@linxiraos/pi-tui 1.4.7 → 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.
Files changed (172) hide show
  1. package/CHANGELOG.md +28 -109
  2. package/README.md +7 -1
  3. package/dist/types/app-keybindings.d.ts +5 -0
  4. package/dist/types/charts/table-data.d.ts +4 -2
  5. package/dist/types/chat/bash-execution.d.ts +4 -1
  6. package/dist/types/chat/eval-execution.d.ts +2 -0
  7. package/dist/types/chat/execution-shared.d.ts +14 -8
  8. package/dist/types/chat/figure-markdown.d.ts +2 -0
  9. package/dist/types/chat/svg-figure.d.ts +5 -0
  10. package/dist/types/chat/table-chart.d.ts +2 -0
  11. package/dist/types/chat/transcript-render-helpers.d.ts +11 -3
  12. package/dist/types/chrome/dynamic-border.d.ts +6 -0
  13. package/dist/types/chrome/transcript-status.d.ts +2 -2
  14. package/dist/types/components/editor.d.ts +15 -6
  15. package/dist/types/components/image.d.ts +6 -0
  16. package/dist/types/components/loader.d.ts +2 -0
  17. package/dist/types/keybinding-matchers.d.ts +7 -0
  18. package/dist/types/native/describe.d.ts +4 -2
  19. package/dist/types/native/node.d.ts +2 -3
  20. package/dist/types/native/overlay.d.ts +42 -2
  21. package/dist/types/native/state.d.ts +4 -0
  22. package/dist/types/overlays/btw-history-panel.d.ts +15 -0
  23. package/dist/types/overlays/btw-history.d.ts +24 -0
  24. package/dist/types/overlays/btw-inject.d.ts +22 -0
  25. package/dist/types/overlays/btw-panel.d.ts +7 -0
  26. package/dist/types/overlays/hook-editor.d.ts +2 -0
  27. package/dist/types/overlays/jobs-panel.d.ts +4 -0
  28. package/dist/types/overlays/model-browser.d.ts +1 -1
  29. package/dist/types/overlays/session-selector.d.ts +11 -2
  30. package/dist/types/prompt/composer.d.ts +13 -5
  31. package/dist/types/render/render-utils.d.ts +23 -1
  32. package/dist/types/status-line/startup.d.ts +0 -15
  33. package/dist/types/terminal-capabilities.d.ts +1 -1
  34. package/dist/types/theme/symbols.d.ts +3 -1
  35. package/dist/types/theme/theme-class.d.ts +1 -0
  36. package/dist/types/theme/theme.d.ts +1 -1
  37. package/dist/types/theme/tui-adapters.d.ts +2 -0
  38. package/dist/types/thinking.d.ts +8 -6
  39. package/dist/types/tools/ast-grep.d.ts +2 -0
  40. package/dist/types/tools/eval.d.ts +2 -0
  41. package/dist/types/tools/find.d.ts +1 -1
  42. package/dist/types/tools/grouped-file-output.d.ts +100 -19
  43. package/dist/types/tools/hashline-format.d.ts +5 -0
  44. package/dist/types/tools/native-view.d.ts +2 -0
  45. package/dist/types/tools/output-meta.d.ts +27 -0
  46. package/dist/types/tools/read.d.ts +14 -4
  47. package/dist/types/tools/task.d.ts +4 -3
  48. package/dist/types/tools/wait.d.ts +2 -0
  49. package/dist/types/tui.d.ts +12 -0
  50. package/dist/types/utils.d.ts +4 -0
  51. package/package.json +9 -9
  52. package/src/app-keybindings.d.ts +5 -0
  53. package/src/app-keybindings.ts +5 -0
  54. package/src/apps/git/git-tui.ts +10 -17
  55. package/src/apps/git/sidebar.ts +21 -35
  56. package/src/apps/ps-top.ts +4 -12
  57. package/src/charts/chart-plan.ts +0 -29
  58. package/src/charts/table-data.d.ts +4 -2
  59. package/src/charts/table-data.ts +55 -6
  60. package/src/chat/bash-execution.d.ts +4 -1
  61. package/src/chat/bash-execution.ts +20 -9
  62. package/src/chat/chat-transcript-builder.ts +5 -2
  63. package/src/chat/eval-execution.d.ts +2 -0
  64. package/src/chat/eval-execution.ts +14 -7
  65. package/src/chat/execution-shared.d.ts +14 -8
  66. package/src/chat/execution-shared.ts +39 -18
  67. package/src/chat/figure-markdown.d.ts +2 -0
  68. package/src/chat/figure-markdown.ts +6 -4
  69. package/src/chat/read-tool-group.ts +56 -36
  70. package/src/chat/svg-figure.d.ts +5 -0
  71. package/src/chat/svg-figure.ts +55 -16
  72. package/src/chat/table-chart.d.ts +2 -0
  73. package/src/chat/table-chart.ts +19 -2
  74. package/src/chat/transcript-render-helpers.d.ts +11 -3
  75. package/src/chat/transcript-render-helpers.ts +70 -22
  76. package/src/chrome/dynamic-border.d.ts +6 -0
  77. package/src/chrome/dynamic-border.ts +28 -2
  78. package/src/chrome/transcript-status.d.ts +2 -2
  79. package/src/chrome/transcript-status.ts +5 -3
  80. package/src/components/editor.d.ts +15 -6
  81. package/src/components/editor.ts +123 -24
  82. package/src/components/image.d.ts +6 -0
  83. package/src/components/image.ts +13 -0
  84. package/src/components/key-value-list.ts +9 -9
  85. package/src/components/loader.d.ts +2 -0
  86. package/src/components/loader.ts +7 -0
  87. package/src/components/section.ts +1 -9
  88. package/src/components/table.ts +1 -9
  89. package/src/keybinding-matchers.d.ts +7 -0
  90. package/src/keybinding-matchers.ts +13 -0
  91. package/src/native/backend.ts +7 -3
  92. package/src/native/describe.d.ts +4 -2
  93. package/src/native/describe.ts +9 -4
  94. package/src/native/node.d.ts +2 -3
  95. package/src/native/node.ts +2 -3
  96. package/src/native/overlay.d.ts +42 -2
  97. package/src/native/overlay.ts +124 -16
  98. package/src/native/state.d.ts +4 -0
  99. package/src/native/state.ts +25 -5
  100. package/src/overlays/btw-history-panel.ts +106 -14
  101. package/src/overlays/btw-history.ts +65 -0
  102. package/src/overlays/btw-inject.ts +91 -0
  103. package/src/overlays/btw-panel.ts +53 -12
  104. package/src/overlays/extensions/extension-dashboard.ts +7 -8
  105. package/src/overlays/hook-editor.ts +6 -0
  106. package/src/overlays/jobs-panel.ts +82 -22
  107. package/src/overlays/login-dialog.ts +8 -26
  108. package/src/overlays/model-browser.ts +69 -10
  109. package/src/overlays/session-selector.ts +25 -5
  110. package/src/overlays/settings-defs.ts +2 -2
  111. package/src/overlays/tree-selector.ts +83 -27
  112. package/src/overlays/usage-dashboard.ts +4 -6
  113. package/src/prompt/composer.ts +17 -5
  114. package/src/render/code-cell.ts +1 -1
  115. package/src/render/file-list.ts +4 -7
  116. package/src/render/render-utils.d.ts +23 -1
  117. package/src/render/render-utils.ts +38 -6
  118. package/src/setup/scenes/glyph.ts +1 -1
  119. package/src/status-line/startup.ts +36 -70
  120. package/src/terminal-capabilities.d.ts +1 -1
  121. package/src/terminal-capabilities.ts +5 -0
  122. package/src/theme/symbols.d.ts +3 -1
  123. package/src/theme/symbols.ts +16 -9
  124. package/src/theme/theme-class.d.ts +1 -0
  125. package/src/theme/theme-class.ts +15 -3
  126. package/src/theme/theme.d.ts +1 -1
  127. package/src/theme/theme.ts +1 -0
  128. package/src/theme/tui-adapters.d.ts +2 -0
  129. package/src/theme/tui-adapters.ts +8 -3
  130. package/src/thinking.d.ts +8 -6
  131. package/src/thinking.ts +17 -11
  132. package/src/tmux.ts +1 -0
  133. package/src/tools/agent-tree.ts +13 -11
  134. package/src/tools/ask.ts +24 -37
  135. package/src/tools/ast-edit.ts +48 -93
  136. package/src/tools/ast-grep.d.ts +2 -0
  137. package/src/tools/ast-grep.ts +31 -67
  138. package/src/tools/bash.ts +7 -0
  139. package/src/tools/default-renderer.ts +1 -1
  140. package/src/tools/edit.ts +50 -43
  141. package/src/tools/eval.d.ts +2 -0
  142. package/src/tools/eval.ts +2 -0
  143. package/src/tools/fetch.ts +2 -1
  144. package/src/tools/find.d.ts +1 -1
  145. package/src/tools/find.ts +13 -5
  146. package/src/tools/github.ts +14 -46
  147. package/src/tools/glob.ts +2 -1
  148. package/src/tools/grep.ts +47 -277
  149. package/src/tools/grouped-file-output.d.ts +100 -19
  150. package/src/tools/grouped-file-output.ts +414 -103
  151. package/src/tools/hashline-format.d.ts +5 -0
  152. package/src/tools/hashline-format.ts +5 -0
  153. package/src/tools/json-tree.ts +1 -5
  154. package/src/tools/lsp.ts +210 -32
  155. package/src/tools/native-view.d.ts +2 -0
  156. package/src/tools/native-view.ts +11 -5
  157. package/src/tools/output-meta.d.ts +27 -0
  158. package/src/tools/output-meta.ts +68 -4
  159. package/src/tools/proc-render.ts +3 -3
  160. package/src/tools/read.d.ts +14 -4
  161. package/src/tools/read.ts +20 -5
  162. package/src/tools/task.d.ts +4 -3
  163. package/src/tools/task.ts +41 -81
  164. package/src/tools/vibe.ts +4 -4
  165. package/src/tools/wait.d.ts +2 -0
  166. package/src/tools/wait.ts +8 -5
  167. package/src/tools/write.ts +17 -27
  168. package/src/tools/yield.ts +1 -1
  169. package/src/tui.d.ts +12 -0
  170. package/src/tui.ts +91 -9
  171. package/src/utils.d.ts +4 -0
  172. package/src/utils.ts +10 -0
@@ -138,10 +138,10 @@ function jobRow(job: JobSnapshot, theme: Theme): string {
138
138
  ? "error"
139
139
  : job.status === "running"
140
140
  ? "running"
141
- : "done",
141
+ : "success",
142
142
  theme,
143
143
  );
144
- return `${icon} ${formatBadge(job.type, job.status === "failed" ? "error" : job.status === "cancelled" ? "warning" : "accent", theme)} ${theme.fg("toolOutput", safe(job.id))} ${theme.fg("dim", safe(job.label))} ${theme.fg("dim", formatDuration(job.durationMs))}`;
144
+ return `${icon} ${formatBadge(job.type, job.status === "failed" ? "error" : job.status === "cancelled" ? "warning" : "accent", theme)} ${theme.fg("toolOutput", safe(job.id))} ${theme.fg("dim", safe(job.intent || job.label))} ${theme.fg("dim", formatDuration(job.durationMs))}`;
145
145
  }
146
146
 
147
147
  /** Render live and completed process writes with the URL-selected operation. */
@@ -303,7 +303,7 @@ function jobItem(job: JobSnapshot, badge?: { text: string; tone: TspTone }): Nat
303
303
  "item",
304
304
  {
305
305
  label: [span(job.type, "accent"), span(" "), span(safe(job.id), "toolOutput")],
306
- detail: [span(safe(job.label), "muted")],
306
+ detail: [span(safe(job.intent || job.label), "muted")],
307
307
  value: badge ? [span(badge.text, badge.tone)] : [span(formatDuration(job.durationMs), "muted")],
308
308
  tone: badge?.tone ?? jobTone(job.status),
309
309
  },
@@ -111,6 +111,16 @@ export declare function splitInternalUrlSel(rawPath: string, specOf?: (scheme: s
111
111
  path: string;
112
112
  sel?: string;
113
113
  };
114
+ /**
115
+ * Split a filesystem read target from its query (`data.json?q=.items` →
116
+ * `data.json`, `?q=.items`), the display twin of the read tool's JSON, SQLite
117
+ * and image-question parsers. URLs own their query string and stay whole, as
118
+ * does a `?` inside a file name.
119
+ */
120
+ export declare function splitReadQuery(readPath: string): {
121
+ path: string;
122
+ query?: string;
123
+ };
114
124
  /** Recognize HTTP URLs and www-prefixed external read targets. */
115
125
  export declare function isReadableUrlPath(value: string): boolean;
116
126
  /** Return the first selected line when every range has valid one-based bounds. */
@@ -139,11 +149,11 @@ export declare function readSourceFsPath(details: unknown): string | undefined;
139
149
  */
140
150
  export declare function readResultIsMarkdown(details: ReadToolDetails | undefined, args: ReadRenderArgs | undefined): boolean;
141
151
  /**
142
- * Read content as numbered, wrapped `code` (no path header: the head names
143
- * the file), matching the ANSI preview's hanging wrap. Numbers come from
152
+ * Read content as one numbered, wrapped `code` block (no path header: the head
153
+ * names the file), matching the ANSI preview's hanging wrap. Numbers come from
144
154
  * `lineNumbers` (`displayContent`'s per-line numbers, `null` for an elided
145
- * block; runs split with `…` between) when they cover every line, else count
146
- * up from `start`.
155
+ * block, which Tern shows as a `…` gap row where the numbers jump) when they
156
+ * cover every line, else count up from `start`.
147
157
  */
148
158
  export declare function readContentCode(content: string, start: number, numbers: readonly (number | null)[] | undefined, path: string | undefined): NativeNode[];
149
159
  /** Render file, image, and URL reads in the transcript. */
package/src/tools/read.ts CHANGED
@@ -242,6 +242,20 @@ export function splitInternalUrlSel(
242
242
  return { path, sel: chunks.join(":") };
243
243
  }
244
244
 
245
+ /** A read query after a filesystem path: `?key=` (`?q=…`, `?limit=…&where=…`), not a `\\?\` long-path prefix. */
246
+ const READ_QUERY_RE = /(?<!^\\\\)\?\w+=/;
247
+
248
+ /**
249
+ * Split a filesystem read target from its query (`data.json?q=.items` →
250
+ * `data.json`, `?q=.items`), the display twin of the read tool's JSON, SQLite
251
+ * and image-question parsers. URLs own their query string and stay whole, as
252
+ * does a `?` inside a file name.
253
+ */
254
+ export function splitReadQuery(readPath: string): { path: string; query?: string } {
255
+ const at = splitUrlScheme(readPath) ? -1 : readPath.search(READ_QUERY_RE);
256
+ return at > 0 ? { path: readPath.slice(0, at), query: readPath.slice(at) } : { path: readPath };
257
+ }
258
+
245
259
  /** Recognize HTTP URLs and www-prefixed external read targets. */
246
260
  export function isReadableUrlPath(value: string): boolean {
247
261
  return /^https?:\/\/?/i.test(value) || /^www\./i.test(value);
@@ -466,11 +480,11 @@ function readRangeStart(rawPath: string, args: ReadRenderArgs | undefined): numb
466
480
  }
467
481
 
468
482
  /**
469
- * Read content as numbered, wrapped `code` (no path header: the head names
470
- * the file), matching the ANSI preview's hanging wrap. Numbers come from
483
+ * Read content as one numbered, wrapped `code` block (no path header: the head
484
+ * names the file), matching the ANSI preview's hanging wrap. Numbers come from
471
485
  * `lineNumbers` (`displayContent`'s per-line numbers, `null` for an elided
472
- * block; runs split with `…` between) when they cover every line, else count
473
- * up from `start`.
486
+ * block, which Tern shows as a `…` gap row where the numbers jump) when they
487
+ * cover every line, else count up from `start`.
474
488
  */
475
489
  export function readContentCode(
476
490
  content: string,
@@ -479,10 +493,11 @@ export function readContentCode(
479
493
  path: string | undefined,
480
494
  ): NativeNode[] {
481
495
  const lines = content.split("\n");
482
- return numberedCode(
496
+ const block = numberedCode(
483
497
  lines.map((text, i) => ({ n: numbers && numbers.length === lines.length ? numbers[i]! : start + i, text })),
484
498
  { path, wrap: true },
485
499
  );
500
+ return block ? [block] : [];
486
501
  }
487
502
 
488
503
  /** An image content block as the read tool emits it (base64 data + mime type). */
@@ -1,9 +1,10 @@
1
1
  import type { Usage } from "@linxiraos/pi-ai";
2
2
  import type { ThemeColor } from "../theme/theme";
3
3
  import type { ConfiguredThinkingLevel } from "../render/render-utils";
4
- import type { RenderResultOptions, NativeToolView, ToolRenderResult } from "./renderer";
5
4
  import { type Component } from "../tui";
5
+ import type { RenderResultOptions } from "./renderer";
6
6
  import { type Theme } from "../theme/theme";
7
+ import type { NativeToolView, ToolRenderResult } from "./renderer";
7
8
  /** Render context threaded in from `ToolExecutionComponent.#buildRenderContext`. */
8
9
  interface TaskRenderContext {
9
10
  hasResult?: boolean;
@@ -103,7 +104,7 @@ export interface TaskItem {
103
104
  agent?: string;
104
105
  /** Historical source session selected by the bundled consult agent. */
105
106
  sourceSession?: string;
106
- /** Optional model selector override for the historical source session. */
107
+ /** Bundled seance: override for the source session's saved model. Any other agent: one exact per-call model, gated by `task.perCallModel`. */
107
108
  model?: string | string[];
108
109
  /** Inline instructions; exactly one of task or taskFile is required. */
109
110
  task?: string;
@@ -134,7 +135,7 @@ export interface TaskParams {
134
135
  agent?: string;
135
136
  /** Historical source session selected by the bundled consult agent. */
136
137
  sourceSession?: string;
137
- /** Optional model selector override for the historical source session. */
138
+ /** See {@link TaskItem.model}. */
138
139
  model?: string | string[];
139
140
  /** The work (flat form). */
140
141
  task?: string;
package/src/tools/task.ts CHANGED
@@ -1,8 +1,8 @@
1
+ import { type } from "@linxiraos/pi-omptype";
1
2
  import type { Usage } from "@linxiraos/pi-ai";
2
- import { isRecord, sanitizeText } from "@linxiraos/pi-utils";
3
3
  import type { ThemeColor } from "../theme/theme";
4
4
  import type { ConfiguredThinkingLevel } from "../render/render-utils";
5
- import type { ToolRenderer, RenderResultOptions, NativeToolView, ToolRenderResult } from "./renderer";
5
+ import type { ToolRenderer } from "./renderer";
6
6
  /**
7
7
  * TUI rendering for task tool.
8
8
  *
@@ -14,6 +14,8 @@ import { Container, type Component } from "../tui";
14
14
  import { Markdown } from "../components/markdown";
15
15
  import { Text } from "../components/text";
16
16
  import { visibleWidth, wrapTextWithAnsi } from "../utils";
17
+ import { sanitizeText } from "@linxiraos/pi-utils";
18
+ import type { RenderResultOptions } from "./renderer";
17
19
  import { formatAgentStatRun, renderAgentTreeRow } from "./agent-tree";
18
20
  import { getMarkdownTheme, type Theme } from "../theme/theme";
19
21
  import { stripGeneratedOutputNotice, stripRawOutputArtifactNotice, stripTrailingNotice } from "./output-meta";
@@ -26,6 +28,7 @@ import {
26
28
  formatFeedModelBadge,
27
29
  formatMoreItems,
28
30
  formatNumber,
31
+ formatStatusIcon,
29
32
  isFeedModelBadgeEnabled,
30
33
  pluralize,
31
34
  previewLine,
@@ -42,7 +45,7 @@ import {
42
45
  } from "../render/render-utils";
43
46
  import { renderStatusLine } from "../render/index";
44
47
  import { framedToolCard } from "../render/tool-card";
45
- import { formatOutputInline, renderJsonTreeLines, describeJsonTree } from "./json-tree";
48
+ import { formatOutputInline, renderJsonTreeLines } from "./json-tree";
46
49
  import { repairDoubleEncodedJsonString } from "./task-repair-args";
47
50
  import { getSubprocessToolRenderer } from "./subprocess";
48
51
  import { assembleYieldResult, type YieldSectionShapes } from "./task-yield-assembly";
@@ -54,6 +57,7 @@ import { plainText } from "../native/spans";
54
57
  import { errorText, noteText, resultText } from "./native-view";
55
58
  import { describeJsonValue } from "./json-tree";
56
59
  import { taskSummary } from "../overlays/agent-hub-renderer";
60
+ import type { NativeToolView, ToolRenderResult } from "./renderer";
57
61
 
58
62
  /** Render context threaded in from `ToolExecutionComponent.#buildRenderContext`. */
59
63
  interface TaskRenderContext {
@@ -348,7 +352,7 @@ function renderOutputSection(
348
352
  if (warning) {
349
353
  lines.push(`${continuePrefix}${theme.fg("dim", "Output")}`);
350
354
  lines.push(
351
- `${continuePrefix} ${theme.fg("warning", theme.status.warning)} ${theme.fg(
355
+ `${continuePrefix} ${formatStatusIcon("warning", theme)} ${theme.fg(
352
356
  "dim",
353
357
  clipCollapsed(sanitizeText(warning), 80, expanded),
354
358
  )}`,
@@ -955,9 +959,7 @@ function renderReviewResult(
955
959
  // Verdict line
956
960
  const verdictColor = summary.overall_correctness === "correct" ? "success" : "error";
957
961
  const isCorrect = summary.overall_correctness === "correct";
958
- const verdictIcon = isCorrect
959
- ? theme.styledSymbol("status.done", "accent")
960
- : theme.fg(verdictColor, theme.status.error);
962
+ const verdictIcon = formatStatusIcon(isCorrect ? "success" : "error", theme);
961
963
  lines.push(
962
964
  `${continuePrefix} Patch is ${theme.fg(verdictColor, summary.overall_correctness)} ${verdictIcon} ${theme.fg(
963
965
  "dim",
@@ -1056,13 +1058,15 @@ function renderAgentResult(
1056
1058
  const mergeFailed = !aborted && result.exitCode === 0 && !!result.error;
1057
1059
  const success = !aborted && result.exitCode === 0 && !result.error;
1058
1060
  const needsWarning = Boolean(missingCompleteWarning) && success;
1059
- const icon = aborted
1060
- ? theme.status.aborted
1061
- : needsWarning
1062
- ? theme.status.warning
1061
+ // A merge failure is a warning: the agent's work succeeded, only folding it back did not.
1062
+ const iconStatus: ToolUIStatus = aborted
1063
+ ? "aborted"
1064
+ : needsWarning || mergeFailed
1065
+ ? "warning"
1063
1066
  : success
1064
- ? theme.styledSymbol("status.done", "text")
1065
- : theme.status.error;
1067
+ ? "success"
1068
+ : "error";
1069
+ const icon = formatStatusIcon(iconStatus, theme);
1066
1070
  const iconColor = needsWarning ? "warning" : success ? "success" : mergeFailed ? "warning" : "error";
1067
1071
  const statusText = aborted
1068
1072
  ? "aborted"
@@ -1106,7 +1110,7 @@ function renderAgentResult(
1106
1110
  ? fullDescription
1107
1111
  : undefined;
1108
1112
  const titlePart = description ? `${theme.bold(displayId)}: ${description}` : displayId;
1109
- let statusLine = `${indent}${theme.fg(iconColor, icon)} ${modelLead}${theme.fg(
1113
+ let statusLine = `${indent}${icon} ${modelLead}${theme.fg(
1110
1114
  success && !needsWarning ? "text" : "accent",
1111
1115
  titlePart,
1112
1116
  )}${badges}`;
@@ -1135,7 +1139,7 @@ function renderAgentResult(
1135
1139
 
1136
1140
  if (aborted && result.abortReason) {
1137
1141
  lines.push(
1138
- `${continuePrefix}${theme.fg("error", theme.status.aborted)} ${theme.fg(
1142
+ `${continuePrefix}${formatStatusIcon("aborted", theme)} ${theme.fg(
1139
1143
  "dim",
1140
1144
  clipCollapsed(flattenLine(sanitizeText(result.abortReason)), 80, expanded),
1141
1145
  )}`,
@@ -1227,7 +1231,7 @@ function renderAgentResult(
1227
1231
 
1228
1232
  if (hasCustomRendering && missingCompleteWarning) {
1229
1233
  lines.push(
1230
- `${continuePrefix}${theme.fg("warning", theme.status.warning)} ${theme.fg(
1234
+ `${continuePrefix}${formatStatusIcon("warning", theme)} ${theme.fg(
1231
1235
  "dim",
1232
1236
  clipCollapsed(sanitizeText(missingCompleteWarning), 80, expanded),
1233
1237
  )}`,
@@ -1367,16 +1371,10 @@ export function renderResult(
1367
1371
  if (!details) {
1368
1372
  const text = result.content.find(c => c.type === "text")?.text || "";
1369
1373
  const errored = result.isError === true;
1370
- const header = errored
1371
- ? renderStatusLine({ icon: "error", title: "Task", description: agentLabel }, theme)
1372
- : renderStatusLine(
1373
- {
1374
- iconOverride: theme.styledSymbol("status.done", "accent"),
1375
- title: "Task",
1376
- description: agentLabel,
1377
- },
1378
- theme,
1379
- );
1374
+ const header = renderStatusLine(
1375
+ { icon: errored ? "error" : "success", title: "Task", description: agentLabel },
1376
+ theme,
1377
+ );
1380
1378
  return framedToolCard(theme, ({ width }) => ({
1381
1379
  header,
1382
1380
  sections: [
@@ -1421,16 +1419,11 @@ export function renderResult(
1421
1419
  const metaLabel = countLabel ?? agentLabel;
1422
1420
  const header = renderStatusLine(
1423
1421
  {
1424
- icon: icon === "success" || icon === "running" ? undefined : icon,
1425
1422
  // While agents are in flight the header shows the dispatch glyph, not a
1426
1423
  // spinner: async spawns return immediately, so "running" means
1427
1424
  // "delegated to peers", not "this call is blocking the turn".
1428
- iconOverride:
1429
- icon === "running"
1430
- ? theme.styledSymbol("tool.task", "accent")
1431
- : icon === "success"
1432
- ? theme.styledSymbol("status.done", "accent")
1433
- : undefined,
1425
+ icon: icon === "running" ? undefined : icon,
1426
+ iconOverride: icon === "running" ? theme.styledSymbol("tool.task", "accent") : undefined,
1434
1427
  title: "Task",
1435
1428
  meta: metaLabel ? [metaLabel] : undefined,
1436
1429
  },
@@ -2251,7 +2244,7 @@ export interface TaskItem {
2251
2244
  agent?: string;
2252
2245
  /** Historical source session selected by the bundled consult agent. */
2253
2246
  sourceSession?: string;
2254
- /** Optional model selector override for the historical source session. */
2247
+ /** Bundled seance: override for the source session's saved model. Any other agent: one exact per-call model, gated by `task.perCallModel`. */
2255
2248
  model?: string | string[];
2256
2249
  /** Inline instructions; exactly one of task or taskFile is required. */
2257
2250
  task?: string;
@@ -2283,7 +2276,7 @@ export interface TaskParams {
2283
2276
  agent?: string;
2284
2277
  /** Historical source session selected by the bundled consult agent. */
2285
2278
  sourceSession?: string;
2286
- /** Optional model selector override for the historical source session. */
2279
+ /** See {@link TaskItem.model}. */
2287
2280
  model?: string | string[];
2288
2281
  /** The work (flat form). */
2289
2282
  task?: string;
@@ -2663,55 +2656,22 @@ export interface FindingDetails {
2663
2656
  line_end: number;
2664
2657
  }
2665
2658
 
2666
- function normalizeFindingPriority(value: unknown): FindingPriority | undefined {
2667
- if (isFindingPriority(value)) return value;
2668
- if (value === 0) return "P0";
2669
- if (value === 1) return "P1";
2670
- if (value === 2) return "P2";
2671
- if (value === 3) return "P3";
2672
- return undefined;
2673
- }
2659
+ const FindingDetailsShape = type({
2660
+ "+": "delete",
2661
+ title: "string",
2662
+ body: "string",
2663
+ // Older reports wrote the severity as its ordinal.
2664
+ priority: type("'P0' | 'P1' | 'P2' | 'P3'").or(type("0 | 1 | 2 | 3").pipe(ordinal => PRIORITY_LABELS[ordinal])),
2665
+ confidence: "0 <= number <= 1",
2666
+ file_path: "string > 0",
2667
+ line_start: "number",
2668
+ line_end: "number",
2669
+ });
2674
2670
 
2675
2671
  /** Validates and normalizes a persisted review finding. */
2676
2672
  export function parseFindingDetails(value: unknown): FindingDetails | undefined {
2677
- if (!isRecord(value)) return undefined;
2678
-
2679
- const title = typeof value.title === "string" ? value.title : undefined;
2680
- const body = typeof value.body === "string" ? value.body : undefined;
2681
- const priority = normalizeFindingPriority(value.priority);
2682
- const confidence =
2683
- typeof value.confidence === "number" &&
2684
- Number.isFinite(value.confidence) &&
2685
- value.confidence >= 0 &&
2686
- value.confidence <= 1
2687
- ? value.confidence
2688
- : undefined;
2689
- const filePath = typeof value.file_path === "string" && value.file_path.length > 0 ? value.file_path : undefined;
2690
- const lineStart =
2691
- typeof value.line_start === "number" && Number.isFinite(value.line_start) ? value.line_start : undefined;
2692
- const lineEnd = typeof value.line_end === "number" && Number.isFinite(value.line_end) ? value.line_end : undefined;
2693
-
2694
- if (
2695
- title === undefined ||
2696
- body === undefined ||
2697
- priority === undefined ||
2698
- confidence === undefined ||
2699
- filePath === undefined ||
2700
- lineStart === undefined ||
2701
- lineEnd === undefined
2702
- ) {
2703
- return undefined;
2704
- }
2705
-
2706
- return {
2707
- title,
2708
- body,
2709
- priority,
2710
- confidence,
2711
- file_path: filePath,
2712
- line_start: lineStart,
2713
- line_end: lineEnd,
2714
- };
2673
+ const details = FindingDetailsShape(value);
2674
+ return details instanceof type.errors ? undefined : details;
2715
2675
  }
2716
2676
  /** SubmitReviewDetails - used for rendering review results from yield tool */
2717
2677
  export interface SubmitReviewDetails {
package/src/tools/vibe.ts CHANGED
@@ -129,7 +129,7 @@ function stateToIcon(state: VibeSessionState): ToolUIStatus {
129
129
  case "starting":
130
130
  return "pending";
131
131
  case "idle":
132
- return "done";
132
+ return "success";
133
133
  case "dead":
134
134
  return "aborted";
135
135
  }
@@ -534,7 +534,7 @@ export function createVibeToolRenderer(op: VibeOp) {
534
534
  if (!details || result.isError) {
535
535
  const fallback = result.content.find(part => part.type === "text")?.text ?? "";
536
536
  const header = renderStatusLine(
537
- { icon: result.isError ? "error" : "done", title: `vibe ${describeCall(op, args)}` },
537
+ { icon: result.isError ? "error" : "success", title: `vibe ${describeCall(op, args)}` },
538
538
  uiTheme,
539
539
  );
540
540
  const body = fallback
@@ -573,7 +573,7 @@ export function createVibeToolRenderer(op: VibeOp) {
573
573
  const killedNote = details.killed?.cancelledTurn ? " (in-flight turn cancelled)" : "";
574
574
  const header = renderStatusLine(
575
575
  {
576
- icon: "done",
576
+ icon: "success",
577
577
  title: `vibe kill ${frameText(details.killed?.id ?? args?.session ?? "?", 40)}${killedNote}`,
578
578
  },
579
579
  uiTheme,
@@ -621,7 +621,7 @@ export function createVibeToolRenderer(op: VibeOp) {
621
621
  : `vibe sessions (${screens.length})`;
622
622
  const header = renderStatusLine(
623
623
  {
624
- icon: details.wait?.timedOut ? "warning" : running > 0 ? "info" : "done",
624
+ icon: details.wait?.timedOut ? "warning" : running > 0 ? "info" : "success",
625
625
  spinnerFrame: running > 0 ? wallOptions.spinnerFrame : undefined,
626
626
  title,
627
627
  meta,
@@ -17,6 +17,8 @@ export interface JobSnapshot {
17
17
  type: "bash" | "task" | "eval";
18
18
  status: "running" | "completed" | "failed" | "cancelled";
19
19
  label: string;
20
+ /** What the job is for, in the model's words (a process job's `label` is its command line). */
21
+ intent?: string;
20
22
  durationMs: number;
21
23
  /** Process exit status when the job reports one. */
22
24
  exitCode?: number;
package/src/tools/wait.ts CHANGED
@@ -51,6 +51,8 @@ export interface JobSnapshot {
51
51
  type: "bash" | "task" | "eval";
52
52
  status: "running" | "completed" | "failed" | "cancelled";
53
53
  label: string;
54
+ /** What the job is for, in the model's words (a process job's `label` is its command line). */
55
+ intent?: string;
54
56
  durationMs: number;
55
57
  /** Process exit status when the job reports one. */
56
58
  exitCode?: number;
@@ -172,7 +174,7 @@ const PREVIEW_LINE_WIDTH = 80;
172
174
  function statusToIcon(status: JobSnapshot["status"]): ToolUIStatus {
173
175
  switch (status) {
174
176
  case "completed":
175
- return "done";
177
+ return "success";
176
178
  case "failed":
177
179
  return "error";
178
180
  case "cancelled":
@@ -219,9 +221,10 @@ function flattenStructuredPreview(text: string): string {
219
221
  return text.slice(0, PREVIEW_LINES_EXPANDED * PREVIEW_LINE_WIDTH * 2).replace(/\s+/g, " ");
220
222
  }
221
223
 
222
- /** The row label: a running task's own stage line when it reports one, else the job's label. */
224
+ /** The row label: a running task's own stage line when it reports one, else what the job is for, else its label. */
223
225
  function jobRowLabel(job: JobSnapshot): string {
224
- return job.type === "task" && job.status === "running" && job.stage?.trim() ? job.stage : job.label;
226
+ if (job.type === "task" && job.status === "running" && job.stage?.trim()) return job.stage;
227
+ return job.intent || job.label;
225
228
  }
226
229
 
227
230
  /** A job as its tile; `live` while the card's clocks run. */
@@ -230,7 +233,7 @@ function jobTile(job: JobSnapshot, live: boolean): JobTile {
230
233
  id: job.id,
231
234
  type: job.type,
232
235
  status: job.status,
233
- label: job.label,
236
+ label: job.intent || job.label,
234
237
  durationMs: job.durationMs,
235
238
  live: live && job.status === "running",
236
239
  ...(job.widget ? { widget: job.widget } : {}),
@@ -380,7 +383,7 @@ function jobsRenderResult(
380
383
  const widgetJobs = sortedJobs.filter(job => job.status === "running" && job.widget?.state === "live");
381
384
  const compactJobLines = (width: number, live: boolean): string[] => {
382
385
  const lines: string[] = [];
383
- const indent = " ".repeat(visibleWidth(formatStatusIcon("done", uiTheme)) + 1);
386
+ const indent = " ".repeat(visibleWidth(formatStatusIcon("success", uiTheme)) + 1);
384
387
  // Failures sort first, so the cap never hides one behind successes;
385
388
  // Ctrl+O lists the rest.
386
389
  for (const job of settledJobs.slice(0, PREVIEW_LIMITS.COLLAPSED_ITEMS)) {
@@ -17,7 +17,6 @@ import {
17
17
  formatErrorDetail,
18
18
  formatExpandHint,
19
19
  formatMoreItems,
20
- formatStatusIcon,
21
20
  PREVIEW_LIMITS,
22
21
  type RenderedStringCache,
23
22
  replaceTabs,
@@ -342,13 +341,12 @@ function formatStreamingContent(
342
341
  expanded: boolean,
343
342
  language: string | undefined,
344
343
  uiTheme: Theme,
345
- spinnerFrame?: number,
346
344
  cache?: RenderedStringCache,
347
345
  streamKey?: WriteStreamingPreviewStateCarrier,
348
346
  argsComplete?: boolean,
349
347
  ): string {
350
348
  if (!content) return "";
351
- const bodyText = cachedRenderedString(cache, uiTheme, expanded, language ?? "", content, () => {
349
+ return cachedRenderedString(cache, uiTheme, expanded, language ?? "", content, () => {
352
350
  const state = updateStreamingPreview(streamKey, content, language, uiTheme, argsComplete === true);
353
351
  let totalLines: number;
354
352
  let startIndex: number;
@@ -371,25 +369,17 @@ function formatStreamingContent(
371
369
  const hidden = startIndex;
372
370
  const lineNumberWidth = Math.max(WRITE_GUTTER_MIN_WIDTH, String(totalLines).length);
373
371
 
374
- let text = "\n\n";
372
+ const rows: string[] = [];
375
373
  if (hidden > 0) {
376
- text += `${uiTheme.fg("dim", `… (${hidden} earlier line${hidden === 1 ? "" : "s"})`)}\n`;
374
+ rows.push(uiTheme.fg("dim", `… (${hidden} earlier line${hidden === 1 ? "" : "s"})`));
377
375
  }
378
376
  for (let i = 0; i < visibleLines.length; i++) {
379
377
  const lineNum = startIndex + i + 1;
380
378
  const gutter = uiTheme.fg("dim", `${String(lineNum).padStart(lineNumberWidth, " ")} `);
381
- const body = replaceTabs(visibleLines[i] ?? "");
382
- text += `${gutter}${body}\n`;
379
+ rows.push(`${gutter}${replaceTabs(visibleLines[i] ?? "")}`);
383
380
  }
384
- return text;
381
+ return `\n\n${rows.join("\n")}`;
385
382
  });
386
- if (bodyText.length === 0) return "";
387
- // The animated glyph lives on this trailing line — inside the transcript's
388
- // volatile-tail holdback — never in the header: an animating head row pins
389
- // the native-scrollback commit boundary at the top of the block, so a long
390
- // expanded preview could never scroll-append mid-stream.
391
- const spinner = spinnerFrame !== undefined ? `${formatStatusIcon("running", uiTheme, spinnerFrame)} ` : "";
392
- return `${bodyText}${spinner}${uiTheme.fg("dim", `… (streaming)`)}`;
393
383
  }
394
384
 
395
385
  function wrapWritePreviewRows(lines: string[], width: number): string[] {
@@ -643,17 +633,6 @@ export const writeToolRenderer = {
643
633
  // rather than an archive member or database row selector.
644
634
  const pathDisplay =
645
635
  filePath && args.content !== undefined ? fileHyperlink(pendingFileLinkPath(rawPath), styledPath) : styledPath;
646
- // No status icon on the head row: it's the head of the framed block, and
647
- // native-scrollback commits are prefix-only — an animated glyph would pin
648
- // the commit boundary at the top, and the pending hourglass just adds
649
- // noise. The liveness cue rides the trailing "(streaming)" line instead.
650
- const header = renderStatusLine(
651
- {
652
- title: "Write",
653
- description: `${langIcon} ${pathDisplay}`,
654
- },
655
- uiTheme,
656
- );
657
636
  // Raw content, not normalizeDisplayText(args.content): the collapsed
658
637
  // streaming path normalizes only its tail window, so a full-payload
659
638
  // normalize on every reveal tick would re-introduce the O(n²) streaming
@@ -664,13 +643,22 @@ export const writeToolRenderer = {
664
643
  return framedToolCard(
665
644
  uiTheme,
666
645
  ({ contentWidth }) => {
646
+ // Only a live spinner fills the icon slot, as in Edit's call card.
647
+ const header = renderStatusLine(
648
+ {
649
+ icon: options?.spinnerFrame === undefined ? undefined : "running",
650
+ spinnerFrame: options?.spinnerFrame,
651
+ title: "Write",
652
+ description: `${langIcon} ${pathDisplay}`,
653
+ },
654
+ uiTheme,
655
+ );
667
656
  const body = content
668
657
  ? formatStreamingContent(
669
658
  content,
670
659
  Boolean(options?.expanded),
671
660
  lang,
672
661
  uiTheme,
673
- options?.spinnerFrame,
674
662
  streamingCache,
675
663
  // `options` is the ToolExecutionComponent's persistent
676
664
  // render-state object — a stable identity across reveal ticks
@@ -684,6 +672,8 @@ export const writeToolRenderer = {
684
672
  while (bodyLines.length > 0 && bodyLines[0].trim() === "") bodyLines.shift();
685
673
  return {
686
674
  header,
675
+ // The label ends with the args: once the content is complete the write is just running.
676
+ footerMeta: body && !options?.argsComplete ? uiTheme.fg("dim", "streaming") : undefined,
687
677
  sections: bodyLines.length > 0 ? [{ content: wrapWritePreviewRows(bodyLines, contentWidth) }] : [],
688
678
  phase: "pending",
689
679
  borderColor: "borderMuted",
@@ -166,7 +166,7 @@ function renderSubmission(s: Submission, options: RenderResultOptions, theme: Th
166
166
  const failed = s.settled && s.error !== undefined;
167
167
  const size = sizeMeta(s.data);
168
168
  const status: StatusLineOptions = {
169
- icon: !s.settled ? (running ? "running" : "pending") : failed ? "error" : "done",
169
+ icon: !s.settled ? (running ? "running" : "pending") : failed ? "error" : "success",
170
170
  spinnerFrame: options.spinnerFrame,
171
171
  title: TITLE,
172
172
  description: s.target,
package/src/tui.d.ts CHANGED
@@ -194,6 +194,18 @@ export interface Component {
194
194
  */
195
195
  dispose?(): void;
196
196
  }
197
+ /**
198
+ * A gutter component that can hand an external native renderer a semantic
199
+ * snapshot of the column it draws (see {@link TUI.setGutterComponent}). Such a
200
+ * component keeps rendering its ANSI rows — the snapshot only travels
201
+ * out-of-band — and a GUI that receives it draws the same content natively.
202
+ * Deliberately separate from {@link Component}: only a sidebar-shaped
203
+ * component describes itself for a whole external surface.
204
+ */
205
+ export interface NativeSnapshotSource {
206
+ /** JSON-serializable TSP node for an external native sidebar renderer. */
207
+ describeSnapshot(): NativeNode | null;
208
+ }
197
209
  /** Lets an overlay root delegate keyboard focus to components it owns. */
198
210
  export interface OverlayFocusOwner {
199
211
  /** Returns true when `component` is a focus target inside this overlay. */