@bastani/atomic 0.8.13 → 0.8.14-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 (355) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/builtin/intercom/package.json +1 -1
  3. package/dist/builtin/mcp/host-html-template.ts +1 -1
  4. package/dist/builtin/mcp/init.ts +15 -2
  5. package/dist/builtin/mcp/mcp-callback-server.ts +10 -9
  6. package/dist/builtin/mcp/package.json +1 -1
  7. package/dist/builtin/mcp/ui-session.ts +9 -6
  8. package/dist/builtin/subagents/CHANGELOG.md +8 -1
  9. package/dist/builtin/subagents/README.md +39 -32
  10. package/dist/builtin/subagents/package.json +1 -1
  11. package/dist/builtin/subagents/skills/subagent/SKILL.md +11 -11
  12. package/dist/builtin/subagents/src/agents/agent-management.ts +6 -1
  13. package/dist/builtin/subagents/src/agents/agent-serializer.ts +2 -0
  14. package/dist/builtin/subagents/src/agents/agents.ts +44 -19
  15. package/dist/builtin/subagents/src/extension/config.ts +16 -0
  16. package/dist/builtin/subagents/src/extension/fanout-child.ts +246 -0
  17. package/dist/builtin/subagents/src/extension/index.ts +466 -603
  18. package/dist/builtin/subagents/src/intercom/intercom-bridge.ts +6 -4
  19. package/dist/builtin/subagents/src/intercom/result-intercom.ts +109 -1
  20. package/dist/builtin/subagents/src/runs/background/async-execution.ts +124 -19
  21. package/dist/builtin/subagents/src/runs/background/async-job-tracker.ts +41 -6
  22. package/dist/builtin/subagents/src/runs/background/async-resume.ts +28 -15
  23. package/dist/builtin/subagents/src/runs/background/async-status.ts +60 -30
  24. package/dist/builtin/subagents/src/runs/background/result-watcher.ts +111 -54
  25. package/dist/builtin/subagents/src/runs/background/run-id-resolver.ts +83 -0
  26. package/dist/builtin/subagents/src/runs/background/run-status.ts +79 -3
  27. package/dist/builtin/subagents/src/runs/background/stale-run-reconciler.ts +46 -1
  28. package/dist/builtin/subagents/src/runs/background/subagent-runner.ts +66 -14
  29. package/dist/builtin/subagents/src/runs/foreground/chain-execution.ts +10 -3
  30. package/dist/builtin/subagents/src/runs/foreground/execution.ts +14 -2
  31. package/dist/builtin/subagents/src/runs/foreground/subagent-executor.ts +320 -23
  32. package/dist/builtin/subagents/src/runs/shared/completion-guard.ts +23 -1
  33. package/dist/builtin/subagents/src/runs/shared/mcp-direct-tool-allowlist.ts +369 -0
  34. package/dist/builtin/subagents/src/runs/shared/nested-events.ts +935 -0
  35. package/dist/builtin/subagents/src/runs/shared/nested-path.ts +52 -0
  36. package/dist/builtin/subagents/src/runs/shared/nested-render.ts +115 -0
  37. package/dist/builtin/subagents/src/runs/shared/parallel-utils.ts +1 -0
  38. package/dist/builtin/subagents/src/runs/shared/pi-args.ts +82 -9
  39. package/dist/builtin/subagents/src/runs/shared/pi-spawn.ts +1 -1
  40. package/dist/builtin/subagents/src/runs/shared/single-output.ts +12 -2
  41. package/dist/builtin/subagents/src/runs/shared/subagent-prompt-runtime.ts +32 -10
  42. package/dist/builtin/subagents/src/runs/shared/worktree.ts +3 -2
  43. package/dist/builtin/subagents/src/shared/artifacts.ts +0 -1
  44. package/dist/builtin/subagents/src/shared/types.ts +96 -1
  45. package/dist/builtin/subagents/src/shared/utils.ts +10 -2
  46. package/dist/builtin/subagents/src/slash/slash-commands.ts +468 -625
  47. package/dist/builtin/subagents/src/tui/render.ts +1227 -2093
  48. package/dist/builtin/web-access/package.json +1 -1
  49. package/dist/builtin/workflows/CHANGELOG.md +24 -0
  50. package/dist/builtin/workflows/README.md +28 -11
  51. package/dist/builtin/workflows/builtin/deep-research-codebase.ts +323 -40
  52. package/dist/builtin/workflows/builtin/ralph.ts +362 -176
  53. package/dist/builtin/workflows/package.json +2 -5
  54. package/dist/builtin/workflows/skills/research-codebase/SKILL.md +1 -1
  55. package/dist/builtin/workflows/skills/skill-creator/LICENSE.txt +202 -0
  56. package/dist/builtin/workflows/skills/skill-creator/SKILL.md +489 -0
  57. package/dist/builtin/workflows/skills/skill-creator/agents/analyzer.md +274 -0
  58. package/dist/builtin/workflows/skills/skill-creator/agents/comparator.md +202 -0
  59. package/dist/builtin/workflows/skills/skill-creator/agents/grader.md +223 -0
  60. package/dist/builtin/workflows/skills/skill-creator/assets/eval_review.html +146 -0
  61. package/dist/builtin/workflows/skills/skill-creator/eval-viewer/generate_review.py +471 -0
  62. package/dist/builtin/workflows/skills/skill-creator/eval-viewer/viewer.html +1325 -0
  63. package/dist/builtin/workflows/skills/skill-creator/references/schemas.md +430 -0
  64. package/dist/builtin/workflows/skills/skill-creator/scripts/__init__.py +0 -0
  65. package/dist/builtin/workflows/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
  66. package/dist/builtin/workflows/skills/skill-creator/scripts/generate_report.py +326 -0
  67. package/dist/builtin/workflows/skills/skill-creator/scripts/improve_description.py +247 -0
  68. package/dist/builtin/workflows/skills/skill-creator/scripts/package_skill.py +136 -0
  69. package/dist/builtin/workflows/skills/skill-creator/scripts/quick_validate.py +103 -0
  70. package/dist/builtin/workflows/skills/skill-creator/scripts/run_eval.py +310 -0
  71. package/dist/builtin/workflows/skills/skill-creator/scripts/run_loop.py +328 -0
  72. package/dist/builtin/workflows/skills/skill-creator/scripts/utils.py +47 -0
  73. package/dist/builtin/workflows/src/extension/index.ts +869 -93
  74. package/dist/builtin/workflows/src/extension/render-call.ts +34 -1
  75. package/dist/builtin/workflows/src/extension/render-result.ts +126 -21
  76. package/dist/builtin/workflows/src/extension/runtime.ts +91 -3
  77. package/dist/builtin/workflows/src/extension/wiring.ts +38 -12
  78. package/dist/builtin/workflows/src/extension/workflow-schema.ts +62 -5
  79. package/dist/builtin/workflows/src/runs/background/runner.ts +3 -3
  80. package/dist/builtin/workflows/src/runs/background/status.ts +42 -8
  81. package/dist/builtin/workflows/src/runs/foreground/executor.ts +410 -95
  82. package/dist/builtin/workflows/src/runs/foreground/stage-control-registry.ts +5 -2
  83. package/dist/builtin/workflows/src/runs/foreground/stage-runner.ts +8 -0
  84. package/dist/builtin/workflows/src/runs/shared/model-fallback.ts +6 -4
  85. package/dist/builtin/workflows/src/runs/shared/worktree.ts +3 -2
  86. package/dist/builtin/workflows/src/shared/persistence-restore.ts +138 -5
  87. package/dist/builtin/workflows/src/shared/persistence-session-entries.ts +30 -0
  88. package/dist/builtin/workflows/src/shared/render-inputs-schema.ts +78 -120
  89. package/dist/builtin/workflows/src/shared/stage-ui-broker.ts +193 -0
  90. package/dist/builtin/workflows/src/shared/store-types.ts +26 -1
  91. package/dist/builtin/workflows/src/shared/store.ts +145 -17
  92. package/dist/builtin/workflows/src/shared/timing.ts +6 -2
  93. package/dist/builtin/workflows/src/shared/workflow-failures.ts +375 -0
  94. package/dist/builtin/workflows/src/tui/chat-surface.ts +68 -17
  95. package/dist/builtin/workflows/src/tui/connectors.ts +2 -2
  96. package/dist/builtin/workflows/src/tui/dispatch-confirm.ts +24 -26
  97. package/dist/builtin/workflows/src/tui/graph-canvas.ts +4 -8
  98. package/dist/builtin/workflows/src/tui/graph-view.ts +17 -14
  99. package/dist/builtin/workflows/src/tui/header.ts +38 -0
  100. package/dist/builtin/workflows/src/tui/inline-form-card.ts +161 -238
  101. package/dist/builtin/workflows/src/tui/inline-form-editor.ts +68 -73
  102. package/dist/builtin/workflows/src/tui/inline-form-overlay.ts +2 -3
  103. package/dist/builtin/workflows/src/tui/inline-form-store.ts +2 -1
  104. package/dist/builtin/workflows/src/tui/inputs-overlay.ts +1 -3
  105. package/dist/builtin/workflows/src/tui/inputs-picker.ts +286 -399
  106. package/dist/builtin/workflows/src/tui/keybindings-adapter.ts +11 -0
  107. package/dist/builtin/workflows/src/tui/node-card.ts +2 -1
  108. package/dist/builtin/workflows/src/tui/overlay-adapter.ts +9 -1
  109. package/dist/builtin/workflows/src/tui/prompt-card.ts +46 -19
  110. package/dist/builtin/workflows/src/tui/run-detail.ts +63 -80
  111. package/dist/builtin/workflows/src/tui/session-confirm.ts +9 -3
  112. package/dist/builtin/workflows/src/tui/session-picker.ts +19 -16
  113. package/dist/builtin/workflows/src/tui/stage-chat-layout.ts +88 -0
  114. package/dist/builtin/workflows/src/tui/stage-chat-view.ts +368 -879
  115. package/dist/builtin/workflows/src/tui/status-helpers.ts +4 -0
  116. package/dist/builtin/workflows/src/tui/status-list.ts +67 -75
  117. package/dist/builtin/workflows/src/tui/store-widget-installer.ts +50 -12
  118. package/dist/builtin/workflows/src/tui/submit-pane.ts +164 -0
  119. package/dist/builtin/workflows/src/tui/switcher.ts +27 -4
  120. package/dist/builtin/workflows/src/tui/text-helpers.ts +98 -4
  121. package/dist/builtin/workflows/src/tui/widget.ts +90 -68
  122. package/dist/builtin/workflows/src/tui/workflow-attach-pane.ts +23 -2
  123. package/dist/builtin/workflows/src/tui/workflow-list.ts +44 -68
  124. package/dist/cli/file-processor.d.ts.map +1 -1
  125. package/dist/cli/file-processor.js +2 -3
  126. package/dist/cli/file-processor.js.map +1 -1
  127. package/dist/config.d.ts.map +1 -1
  128. package/dist/config.js +3 -10
  129. package/dist/config.js.map +1 -1
  130. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  131. package/dist/core/agent-session-runtime.js +2 -1
  132. package/dist/core/agent-session-runtime.js.map +1 -1
  133. package/dist/core/agent-session-services.d.ts.map +1 -1
  134. package/dist/core/agent-session-services.js +3 -2
  135. package/dist/core/agent-session-services.js.map +1 -1
  136. package/dist/core/agent-session.d.ts +6 -0
  137. package/dist/core/agent-session.d.ts.map +1 -1
  138. package/dist/core/agent-session.js +16 -2
  139. package/dist/core/agent-session.js.map +1 -1
  140. package/dist/core/atomic-guide-command.d.ts.map +1 -1
  141. package/dist/core/atomic-guide-command.js +8 -9
  142. package/dist/core/atomic-guide-command.js.map +1 -1
  143. package/dist/core/auth-storage.d.ts.map +1 -1
  144. package/dist/core/auth-storage.js +3 -2
  145. package/dist/core/auth-storage.js.map +1 -1
  146. package/dist/core/bash-executor.d.ts.map +1 -1
  147. package/dist/core/bash-executor.js +2 -1
  148. package/dist/core/bash-executor.js.map +1 -1
  149. package/dist/core/export-html/index.d.ts.map +1 -1
  150. package/dist/core/export-html/index.js +8 -6
  151. package/dist/core/export-html/index.js.map +1 -1
  152. package/dist/core/export-html/template.js +6 -3
  153. package/dist/core/extensions/loader.d.ts.map +1 -1
  154. package/dist/core/extensions/loader.js +12 -29
  155. package/dist/core/extensions/loader.js.map +1 -1
  156. package/dist/core/model-registry.d.ts.map +1 -1
  157. package/dist/core/model-registry.js +5 -1
  158. package/dist/core/model-registry.js.map +1 -1
  159. package/dist/core/package-manager.d.ts +8 -0
  160. package/dist/core/package-manager.d.ts.map +1 -1
  161. package/dist/core/package-manager.js +145 -58
  162. package/dist/core/package-manager.js.map +1 -1
  163. package/dist/core/prompt-templates.d.ts.map +1 -1
  164. package/dist/core/prompt-templates.js +6 -20
  165. package/dist/core/prompt-templates.js.map +1 -1
  166. package/dist/core/resource-loader.d.ts.map +1 -1
  167. package/dist/core/resource-loader.js +38 -31
  168. package/dist/core/resource-loader.js.map +1 -1
  169. package/dist/core/sdk.d.ts.map +1 -1
  170. package/dist/core/sdk.js +9 -4
  171. package/dist/core/sdk.js.map +1 -1
  172. package/dist/core/session-manager.d.ts.map +1 -1
  173. package/dist/core/session-manager.js +32 -24
  174. package/dist/core/session-manager.js.map +1 -1
  175. package/dist/core/settings-manager.d.ts.map +1 -1
  176. package/dist/core/settings-manager.js +8 -15
  177. package/dist/core/settings-manager.js.map +1 -1
  178. package/dist/core/skills.d.ts.map +1 -1
  179. package/dist/core/skills.js +8 -22
  180. package/dist/core/skills.js.map +1 -1
  181. package/dist/core/tools/ask-user-question/state/questionnaire-session.d.ts +5 -4
  182. package/dist/core/tools/ask-user-question/state/questionnaire-session.d.ts.map +1 -1
  183. package/dist/core/tools/ask-user-question/state/questionnaire-session.js +34 -11
  184. package/dist/core/tools/ask-user-question/state/questionnaire-session.js.map +1 -1
  185. package/dist/core/tools/ask-user-question/state/selectors/contract.d.ts +1 -0
  186. package/dist/core/tools/ask-user-question/state/selectors/contract.d.ts.map +1 -1
  187. package/dist/core/tools/ask-user-question/state/selectors/contract.js.map +1 -1
  188. package/dist/core/tools/ask-user-question/state/selectors/projections.d.ts.map +1 -1
  189. package/dist/core/tools/ask-user-question/state/selectors/projections.js +1 -0
  190. package/dist/core/tools/ask-user-question/state/selectors/projections.js.map +1 -1
  191. package/dist/core/tools/ask-user-question/state/state-reducer.d.ts +1 -2
  192. package/dist/core/tools/ask-user-question/state/state-reducer.d.ts.map +1 -1
  193. package/dist/core/tools/ask-user-question/state/state-reducer.js +26 -9
  194. package/dist/core/tools/ask-user-question/state/state-reducer.js.map +1 -1
  195. package/dist/core/tools/ask-user-question/state/state.d.ts +4 -0
  196. package/dist/core/tools/ask-user-question/state/state.d.ts.map +1 -1
  197. package/dist/core/tools/ask-user-question/state/state.js.map +1 -1
  198. package/dist/core/tools/ask-user-question/view/components/option-list-view.d.ts +1 -0
  199. package/dist/core/tools/ask-user-question/view/components/option-list-view.d.ts.map +1 -1
  200. package/dist/core/tools/ask-user-question/view/components/option-list-view.js +1 -0
  201. package/dist/core/tools/ask-user-question/view/components/option-list-view.js.map +1 -1
  202. package/dist/core/tools/ask-user-question/view/components/wrapping-select.d.ts +9 -6
  203. package/dist/core/tools/ask-user-question/view/components/wrapping-select.d.ts.map +1 -1
  204. package/dist/core/tools/ask-user-question/view/components/wrapping-select.js +28 -7
  205. package/dist/core/tools/ask-user-question/view/components/wrapping-select.js.map +1 -1
  206. package/dist/core/tools/ask-user-question/view/props-adapter.d.ts.map +1 -1
  207. package/dist/core/tools/ask-user-question/view/props-adapter.js +4 -1
  208. package/dist/core/tools/ask-user-question/view/props-adapter.js.map +1 -1
  209. package/dist/core/tools/bash.d.ts.map +1 -1
  210. package/dist/core/tools/bash.js +56 -53
  211. package/dist/core/tools/bash.js.map +1 -1
  212. package/dist/core/tools/edit-diff.d.ts +3 -1
  213. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  214. package/dist/core/tools/edit-diff.js +8 -1
  215. package/dist/core/tools/edit-diff.js.map +1 -1
  216. package/dist/core/tools/edit.d.ts +3 -1
  217. package/dist/core/tools/edit.d.ts.map +1 -1
  218. package/dist/core/tools/edit.js +44 -81
  219. package/dist/core/tools/edit.js.map +1 -1
  220. package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
  221. package/dist/core/tools/file-mutation-queue.js +27 -12
  222. package/dist/core/tools/file-mutation-queue.js.map +1 -1
  223. package/dist/core/tools/find.d.ts.map +1 -1
  224. package/dist/core/tools/find.js +2 -3
  225. package/dist/core/tools/find.js.map +1 -1
  226. package/dist/core/tools/grep.d.ts.map +1 -1
  227. package/dist/core/tools/grep.js +3 -3
  228. package/dist/core/tools/grep.js.map +1 -1
  229. package/dist/core/tools/ls.d.ts.map +1 -1
  230. package/dist/core/tools/ls.js +5 -5
  231. package/dist/core/tools/ls.js.map +1 -1
  232. package/dist/core/tools/output-accumulator.d.ts +2 -0
  233. package/dist/core/tools/output-accumulator.d.ts.map +1 -1
  234. package/dist/core/tools/output-accumulator.js +11 -4
  235. package/dist/core/tools/output-accumulator.js.map +1 -1
  236. package/dist/core/tools/path-utils.d.ts +2 -0
  237. package/dist/core/tools/path-utils.d.ts.map +1 -1
  238. package/dist/core/tools/path-utils.js +39 -21
  239. package/dist/core/tools/path-utils.js.map +1 -1
  240. package/dist/core/tools/read.d.ts.map +1 -1
  241. package/dist/core/tools/read.js +9 -8
  242. package/dist/core/tools/read.js.map +1 -1
  243. package/dist/core/tools/truncate.d.ts.map +1 -1
  244. package/dist/core/tools/truncate.js +12 -2
  245. package/dist/core/tools/truncate.js.map +1 -1
  246. package/dist/core/tools/write.d.ts.map +1 -1
  247. package/dist/core/tools/write.js +20 -35
  248. package/dist/core/tools/write.js.map +1 -1
  249. package/dist/index.d.ts +2 -1
  250. package/dist/index.d.ts.map +1 -1
  251. package/dist/index.js +4 -1
  252. package/dist/index.js.map +1 -1
  253. package/dist/main.d.ts.map +1 -1
  254. package/dist/main.js +5 -6
  255. package/dist/main.js.map +1 -1
  256. package/dist/modes/interactive/chat-input-actions.d.ts +24 -0
  257. package/dist/modes/interactive/chat-input-actions.d.ts.map +1 -0
  258. package/dist/modes/interactive/chat-input-actions.js +179 -0
  259. package/dist/modes/interactive/chat-input-actions.js.map +1 -0
  260. package/dist/modes/interactive/components/chat-message-renderer.d.ts +1 -0
  261. package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
  262. package/dist/modes/interactive/components/chat-message-renderer.js +14 -3
  263. package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
  264. package/dist/modes/interactive/components/chat-session-host.d.ts +157 -0
  265. package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -0
  266. package/dist/modes/interactive/components/chat-session-host.js +1007 -0
  267. package/dist/modes/interactive/components/chat-session-host.js.map +1 -0
  268. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  269. package/dist/modes/interactive/components/config-selector.js +1 -1
  270. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  271. package/dist/modes/interactive/components/footer.d.ts +1 -0
  272. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  273. package/dist/modes/interactive/components/footer.js +14 -5
  274. package/dist/modes/interactive/components/footer.js.map +1 -1
  275. package/dist/modes/interactive/components/index.d.ts +1 -0
  276. package/dist/modes/interactive/components/index.d.ts.map +1 -1
  277. package/dist/modes/interactive/components/index.js +1 -0
  278. package/dist/modes/interactive/components/index.js.map +1 -1
  279. package/dist/modes/interactive/components/login-dialog.d.ts +9 -1
  280. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  281. package/dist/modes/interactive/components/login-dialog.js +29 -4
  282. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  283. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  284. package/dist/modes/interactive/interactive-mode.js +18 -67
  285. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  286. package/dist/utils/child-process.d.ts +1 -0
  287. package/dist/utils/child-process.d.ts.map +1 -1
  288. package/dist/utils/child-process.js +8 -0
  289. package/dist/utils/child-process.js.map +1 -1
  290. package/dist/utils/clipboard-native.d.ts +3 -1
  291. package/dist/utils/clipboard-native.d.ts.map +1 -1
  292. package/dist/utils/clipboard-native.js +14 -8
  293. package/dist/utils/clipboard-native.js.map +1 -1
  294. package/dist/utils/image-resize-core.d.ts +30 -0
  295. package/dist/utils/image-resize-core.d.ts.map +1 -0
  296. package/dist/utils/image-resize-core.js +124 -0
  297. package/dist/utils/image-resize-core.js.map +1 -0
  298. package/dist/utils/image-resize-worker.d.ts +2 -0
  299. package/dist/utils/image-resize-worker.d.ts.map +1 -0
  300. package/dist/utils/image-resize-worker.js +31 -0
  301. package/dist/utils/image-resize-worker.js.map +1 -0
  302. package/dist/utils/image-resize.d.ts +7 -27
  303. package/dist/utils/image-resize.d.ts.map +1 -1
  304. package/dist/utils/image-resize.js +75 -115
  305. package/dist/utils/image-resize.js.map +1 -1
  306. package/dist/utils/paths.d.ts +16 -1
  307. package/dist/utils/paths.d.ts.map +1 -1
  308. package/dist/utils/paths.js +49 -7
  309. package/dist/utils/paths.js.map +1 -1
  310. package/docs/changelog.mdx +29 -0
  311. package/docs/compaction.md +1 -1
  312. package/docs/custom-provider.md +2 -2
  313. package/docs/development.md +1 -1
  314. package/docs/docs.json +98 -143
  315. package/docs/extensions.md +29 -16
  316. package/docs/favicon.svg +29 -0
  317. package/docs/images/interactive-mode.png +0 -0
  318. package/docs/images/tree-view.png +0 -0
  319. package/docs/images/workflow-command.png +0 -0
  320. package/docs/images/workflow-graph.png +0 -0
  321. package/docs/images/workflow-input-picker.png +0 -0
  322. package/docs/images/workflow-list.png +0 -0
  323. package/docs/index.md +10 -1
  324. package/docs/logo.svg +59 -0
  325. package/docs/packages.md +3 -3
  326. package/docs/providers.md +1 -1
  327. package/docs/quickstart.md +98 -2
  328. package/docs/rpc.md +8 -8
  329. package/docs/sdk.md +23 -12
  330. package/docs/sessions.md +1 -1
  331. package/docs/skills.md +15 -1
  332. package/docs/termux.md +11 -1
  333. package/docs/themes.md +6 -6
  334. package/docs/tui.md +18 -18
  335. package/docs/usage.md +1 -1
  336. package/docs/workflows.md +172 -2
  337. package/examples/extensions/subagent/index.ts +2 -1
  338. package/package.json +6 -6
  339. /package/dist/builtin/{workflows → subagents}/skills/playwright-cli/SKILL.md +0 -0
  340. /package/dist/builtin/{workflows → subagents}/skills/playwright-cli/references/element-attributes.md +0 -0
  341. /package/dist/builtin/{workflows → subagents}/skills/playwright-cli/references/playwright-tests.md +0 -0
  342. /package/dist/builtin/{workflows → subagents}/skills/playwright-cli/references/request-mocking.md +0 -0
  343. /package/dist/builtin/{workflows → subagents}/skills/playwright-cli/references/running-code.md +0 -0
  344. /package/dist/builtin/{workflows → subagents}/skills/playwright-cli/references/session-management.md +0 -0
  345. /package/dist/builtin/{workflows → subagents}/skills/playwright-cli/references/spec-driven-testing.md +0 -0
  346. /package/dist/builtin/{workflows → subagents}/skills/playwright-cli/references/storage-state.md +0 -0
  347. /package/dist/builtin/{workflows → subagents}/skills/playwright-cli/references/test-generation.md +0 -0
  348. /package/dist/builtin/{workflows → subagents}/skills/playwright-cli/references/tracing.md +0 -0
  349. /package/dist/builtin/{workflows → subagents}/skills/playwright-cli/references/video-recording.md +0 -0
  350. /package/dist/builtin/{workflows → subagents}/skills/tdd/SKILL.md +0 -0
  351. /package/dist/builtin/{workflows → subagents}/skills/tdd/deep-modules.md +0 -0
  352. /package/dist/builtin/{workflows → subagents}/skills/tdd/interface-design.md +0 -0
  353. /package/dist/builtin/{workflows → subagents}/skills/tdd/mocking.md +0 -0
  354. /package/dist/builtin/{workflows → subagents}/skills/tdd/refactoring.md +0 -0
  355. /package/dist/builtin/{workflows → subagents}/skills/tdd/tests.md +0 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/web-access",
3
- "version": "0.8.13",
3
+ "version": "0.8.14-0",
4
4
  "private": true,
5
5
  "description": "Atomic extension for web search, URL fetching, GitHub repo cloning, PDF/video extraction. Fork of: https://github.com/nicobailon/pi-web-access",
6
6
  "contributors": [
@@ -4,6 +4,30 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [Unreleased]
8
+
9
+ ### Added
10
+
11
+ - Added workflow tool stage introspection and control actions (`stages`, `stage`, `transcript`, `send`, `pause`, and `reload`) for inspecting stage state, reading transcripts, answering prompts, controlling live stages, pausing runs, and reloading workflow resources ([#1023](https://github.com/flora131/atomic/issues/1023)).
12
+
13
+ ### Changed
14
+
15
+ - Added a final Ralph PR-preparation phase that reviews changes against the configured base branch, tries available GitHub credentials using local git identity as a hint, posts implementation notes as a PR comment, and creates a pull request when possible.
16
+ - Updated Ralph to persist planner RFCs under `specs/`, keep OS-temp implementation notes during orchestration, and pass file paths rather than the full plan text to later stages ([#1037](https://github.com/flora131/atomic/issues/1037)).
17
+ - Updated `deep-research-codebase` output layout to write public reports under `research/` and hidden per-run handoff artifacts under `research/.deep-research-<run-id>/`.
18
+
19
+ ### Fixed
20
+
21
+ - Removed biasing stage-output and iteration-count context from Ralph reviewer prompts while making the comparison base branch explicit ([#1037](https://github.com/flora131/atomic/issues/1037)).
22
+ - Ordered snapshot transcript fallback entries chronologically before applying `tail`/`limit`, preserving terminal result/error entries after tools for missing or tied timestamps ([#1023](https://github.com/flora131/atomic/issues/1023)).
23
+ - Reloaded workflow resources directly for `workflow({ action: "reload" })` instead of queuing a literal `/workflow reload` follow-up ([#1023](https://github.com/flora131/atomic/issues/1023)).
24
+ - Kept pending prompts unresolved when `workflow({ action: "send" })` omits `text`, `response`, and `message`, while preserving explicit empty-string answers ([#1023](https://github.com/flora131/atomic/issues/1023)).
25
+ - Included `deep-research-codebase` discovery-stage handoff files in the persisted run manifest.
26
+ - Persisted `deep-research-codebase` final reports as dated Markdown research docs while retaining file-only handoffs for bounded aggregation.
27
+ - Prevented `deep-research-codebase` aggregation from inlining large specialist transcripts by using file-only handoff artifacts ([#1016](https://github.com/flora131/atomic/issues/1016)).
28
+ - Removed model metadata from workflow node cards while retaining fallback dependency metadata ([#1011](https://github.com/flora131/atomic/issues/1011)).
29
+ - Preserve the selected workflow switcher row highlight through truncation ellipses on long stage names.
30
+
7
31
  ## [0.0.1] — 2026-05-15
8
32
 
9
33
  ### Added
@@ -192,6 +192,7 @@ registry.get("alpha"); // compiled workflow definition | undefined
192
192
  | `/workflow interrupt [run-id\|--all]` | Pause active/named/all active runs so they can resume |
193
193
  | `/workflow kill [run-id\|--all]` | Kill and remove active/named/all active runs from status |
194
194
  | `/workflow resume <run-id>` | Resume paused work or re-open a run snapshot |
195
+ | `/workflow reload` | Reload discovered workflow resources in-process |
195
196
  | `/workflow inputs <name>` | Print the input schema for a workflow |
196
197
 
197
198
  Input overrides are bare `key=value` tokens (no leading `--`). Values are JSON-parsed when possible, so numbers, booleans, and quoted strings work as expected (e.g. `count=3`, `flag=true`, `prompt="multi word value"`). A whole-object override can be passed as a single JSON token (e.g. `{"prompt":"...","count":3}`).
@@ -207,11 +208,21 @@ Workflows always run as **background tasks** — the chat editor stays free whil
207
208
  "parameters": {
208
209
  "workflow": "string (optional) — workflow ID or normalized name",
209
210
  "inputs": "object (optional) — key/value map of workflow inputs",
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",
211
+ "action": "'run' | 'list' | 'get' | 'inputs' | 'status' | 'stages' | 'stage' | 'transcript' | 'send' | 'pause' | 'interrupt' | 'kill' | 'resume' | 'reload'",
212
+ "runId": "optional run id or unique prefix; control actions default to the active run where safe; use '--all' or all:true for pause/interrupt/kill all",
213
+ "stageId": "optional stage id, prefix, or name for stage-scoped actions; cannot be combined with all:true",
214
+ "statusFilter": "optional stages filter: pending/running/awaiting_input/paused/blocked/completed/failed/skipped/all",
215
+ "format": "optional agent-facing output format: text or json",
216
+ "limit": "transcript-only maximum number of most recent entries; default 50",
217
+ "tail": "transcript-only last-N entry count; overrides limit",
218
+ "includeToolOutput": "transcript-only flag for snapshot tool-event output; live transcripts may not expose tool output",
219
+ "text": "optional string payload for send/resume; explicit empty text answers pending prompts",
220
+ "response": "optional structured payload for answering pending prompts; explicit empty response is valid",
221
+ "message": "optional string payload for send/resume when text is not provided",
222
+ "delivery": "optional send delivery mode: auto, answer, prompt, steer, followUp, or resume; auto prioritizes answer, then resume, steer, followUp",
223
+ "promptId": "optional pending prompt identifier for send/answer",
224
+ "reason": "optional human-readable reload reason",
225
+ "all": "optional boolean for pause/interrupt/kill all; cannot be combined with stageId",
215
226
  "task/tasks/chain": "optional direct workflow-native orchestration modes"
216
227
  }
217
228
  }
@@ -219,6 +230,9 @@ Workflows always run as **background tasks** — the chat editor stays free whil
219
230
 
220
231
  - **`renderCall`** — renders a compact workflow call summary in the chat scroll.
221
232
  - **`renderResult`** — renders the result or dispatch banner; live progress continues through the widget and graph viewer. Named workflow runs are background-oriented.
233
+ - **`transcript`** — uses a registered live stage handle when one exists, even before live messages arrive; otherwise it falls back to stored stage snapshots. Snapshot entries are ordered chronologically before `tail`/`limit` is applied, with terminal result/error entries kept after tool entries when timestamps are missing or tied. `includeToolOutput` applies to snapshot tool events; live session transcripts may not expose tool output.
234
+ - **`send`** — answers pending stage prompts only when `text`, `response`, or `message` is present; an explicit empty string is a valid answer, while an omitted payload is a no-op. `delivery: "auto"` answers pending prompts first, then resumes paused stages, steers streaming stages, or queues a follow-up.
235
+ - **`reload`** — refreshes workflow resources directly in-process instead of queuing a literal `/workflow reload` chat follow-up.
222
236
 
223
237
  ### F2 keyboard shortcut
224
238
 
@@ -288,18 +302,21 @@ Scout + research-history chain → two parallel specialist waves → aggregator.
288
302
  | `max_partitions` | `number` | — | `100` | Maximum number of codebase partitions to explore. |
289
303
  | `max_concurrency` | `number` | — | `4` | Maximum number of workflow stages to run concurrently. |
290
304
 
305
+ Final Markdown research documents are written to dated `research/` paths relative to the current working directory, with a numeric suffix if needed to avoid overwriting an existing document. Hidden run artifacts are written under `research/.deep-research-<run-id>/`.
306
+
291
307
  ### `ralph`
292
308
 
293
- Plan → orchestrate → simplify → infrastructure discovery → parallel review loop. Named after the [Ralph Wiggum Method](https://ghuntley.com/ralph/).
309
+ Plan → write a spec under `specs/` → orchestrate from that spec path while maintaining OS-temp implementation notes → simplify → infrastructure discovery → parallel review loop → PR preparation. The workflow result includes the generated spec as `plan_path`, the notes file as `implementation_notes_path`, and the final PR phase report as `pr_report`. The PR phase uses local git identity as a hint when multiple GitHub accounts are logged in, tries available credentials until one works, and posts the implementation notes as a PR comment when a PR is created. Named after the [Ralph Wiggum Method](https://ghuntley.com/ralph/).
294
310
 
295
311
  ```text
296
- /workflow ralph prompt="Migrate the database layer to Drizzle ORM"
312
+ /workflow ralph prompt="Migrate the database layer to Drizzle ORM" base_branch=develop
297
313
  ```
298
314
 
299
- | Input | Type | Required | Default | Description |
300
- | ----------- | -------- | -------- | ------- | ------------------------------------------ |
301
- | `prompt` | `text` | ✓ | — | High-level task or goal to accomplish. |
302
- | `max_loops` | `number` | — | `10` | Maximum plan → orchestrate → review loops. |
315
+ | Input | Type | Required | Default | Description |
316
+ | ------------- | -------- | -------- | ------- | ------------------------------------------------ |
317
+ | `prompt` | `text` | ✓ | — | High-level task or goal to accomplish. |
318
+ | `max_loops` | `number` | — | `10` | Maximum plan → orchestrate → review loops. |
319
+ | `base_branch` | `string` | — | `origin/main` | Branch reviewers compare the current delta with. |
303
320
 
304
321
  ### `open-claude-design`
305
322
 
@@ -8,8 +8,11 @@
8
8
  * ctx.parallel(), and ctx.chain().
9
9
  */
10
10
 
11
+ import { mkdir, readFile, writeFile } from "node:fs/promises";
12
+ import { dirname, extname, join } from "node:path";
11
13
  import { defineWorkflow } from "../src/index.js";
12
14
  import type {
15
+ WorkflowOutputMode,
13
16
  WorkflowTaskResult,
14
17
  WorkflowTaskStep,
15
18
  } from "../src/shared/types.js";
@@ -17,9 +20,26 @@ import type {
17
20
  const DEFAULT_MAX_PARTITIONS = 100;
18
21
  const DEFAULT_MAX_CONCURRENCY = 4;
19
22
  const LOC_PER_PARTITION = 10_000;
23
+ const DEFAULT_RESEARCH_DOC_DIR = "research";
24
+ const DEEP_RESEARCH_RUN_DIR_PREFIX = ".deep-research-";
25
+ const MAX_RESEARCH_DOC_SLUG_LENGTH = 80;
20
26
 
21
27
  type PromptSection = readonly [tag: string, content: string];
22
28
 
29
+ interface DeepResearchCodebaseResult extends Record<string, unknown> {
30
+ readonly findings: string;
31
+ readonly research_doc_path: string;
32
+ readonly artifact_dir: string;
33
+ readonly manifest_path: string;
34
+ readonly partitions: readonly string[];
35
+ readonly explorer_count: number;
36
+ readonly specialist_count: number;
37
+ readonly max_concurrency: number;
38
+ readonly history: string;
39
+ }
40
+
41
+ const FILE_ONLY_OUTPUT = "file-only" satisfies WorkflowOutputMode;
42
+
23
43
  const CODEBASE_SKILLS = {
24
44
  locator:
25
45
  "codebase-locator — use this skill's search-first discipline when mapping where files, symbols, docs, tests, and configuration live.",
@@ -118,6 +138,147 @@ function parsePartitions(text: string, cap: number): string[] {
118
138
  return partitions.length > 0 ? partitions : ["core codebase architecture"];
119
139
  }
120
140
 
141
+ function slugifyResearchTopic(prompt: string): string {
142
+ const slug = prompt
143
+ .toLowerCase()
144
+ .replace(/[^a-z0-9]+/g, "-")
145
+ .replace(/^-+|-+$/g, "")
146
+ .slice(0, MAX_RESEARCH_DOC_SLUG_LENGTH)
147
+ .replace(/-+$/g, "");
148
+ return slug.length > 0 ? slug : "deep-research-codebase";
149
+ }
150
+
151
+ function defaultResearchDocPath(prompt: string, now = new Date()): string {
152
+ const date = now.toISOString().slice(0, 10);
153
+ return join(DEFAULT_RESEARCH_DOC_DIR, `${date}-${slugifyResearchTopic(prompt)}.md`);
154
+ }
155
+
156
+ function sanitizeRunId(value: string): string {
157
+ const sanitized = value
158
+ .trim()
159
+ .replace(/[^A-Za-z0-9._-]+/g, "-")
160
+ .replace(/^-+|-+$/g, "");
161
+ return sanitized.length > 0 ? sanitized : "run";
162
+ }
163
+
164
+ function timestampRunId(now: Date): string {
165
+ return sanitizeRunId(now.toISOString().replace(/[:.]/g, "-"));
166
+ }
167
+
168
+ function suffixedPath(path: string, suffix: number): string {
169
+ const extension = extname(path);
170
+ const stem = extension.length === 0 ? path : path.slice(0, -extension.length);
171
+ return `${stem}-${suffix}${extension}`;
172
+ }
173
+
174
+ function isFileExistsError(error: unknown): boolean {
175
+ return error instanceof Error && (error as { readonly code?: string }).code === "EEXIST";
176
+ }
177
+
178
+ interface DeepResearchArtifactRoot {
179
+ readonly runId: string;
180
+ readonly artifactRoot: string;
181
+ }
182
+
183
+ async function createArtifactRoot(startedAt: Date): Promise<DeepResearchArtifactRoot> {
184
+ await mkdir(DEFAULT_RESEARCH_DOC_DIR, { recursive: true });
185
+ const baseRunId = timestampRunId(startedAt);
186
+ for (let suffix = 0; ; suffix += 1) {
187
+ const runId = suffix === 0 ? baseRunId : `${baseRunId}-${suffix + 1}`;
188
+ const artifactRoot = join(
189
+ DEFAULT_RESEARCH_DOC_DIR,
190
+ `${DEEP_RESEARCH_RUN_DIR_PREFIX}${runId}`,
191
+ );
192
+ try {
193
+ await mkdir(artifactRoot, { recursive: false });
194
+ return { runId, artifactRoot };
195
+ } catch (error) {
196
+ if (isFileExistsError(error)) continue;
197
+ throw error;
198
+ }
199
+ }
200
+ }
201
+
202
+ interface DeepResearchManifest {
203
+ readonly runId: string;
204
+ readonly startedAt: string;
205
+ readonly completedAt?: string;
206
+ readonly researchQuestion: string;
207
+ readonly finalAsset: string;
208
+ readonly artifacts: Record<string, string>;
209
+ }
210
+
211
+ async function writeManifest(path: string, manifest: DeepResearchManifest): Promise<void> {
212
+ await writeFile(path, `${JSON.stringify(manifest, null, 2)}\n`, "utf8");
213
+ }
214
+
215
+ async function writeResearchDoc(path: string, content: string): Promise<string> {
216
+ await mkdir(dirname(path), { recursive: true });
217
+
218
+ for (let suffix = 0; ; suffix += 1) {
219
+ const candidate = suffix === 0 ? path : suffixedPath(path, suffix + 1);
220
+ try {
221
+ await writeFile(candidate, content, { encoding: "utf8", flag: "wx" });
222
+ return candidate;
223
+ } catch (error) {
224
+ if (isFileExistsError(error)) continue;
225
+ throw error;
226
+ }
227
+ }
228
+ }
229
+
230
+ async function readArtifactText(path: string | undefined, fallback: string): Promise<string> {
231
+ if (path === undefined) return fallback;
232
+ try {
233
+ return await readFile(path, "utf8");
234
+ } catch {
235
+ return fallback;
236
+ }
237
+ }
238
+
239
+ async function specialistHandoffFromArtifacts(
240
+ partition: string,
241
+ index: number,
242
+ artifactPathsByStage: ReadonlyMap<string, string>,
243
+ ): Promise<string> {
244
+ const i = index + 1;
245
+ const locator = await readArtifactText(
246
+ artifactPathsByStage.get(`locator-${i}`),
247
+ "(no locator output)",
248
+ );
249
+ const patterns = await readArtifactText(
250
+ artifactPathsByStage.get(`pattern-finder-${i}`),
251
+ "(no pattern output)",
252
+ );
253
+ const analyzer = await readArtifactText(
254
+ artifactPathsByStage.get(`analyzer-${i}`),
255
+ "(no analyzer output)",
256
+ );
257
+ const online = await readArtifactText(
258
+ artifactPathsByStage.get(`online-${i}`),
259
+ "(no online research output)",
260
+ );
261
+ return [
262
+ `## Partition ${i}: ${partition}`,
263
+ `### Locator\n${locator}`,
264
+ `### Pattern Finder\n${patterns}`,
265
+ `### Analyzer\n${analyzer}`,
266
+ `### Online Researcher\n${online}`,
267
+ ].join("\n\n");
268
+ }
269
+
270
+ function manifestArtifactPaths(
271
+ artifactPathsByStage: ReadonlyMap<string, string>,
272
+ manifestPath: string,
273
+ ): Record<string, string> {
274
+ const artifacts: Record<string, string> = {};
275
+ for (const [stage, path] of artifactPathsByStage) {
276
+ artifacts[stage] = displayPath(path);
277
+ }
278
+ artifacts.manifest = displayPath(manifestPath);
279
+ return artifacts;
280
+ }
281
+
121
282
  function findResult(
122
283
  results: readonly WorkflowTaskResult[],
123
284
  name: string,
@@ -127,32 +288,12 @@ function findResult(
127
288
  );
128
289
  }
129
290
 
130
- function specialistSummary(
131
- partitions: readonly string[],
132
- wave1: readonly WorkflowTaskResult[],
133
- wave2: readonly WorkflowTaskResult[],
134
- ): string {
135
- return partitions
136
- .map((partition, index) => {
137
- const i = index + 1;
138
- const locator =
139
- findResult(wave1, `locator-${i}`)?.text ?? "(no locator output)";
140
- const patterns =
141
- findResult(wave1, `pattern-finder-${i}`)?.text ?? "(no pattern output)";
142
- const analyzer =
143
- findResult(wave2, `analyzer-${i}`)?.text ?? "(no analyzer output)";
144
- const online =
145
- findResult(wave2, `online-researcher-${i}`)?.text ??
146
- "(no online research output)";
147
- return [
148
- `## Partition ${i}: ${partition}`,
149
- `### Locator\n${locator}`,
150
- `### Pattern Finder\n${patterns}`,
151
- `### Analyzer\n${analyzer}`,
152
- `### Online Researcher\n${online}`,
153
- ].join("\n\n");
154
- })
155
- .join("\n\n---\n\n");
291
+ function displayPath(path: string): string {
292
+ return path.replace(/\\/g, "/");
293
+ }
294
+
295
+ function displayPaths(paths: readonly string[]): string {
296
+ return paths.map(displayPath).join(", ");
156
297
  }
157
298
 
158
299
  export default defineWorkflow("deep-research-codebase")
@@ -191,13 +332,45 @@ export default defineWorkflow("deep-research-codebase")
191
332
  inputs.max_concurrency,
192
333
  DEFAULT_MAX_CONCURRENCY,
193
334
  );
335
+ const startedAt = new Date();
336
+ const finalResearchDocPath = defaultResearchDocPath(prompt);
194
337
  const codebaseLines = countCodebaseLines();
195
338
  const partitionCap = calculatePartitionCap(
196
339
  requestedMaxPartitions,
197
340
  codebaseLines,
198
341
  );
342
+ const { runId, artifactRoot } = await createArtifactRoot(startedAt);
343
+ const artifactPathsByStage = new Map<string, string>();
344
+ const addArtifact = (stage: string, path: string) => {
345
+ artifactPathsByStage.set(stage, path);
346
+ return path;
347
+ };
348
+ const fileOnlyOutput = (output: string): {
349
+ output: string;
350
+ outputMode: WorkflowOutputMode;
351
+ } => ({
352
+ output,
353
+ outputMode: FILE_ONLY_OUTPUT,
354
+ });
199
355
 
200
- let noAskQuestionToolSet = [
356
+ const scoutPath = addArtifact(
357
+ "codebase-scout",
358
+ join(artifactRoot, "00-codebase-scout.md"),
359
+ );
360
+ const partitionPlanPath = addArtifact(
361
+ "partition",
362
+ join(artifactRoot, "01-partition-plan.md"),
363
+ );
364
+ const historyLocatorPath = addArtifact(
365
+ "history-locator",
366
+ join(artifactRoot, "01-history-locator.md"),
367
+ );
368
+ const historyAnalyzerPath = addArtifact(
369
+ "history-analyzer",
370
+ join(artifactRoot, "02-history-analyzer.md"),
371
+ );
372
+
373
+ const noAskQuestionToolSet = [
201
374
  "read",
202
375
  "bash",
203
376
  "edit",
@@ -211,7 +384,7 @@ export default defineWorkflow("deep-research-codebase")
211
384
  "intercom",
212
385
  ];
213
386
 
214
- let plannerModelConfig = {
387
+ const plannerModelConfig = {
215
388
  model: "openai/gpt-5.5",
216
389
  fallbackModels: [
217
390
  "openai-codex/gpt-5.5",
@@ -223,7 +396,7 @@ export default defineWorkflow("deep-research-codebase")
223
396
  tools: noAskQuestionToolSet,
224
397
  };
225
398
 
226
- let explorerModelConfig = {
399
+ const explorerModelConfig = {
227
400
  model: "openai/gpt-5.4-mini",
228
401
  fallbackModels: [
229
402
  "openai-codex/gpt-5.4-mini",
@@ -269,6 +442,7 @@ export default defineWorkflow("deep-research-codebase")
269
442
  ].join("\n"),
270
443
  ],
271
444
  ]),
445
+ ...fileOnlyOutput(scoutPath),
272
446
  ...plannerModelConfig,
273
447
  },
274
448
  {
@@ -295,6 +469,7 @@ export default defineWorkflow("deep-research-codebase")
295
469
  "A markdown table with columns: Path, Evidence, Relevance, Confidence.",
296
470
  ],
297
471
  ]),
472
+ ...fileOnlyOutput(historyLocatorPath),
298
473
  ...explorerModelConfig,
299
474
  },
300
475
  ],
@@ -305,7 +480,7 @@ export default defineWorkflow("deep-research-codebase")
305
480
  findResult(initialDiscovery, "codebase-scout") ?? initialDiscovery[0]!;
306
481
  const historyLocator =
307
482
  findResult(initialDiscovery, "history-locator") ?? initialDiscovery[1]!;
308
- const history = await ctx.chain(
483
+ await ctx.chain(
309
484
  [
310
485
  {
311
486
  name: "history-analyzer",
@@ -341,6 +516,8 @@ export default defineWorkflow("deep-research-codebase")
341
516
  ],
342
517
  ]),
343
518
  previous: historyLocator,
519
+ reads: [historyLocatorPath],
520
+ ...fileOnlyOutput(historyAnalyzerPath),
344
521
  ...plannerModelConfig,
345
522
  },
346
523
  ],
@@ -370,14 +547,26 @@ export default defineWorkflow("deep-research-codebase")
370
547
  ["output_format", "Plain text only: one partition per line."],
371
548
  ]),
372
549
  previous: scout,
550
+ output: partitionPlanPath,
551
+ reads: [scoutPath],
373
552
  ...plannerModelConfig,
374
553
  });
375
554
 
376
555
  const partitions = parsePartitions(partitionPlan.text, partitionCap);
556
+ const locatorArtifactPaths = new Map<number, string>();
377
557
 
378
558
  const wave1Steps: WorkflowTaskStep[] = partitions.flatMap(
379
559
  (partition, index) => {
380
560
  const i = index + 1;
561
+ const locatorPath = addArtifact(
562
+ `locator-${i}`,
563
+ join(artifactRoot, `locator-${i}.md`),
564
+ );
565
+ const patternFinderPath = addArtifact(
566
+ `pattern-finder-${i}`,
567
+ join(artifactRoot, `pattern-finder-${i}.md`),
568
+ );
569
+ locatorArtifactPaths.set(i, locatorPath);
381
570
  return [
382
571
  {
383
572
  name: `locator-${i}`,
@@ -388,7 +577,10 @@ export default defineWorkflow("deep-research-codebase")
388
577
  `Partition ${i}/${partitions.length}: ${partition}`,
389
578
  ],
390
579
  ["research_question", prompt],
391
- ["scout_context", "{previous}"],
580
+ [
581
+ "scout_context",
582
+ `Read the scout artifact before making evidence claims: ${displayPath(scoutPath)}\nCompact saved-output reference: {previous}`,
583
+ ],
392
584
  ["codebase_skills", codebaseSkillGuidance("locator")],
393
585
  [
394
586
  "instructions",
@@ -411,6 +603,8 @@ export default defineWorkflow("deep-research-codebase")
411
603
  ],
412
604
  ]),
413
605
  previous: scout,
606
+ reads: [scoutPath],
607
+ ...fileOnlyOutput(locatorPath),
414
608
  ...explorerModelConfig,
415
609
  },
416
610
  {
@@ -422,7 +616,10 @@ export default defineWorkflow("deep-research-codebase")
422
616
  `Partition ${i}/${partitions.length}: ${partition}`,
423
617
  ],
424
618
  ["research_question", prompt],
425
- ["scout_context", "{previous}"],
619
+ [
620
+ "scout_context",
621
+ `Read the scout artifact before making evidence claims: ${displayPath(scoutPath)}\nCompact saved-output reference: {previous}`,
622
+ ],
426
623
  ["codebase_skills", codebaseSkillGuidance("patternFinder")],
427
624
  [
428
625
  "instructions",
@@ -445,6 +642,8 @@ export default defineWorkflow("deep-research-codebase")
445
642
  ],
446
643
  ]),
447
644
  previous: scout,
645
+ reads: [scoutPath],
646
+ ...fileOnlyOutput(patternFinderPath),
448
647
  ...explorerModelConfig,
449
648
  },
450
649
  ];
@@ -460,6 +659,24 @@ export default defineWorkflow("deep-research-codebase")
460
659
  (partition, index) => {
461
660
  const i = index + 1;
462
661
  const locator = findResult(wave1, `locator-${i}`);
662
+ const locatorPath =
663
+ locator === undefined ? undefined : locatorArtifactPaths.get(i);
664
+ const analyzerReads =
665
+ locatorPath === undefined ? [scoutPath] : [scoutPath, locatorPath];
666
+ const onlineResearcherReads =
667
+ locatorPath === undefined ? [scoutPath] : [locatorPath];
668
+ const onlineResearcherLocalContext =
669
+ locatorPath === undefined
670
+ ? `Read scout context before researching: ${displayPath(scoutPath)}\nCompact saved-output reference: {previous}`
671
+ : `Read local artifact context before researching: ${displayPath(locatorPath)}\nCompact saved-output reference: {previous}`;
672
+ const analyzerPath = addArtifact(
673
+ `analyzer-${i}`,
674
+ join(artifactRoot, `analyzer-${i}.md`),
675
+ );
676
+ const onlineResearcherPath = addArtifact(
677
+ `online-${i}`,
678
+ join(artifactRoot, `online-${i}.md`),
679
+ );
463
680
  return [
464
681
  {
465
682
  name: `analyzer-${i}`,
@@ -473,7 +690,10 @@ export default defineWorkflow("deep-research-codebase")
473
690
  `Partition ${i}/${partitions.length}: ${partition}`,
474
691
  ],
475
692
  ["research_question", prompt],
476
- ["context", "{previous}"],
693
+ [
694
+ "context",
695
+ `Read these artifacts before analyzing: ${displayPaths(analyzerReads)}\nCompact saved-output reference: {previous}`,
696
+ ],
477
697
  ["codebase_skills", codebaseSkillGuidance("analyzer")],
478
698
  [
479
699
  "instructions",
@@ -496,6 +716,8 @@ export default defineWorkflow("deep-research-codebase")
496
716
  ],
497
717
  ]),
498
718
  previous: locator === undefined ? scout : [scout, locator],
719
+ reads: analyzerReads,
720
+ ...fileOnlyOutput(analyzerPath),
499
721
  ...explorerModelConfig,
500
722
  },
501
723
  {
@@ -510,7 +732,10 @@ export default defineWorkflow("deep-research-codebase")
510
732
  `Partition ${i}/${partitions.length}: ${partition}`,
511
733
  ],
512
734
  ["research_question", prompt],
513
- ["local_context", "{previous}"],
735
+ [
736
+ "local_context",
737
+ onlineResearcherLocalContext,
738
+ ],
514
739
  ["codebase_skills", codebaseSkillGuidance("onlineResearcher")],
515
740
  [
516
741
  "instructions",
@@ -533,6 +758,8 @@ export default defineWorkflow("deep-research-codebase")
533
758
  ],
534
759
  ]),
535
760
  previous: locator === undefined ? scout : locator,
761
+ reads: onlineResearcherReads,
762
+ ...fileOnlyOutput(onlineResearcherPath),
536
763
  ...explorerModelConfig,
537
764
  },
538
765
  ];
@@ -543,8 +770,29 @@ export default defineWorkflow("deep-research-codebase")
543
770
  task: prompt,
544
771
  concurrency: maxConcurrency,
545
772
  });
546
- const historyOverview = history.at(-1)?.text ?? "";
547
- const specialistReports = specialistSummary(partitions, wave1, wave2);
773
+ const historyOverview = await readArtifactText(historyAnalyzerPath, "");
774
+ const explorerPaths = await Promise.all(
775
+ partitions.map(async (partition, index) => {
776
+ const i = index + 1;
777
+ const explorerPath = addArtifact(
778
+ `explorer-${i}`,
779
+ join(artifactRoot, `explorer-${i}.md`),
780
+ );
781
+ const explorer = await specialistHandoffFromArtifacts(
782
+ partition,
783
+ index,
784
+ artifactPathsByStage,
785
+ );
786
+ await writeFile(explorerPath, explorer, "utf8");
787
+ return explorerPath;
788
+ }),
789
+ );
790
+ const aggregatorReadPaths = [
791
+ scoutPath,
792
+ partitionPlanPath,
793
+ ...(historyOverview === "" ? [] : [historyAnalyzerPath]),
794
+ ...explorerPaths,
795
+ ];
548
796
 
549
797
  const aggregate = await ctx.task("aggregator", {
550
798
  prompt: taggedPrompt([
@@ -553,11 +801,26 @@ export default defineWorkflow("deep-research-codebase")
553
801
  "objective",
554
802
  `Answer the research question comprehensively: ${prompt}`,
555
803
  ],
804
+ [
805
+ "context_artifacts",
806
+ [
807
+ `Read the scout artifact at ${displayPath(scoutPath)}.`,
808
+ `Read the partition plan artifact at ${displayPath(partitionPlanPath)}.`,
809
+ historyOverview === ""
810
+ ? "No prior research overview artifact is available."
811
+ : `Read the prior research overview artifact at ${displayPath(historyAnalyzerPath)}.`,
812
+ ].join("\n"),
813
+ ],
556
814
  [
557
815
  "prior_research_overview",
558
- historyOverview || "(no prior research found)",
816
+ historyOverview === ""
817
+ ? "(no prior research found)"
818
+ : `Read the prior research overview artifact at ${displayPath(historyAnalyzerPath)}.`,
819
+ ],
820
+ [
821
+ "specialist_reports",
822
+ `Read the complete explorer handoff artifact(s) at ${displayPaths(explorerPaths)}. They preserve every partition's Locator, Pattern Finder, Analyzer, and Online Researcher output from the original inline specialist handoff while keeping this prompt bounded.`,
559
823
  ],
560
- ["specialist_reports", specialistReports],
561
824
  [
562
825
  "codebase_skills",
563
826
  codebaseSkillGuidance(
@@ -570,6 +833,7 @@ export default defineWorkflow("deep-research-codebase")
570
833
  "instructions",
571
834
  [
572
835
  "Synthesize; do not merely concatenate specialist reports.",
836
+ "Use the supplied input files as the source of detailed scout, partition, history, and specialist evidence instead of relying on inline transcripts.",
573
837
  "Prioritize claims supported by concrete paths, symbols, tests, docs, or cited external references.",
574
838
  "Resolve contradictions explicitly and preserve important uncertainty.",
575
839
  "Avoid inventing facts not supported by the supplied reports; state unknowns instead.",
@@ -588,17 +852,36 @@ export default defineWorkflow("deep-research-codebase")
588
852
  ].join("\n"),
589
853
  ],
590
854
  ]),
591
- previous: [scout, partitionPlan, ...wave1, ...wave2],
855
+ reads: aggregatorReadPaths,
592
856
  ...explorerModelConfig,
593
857
  });
594
858
 
595
- return {
859
+ const writtenResearchDocPath = await writeResearchDoc(
860
+ finalResearchDocPath,
861
+ aggregate.text,
862
+ );
863
+ const manifestPath = join(artifactRoot, "manifest.json");
864
+ const completedAt = new Date();
865
+ await writeManifest(manifestPath, {
866
+ runId,
867
+ startedAt: startedAt.toISOString(),
868
+ completedAt: completedAt.toISOString(),
869
+ researchQuestion: prompt,
870
+ finalAsset: displayPath(writtenResearchDocPath),
871
+ artifacts: manifestArtifactPaths(artifactPathsByStage, manifestPath),
872
+ });
873
+
874
+ const result: DeepResearchCodebaseResult = {
596
875
  findings: aggregate.text,
876
+ research_doc_path: displayPath(writtenResearchDocPath),
877
+ artifact_dir: displayPath(artifactRoot),
878
+ manifest_path: displayPath(manifestPath),
597
879
  partitions,
598
880
  explorer_count: partitions.length,
599
881
  specialist_count: wave1.length + wave2.length,
600
882
  max_concurrency: maxConcurrency,
601
883
  history: historyOverview,
602
884
  };
885
+ return result;
603
886
  })
604
887
  .compile();