@dsh-cc/tui 0.5.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/LICENSE +201 -0
- package/README.md +144 -0
- package/lib/bash-history.d.ts +31 -0
- package/lib/bash-history.d.ts.map +1 -0
- package/lib/bash-history.js +94 -0
- package/lib/bash-history.js.map +1 -0
- package/lib/compact-fold.d.ts +35 -0
- package/lib/compact-fold.d.ts.map +1 -0
- package/lib/compact-fold.js +60 -0
- package/lib/compact-fold.js.map +1 -0
- package/lib/components/arg-completers.d.ts +22 -0
- package/lib/components/arg-completers.d.ts.map +1 -0
- package/lib/components/arg-completers.js +75 -0
- package/lib/components/arg-completers.js.map +1 -0
- package/lib/components/code-theme.d.ts +25 -0
- package/lib/components/code-theme.d.ts.map +1 -0
- package/lib/components/code-theme.js +137 -0
- package/lib/components/code-theme.js.map +1 -0
- package/lib/components/completion.d.ts +50 -0
- package/lib/components/completion.d.ts.map +1 -0
- package/lib/components/completion.js +279 -0
- package/lib/components/completion.js.map +1 -0
- package/lib/components/diff-card.d.ts +29 -0
- package/lib/components/diff-card.d.ts.map +1 -0
- package/lib/components/diff-card.js +175 -0
- package/lib/components/diff-card.js.map +1 -0
- package/lib/components/diff-hunks.d.ts +44 -0
- package/lib/components/diff-hunks.d.ts.map +1 -0
- package/lib/components/diff-hunks.js +188 -0
- package/lib/components/diff-hunks.js.map +1 -0
- package/lib/components/editor-history.d.ts +23 -0
- package/lib/components/editor-history.d.ts.map +1 -0
- package/lib/components/editor-history.js +29 -0
- package/lib/components/editor-history.js.map +1 -0
- package/lib/components/markdown-theme.d.ts +11 -0
- package/lib/components/markdown-theme.d.ts.map +1 -0
- package/lib/components/markdown-theme.js +29 -0
- package/lib/components/markdown-theme.js.map +1 -0
- package/lib/components/masked-input.d.ts +24 -0
- package/lib/components/masked-input.d.ts.map +1 -0
- package/lib/components/masked-input.js +168 -0
- package/lib/components/masked-input.js.map +1 -0
- package/lib/components/overlay-host.d.ts +31 -0
- package/lib/components/overlay-host.d.ts.map +1 -0
- package/lib/components/overlay-host.js +128 -0
- package/lib/components/overlay-host.js.map +1 -0
- package/lib/components/overlays.d.ts +94 -0
- package/lib/components/overlays.d.ts.map +1 -0
- package/lib/components/overlays.js +450 -0
- package/lib/components/overlays.js.map +1 -0
- package/lib/components/provider-box.d.ts +23 -0
- package/lib/components/provider-box.d.ts.map +1 -0
- package/lib/components/provider-box.js +164 -0
- package/lib/components/provider-box.js.map +1 -0
- package/lib/components/read-group.d.ts +51 -0
- package/lib/components/read-group.d.ts.map +1 -0
- package/lib/components/read-group.js +105 -0
- package/lib/components/read-group.js.map +1 -0
- package/lib/components/root-bash.d.ts +36 -0
- package/lib/components/root-bash.d.ts.map +1 -0
- package/lib/components/root-bash.js +112 -0
- package/lib/components/root-bash.js.map +1 -0
- package/lib/components/root-types.d.ts +42 -0
- package/lib/components/root-types.d.ts.map +1 -0
- package/lib/components/root-types.js +8 -0
- package/lib/components/root-types.js.map +1 -0
- package/lib/components/root-utils.d.ts +22 -0
- package/lib/components/root-utils.d.ts.map +1 -0
- package/lib/components/root-utils.js +45 -0
- package/lib/components/root-utils.js.map +1 -0
- package/lib/components/root.d.ts +25 -0
- package/lib/components/root.d.ts.map +1 -0
- package/lib/components/root.js +357 -0
- package/lib/components/root.js.map +1 -0
- package/lib/components/theme.d.ts +61 -0
- package/lib/components/theme.d.ts.map +1 -0
- package/lib/components/theme.js +99 -0
- package/lib/components/theme.js.map +1 -0
- package/lib/components/transcript.d.ts +43 -0
- package/lib/components/transcript.d.ts.map +1 -0
- package/lib/components/transcript.js +203 -0
- package/lib/components/transcript.js.map +1 -0
- package/lib/components/working-line.d.ts +35 -0
- package/lib/components/working-line.d.ts.map +1 -0
- package/lib/components/working-line.js +66 -0
- package/lib/components/working-line.js.map +1 -0
- package/lib/effort-catalog.d.ts +27 -0
- package/lib/effort-catalog.d.ts.map +1 -0
- package/lib/effort-catalog.js +36 -0
- package/lib/effort-catalog.js.map +1 -0
- package/lib/export-markdown.d.ts +18 -0
- package/lib/export-markdown.d.ts.map +1 -0
- package/lib/export-markdown.js +124 -0
- package/lib/export-markdown.js.map +1 -0
- package/lib/harness/approval-preview.d.ts +33 -0
- package/lib/harness/approval-preview.d.ts.map +1 -0
- package/lib/harness/approval-preview.js +179 -0
- package/lib/harness/approval-preview.js.map +1 -0
- package/lib/harness/boot-banner.d.ts +14 -0
- package/lib/harness/boot-banner.d.ts.map +1 -0
- package/lib/harness/boot-banner.js +89 -0
- package/lib/harness/boot-banner.js.map +1 -0
- package/lib/harness/driver-agent.d.ts +78 -0
- package/lib/harness/driver-agent.d.ts.map +1 -0
- package/lib/harness/driver-agent.js +314 -0
- package/lib/harness/driver-agent.js.map +1 -0
- package/lib/harness/driver-agents.d.ts +20 -0
- package/lib/harness/driver-agents.d.ts.map +1 -0
- package/lib/harness/driver-agents.js +123 -0
- package/lib/harness/driver-agents.js.map +1 -0
- package/lib/harness/driver-approvals.d.ts +38 -0
- package/lib/harness/driver-approvals.d.ts.map +1 -0
- package/lib/harness/driver-approvals.js +277 -0
- package/lib/harness/driver-approvals.js.map +1 -0
- package/lib/harness/driver-bash.d.ts +15 -0
- package/lib/harness/driver-bash.d.ts.map +1 -0
- package/lib/harness/driver-bash.js +73 -0
- package/lib/harness/driver-bash.js.map +1 -0
- package/lib/harness/driver-catalog.d.ts +84 -0
- package/lib/harness/driver-catalog.d.ts.map +1 -0
- package/lib/harness/driver-catalog.js +256 -0
- package/lib/harness/driver-catalog.js.map +1 -0
- package/lib/harness/driver-ctx.d.ts +462 -0
- package/lib/harness/driver-ctx.d.ts.map +1 -0
- package/lib/harness/driver-ctx.js +11 -0
- package/lib/harness/driver-ctx.js.map +1 -0
- package/lib/harness/driver-hud.d.ts +31 -0
- package/lib/harness/driver-hud.d.ts.map +1 -0
- package/lib/harness/driver-hud.js +204 -0
- package/lib/harness/driver-hud.js.map +1 -0
- package/lib/harness/driver-live.d.ts +36 -0
- package/lib/harness/driver-live.d.ts.map +1 -0
- package/lib/harness/driver-live.js +44 -0
- package/lib/harness/driver-live.js.map +1 -0
- package/lib/harness/driver-modal.d.ts +52 -0
- package/lib/harness/driver-modal.d.ts.map +1 -0
- package/lib/harness/driver-modal.js +78 -0
- package/lib/harness/driver-modal.js.map +1 -0
- package/lib/harness/driver-mode.d.ts +35 -0
- package/lib/harness/driver-mode.d.ts.map +1 -0
- package/lib/harness/driver-mode.js +84 -0
- package/lib/harness/driver-mode.js.map +1 -0
- package/lib/harness/driver-pickers.d.ts +48 -0
- package/lib/harness/driver-pickers.d.ts.map +1 -0
- package/lib/harness/driver-pickers.js +249 -0
- package/lib/harness/driver-pickers.js.map +1 -0
- package/lib/harness/driver-promote.d.ts +29 -0
- package/lib/harness/driver-promote.d.ts.map +1 -0
- package/lib/harness/driver-promote.js +36 -0
- package/lib/harness/driver-promote.js.map +1 -0
- package/lib/harness/driver-queue.d.ts +19 -0
- package/lib/harness/driver-queue.d.ts.map +1 -0
- package/lib/harness/driver-queue.js +281 -0
- package/lib/harness/driver-queue.js.map +1 -0
- package/lib/harness/driver-run-local.d.ts +32 -0
- package/lib/harness/driver-run-local.d.ts.map +1 -0
- package/lib/harness/driver-run-local.js +366 -0
- package/lib/harness/driver-run-local.js.map +1 -0
- package/lib/harness/driver-sessions.d.ts +28 -0
- package/lib/harness/driver-sessions.d.ts.map +1 -0
- package/lib/harness/driver-sessions.js +386 -0
- package/lib/harness/driver-sessions.js.map +1 -0
- package/lib/harness/driver.d.ts +22 -0
- package/lib/harness/driver.d.ts.map +1 -0
- package/lib/harness/driver.js +459 -0
- package/lib/harness/driver.js.map +1 -0
- package/lib/harness/preset.d.ts +32 -0
- package/lib/harness/preset.d.ts.map +1 -0
- package/lib/harness/preset.js +34 -0
- package/lib/harness/preset.js.map +1 -0
- package/lib/harness/session-list.d.ts +65 -0
- package/lib/harness/session-list.d.ts.map +1 -0
- package/lib/harness/session-list.js +91 -0
- package/lib/harness/session-list.js.map +1 -0
- package/lib/harness/shell-output.d.ts +44 -0
- package/lib/harness/shell-output.d.ts.map +1 -0
- package/lib/harness/shell-output.js +90 -0
- package/lib/harness/shell-output.js.map +1 -0
- package/lib/harness/statusline-cc-transcript.d.ts +51 -0
- package/lib/harness/statusline-cc-transcript.d.ts.map +1 -0
- package/lib/harness/statusline-cc-transcript.js +191 -0
- package/lib/harness/statusline-cc-transcript.js.map +1 -0
- package/lib/harness/statusline-command.d.ts +54 -0
- package/lib/harness/statusline-command.d.ts.map +1 -0
- package/lib/harness/statusline-command.js +161 -0
- package/lib/harness/statusline-command.js.map +1 -0
- package/lib/harness/statusline-payload.d.ts +79 -0
- package/lib/harness/statusline-payload.d.ts.map +1 -0
- package/lib/harness/statusline-payload.js +93 -0
- package/lib/harness/statusline-payload.js.map +1 -0
- package/lib/harness/statusline-settings.d.ts +47 -0
- package/lib/harness/statusline-settings.d.ts.map +1 -0
- package/lib/harness/statusline-settings.js +57 -0
- package/lib/harness/statusline-settings.js.map +1 -0
- package/lib/harness/statusline-wiring.d.ts +45 -0
- package/lib/harness/statusline-wiring.d.ts.map +1 -0
- package/lib/harness/statusline-wiring.js +247 -0
- package/lib/harness/statusline-wiring.js.map +1 -0
- package/lib/harness/usage-view.d.ts +84 -0
- package/lib/harness/usage-view.d.ts.map +1 -0
- package/lib/harness/usage-view.js +199 -0
- package/lib/harness/usage-view.js.map +1 -0
- package/lib/harness/worktree-exit.d.ts +105 -0
- package/lib/harness/worktree-exit.d.ts.map +1 -0
- package/lib/harness/worktree-exit.js +168 -0
- package/lib/harness/worktree-exit.js.map +1 -0
- package/lib/history.d.ts +50 -0
- package/lib/history.d.ts.map +1 -0
- package/lib/history.js +139 -0
- package/lib/history.js.map +1 -0
- package/lib/index.d.ts +63 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +54 -0
- package/lib/index.js.map +1 -0
- package/lib/input.d.ts +158 -0
- package/lib/input.d.ts.map +1 -0
- package/lib/input.js +400 -0
- package/lib/input.js.map +1 -0
- package/lib/invariant.d.ts +14 -0
- package/lib/invariant.d.ts.map +1 -0
- package/lib/invariant.js +20 -0
- package/lib/invariant.js.map +1 -0
- package/lib/mode-cycle.d.ts +22 -0
- package/lib/mode-cycle.d.ts.map +1 -0
- package/lib/mode-cycle.js +32 -0
- package/lib/mode-cycle.js.map +1 -0
- package/lib/model-catalog.d.ts +22 -0
- package/lib/model-catalog.d.ts.map +1 -0
- package/lib/model-catalog.js +45 -0
- package/lib/model-catalog.js.map +1 -0
- package/lib/packaged-preset.d.ts +32 -0
- package/lib/packaged-preset.d.ts.map +1 -0
- package/lib/packaged-preset.js +94 -0
- package/lib/packaged-preset.js.map +1 -0
- package/lib/plugin.d.ts +11 -0
- package/lib/plugin.d.ts.map +1 -0
- package/lib/plugin.js +88 -0
- package/lib/plugin.js.map +1 -0
- package/lib/profile.d.ts +4 -0
- package/lib/profile.d.ts.map +1 -0
- package/lib/profile.js +7 -0
- package/lib/profile.js.map +1 -0
- package/lib/project-sessions.d.ts +29 -0
- package/lib/project-sessions.d.ts.map +1 -0
- package/lib/project-sessions.js +60 -0
- package/lib/project-sessions.js.map +1 -0
- package/lib/project.d.ts +75 -0
- package/lib/project.d.ts.map +1 -0
- package/lib/project.js +196 -0
- package/lib/project.js.map +1 -0
- package/lib/provider-actions.d.ts +37 -0
- package/lib/provider-actions.d.ts.map +1 -0
- package/lib/provider-actions.js +417 -0
- package/lib/provider-actions.js.map +1 -0
- package/lib/provider-command.d.ts +109 -0
- package/lib/provider-command.d.ts.map +1 -0
- package/lib/provider-command.js +220 -0
- package/lib/provider-command.js.map +1 -0
- package/lib/provider-detail.d.ts +15 -0
- package/lib/provider-detail.d.ts.map +1 -0
- package/lib/provider-detail.js +201 -0
- package/lib/provider-detail.js.map +1 -0
- package/lib/provider-flow.d.ts +191 -0
- package/lib/provider-flow.d.ts.map +1 -0
- package/lib/provider-flow.js +192 -0
- package/lib/provider-flow.js.map +1 -0
- package/lib/provider-presets.d.ts +32 -0
- package/lib/provider-presets.d.ts.map +1 -0
- package/lib/provider-presets.js +105 -0
- package/lib/provider-presets.js.map +1 -0
- package/lib/provider-read.d.ts +63 -0
- package/lib/provider-read.d.ts.map +1 -0
- package/lib/provider-read.js +115 -0
- package/lib/provider-read.js.map +1 -0
- package/lib/provider-settings.d.ts +30 -0
- package/lib/provider-settings.d.ts.map +1 -0
- package/lib/provider-settings.js +65 -0
- package/lib/provider-settings.js.map +1 -0
- package/lib/resume-target.d.ts +59 -0
- package/lib/resume-target.d.ts.map +1 -0
- package/lib/resume-target.js +143 -0
- package/lib/resume-target.js.map +1 -0
- package/lib/slash.d.ts +44 -0
- package/lib/slash.d.ts.map +1 -0
- package/lib/slash.js +81 -0
- package/lib/slash.js.map +1 -0
- package/lib/state/driver-types.d.ts +505 -0
- package/lib/state/driver-types.d.ts.map +1 -0
- package/lib/state/driver-types.js +8 -0
- package/lib/state/driver-types.js.map +1 -0
- package/lib/state/driver-usage-types.d.ts +59 -0
- package/lib/state/driver-usage-types.d.ts.map +1 -0
- package/lib/state/driver-usage-types.js +8 -0
- package/lib/state/driver-usage-types.js.map +1 -0
- package/lib/statusline.d.ts +63 -0
- package/lib/statusline.d.ts.map +1 -0
- package/lib/statusline.js +97 -0
- package/lib/statusline.js.map +1 -0
- package/lib/store/pickers.d.ts +34 -0
- package/lib/store/pickers.d.ts.map +1 -0
- package/lib/store/pickers.js +111 -0
- package/lib/store/pickers.js.map +1 -0
- package/lib/store/provider-panel.d.ts +107 -0
- package/lib/store/provider-panel.d.ts.map +1 -0
- package/lib/store/provider-panel.js +151 -0
- package/lib/store/provider-panel.js.map +1 -0
- package/lib/store/question.d.ts +21 -0
- package/lib/store/question.d.ts.map +1 -0
- package/lib/store/question.js +59 -0
- package/lib/store/question.js.map +1 -0
- package/lib/store/queue.d.ts +27 -0
- package/lib/store/queue.d.ts.map +1 -0
- package/lib/store/queue.js +34 -0
- package/lib/store/queue.js.map +1 -0
- package/lib/store/session.d.ts +73 -0
- package/lib/store/session.d.ts.map +1 -0
- package/lib/store/session.js +172 -0
- package/lib/store/session.js.map +1 -0
- package/lib/store/subagents.d.ts +16 -0
- package/lib/store/subagents.d.ts.map +1 -0
- package/lib/store/subagents.js +44 -0
- package/lib/store/subagents.js.map +1 -0
- package/lib/store/todos.d.ts +35 -0
- package/lib/store/todos.d.ts.map +1 -0
- package/lib/store/todos.js +68 -0
- package/lib/store/todos.js.map +1 -0
- package/lib/store/usage.d.ts +15 -0
- package/lib/store/usage.d.ts.map +1 -0
- package/lib/store/usage.js +27 -0
- package/lib/store/usage.js.map +1 -0
- package/lib/store/views.d.ts +419 -0
- package/lib/store/views.d.ts.map +1 -0
- package/lib/store/views.js +3 -0
- package/lib/store/views.js.map +1 -0
- package/lib/store.d.ts +19 -0
- package/lib/store.d.ts.map +1 -0
- package/lib/store.js +10 -0
- package/lib/store.js.map +1 -0
- package/lib/terminal/lease.d.ts +33 -0
- package/lib/terminal/lease.d.ts.map +1 -0
- package/lib/terminal/lease.js +99 -0
- package/lib/terminal/lease.js.map +1 -0
- package/lib/tool-card.d.ts +75 -0
- package/lib/tool-card.d.ts.map +1 -0
- package/lib/tool-card.js +109 -0
- package/lib/tool-card.js.map +1 -0
- package/lib/tool-verbs.d.ts +12 -0
- package/lib/tool-verbs.d.ts.map +1 -0
- package/lib/tool-verbs.js +29 -0
- package/lib/tool-verbs.js.map +1 -0
- package/lib/transcript.d.ts +40 -0
- package/lib/transcript.d.ts.map +1 -0
- package/lib/transcript.js +413 -0
- package/lib/transcript.js.map +1 -0
- package/lib/working-line.d.ts +44 -0
- package/lib/working-line.d.ts.map +1 -0
- package/lib/working-line.js +56 -0
- package/lib/working-line.js.map +1 -0
- package/package.json +72 -0
- package/presets/cc/.dsh-cc-managed.json +5 -0
- package/presets/cc/agent.cordis.yml +524 -0
- package/presets/cc/preset.yml +3 -0
- package/scripts/stage-preset.mjs +26 -0
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structural Driver interface for UI components. Components import from here
|
|
3
|
+
* (not from harness/driver.ts) so the boundary gate keeps harness imports
|
|
4
|
+
* out of the view layer.
|
|
5
|
+
* @module @dsh-cc/tui/state/driver-types
|
|
6
|
+
*/
|
|
7
|
+
import type { CatalogEntry } from '../model-catalog.ts';
|
|
8
|
+
import type { TuiState } from '../store.ts';
|
|
9
|
+
import type { ToolCallView, ToolResultView } from '../tool-card.ts';
|
|
10
|
+
import type { WorktreeExitHooks } from '../harness/worktree-exit.ts';
|
|
11
|
+
/**
|
|
12
|
+
* The approval answers: grant once, grant persistently, grant for this
|
|
13
|
+
* session, reject.
|
|
14
|
+
*/
|
|
15
|
+
export type ApprovalAnswerKind = 'once' | 'always' | 'session' | 'reject';
|
|
16
|
+
export interface Driver {
|
|
17
|
+
readonly state: TuiState;
|
|
18
|
+
readonly statusLine: string;
|
|
19
|
+
/**
|
|
20
|
+
* Width-aware status line: same content as {@link Driver.statusLine}, but
|
|
21
|
+
* the parenthetical context detail is omitted when the line would not fit
|
|
22
|
+
* `width` columns. Without a width the full line is returned.
|
|
23
|
+
*/
|
|
24
|
+
statusLineIn(width?: number): string;
|
|
25
|
+
/** Session working directory, used for `@`-path completion. */
|
|
26
|
+
readonly cwd: string;
|
|
27
|
+
/**
|
|
28
|
+
* Persisted composer history (oldest→newest) loaded at boot from
|
|
29
|
+
* `~/.dsh/tui/history.txt`. Seeds the editor's ↑/↓ recall; new prompts are
|
|
30
|
+
* appended on submit (see {@link Driver.submit}). Read once at mount.
|
|
31
|
+
*/
|
|
32
|
+
readonly promptHistory: readonly string[];
|
|
33
|
+
/**
|
|
34
|
+
* Bash-mode command history (newest-first, live reference). Every command
|
|
35
|
+
* executed through a leading `!` is prepended here and persisted to
|
|
36
|
+
* `~/.dsh/tui/bash-history.txt`; the root component browses this stack
|
|
37
|
+
* with ↑/↓ while in shell mode — deliberately separate from the composer
|
|
38
|
+
* prompt history.
|
|
39
|
+
*/
|
|
40
|
+
readonly bashHistory: readonly string[];
|
|
41
|
+
subscribe(listener: (state: TuiState) => void): () => void;
|
|
42
|
+
setDraft(draft: string): void;
|
|
43
|
+
submit(text?: string): Promise<void>;
|
|
44
|
+
interrupt(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Queue-jump (Ctrl+S): inject every queued outbox entry into the running
|
|
47
|
+
* turn immediately — FIFO `agent.steer` per entry, with the queue cleared
|
|
48
|
+
* in the same synchronous stroke as the dispatch. A no-op when the queue
|
|
49
|
+
* is empty.
|
|
50
|
+
*/
|
|
51
|
+
steerQueued(): void;
|
|
52
|
+
/**
|
|
53
|
+
* Pop the LAST queued entry (LIFO — the most recent submit) back out of
|
|
54
|
+
* the outbox for editing (empty-composer ↑). Returns the text, or
|
|
55
|
+
* `undefined` when the queue is empty (same-reference no-op).
|
|
56
|
+
*/
|
|
57
|
+
recallQueued(): string | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Ctrl+B promotion of a foreground subagent wait (UX plan §3.4): promote
|
|
60
|
+
* EVERY armed foreground collect of the CURRENT session to background via
|
|
61
|
+
* the root-realm `ccCollectorRegistry`. Gated by the
|
|
62
|
+
* `CLAUDE_CODE_DISABLE_BACKGROUND_TASKS` kill switch and by the registry
|
|
63
|
+
* being resolvable — with nothing promotable (no registry, no armed
|
|
64
|
+
* collect, or env kill switch armed) this is a `0` no-op. Returns the
|
|
65
|
+
* number of promoted collects (the TUI echoes one status line when > 0).
|
|
66
|
+
* Optional: drivers without the seam degrade to no promotion.
|
|
67
|
+
*/
|
|
68
|
+
promoteForegroundCollects?(): number;
|
|
69
|
+
/**
|
|
70
|
+
* Advance the Shift+Tab permission-mode cycle. Mode writes are serialized
|
|
71
|
+
* per driver; the returned promise settles when this step's write chain
|
|
72
|
+
* (command-channel dispatch + engine setMode) has finished, so tests and
|
|
73
|
+
* callers that care about ordering can await it.
|
|
74
|
+
*/
|
|
75
|
+
cyclePermissionMode(): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Flip the global collapse state (Ctrl+O): thinking rows and tool output
|
|
78
|
+
* collapse together, or both expand back. Supersedes {@link Driver.toggleThinking},
|
|
79
|
+
* which is retained for compatibility.
|
|
80
|
+
*/
|
|
81
|
+
toggleGlobalCollapse(): void;
|
|
82
|
+
/** Legacy thinking-only flip; kept for compatibility with Ctrl+O's old behavior. */
|
|
83
|
+
toggleThinking(): void;
|
|
84
|
+
/**
|
|
85
|
+
* Answer the open approval prompt: `'once'` grants this call only;
|
|
86
|
+
* `'always'` additionally derives a permission rule from the prompt's
|
|
87
|
+
* preview and persists it into the settings `permissions.allow` list;
|
|
88
|
+
* `'session'` derives the same rule and grants it for the current session
|
|
89
|
+
* only (session-scoped allowlist — never persisted to global settings);
|
|
90
|
+
* `'reject'` refuses the call.
|
|
91
|
+
*/
|
|
92
|
+
answerApproval(kind: ApprovalAnswerKind): void;
|
|
93
|
+
/**
|
|
94
|
+
* While a question overlay is open: move the focus one row across the
|
|
95
|
+
* options and the trailing free-text ("Other") row.
|
|
96
|
+
*/
|
|
97
|
+
questionMove(delta: -1 | 1): void;
|
|
98
|
+
/**
|
|
99
|
+
* Activate the focused row: a multi-select question toggles the option in
|
|
100
|
+
* `selected`; a single-select question resolves immediately with that
|
|
101
|
+
* option's label; on the "Other" row a space is typed into the buffer.
|
|
102
|
+
*/
|
|
103
|
+
questionToggle(): void;
|
|
104
|
+
/**
|
|
105
|
+
* Jump to option `index` (0-based) and activate it — single-select
|
|
106
|
+
* resolves, multi-select toggles. Out-of-range indexes are ignored. This is
|
|
107
|
+
* the digit quick-pick path (keys 1-9).
|
|
108
|
+
*/
|
|
109
|
+
questionPick(index: number): void;
|
|
110
|
+
/** Append free text to the "Other" buffer and focus that row. */
|
|
111
|
+
questionType(text: string): void;
|
|
112
|
+
/** Edit the "Other" buffer (drops the last character). */
|
|
113
|
+
questionBackspace(): void;
|
|
114
|
+
/**
|
|
115
|
+
* Resolve the open question: the toggled labels for multi-select, or the
|
|
116
|
+
* focused option when nothing is chosen and the buffer is empty; a
|
|
117
|
+
* non-empty "Other" buffer is sent as `custom` (with an empty `selected`
|
|
118
|
+
* when no option was picked).
|
|
119
|
+
*/
|
|
120
|
+
questionSubmit(): void;
|
|
121
|
+
/** Dismiss the overlay resolving the first option (legacy escape behavior). */
|
|
122
|
+
questionCancel(): void;
|
|
123
|
+
/**
|
|
124
|
+
* Open the `/model` picker overlay: loads the catalog, parks `modelPicker`
|
|
125
|
+
* state focused on the current route, or falls back to the status-row
|
|
126
|
+
* notice when the catalog is empty. The arg path (`/model <n|provider/id>`)
|
|
127
|
+
* bypasses the overlay and stays scriptable.
|
|
128
|
+
*/
|
|
129
|
+
openModelPicker(): Promise<void>;
|
|
130
|
+
/** Move the model-picker focus by one row (clamped; no wrap). */
|
|
131
|
+
modelPickerMove(delta: -1 | 1): void;
|
|
132
|
+
/**
|
|
133
|
+
* Select the focused entry and close the overlay synchronously; the model
|
|
134
|
+
* write (with its effort-preserve validation) settles asynchronously, so
|
|
135
|
+
* awaiting the returned promise waits for the selection to be updated.
|
|
136
|
+
*/
|
|
137
|
+
modelPickerSubmit(): Promise<void>;
|
|
138
|
+
/** Close the overlay without changing the selection. */
|
|
139
|
+
modelPickerCancel(): void;
|
|
140
|
+
/**
|
|
141
|
+
* Open the `/effort` picker overlay: resolves the current model's advertised
|
|
142
|
+
* effort levels and parks `effortPicker` state focused on the live effort
|
|
143
|
+
* (the trailing `default` entry when none is set). Fail closed — an
|
|
144
|
+
* unresolved model or unresolvable levels emit a status notice instead of
|
|
145
|
+
* opening a fabricated list. The arg path (`/effort <level|default>`)
|
|
146
|
+
* bypasses the overlay and stays scriptable.
|
|
147
|
+
*/
|
|
148
|
+
openEffortPicker(): Promise<void>;
|
|
149
|
+
/** Move the effort-picker focus by one row (clamped; no wrap). */
|
|
150
|
+
effortPickerMove(delta: -1 | 1): void;
|
|
151
|
+
/**
|
|
152
|
+
* Select the focused entry and close the overlay synchronously; validation
|
|
153
|
+
* and the selection write settle asynchronously behind a stale-pair guard
|
|
154
|
+
* (a concurrent `/model` or session switch refuses the parked write).
|
|
155
|
+
* Awaiting the returned promise waits for that write to settle.
|
|
156
|
+
*/
|
|
157
|
+
effortPickerSubmit(): Promise<void>;
|
|
158
|
+
/** Close the overlay without changing the selection. */
|
|
159
|
+
effortPickerCancel(): void;
|
|
160
|
+
/**
|
|
161
|
+
* Open the `/permissions` picker overlay: parks `permissionPicker` state
|
|
162
|
+
* focused on the live mode. The argued path (`/permissions <mode>`)
|
|
163
|
+
* bypasses the overlay and stays scriptable through the host command.
|
|
164
|
+
*/
|
|
165
|
+
openPermissionPicker(): Promise<void>;
|
|
166
|
+
/** Move the permission-picker focus by one row (clamped; no wrap). */
|
|
167
|
+
permissionPickerMove(delta: -1 | 1): void;
|
|
168
|
+
/**
|
|
169
|
+
* Select the focused entry. `bypassPermissions` first parks an in-overlay
|
|
170
|
+
* confirmation; a second submit (or any other mode) closes the overlay
|
|
171
|
+
* synchronously and writes `/permissions ${id}` through the host command.
|
|
172
|
+
* Awaiting the returned promise waits for that write to settle.
|
|
173
|
+
*/
|
|
174
|
+
permissionPickerSubmit(): Promise<void>;
|
|
175
|
+
/**
|
|
176
|
+
* Close the overlay without changing the mode. While the bypass
|
|
177
|
+
* confirmation is showing, cancel returns to the list instead.
|
|
178
|
+
*/
|
|
179
|
+
permissionPickerCancel(): void;
|
|
180
|
+
/**
|
|
181
|
+
* Open the `/resume` session-switcher overlay: loads the session list,
|
|
182
|
+
* sorts it by last activity, filters it to the current project's cwd (Tab
|
|
183
|
+
* toggles to all projects), parks `sessionSwitcher` state focused on the
|
|
184
|
+
* current session, and decorates titles asynchronously — or falls back to
|
|
185
|
+
* a status-row notice when no sessions exist at all. The arg path
|
|
186
|
+
* (`/resume <id>`) bypasses the overlay and switches directly.
|
|
187
|
+
*/
|
|
188
|
+
openSessionSwitcher(): Promise<void>;
|
|
189
|
+
/** Move the session-switcher focus by one row (clamped; no wrap). */
|
|
190
|
+
sessionSwitcherMove(delta: -1 | 1): void;
|
|
191
|
+
/** Append text to the picker's query filter and re-filter (focus resets). */
|
|
192
|
+
sessionSwitcherType(text: string): void;
|
|
193
|
+
/** Drop the picker query's last character (no-op when empty) and re-filter. */
|
|
194
|
+
sessionSwitcherBackspace(): void;
|
|
195
|
+
/** Flip the picker scope between this project's cwd and all projects. */
|
|
196
|
+
sessionSwitcherToggleScope(): void;
|
|
197
|
+
/** Switch to the focused session (await {@link Driver.switchSession}) and close the overlay. */
|
|
198
|
+
sessionSwitcherSubmit(): Promise<void>;
|
|
199
|
+
/**
|
|
200
|
+
* Two-stage escape: a non-empty query is cleared first (overlay stays
|
|
201
|
+
* open); an empty query closes the overlay without switching.
|
|
202
|
+
*/
|
|
203
|
+
sessionSwitcherCancel(): void;
|
|
204
|
+
/**
|
|
205
|
+
* Toggle the Ctrl+T todo panel: open it focused on the first row when
|
|
206
|
+
* closed (rendering a placeholder when the session has no todos), or close
|
|
207
|
+
* it when open. Pure store evolution — no harness calls.
|
|
208
|
+
*/
|
|
209
|
+
toggleTodoPanel(): void;
|
|
210
|
+
/** Move the todo-panel focus by one row (clamped; no wrap). */
|
|
211
|
+
todoPanelMove(delta: -1 | 1): void;
|
|
212
|
+
/** Close the todo panel. */
|
|
213
|
+
todoPanelClose(): void;
|
|
214
|
+
/**
|
|
215
|
+
* Close the `/usage` panel (Esc). The panel is pure display — opening is
|
|
216
|
+
* owned by the `/usage` command — so closing is its only interaction.
|
|
217
|
+
*/
|
|
218
|
+
usagePanelClose(): void;
|
|
219
|
+
/**
|
|
220
|
+
* Move the `/quit` worktree-exit confirmation focus by one row (clamped;
|
|
221
|
+
* no wrap). Overlay options: 0 keep, 1 remove, 2 cancel.
|
|
222
|
+
*/
|
|
223
|
+
worktreeExitMove(delta: -1 | 1): void;
|
|
224
|
+
/**
|
|
225
|
+
* Confirm the focused worktree-exit option. Keep exits normally; Remove
|
|
226
|
+
* runs the cleanup and only exits on success (failure keeps the session
|
|
227
|
+
* alive); Cancel dismisses the overlay. No-op while `busy`.
|
|
228
|
+
*/
|
|
229
|
+
worktreeExitSubmit(): Promise<void>;
|
|
230
|
+
/**
|
|
231
|
+
* Dismiss the worktree-exit overlay without quitting. No-op while `busy`.
|
|
232
|
+
*/
|
|
233
|
+
worktreeExitCancel(): void;
|
|
234
|
+
/**
|
|
235
|
+
* Show a one-line transient notice above the composer. The notice clears
|
|
236
|
+
* itself after `ttlMs` (default 3000); a newer notice replaces the pending
|
|
237
|
+
* clear timer of the previous one.
|
|
238
|
+
*/
|
|
239
|
+
showNotice(text: string, ttlMs?: number): void;
|
|
240
|
+
/**
|
|
241
|
+
* Record the moment of an idle Ctrl+C press — the anchor for the
|
|
242
|
+
* double-press-to-exit window. Pure state evolution; callers pass the
|
|
243
|
+
* timestamp they compared against so anchor and comparison share one clock
|
|
244
|
+
* read. Defaults to `Date.now()`.
|
|
245
|
+
*/
|
|
246
|
+
markExitAttempt(now?: number): void;
|
|
247
|
+
/**
|
|
248
|
+
* Switch the live agent to a different persisted session in-process: dispose
|
|
249
|
+
* the current handle, resume the target, replay its history through the same
|
|
250
|
+
* fold the boot path uses, and reset the transcript. No-op when `id` matches
|
|
251
|
+
* the current session. On failure the old session stays bound and a notice
|
|
252
|
+
* is emitted.
|
|
253
|
+
*/
|
|
254
|
+
switchSession(id: string): Promise<void>;
|
|
255
|
+
/** List persisted sessions (newest-first absent — the caller sorts). */
|
|
256
|
+
listSessions(): Promise<readonly {
|
|
257
|
+
id: string;
|
|
258
|
+
cwd?: string;
|
|
259
|
+
createdAt: number;
|
|
260
|
+
}[]>;
|
|
261
|
+
/**
|
|
262
|
+
* Live LLM model catalog (`provider`/`id`/`name` per advertised model), the
|
|
263
|
+
* same list `/model` resolves its argument against. Used by slash argument
|
|
264
|
+
* completion; fetched per call so it never goes stale.
|
|
265
|
+
*/
|
|
266
|
+
loadModelCatalog(): Promise<readonly CatalogEntry[]>;
|
|
267
|
+
/**
|
|
268
|
+
* Reasoning-effort levels of the currently resolved model plus the trailing
|
|
269
|
+
* `default` entry; `[]` when no model is resolved or its levels cannot be
|
|
270
|
+
* resolved (no dead-end completions). Used by slash argument completion;
|
|
271
|
+
* fetched per call so it never goes stale.
|
|
272
|
+
*/
|
|
273
|
+
loadModelEfforts(): Promise<readonly string[]>;
|
|
274
|
+
/**
|
|
275
|
+
* Merged slash-command catalog: TUI-local commands first, then harness
|
|
276
|
+
* commands (deduped by name, local wins), then user-invocable skills from
|
|
277
|
+
* the skills registry (a name claimed by a command resolves to the
|
|
278
|
+
* command). The array identity is stable across calls until the catalog
|
|
279
|
+
* changes (so callers can detect a refresh by reference equality).
|
|
280
|
+
*/
|
|
281
|
+
listCommands(): readonly {
|
|
282
|
+
name: string;
|
|
283
|
+
description?: string;
|
|
284
|
+
argumentHint?: string;
|
|
285
|
+
}[];
|
|
286
|
+
dispose(): Promise<void>;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Configuration for the TUI harness driver. `branchProbe` defaults to
|
|
290
|
+
* `gitBranchOf` (harness/shell-output); `exportDir` defaults to
|
|
291
|
+
* `$DSH_HOME/tui/exports` (same resolution as `resume-target`).
|
|
292
|
+
*/
|
|
293
|
+
export interface DriverConfig {
|
|
294
|
+
cwd?: string;
|
|
295
|
+
agentPreset?: string;
|
|
296
|
+
sessionId?: string;
|
|
297
|
+
/** Boot-time resume from the project resume marker (`sessionId` unset). */
|
|
298
|
+
autoResume?: boolean;
|
|
299
|
+
/** `-c`/`--continue` requested — only affects the no-previous-session notice. */
|
|
300
|
+
continueRequested?: boolean;
|
|
301
|
+
provider?: string;
|
|
302
|
+
model?: string;
|
|
303
|
+
/** Directory for the persisted history file (defaults to `$DSH_HOME/tui`). */
|
|
304
|
+
historyDir?: string;
|
|
305
|
+
/** Git-branch probe for the statusline (best-effort); injectable for tests. */
|
|
306
|
+
branchProbe?: (cwd: string) => Promise<string | undefined>;
|
|
307
|
+
/** Output directory for `/export-md` (default `$DSH_HOME/tui/exports`). */
|
|
308
|
+
exportDir?: string;
|
|
309
|
+
/** Sink for the OSC 52 clipboard sequence `/copy` emits; injectable. */
|
|
310
|
+
copyWrite?: (sequence: string) => void;
|
|
311
|
+
/** `/quit` worktree-exit seam (probe/evidence/cleanup); injectable for tests. */
|
|
312
|
+
worktreeExit?: WorktreeExitHooks;
|
|
313
|
+
/** Quit finalizer invoked after a `/quit` decision settles. */
|
|
314
|
+
onQuit?: () => void;
|
|
315
|
+
}
|
|
316
|
+
export type ToolsLike = {
|
|
317
|
+
get(name: string, scope?: unknown): {
|
|
318
|
+
presentCall?(args: unknown): ToolCallView | undefined;
|
|
319
|
+
presentResult?(args: unknown, result: {
|
|
320
|
+
content: unknown;
|
|
321
|
+
isError: boolean;
|
|
322
|
+
meta?: unknown;
|
|
323
|
+
}): ToolResultView | undefined;
|
|
324
|
+
} | undefined;
|
|
325
|
+
};
|
|
326
|
+
/**
|
|
327
|
+
* Structural stand-in for the deployment's `agentDefaultModel` service
|
|
328
|
+
* (settings.yaml's `agent-default-model`), which the headless bundle seeds
|
|
329
|
+
* agents from. `currentSelection()` returns the resolved default or undefined
|
|
330
|
+
* when no default is configured. A carried `reasoningEffort` is seeded into
|
|
331
|
+
* the selection too — but only after the llm service confirms the model
|
|
332
|
+
* advertises it ({@link resolveEfforts}); an invalid or unresolvable effort is
|
|
333
|
+
* silently dropped to the bare pair, which is always legal.
|
|
334
|
+
*/
|
|
335
|
+
export type AgentDefaultModelLike = {
|
|
336
|
+
currentSelection(): {
|
|
337
|
+
provider: string;
|
|
338
|
+
model: string;
|
|
339
|
+
reasoningEffort?: string;
|
|
340
|
+
} | undefined;
|
|
341
|
+
};
|
|
342
|
+
export type LlmLike = {
|
|
343
|
+
listProviders(): {
|
|
344
|
+
id: string;
|
|
345
|
+
}[];
|
|
346
|
+
listModels(provider: string): Promise<{
|
|
347
|
+
provider: string;
|
|
348
|
+
id: string;
|
|
349
|
+
name: string;
|
|
350
|
+
}[]>;
|
|
351
|
+
/**
|
|
352
|
+
* Optional model-metadata lookup used to validate reasoning-effort writes.
|
|
353
|
+
* Optional so existing llm stubs without it keep working: every effort
|
|
354
|
+
* consumer treats absence as "unresolvable" and fails closed (or writes the
|
|
355
|
+
* bare pair for /model, which never needs validation).
|
|
356
|
+
*/
|
|
357
|
+
resolveModelInfo?(provider: string, model: string, signal?: AbortSignal): Promise<{
|
|
358
|
+
reasoning?: {
|
|
359
|
+
efforts: readonly {
|
|
360
|
+
id: string;
|
|
361
|
+
name: string;
|
|
362
|
+
description?: string;
|
|
363
|
+
}[];
|
|
364
|
+
defaultEffort?: string;
|
|
365
|
+
};
|
|
366
|
+
}>;
|
|
367
|
+
};
|
|
368
|
+
export type PersistenceLike = {
|
|
369
|
+
list(signal?: AbortSignal): Promise<{
|
|
370
|
+
id: string;
|
|
371
|
+
cwd?: string;
|
|
372
|
+
createdAt: number;
|
|
373
|
+
updatedAtMs?: number;
|
|
374
|
+
parentSession?: string;
|
|
375
|
+
}[]>;
|
|
376
|
+
};
|
|
377
|
+
/**
|
|
378
|
+
* Structural stand-in for the deployment's `sessionQuery` service: batch
|
|
379
|
+
* title reads for the /resume picker. One result per requested id —
|
|
380
|
+
* operational failures are isolated per id (`status: 'rejected'`), and the
|
|
381
|
+
* fulfilled value carries the session header plus its latest title snapshot.
|
|
382
|
+
*/
|
|
383
|
+
export type SessionTitleResultLike = {
|
|
384
|
+
status: 'fulfilled';
|
|
385
|
+
/** Requested session id — the join key. Do not use `value.session.id`. */
|
|
386
|
+
sessionId: string;
|
|
387
|
+
value: {
|
|
388
|
+
session: {
|
|
389
|
+
id: string;
|
|
390
|
+
};
|
|
391
|
+
title?: {
|
|
392
|
+
title: string;
|
|
393
|
+
};
|
|
394
|
+
};
|
|
395
|
+
} | {
|
|
396
|
+
status: 'rejected';
|
|
397
|
+
sessionId?: string;
|
|
398
|
+
};
|
|
399
|
+
export type SessionQueryLike = {
|
|
400
|
+
readTitleSnapshots(ids: readonly string[], signal?: AbortSignal): Promise<readonly SessionTitleResultLike[]>;
|
|
401
|
+
};
|
|
402
|
+
/**
|
|
403
|
+
* `subagent/start` snapshot. The real `SubagentRunInfo` is declared in
|
|
404
|
+
* the subagent package (via cordis module augmentation), which the tui
|
|
405
|
+
* package doesn't import — so a structural local type stands in. Fields are
|
|
406
|
+
* `unknown` because the driver stringifies them into the view layer.
|
|
407
|
+
*/
|
|
408
|
+
export type SubagentRunInfoLike = {
|
|
409
|
+
runId: unknown;
|
|
410
|
+
provider: unknown;
|
|
411
|
+
id: unknown;
|
|
412
|
+
local: boolean;
|
|
413
|
+
};
|
|
414
|
+
/**
|
|
415
|
+
* `subagent/end` snapshot. `stopReason` and `lastAssistantMessage` are
|
|
416
|
+
* optional on the payload; only `stopReason` is surfaced to the view.
|
|
417
|
+
*/
|
|
418
|
+
export type SubagentRunEndInfoLike = {
|
|
419
|
+
runId: unknown;
|
|
420
|
+
provider: unknown;
|
|
421
|
+
id: unknown;
|
|
422
|
+
local: boolean;
|
|
423
|
+
stopReason?: unknown;
|
|
424
|
+
lastAssistantMessage?: unknown;
|
|
425
|
+
};
|
|
426
|
+
/**
|
|
427
|
+
* Structural stand-in for the deployment's `shell` service (ShellExecutor's
|
|
428
|
+
* resolve→run seam), which the tui package doesn't import. `resolve` fills
|
|
429
|
+
* the request's defaults/caps; `run` executes the resolved spec and reports
|
|
430
|
+
* the first-cause outcome. Absent service → the driver degrades to a direct
|
|
431
|
+
* child process (see `runShellCommand`).
|
|
432
|
+
*/
|
|
433
|
+
export type ShellExecSpecLike = {
|
|
434
|
+
command: string;
|
|
435
|
+
workdir: string;
|
|
436
|
+
timeoutMs: number;
|
|
437
|
+
stdoutMaxBytes: number;
|
|
438
|
+
/** Stdin bytes handed to the child (resolve bakes the request's in). */
|
|
439
|
+
stdin?: string;
|
|
440
|
+
/** Abort signal wiring the caller's cancellation into the child. */
|
|
441
|
+
signal?: AbortSignal;
|
|
442
|
+
/** Extra/overriding environment entries (resolve bakes the request's in). */
|
|
443
|
+
env?: Record<string, string>;
|
|
444
|
+
};
|
|
445
|
+
export type ShellRunResultLike = {
|
|
446
|
+
/** Exit code; null when the process died from a signal. */
|
|
447
|
+
exitCode: number | null;
|
|
448
|
+
/** True when the executor's timeout was the first cause to cut the command. */
|
|
449
|
+
timedOut: boolean;
|
|
450
|
+
stdout: {
|
|
451
|
+
text: string;
|
|
452
|
+
};
|
|
453
|
+
stderr: {
|
|
454
|
+
text: string;
|
|
455
|
+
};
|
|
456
|
+
};
|
|
457
|
+
export type ShellExecRequestLike = {
|
|
458
|
+
command: string;
|
|
459
|
+
timeoutMs?: number;
|
|
460
|
+
stdoutMaxBytes?: number;
|
|
461
|
+
/** Stdin bytes handed to the child (e.g. the status-line JSON payload). */
|
|
462
|
+
stdin?: string;
|
|
463
|
+
/** Abort signal wiring the caller's cancellation into the child. */
|
|
464
|
+
signal?: AbortSignal;
|
|
465
|
+
/** Environment entries merged over the inherited process env. */
|
|
466
|
+
env?: Record<string, string>;
|
|
467
|
+
/** Working directory for the child (the harness executor's field name). */
|
|
468
|
+
workdir?: string;
|
|
469
|
+
};
|
|
470
|
+
export type ShellExecutorLike = {
|
|
471
|
+
resolve(request: ShellExecRequestLike): ShellExecSpecLike;
|
|
472
|
+
run(spec: ShellExecSpecLike): Promise<ShellRunResultLike>;
|
|
473
|
+
};
|
|
474
|
+
/**
|
|
475
|
+
* Structural stand-in for the sessionProjections registry
|
|
476
|
+
* (dsh-session-projection package, via token-meter's augmentation),
|
|
477
|
+
* which the tui package doesn't import — same pattern as the other `*Like`
|
|
478
|
+
* seams. `onChanged` fires once per client-visible unit whose state changed;
|
|
479
|
+
* `stateOf` is the live read (undefined when the key is not registered).
|
|
480
|
+
*/
|
|
481
|
+
export type SessionProjectionsLike = {
|
|
482
|
+
onChanged(listener: (session: {
|
|
483
|
+
id: unknown;
|
|
484
|
+
}, key: string, value: unknown, seq: number) => void): () => void;
|
|
485
|
+
stateOf(session: unknown, key: string): unknown;
|
|
486
|
+
};
|
|
487
|
+
export type { ContextBreakdownStateLike, ContextPressureStateLike, TokenUsageStateLike, TokenUsageTotals, } from './driver-usage-types.ts';
|
|
488
|
+
/**
|
|
489
|
+
* Structural seam for the deployment settings provider: the pieces the
|
|
490
|
+
* always-allow write path needs (namespace descriptors and whole-section
|
|
491
|
+
* replace). Declared locally — the tui package does not import the settings
|
|
492
|
+
* package, mirroring the other `*Like` seams.
|
|
493
|
+
*/
|
|
494
|
+
export type SettingsProviderLike = {
|
|
495
|
+
readonly writable?: boolean;
|
|
496
|
+
describe(options?: {
|
|
497
|
+
redactSecrets?: boolean;
|
|
498
|
+
}): readonly {
|
|
499
|
+
ns: unknown;
|
|
500
|
+
revision: number;
|
|
501
|
+
user?: unknown;
|
|
502
|
+
}[];
|
|
503
|
+
replace(ns: unknown, section: object, expectedRevision?: number): Promise<void>;
|
|
504
|
+
};
|
|
505
|
+
//# sourceMappingURL=driver-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"driver-types.d.ts","sourceRoot":"","sources":["../../src/state/driver-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAEpE;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAA;AAEzE,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAA;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B;;;;OAIG;IACH,YAAY,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACpC,+DAA+D;IAC/D,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,QAAQ,CAAC,aAAa,EAA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CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,SAAS;QACxD,EAAE,EAAE,OAAO,CAAA;QACX,QAAQ,EAAE,MAAM,CAAA;QAChB,IAAI,CAAC,EAAE,OAAO,CAAA;KACf,EAAE,CAAA;IACH,OAAO,CAAC,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAChF,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structural Driver interface for UI components. Components import from here
|
|
3
|
+
* (not from harness/driver.ts) so the boundary gate keeps harness imports
|
|
4
|
+
* out of the view layer.
|
|
5
|
+
* @module @dsh-cc/tui/state/driver-types
|
|
6
|
+
*/
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=driver-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"driver-types.js","sourceRoot":"","sources":["../../src/state/driver-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Usage/projection state types shared by the HUD, the `/usage` panel and
|
|
3
|
+
* `/cost`. Extracted from driver-types.ts to keep that file focused on the
|
|
4
|
+
* Driver interface and its structural service seams.
|
|
5
|
+
* @module @dsh-cc/tui/state/driver-usage-types
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* `tokenUsage` projection state. `uncachedInputTokens` is the harness's
|
|
9
|
+
* field name; `inputTokens` is accepted defensively so a shape drift
|
|
10
|
+
* degrades to "no tokens" instead of NaN. Cache fields are optional —
|
|
11
|
+
* compositions without prompt caching simply omit those lines. `last`
|
|
12
|
+
* (when present) carries the most recent API step's per-response token
|
|
13
|
+
* buckets — the CC `current_usage` semantics; it is read defensively too,
|
|
14
|
+
* since state may arrive as a foreign/partial shape.
|
|
15
|
+
*/
|
|
16
|
+
export type TokenUsageStateLike = {
|
|
17
|
+
totals?: {
|
|
18
|
+
uncachedInputTokens?: number;
|
|
19
|
+
inputTokens?: number;
|
|
20
|
+
outputTokens?: number;
|
|
21
|
+
cacheReadTokens?: number;
|
|
22
|
+
cacheWriteTokens?: number;
|
|
23
|
+
};
|
|
24
|
+
last?: {
|
|
25
|
+
turn?: number;
|
|
26
|
+
step?: number;
|
|
27
|
+
buckets?: {
|
|
28
|
+
uncachedInputTokens?: number;
|
|
29
|
+
inputTokens?: number;
|
|
30
|
+
outputTokens?: number;
|
|
31
|
+
cacheReadTokens?: number;
|
|
32
|
+
cacheWriteTokens?: number;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
/** Normalized token totals shared by the HUD and `/cost`. */
|
|
37
|
+
export interface TokenUsageTotals {
|
|
38
|
+
input: number;
|
|
39
|
+
output: number;
|
|
40
|
+
cacheRead?: number;
|
|
41
|
+
cacheWrite?: number;
|
|
42
|
+
}
|
|
43
|
+
/** `contextPressure` projection state (subset the HUD reads). */
|
|
44
|
+
export type ContextPressureStateLike = {
|
|
45
|
+
contextWindow?: number;
|
|
46
|
+
pressureTokens?: number;
|
|
47
|
+
surfaceTokens?: number;
|
|
48
|
+
sampledSurfaceTokens?: number;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* `contextBreakdown` projection state (subset the usage panel reads): the
|
|
52
|
+
* projected context token count per content role.
|
|
53
|
+
*/
|
|
54
|
+
export type ContextBreakdownStateLike = {
|
|
55
|
+
system?: number;
|
|
56
|
+
tools?: number;
|
|
57
|
+
messages?: number;
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=driver-usage-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"driver-usage-types.d.ts","sourceRoot":"","sources":["../../src/state/driver-usage-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;GAQG;AACH,MAAM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cost`. Extracted from driver-types.ts to keep that file focused on the
|
|
4
|
+
* Driver interface and its structural service seams.
|
|
5
|
+
* @module @dsh-cc/tui/state/driver-usage-types
|
|
6
|
+
*/
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=driver-usage-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"driver-usage-types.js","sourceRoot":"","sources":["../../src/state/driver-usage-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Footer status line for the CC-mode TUI.
|
|
3
|
+
* @module @dsh-cc/tui/statusline
|
|
4
|
+
*/
|
|
5
|
+
export interface StatusLineInput {
|
|
6
|
+
cwd: string;
|
|
7
|
+
sessionId: string;
|
|
8
|
+
permissionMode: string;
|
|
9
|
+
model?: string;
|
|
10
|
+
/** Selected reasoning effort for the active model (omitted = provider default). */
|
|
11
|
+
effort?: string;
|
|
12
|
+
/** Git branch of the session cwd (best-effort boot probe; omitted when unknown). */
|
|
13
|
+
branch?: string;
|
|
14
|
+
/** Context occupancy percent, 0-100 (rounded here when fractional). */
|
|
15
|
+
contextPercent?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Raw occupancy backing `contextPercent`, rendered as the exact
|
|
18
|
+
* `ctx NN% (used/window)` detail when the window is known. The numerator is
|
|
19
|
+
* the projected token count — never back-derived from the rounded percent.
|
|
20
|
+
*/
|
|
21
|
+
contextTokens?: {
|
|
22
|
+
readonly used: number;
|
|
23
|
+
readonly window?: number;
|
|
24
|
+
};
|
|
25
|
+
/** Cumulative token totals for the session. */
|
|
26
|
+
tokens?: {
|
|
27
|
+
input: number;
|
|
28
|
+
output: number;
|
|
29
|
+
};
|
|
30
|
+
busy: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Compact a session id to its `prefix-first8hex` form (e.g.
|
|
34
|
+
* `tui-abcdef01-…` → `tui-abcdef01`). Falls back to the full id when the
|
|
35
|
+
* shape doesn't match. Shared by the footer and `/agents`.
|
|
36
|
+
*/
|
|
37
|
+
export declare function shortenSession(sessionId: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* Compact a token count for the footer: exact below 1k, one decimal below
|
|
40
|
+
* 100k (`12.3k`), integer above (`123k`), and `m` past a million. Negative
|
|
41
|
+
* and non-finite inputs clamp to `0` — the line stays total on bad data.
|
|
42
|
+
*/
|
|
43
|
+
export declare function formatTokens(tokens: number): string;
|
|
44
|
+
/**
|
|
45
|
+
* The client-drawn permission-mode row appended under a custom statusline
|
|
46
|
+
* (`<mode> · shift+tab · /quit`); shares the hint constants with the
|
|
47
|
+
* built-in line so the formats cannot drift.
|
|
48
|
+
*/
|
|
49
|
+
export declare function formatModeLine(permissionMode: string): string;
|
|
50
|
+
/**
|
|
51
|
+
* Compact footer: `cwd [branch] · session · mode · model · ctx NN% ·
|
|
52
|
+
* ↑in ↓out tok` plus the busy marker and key hints. Absent optional fields
|
|
53
|
+
* drop their segments; the function is pure and total on undefined inputs.
|
|
54
|
+
*
|
|
55
|
+
* When the context window is known the ctx segment grows an exact
|
|
56
|
+
* `(used/window)` detail. `opts.width` is a terminal-width hint: when the
|
|
57
|
+
* assembled line would overflow it, only that parenthetical detail is dropped
|
|
58
|
+
* and the bare `ctx NN%` survives (other segments are never elided).
|
|
59
|
+
*/
|
|
60
|
+
export declare function formatStatusLine(input: StatusLineInput, opts?: {
|
|
61
|
+
width?: number;
|
|
62
|
+
}): string;
|
|
63
|
+
//# sourceMappingURL=statusline.d.ts.map
|