@linxiraos/pi-tui 1.2.1 → 1.3.1

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 (280) hide show
  1. package/CHANGELOG.md +245 -224
  2. package/README.md +36 -0
  3. package/THIRD-PARTY-NOTICES.txt +55 -5
  4. package/dist/types/app-keybindings.d.ts +18 -8
  5. package/dist/types/apps/git/diff-pane.d.ts +5 -0
  6. package/dist/types/apps/git/git-tui.d.ts +16 -2
  7. package/dist/types/apps/git/state.d.ts +11 -0
  8. package/dist/types/autocomplete.d.ts +2 -0
  9. package/dist/types/charts/chart-svg.d.ts +7 -13
  10. package/dist/types/chat/advisor-message.d.ts +4 -1
  11. package/dist/types/chat/assistant-message.d.ts +9 -4
  12. package/dist/types/chat/figure-markdown.d.ts +7 -2
  13. package/dist/types/chat/messages.d.ts +3 -1
  14. package/dist/types/chat/read-tool-group.d.ts +2 -2
  15. package/dist/types/chat/table-chart.d.ts +11 -15
  16. package/dist/types/chat/tool-execution.d.ts +32 -20
  17. package/dist/types/chat/user-message.d.ts +3 -2
  18. package/dist/types/chrome/countdown-timer.d.ts +3 -2
  19. package/dist/types/chrome/diff.d.ts +2 -3
  20. package/dist/types/chrome/status-notice.d.ts +2 -0
  21. package/dist/types/chrome/transcript-container.d.ts +2 -0
  22. package/dist/types/components/image.d.ts +2 -0
  23. package/dist/types/components/markdown.d.ts +49 -3
  24. package/dist/types/components/text.d.ts +2 -0
  25. package/dist/types/debug-server.d.ts +2 -0
  26. package/dist/types/keybinding-matchers.d.ts +6 -0
  27. package/dist/types/multiplexers/tmux.d.ts +1 -0
  28. package/dist/types/multiplexers/types.d.ts +6 -0
  29. package/dist/types/native/backend.d.ts +5 -4
  30. package/dist/types/native/blobs.d.ts +24 -12
  31. package/dist/types/overlays/agent-hub-projection.d.ts +10 -5
  32. package/dist/types/overlays/annotation-overlay.d.ts +19 -0
  33. package/dist/types/overlays/approval-dialog.d.ts +79 -0
  34. package/dist/types/overlays/ask-dialog.d.ts +11 -6
  35. package/dist/types/overlays/btw-history-panel.d.ts +2 -6
  36. package/dist/types/overlays/hook-editor.d.ts +7 -2
  37. package/dist/types/overlays/hook-input.d.ts +12 -4
  38. package/dist/types/overlays/job-tree.d.ts +50 -0
  39. package/dist/types/overlays/jobs-panel.d.ts +25 -11
  40. package/dist/types/overlays/login-dialog.d.ts +8 -3
  41. package/dist/types/overlays/mcp-add-wizard.d.ts +9 -1
  42. package/dist/types/overlays/model-browser.d.ts +6 -1
  43. package/dist/types/overlays/model-picker.d.ts +2 -0
  44. package/dist/types/overlays/pause-screen.d.ts +5 -0
  45. package/dist/types/overlays/plan-review-overlay.d.ts +4 -0
  46. package/dist/types/overlays/report-panel.d.ts +5 -1
  47. package/dist/types/overlays/reset-usage-selector.d.ts +7 -5
  48. package/dist/types/overlays/session-account-selector.d.ts +4 -0
  49. package/dist/types/overlays/session-info-overlay.d.ts +7 -3
  50. package/dist/types/overlays/session-selector.d.ts +3 -1
  51. package/dist/types/overlays/usage-dashboard.d.ts +6 -6
  52. package/dist/types/prompt/composer.d.ts +23 -20
  53. package/dist/types/prompt/custom-editor.d.ts +20 -10
  54. package/dist/types/prompt/image-references.d.ts +22 -0
  55. package/dist/types/prompt/internal-url-autocomplete.d.ts +1 -0
  56. package/dist/types/prompt/macos-spelling.d.ts +2 -1
  57. package/dist/types/prompt/prose-gate.d.ts +3 -0
  58. package/dist/types/prompt/queued-messages.d.ts +1 -1
  59. package/dist/types/prompt/typing-word.d.ts +25 -0
  60. package/dist/types/prompt/welcome.d.ts +26 -6
  61. package/dist/types/render/hanging-wrap.d.ts +7 -0
  62. package/dist/types/render/hyperlink.d.ts +2 -0
  63. package/dist/types/render/render-utils.d.ts +9 -1
  64. package/dist/types/render/utils.d.ts +1 -1
  65. package/dist/types/setup/scenes/splash.d.ts +6 -5
  66. package/dist/types/status-line/context-usage.d.ts +4 -1
  67. package/dist/types/status-line/host.d.ts +6 -4
  68. package/dist/types/status-line/startup.d.ts +6 -6
  69. package/dist/types/status-line/types.d.ts +3 -0
  70. package/dist/types/stdin-buffer.d.ts +7 -0
  71. package/dist/types/terminal-capabilities.d.ts +16 -1
  72. package/dist/types/terminal-multiplexer.d.ts +7 -0
  73. package/dist/types/terminal.d.ts +8 -4
  74. package/dist/types/theme/symbols.d.ts +1 -1
  75. package/dist/types/theme/theme.d.ts +11 -0
  76. package/dist/types/thinking.d.ts +5 -0
  77. package/dist/types/tmux.d.ts +39 -4
  78. package/dist/types/tools/ast-edit.d.ts +2 -2
  79. package/dist/types/tools/ast-grep.d.ts +2 -2
  80. package/dist/types/tools/bash.d.ts +6 -1
  81. package/dist/types/tools/edit.d.ts +2 -0
  82. package/dist/types/tools/eval.d.ts +53 -4
  83. package/dist/types/tools/find.d.ts +14 -4
  84. package/dist/types/tools/glob.d.ts +3 -3
  85. package/dist/types/tools/grep.d.ts +2 -2
  86. package/dist/types/tools/grouped-file-output.d.ts +9 -4
  87. package/dist/types/tools/native-view.d.ts +1 -1
  88. package/dist/types/tools/read.d.ts +32 -10
  89. package/dist/types/tools/renderer.d.ts +2 -0
  90. package/dist/types/tools/task.d.ts +31 -0
  91. package/dist/types/tools/web-search-types.d.ts +1 -0
  92. package/dist/types/tools/write.d.ts +2 -0
  93. package/dist/types/tui.d.ts +20 -3
  94. package/package.json +10 -10
  95. package/src/app-keybindings.d.ts +18 -8
  96. package/src/app-keybindings.ts +20 -8
  97. package/src/apps/autoresearch-dashboard.ts +444 -27
  98. package/src/apps/debug/raw-sse.ts +2 -2
  99. package/src/apps/git/diff-pane.ts +39 -41
  100. package/src/apps/git/git-tui.ts +80 -14
  101. package/src/apps/git/sidebar.ts +10 -1
  102. package/src/apps/git/state.ts +12 -0
  103. package/src/autocomplete.d.ts +2 -0
  104. package/src/autocomplete.ts +21 -19
  105. package/src/bracketed-paste.ts +9 -2
  106. package/src/charts/chart-svg.d.ts +7 -13
  107. package/src/charts/chart-svg.ts +19 -22
  108. package/src/charts/table-data.ts +17 -6
  109. package/src/chat/advisor-message.d.ts +4 -1
  110. package/src/chat/advisor-message.ts +77 -24
  111. package/src/chat/assistant-message.d.ts +9 -4
  112. package/src/chat/assistant-message.ts +127 -31
  113. package/src/chat/bash-execution.ts +7 -2
  114. package/src/chat/figure-markdown.d.ts +7 -2
  115. package/src/chat/figure-markdown.ts +10 -3
  116. package/src/chat/image-loading.ts +9 -6
  117. package/src/chat/messages.d.ts +3 -1
  118. package/src/chat/messages.ts +4 -1
  119. package/src/chat/read-tool-group.d.ts +2 -2
  120. package/src/chat/read-tool-group.ts +97 -42
  121. package/src/chat/svg-figure.ts +3 -1
  122. package/src/chat/svg-source.ts +6 -3
  123. package/src/chat/table-chart.d.ts +11 -15
  124. package/src/chat/table-chart.ts +24 -57
  125. package/src/chat/tool-execution.d.ts +32 -20
  126. package/src/chat/tool-execution.ts +103 -36
  127. package/src/chat/user-message.d.ts +3 -2
  128. package/src/chat/user-message.ts +54 -34
  129. package/src/chrome/countdown-timer.ts +3 -3
  130. package/src/chrome/diff.d.ts +2 -3
  131. package/src/chrome/diff.ts +4 -9
  132. package/src/chrome/status-notice.ts +5 -0
  133. package/src/chrome/transcript-container.d.ts +2 -0
  134. package/src/chrome/transcript-container.ts +212 -28
  135. package/src/components/editor.ts +12 -12
  136. package/src/components/image.d.ts +2 -0
  137. package/src/components/image.ts +54 -20
  138. package/src/components/markdown.d.ts +49 -3
  139. package/src/components/markdown.ts +482 -12
  140. package/src/components/settings-list.ts +2 -4
  141. package/src/components/text.d.ts +2 -0
  142. package/src/components/text.ts +11 -1
  143. package/src/debug-server.d.ts +2 -0
  144. package/src/debug-server.ts +51 -69
  145. package/src/hotkeys-markdown.ts +2 -0
  146. package/src/keybinding-matchers.d.ts +6 -0
  147. package/src/keybinding-matchers.ts +19 -0
  148. package/src/multiplexers/tmux.d.ts +1 -0
  149. package/src/multiplexers/tmux.ts +3 -0
  150. package/src/multiplexers/types.d.ts +6 -0
  151. package/src/multiplexers/types.ts +6 -0
  152. package/src/native/backend.d.ts +5 -4
  153. package/src/native/backend.ts +13 -5
  154. package/src/native/blobs.d.ts +24 -12
  155. package/src/native/blobs.ts +56 -7
  156. package/src/native/reconcile.ts +43 -21
  157. package/src/overlays/advisor-config.ts +259 -8
  158. package/src/overlays/agent-hub-projection.d.ts +10 -5
  159. package/src/overlays/agent-hub-projection.ts +63 -12
  160. package/src/overlays/annotation-overlay.ts +422 -168
  161. package/src/overlays/approval-dialog.ts +389 -0
  162. package/src/overlays/ask-dialog.ts +244 -105
  163. package/src/overlays/btw-history-panel.ts +208 -147
  164. package/src/overlays/extensions/extension-list.ts +4 -6
  165. package/src/overlays/hook-editor.ts +90 -32
  166. package/src/overlays/hook-input.ts +105 -19
  167. package/src/overlays/job-tree.ts +177 -0
  168. package/src/overlays/jobs-panel.ts +222 -142
  169. package/src/overlays/login-dialog.ts +201 -91
  170. package/src/overlays/mcp-add-wizard.ts +562 -279
  171. package/src/overlays/model-browser.ts +32 -7
  172. package/src/overlays/model-hub.ts +4 -10
  173. package/src/overlays/model-picker.ts +58 -21
  174. package/src/overlays/pause-screen.ts +81 -23
  175. package/src/overlays/plan-review-overlay.ts +16 -0
  176. package/src/overlays/plugin-selector.ts +17 -1
  177. package/src/overlays/queue-mode-selector.ts +10 -0
  178. package/src/overlays/report-panel.ts +6 -2
  179. package/src/overlays/reset-usage-selector.ts +130 -21
  180. package/src/overlays/session-account-selector.ts +36 -0
  181. package/src/overlays/session-info-overlay.ts +199 -76
  182. package/src/overlays/session-selector.ts +15 -10
  183. package/src/overlays/settings-selector.ts +3 -0
  184. package/src/overlays/show-images-selector.ts +1 -0
  185. package/src/overlays/snapcompact-shape-preview.ts +13 -6
  186. package/src/overlays/theme-selector.ts +6 -1
  187. package/src/overlays/thinking-selector.ts +8 -4
  188. package/src/overlays/tree-selector.ts +117 -2
  189. package/src/overlays/usage-dashboard.ts +498 -144
  190. package/src/prompt/composer-cache.ts +4 -1
  191. package/src/prompt/composer.ts +200 -74
  192. package/src/prompt/custom-editor.ts +168 -65
  193. package/src/prompt/image-references.d.ts +22 -0
  194. package/src/prompt/image-references.ts +79 -2
  195. package/src/prompt/internal-url-autocomplete.ts +1 -0
  196. package/src/prompt/macos-spelling.ts +28 -5
  197. package/src/prompt/prose-gate.ts +3 -0
  198. package/src/prompt/queued-messages.ts +9 -2
  199. package/src/prompt/tips.txt +1 -2
  200. package/src/prompt/typing-word.ts +59 -0
  201. package/src/prompt/welcome.ts +97 -45
  202. package/src/render/code-cell.ts +18 -5
  203. package/src/render/hanging-wrap.d.ts +7 -0
  204. package/src/render/hanging-wrap.ts +58 -0
  205. package/src/render/hyperlink.d.ts +2 -0
  206. package/src/render/hyperlink.ts +5 -0
  207. package/src/render/render-utils.d.ts +9 -1
  208. package/src/render/render-utils.ts +16 -2
  209. package/src/render/utils.d.ts +1 -1
  210. package/src/render/utils.ts +1 -1
  211. package/src/render/width-aware-text.ts +6 -5
  212. package/src/setup/scenes/splash.ts +22 -8
  213. package/src/status-line/component.ts +79 -11
  214. package/src/status-line/context-usage.ts +176 -73
  215. package/src/status-line/footer.ts +18 -35
  216. package/src/status-line/host.ts +6 -1
  217. package/src/status-line/segments.ts +16 -5
  218. package/src/status-line/startup.ts +6 -6
  219. package/src/status-line/types.ts +1 -0
  220. package/src/stdin-buffer.d.ts +7 -0
  221. package/src/stdin-buffer.ts +300 -62
  222. package/src/terminal-capabilities.d.ts +16 -1
  223. package/src/terminal-capabilities.ts +66 -28
  224. package/src/terminal-multiplexer.d.ts +7 -0
  225. package/src/terminal-multiplexer.ts +14 -0
  226. package/src/terminal.d.ts +8 -4
  227. package/src/terminal.ts +190 -63
  228. package/src/theme/symbols.d.ts +1 -1
  229. package/src/theme/symbols.ts +1 -0
  230. package/src/theme/theme-class.ts +1 -0
  231. package/src/theme/theme.d.ts +11 -0
  232. package/src/theme/theme.ts +46 -14
  233. package/src/thinking.d.ts +5 -0
  234. package/src/thinking.ts +9 -1
  235. package/src/tmux.d.ts +39 -4
  236. package/src/tmux.ts +110 -16
  237. package/src/tools/ask.ts +20 -9
  238. package/src/tools/ast-edit.d.ts +2 -2
  239. package/src/tools/ast-edit.ts +30 -7
  240. package/src/tools/ast-grep.d.ts +2 -2
  241. package/src/tools/ast-grep.ts +39 -35
  242. package/src/tools/bash.d.ts +6 -1
  243. package/src/tools/bash.ts +15 -9
  244. package/src/tools/debug.ts +2 -1
  245. package/src/tools/default-renderer.ts +3 -2
  246. package/src/tools/edit.d.ts +2 -0
  247. package/src/tools/edit.ts +100 -21
  248. package/src/tools/eval.d.ts +53 -4
  249. package/src/tools/eval.ts +173 -137
  250. package/src/tools/find.d.ts +14 -4
  251. package/src/tools/find.ts +71 -18
  252. package/src/tools/glob.d.ts +3 -3
  253. package/src/tools/glob.ts +51 -17
  254. package/src/tools/grep.d.ts +2 -2
  255. package/src/tools/grep.ts +99 -22
  256. package/src/tools/grouped-file-output.d.ts +9 -4
  257. package/src/tools/grouped-file-output.ts +21 -6
  258. package/src/tools/lsp.ts +30 -18
  259. package/src/tools/mcp.ts +2 -2
  260. package/src/tools/native-view.d.ts +1 -1
  261. package/src/tools/native-view.ts +2 -2
  262. package/src/tools/read.d.ts +32 -10
  263. package/src/tools/read.ts +89 -43
  264. package/src/tools/renderer.d.ts +2 -0
  265. package/src/tools/renderer.ts +2 -0
  266. package/src/tools/task.d.ts +31 -0
  267. package/src/tools/task.ts +40 -7
  268. package/src/tools/todo.ts +3 -2
  269. package/src/tools/wait.ts +16 -30
  270. package/src/tools/web-search-types.d.ts +1 -0
  271. package/src/tools/web-search-types.ts +1 -0
  272. package/src/tools/web-search.ts +2 -1
  273. package/src/tools/write.d.ts +2 -0
  274. package/src/tools/write.ts +36 -12
  275. package/src/tools/yield.ts +2 -2
  276. package/src/tui.d.ts +20 -3
  277. package/src/tui.ts +160 -43
  278. package/src/utils.ts +5 -3
  279. package/dist/types/tools/eval-format/code-mode-declarations.d.ts +0 -5
  280. package/src/tools/eval-format/code-mode-declarations.ts +0 -61
@@ -1,6 +1,6 @@
1
1
  import type { SummaryResult } from "@linxiraos/pi-natives";
2
2
  import type { Component } from "../tui.js";
3
- import type { NativeToolView, RenderResultOptions, ToolActivityContext, ToolActivitySummary } from "./renderer.js";
3
+ import type { RenderResultContextOptions, NativeToolView, RenderResultOptions, ToolActivityContext, ToolActivitySummary } from "./renderer.js";
4
4
  import type { NativeNode } from "../native/node.js";
5
5
  import type { Theme } from "../theme/theme.js";
6
6
  import type { OutputMeta } from "./output-meta.js";
@@ -20,6 +20,12 @@ export interface ReadToolDetails {
20
20
  truncation?: ReadTruncationStats;
21
21
  isDirectory?: boolean;
22
22
  resolvedPath?: string;
23
+ /**
24
+ * Absolute path of the disk file whose image this read returned. A native TSP host that
25
+ * supports `media` shows the file by path instead of the uploaded image bytes. Unset for
26
+ * screenshots, URL reads and other images not backed by a file. Display-only.
27
+ */
28
+ mediaPath?: string;
23
29
  suffixResolution?: {
24
30
  from: string;
25
31
  to: string;
@@ -34,6 +40,11 @@ export interface ReadToolDetails {
34
40
  fileSize?: number;
35
41
  /** Full source line count when the read reached EOF and the count is exact. */
36
42
  totalLines?: number;
43
+ /**
44
+ * Whether the text's rows carry line-number prefixes (`N:` hashline, `N|` line numbers). Set where a
45
+ * file read is formatted; a raw read sets `false`. Snapcompact reads it to tell a `12:` prefix from content.
46
+ */
47
+ rowPrefixes?: boolean;
37
48
  /** Raw text + start line for user-visible TUI rendering, set when content is text-like.
38
49
  * Mirrors the same lines the model receives but without hashline/line-number prefixes,
39
50
  * so the TUI can render the file content with its own gutter without re-parsing the formatted text. */
@@ -49,7 +60,10 @@ export interface ReadToolDetails {
49
60
  };
50
61
  /** Number of unresolved git conflicts surfaced by this read (TUI uses for inline `⚠ N` badge). */
51
62
  conflictCount?: number;
52
- /** Paths recovered from a delimited read argument; used only by the TUI to render one call as multiple read rows. */
63
+ /**
64
+ * Paths recovered from a delimited read argument. The TUI renders one call as multiple read rows; snapcompact
65
+ * keeps such a composite result as text.
66
+ */
53
67
  displayReadTargets?: string[];
54
68
  /**
55
69
  * Resolved filesystem link target for each {@link displayReadTargets} entry, aligned by index; `null` when a
@@ -107,14 +121,22 @@ export declare function pendingFileLinkPath(inputPath: string): string;
107
121
  * target when the structured `resolvedPath` isn't set (the common plain-file and
108
122
  * image reads only record the path in `meta.source`). URL/internal sources are
109
123
  * not fs paths, so only `type: "path"` qualifies. */
110
- export declare function readSourceFsPath(details: ReadToolDetails | undefined): string | undefined;
124
+ export declare function readSourceFsPath(details: unknown): string | undefined;
125
+ /**
126
+ * Whether a read result renders as a Markdown preview rather than numbered source:
127
+ * the read tool tagged it `text/markdown` (`read.renderMarkdown`, or a protocol
128
+ * resource) and the call did not ask for `:raw` source. Shared by the standalone
129
+ * read card and the read group's content previews so both honor the setting.
130
+ */
131
+ export declare function readResultIsMarkdown(details: ReadToolDetails | undefined, args: ReadRenderArgs | undefined): boolean;
111
132
  /**
112
- * Read content as numbered `code` (no path header: the head names the file).
113
- * Numbers come from `lineNumbers` (`displayContent`'s per-line numbers,
114
- * `null` for an elided block; runs split with `…` between) when they cover
115
- * every line, else count up from `start`.
133
+ * Read content as numbered, wrapped `code` (no path header: the head names
134
+ * the file), matching the ANSI preview's hanging wrap. Numbers come from
135
+ * `lineNumbers` (`displayContent`'s per-line numbers, `null` for an elided
136
+ * block; runs split with `…` between) when they cover every line, else count
137
+ * up from `start`.
116
138
  */
117
- export declare function readContentCode(content: string, start: number, numbers: readonly (number | null)[] | undefined, lang: string | undefined): NativeNode[];
139
+ export declare function readContentCode(content: string, start: number, numbers: readonly (number | null)[] | undefined, path: string | undefined): NativeNode[];
118
140
  /** Render file, image, and URL reads in the transcript. */
119
141
  export declare const readToolRenderer: {
120
142
  activitySummary(args: unknown, _context: ToolActivityContext): ToolActivitySummary;
@@ -126,7 +148,7 @@ export declare const readToolRenderer: {
126
148
  }>;
127
149
  details?: ReadToolDetails;
128
150
  isError?: boolean;
129
- }, options: RenderResultOptions, uiTheme: Theme, args?: ReadRenderArgs): Component;
151
+ }, options: RenderResultContextOptions, uiTheme: Theme, args?: ReadRenderArgs): Component;
130
152
  describeCall(args: ReadRenderArgs): NativeToolView;
131
153
  /**
132
154
  * Inline (§7.3 read): the head names the file and range; the content
@@ -140,7 +162,7 @@ export declare const readToolRenderer: {
140
162
  }>;
141
163
  details?: ReadToolDetails;
142
164
  isError?: boolean;
143
- }, _options: RenderResultOptions, args?: ReadRenderArgs): NativeToolView;
165
+ }, options: RenderResultContextOptions, args?: ReadRenderArgs): NativeToolView;
144
166
  mergeCallAndResult: true;
145
167
  };
146
168
  /** Inclusive line range describing one elided span in a structural summary. */
@@ -33,6 +33,8 @@ export interface RenderResultOptions {
33
33
  elapsedMs?: number;
34
34
  /** The call was abandoned without a final result (turn aborted, sealed). Native describe hooks only. */
35
35
  cancelled?: boolean;
36
+ /** The native host shows files by path (`cx.supports("media")`). Native describe hooks only. */
37
+ media?: boolean;
36
38
  }
37
39
  /** Render options for a result, plus the tool-specific context the transcript threads through. */
38
40
  export type RenderResultContextOptions = RenderResultOptions & {
@@ -101,6 +101,10 @@ export interface TaskItem {
101
101
  name?: string;
102
102
  /** Agent type to run this item (e.g. "scout"). Defaults to the spawn policy's default agent. */
103
103
  agent?: string;
104
+ /** Historical source session selected by the bundled consult agent. */
105
+ sourceSession?: string;
106
+ /** Optional model selector override for the historical source session. */
107
+ model?: string | string[];
104
108
  /** The work; required by the schema. */
105
109
  task?: string;
106
110
  /** How open-ended the work is; required by the schema and the child's sole `auto` thinking classification input. */
@@ -127,6 +131,10 @@ export interface TaskParams {
127
131
  name?: string;
128
132
  /** Agent type to spawn (flat form); omitted values resolve from the session spawn policy. */
129
133
  agent?: string;
134
+ /** Historical source session selected by the bundled consult agent. */
135
+ sourceSession?: string;
136
+ /** Optional model selector override for the historical source session. */
137
+ model?: string | string[];
130
138
  /** The work (flat form). */
131
139
  task?: string;
132
140
  /** How open-ended the work is (flat form); see {@link TaskItem.solutionSpace}. */
@@ -383,6 +391,29 @@ export interface SingleResult {
383
391
  attempt: number;
384
392
  errorMessage: string;
385
393
  };
394
+ /**
395
+ * Coarse category of a non-zero exit — `usage-limit`, `auth`,
396
+ * `account-policy`, `context-overflow`, `transient`, `aborted`, or
397
+ * `unknown`. A parent agent reads this to tell "swap the model" (the first
398
+ * three) from "fix the request" instead of parsing provider prose.
399
+ */
400
+ failureClass?: "usage-limit" | "auth" | "account-policy" | "context-overflow" | "transient" | "aborted" | "unknown";
401
+ /**
402
+ * Other models this session could run instead (selectors accepted by the
403
+ * task `model` parameter, including `@role` aliases). Empty when nothing
404
+ * else is configured or every alternative is already in cooldown.
405
+ */
406
+ fallbackCandidates?: string[];
407
+ /**
408
+ * Set when a caller-supplied `model` replaced the model this run would
409
+ * otherwise have used — the audit trail of an agent-driven switch.
410
+ */
411
+ modelChange?: {
412
+ source: "spawn-param" | "wake-param";
413
+ /** The model the run would have used without the override, when resolvable. */
414
+ from?: string;
415
+ to: string;
416
+ };
386
417
  /** Output metadata for agent:// URL integration */
387
418
  outputMeta?: {
388
419
  lineCount: number;
@@ -25,6 +25,7 @@ export declare const SEARCH_PROVIDER_LABELS: {
25
25
  readonly tavily: "Tavily";
26
26
  readonly firecrawl: "Firecrawl";
27
27
  readonly brave: "Brave";
28
+ readonly deepseek: "DeepSeek";
28
29
  readonly kimi: "Kimi";
29
30
  readonly synthetic: "Synthetic";
30
31
  readonly ollama: "Ollama";
@@ -73,6 +73,8 @@ interface WriteStreamingPreviewStateCarrier {
73
73
  /** Render context for the write tool: resolves an `xd://`-mounted tool so its live renderer drives device dispatch previews. */
74
74
  export interface WriteRenderContext {
75
75
  resolveXdevMounted?: (name: string) => XdevMountedRenderer | undefined;
76
+ /** Original result metadata used only for filesystem link targets. */
77
+ rawDetails?: unknown;
76
78
  }
77
79
  /** Render file writes and delegated tool-device calls. */
78
80
  export declare const writeToolRenderer: {
@@ -115,9 +115,6 @@ export interface Component {
115
115
  * last time.
116
116
  */
117
117
  render(width: number): readonly string[];
118
- /** Inline decision panels must keep displaced settled transcript rows in
119
- * native scrollback even when mounted inside a transient editor container. */
120
- readonly retireDisplacedTranscript?: boolean;
121
118
  /**
122
119
  * Describe the component semantically for a Tern Surface Protocol
123
120
  * terminal (see `native/node.ts`). Called instead of `render()` when the
@@ -351,6 +348,7 @@ export declare class TUI extends Container {
351
348
  overlayStack: {
352
349
  component: Component;
353
350
  options?: OverlayOptions;
351
+ /** Focus restored after closing; tracks live focus changes beneath an input-less key holder. */
354
352
  preFocus: Component | null;
355
353
  hidden: boolean;
356
354
  /**
@@ -458,6 +456,16 @@ export declare class TUI extends Container {
458
456
  top: number;
459
457
  length: number;
460
458
  };
459
+ /**
460
+ * Rows of native history the last paint left on screen above a mutable
461
+ * viewport that reached the bottom row, or `undefined` when that paint left
462
+ * rows free below it (or none happened, or a destructive reset will repaint
463
+ * from row zero). Rows above a bottom-reaching viewport may already sit in
464
+ * native scrollback, which a later shrink cannot pull back down.
465
+ */
466
+ getFilledHistoryRows(): number | undefined;
467
+ /** Whether native history holds rows the frame provider committed since the last destructive reset. */
468
+ hasProviderHistory(): boolean;
461
469
  /**
462
470
  * Probe for opt-in normal-buffer click capture. The provider is read every
463
471
  * frame; while it returns true (and no fullscreen overlay owns the
@@ -507,6 +515,13 @@ export declare class TUI extends Container {
507
515
  * overtaking them. No-op unless `previous` owns the held keys.
508
516
  */
509
517
  replaceHeldFocus(previous: Component, next: Component): void;
518
+ /**
519
+ * Register a hook that re-enables terminal modes on every start(). A hook
520
+ * added while the TUI is already running (a prepaint composer starts it
521
+ * before the interactive mode wires its controllers) missed that start, so
522
+ * it runs immediately instead of waiting for a stop/start cycle that may
523
+ * never come.
524
+ */
510
525
  addStartListener(listener: StartListener): () => void;
511
526
  addInputListener(listener: InputListener): () => void;
512
527
  removeInputListener(listener: InputListener): void;
@@ -519,6 +534,8 @@ export declare class TUI extends Container {
519
534
  */
520
535
  resetDisplay(): void;
521
536
  requestRender(force?: boolean, options?: RenderRequestOptions): void;
537
+ /** Run `callback` after `delayMs` on the render scheduler's clock, unless the TUI has stopped. */
538
+ scheduleAfter(delayMs: number, callback: () => void): RenderTimer;
522
539
  /**
523
540
  * Paint a forced frame synchronously when startup must hand off an already
524
541
  * visible component tree before further async initialization. Same as
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@linxiraos/pi-tui",
4
- "version": "1.2.1",
4
+ "version": "1.3.1",
5
5
  "description": "Terminal User Interface library with differential rendering for efficient text-based applications",
6
6
  "homepage": "https://linxira-os.github.io/zeta/",
7
7
  "author": "Linxira-OS",
@@ -30,7 +30,7 @@
30
30
  "types": "./dist/types/index.d.ts",
31
31
  "scripts": {
32
32
  "check": "oxlint . && oxfmt --check --no-error-on-unmatched-pattern 'src/**/*.{ts,tsx}' '{test,bench,examples,scripts}/**/*.ts' '*.ts' && bun run check:types",
33
- "check:types": "tsgo -p tsconfig.json --noEmit",
33
+ "check:types": "tsc -p tsconfig.json --noEmit",
34
34
  "lint": "oxlint .",
35
35
  "test": "bun test --parallel test/*.test.ts",
36
36
  "fix": "oxlint --fix --fix-suggestions . && bun run fmt",
@@ -38,14 +38,14 @@
38
38
  "gen:glyphs": "bun scripts/gen-glyphs.ts"
39
39
  },
40
40
  "dependencies": {
41
- "@linxiraos/pi-omptype": "1.2.1",
42
- "@linxiraos/pi-agent-core": "1.2.1",
43
- "@linxiraos/pi-ai": "1.2.1",
44
- "@linxiraos/pi-catalog": "1.2.1",
45
- "@linxiraos/pi-natives": "1.2.1",
46
- "@linxiraos/pi-utils": "1.2.1",
47
- "@linxiraos/pi-wire": "1.2.1",
48
- "@linxiraos/pi-snapcompact": "1.2.1"
41
+ "@linxiraos/pi-omptype": "1.3.1",
42
+ "@linxiraos/pi-agent-core": "1.3.1",
43
+ "@linxiraos/pi-ai": "1.3.1",
44
+ "@linxiraos/pi-catalog": "1.3.1",
45
+ "@linxiraos/pi-natives": "1.3.1",
46
+ "@linxiraos/pi-utils": "1.3.1",
47
+ "@linxiraos/pi-wire": "1.3.1",
48
+ "@linxiraos/pi-snapcompact": "1.3.1"
49
49
  },
50
50
  "devDependencies": {
51
51
  "kitty-vt-wasm": "^0.2.0"
@@ -17,6 +17,8 @@ interface AppKeybindings {
17
17
  "app.model.selectTemporary": true;
18
18
  "app.tools.expand": true;
19
19
  "app.tools.toggleVisibility": true;
20
+ "app.ask.hide": true;
21
+ "app.approval.approve": true;
20
22
  "app.editor.external": true;
21
23
  "app.message.followUp": true;
22
24
  "app.retry": true;
@@ -36,8 +38,8 @@ interface AppKeybindings {
36
38
  "app.session.rename": true;
37
39
  "app.session.delete": true;
38
40
  "app.session.deleteNoninvasive": true;
39
- "app.tree.foldOrUp": true;
40
- "app.tree.unfoldOrDown": true;
41
+ "app.tree.previousBranch": true;
42
+ "app.tree.nextBranch": true;
41
43
  "app.plan.toggle": true;
42
44
  "app.history.search": true;
43
45
  "app.stt.pushToTalk": true;
@@ -238,6 +240,14 @@ export declare const KEYBINDINGS: {
238
240
  readonly defaultKeys: "ctrl+shift+o";
239
241
  readonly description: "Show or hide tool activity";
240
242
  };
243
+ readonly "app.ask.hide": {
244
+ readonly defaultKeys: "alt+h";
245
+ readonly description: "Hide or show a pending ask dialog";
246
+ };
247
+ readonly "app.approval.approve": {
248
+ readonly defaultKeys: ["ctrl+enter", "ctrl+q"];
249
+ readonly description: "Approve a pending tool call";
250
+ };
241
251
  readonly "app.editor.external": {
242
252
  readonly defaultKeys: "ctrl+g";
243
253
  readonly description: "Open external editor";
@@ -314,13 +324,13 @@ export declare const KEYBINDINGS: {
314
324
  readonly defaultKeys: "ctrl+backspace";
315
325
  readonly description: "Delete session (non-invasive)";
316
326
  };
317
- readonly "app.tree.foldOrUp": {
318
- readonly defaultKeys: ["ctrl+left", "alt+left"];
319
- readonly description: "Fold or move up";
327
+ readonly "app.tree.previousBranch": {
328
+ readonly defaultKeys: [];
329
+ readonly description: "Jump to the previous branch in /tree";
320
330
  };
321
- readonly "app.tree.unfoldOrDown": {
322
- readonly defaultKeys: ["ctrl+right", "alt+right"];
323
- readonly description: "Unfold or move down";
331
+ readonly "app.tree.nextBranch": {
332
+ readonly defaultKeys: [];
333
+ readonly description: "Jump to the next branch in /tree";
324
334
  };
325
335
  readonly "app.plan.toggle": {
326
336
  readonly defaultKeys: "alt+shift+p";
@@ -37,6 +37,8 @@ interface AppKeybindings {
37
37
  "app.model.selectTemporary": true;
38
38
  "app.tools.expand": true;
39
39
  "app.tools.toggleVisibility": true;
40
+ "app.ask.hide": true;
41
+ "app.approval.approve": true;
40
42
  "app.editor.external": true;
41
43
  "app.message.followUp": true;
42
44
  "app.retry": true;
@@ -56,8 +58,8 @@ interface AppKeybindings {
56
58
  "app.session.rename": true;
57
59
  "app.session.delete": true;
58
60
  "app.session.deleteNoninvasive": true;
59
- "app.tree.foldOrUp": true;
60
- "app.tree.unfoldOrDown": true;
61
+ "app.tree.previousBranch": true;
62
+ "app.tree.nextBranch": true;
61
63
  "app.plan.toggle": true;
62
64
  "app.history.search": true;
63
65
  "app.stt.pushToTalk": true;
@@ -138,6 +140,16 @@ export const KEYBINDINGS = {
138
140
  defaultKeys: "ctrl+shift+o",
139
141
  description: "Show or hide tool activity",
140
142
  },
143
+ "app.ask.hide": {
144
+ defaultKeys: "alt+h",
145
+ description: "Hide or show a pending ask dialog",
146
+ },
147
+ "app.approval.approve": {
148
+ // A chord, not Enter: an Enter typed for the composer as the prompt appears must not approve.
149
+ // Ctrl+Q backs up Ctrl+Enter, which Windows Terminal cannot deliver (#1903).
150
+ defaultKeys: ["ctrl+enter", "ctrl+q"],
151
+ description: "Approve a pending tool call",
152
+ },
141
153
  "app.editor.external": {
142
154
  defaultKeys: "ctrl+g",
143
155
  description: "Open external editor",
@@ -222,13 +234,13 @@ export const KEYBINDINGS = {
222
234
  defaultKeys: "ctrl+backspace",
223
235
  description: "Delete session (non-invasive)",
224
236
  },
225
- "app.tree.foldOrUp": {
226
- defaultKeys: ["ctrl+left", "alt+left"],
227
- description: "Fold or move up",
237
+ "app.tree.previousBranch": {
238
+ defaultKeys: [],
239
+ description: "Jump to the previous branch in /tree",
228
240
  },
229
- "app.tree.unfoldOrDown": {
230
- defaultKeys: ["ctrl+right", "alt+right"],
231
- description: "Unfold or move down",
241
+ "app.tree.nextBranch": {
242
+ defaultKeys: [],
243
+ description: "Jump to the next branch in /tree",
232
244
  },
233
245
  "app.plan.toggle": {
234
246
  defaultKeys: "alt+shift+p",