@bastani/atomic 0.10.9 → 0.10.10-alpha.2

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 (406) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/README.md +226 -163
  3. package/dist/_shared/dist-KOELCESV.js +2 -2
  4. package/dist/_shared/fork-row-index-UAUAQRD5.js +2 -2
  5. package/dist/_shared/lib-4PES5P4V.js +2 -2
  6. package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js +27 -12
  7. package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js.map +1 -1
  8. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +47 -7
  9. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js.map +1 -1
  10. package/dist/_shared/mode-shared-2QJSCUM6.js +48 -19
  11. package/dist/_shared/mode-shared-2QJSCUM6.js.map +1 -1
  12. package/dist/_shared/{p1a-prewarm-UQY3X2UK.js → p1a-prewarm-XIU57JHF.js} +5 -5
  13. package/dist/_shared/{p1a-prewarm-UQY3X2UK.js.map → p1a-prewarm-XIU57JHF.js.map} +1 -1
  14. package/dist/_shared/p2-shell-main-B2WIALFD.js +30 -25
  15. package/dist/_shared/p2-shell-main-B2WIALFD.js.map +1 -1
  16. package/dist/_shared/runtime-O4KCSG4C.js +5 -5
  17. package/dist/_shared/{sdk-OSBEPR3Q.js → sdk-RRLVN7ER.js} +15 -9
  18. package/dist/_shared/sdk-RRLVN7ER.js.map +1 -0
  19. package/dist/_shared/session-data-AHTU7IS6.js +2 -2
  20. package/dist/_shared/session-manager-list-2BLEEZVG.js +1 -1
  21. package/dist/_shared/settings-startup-8-DNZ2RIHM.js +4 -1
  22. package/dist/_shared/settings-startup-8-DNZ2RIHM.js.map +1 -1
  23. package/dist/_shared/{startup-0-0-TYUFUOJZ.js → startup-0-0-4VG2G44V.js} +427 -33
  24. package/dist/_shared/startup-0-0-4VG2G44V.js.map +1 -0
  25. package/dist/_shared/{startup-0-1-W2G2UY7R.js → startup-0-1-XTIL65D4.js} +18 -11
  26. package/dist/_shared/startup-0-1-XTIL65D4.js.map +1 -0
  27. package/dist/_shared/{startup-0-2-UXBUEOXW.js → startup-0-2-27OWFHV6.js} +150 -62
  28. package/dist/_shared/startup-0-2-27OWFHV6.js.map +1 -0
  29. package/dist/_shared/startup-0-3-T4DVFYWX.js +15 -25
  30. package/dist/_shared/startup-0-3-T4DVFYWX.js.map +1 -1
  31. package/dist/_shared/{startup-0-4-HN5EB4K7.js → startup-0-4-ZMJV547D.js} +81 -12
  32. package/dist/_shared/startup-0-4-ZMJV547D.js.map +1 -0
  33. package/dist/_shared/startup-0-5-FD2P735I.js +90 -50
  34. package/dist/_shared/startup-0-5-FD2P735I.js.map +1 -1
  35. package/dist/_shared/startup-10-0-TDQNBDDL.js +5 -5
  36. package/dist/_shared/startup-12-0-55AAXBJZ.js +13 -7
  37. package/dist/_shared/startup-12-0-55AAXBJZ.js.map +1 -1
  38. package/dist/_shared/startup-14-0-MLX36RBG.js +4 -4
  39. package/dist/_shared/startup-15-0-YUKGAC63.js +4 -4
  40. package/dist/_shared/startup-15-1-4S7FLMNG.js +88 -28
  41. package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
  42. package/dist/_shared/startup-8-0-34CBHPZH.js +5 -5
  43. package/dist/_shared/startup-8-1-4KANEHRA.js +61 -17
  44. package/dist/_shared/startup-8-1-4KANEHRA.js.map +1 -1
  45. package/dist/_shared/storage-command-7MGXLJGZ.js +4 -4
  46. package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
  47. package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
  48. package/dist/builtin/intercom/CHANGELOG.md +6 -0
  49. package/dist/builtin/intercom/README.md +87 -116
  50. package/dist/builtin/intercom/broker/broker.bundle.mjs +3 -3
  51. package/dist/builtin/intercom/broker/presence-handler.ts +1 -1
  52. package/dist/builtin/intercom/group.ts +7 -3
  53. package/dist/builtin/intercom/index.bundle.mjs +1 -1
  54. package/dist/builtin/intercom/package.json +1 -1
  55. package/dist/builtin/mcp/README.md +61 -27
  56. package/dist/builtin/mcp/index.bundle.mjs +1 -1
  57. package/dist/builtin/mcp/package.json +1 -1
  58. package/dist/builtin/subagents/CHANGELOG.md +8 -0
  59. package/dist/builtin/subagents/README.md +74 -141
  60. package/dist/builtin/subagents/package.json +1 -1
  61. package/dist/builtin/subagents/src/extension/index.bundle.mjs +213 -74
  62. package/dist/builtin/web-access/CHANGELOG.md +9 -0
  63. package/dist/builtin/web-access/README.md +61 -88
  64. package/dist/builtin/web-access/index.bundle.mjs +387 -351
  65. package/dist/builtin/web-access/package.json +1 -1
  66. package/dist/cli/args.js +2 -2
  67. package/dist/cli/auth-cli.code.js +4 -4
  68. package/dist/cli/auth-cli.impl.js +3 -3
  69. package/dist/cli/auth-cli.js +3 -3
  70. package/dist/cli/blueprint-command.code.js +2 -2
  71. package/dist/cli/blueprint-command.impl.js +3 -3
  72. package/dist/cli/blueprint-command.js +3 -3
  73. package/dist/cli/intercom-command.code.js +3 -3
  74. package/dist/cli/intercom-command.impl.js +3 -3
  75. package/dist/cli/intercom-command.js +3 -3
  76. package/dist/cli/list-models.code.js +3 -3
  77. package/dist/cli/list-models.impl.js +3 -3
  78. package/dist/cli/list-models.js +3 -3
  79. package/dist/cli/session-picker.code.js +2 -2
  80. package/dist/cli/session-picker.impl.js +3 -3
  81. package/dist/cli/session-picker.js +3 -3
  82. package/dist/cli/startup-ui.code.js +2 -2
  83. package/dist/cli/startup-ui.impl.js +3 -3
  84. package/dist/cli/startup-ui.js +3 -3
  85. package/dist/cli/storage-command.impl.js +3 -3
  86. package/dist/cli/storage-command.js +3 -3
  87. package/dist/cli/storage-search-session.code.js +2 -2
  88. package/dist/cli/storage-search-session.impl.js +3 -3
  89. package/dist/cli/storage-search-session.js +3 -3
  90. package/dist/cli/team-command.code.js +2 -2
  91. package/dist/cli/team-command.impl.js +3 -3
  92. package/dist/cli/team-command.js +3 -3
  93. package/dist/cli.js +2 -2
  94. package/dist/core/agent-session-methods.d.ts +4 -1
  95. package/dist/core/agent-session-methods.js.map +1 -1
  96. package/dist/core/agent-session.d.ts +3 -0
  97. package/dist/core/compaction/compactor.d.ts +20 -14
  98. package/dist/core/compaction/errors.d.ts +120 -0
  99. package/dist/core/compaction/index.d.ts +1 -0
  100. package/dist/core/compaction/model-resolver.d.ts +2 -2
  101. package/dist/core/debug.impl.js +3 -3
  102. package/dist/core/debug.js +3 -3
  103. package/dist/core/export-html/card-projection.impl.js +3 -3
  104. package/dist/core/export-html/card-projection.js +3 -3
  105. package/dist/core/export-html/index.code.js +2 -2
  106. package/dist/core/export-html/index.impl.js +3 -3
  107. package/dist/core/export-html/index.js +3 -3
  108. package/dist/core/export-html/json-spans.impl.js +3 -3
  109. package/dist/core/export-html/json-spans.js +3 -3
  110. package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
  111. package/dist/core/export-html/oversized-render-inputs.js +3 -3
  112. package/dist/core/export-html/tool-renderer.code.js +1 -1
  113. package/dist/core/export-html/tool-renderer.impl.js +3 -3
  114. package/dist/core/export-html/tool-renderer.js +3 -3
  115. package/dist/core/extensions/api-types.d.ts +1 -1
  116. package/dist/core/extensions/api-types.js.map +1 -1
  117. package/dist/core/extensions/index.d.ts +1 -1
  118. package/dist/core/extensions/jiti-loader.impl.js +3 -3
  119. package/dist/core/extensions/jiti-loader.js +3 -3
  120. package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
  121. package/dist/core/extensions/jiti-static-loader.js +3 -3
  122. package/dist/core/extensions/loader-host-modules.code.js +1 -1
  123. package/dist/core/extensions/loader-host-modules.impl.js +3 -3
  124. package/dist/core/extensions/loader-host-modules.js +3 -3
  125. package/dist/core/extensions/loader-virtual-modules.js +1 -1
  126. package/dist/core/extensions/provider-types.d.ts +18 -6
  127. package/dist/core/extensions/provider-types.js.map +1 -1
  128. package/dist/core/extensions/runner-context.js +1 -1
  129. package/dist/core/intercom-broker-control-host.code.js +1 -1
  130. package/dist/core/intercom-broker-control-host.impl.js +3 -3
  131. package/dist/core/intercom-broker-control-host.js +3 -3
  132. package/dist/core/intercom-broker-control.code.js +3 -3
  133. package/dist/core/intercom-broker-control.impl.js +3 -3
  134. package/dist/core/intercom-broker-control.js +3 -3
  135. package/dist/core/model-config.d.ts +40 -0
  136. package/dist/core/model-registry.js +1 -1
  137. package/dist/core/model-resolver-scope.d.ts +4 -4
  138. package/dist/core/model-runtime.d.ts +1 -1
  139. package/dist/core/package-manager-storage-adapters.impl.js +3 -3
  140. package/dist/core/package-manager-storage-adapters.js +3 -3
  141. package/dist/core/provider-composer-internal.d.ts +11 -2
  142. package/dist/core/sdk.code.js +3 -3
  143. package/dist/core/sdk.impl.js +3 -3
  144. package/dist/core/sdk.js +3 -3
  145. package/dist/core/session-manager-core.js +5 -5
  146. package/dist/core/session-manager-list.impl.js +3 -3
  147. package/dist/core/session-manager-list.js +3 -3
  148. package/dist/core/session-manager.code.js +1 -1
  149. package/dist/core/session-manager.impl.js +3 -3
  150. package/dist/core/session-manager.js +3 -3
  151. package/dist/core/session-storage.impl.js +3 -3
  152. package/dist/core/session-storage.js +3 -3
  153. package/dist/core/settings-manager-basic-accessors.d.ts +6 -2
  154. package/dist/core/storage/index.js +2 -2
  155. package/dist/core/storage/node-sqlite-thread.js +2 -2
  156. package/dist/core/storage/node-sqlite.js +2 -2
  157. package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
  158. package/dist/core/storage/offline-snapshot-file.js +3 -3
  159. package/dist/core/storage/provider.js +2 -2
  160. package/dist/core/storage/selection.js +2 -2
  161. package/dist/core/storage/session/branch-fork-source.code.js +2 -2
  162. package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
  163. package/dist/core/storage/session/branch-fork-source.js +3 -3
  164. package/dist/core/storage/session/card-view.impl.js +3 -3
  165. package/dist/core/storage/session/card-view.js +3 -3
  166. package/dist/core/storage/session/child-reader.code.js +3 -3
  167. package/dist/core/storage/session/child-reader.impl.js +3 -3
  168. package/dist/core/storage/session/child-reader.js +3 -3
  169. package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
  170. package/dist/core/storage/session/chunked-resume-projection.js +3 -3
  171. package/dist/core/storage/session/expanded-child-details.code.js +2 -2
  172. package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
  173. package/dist/core/storage/session/expanded-child-details.js +3 -3
  174. package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
  175. package/dist/core/storage/session/fork-row-bytes.js +3 -3
  176. package/dist/core/storage/session/fork-row-index.impl.js +3 -3
  177. package/dist/core/storage/session/fork-row-index.js +3 -3
  178. package/dist/core/storage/session/fork-staging.code.js +2 -2
  179. package/dist/core/storage/session/fork-staging.impl.js +3 -3
  180. package/dist/core/storage/session/fork-staging.js +3 -3
  181. package/dist/core/storage/session/fork-window.code.js +3 -3
  182. package/dist/core/storage/session/fork-window.impl.js +3 -3
  183. package/dist/core/storage/session/fork-window.js +3 -3
  184. package/dist/core/storage/session/history-pages.impl.js +3 -3
  185. package/dist/core/storage/session/history-pages.js +3 -3
  186. package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
  187. package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
  188. package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
  189. package/dist/core/storage/session/jsonl-session-store.js +3 -3
  190. package/dist/core/storage/session/memory-session-store.impl.js +3 -3
  191. package/dist/core/storage/session/memory-session-store.js +3 -3
  192. package/dist/core/storage/session/pinned-branch-resume.code.js +3 -3
  193. package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
  194. package/dist/core/storage/session/pinned-branch-resume.js +3 -3
  195. package/dist/core/storage/session/released-history-files.code.js +3 -3
  196. package/dist/core/storage/session/released-history-files.impl.js +3 -3
  197. package/dist/core/storage/session/released-history-files.js +3 -3
  198. package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
  199. package/dist/core/storage/session/resident-fork-rows.js +3 -3
  200. package/dist/core/storage/session/session-resume.impl.js +3 -3
  201. package/dist/core/storage/session/session-resume.js +3 -3
  202. package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
  203. package/dist/core/storage/session/snapshot-cut.js +3 -3
  204. package/dist/core/storage/session/snapshot-history.code.js +3 -3
  205. package/dist/core/storage/session/snapshot-history.impl.js +3 -3
  206. package/dist/core/storage/session/snapshot-history.js +3 -3
  207. package/dist/core/storage/session/sql-session-store.code.js +1 -1
  208. package/dist/core/storage/session/sql-session-store.impl.js +3 -3
  209. package/dist/core/storage/session/sql-session-store.js +3 -3
  210. package/dist/core/storage/session/tree-outline.impl.js +3 -3
  211. package/dist/core/storage/session/tree-outline.js +3 -3
  212. package/dist/core/storage/session/tree-presentation.impl.js +3 -3
  213. package/dist/core/storage/session/tree-presentation.js +3 -3
  214. package/dist/core/storage/storage-status.impl.js +3 -3
  215. package/dist/core/storage/storage-status.js +3 -3
  216. package/dist/core/storage/team.impl.js +3 -3
  217. package/dist/core/storage/team.js +3 -3
  218. package/dist/core/structured-output/index.code.js +1 -1
  219. package/dist/core/structured-output/index.impl.js +3 -3
  220. package/dist/core/structured-output/index.js +3 -3
  221. package/dist/core/tasks/task-completion-entry.impl.js +3 -3
  222. package/dist/core/tasks/task-completion-entry.js +3 -3
  223. package/dist/core/tasks/task-file-history.code.js +3 -3
  224. package/dist/core/tasks/task-file-history.impl.js +3 -3
  225. package/dist/core/tasks/task-file-history.js +3 -3
  226. package/dist/core/tasks/task-reference-archive.code.js +4 -4
  227. package/dist/core/tasks/task-reference-archive.js +3 -3
  228. package/dist/core/tasks/task-reference-identity.code.js +1 -1
  229. package/dist/core/tasks/task-reference-identity.js +3 -3
  230. package/dist/core/tasks/task-reference-stream.impl.js +3 -3
  231. package/dist/core/tasks/task-reference-stream.js +3 -3
  232. package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
  233. package/dist/core/tasks/task-unsaved-answer.js +3 -3
  234. package/dist/core/tasks/task-view-source.impl.js +3 -3
  235. package/dist/core/tasks/task-view-source.js +3 -3
  236. package/dist/core/tools/read-url.code.js +2 -2
  237. package/dist/core/tools/read-url.impl.js +3 -3
  238. package/dist/core/tools/read-url.js +3 -3
  239. package/dist/core/worktree-snapshot/blob-store.js +2 -2
  240. package/dist/core/worktree-snapshot/errors.code.js +3 -3
  241. package/dist/core/worktree-snapshot/errors.impl.js +3 -3
  242. package/dist/core/worktree-snapshot/errors.js +3 -3
  243. package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
  244. package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
  245. package/dist/extensions/codemode/execute.code.js +1 -1
  246. package/dist/extensions/codemode/execute.impl.js +3 -3
  247. package/dist/extensions/codemode/execute.js +3 -3
  248. package/dist/extensions/codemode/renderer.code.js +2 -2
  249. package/dist/extensions/codemode/renderer.impl.js +3 -3
  250. package/dist/extensions/codemode/renderer.js +3 -3
  251. package/dist/extensions/mcp/cli.code.js +2 -2
  252. package/dist/extensions/mcp/cli.impl.js +3 -3
  253. package/dist/extensions/mcp/cli.js +3 -3
  254. package/dist/extensions/mcp/cli.lazy.code.js +2 -2
  255. package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
  256. package/dist/extensions/mcp/cli.lazy.js +3 -3
  257. package/dist/extensions/mcp/runtime.code.js +1 -1
  258. package/dist/extensions/mcp/runtime.impl.js +3 -3
  259. package/dist/extensions/mcp/runtime.js +3 -3
  260. package/dist/index-extensions.d.ts +1 -1
  261. package/dist/index.d.ts +8 -1
  262. package/dist/index.js +7 -7
  263. package/dist/main-first-time-setup.code.js +2 -2
  264. package/dist/main-first-time-setup.impl.js +3 -3
  265. package/dist/main-first-time-setup.js +3 -3
  266. package/dist/modes/interactive/components/settings-selector-types.d.ts +1 -0
  267. package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
  268. package/dist/modes/interactive/components/stored-tree-view.code.js +2 -2
  269. package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
  270. package/dist/modes/interactive/components/stored-tree-view.js +3 -3
  271. package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
  272. package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
  273. package/dist/modes/interactive/theme/color-utils.d.ts +5 -5
  274. package/dist/modes/interactive/theme/theme-loading.d.ts +1 -0
  275. package/dist/modes/interactive-engine/engine-prewarm.js +1 -1
  276. package/dist/modes/interactive-engine/remote-model-catalog.d.ts +1 -0
  277. package/dist/modes/print-mode.js +1 -1
  278. package/dist/modes/rpc/rpc-client-api.d.ts +6 -0
  279. package/dist/modes/rpc/rpc-types.d.ts +29 -2
  280. package/dist/package-manager-cli.code.js +5 -5
  281. package/dist/package-manager-cli.impl.js +3 -3
  282. package/dist/package-manager-cli.js +3 -3
  283. package/dist/rpc-entry.js +1 -1
  284. package/dist/startup-files.json +1 -1
  285. package/dist/startup-stages/5.js +1 -1
  286. package/dist/startup-stages/7.js +1 -1
  287. package/dist/startup-stages/8.js +1 -2
  288. package/dist/startup-stages/9.js +2 -1
  289. package/dist/utils/native-module.d.ts +44 -0
  290. package/dist/utils/startup-database-spare.code.js +3 -3
  291. package/dist/utils/startup-database-spare.impl.js +3 -3
  292. package/dist/utils/startup-database-spare.js +3 -3
  293. package/dist/utils/tools-manager.code.js +1 -1
  294. package/dist/utils/tools-manager.impl.js +3 -3
  295. package/dist/utils/tools-manager.js +3 -3
  296. package/docs/background-tasks.md +238 -243
  297. package/docs/build.md +21 -15
  298. package/docs/changelog.mdx +1 -1
  299. package/docs/codemode.md +68 -51
  300. package/docs/compaction/reference.md +65 -26
  301. package/docs/compaction.md +118 -66
  302. package/docs/computer-use.md +179 -146
  303. package/docs/containerization.md +87 -33
  304. package/docs/custom-provider/api-reference.md +152 -13
  305. package/docs/custom-provider/oauth.md +45 -28
  306. package/docs/custom-provider/override.md +14 -7
  307. package/docs/custom-provider/registration.md +77 -67
  308. package/docs/custom-provider/streaming.md +42 -19
  309. package/docs/custom-provider.md +26 -62
  310. package/docs/development.md +81 -42
  311. package/docs/docs.json +54 -38
  312. package/docs/environment-variables.md +92 -64
  313. package/docs/extensions/api-reference.md +326 -735
  314. package/docs/extensions/authoring.md +186 -269
  315. package/docs/extensions/events.md +308 -375
  316. package/docs/extensions/examples.md +122 -74
  317. package/docs/extensions/ui.md +217 -197
  318. package/docs/extensions.md +189 -259
  319. package/docs/getting-started/authentication.md +27 -14
  320. package/docs/getting-started/first-session.md +25 -26
  321. package/docs/getting-started/installation.md +62 -84
  322. package/docs/getting-started/project-instructions.md +39 -14
  323. package/docs/guides/configuration.md +62 -20
  324. package/docs/guides/intercom.md +20 -12
  325. package/docs/guides/non-interactive.md +31 -16
  326. package/docs/guides/orchestration.md +17 -9
  327. package/docs/guides/resume-on-any-machine.md +63 -52
  328. package/docs/guides/subagents.md +26 -14
  329. package/docs/guides/team-setup.md +49 -27
  330. package/docs/guides.md +30 -23
  331. package/docs/herdr.md +22 -17
  332. package/docs/index.md +24 -17
  333. package/docs/intercom/operations.md +90 -66
  334. package/docs/intercom/reference.md +219 -192
  335. package/docs/intercom.md +111 -92
  336. package/docs/json.md +73 -71
  337. package/docs/keybindings.md +74 -48
  338. package/docs/libraries/agent-core.md +52 -9
  339. package/docs/libraries/ai.md +90 -63
  340. package/docs/libraries/codemode.md +31 -8
  341. package/docs/libraries/schema.md +12 -9
  342. package/docs/libraries/storage-libsql.md +92 -0
  343. package/docs/libraries/storage-postgres.md +119 -0
  344. package/docs/libraries/telemetry.md +42 -9
  345. package/docs/libraries/tui.md +74 -94
  346. package/docs/libraries.md +25 -8
  347. package/docs/llama-cpp.md +38 -33
  348. package/docs/mcp-servers.md +140 -88
  349. package/docs/models/reference.md +53 -36
  350. package/docs/models-configuration.md +19 -13
  351. package/docs/models.md +102 -87
  352. package/docs/orchestration/migrating-workflows.md +22 -20
  353. package/docs/orchestration/patterns.md +36 -21
  354. package/docs/orchestration.md +24 -21
  355. package/docs/packages/authoring.md +29 -18
  356. package/docs/packages/reference.md +77 -16
  357. package/docs/packages.md +34 -34
  358. package/docs/programmatic.md +28 -21
  359. package/docs/prompt-templates.md +65 -41
  360. package/docs/providers/reference.md +36 -20
  361. package/docs/providers.md +78 -76
  362. package/docs/quickstart.md +42 -54
  363. package/docs/reference/cli.md +256 -254
  364. package/docs/reference.md +30 -23
  365. package/docs/rpc/examples.md +121 -17
  366. package/docs/rpc/extension-ui.md +86 -63
  367. package/docs/rpc/protocol.md +817 -358
  368. package/docs/rpc.md +78 -152
  369. package/docs/sdk/reference.md +309 -73
  370. package/docs/sdk/storage.md +614 -0
  371. package/docs/sdk/structured-decisions.md +168 -65
  372. package/docs/sdk/web-server.md +80 -46
  373. package/docs/sdk.md +168 -215
  374. package/docs/security.md +117 -44
  375. package/docs/session-format.md +127 -76
  376. package/docs/sessions.md +155 -113
  377. package/docs/settings.md +293 -205
  378. package/docs/shell-aliases.md +15 -6
  379. package/docs/skills/authoring.md +17 -9
  380. package/docs/skills/reference.md +23 -21
  381. package/docs/skills.md +148 -97
  382. package/docs/storage.md +172 -260
  383. package/docs/subagents/authoring.md +148 -15
  384. package/docs/subagents/reference.md +105 -29
  385. package/docs/subagents.md +247 -250
  386. package/docs/terminal-setup.md +97 -69
  387. package/docs/termux.md +51 -85
  388. package/docs/themes/reference.md +51 -37
  389. package/docs/themes.md +52 -55
  390. package/docs/tmux.md +38 -21
  391. package/docs/tools.md +209 -147
  392. package/docs/tui/reference.md +64 -32
  393. package/docs/tui.md +38 -66
  394. package/docs/usage.md +94 -86
  395. package/docs/verification.md +25 -25
  396. package/docs/web-access.md +106 -54
  397. package/docs/windows.md +55 -57
  398. package/docs/worktree-snapshots.md +82 -74
  399. package/examples/sdk/11-sessions.ts +4 -4
  400. package/package.json +8 -8
  401. package/schemas/models.schema.json +58 -7
  402. package/dist/_shared/sdk-OSBEPR3Q.js.map +0 -1
  403. package/dist/_shared/startup-0-0-TYUFUOJZ.js.map +0 -1
  404. package/dist/_shared/startup-0-1-W2G2UY7R.js.map +0 -1
  405. package/dist/_shared/startup-0-2-UXBUEOXW.js.map +0 -1
  406. package/dist/_shared/startup-0-4-HN5EB4K7.js.map +0 -1
package/docs/intercom.md CHANGED
@@ -1,33 +1,34 @@
1
1
  ---
2
- title: "Intercom"
3
- description: "Direct and broadcast messaging between Atomic sessions, on one machine or across machines that share storage"
2
+ title: "Coordinate sessions with Intercom"
3
+ sidebarTitle: "Intercom guide"
4
+ description: "Send messages, ask non-blocking questions, and escalate subagent decisions between Atomic sessions."
4
5
  ---
5
6
 
6
- # Intercom
7
+ Intercom provides direct and broadcast messaging between Atomic sessions on the same machine, or across multiple machines that share a [storage database](/storage#sharing-storage-across-hosts). You can send context, findings, or requests yourself, or let agents coordinate directly. No separate install is required.
7
8
 
8
- Atomic bundles `@bastani/intercom` for direct and broadcast messaging between sessions on the same machine, or across several machines that share a storage database. You can send context, findings, or requests yourself, or let agents coordinate directly. No separate install is required.
9
+ New to Intercom? Start with [Intercom overview](/guides/intercom). For multi-machine setup, broker upgrades, and recovery, see [Operate Intercom](/intercom/operations). For the tool schema, settings, and SDK errors, see [Intercom reference](/intercom/reference). For programmatic group and reach control, see [Intercom group and reach in the SDK](/sdk#intercom-group-and-reach).
9
10
 
10
- The extension registers commands and tools at startup. An interactive session joins Intercom in the background a few seconds after it starts, so other sessions in its group can list and message it before it uses Intercom itself. Starting the session does not wait for this connection.
11
+ The `/intercom` command, `Alt+M` shortcut, and `intercom` tool are available as soon as Atomic starts. An interactive session joins Intercom automatically in the background 3 seconds after startup, so other sessions in its group can list and message it before it uses Intercom itself. Startup never waits for this connection.
11
12
 
12
- Print (`-p`), JSON, RPC, and SDK sessions join when you or the model first use Intercom, or when they launch a subagent with Intercom. Interactive sessions do the same when startup join is off, either because `ATOMIC_INTERCOM_JOIN_AT_STARTUP=0` is set or because `joinAtStartup` is `false` in Intercom's [configuration](/intercom/reference#configuration) without `ATOMIC_INTERCOM_JOIN_AT_STARTUP=1`. A subagent launched with Intercom joins as soon as its session starts and inherits the launching session's group unless the launch sets `group`.
13
+ Print (`-p`), JSON, RPC, and SDK sessions connect on first Intercom use or when they launch a subagent with Intercom. Interactive sessions do the same when startup join is disabled (`ATOMIC_INTERCOM_JOIN_AT_STARTUP=0` or `false`, legacy alias `PI_INTERCOM_JOIN_AT_STARTUP`, or `joinAtStartup: false` in [Intercom configuration](/intercom/reference#configuration) without `ATOMIC_INTERCOM_JOIN_AT_STARTUP=1` or `true`; unrecognized environment values are ignored). A subagent launched with Intercom connects as soon as its session starts and inherits the launching session's group unless the launch sets `group`.
13
14
 
14
15
  **Key capabilities:**
15
16
 
16
17
  - **Session messaging.** Call `send`, `ask`, `reply`, `pending`, `cancel`, `list`, `groups`, and `status` through the `intercom` tool. Calls to `ask` never block; late replies arrive as messages.
17
- - **Runtime groups.** Add or remove named memberships without restarting. Joined sessions keep their broker IDs, and later subagents inherit the most recently joined membership.
18
- - **Session and group discovery.** List connected sessions or every available group with session counts and membership markers.
19
- - **Host-set reach.** An SDK host can assign a session a home group and reachable groups, enforced by the broker ([Reach policies](/intercom/reference#reach-policies)).
20
- - **Keyboard overlay.** Press ALT+M or run `/intercom` to pick a session and compose a message.
18
+ - **Runtime groups.** Add or remove named memberships without restarting. Joined sessions keep their Intercom session IDs, and later subagents inherit the most recently joined membership.
19
+ - **Session and group discovery.** List connected sessions or every active group with session counts and membership markers.
20
+ - **Keyboard overlay.** Press `Alt+M` or run `/intercom` to pick a session and compose a message.
21
21
  - **Attachments.** Share `file`, `snippet`, and `context` payloads between sessions.
22
- - **Subagent escalation.** Delegated children receive a `contact_supervisor` tool for decisions, structured interviews, and progress updates.
23
- - **Run notifications.** Subagents deliver run results and control notices to their parent session over Intercom.
22
+ - **Subagent escalation.** Subagents receive `contact_supervisor` for decisions, structured interviews, and progress updates.
23
+ - **Run notifications.** Subagents deliver run results and activity notices to their launching session over Intercom.
24
24
  - **Bundled skill.** Run `/skill:intercom` for planner-worker, group, broadcast, and escalation patterns.
25
+ - **Programmatic reach policies.** Embedded SDK hosts can constrain a session's reachable groups via [Intercom group and reach](/sdk#intercom-group-and-reach) and [Reach policies](/intercom/reference#reach-policies).
25
26
 
26
- **Example use cases:**
27
+ **Common use cases:**
27
28
 
28
29
  - Planner and worker splits across two terminals.
29
- - Research to implementation context handoffs.
30
- - Supervisor decisions and structured interviews for delegated subagents.
30
+ - Research-to-implementation context handoffs.
31
+ - Supervisor decisions and structured interviews for subagents.
31
32
  - Peer-to-peer coordination across parallel subagents.
32
33
  - Pair debugging between sessions.
33
34
 
@@ -35,19 +36,20 @@ Print (`-p`), JSON, RPC, and SDK sessions join when you or the model first use I
35
36
 
36
37
  Read this page for the quick start, coordination patterns, and supervisor escalation. Then continue to:
37
38
 
38
- - [Intercom operations](/intercom/operations) for connection states, delivery behavior, notifications, shortcuts, and recovery.
39
- - [Running Intercom across machines](/intercom/operations#running-intercom-across-machines) for multi-machine messaging through shared storage.
40
- - [Intercom reference](/intercom/reference) for the `intercom` tool contract, error classes, and every Intercom setting.
39
+ - [Operate Intercom](/intercom/operations) for connection lifecycles, delivery recovery, broker upgrades, and troubleshooting.
40
+ - [Running Intercom across machines](/intercom/operations#running-intercom-across-machines), [Sharing storage across hosts](/storage#sharing-storage-across-hosts), and [Set up teams and CI](/guides/team-setup) for multi-machine messaging through shared storage.
41
+ - [Intercom reference](/intercom/reference) for the `intercom` tool contract, targeting rules, error classes, and every Intercom setting.
42
+ - [Intercom group and reach in the SDK](/sdk#intercom-group-and-reach) and [SDK tools](/sdk/reference#tools) for programmatic reach policies and `builtins.intercom`.
41
43
 
42
44
  ## Quick start
43
45
 
44
46
  ### From the keyboard
45
47
 
46
- Press **ALT+M** or run `/intercom` to open the session list overlay:
48
+ Press **`Alt+M`** or run `/intercom` to open the session list overlay (`Alt+M` is bound by the Intercom extension rather than `keybindings.json`; `/intercom` always works as a fallback):
47
49
 
48
50
  1. **Select a session.** Use arrow keys to choose a target session.
49
51
  2. **Compose a message.** Type your message in the compose overlay.
50
- 3. **Send.** Press Enter to send or Escape to cancel.
52
+ 3. **Send.** Press `Enter` to send or `Esc` to cancel.
51
53
 
52
54
  Sent messages are recorded in session history and confirmed with a notification.
53
55
 
@@ -119,31 +121,31 @@ Found the issue: UserService.validate() does not check for null input.
119
121
  See auth.ts:142-156.
120
122
  ```
121
123
 
122
- The reply hint is enabled by default and points to `intercom({ action: "reply", ... })`, so recipients rarely need raw sender or `replyTo` IDs. Idle recipients start a new turn immediately; busy interactive recipients receive the message when they go idle. Attachment content is included in the model-visible body, and messages are stored in Atomic session history.
124
+ The reply hint is enabled by default and points to `intercom({ action: "reply", ... })`, so recipients rarely need raw sender or `replyTo` IDs. Idle recipients start a new turn immediately; busy interactive main sessions receive incoming messages when they become idle. Attachment content is included in the model-visible body, and messages are stored in Atomic session history.
123
125
 
124
126
  The recipient saves each message to its session as soon as it arrives, and the sender sees `delivered` only after that save succeeds. If the recipient closes or crashes before showing a saved message, resuming it with `atomic --session <id>` or `/resume` replays unread messages once in arrival order when the sender is still connected.
125
127
 
126
- Messages from a sender that is gone are recorded once in full without starting a turn. Messages whose sender cannot be checked yet, such as when Intercom is unreachable or a relaunched subagent has not reconnected, are deferred until the next reopen. Sessions started with `--no-session` are not saved, so their unread messages cannot be recovered.
128
+ Messages from a sender that is gone are recorded once in full without starting a turn. Messages whose sender cannot be checked yet (such as when Intercom is unreachable or a relaunched subagent has not reconnected) are deferred until the next reopen. Sessions started with `--no-session` are not saved, so their unread messages cannot be recovered.
127
129
 
128
- Working subagents handle incoming `send` and `ask` messages in the same task and session according to the sender's `delivery` option:
130
+ Working subagents act on incoming `send` and `ask` messages in the same task and session according to the sender's case-sensitive `delivery` option (busy interactive main sessions wait until idle regardless of `delivery`):
129
131
 
130
- | `delivery` | When a busy recipient gets it | Use it for |
132
+ | `delivery` | When a working subagent receives it | Use it for |
131
133
  | --- | --- | --- |
132
134
  | `"steer"` (default) | After its current tool calls finish. Current work is not cancelled. | Ordinary coordination, findings, and updates |
133
- | `"followUp"` | After the recipient finishes and stops. | Low-priority notes or follow-up tasks |
135
+ | `"followUp"` | After the subagent finishes and stops. | Low-priority notes or follow-up tasks |
134
136
  | `"interrupt"` | Immediately. Current model call or cancellable tool call is cancelled, then the message runs next. | Urgent corrections or stop orders |
135
137
 
136
- Any sender can set `delivery` per message, including peers, the supervisor, and you. An idle recipient starts a turn for any mode. For example, `intercom({ action: "send", to: "worker", message: "Stop; the spec changed", delivery: "interrupt" })` cancels the worker's current tool call. Tools that ignore cancellation finish first, and completed side effects are not undone.
138
+ Any sender can set `delivery` per `send` or `ask` call, including peers, the supervisor, and you. An idle recipient starts a turn for any mode. For example, `intercom({ action: "send", to: "worker", message: "Stop; the spec changed", delivery: "interrupt" })` cancels the worker's current tool call. Tools that ignore cancellation finish first, and completed side effects are not undone.
137
139
 
138
- Messages from one sender always reach the recipient in arrival order, whether admitted immediately, queued for idle, or replayed on resume. Startup messages join the original subagent task, and asks keep their reply threads. Subagent `pause` and `quit`, owner cancellation, host stop, and permanently cancelled children take precedence over later messages.
140
+ Messages from one sender always reach the recipient in arrival order, whether delivered immediately, queued for idle, or replayed on resume. Startup messages join the original subagent task, and asks keep their reply threads. Subagent `pause` and `quit`, session cancellation, host stop, and permanently cancelled subagents take precedence over later messages.
139
141
 
140
142
  Sending or asking a subagent that completed or failed resumes it automatically. The call returns at once with the message queued, the launching session resumes the subagent, and the subagent receives the message first. A paused or quit subagent is not resumed automatically; its messages wait with no time limit until the launching session continues it.
141
143
 
142
144
  Queued messages survive broker restarts and deliver once in order. If delivery becomes impossible because the subagent was cancelled, the launching session ended, or the launching session stayed away for 7 days in a row, the sender gets one delivery failure. See [Messages that resume a finished subagent](/intercom/reference#messages-that-resume-a-finished-subagent).
143
145
 
144
- A busy non-interactive recipient that is not an admitted subagent can refuse a message without interrupting its work. A `delivered` receipt means the recipient saved the message, not that its model accepted it. Refusals keep the reply thread: an `ask` receives a failed-ask message (or an inline error while waiting), and a `send` delivers an **Intercom delivery failed** notice with a `Sent:` timestamp without triggering a standalone turn.
146
+ A busy non-interactive recipient other than a running subagent can refuse a message without interrupting its work. A `delivered` receipt means the recipient saved the message, not that its model accepted it. Refusals keep the reply thread: an `ask` receives a failed-ask message (or an inline error while waiting), and a `send` delivers an **Intercom delivery failed** notice with a `Sent:` timestamp without triggering a standalone turn.
145
147
 
146
- Atomic enables `intercom` by default, subject to tool allowlists, exclusions, and `noTools: "all"`. Include `"intercom"` in an explicit allowlist when you need it. An interactive session whose tool selection omits `intercom` does not join at startup. SDK hosts can disable the package completely with `builtins: { intercom: false }`, and reload does not restore it. `contact_supervisor` remains subagent-only.
148
+ Atomic enables `intercom` by default, subject to tool allowlists, exclusions, and `noTools: "all"`. Include `"intercom"` in an explicit allowlist when you need it. An interactive session whose tool selection omits `intercom` does not join at startup. Print, JSON, RPC, and SDK sessions with `builtins: { intercom: false }` disable Intercom completely, and `/reload` does not restore it. See [SDK tools](/sdk/reference#tools) and [Reach policies](/intercom/reference#reach-policies) for programmatic setup, `session.intercom.setReachable()`, and `IntercomPolicyError`. `contact_supervisor` remains subagent-only.
147
149
 
148
150
  ## Coordination patterns
149
151
 
@@ -179,7 +181,7 @@ intercom({
179
181
  | Pattern | Action | Why |
180
182
  | --- | --- | --- |
181
183
  | **Task delegation** | Planner uses `send` | Fire-and-forget. Planner does not need to wait for an answer. |
182
- | **Clarification request** | Worker uses `ask` | Worker needs an answer to proceed. It keeps working on unblocked tasks until the reply arrives. |
184
+ | **Clarification request** | Worker uses `ask` | Worker needs an answer to proceed and keeps working on unblocked tasks until the reply arrives. |
183
185
  | **Discovery escalation** | Worker uses `ask` | Worker requests approval before changing direction. |
184
186
  | **Completion report** | Worker uses `ask` | Planner may have follow-up instructions or the next task. |
185
187
  | **Peer handoff** | Sibling uses `send` | A researcher or debugger passes file paths, evidence, or a reproduction straight to the sibling that needs it. |
@@ -207,33 +209,27 @@ Coordinate with other local Atomic sessions on related codebases. Use `/skill:in
207
209
  </intercom>
208
210
  ```
209
211
 
210
- ## Subagent escalation: contact_supervisor
212
+ ## Escalate subagent decisions with `contact_supervisor`
211
213
 
212
- When Atomic's [subagent runtime](/subagents) launches a delegated child with supervisor coordination enabled, that child receives the subagent-only `contact_supervisor` tool alongside `intercom`. Normal sessions never see `contact_supervisor`.
214
+ By default (`intercomBridge.mode: "always"` in `~/.atomic/agent/extensions/subagent/config.json`, documented in [Subagent config.json reference](/subagents/reference#subagent-config-json-reference)), every subagent launched by a session with Intercom active receives the subagent-only `contact_supervisor` tool alongside `intercom`. Atomic wires up the supervisor target automatically with no manual configuration. Normal sessions never see `contact_supervisor`.
213
215
 
214
- ### When the tool appears
216
+ Setting `intercomBridge.mode` to `"off"` (or `"fork-only"` for fresh subagents) limits `contact_supervisor` to agents that explicitly include it in their frontmatter tools list.
215
217
 
216
- `contact_supervisor` appears only in a delegated child whose parent granted supervisor coordination. Otherwise the child receives only `intercom`. Supervisor identity is injected by the runtime, not environment variables.
217
-
218
- In normal task-host runs, both single-child and parallel launches run in the background. A `contact_supervisor` request waits in the requesting child and continues in that same child when the supervisor replies, while an `intercom` `ask` returns at delivery and delivers its reply later as a message.
219
-
220
- A parent's `subagent({ action: "wait" })` call may yield so the parent can reply without cancelling active or queued siblings. Sends and progress updates never block. Only a direct single-child launch in an SDK session without a task host ends with a `[TASK_CONTEXT]` fresh-child handoff when its blocking parent request is claimed.
218
+ ### Parameters and reasons
221
219
 
222
220
  | Parameter | Type | Description |
223
221
  | --- | --- | --- |
224
- | `reason` | string | `"need_decision"` (blocking), `"interview_request"` (blocking structured questions), or `"progress_update"` (fire-and-forget) |
225
- | `message` | string | The decision request, optional interview note, or progress update |
226
- | `interview` | object | Required for `interview_request`: `{ title?, description?, questions: [...] }` |
227
-
228
- ### The three reasons
222
+ | `reason` | string | `"need_decision"` (blocking), `"interview_request"` (blocking structured questions), or `"progress_update"` (fire-and-forget). |
223
+ | `message` | string | Required for `progress_update`; strongly recommended for `need_decision` (an omitted `message` sends an empty question); optional note for `interview_request`. |
224
+ | `interview` | object | Required for `interview_request`: `{ title?, description?, questions: [...] }`. |
229
225
 
230
226
  | Reason | Behavior | Use when |
231
227
  | --- | --- | --- |
232
- | `need_decision` | In normal task-host runs, both single and parallel, waits for the supervisor's correlated reply and continues in the same child. In an SDK session without a task host, a direct single-child launch ends with a claimed `[TASK_CONTEXT]` fresh-child handoff. | The subagent is blocked, uncertain, needs approval, or faces a product, API, or scope decision. |
233
- | `interview_request` | In normal task-host runs, both single and parallel, waits for structured supervisor answers and continues in the same child. In an SDK session without a task host, a direct single-child launch ends with a claimed `[TASK_CONTEXT]` fresh-child handoff. | The subagent needs multiple machine-readable answers from the supervisor in one exchange. |
234
- | `progress_update` | Fire-and-forget update to the supervisor. Does not wait or end the child. | Meaningful progress or unexpected discoveries change the plan. |
228
+ | `need_decision` | Waits inside the requesting subagent (up to 10 minutes) for the supervisor's correlated reply, then continues in that same subagent. | The subagent is blocked, uncertain, needs approval, or faces a product, API, or scope decision. |
229
+ | `interview_request` | Waits inside the requesting subagent (up to 10 minutes) for structured answers from the supervisor, then continues in that same subagent. | The subagent needs multiple machine-readable answers in one exchange. |
230
+ | `progress_update` | Fire-and-forget update to the supervisor. Returns immediately without waiting or disrupting siblings. | Meaningful progress or unexpected discoveries change the plan. |
235
231
 
236
- Do not use `contact_supervisor` for routine completion handoffs; return the final subagent result normally.
232
+ Do not use `contact_supervisor` for routine completion handoffs; return the final subagent result normally. A parent's `subagent({ action: "wait" })` call yields so the supervisor can reply without cancelling active or queued siblings.
237
233
 
238
234
  ```typescript
239
235
  // Blocked subagent asks for guidance
@@ -241,8 +237,6 @@ contact_supervisor({
241
237
  reason: "need_decision",
242
238
  message: "The auth service returns 403 instead of 401 for expired tokens. Should I treat 403 as a re-auth trigger or a hard failure?"
243
239
  })
244
- // Normal task-host run (single or parallel): the supervisor replies through Intercom and this child continues.
245
- // Direct single-child SDK launch without a task host: parent receives [TASK_CONTEXT] for a fresh child.
246
240
 
247
241
  // Fire-and-forget progress update
248
242
  contact_supervisor({
@@ -252,28 +246,18 @@ contact_supervisor({
252
246
  // Output: Progress update sent to supervisor planner
253
247
  ```
254
248
 
255
- ### What the supervisor sees
256
-
257
- In normal task-host runs, both single and parallel, the supervisor receives the question with child and run identity plus a reply hint. Answer through `intercom({ action: "reply", message: "..." })`. If several questions are pending, run `intercom({ action: "pending" })` and pass the exact `replyTo`. The answer returns as the child's tool result; do not launch a replacement child to answer it.
258
-
259
- In an SDK session without a task host, a claimed direct single-child handoff instead delivers terminal run metadata, ordered attachments, the original delegated task, and a fresh-start `[TASK_CONTEXT]` call:
260
-
261
- ```text
262
- Subagent yielded for parent input (worker, child 1).
263
- Previous run (terminal): 78f659a3
264
- Question:
265
- Which API should I use?
249
+ ### Answering a subagent as the supervisor
266
250
 
267
- Start a fresh subagent with a new run identity, replacing <SUPERVISOR_ANSWER> with your answer:
268
- subagent({
269
- "agent": "worker",
270
- "task": "[TASK_CONTEXT] ... Continue with this supervisor answer: <SUPERVISOR_ANSWER>"
271
- })
272
- ```
251
+ The supervisor receives the question with child and run identity plus a reply hint. Answer through `intercom({ action: "reply", message: "..." })`. If several questions are pending, run `intercom({ action: "pending" })` and pass the exact `replyTo`. Your answer returns as the subagent's tool result; never launch a replacement subagent just to answer it.
273
252
 
274
253
  ### Structured interview replies
275
254
 
276
- `interview_request` questions use the shape `{ id, type, question, options?, context? }` where `type` is `single`, `multi`, `text`, `image`, or `info` (`info` questions provide context only and need no response):
255
+ `interview_request` questions use `{ id, type, question, options?, context? }`:
256
+
257
+ - `questions` must be a non-empty array with unique, non-empty `id` strings.
258
+ - `type` must be `"single"`, `"multi"`, `"text"`, `"image"`, or `"info"` (`info` items provide context only and need no answer).
259
+ - `options` is **required** (non-empty array of strings or `{ label: string }` objects) for `single` and `multi`, and **rejected** for `text`, `image`, and `info`.
260
+ - `message` is optional.
277
261
 
278
262
  ```typescript
279
263
  contact_supervisor({
@@ -289,7 +273,7 @@ contact_supervisor({
289
273
  })
290
274
  ```
291
275
 
292
- In normal task-host runs, questions arrive without reordering or rewriting. The supervisor can reply with plain or fenced JSON using this shape to tie answers to question IDs:
276
+ Questions arrive without reordering or rewriting. Reply with plain JSON or a fenced code block (if a reply contains multiple fenced blocks, only the first is parsed):
293
277
 
294
278
  ```json
295
279
  {
@@ -300,13 +284,30 @@ In normal task-host runs, questions arrive without reordering or rewriting. The
300
284
  }
301
285
  ```
302
286
 
303
- The child's tool result preserves the raw reply text and populates `details.structuredReply` when the answer matches the expected question IDs and options. In an SDK session without a task host, a direct single-child handoff instead carries the structured questions into its fresh task context and does not create an Intercom reply.
287
+ The subagent's tool result preserves the raw reply text and populates `details.structuredReply` when the JSON matches the expected question IDs and options. If JSON parsing or option validation fails, `details.structuredReply` is omitted and `details.structuredReplyParseError` describes the error while keeping the raw reply text.
288
+
289
+ ### Embedded SDK sessions without background task management
290
+
291
+ When an embedded SDK session launches a single subagent directly without background task management, a blocking `need_decision` or `interview_request` ends that subagent instead of waiting in place. The caller receives terminal run metadata, ordered attachments, the original delegated task (including any structured interview questions), and a fresh-start `[TASK_CONTEXT]` call:
292
+
293
+ ```text
294
+ Subagent yielded for parent input (worker, child 1).
295
+ Previous run (terminal): 78f659a3
296
+ Question:
297
+ Which API should I use?
298
+
299
+ Start a fresh subagent with a new run identity, replacing <SUPERVISOR_ANSWER> with your answer:
300
+ subagent({
301
+ "agent": "worker",
302
+ "task": "[TASK_CONTEXT] ... Continue with this supervisor answer: <SUPERVISOR_ANSWER>"
303
+ })
304
+ ```
304
305
 
305
306
  ## Mixed versions
306
307
 
307
- Atomic 0.10.0 removed workflows and `workflow:<rootRunId>/...` stage targets, which now return `Session not found`. Sessions of 0.9.x and 0.10.0+ still exchange ordinary sends, asks, and replies through whichever broker is running. See [Mixed versions and workflows](/intercom/operations#mixed-versions-and-workflows) for details.
308
+ Atomic 0.10.0 removed workflows and `workflow:<rootRunId>/...` stage targets, which now return `Session not found`. Sessions of 0.9.x and 0.10.0+ still exchange ordinary sends, asks, and replies through whichever broker is running. See [Mixed versions and workflows](/intercom/operations#mixed-versions-and-workflows).
308
309
 
309
- ## Intercom vs shared-room messengers
310
+ ## Intercom vs. shared-room messengers
310
311
 
311
312
  | Aspect | Intercom | Shared-room messengers |
312
313
  | --- | --- | --- |
@@ -320,31 +321,49 @@ Use Intercom for coordinating your own sessions and for peer-to-peer agent swarm
320
321
 
321
322
  ## Related docs
322
323
 
323
- - [Subagents](/subagents) for delegated child runs, supervisor coordination, and result delivery.
324
- - [Orchestration](/orchestration) for multi-step tasks and child completion notices.
324
+ - [Operate Intercom](/intercom/operations) for broker lifecycles, upgrades, recovery, and multi-machine routing.
325
+ - [Intercom reference](/intercom/reference) for tool parameters, targeting rules, reach policies, and error classes.
326
+ - [Sharing storage across hosts](/storage#sharing-storage-across-hosts) and [Set up teams and CI](/guides/team-setup) for shared PostgreSQL and libSQL databases.
327
+ - [Intercom group and reach in the SDK](/sdk#intercom-group-and-reach) and [SDK tools](/sdk/reference#tools) for programmatic Intercom policies and `builtins.intercom`.
328
+ - [Storage and Intercom CLI commands](/reference/cli#storage-and-intercom-commands) for `atomic intercom` and `atomic storage` subcommands.
329
+ - [Run subagents](/subagents) for delegated subagent runs, supervisor coordination, and result delivery.
330
+ - [Orchestrate with codemode and subagents](/orchestration) for multi-step tasks and completion notices.
325
331
  - [Skills](/skills) for reusable instructions like `/skill:intercom`.
326
332
  - [Environment variables](/environment-variables) for Intercom environment variables.
327
- - [Interactive use](/usage) for interactive commands and the bundled-extension overview.
333
+ - [Interactive use](/usage) for interactive commands and bundled extensions.
328
334
 
329
335
  ## Moved sections
330
336
 
331
- <a id="how-connection-works" />
332
- <a id="troubleshooting-initialization" />
333
- <a id="subagent-notifications" />
334
- <a id="subagent-control-notices" />
335
- <a id="delivery-ordering" />
336
- <a id="keyboard-shortcuts" />
337
- <a id="how-it-works" />
338
- <a id="limitations" />
339
-
340
- - **Intercom operations:** [How Connection Works](/intercom/operations#how-connection-works), [Troubleshooting initialization](/intercom/operations#troubleshooting-initialization), [Subagent Notifications](/intercom/operations#subagent-notifications), [Subagent Control Notices](/intercom/operations#subagent-control-notices), [Delivery Ordering](/intercom/operations#delivery-ordering), [Keyboard Shortcuts](/intercom/operations#keyboard-shortcuts), [How It Works](/intercom/operations#how-it-works), [Limitations](/intercom/operations#limitations).
341
-
342
- <a id="the-intercom-tool" />
343
- <a id="actions" />
344
- <a id="targeting-sessions" />
345
- <a id="groups" />
346
- <a id="send-vs-ask-vs-reply" />
347
- <a id="attachments" />
348
- <a id="configuration" />
337
+ <div id="how-connection-works" />
338
+
339
+ <div id="troubleshooting-initialization" />
340
+
341
+ <div id="subagent-notifications" />
342
+
343
+ <div id="subagent-control-notices" />
344
+
345
+ <div id="delivery-ordering" />
346
+
347
+ <div id="keyboard-shortcuts" />
348
+
349
+ <div id="how-it-works" />
350
+
351
+ <div id="limitations" />
352
+
353
+ - **Intercom operations:** [How connection works](/intercom/operations#how-connection-works), [Troubleshooting initialization](/intercom/operations#troubleshooting-initialization), [Subagent notifications](/intercom/operations#subagent-notifications), [Subagent control notices](/intercom/operations#subagent-control-notices), [Delivery ordering](/intercom/operations#delivery-ordering), [Keyboard shortcuts](/intercom/operations#keyboard-shortcuts), [How it works](/intercom/operations#how-it-works), [Limitations](/intercom/operations#limitations).
354
+
355
+ <div id="the-intercom-tool" />
356
+
357
+ <div id="actions" />
358
+
359
+ <div id="targeting-sessions" />
360
+
361
+ <div id="groups" />
362
+
363
+ <div id="send-vs-ask-vs-reply" />
364
+
365
+ <div id="attachments" />
366
+
367
+ <div id="configuration" />
349
368
 
350
369
  - **Intercom reference:** [The intercom tool](/intercom/reference#the-intercom-tool), [Actions](/intercom/reference#actions), [Targeting sessions](/intercom/reference#targeting-sessions), [Groups](/intercom/reference#groups), [send vs ask vs reply](/intercom/reference#send-vs-ask-vs-reply), [Attachments](/intercom/reference#attachments), [Configuration](/intercom/reference#configuration).
package/docs/json.md CHANGED
@@ -1,33 +1,58 @@
1
1
  ---
2
2
  title: "JSON event stream"
3
- description: "Run one prompt and parse Atomic's output as newline-delimited events."
3
+ sidebarTitle: "JSON event stream"
4
+ description: "Run one or more prompts and parse Atomic session output as newline-delimited JSON events."
4
5
  ---
5
6
 
6
- # JSON event stream mode
7
-
8
7
  ```bash
9
8
  atomic --mode json "Your prompt"
10
9
  ```
11
10
 
12
- Outputs all session events as JSON lines to stdout. Use this mode to integrate Atomic into scripts, pipelines, or custom UIs.
11
+ JSON mode runs one or more positional prompts in sequence (`atomic --mode json "First prompt" "Second prompt"`), writes every session event as a JSON line to stdout, and exits. Use it for scripts, CI pipelines, and batch processors that do not need interactive follow-up commands.
12
+
13
+ Need to send follow-up commands to a live process or embed Atomic directly in Node.js? Compare JSON mode, [RPC mode](/rpc), and the [TypeScript SDK](/sdk) on [Programmatic integration](/programmatic).
14
+
15
+ If a saved default `provider/model` names a provider that stays unsupported after startup, JSON mode writes a configuration diagnostic to stderr and exits with code `1` before sending any prompt. Stdout stays empty so downstream parsers never receive non-JSON text. Supported providers with an unknown model or missing credentials still fall back through normal model selection.
16
+
17
+ To isolate session storage in scripts or CI runs without changing saved settings, pass `--storage '<json>'`, `--storage-file <path>`, or `--session-store <path>` (with optional `--session-prefix <prefix>`), or set `ATOMIC_STORAGE` or `ATOMIC_SESSIONS_STORAGE` in the environment. Invalid storage selections fail at startup with `StorageConfigError`. Atomic writes the error to stderr, leaves stdout empty, and exits with code `1`. See [Selecting storage per process](/storage#selecting-storage-per-process).
18
+
19
+ ## Output format
13
20
 
14
- If a complete saved provider/model default names a provider that remains unsupported after provider registration, JSON mode writes a configuration diagnostic to stderr and exits nonzero before sending the prompt. It writes no diagnostic text to stdout, so stdout remains valid JSONL. Supported-provider model or authentication fallback still uses automatic model selection.
21
+ Each line on stdout is a single JSON object terminated by `\n`. The first line is always the session header (including when `--no-session` is passed, which emits the in-memory session header):
15
22
 
16
- ## Choosing an integration mode
23
+ ```json
24
+ {"type":"session","version":4,"id":"uuid","createdAt":"2026-01-01T00:00:00.000Z","cwd":"/path"}
25
+ ```
17
26
 
18
- JSON mode is one of three ways to drive Atomic from your software. Pick the smallest one that fits.
27
+ Session events follow as they occur:
19
28
 
20
- | You want | Use | Why |
21
- | --- | --- | --- |
22
- | One prompt, structured output, then exit | **JSON event stream mode** (this page) | One process, one prompt, newline-delimited events on stdout. Nothing to keep alive. |
23
- | A long-lived process you send more input to | [RPC mode](/rpc) | Send further prompts, interrupt, switch models, and answer extension UI dialogs and OAuth prompts on a live process. |
24
- | Atomic embedded inside a Node.js application | [SDK](/sdk) | The same engine as a library, with programmatic control over extensions, skills, tools, and session storage. |
29
+ ```json
30
+ {"type":"agent_start"}
31
+ {"type":"turn_start"}
32
+ {"type":"message_start","message":{"role":"assistant","content":[]}}
33
+ {"type":"message_update","usage":{},"assistantMessageEvent":{"type":"text_delta","contentIndex":0,"delta":"Hello"}}
34
+ {"type":"message_end","message":{"role":"assistant","content":[{"type":"text","text":"Hello"}]}}
35
+ {"type":"turn_end","message":{"role":"assistant","content":[{"type":"text","text":"Hello"}]},"toolResults":[]}
36
+ {"type":"agent_end","messages":[]}
37
+ ```
25
38
 
26
- If you need the full protocol contract rather than an overview, read the [RPC protocol](/rpc/protocol) or the [SDK API reference](/sdk/reference). [Programmatic use](/programmatic) compares all three modes side by side.
39
+ Unlike RPC mode, JSON mode does not add `entryId` or `seq` fields to `message_end`.
40
+
41
+ ### Streaming `message_update` wire format
42
+
43
+ On the wire, `message_update` omits large cumulative snapshots to keep streaming lines compact:
44
+
45
+ - The top-level `message` property is **stripped** on the wire (unlike the in-memory `AgentSessionEvent` delivered to SDK subscribers). Read final message content from `message_end`.
46
+ - `assistantMessageEvent.partial` is **stripped**.
47
+ - When `assistantMessageEvent.type` is `"toolcall_start"`, Atomic injects `id` and `toolName` directly on `assistantMessageEvent`.
48
+ - Top-level `usage` carries the latest cumulative provider-reported token usage (which may stay zero until completion if the provider reports usage only at the end).
49
+ - Top-level `endTurn` is included only when the provider reported an explicit end-of-turn signal (`AssistantMessage.endTurn` from `@bastani/atomic-ai`, such as OpenAI Codex `end_turn`).
50
+
51
+ A non-assistant message on `message_update` is treated as a protocol violation; Atomic throws an error instead of emitting fabricated usage.
27
52
 
28
53
  ## Event types
29
54
 
30
- Events follow the `AgentSessionEvent` type exported from `@bastani/atomic`:
55
+ Events follow the `AgentSessionEvent` union exported from `@bastani/atomic`, with the wire adjustments on `message_update` described above:
31
56
 
32
57
  ```typescript
33
58
  type AgentSessionEvent =
@@ -61,93 +86,70 @@ type AgentSessionEvent =
61
86
  | { type: "worktree_snapshot_unavailable"; reason: SerializedWorkspaceError };
62
87
  ```
63
88
 
64
- A resumed session whose blueprint build runs behind its first turn (see [Start the first turn while the build runs](/guides/resume-on-any-machine#start-the-first-turn-while-the-build-runs)) also gets one line when that build ends:
65
-
66
- ```json
67
- {"type": "blueprint_build_finished", "sessionId": "...", "roots": ["/home/u/.atomic/agent/worktree-snapshots/worktrees/..."], "notices": [{"type": "warning", "message": "Partial build: ..."}]}
68
- ```
69
-
70
- While a resume waits for another Atomic process's build of the same worktree, Atomic emits `{"type": "blueprint_build_waiting", "root": "...", "message": "Waiting for ..."}` once. This line can arrive before the session header. `notices` holds the warnings that a waiting resume prints, and is empty when the build finished cleanly. In text mode (`-p`), the same warnings go to stderr as `Warning: ...` lines.
71
-
72
- ### Key session events
73
-
74
- - `queue_update`: emits the full pending steering and follow-up queues whenever they change.
75
- - `session_info_changed`, `model_changed`, and `thinking_level_changed`: report session metadata changes.
76
- - `compaction_start` and `compaction_end`: cover manual and automatic compaction. `compaction_end.result.form` is `cleared` when the context window was cleared and `compacted` when a compactor model or an extension replaced it.
77
- - `compaction_usage`: reports the usage of the compactor model's request when it returns, including for a run that later fails. A clear makes no model call.
78
- - `child_session_usage`: reports one model call of a child session created by this session, such as a subagent, or of that child's own children.
79
- - `agent_end` and `agent_settled`: `agent_end` closes one low-level agent run while retries, compaction recovery, or queued work may still continue. `agent_settled` means no automatic work remains for the session-level run, and `aborted` is `true` when the run was cancelled.
80
-
81
- For automatic compaction, `compaction_end.willRetry === true` means the interrupted turn will retry, and `AgentSession.prompt()` waits for that continuation. This includes overflow and retry-worthy threshold recovery, such as output-token truncation or OpenAI Responses output-budget underflow. Generic `invalid_request_body` failures use `willRetry: false` when threshold compaction is warranted.
82
-
83
- If the compact-and-retry attempt for an overflow is exhausted, `unresolvedOverflow: true` and `errorMessage` let integrations choose another model instead of treating the prompt as successful. Check `result` and `errorMessage` independently: both can be present when the boundary was saved but the follow-up request exceeded the provider's hard input limit.
84
-
85
- Branch summaries reuse the configured retry policy for transient provider failures. Their `summarization_retry_*` events report scheduling, each restarted request, and retry-loop completion to JSON, RPC, SDK, and interactive consumers. Compaction does not retry its compactor request; a failure clears the context instead.
86
-
87
- Base events come from `AgentEvent` in `@bastani/atomic-agent-core` (installed as an Atomic dependency):
89
+ Base events come from `AgentEvent` in `@bastani/atomic-agent-core`:
88
90
 
89
91
  ```typescript
90
92
  type AgentEvent =
91
- // Agent lifecycle
92
93
  | { type: "agent_start" }
93
94
  | { type: "agent_end"; messages: AgentMessage[] }
94
- // Turn lifecycle
95
95
  | { type: "turn_start" }
96
96
  | { type: "turn_end"; message: AgentMessage; toolResults: ToolResultMessage[] }
97
- // Message lifecycle
98
97
  | { type: "message_start"; message: AgentMessage }
99
98
  | { type: "message_update"; message: AgentMessage; assistantMessageEvent: AssistantMessageEvent }
100
99
  | { type: "message_end"; message: AgentMessage }
101
- // Tool execution
102
- | { type: "tool_execution_start"; toolCallId: string; toolName: string; args: any }
103
- | { type: "tool_execution_update"; toolCallId: string; toolName: string; args: any; partialResult: any }
104
- | { type: "tool_execution_end"; toolCallId: string; toolName: string; result: any; isError: boolean; durationMs?: number };
100
+ | { type: "tool_execution_start"; toolCallId: string; toolName: string; args: unknown }
101
+ | { type: "tool_execution_update"; toolCallId: string; toolName: string; args: unknown; partialResult: unknown }
102
+ | { type: "tool_execution_end"; toolCallId: string; toolName: string; result: unknown; isError: boolean; durationMs?: number };
105
103
  ```
106
104
 
107
- Final assistant and tool-result messages include optional `durationMs` timing. On `tool_execution_end`, `durationMs` records how long the tool's `execute()` took using a monotonic clock, and is absent when the tool did not run.
105
+ Final assistant messages and tool results include optional `durationMs` timing. On `tool_execution_end`, `durationMs` records how long the tool's `execute()` ran using a monotonic clock and is omitted when the tool did not execute.
106
+
107
+ ### Key session events
108
+
109
+ - `queue_update`: reports the full pending steering and follow-up queues whenever they change.
110
+ - `session_info_changed`, `model_changed`, and `thinking_level_changed`: report session metadata updates.
111
+ - `compaction_start` and `compaction_end`: bracket manual and automatic compaction. `compaction_end.result.form` is `"cleared"` when the context window was cleared and `"compacted"` when a compactor model or extension replaced it.
112
+ - `compaction_usage`: reports compactor model token usage when the request returns, even if the run later fails. Clearing context makes no model call.
113
+ - `child_session_usage`: reports one model call made by a child session (such as a subagent or nested subagent).
114
+ - `agent_end` and `agent_settled`: `agent_end` finishes one low-level agent loop while retries, compaction recovery, or queued messages may still continue. `agent_settled` fires once no automatic work remains, with `aborted: true` if cancelled.
115
+ - `blueprint_build_waiting` and `blueprint_build_finished`: emitted when resuming a session whose worktree blueprint build is running in the background (see [Start the first turn while the build runs](/guides/resume-on-any-machine#start-the-first-turn-while-the-build-runs)).
116
+
117
+ ```json
118
+ {"type":"blueprint_build_waiting","root":"...","message":"Waiting for ..."}
119
+ {"type":"blueprint_build_finished","sessionId":"...","roots":["/home/u/.atomic/agent/worktree-snapshots/worktrees/..."],"notices":[{"type":"warning","message":"Partial build: ..."}]}
120
+ ```
108
121
 
109
- On the wire, each `message_update` record carries:
122
+ `blueprint_build_waiting` can arrive before the session header when waiting on another process's build of the same worktree. `notices` is empty when the build completes cleanly (in `-p` text mode, those warnings go to stderr as `Warning: ...`).
110
123
 
111
- - The streaming delta in `assistantMessageEvent`, with its cumulative `partial` field stripped.
112
- - The latest cumulative provider-reported `usage`. This may remain zero until completion if the provider reports usage only at the end.
113
- - `endTurn`, only when the provider reported it. This is the provider's explicit end-of-turn signal (`AssistantMessage.endTurn` from `@bastani/atomic-ai`), for example OpenAI Codex `end_turn`.
124
+ For automatic compaction, `compaction_end.willRetry: true` indicates Atomic will automatically retry the interrupted turn (such as after context overflow or recoverable output truncation). When a non-retryable request error triggers threshold compaction, `willRetry` is `false`. If overflow recovery is exhausted, `unresolvedOverflow: true` and `errorMessage` are set; check `result` and `errorMessage` independently because both can be present when a compaction boundary was saved before the follow-up request still exceeded the provider's input limit.
114
125
 
115
- A non-assistant message on `message_update` is a protocol violation. Atomic throws rather than emitting invented zeroed usage.
126
+ Branch summaries use the configured retry policy for transient provider errors and emit `summarization_retry_*` events. Compaction does not retry its compactor call and clears context instead if it fails.
116
127
 
117
128
  ## Message types
118
129
 
119
- Base messages come from `@bastani/atomic-ai` (installed as an Atomic dependency):
130
+ Base messages come from `@bastani/atomic-ai`:
131
+
120
132
  - `UserMessage`
121
133
  - `AssistantMessage`
122
134
  - `ToolResultMessage`
123
135
 
124
- Importing `@bastani/atomic` augments `AgentMessage` from `@bastani/atomic-agent-core` with Atomic's extended message roles (documented in [RPC protocol types](/rpc/protocol#types)):
136
+ Importing `@bastani/atomic` augments `AgentMessage` with Atomic's extended roles (documented in [RPC protocol types](/rpc/protocol#types)):
137
+
125
138
  - `BashExecutionMessage`
126
139
  - `CustomMessage`
127
140
  - `BranchSummaryMessage`
128
141
 
129
- ## Output format
130
-
131
- Each line is a JSON object. The first line is the session header:
132
-
133
- ```json
134
- {"type":"session","version":4,"id":"uuid","timestamp":"...","cwd":"/path"}
135
- ```
142
+ ## Exit codes and signals
136
143
 
137
- Followed by events as they occur:
138
-
139
- ```json
140
- {"type":"agent_start"}
141
- {"type":"turn_start"}
142
- {"type":"message_start","message":{"role":"assistant","content":[],...}}
143
- {"type":"message_update","usage":{...},"assistantMessageEvent":{"type":"text_delta","delta":"Hello",...}}
144
- {"type":"message_end","message":{...}}
145
- {"type":"turn_end","message":{...},"toolResults":[]}
146
- {"type":"agent_end","messages":[...]}
147
- ```
144
+ - **Exit `0`**: all prompts finished without fatal errors. Unlike `-p` text mode, an assistant response ending with `stopReason: "length"` still exits `0` in JSON mode.
145
+ - **Exit `1`**: configuration diagnostic for an unsupported provider, extension command failure, session persistence or claim conflict, final assistant `stopReason` of `"error"` or `"aborted"`, or an uncaught error.
146
+ - **Signals**: `SIGINT` exits with `130`, `SIGTERM` exits with `143`, and `SIGHUP` exits with `129` (skipped on Windows and when started with `SIGHUP` ignored, such as under `nohup`). A second signal forces immediate exit.
147
+ - **Background worktree builds**: JSON mode waits for in-progress blueprint builds to settle before exiting.
148
148
 
149
149
  ## Example
150
150
 
151
+ Filter completed messages with `jq`:
152
+
151
153
  ```bash
152
154
  atomic --mode json "List files" 2>/dev/null | jq -c 'select(.type == "message_end")'
153
155
  ```