@esso0428/pi-subagents 0.17.16 → 0.17.17

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 (359) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/ROADMAP.md +87 -0
  3. package/docs/post-0.17.6-agents-roster-viewer-spec.md +42 -0
  4. package/docs/post-0.17.6-durable-history-spec.md +41 -0
  5. package/docs/post-0.17.6-feature-specs.md +50 -0
  6. package/docs/post-0.17.6-nested-agents-spec.md +38 -0
  7. package/docs/post-0.17.6-recovery-shutdown-spec.md +46 -0
  8. package/docs/post-0.17.6-ui-latency-baseline-spec.md +46 -0
  9. package/docs/post-0.17.6-workflow-rpc-lifecycle-spec.md +54 -0
  10. package/package.json +1 -1
  11. package/src/agent-history.ts +2 -54
  12. package/src/agent-manager.ts +406 -1288
  13. package/src/agent-runner.ts +27 -251
  14. package/src/agent-types.ts +32 -188
  15. package/src/cross-extension-rpc.ts +20 -96
  16. package/src/custom-agents.ts +13 -170
  17. package/src/index.ts +480 -1920
  18. package/src/invocation-config.ts +3 -118
  19. package/src/model-resolver.ts +0 -18
  20. package/src/output-file.ts +6 -61
  21. package/src/prompts.ts +2 -45
  22. package/src/schedule.ts +14 -35
  23. package/src/settings.ts +2 -301
  24. package/src/status-note.ts +1 -66
  25. package/src/types.ts +10 -177
  26. package/src/ui/agent-widget.ts +57 -278
  27. package/src/ui/conversation-blocks.ts +0 -6
  28. package/src/ui/conversation-timeline.ts +25 -139
  29. package/src/ui/conversation-viewer.ts +48 -212
  30. package/src/ui/schedule-menu.ts +8 -9
  31. package/src/usage.ts +2 -109
  32. package/src/worktree.ts +55 -69
  33. package/dist/abortable.d.ts +0 -13
  34. package/dist/abortable.d.ts.map +0 -1
  35. package/dist/abortable.js +0 -43
  36. package/dist/abortable.js.map +0 -1
  37. package/dist/agent-color.d.ts +0 -36
  38. package/dist/agent-color.d.ts.map +0 -1
  39. package/dist/agent-color.js +0 -124
  40. package/dist/agent-color.js.map +0 -1
  41. package/dist/agent-file-toggle.d.ts +0 -126
  42. package/dist/agent-file-toggle.d.ts.map +0 -1
  43. package/dist/agent-file-toggle.js +0 -259
  44. package/dist/agent-file-toggle.js.map +0 -1
  45. package/dist/agent-history-list.d.ts +0 -19
  46. package/dist/agent-history-list.d.ts.map +0 -1
  47. package/dist/agent-history-list.js +0 -69
  48. package/dist/agent-history-list.js.map +0 -1
  49. package/dist/agent-history.d.ts +0 -35
  50. package/dist/agent-history.d.ts.map +0 -1
  51. package/dist/agent-history.js +0 -188
  52. package/dist/agent-history.js.map +0 -1
  53. package/dist/agent-manager.d.ts +0 -503
  54. package/dist/agent-manager.d.ts.map +0 -1
  55. package/dist/agent-manager.js +0 -1572
  56. package/dist/agent-manager.js.map +0 -1
  57. package/dist/agent-recovery.d.ts +0 -37
  58. package/dist/agent-recovery.d.ts.map +0 -1
  59. package/dist/agent-recovery.js +0 -171
  60. package/dist/agent-recovery.js.map +0 -1
  61. package/dist/agent-runner.d.ts +0 -303
  62. package/dist/agent-runner.d.ts.map +0 -1
  63. package/dist/agent-runner.js +0 -1003
  64. package/dist/agent-runner.js.map +0 -1
  65. package/dist/agent-types.d.ts +0 -120
  66. package/dist/agent-types.d.ts.map +0 -1
  67. package/dist/agent-types.js +0 -301
  68. package/dist/agent-types.js.map +0 -1
  69. package/dist/child-context.d.ts +0 -3
  70. package/dist/child-context.d.ts.map +0 -1
  71. package/dist/child-context.js +0 -13
  72. package/dist/child-context.js.map +0 -1
  73. package/dist/context.d.ts +0 -13
  74. package/dist/context.d.ts.map +0 -1
  75. package/dist/context.js +0 -57
  76. package/dist/context.js.map +0 -1
  77. package/dist/cross-extension-rpc.d.ts +0 -67
  78. package/dist/cross-extension-rpc.d.ts.map +0 -1
  79. package/dist/cross-extension-rpc.js +0 -139
  80. package/dist/cross-extension-rpc.js.map +0 -1
  81. package/dist/custom-agents.d.ts +0 -55
  82. package/dist/custom-agents.d.ts.map +0 -1
  83. package/dist/custom-agents.js +0 -309
  84. package/dist/custom-agents.js.map +0 -1
  85. package/dist/default-agents.d.ts +0 -8
  86. package/dist/default-agents.d.ts.map +0 -1
  87. package/dist/default-agents.js +0 -123
  88. package/dist/default-agents.js.map +0 -1
  89. package/dist/enabled-models.d.ts +0 -50
  90. package/dist/enabled-models.d.ts.map +0 -1
  91. package/dist/enabled-models.js +0 -146
  92. package/dist/enabled-models.js.map +0 -1
  93. package/dist/env.d.ts +0 -7
  94. package/dist/env.d.ts.map +0 -1
  95. package/dist/env.js +0 -29
  96. package/dist/env.js.map +0 -1
  97. package/dist/group-join.d.ts +0 -33
  98. package/dist/group-join.d.ts.map +0 -1
  99. package/dist/group-join.js +0 -117
  100. package/dist/group-join.js.map +0 -1
  101. package/dist/index.d.ts +0 -51
  102. package/dist/index.d.ts.map +0 -1
  103. package/dist/index.js +0 -3687
  104. package/dist/index.js.map +0 -1
  105. package/dist/invocation-config.d.ts +0 -108
  106. package/dist/invocation-config.d.ts.map +0 -1
  107. package/dist/invocation-config.js +0 -84
  108. package/dist/invocation-config.js.map +0 -1
  109. package/dist/memory.d.ts +0 -54
  110. package/dist/memory.d.ts.map +0 -1
  111. package/dist/memory.js +0 -166
  112. package/dist/memory.js.map +0 -1
  113. package/dist/mention-clone.d.ts +0 -88
  114. package/dist/mention-clone.d.ts.map +0 -1
  115. package/dist/mention-clone.js +0 -154
  116. package/dist/mention-clone.js.map +0 -1
  117. package/dist/mention.d.ts +0 -82
  118. package/dist/mention.d.ts.map +0 -1
  119. package/dist/mention.js +0 -132
  120. package/dist/mention.js.map +0 -1
  121. package/dist/model-resolver.d.ts +0 -37
  122. package/dist/model-resolver.d.ts.map +0 -1
  123. package/dist/model-resolver.js +0 -96
  124. package/dist/model-resolver.js.map +0 -1
  125. package/dist/model-scope.d.ts +0 -50
  126. package/dist/model-scope.d.ts.map +0 -1
  127. package/dist/model-scope.js +0 -49
  128. package/dist/model-scope.js.map +0 -1
  129. package/dist/nested-tools.d.ts +0 -57
  130. package/dist/nested-tools.d.ts.map +0 -1
  131. package/dist/nested-tools.js +0 -301
  132. package/dist/nested-tools.js.map +0 -1
  133. package/dist/nico-overrides.d.ts +0 -54
  134. package/dist/nico-overrides.d.ts.map +0 -1
  135. package/dist/nico-overrides.js +0 -170
  136. package/dist/nico-overrides.js.map +0 -1
  137. package/dist/output-file.d.ts +0 -44
  138. package/dist/output-file.d.ts.map +0 -1
  139. package/dist/output-file.js +0 -156
  140. package/dist/output-file.js.map +0 -1
  141. package/dist/prompts.d.ts +0 -56
  142. package/dist/prompts.d.ts.map +0 -1
  143. package/dist/prompts.js +0 -92
  144. package/dist/prompts.js.map +0 -1
  145. package/dist/schedule-store.d.ts +0 -39
  146. package/dist/schedule-store.d.ts.map +0 -1
  147. package/dist/schedule-store.js +0 -156
  148. package/dist/schedule-store.js.map +0 -1
  149. package/dist/schedule.d.ts +0 -110
  150. package/dist/schedule.d.ts.map +0 -1
  151. package/dist/schedule.js +0 -360
  152. package/dist/schedule.js.map +0 -1
  153. package/dist/settings.d.ts +0 -354
  154. package/dist/settings.d.ts.map +0 -1
  155. package/dist/settings.js +0 -247
  156. package/dist/settings.js.map +0 -1
  157. package/dist/skill-loader.d.ts +0 -25
  158. package/dist/skill-loader.d.ts.map +0 -1
  159. package/dist/skill-loader.js +0 -94
  160. package/dist/skill-loader.js.map +0 -1
  161. package/dist/status-note.d.ts +0 -62
  162. package/dist/status-note.d.ts.map +0 -1
  163. package/dist/status-note.js +0 -86
  164. package/dist/status-note.js.map +0 -1
  165. package/dist/structured-output.d.ts +0 -62
  166. package/dist/structured-output.d.ts.map +0 -1
  167. package/dist/structured-output.js +0 -113
  168. package/dist/structured-output.js.map +0 -1
  169. package/dist/types.d.ts +0 -372
  170. package/dist/types.d.ts.map +0 -1
  171. package/dist/types.js +0 -6
  172. package/dist/types.js.map +0 -1
  173. package/dist/ui/agent-mention.d.ts +0 -83
  174. package/dist/ui/agent-mention.d.ts.map +0 -1
  175. package/dist/ui/agent-mention.js +0 -188
  176. package/dist/ui/agent-mention.js.map +0 -1
  177. package/dist/ui/agent-widget.d.ts +0 -241
  178. package/dist/ui/agent-widget.d.ts.map +0 -1
  179. package/dist/ui/agent-widget.js +0 -992
  180. package/dist/ui/agent-widget.js.map +0 -1
  181. package/dist/ui/ccstyle/diff/ansi-utils.d.ts +0 -11
  182. package/dist/ui/ccstyle/diff/ansi-utils.d.ts.map +0 -1
  183. package/dist/ui/ccstyle/diff/ansi-utils.js +0 -145
  184. package/dist/ui/ccstyle/diff/ansi-utils.js.map +0 -1
  185. package/dist/ui/ccstyle/diff/diff-presentation.d.ts +0 -12
  186. package/dist/ui/ccstyle/diff/diff-presentation.d.ts.map +0 -1
  187. package/dist/ui/ccstyle/diff/diff-presentation.js +0 -48
  188. package/dist/ui/ccstyle/diff/diff-presentation.js.map +0 -1
  189. package/dist/ui/ccstyle/diff/diff-renderer.d.ts +0 -46
  190. package/dist/ui/ccstyle/diff/diff-renderer.d.ts.map +0 -1
  191. package/dist/ui/ccstyle/diff/diff-renderer.js +0 -2049
  192. package/dist/ui/ccstyle/diff/diff-renderer.js.map +0 -1
  193. package/dist/ui/ccstyle/diff/line-width-safety.d.ts +0 -12
  194. package/dist/ui/ccstyle/diff/line-width-safety.d.ts.map +0 -1
  195. package/dist/ui/ccstyle/diff/line-width-safety.js +0 -58
  196. package/dist/ui/ccstyle/diff/line-width-safety.js.map +0 -1
  197. package/dist/ui/ccstyle/diff/render-utils.d.ts +0 -6
  198. package/dist/ui/ccstyle/diff/render-utils.d.ts.map +0 -1
  199. package/dist/ui/ccstyle/diff/render-utils.js +0 -25
  200. package/dist/ui/ccstyle/diff/render-utils.js.map +0 -1
  201. package/dist/ui/ccstyle/diff/shiki-highlight.d.ts +0 -19
  202. package/dist/ui/ccstyle/diff/shiki-highlight.d.ts.map +0 -1
  203. package/dist/ui/ccstyle/diff/shiki-highlight.js +0 -85
  204. package/dist/ui/ccstyle/diff/shiki-highlight.js.map +0 -1
  205. package/dist/ui/ccstyle/diff/types.d.ts +0 -22
  206. package/dist/ui/ccstyle/diff/types.d.ts.map +0 -1
  207. package/dist/ui/ccstyle/diff/types.js +0 -10
  208. package/dist/ui/ccstyle/diff/types.js.map +0 -1
  209. package/dist/ui/ccstyle/diff/write-display-utils.d.ts +0 -2
  210. package/dist/ui/ccstyle/diff/write-display-utils.d.ts.map +0 -1
  211. package/dist/ui/ccstyle/diff/write-display-utils.js +0 -12
  212. package/dist/ui/ccstyle/diff/write-display-utils.js.map +0 -1
  213. package/dist/ui/ccstyle/tool-renderer.d.ts +0 -17
  214. package/dist/ui/ccstyle/tool-renderer.d.ts.map +0 -1
  215. package/dist/ui/ccstyle/tool-renderer.js +0 -74
  216. package/dist/ui/ccstyle/tool-renderer.js.map +0 -1
  217. package/dist/ui/ccstyle/tool-result.d.ts +0 -44
  218. package/dist/ui/ccstyle/tool-result.d.ts.map +0 -1
  219. package/dist/ui/ccstyle/tool-result.js +0 -423
  220. package/dist/ui/ccstyle/tool-result.js.map +0 -1
  221. package/dist/ui/conversation-blocks.d.ts +0 -46
  222. package/dist/ui/conversation-blocks.d.ts.map +0 -1
  223. package/dist/ui/conversation-blocks.js +0 -313
  224. package/dist/ui/conversation-blocks.js.map +0 -1
  225. package/dist/ui/conversation-nvim.d.ts +0 -8
  226. package/dist/ui/conversation-nvim.d.ts.map +0 -1
  227. package/dist/ui/conversation-nvim.js +0 -117
  228. package/dist/ui/conversation-nvim.js.map +0 -1
  229. package/dist/ui/conversation-role.d.ts +0 -13
  230. package/dist/ui/conversation-role.d.ts.map +0 -1
  231. package/dist/ui/conversation-role.js +0 -39
  232. package/dist/ui/conversation-role.js.map +0 -1
  233. package/dist/ui/conversation-search.d.ts +0 -39
  234. package/dist/ui/conversation-search.d.ts.map +0 -1
  235. package/dist/ui/conversation-search.js +0 -124
  236. package/dist/ui/conversation-search.js.map +0 -1
  237. package/dist/ui/conversation-timeline.d.ts +0 -102
  238. package/dist/ui/conversation-timeline.d.ts.map +0 -1
  239. package/dist/ui/conversation-timeline.js +0 -555
  240. package/dist/ui/conversation-timeline.js.map +0 -1
  241. package/dist/ui/conversation-viewer.d.ts +0 -138
  242. package/dist/ui/conversation-viewer.d.ts.map +0 -1
  243. package/dist/ui/conversation-viewer.js +0 -1175
  244. package/dist/ui/conversation-viewer.js.map +0 -1
  245. package/dist/ui/schedule-menu.d.ts +0 -17
  246. package/dist/ui/schedule-menu.d.ts.map +0 -1
  247. package/dist/ui/schedule-menu.js +0 -95
  248. package/dist/ui/schedule-menu.js.map +0 -1
  249. package/dist/ui/select-item.d.ts +0 -28
  250. package/dist/ui/select-item.d.ts.map +0 -1
  251. package/dist/ui/select-item.js +0 -35
  252. package/dist/ui/select-item.js.map +0 -1
  253. package/dist/ui/viewer-keys.d.ts +0 -21
  254. package/dist/ui/viewer-keys.d.ts.map +0 -1
  255. package/dist/ui/viewer-keys.js +0 -18
  256. package/dist/ui/viewer-keys.js.map +0 -1
  257. package/dist/ui/workflow-card.d.ts +0 -176
  258. package/dist/ui/workflow-card.d.ts.map +0 -1
  259. package/dist/ui/workflow-card.js +0 -333
  260. package/dist/ui/workflow-card.js.map +0 -1
  261. package/dist/ui/workflow-dialog.d.ts +0 -306
  262. package/dist/ui/workflow-dialog.d.ts.map +0 -1
  263. package/dist/ui/workflow-dialog.js +0 -844
  264. package/dist/ui/workflow-dialog.js.map +0 -1
  265. package/dist/ui/workflow-menu.d.ts +0 -42
  266. package/dist/ui/workflow-menu.d.ts.map +0 -1
  267. package/dist/ui/workflow-menu.js +0 -127
  268. package/dist/ui/workflow-menu.js.map +0 -1
  269. package/dist/usage.d.ts +0 -136
  270. package/dist/usage.d.ts.map +0 -1
  271. package/dist/usage.js +0 -121
  272. package/dist/usage.js.map +0 -1
  273. package/dist/workflow/collisions.d.ts +0 -96
  274. package/dist/workflow/collisions.d.ts.map +0 -1
  275. package/dist/workflow/collisions.js +0 -89
  276. package/dist/workflow/collisions.js.map +0 -1
  277. package/dist/workflow/entry.d.ts +0 -33
  278. package/dist/workflow/entry.d.ts.map +0 -1
  279. package/dist/workflow/entry.js +0 -30
  280. package/dist/workflow/entry.js.map +0 -1
  281. package/dist/workflow/host.d.ts +0 -63
  282. package/dist/workflow/host.d.ts.map +0 -1
  283. package/dist/workflow/host.js +0 -363
  284. package/dist/workflow/host.js.map +0 -1
  285. package/dist/workflow/journal.d.ts +0 -98
  286. package/dist/workflow/journal.d.ts.map +0 -1
  287. package/dist/workflow/journal.js +0 -121
  288. package/dist/workflow/journal.js.map +0 -1
  289. package/dist/workflow/json-schema.d.ts +0 -52
  290. package/dist/workflow/json-schema.d.ts.map +0 -1
  291. package/dist/workflow/json-schema.js +0 -112
  292. package/dist/workflow/json-schema.js.map +0 -1
  293. package/dist/workflow/meta.d.ts +0 -68
  294. package/dist/workflow/meta.d.ts.map +0 -1
  295. package/dist/workflow/meta.js +0 -318
  296. package/dist/workflow/meta.js.map +0 -1
  297. package/dist/workflow/progress.d.ts +0 -225
  298. package/dist/workflow/progress.d.ts.map +0 -1
  299. package/dist/workflow/progress.js +0 -362
  300. package/dist/workflow/progress.js.map +0 -1
  301. package/dist/workflow/runtime.d.ts +0 -335
  302. package/dist/workflow/runtime.d.ts.map +0 -1
  303. package/dist/workflow/runtime.js +0 -831
  304. package/dist/workflow/runtime.js.map +0 -1
  305. package/dist/workflow/saved.d.ts +0 -91
  306. package/dist/workflow/saved.d.ts.map +0 -1
  307. package/dist/workflow/saved.js +0 -204
  308. package/dist/workflow/saved.js.map +0 -1
  309. package/dist/workflow/task.d.ts +0 -137
  310. package/dist/workflow/task.d.ts.map +0 -1
  311. package/dist/workflow/task.js +0 -208
  312. package/dist/workflow/task.js.map +0 -1
  313. package/dist/workflow/tool-description.d.ts +0 -39
  314. package/dist/workflow/tool-description.d.ts.map +0 -1
  315. package/dist/workflow/tool-description.js +0 -200
  316. package/dist/workflow/tool-description.js.map +0 -1
  317. package/dist/workflow/worker-source.d.ts +0 -48
  318. package/dist/workflow/worker-source.d.ts.map +0 -1
  319. package/dist/workflow/worker-source.js +0 -779
  320. package/dist/workflow/worker-source.js.map +0 -1
  321. package/dist/worktree.d.ts +0 -53
  322. package/dist/worktree.d.ts.map +0 -1
  323. package/dist/worktree.js +0 -165
  324. package/dist/worktree.js.map +0 -1
  325. package/dist/write-execution.d.ts +0 -42
  326. package/dist/write-execution.d.ts.map +0 -1
  327. package/dist/write-execution.js +0 -138
  328. package/dist/write-execution.js.map +0 -1
  329. package/dist/xml.d.ts +0 -11
  330. package/dist/xml.d.ts.map +0 -1
  331. package/dist/xml.js +0 -13
  332. package/dist/xml.js.map +0 -1
  333. package/src/abortable.ts +0 -43
  334. package/src/agent-color.ts +0 -161
  335. package/src/agent-file-toggle.ts +0 -269
  336. package/src/child-context.ts +0 -15
  337. package/src/mention-clone.ts +0 -196
  338. package/src/mention.ts +0 -141
  339. package/src/model-scope.ts +0 -70
  340. package/src/nested-tools.ts +0 -424
  341. package/src/structured-output.ts +0 -130
  342. package/src/ui/agent-mention.ts +0 -216
  343. package/src/ui/select-item.ts +0 -45
  344. package/src/ui/workflow-card.ts +0 -470
  345. package/src/ui/workflow-dialog.ts +0 -1115
  346. package/src/ui/workflow-menu.ts +0 -166
  347. package/src/workflow/collisions.ts +0 -123
  348. package/src/workflow/entry.ts +0 -47
  349. package/src/workflow/host.ts +0 -403
  350. package/src/workflow/journal.ts +0 -164
  351. package/src/workflow/json-schema.ts +0 -128
  352. package/src/workflow/meta.ts +0 -325
  353. package/src/workflow/progress.ts +0 -550
  354. package/src/workflow/runtime.ts +0 -1219
  355. package/src/workflow/saved.ts +0 -217
  356. package/src/workflow/task.ts +0 -302
  357. package/src/workflow/tool-description.ts +0 -200
  358. package/src/workflow/worker-source.ts +0 -781
  359. package/src/xml.ts +0 -13
@@ -1,333 +0,0 @@
1
- /**
2
- * workflow-card.ts — the inline transcript card for a running workflow.
3
- *
4
- * ```
5
- * ▸ Workflow review-changes 3/7 agents · 1m12s
6
- * Review changed files across dimensions, verify each finding
7
- * ╭─ Review
8
- * │ ├─ ✔ review:bugs · Explore · haiku · 18.4k · 12 tool calls · 42s
9
- * │ ├─ ⟳ review:perf · Explore · 8 tool calls · 21s
10
- * │ └─ ⟳ review:security
11
- * ╰─ Verify
12
- * └─ ⟳ verify:auth.ts · Plan · 3 tool calls · 9s
13
- * ⎿ scanned 41 changed files
14
- * ```
15
- *
16
- * Two things about this file are easy to get wrong.
17
- *
18
- * **The glyphs are not the dialog's glyphs.** The inline row keys off the *raw*
19
- * entry `state` (start | progress | done | error), not the derived display
20
- * state, so a skipped or blocked agent renders as a plain ✘ here while the
21
- * workflows dialog distinguishes them. `displayState` is deliberately not
22
- * consulted below.
23
- *
24
- * **The layout is pure.** `layoutWorkflowCard` returns coloured segments and
25
- * never touches a theme or a terminal, so the same layout drives the `Workflow`
26
- * tool's `renderResult` and a standalone session entry (a workflow launched from
27
- * a CLI flag has no tool call to attach to). Theme application is the thin
28
- * `styleWorkflowCardLines` wrapper on top.
29
- *
30
- * All state derivation lives in `src/workflow/progress.ts`; this file only
31
- * arranges what that module returns.
32
- */
33
- import { stripTerminalSequences, Text, truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
34
- import { buildPhaseGroups, collapse, formatDuration, header, sizeWarning, stats, } from "../workflow/progress.js";
35
- /**
36
- * Header re-render cadence. Claude Code ticks the workflow clock once a second,
37
- * not at the 80ms spinner cadence — the running glyph is static, so there is
38
- * nothing to animate faster than the elapsed time changes.
39
- */
40
- export const WORKFLOW_TICK_MS = 1000;
41
- /** Widest label column before stats stop being aligned and just follow the label. */
42
- const LABEL_COLUMN_MAX = 28;
43
- /** Fallback width when the caller does not know the terminal's. */
44
- const DEFAULT_WIDTH = 80;
45
- export const UNICODE_GLYPHS = {
46
- pointer: "▸",
47
- tick: "✔",
48
- cross: "✘",
49
- running: "⟳",
50
- groupTop: "╭─",
51
- groupMid: "├─",
52
- groupBottom: "╰─",
53
- vertical: "│",
54
- branch: "├─",
55
- lastBranch: "└─",
56
- log: "⎿",
57
- warning: "⚠",
58
- };
59
- /**
60
- * The `figures` ASCII tier, for terminals that cannot draw the box set. Every
61
- * glyph keeps its unicode counterpart's column width so the tree stays aligned
62
- * either way.
63
- */
64
- export const ASCII_GLYPHS = {
65
- pointer: ">",
66
- tick: "√",
67
- cross: "×",
68
- running: "*",
69
- groupTop: ",-",
70
- groupMid: "|-",
71
- groupBottom: "`-",
72
- vertical: "|",
73
- branch: "|-",
74
- lastBranch: "`-",
75
- log: "\\",
76
- warning: "!",
77
- };
78
- /* ------------------------------------------------------------------------- *
79
- * Formatting
80
- * ------------------------------------------------------------------------- */
81
- /** `18.4k` / `1.2M` — bare magnitude, since the row already reads as a stat. */
82
- export function formatCompactTokens(count) {
83
- if (count >= 1_000_000)
84
- return `${(count / 1_000_000).toFixed(1)}M`;
85
- if (count >= 1_000)
86
- return `${(count / 1_000).toFixed(1)}k`;
87
- return `${count}`;
88
- }
89
- /**
90
- * One label for the model pair. A fallback that never differed from the primary
91
- * would just be noise, so it only shows when the run actually has two models in
92
- * play.
93
- */
94
- export function formatModel(entry, opts) {
95
- const { fallbackModel, requestedModel } = entry;
96
- // `canonical` is for surfaces with the width for `provider/model-id`; the
97
- // tight rows take the short label. Chosen here rather than by the caller
98
- // swapping fields, which would leave `fallbackModel` in the other spelling.
99
- const model = opts?.canonical ? entry.modelId ?? entry.model : entry.model;
100
- const primary = model && fallbackModel && model !== fallbackModel ? `${model}→${fallbackModel}` : model ?? fallbackModel;
101
- if (primary === undefined)
102
- return undefined;
103
- // Disclosed rather than substituted: a model an agent file pinned over the
104
- // script's is still a model the script did not get (#182). Same rule as
105
- // `buildInvocationTags`' `asked()` — only when the two actually differ, so a
106
- // request that was honoured says nothing.
107
- return requestedModel !== undefined && requestedModel !== primary
108
- ? `${primary} (asked ${requestedModel})`
109
- : primary;
110
- }
111
- /**
112
- * The thinking level, and what was asked for when it was not honoured.
113
- *
114
- * Separate from {@link formatModel} because a row can have one without the
115
- * other: an `agent()` that named no model still runs at some level, and a level
116
- * pi clamped is worth saying so about even when the model is unremarkable.
117
- */
118
- export function formatThinking(entry) {
119
- const { thinking, requestedThinking } = entry;
120
- if (!thinking)
121
- return undefined;
122
- return requestedThinking !== undefined && requestedThinking !== thinking
123
- ? `thinking: ${thinking} (asked ${requestedThinking})`
124
- : `thinking: ${thinking}`;
125
- }
126
- /**
127
- * What a row replayed from a resume journal says instead of a duration.
128
- *
129
- * Shared with the dialog so both views name the same thing the same way — the
130
- * card shows it inline while the run happens, the dialog on the agent's row.
131
- */
132
- export const REPLAYED_ANNOTATION = "from resume journal";
133
- /**
134
- * The `·`-separated tail of an agent row, in the recovered order: agentType,
135
- * model, tokens, toolCalls, durationMs. Absent values drop out entirely rather
136
- * than rendering a placeholder.
137
- */
138
- export function agentStatSegments(entry) {
139
- const parts = [];
140
- if (entry.agentType)
141
- parts.push(entry.agentType);
142
- const model = formatModel(entry);
143
- if (model)
144
- parts.push(model);
145
- if (entry.tokens)
146
- parts.push(formatCompactTokens(entry.tokens));
147
- if (entry.toolCalls)
148
- parts.push(`${entry.toolCalls} tool call${entry.toolCalls === 1 ? "" : "s"}`);
149
- if (entry.durationMs)
150
- parts.push(formatDuration(entry.durationMs));
151
- return parts;
152
- }
153
- /**
154
- * The recovered inline mapping — keyed on the raw entry state. `skipped` and
155
- * `blocked` are not distinguished here; that is the dialog's job.
156
- */
157
- function rowGlyph(entry, glyphs) {
158
- if (entry.state === "done")
159
- return { text: glyphs.tick, color: "success" };
160
- if (entry.state === "error")
161
- return { text: glyphs.cross, color: "error" };
162
- return { text: glyphs.running };
163
- }
164
- /* ------------------------------------------------------------------------- *
165
- * Layout
166
- * ------------------------------------------------------------------------- */
167
- /** Trim a line to `width`, cutting inside whichever segment crosses the edge. */
168
- export function clampLine(line, width) {
169
- const clamped = [];
170
- let used = 0;
171
- for (const segment of line) {
172
- const segmentWidth = visibleWidth(segment.text);
173
- if (used + segmentWidth <= width) {
174
- clamped.push(segment);
175
- used += segmentWidth;
176
- continue;
177
- }
178
- const room = width - used;
179
- // truncateToWidth wraps its ellipsis in resets, which would leak escape
180
- // codes into a layout that is supposed to be plain text until it is themed.
181
- if (room > 0) {
182
- clamped.push({ ...segment, text: stripTerminalSequences(truncateToWidth(segment.text, room, "…")) });
183
- }
184
- return clamped;
185
- }
186
- return clamped;
187
- }
188
- const lineWidth = (line) => line.reduce((sum, s) => sum + visibleWidth(s.text), 0);
189
- /**
190
- * Build the card.
191
- *
192
- * Everything derived — the phase tree, the header counts, the logs, the size
193
- * warning — comes from `progress.ts`; what happens here is purely arrangement.
194
- */
195
- export function layoutWorkflowCard(input) {
196
- const glyphs = input.ascii ? ASCII_GLYPHS : UNICODE_GLYPHS;
197
- const width = Math.max(1, input.width ?? DEFAULT_WIDTH);
198
- const now = input.now ?? Date.now();
199
- const groups = buildPhaseGroups(input.progress, input.meta?.phases);
200
- const { agents, logs } = collapse(input.progress);
201
- const totals = stats(input.progress, input.agentCount ?? 0);
202
- const head = header(input.task, input.meta, groups, input.agentCount ?? 0, now);
203
- const lines = [];
204
- // ---- Header: `<name>` with the stats flush right ----
205
- // The tool name appears only when nothing above the card already carries it.
206
- // As a tool result there is a `▸ SubagentWorkflow …` call line directly above,
207
- // and repeating it put two near-identical pointer lines back to back.
208
- const left = input.showToolTitle
209
- ? [
210
- { text: `${glyphs.pointer} `, color: "toolTitle" },
211
- { text: "SubagentWorkflow", color: "toolTitle", bold: true },
212
- { text: " " },
213
- { text: head.name, color: "muted" },
214
- ]
215
- : [{ text: " " }, { text: head.name, color: "toolTitle", bold: true }];
216
- const statsWidth = visibleWidth(head.stats);
217
- const clampedLeft = clampLine(left, Math.max(0, width - statsWidth - 1));
218
- const gap = Math.max(1, width - lineWidth(clampedLeft) - statsWidth);
219
- lines.push([...clampedLeft, { text: " ".repeat(gap) }, { text: head.stats, color: "dim" }]);
220
- if (head.subtext)
221
- lines.push(clampLine([{ text: ` ${head.subtext}`, color: "dim" }], width));
222
- // ---- Phase tree ----
223
- // Stats line up in one column across the whole card, not per group, so the
224
- // eye can scan them; a label past the cap just pushes its own stats along.
225
- const labelColumn = Math.min(LABEL_COLUMN_MAX, Math.max(0, ...groups.flatMap(group => group.agents.map(a => visibleWidth(a.label)))));
226
- groups.forEach((group, groupIndex) => {
227
- const lastGroup = groupIndex === groups.length - 1;
228
- lines.push(clampLine([
229
- { text: " " },
230
- // One box, not a stack of them: only the first group opens it and
231
- // only the last closes it. Everything between branches off the side,
232
- // or three phases read as three half-drawn boxes.
233
- {
234
- text: `${lastGroup ? glyphs.groupBottom
235
- : groupIndex === 0 ? glyphs.groupTop
236
- : glyphs.groupMid} `,
237
- color: "dim",
238
- },
239
- { text: group.title },
240
- ], width));
241
- const rail = lastGroup ? " " : `${glyphs.vertical} `;
242
- group.agents.forEach((entry, agentIndex) => {
243
- const lastAgent = agentIndex === group.agents.length - 1;
244
- const segments = [
245
- { text: " " },
246
- { text: rail, color: "dim" },
247
- { text: `${lastAgent ? glyphs.lastBranch : glyphs.branch} `, color: "dim" },
248
- rowGlyph(entry, glyphs),
249
- { text: " " },
250
- ];
251
- // Prepended rather than folded into `agentStatSegments`, which is the
252
- // ported stat tail in its recovered order. A replayed agent otherwise
253
- // renders as a tick with no tokens and no duration — indistinguishable
254
- // from one that somehow did the work for free.
255
- const statParts = entry.cached
256
- ? [REPLAYED_ANNOTATION, ...agentStatSegments(entry)]
257
- : agentStatSegments(entry);
258
- const pad = Math.max(0, labelColumn - visibleWidth(entry.label));
259
- segments.push({ text: statParts.length > 0 ? entry.label + " ".repeat(pad) : entry.label });
260
- for (const part of statParts) {
261
- segments.push({ text: " · ", color: "dim" }, { text: part, color: "dim" });
262
- }
263
- lines.push(clampLine(segments, width));
264
- });
265
- });
266
- // ---- log() output, below the tree ----
267
- for (const message of logs) {
268
- const [first, ...rest] = message.split("\n");
269
- lines.push(clampLine([{ text: ` ${glyphs.log} ${first}`, color: "dim" }], width));
270
- for (const continuation of rest) {
271
- lines.push(clampLine([{ text: ` ${continuation}`, color: "dim" }], width));
272
- }
273
- }
274
- // ---- Size warning ----
275
- const totalTokens = input.totalTokens ?? agents.reduce((sum, entry) => sum + (entry.tokens ?? 0), 0);
276
- const warning = sizeWarning({
277
- scheduledAgents: Math.max(input.agentCount ?? 0, totals.total),
278
- startedAgents: totals.started,
279
- totalTokens,
280
- agentCap: input.agentCap,
281
- tokenCap: input.tokenCap,
282
- });
283
- if (warning) {
284
- lines.push(clampLine([{ text: ` ${glyphs.warning} Large workflow · /agents → Workflows to stop`, color: "warning" }], width));
285
- }
286
- return lines;
287
- }
288
- /* ------------------------------------------------------------------------- *
289
- * Rendering
290
- * ------------------------------------------------------------------------- */
291
- /** The card as plain text — what the layout tests assert against. */
292
- export function plainWorkflowCardLines(lines) {
293
- return lines.map(line => line.map(segment => segment.text).join(""));
294
- }
295
- /** Apply the theme. Nothing here changes the layout, only its colours. */
296
- export function styleWorkflowCardLines(lines, theme) {
297
- return lines.map(line => line
298
- .map(segment => {
299
- const text = segment.bold ? theme.bold(segment.text) : segment.text;
300
- return segment.color ? theme.fg(segment.color, text) : text;
301
- })
302
- .join(""));
303
- }
304
- /** The card as a component, for a tool result or a session entry renderer. */
305
- export function renderWorkflowCard(input, theme) {
306
- return new Text(styleWorkflowCardLines(layoutWorkflowCard(input), theme).join("\n"), 0, 0);
307
- }
308
- /**
309
- * The card for a session entry, from the JSON a flag-launched run persisted.
310
- *
311
- * The same layout the tool result uses, not a second one — the only difference
312
- * is `showToolTitle`, because a session entry stands alone and nothing above it
313
- * says what it is. Returns undefined for an entry with no data, which is what
314
- * pi's renderer contract wants for "nothing to draw".
315
- */
316
- export function renderWorkflowEntryCard(data, theme) {
317
- if (!data)
318
- return undefined;
319
- return renderWorkflowCard({
320
- progress: data.progress,
321
- task: {
322
- status: data.status,
323
- workflowName: data.name,
324
- startTime: data.startTime,
325
- endTime: data.endTime,
326
- },
327
- meta: data.meta,
328
- agentCount: data.agentCount,
329
- totalTokens: data.totalTokens,
330
- showToolTitle: true,
331
- }, theme);
332
- }
333
- //# sourceMappingURL=workflow-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OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;QACpE,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9D,CAAC,CAAC;SACD,IAAI,CAAC,EAAE,CAAC,CACZ,CAAC;AACJ,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,kBAAkB,CAAC,KAAwB,EAAE,KAAY;IACvE,OAAO,IAAI,IAAI,CAAC,sBAAsB,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAC7F,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAAmC,EAAE,KAAY;IACvF,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC;IAC5B,OAAO,kBAAkB,CACvB;QACE,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,IAAI,EAAE;YACJ,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,YAAY,EAAE,IAAI,CAAC,IAAI;YACvB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB;QACD,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,aAAa,EAAE,IAAI;KACpB,EACD,KAAK,CACN,CAAC;AACJ,CAAC"}
@@ -1,306 +0,0 @@
1
- /**
2
- * workflow-dialog.ts — the `/agents → Workflows` two-pane inspector.
3
- *
4
- * ```
5
- * review-changes
6
- * Review changed files across dimensions 3/7 agents · 1m12s
7
- *
8
- * ╭ Phases ──────────┬ Verify · 1 agent ──────────────────────────────╮
9
- * │ ❯ ✔ Review 3/3 │ ❯ ◌ verify:auth.ts · attempt 2 · waiting 8s │
10
- * │ 2 Verify 1/2 │ │
11
- * │ 3 Report │ │
12
- * ╰──────────────────┴────────────────────────────────────────────────╯
13
- * ↑↓ select · ⏎ open · f filter · x stop · esc close · c convo
14
- * ```
15
- *
16
- * Opening an agent swaps the panes: that phase's agents move left and the
17
- * right becomes the agent's Prompt / Activity / Outcome detail.
18
- *
19
- * A phase with no agents yet shows its number and nothing else. The single-pane
20
- * layout this replaced spelled that out as "Not started yet"; the left pane is
21
- * too narrow to hold the words, and a numbered row with no count says it.
22
- *
23
- * **The glyphs are not the card's glyphs.** `workflow-card.ts` keys off the raw
24
- * entry `state`; this file keys off the *derived* `displayState(entry, active)`
25
- * and splits cases the card cannot see — skipped, blocked, queued and
26
- * interrupted all render as a plain ✘ or ⟳ inline but are distinct here. `◌`
27
- * (U+25CC) appears only in this file, and a running row animates a spinner where
28
- * the card draws a static `⟳`.
29
- *
30
- * **The phases pane is stranger still**: a phase that has not finished shows
31
- * *its number*, not a glyph. That is deliberate, recovered behaviour.
32
- *
33
- * **The layout is pure.** `layoutWorkflowDialog` returns coloured segments and
34
- * `handleWorkflowDialogKey` maps a keypress to the next state plus an optional
35
- * action; neither touches a theme, a terminal, or the workflow runtime. The
36
- * `WorkflowDialog` component is the thin shell that wires those to `ctx.ui`, and
37
- * the runtime side arrives as an injected `WorkflowDialogActions`.
38
- *
39
- * All state derivation lives in `src/workflow/progress.ts`; this file only
40
- * arranges what that module returns.
41
- */
42
- import { type Component, type TUI } from "@earendil-works/pi-tui";
43
- import type { WorkflowMeta } from "../workflow/meta.js";
44
- import { type PhaseGroup, type WorkflowAgentEntry, type WorkflowDisplayState, type WorkflowEntry } from "../workflow/progress.js";
45
- import { type Theme } from "./agent-widget.js";
46
- import { type WorkflowCardLine, type WorkflowCardSegment, type WorkflowCardTask } from "./workflow-card.js";
47
- /**
48
- * Most rows the frame will ever draw between its top and bottom edges.
49
- *
50
- * A cap, not a height: the box sizes itself to what it holds, and this is where
51
- * it stops growing so a 200-agent fan-out scrolls inside the pane instead of
52
- * pasting 200 rows into the conversation.
53
- */
54
- export declare const DEFAULT_PANE_BODY_ROWS = 22;
55
- /**
56
- * Fewest rows the frame will draw.
57
- *
58
- * Below this a pane stops reading as a pane, and the box would resize on
59
- * nearly every keypress — most phases hold a handful of agents, so a floor here
60
- * absorbs the ordinary movement and leaves the height alone.
61
- */
62
- export declare const MIN_PANE_BODY_ROWS = 6;
63
- /** Prompt lines shown before `expand` is offered. */
64
- export declare const PROMPT_COLLAPSED_LINES = 4;
65
- /** Spinner cadence. Unlike the card's 1s header tick, this row really animates. */
66
- export declare const WORKFLOW_DIALOG_SPINNER_MS = 80;
67
- export interface WorkflowDialogGlyphs {
68
- tick: string;
69
- cross: string;
70
- /** `◌` — queued or interrupted. The card has no row that draws this. */
71
- queued: string;
72
- /** `figures.pointer` — the selected row in either pane. */
73
- pointer: string;
74
- /** Marks whichever pane currently owns j/k. */
75
- focus: string;
76
- /** Running rows cycle these. */
77
- spinner: readonly string[];
78
- /** The pane frame: corners, edges and the tee where the two panes meet. */
79
- box: {
80
- topLeft: string;
81
- topRight: string;
82
- bottomLeft: string;
83
- bottomRight: string;
84
- horizontal: string;
85
- vertical: string;
86
- topTee: string;
87
- bottomTee: string;
88
- };
89
- /** Trailing marker on a title the pane was too narrow to hold. */
90
- ellipsis: string;
91
- /** How the footer names the arrow keys and Enter. */
92
- upDown: string;
93
- enter: string;
94
- }
95
- export declare const UNICODE_DIALOG_GLYPHS: WorkflowDialogGlyphs;
96
- /** The ASCII tier, one column per glyph so the panes stay aligned either way. */
97
- export declare const ASCII_DIALOG_GLYPHS: WorkflowDialogGlyphs;
98
- /**
99
- * The recovered dialog mapping — keyed on the *display* state.
100
- *
101
- * Claude Code's `permission` colour has no pi equivalent; a blocked agent is
102
- * waiting on the user, so it maps to `warning` (selection maps to `accent`).
103
- */
104
- export declare function dialogRowGlyph(state: WorkflowDisplayState, glyphs: WorkflowDialogGlyphs, spinnerFrame?: number): WorkflowCardSegment;
105
- /**
106
- * Claude Code's own strings. Kept together and named so a reader can see at a
107
- * glance which surface each belongs to, and so none drifts under an edit.
108
- */
109
- export declare const WORKFLOW_DIALOG_COPY: {
110
- readonly waitingForSlot: "Waiting for an agent slot.";
111
- readonly availableOnceStarted: "Available once the agent starts.";
112
- readonly notAvailableYet: "Not available yet (agent still running).";
113
- readonly noTranscript: "Transcript not available.";
114
- readonly stoppedEarly: "The workflow stopped before this agent finished.";
115
- readonly skippedByUser: "Skipped by user.";
116
- readonly noToolCallsYet: "No tool calls yet.";
117
- readonly noToolCalls: "No tool calls.";
118
- readonly noAgents: "No agents";
119
- };
120
- /**
121
- * Which of the two drill-down levels is showing.
122
- *
123
- * `phases` is the overview — phases on the left, the selected phase's agents on
124
- * the right. `agent` is the subview reached by opening one: the same phase's
125
- * agents move to the left pane and the right pane becomes that agent's detail.
126
- * The panes never change count, only what they hold, which is what makes the
127
- * frame stay put as you drill in and back out.
128
- */
129
- export type WorkflowDialogLevel = "phases" | "agent";
130
- /** `all`, or exactly one display state. */
131
- export type WorkflowDialogFilter = "all" | WorkflowDisplayState;
132
- /** The order `f` cycles through. */
133
- export declare const WORKFLOW_DIALOG_FILTERS: readonly WorkflowDialogFilter[];
134
- export interface WorkflowDialogState {
135
- /** Raw selection; `clampedPhase` is what actually renders. */
136
- selectedPhase: number;
137
- selectedAgent: number;
138
- level: WorkflowDialogLevel;
139
- filter: WorkflowDialogFilter;
140
- promptExpanded: boolean;
141
- }
142
- export declare function initialWorkflowDialogState(initialPhaseIndex?: number): WorkflowDialogState;
143
- /** Everything the dialog reads about a run, so it can be driven from a stub. */
144
- export interface WorkflowDialogSource {
145
- progress: readonly WorkflowEntry[];
146
- task: WorkflowCardTask;
147
- meta?: WorkflowMeta;
148
- /** Agents the runtime has scheduled, which can exceed those that reported. */
149
- agentCount?: number;
150
- }
151
- export interface WorkflowDialogInput extends WorkflowDialogSource {
152
- state: WorkflowDialogState;
153
- /**
154
- * Which actions the caller actually wired. Absent keys default to available,
155
- * so layout tests and read-only callers keep the full footer; a caller that
156
- * wires only some actions passes the map so the hints stay truthful.
157
- */
158
- available?: Partial<Record<keyof WorkflowDialogActions, boolean>>;
159
- now?: number;
160
- /** The *terminal* width; the content width is derived from it. */
161
- width?: number;
162
- ascii?: boolean;
163
- spinnerFrame?: number;
164
- /**
165
- * Most rows the frame may use, overriding {@link DEFAULT_PANE_BODY_ROWS}.
166
- *
167
- * The frame still sizes to its content and still respects
168
- * {@link MIN_PANE_BODY_ROWS}; this only moves the ceiling.
169
- */
170
- bodyRows?: number;
171
- }
172
- /** The actions the dialog needs from the workflow runtime, injected. */
173
- export interface WorkflowDialogActions {
174
- onKill?(): void;
175
- onPause?(): void;
176
- onResume?(): void;
177
- /** `index` is the entry's stable `index`, not its row position. */
178
- onSkipAgent?(index: number): void;
179
- onRetryAgent?(index: number): void;
180
- /**
181
- * Open the selected agent's conversation.
182
- *
183
- * `recordId` is the manager's id for the child, which the entry carries once
184
- * the host has reported one — the dialog knows nothing about sessions, so
185
- * what happens to an id whose record has since been swept is the caller's to
186
- * say. The only key here that shows something rather than changing the run.
187
- */
188
- onOpenAgent?(recordId: string): void;
189
- }
190
- export type WorkflowDialogAction = {
191
- kind: "cancel";
192
- } | {
193
- kind: "kill";
194
- } | {
195
- kind: "pause";
196
- } | {
197
- kind: "resume";
198
- } | {
199
- kind: "skip";
200
- index: number;
201
- } | {
202
- kind: "retry";
203
- index: number;
204
- } | {
205
- kind: "open";
206
- recordId: string;
207
- };
208
- export interface ResolvedWorkflowDialog {
209
- groups: PhaseGroup[];
210
- clampedPhase: number;
211
- clampedAgent: number;
212
- /** The selected phase's agents, after the state filter. */
213
- visibleAgents: WorkflowAgentEntry[];
214
- selectedEntry: WorkflowAgentEntry | undefined;
215
- /** False once the run stops — which is what turns live agents "interrupted". */
216
- workflowActive: boolean;
217
- paused: boolean;
218
- }
219
- /** Content width. The 6 columns are the dialog's border and padding. */
220
- export declare function workflowDialogContentWidth(terminalWidth: number): number;
221
- /**
222
- * Settle the selection against the data actually present.
223
- *
224
- * Selection is stored raw and clamped on read, so a phase finishing (and its
225
- * agents dropping out of a filtered view) never leaves the cursor pointing past
226
- * the end — the same trick `fleet-list.ts` plays, minus the mutation.
227
- */
228
- export declare function resolveWorkflowDialog(input: WorkflowDialogInput): ResolvedWorkflowDialog;
229
- /**
230
- * The `·`-separated annotations between an agent's label and its stats.
231
- *
232
- * These say *why* a row looks the way it does — a retry and its cause, a cache
233
- * hit replayed from the resume journal, how long a queued agent has been
234
- * waiting. The stat tail (agentType, model, tokens, tool calls, duration) is the
235
- * card's and is appended after.
236
- */
237
- export declare function subStatusAnnotations(entry: WorkflowAgentEntry, state: WorkflowDisplayState, now: number): string[];
238
- /**
239
- * Inner width of the left pane.
240
- *
241
- * Fixed rather than proportional at usable terminal sizes: the left pane holds
242
- * short labels (a phase title, an agent label) and the right pane holds
243
- * everything that actually needs room, so giving the left a share of a wide
244
- * terminal would only pad it. It gives way on a narrow one.
245
- */
246
- export declare function leftPaneWidth(width: number): number;
247
- /**
248
- * Which of the per-agent actions the selected row can currently take.
249
- *
250
- * The window for both is the one in which the agent's `agent()` call is still
251
- * unanswered. Skip covers that whole window; retry needs a child to stop and
252
- * start again, so it begins only once one exists. Once the call has settled its
253
- * value is already the script's, and there is nothing either key could change.
254
- */
255
- export declare function agentActions(entry: WorkflowAgentEntry | undefined, workflowActive: boolean): {
256
- skip: boolean;
257
- retry: boolean;
258
- };
259
- /**
260
- * Build the dialog.
261
- *
262
- * Two panes side by side inside one frame, and two levels of depth: phases with
263
- * the selected phase's agents beside them, then — on opening one — those agents
264
- * with the selected agent's detail beside them. The frame is a fixed height so
265
- * the dialog does not jump as the selection moves through runs of very
266
- * different sizes.
267
- */
268
- export declare function layoutWorkflowDialog(input: WorkflowDialogInput): WorkflowCardLine[];
269
- /**
270
- * Map a keypress to the next state and, where the key is an action, what the
271
- * caller should do about it. Pure: `undefined` means "not ours".
272
- *
273
- * Movement clamps at both ends rather than wrapping — a long agent list should
274
- * not jump back to the top under a held `j`.
275
- */
276
- export declare function handleWorkflowDialogKey(data: string, state: WorkflowDialogState, view: ResolvedWorkflowDialog): {
277
- state: WorkflowDialogState;
278
- action?: WorkflowDialogAction;
279
- } | undefined;
280
- /** The dialog as plain text — what the layout tests assert against. */
281
- export declare function plainWorkflowDialogLines(lines: readonly WorkflowCardLine[]): string[];
282
- /**
283
- * The `/agents → Workflows` overlay.
284
- *
285
- * Deliberately thin: it owns the spinner timer and the theme, and delegates
286
- * everything else to the two pure functions above. `source` is re-read every
287
- * render so a live run updates in place without any subscription plumbing.
288
- */
289
- export declare class WorkflowDialog implements Component {
290
- private tui;
291
- private source;
292
- private theme;
293
- private done;
294
- private actions;
295
- private state;
296
- private spinnerFrame;
297
- private timer;
298
- private closed;
299
- constructor(tui: TUI, source: () => WorkflowDialogSource, theme: Theme, done: (result: undefined) => void, actions?: WorkflowDialogActions, initialPhaseIndex?: number);
300
- handleInput(data: string): void;
301
- render(width: number): string[];
302
- invalidate(): void;
303
- dispose(): void;
304
- private dispatch;
305
- }
306
- //# sourceMappingURL=workflow-dialog.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workflow-dialog.d.ts","sourceRoot":"","sources":["../../src/ui/workflow-dialog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EACL,KAAK,SAAS,EAGd,KAAK,GAAG,EAIT,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAML,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,aAAa,EACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAW,KAAK,KAAK,EAAE,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