@deepseek-harness-tui/dsh-tui 0.10.2 → 0.11.0
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/README.md +171 -124
- package/bin/dsh-tui.js +748 -22
- package/cordis.patch.yml +38 -10
- package/cordis.yml +2 -0
- package/lib/types/adapter/channel/session-projection.d.ts.map +1 -1
- package/lib/types/adapter/channel/session-projection.js +2 -0
- package/lib/types/adapter/channel/ui-policy.d.ts +4 -1
- package/lib/types/adapter/channel/ui-policy.d.ts.map +1 -1
- package/lib/types/adapter/channel/ui-policy.js +5 -1
- package/lib/types/adapter/kernel/host-facade.d.ts.map +1 -1
- package/lib/types/adapter/kernel/host-facade.js +1 -0
- package/lib/types/adapter/kernel/replay.d.ts.map +1 -1
- package/lib/types/adapter/kernel/replay.js +3 -0
- package/lib/types/adapter/kernel/runtime.d.ts.map +1 -1
- package/lib/types/adapter/kernel/runtime.js +2 -0
- package/lib/types/adapter/kernel/slices/workspace.d.ts.map +1 -1
- package/lib/types/adapter/kernel/slices/workspace.js +1 -0
- package/lib/types/adapter/ports/channel-ui.d.ts +22 -2
- package/lib/types/adapter/ports/channel-ui.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-view.d.ts +66 -0
- package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-workspace.d.ts +23 -0
- package/lib/types/adapter/ports/channel-workspace.d.ts.map +1 -1
- package/lib/types/adapter/ports/workspace.d.ts +2 -0
- package/lib/types/adapter/ports/workspace.d.ts.map +1 -1
- package/lib/types/adapter/upstream/workspace-driver.d.ts.map +1 -1
- package/lib/types/adapter/upstream/workspace-driver.js +10 -2
- package/lib/types/commands.d.ts.map +1 -1
- package/lib/types/commands.js +1 -0
- package/lib/types/components/ContextBarView.d.ts +15 -7
- package/lib/types/components/ContextBarView.d.ts.map +1 -1
- package/lib/types/components/ContextBarView.js +26 -22
- package/lib/types/components/ImagePreviewOverlay.d.ts.map +1 -1
- package/lib/types/components/ImagePreviewOverlay.js +11 -5
- package/lib/types/components/Markdown.d.ts +11 -1
- package/lib/types/components/Markdown.d.ts.map +1 -1
- package/lib/types/components/Markdown.js +20 -2
- package/lib/types/components/MermaidDiagram.d.ts +13 -0
- package/lib/types/components/MermaidDiagram.d.ts.map +1 -0
- package/lib/types/components/MermaidDiagram.js +61 -0
- package/lib/types/components/MessageList.d.ts +26 -1
- package/lib/types/components/MessageList.d.ts.map +1 -1
- package/lib/types/components/MessageList.js +72 -7
- package/lib/types/components/PageMargin.d.ts +1 -1
- package/lib/types/components/PromptInput.d.ts +37 -1
- package/lib/types/components/PromptInput.d.ts.map +1 -1
- package/lib/types/components/PromptInput.js +243 -28
- package/lib/types/components/ScrollbarGutter.d.ts +20 -5
- package/lib/types/components/ScrollbarGutter.d.ts.map +1 -1
- package/lib/types/components/ScrollbarGutter.js +88 -10
- package/lib/types/components/StreamingMarkdown.d.ts.map +1 -1
- package/lib/types/components/StreamingMarkdown.js +30 -28
- package/lib/types/components/Tooltip.d.ts.map +1 -1
- package/lib/types/components/Tooltip.js +45 -7
- package/lib/types/components/messages/UserPromptMessage.d.ts.map +1 -1
- package/lib/types/components/messages/UserPromptMessage.js +5 -7
- package/lib/types/components/messages/useImageInspection.d.ts.map +1 -1
- package/lib/types/components/messages/useImageInspection.js +19 -9
- package/lib/types/components/promptDraftCache.d.ts +102 -0
- package/lib/types/components/promptDraftCache.d.ts.map +1 -0
- package/lib/types/components/promptDraftCache.js +76 -0
- package/lib/types/components/questions/AskUserQuestionPanel.d.ts +17 -1
- package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -1
- package/lib/types/components/questions/AskUserQuestionPanel.js +40 -7
- package/lib/types/components/questions/QuestionMinimizedBar.d.ts +12 -0
- package/lib/types/components/questions/QuestionMinimizedBar.d.ts.map +1 -0
- package/lib/types/components/questions/QuestionMinimizedBar.js +43 -0
- package/lib/types/components/sessions/SessionListRow.d.ts +23 -1
- package/lib/types/components/sessions/SessionListRow.d.ts.map +1 -1
- package/lib/types/components/sessions/SessionListRow.js +52 -5
- package/lib/types/components/workspaces/HomeWorkspaceRow.d.ts +49 -0
- package/lib/types/components/workspaces/HomeWorkspaceRow.d.ts.map +1 -0
- package/lib/types/components/workspaces/HomeWorkspaceRow.js +50 -0
- package/lib/types/dsh-adapter/bundled-presets.d.ts +10 -0
- package/lib/types/dsh-adapter/bundled-presets.d.ts.map +1 -0
- package/lib/types/dsh-adapter/bundled-presets.js +80 -0
- package/lib/types/dsh-adapter/channel/action-readiness.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/action-readiness.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/action-readiness.js +3 -0
- package/lib/types/dsh-adapter/channel/agent-view-projection.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/agent-view-projection.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/agent-view-projection.js +19 -2
- package/lib/types/dsh-adapter/channel/background-action.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/background-action.js +52 -29
- package/lib/types/dsh-adapter/channel/binding.d.ts +19 -2
- package/lib/types/dsh-adapter/channel/binding.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/binding.js +78 -18
- package/lib/types/dsh-adapter/channel/composer-images.d.ts +5 -0
- package/lib/types/dsh-adapter/channel/composer-images.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/composer-images.js +105 -6
- package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts +8 -0
- package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/context-bookkeeping.js +3 -2
- package/lib/types/dsh-adapter/channel/ide-selection.d.ts +58 -0
- package/lib/types/dsh-adapter/channel/ide-selection.d.ts.map +1 -0
- package/lib/types/dsh-adapter/channel/ide-selection.js +226 -0
- package/lib/types/dsh-adapter/channel/input-delivery.d.ts +6 -1
- package/lib/types/dsh-adapter/channel/input-delivery.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/input-delivery.js +9 -1
- package/lib/types/dsh-adapter/channel/local-actions.d.ts +3 -19
- package/lib/types/dsh-adapter/channel/local-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/local-actions.js +2 -1
- package/lib/types/dsh-adapter/channel/model-actions.d.ts +4 -1
- package/lib/types/dsh-adapter/channel/model-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/model-actions.js +82 -6
- package/lib/types/dsh-adapter/channel/model-switch.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/model-switch.js +49 -31
- package/lib/types/dsh-adapter/channel/projection.d.ts +4 -0
- package/lib/types/dsh-adapter/channel/projection.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/projection.js +29 -19
- package/lib/types/dsh-adapter/channel/reports.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/reports.js +4 -12
- package/lib/types/dsh-adapter/channel/session-fork.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-fork.js +26 -2
- package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts +3 -0
- package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-live-adoption.js +1 -0
- package/lib/types/dsh-adapter/channel/session-metadata.d.ts +10 -0
- package/lib/types/dsh-adapter/channel/session-metadata.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-metadata.js +2 -2
- package/lib/types/dsh-adapter/channel/session-resume.d.ts +11 -2
- package/lib/types/dsh-adapter/channel/session-resume.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-resume.js +291 -94
- package/lib/types/dsh-adapter/channel/session-rewind.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-rewind.js +34 -16
- package/lib/types/dsh-adapter/channel/session-tree-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-tree-actions.js +19 -3
- package/lib/types/dsh-adapter/channel/settings-host.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/settings-host.js +4 -3
- package/lib/types/dsh-adapter/channel/state.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/state.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/state.js +1 -1
- package/lib/types/dsh-adapter/channel/transcript.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/transcript.js +6 -12
- package/lib/types/dsh-adapter/channel/types.d.ts +6 -1
- package/lib/types/dsh-adapter/channel/types.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/workspace-actions.d.ts +4 -1
- package/lib/types/dsh-adapter/channel/workspace-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/workspace-actions.js +41 -1
- package/lib/types/dsh-adapter/channel.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel.js +67 -6
- package/lib/types/dsh-adapter/compat/messages.d.ts +15 -0
- package/lib/types/dsh-adapter/compat/messages.d.ts.map +1 -0
- package/lib/types/dsh-adapter/compat/messages.js +15 -0
- package/lib/types/dsh-adapter/compat/settings.d.ts +33 -0
- package/lib/types/dsh-adapter/compat/settings.d.ts.map +1 -0
- package/lib/types/dsh-adapter/compat/settings.js +43 -0
- package/lib/types/dsh-adapter/compat/shell.d.ts +25 -0
- package/lib/types/dsh-adapter/compat/shell.d.ts.map +1 -0
- package/lib/types/dsh-adapter/compat/shell.js +11 -0
- package/lib/types/dsh-adapter/contract.d.ts +4 -4
- package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
- package/lib/types/dsh-adapter/contract.js +15 -6
- package/lib/types/dsh-adapter/ide-channel.d.ts +224 -0
- package/lib/types/dsh-adapter/ide-channel.d.ts.map +1 -0
- package/lib/types/dsh-adapter/ide-channel.js +556 -0
- package/lib/types/dsh-adapter/index.d.ts +18 -3
- package/lib/types/dsh-adapter/index.d.ts.map +1 -1
- package/lib/types/dsh-adapter/index.js +32 -5
- package/lib/types/dsh-adapter/plugin.d.ts +5 -2
- package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin.js +173 -42
- package/lib/types/dsh-adapter/preset-resolution.d.ts +8 -0
- package/lib/types/dsh-adapter/preset-resolution.d.ts.map +1 -1
- package/lib/types/dsh-adapter/preset-resolution.js +10 -0
- package/lib/types/dsh-adapter/session-mount-heartbeat.d.ts +53 -0
- package/lib/types/dsh-adapter/session-mount-heartbeat.d.ts.map +1 -0
- package/lib/types/dsh-adapter/session-mount-heartbeat.js +100 -0
- package/lib/types/dsh-adapter/sessionTree.d.ts.map +1 -1
- package/lib/types/dsh-adapter/sessionTree.js +3 -2
- package/lib/types/dsh-adapter/subagents.d.ts.map +1 -1
- package/lib/types/dsh-adapter/subagents.js +6 -5
- package/lib/types/dsh-adapter/workspaces.d.ts +46 -3
- package/lib/types/dsh-adapter/workspaces.d.ts.map +1 -1
- package/lib/types/dsh-adapter/workspaces.js +116 -0
- package/lib/types/effortPrefs.d.ts +15 -3
- package/lib/types/effortPrefs.d.ts.map +1 -1
- package/lib/types/effortPrefs.js +37 -3
- package/lib/types/homePrefs.d.ts +15 -0
- package/lib/types/homePrefs.d.ts.map +1 -0
- package/lib/types/homePrefs.js +53 -0
- package/lib/types/i18n.d.ts +257 -296
- package/lib/types/i18n.d.ts.map +1 -1
- package/lib/types/i18n.js +78 -84
- package/lib/types/ink/colorize.d.ts +10 -0
- package/lib/types/ink/colorize.d.ts.map +1 -1
- package/lib/types/ink/colorize.js +21 -0
- package/lib/types/ink/components/ScrollBox.d.ts.map +1 -1
- package/lib/types/ink/components/ScrollBox.js +12 -1
- package/lib/types/ink/dom.d.ts +1 -0
- package/lib/types/ink/dom.d.ts.map +1 -1
- package/lib/types/ink/hooks/use-copy-on-select.d.ts +5 -1
- package/lib/types/ink/hooks/use-copy-on-select.d.ts.map +1 -1
- package/lib/types/ink/hooks/use-copy-on-select.js +15 -1
- package/lib/types/ink/ink.d.ts.map +1 -1
- package/lib/types/ink/ink.js +36 -1
- package/lib/types/ink/output.d.ts +10 -1
- package/lib/types/ink/output.d.ts.map +1 -1
- package/lib/types/ink/output.js +109 -17
- package/lib/types/ink/render-border.d.ts +6 -1
- package/lib/types/ink/render-border.d.ts.map +1 -1
- package/lib/types/ink/render-border.js +25 -9
- package/lib/types/ink/render-node-to-output.d.ts.map +1 -1
- package/lib/types/ink/render-node-to-output.js +48 -6
- package/lib/types/ink/renderer.d.ts +6 -0
- package/lib/types/ink/renderer.d.ts.map +1 -1
- package/lib/types/ink/renderer.js +2 -1
- package/lib/types/ink/selection.d.ts +60 -0
- package/lib/types/ink/selection.d.ts.map +1 -1
- package/lib/types/ink/selection.js +129 -0
- package/lib/types/ink/sixel-graphics.d.ts +19 -1
- package/lib/types/ink/sixel-graphics.d.ts.map +1 -1
- package/lib/types/ink/sixel-graphics.js +124 -12
- package/lib/types/ink/terminal-image.d.ts +18 -1
- package/lib/types/ink/terminal-image.d.ts.map +1 -1
- package/lib/types/ink/terminal.d.ts +17 -0
- package/lib/types/ink/terminal.d.ts.map +1 -1
- package/lib/types/ink/terminal.js +20 -1
- package/lib/types/screens/Chat.d.ts +17 -1
- package/lib/types/screens/Chat.d.ts.map +1 -1
- package/lib/types/screens/Chat.js +284 -72
- package/lib/types/screens/SessionSupervisor.d.ts +84 -0
- package/lib/types/screens/SessionSupervisor.d.ts.map +1 -0
- package/lib/types/screens/SessionSupervisor.js +350 -0
- package/lib/types/screens/SessionTree.js +2 -2
- package/lib/types/screens/Settings.d.ts.map +1 -1
- package/lib/types/screens/Settings.js +32 -9
- package/lib/types/screens/StatusLine.d.ts +13 -0
- package/lib/types/screens/StatusLine.d.ts.map +1 -1
- package/lib/types/screens/StatusLine.js +36 -17
- package/lib/types/screens/StatusMetrics.d.ts +79 -22
- package/lib/types/screens/StatusMetrics.d.ts.map +1 -1
- package/lib/types/screens/StatusMetrics.js +153 -88
- package/lib/types/screens/sessionSupervisor/model.d.ts +83 -0
- package/lib/types/screens/sessionSupervisor/model.d.ts.map +1 -0
- package/lib/types/screens/sessionSupervisor/model.js +69 -0
- package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts +120 -0
- package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts.map +1 -0
- package/lib/types/screens/sessionSupervisor/useSessionSupervisor.js +593 -0
- package/lib/types/sessionMounts.d.ts +272 -0
- package/lib/types/sessionMounts.d.ts.map +1 -0
- package/lib/types/sessionMounts.js +706 -0
- package/lib/types/sessions/format.d.ts.map +1 -1
- package/lib/types/sessions/format.js +4 -1
- package/lib/types/sessions/resumeFailure.d.ts +38 -0
- package/lib/types/sessions/resumeFailure.d.ts.map +1 -0
- package/lib/types/sessions/resumeFailure.js +58 -0
- package/lib/types/terminal-utils/mermaid.d.ts +44 -0
- package/lib/types/terminal-utils/mermaid.d.ts.map +1 -0
- package/lib/types/terminal-utils/mermaid.js +83 -0
- package/lib/types/tips.d.ts.map +1 -1
- package/lib/types/tips.js +175 -19
- package/lib/types/tuiDisplayPrefs.d.ts +7 -9
- package/lib/types/tuiDisplayPrefs.d.ts.map +1 -1
- package/lib/types/tuiDisplayPrefs.js +31 -28
- package/lib/types/update.d.ts +61 -0
- package/lib/types/update.d.ts.map +1 -1
- package/lib/types/update.js +194 -0
- package/lib/types/utils/imageResize.d.ts +90 -0
- package/lib/types/utils/imageResize.d.ts.map +1 -0
- package/lib/types/utils/imageResize.js +272 -0
- package/lib/types/utils/keymap.d.ts +5 -1
- package/lib/types/utils/keymap.d.ts.map +1 -1
- package/lib/types/utils/keymap.js +23 -0
- package/lib/types/workspaces.d.ts +2 -1
- package/lib/types/workspaces.d.ts.map +1 -1
- package/lib/types/workspaces.js +1 -1
- package/node_modules/@deepseek-harness-tui/dsh-auth/package.json +10 -10
- package/package.json +120 -103
- package/presets/liangshen/.dsh-tui-managed.json +1 -1
- package/presets/liangshen/agent.cordis.yml +15 -0
- package/lib/types/screens/AgentView.d.ts +0 -23
- package/lib/types/screens/AgentView.d.ts.map +0 -1
- package/lib/types/screens/AgentView.js +0 -546
- package/lib/types/screens/SessionBrowser.d.ts +0 -42
- package/lib/types/screens/SessionBrowser.d.ts.map +0 -1
- package/lib/types/screens/SessionBrowser.js +0 -911
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure model for the unified session screen: constants, view types and the
|
|
3
|
+
* derivations that are testable without a terminal.
|
|
4
|
+
*
|
|
5
|
+
* Kept apart from the screen so the hook and the screen can share them without
|
|
6
|
+
* importing each other, and so a regression can drive them directly. Anything
|
|
7
|
+
* that needs a channel, the filesystem or a render belongs to the hook instead.
|
|
8
|
+
*/
|
|
9
|
+
import type { SessionSummary } from '../../dsh-adapter/sessions/index.js';
|
|
10
|
+
import type { TuiWorkspaceEntry } from '../../workspaces.js';
|
|
11
|
+
/**
|
|
12
|
+
* Rows the left rail always keeps: the section header, the hint line, and the
|
|
13
|
+
* blank rows around them.
|
|
14
|
+
*
|
|
15
|
+
* There is no `+` row any more. A workspace enters the ledger by being the
|
|
16
|
+
* directory a terminal started in (see the startup attach in `plugin.ts`), so
|
|
17
|
+
* the rail has no creation control to reserve a row for.
|
|
18
|
+
*/
|
|
19
|
+
export declare const RAIL_CHROME_ROWS = 4;
|
|
20
|
+
/** Terminal rows one rail entry occupies; see {@link HomeWorkspaceRow}. */
|
|
21
|
+
export declare const WORKSPACE_ROW_LINES = 2;
|
|
22
|
+
/** Width the rail gets when the terminal is wide enough to show both panes. */
|
|
23
|
+
export declare const RAIL_MIN_TOTAL_COLUMNS = 84;
|
|
24
|
+
export declare const RAIL_WIDTH_MIN = 24;
|
|
25
|
+
export declare const RAIL_WIDTH_MAX = 38;
|
|
26
|
+
/** Two lines per session row (title + facts), plus the filter and notice rows. */
|
|
27
|
+
export declare const SESSION_ROW_LINES = 2;
|
|
28
|
+
/** Chrome the right pane spends on banner, filter, new-session card, notice and hints. */
|
|
29
|
+
export declare const SESSION_PANE_CHROME_ROWS = 8;
|
|
30
|
+
export type MenuAction = 'edit' | 'new' | 'rename' | 'remove';
|
|
31
|
+
export declare const MENU_ACTIONS: readonly MenuAction[];
|
|
32
|
+
export declare const MENU_WIDTH = 30;
|
|
33
|
+
/** One confirm line + its explanation. */
|
|
34
|
+
export declare const MENU_HEIGHT: number;
|
|
35
|
+
export declare const MENU_LABEL_KEYS: {
|
|
36
|
+
readonly edit: "home-menu-edit";
|
|
37
|
+
readonly new: "home-menu-new";
|
|
38
|
+
readonly rename: "home-menu-rename";
|
|
39
|
+
readonly remove: "home-menu-remove";
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* What this terminal knows about one session's live state, from the channel's
|
|
43
|
+
* agent-view projection. Absent for a session this process never mounted.
|
|
44
|
+
*/
|
|
45
|
+
export interface SupervisorLiveState {
|
|
46
|
+
/** The row status vocabulary the overview column already uses. */
|
|
47
|
+
readonly status: 'working' | 'needs-input' | 'idle' | 'completed' | 'failed' | 'stopped';
|
|
48
|
+
/** True when an agent for this session is alive in THIS process. */
|
|
49
|
+
readonly live: boolean;
|
|
50
|
+
/** True when this is the session the terminal is attached to. */
|
|
51
|
+
readonly current: boolean;
|
|
52
|
+
/** One-line activity summary. */
|
|
53
|
+
readonly summary: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* One row of the workspace rail: a durable registration, or the fallback group
|
|
57
|
+
* for sessions whose directory is NOT registered.
|
|
58
|
+
*
|
|
59
|
+
* The registry is not the whole session store — a host can run without the
|
|
60
|
+
* workspace service at all (bare compositions return an empty registry), and a
|
|
61
|
+
* session keeps existing after its registration is removed. Those sessions are
|
|
62
|
+
* still resumable, so "no registration" must not read as "no history".
|
|
63
|
+
*/
|
|
64
|
+
export type RailEntry = TuiWorkspaceEntry & {
|
|
65
|
+
readonly from: 'registry' | 'unregistered';
|
|
66
|
+
};
|
|
67
|
+
/** Synthetic id/path for the fallback group; never persisted. */
|
|
68
|
+
export declare const UNREGISTERED_RAIL_ID = "rail:unregistered";
|
|
69
|
+
export declare function message(error: unknown): string;
|
|
70
|
+
/** Case-insensitive path equality, matching the workspace ledger's own rule. */
|
|
71
|
+
export declare function samePath(left: string, right: string): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Case-insensitive substring match over the fields a person searches by.
|
|
74
|
+
*
|
|
75
|
+
* Title and label are the obvious ones; the working directory and branch are
|
|
76
|
+
* included because "which of these three look-alike sessions" is usually
|
|
77
|
+
* answered by where it ran and what it was on, not by its truncated title.
|
|
78
|
+
* @param session - The session to test.
|
|
79
|
+
* @param needle - Lower-cased query; empty matches everything.
|
|
80
|
+
* @returns True when the session should stay visible.
|
|
81
|
+
*/
|
|
82
|
+
export declare function sessionMatchesQuery(session: SessionSummary, needle: string): boolean;
|
|
83
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../../src/screens/sessionSupervisor/model.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAG5D;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,IAAI,CAAA;AACjC,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,IAAI,CAAA;AACpC,+EAA+E;AAC/E,eAAO,MAAM,sBAAsB,KAAK,CAAA;AACxC,eAAO,MAAM,cAAc,KAAK,CAAA;AAChC,eAAO,MAAM,cAAc,KAAK,CAAA;AAChC,kFAAkF;AAClF,eAAO,MAAM,iBAAiB,IAAI,CAAA;AAClC,0FAA0F;AAC1F,eAAO,MAAM,wBAAwB,IAAI,CAAA;AAEzC,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAC7D,eAAO,MAAM,YAAY,EAAE,SAAS,UAAU,EAAwC,CAAA;AACtF,eAAO,MAAM,UAAU,KAAK,CAAA;AAC5B,0CAA0C;AAC1C,eAAO,MAAM,WAAW,QAA0B,CAAA;AAElD,eAAO,MAAM,eAAe;;;;;CAKlB,CAAA;AAEV;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,kEAAkE;IAClE,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,aAAa,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAA;IACxF,oEAAoE;IACpE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,iEAAiE;IACjE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,iCAAiC;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,SAAS,GAAG,iBAAiB,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,cAAc,CAAA;CAAE,CAAA;AAE1F,iEAAiE;AACjE,eAAO,MAAM,oBAAoB,sBAAsB,CAAA;AAEvD,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAE9C;AAED,gFAAgF;AAChF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAUpF"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure model for the unified session screen: constants, view types and the
|
|
3
|
+
* derivations that are testable without a terminal.
|
|
4
|
+
*
|
|
5
|
+
* Kept apart from the screen so the hook and the screen can share them without
|
|
6
|
+
* importing each other, and so a regression can drive them directly. Anything
|
|
7
|
+
* that needs a channel, the filesystem or a render belongs to the hook instead.
|
|
8
|
+
*/
|
|
9
|
+
import { normalizeWorkspaceCwd } from '../../sessions/view.js';
|
|
10
|
+
/**
|
|
11
|
+
* Rows the left rail always keeps: the section header, the hint line, and the
|
|
12
|
+
* blank rows around them.
|
|
13
|
+
*
|
|
14
|
+
* There is no `+` row any more. A workspace enters the ledger by being the
|
|
15
|
+
* directory a terminal started in (see the startup attach in `plugin.ts`), so
|
|
16
|
+
* the rail has no creation control to reserve a row for.
|
|
17
|
+
*/
|
|
18
|
+
export const RAIL_CHROME_ROWS = 4;
|
|
19
|
+
/** Terminal rows one rail entry occupies; see {@link HomeWorkspaceRow}. */
|
|
20
|
+
export const WORKSPACE_ROW_LINES = 2;
|
|
21
|
+
/** Width the rail gets when the terminal is wide enough to show both panes. */
|
|
22
|
+
export const RAIL_MIN_TOTAL_COLUMNS = 84;
|
|
23
|
+
export const RAIL_WIDTH_MIN = 24;
|
|
24
|
+
export const RAIL_WIDTH_MAX = 38;
|
|
25
|
+
/** Two lines per session row (title + facts), plus the filter and notice rows. */
|
|
26
|
+
export const SESSION_ROW_LINES = 2;
|
|
27
|
+
/** Chrome the right pane spends on banner, filter, new-session card, notice and hints. */
|
|
28
|
+
export const SESSION_PANE_CHROME_ROWS = 8;
|
|
29
|
+
export const MENU_ACTIONS = ['edit', 'new', 'rename', 'remove'];
|
|
30
|
+
export const MENU_WIDTH = 30;
|
|
31
|
+
/** One confirm line + its explanation. */
|
|
32
|
+
export const MENU_HEIGHT = MENU_ACTIONS.length + 2;
|
|
33
|
+
export const MENU_LABEL_KEYS = {
|
|
34
|
+
edit: 'home-menu-edit',
|
|
35
|
+
new: 'home-menu-new',
|
|
36
|
+
rename: 'home-menu-rename',
|
|
37
|
+
remove: 'home-menu-remove',
|
|
38
|
+
};
|
|
39
|
+
/** Synthetic id/path for the fallback group; never persisted. */
|
|
40
|
+
export const UNREGISTERED_RAIL_ID = 'rail:unregistered';
|
|
41
|
+
export function message(error) {
|
|
42
|
+
return error instanceof Error ? error.message : String(error);
|
|
43
|
+
}
|
|
44
|
+
/** Case-insensitive path equality, matching the workspace ledger's own rule. */
|
|
45
|
+
export function samePath(left, right) {
|
|
46
|
+
return normalizeWorkspaceCwd(left) === normalizeWorkspaceCwd(right);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Case-insensitive substring match over the fields a person searches by.
|
|
50
|
+
*
|
|
51
|
+
* Title and label are the obvious ones; the working directory and branch are
|
|
52
|
+
* included because "which of these three look-alike sessions" is usually
|
|
53
|
+
* answered by where it ran and what it was on, not by its truncated title.
|
|
54
|
+
* @param session - The session to test.
|
|
55
|
+
* @param needle - Lower-cased query; empty matches everything.
|
|
56
|
+
* @returns True when the session should stay visible.
|
|
57
|
+
*/
|
|
58
|
+
export function sessionMatchesQuery(session, needle) {
|
|
59
|
+
if (needle.length === 0)
|
|
60
|
+
return true;
|
|
61
|
+
const haystack = [
|
|
62
|
+
session.title.text,
|
|
63
|
+
session.label ?? '',
|
|
64
|
+
session.cwd,
|
|
65
|
+
session.branch ?? '',
|
|
66
|
+
session.model ?? '',
|
|
67
|
+
].join('\n').toLowerCase();
|
|
68
|
+
return haystack.includes(needle);
|
|
69
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Data, derived state and actions for the unified session screen.
|
|
3
|
+
*
|
|
4
|
+
* The screen keeps only assembly and key routing; everything that answers "what
|
|
5
|
+
* is on screen and what does an action do" lives here. That is what makes the
|
|
6
|
+
* two panes presentational and the derivations reachable from a regression.
|
|
7
|
+
*
|
|
8
|
+
* Two ownership rules must not be duplicated anywhere else:
|
|
9
|
+
* - the cursor is ONE fact; every index is derived from it, so movement,
|
|
10
|
+
* rendering and Enter can never disagree;
|
|
11
|
+
* - occupancy is re-read from the ledger on this screen own pulse and never
|
|
12
|
+
* captured from the parent render.
|
|
13
|
+
*/
|
|
14
|
+
import React from 'react';
|
|
15
|
+
import type { SessionSummary } from '../../dsh-adapter/sessions/index.js';
|
|
16
|
+
import type { TuiWorkspaceEntry, TuiWorkspaceTarget } from '../../workspaces.js';
|
|
17
|
+
import type { ChannelUi as Channel } from '../../adapter/channel/ui-policy.js';
|
|
18
|
+
import { SupervisorLiveState, RailEntry } from './model.js';
|
|
19
|
+
/** Everything the screen owns that the model needs to read. */
|
|
20
|
+
export interface SessionSupervisorInput {
|
|
21
|
+
readonly channel: Channel;
|
|
22
|
+
/** Home directory, for collapsing paths to `~`. */
|
|
23
|
+
readonly home: string;
|
|
24
|
+
/** Mount a persisted session (the channel unified resume path). */
|
|
25
|
+
onOpenSession(sessionId: string): Promise<boolean>;
|
|
26
|
+
/** Start a fresh session in the workspace at `path`. */
|
|
27
|
+
onNewSession(target: TuiWorkspaceTarget): Promise<boolean>;
|
|
28
|
+
/** Stop a background session of this terminal; false when it is not ours. */
|
|
29
|
+
onStopSession(sessionId: string): Promise<boolean>;
|
|
30
|
+
/** This terminal live state for a session, or undefined when it has none. */
|
|
31
|
+
liveStateOf(sessionId: string): SupervisorLiveState | undefined;
|
|
32
|
+
readonly columns: number;
|
|
33
|
+
readonly rows: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Derive the whole screen model.
|
|
37
|
+
* @param input - Channel, home, the opening/stop actions and the live lookup.
|
|
38
|
+
* @returns Every value the screen renders from, plus the action callbacks.
|
|
39
|
+
*/
|
|
40
|
+
export declare function useSessionSupervisor(input: SessionSupervisorInput): {
|
|
41
|
+
entries: readonly RailEntry[];
|
|
42
|
+
sessions: readonly SessionSummary[];
|
|
43
|
+
loading: boolean;
|
|
44
|
+
notice: {
|
|
45
|
+
text: string;
|
|
46
|
+
tone: "info" | "error";
|
|
47
|
+
} | undefined;
|
|
48
|
+
setNotice: React.Dispatch<React.SetStateAction<{
|
|
49
|
+
text: string;
|
|
50
|
+
tone: "info" | "error";
|
|
51
|
+
} | undefined>>;
|
|
52
|
+
query: string;
|
|
53
|
+
setQuery: React.Dispatch<React.SetStateAction<string>>;
|
|
54
|
+
holderOf: (sessionId: string) => number | undefined;
|
|
55
|
+
listedSessions: SessionSummary[];
|
|
56
|
+
railEntries: readonly RailEntry[];
|
|
57
|
+
countOf: (entry: RailEntry) => number;
|
|
58
|
+
railFocus: number;
|
|
59
|
+
setRailFocus: React.Dispatch<React.SetStateAction<number>>;
|
|
60
|
+
setFocusSessionId: React.Dispatch<React.SetStateAction<string | undefined>>;
|
|
61
|
+
activePane: "list" | "rail";
|
|
62
|
+
pins: ReadonlySet<string>;
|
|
63
|
+
menu: {
|
|
64
|
+
path: string;
|
|
65
|
+
col: number;
|
|
66
|
+
row: number;
|
|
67
|
+
item: number;
|
|
68
|
+
} | undefined;
|
|
69
|
+
setMenu: React.Dispatch<React.SetStateAction<{
|
|
70
|
+
path: string;
|
|
71
|
+
col: number;
|
|
72
|
+
row: number;
|
|
73
|
+
item: number;
|
|
74
|
+
} | undefined>>;
|
|
75
|
+
rename: {
|
|
76
|
+
path: string;
|
|
77
|
+
draft: string;
|
|
78
|
+
} | undefined;
|
|
79
|
+
setRename: React.Dispatch<React.SetStateAction<{
|
|
80
|
+
path: string;
|
|
81
|
+
draft: string;
|
|
82
|
+
} | undefined>>;
|
|
83
|
+
confirmRemove: string | undefined;
|
|
84
|
+
setConfirmRemove: React.Dispatch<React.SetStateAction<string | undefined>>;
|
|
85
|
+
railRef: React.RefObject<number>;
|
|
86
|
+
menuRef: React.RefObject<{
|
|
87
|
+
path: string;
|
|
88
|
+
col: number;
|
|
89
|
+
row: number;
|
|
90
|
+
item: number;
|
|
91
|
+
} | undefined>;
|
|
92
|
+
queryRef: React.RefObject<string>;
|
|
93
|
+
now: number;
|
|
94
|
+
reload: () => Promise<void>;
|
|
95
|
+
selected: RailEntry | undefined;
|
|
96
|
+
visibleSessions: SessionSummary[];
|
|
97
|
+
sessionIndex: number;
|
|
98
|
+
cardFocused: boolean;
|
|
99
|
+
sessionAt: (index: number) => SessionSummary | undefined;
|
|
100
|
+
activateList: () => void;
|
|
101
|
+
activateRail: () => void;
|
|
102
|
+
railWidth: number;
|
|
103
|
+
railVisible: boolean;
|
|
104
|
+
sessionWidth: number;
|
|
105
|
+
railEntryCapacity: number;
|
|
106
|
+
sessionListHeight: number;
|
|
107
|
+
persistPin: (id: string, pinned: boolean) => void;
|
|
108
|
+
selectEntry: (entry: RailEntry) => void;
|
|
109
|
+
openSession: (session: SessionSummary) => void;
|
|
110
|
+
newSessionIn: (entry: TuiWorkspaceEntry) => void;
|
|
111
|
+
renameEntry: (path: string, title: string) => void;
|
|
112
|
+
removeEntry: (path: string) => void;
|
|
113
|
+
stopSession: (session: SessionSummary) => void;
|
|
114
|
+
closeMenu: () => void;
|
|
115
|
+
activateMenu: (entry: RailEntry, item: number) => void;
|
|
116
|
+
moveRail: (by: 1 | -1) => void;
|
|
117
|
+
moveSession: (by: 1 | -1) => void;
|
|
118
|
+
focusedSession: SessionSummary | undefined;
|
|
119
|
+
};
|
|
120
|
+
//# sourceMappingURL=useSessionSupervisor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSessionSupervisor.d.ts","sourceRoot":"","sources":["../../../../src/screens/sessionSupervisor/useSessionSupervisor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAiD,MAAM,OAAO,CAAA;AAOrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAChF,OAAO,KAAK,EAAE,SAAS,IAAI,OAAO,EAAE,MAAM,oCAAoC,CAAA;AAC9E,OAAO,EAAkN,mBAAmB,EAAE,SAAS,EAAgE,MAAM,YAAY,CAAA;AAEzU,+DAA+D;AAC/D,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,mDAAmD;IACnD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,mEAAmE;IACnE,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAClD,wDAAwD;IACxD,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAC1D,6EAA6E;IAC7E,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAClD,6EAA6E;IAC7E,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAAA;IAC/D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,sBAAsB;;;;;cAMnB,MAAM;cAAQ,MAAM,GAAG,OAAO;;;cAA9B,MAAM;cAAQ,MAAM,GAAG,OAAO;;;;0BAwB7D,MAAM,KAAG,MAAM,GAAG,SAAS;;;qBA6F/B,SAAS,KAAG,MAAM;;;;;;;cA6Ca,MAAM;aAAO,MAAM;aAAO,MAAM;cAAQ,MAAM;;;cAA9C,MAAM;aAAO,MAAM;aAAO,MAAM;cAAQ,MAAM;;;cAC1C,MAAM;eAAS,MAAM;;;cAArB,MAAM;eAAS,MAAM;;;;;;cADzB,MAAM;aAAO,MAAM;aAAO,MAAM;cAAQ,MAAM;;;;kBA0ClD,OAAO,CAAC,IAAI,CAAC;;;;;uBA+IxC,MAAM,KAAG,cAAc,GAAG,SAAS;wBAWR,IAAI;wBAOJ,IAAI;;;;;;qBA2BL,MAAM,UAAU,OAAO,KAAG,IAAI;yBAS1B,SAAS,KAAG,IAAI;2BAed,cAAc,KAAG,IAAI;0BAmBtB,iBAAiB,KAAG,IAAI;wBAgB1B,MAAM,SAAS,MAAM,KAAG,IAAI;wBAe5B,MAAM,KAAG,IAAI;2BAWV,cAAc,KAAG,IAAI;qBAiB7B,IAAI;0BAKG,SAAS,QAAQ,MAAM,KAAG,IAAI;mBAarC,CAAC,GAAG,CAAC,CAAC,KAAG,IAAI;sBAWV,CAAC,GAAG,CAAC,CAAC,KAAG,IAAI;;EAqEnD"}
|