@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
|
@@ -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));
|
|
@@ -442,18 +468,7 @@ export class LoginDialogComponent extends OverlayPanel {
|
|
|
442
468
|
[
|
|
443
469
|
node("icon", { name: "link" }, undefined, "icon"),
|
|
444
470
|
keyed(shown, "url"),
|
|
445
|
-
|
|
446
|
-
"row",
|
|
447
|
-
{
|
|
448
|
-
role: "zeta.btn",
|
|
449
|
-
align: "center",
|
|
450
|
-
actions: { click: "copy" },
|
|
451
|
-
href: url,
|
|
452
|
-
title: "Copy the sign-in link",
|
|
453
|
-
},
|
|
454
|
-
[text("Copy")],
|
|
455
|
-
"copyLink",
|
|
456
|
-
),
|
|
471
|
+
actionButton("Copy", "copy", { key: "copyLink", href: url, title: "Copy the sign-in link" }),
|
|
457
472
|
],
|
|
458
473
|
"link",
|
|
459
474
|
);
|
|
@@ -461,20 +476,13 @@ export class LoginDialogComponent extends OverlayPanel {
|
|
|
461
476
|
|
|
462
477
|
/** Open sign-in page (Tern opens the link itself): the primary action while nothing waits for an answer. */
|
|
463
478
|
#describeOpen(url: string, primary: boolean): NativeNode {
|
|
464
|
-
return
|
|
465
|
-
"
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
href: url,
|
|
472
|
-
title: `Open ${urlPlace(url)} in your browser`,
|
|
473
|
-
...(primary ? { tone: "accent" as const } : {}),
|
|
474
|
-
},
|
|
475
|
-
[text("Open sign-in page"), node("icon", { name: "open" }, undefined, "icon")],
|
|
476
|
-
"openLink",
|
|
477
|
-
);
|
|
479
|
+
return actionButton("Open sign-in page", "open", {
|
|
480
|
+
key: "openLink",
|
|
481
|
+
href: url,
|
|
482
|
+
title: `Open ${urlPlace(url)} in your browser`,
|
|
483
|
+
icon: "open",
|
|
484
|
+
tone: primary ? "accent" : undefined,
|
|
485
|
+
});
|
|
478
486
|
}
|
|
479
487
|
|
|
480
488
|
/** The stage running now: a spinner and what it waits for. */
|
|
@@ -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
|
});
|
|
@@ -10,7 +10,12 @@
|
|
|
10
10
|
import { ThinkingLevel } from "@linxiraos/pi-agent-core";
|
|
11
11
|
import type { Model } from "@linxiraos/pi-ai";
|
|
12
12
|
import { buildModel } from "@linxiraos/pi-catalog/build";
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
getEffectiveTokenCost,
|
|
15
|
+
getFactoryDroidCreditRate,
|
|
16
|
+
getModelPricingStatus,
|
|
17
|
+
modelsAreEqual,
|
|
18
|
+
} from "@linxiraos/pi-catalog/models";
|
|
14
19
|
import { modelKind, type ModelKind, type ModelPricingStatus } from "@linxiraos/pi-catalog/types";
|
|
15
20
|
import type { Component } from "../tui";
|
|
16
21
|
import { FuzzyCorpus, fuzzyRank } from "../fuzzy";
|
|
@@ -42,6 +47,7 @@ import type {
|
|
|
42
47
|
TspPickerGroup,
|
|
43
48
|
TspPickerItem,
|
|
44
49
|
TspPickerMark,
|
|
50
|
+
TspPickerProps,
|
|
45
51
|
TspSpan,
|
|
46
52
|
TspText,
|
|
47
53
|
} from "@linxiraos/pi-wire";
|
|
@@ -68,7 +74,8 @@ export type ModelRole =
|
|
|
68
74
|
| "web"
|
|
69
75
|
| "speech"
|
|
70
76
|
| "dictation"
|
|
71
|
-
| "judge"
|
|
77
|
+
| "judge"
|
|
78
|
+
| "taste";
|
|
72
79
|
export const MODEL_ROLE_IDS: ModelRole[] = [
|
|
73
80
|
"default",
|
|
74
81
|
"smol",
|
|
@@ -86,6 +93,7 @@ export const MODEL_ROLE_IDS: ModelRole[] = [
|
|
|
86
93
|
"speech",
|
|
87
94
|
"dictation",
|
|
88
95
|
"judge",
|
|
96
|
+
"taste",
|
|
89
97
|
];
|
|
90
98
|
export const CHAT_MODEL_ROLE_IDS: ModelRole[] = [
|
|
91
99
|
"default",
|
|
@@ -100,7 +108,7 @@ export const CHAT_MODEL_ROLE_IDS: ModelRole[] = [
|
|
|
100
108
|
"advisor",
|
|
101
109
|
"widget",
|
|
102
110
|
];
|
|
103
|
-
export const KIND_ROLE_IDS: ModelRole[] = ["image", "web", "speech", "dictation", "judge"];
|
|
111
|
+
export const KIND_ROLE_IDS: ModelRole[] = ["image", "web", "speech", "dictation", "judge", "taste"];
|
|
104
112
|
|
|
105
113
|
/** Measured model performance shown in browser rows. */
|
|
106
114
|
export interface ModelBrowserPerf {
|
|
@@ -746,7 +754,7 @@ function isFreeModel(model: Model): boolean {
|
|
|
746
754
|
const declared = declaredPricingStatus(model);
|
|
747
755
|
if (declared !== undefined) return declared === "free";
|
|
748
756
|
const cost = model.cost ? getEffectiveTokenCost(model.cost) : undefined;
|
|
749
|
-
const credits = model
|
|
757
|
+
const credits = getFactoryDroidCreditRate(model)?.rate;
|
|
750
758
|
return (!cost || (cost.input === 0 && cost.output === 0)) && (credits === undefined || credits === 0);
|
|
751
759
|
}
|
|
752
760
|
|
|
@@ -760,15 +768,22 @@ function formatCostLeg(n: number): string {
|
|
|
760
768
|
return s.includes(".") ? s.replace(/\.?0+$/, "") : s;
|
|
761
769
|
}
|
|
762
770
|
|
|
771
|
+
/** `2× from 2026-11-22` when a dated Factory Droid credit card changes the rate in force now; undefined otherwise. */
|
|
772
|
+
function nextCreditRateNote(model: Model): string | undefined {
|
|
773
|
+
const next = getFactoryDroidCreditRate(model)?.next;
|
|
774
|
+
return next ? `${formatCostLeg(next.rate)}× from ${new Date(next.at).toISOString().slice(0, 10)}` : undefined;
|
|
775
|
+
}
|
|
776
|
+
|
|
763
777
|
/**
|
|
764
|
-
* Adds Factory Droid's `N×`
|
|
765
|
-
*
|
|
766
|
-
*
|
|
778
|
+
* Adds Factory Droid's `N×` Standard Credits rate in force now (its dated
|
|
779
|
+
* `credit-rates` card applied) to a dollar price, replacing the price when the
|
|
780
|
+
* model has no dollar reference. The dollar reference never includes vendor
|
|
781
|
+
* promotions; the preview and detail facts name the next rate (`nextCreditRateNote`).
|
|
767
782
|
*/
|
|
768
783
|
function withCreditBadge(model: Model, price: string): string {
|
|
769
|
-
const credits = model
|
|
784
|
+
const credits = getFactoryDroidCreditRate(model);
|
|
770
785
|
if (credits === undefined) return price;
|
|
771
|
-
const badge = `${formatCostLeg(credits)}×`;
|
|
786
|
+
const badge = `${formatCostLeg(credits.rate)}×`;
|
|
772
787
|
const cost = getEffectiveTokenCost(model.cost);
|
|
773
788
|
return cost.input !== 0 || cost.output !== 0 ? `${price} ${badge}` : badge;
|
|
774
789
|
}
|
|
@@ -819,7 +834,9 @@ function previewPrice(model: Model): string {
|
|
|
819
834
|
const cost = getEffectiveTokenCost(model.cost);
|
|
820
835
|
const parts = [`$${formatCostLeg(cost.input)} in`, `$${formatCostLeg(cost.output)} out`];
|
|
821
836
|
if (cost.cacheRead > 0) parts.push(`$${formatCostLeg(cost.cacheRead)} cache`);
|
|
822
|
-
|
|
837
|
+
const priced = withCreditBadge(model, parts.join(" · "));
|
|
838
|
+
const note = nextCreditRateNote(model);
|
|
839
|
+
return note ? `${priced} (${note})` : priced;
|
|
823
840
|
}
|
|
824
841
|
|
|
825
842
|
/**
|
|
@@ -918,6 +935,22 @@ export interface ModelPickerCatalogue {
|
|
|
918
935
|
readonly itemsDel?: readonly string[];
|
|
919
936
|
}
|
|
920
937
|
|
|
938
|
+
/** The search, fact-column and row props every model `picker` sheet sends ({@link ModelBrowser.pickerRows}). */
|
|
939
|
+
export type ModelPickerRows = Pick<
|
|
940
|
+
TspPickerProps,
|
|
941
|
+
| "query"
|
|
942
|
+
| "cursor"
|
|
943
|
+
| "columns"
|
|
944
|
+
| "items"
|
|
945
|
+
| "itemsAdd"
|
|
946
|
+
| "itemsDel"
|
|
947
|
+
| "order"
|
|
948
|
+
| "hits"
|
|
949
|
+
| "selected"
|
|
950
|
+
| "current"
|
|
951
|
+
| "total"
|
|
952
|
+
>;
|
|
953
|
+
|
|
921
954
|
/** How {@link ModelBrowser.pickerOrder} heads its rows. */
|
|
922
955
|
export interface ModelPickerGrouping {
|
|
923
956
|
/** One group per provider after the Recent block (the unfiltered All models view). */
|
|
@@ -1008,6 +1041,8 @@ export class ModelBrowser implements Component {
|
|
|
1008
1041
|
| undefined;
|
|
1009
1042
|
/** Theme-formatted catalog metric cells per item; rebuilt when the item's model or the theme changes. */
|
|
1010
1043
|
#metricCells = new WeakMap<ModelBrowserItem, MetricCells>();
|
|
1044
|
+
/** Earliest dated credit-rate change among models whose rows are memoized; passing it rebuilds them. */
|
|
1045
|
+
#nextCreditChange = Number.POSITIVE_INFINITY;
|
|
1011
1046
|
/** Non-separator items of the last ranked visible list, for {@link queryMatches}. */
|
|
1012
1047
|
#queryMatches: { visible: readonly ModelBrowserItem[]; matches: readonly ModelBrowserItem[] } | undefined;
|
|
1013
1048
|
#hoveredIndex: number | null = null;
|
|
@@ -1099,6 +1134,7 @@ export class ModelBrowser implements Component {
|
|
|
1099
1134
|
|
|
1100
1135
|
/** Replace the scope's base items; the live query re-applies and selection is pinned by selector. */
|
|
1101
1136
|
setItems(items: ModelBrowserItem[]): void {
|
|
1137
|
+
for (const item of items) this.#noteCreditChange(item.model);
|
|
1102
1138
|
const selectedKey = this.getSelected()?.selector;
|
|
1103
1139
|
this.#menu.setItems(this.#insertSeparator(items), selectedKey);
|
|
1104
1140
|
this.onSelectionChange?.(this.getSelected());
|
|
@@ -1494,6 +1530,7 @@ export class ModelBrowser implements Component {
|
|
|
1494
1530
|
#metricCellsFor(item: ModelBrowserItem): MetricCells {
|
|
1495
1531
|
const cached = this.#metricCells.get(item);
|
|
1496
1532
|
if (cached?.model === item.model && cached.theme === theme) return cached;
|
|
1533
|
+
this.#noteCreditChange(item.model);
|
|
1497
1534
|
const intelligence = formatIntelligence(item.model);
|
|
1498
1535
|
const ctx = formatContext(item.model);
|
|
1499
1536
|
const cost = formatCostPair(item.model);
|
|
@@ -1610,6 +1647,9 @@ export class ModelBrowser implements Component {
|
|
|
1610
1647
|
} else if (model.tps != null && Number.isFinite(model.tps) && model.tps > 0) {
|
|
1611
1648
|
facts.push(`~${formatTps(model.tps)}`);
|
|
1612
1649
|
}
|
|
1650
|
+
// Last fact before prose, so narrow widths cut it before capability and perf facts.
|
|
1651
|
+
const nextCredits = nextCreditRateNote(model);
|
|
1652
|
+
if (nextCredits) facts.push(nextCredits);
|
|
1613
1653
|
if (model.description) {
|
|
1614
1654
|
const description = formatDescription(model.description);
|
|
1615
1655
|
if (description) facts.push(description);
|
|
@@ -1641,6 +1681,7 @@ export class ModelBrowser implements Component {
|
|
|
1641
1681
|
}
|
|
1642
1682
|
|
|
1643
1683
|
render(width: number): string[] {
|
|
1684
|
+
this.#syncCreditClock();
|
|
1644
1685
|
const lines: string[] = [];
|
|
1645
1686
|
|
|
1646
1687
|
const searchIcon = theme.fg("accent", theme.symbol("icon.search"));
|
|
@@ -1732,6 +1773,30 @@ export class ModelBrowser implements Component {
|
|
|
1732
1773
|
|
|
1733
1774
|
invalidate(): void {}
|
|
1734
1775
|
|
|
1776
|
+
/** Called for every listed model and before a row is memoized: its credit rate changes at its next dated card. */
|
|
1777
|
+
#noteCreditChange(model: Model): void {
|
|
1778
|
+
const at = getFactoryDroidCreditRate(model)?.next?.at;
|
|
1779
|
+
if (at !== undefined && at < this.#nextCreditChange) this.#nextCreditChange = at;
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
/**
|
|
1783
|
+
* A dated credit rate took effect since rows were memoized: rebuild every
|
|
1784
|
+
* memoized row, and re-rank the list, whose `free` search word follows the
|
|
1785
|
+
* rate too.
|
|
1786
|
+
*/
|
|
1787
|
+
#syncCreditClock(): void {
|
|
1788
|
+
if (Date.now() < this.#nextCreditChange) return;
|
|
1789
|
+
this.#nextCreditChange = Number.POSITIVE_INFINITY;
|
|
1790
|
+
this.#metricCells = new WeakMap();
|
|
1791
|
+
this.#pickerPreview = undefined;
|
|
1792
|
+
this.#bumpPickerEpoch();
|
|
1793
|
+
this.#ranker = undefined;
|
|
1794
|
+
this.#menu.setItems(this.#menu.items);
|
|
1795
|
+
for (const item of this.#menu.items) {
|
|
1796
|
+
if (item.id !== "separator") this.#noteCreditChange(item.model);
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1735
1800
|
#bumpNativeEpoch(): void {
|
|
1736
1801
|
this.#nativeEpoch++;
|
|
1737
1802
|
this.#itemNodes.clear();
|
|
@@ -1750,6 +1815,7 @@ export class ModelBrowser implements Component {
|
|
|
1750
1815
|
* scrolls), and the selection's facts and role chips.
|
|
1751
1816
|
*/
|
|
1752
1817
|
describe(): NativeNode {
|
|
1818
|
+
this.#syncCreditClock();
|
|
1753
1819
|
this.#nativeSearch ??= row([text([span(theme.symbol("icon.search"), "accent")]), this.#searchInput], {
|
|
1754
1820
|
gap: "sm",
|
|
1755
1821
|
align: "center",
|
|
@@ -1820,6 +1886,7 @@ export class ModelBrowser implements Component {
|
|
|
1820
1886
|
if (item.id === "separator") return node("rule", undefined, undefined, "separator");
|
|
1821
1887
|
const cached = this.#itemNodes.get(item.selector);
|
|
1822
1888
|
if (cached?.item === item) return cached.node;
|
|
1889
|
+
this.#noteCreditChange(item.model);
|
|
1823
1890
|
|
|
1824
1891
|
const label: TspSpan[] = [];
|
|
1825
1892
|
if (this.#showProvider) label.push(span(`${item.provider}/`, "dim"));
|
|
@@ -1862,6 +1929,7 @@ export class ModelBrowser implements Component {
|
|
|
1862
1929
|
return prev.node;
|
|
1863
1930
|
}
|
|
1864
1931
|
|
|
1932
|
+
if (selected) this.#noteCreditChange(selected.model);
|
|
1865
1933
|
const children: NativeChild[] = [];
|
|
1866
1934
|
if (selected) {
|
|
1867
1935
|
const model = selected.model;
|
|
@@ -1886,6 +1954,8 @@ export class ModelBrowser implements Component {
|
|
|
1886
1954
|
} else if (model.tps != null && Number.isFinite(model.tps) && model.tps > 0) {
|
|
1887
1955
|
facts.push(`~${formatTps(model.tps)}`);
|
|
1888
1956
|
}
|
|
1957
|
+
const nextCredits = nextCreditRateNote(model);
|
|
1958
|
+
if (nextCredits) facts.push(nextCredits);
|
|
1889
1959
|
children.push(text([span(facts.join(" · "), "muted")], { wrap: "word" }));
|
|
1890
1960
|
const description = model.description ? formatDescription(model.description) : "";
|
|
1891
1961
|
if (description) children.push(text([span(description, "dim")], { wrap: "word", lines: 2 }));
|
|
@@ -1933,6 +2003,26 @@ export class ModelBrowser implements Component {
|
|
|
1933
2003
|
return selected && !this.#isDisabled(selected) ? selected.selector : null;
|
|
1934
2004
|
}
|
|
1935
2005
|
|
|
2006
|
+
/**
|
|
2007
|
+
* A model picker's search field, fact columns and rows: `catalogue` (from
|
|
2008
|
+
* {@link pickerItems}) in `view` order (from {@link pickerOrder}), the
|
|
2009
|
+
* selection, and `current` checked. Memoize hosts on its inputs plus
|
|
2010
|
+
* {@link query}, {@link cursor} and {@link pickerSelected}.
|
|
2011
|
+
*/
|
|
2012
|
+
pickerRows(catalogue: ModelPickerCatalogue, view: ModelPickerOrder, current: string | undefined): ModelPickerRows {
|
|
2013
|
+
return {
|
|
2014
|
+
query: this.query,
|
|
2015
|
+
cursor: this.cursor,
|
|
2016
|
+
columns: MODEL_PICKER_COLUMNS,
|
|
2017
|
+
...catalogue,
|
|
2018
|
+
order: view.order,
|
|
2019
|
+
...(view.hits ? { hits: view.hits } : {}),
|
|
2020
|
+
selected: this.pickerSelected,
|
|
2021
|
+
...(current ? { current: [current] } : {}),
|
|
2022
|
+
total: this.baseCount,
|
|
2023
|
+
};
|
|
2024
|
+
}
|
|
2025
|
+
|
|
1936
2026
|
/**
|
|
1937
2027
|
* Picker rows for `catalogue`: the same object while the catalogue, roles
|
|
1938
2028
|
* and row inputs are unchanged, so typing and scope hops never resend it.
|
|
@@ -1940,6 +2030,7 @@ export class ModelBrowser implements Component {
|
|
|
1940
2030
|
* role moving) keeps the last whole `items` and patches it.
|
|
1941
2031
|
*/
|
|
1942
2032
|
pickerItems(catalogue: readonly ModelBrowserItem[]): ModelPickerCatalogue {
|
|
2033
|
+
this.#syncCreditClock();
|
|
1943
2034
|
const memo = this.#pickerItems;
|
|
1944
2035
|
if (memo?.catalogue === catalogue && memo.epoch === this.#pickerEpoch && memo.roles === this.#roles) {
|
|
1945
2036
|
return memo.value;
|
|
@@ -1991,6 +2082,7 @@ export class ModelBrowser implements Component {
|
|
|
1991
2082
|
) {
|
|
1992
2083
|
return cached.value;
|
|
1993
2084
|
}
|
|
2085
|
+
this.#noteCreditChange(model);
|
|
1994
2086
|
const facts: Record<string, TspText | number> = {};
|
|
1995
2087
|
const int = model.int != null && Number.isFinite(model.int) ? model.int : undefined;
|
|
1996
2088
|
if (int !== undefined) facts.int = String(Math.round(int));
|
|
@@ -2137,6 +2229,7 @@ export class ModelBrowser implements Component {
|
|
|
2137
2229
|
* below the list): one inline fact line and the held-role chips.
|
|
2138
2230
|
*/
|
|
2139
2231
|
pickerPreview(mode: "full" | "compact", current?: string): readonly NativeChild[] {
|
|
2232
|
+
this.#syncCreditClock();
|
|
2140
2233
|
const selected = this.getSelected();
|
|
2141
2234
|
const item = selected && !this.#isDisabled(selected) ? selected : undefined;
|
|
2142
2235
|
const key = `${mode}\0${current ?? ""}\0${this.#settings.revision}`;
|
|
@@ -2150,6 +2243,7 @@ export class ModelBrowser implements Component {
|
|
|
2150
2243
|
) {
|
|
2151
2244
|
return memo.children;
|
|
2152
2245
|
}
|
|
2246
|
+
if (item) this.#noteCreditChange(item.model);
|
|
2153
2247
|
const children = item ? this.modelPreview(item, mode, current) : [];
|
|
2154
2248
|
this.#pickerPreview = { item, epoch: this.#pickerEpoch, roles: this.#roles, key, children };
|
|
2155
2249
|
return children;
|
|
@@ -2195,6 +2289,8 @@ export class ModelBrowser implements Component {
|
|
|
2195
2289
|
if (ctx > 0) facts.push({ k: "ctx", v: formatNumber(ctx).toLowerCase() });
|
|
2196
2290
|
if (out > 0) facts.push({ k: "out", v: formatNumber(out).toLowerCase() });
|
|
2197
2291
|
facts.push({ k: "price", v: isFreeModel(model) ? "free" : formatCostDetail(model) });
|
|
2292
|
+
const nextCredits = nextCreditRateNote(model);
|
|
2293
|
+
if (nextCredits) facts.push({ k: "then", v: nextCredits });
|
|
2198
2294
|
facts.push({ k: "reasoning", v: model.reasoning ? "yes" : "no" });
|
|
2199
2295
|
const children: NativeChild[] = [node("kv", { items: facts, layout: "inline" })];
|
|
2200
2296
|
const chips: NativeChild[] = [];
|
|
@@ -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
|
}
|
|
@@ -256,6 +256,8 @@ export interface PlanReviewOverlayOptions {
|
|
|
256
256
|
slider?: HookSelectorSlider;
|
|
257
257
|
/** Display label for the external-editor key, surfaced in the footer help. */
|
|
258
258
|
externalEditorLabel?: string;
|
|
259
|
+
/** The external editor's name ("Notepad", "nvim") for the native Edit button; `$EDITOR` when unset. */
|
|
260
|
+
externalEditorName?: string;
|
|
259
261
|
/** Serializable annotations restored into this overlay instance. */
|
|
260
262
|
annotationState?: PlanReviewAnnotationState;
|
|
261
263
|
}
|
|
@@ -286,6 +288,7 @@ export class PlanReviewOverlay implements Component {
|
|
|
286
288
|
#disabled: Set<number>;
|
|
287
289
|
#helpSuffix: string | undefined;
|
|
288
290
|
#externalEditorLabel: string | undefined;
|
|
291
|
+
#externalEditorName: string | undefined;
|
|
289
292
|
#promptTitle: string | undefined;
|
|
290
293
|
#selectedIndex: number;
|
|
291
294
|
#slider: HookSelectorSlider | undefined;
|
|
@@ -354,6 +357,7 @@ export class PlanReviewOverlay implements Component {
|
|
|
354
357
|
);
|
|
355
358
|
this.#helpSuffix = options.helpText;
|
|
356
359
|
this.#externalEditorLabel = options.externalEditorLabel;
|
|
360
|
+
this.#externalEditorName = options.externalEditorName;
|
|
357
361
|
this.#promptTitle = options.promptTitle;
|
|
358
362
|
this.#selectedIndex = this.#coerceIndex(options.initialIndex ?? 0);
|
|
359
363
|
if (options.slider && options.slider.segments.length > 0) {
|
|
@@ -1632,7 +1636,13 @@ export class PlanReviewOverlay implements Component {
|
|
|
1632
1636
|
// Unbound: the button still mirrors the callback, without a keycap.
|
|
1633
1637
|
const editorKeyId = getKeybindings().getKeys("app.editor.external")[0];
|
|
1634
1638
|
if (this.callbacks.onExternalEditor) {
|
|
1635
|
-
buttons.push(
|
|
1639
|
+
buttons.push(
|
|
1640
|
+
actionButton(
|
|
1641
|
+
`Edit in ${this.#externalEditorName ?? "$EDITOR"}`,
|
|
1642
|
+
"externalEditor",
|
|
1643
|
+
editorKeyId ? { keys: editorKeyId } : {},
|
|
1644
|
+
),
|
|
1645
|
+
);
|
|
1636
1646
|
}
|
|
1637
1647
|
// Cancel the review the way the cancel key does; while annotating that key
|
|
1638
1648
|
// only leaves the draft/chooser, so the button is hidden there.
|
|
@@ -1754,7 +1764,8 @@ export class PlanReviewOverlay implements Component {
|
|
|
1754
1764
|
"tabs",
|
|
1755
1765
|
);
|
|
1756
1766
|
const track: NativeChild[] = slider.caption ? [text([span(slider.caption, "dim")]), tabs] : [tabs];
|
|
1757
|
-
|
|
1767
|
+
// A role of its own: Tern's sheet lets only the role-less split row (Contents + body) shrink and scroll.
|
|
1768
|
+
const out = [keyed(rowNode(track, { role: "zeta.plan.slider", gap: "sm", align: "center" }), "slider")];
|
|
1758
1769
|
const detail = slider.segments[this.#sliderIndex]?.detail;
|
|
1759
1770
|
if (detail) out.push(keyed(text([span("↳ ", "dim"), span(detail, "muted")], { wrap: "word" }), "sliderDetail"));
|
|
1760
1771
|
return out;
|