@esso0428/pi-subagents 0.17.6 → 0.17.7

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 (260) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/CONTRIBUTING.md +4 -0
  3. package/dist/abortable.d.ts +13 -0
  4. package/dist/abortable.d.ts.map +1 -0
  5. package/dist/abortable.js +43 -0
  6. package/dist/abortable.js.map +1 -0
  7. package/dist/agent-color.d.ts +36 -0
  8. package/dist/agent-color.d.ts.map +1 -0
  9. package/dist/agent-color.js +124 -0
  10. package/dist/agent-color.js.map +1 -0
  11. package/dist/agent-file-toggle.d.ts +126 -0
  12. package/dist/agent-file-toggle.d.ts.map +1 -0
  13. package/dist/agent-file-toggle.js +259 -0
  14. package/dist/agent-file-toggle.js.map +1 -0
  15. package/dist/agent-history.d.ts +4 -0
  16. package/dist/agent-history.d.ts.map +1 -1
  17. package/dist/agent-history.js +47 -1
  18. package/dist/agent-history.js.map +1 -1
  19. package/dist/agent-manager.d.ts +370 -56
  20. package/dist/agent-manager.d.ts.map +1 -1
  21. package/dist/agent-manager.js +1123 -409
  22. package/dist/agent-manager.js.map +1 -1
  23. package/dist/agent-runner.d.ts +100 -10
  24. package/dist/agent-runner.d.ts.map +1 -1
  25. package/dist/agent-runner.js +166 -21
  26. package/dist/agent-runner.js.map +1 -1
  27. package/dist/agent-types.d.ts +57 -5
  28. package/dist/agent-types.d.ts.map +1 -1
  29. package/dist/agent-types.js +164 -32
  30. package/dist/agent-types.js.map +1 -1
  31. package/dist/child-context.d.ts +3 -0
  32. package/dist/child-context.d.ts.map +1 -0
  33. package/dist/child-context.js +13 -0
  34. package/dist/child-context.js.map +1 -0
  35. package/dist/cross-extension-rpc.d.ts +23 -3
  36. package/dist/cross-extension-rpc.d.ts.map +1 -1
  37. package/dist/cross-extension-rpc.js +79 -17
  38. package/dist/cross-extension-rpc.js.map +1 -1
  39. package/dist/custom-agents.d.ts +38 -1
  40. package/dist/custom-agents.d.ts.map +1 -1
  41. package/dist/custom-agents.js +164 -12
  42. package/dist/custom-agents.js.map +1 -1
  43. package/dist/index.d.ts +34 -0
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +1908 -495
  46. package/dist/index.js.map +1 -1
  47. package/dist/invocation-config.d.ts +87 -2
  48. package/dist/invocation-config.d.ts.map +1 -1
  49. package/dist/invocation-config.js +71 -3
  50. package/dist/invocation-config.js.map +1 -1
  51. package/dist/mention-clone.d.ts +88 -0
  52. package/dist/mention-clone.d.ts.map +1 -0
  53. package/dist/mention-clone.js +154 -0
  54. package/dist/mention-clone.js.map +1 -0
  55. package/dist/mention.d.ts +82 -0
  56. package/dist/mention.d.ts.map +1 -0
  57. package/dist/mention.js +132 -0
  58. package/dist/mention.js.map +1 -0
  59. package/dist/model-resolver.d.ts +17 -0
  60. package/dist/model-resolver.d.ts.map +1 -1
  61. package/dist/model-resolver.js +15 -0
  62. package/dist/model-resolver.js.map +1 -1
  63. package/dist/model-scope.d.ts +50 -0
  64. package/dist/model-scope.d.ts.map +1 -0
  65. package/dist/model-scope.js +49 -0
  66. package/dist/model-scope.js.map +1 -0
  67. package/dist/nested-tools.d.ts +57 -0
  68. package/dist/nested-tools.d.ts.map +1 -0
  69. package/dist/nested-tools.js +301 -0
  70. package/dist/nested-tools.js.map +1 -0
  71. package/dist/output-file.d.ts +22 -3
  72. package/dist/output-file.d.ts.map +1 -1
  73. package/dist/output-file.js +58 -7
  74. package/dist/output-file.js.map +1 -1
  75. package/dist/prompts.d.ts +23 -0
  76. package/dist/prompts.d.ts.map +1 -1
  77. package/dist/prompts.js +20 -2
  78. package/dist/prompts.js.map +1 -1
  79. package/dist/schedule.d.ts.map +1 -1
  80. package/dist/schedule.js +36 -15
  81. package/dist/schedule.js.map +1 -1
  82. package/dist/settings.d.ts +228 -2
  83. package/dist/settings.d.ts.map +1 -1
  84. package/dist/settings.js +94 -0
  85. package/dist/settings.js.map +1 -1
  86. package/dist/status-note.d.ts +49 -1
  87. package/dist/status-note.d.ts.map +1 -1
  88. package/dist/status-note.js +62 -1
  89. package/dist/status-note.js.map +1 -1
  90. package/dist/structured-output.d.ts +62 -0
  91. package/dist/structured-output.d.ts.map +1 -0
  92. package/dist/structured-output.js +113 -0
  93. package/dist/structured-output.js.map +1 -0
  94. package/dist/types.d.ts +176 -10
  95. package/dist/types.d.ts.map +1 -1
  96. package/dist/ui/agent-mention.d.ts +83 -0
  97. package/dist/ui/agent-mention.d.ts.map +1 -0
  98. package/dist/ui/agent-mention.js +188 -0
  99. package/dist/ui/agent-mention.js.map +1 -0
  100. package/dist/ui/agent-widget.d.ts +96 -75
  101. package/dist/ui/agent-widget.d.ts.map +1 -1
  102. package/dist/ui/agent-widget.js +397 -420
  103. package/dist/ui/agent-widget.js.map +1 -1
  104. package/dist/ui/conversation-blocks.d.ts.map +1 -1
  105. package/dist/ui/conversation-blocks.js +6 -0
  106. package/dist/ui/conversation-blocks.js.map +1 -1
  107. package/dist/ui/conversation-timeline.d.ts +10 -2
  108. package/dist/ui/conversation-timeline.d.ts.map +1 -1
  109. package/dist/ui/conversation-timeline.js +130 -23
  110. package/dist/ui/conversation-timeline.js.map +1 -1
  111. package/dist/ui/conversation-viewer.d.ts +15 -5
  112. package/dist/ui/conversation-viewer.d.ts.map +1 -1
  113. package/dist/ui/conversation-viewer.js +202 -50
  114. package/dist/ui/conversation-viewer.js.map +1 -1
  115. package/dist/ui/fleet-list.d.ts +198 -0
  116. package/dist/ui/fleet-list.d.ts.map +1 -0
  117. package/dist/ui/fleet-list.js +487 -0
  118. package/dist/ui/fleet-list.js.map +1 -0
  119. package/dist/ui/schedule-menu.d.ts.map +1 -1
  120. package/dist/ui/schedule-menu.js +6 -7
  121. package/dist/ui/schedule-menu.js.map +1 -1
  122. package/dist/ui/select-item.d.ts +28 -0
  123. package/dist/ui/select-item.d.ts.map +1 -0
  124. package/dist/ui/select-item.js +35 -0
  125. package/dist/ui/select-item.js.map +1 -0
  126. package/dist/ui/workflow-card.d.ts +176 -0
  127. package/dist/ui/workflow-card.d.ts.map +1 -0
  128. package/dist/ui/workflow-card.js +333 -0
  129. package/dist/ui/workflow-card.js.map +1 -0
  130. package/dist/ui/workflow-dialog.d.ts +306 -0
  131. package/dist/ui/workflow-dialog.d.ts.map +1 -0
  132. package/dist/ui/workflow-dialog.js +844 -0
  133. package/dist/ui/workflow-dialog.js.map +1 -0
  134. package/dist/ui/workflow-menu.d.ts +61 -0
  135. package/dist/ui/workflow-menu.d.ts.map +1 -0
  136. package/dist/ui/workflow-menu.js +148 -0
  137. package/dist/ui/workflow-menu.js.map +1 -0
  138. package/dist/usage.d.ts +86 -1
  139. package/dist/usage.d.ts.map +1 -1
  140. package/dist/usage.js +72 -1
  141. package/dist/usage.js.map +1 -1
  142. package/dist/workflow/collisions.d.ts +96 -0
  143. package/dist/workflow/collisions.d.ts.map +1 -0
  144. package/dist/workflow/collisions.js +89 -0
  145. package/dist/workflow/collisions.js.map +1 -0
  146. package/dist/workflow/entry.d.ts +33 -0
  147. package/dist/workflow/entry.d.ts.map +1 -0
  148. package/dist/workflow/entry.js +30 -0
  149. package/dist/workflow/entry.js.map +1 -0
  150. package/dist/workflow/host.d.ts +63 -0
  151. package/dist/workflow/host.d.ts.map +1 -0
  152. package/dist/workflow/host.js +363 -0
  153. package/dist/workflow/host.js.map +1 -0
  154. package/dist/workflow/journal.d.ts +98 -0
  155. package/dist/workflow/journal.d.ts.map +1 -0
  156. package/dist/workflow/journal.js +121 -0
  157. package/dist/workflow/journal.js.map +1 -0
  158. package/dist/workflow/json-schema.d.ts +52 -0
  159. package/dist/workflow/json-schema.d.ts.map +1 -0
  160. package/dist/workflow/json-schema.js +112 -0
  161. package/dist/workflow/json-schema.js.map +1 -0
  162. package/dist/workflow/meta.d.ts +68 -0
  163. package/dist/workflow/meta.d.ts.map +1 -0
  164. package/dist/workflow/meta.js +318 -0
  165. package/dist/workflow/meta.js.map +1 -0
  166. package/dist/workflow/progress.d.ts +225 -0
  167. package/dist/workflow/progress.d.ts.map +1 -0
  168. package/dist/workflow/progress.js +362 -0
  169. package/dist/workflow/progress.js.map +1 -0
  170. package/dist/workflow/runtime.d.ts +335 -0
  171. package/dist/workflow/runtime.d.ts.map +1 -0
  172. package/dist/workflow/runtime.js +831 -0
  173. package/dist/workflow/runtime.js.map +1 -0
  174. package/dist/workflow/saved.d.ts +91 -0
  175. package/dist/workflow/saved.d.ts.map +1 -0
  176. package/dist/workflow/saved.js +204 -0
  177. package/dist/workflow/saved.js.map +1 -0
  178. package/dist/workflow/task.d.ts +137 -0
  179. package/dist/workflow/task.d.ts.map +1 -0
  180. package/dist/workflow/task.js +208 -0
  181. package/dist/workflow/task.js.map +1 -0
  182. package/dist/workflow/tool-description.d.ts +39 -0
  183. package/dist/workflow/tool-description.d.ts.map +1 -0
  184. package/dist/workflow/tool-description.js +200 -0
  185. package/dist/workflow/tool-description.js.map +1 -0
  186. package/dist/workflow/worker-source.d.ts +48 -0
  187. package/dist/workflow/worker-source.d.ts.map +1 -0
  188. package/dist/workflow/worker-source.js +779 -0
  189. package/dist/workflow/worker-source.js.map +1 -0
  190. package/dist/worktree.d.ts +10 -3
  191. package/dist/worktree.d.ts.map +1 -1
  192. package/dist/worktree.js +58 -54
  193. package/dist/worktree.js.map +1 -1
  194. package/dist/xml.d.ts +11 -0
  195. package/dist/xml.d.ts.map +1 -0
  196. package/dist/xml.js +13 -0
  197. package/dist/xml.js.map +1 -0
  198. package/docs/rpc.md +183 -0
  199. package/docs/superpowers/plans/2026-09-30-upstream-event-workflow-partial-history.md +195 -0
  200. package/docs/superpowers/specs/2026-09-30-upstream-event-workflow-partial-history-design.md +49 -0
  201. package/docs/workflows.md +437 -0
  202. package/examples/agent-tool-description.md +7 -7
  203. package/examples/workflows/compose.js +51 -0
  204. package/examples/workflows/fan-out-audit.js +47 -0
  205. package/examples/workflows/gated-fix.js +60 -0
  206. package/examples/workflows/lib/count-child.js +27 -0
  207. package/examples/workflows/review-panel.js +63 -0
  208. package/examples/workflows/structured-findings.js +78 -0
  209. package/package.json +1 -1
  210. package/src/abortable.ts +43 -0
  211. package/src/agent-color.ts +161 -0
  212. package/src/agent-file-toggle.ts +269 -0
  213. package/src/agent-history.ts +54 -2
  214. package/src/agent-manager.ts +1263 -402
  215. package/src/agent-runner.ts +251 -27
  216. package/src/agent-types.ts +188 -32
  217. package/src/child-context.ts +15 -0
  218. package/src/cross-extension-rpc.ts +96 -20
  219. package/src/custom-agents.ts +170 -13
  220. package/src/index.ts +2024 -537
  221. package/src/invocation-config.ts +118 -3
  222. package/src/mention-clone.ts +196 -0
  223. package/src/mention.ts +141 -0
  224. package/src/model-resolver.ts +18 -0
  225. package/src/model-scope.ts +70 -0
  226. package/src/nested-tools.ts +424 -0
  227. package/src/output-file.ts +61 -6
  228. package/src/prompts.ts +45 -2
  229. package/src/schedule.ts +35 -14
  230. package/src/settings.ts +312 -2
  231. package/src/status-note.ts +66 -1
  232. package/src/structured-output.ts +130 -0
  233. package/src/types.ts +177 -10
  234. package/src/ui/agent-mention.ts +216 -0
  235. package/src/ui/agent-widget.ts +389 -441
  236. package/src/ui/conversation-blocks.ts +6 -0
  237. package/src/ui/conversation-timeline.ts +139 -25
  238. package/src/ui/conversation-viewer.ts +212 -48
  239. package/src/ui/fleet-list.ts +558 -0
  240. package/src/ui/schedule-menu.ts +9 -8
  241. package/src/ui/select-item.ts +45 -0
  242. package/src/ui/workflow-card.ts +470 -0
  243. package/src/ui/workflow-dialog.ts +1115 -0
  244. package/src/ui/workflow-menu.ts +193 -0
  245. package/src/usage.ts +109 -2
  246. package/src/workflow/collisions.ts +123 -0
  247. package/src/workflow/entry.ts +47 -0
  248. package/src/workflow/host.ts +403 -0
  249. package/src/workflow/journal.ts +164 -0
  250. package/src/workflow/json-schema.ts +128 -0
  251. package/src/workflow/meta.ts +325 -0
  252. package/src/workflow/progress.ts +550 -0
  253. package/src/workflow/runtime.ts +1219 -0
  254. package/src/workflow/saved.ts +217 -0
  255. package/src/workflow/task.ts +302 -0
  256. package/src/workflow/tool-description.ts +200 -0
  257. package/src/workflow/worker-source.ts +781 -0
  258. package/src/worktree.ts +69 -55
  259. package/src/xml.ts +13 -0
  260. package/vitest.config.ts +0 -18
@@ -0,0 +1,306 @@
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
@@ -0,0 +1 @@
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,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAUL,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AAS5B;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,qDAAqD;AACrD,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,mFAAmF;AACnF,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAM7C,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,MAAM,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,OAAO,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,gCAAgC;IAChC,OAAO,EAA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