Files
Netcatty/domain/models/workspace.ts
T
chin d136c52aef fix(tabs): flag explicitly-titled workspaces instead of a title-string sentinel
Codex P2: resolveWorkspaceTabLabel treated any workspace whose title equals
"Workspace" as an untouched default and replaced it with a host label — so a
workspace a user renamed to "Workspace" (or a snippet named "Workspace")
lost its chosen name.

Add an explicit Workspace.autoTitle flag. It is authoritative when present:
- set false on user rename, snippet-created, named "New Workspace", and any
  createWorkspaceFromTargets call given an explicit name;
- absent/true means the tab may derive a host label.
Legacy workspaces without the flag fall back to the old default-title string
check, so already-open default splits still get host labels and previously
renamed workspaces keep their names.

- domain/models/workspace.ts: add autoTitle field.
- domain/workspace.ts: thread autoTitle through createWorkspaceFromSessionIds.
- application/state/useSessionState.ts: mark rename / snippet / named
  creation paths as explicit; createWorkspaceFromTargets takes an optional
  name and only marks custom when one is given.
- domain/sessionTabTitle.ts: derive only when autoTitle (with legacy string
  fallback); tests for explicit "Workspace" name and explicit auto-title.
2026-08-01 19:11:26 +08:00

42 lines
1.5 KiB
TypeScript

export interface RemoteFile {
name: string;
type: 'file' | 'directory' | 'symlink';
size: string;
lastModified: string;
linkTarget?: 'file' | 'directory' | null; // For symlinks: the type of the target, or null if broken
permissions?: string; // rwx format for owner/group/others e.g. "rwxr-xr-x"
hidden?: boolean; // Windows hidden attribute (only set for local Windows filesystem)
}
export type WorkspaceNode =
| {
id: string;
type: 'pane';
sessionId: string;
}
| {
id: string;
type: 'split';
direction: 'horizontal' | 'vertical';
children: WorkspaceNode[];
sizes?: number[]; // relative sizes for children
};
export type WorkspaceViewMode = 'split' | 'focus';
export interface Workspace {
id: string;
title: string;
root: WorkspaceNode;
viewMode?: WorkspaceViewMode; // 'split' = tiled view (default), 'focus' = left list + single terminal
focusedSessionId?: string; // Which session is focused when in focus mode
focusSessionOrder?: string[]; // User-defined session order for the focus-mode sidebar
snippetId?: string; // If this workspace was created from running a snippet
// Whether `title` is an explicit name the user/caller chose. `false` means a
// user rename or a named-at-creation workspace; `true`/absent means the tab
// may derive a host-based label instead of showing the generic default.
// Absent on legacy workspaces — the tab falls back to the default-title
// string check for those. See resolveWorkspaceTabLabel.
autoTitle?: boolean;
}