@agi-fans/dsh-tui 0.18.0 → 0.20.0

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 (227) hide show
  1. package/lib/CHANGELOG.md +115 -1
  2. package/lib/chrome/box.d.ts +2 -0
  3. package/lib/chrome/box.js +6 -12
  4. package/lib/chrome/box.js.map +1 -1
  5. package/lib/chrome/code-highlight.d.ts +26 -18
  6. package/lib/chrome/code-highlight.js +114 -39
  7. package/lib/chrome/code-highlight.js.map +1 -1
  8. package/lib/chrome/diff-render.d.ts +1 -2
  9. package/lib/chrome/diff-render.js +41 -90
  10. package/lib/chrome/diff-render.js.map +1 -1
  11. package/lib/chrome/main-screen-renderer.d.ts +52 -30
  12. package/lib/chrome/main-screen-renderer.js +1730 -79
  13. package/lib/chrome/main-screen-renderer.js.map +1 -1
  14. package/lib/chrome/markdown.js +144 -101
  15. package/lib/chrome/markdown.js.map +1 -1
  16. package/lib/chrome/math.d.ts +4 -0
  17. package/lib/chrome/math.js +340 -0
  18. package/lib/chrome/math.js.map +1 -0
  19. package/lib/chrome/md-style.d.ts +3 -0
  20. package/lib/chrome/md-style.js.map +1 -1
  21. package/lib/chrome/mermaid.d.ts +6 -0
  22. package/lib/chrome/mermaid.js +56 -0
  23. package/lib/chrome/mermaid.js.map +1 -0
  24. package/lib/chrome/renderer.d.ts +78 -0
  25. package/lib/chrome/renderer.js.map +1 -1
  26. package/lib/chrome/status-config.d.ts +5 -0
  27. package/lib/chrome/status-config.js +3 -0
  28. package/lib/chrome/status-config.js.map +1 -1
  29. package/lib/chrome/status-line.d.ts +0 -21
  30. package/lib/chrome/status-line.js +8 -65
  31. package/lib/chrome/status-line.js.map +1 -1
  32. package/lib/chrome/terminal-images.d.ts +31 -0
  33. package/lib/chrome/terminal-images.js +34 -0
  34. package/lib/chrome/terminal-images.js.map +1 -0
  35. package/lib/chrome/theme.d.ts +23 -6
  36. package/lib/chrome/theme.js +217 -109
  37. package/lib/chrome/theme.js.map +1 -1
  38. package/lib/chrome/tool-args.d.ts +24 -1
  39. package/lib/chrome/tool-args.js +40 -1
  40. package/lib/chrome/tool-args.js.map +1 -1
  41. package/lib/chrome/tool-renderers.d.ts +11 -0
  42. package/lib/chrome/tool-renderers.js +55 -5
  43. package/lib/chrome/tool-renderers.js.map +1 -1
  44. package/lib/chrome/welcome-tips.js +2 -2
  45. package/lib/chrome/welcome-tips.js.map +1 -1
  46. package/lib/chrome/width.d.ts +7 -3
  47. package/lib/chrome/width.js +78 -14
  48. package/lib/chrome/width.js.map +1 -1
  49. package/lib/commands/diff.js +49 -3
  50. package/lib/commands/diff.js.map +1 -1
  51. package/lib/commands/export.js +28 -5
  52. package/lib/commands/export.js.map +1 -1
  53. package/lib/commands/files.d.ts +8 -0
  54. package/lib/commands/files.js +137 -0
  55. package/lib/commands/files.js.map +1 -0
  56. package/lib/commands/plugins.d.ts +8 -0
  57. package/lib/commands/plugins.js +158 -0
  58. package/lib/commands/plugins.js.map +1 -0
  59. package/lib/commands/session-configuration.d.ts +4 -0
  60. package/lib/commands/session-configuration.js +39 -8
  61. package/lib/commands/session-configuration.js.map +1 -1
  62. package/lib/commands/session.js +47 -15
  63. package/lib/commands/session.js.map +1 -1
  64. package/lib/commands/steer.js +2 -2
  65. package/lib/commands/steer.js.map +1 -1
  66. package/lib/commands/terminal.d.ts +7 -0
  67. package/lib/commands/terminal.js +99 -0
  68. package/lib/commands/terminal.js.map +1 -0
  69. package/lib/definition.d.ts +180 -14
  70. package/lib/definition.js.map +1 -1
  71. package/lib/input/clipboard.d.ts +12 -7
  72. package/lib/input/clipboard.js +79 -20
  73. package/lib/input/clipboard.js.map +1 -1
  74. package/lib/input/composer-files.d.ts +26 -0
  75. package/lib/input/composer-files.js +50 -0
  76. package/lib/input/composer-files.js.map +1 -0
  77. package/lib/input/editor-discovery.d.ts +21 -0
  78. package/lib/input/editor-discovery.js +99 -0
  79. package/lib/input/editor-discovery.js.map +1 -0
  80. package/lib/input/editor.d.ts +26 -1
  81. package/lib/input/editor.js +126 -12
  82. package/lib/input/editor.js.map +1 -1
  83. package/lib/input/external-editor.d.ts +5 -2
  84. package/lib/input/external-editor.js +14 -12
  85. package/lib/input/external-editor.js.map +1 -1
  86. package/lib/input/fuzzy-search.d.ts +9 -0
  87. package/lib/input/fuzzy-search.js +113 -0
  88. package/lib/input/fuzzy-search.js.map +1 -0
  89. package/lib/input/keybindings-config.d.ts +1 -1
  90. package/lib/input/keybindings-config.js +7 -1
  91. package/lib/input/keybindings-config.js.map +1 -1
  92. package/lib/input/keys.d.ts +17 -0
  93. package/lib/input/keys.js +21 -5
  94. package/lib/input/keys.js.map +1 -1
  95. package/lib/input/mouse-policy.d.ts +3 -0
  96. package/lib/input/mouse-policy.js +14 -0
  97. package/lib/input/mouse-policy.js.map +1 -0
  98. package/lib/input/paste-burst.d.ts +16 -0
  99. package/lib/input/paste-burst.js +61 -0
  100. package/lib/input/paste-burst.js.map +1 -0
  101. package/lib/input/text-selection.d.ts +20 -0
  102. package/lib/input/text-selection.js +195 -0
  103. package/lib/input/text-selection.js.map +1 -0
  104. package/lib/runtime/composer-images.d.ts +1 -0
  105. package/lib/runtime/composer-images.js +11 -3
  106. package/lib/runtime/composer-images.js.map +1 -1
  107. package/lib/runtime/file-open.d.ts +2 -0
  108. package/lib/runtime/file-open.js +12 -0
  109. package/lib/runtime/file-open.js.map +1 -0
  110. package/lib/runtime/file-review.d.ts +24 -0
  111. package/lib/runtime/file-review.js +188 -0
  112. package/lib/runtime/file-review.js.map +1 -0
  113. package/lib/runtime/herdr-agent.d.ts +7 -15
  114. package/lib/runtime/herdr-agent.js +151 -79
  115. package/lib/runtime/herdr-agent.js.map +1 -1
  116. package/lib/runtime/hook-settings.d.ts +17 -0
  117. package/lib/runtime/hook-settings.js +57 -0
  118. package/lib/runtime/hook-settings.js.map +1 -0
  119. package/lib/runtime/human-interaction.js +1 -1
  120. package/lib/runtime/human-interaction.js.map +1 -1
  121. package/lib/runtime/image-preview.d.ts +8 -0
  122. package/lib/runtime/image-preview.js +119 -0
  123. package/lib/runtime/image-preview.js.map +1 -0
  124. package/lib/runtime/plain-tui.d.ts +2 -0
  125. package/lib/runtime/plain-tui.js +2 -2
  126. package/lib/runtime/plain-tui.js.map +1 -1
  127. package/lib/runtime/plugin-settings.d.ts +17 -0
  128. package/lib/runtime/plugin-settings.js +154 -0
  129. package/lib/runtime/plugin-settings.js.map +1 -0
  130. package/lib/runtime/provider-local.d.ts +58 -7
  131. package/lib/runtime/provider-local.js +1394 -137
  132. package/lib/runtime/provider-local.js.map +1 -1
  133. package/lib/runtime/runner.js +3 -3
  134. package/lib/runtime/runner.js.map +1 -1
  135. package/lib/runtime/session-archive.d.ts +5 -0
  136. package/lib/runtime/session-archive.js +114 -0
  137. package/lib/runtime/session-archive.js.map +1 -0
  138. package/lib/runtime/subagent-model-selection.d.ts +5 -0
  139. package/lib/runtime/subagent-model-selection.js +15 -0
  140. package/lib/runtime/subagent-model-selection.js.map +1 -0
  141. package/lib/runtime/terminal-notifications.d.ts +8 -0
  142. package/lib/runtime/terminal-notifications.js +16 -0
  143. package/lib/runtime/terminal-notifications.js.map +1 -1
  144. package/lib/runtime/terminal-reader.d.ts +11 -0
  145. package/lib/runtime/terminal-reader.js +87 -0
  146. package/lib/runtime/terminal-reader.js.map +1 -0
  147. package/lib/runtime/tool-presentation.js +43 -30
  148. package/lib/runtime/tool-presentation.js.map +1 -1
  149. package/lib/session/composer-drafts.d.ts +20 -0
  150. package/lib/session/composer-drafts.js +103 -0
  151. package/lib/session/composer-drafts.js.map +1 -0
  152. package/lib/session/conversation-turns.d.ts +16 -0
  153. package/lib/session/conversation-turns.js +33 -0
  154. package/lib/session/conversation-turns.js.map +1 -0
  155. package/lib/session/feature-toggles.d.ts +79 -0
  156. package/lib/session/feature-toggles.js +139 -0
  157. package/lib/session/feature-toggles.js.map +1 -0
  158. package/lib/session/fold-policy.d.ts +4 -0
  159. package/lib/session/fold-policy.js +4 -0
  160. package/lib/session/fold-policy.js.map +1 -0
  161. package/lib/session/interaction-adapter.d.ts +2 -2
  162. package/lib/session/interaction-adapter.js +156 -25
  163. package/lib/session/interaction-adapter.js.map +1 -1
  164. package/lib/session/job-notice.d.ts +4 -0
  165. package/lib/session/job-notice.js +44 -3
  166. package/lib/session/job-notice.js.map +1 -1
  167. package/lib/session/message-queue.d.ts +22 -0
  168. package/lib/session/message-queue.js +157 -0
  169. package/lib/session/message-queue.js.map +1 -0
  170. package/lib/session/project-file-search.js +3 -21
  171. package/lib/session/project-file-search.js.map +1 -1
  172. package/lib/session/session-controller.d.ts +11 -18
  173. package/lib/session/session-controller.js +246 -100
  174. package/lib/session/session-controller.js.map +1 -1
  175. package/lib/session/session-library.d.ts +11 -3
  176. package/lib/session/session-library.js +48 -8
  177. package/lib/session/session-library.js.map +1 -1
  178. package/lib/session/session-tree.d.ts +26 -0
  179. package/lib/session/session-tree.js +112 -0
  180. package/lib/session/session-tree.js.map +1 -0
  181. package/lib/session/steering.d.ts +3 -0
  182. package/lib/session/steering.js +9 -0
  183. package/lib/session/steering.js.map +1 -0
  184. package/lib/session/tui-settings.d.ts +23 -1
  185. package/lib/session/tui-settings.js +15 -2
  186. package/lib/session/tui-settings.js.map +1 -1
  187. package/lib/session/workflow-projection.d.ts +9 -0
  188. package/lib/session/workflow-projection.js +44 -0
  189. package/lib/session/workflow-projection.js.map +1 -0
  190. package/lib/views/agent-hub.js +9 -4
  191. package/lib/views/agent-hub.js.map +1 -1
  192. package/lib/views/autocomplete.js +5 -25
  193. package/lib/views/autocomplete.js.map +1 -1
  194. package/lib/views/document-reader.d.ts +34 -0
  195. package/lib/views/document-reader.js +145 -0
  196. package/lib/views/document-reader.js.map +1 -0
  197. package/lib/views/event-views.d.ts +26 -2
  198. package/lib/views/event-views.js +196 -42
  199. package/lib/views/event-views.js.map +1 -1
  200. package/lib/views/hotkeys.d.ts +2 -0
  201. package/lib/views/hotkeys.js +20 -8
  202. package/lib/views/hotkeys.js.map +1 -1
  203. package/lib/views/prompt-selector.d.ts +33 -3
  204. package/lib/views/prompt-selector.js +287 -43
  205. package/lib/views/prompt-selector.js.map +1 -1
  206. package/lib/views/prompt-tree.d.ts +11 -0
  207. package/lib/views/prompt-tree.js +74 -0
  208. package/lib/views/prompt-tree.js.map +1 -0
  209. package/lib/views/session-files.d.ts +7 -0
  210. package/lib/views/session-files.js +62 -0
  211. package/lib/views/session-files.js.map +1 -0
  212. package/lib/views/settings-list.d.ts +32 -4
  213. package/lib/views/settings-list.js +148 -37
  214. package/lib/views/settings-list.js.map +1 -1
  215. package/lib/views/transcript-render.d.ts +117 -18
  216. package/lib/views/transcript-render.js +1084 -126
  217. package/lib/views/transcript-render.js.map +1 -1
  218. package/lib/views/transcript-types.d.ts +80 -2
  219. package/lib/views/transcript-types.js +11 -0
  220. package/lib/views/transcript-types.js.map +1 -1
  221. package/lib/views/workspace-changes.d.ts +27 -0
  222. package/lib/views/workspace-changes.js +128 -0
  223. package/lib/views/workspace-changes.js.map +1 -0
  224. package/package.json +77 -41
  225. package/lib/chrome/style.d.ts +0 -22
  226. package/lib/chrome/style.js +0 -23
  227. package/lib/chrome/style.js.map +0 -1
@@ -20,6 +20,8 @@ import type { WelcomeTip } from '../chrome/welcome-tips.ts';
20
20
  import type { MotionMode } from '../session/tui-settings.ts';
21
21
  import { type Block, type TodoItem, type TranscriptState } from './transcript-types.ts';
22
22
  export interface ViewOptions {
23
+ /** Effective key for active-turn guidance, when the provider has an admission handler. */
24
+ steerKey?: string;
23
25
  /** Terminal width in columns. */
24
26
  width: number;
25
27
  /** Terminal height in rows; the view keeps the frame inside it. */
@@ -52,6 +54,8 @@ export interface ViewOptions {
52
54
  spinnerFrame?: number;
53
55
  /** Animation policy for streaming, activity marks, and the working label. */
54
56
  motion?: MotionMode;
57
+ mathMode?: import('../chrome/math.ts').MathMode;
58
+ mermaidMode?: import('../chrome/mermaid.ts').MermaidMode;
55
59
  /** 24-bit color; defaults to off so tests stay deterministic. */
56
60
  trueColor?: boolean;
57
61
  /** Shipped palette; defaults to dark. */
@@ -71,6 +75,12 @@ export interface ViewOptions {
71
75
  trajectory?: TrajectoryState;
72
76
  /** Keyboard-first full-screen descendant roster and inspector. */
73
77
  agentHub?: AgentHubState;
78
+ /** Terminal-owned graphics capability and measured cell geometry. */
79
+ imageProtocol?: import('../chrome/terminal-images.ts').ImageProtocol;
80
+ imageCellSize?: {
81
+ width: number;
82
+ height: number;
83
+ };
74
84
  /** Human-interaction selector; replaces the normal editor while active. */
75
85
  promptSelector?: PromptSelectorState;
76
86
  /** Effective local + agent-scoped slash command catalog. */
@@ -100,8 +110,10 @@ export interface ViewOptions {
100
110
  * the window to the latest lines — the OMP follow-tail default.
101
111
  */
102
112
  scrollStart?: number;
103
- /** Open one transcript block at its first row instead of following the tail. */
113
+ /** Focus one transcript block instead of following the tail. */
104
114
  focusBlock?: number;
115
+ /** Which edge of the focused block to show; searches default to its start. */
116
+ focusBlockEdge?: 'start' | 'end';
105
117
  /**
106
118
  * Active transcript search. Matching block rows containing the query paint
107
119
  * inverse; `matches` are block indexes in render order and `focus` selects
@@ -113,35 +125,120 @@ export interface ViewOptions {
113
125
  focus: number;
114
126
  editing: boolean;
115
127
  };
116
- /**
117
- * When true, tool blocks paint their full output (OMP `ctrl+o`). Default
118
- * is the collapsed preview of {@link TOOL_COLLAPSED_LINES} rows.
119
- */
128
+ /** Legacy full-output override for direct callers and the tool catalog. */
120
129
  toolsExpanded?: boolean;
121
- /** Individual tool calls expanded by the user. */
130
+ /** Tool calls whose complete inputs and results are visible. */
122
131
  expandedTools?: ReadonlySet<string>;
132
+ /** Effective application binding used in preview hints. */
133
+ toolDetailsKey?: string;
134
+ /** Effective application binding used in completed-turn expansion hints. */
135
+ turnDetailsKey?: string;
136
+ /** Legacy reasoning anchors retained for search and scroll mapping. */
137
+ expandedReasoning?: ReadonlySet<string>;
138
+ /** Process groups the reader opened, keyed by {@link ProcessGroup.key}. */
139
+ openedGroups?: ReadonlySet<string>;
123
140
  }
124
- /** Collapsed tool-output preview height (OMP `DEFAULT_TERMINAL_PREVIEW_LINES`). */
125
- export declare const TOOL_COLLAPSED_LINES = 10;
126
- export declare const TOOL_INPUT_COLLAPSED_LINES = 3;
141
+ /** A settled turn's length, the way a person would say it. */
142
+ export declare function formatElapsed(ms: number): string;
127
143
  /**
128
- * Render one transcript block to display lines. Pure; shared by the tty view
129
- * and the non-tty plain printer.
130
- * @param block - the block to render.
131
- * @param theme - active theme.
132
- * @param width - terminal width in columns.
133
- * @param spinnerFrame - activity spinner phase for running tools.
134
- * @param toolsExpanded - paint full tool output instead of the collapsed preview.
135
- * @returns display lines (already width-fitted).
144
+ * Render a block for the transcript or plain printer. Full output is available
145
+ * to direct callers; turn inspection uses previews. omitReasoning excludes
146
+ * thinking already drawn by a run.
136
147
  */
137
- export declare function blockLines(block: Block, theme: Theme, width: number, spinnerFrame?: number, toolsExpanded?: boolean): string[];
148
+ export declare function blockLines(block: Block, theme: Theme, width: number, { toolsExpanded, omitReasoning, toolDetailsKey, mathMode, mermaidMode }?: {
149
+ toolsExpanded?: boolean;
150
+ omitReasoning?: boolean;
151
+ toolDetailsKey?: string;
152
+ mathMode?: import('../chrome/math.ts').MathMode;
153
+ mermaidMode?: import('../chrome/mermaid.ts').MermaidMode;
154
+ }): string[];
155
+ /** Why the transcript was replaced. */
156
+ export type TranscriptSeam = 'session-opened' | 'cleared';
157
+ /** The row that separates two documents in the terminal's history. */
158
+ export declare function transcriptSeam(reason: TranscriptSeam): Block;
138
159
  /** Plain text of one block, used by transcript search and match painting. */
139
160
  export declare function blockSearchText(block: Block): string;
161
+ /** One collapsible stretch of process: the calls and thoughts between two answers. */
162
+ export interface ProcessGroup {
163
+ /** Index of the first block in the group. */
164
+ start: number;
165
+ /**
166
+ * Exclusive end of the whole stretch, including the answer and any process
167
+ * work that settled behind it. Those are the run's work too, so the header
168
+ * counts them; they render as the run's rows around the answer, which keeps
169
+ * the rows in the order the events arrived.
170
+ *
171
+ * The run's own members end at its {@link ProcessGroup.answer} when it had
172
+ * one — that is where a reply enters — and at this boundary otherwise, so
173
+ * there is no separate member end to keep in step.
174
+ */
175
+ until: number;
176
+ /**
177
+ * The reply that closed the run, when the stretch had one.
178
+ *
179
+ * It is the turn's answer, not part of the run: the run's work sits above and
180
+ * around it, and its words render as a row of their own. Naming it keeps the
181
+ * run's members, the answer and the work behind it from overlapping, which is
182
+ * how a run ended up painting its own header twice, or folding the reply it
183
+ * was supposed to leave visible.
184
+ */
185
+ answer?: number;
186
+ /**
187
+ * The run took the answer's step's thought as its last row, so those words
188
+ * are painted without it. The step is always {@link ProcessGroup.answer}, so
189
+ * this is a flag rather than a second index into the same block.
190
+ */
191
+ tookThought: boolean;
192
+ /** How many tool calls the run made. */
193
+ calls: number;
194
+ /** Failed calls and independent process notices in this run. */
195
+ failures: number;
196
+ /** True while the group still holds a call in flight or a thought still arriving. */
197
+ live: boolean;
198
+ /** The turn the run belongs to, when any of its steps says. */
199
+ turn?: number;
200
+ /**
201
+ * Identity derived from the group's first block, so a group that grows as the
202
+ * agent keeps working is still the same group to the reader who opened it.
203
+ */
204
+ key: string;
205
+ }
206
+ /**
207
+ * Project the transcript's turns into runs without touching the block list.
208
+ *
209
+ * A stretch of process blocks from one turn is one run. If the stretch ends on
210
+ * a reply, that reply is the turn's answer and stays outside; any reply before
211
+ * it was written on the way and is part of the run. A prompt, the per-turn
212
+ * changed-file record, or any notice that speaks to the reader ends the stretch,
213
+ * and so does a block from another turn — two turns with no prompt between
214
+ * them, such as a goal continuing itself, still read as two runs.
215
+ *
216
+ * The block list is deliberately left alone: a group is a rendering decision, so
217
+ * search, focus, and the row offsets keep addressing real blocks, and a group
218
+ * that is still growing cannot invalidate anything a reader already saw.
219
+ */
220
+ export declare function processGroups(blocks: readonly Block[]): ProcessGroup[];
221
+ /**
222
+ * The runs as the reader sees them now: {@link processGroups}, with the run a
223
+ * running turn is still adding to marked live.
224
+ *
225
+ * That run is live even between two events, when nothing is in flight — the
226
+ * model is choosing what to do next — and while the answer streams below it,
227
+ * so it becomes a group once, when the turn ends, rather than folding and
228
+ * unfolding at every pause. The host aims Ctrl+O with the same projection the
229
+ * renderer paints, so the two cannot disagree about what is folded.
230
+ */
231
+ export declare function turnGroups(state: TranscriptState): ProcessGroup[];
140
232
  /** Rows moved per Shift+Arrow (OMP ScrollView `fastScrollLines`). */
141
233
  export declare const TRANSCRIPT_FAST_SCROLL = 5;
142
234
  /**
143
235
  * Window `body` into `budget` rows with ↑/↓ overflow markers.
144
236
  * `start` is the first body row to keep; non-finite values pin to the tail.
237
+ *
238
+ * `documentRows` says which of `body`'s rows the returned lines are, and where
239
+ * in the returned lines they start. A window that is nothing but an overflow
240
+ * marker carries none: `null`, because the frame drew no body rather than
241
+ * because the caller forgot to say.
145
242
  */
146
243
  export declare function windowTranscript(body: readonly string[], budget: number, start: number, theme: Theme): TranscriptScroll & {
147
244
  lines: string[];
@@ -167,6 +264,8 @@ export declare function renderInspectBanner(inspected: TuiInspectedSubagent | un
167
264
  * The row is bounded to a single line so it cannot squeeze the transcript.
168
265
  */
169
266
  export declare function renderTurnError(text: string, theme: Theme, width: number): string[];
267
+ /** Human guidance remains visible until the Harness claims it for a model step. */
268
+ export declare function renderSteering(inbox: readonly UserMessage[], theme: Theme, width: number): string[];
170
269
  /** Compact, unframed pending-message view placed immediately above the composer. */
171
270
  export declare function renderQueuedSubmissions(submissions: readonly TuiSubmission[], theme: Theme, width: number, inbox?: readonly UserMessage[]): string[];
172
271
  /**