@linxiraos/pi-tui 1.4.6 → 1.4.9
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 +162 -244
- package/README.md +41 -35
- 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/charts/table-data.d.ts +4 -2
- package/dist/types/chat/assistant-message.d.ts +15 -3
- package/dist/types/chat/bash-execution.d.ts +6 -1
- package/dist/types/chat/display-preferences.d.ts +2 -0
- package/dist/types/chat/eval-execution.d.ts +2 -0
- package/dist/types/chat/execution-shared.d.ts +14 -8
- package/dist/types/chat/extension-types.d.ts +31 -0
- package/dist/types/chat/figure-markdown.d.ts +2 -0
- package/dist/types/chat/reply-write.d.ts +48 -0
- package/dist/types/chat/svg-figure.d.ts +5 -0
- package/dist/types/chat/table-chart.d.ts +6 -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 +13 -3
- package/dist/types/chrome/dynamic-border.d.ts +6 -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 +21 -9
- package/dist/types/components/editor.d.ts +23 -6
- package/dist/types/components/image.d.ts +6 -0
- package/dist/types/components/loader.d.ts +2 -0
- package/dist/types/components/markdown.d.ts +7 -0
- package/dist/types/keybinding-matchers.d.ts +7 -0
- package/dist/types/native/blobs.d.ts +2 -1
- package/dist/types/native/describe.d.ts +4 -2
- package/dist/types/native/node.d.ts +2 -3
- package/dist/types/native/overlay.d.ts +42 -2
- package/dist/types/native/picker.d.ts +4 -4
- package/dist/types/native/state.d.ts +4 -0
- package/dist/types/overlays/annotation-overlay.d.ts +7 -1
- package/dist/types/overlays/annotation-types.d.ts +28 -0
- package/dist/types/overlays/btw-history-panel.d.ts +15 -0
- package/dist/types/overlays/btw-history.d.ts +24 -0
- package/dist/types/overlays/btw-inject.d.ts +22 -0
- package/dist/types/overlays/btw-panel.d.ts +7 -0
- package/dist/types/overlays/hook-editor.d.ts +2 -0
- package/dist/types/overlays/jobs-panel.d.ts +4 -0
- package/dist/types/overlays/login-dialog.d.ts +5 -1
- package/dist/types/overlays/model-browser.d.ts +11 -2
- package/dist/types/overlays/oauth-selector.d.ts +23 -0
- 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/session-selector.d.ts +33 -4
- package/dist/types/prompt/composer.d.ts +56 -5
- package/dist/types/prompt/interactive-context-helpers.d.ts +10 -3
- package/dist/types/render/extension-links.d.ts +65 -0
- package/dist/types/render/hyperlink.d.ts +25 -7
- package/dist/types/render/index.d.ts +1 -0
- package/dist/types/render/render-utils.d.ts +23 -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 +1 -1
- package/dist/types/status-line/context-usage.d.ts +28 -6
- package/dist/types/status-line/host.d.ts +6 -2
- package/dist/types/status-line/startup.d.ts +0 -15
- package/dist/types/terminal-capabilities.d.ts +1 -1
- package/dist/types/theme/symbols.d.ts +3 -1
- package/dist/types/theme/theme-class.d.ts +1 -0
- package/dist/types/theme/theme.d.ts +1 -24
- package/dist/types/theme/tui-adapters.d.ts +2 -0
- package/dist/types/thinking.d.ts +8 -6
- package/dist/types/tools/ast-grep.d.ts +2 -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/eval.d.ts +2 -0
- package/dist/types/tools/find.d.ts +1 -1
- package/dist/types/tools/grouped-file-output.d.ts +100 -19
- package/dist/types/tools/hashline-format.d.ts +5 -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 +6 -5
- package/dist/types/tools/native-view.d.ts +3 -1
- package/dist/types/tools/output-meta.d.ts +27 -0
- package/dist/types/tools/read.d.ts +14 -4
- 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 +13 -4
- package/dist/types/tools/url-scheme-host.d.ts +17 -0
- package/dist/types/tools/wait.d.ts +2 -0
- package/dist/types/tools/yield.d.ts +1 -1
- package/dist/types/tui.d.ts +19 -2
- package/dist/types/utils.d.ts +4 -0
- package/package.json +10 -14
- package/src/app-keybindings.d.ts +20 -0
- package/src/app-keybindings.ts +20 -0
- package/src/apps/git/git-tui.ts +10 -17
- package/src/apps/git/sidebar.ts +21 -35
- package/src/apps/ps-top.ts +4 -12
- package/src/apps/session-picker.ts +7 -0
- package/src/charts/chart-plan.d.ts +9 -7
- package/src/charts/chart-plan.ts +20 -79
- package/src/charts/table-data.d.ts +4 -2
- package/src/charts/table-data.ts +55 -6
- 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 +6 -1
- package/src/chat/bash-execution.ts +26 -9
- package/src/chat/chat-transcript-builder.ts +63 -30
- 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/eval-execution.d.ts +2 -0
- package/src/chat/eval-execution.ts +14 -7
- package/src/chat/execution-shared.d.ts +14 -8
- package/src/chat/execution-shared.ts +39 -18
- package/src/chat/extension-types.d.ts +31 -0
- package/src/chat/extension-types.ts +34 -0
- package/src/chat/figure-markdown.d.ts +2 -0
- package/src/chat/figure-markdown.ts +6 -4
- package/src/chat/read-tool-group.ts +56 -36
- package/src/chat/reply-write.d.ts +48 -0
- package/src/chat/reply-write.ts +127 -0
- package/src/chat/svg-figure.d.ts +5 -0
- package/src/chat/svg-figure.ts +55 -16
- package/src/chat/table-chart.d.ts +6 -3
- package/src/chat/table-chart.ts +29 -6
- 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 +13 -3
- package/src/chat/transcript-render-helpers.ts +134 -44
- package/src/chrome/dynamic-border.d.ts +6 -0
- package/src/chrome/dynamic-border.ts +28 -2
- package/src/chrome/index.ts +1 -0
- package/src/chrome/transcript-notice.d.ts +35 -0
- package/src/chrome/transcript-notice.ts +83 -0
- package/src/chrome/transcript-status.d.ts +21 -9
- package/src/chrome/transcript-status.ts +32 -30
- package/src/components/editor.d.ts +23 -6
- package/src/components/editor.ts +133 -25
- package/src/components/image.d.ts +6 -0
- package/src/components/image.ts +13 -0
- package/src/components/key-value-list.ts +9 -9
- package/src/components/loader.d.ts +2 -0
- package/src/components/loader.ts +7 -0
- package/src/components/markdown.d.ts +7 -0
- package/src/components/markdown.ts +116 -6
- package/src/components/section.ts +1 -9
- package/src/components/table.ts +1 -9
- package/src/hotkeys-markdown.ts +1 -0
- package/src/keybinding-matchers.d.ts +7 -0
- package/src/keybinding-matchers.ts +13 -0
- package/src/native/backend.ts +10 -67
- package/src/native/blobs.d.ts +2 -1
- package/src/native/blobs.ts +3 -2
- package/src/native/describe.d.ts +4 -2
- package/src/native/describe.ts +9 -4
- package/src/native/node.d.ts +2 -3
- package/src/native/node.ts +2 -3
- package/src/native/overlay.d.ts +42 -2
- package/src/native/overlay.ts +124 -16
- package/src/native/picker.d.ts +4 -4
- package/src/native/picker.ts +4 -4
- package/src/native/state.d.ts +4 -0
- package/src/native/state.ts +25 -5
- package/src/overlays/advisor-config.ts +1 -10
- package/src/overlays/annotation-overlay.ts +125 -37
- package/src/overlays/annotation-types.ts +24 -0
- package/src/overlays/btw-history-panel.ts +106 -14
- package/src/overlays/btw-history.ts +65 -0
- package/src/overlays/btw-inject.ts +91 -0
- package/src/overlays/btw-panel.ts +53 -12
- package/src/overlays/extensions/extension-dashboard.ts +7 -8
- package/src/overlays/hook-editor.ts +6 -0
- package/src/overlays/hook-selector.ts +2 -2
- package/src/overlays/jobs-panel.ts +82 -22
- package/src/overlays/login-dialog.ts +39 -31
- package/src/overlays/mcp-add-wizard.ts +1 -1
- package/src/overlays/model-browser.ts +106 -10
- 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/plan-review-overlay.ts +13 -2
- package/src/overlays/rewind-selector.ts +29 -12
- package/src/overlays/session-selector.ts +338 -47
- package/src/overlays/settings-defs.ts +2 -2
- package/src/overlays/tree-selector.ts +83 -27
- package/src/overlays/usage-dashboard.ts +9 -18
- package/src/prompt/composer.ts +233 -6
- 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/render/code-cell.ts +1 -1
- package/src/render/extension-links.d.ts +65 -0
- package/src/render/extension-links.ts +214 -0
- package/src/render/file-list.ts +4 -7
- package/src/render/hyperlink.d.ts +25 -7
- package/src/render/hyperlink.ts +65 -9
- package/src/render/index.d.ts +1 -0
- package/src/render/index.ts +1 -0
- package/src/render/render-utils.d.ts +23 -1
- package/src/render/render-utils.ts +38 -6
- package/src/setup/scenes/composer.ts +2 -0
- package/src/setup/scenes/glyph.ts +4 -2
- package/src/setup/scenes/model.ts +192 -29
- package/src/setup/scenes/outro.ts +33 -15
- package/src/setup/scenes/sign-in.ts +196 -400
- 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 +4 -10
- package/src/status-line/context-usage.ts +72 -21
- package/src/status-line/host.ts +6 -2
- package/src/status-line/startup.ts +36 -70
- package/src/terminal-capabilities.d.ts +1 -1
- package/src/terminal-capabilities.ts +5 -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 +3 -1
- package/src/theme/symbols.ts +16 -9
- package/src/theme/theme-class.d.ts +1 -0
- package/src/theme/theme-class.ts +15 -3
- package/src/theme/theme.d.ts +1 -24
- package/src/theme/theme.ts +3 -75
- package/src/theme/tui-adapters.d.ts +2 -0
- package/src/theme/tui-adapters.ts +8 -3
- package/src/thinking.d.ts +8 -6
- package/src/thinking.ts +17 -11
- package/src/tmux.ts +1 -0
- package/src/tools/agent-tree.ts +13 -11
- package/src/tools/ask.ts +24 -37
- package/src/tools/ast-edit.ts +48 -93
- package/src/tools/ast-grep.d.ts +2 -0
- package/src/tools/ast-grep.ts +31 -67
- 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 +9 -0
- package/src/tools/default-renderer.d.ts +6 -4
- package/src/tools/default-renderer.ts +10 -7
- package/src/tools/edit.ts +50 -43
- package/src/tools/eval.d.ts +2 -0
- package/src/tools/eval.ts +16 -4
- package/src/tools/fetch.ts +2 -1
- package/src/tools/find.d.ts +1 -1
- package/src/tools/find.ts +13 -5
- package/src/tools/github.ts +14 -46
- package/src/tools/glob.ts +2 -1
- package/src/tools/grep.ts +47 -277
- package/src/tools/grouped-file-output.d.ts +100 -19
- package/src/tools/grouped-file-output.ts +414 -103
- package/src/tools/hashline-format.d.ts +5 -0
- package/src/tools/hashline-format.ts +5 -0
- 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 -46
- package/src/tools/lsp.d.ts +2 -0
- package/src/tools/lsp.ts +246 -47
- package/src/tools/mcp.d.ts +6 -5
- package/src/tools/mcp.ts +20 -12
- package/src/tools/native-view.d.ts +3 -1
- package/src/tools/native-view.ts +12 -6
- package/src/tools/output-meta.d.ts +27 -0
- package/src/tools/output-meta.ts +68 -4
- package/src/tools/proc-render.ts +3 -3
- package/src/tools/read.d.ts +14 -4
- package/src/tools/read.ts +20 -5
- 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 +13 -4
- package/src/tools/task.ts +100 -97
- package/src/tools/url-scheme-host.d.ts +17 -0
- package/src/tools/url-scheme-host.ts +21 -0
- package/src/tools/vibe.ts +4 -4
- package/src/tools/wait.d.ts +2 -0
- package/src/tools/wait.ts +8 -5
- package/src/tools/write.ts +17 -27
- package/src/tools/yield.d.ts +1 -1
- package/src/tools/yield.ts +19 -10
- package/src/tui.d.ts +19 -2
- package/src/tui.ts +134 -24
- package/src/utils.d.ts +4 -0
- package/src/utils.ts +10 -0
- 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
|
@@ -39,7 +39,6 @@ export interface SetupHost extends SetupUiHost {
|
|
|
39
39
|
saveColorBlindMode(enabled: boolean): void;
|
|
40
40
|
saveTheme(mode: "dark" | "light", name: string): void;
|
|
41
41
|
captureBrowserSession(request: OAuthBrowserSessionRequest, signal?: AbortSignal): Promise<string>;
|
|
42
|
-
copyToClipboard(text: string): Promise<void>;
|
|
43
42
|
openInBrowser(url: string): void;
|
|
44
43
|
markComplete(version: number): Promise<void>;
|
|
45
44
|
playWelcomeIntro(): void;
|
|
@@ -81,11 +80,29 @@ export interface SetupSceneController extends Component {
|
|
|
81
80
|
routeMouse?(event: SgrMouseEvent, line: number, col: number): void;
|
|
82
81
|
}
|
|
83
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Role of the sheet (`picker` or `overlay`) an interactive scene presents in a
|
|
85
|
+
* TSP terminal. The terminal's setup stylesheet seats it under the wizard's
|
|
86
|
+
* brand and stepper instead of floating it over a dimmed page.
|
|
87
|
+
*/
|
|
88
|
+
export const SETUP_SHEET_ROLE = "zeta.setup.sheet";
|
|
89
|
+
|
|
90
|
+
/** Surface role of the setup page (wizard and startup splash) in a TSP terminal. */
|
|
91
|
+
export const SETUP_SURFACE_ROLE = "zeta.app.setup";
|
|
92
|
+
|
|
84
93
|
/** Versioned onboarding scene definition. */
|
|
85
94
|
export interface SetupScene {
|
|
86
95
|
id: string;
|
|
87
96
|
title: string;
|
|
97
|
+
/** Short label for the wizard's stepper (`Sign in`, `Model`). */
|
|
98
|
+
step: string;
|
|
88
99
|
minVersion: number;
|
|
100
|
+
/**
|
|
101
|
+
* Configures something only the cell-grid renderer draws (glyphs, composer
|
|
102
|
+
* shape, theme). A TSP terminal draws those itself, so the wizard skips the
|
|
103
|
+
* scene while a native surface is live.
|
|
104
|
+
*/
|
|
105
|
+
ansiOnly?: boolean;
|
|
89
106
|
shouldRun?(ctx: SetupHost): boolean | Promise<boolean>;
|
|
90
107
|
mount(host: SetupSceneHost): SetupSceneController;
|
|
91
108
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { type Component, type OverlayFocusOwner } from "../tui";
|
|
2
2
|
import { matchesKey } from "../keys";
|
|
3
|
-
import {
|
|
4
|
-
import type { NativeNode, NativeUiEvent } from "../native/node";
|
|
5
|
-
import { Memo } from "../native/memo";
|
|
3
|
+
import type { NativeNode, NativeScreen, NativeUiEvent } from "../native/node";
|
|
6
4
|
import { isNativeRendering } from "../native/state";
|
|
7
|
-
import type
|
|
5
|
+
import { SETUP_SURFACE_ROLE, type SetupUiHost } from "./scenes/types";
|
|
8
6
|
import { describeSetupSplash, renderSetupSplash, SETUP_SPLASH_MS, SETUP_TICK_MS } from "./scenes/splash";
|
|
9
7
|
|
|
10
8
|
/** Timing controls for the standalone startup animation. */
|
|
@@ -19,7 +17,6 @@ class StartupSplashComponent implements Component, OverlayFocusOwner {
|
|
|
19
17
|
#timer: NodeJS.Timeout | undefined;
|
|
20
18
|
/** Native path: one-shot at the end of the splash; the terminal clocks the motion. */
|
|
21
19
|
#deadline: NodeJS.Timeout | undefined;
|
|
22
|
-
#native = new Memo();
|
|
23
20
|
#done = Promise.withResolvers<void>();
|
|
24
21
|
#disposed = false;
|
|
25
22
|
readonly #durationMs: number;
|
|
@@ -67,9 +64,13 @@ class StartupSplashComponent implements Component, OverlayFocusOwner {
|
|
|
67
64
|
return renderSetupSplash(Math.max(1, width), Math.max(1, this.ctx.ui.terminal.rows), elapsedMs);
|
|
68
65
|
}
|
|
69
66
|
|
|
67
|
+
/** The setup page's splash, on a screen surface of the setup page's role. */
|
|
68
|
+
describeScreen(): NativeScreen {
|
|
69
|
+
return { role: SETUP_SURFACE_ROLE, main: [this], dock: [] };
|
|
70
|
+
}
|
|
71
|
+
|
|
70
72
|
describe(): NativeNode {
|
|
71
|
-
|
|
72
|
-
return this.#native.get([splash], () => col([splash], { grow: 1, role: "zeta.app.startup-splash" }));
|
|
73
|
+
return describeSetupSplash();
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
handleNativeEvent(event: NativeUiEvent): void {
|
|
@@ -7,16 +7,23 @@ import { padToWidth } from "../render/utils";
|
|
|
7
7
|
import { tuiText, tuiTextFmt } from "../i18n";
|
|
8
8
|
import { routeSgrMouseInput, type SgrMouseEvent } from "../mouse";
|
|
9
9
|
import { APP_NAME } from "@linxiraos/pi-utils";
|
|
10
|
-
import { gradientLogo,
|
|
10
|
+
import { gradientLogo, ZETA_LOGO } from "../prompt/welcome";
|
|
11
11
|
import { theme } from "../theme/theme";
|
|
12
|
-
import { col, node, span, text } from "../native/describe";
|
|
13
|
-
import type { NativeNode, NativeUiEvent } from "../native/node";
|
|
12
|
+
import { col, keyed, node, row, span, text } from "../native/describe";
|
|
13
|
+
import type { DescribeContext, NativeChild, NativeNode, NativeScreen, NativeUiEvent } from "../native/node";
|
|
14
14
|
import { Memo } from "../native/memo";
|
|
15
|
+
import { actionButton } from "../native/overlay";
|
|
15
16
|
import { isNativeRendering } from "../native/state";
|
|
16
17
|
import type { SetupHost } from "./scenes/types";
|
|
17
18
|
import { describeSetupOutro, renderSetupOutro, SETUP_OUTRO_MS } from "./scenes/outro";
|
|
18
19
|
import { describeSetupSplash, renderSetupSplash, SETUP_SPLASH_MS, SETUP_TICK_MS } from "./scenes/splash";
|
|
19
|
-
import
|
|
20
|
+
import {
|
|
21
|
+
SETUP_SURFACE_ROLE,
|
|
22
|
+
type SetupScene,
|
|
23
|
+
type SetupSceneController,
|
|
24
|
+
type SetupSceneHost,
|
|
25
|
+
type SetupSceneResult,
|
|
26
|
+
} from "./scenes/types";
|
|
20
27
|
|
|
21
28
|
type WizardPhase = "splash" | "transition" | "scene" | "outro" | "done";
|
|
22
29
|
|
|
@@ -35,6 +42,30 @@ const PHASE_LIMIT_MS: Partial<Record<WizardPhase, number>> = {
|
|
|
35
42
|
/** Nothing left to show once the wizard completed. */
|
|
36
43
|
const DONE_NODE = col([]);
|
|
37
44
|
|
|
45
|
+
/** Whether `scene` is asked under the current renderer: a TSP surface draws `ansiOnly` settings itself. */
|
|
46
|
+
export function setupSceneApplies(scene: SetupScene): boolean {
|
|
47
|
+
return !scene.ansiOnly || !isNativeRendering();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Stepper state of one step: before, at, or after the active scene. */
|
|
51
|
+
type StepState = "done" | "current" | "next";
|
|
52
|
+
|
|
53
|
+
const STEP_TONE = { done: "success", current: "accent", next: "muted" } as const;
|
|
54
|
+
|
|
55
|
+
/** One stepper entry: a disc (check once done, else the step number) and the label. */
|
|
56
|
+
function stepNode(label: string, position: number, state: StepState): NativeNode {
|
|
57
|
+
const disc =
|
|
58
|
+
state === "done"
|
|
59
|
+
? node("icon", { name: "check", role: "zeta.setup.step.disc" })
|
|
60
|
+
: text(String(position + 1), { wrap: "none", role: "zeta.setup.step.disc" });
|
|
61
|
+
return node(
|
|
62
|
+
"row",
|
|
63
|
+
{ align: "center", gap: "xs", role: "zeta.setup.step", tone: STEP_TONE[state] },
|
|
64
|
+
[disc, text(label, { wrap: "none", role: "zeta.setup.step.label" })],
|
|
65
|
+
`step:${position}`,
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
38
69
|
function sceneFooterHint(): string {
|
|
39
70
|
const navKeys = editorKeys("tui.select.up", "tui.select.down");
|
|
40
71
|
return `${navKeys} select · ${editorKey("tui.select.confirm")} confirm · ${editorKey("tui.select.cancel")} skip · ${formatKeyHint("ctrl+c")} exit setup`;
|
|
@@ -76,8 +107,11 @@ export class SetupWizardComponent implements Component, OverlayFocusOwner {
|
|
|
76
107
|
#timer: NodeJS.Timeout | undefined;
|
|
77
108
|
/** Native path: one-shot at the end of a timed phase; the terminal clocks the motion. */
|
|
78
109
|
#deadline: NodeJS.Timeout | undefined;
|
|
110
|
+
#nativeHead = new Memo();
|
|
79
111
|
#nativeScene = new Memo();
|
|
80
112
|
#nativeRoot = new Memo();
|
|
113
|
+
/** Display name of the default model the outro reports; `null` once looked up and absent. */
|
|
114
|
+
#outroModel: string | null | undefined;
|
|
81
115
|
#done = Promise.withResolvers<void>();
|
|
82
116
|
#disposed = false;
|
|
83
117
|
/** Screen row where the active scene's body began in the last rendered frame. */
|
|
@@ -90,7 +124,11 @@ export class SetupWizardComponent implements Component, OverlayFocusOwner {
|
|
|
90
124
|
) {}
|
|
91
125
|
|
|
92
126
|
run(): Promise<void> {
|
|
93
|
-
|
|
127
|
+
if (!this.scenes.some(setupSceneApplies)) {
|
|
128
|
+
this.#complete();
|
|
129
|
+
return this.#done.promise;
|
|
130
|
+
}
|
|
131
|
+
this.#phase = "splash";
|
|
94
132
|
this.#phaseStartedAt = performance.now();
|
|
95
133
|
this.#startTimer();
|
|
96
134
|
this.ctx.ui.requestRender();
|
|
@@ -104,6 +142,7 @@ export class SetupWizardComponent implements Component, OverlayFocusOwner {
|
|
|
104
142
|
}
|
|
105
143
|
|
|
106
144
|
invalidate(): void {
|
|
145
|
+
this.#nativeHead.clear();
|
|
107
146
|
this.#nativeScene.clear();
|
|
108
147
|
this.#activeScene?.invalidate?.();
|
|
109
148
|
}
|
|
@@ -207,13 +246,18 @@ export class SetupWizardComponent implements Component, OverlayFocusOwner {
|
|
|
207
246
|
return this.#fitToScreen(lines, safeWidth, height);
|
|
208
247
|
}
|
|
209
248
|
|
|
249
|
+
/** The wizard is a page of its own: a screen surface styled by {@link SETUP_SURFACE_ROLE}. */
|
|
250
|
+
describeScreen(_cx: DescribeContext): NativeScreen {
|
|
251
|
+
return { role: SETUP_SURFACE_ROLE, main: [this], dock: [] };
|
|
252
|
+
}
|
|
253
|
+
|
|
210
254
|
/**
|
|
211
|
-
* Fullscreen description: splash, the active scene
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
255
|
+
* Fullscreen description: splash, the active scene under the setup
|
|
256
|
+
* header (brand, stepper, Exit setup), or the outro. The splash→scene
|
|
257
|
+
* dissolve is a row effect with no native counterpart, so a transition
|
|
258
|
+
* describes as the scene.
|
|
215
259
|
*/
|
|
216
|
-
describe(): NativeNode {
|
|
260
|
+
describe(cx: DescribeContext): NativeNode {
|
|
217
261
|
let content: NativeNode;
|
|
218
262
|
switch (this.#phase) {
|
|
219
263
|
case "splash":
|
|
@@ -221,10 +265,10 @@ export class SetupWizardComponent implements Component, OverlayFocusOwner {
|
|
|
221
265
|
break;
|
|
222
266
|
case "transition":
|
|
223
267
|
case "scene":
|
|
224
|
-
content = this.#describeScene();
|
|
268
|
+
content = this.#describeScene(cx.supports("picker"));
|
|
225
269
|
break;
|
|
226
270
|
case "outro":
|
|
227
|
-
content = describeSetupOutro();
|
|
271
|
+
content = describeSetupOutro(this.#outroModelName());
|
|
228
272
|
break;
|
|
229
273
|
case "done":
|
|
230
274
|
content = DONE_NODE;
|
|
@@ -242,53 +286,133 @@ export class SetupWizardComponent implements Component, OverlayFocusOwner {
|
|
|
242
286
|
if (event.type !== "action") return;
|
|
243
287
|
if (event.act === "skip" && this.#phase === "splash") this.#beginScene();
|
|
244
288
|
else if (event.act === "continue" && this.#phase === "outro") this.#complete();
|
|
289
|
+
else if (event.act === "exit" && (this.#phase === "scene" || this.#phase === "transition")) this.#beginOutro();
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* The steps the stepper and the ANSI counter show: every scene that
|
|
294
|
+
* applies to the current renderer, plus the active one (so a renderer
|
|
295
|
+
* switch mid-scene never orphans it), and the active one's position.
|
|
296
|
+
*/
|
|
297
|
+
#steps(): { scenes: SetupScene[]; current: number } {
|
|
298
|
+
const scenes: SetupScene[] = [];
|
|
299
|
+
let current = 0;
|
|
300
|
+
this.scenes.forEach((scene, index) => {
|
|
301
|
+
if (index === this.#sceneIndex) current = scenes.length;
|
|
302
|
+
if (index === this.#sceneIndex || setupSceneApplies(scene)) scenes.push(scene);
|
|
303
|
+
});
|
|
304
|
+
return { scenes, current };
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* The setup header, a fixed-height row: the compact brand lockup (the
|
|
309
|
+
* builtin `zeta` mark and wordmark), the stepper of the applicable scenes
|
|
310
|
+
* (done = check in the success tone, current = accent, upcoming = muted,
|
|
311
|
+
* hairline connectors between), and a quiet Exit setup button (⌃C).
|
|
312
|
+
*/
|
|
313
|
+
#describeHead(): NativeNode {
|
|
314
|
+
return this.#nativeHead.get([this.#sceneIndex], () => {
|
|
315
|
+
const { scenes, current } = this.#steps();
|
|
316
|
+
const steps: NativeChild[] = [];
|
|
317
|
+
scenes.forEach((scene, position) => {
|
|
318
|
+
if (position > 0) {
|
|
319
|
+
steps.push(
|
|
320
|
+
node(
|
|
321
|
+
"rule",
|
|
322
|
+
{ role: "zeta.setup.step.line", tone: position <= current ? "success" : "muted" },
|
|
323
|
+
undefined,
|
|
324
|
+
`line:${position}`,
|
|
325
|
+
),
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
steps.push(
|
|
329
|
+
stepNode(scene.step, position, position < current ? "done" : position === current ? "current" : "next"),
|
|
330
|
+
);
|
|
331
|
+
});
|
|
332
|
+
return keyed(
|
|
333
|
+
row(
|
|
334
|
+
[
|
|
335
|
+
keyed(
|
|
336
|
+
row(
|
|
337
|
+
[
|
|
338
|
+
node(
|
|
339
|
+
"image",
|
|
340
|
+
{ builtin: "zeta", alt: APP_NAME, w: 22, role: "zeta.setup.mark" },
|
|
341
|
+
undefined,
|
|
342
|
+
"logo",
|
|
343
|
+
),
|
|
344
|
+
keyed(
|
|
345
|
+
text([span(APP_NAME, "strong")], { wrap: "none", role: "zeta.setup.brand.name" }),
|
|
346
|
+
"name",
|
|
347
|
+
),
|
|
348
|
+
keyed(
|
|
349
|
+
text([span("Setup", "muted")], { wrap: "none", role: "zeta.setup.brand.label" }),
|
|
350
|
+
"label",
|
|
351
|
+
),
|
|
352
|
+
],
|
|
353
|
+
{ align: "center", role: "zeta.setup.brand" },
|
|
354
|
+
),
|
|
355
|
+
"brand",
|
|
356
|
+
),
|
|
357
|
+
keyed(row(steps, { align: "center", role: "zeta.setup.steps" }), "steps"),
|
|
358
|
+
actionButton("Exit setup", "exit", { keys: "ctrl+c" }),
|
|
359
|
+
],
|
|
360
|
+
{ align: "center", role: "zeta.setup.head" },
|
|
361
|
+
),
|
|
362
|
+
"head",
|
|
363
|
+
);
|
|
364
|
+
});
|
|
245
365
|
}
|
|
246
366
|
|
|
247
|
-
|
|
367
|
+
/**
|
|
368
|
+
* The scene page: the setup header over the body. A terminal that draws
|
|
369
|
+
* `picker` sheets gets the active scene alone (its sheet, titled with the
|
|
370
|
+
* scene, hoists into the layer and sits under the header); otherwise the
|
|
371
|
+
* scene title and subtitle head the scene's inline content.
|
|
372
|
+
*/
|
|
373
|
+
#describeScene(pickers: boolean): NativeNode {
|
|
248
374
|
const scene = this.scenes[this.#sceneIndex];
|
|
249
375
|
const active = this.#activeScene;
|
|
250
376
|
const title = active?.title ?? scene?.title ?? "Setup";
|
|
251
377
|
const subtitle = active?.subtitle;
|
|
252
|
-
const
|
|
253
|
-
return this.#nativeScene.get([
|
|
254
|
-
const
|
|
255
|
-
if (
|
|
378
|
+
const head = this.#describeHead();
|
|
379
|
+
return this.#nativeScene.get([head, active, title, subtitle, pickers], () => {
|
|
380
|
+
const body: NativeChild[] = [];
|
|
381
|
+
if (!pickers) {
|
|
382
|
+
body.push(keyed(text([span(title, "strong")], { role: "zeta.setup.title" }), "title"));
|
|
383
|
+
if (subtitle)
|
|
384
|
+
body.push(keyed(text([span(subtitle, "muted")], { role: "zeta.setup.subtitle" }), "subtitle"));
|
|
385
|
+
}
|
|
386
|
+
if (active) body.push(active);
|
|
256
387
|
return col(
|
|
257
388
|
[
|
|
258
|
-
|
|
259
|
-
[
|
|
260
|
-
logoNode(ZETA_LOGO, false),
|
|
261
|
-
text([span(APP_NAME, "accent strong")], { wrap: "none" }),
|
|
262
|
-
text([span(`Setup step ${this.#sceneIndex + 1} of ${this.scenes.length}`, "muted")], {
|
|
263
|
-
wrap: "none",
|
|
264
|
-
}),
|
|
265
|
-
],
|
|
266
|
-
{ align: "center" },
|
|
267
|
-
),
|
|
268
|
-
col(heading),
|
|
389
|
+
head,
|
|
269
390
|
// Keyed by scene so a new scene's nodes never reuse the previous one's ids.
|
|
270
|
-
node("col", { grow: 1
|
|
271
|
-
col([text([span(footer, "dim")])], { align: "center" }),
|
|
391
|
+
node("col", { grow: 1, role: "zeta.setup.body" }, body, `body:${scene?.id ?? this.#sceneIndex}`),
|
|
272
392
|
],
|
|
273
|
-
{
|
|
393
|
+
{ grow: 1, role: "zeta.setup.scene" },
|
|
274
394
|
);
|
|
275
395
|
});
|
|
276
396
|
}
|
|
277
397
|
|
|
398
|
+
/** The default model's display name for the outro, looked up once per outro. */
|
|
399
|
+
#outroModelName(): string | undefined {
|
|
400
|
+
if (this.#outroModel === undefined) this.#outroModel = this.ctx.getModels().current?.name ?? null;
|
|
401
|
+
return this.#outroModel ?? undefined;
|
|
402
|
+
}
|
|
403
|
+
|
|
278
404
|
#renderScene(width: number, height: number): string[] {
|
|
279
405
|
const scene = this.scenes[this.#sceneIndex];
|
|
280
406
|
const title = this.#activeScene?.title ?? scene?.title ?? tuiText("setupFallbackTitle", "Setup");
|
|
281
407
|
const subtitle = this.#activeScene?.subtitle;
|
|
408
|
+
const { scenes: steps, current } = this.#steps();
|
|
282
409
|
const contentWidth = Math.max(MIN_CONTENT_WIDTH, width - SCENE_MARGIN_X * 2);
|
|
283
410
|
const logo = gradientLogo(ZETA_LOGO, 0);
|
|
284
411
|
const header = [
|
|
285
412
|
...logo.map(line => centerLine(line, width)),
|
|
286
413
|
centerLine(theme.bold(theme.fg("accent", APP_NAME)), width),
|
|
287
414
|
centerLine(
|
|
288
|
-
theme.fg(
|
|
289
|
-
"muted",
|
|
290
|
-
tuiTextFmt("setupStepFmt", "Setup step %s of %s", this.#sceneIndex + 1, this.scenes.length),
|
|
291
|
-
),
|
|
415
|
+
theme.fg("muted", tuiTextFmt("setupStepFmt", "Setup step %s of %s", current + 1, steps.length)),
|
|
292
416
|
width,
|
|
293
417
|
),
|
|
294
418
|
"",
|
|
@@ -373,6 +497,10 @@ export class SetupWizardComponent implements Component, OverlayFocusOwner {
|
|
|
373
497
|
#mountSceneController(targetPhase: "scene" | "transition"): void {
|
|
374
498
|
if (this.#disposed) return;
|
|
375
499
|
this.#unmountActiveScene();
|
|
500
|
+
// Decided at mount time, so a native surface opened or closed mid-wizard is honored.
|
|
501
|
+
while (this.#sceneIndex < this.scenes.length && !setupSceneApplies(this.scenes[this.#sceneIndex])) {
|
|
502
|
+
this.#sceneIndex += 1;
|
|
503
|
+
}
|
|
376
504
|
if (this.#sceneIndex >= this.scenes.length) {
|
|
377
505
|
this.#beginOutro();
|
|
378
506
|
return;
|
|
@@ -428,6 +556,7 @@ export class SetupWizardComponent implements Component, OverlayFocusOwner {
|
|
|
428
556
|
if (this.#phase === "done") return;
|
|
429
557
|
this.#unmountActiveScene();
|
|
430
558
|
this.#phase = "outro";
|
|
559
|
+
this.#outroModel = undefined;
|
|
431
560
|
this.#phaseStartedAt = performance.now();
|
|
432
561
|
this.ctx.ui.setFocus(this);
|
|
433
562
|
this.#startTimer();
|
package/src/setup/wizard.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { modelSetupScene } from "./scenes/model";
|
|
|
6
6
|
import { providersSetupScene } from "./scenes/sign-in";
|
|
7
7
|
import { themeSetupScene } from "./scenes/theme";
|
|
8
8
|
import type { SetupScene } from "./scenes/types";
|
|
9
|
-
import { SetupWizardComponent } from "./wizard-overlay";
|
|
9
|
+
import { SetupWizardComponent, setupSceneApplies } from "./wizard-overlay";
|
|
10
10
|
|
|
11
11
|
export type { SetupScene, SetupSceneController, SetupSceneHost, SetupSceneResult } from "./scenes/types";
|
|
12
12
|
|
|
@@ -70,13 +70,22 @@ export interface RunSetupWizardOptions {
|
|
|
70
70
|
playWelcomeIntro?: boolean;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* Own the fullscreen setup overlay until its scenes and outro finish. When
|
|
75
|
+
* none of `scenes` applies to the current renderer (a TSP surface skips
|
|
76
|
+
* `ansiOnly` ones) nothing is shown, but completion is still persisted.
|
|
77
|
+
*/
|
|
74
78
|
export async function runSetupWizard(
|
|
75
79
|
ctx: SetupHost,
|
|
76
80
|
scenes: readonly SetupScene[] = ALL_SCENES,
|
|
77
81
|
options: RunSetupWizardOptions = {},
|
|
78
82
|
): Promise<void> {
|
|
79
83
|
if (scenes.length === 0) return;
|
|
84
|
+
if (!scenes.some(setupSceneApplies)) {
|
|
85
|
+
if (options.markComplete !== false) await ctx.markComplete(CURRENT_SETUP_VERSION);
|
|
86
|
+
if (options.playWelcomeIntro !== false) ctx.playWelcomeIntro();
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
80
89
|
const component = new SetupWizardComponent(ctx, scenes);
|
|
81
90
|
const overlay = ctx.ui.showOverlay(component, {
|
|
82
91
|
width: "100%",
|
|
@@ -828,8 +828,6 @@ export class StatusLineComponent<TSession extends StatusLineSession = StatusLine
|
|
|
828
828
|
#codexResetSnapshots = new Map<string, CodexResetUsageSnapshot>();
|
|
829
829
|
#onCodexResetFireworks: ((event: CodexResetFireworksEvent) => void) | undefined;
|
|
830
830
|
#onResetExpiryNotice: ((notice: string) => void) | undefined;
|
|
831
|
-
/** Conversations already warned about expiring saved resets: later refreshes stay quiet. */
|
|
832
|
-
#resetExpiryNoticedSessions = new Set<string>();
|
|
833
831
|
// Context-usage memo. The status line redraws on every agent event, so the
|
|
834
832
|
// hot path must not recompute context tokens unless an input changed.
|
|
835
833
|
// `getContextUsage()` anchors on the last assistant's real prompt-token
|
|
@@ -1249,7 +1247,7 @@ export class StatusLineComponent<TSession extends StatusLineSession = StatusLine
|
|
|
1249
1247
|
this.#onCodexResetFireworks = handler;
|
|
1250
1248
|
}
|
|
1251
1249
|
|
|
1252
|
-
/** Set the callback that presents
|
|
1250
|
+
/** Set the callback that presents pool-wide saved-reset expiry warnings, or clear it with `undefined`. */
|
|
1253
1251
|
setResetExpiryNoticeHandler(handler: ((notice: string) => void) | undefined): void {
|
|
1254
1252
|
this.#onResetExpiryNotice = handler;
|
|
1255
1253
|
}
|
|
@@ -2132,7 +2130,7 @@ export class StatusLineComponent<TSession extends StatusLineSession = StatusLine
|
|
|
2132
2130
|
}
|
|
2133
2131
|
|
|
2134
2132
|
#noticeResetExpiry(session: TSession, reports: unknown): void {
|
|
2135
|
-
// A focused subagent's view is not a conversation the user started;
|
|
2133
|
+
// A focused subagent's view is not a conversation the user started; leave the warning for their own.
|
|
2136
2134
|
if (
|
|
2137
2135
|
this.#focusedAgentId !== undefined ||
|
|
2138
2136
|
!this.#onResetExpiryNotice ||
|
|
@@ -2141,8 +2139,6 @@ export class StatusLineComponent<TSession extends StatusLineSession = StatusLine
|
|
|
2141
2139
|
) {
|
|
2142
2140
|
return;
|
|
2143
2141
|
}
|
|
2144
|
-
const sessionId = session.sessionManager.getSessionId();
|
|
2145
|
-
if (this.#resetExpiryNoticedSessions.has(sessionId)) return;
|
|
2146
2142
|
// fetchUsageReports supplies normalized rows; keep only entries shaped like reports.
|
|
2147
2143
|
const usageReports = reports.filter(
|
|
2148
2144
|
(report): report is UsageReport =>
|
|
@@ -2152,10 +2148,8 @@ export class StatusLineComponent<TSession extends StatusLineSession = StatusLine
|
|
|
2152
2148
|
"limits" in report &&
|
|
2153
2149
|
Array.isArray(report.limits),
|
|
2154
2150
|
);
|
|
2155
|
-
const notice = this.host.resetExpiryNotice(usageReports, Date.now());
|
|
2156
|
-
if (
|
|
2157
|
-
this.#resetExpiryNoticedSessions.add(sessionId);
|
|
2158
|
-
this.#onResetExpiryNotice(notice);
|
|
2151
|
+
const notice = this.host.resetExpiryNotice(session, usageReports, Date.now());
|
|
2152
|
+
if (notice) this.#onResetExpiryNotice(notice);
|
|
2159
2153
|
}
|
|
2160
2154
|
|
|
2161
2155
|
#observeLateUsageRefresh(session: TSession, reportsPromise: Promise<unknown>, sequence: number): void {
|