@linxiraos/pi-tui 1.4.6 → 1.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +194 -195
- package/README.md +34 -34
- package/dist/types/app-keybindings.d.ts +15 -0
- package/dist/types/apps/session-picker.d.ts +5 -0
- package/dist/types/charts/chart-plan.d.ts +9 -7
- package/dist/types/chat/assistant-message.d.ts +15 -3
- package/dist/types/chat/bash-execution.d.ts +2 -0
- package/dist/types/chat/display-preferences.d.ts +2 -0
- package/dist/types/chat/extension-types.d.ts +31 -0
- package/dist/types/chat/reply-write.d.ts +48 -0
- package/dist/types/chat/table-chart.d.ts +4 -3
- package/dist/types/chat/tool-execution.d.ts +1 -2
- package/dist/types/chat/transcript-outline.d.ts +7 -0
- package/dist/types/chat/transcript-render-helpers.d.ts +2 -0
- package/dist/types/chrome/index.d.ts +1 -0
- package/dist/types/chrome/transcript-notice.d.ts +35 -0
- package/dist/types/chrome/transcript-status.d.ts +20 -8
- package/dist/types/components/editor.d.ts +8 -0
- package/dist/types/components/markdown.d.ts +7 -0
- package/dist/types/native/blobs.d.ts +2 -1
- package/dist/types/native/picker.d.ts +4 -4
- package/dist/types/overlays/annotation-overlay.d.ts +7 -1
- package/dist/types/overlays/annotation-types.d.ts +28 -0
- package/dist/types/overlays/login-dialog.d.ts +5 -1
- package/dist/types/overlays/model-browser.d.ts +10 -1
- 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 +22 -2
- package/dist/types/prompt/composer.d.ts +43 -0
- package/dist/types/prompt/interactive-context-helpers.d.ts +10 -3
- package/dist/types/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/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/theme/theme.d.ts +0 -23
- 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/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 +1 -1
- package/dist/types/tools/renderer.d.ts +2 -0
- package/dist/types/tools/streaming-output.d.ts +11 -0
- package/dist/types/tools/task.d.ts +9 -1
- package/dist/types/tools/url-scheme-host.d.ts +17 -0
- package/dist/types/tools/yield.d.ts +1 -1
- package/dist/types/tui.d.ts +7 -2
- package/package.json +10 -14
- package/src/app-keybindings.d.ts +15 -0
- package/src/app-keybindings.ts +15 -0
- package/src/apps/session-picker.ts +7 -0
- package/src/charts/chart-plan.d.ts +9 -7
- package/src/charts/chart-plan.ts +20 -50
- package/src/chat/advisor-message.ts +2 -0
- package/src/chat/assistant-message.d.ts +15 -3
- package/src/chat/assistant-message.ts +137 -19
- package/src/chat/background-tan-message.ts +4 -0
- package/src/chat/bash-execution.d.ts +2 -0
- package/src/chat/bash-execution.ts +6 -0
- package/src/chat/chat-transcript-builder.ts +58 -28
- package/src/chat/compaction-summary-message.ts +2 -1
- package/src/chat/display-preferences.d.ts +2 -0
- package/src/chat/display-preferences.ts +3 -0
- package/src/chat/extension-types.d.ts +31 -0
- package/src/chat/extension-types.ts +34 -0
- package/src/chat/reply-write.d.ts +48 -0
- package/src/chat/reply-write.ts +127 -0
- package/src/chat/table-chart.d.ts +4 -3
- package/src/chat/table-chart.ts +10 -4
- package/src/chat/tool-execution.d.ts +1 -2
- package/src/chat/tool-execution.ts +20 -13
- package/src/chat/transcript-outline.d.ts +7 -0
- package/src/chat/transcript-outline.ts +27 -0
- package/src/chat/transcript-render-helpers.d.ts +2 -0
- package/src/chat/transcript-render-helpers.ts +66 -24
- package/src/chrome/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 +20 -8
- package/src/chrome/transcript-status.ts +29 -29
- package/src/components/editor.d.ts +8 -0
- package/src/components/editor.ts +10 -1
- package/src/components/markdown.d.ts +7 -0
- package/src/components/markdown.ts +116 -6
- package/src/hotkeys-markdown.ts +1 -0
- package/src/native/backend.ts +5 -66
- package/src/native/blobs.d.ts +2 -1
- package/src/native/blobs.ts +3 -2
- package/src/native/picker.d.ts +4 -4
- package/src/native/picker.ts +4 -4
- 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/hook-selector.ts +2 -2
- package/src/overlays/login-dialog.ts +31 -5
- package/src/overlays/mcp-add-wizard.ts +1 -1
- package/src/overlays/model-browser.ts +37 -0
- package/src/overlays/model-hub.ts +1 -7
- package/src/overlays/model-picker.ts +1 -10
- package/src/overlays/oauth-selector.ts +44 -6
- package/src/overlays/plan-review-overlay.ts +13 -2
- package/src/overlays/rewind-selector.ts +29 -12
- package/src/overlays/session-selector.ts +313 -42
- package/src/overlays/usage-dashboard.ts +5 -12
- package/src/prompt/composer.ts +216 -1
- package/src/prompt/custom-editor.ts +6 -1
- package/src/prompt/emoji-autocomplete.ts +0 -2
- package/src/prompt/interactive-context-helpers.ts +29 -4
- package/src/render/extension-links.d.ts +65 -0
- package/src/render/extension-links.ts +214 -0
- 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/setup/scenes/composer.ts +2 -0
- package/src/setup/scenes/glyph.ts +3 -1
- package/src/setup/scenes/model.ts +192 -29
- package/src/setup/scenes/outro.ts +33 -15
- package/src/setup/scenes/sign-in.ts +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/terminal.ts +24 -2
- package/src/theme/defaults.json +1 -0
- package/src/theme/loader.ts +1 -1
- package/src/theme/theme.d.ts +0 -23
- package/src/theme/theme.ts +2 -75
- 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 +2 -0
- package/src/tools/default-renderer.d.ts +6 -4
- package/src/tools/default-renderer.ts +9 -6
- package/src/tools/eval.ts +14 -4
- package/src/tools/irc.d.ts +6 -0
- package/src/tools/irc.ts +6 -0
- package/src/tools/job-widget.ts +13 -1
- package/src/tools/json-tree.d.ts +23 -4
- package/src/tools/json-tree.ts +132 -42
- package/src/tools/lsp.d.ts +2 -0
- package/src/tools/lsp.ts +36 -15
- package/src/tools/mcp.d.ts +6 -5
- package/src/tools/mcp.ts +20 -12
- package/src/tools/native-view.d.ts +1 -1
- package/src/tools/native-view.ts +1 -1
- package/src/tools/renderer.d.ts +2 -0
- package/src/tools/renderer.ts +2 -0
- package/src/tools/streaming-output.d.ts +11 -0
- package/src/tools/streaming-output.ts +41 -0
- package/src/tools/task.d.ts +9 -1
- package/src/tools/task.ts +59 -16
- package/src/tools/url-scheme-host.d.ts +17 -0
- package/src/tools/url-scheme-host.ts +21 -0
- package/src/tools/yield.d.ts +1 -1
- package/src/tools/yield.ts +18 -9
- package/src/tui.d.ts +7 -2
- package/src/tui.ts +43 -15
- 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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AssistantMessage, ImageContent } from "@linxiraos/pi-ai";
|
|
2
2
|
import { type Component, Container } from "../tui.js";
|
|
3
3
|
import { type ImageBudget } from "../components/image.js";
|
|
4
|
-
import type { AssistantThinkingRenderer } from "./extension-types.js";
|
|
4
|
+
import type { AssistantTextRenderer, AssistantTextRendering, AssistantThinkingRenderer } from "./extension-types.js";
|
|
5
5
|
import type { DescribeContext, NativeNode, NativeUiEvent } from "../native/node.js";
|
|
6
6
|
import { type CacheInvalidation } from "./cache-invalidation-marker.js";
|
|
7
7
|
import { type ServedModelMismatch } from "./served-model-marker.js";
|
|
@@ -38,7 +38,7 @@ export declare class AssistantMessageComponent extends Container {
|
|
|
38
38
|
* for lack of a target is re-rendered with its reaction stripped.
|
|
39
39
|
*/
|
|
40
40
|
pickReactionTarget(transcript: readonly Component[]): void;
|
|
41
|
-
constructor(message?: AssistantMessage, hideThinkingBlock?: boolean, onImageUpdate?: () => void, thinkingRenderers?: readonly AssistantThinkingRenderer[], imageBudget?: ImageBudget, proseOnlyThinking?: boolean, linkTargets?: ReadonlyMap<string, string>, expandThinkingBlocks?: boolean);
|
|
41
|
+
constructor(message?: AssistantMessage, hideThinkingBlock?: boolean, onImageUpdate?: () => void, thinkingRenderers?: readonly AssistantThinkingRenderer[], imageBudget?: ImageBudget, proseOnlyThinking?: boolean, linkTargets?: ReadonlyMap<string, string>, expandThinkingBlocks?: boolean, textRendering?: AssistantTextRendering);
|
|
42
42
|
/**
|
|
43
43
|
* Show or clear the trailing cache-invalidation divider. Set at `message_end`
|
|
44
44
|
* (live) or during rebuild, once the turn's usage is known and compared
|
|
@@ -87,7 +87,7 @@ export declare class AssistantMessageComponent extends Container {
|
|
|
87
87
|
*/
|
|
88
88
|
setExpanded(expanded: boolean): void;
|
|
89
89
|
isTranscriptBlockFinalized(): boolean;
|
|
90
|
-
/**
|
|
90
|
+
/** Hold image and figure rendering until the completed block can enter immutable scrollback. */
|
|
91
91
|
isTranscriptBlockPending(): boolean;
|
|
92
92
|
render(width: number): readonly string[];
|
|
93
93
|
/**
|
|
@@ -122,7 +122,19 @@ export declare class AssistantMessageComponent extends Container {
|
|
|
122
122
|
renderTranscriptBlockEmergencyRow(width: number): string | undefined;
|
|
123
123
|
getTranscriptBlockVersion(): number;
|
|
124
124
|
markTranscriptBlockFinalized(): void;
|
|
125
|
+
/**
|
|
126
|
+
* Swap the extension text renderers (the setting enabling them changed) and redraw with them.
|
|
127
|
+
* Enabling them also drops rows already published as stable, since a renderer may rewrite them;
|
|
128
|
+
* callers MUST pair this with a scrollback-clearing display reset, as for
|
|
129
|
+
* {@link resetTranscriptStableRows}.
|
|
130
|
+
*/
|
|
131
|
+
setTextRenderers(renderers: readonly AssistantTextRenderer[]): void;
|
|
125
132
|
applyRetryRecovery(retryRecovery: AssistantMessage["retryRecovery"]): void;
|
|
133
|
+
/**
|
|
134
|
+
* Draw the current message again when it is the reply sent at `timestamp`, re-running the
|
|
135
|
+
* extension text renderers; returns whether it was. The caller schedules the frame.
|
|
136
|
+
*/
|
|
137
|
+
rerenderMessage(timestamp: number): boolean;
|
|
126
138
|
messagePersistenceKey(): string | undefined;
|
|
127
139
|
/** Toggle rendering for assistant-native and tool-result images. */
|
|
128
140
|
setImagesVisible(visible: boolean): void;
|
|
@@ -37,6 +37,8 @@ export declare class BashExecutionComponent extends Container {
|
|
|
37
37
|
appendOutput(chunk: string): void;
|
|
38
38
|
/** Switch to PTY rendering and feed raw terminal bytes through the vterm replay. */
|
|
39
39
|
appendPtyChunk(chunk: string): void;
|
|
40
|
+
/** Bytes a terminal would send for a key event, honoring the command's cursor-key mode; "" for key releases. */
|
|
41
|
+
encodePtyInput(data: string): string;
|
|
40
42
|
setComplete(exitCode: number | undefined, cancelled: boolean, options?: {
|
|
41
43
|
output?: string;
|
|
42
44
|
truncation?: TruncationMeta;
|
|
@@ -6,6 +6,8 @@ export interface ChatTranscriptDisplayPreferences {
|
|
|
6
6
|
cacheMissMarker: boolean;
|
|
7
7
|
showTokenUsage: boolean;
|
|
8
8
|
showTurnTime: boolean;
|
|
9
|
+
/** Max rows a collapsed advisor card shows below its header; 0 = no cap. */
|
|
10
|
+
advisorCollapsedLines: number;
|
|
9
11
|
}
|
|
10
12
|
/** Current transcript display preferences. */
|
|
11
13
|
export declare const chatTranscriptDisplayPreferences: ChatTranscriptDisplayPreferences;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AssistantMessage } from "@linxiraos/pi-ai";
|
|
1
2
|
import type { Component, TUI } from "../tui.js";
|
|
2
3
|
import type { Theme } from "../theme/theme.js";
|
|
3
4
|
import type { CustomMessage, HookMessage } from "./messages.js";
|
|
@@ -17,6 +18,36 @@ export interface AssistantThinkingRenderContext {
|
|
|
17
18
|
requestRender(): void;
|
|
18
19
|
}
|
|
19
20
|
export type AssistantThinkingRenderer = (context: AssistantThinkingRenderContext, theme: Theme) => Component | undefined;
|
|
21
|
+
export interface AssistantTextRenderContext {
|
|
22
|
+
/**
|
|
23
|
+
* The message being drawn; `message.timestamp` identifies the reply for `ctx.ui.rerenderMessage()`.
|
|
24
|
+
* After a tool call this is only the segment drawn there, so its `content` does not hold the whole reply.
|
|
25
|
+
* A deep copy: editing it, at any depth, cannot change the stored reply.
|
|
26
|
+
*/
|
|
27
|
+
message: AssistantMessage;
|
|
28
|
+
/**
|
|
29
|
+
* The text block's index in the full reply's `content`, also when the reply is drawn in segments
|
|
30
|
+
* around tool calls; not an index into `message.content` for a segment. It counts the content as
|
|
31
|
+
* currently stored: a transcript rebuild that drops tool calls left without a result shifts later
|
|
32
|
+
* blocks down, so do not persist it as a permanent key.
|
|
33
|
+
*/
|
|
34
|
+
contentIndex: number;
|
|
35
|
+
/** The block's markdown as drawn so far, after any earlier renderer. */
|
|
36
|
+
text: string;
|
|
37
|
+
/** True while the block may still grow; false for its final render, a block sealed at a tool call, and later redraws. */
|
|
38
|
+
streaming: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Display-only transform of one assistant text block: returns the markdown to draw, or `undefined`
|
|
42
|
+
* to draw `context.text` unchanged. The session, exports and model context keep the original text.
|
|
43
|
+
*/
|
|
44
|
+
export type AssistantTextRenderer = (context: AssistantTextRenderContext) => string | undefined;
|
|
45
|
+
/** Extension text renderers for one assistant component, and where its content starts in the full reply. */
|
|
46
|
+
export interface AssistantTextRendering {
|
|
47
|
+
renderers: readonly AssistantTextRenderer[];
|
|
48
|
+
/** Index in the full reply's `content` of this component's first block; a segment after a tool call starts past it. */
|
|
49
|
+
contentOffset: number;
|
|
50
|
+
}
|
|
20
51
|
export interface HookMessageRenderOptions {
|
|
21
52
|
/** Whether the view is expanded */
|
|
22
53
|
expanded: boolean;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replies: text the agent sends to a scheme whose writes are `reply`-scoped (`out://`)
|
|
3
|
+
* is its mid-turn message to the user, drawn as assistant prose so it can answer
|
|
4
|
+
* without ending its turn.
|
|
5
|
+
* - A `write` call to a reply URL draws as {@link ReplyWriteComponent}, streaming as the
|
|
6
|
+
* call's arguments arrive, instead of a tool card.
|
|
7
|
+
* - Text a tool's commands write there (`printf … > out://` in bash) arrives in the
|
|
8
|
+
* tool's result `details.replies` ({@link toolResultReplies}); transcripts draw each
|
|
9
|
+
* one as a prose block after the call ({@link replyDisplayMessage}).
|
|
10
|
+
*/
|
|
11
|
+
import type { AssistantMessage } from "@linxiraos/pi-ai";
|
|
12
|
+
import type { ImageBudget } from "../components/image.js";
|
|
13
|
+
import { AssistantMessageComponent } from "./assistant-message.js";
|
|
14
|
+
import type { ToolExecutionHandle, ToolResultFrame } from "./tool-execution.js";
|
|
15
|
+
/**
|
|
16
|
+
* Whether a `toolName` call writes to a reply URL. `undefined` while streamed args cannot tell yet:
|
|
17
|
+
* no path so far, or a path that could still grow into a reply URL (`ou`, `out:/`). Callers holding
|
|
18
|
+
* final args treat `undefined` as `false`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isReplyWrite(toolName: string, args: unknown): boolean | undefined;
|
|
21
|
+
/** Display options of a reply block; the rest of its presentation follows the assistant prose defaults. */
|
|
22
|
+
export interface ReplyWriteOptions {
|
|
23
|
+
/** Repaint request for figures and images that finish loading after a render. */
|
|
24
|
+
readonly requestRender?: () => void;
|
|
25
|
+
readonly imageBudget?: ImageBudget;
|
|
26
|
+
/** Resolved local destinations of Markdown links, as for assistant text. */
|
|
27
|
+
readonly linkTargets?: ReadonlyMap<string, string>;
|
|
28
|
+
}
|
|
29
|
+
/** Replies a tool result carries in `details.replies` (text its commands wrote to a reply URL), oldest first. */
|
|
30
|
+
export declare function toolResultReplies(details: unknown): readonly string[];
|
|
31
|
+
/** Assistant message drawing reply text. No provider turn backs it, so its identity fields stay empty. */
|
|
32
|
+
export declare function replyDisplayMessage(text: string, errorMessage?: string): AssistantMessage;
|
|
33
|
+
/**
|
|
34
|
+
* A reply write ({@link isReplyWrite}) drawn as assistant prose. The call's lifecycle arrives
|
|
35
|
+
* through {@link ToolExecutionHandle}: streamed args grow the text, final args settle it, and
|
|
36
|
+
* the result seals the block, a failure showing its error under the text. It is a reply, not
|
|
37
|
+
* tool activity, so hiding tool activity leaves it on screen.
|
|
38
|
+
*/
|
|
39
|
+
export declare class ReplyWriteComponent extends AssistantMessageComponent implements ToolExecutionHandle {
|
|
40
|
+
#private;
|
|
41
|
+
constructor(options?: ReplyWriteOptions);
|
|
42
|
+
updateArgs(args: unknown): void;
|
|
43
|
+
setArgsComplete(): void;
|
|
44
|
+
setExecutionStarted(): void;
|
|
45
|
+
updateResult(result: ToolResultFrame, isPartial?: boolean): void;
|
|
46
|
+
parkAsBackground(): void;
|
|
47
|
+
seal(): void;
|
|
48
|
+
}
|
|
@@ -19,10 +19,11 @@ export interface TableChartRequest {
|
|
|
19
19
|
readonly guess: ChartPlan;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
* Picks the chart for a
|
|
23
|
-
*
|
|
22
|
+
* Picks the chart for a table under `smart`: a plan, or `null` for no chart.
|
|
23
|
+
* A rejection falls back to the local guess; `undefined` (no judge to ask
|
|
24
|
+
* right now) keeps the guess at once, exactly as `always` would draw it.
|
|
24
25
|
*/
|
|
25
|
-
export type TableChartPlanner = (request: TableChartRequest) => Promise<ChartPlan | null
|
|
26
|
+
export type TableChartPlanner = (request: TableChartRequest) => Promise<ChartPlan | null> | undefined;
|
|
26
27
|
/**
|
|
27
28
|
* The chart under a table: its SVG, colored with figure tokens (`var(--accent)`, …)
|
|
28
29
|
* still to resolve; none; or a smart pick on its way (the promise settles once the cache holds it).
|
|
@@ -35,7 +35,6 @@ export interface ToolExecutionHandle extends Component {
|
|
|
35
35
|
setArgsComplete(toolCallId?: string): void;
|
|
36
36
|
setExecutionStarted(toolCallId?: string): void;
|
|
37
37
|
setExpanded(expanded: boolean): void;
|
|
38
|
-
setToolActivityVisible(visible: boolean): void;
|
|
39
38
|
/** Mark the call parked: it returned, but stays tracked for async job frames. */
|
|
40
39
|
parkAsBackground(): void;
|
|
41
40
|
/** Seal the block as final history and stop its animations. */
|
|
@@ -102,7 +101,7 @@ export declare class ToolExecutionComponent extends Container {
|
|
|
102
101
|
* component-scoped so the TUI reuses every other root subtree (issue #4377).
|
|
103
102
|
*/
|
|
104
103
|
tickSpinner(frame: number): void;
|
|
105
|
-
/**
|
|
104
|
+
/** Hold visible results until their figures and Kitty images are ready for immutable scrollback. */
|
|
106
105
|
isTranscriptBlockPending(): boolean;
|
|
107
106
|
/**
|
|
108
107
|
* Whether this block is ready to retire as immutable history. Partial
|
|
@@ -9,6 +9,7 @@ import { type TranscriptEntryLike as TranscriptEntry } from "./transcript-entry.
|
|
|
9
9
|
import type { SessionMessageEntryLike as SessionMessageEntry } from "./transcript-entry.js";
|
|
10
10
|
import { type ThemeColor } from "../theme/index.js";
|
|
11
11
|
import type { ChatTranscriptBuilder } from "./chat-transcript-builder.js";
|
|
12
|
+
import type { DescribeContext } from "../native/node.js";
|
|
12
13
|
/** One selectable transcript item: a message entry plus its rendered block range. */
|
|
13
14
|
export interface OutlineTarget {
|
|
14
15
|
/** Entry the selection resolves to; extended over trailing componentless tool results. */
|
|
@@ -63,6 +64,12 @@ export declare class OutlineRowCache {
|
|
|
63
64
|
export declare function appendOutlineEntries(builder: ChatTranscriptBuilder, entries: TranscriptEntry[]): OutlineTarget[];
|
|
64
65
|
/** Per-target "renders at least one non-blank row" flags at the given rows. */
|
|
65
66
|
export declare function outlineVisibility(childRows: readonly (readonly string[])[], targets: readonly OutlineTarget[]): boolean[];
|
|
67
|
+
/**
|
|
68
|
+
* Per-target "describes something that shows" flags: {@link outlineVisibility}
|
|
69
|
+
* for a TSP page, where blocks describe nodes instead of rendering rows. An
|
|
70
|
+
* empty `col`/`row` (an interrupted turn with no output) shows nothing.
|
|
71
|
+
*/
|
|
72
|
+
export declare function describedVisibility(blocks: readonly Component[], targets: readonly OutlineTarget[], cx: DescribeContext): boolean[];
|
|
66
73
|
/** Dotted horizontal rule with rounded corners, spanning the outline width. */
|
|
67
74
|
export declare function outlineRule(left: string, right: string, innerWidth: number, color?: ThemeColor, caption?: string): string;
|
|
68
75
|
/** Wrap pre-rendered rows in the dotted outline (rules above/below, `┆` sides). */
|
|
@@ -55,6 +55,8 @@ export declare function assistantHasVisibleContent(message: AssistantAgentMessag
|
|
|
55
55
|
export declare function splitAssistantMessageToolTimeline(message: AssistantAgentMessage): {
|
|
56
56
|
beforeTools: AssistantAgentMessage;
|
|
57
57
|
afterToolCalls: ReadonlyMap<string, AssistantAgentMessage>;
|
|
58
|
+
/** Index in `message.content` of each after-tool segment's first block, by tool-call id. */
|
|
59
|
+
contentOffsets: ReadonlyMap<string, number>;
|
|
58
60
|
hasToolCalls: boolean;
|
|
59
61
|
lastToolCallId?: string;
|
|
60
62
|
};
|
|
@@ -16,5 +16,6 @@ export * from "./shared.js";
|
|
|
16
16
|
export * from "./streaming-panel.js";
|
|
17
17
|
export * from "./tool-activity.js";
|
|
18
18
|
export * from "./transcript-container.js";
|
|
19
|
+
export * from "./transcript-notice.js";
|
|
19
20
|
export * from "./transcript-status.js";
|
|
20
21
|
export * from "./visual-truncate.js";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { TspText } from "@linxiraos/pi-wire";
|
|
2
|
+
import type { NativeNode } from "../native/node.js";
|
|
3
|
+
import type { Component } from "../tui.js";
|
|
4
|
+
import { TranscriptBlock } from "./transcript-container.js";
|
|
5
|
+
/** How loud an inline transcript notice is; a native terminal styles it as `zeta.notice.<tone>`. */
|
|
6
|
+
export type NoticeTone = "info" | "success" | "warning" | "error";
|
|
7
|
+
/** Optional parts of a {@link noticeRow}. */
|
|
8
|
+
export interface NoticeRowOptions {
|
|
9
|
+
/** Icon name in place of the tone's own (`read` for a file read, `download` for an update). */
|
|
10
|
+
readonly icon?: string;
|
|
11
|
+
readonly key?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* One inline transcript notice for a native terminal (`zeta.notice.<tone>`): a
|
|
15
|
+
* leading icon beside the wrapped message. Warnings, errors, background-job
|
|
16
|
+
* completions and prompt file reads all draw as this row, so they read alike.
|
|
17
|
+
* The tone colors the icon (an info notice keeps it quiet); the message spans
|
|
18
|
+
* carry emphasis only (`path`, `mono`, `dim`), never the tone itself.
|
|
19
|
+
*/
|
|
20
|
+
export declare function noticeRow(tone: NoticeTone, message: TspText, options?: NoticeRowOptions): NativeNode;
|
|
21
|
+
/**
|
|
22
|
+
* A transcript block that a native terminal draws as one {@link noticeRow}
|
|
23
|
+
* while a text terminal draws `ansi`.
|
|
24
|
+
*/
|
|
25
|
+
export declare class TranscriptNotice extends TranscriptBlock {
|
|
26
|
+
#private;
|
|
27
|
+
constructor(native: NativeNode, ansi: readonly Component[]);
|
|
28
|
+
/**
|
|
29
|
+
* `showWarning` / `showError`: a blank row and the `Warning: …` / `Error: …`
|
|
30
|
+
* line in its color in a text terminal; natively the tone's icon and the
|
|
31
|
+
* message, the label left to the icon.
|
|
32
|
+
*/
|
|
33
|
+
static line(tone: "warning" | "error", message: string): TranscriptNotice;
|
|
34
|
+
describe(): NativeNode;
|
|
35
|
+
}
|
|
@@ -1,24 +1,36 @@
|
|
|
1
|
+
import type { TspSpan } from "@linxiraos/pi-wire";
|
|
1
2
|
import type { NativeNode } from "../native/node.js";
|
|
2
3
|
import { type ThemeColor } from "../theme/index.js";
|
|
3
4
|
import { TranscriptBlock } from "./transcript-container.js";
|
|
4
|
-
|
|
5
|
+
import { type NoticeTone } from "./transcript-notice.js";
|
|
6
|
+
/** One themed run of a status row's terminal line. */
|
|
5
7
|
export interface TranscriptStatusPart {
|
|
6
8
|
readonly text: string;
|
|
7
9
|
readonly color: ThemeColor;
|
|
8
|
-
/** Glyph art (tree connectors) drawn only in rows; native terminals draw their own structure. */
|
|
9
|
-
readonly rowsOnly?: boolean;
|
|
10
10
|
}
|
|
11
|
-
/**
|
|
11
|
+
/** A status row in a native terminal: its {@link noticeRow}'s tone, icon and message. */
|
|
12
|
+
export interface TranscriptStatusNative {
|
|
13
|
+
readonly tone: NoticeTone;
|
|
14
|
+
/** Icon name in place of the tone's own. */
|
|
15
|
+
readonly icon?: string;
|
|
16
|
+
readonly message: readonly TspSpan[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* One compact transcript status row: the terminal line's themed parts (joined
|
|
20
|
+
* by single spaces, glyphs and brackets included) and the same row natively.
|
|
21
|
+
*/
|
|
12
22
|
export interface TranscriptStatusRow {
|
|
13
23
|
readonly parts: readonly (TranscriptStatusPart | undefined)[];
|
|
14
24
|
readonly indent?: number;
|
|
25
|
+
readonly native: TranscriptStatusNative;
|
|
15
26
|
}
|
|
16
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Shared compact status block for background activity and prompt file reads:
|
|
29
|
+
* one themed line per row in a text terminal, one notice row per row natively
|
|
30
|
+
* (`zeta.status-block`).
|
|
31
|
+
*/
|
|
17
32
|
export declare class TranscriptStatusBlock extends TranscriptBlock {
|
|
18
33
|
#private;
|
|
19
34
|
constructor(rows: readonly TranscriptStatusRow[]);
|
|
20
|
-
/** Append a supplemental line such as an artifact warning. */
|
|
21
|
-
addLine(parts: readonly (TranscriptStatusPart | undefined)[], indent?: number): void;
|
|
22
|
-
/** One wrapped text line per status row. */
|
|
23
35
|
describe(): NativeNode;
|
|
24
36
|
}
|
|
@@ -98,6 +98,14 @@ export declare class Editor implements Component, Focusable {
|
|
|
98
98
|
describeDecorations: ((lines: readonly string[]) => readonly TspEditorDecoration[]) | undefined;
|
|
99
99
|
/** TSP code language of the buffer (`python`, `bash`): the terminal highlights it in the mono face. */
|
|
100
100
|
describeLanguage: (() => string | undefined) | undefined;
|
|
101
|
+
/** Label the TSP field to disable host-side editing while another input owner handles raw keys. */
|
|
102
|
+
nativeKeyPassthrough: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Ask the TSP terminal to keep what is typed into this field and draw it at
|
|
105
|
+
* the caret until this clears, then send it: set while startup cannot read
|
|
106
|
+
* input yet (the prompt composer's deferred-input start).
|
|
107
|
+
*/
|
|
108
|
+
nativeTypeahead: boolean;
|
|
101
109
|
/**
|
|
102
110
|
* TSP chrome around the `editor` node (the prompt composer's chips, mode
|
|
103
111
|
* chip, send/stop): the root role, the children with `input` placed where
|
|
@@ -10,6 +10,13 @@ import type { Component } from "../tui.js";
|
|
|
10
10
|
* byte-identical to rendering `text`.
|
|
11
11
|
*/
|
|
12
12
|
export declare function streamingMarkdownSource(text: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Whether `text` ends inside a code fence the source never closed. The
|
|
15
|
+
* renderer still draws such a fence's closing border, so a caller publishing a
|
|
16
|
+
* settled source prefix must drop that fabricated row: it is not a prefix of
|
|
17
|
+
* the live block, which reaches the border only once the closer arrives.
|
|
18
|
+
*/
|
|
19
|
+
export declare function endsInsideOpenFence(text: string): boolean;
|
|
13
20
|
/**
|
|
14
21
|
* Streaming `md` source for a native terminal, minus a still-growing table row:
|
|
15
22
|
* the unterminated last line when a GFM table (a run of pipe lines holding a
|
|
@@ -29,7 +29,8 @@ export declare function base64ImageNode(data: string, mimeType: string, p?: Omit
|
|
|
29
29
|
/**
|
|
30
30
|
* Props that make an `image` node open the file at `filePath` (as a `file://` URL, the TSP
|
|
31
31
|
* open-target form): a click zooms the image in the terminal, and the file opens from its
|
|
32
|
-
* context menu.
|
|
32
|
+
* context menu. Always uses a local file URL because the open action runs locally,
|
|
33
|
+
* even when remote file handlers are configured. Empty without a file.
|
|
33
34
|
*/
|
|
34
35
|
export declare function openableImageProps(filePath: string | undefined): Pick<TspProps<"image">, "href" | "actions">;
|
|
35
36
|
/**
|
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
* the item id and `action` with an action id (plus `value` for
|
|
17
17
|
* `scope`/`tab`/`strip`). {@link pickerEvent} folds them into one shape.
|
|
18
18
|
*/
|
|
19
|
-
import type { TspPickerAction, TspPickerItem, TspPickerProps } from "@linxiraos/pi-wire";
|
|
19
|
+
import type { TspPickerAction, TspPickerItem, TspPickerProps, TspProps } from "@linxiraos/pi-wire";
|
|
20
20
|
import type { KeyName } from "../key-hint-format.js";
|
|
21
21
|
import { type Keybinding } from "../keybindings.js";
|
|
22
22
|
import type { Input } from "../components/input.js";
|
|
23
23
|
import type { SelectItem, SelectList } from "../components/select-list.js";
|
|
24
24
|
import type { NativeChild, NativeNode, NativeUiEvent } from "./node.js";
|
|
25
25
|
/** The picker sheet; `preview` children fill its preview pane. */
|
|
26
|
-
export declare function picker(p:
|
|
26
|
+
export declare function picker(p: TspProps<"picker">, preview?: readonly NativeChild[]): NativeNode;
|
|
27
27
|
/**
|
|
28
28
|
* A picker's search field from the {@link Input} that edits it: the text and
|
|
29
29
|
* its caret. `null` hides the field. Memoized pickers MUST key on the caret
|
|
@@ -37,7 +37,7 @@ export declare const PICKER_KEY = "picker";
|
|
|
37
37
|
* the picker as child {@link PICKER_KEY}, which the reconciler hoists into
|
|
38
38
|
* `layer`. Route its events with `pickerEvent(event, PICKER_KEY)`.
|
|
39
39
|
*/
|
|
40
|
-
export declare function dockedPicker(p:
|
|
40
|
+
export declare function dockedPicker(p: TspProps<"picker">, preview?: readonly NativeChild[]): NativeNode;
|
|
41
41
|
/** Keycap names for one key id (`"alt+enter"` → `["alt", "enter"]`, `"escape"` → `["esc"]`). */
|
|
42
42
|
export declare function pickerKeys(key: KeyName | string): string[];
|
|
43
43
|
/** The keycaps of a keybinding's primary key, empty when unbound. */
|
|
@@ -83,7 +83,7 @@ export interface SelectPickerOptions {
|
|
|
83
83
|
readonly subtitle?: string;
|
|
84
84
|
readonly icon?: string;
|
|
85
85
|
readonly noun?: string;
|
|
86
|
-
/** Show
|
|
86
|
+
/** Show Zeta's filter text as the search field (lists that filter as you type). */
|
|
87
87
|
readonly searchable?: boolean;
|
|
88
88
|
/** Per-item extras (a thinking-level dot, a swatch mark, a budget fact). */
|
|
89
89
|
readonly decorate?: (item: SelectItem) => Partial<Omit<TspPickerItem, "id">> | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Focusable, type TUI } from "../index.js";
|
|
2
2
|
import { type KeybindingsManager } from "../app-keybindings.js";
|
|
3
3
|
import { type Theme } from "../theme/theme.js";
|
|
4
|
-
import type { CodeReviewAnnotation, CodeReviewOverlayResult, ReviewDiffFile, TextReviewAnnotation, TextReviewOverlayResult, TextReviewSource } from "./annotation-types.js";
|
|
4
|
+
import type { AnnotationOverlayDraft, CodeReviewAnnotation, CodeReviewOverlayResult, ReviewDiffFile, TextReviewAnnotation, TextReviewOverlayResult, TextReviewSource } from "./annotation-types.js";
|
|
5
5
|
import type { TspSpan } from "@linxiraos/pi-wire";
|
|
6
6
|
import { type NativeNode, type NativeUiEvent } from "../native/node.js";
|
|
7
7
|
export declare const CONTINUE_CODE_REVIEW_ACTION = "Continue with LLM review";
|
|
@@ -20,6 +20,8 @@ export interface CodeReviewOverlayCallbacks extends AnnotationOverlayCallbacks {
|
|
|
20
20
|
export interface TextReviewOverlayCallbacks extends AnnotationOverlayCallbacks {
|
|
21
21
|
onComplete(result: TextReviewOverlayResult | undefined): void;
|
|
22
22
|
}
|
|
23
|
+
/** Clears every note and closes; the host then has nothing to keep. Needs a second confirm. */
|
|
24
|
+
export declare const DISCARD_ANNOTATIONS_ACTION = "Discard notes and close";
|
|
23
25
|
/** Splits a text source into the overlay's 1-based annotatable lines. */
|
|
24
26
|
export declare function splitTextLines(text: string): string[];
|
|
25
27
|
/** The native sheet: full-pane glass, titled by the review kind with what is under review after it. */
|
|
@@ -38,6 +40,10 @@ export declare class AnnotationOverlay implements Focusable {
|
|
|
38
40
|
setUseTerminalCursor(useTerminalCursor: boolean): void;
|
|
39
41
|
invalidate(): void;
|
|
40
42
|
dispose(): void;
|
|
43
|
+
/** Notes, the unfinished note, and any source edit, in the form {@link restoreDraft} replays. */
|
|
44
|
+
getDraft(): AnnotationOverlayDraft;
|
|
45
|
+
/** Replay a draft taken from this same source; anything anchored outside it is dropped. */
|
|
46
|
+
restoreDraft(draft: AnnotationOverlayDraft): void;
|
|
41
47
|
getAnnotations(): CodeReviewAnnotation[];
|
|
42
48
|
getTextAnnotations(): TextReviewAnnotation[];
|
|
43
49
|
/** Repo-relative path of the diff file under the cursor, if this is a code review. */
|
|
@@ -84,3 +84,31 @@ export interface TextReviewOverlayResult {
|
|
|
84
84
|
/** Source text after an external-editor edit; absent when the source was not edited. */
|
|
85
85
|
editedText?: string;
|
|
86
86
|
}
|
|
87
|
+
export type AnnotationOverlayDraft = {
|
|
88
|
+
kind: "diff";
|
|
89
|
+
annotations: {
|
|
90
|
+
fileIndex: number;
|
|
91
|
+
sourceIndex: number;
|
|
92
|
+
annotation: CodeReviewAnnotation;
|
|
93
|
+
}[];
|
|
94
|
+
editor?: {
|
|
95
|
+
fileIndex: number;
|
|
96
|
+
sourceIndex: number;
|
|
97
|
+
scope: "file" | "line";
|
|
98
|
+
editingAnnotationIndex?: number;
|
|
99
|
+
text: string;
|
|
100
|
+
};
|
|
101
|
+
} | {
|
|
102
|
+
kind: "text";
|
|
103
|
+
annotations: {
|
|
104
|
+
sourceIndex: number;
|
|
105
|
+
annotation: TextReviewAnnotation;
|
|
106
|
+
}[];
|
|
107
|
+
editedText?: string;
|
|
108
|
+
editor?: {
|
|
109
|
+
sourceIndex: number;
|
|
110
|
+
scope: "text" | "line";
|
|
111
|
+
editingAnnotationIndex?: number;
|
|
112
|
+
text: string;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
@@ -7,7 +7,11 @@ import type { NativeNode, NativeUiEvent } from "../native/node.js";
|
|
|
7
7
|
*/
|
|
8
8
|
export declare class LoginDialogComponent extends OverlayPanel {
|
|
9
9
|
#private;
|
|
10
|
-
constructor(tui: TUI, providerId: string, onComplete: (success: boolean, message?: string) => void, openUrl: (url: string) => void);
|
|
10
|
+
constructor(tui: Pick<TUI, "requestRender">, providerId: string, onComplete: (success: boolean, message?: string) => void, openUrl: (url: string) => void);
|
|
11
|
+
/** Focus reaches the live field: it draws the caret (the hardware cursor when the terminal's is on). */
|
|
12
|
+
get focused(): boolean;
|
|
13
|
+
set focused(value: boolean);
|
|
14
|
+
setUseTerminalCursor(useTerminalCursor: boolean): void;
|
|
11
15
|
get signal(): AbortSignal;
|
|
12
16
|
/**
|
|
13
17
|
* Called by the OAuth `onAuth` callback. Renders the full authorization URL
|
|
@@ -4,7 +4,7 @@ import type { Component } from "../tui.js";
|
|
|
4
4
|
import type { SgrMouseEvent } from "../mouse.js";
|
|
5
5
|
import { type ConfiguredThinkingLevel } from "../thinking.js";
|
|
6
6
|
import { type ThemeColor } from "../theme/theme.js";
|
|
7
|
-
import type { TspPickerColumn, TspPickerGroup, TspPickerItem, TspPickerMark } from "@linxiraos/pi-wire";
|
|
7
|
+
import type { TspPickerColumn, TspPickerGroup, TspPickerItem, TspPickerMark, TspPickerProps } from "@linxiraos/pi-wire";
|
|
8
8
|
import type { NativeChild, NativeNode, NativeUiEvent } from "../native/node.js";
|
|
9
9
|
/** Canonical display ordering of built-in model roles. */
|
|
10
10
|
export type ModelRole = "default" | "smol" | "slow" | "vision" | "plan" | "commit" | "tiny" | "memory" | "task" | "advisor" | "widget" | "image" | "web" | "speech" | "dictation" | "judge";
|
|
@@ -232,6 +232,8 @@ export interface ModelPickerCatalogue {
|
|
|
232
232
|
readonly itemsAdd?: readonly TspPickerItem[];
|
|
233
233
|
readonly itemsDel?: readonly string[];
|
|
234
234
|
}
|
|
235
|
+
/** The search, fact-column and row props every model `picker` sheet sends ({@link ModelBrowser.pickerRows}). */
|
|
236
|
+
export type ModelPickerRows = Pick<TspPickerProps, "query" | "cursor" | "columns" | "items" | "itemsAdd" | "itemsDel" | "order" | "hits" | "selected" | "current" | "total">;
|
|
235
237
|
/** How {@link ModelBrowser.pickerOrder} heads its rows. */
|
|
236
238
|
export interface ModelPickerGrouping {
|
|
237
239
|
/** One group per provider after the Recent block (the unfiltered All models view). */
|
|
@@ -329,6 +331,13 @@ export declare class ModelBrowser implements Component {
|
|
|
329
331
|
get baseCount(): number;
|
|
330
332
|
/** The selected row's selector, null when nothing selectable is selected. */
|
|
331
333
|
get pickerSelected(): string | null;
|
|
334
|
+
/**
|
|
335
|
+
* A model picker's search field, fact columns and rows: `catalogue` (from
|
|
336
|
+
* {@link pickerItems}) in `view` order (from {@link pickerOrder}), the
|
|
337
|
+
* selection, and `current` checked. Memoize hosts on its inputs plus
|
|
338
|
+
* {@link query}, {@link cursor} and {@link pickerSelected}.
|
|
339
|
+
*/
|
|
340
|
+
pickerRows(catalogue: ModelPickerCatalogue, view: ModelPickerOrder, current: string | undefined): ModelPickerRows;
|
|
332
341
|
/**
|
|
333
342
|
* Picker rows for `catalogue`: the same object while the catalogue, roles
|
|
334
343
|
* and row inputs are unchanged, so typing and scope hops never resend it.
|
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
import type { CredentialsApi, KeysApi } from "@linxiraos/pi-ai";
|
|
2
2
|
import { type SgrMouseEvent } from "../index.js";
|
|
3
3
|
import { OverlayPanel } from "../chrome/overlay-box.js";
|
|
4
|
+
import type { TspText } from "@linxiraos/pi-wire";
|
|
4
5
|
import type { DescribeContext, NativeNode, NativeUiEvent } from "../native/node.js";
|
|
5
6
|
/** Credential presence and provenance needed by the provider picker. */
|
|
6
7
|
export interface OAuthSelectorAuthSource {
|
|
7
8
|
readonly credentials: Pick<CredentialsApi, "has">;
|
|
8
9
|
readonly keys: Pick<KeysApi, "source">;
|
|
9
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* How a host other than `/login` presents the native provider sheet (the
|
|
13
|
+
* setup wizard): its heading, `role` and size, a status line docked above the
|
|
14
|
+
* action bar, and the Esc action that leaves in place of Close (the action's
|
|
15
|
+
* `id` cancels like Esc).
|
|
16
|
+
*/
|
|
17
|
+
export interface OAuthSelectorSheet {
|
|
18
|
+
readonly title: string;
|
|
19
|
+
readonly subtitle: TspText;
|
|
20
|
+
readonly role: string;
|
|
21
|
+
readonly size: "md" | "lg";
|
|
22
|
+
readonly status?: TspText;
|
|
23
|
+
readonly leave: {
|
|
24
|
+
readonly id: string;
|
|
25
|
+
readonly label: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
10
28
|
/**
|
|
11
29
|
* Component that renders an OAuth provider selector.
|
|
12
30
|
*/
|
|
@@ -16,8 +34,13 @@ export declare class OAuthSelectorComponent extends OverlayPanel {
|
|
|
16
34
|
disabledProviders?: readonly string[];
|
|
17
35
|
validateAuth?: (providerId: string) => Promise<boolean>;
|
|
18
36
|
requestRender?: () => void;
|
|
37
|
+
sheet?: OAuthSelectorSheet;
|
|
19
38
|
});
|
|
20
39
|
stopValidation(): void;
|
|
40
|
+
/** Replace the native sheet's presentation (a new outcome line, a relabelled leave action). */
|
|
41
|
+
setSheet(sheet: OAuthSelectorSheet): void;
|
|
42
|
+
/** Re-read credential state after a sign-in stored one, keeping the query and selection. */
|
|
43
|
+
refreshAuth(): void;
|
|
21
44
|
/**
|
|
22
45
|
* Fit the selector into `lines` rendered rows by shrinking the visible list
|
|
23
46
|
* window (the window is centered on the selection, so the selected row is
|
|
@@ -74,6 +74,8 @@ export interface PlanReviewOverlayOptions {
|
|
|
74
74
|
slider?: HookSelectorSlider;
|
|
75
75
|
/** Display label for the external-editor key, surfaced in the footer help. */
|
|
76
76
|
externalEditorLabel?: string;
|
|
77
|
+
/** The external editor's name ("Notepad", "nvim") for the native Edit button; `$EDITOR` when unset. */
|
|
78
|
+
externalEditorName?: string;
|
|
77
79
|
/** Serializable annotations restored into this overlay instance. */
|
|
78
80
|
annotationState?: PlanReviewAnnotationState;
|
|
79
81
|
}
|
|
@@ -74,7 +74,7 @@ export declare class RewindSelectorComponent implements Component {
|
|
|
74
74
|
* of branch columns, the current path first. The bar is this component's
|
|
75
75
|
* own node, docked under the page, so the filter field keeps the caret.
|
|
76
76
|
*/
|
|
77
|
-
describeScreen(
|
|
77
|
+
describeScreen(cx: DescribeContext): NativeScreen;
|
|
78
78
|
/** The bar docked under the page: position, key hints, Cancel and Rewind; the filter field while filtering. */
|
|
79
79
|
describe(_cx: DescribeContext): NativeNode;
|
|
80
80
|
/** The bar's buttons run their keys' paths; everything else belongs to the blocks. */
|
|
@@ -74,6 +74,8 @@ declare class SessionList<T extends SessionSelectorEntry> implements Component {
|
|
|
74
74
|
onExit: () => void;
|
|
75
75
|
onToggleScope?: () => void;
|
|
76
76
|
onDeleteRequest?: (session: T) => void;
|
|
77
|
+
onRenameRequest?: (session: T) => void;
|
|
78
|
+
onPinRequest?: (session: T, pinned: boolean) => void;
|
|
77
79
|
/** Re-render hook for async list updates (fuzzy scan completion, history merge). */
|
|
78
80
|
onRequestRender?: () => void;
|
|
79
81
|
constructor(sessions: T[], showCwd?: boolean, historyMatcher?: SessionHistoryMatcher, getTerminalRows?: () => number, pinnedIds?: ReadonlySet<string>, currentSessionPath?: string | (() => string | undefined));
|
|
@@ -87,6 +89,8 @@ declare class SessionList<T extends SessionSelectorEntry> implements Component {
|
|
|
87
89
|
/** Cancel pending async search work; idempotent, called on every picker exit path. */
|
|
88
90
|
dispose(): void;
|
|
89
91
|
removeSession(sessionPath: string): void;
|
|
92
|
+
/** Update a session's title in place and refresh the visible list, keeping the selection. */
|
|
93
|
+
renameSessionTitle(sessionPath: string, title: string): void;
|
|
90
94
|
/** Resolve a list-local rendered-line index to a filtered-session index. */
|
|
91
95
|
hitTestSession(line: number): number | undefined;
|
|
92
96
|
/** Wheel notch: move the selection one step (clamped, no wrap). */
|
|
@@ -101,6 +105,14 @@ declare class SessionList<T extends SessionSelectorEntry> implements Component {
|
|
|
101
105
|
resumeSelected(): void;
|
|
102
106
|
/** Delete / Backspace on an empty query: ask the parent to confirm deleting the selected session. */
|
|
103
107
|
requestDelete(): void;
|
|
108
|
+
/** F2: ask the parent to rename the selected session. */
|
|
109
|
+
requestRename(): void;
|
|
110
|
+
/** Pin keys: ask the parent to pin or unpin the selected session (default: flip it); no-op when already there. */
|
|
111
|
+
requestPin(pinned?: boolean): void;
|
|
112
|
+
/** Apply a persisted pin change; the list re-partitions and the cursor follows the session. */
|
|
113
|
+
setPinned(sessionId: string, pinned: boolean): void;
|
|
114
|
+
/** Whether the selected session is pinned (picks the pin action's direction). */
|
|
115
|
+
get selectedPinned(): boolean;
|
|
104
116
|
/** Empty the search query (the empty state's "Clear search"). */
|
|
105
117
|
clearSearch(): void;
|
|
106
118
|
get selectedSession(): T | undefined;
|
|
@@ -128,6 +140,14 @@ declare class SessionList<T extends SessionSelectorEntry> implements Component {
|
|
|
128
140
|
}
|
|
129
141
|
export interface SessionSelectorOptions<T extends SessionSelectorEntry = SessionSelectorEntry> {
|
|
130
142
|
onDelete?: (session: T) => Promise<boolean>;
|
|
143
|
+
/**
|
|
144
|
+
* Rename the selected session to a user-supplied title; resolve with the
|
|
145
|
+
* title as stored (the session canonicalizes it) or null when the rename
|
|
146
|
+
* did not happen.
|
|
147
|
+
*/
|
|
148
|
+
onRename?: (session: T, title: string) => Promise<string | null>;
|
|
149
|
+
/** Persist the selected session's pin state (pin keys / the picker's Pin action). */
|
|
150
|
+
onSetPinned?: (session: T, pinned: boolean) => Promise<void>;
|
|
131
151
|
historyMatcher?: SessionHistoryMatcher;
|
|
132
152
|
/** Loads sessions across all projects for the all-projects scope toggle (Tab). */
|
|
133
153
|
loadAllSessions?: () => Promise<T[]>;
|
|
@@ -205,8 +225,8 @@ export declare class SessionSelectorComponent<T extends SessionSelectorEntry = S
|
|
|
205
225
|
/**
|
|
206
226
|
* With the `picker` kind: the data-first session picker (§4.7). Otherwise
|
|
207
227
|
* scope `tabs`, loading/error message, then the search `input` and session
|
|
208
|
-
* `list` — or the delete-confirmation dialog in their place, as on
|
|
209
|
-
* path — and the key-hint footer.
|
|
228
|
+
* `list` — or the delete-confirmation / rename dialog in their place, as on
|
|
229
|
+
* the ANSI path — and the key-hint footer.
|
|
210
230
|
*/
|
|
211
231
|
describe(cx: DescribeContext): NativeNode;
|
|
212
232
|
/** Picker events (root keypath); fallback: scope tab → toggle scope, click on a session → resume it, exactly like a mouse click. */
|