@linxiraos/pi-tui 1.4.4 → 1.4.7
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/CHANGELOG.md +208 -207
- package/README.md +34 -34
- package/dist/types/app-keybindings.d.ts +20 -0
- package/dist/types/apps/session-picker.d.ts +5 -0
- package/dist/types/charts/chart-plan.d.ts +9 -7
- package/dist/types/chat/assistant-message.d.ts +15 -3
- package/dist/types/chat/bash-execution.d.ts +2 -0
- package/dist/types/chat/display-preferences.d.ts +2 -0
- package/dist/types/chat/extension-types.d.ts +31 -0
- package/dist/types/chat/reply-write.d.ts +48 -0
- package/dist/types/chat/table-chart.d.ts +4 -3
- package/dist/types/chat/tool-execution.d.ts +1 -2
- package/dist/types/chat/transcript-outline.d.ts +7 -0
- package/dist/types/chat/transcript-render-helpers.d.ts +2 -0
- package/dist/types/chrome/context-map.d.ts +15 -0
- package/dist/types/chrome/context-presentation.d.ts +48 -0
- package/dist/types/chrome/context-view-model.d.ts +77 -0
- package/dist/types/chrome/index.d.ts +1 -0
- package/dist/types/chrome/transcript-notice.d.ts +35 -0
- package/dist/types/chrome/transcript-status.d.ts +20 -8
- package/dist/types/components/editor.d.ts +8 -0
- package/dist/types/components/image.d.ts +20 -0
- package/dist/types/components/loader.d.ts +1 -1
- package/dist/types/components/markdown.d.ts +7 -0
- package/dist/types/native/blobs.d.ts +11 -1
- package/dist/types/native/picker.d.ts +4 -4
- package/dist/types/overlays/advisor-config.d.ts +6 -0
- package/dist/types/overlays/agent-hub-projection.d.ts +3 -1
- package/dist/types/overlays/annotation-overlay.d.ts +7 -1
- package/dist/types/overlays/annotation-types.d.ts +28 -0
- package/dist/types/overlays/ask-dialog.d.ts +12 -3
- package/dist/types/overlays/btw-history-panel.d.ts +16 -2
- package/dist/types/overlays/btw-history.d.ts +7 -0
- package/dist/types/overlays/btw-panel.d.ts +2 -0
- package/dist/types/overlays/context-viewer-format.d.ts +42 -0
- package/dist/types/overlays/context-viewer-overview.d.ts +70 -0
- package/dist/types/overlays/context-viewer.d.ts +25 -0
- package/dist/types/overlays/hook-input.d.ts +1 -0
- package/dist/types/overlays/login-dialog.d.ts +5 -1
- package/dist/types/overlays/mcp-add-wizard.d.ts +2 -0
- package/dist/types/overlays/model-browser.d.ts +10 -1
- package/dist/types/overlays/oauth-selector.d.ts +23 -0
- package/dist/types/overlays/pause-screen.d.ts +13 -3
- package/dist/types/overlays/plan-review-overlay.d.ts +2 -0
- package/dist/types/overlays/rewind-selector.d.ts +1 -1
- package/dist/types/overlays/running-subagent-badge.d.ts +7 -1
- package/dist/types/overlays/session-selector.d.ts +22 -2
- package/dist/types/prompt/composer.d.ts +43 -0
- package/dist/types/prompt/interactive-context-helpers.d.ts +10 -3
- package/dist/types/prompt/macos-spelling.d.ts +2 -2
- package/dist/types/render/extension-links.d.ts +65 -0
- package/dist/types/render/hyperlink.d.ts +38 -7
- package/dist/types/render/index.d.ts +1 -0
- package/dist/types/render/output-pane.d.ts +1 -1
- package/dist/types/render/render-utils.d.ts +7 -1
- package/dist/types/setup/scenes/glyph.d.ts +1 -1
- package/dist/types/setup/scenes/model.d.ts +1 -1
- package/dist/types/setup/scenes/outro.d.ts +5 -4
- package/dist/types/setup/scenes/sign-in.d.ts +13 -8
- package/dist/types/setup/scenes/types.d.ts +16 -1
- package/dist/types/setup/startup-splash.d.ts +1 -1
- package/dist/types/setup/wizard-overlay.d.ts +11 -7
- package/dist/types/setup/wizard.d.ts +5 -1
- package/dist/types/status-line/component.d.ts +3 -3
- package/dist/types/status-line/context-usage.d.ts +42 -35
- package/dist/types/status-line/host.d.ts +6 -2
- package/dist/types/terminal-capabilities.d.ts +7 -0
- package/dist/types/theme/symbols.d.ts +1 -1
- package/dist/types/theme/theme.d.ts +0 -23
- package/dist/types/tools/ask.d.ts +4 -0
- package/dist/types/tools/bash-interactive.d.ts +6 -0
- package/dist/types/tools/bash.d.ts +2 -0
- package/dist/types/tools/default-renderer.d.ts +6 -4
- package/dist/types/tools/edit.d.ts +3 -1
- package/dist/types/tools/fetch.d.ts +1 -0
- package/dist/types/tools/github.d.ts +3 -0
- package/dist/types/tools/grouped-file-output.d.ts +2 -0
- package/dist/types/tools/irc.d.ts +6 -0
- package/dist/types/tools/json-tree.d.ts +23 -4
- package/dist/types/tools/lsp.d.ts +2 -0
- package/dist/types/tools/mcp.d.ts +7 -6
- package/dist/types/tools/native-view.d.ts +1 -1
- package/dist/types/tools/read.d.ts +3 -0
- package/dist/types/tools/renderer.d.ts +2 -0
- package/dist/types/tools/streaming-output.d.ts +11 -0
- package/dist/types/tools/task.d.ts +9 -1
- package/dist/types/tools/url-scheme-host.d.ts +17 -0
- package/dist/types/tools/wait.d.ts +16 -2
- package/dist/types/tools/yield.d.ts +1 -1
- package/dist/types/tui.d.ts +9 -2
- package/dist/types/vim.d.ts +39 -0
- package/package.json +10 -14
- package/src/app-keybindings.d.ts +20 -0
- package/src/app-keybindings.ts +20 -0
- package/src/apps/session-picker.ts +7 -0
- package/src/charts/chart-plan.d.ts +9 -7
- package/src/charts/chart-plan.ts +20 -50
- package/src/chat/advisor-message.ts +2 -0
- package/src/chat/assistant-message.d.ts +15 -3
- package/src/chat/assistant-message.ts +137 -19
- package/src/chat/background-tan-message.ts +4 -0
- package/src/chat/bash-execution.d.ts +2 -0
- package/src/chat/bash-execution.ts +13 -1
- package/src/chat/chat-transcript-builder.ts +58 -28
- package/src/chat/compaction-summary-message.ts +2 -1
- package/src/chat/display-preferences.d.ts +2 -0
- package/src/chat/display-preferences.ts +3 -0
- package/src/chat/extension-types.d.ts +31 -0
- package/src/chat/extension-types.ts +34 -0
- package/src/chat/read-tool-group.ts +1 -2
- package/src/chat/reply-write.d.ts +48 -0
- package/src/chat/reply-write.ts +127 -0
- package/src/chat/skill-message.ts +2 -6
- package/src/chat/table-chart.d.ts +4 -3
- package/src/chat/table-chart.ts +10 -4
- package/src/chat/tool-execution.d.ts +1 -2
- package/src/chat/tool-execution.ts +20 -13
- package/src/chat/transcript-outline.d.ts +7 -0
- package/src/chat/transcript-outline.ts +27 -0
- package/src/chat/transcript-render-helpers.d.ts +2 -0
- package/src/chat/transcript-render-helpers.ts +66 -24
- package/src/chrome/context-map.ts +62 -0
- package/src/chrome/context-presentation.ts +26 -0
- package/src/chrome/context-view-model.ts +73 -0
- package/src/chrome/index.ts +1 -0
- package/src/chrome/transcript-container.ts +89 -59
- package/src/chrome/transcript-notice.d.ts +35 -0
- package/src/chrome/transcript-notice.ts +83 -0
- package/src/chrome/transcript-status.d.ts +20 -8
- package/src/chrome/transcript-status.ts +29 -29
- package/src/components/editor.d.ts +8 -0
- package/src/components/editor.ts +465 -14
- package/src/components/image.d.ts +20 -0
- package/src/components/image.ts +83 -18
- package/src/components/loader.d.ts +1 -1
- package/src/components/loader.ts +1 -1
- package/src/components/markdown.d.ts +7 -0
- package/src/components/markdown.ts +225 -13
- package/src/hotkeys-markdown.ts +2 -0
- package/src/native/backend.ts +5 -66
- package/src/native/blobs.d.ts +11 -1
- package/src/native/blobs.ts +5 -3
- package/src/native/picker.d.ts +4 -4
- package/src/native/picker.ts +4 -4
- package/src/overlays/advisor-config.ts +10 -12
- package/src/overlays/agent-hub-projection.d.ts +3 -1
- package/src/overlays/agent-hub-projection.ts +6 -5
- package/src/overlays/agent-hub.ts +51 -42
- package/src/overlays/annotation-overlay.ts +125 -37
- package/src/overlays/annotation-types.ts +24 -0
- package/src/overlays/ask-dialog.ts +125 -35
- package/src/overlays/btw-history-panel.ts +124 -12
- package/src/overlays/btw-history.ts +11 -0
- package/src/overlays/btw-panel.ts +8 -4
- package/src/overlays/context-viewer-format.ts +145 -0
- package/src/overlays/context-viewer-overview.ts +381 -0
- package/src/overlays/context-viewer.ts +728 -0
- package/src/overlays/hook-input.ts +2 -0
- package/src/overlays/hook-selector.ts +2 -2
- package/src/overlays/login-dialog.ts +31 -5
- package/src/overlays/mcp-add-wizard.ts +6 -1
- package/src/overlays/model-browser.ts +37 -0
- package/src/overlays/model-hub.ts +1 -7
- package/src/overlays/model-picker.ts +1 -10
- package/src/overlays/oauth-selector.ts +44 -6
- package/src/overlays/pause-screen.ts +166 -33
- package/src/overlays/plan-review-overlay.ts +13 -2
- package/src/overlays/rewind-selector.ts +29 -12
- package/src/overlays/running-subagent-badge.ts +12 -1
- package/src/overlays/session-selector.ts +313 -42
- package/src/overlays/settings-defs.ts +1 -0
- package/src/overlays/usage-dashboard.ts +20 -14
- package/src/prompt/composer.ts +216 -1
- package/src/prompt/custom-editor.ts +6 -1
- package/src/prompt/emoji-autocomplete.ts +0 -2
- package/src/prompt/interactive-context-helpers.ts +29 -4
- package/src/prompt/macos-spelling.ts +24 -15
- package/src/render/extension-links.d.ts +65 -0
- package/src/render/extension-links.ts +214 -0
- package/src/render/hyperlink.d.ts +38 -7
- package/src/render/hyperlink.ts +102 -23
- package/src/render/index.d.ts +1 -0
- package/src/render/index.ts +1 -0
- package/src/render/output-pane.d.ts +1 -1
- package/src/render/output-pane.ts +60 -17
- package/src/render/render-utils.d.ts +7 -1
- package/src/render/render-utils.ts +11 -2
- package/src/setup/scenes/composer.ts +2 -0
- package/src/setup/scenes/glyph.ts +3 -1
- package/src/setup/scenes/model.ts +192 -29
- package/src/setup/scenes/outro.ts +33 -15
- package/src/setup/scenes/sign-in.ts +194 -392
- package/src/setup/scenes/theme.ts +2 -0
- package/src/setup/scenes/types.ts +18 -1
- package/src/setup/startup-splash.ts +8 -7
- package/src/setup/wizard-overlay.ts +164 -35
- package/src/setup/wizard.ts +11 -2
- package/src/status-line/component.ts +10 -14
- package/src/status-line/context-usage.ts +122 -597
- package/src/status-line/host.ts +6 -2
- package/src/terminal-capabilities.d.ts +7 -0
- package/src/terminal-capabilities.ts +10 -0
- package/src/terminal.ts +24 -2
- package/src/theme/defaults.json +1 -0
- package/src/theme/loader.ts +1 -1
- package/src/theme/symbols.d.ts +1 -1
- package/src/theme/symbols.ts +16 -0
- package/src/theme/theme.d.ts +0 -23
- package/src/theme/theme.ts +2 -75
- package/src/tools/ask.d.ts +4 -0
- package/src/tools/ask.ts +4 -0
- package/src/tools/ast-grep.ts +3 -2
- package/src/tools/bash-interactive.d.ts +49 -0
- package/src/tools/bash-interactive.ts +6 -1
- package/src/tools/bash.d.ts +2 -0
- package/src/tools/bash.ts +7 -23
- package/src/tools/default-renderer.d.ts +6 -4
- package/src/tools/default-renderer.ts +9 -6
- package/src/tools/edit.d.ts +3 -1
- package/src/tools/edit.ts +8 -4
- package/src/tools/eval.ts +14 -4
- package/src/tools/fetch.d.ts +1 -0
- package/src/tools/fetch.ts +1 -0
- package/src/tools/find.ts +3 -10
- package/src/tools/github.d.ts +3 -0
- package/src/tools/github.ts +23 -3
- package/src/tools/glob.ts +4 -3
- package/src/tools/grep.ts +3 -4
- package/src/tools/grouped-file-output.d.ts +2 -0
- package/src/tools/grouped-file-output.ts +8 -2
- package/src/tools/irc.d.ts +6 -0
- package/src/tools/irc.ts +6 -0
- package/src/tools/job-widget.ts +13 -1
- package/src/tools/json-tree.d.ts +23 -4
- package/src/tools/json-tree.ts +132 -42
- package/src/tools/lsp.d.ts +2 -0
- package/src/tools/lsp.ts +36 -15
- package/src/tools/mcp.d.ts +7 -6
- package/src/tools/mcp.ts +41 -15
- package/src/tools/native-view.d.ts +1 -1
- package/src/tools/native-view.ts +3 -3
- package/src/tools/read.d.ts +3 -0
- package/src/tools/read.ts +3 -1
- package/src/tools/renderer.d.ts +2 -0
- package/src/tools/renderer.ts +2 -0
- package/src/tools/streaming-output.d.ts +11 -0
- package/src/tools/streaming-output.ts +41 -0
- package/src/tools/task.d.ts +9 -1
- package/src/tools/task.ts +59 -16
- package/src/tools/url-scheme-host.d.ts +17 -0
- package/src/tools/url-scheme-host.ts +21 -0
- package/src/tools/vibe.ts +14 -3
- package/src/tools/wait.d.ts +16 -2
- package/src/tools/wait.ts +16 -2
- package/src/tools/yield.d.ts +1 -1
- package/src/tools/yield.ts +18 -9
- package/src/tui.d.ts +9 -2
- package/src/tui.ts +102 -34
- package/src/vim.d.ts +39 -0
- package/src/vim.ts +313 -22
- package/dist/types/theme/defaults/index.d.ts +0 -10289
- package/src/theme/defaults/alabaster.json +0 -103
- package/src/theme/defaults/amethyst.json +0 -106
- package/src/theme/defaults/anthracite.json +0 -103
- package/src/theme/defaults/basalt.json +0 -101
- package/src/theme/defaults/birch.json +0 -105
- package/src/theme/defaults/dark-abyss.json +0 -101
- package/src/theme/defaults/dark-arctic.json +0 -114
- package/src/theme/defaults/dark-aurora.json +0 -105
- package/src/theme/defaults/dark-catppuccin.json +0 -117
- package/src/theme/defaults/dark-cavern.json +0 -101
- package/src/theme/defaults/dark-celestial.json +0 -116
- package/src/theme/defaults/dark-copper.json +0 -105
- package/src/theme/defaults/dark-cosmos.json +0 -100
- package/src/theme/defaults/dark-cyberpunk.json +0 -112
- package/src/theme/defaults/dark-dracula.json +0 -108
- package/src/theme/defaults/dark-eclipse.json +0 -101
- package/src/theme/defaults/dark-ember.json +0 -105
- package/src/theme/defaults/dark-equinox.json +0 -100
- package/src/theme/defaults/dark-forest.json +0 -106
- package/src/theme/defaults/dark-github.json +0 -115
- package/src/theme/defaults/dark-gruvbox.json +0 -122
- package/src/theme/defaults/dark-lavender.json +0 -105
- package/src/theme/defaults/dark-lunar.json +0 -99
- package/src/theme/defaults/dark-midnight.json +0 -105
- package/src/theme/defaults/dark-monochrome.json +0 -104
- package/src/theme/defaults/dark-monokai.json +0 -108
- package/src/theme/defaults/dark-nebula.json +0 -100
- package/src/theme/defaults/dark-neon-noir.json +0 -110
- package/src/theme/defaults/dark-nord.json +0 -108
- package/src/theme/defaults/dark-ocean.json +0 -111
- package/src/theme/defaults/dark-one.json +0 -110
- package/src/theme/defaults/dark-poimandres.json +0 -125
- package/src/theme/defaults/dark-rainforest.json +0 -101
- package/src/theme/defaults/dark-reef.json +0 -101
- package/src/theme/defaults/dark-retro.json +0 -102
- package/src/theme/defaults/dark-rose-pine.json +0 -106
- package/src/theme/defaults/dark-sakura.json +0 -105
- package/src/theme/defaults/dark-slate.json +0 -105
- package/src/theme/defaults/dark-solarized.json +0 -107
- package/src/theme/defaults/dark-solstice.json +0 -100
- package/src/theme/defaults/dark-starfall.json +0 -101
- package/src/theme/defaults/dark-sunset.json +0 -109
- package/src/theme/defaults/dark-swamp.json +0 -100
- package/src/theme/defaults/dark-synthwave.json +0 -113
- package/src/theme/defaults/dark-taiga.json +0 -101
- package/src/theme/defaults/dark-terminal.json +0 -105
- package/src/theme/defaults/dark-tokyo-night.json +0 -111
- package/src/theme/defaults/dark-tundra.json +0 -101
- package/src/theme/defaults/dark-twilight.json +0 -101
- package/src/theme/defaults/dark-volcanic.json +0 -101
- package/src/theme/defaults/graphite.json +0 -102
- package/src/theme/defaults/index.d.ts +0 -10289
- package/src/theme/defaults/index.ts +0 -203
- package/src/theme/defaults/light-arctic.json +0 -117
- package/src/theme/defaults/light-aurora-day.json +0 -101
- package/src/theme/defaults/light-canyon.json +0 -101
- package/src/theme/defaults/light-catppuccin.json +0 -116
- package/src/theme/defaults/light-cirrus.json +0 -100
- package/src/theme/defaults/light-coral.json +0 -105
- package/src/theme/defaults/light-cyberpunk.json +0 -106
- package/src/theme/defaults/light-dawn.json +0 -100
- package/src/theme/defaults/light-dunes.json +0 -101
- package/src/theme/defaults/light-eucalyptus.json +0 -105
- package/src/theme/defaults/light-forest.json +0 -110
- package/src/theme/defaults/light-frost.json +0 -105
- package/src/theme/defaults/light-github.json +0 -125
- package/src/theme/defaults/light-glacier.json +0 -101
- package/src/theme/defaults/light-gruvbox.json +0 -118
- package/src/theme/defaults/light-haze.json +0 -100
- package/src/theme/defaults/light-honeycomb.json +0 -105
- package/src/theme/defaults/light-lagoon.json +0 -101
- package/src/theme/defaults/light-lavender.json +0 -105
- package/src/theme/defaults/light-meadow.json +0 -101
- package/src/theme/defaults/light-mint.json +0 -105
- package/src/theme/defaults/light-monochrome.json +0 -111
- package/src/theme/defaults/light-ocean.json +0 -109
- package/src/theme/defaults/light-one.json +0 -109
- package/src/theme/defaults/light-opal.json +0 -101
- package/src/theme/defaults/light-orchard.json +0 -101
- package/src/theme/defaults/light-paper.json +0 -105
- package/src/theme/defaults/light-poimandres.json +0 -125
- package/src/theme/defaults/light-prism.json +0 -100
- package/src/theme/defaults/light-retro.json +0 -108
- package/src/theme/defaults/light-sand.json +0 -105
- package/src/theme/defaults/light-savanna.json +0 -101
- package/src/theme/defaults/light-solarized.json +0 -112
- package/src/theme/defaults/light-soleil.json +0 -100
- package/src/theme/defaults/light-sunset.json +0 -109
- package/src/theme/defaults/light-synthwave.json +0 -108
- package/src/theme/defaults/light-tokyo-night.json +0 -121
- package/src/theme/defaults/light-wetland.json +0 -101
- package/src/theme/defaults/light-zenith.json +0 -99
- package/src/theme/defaults/limestone.json +0 -104
- package/src/theme/defaults/mahogany.json +0 -107
- package/src/theme/defaults/marble.json +0 -103
- package/src/theme/defaults/obsidian.json +0 -101
- package/src/theme/defaults/onyx.json +0 -101
- package/src/theme/defaults/pearl.json +0 -103
- package/src/theme/defaults/porcelain.json +0 -101
- package/src/theme/defaults/quartz.json +0 -106
- package/src/theme/defaults/sandstone.json +0 -105
- package/src/theme/defaults/titanium.json +0 -100
|
@@ -21,6 +21,7 @@ export interface HookInputOptions {
|
|
|
21
21
|
tui?: TUI;
|
|
22
22
|
timeout?: number;
|
|
23
23
|
onTimeout?: () => void;
|
|
24
|
+
secret?: boolean;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
/** Terminal-only key legend under the field; a native terminal puts the keys in the buttons' tooltips. */
|
|
@@ -84,6 +85,7 @@ export class HookInputComponent extends OverlayPanel {
|
|
|
84
85
|
|
|
85
86
|
this.#field = new TextFormField({
|
|
86
87
|
theme: formTheme,
|
|
88
|
+
secret: opts?.secret ?? false,
|
|
87
89
|
empty: "submit",
|
|
88
90
|
onSubmit: value => this.#onSubmitCallback(value),
|
|
89
91
|
onCancel: () => this.#onCancelCallback(),
|
|
@@ -647,9 +647,9 @@ export class HookSelectorComponent extends OverlayPanel {
|
|
|
647
647
|
return;
|
|
648
648
|
}
|
|
649
649
|
|
|
650
|
-
if (matchesSelectUp(keyData)
|
|
650
|
+
if (matchesSelectUp(keyData)) {
|
|
651
651
|
this.#moveSelection(-1);
|
|
652
|
-
} else if (matchesSelectDown(keyData)
|
|
652
|
+
} else if (matchesSelectDown(keyData)) {
|
|
653
653
|
this.#moveSelection(1);
|
|
654
654
|
} else if (matchesKey(keyData, "enter") || matchesKey(keyData, "return") || keyData === "\n") {
|
|
655
655
|
const selected = this.#menu.selectedItem;
|
|
@@ -64,7 +64,9 @@ function urlPlace(url: string): string {
|
|
|
64
64
|
export class LoginDialogComponent extends OverlayPanel {
|
|
65
65
|
#contentContainer: Container;
|
|
66
66
|
#input: TextFormField;
|
|
67
|
-
#tui: TUI
|
|
67
|
+
#tui: Pick<TUI, "requestRender">;
|
|
68
|
+
#focused = false;
|
|
69
|
+
#useTerminalCursor = false;
|
|
68
70
|
#onComplete: (success: boolean, message?: string) => void;
|
|
69
71
|
#openUrl: (url: string) => void;
|
|
70
72
|
#abortController = new AbortController();
|
|
@@ -78,7 +80,7 @@ export class LoginDialogComponent extends OverlayPanel {
|
|
|
78
80
|
#nativeRoot: NativeNode | undefined;
|
|
79
81
|
|
|
80
82
|
constructor(
|
|
81
|
-
tui: TUI,
|
|
83
|
+
tui: Pick<TUI, "requestRender">,
|
|
82
84
|
providerId: string,
|
|
83
85
|
onComplete: (success: boolean, message?: string) => void,
|
|
84
86
|
openUrl: (url: string) => void,
|
|
@@ -98,8 +100,29 @@ export class LoginDialogComponent extends OverlayPanel {
|
|
|
98
100
|
this.#input = this.#createInput();
|
|
99
101
|
}
|
|
100
102
|
|
|
103
|
+
/** Focus reaches the live field: it draws the caret (the hardware cursor when the terminal's is on). */
|
|
104
|
+
get focused(): boolean {
|
|
105
|
+
return this.#focused;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
set focused(value: boolean) {
|
|
109
|
+
this.#focused = value;
|
|
110
|
+
this.#input.focused = value;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
setUseTerminalCursor(useTerminalCursor: boolean): void {
|
|
114
|
+
this.#useTerminalCursor = useTerminalCursor;
|
|
115
|
+
this.#input.input.setUseTerminalCursor(useTerminalCursor);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** A fresh field for the next answer; the previous one stops drawing a caret. */
|
|
119
|
+
#replaceInput(secret = false): void {
|
|
120
|
+
this.#input.focused = false;
|
|
121
|
+
this.#input = this.#createInput(secret);
|
|
122
|
+
}
|
|
123
|
+
|
|
101
124
|
#createInput(secret = false): TextFormField {
|
|
102
|
-
|
|
125
|
+
const field = new TextFormField({
|
|
103
126
|
theme: formTheme,
|
|
104
127
|
secret,
|
|
105
128
|
empty: "submit",
|
|
@@ -116,6 +139,9 @@ export class LoginDialogComponent extends OverlayPanel {
|
|
|
116
139
|
},
|
|
117
140
|
requestRender: () => this.#tui.requestRender(),
|
|
118
141
|
});
|
|
142
|
+
field.focused = this.#focused;
|
|
143
|
+
field.input.setUseTerminalCursor(this.#useTerminalCursor);
|
|
144
|
+
return field;
|
|
119
145
|
}
|
|
120
146
|
|
|
121
147
|
get signal(): AbortSignal {
|
|
@@ -194,7 +220,7 @@ export class LoginDialogComponent extends OverlayPanel {
|
|
|
194
220
|
// Keep retry chrome in place, but discard prior prompt undo/kill history.
|
|
195
221
|
const mounted = this.#contentContainer.children.indexOf(this.#input);
|
|
196
222
|
const previousInput = this.#input;
|
|
197
|
-
this.#
|
|
223
|
+
this.#replaceInput();
|
|
198
224
|
const nativeMounted = this.#nativeSteps.find(step => step.kind === "input" && step.field === previousInput);
|
|
199
225
|
if (mounted !== -1) {
|
|
200
226
|
// The flow asks again only when the last paste carried no usable code.
|
|
@@ -247,7 +273,7 @@ export class LoginDialogComponent extends OverlayPanel {
|
|
|
247
273
|
if (answered?.kind === "input") answered.answer = value;
|
|
248
274
|
}
|
|
249
275
|
// A new prompt must not recover a previous secret through undo or yank.
|
|
250
|
-
this.#
|
|
276
|
+
this.#replaceInput(prompt.secret === true);
|
|
251
277
|
if (prompt.placeholder) this.#input.input.placeholder = plainText(prompt.placeholder);
|
|
252
278
|
this.#contentContainer.addChild(new Spacer(1));
|
|
253
279
|
this.#contentContainer.addChild(new Text(theme.fg("text", prompt.message), 0, 0));
|
|
@@ -809,7 +809,7 @@ export class MCPAddWizard extends OverlayPanel {
|
|
|
809
809
|
#renderTransportStep(): void {
|
|
810
810
|
this.#choiceStep({
|
|
811
811
|
title: "How does omp reach it?",
|
|
812
|
-
lead: `Pick how ${this.#state.name} talks to
|
|
812
|
+
lead: `Pick how ${this.#state.name} talks to Zeta.`,
|
|
813
813
|
choices: TRANSPORTS.map(transport => ({ ...TRANSPORT_CHOICES[transport], tag: transport })),
|
|
814
814
|
escape: "go back",
|
|
815
815
|
});
|
|
@@ -986,6 +986,11 @@ export class MCPAddWizard extends OverlayPanel {
|
|
|
986
986
|
);
|
|
987
987
|
}
|
|
988
988
|
|
|
989
|
+
/** Route enhanced clipboard text into the active wizard field, never the hidden chat editor. */
|
|
990
|
+
pasteText(text: string): void {
|
|
991
|
+
if (this.#stepKind === "input") this.#inputField?.pasteText(text);
|
|
992
|
+
}
|
|
993
|
+
|
|
989
994
|
handleInput(keyData: string): void {
|
|
990
995
|
// While an OAuth callback is being awaited, Esc/Ctrl+C aborts the flow
|
|
991
996
|
// rather than stepping back through the form: the wizard advertises
|
|
@@ -42,6 +42,7 @@ import type {
|
|
|
42
42
|
TspPickerGroup,
|
|
43
43
|
TspPickerItem,
|
|
44
44
|
TspPickerMark,
|
|
45
|
+
TspPickerProps,
|
|
45
46
|
TspSpan,
|
|
46
47
|
TspText,
|
|
47
48
|
} from "@linxiraos/pi-wire";
|
|
@@ -918,6 +919,22 @@ export interface ModelPickerCatalogue {
|
|
|
918
919
|
readonly itemsDel?: readonly string[];
|
|
919
920
|
}
|
|
920
921
|
|
|
922
|
+
/** The search, fact-column and row props every model `picker` sheet sends ({@link ModelBrowser.pickerRows}). */
|
|
923
|
+
export type ModelPickerRows = Pick<
|
|
924
|
+
TspPickerProps,
|
|
925
|
+
| "query"
|
|
926
|
+
| "cursor"
|
|
927
|
+
| "columns"
|
|
928
|
+
| "items"
|
|
929
|
+
| "itemsAdd"
|
|
930
|
+
| "itemsDel"
|
|
931
|
+
| "order"
|
|
932
|
+
| "hits"
|
|
933
|
+
| "selected"
|
|
934
|
+
| "current"
|
|
935
|
+
| "total"
|
|
936
|
+
>;
|
|
937
|
+
|
|
921
938
|
/** How {@link ModelBrowser.pickerOrder} heads its rows. */
|
|
922
939
|
export interface ModelPickerGrouping {
|
|
923
940
|
/** One group per provider after the Recent block (the unfiltered All models view). */
|
|
@@ -1933,6 +1950,26 @@ export class ModelBrowser implements Component {
|
|
|
1933
1950
|
return selected && !this.#isDisabled(selected) ? selected.selector : null;
|
|
1934
1951
|
}
|
|
1935
1952
|
|
|
1953
|
+
/**
|
|
1954
|
+
* A model picker's search field, fact columns and rows: `catalogue` (from
|
|
1955
|
+
* {@link pickerItems}) in `view` order (from {@link pickerOrder}), the
|
|
1956
|
+
* selection, and `current` checked. Memoize hosts on its inputs plus
|
|
1957
|
+
* {@link query}, {@link cursor} and {@link pickerSelected}.
|
|
1958
|
+
*/
|
|
1959
|
+
pickerRows(catalogue: ModelPickerCatalogue, view: ModelPickerOrder, current: string | undefined): ModelPickerRows {
|
|
1960
|
+
return {
|
|
1961
|
+
query: this.query,
|
|
1962
|
+
cursor: this.cursor,
|
|
1963
|
+
columns: MODEL_PICKER_COLUMNS,
|
|
1964
|
+
...catalogue,
|
|
1965
|
+
order: view.order,
|
|
1966
|
+
...(view.hits ? { hits: view.hits } : {}),
|
|
1967
|
+
selected: this.pickerSelected,
|
|
1968
|
+
...(current ? { current: [current] } : {}),
|
|
1969
|
+
total: this.baseCount,
|
|
1970
|
+
};
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1936
1973
|
/**
|
|
1937
1974
|
* Picker rows for `catalogue`: the same object while the catalogue, roles
|
|
1938
1975
|
* and row inputs are unchanged, so typing and scope hops never resend it.
|
|
@@ -3370,13 +3370,7 @@ export class ModelHubComponent implements Component {
|
|
|
3370
3370
|
...props,
|
|
3371
3371
|
tabs: this.#pickerKindTabs(),
|
|
3372
3372
|
tab: this.#modelKindTab,
|
|
3373
|
-
|
|
3374
|
-
...catalogue,
|
|
3375
|
-
order: view.order,
|
|
3376
|
-
...(view.hits ? { hits: view.hits } : {}),
|
|
3377
|
-
selected: this.#browser.pickerSelected,
|
|
3378
|
-
...(current ? { current } : {}),
|
|
3379
|
-
total: this.#browser.baseCount,
|
|
3373
|
+
...this.#browser.pickerRows(catalogue, view, this.#currentSelector),
|
|
3380
3374
|
state,
|
|
3381
3375
|
...(state === "error" && this.#configError ? { message: this.#configError } : {}),
|
|
3382
3376
|
empty:
|
|
@@ -11,7 +11,6 @@ import type { Component, TUI } from "../tui";
|
|
|
11
11
|
import { type ThemeColor, theme } from "../theme/theme";
|
|
12
12
|
import {
|
|
13
13
|
buildSessionModelScope,
|
|
14
|
-
MODEL_PICKER_COLUMNS,
|
|
15
14
|
ModelBrowser,
|
|
16
15
|
type ModelBrowserItem,
|
|
17
16
|
type ModelPickerCatalogue,
|
|
@@ -424,17 +423,9 @@ export class ModelPickerComponent implements Component {
|
|
|
424
423
|
size: "md",
|
|
425
424
|
layout: "rows",
|
|
426
425
|
preview: "below",
|
|
427
|
-
query,
|
|
428
|
-
cursor,
|
|
429
426
|
placeholder:
|
|
430
427
|
mode === "task" || mode === "selection" ? "Search models…" : "Search models, @ for quick roles…",
|
|
431
|
-
|
|
432
|
-
...catalogue,
|
|
433
|
-
order: view.order,
|
|
434
|
-
...(view.hits ? { hits: view.hits } : {}),
|
|
435
|
-
selected,
|
|
436
|
-
...(current ? { current: [current] } : {}),
|
|
437
|
-
total: this.#browser.baseCount,
|
|
428
|
+
...this.#browser.pickerRows(catalogue, view, current),
|
|
438
429
|
empty: mode === "role" ? `No quick roles in the ${cycleKey} cycle` : "No models available",
|
|
439
430
|
actions: compact([
|
|
440
431
|
pickerAction(
|
|
@@ -17,7 +17,7 @@ import { OverlayPanel } from "../chrome/overlay-box";
|
|
|
17
17
|
import { Input } from "../components/input";
|
|
18
18
|
import { MenuSelection } from "../components/menu-selection";
|
|
19
19
|
import { centeredViewportRange } from "../components/scroll-viewport";
|
|
20
|
-
import type { TspPickerItem, TspSpan, TspTone } from "@linxiraos/pi-wire";
|
|
20
|
+
import type { TspPickerAction, TspPickerItem, TspSpan, TspText, TspTone } from "@linxiraos/pi-wire";
|
|
21
21
|
import { node, span, text } from "../native/describe";
|
|
22
22
|
import type { DescribeContext, NativeNode, NativeUiEvent } from "../native/node";
|
|
23
23
|
import { CLOSE_ACTION, dockedPicker, PICKER_KEY, pickerAction, pickerEvent, pickerQuery } from "../native/picker";
|
|
@@ -32,6 +32,21 @@ export interface OAuthSelectorAuthSource {
|
|
|
32
32
|
readonly keys: Pick<KeysApi, "source">;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* How a host other than `/login` presents the native provider sheet (the
|
|
37
|
+
* setup wizard): its heading, `role` and size, a status line docked above the
|
|
38
|
+
* action bar, and the Esc action that leaves in place of Close (the action's
|
|
39
|
+
* `id` cancels like Esc).
|
|
40
|
+
*/
|
|
41
|
+
export interface OAuthSelectorSheet {
|
|
42
|
+
readonly title: string;
|
|
43
|
+
readonly subtitle: TspText;
|
|
44
|
+
readonly role: string;
|
|
45
|
+
readonly size: "md" | "lg";
|
|
46
|
+
readonly status?: TspText;
|
|
47
|
+
readonly leave: { readonly id: string; readonly label: string };
|
|
48
|
+
}
|
|
49
|
+
|
|
35
50
|
/**
|
|
36
51
|
* Rendered lines before the provider rows: top border
|
|
37
52
|
* (must mirror the constructor's addChild order).
|
|
@@ -80,6 +95,7 @@ export class OAuthSelectorComponent extends OverlayPanel {
|
|
|
80
95
|
/** Picker rows for the whole catalogue; dropped when an auth state changes. */
|
|
81
96
|
#pickerItems: readonly TspPickerItem[] | undefined;
|
|
82
97
|
#pickerRoot: NativeNode | undefined;
|
|
98
|
+
#sheet: OAuthSelectorSheet | undefined;
|
|
83
99
|
constructor(
|
|
84
100
|
mode: "login" | "logout",
|
|
85
101
|
authStorage: OAuthSelectorAuthSource,
|
|
@@ -89,6 +105,7 @@ export class OAuthSelectorComponent extends OverlayPanel {
|
|
|
89
105
|
disabledProviders?: readonly string[];
|
|
90
106
|
validateAuth?: (providerId: string) => Promise<boolean>;
|
|
91
107
|
requestRender?: () => void;
|
|
108
|
+
sheet?: OAuthSelectorSheet;
|
|
92
109
|
},
|
|
93
110
|
) {
|
|
94
111
|
super(mode === "login" ? "Select provider to login" : "Select provider to logout", "zeta.overlay.oauth");
|
|
@@ -98,6 +115,7 @@ export class OAuthSelectorComponent extends OverlayPanel {
|
|
|
98
115
|
this.#onCancelCallback = onCancel;
|
|
99
116
|
this.#validateAuthCallback = options?.validateAuth;
|
|
100
117
|
this.#requestRenderCallback = options?.requestRender;
|
|
118
|
+
this.#sheet = options?.sheet;
|
|
101
119
|
this.#menu = new MenuSelection<OAuthProviderInfo>([], {
|
|
102
120
|
getKey: provider => provider.id,
|
|
103
121
|
getSearchText: provider => this.#getProviderSearchText(provider),
|
|
@@ -117,6 +135,20 @@ export class OAuthSelectorComponent extends OverlayPanel {
|
|
|
117
135
|
this.#stopSpinner();
|
|
118
136
|
}
|
|
119
137
|
|
|
138
|
+
/** Replace the native sheet's presentation (a new outcome line, a relabelled leave action). */
|
|
139
|
+
setSheet(sheet: OAuthSelectorSheet): void {
|
|
140
|
+
this.#sheet = sheet;
|
|
141
|
+
this.#pickerRoot = undefined;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** Re-read credential state after a sign-in stored one, keeping the query and selection. */
|
|
145
|
+
refreshAuth(): void {
|
|
146
|
+
this.#nativeItems = undefined;
|
|
147
|
+
this.#pickerItems = undefined;
|
|
148
|
+
this.#menu.setItems(this.#menu.items);
|
|
149
|
+
this.#updateList();
|
|
150
|
+
}
|
|
151
|
+
|
|
120
152
|
/**
|
|
121
153
|
* Fit the selector into `lines` rendered rows by shrinking the visible list
|
|
122
154
|
* window (the window is centered on the selection, so the selected row is
|
|
@@ -504,12 +536,17 @@ export class OAuthSelectorComponent extends OverlayPanel {
|
|
|
504
536
|
const query = this.#menu.query;
|
|
505
537
|
const login = this.#mode === "login";
|
|
506
538
|
const search = this.#shouldRenderSearchStatus() ? pickerQuery(this.#search) : pickerQuery(null);
|
|
539
|
+
const sheet = this.#sheet;
|
|
540
|
+
const leave: TspPickerAction = sheet
|
|
541
|
+
? pickerAction(sheet.leave.id, sheet.leave.label, "escape", { end: true })
|
|
542
|
+
: CLOSE_ACTION;
|
|
507
543
|
this.#pickerRoot = dockedPicker({
|
|
508
|
-
|
|
509
|
-
|
|
544
|
+
...(sheet ? { role: sheet.role } : {}),
|
|
545
|
+
title: sheet?.title ?? (login ? "Sign in" : "Sign out"),
|
|
546
|
+
subtitle: sheet?.subtitle ?? (login ? "Pick a provider" : "Remove stored credentials"),
|
|
510
547
|
icon: "key-round",
|
|
511
548
|
noun: "providers",
|
|
512
|
-
size: "md",
|
|
549
|
+
size: sheet?.size ?? "md",
|
|
513
550
|
layout: "cards",
|
|
514
551
|
preview: "none",
|
|
515
552
|
...search,
|
|
@@ -520,6 +557,7 @@ export class OAuthSelectorComponent extends OverlayPanel {
|
|
|
520
557
|
total: all.length,
|
|
521
558
|
empty: login ? "No OAuth providers available" : "No stored provider credentials to log out",
|
|
522
559
|
...(this.#statusMessage ? { message: this.#statusMessage } : {}),
|
|
560
|
+
...(sheet?.status ? { strip: { label: sheet.status, items: [] } } : {}),
|
|
523
561
|
actions: [
|
|
524
562
|
pickerAction(
|
|
525
563
|
"confirm",
|
|
@@ -527,7 +565,7 @@ export class OAuthSelectorComponent extends OverlayPanel {
|
|
|
527
565
|
"enter",
|
|
528
566
|
login ? { primary: true } : { primary: true, danger: true },
|
|
529
567
|
),
|
|
530
|
-
|
|
568
|
+
leave,
|
|
531
569
|
],
|
|
532
570
|
});
|
|
533
571
|
return this.#pickerRoot;
|
|
@@ -596,7 +634,7 @@ export class OAuthSelectorComponent extends OverlayPanel {
|
|
|
596
634
|
else if (ev.act === "clear") {
|
|
597
635
|
this.#search.setValue("");
|
|
598
636
|
this.#syncSearchQuery();
|
|
599
|
-
} else if (ev.act === "close" || ev.act === "cancel") {
|
|
637
|
+
} else if (ev.act === "close" || ev.act === "cancel" || ev.act === this.#sheet?.leave.id) {
|
|
600
638
|
this.stopValidation();
|
|
601
639
|
this.#onCancelCallback();
|
|
602
640
|
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import { agentPauseGate } from "@linxiraos/pi-agent-core";
|
|
15
15
|
import { type Component, matchesKey, type OverlayFocusOwner, type OverlayHandle, type OverlayOptions } from "../index";
|
|
16
16
|
import { formatCoarseDuration } from "../chrome/format";
|
|
17
|
-
import { centerLine } from "../utils";
|
|
17
|
+
import { centerLine, visibleWidth } from "../utils";
|
|
18
18
|
import { theme } from "../theme/theme";
|
|
19
19
|
import { matchesAppInterrupt } from "../keybinding-matchers";
|
|
20
20
|
import { formatKeyHint, formatTooltipKey } from "../app-keybindings";
|
|
@@ -24,6 +24,17 @@ import { col, keyed, node, row, span, text } from "../native/describe";
|
|
|
24
24
|
import { actionBar, actionButton } from "../native/overlay";
|
|
25
25
|
import { isNativeRendering } from "../native/state";
|
|
26
26
|
|
|
27
|
+
/** Outstanding turn and job counts supplied by the pause-screen host. */
|
|
28
|
+
export interface PauseWorkStatus {
|
|
29
|
+
unsettledTurns: number;
|
|
30
|
+
unfinishedJobs: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Optional live work source for the pause overlay. */
|
|
34
|
+
export interface PauseScreenOptions {
|
|
35
|
+
getWorkStatus?: () => PauseWorkStatus;
|
|
36
|
+
}
|
|
37
|
+
|
|
27
38
|
/**
|
|
28
39
|
* Slice of `InteractiveModeContext` the pause screen drives. Narrow so tests
|
|
29
40
|
* can exercise the full engage → hold → release lifecycle without a real TUI.
|
|
@@ -39,9 +50,10 @@ export interface PauseScreenHost {
|
|
|
39
50
|
readonly sessionName?: string;
|
|
40
51
|
}
|
|
41
52
|
|
|
42
|
-
|
|
43
|
-
const TICK_MS = 1_000;
|
|
53
|
+
const EMPTY_WORK_STATUS: PauseWorkStatus = { unsettledTurns: 0, unfinishedJobs: 0 };
|
|
44
54
|
|
|
55
|
+
/** Refresh cadence for the live hold clock and work-status snapshot. */
|
|
56
|
+
const TICK_MS = 1_000;
|
|
45
57
|
/** Pause-bar glyph geometry (rows × columns of full blocks per bar). */
|
|
46
58
|
const BAR_ROWS = 7;
|
|
47
59
|
const BAR_WIDTH = 5;
|
|
@@ -49,7 +61,7 @@ const BAR_GAP = 4;
|
|
|
49
61
|
|
|
50
62
|
/** Below either bound the full scene cannot breathe; drop to the compact card. */
|
|
51
63
|
const MIN_FULL_WIDTH = 64;
|
|
52
|
-
const MIN_FULL_HEIGHT =
|
|
64
|
+
const MIN_FULL_HEIGHT = 23;
|
|
53
65
|
|
|
54
66
|
const TITLE = "P A U S E D";
|
|
55
67
|
const BODY_LINES = [
|
|
@@ -79,51 +91,110 @@ function formatClock(ms: number): string {
|
|
|
79
91
|
* Paint the pause scene as exactly `height` rows, vertically centered.
|
|
80
92
|
* Exported for tests.
|
|
81
93
|
*/
|
|
82
|
-
export function renderPauseScreen(
|
|
83
|
-
|
|
94
|
+
export function renderPauseScreen(
|
|
95
|
+
width: number,
|
|
96
|
+
height: number,
|
|
97
|
+
elapsedMs: number,
|
|
98
|
+
sessionName?: string,
|
|
99
|
+
workStatus: PauseWorkStatus = EMPTY_WORK_STATUS,
|
|
100
|
+
): string[] {
|
|
101
|
+
const screenWidth = Math.max(1, Math.floor(width));
|
|
102
|
+
const screenHeight = Math.max(1, Math.floor(height));
|
|
103
|
+
const compact = screenWidth < MIN_FULL_WIDTH || screenHeight < MIN_FULL_HEIGHT;
|
|
104
|
+
const outstanding = workStatus.unsettledTurns > 0 || workStatus.unfinishedJobs > 0;
|
|
105
|
+
const status = outstanding ? "Pausing — waiting for work to settle" : "Paused — ready to suspend";
|
|
106
|
+
const workCounts = [
|
|
107
|
+
`Unsettled turns: ${workStatus.unsettledTurns}`,
|
|
108
|
+
`Unfinished jobs: ${workStatus.unfinishedJobs}`,
|
|
109
|
+
];
|
|
84
110
|
const content: string[] = [];
|
|
85
111
|
// Resume keys mirror PauseScreenComponent#handleInput: `app.interrupt` (raw Escape when unbound), Enter, Space.
|
|
86
112
|
const esc = interruptKey();
|
|
87
113
|
|
|
88
114
|
if (compact) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
115
|
+
const sessionLine = sessionName
|
|
116
|
+
? centerLine(theme.bold(sessionName.replace(/\s+/g, " ").trim()), screenWidth).trimEnd()
|
|
117
|
+
: undefined;
|
|
118
|
+
const titleLine = centerLine(theme.bold(theme.fg("accent", `▌▌ ${TITLE}`)), screenWidth).trimEnd();
|
|
119
|
+
const clockLine = centerLine(theme.fg("dim", `paused for ${formatClock(elapsedMs)}`), screenWidth).trimEnd();
|
|
120
|
+
const statusLine = centerLine(theme.fg(outstanding ? "warning" : "success", status), screenWidth).trimEnd();
|
|
121
|
+
const resumeLine = centerLine(theme.fg("dim", `${esc} to resume`), screenWidth).trimEnd();
|
|
122
|
+
const fullContent: string[] = [];
|
|
123
|
+
if (sessionLine) fullContent.push(sessionLine);
|
|
124
|
+
fullContent.push(titleLine, "", clockLine, statusLine);
|
|
125
|
+
if (outstanding)
|
|
126
|
+
fullContent.push(...workCounts.map(line => centerLine(theme.fg("muted", line), screenWidth).trimEnd()));
|
|
127
|
+
fullContent.push(resumeLine);
|
|
128
|
+
|
|
129
|
+
if (screenHeight >= fullContent.length) {
|
|
130
|
+
content.push(...fullContent);
|
|
131
|
+
} else {
|
|
132
|
+
// Keep the live state and a way out on screen before the decorative card details.
|
|
133
|
+
if (screenHeight === 1) {
|
|
134
|
+
const counts = `T:${workStatus.unsettledTurns} J:${workStatus.unfinishedJobs}`;
|
|
135
|
+
const summary = outstanding ? `${counts} · ${esc} to resume` : `Paused · ${esc} to resume`;
|
|
136
|
+
const abbreviatedSummary = outstanding
|
|
137
|
+
? `T${workStatus.unsettledTurns} J${workStatus.unfinishedJobs} ${esc} resume`
|
|
138
|
+
: `${esc} resume`;
|
|
139
|
+
const visibleSummary = visibleWidth(summary) > screenWidth ? abbreviatedSummary : summary;
|
|
140
|
+
content.push(
|
|
141
|
+
centerLine(theme.fg(outstanding ? "warning" : "success", visibleSummary), screenWidth).trimEnd(),
|
|
142
|
+
);
|
|
143
|
+
} else if (screenHeight === 2 && outstanding) {
|
|
144
|
+
const counts = `Pausing · T:${workStatus.unsettledTurns} J:${workStatus.unfinishedJobs}`;
|
|
145
|
+
content.push(centerLine(theme.fg("warning", counts), screenWidth).trimEnd(), resumeLine);
|
|
146
|
+
} else {
|
|
147
|
+
content.push(statusLine);
|
|
148
|
+
if (outstanding && screenHeight === 3) {
|
|
149
|
+
content.push(
|
|
150
|
+
centerLine(
|
|
151
|
+
theme.fg("muted", `Turns: ${workStatus.unsettledTurns} · Jobs: ${workStatus.unfinishedJobs}`),
|
|
152
|
+
screenWidth,
|
|
153
|
+
).trimEnd(),
|
|
154
|
+
);
|
|
155
|
+
} else if (outstanding) {
|
|
156
|
+
content.push(...workCounts.map(line => centerLine(theme.fg("muted", line), screenWidth).trimEnd()));
|
|
157
|
+
}
|
|
158
|
+
content.push(resumeLine);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (content.length < screenHeight && sessionLine) content.push(sessionLine);
|
|
162
|
+
if (content.length < screenHeight) content.push(titleLine);
|
|
163
|
+
if (content.length < screenHeight) content.push(clockLine);
|
|
92
164
|
}
|
|
93
|
-
content.push(centerLine(theme.bold(theme.fg("accent", `▌▌ ${TITLE}`)), width).trimEnd());
|
|
94
|
-
content.push("");
|
|
95
|
-
content.push(centerLine(theme.fg("dim", `paused for ${formatClock(elapsedMs)}`), width).trimEnd());
|
|
96
|
-
content.push(centerLine(theme.fg("dim", `${esc} to resume`), width).trimEnd());
|
|
97
165
|
} else {
|
|
98
166
|
if (sessionName) {
|
|
99
|
-
content.push(centerLine(theme.bold(sessionName),
|
|
100
|
-
content.push("");
|
|
167
|
+
content.push(centerLine(theme.bold(sessionName.replace(/\s+/g, " ").trim()), screenWidth).trimEnd());
|
|
101
168
|
content.push("");
|
|
102
169
|
}
|
|
103
170
|
const bar = "█".repeat(BAR_WIDTH);
|
|
104
171
|
const glyphRow = `${bar}${" ".repeat(BAR_GAP)}${bar}`;
|
|
105
172
|
for (let i = 0; i < BAR_ROWS; i++) {
|
|
106
|
-
content.push(centerLine(theme.fg("accent", glyphRow),
|
|
173
|
+
content.push(centerLine(theme.fg("accent", glyphRow), screenWidth).trimEnd());
|
|
107
174
|
}
|
|
108
175
|
content.push("");
|
|
109
|
-
content.push(centerLine(theme.bold(theme.fg("accent", TITLE)),
|
|
176
|
+
content.push(centerLine(theme.bold(theme.fg("accent", TITLE)), screenWidth).trimEnd());
|
|
110
177
|
content.push("");
|
|
111
178
|
for (const line of BODY_LINES) {
|
|
112
|
-
content.push(centerLine(theme.fg("muted", line),
|
|
179
|
+
content.push(centerLine(theme.fg("muted", line), screenWidth).trimEnd());
|
|
113
180
|
}
|
|
114
|
-
content.push("");
|
|
115
|
-
|
|
181
|
+
content.push(centerLine(theme.fg(outstanding ? "warning" : "success", status), screenWidth).trimEnd());
|
|
182
|
+
if (outstanding) {
|
|
183
|
+
content.push(centerLine(theme.fg("muted", workCounts[0]!), screenWidth).trimEnd());
|
|
184
|
+
content.push(centerLine(theme.fg("muted", workCounts[1]!), screenWidth).trimEnd());
|
|
185
|
+
}
|
|
186
|
+
content.push(centerLine(theme.fg("dim", `paused for ${formatClock(elapsedMs)}`), screenWidth).trimEnd());
|
|
116
187
|
content.push("");
|
|
117
188
|
const resumeHint = `${esc} · ${formatKeyHint("enter")} · ${formatKeyHint("space")} — resume`;
|
|
118
|
-
content.push(centerLine(theme.fg("dim", resumeHint),
|
|
189
|
+
content.push(centerLine(theme.fg("dim", resumeHint), screenWidth).trimEnd());
|
|
119
190
|
}
|
|
120
191
|
|
|
121
|
-
const topPad = Math.max(0, Math.floor((
|
|
192
|
+
const topPad = Math.max(0, Math.floor((screenHeight - content.length) / 2));
|
|
122
193
|
// oxlint-disable-next-line unicorn/no-new-array -- length preallocation
|
|
123
194
|
const lines: string[] = new Array(topPad).fill("");
|
|
124
195
|
lines.push(...content);
|
|
125
|
-
while (lines.length <
|
|
126
|
-
return lines.slice(0,
|
|
196
|
+
while (lines.length < screenHeight) lines.push("");
|
|
197
|
+
return lines.slice(0, screenHeight);
|
|
127
198
|
}
|
|
128
199
|
|
|
129
200
|
/** Fullscreen overlay component; resolves {@link run} when a resume key lands. */
|
|
@@ -133,19 +204,25 @@ export class PauseScreenComponent implements Component, OverlayFocusOwner {
|
|
|
133
204
|
#disposed = false;
|
|
134
205
|
#startedAt = Date.now();
|
|
135
206
|
#native: NativeNode | undefined;
|
|
207
|
+
#workSnapshot: PauseWorkStatus;
|
|
136
208
|
|
|
137
|
-
constructor(
|
|
209
|
+
constructor(
|
|
210
|
+
readonly host: PauseScreenHost,
|
|
211
|
+
readonly options: PauseScreenOptions = {},
|
|
212
|
+
) {
|
|
213
|
+
this.#workSnapshot = this.#readWorkSnapshot();
|
|
214
|
+
}
|
|
138
215
|
|
|
139
216
|
/** Start the clock; resolves once the user asks to resume. */
|
|
140
217
|
run(): Promise<void> {
|
|
141
218
|
this.#startedAt = agentPauseGate.pausedAt ?? Date.now();
|
|
142
219
|
this.#native = undefined;
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
this.#
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
220
|
+
this.#refreshWorkSnapshot();
|
|
221
|
+
this.#timer ??= setInterval(() => {
|
|
222
|
+
if (this.#disposed) return;
|
|
223
|
+
const statusChanged = this.#refreshWorkSnapshot();
|
|
224
|
+
if (statusChanged || !isNativeRendering()) this.host.ui.requestRender();
|
|
225
|
+
}, TICK_MS);
|
|
149
226
|
this.host.ui.requestRender();
|
|
150
227
|
return this.#done.promise;
|
|
151
228
|
}
|
|
@@ -181,6 +258,25 @@ export class PauseScreenComponent implements Component, OverlayFocusOwner {
|
|
|
181
258
|
this.#native = undefined;
|
|
182
259
|
}
|
|
183
260
|
|
|
261
|
+
#readWorkSnapshot(): PauseWorkStatus {
|
|
262
|
+
const workStatus = this.options.getWorkStatus?.() ?? EMPTY_WORK_STATUS;
|
|
263
|
+
return {
|
|
264
|
+
unsettledTurns: workStatus.unsettledTurns,
|
|
265
|
+
unfinishedJobs: workStatus.unfinishedJobs,
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
#refreshWorkSnapshot(): boolean {
|
|
270
|
+
const next = this.#readWorkSnapshot();
|
|
271
|
+
const previous = this.#workSnapshot;
|
|
272
|
+
if (next.unsettledTurns === previous.unsettledTurns && next.unfinishedJobs === previous.unfinishedJobs) {
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
this.#workSnapshot = next;
|
|
276
|
+
this.#native = undefined;
|
|
277
|
+
return true;
|
|
278
|
+
}
|
|
279
|
+
|
|
184
280
|
/** A glass sheet titled "Paused" (not the whole pane: the transcript stays visible, frozen). */
|
|
185
281
|
readonly nativeOverlay = { role: "zeta.overlay.pause", size: "md", anchor: "center", head: "Paused" } as const;
|
|
186
282
|
|
|
@@ -191,6 +287,41 @@ export class PauseScreenComponent implements Component, OverlayFocusOwner {
|
|
|
191
287
|
*/
|
|
192
288
|
describe(): NativeNode {
|
|
193
289
|
if (this.#native) return this.#native;
|
|
290
|
+
const snapshot = this.#workSnapshot;
|
|
291
|
+
const outstanding = snapshot.unsettledTurns > 0 || snapshot.unfinishedJobs > 0;
|
|
292
|
+
const status = col(
|
|
293
|
+
[
|
|
294
|
+
keyed(
|
|
295
|
+
text(
|
|
296
|
+
[
|
|
297
|
+
span(
|
|
298
|
+
outstanding ? "Pausing — waiting for work to settle" : "Paused — ready to suspend",
|
|
299
|
+
outstanding ? "warning" : "success",
|
|
300
|
+
),
|
|
301
|
+
],
|
|
302
|
+
{ role: "zeta.pause.settlement" },
|
|
303
|
+
),
|
|
304
|
+
"settlement",
|
|
305
|
+
),
|
|
306
|
+
...(outstanding
|
|
307
|
+
? [
|
|
308
|
+
keyed(
|
|
309
|
+
text([span(`Unsettled turns: ${snapshot.unsettledTurns}`, "muted")], {
|
|
310
|
+
role: "zeta.pause.unsettled-turn-count",
|
|
311
|
+
}),
|
|
312
|
+
"unsettled-turns",
|
|
313
|
+
),
|
|
314
|
+
keyed(
|
|
315
|
+
text([span(`Unfinished jobs: ${snapshot.unfinishedJobs}`, "muted")], {
|
|
316
|
+
role: "zeta.pause.unfinished-job-count",
|
|
317
|
+
}),
|
|
318
|
+
"unfinished-jobs",
|
|
319
|
+
),
|
|
320
|
+
]
|
|
321
|
+
: []),
|
|
322
|
+
],
|
|
323
|
+
{ role: "zeta.pause.settlement-status", gap: "sm" },
|
|
324
|
+
);
|
|
194
325
|
const resumeKey = boundKeys("app.interrupt", ["escape"])[0] ?? "escape";
|
|
195
326
|
const hero = row(
|
|
196
327
|
[
|
|
@@ -244,6 +375,7 @@ export class PauseScreenComponent implements Component, OverlayFocusOwner {
|
|
|
244
375
|
this.#native = col(
|
|
245
376
|
[
|
|
246
377
|
keyed(hero, "hero"),
|
|
378
|
+
keyed(status, "settlement-status"),
|
|
247
379
|
keyed(facts, "facts"),
|
|
248
380
|
actionBar([
|
|
249
381
|
keyed(
|
|
@@ -276,6 +408,7 @@ export class PauseScreenComponent implements Component, OverlayFocusOwner {
|
|
|
276
408
|
Math.max(1, this.host.ui.terminal.rows),
|
|
277
409
|
elapsed,
|
|
278
410
|
this.host.sessionName,
|
|
411
|
+
this.#workSnapshot,
|
|
279
412
|
);
|
|
280
413
|
}
|
|
281
414
|
}
|
|
@@ -286,9 +419,9 @@ export class PauseScreenComponent implements Component, OverlayFocusOwner {
|
|
|
286
419
|
* gate on the way out (including teardown throws) — a leaked pause would
|
|
287
420
|
* freeze every agent in the process with no UI left to release it.
|
|
288
421
|
*/
|
|
289
|
-
export async function runPauseScreen(host: PauseScreenHost): Promise<void> {
|
|
422
|
+
export async function runPauseScreen(host: PauseScreenHost, options?: PauseScreenOptions): Promise<void> {
|
|
290
423
|
if (!agentPauseGate.pause()) return;
|
|
291
|
-
const component = new PauseScreenComponent(host);
|
|
424
|
+
const component = new PauseScreenComponent(host, options);
|
|
292
425
|
const overlay = host.ui.showOverlay(component, {
|
|
293
426
|
width: "100%",
|
|
294
427
|
maxHeight: "100%",
|