@acryldev/workspace 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +61 -2
- package/cordis.patch.yml +3 -0
- package/lib/agents/argument-text.d.ts +9 -0
- package/lib/agents/catalog.d.ts +32 -0
- package/lib/agents/contract.d.ts +50 -0
- package/lib/agents/definition.d.ts +38 -0
- package/lib/agents/file-store.d.ts +7 -0
- package/lib/agents/known-agents.d.ts +52 -0
- package/lib/agents/launch.d.ts +26 -0
- package/lib/agents/preferences.d.ts +40 -0
- package/lib/agents/route.d.ts +10 -0
- package/lib/agents/settings.d.ts +28 -0
- package/lib/agents/status/agent-status.d.ts +38 -0
- package/lib/agents/status/claude-hooks.d.ts +18 -0
- package/lib/agents/status/route.d.ts +10 -0
- package/lib/capabilities/contract.d.ts +17 -0
- package/lib/capabilities/route.d.ts +8 -0
- package/lib/client.js +91109 -0
- package/lib/client.js.map +1 -0
- package/lib/files/contract.d.ts +74 -0
- package/lib/files/route.d.ts +9 -0
- package/lib/files/service.d.ts +48 -0
- package/lib/folder-picker/contract.d.ts +9 -0
- package/lib/folder-picker/picker.d.ts +23 -0
- package/lib/folder-picker/route.d.ts +5 -0
- package/lib/git/changes.d.ts +29 -0
- package/lib/git/checks.d.ts +8 -0
- package/lib/git/commits.d.ts +14 -0
- package/lib/git/contract.d.ts +136 -0
- package/lib/git/errors.d.ts +9 -0
- package/lib/git/guards.d.ts +9 -0
- package/lib/git/ignored.d.ts +9 -0
- package/lib/git/parsing.d.ts +13 -0
- package/lib/git/route.d.ts +9 -0
- package/lib/git/runner.d.ts +29 -0
- package/lib/git/search.d.ts +14 -0
- package/lib/git/service.d.ts +52 -0
- package/lib/git/worktrees.d.ts +26 -0
- package/lib/index.d.ts +39 -0
- package/lib/index.js +3799 -0
- package/lib/index.js.map +1 -0
- package/lib/private-route.d.ts +15 -0
- package/lib/projects/contract.d.ts +82 -0
- package/lib/projects/registry.d.ts +73 -0
- package/lib/projects/route.d.ts +16 -0
- package/lib/projects/tools.d.ts +24 -0
- package/lib/pty/contract.d.ts +52 -0
- package/lib/pty/node-pty-spawn.d.ts +3 -0
- package/lib/pty/route.d.ts +9 -0
- package/lib/pty/screen-model.d.ts +25 -0
- package/lib/pty/scrollback.d.ts +26 -0
- package/lib/pty/service.d.ts +156 -0
- package/lib/pty/stream.d.ts +19 -0
- package/lib/shared-context/chat.d.ts +34 -0
- package/lib/shared-context/launch.d.ts +24 -0
- package/lib/shared-context/render.d.ts +29 -0
- package/lib/shared-context/route.d.ts +13 -0
- package/lib/shared-context/service.d.ts +65 -0
- package/lib/shared-context/tool.d.ts +20 -0
- package/lib/types/agents/argument-text.d.ts +9 -0
- package/lib/types/agents/contract.d.ts +50 -0
- package/lib/types/agents/definition.d.ts +38 -0
- package/lib/types/agents/known-agents.d.ts +52 -0
- package/lib/types/agents/launch.d.ts +26 -0
- package/lib/types/agents/preferences.d.ts +40 -0
- package/lib/types/agents/status/agent-status.d.ts +38 -0
- package/lib/types/capabilities/contract.d.ts +17 -0
- package/lib/types/client/agents/AddAgentForm.d.ts +10 -0
- package/lib/types/client/agents/AgentRow.d.ts +11 -0
- package/lib/types/client/agents/AgentsSection.d.ts +14 -0
- package/lib/types/client/agents/acryl-logo-data.d.ts +3 -0
- package/lib/types/client/agents/agent-draft.d.ts +24 -0
- package/lib/types/client/agents/agents-api.d.ts +18 -0
- package/lib/types/client/agents/agents-section-model.d.ts +45 -0
- package/lib/types/client/agents/agents-settings-plugin.d.ts +8 -0
- package/lib/types/client/agents/agents-state.d.ts +26 -0
- package/lib/types/client/agents/controls.d.ts +40 -0
- package/lib/types/client/board/NoteColumn.d.ts +17 -0
- package/lib/types/client/board/SessionBoardPane.d.ts +16 -0
- package/lib/types/client/board/board-model.d.ts +36 -0
- package/lib/types/client/browser/BrowserPane.d.ts +28 -0
- package/lib/types/client/canvas/SplitDivider.d.ts +9 -0
- package/lib/types/client/canvas/WorkspaceCanvas.d.ts +78 -0
- package/lib/types/client/canvas/groups.d.ts +47 -0
- package/lib/types/client/canvas/persist.d.ts +17 -0
- package/lib/types/client/canvas/persistence.d.ts +78 -0
- package/lib/types/client/canvas/shell-requests.d.ts +16 -0
- package/lib/types/client/canvas/split-ratio.d.ts +12 -0
- package/lib/types/client/canvas/state.d.ts +181 -0
- package/lib/types/client/canvas/tab-title.d.ts +7 -0
- package/lib/types/client/capabilities/capabilities-api.d.ts +8 -0
- package/lib/types/client/changes/ChangesBody.d.ts +14 -0
- package/lib/types/client/changes/changes-tab.d.ts +20 -0
- package/lib/types/client/chat/chat-selection.d.ts +70 -0
- package/lib/types/client/chat/composer-focus.d.ts +16 -0
- package/lib/types/client/checks/ChecksBody.d.ts +9 -0
- package/lib/types/client/checks/checks-tab.d.ts +12 -0
- package/lib/types/client/chrome/StatusLine.d.ts +11 -0
- package/lib/types/client/chrome/panel-icons.d.ts +16 -0
- package/lib/types/client/chrome/status-line.d.ts +19 -0
- package/lib/types/client/chrome/worktree-agents.d.ts +13 -0
- package/lib/types/client/comments/CommentsBody.d.ts +24 -0
- package/lib/types/client/comments/comment-store.d.ts +38 -0
- package/lib/types/client/comments/comments-tab.d.ts +14 -0
- package/lib/types/client/comments/editor-comments.d.ts +6 -0
- package/lib/types/client/comments/terminal-targets.d.ts +35 -0
- package/lib/types/client/comments/use-comments.d.ts +27 -0
- package/lib/types/client/connection/session-banner.d.ts +51 -0
- package/lib/types/client/diff/GitDiffPane.d.ts +27 -0
- package/lib/types/client/diff/TextDiffPane.d.ts +6 -0
- package/lib/types/client/diff/comment-message.d.ts +29 -0
- package/lib/types/client/diff/diff-layout.d.ts +4 -0
- package/lib/types/client/diff/line-diff.d.ts +14 -0
- package/lib/types/client/diff/unified-diff.d.ts +31 -0
- package/lib/types/client/dock/DockButtons.d.ts +19 -0
- package/lib/types/client/dock/DockColumns.d.ts +21 -0
- package/lib/types/client/dock/DockDivider.d.ts +13 -0
- package/lib/types/client/dock/TerminalDockPanel.d.ts +13 -0
- package/lib/types/client/dock/dock-controller.d.ts +55 -0
- package/lib/types/client/dock/dock-hooks.d.ts +6 -0
- package/lib/types/client/dock/dock-host.d.ts +14 -0
- package/lib/types/client/dock/dock-icons.d.ts +10 -0
- package/lib/types/client/dock/dock-model.d.ts +35 -0
- package/lib/types/client/dock/dock-tabs.d.ts +72 -0
- package/lib/types/client/dock/terminal-stack.d.ts +19 -0
- package/lib/types/client/docs/DocFilePane.d.ts +12 -0
- package/lib/types/client/docs/DocPane.d.ts +6 -0
- package/lib/types/client/docs/DocView.d.ts +5 -0
- package/lib/types/client/docs/doc-format.d.ts +46 -0
- package/lib/types/client/dom/find-by-name.d.ts +18 -0
- package/lib/types/client/files/CodeEditor.d.ts +19 -0
- package/lib/types/client/files/FileBreadcrumbs.d.ts +15 -0
- package/lib/types/client/files/FileEditorPane.d.ts +12 -0
- package/lib/types/client/files/FileTree.d.ts +25 -0
- package/lib/types/client/files/FilesBody.d.ts +14 -0
- package/lib/types/client/files/ScratchFilePane.d.ts +6 -0
- package/lib/types/client/files/breadcrumbs.d.ts +18 -0
- package/lib/types/client/files/file-edit.d.ts +20 -0
- package/lib/types/client/files/file-icons.d.ts +17 -0
- package/lib/types/client/files/files-api.d.ts +26 -0
- package/lib/types/client/files/files-tab.d.ts +25 -0
- package/lib/types/client/files/line-comment.d.ts +26 -0
- package/lib/types/client/files/line-comments.d.ts +48 -0
- package/lib/types/client/files/tree-model.d.ts +60 -0
- package/lib/types/client/git/git-api.d.ts +35 -0
- package/lib/types/client/index.d.ts +28 -0
- package/lib/types/client/models/ModelConnect.d.ts +13 -0
- package/lib/types/client/models/model-connect.d.ts +145 -0
- package/lib/types/client/notifications/Toasts.d.ts +6 -0
- package/lib/types/client/notifications/system-notice.d.ts +19 -0
- package/lib/types/client/notifications/toast-state.d.ts +29 -0
- package/lib/types/client/palette/CommandPalette.d.ts +9 -0
- package/lib/types/client/palette/PalettePanel.d.ts +10 -0
- package/lib/types/client/palette/file-search.d.ts +9 -0
- package/lib/types/client/palette/fuzzy.d.ts +15 -0
- package/lib/types/client/palette/palette-commands.d.ts +64 -0
- package/lib/types/client/palette/palette-config.d.ts +21 -0
- package/lib/types/client/palette/palette-items.d.ts +40 -0
- package/lib/types/client/palette/palette-settings-plugin.d.ts +8 -0
- package/lib/types/client/palette/palette-shortcut.d.ts +10 -0
- package/lib/types/client/palette/palette-state.d.ts +68 -0
- package/lib/types/client/palette/use-workspace-palette.d.ts +39 -0
- package/lib/types/client/projects/NewWorkspaceDialog.d.ts +21 -0
- package/lib/types/client/projects/ProjectsSidebar.d.ts +39 -0
- package/lib/types/client/projects/RepoSection.d.ts +29 -0
- package/lib/types/client/projects/WorkspaceStrip.d.ts +14 -0
- package/lib/types/client/projects/projects-control.d.ts +119 -0
- package/lib/types/client/projects/registry-api.d.ts +22 -0
- package/lib/types/client/projects/registry-state.d.ts +67 -0
- package/lib/types/client/projects/shown-workspace.d.ts +19 -0
- package/lib/types/client/projects/sidebar-model.d.ts +113 -0
- package/lib/types/client/projects/upstream-panels.d.ts +54 -0
- package/lib/types/client/projects/web-folder-picker.d.ts +13 -0
- package/lib/types/client/review/ReviewBody.d.ts +9 -0
- package/lib/types/client/review/review-store.d.ts +46 -0
- package/lib/types/client/review/review-tab.d.ts +15 -0
- package/lib/types/client/sessions/agent-bridge.d.ts +20 -0
- package/lib/types/client/sessions/main-session.d.ts +24 -0
- package/lib/types/client/sessions/running-agents.d.ts +9 -0
- package/lib/types/client/sessions/session-client.d.ts +22 -0
- package/lib/types/client/sessions/session-navigation.d.ts +63 -0
- package/lib/types/client/sessions/session-pick.d.ts +15 -0
- package/lib/types/client/settings/locales.d.ts +5 -0
- package/lib/types/client/settings/open-settings.d.ts +37 -0
- package/lib/types/client/settings/section-plugin.d.ts +39 -0
- package/lib/types/client/settings/styles.d.ts +3 -0
- package/lib/types/client/shared-context/BriefTab.d.ts +21 -0
- package/lib/types/client/shared-context/brief-api.d.ts +9 -0
- package/lib/types/client/status/agent-status-api.d.ts +10 -0
- package/lib/types/client/status/agent-status-state.d.ts +27 -0
- package/lib/types/client/status/attention-model.d.ts +20 -0
- package/lib/types/client/styles.d.ts +2 -0
- package/lib/types/client/tabs/AgentIcon.d.ts +12 -0
- package/lib/types/client/tabs/NewTabMenu.d.ts +42 -0
- package/lib/types/client/tabs/TabActivity.d.ts +7 -0
- package/lib/types/client/tabs/TabStrip.d.ts +53 -0
- package/lib/types/client/tabs/TabsPanel.d.ts +14 -0
- package/lib/types/client/tabs/agent-marks.d.ts +9 -0
- package/lib/types/client/tabs/agent-visibility.d.ts +11 -0
- package/lib/types/client/tabs/last-tab.d.ts +15 -0
- package/lib/types/client/tabs/registry/CustomTabPane.d.ts +13 -0
- package/lib/types/client/tabs/registry/provide.d.ts +11 -0
- package/lib/types/client/tabs/registry/tab-registry.d.ts +52 -0
- package/lib/types/client/tabs/tab-close.d.ts +4 -0
- package/lib/types/client/tabs/tab-scroll.d.ts +19 -0
- package/lib/types/client/tabs/tab-types-state.d.ts +24 -0
- package/lib/types/client/tabs/tabs-settings-plugin.d.ts +9 -0
- package/lib/types/client/terminal/PtyPane.d.ts +8 -0
- package/lib/types/client/terminal/TerminalSearchBar.d.ts +7 -0
- package/lib/types/client/terminal/agent-commands.d.ts +15 -0
- package/lib/types/client/terminal/gpu-renderer.d.ts +10 -0
- package/lib/types/client/terminal/pty-api.d.ts +21 -0
- package/lib/types/client/terminal/pty-stream.d.ts +46 -0
- package/lib/types/client/terminal/terminal-links.d.ts +9 -0
- package/lib/types/client/terminal/terminal-search.d.ts +18 -0
- package/lib/types/client/terminal/terminal-session.d.ts +105 -0
- package/lib/types/client/terminal/terminal-size.d.ts +7 -0
- package/lib/types/client/ui.d.ts +18 -0
- package/lib/types/client/worktrees/shell-polling.d.ts +10 -0
- package/lib/types/client/worktrees/shell-state.d.ts +200 -0
- package/lib/types/files/contract.d.ts +74 -0
- package/lib/types/folder-picker/contract.d.ts +9 -0
- package/lib/types/git/contract.d.ts +136 -0
- package/lib/types/projects/contract.d.ts +82 -0
- package/lib/types/pty/contract.d.ts +52 -0
- package/lib/ui.js +12735 -0
- package/lib/ui.js.map +1 -0
- package/package.json +147 -4
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** The agents the page knows about, shared by the "+" menu, the tab icons and Settings > Agents. */
|
|
2
|
+
import type { AgentSettingsView } from '../../agents/contract.ts';
|
|
3
|
+
import type { CustomAgent } from '../../agents/definition.ts';
|
|
4
|
+
import type { PreferencesPatch } from '../../agents/preferences.ts';
|
|
5
|
+
import type { WorkspaceAgentsApi } from './agents-api.ts';
|
|
6
|
+
export declare class AgentsState {
|
|
7
|
+
private readonly api;
|
|
8
|
+
private agents;
|
|
9
|
+
private view;
|
|
10
|
+
private readonly listeners;
|
|
11
|
+
constructor(api: WorkspaceAgentsApi);
|
|
12
|
+
/** The user's own agents. */
|
|
13
|
+
getSnapshot: () => readonly CustomAgent[];
|
|
14
|
+
/** Settings and detection for every agent, or null until the Host has answered (or when it has no such route). */
|
|
15
|
+
getSettings: () => AgentSettingsView | null;
|
|
16
|
+
subscribe: (listener: () => void) => (() => void);
|
|
17
|
+
/** Load the catalog and the settings; a Host without the routes just means no custom agents and no settings. */
|
|
18
|
+
refresh(): Promise<void>;
|
|
19
|
+
/** @throws an Error whose message says what to fix. */
|
|
20
|
+
add(agent: CustomAgent): Promise<void>;
|
|
21
|
+
remove(id: string): Promise<void>;
|
|
22
|
+
/** @throws an Error whose message says what to fix. */
|
|
23
|
+
change(patch: PreferencesPatch): Promise<void>;
|
|
24
|
+
private reloadSettings;
|
|
25
|
+
private notify;
|
|
26
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** Small controls shared by the Agents settings rows. */
|
|
2
|
+
export interface SegmentedProps {
|
|
3
|
+
readonly label: string;
|
|
4
|
+
readonly value: string;
|
|
5
|
+
readonly options: readonly {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly label: string;
|
|
8
|
+
}[];
|
|
9
|
+
onChange(id: string): void;
|
|
10
|
+
}
|
|
11
|
+
/** A two-or-three way switch drawn as joined buttons; exactly one is checked. */
|
|
12
|
+
export declare function Segmented({ label, value, options, onChange }: SegmentedProps): import("react").JSX.Element;
|
|
13
|
+
export declare function ExternalLinkIcon(): import("react").JSX.Element;
|
|
14
|
+
/** A small chevron that points down, or up when `open`. */
|
|
15
|
+
export declare function ChevronIcon({ open }: {
|
|
16
|
+
readonly open: boolean;
|
|
17
|
+
}): import("react").JSX.Element;
|
|
18
|
+
/** AcrylDSH Chat's own mark, distinct from any agent runtime's icon (spec 040 T130) - a chat bubble. */
|
|
19
|
+
export declare function ChatIcon(): import("react").JSX.Element;
|
|
20
|
+
/** A workspace's own mark when it is a git repository, distinct from a plain folder's. */
|
|
21
|
+
export declare function GitRepoIcon(): import("react").JSX.Element;
|
|
22
|
+
/** A workspace's own mark when it is a plain folder, not a git repository. */
|
|
23
|
+
export declare function FolderIcon(): import("react").JSX.Element;
|
|
24
|
+
/**
|
|
25
|
+
* The real ACRYL mark for the tree's own header (the upstream sidebar's chrome, which showed it, is hidden).
|
|
26
|
+
*
|
|
27
|
+
* `dsh-client-ui-brand-acryl`'s client entry is a Cordis-loader-format bundle
|
|
28
|
+
* (`window.__ModuleLoader__.load(...)`), built to be consumed only through the sidebar's own brand-mark
|
|
29
|
+
* slot - not importable as a plain React component (confirmed by a real `ReferenceError: window is not
|
|
30
|
+
* defined` when tried directly). Rather than substitute a made-up mark, this reads the real source PNGs
|
|
31
|
+
* from `acryl-logo-data.ts` (generated by `scripts/generate-acryl-logo-data.mjs` from the same
|
|
32
|
+
* workspace-root `acryl-logo.png`/`acryl-logo-white.png` that `dsh-client-ui-brand-acryl`'s own
|
|
33
|
+
* generator and `acryl-desktop`'s own generator already read for the identical purpose) - a third,
|
|
34
|
+
* independent reader of that one shared source, not a copy of either sibling package's internals.
|
|
35
|
+
*/
|
|
36
|
+
export declare function AcrylMarkIcon({ size }: {
|
|
37
|
+
readonly size?: number;
|
|
38
|
+
}): import("react").JSX.Element;
|
|
39
|
+
/** Two-pane "collapse sidebar" mark for the tree's own header. */
|
|
40
|
+
export declare function CollapseSidebarIcon(): import("react").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One column of the local notes board. Cards are dragged with the browser's own drag and drop: pick one up,
|
|
3
|
+
* drop it on a column to append, or on another card to place it just before that card. The move itself is
|
|
4
|
+
* `WorkspaceState.moveCard`; this component only reports where the card was dropped.
|
|
5
|
+
*/
|
|
6
|
+
import type { KanbanCard, KanbanColumnId } from '../canvas/state.ts';
|
|
7
|
+
export declare const NOTE_DRAG_TYPE = "application/x-acryl-note";
|
|
8
|
+
export interface NoteColumnProps {
|
|
9
|
+
readonly id: KanbanColumnId;
|
|
10
|
+
readonly title: string;
|
|
11
|
+
readonly cards: readonly KanbanCard[];
|
|
12
|
+
/** A card was dropped here; `index` is where it goes (the card count when dropped on the column itself). */
|
|
13
|
+
onDrop(cardId: string, column: KanbanColumnId, index: number): void;
|
|
14
|
+
/** Rendered under the cards (the add-a-note field). */
|
|
15
|
+
readonly footer?: React.ReactNode;
|
|
16
|
+
}
|
|
17
|
+
export declare function NoteColumn({ id, title, cards, onDrop, footer }: NoteColumnProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Kanban tile: one card per chat, in the column that says what its agent is doing (Ready, Running, Done),
|
|
3
|
+
* updated live from the session list, plus three local note columns (To do, Doing, Done) whose cards are dragged between columns.
|
|
4
|
+
*/
|
|
5
|
+
import type { UseSessions } from '@acryldev/ui/frame';
|
|
6
|
+
import type { WorkspaceState, WorkspaceTile } from '../canvas/state.ts';
|
|
7
|
+
import type { SessionNavigator } from '../chat/chat-selection.ts';
|
|
8
|
+
import type { WorkspaceShellState } from '../worktrees/shell-state.ts';
|
|
9
|
+
export interface SessionBoardPaneProps {
|
|
10
|
+
readonly tile: WorkspaceTile;
|
|
11
|
+
readonly workspace: WorkspaceState;
|
|
12
|
+
readonly shell: WorkspaceShellState;
|
|
13
|
+
readonly useSessions: UseSessions;
|
|
14
|
+
readonly navigator: SessionNavigator;
|
|
15
|
+
}
|
|
16
|
+
export declare function SessionBoardPane({ tile, workspace, shell, useSessions, navigator }: SessionBoardPaneProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** Pure model of the live session board: chats grouped by what their agent is doing right now. */
|
|
2
|
+
import type { RepoState } from '../worktrees/shell-state.ts';
|
|
3
|
+
/** The slice of a session row the board needs (a `SessionSummary` fits). */
|
|
4
|
+
export interface BoardSession {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly cwd?: string;
|
|
7
|
+
readonly running: boolean;
|
|
8
|
+
readonly blank: boolean;
|
|
9
|
+
readonly updatedAt: number;
|
|
10
|
+
readonly origin?: string;
|
|
11
|
+
readonly displayTitle: string;
|
|
12
|
+
readonly title?: string;
|
|
13
|
+
}
|
|
14
|
+
export type BoardColumnId = 'ready' | 'running' | 'done';
|
|
15
|
+
export interface BoardCard {
|
|
16
|
+
readonly sessionId: string;
|
|
17
|
+
/** The chat's name, as the tree and its tab show it. */
|
|
18
|
+
readonly title: string;
|
|
19
|
+
/** The branch (or worktree folder) the chat works in, or null when its folder is in no known worktree. */
|
|
20
|
+
readonly branch: string | null;
|
|
21
|
+
readonly cwd: string | undefined;
|
|
22
|
+
readonly updatedAt: number;
|
|
23
|
+
}
|
|
24
|
+
export interface BoardColumn {
|
|
25
|
+
readonly id: BoardColumnId;
|
|
26
|
+
readonly label: string;
|
|
27
|
+
readonly cards: readonly BoardCard[];
|
|
28
|
+
}
|
|
29
|
+
/** How many finished chats the Done column lists; older ones stay reachable from the chat list. */
|
|
30
|
+
export declare const DONE_LIMIT = 30;
|
|
31
|
+
/**
|
|
32
|
+
* @param sessions - every session row; subagent rows are left out (they belong to their parent chat).
|
|
33
|
+
* @param repos - the discovered repositories, to name each chat's branch.
|
|
34
|
+
* @returns Ready (blank chats), Running, and Done (finished chats, newest first, capped), in that order.
|
|
35
|
+
*/
|
|
36
|
+
export declare function buildSessionBoard(sessions: readonly BoardSession[], repos: readonly RepoState[]): BoardColumn[];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** The browser tab: an address bar and a sandboxed frame. */
|
|
2
|
+
import { type WorkspaceState, type WorkspaceTile } from '../canvas/state.ts';
|
|
3
|
+
/** How many loads a same-origin transport error gets per press: the press itself and two automatic reloads. */
|
|
4
|
+
export declare const BROWSER_LOAD_ATTEMPTS = 3;
|
|
5
|
+
/** How long between those automatic reloads. */
|
|
6
|
+
export declare const BROWSER_LOAD_RETRY_MS = 250;
|
|
7
|
+
/**
|
|
8
|
+
* Whether a finished tile load is the browser's own error page for one of this page's own addresses, so it should be loaded again.
|
|
9
|
+
*
|
|
10
|
+
* A same-origin document always exposes `contentDocument`; null therefore means Chrome put its error page there (the request was reset or
|
|
11
|
+
* refused), never a real page. A cross-origin page also hides its document, and is never retried: a healthy external page would otherwise
|
|
12
|
+
* load twice. The attempt budget keeps a genuinely dead address from looping; it settles on the browser's error page.
|
|
13
|
+
*
|
|
14
|
+
* Only a frame's first load answers for its `src`. Every later load is the page's own doing (a link it followed, its own reload, a door
|
|
15
|
+
* navigation), and an unreadable one there is a page the person or the app went to, not an error to undo: reloading it would replace a live
|
|
16
|
+
* page, with whatever run it holds, by the address the tab was opened at.
|
|
17
|
+
*/
|
|
18
|
+
export declare function shouldRetryBrowserLoad(options: {
|
|
19
|
+
readonly src: string | null;
|
|
20
|
+
readonly topOrigin: string;
|
|
21
|
+
readonly documentReadable: boolean;
|
|
22
|
+
readonly retries: number;
|
|
23
|
+
readonly firstLoad: boolean;
|
|
24
|
+
}): boolean;
|
|
25
|
+
export declare function BrowserPane({ tile, workspace, }: {
|
|
26
|
+
tile: WorkspaceTile;
|
|
27
|
+
workspace: WorkspaceState;
|
|
28
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
export interface SplitDividerProps {
|
|
3
|
+
/** The stage the two panes live in; its box turns pointer positions into a ratio. */
|
|
4
|
+
readonly stage: RefObject<HTMLElement | null>;
|
|
5
|
+
readonly ratio: number;
|
|
6
|
+
readonly onRatio: (ratio: number) => void;
|
|
7
|
+
}
|
|
8
|
+
/** The draggable, keyboard-operable bar between the primary and the split pane. */
|
|
9
|
+
export declare function SplitDivider({ stage, ratio, onRatio }: SplitDividerProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/** Advanced-mode ADE workspace: one tile fills the main content area. */
|
|
2
|
+
import type { PropsRuntime, UseSessions } from '@acryldev/ui/frame';
|
|
3
|
+
import { type ReactNode } from 'react';
|
|
4
|
+
import type { AgentBridge } from '../sessions/agent-bridge.ts';
|
|
5
|
+
import type { WorkspaceGitApi } from '../git/git-api.ts';
|
|
6
|
+
import type { ChatSelection } from '../chat/chat-selection.ts';
|
|
7
|
+
import type { WorkspaceFilesApi } from '../files/files-api.ts';
|
|
8
|
+
import type { ReviewStore } from '../review/review-store.ts';
|
|
9
|
+
import type { CommentStore } from '../comments/comment-store.ts';
|
|
10
|
+
import type { TerminalRegistry } from '../terminal/terminal-session.ts';
|
|
11
|
+
import { type SystemNoticePort } from '../notifications/system-notice.ts';
|
|
12
|
+
import type { ModelConnectControl } from '../models/model-connect.ts';
|
|
13
|
+
import { type ToastState } from '../notifications/toast-state.ts';
|
|
14
|
+
import type { AgentsState } from '../agents/agents-state.ts';
|
|
15
|
+
import { type WorkspaceGroups } from './groups.ts';
|
|
16
|
+
import type { WorkspaceShellState } from '../worktrees/shell-state.ts';
|
|
17
|
+
import type { WorkspaceTabRegistry } from '../tabs/registry/tab-registry.ts';
|
|
18
|
+
import type { AgentStatusState } from '../status/agent-status-state.ts';
|
|
19
|
+
import type { DockController } from '../dock/dock-controller.ts';
|
|
20
|
+
import type { RightPaneHandle } from '../dock/DockButtons.tsx';
|
|
21
|
+
import type { PaletteConfigState } from '../palette/palette-config.ts';
|
|
22
|
+
import type { TabTypesState } from '../tabs/tab-types-state.ts';
|
|
23
|
+
import { type FrameSessionBanner } from '../connection/session-banner.ts';
|
|
24
|
+
import { type WorkspacePtyApi } from '../terminal/pty-api.ts';
|
|
25
|
+
import type { ProjectsControl } from '../projects/projects-control.ts';
|
|
26
|
+
export type WorkspaceCanvasProps = Omit<PropsRuntime<'root'>, 'useSessions'> & {
|
|
27
|
+
readonly renderConversation: () => ReactNode;
|
|
28
|
+
readonly ptyApi?: WorkspacePtyApi;
|
|
29
|
+
/** The live terminals, owned by the composition root so they end with the plugin, not with a render. */
|
|
30
|
+
readonly terminals: TerminalRegistry;
|
|
31
|
+
/** The user's custom agents, for the "+" menu and the tab icons. */
|
|
32
|
+
readonly agents: AgentsState;
|
|
33
|
+
/** Which tab types are turned on (Settings > Tabs). */
|
|
34
|
+
readonly tabTypes: TabTypesState;
|
|
35
|
+
/** The tab types plugins registered. */
|
|
36
|
+
readonly tabRegistry: WorkspaceTabRegistry;
|
|
37
|
+
/** What the command palette lists (Settings > Command palette). */
|
|
38
|
+
readonly paletteConfig: PaletteConfigState;
|
|
39
|
+
/** Notices such as "Claude finished", fed from the terminals' exits. */
|
|
40
|
+
readonly toasts: ToastState;
|
|
41
|
+
/** Notices outside the page; permission is asked for by a button, never on load. */
|
|
42
|
+
readonly notices: SystemNoticePort;
|
|
43
|
+
readonly useSessions: UseSessions;
|
|
44
|
+
/** Shared shell state: which worktree is selected, and the channel for open-diff requests. */
|
|
45
|
+
readonly shell: WorkspaceShellState;
|
|
46
|
+
/** One tab workspace per worktree. Owned by the plugin so it can be saved and restored. */
|
|
47
|
+
readonly groups: WorkspaceGroups;
|
|
48
|
+
readonly gitApi: WorkspaceGitApi;
|
|
49
|
+
/** Reads and saves real files for the editor tabs. */
|
|
50
|
+
readonly filesApi: WorkspaceFilesApi;
|
|
51
|
+
/** Delivers diff line comments to the open chat's agent. */
|
|
52
|
+
readonly agent: AgentBridge;
|
|
53
|
+
/** Which chat is shown: tab selection and the board's cards go through it. */
|
|
54
|
+
readonly chats: ChatSelection;
|
|
55
|
+
/** Remembers each comment sent, for the Review tab. */
|
|
56
|
+
readonly review: ReviewStore;
|
|
57
|
+
/** Line comments from files, kept until the user copies or sends them. */
|
|
58
|
+
readonly comments: CommentStore;
|
|
59
|
+
/** Opens and closes the right panel. Always available, even for a chat that has no header yet. */
|
|
60
|
+
readonly rightPanel?: RightPaneHandle;
|
|
61
|
+
/** The terminal dock: its buttons sit in the tab strip, and the frame places its panel. */
|
|
62
|
+
readonly dock: DockController;
|
|
63
|
+
/** What terminal agents report (working, waiting for you, done). */
|
|
64
|
+
readonly agentStatus: AgentStatusState;
|
|
65
|
+
/** Starts a brand new AcrylDSH Chat session in this worktree, for the "+" menu's own chat entry. */
|
|
66
|
+
readonly projects: ProjectsControl;
|
|
67
|
+
/** First-run setup: shown inside the chat surface while no model can serve a request. */
|
|
68
|
+
readonly connectModel?: ModelConnectControl;
|
|
69
|
+
/** The frame's own session: its banner names the way back in when the browser session ended, instead of an endless reconnect. */
|
|
70
|
+
readonly frameSession: FrameSessionBanner;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Tab workspace that replaces the advanced-mode conversation surface with a tile-based canvas:
|
|
74
|
+
* Chat/Terminal/File/Browser (ported from the reference `acryl-development-canvas` plugin) plus
|
|
75
|
+
* Diff/Kanban/Doc (new, spec 040).
|
|
76
|
+
* @param props.renderConversation - upstream Chat slot, rendered by the Chat tile.
|
|
77
|
+
*/
|
|
78
|
+
export declare function WorkspaceCanvas({ renderConversation, ptyApi, terminals, dock, agentStatus, agents: agentsState, tabTypes, tabRegistry, paletteConfig, toasts, notices, useSessions, shell, groups, gitApi, filesApi, agent, chats, review, comments, rightPanel, projects, connectModel, frameSession }: WorkspaceCanvasProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One independent tab workspace per worktree and per shown workspace (spec 043 Q2), so switching branch, or switching
|
|
3
|
+
* workspace, swaps the whole set of tabs.
|
|
4
|
+
*/
|
|
5
|
+
import type { SavedGroup } from './persistence.ts';
|
|
6
|
+
import { WorkspaceState } from './state.ts';
|
|
7
|
+
/** The key used before any worktree is selected. */
|
|
8
|
+
export declare const GLOBAL_GROUP = "";
|
|
9
|
+
/** The key a group is saved under: the worktree alone for Default (as before workspaces), else workspace and worktree. */
|
|
10
|
+
export declare function savedGroupKey(workspace: string, worktree: string): string;
|
|
11
|
+
/** Where a saved key's tab set lives: its workspace and worktree. */
|
|
12
|
+
export declare function groupLocation(savedKey: string): {
|
|
13
|
+
readonly workspace: string;
|
|
14
|
+
readonly worktree: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Lazily created {@link WorkspaceState} per worktree key (a worktree path, or {@link GLOBAL_GROUP}) in the shown workspace.
|
|
18
|
+
* Groups are kept for the lifetime of the canvas: leaving a branch or a workspace leaves its tabs, and any terminals or
|
|
19
|
+
* agents in them, running in the background until their tab is closed.
|
|
20
|
+
*/
|
|
21
|
+
export declare class WorkspaceGroups {
|
|
22
|
+
private readonly create;
|
|
23
|
+
private readonly saved;
|
|
24
|
+
private readonly states;
|
|
25
|
+
private readonly listeners;
|
|
26
|
+
private scope;
|
|
27
|
+
/**
|
|
28
|
+
* @param create - factory for a group's workspace.
|
|
29
|
+
* @param saved - groups saved by a previous run, by {@link savedGroupKey}; each is restored when its key is first used.
|
|
30
|
+
*/
|
|
31
|
+
constructor(create?: () => WorkspaceState, saved?: Readonly<Record<string, SavedGroup>>);
|
|
32
|
+
/** The workspace whose tab sets {@link stateFor} and {@link keys} answer for. */
|
|
33
|
+
workspace(): string;
|
|
34
|
+
/** Show another workspace's tab sets. */
|
|
35
|
+
setWorkspace(id: string): void;
|
|
36
|
+
/** @returns the shown workspace's tab set for `worktree`, created on first use. */
|
|
37
|
+
stateFor(worktree: string): WorkspaceState;
|
|
38
|
+
/** @returns every worktree key opened in the shown workspace. */
|
|
39
|
+
keys(): readonly string[];
|
|
40
|
+
/** @returns every opened tab set in every workspace, by its saved key (for saving, and for a terminal found by id wherever its tab is). */
|
|
41
|
+
entries(): readonly (readonly [string, WorkspaceState])[];
|
|
42
|
+
/** @returns the saved tab sets no {@link stateFor} has opened yet, by saved key (kept as they were when saving). */
|
|
43
|
+
unopened(): Readonly<Record<string, SavedGroup>>;
|
|
44
|
+
/** Observe the shown workspace changing, a group being opened, or any group's tabs changing. @returns disposer. */
|
|
45
|
+
onChange(listener: () => void): () => void;
|
|
46
|
+
private notify;
|
|
47
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Write the workspace's durable parts to storage when they change. */
|
|
2
|
+
import type { WorkspaceGroups } from './groups.ts';
|
|
3
|
+
import { type StorageLike } from './persistence.ts';
|
|
4
|
+
import type { WorkspaceShellState } from '../worktrees/shell-state.ts';
|
|
5
|
+
export interface PersistenceDeps {
|
|
6
|
+
readonly groups: WorkspaceGroups;
|
|
7
|
+
readonly shell: WorkspaceShellState;
|
|
8
|
+
/** Undefined when storage is unavailable; persistence then does nothing. */
|
|
9
|
+
readonly storage: StorageLike | undefined;
|
|
10
|
+
readonly delayMs?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Save shortly after the last change, and once more on shutdown. Failures (a full or blocked
|
|
14
|
+
* store) are ignored: this is a convenience, and must never disturb the app.
|
|
15
|
+
* @returns disposer, for one owning `ctx.effect`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function startWorkspacePersistence(deps: PersistenceDeps): () => void;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What survives a restart or a page reload: the Chats | Projects choice, per worktree the tabs whose
|
|
3
|
+
* content lives in the renderer (files, diffs, browser pages, docs, boards) and the terminal and agent
|
|
4
|
+
* tabs by the id of the Host terminal behind them, and which repository roots the owner explicitly
|
|
5
|
+
* removed from the tree (`forgetRepo`) - without this, a removal only lasted until the next reload: the
|
|
6
|
+
* passive per-session and per-registered-workspace discovery effects re-add every repo a chat ever ran
|
|
7
|
+
* in or the Host still lists, on every fresh page load, with nothing remembering it was removed (owner
|
|
8
|
+
* report: pressing "x" to remove a workspace, it "always appears back... as if it loads from some
|
|
9
|
+
* persisted config" - the opposite was true: the removal was the part that was never persisted). The
|
|
10
|
+
* Host keeps a terminal running across a page reload, so the tab reattaches to the exact screen; when
|
|
11
|
+
* the Host itself restarted the terminal is gone, the tab finds that out on reconnecting and closes
|
|
12
|
+
* itself. The chat is the session's own record.
|
|
13
|
+
*
|
|
14
|
+
* Stored in the renderer's storage as a convenience, so every read is defensive: anything that does
|
|
15
|
+
* not validate is dropped, never thrown, and never able to break startup.
|
|
16
|
+
*/
|
|
17
|
+
import type { KanbanBoard } from './state.ts';
|
|
18
|
+
import type { ShellMode } from '../worktrees/shell-state.ts';
|
|
19
|
+
import type { WorkspaceGroups } from './groups.ts';
|
|
20
|
+
export declare const STORAGE_KEY = "acryl-workspace:v1";
|
|
21
|
+
declare const RESTORABLE_KINDS: readonly ["file", "browser", "diff", "kanban", "doc", "pty", "custom"];
|
|
22
|
+
export type SavedTileKind = (typeof RESTORABLE_KINDS)[number];
|
|
23
|
+
export interface SavedTile {
|
|
24
|
+
readonly kind: SavedTileKind;
|
|
25
|
+
readonly title: string;
|
|
26
|
+
readonly path?: string;
|
|
27
|
+
readonly content?: string;
|
|
28
|
+
readonly url?: string;
|
|
29
|
+
readonly diffBefore?: string;
|
|
30
|
+
readonly diffAfter?: string;
|
|
31
|
+
readonly diffWorktree?: string;
|
|
32
|
+
readonly diffFile?: string;
|
|
33
|
+
readonly fileWorktree?: string;
|
|
34
|
+
readonly fileRel?: string;
|
|
35
|
+
readonly docWorktree?: string;
|
|
36
|
+
readonly docRel?: string;
|
|
37
|
+
readonly board?: KanbanBoard;
|
|
38
|
+
readonly docText?: string;
|
|
39
|
+
/** A plugin tab: its kind and the state the plugin saved. */
|
|
40
|
+
readonly customType?: string;
|
|
41
|
+
readonly customState?: string;
|
|
42
|
+
/** A terminal or agent tab: the Host terminal it shows and the agent it runs. */
|
|
43
|
+
readonly terminalId?: string;
|
|
44
|
+
readonly commandId?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface SavedGroup {
|
|
47
|
+
readonly tiles: readonly SavedTile[];
|
|
48
|
+
/** Index into `tiles` of the active tab, or -1 when the chat tab was active. */
|
|
49
|
+
readonly active: number;
|
|
50
|
+
/** Index into `tiles` of the tab in the split pane, or -1 when there was no split. */
|
|
51
|
+
readonly split: number;
|
|
52
|
+
}
|
|
53
|
+
export interface SavedWorkspace {
|
|
54
|
+
readonly version: 1;
|
|
55
|
+
readonly mode: ShellMode;
|
|
56
|
+
readonly groups: Readonly<Record<string, SavedGroup>>;
|
|
57
|
+
/** Repository roots explicitly removed from the tree (`WorkspaceShellState.forgetRepo`); absent or
|
|
58
|
+
* empty when none have been. */
|
|
59
|
+
readonly forgottenRoots: readonly string[];
|
|
60
|
+
/** Chat session ids hidden with "x" (`WorkspaceShellState.dismissChat`); absent or empty when none have
|
|
61
|
+
* been. */
|
|
62
|
+
readonly dismissedChats: readonly string[];
|
|
63
|
+
}
|
|
64
|
+
/** The two methods of the Storage interface this module uses. */
|
|
65
|
+
export interface StorageLike {
|
|
66
|
+
getItem(key: string): string | null;
|
|
67
|
+
setItem(key: string, value: string): void;
|
|
68
|
+
}
|
|
69
|
+
/** @returns the page's localStorage, or undefined when it is blocked (private windows, policies). */
|
|
70
|
+
export declare function browserStorage(): StorageLike | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* @param raw - the stored string, or null.
|
|
73
|
+
* @returns the saved state, or undefined when there is none or it does not validate.
|
|
74
|
+
*/
|
|
75
|
+
export declare function parseSavedWorkspace(raw: string | null): SavedWorkspace | undefined;
|
|
76
|
+
/** @returns the JSON to store, staying under the size cap by dropping the largest tiles first. */
|
|
77
|
+
export declare function serializeWorkspace(mode: ShellMode, groups: WorkspaceGroups, forgottenRoots?: readonly string[], dismissedChats?: readonly string[]): string;
|
|
78
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Requests other parts of the workspace send to the tab sets through the shell (the tree, the Changes, Files and Checks tabs): close a tab, open a
|
|
3
|
+
* diff, a file or a document, run a check in a terminal. Each acts on the named worktree's tab set, shown or not.
|
|
4
|
+
*/
|
|
5
|
+
import type { WorkspaceGroups } from './groups.ts';
|
|
6
|
+
import type { WorkspaceShellState } from '../worktrees/shell-state.ts';
|
|
7
|
+
import type { TerminalRegistry } from '../terminal/terminal-session.ts';
|
|
8
|
+
import type { WorkspacePtyApi } from '../terminal/pty-api.ts';
|
|
9
|
+
export interface ShellRequestDeps {
|
|
10
|
+
readonly shell: WorkspaceShellState;
|
|
11
|
+
readonly groups: WorkspaceGroups;
|
|
12
|
+
readonly terminals: Pick<TerminalRegistry, 'release'>;
|
|
13
|
+
readonly api: Pick<WorkspacePtyApi, 'start' | 'write' | 'close'>;
|
|
14
|
+
}
|
|
15
|
+
/** Handle the shell's requests until the returned disposer runs. */
|
|
16
|
+
export declare function routeShellRequests({ shell, groups, terminals, api }: ShellRequestDeps): () => void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Pure maths and storage for the width ratio of the canvas split. Kept apart from React so it is unit-tested. */
|
|
2
|
+
export declare const SPLIT_MIN = 0.2;
|
|
3
|
+
export declare const SPLIT_MAX = 0.8;
|
|
4
|
+
export declare const SPLIT_DEFAULT = 0.5;
|
|
5
|
+
/** One arrow-key press on the divider moves this fraction of the stage width. */
|
|
6
|
+
export declare const SPLIT_KEY_STEP = 0.05;
|
|
7
|
+
/** Clamp to the allowed range; anything that is not a finite number falls back to an even split. */
|
|
8
|
+
export declare function clampSplit(value: number): number;
|
|
9
|
+
/** The primary pane's share of the stage for a pointer at `clientX`, given the stage's box. */
|
|
10
|
+
export declare function ratioFromPointer(clientX: number, left: number, width: number): number;
|
|
11
|
+
export declare function readSplitRatio(storage: Pick<Storage, 'getItem'> | undefined): number;
|
|
12
|
+
export declare function writeSplitRatio(storage: Pick<Storage, 'setItem'> | undefined, ratio: number): void;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/** In-memory ACRYL Workspace tabs. Host PTY sessions bind through tile.terminalId. */
|
|
2
|
+
import type { AgentId } from '../../pty/contract.ts';
|
|
3
|
+
export type WorkspaceTileKind = 'chat' | 'pty' | 'file' | 'browser' | 'diff' | 'kanban' | 'doc' | 'custom';
|
|
4
|
+
export interface KanbanCard {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly text: string;
|
|
7
|
+
}
|
|
8
|
+
export type KanbanColumnId = 'todo' | 'doing' | 'done';
|
|
9
|
+
export type KanbanBoard = Readonly<Record<KanbanColumnId, readonly KanbanCard[]>>;
|
|
10
|
+
export interface WorkspaceTile {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly kind: WorkspaceTileKind;
|
|
13
|
+
readonly title: string;
|
|
14
|
+
readonly commandId?: AgentId;
|
|
15
|
+
readonly terminalId?: string;
|
|
16
|
+
/** chat tile: the DSH session it shows. Distinct sessions get distinct tiles; undefined only briefly at
|
|
17
|
+
* bootstrap, before the first session id is known (state.ts claims it for the first real session). */
|
|
18
|
+
readonly chatSessionId?: string;
|
|
19
|
+
readonly path?: string;
|
|
20
|
+
readonly content?: string;
|
|
21
|
+
readonly url?: string;
|
|
22
|
+
readonly error?: string;
|
|
23
|
+
/** diff tile: two texts compared line-by-line client-side (no external diff library - see spec 040 open question 5). */
|
|
24
|
+
readonly diffBefore?: string;
|
|
25
|
+
readonly diffAfter?: string;
|
|
26
|
+
/** diff tile, git mode: the worktree and the file (relative to it) whose diff against HEAD is shown. */
|
|
27
|
+
readonly diffWorktree?: string;
|
|
28
|
+
readonly diffFile?: string;
|
|
29
|
+
/** file tile, editor mode: the worktree and the file (relative to it) being edited. `content` then holds an unsaved draft. */
|
|
30
|
+
readonly fileWorktree?: string;
|
|
31
|
+
readonly fileRel?: string;
|
|
32
|
+
/** doc tile, file mode: the worktree and the markdown file (relative to it) shown read-only. */
|
|
33
|
+
readonly docWorktree?: string;
|
|
34
|
+
readonly docRel?: string;
|
|
35
|
+
/** editor tile: the disk modification time the `content` draft is based on. */
|
|
36
|
+
readonly fileMtimeMs?: number;
|
|
37
|
+
/** kanban tile: one local board per tile. */
|
|
38
|
+
readonly board?: KanbanBoard;
|
|
39
|
+
/** doc tile: raw markdown-ish text, rendered with a minimal built-in formatter. */
|
|
40
|
+
readonly docText?: string;
|
|
41
|
+
/** custom tile: the kind of the plugin tab type it shows (`owner.name`) and the state that plugin saved in it. */
|
|
42
|
+
readonly customType?: string;
|
|
43
|
+
readonly customState?: string;
|
|
44
|
+
/** terminal tile: the last title this tab took from its program (so a title you typed yourself is never overwritten). */
|
|
45
|
+
readonly autoTitle?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface WorkspaceSnapshot {
|
|
48
|
+
readonly tiles: readonly WorkspaceTile[];
|
|
49
|
+
readonly activeId: string | undefined;
|
|
50
|
+
/** The tab shown in the optional second pane beside the active one. Never equal to `activeId`. */
|
|
51
|
+
readonly splitId: string | undefined;
|
|
52
|
+
readonly menuOpen: boolean;
|
|
53
|
+
}
|
|
54
|
+
export interface WorkspaceStateOptions {
|
|
55
|
+
readonly createId?: () => string;
|
|
56
|
+
/**
|
|
57
|
+
* Whether the DSH chat is available. Off, the workspace starts on a terminal instead of an AcrylDSH Chat and tabs saved as chats are not
|
|
58
|
+
* restored (there is nothing to open them with). Defaults to on, what the product always was.
|
|
59
|
+
*/
|
|
60
|
+
readonly chat?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Where a new browser tab opens when it is not given an address: the app's own page when the Host serves one. Without it a new tab starts empty,
|
|
63
|
+
* with the address bar waiting; it never loads an outside site nobody asked for. Read when the tab is made, so a Host that answers after the tab
|
|
64
|
+
* set exists still counts.
|
|
65
|
+
*/
|
|
66
|
+
readonly browserHome?: () => string | undefined;
|
|
67
|
+
}
|
|
68
|
+
export interface AddTileOptions {
|
|
69
|
+
readonly commandId?: AgentId;
|
|
70
|
+
readonly title?: string;
|
|
71
|
+
/** chat tile: which DSH session this tab shows (one tab per open chat). */
|
|
72
|
+
readonly chatSessionId?: string;
|
|
73
|
+
readonly fileWorktree?: string;
|
|
74
|
+
readonly fileRel?: string;
|
|
75
|
+
readonly diffWorktree?: string;
|
|
76
|
+
readonly diffFile?: string;
|
|
77
|
+
readonly docWorktree?: string;
|
|
78
|
+
readonly docRel?: string;
|
|
79
|
+
/** browser tile: the page it opens (defaults to the blank starter address). */
|
|
80
|
+
readonly url?: string;
|
|
81
|
+
/** A plugin tab: its registered kind. */
|
|
82
|
+
readonly customType?: string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Observable tab workspace for one advanced-shell lifetime.
|
|
86
|
+
* One tile fills the main content area; "+" appends another tile.
|
|
87
|
+
*/
|
|
88
|
+
export declare class WorkspaceState {
|
|
89
|
+
private snapshot;
|
|
90
|
+
private readonly listeners;
|
|
91
|
+
private readonly createId;
|
|
92
|
+
private readonly chat;
|
|
93
|
+
private readonly browserHome;
|
|
94
|
+
constructor(options?: WorkspaceStateOptions);
|
|
95
|
+
/** @returns the immutable current workspace. */
|
|
96
|
+
getSnapshot(): WorkspaceSnapshot;
|
|
97
|
+
/** @param listener - notified after a snapshot replacement. @returns disposer. */
|
|
98
|
+
subscribe(listener: () => void): () => void;
|
|
99
|
+
/** Open or close the "+" menu. */
|
|
100
|
+
setMenuOpen(menuOpen: boolean): void;
|
|
101
|
+
/** Focus one existing tile. Selecting the tab in the split pane swaps the two panes. */
|
|
102
|
+
selectTile(id: string): void;
|
|
103
|
+
/**
|
|
104
|
+
* Show a tab in the second pane, beside the active one. There is one split at most; a new one
|
|
105
|
+
* replaces the old. Moving the active tab focuses a neighbour first, so both stay visible.
|
|
106
|
+
*/
|
|
107
|
+
openInSplit(id: string): void;
|
|
108
|
+
/** Close the second pane; its tab stays open as an ordinary tab. */
|
|
109
|
+
closeSplit(): void;
|
|
110
|
+
/**
|
|
111
|
+
* Append one tile and focus it. A Chat tile is keyed by its session (`options.chatSessionId`): a session
|
|
112
|
+
* already open here is focused, not duplicated, so one worktree can hold several distinct AcrylDSH Chat
|
|
113
|
+
* tabs - one per open session - instead of at most one chat tile total.
|
|
114
|
+
* @param kind - tile kind from the "+" menu.
|
|
115
|
+
* @param options - PTY command / title overrides.
|
|
116
|
+
*/
|
|
117
|
+
addTile(kind: WorkspaceTileKind, options?: AddTileOptions): WorkspaceTile | undefined;
|
|
118
|
+
/**
|
|
119
|
+
* Re-create tabs saved by a previous run, after the initial chat tab. Each gets a fresh id.
|
|
120
|
+
* @param saved - tiles without ids (terminals are never saved).
|
|
121
|
+
* @param active - index into `saved` of the tab to focus, or -1 to keep the chat focused.
|
|
122
|
+
*/
|
|
123
|
+
restore(saved: readonly Omit<WorkspaceTile, 'id'>[], active: number, split?: number): void;
|
|
124
|
+
/**
|
|
125
|
+
* Edit one file of a worktree: focus the tab already editing it, or open a new one. It opens as the current tab; a split is the user's choice
|
|
126
|
+
* (the tab's split button or its menu).
|
|
127
|
+
* @param worktree - absolute worktree path.
|
|
128
|
+
* @param file - path relative to that worktree.
|
|
129
|
+
*/
|
|
130
|
+
openFile(worktree: string, file: string): WorkspaceTile | undefined;
|
|
131
|
+
/**
|
|
132
|
+
* Preview one markdown file of a worktree read-only: focus the tab already showing it, or open a new one.
|
|
133
|
+
* @param worktree - absolute worktree path.
|
|
134
|
+
* @param file - path relative to that worktree.
|
|
135
|
+
*/
|
|
136
|
+
openDoc(worktree: string, file: string): WorkspaceTile | undefined;
|
|
137
|
+
/**
|
|
138
|
+
* Show one changed file's git diff: focus the tab already showing it, or open a new one.
|
|
139
|
+
* @param worktree - absolute worktree path.
|
|
140
|
+
* @param file - path relative to that worktree.
|
|
141
|
+
*/
|
|
142
|
+
openDiff(worktree: string, file: string): WorkspaceTile | undefined;
|
|
143
|
+
private focusOrAdd;
|
|
144
|
+
/**
|
|
145
|
+
* Remove one tile. Caller disposes a Host PTY when `terminalId` was set.
|
|
146
|
+
* @param id - tile id.
|
|
147
|
+
*/
|
|
148
|
+
closeTile(id: string): WorkspaceTile | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* Merge kind-specific fields onto one tile.
|
|
151
|
+
* @param id - tile id.
|
|
152
|
+
* @param patch - fields to replace.
|
|
153
|
+
*/
|
|
154
|
+
/** Remember an unsaved editor draft and the disk version it is based on, so it survives switching tabs. */
|
|
155
|
+
setFileDraft(id: string, content: string, mtimeMs: number): void;
|
|
156
|
+
/** Forget an editor tab's draft (it was saved, discarded or matches the disk again). */
|
|
157
|
+
clearFileDraft(id: string): void;
|
|
158
|
+
/**
|
|
159
|
+
* Give a tab the name the user typed; typing nothing gives it back its own name (the agent, the file or
|
|
160
|
+
* the site it shows).
|
|
161
|
+
*/
|
|
162
|
+
renameTile(id: string, raw: string): void;
|
|
163
|
+
/**
|
|
164
|
+
* A shell program set its terminal's title. Deliberately a no-op: shells commonly set this to `user@host: cwd`
|
|
165
|
+
* (zsh's default `precmd`), which is long and not useful in a narrow tab strip, so a plain shell tab keeps its
|
|
166
|
+
* short default name ("Terminal", "Terminal 2", ...) instead of following it. Kept as a named function (rather
|
|
167
|
+
* than removed) so a future, shorter derivation (e.g. just the cwd's basename) can plug back in here.
|
|
168
|
+
* @returns true when the tab title changed.
|
|
169
|
+
*/
|
|
170
|
+
applyTerminalTitle(_terminalId: string, _raw: string): boolean;
|
|
171
|
+
private defaultTitle;
|
|
172
|
+
updateTile(id: string, patch: Partial<Omit<WorkspaceTile, 'id' | 'kind'>>): void;
|
|
173
|
+
/** Move a kanban card between columns (or within one, at the given index). */
|
|
174
|
+
moveCard(tileId: string, cardId: string, toColumn: KanbanColumnId, toIndex: number): void;
|
|
175
|
+
/** Add a new kanban card to a column. */
|
|
176
|
+
addCard(tileId: string, column: KanbanColumnId, text: string): void;
|
|
177
|
+
private createTile;
|
|
178
|
+
private replace;
|
|
179
|
+
}
|
|
180
|
+
/** @param url - address-bar text. */
|
|
181
|
+
export declare function normalizeBrowserUrl(url: string): string | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Rules for a tab's name when the user renames it. */
|
|
2
|
+
export declare const MAX_TAB_TITLE = 40;
|
|
3
|
+
/**
|
|
4
|
+
* @param input - what was typed in the rename box.
|
|
5
|
+
* @returns the name to keep, or null when nothing usable was typed (the tab then goes back to its own name).
|
|
6
|
+
*/
|
|
7
|
+
export declare function normalizeTabTitle(input: string): string | null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Same-origin browser client for what the Host composition offers. */
|
|
2
|
+
import { type WorkspaceCapabilities } from '../../capabilities/contract.ts';
|
|
3
|
+
type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
|
|
4
|
+
/** What a page assumes when the Host cannot say (an older Host, a failed request): everything the product always had. */
|
|
5
|
+
export declare const DEFAULT_WORKSPACE_CAPABILITIES: WorkspaceCapabilities;
|
|
6
|
+
/** @param fetchImpl - injectable for tests; defaults to the page's fetch. */
|
|
7
|
+
export declare function loadWorkspaceCapabilities(fetchImpl?: FetchLike): Promise<WorkspaceCapabilities>;
|
|
8
|
+
export {};
|