@bastani/atomic 0.8.4 → 0.8.5-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 (245) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +24 -23
  3. package/dist/builtin/intercom/README.md +5 -5
  4. package/dist/builtin/intercom/index.ts +1 -1
  5. package/dist/builtin/intercom/package.json +1 -1
  6. package/dist/builtin/intercom/ui/compose.ts +19 -1
  7. package/dist/builtin/intercom/ui/session-list.ts +19 -1
  8. package/dist/builtin/mcp/README.md +3 -3
  9. package/dist/builtin/mcp/commands.ts +1 -1
  10. package/dist/builtin/mcp/host-html-template.ts +1 -1
  11. package/dist/builtin/mcp/mcp-panel.ts +14 -14
  12. package/dist/builtin/mcp/mcp-setup-panel.ts +4 -4
  13. package/dist/builtin/mcp/package.json +1 -1
  14. package/dist/builtin/mcp/tool-result-renderer.ts +1 -1
  15. package/dist/builtin/subagents/README.md +3 -3
  16. package/dist/builtin/subagents/package.json +1 -1
  17. package/dist/builtin/subagents/src/tui/render.ts +1844 -1062
  18. package/dist/builtin/web-access/README.md +1 -1
  19. package/dist/builtin/web-access/curator-page.ts +2 -2
  20. package/dist/builtin/web-access/index.ts +1 -1
  21. package/dist/builtin/web-access/package.json +1 -1
  22. package/dist/builtin/workflows/README.md +34 -7
  23. package/dist/builtin/workflows/builtin/deep-research-codebase.ts +23 -4
  24. package/dist/builtin/workflows/builtin/ralph.ts +1 -1
  25. package/dist/builtin/workflows/package.json +1 -1
  26. package/dist/builtin/workflows/skills/workflow/SKILL.md +75 -16
  27. package/dist/builtin/workflows/skills/workflow/references/running-workflows.md +34 -11
  28. package/dist/builtin/workflows/skills/workflow/references/sdk-authoring.md +111 -20
  29. package/dist/builtin/workflows/src/extension/discovery.ts +32 -4
  30. package/dist/builtin/workflows/src/extension/index.ts +347 -63
  31. package/dist/builtin/workflows/src/extension/render-call.ts +3 -1
  32. package/dist/builtin/workflows/src/extension/render-result.ts +7 -0
  33. package/dist/builtin/workflows/src/extension/runtime.ts +4 -2
  34. package/dist/builtin/workflows/src/extension/wiring.ts +32 -8
  35. package/dist/builtin/workflows/src/extension/workflow-schema.ts +36 -14
  36. package/dist/builtin/workflows/src/runs/background/runner.ts +2 -2
  37. package/dist/builtin/workflows/src/runs/background/status.ts +89 -0
  38. package/dist/builtin/workflows/src/runs/foreground/executor.ts +338 -78
  39. package/dist/builtin/workflows/src/runs/foreground/stage-control-registry.ts +2 -0
  40. package/dist/builtin/workflows/src/runs/foreground/stage-runner.ts +55 -7
  41. package/dist/builtin/workflows/src/runs/shared/workflow-runner.ts +146 -10
  42. package/dist/builtin/workflows/src/shared/store.ts +29 -0
  43. package/dist/builtin/workflows/src/shared/types.ts +25 -4
  44. package/dist/builtin/workflows/src/tui/graph-canvas.ts +69 -2
  45. package/dist/builtin/workflows/src/tui/graph-view.ts +97 -182
  46. package/dist/builtin/workflows/src/tui/header.ts +36 -20
  47. package/dist/builtin/workflows/src/tui/inline-form-card.ts +129 -46
  48. package/dist/builtin/workflows/src/tui/inline-form-editor.ts +111 -36
  49. package/dist/builtin/workflows/src/tui/inputs-picker.ts +311 -91
  50. package/dist/builtin/workflows/src/tui/layout.ts +1 -1
  51. package/dist/builtin/workflows/src/tui/node-card.ts +66 -37
  52. package/dist/builtin/workflows/src/tui/overlay-adapter.ts +20 -6
  53. package/dist/builtin/workflows/src/tui/prompt-card.ts +262 -85
  54. package/dist/builtin/workflows/src/tui/run-detail.ts +50 -31
  55. package/dist/builtin/workflows/src/tui/session-confirm.ts +21 -14
  56. package/dist/builtin/workflows/src/tui/session-picker.ts +35 -26
  57. package/dist/builtin/workflows/src/tui/stage-chat-view.ts +531 -960
  58. package/dist/builtin/workflows/src/tui/status-helpers.ts +6 -0
  59. package/dist/builtin/workflows/src/tui/status-list.ts +8 -4
  60. package/dist/builtin/workflows/src/tui/store-widget-installer.ts +7 -2
  61. package/dist/builtin/workflows/src/tui/switcher.ts +55 -25
  62. package/dist/builtin/workflows/src/tui/workflow-attach-pane.ts +33 -1
  63. package/dist/builtin/workflows/src/tui/workflow-list.ts +10 -6
  64. package/dist/cli/args.d.ts.map +1 -1
  65. package/dist/cli/args.js +1 -1
  66. package/dist/cli/args.js.map +1 -1
  67. package/dist/config.d.ts.map +1 -1
  68. package/dist/config.js +20 -6
  69. package/dist/config.js.map +1 -1
  70. package/dist/core/agent-session-services.d.ts +3 -3
  71. package/dist/core/agent-session-services.d.ts.map +1 -1
  72. package/dist/core/agent-session-services.js.map +1 -1
  73. package/dist/core/agent-session.d.ts +7 -7
  74. package/dist/core/agent-session.d.ts.map +1 -1
  75. package/dist/core/agent-session.js.map +1 -1
  76. package/dist/core/compaction/branch-summarization.d.ts +2 -2
  77. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  78. package/dist/core/compaction/branch-summarization.js.map +1 -1
  79. package/dist/core/compaction/compaction.d.ts +3 -3
  80. package/dist/core/compaction/compaction.d.ts.map +1 -1
  81. package/dist/core/compaction/compaction.js.map +1 -1
  82. package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  83. package/dist/core/export-html/tool-renderer.js.map +1 -1
  84. package/dist/core/extensions/loader.d.ts +3 -2
  85. package/dist/core/extensions/loader.d.ts.map +1 -1
  86. package/dist/core/extensions/loader.js +24 -12
  87. package/dist/core/extensions/loader.js.map +1 -1
  88. package/dist/core/extensions/runner.d.ts.map +1 -1
  89. package/dist/core/extensions/runner.js +6 -0
  90. package/dist/core/extensions/runner.js.map +1 -1
  91. package/dist/core/extensions/types.d.ts +28 -17
  92. package/dist/core/extensions/types.d.ts.map +1 -1
  93. package/dist/core/extensions/types.js.map +1 -1
  94. package/dist/core/package-manager.d.ts +1 -0
  95. package/dist/core/package-manager.d.ts.map +1 -1
  96. package/dist/core/package-manager.js +65 -28
  97. package/dist/core/package-manager.js.map +1 -1
  98. package/dist/core/resource-loader.d.ts.map +1 -1
  99. package/dist/core/resource-loader.js +13 -5
  100. package/dist/core/resource-loader.js.map +1 -1
  101. package/dist/core/sdk.d.ts +3 -3
  102. package/dist/core/sdk.d.ts.map +1 -1
  103. package/dist/core/sdk.js.map +1 -1
  104. package/dist/core/session-manager.d.ts.map +1 -1
  105. package/dist/core/session-manager.js +1 -1
  106. package/dist/core/session-manager.js.map +1 -1
  107. package/dist/core/settings-manager.d.ts +2 -0
  108. package/dist/core/settings-manager.d.ts.map +1 -1
  109. package/dist/core/settings-manager.js.map +1 -1
  110. package/dist/core/slash-commands.d.ts.map +1 -1
  111. package/dist/core/slash-commands.js +1 -1
  112. package/dist/core/slash-commands.js.map +1 -1
  113. package/dist/core/system-prompt.d.ts.map +1 -1
  114. package/dist/core/system-prompt.js +5 -3
  115. package/dist/core/system-prompt.js.map +1 -1
  116. package/dist/core/tools/ask-user-question/view/components/preview/preview-block-renderer.d.ts +1 -1
  117. package/dist/core/tools/ask-user-question/view/components/preview/preview-block-renderer.d.ts.map +1 -1
  118. package/dist/core/tools/ask-user-question/view/components/preview/preview-block-renderer.js +1 -1
  119. package/dist/core/tools/ask-user-question/view/components/preview/preview-block-renderer.js.map +1 -1
  120. package/dist/core/tools/ask-user-question/view/dialog-builder.d.ts +8 -8
  121. package/dist/core/tools/ask-user-question/view/dialog-builder.d.ts.map +1 -1
  122. package/dist/core/tools/ask-user-question/view/dialog-builder.js +6 -6
  123. package/dist/core/tools/ask-user-question/view/dialog-builder.js.map +1 -1
  124. package/dist/core/tools/bash.d.ts.map +1 -1
  125. package/dist/core/tools/bash.js +1 -1
  126. package/dist/core/tools/bash.js.map +1 -1
  127. package/dist/core/tools/find.d.ts.map +1 -1
  128. package/dist/core/tools/find.js +1 -1
  129. package/dist/core/tools/find.js.map +1 -1
  130. package/dist/core/tools/grep.d.ts.map +1 -1
  131. package/dist/core/tools/grep.js +7 -4
  132. package/dist/core/tools/grep.js.map +1 -1
  133. package/dist/core/tools/index.d.ts +3 -2
  134. package/dist/core/tools/index.d.ts.map +1 -1
  135. package/dist/core/tools/index.js.map +1 -1
  136. package/dist/core/tools/ls.d.ts.map +1 -1
  137. package/dist/core/tools/ls.js +3 -2
  138. package/dist/core/tools/ls.js.map +1 -1
  139. package/dist/core/tools/read.d.ts.map +1 -1
  140. package/dist/core/tools/read.js +2 -2
  141. package/dist/core/tools/read.js.map +1 -1
  142. package/dist/core/tools/render-utils.d.ts +2 -1
  143. package/dist/core/tools/render-utils.d.ts.map +1 -1
  144. package/dist/core/tools/render-utils.js.map +1 -1
  145. package/dist/core/tools/todos.d.ts.map +1 -1
  146. package/dist/core/tools/todos.js +1 -1
  147. package/dist/core/tools/todos.js.map +1 -1
  148. package/dist/core/tools/tool-definition-wrapper.d.ts +4 -3
  149. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
  150. package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
  151. package/dist/core/tools/write.d.ts.map +1 -1
  152. package/dist/core/tools/write.js +1 -1
  153. package/dist/core/tools/write.js.map +1 -1
  154. package/dist/index.d.ts +2 -1
  155. package/dist/index.d.ts.map +1 -1
  156. package/dist/index.js +2 -1
  157. package/dist/index.js.map +1 -1
  158. package/dist/main.d.ts.map +1 -1
  159. package/dist/main.js +2 -2
  160. package/dist/main.js.map +1 -1
  161. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  162. package/dist/modes/interactive/components/assistant-message.js +3 -3
  163. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  164. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  165. package/dist/modes/interactive/components/bash-execution.js +3 -3
  166. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  167. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  168. package/dist/modes/interactive/components/branch-summary-message.js +1 -1
  169. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  170. package/dist/modes/interactive/components/chat-message-renderer.d.ts +2 -1
  171. package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
  172. package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
  173. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
  174. package/dist/modes/interactive/components/compaction-summary-message.js +1 -1
  175. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
  176. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  177. package/dist/modes/interactive/components/config-selector.js +1 -1
  178. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  179. package/dist/modes/interactive/components/custom-editor.d.ts +3 -0
  180. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  181. package/dist/modes/interactive/components/custom-editor.js +13 -3
  182. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  183. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  184. package/dist/modes/interactive/components/footer.js +1 -1
  185. package/dist/modes/interactive/components/footer.js.map +1 -1
  186. package/dist/modes/interactive/components/index.d.ts +2 -1
  187. package/dist/modes/interactive/components/index.d.ts.map +1 -1
  188. package/dist/modes/interactive/components/index.js +2 -1
  189. package/dist/modes/interactive/components/index.js.map +1 -1
  190. package/dist/modes/interactive/components/keybinding-hints.d.ts +1 -0
  191. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
  192. package/dist/modes/interactive/components/keybinding-hints.js +47 -5
  193. package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
  194. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  195. package/dist/modes/interactive/components/login-dialog.js +5 -5
  196. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  197. package/dist/modes/interactive/components/model-selector.d.ts +3 -3
  198. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  199. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  200. package/dist/modes/interactive/components/scoped-models-selector.d.ts +2 -2
  201. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  202. package/dist/modes/interactive/components/scoped-models-selector.js +7 -7
  203. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  204. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  205. package/dist/modes/interactive/components/session-selector.js +8 -8
  206. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  207. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  208. package/dist/modes/interactive/components/settings-selector.js +3 -3
  209. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  210. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  211. package/dist/modes/interactive/components/skill-invocation-message.js +2 -2
  212. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  213. package/dist/modes/interactive/components/tool-execution.d.ts +10 -12
  214. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  215. package/dist/modes/interactive/components/tool-execution.js +3 -3
  216. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  217. package/dist/modes/interactive/components/working-status.d.ts +25 -0
  218. package/dist/modes/interactive/components/working-status.d.ts.map +1 -0
  219. package/dist/modes/interactive/components/working-status.js +28 -0
  220. package/dist/modes/interactive/components/working-status.js.map +1 -0
  221. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  222. package/dist/modes/interactive/interactive-mode.js +8 -7
  223. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  224. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  225. package/dist/modes/rpc/rpc-mode.js +8 -0
  226. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  227. package/dist/modes/rpc/rpc-types.d.ts +5 -5
  228. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  229. package/dist/modes/rpc/rpc-types.js.map +1 -1
  230. package/dist/utils/tools-manager.d.ts.map +1 -1
  231. package/dist/utils/tools-manager.js.map +1 -1
  232. package/docs/development.md +2 -2
  233. package/docs/extensions.md +7 -7
  234. package/docs/packages.md +11 -8
  235. package/docs/quickstart.md +2 -2
  236. package/docs/rpc.md +1 -1
  237. package/docs/sdk.md +14 -11
  238. package/docs/session-format.md +1 -1
  239. package/docs/sessions.md +10 -10
  240. package/docs/settings.md +1 -1
  241. package/docs/terminal-setup.md +9 -9
  242. package/docs/tmux.md +10 -10
  243. package/docs/tui.md +2 -2
  244. package/docs/usage.md +9 -9
  245. package/package.json +6 -1
@@ -235,7 +235,7 @@ Show the active Google account currently authenticated for Gemini Web. Useful wh
235
235
 
236
236
  ## Activity Monitor
237
237
 
238
- Toggle with **Ctrl+Shift+W** to see live request/response activity:
238
+ Toggle with **CTRL+SHIFT+W** to see live request/response activity:
239
239
 
240
240
  ```
241
241
  ─── Web Search Activity ────────────────────────────────────
@@ -125,9 +125,9 @@ ${CSS}
125
125
 
126
126
  <footer class="action-bar">
127
127
  <div class="action-shortcuts">
128
- <span class="shortcut"><kbd>A</kbd> <span>Toggle all</span></span>
128
+ <span class="shortcut"><kbd>A</kbd> <span>Toggle All</span></span>
129
129
  <span class="shortcut"><kbd>Enter</kbd> <span>Generate</span></span>
130
- <span class="shortcut"><kbd>Esc</kbd> <span>Cancel</span></span>
130
+ <span class="shortcut"><kbd>Escape</kbd> <span>Cancel</span></span>
131
131
  </div>
132
132
  <div class="action-buttons">
133
133
  <button class="btn btn-submit" id="btn-send" disabled>Waiting for results\u2026</button>
@@ -1523,7 +1523,7 @@ export default function (pi: ExtensionAPI) {
1523
1523
  }
1524
1524
  const moreLines = Math.max(0, totalLines - collapsedLines);
1525
1525
  if (moreLines > 0) {
1526
- box.addChild(new Text(theme.fg("muted", `\n... (${moreLines} more lines, ${totalLines} total, ctrl+o to expand)`), 0, 0));
1526
+ box.addChild(new Text(theme.fg("muted", `\n... (${moreLines} more lines, ${totalLines} total, CTRL+O Expand)`), 0, 0));
1527
1527
  }
1528
1528
  return box;
1529
1529
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/web-access",
3
- "version": "0.8.4",
3
+ "version": "0.8.5-0",
4
4
  "private": true,
5
5
  "description": "Atomic extension for web search, URL fetching, GitHub repo cloning, PDF/video extraction.",
6
6
  "contributors": [
@@ -69,7 +69,7 @@ export default defineWorkflow("parallel-research")
69
69
  { name: "auth-specialist", task: `Research authentication patterns for: ${topic}` },
70
70
  { name: "db-specialist", task: `Research database layer for: ${topic}` },
71
71
  { name: "api-specialist", task: `Research API surface for: ${topic}` },
72
- ]);
72
+ ], { concurrency: 2, failFast: false });
73
73
 
74
74
  const summary = await ctx.task("aggregator", {
75
75
  prompt: "Synthesize these specialist reports:\n\n{previous}",
@@ -189,7 +189,8 @@ registry.get("alpha"); // compiled workflow definition | undefined
189
189
  | `/workflow connect [run-id]` | Attach to a workflow run overlay |
190
190
  | `/workflow attach [run-id] [stage]` | Open the attach/chat pane for a run or stage |
191
191
  | `/workflow pause [run-id] [stage]` | Pause a live run or stage |
192
- | `/workflow interrupt [run-id\|--all]` | Stop the active run, a named run, or all active runs |
192
+ | `/workflow interrupt [run-id\|--all]` | Pause active/named/all active runs so they can resume |
193
+ | `/workflow kill [run-id\|--all]` | Kill and remove active/named/all active runs from status |
193
194
  | `/workflow resume <run-id>` | Resume paused work or re-open a run snapshot |
194
195
  | `/workflow inputs <name>` | Print the input schema for a workflow |
195
196
 
@@ -206,7 +207,11 @@ Workflows always run as **background tasks** — the chat editor stays free whil
206
207
  "parameters": {
207
208
  "workflow": "string (optional) — workflow ID or normalized name",
208
209
  "inputs": "object (optional) — key/value map of workflow inputs",
209
- "action": "'run' | 'list' | 'get' | 'inputs' | 'status' | 'interrupt' | 'resume'",
210
+ "action": "'run' | 'list' | 'get' | 'inputs' | 'status' | 'interrupt' | 'kill' | 'resume'",
211
+ "runId": "optional run id or unique prefix; interrupt/kill default to the active run; use '--all' or all:true for interrupt/kill all",
212
+ "stageId": "optional stage id, prefix, or name for resume",
213
+ "message": "optional resume message",
214
+ "all": "optional boolean for interrupt/kill all",
210
215
  "task/tasks/chain": "optional direct workflow-native orchestration modes"
211
216
  }
212
217
  }
@@ -234,14 +239,35 @@ const definition = {
234
239
  inputs: {
235
240
  prompt: "Investigate the auth module",
236
241
  max_partitions: 6,
242
+ max_concurrency: 4,
237
243
  },
238
244
  } as const;
239
245
 
240
246
  const options: WorkflowOptions = {};
241
247
 
242
248
  await runWorkflow(definition, options);
249
+
250
+ await runWorkflow({
251
+ mode: "parallel",
252
+ task: "Audit auth changes",
253
+ tasks: [
254
+ { name: "security", task: "Review security risks" },
255
+ { name: "runtime", task: "Review runtime risks" },
256
+ ],
257
+ concurrency: 2,
258
+ reads: ["research/context.md"],
259
+ output: "research/auth-audit.md",
260
+ outputMode: "inline",
261
+ worktree: false,
262
+ maxOutput: { lines: 2000 },
263
+ artifacts: true,
264
+ });
243
265
  ```
244
266
 
267
+ The programmatic definition object mirrors the workflow tool: named workflow runs, single-task runs, parallel `tasks`, and mixed `chain` runs accept the same direct options (`reads`, `output`, `outputMode`, `worktree`, `maxOutput`, `artifacts`, `concurrency`, `failFast`, and stage/session options such as `cwd`, `agentDir`, `model`, `tools`, `context`, and `sessionDir`). `chainDir` is chain-only: it provides the shared artifact directory for chain reads, outputs, and worktree diffs.
268
+
269
+ Workflow stage sessions follow Atomic SDK directory defaults: `DefaultResourceLoader` is initialized with the project `cwd` and the Atomic default `~/.atomic/agent` directory, while legacy `.pi` paths remain readable where the SDK supports multiple config directories. A stage-supplied `agentDir` is treated as an explicit user override; a stage-supplied `resourceLoader` owns discovery, with `cwd`/`agentDir` left for session naming and tool path resolution.
270
+
245
271
  To inspect a workflow's input schema inside pi, use `/workflow inputs <name>` or `/workflow <name> --help`.
246
272
 
247
273
  ---
@@ -256,10 +282,11 @@ Scout + research-history chain → two parallel specialist waves → aggregator.
256
282
  /workflow deep-research-codebase prompt="How does session persistence work?"
257
283
  ```
258
284
 
259
- | Input | Type | Required | Default | Description |
260
- | ---------------- | -------- | -------- | ------- | ------------------------------------------------- |
261
- | `prompt` | `text` | ✓ | — | Research question or topic to investigate. |
262
- | `max_partitions` | `number` | — | `100` | Maximum number of codebase partitions to explore. |
285
+ | Input | Type | Required | Default | Description |
286
+ | ----------------- | -------- | -------- | ------- | --------------------------------------------------------- |
287
+ | `prompt` | `text` | ✓ | — | Research question or topic to investigate. |
288
+ | `max_partitions` | `number` | — | `100` | Maximum number of codebase partitions to explore. |
289
+ | `max_concurrency` | `number` | — | `4` | Maximum number of workflow stages to run concurrently. |
263
290
 
264
291
  ### `ralph`
265
292
 
@@ -15,6 +15,7 @@ import type {
15
15
  } from "../src/shared/types.js";
16
16
 
17
17
  const DEFAULT_MAX_PARTITIONS = 100;
18
+ const DEFAULT_MAX_CONCURRENCY = 4;
18
19
  const LOC_PER_PARTITION = 10_000;
19
20
 
20
21
  type PromptSection = readonly [tag: string, content: string];
@@ -169,23 +170,34 @@ export default defineWorkflow("deep-research-codebase")
169
170
  description:
170
171
  "Maximum number of codebase partitions to explore in parallel. Actual partitions scale by one per 10K LoC, capped by this value.",
171
172
  })
173
+ .input("max_concurrency", {
174
+ type: "number",
175
+ default: DEFAULT_MAX_CONCURRENCY,
176
+ description:
177
+ "Maximum number of workflow stages to run concurrently during deep research.",
178
+ })
172
179
  .run(async (ctx) => {
173
180
  const inputs = ctx.inputs as {
174
181
  prompt?: string;
175
182
  max_partitions?: number;
183
+ max_concurrency?: number;
176
184
  };
177
185
  const prompt = inputs.prompt ?? "";
178
186
  const requestedMaxPartitions = positiveInteger(
179
187
  inputs.max_partitions,
180
188
  DEFAULT_MAX_PARTITIONS,
181
189
  );
190
+ const maxConcurrency = positiveInteger(
191
+ inputs.max_concurrency,
192
+ DEFAULT_MAX_CONCURRENCY,
193
+ );
182
194
  const codebaseLines = countCodebaseLines();
183
195
  const partitionCap = calculatePartitionCap(
184
196
  requestedMaxPartitions,
185
197
  codebaseLines,
186
198
  );
187
199
 
188
- let noAskQuestionToolSet = ["read, bash, edit, write, todo"];
200
+ let noAskQuestionToolSet = ["read", "bash", "edit", "write", "todo"];
189
201
 
190
202
  let plannerModelConfig = {
191
203
  model: "openai/gpt-5.5",
@@ -274,7 +286,7 @@ export default defineWorkflow("deep-research-codebase")
274
286
  ...explorerModelConfig,
275
287
  },
276
288
  ],
277
- { task: prompt },
289
+ { task: prompt, concurrency: maxConcurrency },
278
290
  );
279
291
 
280
292
  const scout =
@@ -427,7 +439,10 @@ export default defineWorkflow("deep-research-codebase")
427
439
  },
428
440
  );
429
441
 
430
- const wave1 = await ctx.parallel(wave1Steps, { task: prompt });
442
+ const wave1 = await ctx.parallel(wave1Steps, {
443
+ task: prompt,
444
+ concurrency: maxConcurrency,
445
+ });
431
446
 
432
447
  const wave2Steps: WorkflowTaskStep[] = partitions.flatMap(
433
448
  (partition, index) => {
@@ -512,7 +527,10 @@ export default defineWorkflow("deep-research-codebase")
512
527
  },
513
528
  );
514
529
 
515
- const wave2 = await ctx.parallel(wave2Steps, { task: prompt });
530
+ const wave2 = await ctx.parallel(wave2Steps, {
531
+ task: prompt,
532
+ concurrency: maxConcurrency,
533
+ });
516
534
  const historyOverview = history.at(-1)?.text ?? "";
517
535
  const specialistReports = specialistSummary(partitions, wave1, wave2);
518
536
 
@@ -567,6 +585,7 @@ export default defineWorkflow("deep-research-codebase")
567
585
  partitions,
568
586
  explorer_count: partitions.length,
569
587
  specialist_count: wave1.length + wave2.length,
588
+ max_concurrency: maxConcurrency,
570
589
  history: historyOverview,
571
590
  };
572
591
  })
@@ -152,7 +152,7 @@ export default defineWorkflow("ralph")
152
152
  let approved = false;
153
153
  let iterationsCompleted = 0;
154
154
 
155
- let noAskQuestionToolSet = ["read, bash, edit, write, todo"];
155
+ let noAskQuestionToolSet = ["read", "bash", "edit", "write", "todo"];
156
156
 
157
157
  let plannerModelConfig = {
158
158
  model: "openai/gpt-5.5",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/workflows",
3
- "version": "0.8.4",
3
+ "version": "0.8.5-0",
4
4
  "private": true,
5
5
  "description": "pi extension for multi-stage workflow authoring and execution.",
6
6
  "contributors": [
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: workflow
3
- description: Create, run, inspect, and improve pi/atomic workflows. Use whenever the user wants reusable multi-stage automation, a DAG or staged agent pipeline, workflow definitions with defineWorkflow, ctx.task/ctx.parallel/ctx.chain/ctx.stage/ctx.ui orchestration, workflow tool calls, /workflow list/inputs/connect/attach/pause/resume/status help, custom workflow discovery, model fallback chains, or context-engineered multi-session processes.
3
+ description: Create, run, inspect, and improve pi/atomic workflows. Use whenever the user wants reusable multi-stage automation, a DAG or staged agent pipeline, workflow definitions with defineWorkflow, ctx.task/ctx.parallel/ctx.chain/ctx.stage/ctx.ui orchestration, workflow tool calls, /workflow list/inputs/connect/attach/pause/interrupt/resume/kill/status help, custom workflow discovery, model fallback chains, or context-engineered multi-session processes.
4
4
  ---
5
5
 
6
6
  # Workflow Skill
@@ -55,6 +55,10 @@ workflow({ action: "list" })
55
55
  workflow({ action: "get", workflow: "deep-research-codebase" })
56
56
  workflow({ action: "inputs", workflow: "deep-research-codebase" })
57
57
  workflow({ action: "run", workflow: "deep-research-codebase", inputs: { prompt: "map workflow runtime" } })
58
+ workflow({ action: "status" })
59
+ workflow({ action: "interrupt", runId: "<run-id-or-prefix>" })
60
+ workflow({ action: "resume", runId: "<run-id-or-prefix>", stageId: "<optional-stage>", message: "continue" })
61
+ workflow({ action: "kill", runId: "<run-id-or-prefix>" })
58
62
  ```
59
63
 
60
64
  Slash equivalents:
@@ -70,10 +74,19 @@ Slash equivalents:
70
74
  /workflow status --all
71
75
  /workflow status <run-id>
72
76
  /workflow interrupt <run-id|--all>
77
+ /workflow kill <run-id|--all>
73
78
  /workflow resume <run-id> [stage-id-or-name] [message]
74
79
  ```
75
80
 
76
- Named workflow dispatch is always background-oriented: expect a run id, then monitor status/attention states. Press F2 or run `/workflow connect <run-id>` to open the live graph viewer. HIL prompts from `ctx.ui.input/confirm/select/editor` appear in that workflow UI, not as modal chat dialogs.
81
+ Named workflow dispatch is always background-oriented: expect a run id, then monitor status/attention states. Press F2 or run `/workflow connect <run-id>` to open the live graph viewer. Use `workflow({ action: "interrupt" })` or `/workflow interrupt` for resumable interruption, and `workflow({ action: "kill" })` or `/workflow kill` only when the run should be terminated and removed from live history/status. HIL prompts from `ctx.ui.input/confirm/select/editor` appear in that workflow UI, not as modal chat dialogs.
82
+
83
+ Workflow tool run-control parity:
84
+
85
+ - `interrupt`, `kill`, and `resume` accept full run ids or unique prefixes via `runId`.
86
+ - `interrupt` and `kill` default to the active run when `runId` is omitted.
87
+ - `interrupt` and `kill` support all in-flight runs with `all: true` or `runId: "--all"`.
88
+ - `resume` supports `stageId` as a stage id, unique prefix, or stage name, plus an optional `message` forwarded to paused work.
89
+ - `kill` is destructive: it aborts in-flight work and removes the run from live history/status. `interrupt` is resumable and keeps the run visible.
77
90
 
78
91
  ## Direct Workflow-Native Orchestration
79
92
 
@@ -127,18 +140,41 @@ workflow({
127
140
  })
128
141
  ```
129
142
 
130
- Task options mirror pi session options plus workflow-owned fields such as `output`, `reads`, `progress`, `worktree`, `maxOutput`, `artifacts`, `sessionDir`, `model`, `fallbackModels`, `thinkingLevel`, and per-stage `mcp` allow/deny.
143
+ Task options mirror pi session options plus workflow-owned fields such as `output`, `outputMode`, `reads`, `worktree`, `maxOutput`, `artifacts`, `sessionDir`, `cwd`, `agentDir`, `model`, `fallbackModels`, `thinkingLevel`, `context`, `tools`, `noTools`, `customTools`, `forkFromSessionFile`, and per-stage `mcp` allow/deny. Direct chain orchestration also supports `chainName` and `chainDir` for artifact grouping and shared chain-relative files.
131
144
 
132
145
  ## Authoring Process
133
146
 
134
147
  ### 1. Locate the workflow surface
135
148
 
136
- For user-authored workflows, place definitions where pi discovers them:
149
+ Atomic/pi discovers workflow definitions in this override order:
150
+
151
+ 1. Configured project files from `.atomic/extensions/workflow/config.json` (`workflows.<name>.path`). Legacy `.pi/...` config paths are also considered.
152
+ 2. Project-local files in `.atomic/workflows/*.{ts,js,mjs,cjs}`. Legacy `.pi/workflows/` is also checked.
153
+ 3. Configured global files from `~/.atomic/agent/extensions/workflow/config.json`. Legacy `~/.pi/...` config paths are also considered.
154
+ 4. User-global files in `~/.atomic/agent/workflows/*.{ts,js,mjs,cjs}`. Legacy `~/.pi/agent/workflows/` is also checked.
155
+ 5. Package-provided workflow files from installed Atomic/pi packages.
156
+ 6. Bundled workflows shipped with `@bastani/workflows`.
157
+
158
+ A workflow module may export one default workflow definition and/or named workflow definitions; discovery checks the default export first, then named exports.
159
+
160
+ Extension config can also tune runtime behavior:
161
+
162
+ ```json
163
+ {
164
+ "workflows": {
165
+ "team": { "path": "./workflows/team.ts" }
166
+ },
167
+ "defaultConcurrency": 4,
168
+ "maxDepth": 4,
169
+ "persistRuns": true,
170
+ "statusFile": false,
171
+ "resumeInFlight": "ask"
172
+ }
173
+ ```
174
+
175
+ Project config relative workflow paths resolve from the project root. Global config relative paths resolve from the user agent directory. When `statusFile` is enabled, the derived status file defaults under `.atomic/workflows/status.json` for the project.
137
176
 
138
- - Project-local: `.atomic/workflows/*.{ts,js,mjs,cjs}` inside the current project. Legacy `.pi/workflows/` is also checked for compatibility.
139
- - User-global: `~/.atomic/agent/workflows/*.{ts,js,mjs,cjs}` for workflows available across projects. Legacy `~/.pi/agent/workflows/` is also checked.
140
- - Configured directories: `.atomic/extensions/workflow/config.json` or `~/.atomic/agent/extensions/workflow/config.json` may add named `workflows.<name>.path` entries; legacy `.pi/...` config paths are also considered.
141
- - Package workflows: a pi package can expose bundled workflow directories through `package.json` under `pi.builtin`.
177
+ Package-provided workflows can be exposed through host package metadata or a conventional `workflows/` directory; singular `workflow/` is accepted as an alias. For new Atomic package examples, prefer app-name keys when supported (for example `atomic.workflows` / `atomic.extensions`); keep `pi.workflows` / `pi.extensions` in mind for pi compatibility and existing first-party package metadata.
142
178
 
143
179
  If an existing project has workflow examples, inspect those first for import style and naming conventions. In a normal consumer project, import from the package:
144
180
 
@@ -193,18 +229,22 @@ Builder rules:
193
229
  - `.run(async (ctx) => ({ ... }))` defines the workflow body.
194
230
  - `.compile()` returns the workflow definition for discovery.
195
231
 
232
+ **Anti-pattern: no-stage workflows.** Do not author workflows whose `run` body only performs deterministic code and returns a value without creating a tracked workflow stage. A registered workflow must call at least one of `ctx.task()`, `ctx.chain()`, `ctx.parallel()`, or `ctx.stage()` in its run body. Pure no-stage workflows are invalid, are skipped during discovery, and surface startup diagnostics because they defeat workflow orchestration and render an empty graph (`cachedLayout.length === 0`). If all work is deterministic TypeScript with no LLM/session stage, write a script or extension command instead of a workflow.
233
+
196
234
  Input types: `text`, `string`, `number`, `boolean`, `select`. All support `description` and `required`; defaults are type-specific; `select` requires `choices`. Runtime validation rejects unknown keys, missing required values, type mismatches, and select values outside `choices`.
197
235
 
198
236
  ### 4. Pick the right primitive
199
237
 
200
- | Need | Use |
238
+ Default to the high-level primitives because they create tracked graph nodes, standardize handoffs, and keep workflow definitions readable:
239
+
240
+ | Need | Preferred primitive |
201
241
  | --- | --- |
202
- | One LLM task with workflow tracking | `ctx.task(name, options)` |
203
- | Independent branches | `ctx.parallel(steps, { task? })` |
204
- | Dependent stages | `ctx.chain(steps, { task? })` |
205
- | Low-level session controls | `ctx.stage(name, options)` then `stage.prompt/complete` |
206
- | User interaction during run | `ctx.ui.input/confirm/select/editor` |
207
- | Pure computation / file I/O / parsing | Plain TypeScript in `.run()` or helpers |
242
+ | One LLM/session task with workflow tracking | `ctx.task(name, options)` |
243
+ | Dependent sequential tasks | `ctx.chain(steps, { task? })` |
244
+ | Independent/concurrent branches | `ctx.parallel(steps, { task?, concurrency?, failFast? })` |
245
+ | Human-in-the-loop decision in the workflow run | `ctx.ui.input/confirm/select/editor` |
246
+ | Pure deterministic computation, parsing, or file I/O | Plain TypeScript in `.run()` or helpers, paired with a nearby tracked stage when it contributes to stage output |
247
+ | Advanced/fine-grained session control | `ctx.stage(name, options)` then `stage.prompt/complete`; use when you need lower-level controls such as steer/follow-up messages, model switching, subscriptions, tree navigation, compaction, or abort |
208
248
 
209
249
  Use `previous` plus `{previous}` for context handoff. If no placeholder is present, the runtime appends context. Chain defaults: first missing task uses `{task}`, later missing tasks use `{previous}`, and missing tasks inside chain-parallel groups use `{previous}`.
210
250
 
@@ -223,7 +263,7 @@ Prefer concise structured returns and durable artifacts over dumping full transc
223
263
 
224
264
  ## Execution Model
225
265
 
226
- `@bastani/workflows` follows pi's package/extension model: pi loads the extension from the package manifest, and the extension registers the `workflow` tool, `/workflow` command, UI renderers, widgets, and lifecycle hooks in-process.
266
+ `@bastani/workflows` follows Atomic/pi's package/extension model: the host loads extension metadata from supported package manifest keys (new app-name keys where available plus pi-compatible metadata used by existing packages), then the extension registers the `workflow` tool, `/workflow` command, UI renderers, widgets, and lifecycle hooks in-process.
227
267
 
228
268
  Use these supported workflow surfaces:
229
269
 
@@ -243,19 +283,38 @@ const definition = {
243
283
  inputs: {
244
284
  prompt: "map workflow sdk",
245
285
  max_partitions: 1,
286
+ max_concurrency: 4,
246
287
  },
247
288
  } as const;
248
289
 
249
290
  const options: WorkflowOptions = {};
250
291
 
251
292
  await runWorkflow(definition, options);
293
+
294
+ await runWorkflow({
295
+ mode: "parallel",
296
+ task: "Audit auth changes",
297
+ tasks: [
298
+ { name: "security", task: "Review security risks" },
299
+ { name: "runtime", task: "Review runtime risks" },
300
+ ],
301
+ concurrency: 2,
302
+ reads: ["research/context.md"],
303
+ output: "research/auth-audit.md",
304
+ outputMode: "inline",
305
+ maxOutput: { lines: 2000 },
306
+ artifacts: true,
307
+ });
252
308
  ```
253
309
 
310
+ The programmatic definition object mirrors the workflow tool for named runs (`mode: "workflow"` / `"named"`), direct single-task runs (`"single"`), parallel `tasks` (`"parallel"`), mixed `chain` runs (`"chain"`), direct options, and stage/session options. Use `chainDir` for chain-local shared artifacts/relative reads/outputs/worktree diffs and `chainName` for status/artifact grouping.
311
+
254
312
  ## Safety and Compatibility Rules
255
313
 
256
314
  - Do not fabricate workflow names or inputs; list/inspect first with `list`, `get`, or `inputs`.
257
315
  - Do not use legacy workflow tool fields such as `agent`, `stage`, or run-control `name`.
258
316
  - Do not expect workflow-tool `create`, `update`, or `delete`; reusable definitions are code-authored.
317
+ - For new Atomic package metadata, prefer app-name manifest keys such as `atomic.workflows`/`atomic.extensions` when supported; preserve `pi.workflows`/`pi.extensions` compatibility for existing pi packages and current first-party package metadata.
259
318
  - Use `/workflow` slash commands for named runs, input picker/help, graph attach, pause/resume, status, and diagnostics.
260
319
  - Prefer `ctx.task`, `ctx.parallel`, and `ctx.chain`; drop to `ctx.stage` only for lower-level controls.
261
320
  - Keep stage names user-readable because they appear in workflow status/UI.
@@ -20,19 +20,19 @@ If required inputs are missing and cannot be inferred, ask the user with `ask_us
20
20
  workflow({
21
21
  action: "run",
22
22
  workflow: "deep-research-codebase",
23
- inputs: { prompt: "map workflow dispatch" },
23
+ inputs: { prompt: "map workflow dispatch", max_concurrency: 4 },
24
24
  })
25
25
  ```
26
26
 
27
27
  Slash equivalent:
28
28
 
29
29
  ```text
30
- /workflow deep-research-codebase prompt="map workflow dispatch"
30
+ /workflow deep-research-codebase prompt="map workflow dispatch" max_concurrency=4
31
31
  ```
32
32
 
33
33
  Input overrides are bare `key=value` tokens. Values are JSON-parsed when possible, so `count=3`, `flag=true`, and `prompt="multi word value"` preserve useful types. A whole input object can also be passed as one JSON token.
34
34
 
35
- Named workflow dispatch is always background-oriented: expect a run id and then monitor status. Press F2 or use `/workflow connect <run-id>` to attach to the graph viewer. If the TUI is available and required inputs are missing, `/workflow <name>` opens an input picker unless the user passes `--no-picker`.
35
+ Named workflow dispatch is always background-oriented: expect a run id and then monitor status. Press F2 or use `/workflow connect <run-id>` to attach to the graph viewer. In the TUI, `/workflow <name>` opens an input picker when the workflow declares inputs and either no arguments were supplied or required inputs are missing; supplied values seed the picker. Pass `--no-picker` to skip that interactive flow.
36
36
 
37
37
  ## Slash command surface
38
38
 
@@ -47,10 +47,11 @@ Named workflow dispatch is always background-oriented: expect a run id and then
47
47
  /workflow status [run-id]
48
48
  /workflow status --all
49
49
  /workflow interrupt <run-id|--all>
50
+ /workflow kill <run-id|--all>
50
51
  /workflow resume <run-id> [stage-id-or-name] [message]
51
52
  ```
52
53
 
53
- Use `connect` for the orchestrator graph. Use `attach` when the user wants to open a chat pane for a specific stage. Use `pause`/`resume` for live paused work; `resume` on a non-paused run reopens the saved snapshot/overlay.
54
+ Use `connect` for the orchestrator graph. Use `attach` when the user wants to open a chat pane for a specific stage. Use `interrupt`/`pause`/`resume` for resumable live work; `resume` on a non-paused run reopens the saved snapshot/overlay. Use `kill` only when the run should be terminated and removed from live history/status. `/workflow status` lists in-flight runs by default; `/workflow status --all` includes retained ended runs as well.
54
55
 
55
56
  Human-in-the-loop prompts from `ctx.ui.input`, `ctx.ui.confirm`, `ctx.ui.select`, and `ctx.ui.editor` surface in the workflow UI/graph viewer, not as ordinary chat modals.
56
57
 
@@ -95,21 +96,42 @@ workflow({
95
96
  })
96
97
  ```
97
98
 
98
- Direct mode supports top-level/default options and per-task options such as `context`, `model`, `fallbackModels`, `thinkingLevel`, `mcp`, `output`, `reads`, `progress`, `worktree`, `maxOutput`, `artifacts`, `sessionDir`, and `cwd`. For large fan-outs, prefer `outputMode: "file-only"`.
99
+ Direct mode supports top-level/default options and per-task options such as `context`, `forkFromSessionFile`, `model`, `fallbackModels`, `thinkingLevel`, `tools`, `noTools`, `customTools`, `mcp`, `output`, `outputMode`, `reads`, `worktree`, `maxOutput`, `artifacts`, `sessionDir`, `cwd`, and `agentDir`. Direct chains also support `chainName`, `chainDir`, and `failFast`; use `chainDir` for shared relative reads/outputs/worktree diffs. For large fan-outs, prefer `outputMode: "file-only"`.
99
100
 
100
101
  ## Monitor/control with the workflow tool
101
102
 
103
+ The LLM-callable workflow tool exposes lifecycle controls with the same targeting affordances as the slash commands where a non-interactive tool call makes sense.
104
+
102
105
  ```ts
103
106
  workflow({ action: "status" })
104
- workflow({ action: "status", runId: "<id>" })
105
- workflow({ action: "interrupt", runId: "<id>" })
107
+ workflow({ action: "status", runId: "<id-or-prefix>" })
108
+
109
+ // Resumable interruption. Omit runId to target the active run.
110
+ workflow({ action: "interrupt" })
111
+ workflow({ action: "interrupt", runId: "<id-or-prefix>" })
112
+ workflow({ action: "interrupt", all: true })
106
113
  workflow({ action: "interrupt", runId: "--all" })
107
- workflow({ action: "resume", runId: "<id>" })
114
+
115
+ // Resume a run, optionally targeting a stage by id, prefix, or name.
116
+ workflow({ action: "resume", runId: "<id-or-prefix>" })
117
+ workflow({ action: "resume", runId: "<id-or-prefix>", stageId: "review", message: "continue with the approved fix" })
118
+
119
+ // Destructive termination. Omit runId to target the active run.
120
+ workflow({ action: "kill" })
121
+ workflow({ action: "kill", runId: "<id-or-prefix>" })
122
+ workflow({ action: "kill", all: true })
123
+ workflow({ action: "kill", runId: "--all" })
108
124
  ```
109
125
 
110
- The LLM-callable tool exposes status/interrupt/resume controls. Use slash commands for graph connect, stage attach, and pause because those are interactive TUI surfaces.
126
+ Control semantics:
127
+
128
+ - `runId` accepts full run ids or unique prefixes for `status`, `interrupt`, `resume`, and `kill`.
129
+ - `interrupt` and `kill` default to the active run when `runId` is omitted.
130
+ - `interrupt` is resumable: it pauses live work when pausable stages exist and keeps the run in live history/status.
131
+ - `resume` can target a stage with `stageId`; the target may be a stage id, unique prefix, or stage name. `message` is forwarded to paused work.
132
+ - `kill` is destructive: it aborts in-flight work and removes the run from live history/status. Use it only when the user wants the workflow gone.
111
133
 
112
- When a run needs user input or attention, surface that to the user instead of polling silently.
134
+ Use slash commands for graph connect and stage attach because those are interactive TUI surfaces. When a run needs user input or attention, surface that to the user instead of polling silently.
113
135
 
114
136
  ## Intercom
115
137
 
@@ -133,4 +155,5 @@ Treat intercom payloads as user-visible workflow output.
133
155
  - Do not use legacy tool fields like `agent`, `stage`, or run-control `name`.
134
156
  - Do not expect named workflow runs to block the chat turn; they are background tasks.
135
157
  - Prefer `outputMode: "file-only"` for large fan-outs.
136
- - Use status/resume controls for run lifecycle; inspect workflow output and artifacts for behavior.
158
+ - Use status/interrupt/resume/kill controls for run lifecycle; inspect workflow output and artifacts for behavior.
159
+ - Do not call `kill` when the user asks to interrupt or pause resumably; kill removes the run from live history/status.