@linxiraos/pi-tui 1.4.4 → 1.4.6
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 +29 -27
- package/dist/types/app-keybindings.d.ts +5 -0
- package/dist/types/chrome/context-map.d.ts +15 -0
- package/dist/types/chrome/context-presentation.d.ts +48 -0
- package/dist/types/chrome/context-view-model.d.ts +77 -0
- package/dist/types/components/image.d.ts +20 -0
- package/dist/types/components/loader.d.ts +1 -1
- package/dist/types/native/blobs.d.ts +9 -0
- package/dist/types/overlays/advisor-config.d.ts +6 -0
- package/dist/types/overlays/agent-hub-projection.d.ts +3 -1
- package/dist/types/overlays/ask-dialog.d.ts +12 -3
- package/dist/types/overlays/btw-history-panel.d.ts +16 -2
- package/dist/types/overlays/btw-history.d.ts +7 -0
- package/dist/types/overlays/btw-panel.d.ts +2 -0
- package/dist/types/overlays/context-viewer-format.d.ts +42 -0
- package/dist/types/overlays/context-viewer-overview.d.ts +70 -0
- package/dist/types/overlays/context-viewer.d.ts +25 -0
- package/dist/types/overlays/hook-input.d.ts +1 -0
- package/dist/types/overlays/mcp-add-wizard.d.ts +2 -0
- package/dist/types/overlays/pause-screen.d.ts +13 -3
- package/dist/types/overlays/running-subagent-badge.d.ts +7 -1
- package/dist/types/prompt/macos-spelling.d.ts +2 -2
- package/dist/types/render/hyperlink.d.ts +15 -2
- package/dist/types/render/output-pane.d.ts +1 -1
- package/dist/types/render/render-utils.d.ts +7 -1
- package/dist/types/status-line/component.d.ts +2 -2
- package/dist/types/status-line/context-usage.d.ts +15 -30
- package/dist/types/terminal-capabilities.d.ts +7 -0
- package/dist/types/theme/symbols.d.ts +1 -1
- package/dist/types/tools/ask.d.ts +4 -0
- package/dist/types/tools/edit.d.ts +3 -1
- package/dist/types/tools/fetch.d.ts +1 -0
- package/dist/types/tools/github.d.ts +3 -0
- package/dist/types/tools/grouped-file-output.d.ts +2 -0
- package/dist/types/tools/mcp.d.ts +3 -3
- package/dist/types/tools/read.d.ts +3 -0
- package/dist/types/tools/wait.d.ts +16 -2
- package/dist/types/tui.d.ts +2 -0
- package/dist/types/vim.d.ts +39 -0
- package/package.json +9 -9
- package/src/app-keybindings.d.ts +5 -0
- package/src/app-keybindings.ts +5 -0
- package/src/chat/bash-execution.ts +7 -1
- package/src/chat/read-tool-group.ts +1 -2
- package/src/chat/skill-message.ts +2 -6
- package/src/chrome/context-map.ts +62 -0
- package/src/chrome/context-presentation.ts +26 -0
- package/src/chrome/context-view-model.ts +73 -0
- package/src/chrome/transcript-container.ts +89 -59
- package/src/components/editor.ts +455 -13
- package/src/components/image.d.ts +20 -0
- package/src/components/image.ts +83 -18
- package/src/components/loader.d.ts +1 -1
- package/src/components/loader.ts +1 -1
- package/src/components/markdown.ts +109 -7
- package/src/hotkeys-markdown.ts +1 -0
- package/src/native/blobs.d.ts +9 -0
- package/src/native/blobs.ts +3 -2
- package/src/overlays/advisor-config.ts +9 -2
- package/src/overlays/agent-hub-projection.d.ts +3 -1
- package/src/overlays/agent-hub-projection.ts +6 -5
- package/src/overlays/agent-hub.ts +51 -42
- package/src/overlays/ask-dialog.ts +125 -35
- package/src/overlays/btw-history-panel.ts +124 -12
- package/src/overlays/btw-history.ts +11 -0
- package/src/overlays/btw-panel.ts +8 -4
- package/src/overlays/context-viewer-format.ts +145 -0
- package/src/overlays/context-viewer-overview.ts +381 -0
- package/src/overlays/context-viewer.ts +728 -0
- package/src/overlays/hook-input.ts +2 -0
- package/src/overlays/mcp-add-wizard.ts +5 -0
- package/src/overlays/pause-screen.ts +166 -33
- package/src/overlays/running-subagent-badge.ts +12 -1
- package/src/overlays/settings-defs.ts +1 -0
- package/src/overlays/usage-dashboard.ts +15 -2
- package/src/prompt/macos-spelling.ts +24 -15
- package/src/render/hyperlink.d.ts +15 -2
- package/src/render/hyperlink.ts +41 -18
- package/src/render/output-pane.d.ts +1 -1
- package/src/render/output-pane.ts +60 -17
- package/src/render/render-utils.d.ts +7 -1
- package/src/render/render-utils.ts +11 -2
- package/src/setup/scenes/sign-in.ts +6 -0
- package/src/status-line/component.ts +6 -4
- package/src/status-line/context-usage.ts +56 -582
- package/src/terminal-capabilities.d.ts +7 -0
- package/src/terminal-capabilities.ts +10 -0
- package/src/theme/symbols.d.ts +1 -1
- package/src/theme/symbols.ts +16 -0
- package/src/tools/ask.d.ts +4 -0
- package/src/tools/ask.ts +4 -0
- package/src/tools/ast-grep.ts +3 -2
- package/src/tools/bash.ts +5 -23
- package/src/tools/edit.d.ts +3 -1
- package/src/tools/edit.ts +8 -4
- package/src/tools/fetch.d.ts +1 -0
- package/src/tools/fetch.ts +1 -0
- package/src/tools/find.ts +3 -10
- package/src/tools/github.d.ts +3 -0
- package/src/tools/github.ts +23 -3
- package/src/tools/glob.ts +4 -3
- package/src/tools/grep.ts +3 -4
- package/src/tools/grouped-file-output.d.ts +2 -0
- package/src/tools/grouped-file-output.ts +8 -2
- package/src/tools/mcp.d.ts +3 -3
- package/src/tools/mcp.ts +27 -9
- package/src/tools/native-view.ts +2 -2
- package/src/tools/read.d.ts +3 -0
- package/src/tools/read.ts +3 -1
- package/src/tools/vibe.ts +14 -3
- package/src/tools/wait.d.ts +16 -2
- package/src/tools/wait.ts +16 -2
- package/src/tui.d.ts +2 -0
- package/src/tui.ts +59 -19
- package/src/vim.d.ts +39 -0
- package/src/vim.ts +313 -22
|
@@ -21,6 +21,7 @@ export interface HookInputOptions {
|
|
|
21
21
|
tui?: TUI;
|
|
22
22
|
timeout?: number;
|
|
23
23
|
onTimeout?: () => void;
|
|
24
|
+
secret?: boolean;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
/** Terminal-only key legend under the field; a native terminal puts the keys in the buttons' tooltips. */
|
|
@@ -84,6 +85,7 @@ export class HookInputComponent extends OverlayPanel {
|
|
|
84
85
|
|
|
85
86
|
this.#field = new TextFormField({
|
|
86
87
|
theme: formTheme,
|
|
88
|
+
secret: opts?.secret ?? false,
|
|
87
89
|
empty: "submit",
|
|
88
90
|
onSubmit: value => this.#onSubmitCallback(value),
|
|
89
91
|
onCancel: () => this.#onCancelCallback(),
|
|
@@ -986,6 +986,11 @@ export class MCPAddWizard extends OverlayPanel {
|
|
|
986
986
|
);
|
|
987
987
|
}
|
|
988
988
|
|
|
989
|
+
/** Route enhanced clipboard text into the active wizard field, never the hidden chat editor. */
|
|
990
|
+
pasteText(text: string): void {
|
|
991
|
+
if (this.#stepKind === "input") this.#inputField?.pasteText(text);
|
|
992
|
+
}
|
|
993
|
+
|
|
989
994
|
handleInput(keyData: string): void {
|
|
990
995
|
// While an OAuth callback is being awaited, Esc/Ctrl+C aborts the flow
|
|
991
996
|
// rather than stepping back through the form: the wizard advertises
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import { agentPauseGate } from "@linxiraos/pi-agent-core";
|
|
15
15
|
import { type Component, matchesKey, type OverlayFocusOwner, type OverlayHandle, type OverlayOptions } from "../index";
|
|
16
16
|
import { formatCoarseDuration } from "../chrome/format";
|
|
17
|
-
import { centerLine } from "../utils";
|
|
17
|
+
import { centerLine, visibleWidth } from "../utils";
|
|
18
18
|
import { theme } from "../theme/theme";
|
|
19
19
|
import { matchesAppInterrupt } from "../keybinding-matchers";
|
|
20
20
|
import { formatKeyHint, formatTooltipKey } from "../app-keybindings";
|
|
@@ -24,6 +24,17 @@ import { col, keyed, node, row, span, text } from "../native/describe";
|
|
|
24
24
|
import { actionBar, actionButton } from "../native/overlay";
|
|
25
25
|
import { isNativeRendering } from "../native/state";
|
|
26
26
|
|
|
27
|
+
/** Outstanding turn and job counts supplied by the pause-screen host. */
|
|
28
|
+
export interface PauseWorkStatus {
|
|
29
|
+
unsettledTurns: number;
|
|
30
|
+
unfinishedJobs: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Optional live work source for the pause overlay. */
|
|
34
|
+
export interface PauseScreenOptions {
|
|
35
|
+
getWorkStatus?: () => PauseWorkStatus;
|
|
36
|
+
}
|
|
37
|
+
|
|
27
38
|
/**
|
|
28
39
|
* Slice of `InteractiveModeContext` the pause screen drives. Narrow so tests
|
|
29
40
|
* can exercise the full engage → hold → release lifecycle without a real TUI.
|
|
@@ -39,9 +50,10 @@ export interface PauseScreenHost {
|
|
|
39
50
|
readonly sessionName?: string;
|
|
40
51
|
}
|
|
41
52
|
|
|
42
|
-
|
|
43
|
-
const TICK_MS = 1_000;
|
|
53
|
+
const EMPTY_WORK_STATUS: PauseWorkStatus = { unsettledTurns: 0, unfinishedJobs: 0 };
|
|
44
54
|
|
|
55
|
+
/** Refresh cadence for the live hold clock and work-status snapshot. */
|
|
56
|
+
const TICK_MS = 1_000;
|
|
45
57
|
/** Pause-bar glyph geometry (rows × columns of full blocks per bar). */
|
|
46
58
|
const BAR_ROWS = 7;
|
|
47
59
|
const BAR_WIDTH = 5;
|
|
@@ -49,7 +61,7 @@ const BAR_GAP = 4;
|
|
|
49
61
|
|
|
50
62
|
/** Below either bound the full scene cannot breathe; drop to the compact card. */
|
|
51
63
|
const MIN_FULL_WIDTH = 64;
|
|
52
|
-
const MIN_FULL_HEIGHT =
|
|
64
|
+
const MIN_FULL_HEIGHT = 23;
|
|
53
65
|
|
|
54
66
|
const TITLE = "P A U S E D";
|
|
55
67
|
const BODY_LINES = [
|
|
@@ -79,51 +91,110 @@ function formatClock(ms: number): string {
|
|
|
79
91
|
* Paint the pause scene as exactly `height` rows, vertically centered.
|
|
80
92
|
* Exported for tests.
|
|
81
93
|
*/
|
|
82
|
-
export function renderPauseScreen(
|
|
83
|
-
|
|
94
|
+
export function renderPauseScreen(
|
|
95
|
+
width: number,
|
|
96
|
+
height: number,
|
|
97
|
+
elapsedMs: number,
|
|
98
|
+
sessionName?: string,
|
|
99
|
+
workStatus: PauseWorkStatus = EMPTY_WORK_STATUS,
|
|
100
|
+
): string[] {
|
|
101
|
+
const screenWidth = Math.max(1, Math.floor(width));
|
|
102
|
+
const screenHeight = Math.max(1, Math.floor(height));
|
|
103
|
+
const compact = screenWidth < MIN_FULL_WIDTH || screenHeight < MIN_FULL_HEIGHT;
|
|
104
|
+
const outstanding = workStatus.unsettledTurns > 0 || workStatus.unfinishedJobs > 0;
|
|
105
|
+
const status = outstanding ? "Pausing — waiting for work to settle" : "Paused — ready to suspend";
|
|
106
|
+
const workCounts = [
|
|
107
|
+
`Unsettled turns: ${workStatus.unsettledTurns}`,
|
|
108
|
+
`Unfinished jobs: ${workStatus.unfinishedJobs}`,
|
|
109
|
+
];
|
|
84
110
|
const content: string[] = [];
|
|
85
111
|
// Resume keys mirror PauseScreenComponent#handleInput: `app.interrupt` (raw Escape when unbound), Enter, Space.
|
|
86
112
|
const esc = interruptKey();
|
|
87
113
|
|
|
88
114
|
if (compact) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
115
|
+
const sessionLine = sessionName
|
|
116
|
+
? centerLine(theme.bold(sessionName.replace(/\s+/g, " ").trim()), screenWidth).trimEnd()
|
|
117
|
+
: undefined;
|
|
118
|
+
const titleLine = centerLine(theme.bold(theme.fg("accent", `▌▌ ${TITLE}`)), screenWidth).trimEnd();
|
|
119
|
+
const clockLine = centerLine(theme.fg("dim", `paused for ${formatClock(elapsedMs)}`), screenWidth).trimEnd();
|
|
120
|
+
const statusLine = centerLine(theme.fg(outstanding ? "warning" : "success", status), screenWidth).trimEnd();
|
|
121
|
+
const resumeLine = centerLine(theme.fg("dim", `${esc} to resume`), screenWidth).trimEnd();
|
|
122
|
+
const fullContent: string[] = [];
|
|
123
|
+
if (sessionLine) fullContent.push(sessionLine);
|
|
124
|
+
fullContent.push(titleLine, "", clockLine, statusLine);
|
|
125
|
+
if (outstanding)
|
|
126
|
+
fullContent.push(...workCounts.map(line => centerLine(theme.fg("muted", line), screenWidth).trimEnd()));
|
|
127
|
+
fullContent.push(resumeLine);
|
|
128
|
+
|
|
129
|
+
if (screenHeight >= fullContent.length) {
|
|
130
|
+
content.push(...fullContent);
|
|
131
|
+
} else {
|
|
132
|
+
// Keep the live state and a way out on screen before the decorative card details.
|
|
133
|
+
if (screenHeight === 1) {
|
|
134
|
+
const counts = `T:${workStatus.unsettledTurns} J:${workStatus.unfinishedJobs}`;
|
|
135
|
+
const summary = outstanding ? `${counts} · ${esc} to resume` : `Paused · ${esc} to resume`;
|
|
136
|
+
const abbreviatedSummary = outstanding
|
|
137
|
+
? `T${workStatus.unsettledTurns} J${workStatus.unfinishedJobs} ${esc} resume`
|
|
138
|
+
: `${esc} resume`;
|
|
139
|
+
const visibleSummary = visibleWidth(summary) > screenWidth ? abbreviatedSummary : summary;
|
|
140
|
+
content.push(
|
|
141
|
+
centerLine(theme.fg(outstanding ? "warning" : "success", visibleSummary), screenWidth).trimEnd(),
|
|
142
|
+
);
|
|
143
|
+
} else if (screenHeight === 2 && outstanding) {
|
|
144
|
+
const counts = `Pausing · T:${workStatus.unsettledTurns} J:${workStatus.unfinishedJobs}`;
|
|
145
|
+
content.push(centerLine(theme.fg("warning", counts), screenWidth).trimEnd(), resumeLine);
|
|
146
|
+
} else {
|
|
147
|
+
content.push(statusLine);
|
|
148
|
+
if (outstanding && screenHeight === 3) {
|
|
149
|
+
content.push(
|
|
150
|
+
centerLine(
|
|
151
|
+
theme.fg("muted", `Turns: ${workStatus.unsettledTurns} · Jobs: ${workStatus.unfinishedJobs}`),
|
|
152
|
+
screenWidth,
|
|
153
|
+
).trimEnd(),
|
|
154
|
+
);
|
|
155
|
+
} else if (outstanding) {
|
|
156
|
+
content.push(...workCounts.map(line => centerLine(theme.fg("muted", line), screenWidth).trimEnd()));
|
|
157
|
+
}
|
|
158
|
+
content.push(resumeLine);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (content.length < screenHeight && sessionLine) content.push(sessionLine);
|
|
162
|
+
if (content.length < screenHeight) content.push(titleLine);
|
|
163
|
+
if (content.length < screenHeight) content.push(clockLine);
|
|
92
164
|
}
|
|
93
|
-
content.push(centerLine(theme.bold(theme.fg("accent", `▌▌ ${TITLE}`)), width).trimEnd());
|
|
94
|
-
content.push("");
|
|
95
|
-
content.push(centerLine(theme.fg("dim", `paused for ${formatClock(elapsedMs)}`), width).trimEnd());
|
|
96
|
-
content.push(centerLine(theme.fg("dim", `${esc} to resume`), width).trimEnd());
|
|
97
165
|
} else {
|
|
98
166
|
if (sessionName) {
|
|
99
|
-
content.push(centerLine(theme.bold(sessionName),
|
|
100
|
-
content.push("");
|
|
167
|
+
content.push(centerLine(theme.bold(sessionName.replace(/\s+/g, " ").trim()), screenWidth).trimEnd());
|
|
101
168
|
content.push("");
|
|
102
169
|
}
|
|
103
170
|
const bar = "█".repeat(BAR_WIDTH);
|
|
104
171
|
const glyphRow = `${bar}${" ".repeat(BAR_GAP)}${bar}`;
|
|
105
172
|
for (let i = 0; i < BAR_ROWS; i++) {
|
|
106
|
-
content.push(centerLine(theme.fg("accent", glyphRow),
|
|
173
|
+
content.push(centerLine(theme.fg("accent", glyphRow), screenWidth).trimEnd());
|
|
107
174
|
}
|
|
108
175
|
content.push("");
|
|
109
|
-
content.push(centerLine(theme.bold(theme.fg("accent", TITLE)),
|
|
176
|
+
content.push(centerLine(theme.bold(theme.fg("accent", TITLE)), screenWidth).trimEnd());
|
|
110
177
|
content.push("");
|
|
111
178
|
for (const line of BODY_LINES) {
|
|
112
|
-
content.push(centerLine(theme.fg("muted", line),
|
|
179
|
+
content.push(centerLine(theme.fg("muted", line), screenWidth).trimEnd());
|
|
113
180
|
}
|
|
114
|
-
content.push("");
|
|
115
|
-
|
|
181
|
+
content.push(centerLine(theme.fg(outstanding ? "warning" : "success", status), screenWidth).trimEnd());
|
|
182
|
+
if (outstanding) {
|
|
183
|
+
content.push(centerLine(theme.fg("muted", workCounts[0]!), screenWidth).trimEnd());
|
|
184
|
+
content.push(centerLine(theme.fg("muted", workCounts[1]!), screenWidth).trimEnd());
|
|
185
|
+
}
|
|
186
|
+
content.push(centerLine(theme.fg("dim", `paused for ${formatClock(elapsedMs)}`), screenWidth).trimEnd());
|
|
116
187
|
content.push("");
|
|
117
188
|
const resumeHint = `${esc} · ${formatKeyHint("enter")} · ${formatKeyHint("space")} — resume`;
|
|
118
|
-
content.push(centerLine(theme.fg("dim", resumeHint),
|
|
189
|
+
content.push(centerLine(theme.fg("dim", resumeHint), screenWidth).trimEnd());
|
|
119
190
|
}
|
|
120
191
|
|
|
121
|
-
const topPad = Math.max(0, Math.floor((
|
|
192
|
+
const topPad = Math.max(0, Math.floor((screenHeight - content.length) / 2));
|
|
122
193
|
// oxlint-disable-next-line unicorn/no-new-array -- length preallocation
|
|
123
194
|
const lines: string[] = new Array(topPad).fill("");
|
|
124
195
|
lines.push(...content);
|
|
125
|
-
while (lines.length <
|
|
126
|
-
return lines.slice(0,
|
|
196
|
+
while (lines.length < screenHeight) lines.push("");
|
|
197
|
+
return lines.slice(0, screenHeight);
|
|
127
198
|
}
|
|
128
199
|
|
|
129
200
|
/** Fullscreen overlay component; resolves {@link run} when a resume key lands. */
|
|
@@ -133,19 +204,25 @@ export class PauseScreenComponent implements Component, OverlayFocusOwner {
|
|
|
133
204
|
#disposed = false;
|
|
134
205
|
#startedAt = Date.now();
|
|
135
206
|
#native: NativeNode | undefined;
|
|
207
|
+
#workSnapshot: PauseWorkStatus;
|
|
136
208
|
|
|
137
|
-
constructor(
|
|
209
|
+
constructor(
|
|
210
|
+
readonly host: PauseScreenHost,
|
|
211
|
+
readonly options: PauseScreenOptions = {},
|
|
212
|
+
) {
|
|
213
|
+
this.#workSnapshot = this.#readWorkSnapshot();
|
|
214
|
+
}
|
|
138
215
|
|
|
139
216
|
/** Start the clock; resolves once the user asks to resume. */
|
|
140
217
|
run(): Promise<void> {
|
|
141
218
|
this.#startedAt = agentPauseGate.pausedAt ?? Date.now();
|
|
142
219
|
this.#native = undefined;
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
this.#
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
220
|
+
this.#refreshWorkSnapshot();
|
|
221
|
+
this.#timer ??= setInterval(() => {
|
|
222
|
+
if (this.#disposed) return;
|
|
223
|
+
const statusChanged = this.#refreshWorkSnapshot();
|
|
224
|
+
if (statusChanged || !isNativeRendering()) this.host.ui.requestRender();
|
|
225
|
+
}, TICK_MS);
|
|
149
226
|
this.host.ui.requestRender();
|
|
150
227
|
return this.#done.promise;
|
|
151
228
|
}
|
|
@@ -181,6 +258,25 @@ export class PauseScreenComponent implements Component, OverlayFocusOwner {
|
|
|
181
258
|
this.#native = undefined;
|
|
182
259
|
}
|
|
183
260
|
|
|
261
|
+
#readWorkSnapshot(): PauseWorkStatus {
|
|
262
|
+
const workStatus = this.options.getWorkStatus?.() ?? EMPTY_WORK_STATUS;
|
|
263
|
+
return {
|
|
264
|
+
unsettledTurns: workStatus.unsettledTurns,
|
|
265
|
+
unfinishedJobs: workStatus.unfinishedJobs,
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
#refreshWorkSnapshot(): boolean {
|
|
270
|
+
const next = this.#readWorkSnapshot();
|
|
271
|
+
const previous = this.#workSnapshot;
|
|
272
|
+
if (next.unsettledTurns === previous.unsettledTurns && next.unfinishedJobs === previous.unfinishedJobs) {
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
this.#workSnapshot = next;
|
|
276
|
+
this.#native = undefined;
|
|
277
|
+
return true;
|
|
278
|
+
}
|
|
279
|
+
|
|
184
280
|
/** A glass sheet titled "Paused" (not the whole pane: the transcript stays visible, frozen). */
|
|
185
281
|
readonly nativeOverlay = { role: "zeta.overlay.pause", size: "md", anchor: "center", head: "Paused" } as const;
|
|
186
282
|
|
|
@@ -191,6 +287,41 @@ export class PauseScreenComponent implements Component, OverlayFocusOwner {
|
|
|
191
287
|
*/
|
|
192
288
|
describe(): NativeNode {
|
|
193
289
|
if (this.#native) return this.#native;
|
|
290
|
+
const snapshot = this.#workSnapshot;
|
|
291
|
+
const outstanding = snapshot.unsettledTurns > 0 || snapshot.unfinishedJobs > 0;
|
|
292
|
+
const status = col(
|
|
293
|
+
[
|
|
294
|
+
keyed(
|
|
295
|
+
text(
|
|
296
|
+
[
|
|
297
|
+
span(
|
|
298
|
+
outstanding ? "Pausing — waiting for work to settle" : "Paused — ready to suspend",
|
|
299
|
+
outstanding ? "warning" : "success",
|
|
300
|
+
),
|
|
301
|
+
],
|
|
302
|
+
{ role: "zeta.pause.settlement" },
|
|
303
|
+
),
|
|
304
|
+
"settlement",
|
|
305
|
+
),
|
|
306
|
+
...(outstanding
|
|
307
|
+
? [
|
|
308
|
+
keyed(
|
|
309
|
+
text([span(`Unsettled turns: ${snapshot.unsettledTurns}`, "muted")], {
|
|
310
|
+
role: "zeta.pause.unsettled-turn-count",
|
|
311
|
+
}),
|
|
312
|
+
"unsettled-turns",
|
|
313
|
+
),
|
|
314
|
+
keyed(
|
|
315
|
+
text([span(`Unfinished jobs: ${snapshot.unfinishedJobs}`, "muted")], {
|
|
316
|
+
role: "zeta.pause.unfinished-job-count",
|
|
317
|
+
}),
|
|
318
|
+
"unfinished-jobs",
|
|
319
|
+
),
|
|
320
|
+
]
|
|
321
|
+
: []),
|
|
322
|
+
],
|
|
323
|
+
{ role: "zeta.pause.settlement-status", gap: "sm" },
|
|
324
|
+
);
|
|
194
325
|
const resumeKey = boundKeys("app.interrupt", ["escape"])[0] ?? "escape";
|
|
195
326
|
const hero = row(
|
|
196
327
|
[
|
|
@@ -244,6 +375,7 @@ export class PauseScreenComponent implements Component, OverlayFocusOwner {
|
|
|
244
375
|
this.#native = col(
|
|
245
376
|
[
|
|
246
377
|
keyed(hero, "hero"),
|
|
378
|
+
keyed(status, "settlement-status"),
|
|
247
379
|
keyed(facts, "facts"),
|
|
248
380
|
actionBar([
|
|
249
381
|
keyed(
|
|
@@ -276,6 +408,7 @@ export class PauseScreenComponent implements Component, OverlayFocusOwner {
|
|
|
276
408
|
Math.max(1, this.host.ui.terminal.rows),
|
|
277
409
|
elapsed,
|
|
278
410
|
this.host.sessionName,
|
|
411
|
+
this.#workSnapshot,
|
|
279
412
|
);
|
|
280
413
|
}
|
|
281
414
|
}
|
|
@@ -286,9 +419,9 @@ export class PauseScreenComponent implements Component, OverlayFocusOwner {
|
|
|
286
419
|
* gate on the way out (including teardown throws) — a leaked pause would
|
|
287
420
|
* freeze every agent in the process with no UI left to release it.
|
|
288
421
|
*/
|
|
289
|
-
export async function runPauseScreen(host: PauseScreenHost): Promise<void> {
|
|
422
|
+
export async function runPauseScreen(host: PauseScreenHost, options?: PauseScreenOptions): Promise<void> {
|
|
290
423
|
if (!agentPauseGate.pause()) return;
|
|
291
|
-
const component = new PauseScreenComponent(host);
|
|
424
|
+
const component = new PauseScreenComponent(host, options);
|
|
292
425
|
const overlay = host.ui.showOverlay(component, {
|
|
293
426
|
width: "100%",
|
|
294
427
|
maxHeight: "100%",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AgentHubRegistry, MAIN_AGENT_ID } from "./agent-hub-types";
|
|
2
2
|
|
|
3
3
|
export interface RunningSubagentRegistrySource<T extends AgentHubRegistry = AgentHubRegistry> {
|
|
4
4
|
agentRegistry: T;
|
|
@@ -17,3 +17,14 @@ export function getRunningSubagentBadgeAgentIds(registry: AgentHubRegistry): str
|
|
|
17
17
|
.filter(ref => ref.kind === "sub" && ref.status === "running")
|
|
18
18
|
.map(ref => ref.id);
|
|
19
19
|
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Agents the Agent Hub roster can show (every registry ref but the main
|
|
23
|
+
* session), whatever their status: finished, parked and killed subagents
|
|
24
|
+
* stay inspectable after the last one stops running.
|
|
25
|
+
*/
|
|
26
|
+
export function getInspectableSubagentCount(registry: AgentHubRegistry): number {
|
|
27
|
+
let count = 0;
|
|
28
|
+
for (const ref of registry.list()) if (ref.id !== MAIN_AGENT_ID) count++;
|
|
29
|
+
return count;
|
|
30
|
+
}
|
|
@@ -178,7 +178,16 @@ export function buildProviderCards(
|
|
|
178
178
|
for (const report of providerReports) {
|
|
179
179
|
for (const limit of report.limits) {
|
|
180
180
|
const label = formatLimitTitle(limit);
|
|
181
|
-
|
|
181
|
+
// Distinct buckets can share a label and window (Antigravity's Gemini
|
|
182
|
+
// vs Gemini (Argon) weekly) and must not average into one row, so the
|
|
183
|
+
// id joins the key. The label and window stay in it too: some
|
|
184
|
+
// providers build ids positionally or per plan (kimi's `${index}`,
|
|
185
|
+
// copilot's allowance), where ids differ across accounts for the
|
|
186
|
+
// same quota, so an id-only key would split those accounts apart.
|
|
187
|
+
// `sharedGroup` already names the routing copies of one shared bucket.
|
|
188
|
+
const key =
|
|
189
|
+
limit.scope.sharedGroup ??
|
|
190
|
+
`${label}|${limit.window?.id ?? limit.scope.windowId ?? "default"}|${limit.id}`;
|
|
182
191
|
const entry = buckets.get(key) ?? { label, limits: [] };
|
|
183
192
|
entry.limits.push(limit);
|
|
184
193
|
buckets.set(key, entry);
|
|
@@ -1680,7 +1689,11 @@ export class UsageDashboardComponent implements Component {
|
|
|
1680
1689
|
for (const [index, report] of reports.entries()) {
|
|
1681
1690
|
for (const limit of report.limits) {
|
|
1682
1691
|
const label = sanitizeDisplayLine(formatLimitTitle(limit));
|
|
1683
|
-
|
|
1692
|
+
// Same hybrid key as the cards: distinct buckets that share a
|
|
1693
|
+
// label and window (Gemini vs Gemini (Argon) weekly) stay separate.
|
|
1694
|
+
const key =
|
|
1695
|
+
limit.scope.sharedGroup ??
|
|
1696
|
+
`${label}|${limit.window?.id ?? limit.scope.windowId ?? "default"}|${limit.id}`;
|
|
1684
1697
|
let bucket = buckets.get(key);
|
|
1685
1698
|
if (!bucket) {
|
|
1686
1699
|
bucket = { label, window: detailWindowLabel(label, limit), rows: [] };
|
|
@@ -62,7 +62,7 @@ export class MacOSSpellingProvider implements EditorTextAssistProvider {
|
|
|
62
62
|
#availabilityChecked = false;
|
|
63
63
|
#cacheGeneration = 0;
|
|
64
64
|
#typoCache = new Map<string, readonly native.SpellingRange[]>();
|
|
65
|
-
/** {@link #projectTypoRanges} answers for the current {@link #typoCache}; segments re-ask every frame. */
|
|
65
|
+
/** {@link #projectTypoRanges} answers for the current {@link #typoCache}; render segments re-ask every frame. */
|
|
66
66
|
#projectionMemo = new Map<string, readonly native.SpellingRange[] | undefined>();
|
|
67
67
|
#typoInFlight = new Map<string, Promise<readonly native.SpellingRange[]>>();
|
|
68
68
|
#automaticTypoActive = false;
|
|
@@ -120,39 +120,48 @@ export class MacOSSpellingProvider implements EditorTextAssistProvider {
|
|
|
120
120
|
/**
|
|
121
121
|
* Misspelled prose ranges in `text` (offsets into it), in order and
|
|
122
122
|
* non-overlapping, except ones touching `context.typing` (the word still
|
|
123
|
-
* being typed).
|
|
124
|
-
*
|
|
123
|
+
* being typed). Checks the full logical line so rendering cuts cannot
|
|
124
|
+
* change spelling or prose boundaries. Uncached lines arrive through {@link onUpdate}.
|
|
125
125
|
*/
|
|
126
126
|
typoRanges(text: string, context: SpellingDecorationContext): readonly native.SpellingRange[] {
|
|
127
127
|
if (!this.#available || !this.#features.typoDetection || text.length === 0) return [];
|
|
128
|
-
|
|
129
|
-
const
|
|
130
|
-
|
|
128
|
+
const line = context.lines[context.line];
|
|
129
|
+
const segmentEnd = context.startCol + text.length;
|
|
130
|
+
if (
|
|
131
|
+
line === undefined ||
|
|
132
|
+
context.startCol < 0 ||
|
|
133
|
+
segmentEnd > line.length ||
|
|
134
|
+
!line.startsWith(text, context.startCol)
|
|
135
|
+
)
|
|
136
|
+
return [];
|
|
137
|
+
if (!this.#prose.isProse(context, context.startCol, segmentEnd)) return [];
|
|
138
|
+
const lane = `${context.line}:0`;
|
|
139
|
+
const cached = this.#typoCache.get(line);
|
|
131
140
|
// A cache hit obsoletes any older text queued for this lane. A miss must
|
|
132
141
|
// keep its just-scheduled entry alive: deleting it here used to cancel the
|
|
133
142
|
// verification check whenever a stale projection painted ranges while
|
|
134
143
|
// another check was in flight, freezing the projected undercurl (e.g. the
|
|
135
144
|
// "eac" of a fast-typed "each") until an unrelated repaint rescheduled it.
|
|
136
|
-
if (cached === undefined) this.#scheduleTypoRanges(
|
|
145
|
+
if (cached === undefined) this.#scheduleTypoRanges(line, lane);
|
|
137
146
|
else this.#automaticTypoQueue.delete(lane);
|
|
138
|
-
const ranges = cached ?? this.#projectTypoRanges(
|
|
147
|
+
const ranges = cached ?? this.#projectTypoRanges(line);
|
|
139
148
|
if (!ranges || ranges.length === 0) return [];
|
|
140
149
|
const kept: native.SpellingRange[] = [];
|
|
141
150
|
const typing = context.typing?.line === context.line ? context.typing : undefined;
|
|
142
151
|
let cursor = 0;
|
|
143
152
|
for (const range of ranges) {
|
|
144
153
|
const end = range.start + range.length;
|
|
145
|
-
if (typing &&
|
|
146
|
-
continue;
|
|
147
|
-
}
|
|
154
|
+
if (typing && range.start <= typing.end && typing.start <= end) continue;
|
|
148
155
|
// Overlapping or out-of-bounds ranges (stale native data, edit projection)
|
|
149
156
|
// must never re-emit already-rendered text: that doubles it on screen and
|
|
150
157
|
// desyncs the rendered width from the measured width (cursor drift).
|
|
151
|
-
if (range.start < cursor || end >
|
|
152
|
-
if (!this.#prose.isProse(context,
|
|
153
|
-
|
|
158
|
+
if (range.start < cursor || end > line.length) continue;
|
|
159
|
+
if (!this.#prose.isProse(context, range.start, end)) continue;
|
|
160
|
+
const start = Math.max(range.start, context.startCol);
|
|
161
|
+
const clippedEnd = Math.min(end, segmentEnd);
|
|
162
|
+
if (start < clippedEnd) {
|
|
163
|
+
kept.push({ start: start - context.startCol, length: clippedEnd - start });
|
|
154
164
|
}
|
|
155
|
-
kept.push(range);
|
|
156
165
|
cursor = end;
|
|
157
166
|
}
|
|
158
167
|
return kept;
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import type { TspSpan } from "@linxiraos/pi-wire";
|
|
2
2
|
import { type TerminalId } from "../terminal-capabilities";
|
|
3
|
+
/**
|
|
4
|
+
* A `file:` URL for `filePath`, or `undefined` when Node cannot encode it.
|
|
5
|
+
*
|
|
6
|
+
* Node rejects a malformed UNC target (a UNC path escaped twice by its author,
|
|
7
|
+
* e.g. `\\\wsl.localhost\…`) with `ERR_INVALID_ARG_VALUE: Empty UNC servername`.
|
|
8
|
+
* A stored session keeps whatever a tool call recorded, so a transcript must
|
|
9
|
+
* render such a path without a link rather than throw while it rebuilds.
|
|
10
|
+
*/
|
|
11
|
+
export declare function tryFileUri(filePath: string): string | undefined;
|
|
3
12
|
/**
|
|
4
13
|
* Build the OSC 8 target for a file path on `terminalId`.
|
|
5
14
|
*
|
|
@@ -15,11 +24,14 @@ import { type TerminalId } from "../terminal-capabilities";
|
|
|
15
24
|
* `vscode://file/<path>:<line>:<col>` form. Everywhere else the plain `file:`
|
|
16
25
|
* URI is right, with the location left in the visible text — terminals that
|
|
17
26
|
* parse a `path:line:col` suffix resolve that on their own.
|
|
27
|
+
*
|
|
28
|
+
* Returns `undefined` when `filePath` cannot be encoded — a malformed UNC
|
|
29
|
+
* target on the `file:` branch, or a lone surrogate on the `vscode://` branch.
|
|
18
30
|
*/
|
|
19
31
|
export declare function fileUriForTerminal(filePath: string, opts: {
|
|
20
32
|
line?: number;
|
|
21
33
|
col?: number;
|
|
22
|
-
} | undefined, terminalId: TerminalId): string;
|
|
34
|
+
} | undefined, terminalId: TerminalId): string | undefined;
|
|
23
35
|
/**
|
|
24
36
|
* Returns true when OSC 8 hyperlinks should be emitted.
|
|
25
37
|
*
|
|
@@ -84,7 +96,8 @@ export declare function fileLinkSpan(filePath: string, displayText: string, s?:
|
|
|
84
96
|
* Returns `displayText` unchanged when hyperlinks are disabled or when
|
|
85
97
|
* the text already contains an OSC 8 sequence (prevents double-wrapping).
|
|
86
98
|
* Relative paths resolve against the current working directory before URI
|
|
87
|
-
* encoding so the OSC 8 target is always a valid `file://` URL.
|
|
99
|
+
* encoding so the OSC 8 target is always a valid `file://` URL. A path Node
|
|
100
|
+
* cannot encode renders as `displayText` with no link.
|
|
88
101
|
*
|
|
89
102
|
* @param filePath - Filesystem path
|
|
90
103
|
* @param displayText - Text to render as the hyperlink anchor (may contain ANSI codes)
|
package/src/render/hyperlink.ts
CHANGED
|
@@ -34,6 +34,22 @@ function buildLinkId(uri: string): string {
|
|
|
34
34
|
return (h >>> 0).toString(16).padStart(8, "0");
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* A `file:` URL for `filePath`, or `undefined` when Node cannot encode it.
|
|
39
|
+
*
|
|
40
|
+
* Node rejects a malformed UNC target (a UNC path escaped twice by its author,
|
|
41
|
+
* e.g. `\\\wsl.localhost\…`) with `ERR_INVALID_ARG_VALUE: Empty UNC servername`.
|
|
42
|
+
* A stored session keeps whatever a tool call recorded, so a transcript must
|
|
43
|
+
* render such a path without a link rather than throw while it rebuilds.
|
|
44
|
+
*/
|
|
45
|
+
export function tryFileUri(filePath: string): string | undefined {
|
|
46
|
+
try {
|
|
47
|
+
return url.pathToFileURL(filePath).href;
|
|
48
|
+
} catch {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
37
53
|
/**
|
|
38
54
|
* Build the OSC 8 target for a file path on `terminalId`.
|
|
39
55
|
*
|
|
@@ -49,29 +65,33 @@ function buildLinkId(uri: string): string {
|
|
|
49
65
|
* `vscode://file/<path>:<line>:<col>` form. Everywhere else the plain `file:`
|
|
50
66
|
* URI is right, with the location left in the visible text — terminals that
|
|
51
67
|
* parse a `path:line:col` suffix resolve that on their own.
|
|
68
|
+
*
|
|
69
|
+
* Returns `undefined` when `filePath` cannot be encoded — a malformed UNC
|
|
70
|
+
* target on the `file:` branch, or a lone surrogate on the `vscode://` branch.
|
|
52
71
|
*/
|
|
53
72
|
export function fileUriForTerminal(
|
|
54
73
|
filePath: string,
|
|
55
74
|
opts: { line?: number; col?: number } | undefined,
|
|
56
75
|
terminalId: TerminalId,
|
|
57
|
-
): string {
|
|
58
|
-
if (terminalId !== "vscode") return
|
|
76
|
+
): string | undefined {
|
|
77
|
+
if (terminalId !== "vscode") return tryFileUri(filePath);
|
|
59
78
|
// vscode:// takes a filesystem path with forward slashes. Encode each
|
|
60
79
|
// segment independently so separators and a Windows drive colon stay
|
|
61
80
|
// structural while reserved bytes in file names cannot become URI syntax.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
81
|
+
try {
|
|
82
|
+
const asPath = filePath.replace(/\\/gu, "/");
|
|
83
|
+
const encodedPath = asPath
|
|
84
|
+
.split("/")
|
|
85
|
+
.map((segment, index) => (index === 0 && /^[a-z]:$/iu.test(segment) ? segment : encodeURIComponent(segment)))
|
|
86
|
+
.join("/");
|
|
87
|
+
const position =
|
|
88
|
+
opts?.line === undefined ? "" : opts.col === undefined ? `:${opts.line}` : `:${opts.line}:${opts.col}`;
|
|
89
|
+
return `vscode://file${encodedPath.startsWith("/") ? "" : "/"}${encodedPath}${position}`;
|
|
90
|
+
} catch {
|
|
91
|
+
// `encodeURIComponent` throws URIError on a lone surrogate, which a
|
|
92
|
+
// model-authored path can carry; the row keeps its text and loses the link.
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
75
95
|
}
|
|
76
96
|
|
|
77
97
|
/**
|
|
@@ -208,7 +228,8 @@ export function isNativeLinkEnabled(): boolean {
|
|
|
208
228
|
*/
|
|
209
229
|
export function fileLinkSpan(filePath: string, displayText: string, s = "path"): TspSpan {
|
|
210
230
|
if (hyperlinkMode === "off") return span(displayText, s);
|
|
211
|
-
const
|
|
231
|
+
const uri = tryFileUri(filePath);
|
|
232
|
+
const href = uri === undefined ? undefined : safeHyperlinkUri(uri);
|
|
212
233
|
return href ? span(displayText, s, { href }) : span(displayText, s);
|
|
213
234
|
}
|
|
214
235
|
|
|
@@ -218,12 +239,14 @@ export function fileLinkSpan(filePath: string, displayText: string, s = "path"):
|
|
|
218
239
|
* Returns `displayText` unchanged when hyperlinks are disabled or when
|
|
219
240
|
* the text already contains an OSC 8 sequence (prevents double-wrapping).
|
|
220
241
|
* Relative paths resolve against the current working directory before URI
|
|
221
|
-
* encoding so the OSC 8 target is always a valid `file://` URL.
|
|
242
|
+
* encoding so the OSC 8 target is always a valid `file://` URL. A path Node
|
|
243
|
+
* cannot encode renders as `displayText` with no link.
|
|
222
244
|
*
|
|
223
245
|
* @param filePath - Filesystem path
|
|
224
246
|
* @param displayText - Text to render as the hyperlink anchor (may contain ANSI codes)
|
|
225
247
|
* @param opts - Optional line/col position appended as `?line=N&col=M` query params
|
|
226
248
|
*/
|
|
227
249
|
export function fileHyperlink(filePath: string, displayText: string, opts?: { line?: number; col?: number }): string {
|
|
228
|
-
|
|
250
|
+
const uri = fileUriForTerminal(filePath, opts, TERMINAL.id);
|
|
251
|
+
return uri ? wrapHyperlink(uri, displayText) : displayText;
|
|
229
252
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DescribeContext, NativeNode } from "../native/node";
|
|
2
|
-
import type
|
|
2
|
+
import { type Theme } from "../theme/theme";
|
|
3
3
|
import type { Component } from "../tui";
|
|
4
4
|
/** Which side of an output stream remains visible when the pane is capped. */
|
|
5
5
|
export type OutputPaneEdge = "head" | "tail";
|