@bastani/atomic 0.10.9-alpha.1 → 0.10.10-alpha.1

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 (401) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/README.md +211 -155
  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} +145 -58
  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 +85 -114
  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 +37 -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 +71 -138
  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 +60 -87
  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 +235 -243
  297. package/docs/build.md +12 -11
  298. package/docs/codemode.md +60 -51
  299. package/docs/compaction/reference.md +61 -24
  300. package/docs/compaction.md +117 -65
  301. package/docs/computer-use.md +179 -146
  302. package/docs/containerization.md +79 -33
  303. package/docs/custom-provider/api-reference.md +148 -11
  304. package/docs/custom-provider/oauth.md +44 -27
  305. package/docs/custom-provider/override.md +14 -7
  306. package/docs/custom-provider/registration.md +75 -65
  307. package/docs/custom-provider/streaming.md +42 -19
  308. package/docs/custom-provider.md +25 -61
  309. package/docs/development.md +47 -43
  310. package/docs/docs.json +33 -33
  311. package/docs/environment-variables.md +83 -57
  312. package/docs/extensions/api-reference.md +323 -734
  313. package/docs/extensions/authoring.md +186 -269
  314. package/docs/extensions/events.md +308 -375
  315. package/docs/extensions/examples.md +122 -74
  316. package/docs/extensions/ui.md +217 -197
  317. package/docs/extensions.md +152 -259
  318. package/docs/getting-started/authentication.md +27 -14
  319. package/docs/getting-started/first-session.md +25 -26
  320. package/docs/getting-started/installation.md +62 -84
  321. package/docs/getting-started/project-instructions.md +39 -14
  322. package/docs/guides/configuration.md +42 -20
  323. package/docs/guides/intercom.md +17 -13
  324. package/docs/guides/non-interactive.md +29 -16
  325. package/docs/guides/orchestration.md +16 -10
  326. package/docs/guides/resume-on-any-machine.md +54 -49
  327. package/docs/guides/subagents.md +22 -14
  328. package/docs/guides/team-setup.md +37 -26
  329. package/docs/guides.md +22 -21
  330. package/docs/herdr.md +21 -16
  331. package/docs/index.md +16 -17
  332. package/docs/intercom/operations.md +68 -66
  333. package/docs/intercom/reference.md +196 -191
  334. package/docs/intercom.md +103 -92
  335. package/docs/json.md +71 -71
  336. package/docs/keybindings.md +63 -50
  337. package/docs/libraries/agent-core.md +49 -8
  338. package/docs/libraries/ai.md +21 -12
  339. package/docs/libraries/codemode.md +28 -6
  340. package/docs/libraries/schema.md +7 -7
  341. package/docs/libraries/telemetry.md +7 -7
  342. package/docs/libraries/tui.md +74 -94
  343. package/docs/libraries.md +5 -5
  344. package/docs/llama-cpp.md +38 -33
  345. package/docs/mcp-servers.md +96 -90
  346. package/docs/models/reference.md +46 -33
  347. package/docs/models-configuration.md +12 -6
  348. package/docs/models.md +93 -88
  349. package/docs/orchestration/migrating-workflows.md +21 -19
  350. package/docs/orchestration/patterns.md +35 -20
  351. package/docs/orchestration.md +22 -21
  352. package/docs/packages/authoring.md +28 -19
  353. package/docs/packages/reference.md +75 -16
  354. package/docs/packages.md +31 -33
  355. package/docs/programmatic.md +22 -21
  356. package/docs/prompt-templates.md +63 -41
  357. package/docs/providers/reference.md +35 -19
  358. package/docs/providers.md +61 -71
  359. package/docs/quickstart.md +32 -46
  360. package/docs/reference/cli.md +249 -252
  361. package/docs/reference.md +23 -20
  362. package/docs/rpc/examples.md +74 -17
  363. package/docs/rpc/extension-ui.md +79 -62
  364. package/docs/rpc/protocol.md +816 -358
  365. package/docs/rpc.md +75 -151
  366. package/docs/sdk/reference.md +175 -45
  367. package/docs/sdk/structured-decisions.md +92 -62
  368. package/docs/sdk/web-server.md +79 -46
  369. package/docs/sdk.md +237 -195
  370. package/docs/security.md +106 -43
  371. package/docs/session-format.md +96 -59
  372. package/docs/sessions.md +149 -113
  373. package/docs/settings.md +289 -204
  374. package/docs/shell-aliases.md +15 -6
  375. package/docs/skills/authoring.md +17 -9
  376. package/docs/skills/reference.md +23 -21
  377. package/docs/skills.md +104 -97
  378. package/docs/storage.md +140 -242
  379. package/docs/subagents/authoring.md +147 -16
  380. package/docs/subagents/reference.md +100 -30
  381. package/docs/subagents.md +220 -252
  382. package/docs/terminal-setup.md +97 -69
  383. package/docs/termux.md +51 -85
  384. package/docs/themes/reference.md +51 -37
  385. package/docs/themes.md +49 -54
  386. package/docs/tmux.md +38 -21
  387. package/docs/tools.md +198 -147
  388. package/docs/tui/reference.md +64 -32
  389. package/docs/tui.md +38 -66
  390. package/docs/usage.md +76 -78
  391. package/docs/verification.md +25 -25
  392. package/docs/web-access.md +72 -55
  393. package/docs/windows.md +53 -58
  394. package/docs/worktree-snapshots.md +62 -65
  395. package/package.json +8 -8
  396. package/schemas/models.schema.json +51 -0
  397. package/dist/_shared/sdk-OSBEPR3Q.js.map +0 -1
  398. package/dist/_shared/startup-0-0-TYUFUOJZ.js.map +0 -1
  399. package/dist/_shared/startup-0-1-W2G2UY7R.js.map +0 -1
  400. package/dist/_shared/startup-0-2-UXBUEOXW.js.map +0 -1
  401. package/dist/_shared/startup-0-4-HN5EB4K7.js.map +0 -1
@@ -1,145 +1,145 @@
1
1
  ---
2
- title: RPC protocol
3
- description: Every RPC command, event, type, and error contract.
2
+ title: "RPC protocol reference"
3
+ sidebarTitle: "RPC protocol"
4
+ description: "Reference for every Atomic RPC command, streamed event, structured error code, and JSON wire type."
4
5
  ---
5
6
 
6
- # RPC protocol
7
-
8
7
  ## Commands
9
8
 
10
9
  ### Stored session summaries
11
10
 
12
- These read-only commands do not start a model turn. Stored summaries remain available when `sessionSummary.enabled` is false.
11
+ These read-only commands do not start a model turn. Stored summaries remain available even when `sessionSummary.enabled` is `false`.
13
12
 
14
13
  | Command | Response `data` | TypeScript `RpcClient` method |
15
14
  | --- | --- | --- |
16
15
  | `{"type":"get_session_summary"}` | `{ summary: SessionSummaryEntry \| null }`, including `summary` and `summarizedThroughId`; always `null` for an unsaved (`--no-session`) session | `getSessionSummary()` |
17
- | `{"type":"list_sessions"}` | `{ sessions: RpcSessionInfo[] }` for the current project/session directory, including `summary` and `summarizedThroughId`; `created` and `modified` are ISO strings | `listSessions()` |
16
+ | `{"type":"list_sessions"}` | `{ sessions: RpcSessionInfo[] }` for the current project or session directory, including `summary` and `summarizedThroughId`; `created` and `modified` are ISO strings | `listSessions()` |
18
17
 
19
18
  ### Prompting
20
19
 
21
20
  #### prompt
22
21
 
23
- Send a user prompt to the agent. The command response is emitted after the prompt is accepted, queued, or handled. Events continue streaming asynchronously after acceptance.
22
+ Send a user prompt to the agent. Atomic emits the command response once the prompt is accepted, queued, or handled. Session events then stream asynchronously.
24
23
 
25
24
  ```json
26
25
  {"id": "req-1", "type": "prompt", "message": "Hello, world!"}
27
26
  ```
28
27
 
29
28
  With images:
29
+
30
30
  ```json
31
31
  {"type": "prompt", "message": "What's in this image?", "images": [{"type": "image", "data": "base64-encoded-data", "mimeType": "image/png"}]}
32
32
  ```
33
33
 
34
- **During streaming**: If the agent is already streaming, you must specify `streamingBehavior` to queue the message:
34
+ **During streaming:** If the agent is already streaming, pass `streamingBehavior` to queue the message:
35
35
 
36
36
  ```json
37
37
  {"type": "prompt", "message": "New instruction", "streamingBehavior": "steer"}
38
38
  ```
39
39
 
40
- - `"steer"`: Queue the message while the agent is running. It is delivered after the current assistant turn finishes executing its tool calls, before the next LLM call.
41
- - `"followUp"`: Wait until the agent finishes. Message is delivered only when agent stops.
40
+ - `"steer"`: queue the message for delivery after the current assistant turn finishes its tool calls, before the next model request.
41
+ - `"followUp"`: hold the message until the active run stops.
42
42
 
43
- If the agent is streaming and no `streamingBehavior` is specified, the command returns an error.
43
+ Sending `prompt` during streaming without `streamingBehavior` returns an error response.
44
44
 
45
- **Extension commands**: If the message is an extension command (e.g., `/mycommand`), it executes immediately even during streaming. Extension commands manage their own LLM interaction via `atomic.sendMessage()`.
45
+ **Extension commands:** If `message` invokes an extension command (such as `/mycommand`), it executes immediately even while streaming. Extension commands manage their own model interaction through `atomic.sendMessage()`.
46
46
 
47
- **Input expansion**: Skill commands (`/skill:name`) and prompt templates (`/template`) are expanded before sending/queueing.
47
+ **Input expansion:** Skill commands (`/skill:name`) and prompt templates (`/template`) expand before sending or queueing.
48
48
 
49
49
  Response:
50
+
50
51
  ```json
51
52
  {"id": "req-1", "type": "response", "command": "prompt", "success": true, "data": {"disposition": "started"}}
52
53
  ```
53
54
 
54
55
  `data.disposition` reports how Atomic accepted the prompt:
56
+
55
57
  - `"handled"`: an extension command or input handler consumed it; no turn started, so do not wait for `agent_end` or `agent_settled`.
56
- - `"queued"`: queued during a run, held while the queue was paused, or held while compacting. A prompt held during compaction runs once compaction ends; if that turn fails to start (for example, missing credentials), the message stays queued and Atomic emits `agent_continue_error` with `source: "post_compaction"`.
57
- - `"started"`: Atomic started a run for this prompt (not a guarantee of completion or independent extension work).
58
+ - `"queued"`: queued during an active run, held while the queue was paused, or held during compaction. A prompt held during compaction runs once compaction ends; if starting that turn fails (for example, missing credentials), the message stays queued and Atomic emits `agent_continue_error` with `source: "post_compaction"`.
59
+ - `"started"`: Atomic started a run for this prompt.
58
60
 
59
- `success: true` means the prompt was accepted, queued, or handled immediately. `success: false` means the prompt was rejected before acceptance. Failures after acceptance are reported through the normal event and message stream, not as a second `response` for the same request id.
61
+ `success: true` means the prompt was accepted, queued, or handled. `success: false` means it was rejected before acceptance. Failures after acceptance appear on the event stream rather than as a second `response` for the same request ID.
60
62
 
61
- The `images` field is optional. Each image uses `ImageContent` format: `{"type": "image", "data": "base64-encoded-data", "mimeType": "image/png"}`.
63
+ Each optional entry in `images` uses `ImageContent` format: `{"type": "image", "data": "base64-encoded-data", "mimeType": "image/png"}`.
62
64
 
63
65
  #### steer
64
66
 
65
- Queue a steering message while the agent is running. Atomic delivers it after the current assistant turn finishes its tool calls, before the next LLM call.
67
+ Queue a steering message while the agent is running. Atomic delivers it after the current assistant turn finishes its tool calls, before the next model call.
66
68
 
67
- If no run is active and the session already has messages, Atomic starts a turn to deliver it (so a `prompt` sent during that turn needs `streamingBehavior`). On an empty session, or after `abort`, it stays queued until the next `prompt`. Skill commands and prompt templates expand; extension commands are rejected (use `prompt` instead).
69
+ If no run is active and the session already has messages, Atomic starts a turn to deliver it (so a `prompt` sent during that turn requires `streamingBehavior`). On an empty session, or after `abort`, the message stays queued until the next `prompt`. Skill commands and prompt templates expand; extension commands are rejected (use `prompt` instead).
68
70
 
69
71
  ```json
70
72
  {"type": "steer", "message": "Stop and do this instead"}
71
73
  ```
72
74
 
73
- With images:
75
+ With optional images:
76
+
74
77
  ```json
75
78
  {"type": "steer", "message": "Look at this instead", "images": [{"type": "image", "data": "base64-encoded-data", "mimeType": "image/png"}]}
76
79
  ```
77
80
 
78
- The `images` field is optional. Each image uses `ImageContent` format (same as `prompt`).
79
-
80
81
  Response:
82
+
81
83
  ```json
82
84
  {"type": "response", "command": "steer", "success": true, "data": {"disposition": "queued"}}
83
85
  ```
84
86
 
85
- `data.disposition` is `"handled"` if an input handler consumed this steer, or `"queued"` if Atomic queued it (including after a handler transformed it). It does not guarantee this message remains queued.
86
-
87
- See [set_steering_mode](#set_steering_mode) for controlling how steering messages are processed.
87
+ `data.disposition` is `"handled"` when an input handler consumed the message, or `"queued"` when Atomic queued it. See [set_steering_mode](#set_steering_mode) for delivery behavior.
88
88
 
89
89
  #### follow_up
90
90
 
91
91
  Queue a follow-up message to run after the agent finishes, once no tool calls or steering messages remain.
92
92
 
93
- If no run is active and the session already has messages, Atomic starts a turn to deliver it (so a `prompt` sent during that turn needs `streamingBehavior`). On an empty session, or after `abort`, it stays queued until the next `prompt`. Skill commands and prompt templates expand; extension commands are rejected (use `prompt` instead).
93
+ If no run is active and the session already has messages, Atomic starts a turn to deliver it. On an empty session, or after `abort`, the message stays queued until the next `prompt`. Skill commands and prompt templates expand; extension commands are rejected.
94
94
 
95
95
  ```json
96
96
  {"type": "follow_up", "message": "After you're done, also do this"}
97
97
  ```
98
98
 
99
- With images:
99
+ With optional images:
100
+
100
101
  ```json
101
102
  {"type": "follow_up", "message": "Also check this image", "images": [{"type": "image", "data": "base64-encoded-data", "mimeType": "image/png"}]}
102
103
  ```
103
104
 
104
- The `images` field is optional. Each image uses `ImageContent` format (same as `prompt`).
105
-
106
105
  Response:
106
+
107
107
  ```json
108
108
  {"type": "response", "command": "follow_up", "success": true, "data": {"disposition": "queued"}}
109
109
  ```
110
110
 
111
- `data.disposition` has the same `"handled"` or `"queued"` meaning as for `steer`, applied to this follow-up.
112
-
113
- See [set_follow_up_mode](#set_follow_up_mode) for controlling how follow-up messages are processed.
111
+ `data.disposition` is `"handled"` or `"queued"`. See [set_follow_up_mode](#set_follow_up_mode).
114
112
 
115
113
  #### abort
116
114
 
117
115
  Abort the current operation and wait for the session to become idle before responding.
118
116
 
119
- Like `Esc` in the TUI, `abort` first holds queued messages: queued steering and follow-up messages, plus notices that arrive afterward (such as background command completions), wait instead of starting a new turn.
117
+ Like `Esc` in the TUI, `abort` holds queued messages first: queued steering and follow-up messages, plus notices arriving afterward (such as background command completions), wait instead of starting a new turn.
120
118
 
121
- The next `prompt` releases the hold and includes them in its turn. If the client paused the queue with `pause_queued_messages` before or after `abort`, the hold stays until `resume_queued_messages`. If the process shuts down while a notice is held, the notice is saved and shown once when the session reopens.
119
+ The next `prompt` releases the hold and includes them in its turn. If the client paused the queue with `pause_queued_messages` before or after `abort`, the hold stays active until `resume_queued_messages`. If the process shuts down while a notice is held, Atomic saves the notice and displays it once when the session reopens.
122
120
 
123
121
  ```json
124
122
  {"type": "abort"}
125
123
  ```
126
124
 
127
125
  Response:
126
+
128
127
  ```json
129
128
  {"type": "response", "command": "abort", "success": true}
130
129
  ```
131
130
 
132
131
  #### clear_queue
133
132
 
134
- Remove queued steering and follow-up messages and return their text.
133
+ Remove all queued steering and follow-up messages and return them.
135
134
 
136
- The response lists exactly the messages this call removed. It includes a message queued after the last `queue_update` the client received, and leaves out one the session already took into a turn. A client that restores the queue to an editor should restore this list, not its own copy of the queue: the copy kept from `queue_update` events trails the session by a round trip.
135
+ The response lists the exact messages removed by this call, including anything queued after the last `queue_update` event and excluding messages already taken into a turn. Restore an editor from this response rather than from cached `queue_update` state.
137
136
 
138
137
  ```json
139
138
  {"type": "clear_queue"}
140
139
  ```
141
140
 
142
141
  Response:
142
+
143
143
  ```json
144
144
  {
145
145
  "type": "response",
@@ -151,79 +151,118 @@ Response:
151
151
  "typed": {
152
152
  "steering": ["Change direction"],
153
153
  "followUp": ["Summarize when finished"]
154
+ },
155
+ "images": {
156
+ "steering": [null],
157
+ "followUp": [null]
154
158
  }
155
159
  }
156
160
  }
157
161
  ```
158
162
 
159
- `steering` and `followUp` list each message as queued, after `input` hooks, skills and prompt templates changed it. `typed` lists the same messages, in the same order, as they were submitted. A client that gives the messages back to the user to send again should restore `typed`, so those steps run once more and not twice. `typed` is left out when every message was queued as submitted, and by sessions from before it was added; restore `steering` and `followUp` then.
163
+ `steering` and `followUp` contain each message after `input` hooks, skill expansion, and prompt templates ran. `typed` contains the original submitted text when any message was transformed; restore `typed` when returning text to a user editor so expansions do not run twice (`typed` is omitted when nothing was transformed). Optional `images` carries `{ steering: (ImageContent[] | undefined)[], followUp: (ImageContent[] | undefined)[] }` aligned with the cleared messages.
164
+
165
+ To mirror interactive `Esc`, send `clear_queue` before `abort` and restore the returned messages in your editor.
166
+
167
+ #### pause_queued_messages
168
+
169
+ Hold queued steering messages, follow-up messages, and arrival notices so they do not start a new turn until released by `resume_queued_messages`.
170
+
171
+ ```json
172
+ {"type": "pause_queued_messages"}
173
+ ```
174
+
175
+ Response:
176
+
177
+ ```json
178
+ {"type": "response", "command": "pause_queued_messages", "success": true}
179
+ ```
180
+
181
+ #### resume_queued_messages
182
+
183
+ Release a queued-message hold placed by `pause_queued_messages` or `abort`.
184
+
185
+ ```json
186
+ {"type": "resume_queued_messages"}
187
+ ```
188
+
189
+ Response:
190
+
191
+ ```json
192
+ {"type": "response", "command": "resume_queued_messages", "success": true, "data": {"released": true}}
193
+ ```
160
194
 
161
- To implement interactive `Esc` behavior, send `clear_queue` before `abort`, then restore the returned text in the client editor. `abort` holds any remaining queued messages (`pauseQueuedMessages: true`) so they wait instead of starting a new turn, and `clear_queue` removes them so you can return them to the editor.
195
+ `data.released` is `true` if held messages were released into processing, or `false` if nothing was waiting.
162
196
 
163
197
  #### new_session
164
198
 
165
- Start a fresh session. Can be cancelled by a `session_before_switch` extension event handler.
199
+ Start a fresh session. A `session_before_switch` extension hook can cancel it.
166
200
 
167
201
  ```json
168
202
  {"type": "new_session"}
169
203
  ```
170
204
 
171
205
  With optional parent session tracking:
206
+
172
207
  ```json
173
208
  {"type": "new_session", "parentSession": "parent-session-id"}
174
209
  ```
175
210
 
176
211
  Response:
212
+
177
213
  ```json
178
214
  {"type": "response", "command": "new_session", "success": true, "data": {"cancelled": false}}
179
215
  ```
180
216
 
181
217
  If an extension cancelled:
218
+
182
219
  ```json
183
220
  {"type": "response", "command": "new_session", "success": true, "data": {"cancelled": true}}
184
221
  ```
185
222
 
186
223
  #### delete_session
187
224
 
188
- Delete a stored session and its entries from the active session store (SQLite or JSONL). Use `list_sessions` to find IDs.
225
+ Delete a stored session and its entries from the active session store (SQLite or JSONL). Use `list_sessions` to discover IDs.
189
226
 
190
227
  ```json
191
228
  {"id": "req-2", "type": "delete_session", "sessionId": "019fdf86-cf98-7327-8a73-21365028f6ae"}
192
229
  ```
193
230
 
194
- `sessionId` names the session to delete. `id` is the request ID that every command carries and is echoed in the response. When `sessionId` is omitted, `id` is also used as the session ID, so `{"type": "delete_session", "id": "019fdf86-cf98-7327-8a73-21365028f6ae"}` deletes that session and the response echoes the same `id`. When both are present, `sessionId` wins. Omitting both returns an error response (`delete_session requires sessionId`) and changes nothing.
231
+ `sessionId` selects the session to delete, while `id` is the request correlation ID echoed in the response. If `sessionId` is omitted, `id` is used as the session ID too; if both are present, `sessionId` wins. Omitting both returns an error (`delete_session requires sessionId`).
195
232
 
196
233
  Response:
234
+
197
235
  ```json
198
236
  {"id": "req-2", "type": "response", "command": "delete_session", "success": true}
199
237
  ```
200
238
 
201
- The session currently open in this process cannot be deleted. The command returns an error response and the session stays intact; start or switch to another session first. Deleting an ID that is not in the store succeeds without changing anything.
239
+ You cannot delete the session currently open in this process; start or switch to another session first. Deleting an ID that does not exist succeeds without error.
202
240
 
203
241
  ```json
204
242
  {"id": "req-2", "type": "response", "command": "delete_session", "success": false, "error": "Cannot delete the session that is currently open: 019fdf86-cf98-7327-8a73-21365028f6ae"}
205
243
  ```
206
244
 
207
- TypeScript `RpcClient` method: `deleteSession(sessionId)`, which rejects on an error response.
245
+ TypeScript `RpcClient` method: `deleteSession(sessionId)`.
208
246
 
209
247
  ### State
210
248
 
211
249
  #### get_state
212
250
 
213
- Get current session state.
251
+ Return the current session state.
214
252
 
215
253
  ```json
216
254
  {"type": "get_state"}
217
255
  ```
218
256
 
219
257
  Response:
258
+
220
259
  ```json
221
260
  {
222
261
  "type": "response",
223
262
  "command": "get_state",
224
263
  "success": true,
225
264
  "data": {
226
- "model": {...},
265
+ "model": {},
227
266
  "thinkingLevel": "medium",
228
267
  "isStreaming": false,
229
268
  "isCompacting": false,
@@ -235,130 +274,177 @@ Response:
235
274
  "autoCompactionEnabled": true,
236
275
  "messageCount": 5,
237
276
  "pendingMessageCount": 0,
277
+ "queuedMessagesPaused": false,
278
+ "projectTrusted": true,
238
279
  "resourceErrors": [{"path": "/path/to/extension.ts", "error": "Failed to load extension: ..."}],
239
280
  "resourceWarnings": []
240
281
  }
241
282
  }
242
283
  ```
243
284
 
244
- `resourceErrors` lists the extensions that failed to load in the last startup or reload, and `resourceWarnings` lists their load warnings, such as an extension registering the same tool name twice.
245
-
246
- While the session waits to retry or switch models, `retryStatus` carries the `auto_retry_start` or `model_fallback_start` event, and for a retry `retryAt` gives the countdown deadline in Unix epoch milliseconds. Use `retryStatus` rather than `isStreaming` to display a wait, because a session can stay streaming across backoff; it clears once the next request starts or the wait ends.
247
-
248
- `turnStartedAt` gives the Unix epoch timestamp in milliseconds of the current turn's first request, stays unchanged across retries and fallbacks, and is absent when idle.
285
+ Key fields on `data`:
249
286
 
250
- When `isCompacting` is `true`, `compactionReason` identifies the compaction. The optional `compactionStartedAt` gives its start time in Unix epoch milliseconds, so an attaching client can show elapsed time. These fields are absent when no compaction is active.
251
-
252
- The `model` field is a full [Model](#model) object or `null`. Its `contextWindow` is the model's token budget. The `sessionName` field is the display name set via `set_session_name`, or omitted if not set.
287
+ - `model`: full [Model](#model-type) object when a model is selected, or **omitted** (not `null`) when no model is active. Its `contextWindow` is the model's token budget.
288
+ - `modelFallbackMessage` / `modelFallbackReason`: present when startup fell back from a requested or default model.
289
+ - `sessionName`: display name set via `set_session_name` or `--name`, omitted when unset.
290
+ - `queuedMessagesPaused`: `true` when queued message delivery is currently held.
291
+ - `retryStatus`: present while waiting to retry or switch fallback models; carries the `auto_retry_start` or `model_fallback_start` event (and `retryAt` in Unix epoch milliseconds for retries). Use `retryStatus` rather than `isStreaming` to render retry waits.
292
+ - `turnStartedAt`: Unix epoch timestamp in milliseconds of the active turn's first request; stays stable across retries and fallbacks and is omitted when idle.
293
+ - `compactionReason` / `compactionStartedAt`: present only while `isCompacting` is `true`, reporting why compaction started and its start timestamp in Unix epoch milliseconds.
294
+ - `projectTrusted` / `pendingProjectResourcesTrusted`: current project trust state while deciding or after trust resolution.
295
+ - `resourceErrors` / `resourceWarnings`: extension load failures and warnings from the last startup or reload.
296
+ - `resourceOverlaps` / `resourceExtensions`: overlapping resource diagnostics and loaded extension descriptors (`{ path, sourceInfo?, hidden }`).
253
297
 
254
298
  #### get_messages
255
299
 
256
- Get all messages in the conversation.
300
+ Return all messages in the active conversation branch.
257
301
 
258
302
  ```json
259
303
  {"type": "get_messages"}
260
304
  ```
261
305
 
262
306
  Response:
307
+
263
308
  ```json
264
309
  {
265
310
  "type": "response",
266
311
  "command": "get_messages",
267
312
  "success": true,
268
- "data": {"messages": [...]}
313
+ "data": {"messages": []}
269
314
  }
270
315
  ```
271
316
 
272
317
  Messages are `AgentMessage` objects (see [Types](#types)).
273
318
 
319
+ #### stop_all_background
320
+
321
+ Cancel every running or queued background subagent and background shell owned by this session (including shells started by its subagents).
322
+
323
+ ```json
324
+ {"type": "stop_all_background"}
325
+ ```
326
+
327
+ Response:
328
+
329
+ ```json
330
+ {
331
+ "type": "response",
332
+ "command": "stop_all_background",
333
+ "success": true,
334
+ "data": {
335
+ "agents": 1,
336
+ "shells": 2,
337
+ "failures": []
338
+ }
339
+ }
340
+ ```
341
+
342
+ `agents` and `shells` count the tasks cancelled; `failures` lists descriptive messages for any tasks that could not be stopped.
343
+
274
344
  ### Model
275
345
 
276
346
  #### set_model
277
347
 
278
- Switch to a specific model. Pass optional `thinkingLevel` (`"off"`, `"minimal"`, `"low"`, `"medium"`, `"high"`, `"xhigh"`, or `"max"`) to choose the model and its reasoning level in one call. A level the model does not support is clamped to a supported level. An unrecognized value returns an error response without changing the model.
348
+ Switch to a specific model. Pass optional `thinkingLevel` (`"off"`, `"minimal"`, `"low"`, `"medium"`, `"high"`, `"xhigh"`, or `"max"`) to set both model and reasoning level in one call. Unsupported levels for that model clamp to a supported level; unrecognized values return an error response without changing the model.
279
349
 
280
- Omit `persist` (or set it false) to change only the current session. Set `"persist": true` to also save `defaultProvider`, `defaultModel`, and the effective thinking level in settings, matching an interactive `/model` selection.
350
+ Omit `persist` (or pass `false`) to change only the active session. Pass `"persist": true` to also save `defaultProvider`, `defaultModel`, and the effective thinking level in global settings, matching interactive `/model`.
281
351
 
282
352
  ```json
283
353
  {"type": "set_model", "provider": "anthropic", "modelId": "claude-sonnet-4-20250514"}
284
354
  ```
285
355
 
286
356
  Persist as the startup default with an explicit reasoning level:
357
+
287
358
  ```json
288
359
  {"type": "set_model", "provider": "anthropic", "modelId": "claude-sonnet-4-20250514", "thinkingLevel": "high", "persist": true}
289
360
  ```
290
361
 
291
- Response contains the full [Model](/rpc/protocol#model) object:
362
+ Response contains the full [Model](#model-type) object:
363
+
292
364
  ```json
293
365
  {
294
366
  "type": "response",
295
367
  "command": "set_model",
296
368
  "success": true,
297
- "data": {...}
369
+ "data": {}
298
370
  }
299
371
  ```
300
372
 
301
- When `persist` is true, the model object also includes `persistedDefaults` with `provider`, `modelId`, `thinkingLevel` and `defaultThinkingLevel`. These fields report the startup model, its reasoning preference and the reasoning default saved to the global settings file, without project overrides. They can differ from the live session if an extension makes a session-only change during model selection. Use `get_state` to read the live model and reasoning level.
373
+ When `persist` is `true`, `data` also includes `persistedDefaults` (`{ provider, modelId, thinkingLevel, defaultThinkingLevel }`) reflecting the global settings file without project overrides. Use `get_state` to read the live session model and thinking level.
302
374
 
303
375
  #### cycle_model
304
376
 
305
- Cycle to the next available model. Returns `null` when fewer than two authenticated models are available in the active scope or catalog. When an unsupported saved default is blocking prompts, a successful cycle that returns a different model clears that condition; a `null` or unchanged result does not. Set `"persist": true` to also write the cycled model as the startup default.
377
+ Cycle to the next available model. Pass optional `direction` (`"forward"` or `"backward"`, default `"forward"`) and optional `persist: true` to save the cycled model as the startup default.
378
+
379
+ Returns `null` when fewer than two authenticated models are available in the active scope or catalog. When an unsupported saved default is blocking prompts, a cycle that selects a different model clears that block; a `null` or unchanged result does not.
306
380
 
307
381
  ```json
308
- {"type": "cycle_model"}
382
+ {"type": "cycle_model", "direction": "forward"}
309
383
  ```
310
384
 
311
385
  Response:
386
+
312
387
  ```json
313
388
  {
314
389
  "type": "response",
315
390
  "command": "cycle_model",
316
391
  "success": true,
317
392
  "data": {
318
- "model": {...},
393
+ "model": {},
319
394
  "thinkingLevel": "medium",
320
395
  "isScoped": false
321
396
  }
322
397
  }
323
398
  ```
324
399
 
325
- The `model` field is a full [Model](#model) object. With `persist: true`, the response data also includes `persistedDefaults` in the same format as [`set_model`](#set_model).
400
+ `model` is a full [Model](#model-type) object. With `persist: true`, `data` includes `persistedDefaults` in the same format as [`set_model`](#set_model).
326
401
 
327
402
  #### set_scoped_models
328
403
 
329
- Replace the current session's model-cycling scope. Model searches limited to the scope and `cycle_model` use the new list immediately. An empty `models` list removes the cycling restriction. Unknown model references are ignored. Invalid thinking levels return an error without changing the scope.
404
+ Replace the active session's model-cycling scope. Model cycling and scoped searches apply the new list immediately. Pass `"models": []` to clear the cycling restriction.
330
405
 
331
406
  ```json
332
407
  {"type": "set_scoped_models", "models": [{"provider": "openai", "modelId": "o3", "thinkingLevel": "high"}]}
333
408
  ```
334
409
 
335
- Each entry requires `provider` and `modelId`; `thinkingLevel` is optional. The optional `enabledModels` field also updates the global saved model patterns. Omit it to leave saved settings unchanged, pass an array to replace them, or pass `null` to enable all models. Project settings remain unchanged.
410
+ - `models` must be an array of `{ provider, modelId, thinkingLevel? }` objects; non-array values or unrecognized `thinkingLevel` values return an error response without mutating state.
411
+ - Entries matching a model known to the model runtime are added to `scopedModels` (even if unauthenticated); unknown model references are ignored.
412
+ - Optional `enabledModels` updates global `enabledModels` patterns in `settings.json` (project settings stay unchanged). Omit it to leave saved settings alone, pass an array of pattern strings (same exact, glob, and fuzzy syntax as `--models`), or pass `null` to clear saved restrictions. Non-string array entries or invalid types return an error response without modifying settings.
336
413
 
337
- A successful response has `command: "set_scoped_models"` and the same catalog `data` as `get_available_models`, including the updated `scopedModels`.
414
+ Response has `command: "set_scoped_models"` and the same catalog `data` shape as [`get_available_models`](#get_available_models), including the updated `scopedModels`.
338
415
 
339
416
  #### get_available_models
340
417
 
341
- List all configured models.
418
+ List all configured models and auth metadata.
342
419
 
343
420
  ```json
344
421
  {"type": "get_available_models"}
345
422
  ```
346
423
 
347
- Response contains an array of full [Model](#model) objects:
424
+ Response contains an array of full [Model](#model-type) objects:
425
+
348
426
  ```json
349
427
  {
350
428
  "type": "response",
351
429
  "command": "get_available_models",
352
430
  "success": true,
353
431
  "data": {
354
- "models": [...]
432
+ "models": [],
433
+ "scopedModels": [],
434
+ "compactorModels": [],
435
+ "customAuthProviders": [],
436
+ "oauthProviders": [],
437
+ "providerAuthStatuses": []
355
438
  }
356
439
  }
357
440
  ```
358
441
 
359
- `data` also carries `scopedModels`, `oauthProviders`, `customAuthProviders`, and `providerAuthStatuses`. `customAuthProviders` lists extension-registered providers (`{ id, name }`) that accept an API key through `login_provider`. `providerAuthStatuses` lists the authentication status of extension-registered providers (`{ provider, status }`, where `status` is `{ configured, source?, label? }`) when it does not come from a credential stored in `auth.json`, for example an environment variable. `refresh_models` responses carry the same fields.
442
+ - `compactorModels`: dedicated compactor models registered in the session (`morph/morph-compactor`, custom `models.json` compactors, and extension-registered compactors).
443
+ - `customAuthProviders`: extension-registered providers (`{ id, name }`) accepting API-key login through `login_provider`.
444
+ - `oauthProviders`: providers supporting interactive OAuth login through `login_provider`.
445
+ - `providerAuthStatuses`: auth status of extension-registered providers (`{ provider, status }`, where `status` is `{ configured, source?, label? }`) when credentials do not come from `auth.json` (for example, an environment variable).
360
446
 
361
- The subprocess protocol returns full `Model` objects. The exported TypeScript `RpcClient.getAvailableModels()` keeps its smaller backward-compatible `ModelInfo` shape (`provider`, `id`, `contextWindow`, `reasoning`) and adds optional `compat`. When present, `compat` exposes constrained-sampling capability claims including `supportsStrictTools`, `supportsStrictMode`, canonical `supportsOpenAIGrammarTools`, and Atomic's synchronized `supportsGrammarTools` alias. Treat absence as unknown/unsupported; do not infer enforcement from the provider name.
447
+ The raw subprocess protocol returns full `Model` objects. The TypeScript `RpcClient.getAvailableModels()` helper returns the compact `ModelInfo` shape (`provider`, `id`, `contextWindow`, `reasoning`, plus optional `compat`). When present, `compat` exposes constrained-sampling flags (`supportsStrictTools`, `supportsStrictMode`, `supportsOpenAIGrammarTools`, and the synchronized `supportsGrammarTools` alias). Treat omitted flags as unsupported; do not infer support from provider names.
362
448
 
363
449
  ```typescript
364
450
  const models = await client.getAvailableModels();
@@ -368,9 +454,73 @@ if (capabilities?.supportsStrictTools) {
368
454
  }
369
455
  ```
370
456
 
457
+ #### login_provider
458
+
459
+ Start an API-key or interactive OAuth sign-in flow for a provider, save the resulting credential, and refresh the catalog.
460
+
461
+ ```json
462
+ {"type": "login_provider", "provider": "anthropic", "authType": "oauth", "loginId": "login-1"}
463
+ ```
464
+
465
+ - `authType`: `"oauth"` or `"api_key"` (defaults to `"api_key"` when omitted).
466
+ - `loginId`: optional correlation string echoed on `oauth_*` extension UI requests so you can cancel a specific login with `cancel_login_provider`.
467
+ - For `"oauth"`, Atomic emits `oauth_*` requests over the [RPC extension UI protocol](/rpc/extension-ui#oauth-login-methods) and waits for interactive prompt responses.
468
+
469
+ Response when sign-in succeeds (returns the refreshed `RpcModelCatalog` plus `provider` and `cancelled: false`, without echoing the raw secret):
470
+
471
+ ```json
472
+ {
473
+ "type": "response",
474
+ "command": "login_provider",
475
+ "success": true,
476
+ "data": {
477
+ "provider": "anthropic",
478
+ "cancelled": false,
479
+ "models": [],
480
+ "scopedModels": [],
481
+ "customAuthProviders": []
482
+ }
483
+ }
484
+ ```
485
+
486
+ If cancelled:
487
+
488
+ ```json
489
+ {"type": "response", "command": "login_provider", "success": true, "data": {"provider": "anthropic", "cancelled": true}}
490
+ ```
491
+
492
+ #### cancel_login_provider
493
+
494
+ Cancel an in-flight `login_provider` flow. Pass the same `provider` and optional `loginId`.
495
+
496
+ ```json
497
+ {"type": "cancel_login_provider", "provider": "anthropic", "loginId": "login-1"}
498
+ ```
499
+
500
+ Response:
501
+
502
+ ```json
503
+ {"type": "response", "command": "cancel_login_provider", "success": true}
504
+ ```
505
+
506
+ #### save_provider_credential
507
+
508
+ Persist a provider `Credential` object directly (without driving interactive prompts) and return the refreshed model catalog.
509
+
510
+ ```json
511
+ {
512
+ "type": "save_provider_credential",
513
+ "provider": "openai",
514
+ "credential": {"type": "api_key", "key": "sk-..."},
515
+ "refreshCatalog": true
516
+ }
517
+ ```
518
+
519
+ `refreshCatalog` defaults to `true` (fetches the remote catalog before publishing the credential). Response `data` has the same `RpcModelCatalog` shape as [`get_available_models`](#get_available_models).
520
+
371
521
  #### logout_provider
372
522
 
373
- Remove a provider's stored credential in the authoritative agent process, refresh its available-model catalog, and return the remaining authentication status and new catalog. Environment variables and `models.json` authentication are reported but are not modified.
523
+ Remove a provider's stored credential in the running Atomic process, refresh its available-model catalog, and return the remaining auth status and catalog. Environment variables and `models.json` auth are reported but never modified.
374
524
 
375
525
  ```json
376
526
  {"type": "logout_provider", "provider": "github-copilot"}
@@ -392,48 +542,75 @@ Response:
392
542
  }
393
543
  ```
394
544
 
395
- `models` preserves the refreshed catalog order. `scopedModels` is optional. If authentication remains through an environment variable, `authStatus.source` is `"environment"` and `authStatus.label` names the variable.
545
+ If authentication still comes from an environment variable, `authStatus.source` is `"environment"` and `authStatus.label` names the variable.
546
+
547
+ #### refresh_models
548
+
549
+ Refresh provider model catalogs and return the updated catalog plus any per-provider refresh errors.
550
+
551
+ ```json
552
+ {"type": "refresh_models", "timeoutMs": 15000, "force": true, "allowNetwork": true}
553
+ ```
554
+
555
+ All options (`timeoutMs`, `force`, `allowNetwork`) are optional.
556
+
557
+ Response:
558
+
559
+ ```json
560
+ {
561
+ "type": "response",
562
+ "command": "refresh_models",
563
+ "success": true,
564
+ "data": {
565
+ "models": [],
566
+ "scopedModels": [],
567
+ "customAuthProviders": [],
568
+ "oauthProviders": [],
569
+ "providerAuthStatuses": [],
570
+ "aborted": false,
571
+ "errors": []
572
+ }
573
+ }
574
+ ```
396
575
 
397
576
  ### Thinking
398
577
 
399
578
  #### set_thinking_level
400
579
 
401
- Set the reasoning/thinking level for models that support it. Omit `persist` (or set it false) to change only the current session. Set `"persist": true` to also save `defaultThinkingLevel` and, when a model is active, its per-model override. Interactive `/thinking` choices request persistence automatically.
580
+ Set the reasoning level for models that support it. Omit `persist` (or pass `false`) to change only the current session. Pass `"persist": true` to also save `defaultThinkingLevel` and, when a model is active, its per-model override.
402
581
 
403
582
  ```json
404
583
  {"type": "set_thinking_level", "level": "high"}
405
584
  ```
406
585
 
407
586
  Persist as the startup default:
587
+
408
588
  ```json
409
589
  {"type": "set_thinking_level", "level": "high", "persist": true}
410
590
  ```
411
591
 
412
- Levels: `"off"`, `"minimal"`, `"low"`, `"medium"`, `"high"`, `"xhigh"`, `"max"`.
592
+ Valid levels: `"off"`, `"minimal"`, `"low"`, `"medium"`, `"high"`, `"xhigh"`, `"max"`. Passing an unrecognized `level` returns an error response (`success: false`) without changing session state or settings.
413
593
 
414
- `xhigh` and `max` are available only when the active model's capability mapping supports them; unsupported levels are clamped by the session model controls.
594
+ `xhigh` and `max` apply only when the active model supports them; valid levels unsupported by the current model clamp to a supported level.
415
595
 
416
- Response may omit `data` for compatibility with older clients:
417
- ```json
418
- {"type": "response", "command": "set_thinking_level", "success": true}
419
- ```
596
+ Current Atomic versions include the effective level after capability clamping and, when a model is active, the provider and model persisted against:
420
597
 
421
- Current engines include the effective level after capability clamping and, when a model is active, the provider/model the engine persisted against:
422
598
  ```json
423
599
  {"type": "response", "command": "set_thinking_level", "success": true, "data": {"level": "high", "provider": "anthropic", "modelId": "claude-sonnet-4-20250514"}}
424
600
  ```
425
601
 
426
- Use the acknowledgement's provider/model when recording a persisted thinking override, not whichever model is active when your callback runs. Keep newer `thinking_level_changed` state if an older acknowledgement arrives later. `RpcClient.setThinkingLevel(level)` remains a one-argument `Promise<void>` method.
602
+ Older clients may also encounter a data-less success response (`{"type": "response", "command": "set_thinking_level", "success": true}`). Record persisted overrides against the acknowledgement's `provider` and `modelId`, and keep newer `thinking_level_changed` events if an older acknowledgement arrives later. `RpcClient.setThinkingLevel(level)` remains a one-argument `Promise<void>` method.
427
603
 
428
604
  #### cycle_thinking_level
429
605
 
430
- Cycle through available thinking levels. Returns `null` data if model doesn't support thinking.
606
+ Cycle through thinking levels supported by the active model. Returns `data: null` if the model does not support thinking.
431
607
 
432
608
  ```json
433
609
  {"type": "cycle_thinking_level"}
434
610
  ```
435
611
 
436
612
  Response:
613
+
437
614
  ```json
438
615
  {
439
616
  "type": "response",
@@ -452,6 +629,7 @@ Return the thinking levels supported by the current model, in cycle order.
452
629
  ```
453
630
 
454
631
  Response:
632
+
455
633
  ```json
456
634
  {
457
635
  "type": "response",
@@ -465,34 +643,38 @@ Response:
465
643
 
466
644
  #### set_steering_mode
467
645
 
468
- Control how steering messages (from `steer`) are delivered.
646
+ Control how steering messages queued by `steer` are delivered.
469
647
 
470
648
  ```json
471
649
  {"type": "set_steering_mode", "mode": "one-at-a-time"}
472
650
  ```
473
651
 
474
652
  Modes:
475
- - `"all"`: Deliver all steering messages after the current assistant turn finishes executing its tool calls
476
- - `"one-at-a-time"`: Deliver one steering message per completed assistant turn (default)
653
+
654
+ - `"all"`: deliver all queued steering messages after the current assistant turn finishes its tool calls.
655
+ - `"one-at-a-time"`: deliver one steering message per completed assistant turn (default).
477
656
 
478
657
  Response:
658
+
479
659
  ```json
480
660
  {"type": "response", "command": "set_steering_mode", "success": true}
481
661
  ```
482
662
 
483
663
  #### set_follow_up_mode
484
664
 
485
- Control how follow-up messages (from `follow_up`) are delivered.
665
+ Control how follow-up messages queued by `follow_up` are delivered.
486
666
 
487
667
  ```json
488
668
  {"type": "set_follow_up_mode", "mode": "one-at-a-time"}
489
669
  ```
490
670
 
491
671
  Modes:
492
- - `"all"`: Deliver all follow-up messages when agent finishes
493
- - `"one-at-a-time"`: Deliver one follow-up message per agent completion (default)
672
+
673
+ - `"all"`: deliver all queued follow-up messages when the agent finishes.
674
+ - `"one-at-a-time"`: deliver one follow-up message per agent completion (default).
494
675
 
495
676
  Response:
677
+
496
678
  ```json
497
679
  {"type": "response", "command": "set_follow_up_mode", "success": true}
498
680
  ```
@@ -501,20 +683,21 @@ Response:
501
683
 
502
684
  #### compact
503
685
 
504
- Compact the session: stop the active run, then clear the context window, or replace it with the configured compactor model's output. `instructions` is optional; it is added to the boundary message and becomes the compactor's query, like `/compact <instructions>`. The response rejects with `Nothing to compact` when nothing has entered the context since the last boundary. The durable entry uses `details.strategy: "verbatim-lines"`; see [Compaction](/compaction) for behavior and settings.
686
+ Stop the active run and compact the session by clearing the context window or replacing it with the configured compactor model's output. Optional `instructions` is added to the boundary message and passed as the compactor query (like `/compact <instructions>`). Rejects with `Nothing to compact` if nothing has entered the context since the last boundary. See [Compaction](/compaction) for details.
505
687
 
506
688
  ```json
507
689
  {"type": "compact", "instructions": "keep the migration plan"}
508
690
  ```
509
691
 
510
692
  Response:
693
+
511
694
  ```json
512
695
  {
513
696
  "type": "response",
514
697
  "command": "compact",
515
698
  "success": true,
516
699
  "data": {
517
- "compactedText": "Context cleared. Your earlier conversation (150,000 tokens) is no longer in your context window. …",
700
+ "compactedText": "Context cleared. Your earlier conversation (150,000 tokens) is no longer in your context window. ...",
518
701
  "firstKeptEntryId": null,
519
702
  "tokensBefore": 150000,
520
703
  "promptVersion": 7,
@@ -535,32 +718,90 @@ Response:
535
718
  }
536
719
  ```
537
720
 
538
- `compactedText` is the whole boundary message the model sees. `firstKeptEntryId` is always `null`. `form` is `cleared` or `compacted`; a compacted result also carries `backend` (`compactor` or `extension`) and, for a compactor, `model`. `fallbackReason` says why a configured compactor was not used. See [Persistence and resume](/compaction/reference#persistence-and-resume) for every field.
721
+ `compactedText` is the full boundary message seen by the model. `firstKeptEntryId` is always `null`. `form` is `"cleared"` or `"compacted"`; compacted results also carry `backend` (`"compactor"` or `"extension"`) and, for a compactor, `model`. `fallbackReason` explains why a configured compactor was skipped. See [Persistence and resume](/compaction/reference#persistence-and-resume).
539
722
 
540
723
  `RpcClient.compact(instructions?)` sends this command and resolves with `data`.
541
724
 
542
725
  #### set_auto_compaction
543
726
 
544
- Enable or disable automatic compaction when context is nearly full.
727
+ Enable or disable automatic compaction when context approaches the model limit.
545
728
 
546
729
  ```json
547
730
  {"type": "set_auto_compaction", "enabled": true}
548
731
  ```
549
732
 
550
733
  Response:
734
+
551
735
  ```json
552
736
  {"type": "response", "command": "set_auto_compaction", "success": true}
553
737
  ```
554
738
 
739
+ #### set_compaction_model
740
+
741
+ Switch the active compaction model immediately without restarting or reloading, and persist it to global or project settings (pass `"persist": false` to update only in-memory session state). Pass `""` or `"auto"` for Automatic (clear and recover), or an exact compactor `provider/model` ID. Invalid values return `errorCode: "compaction_error"` with a serialized `CompactionConfigError` that `RpcClient` rehydrates automatically.
742
+
743
+ ```json
744
+ {"type": "set_compaction_model", "model": "my-compactor/compact-v2", "scope": "global"}
745
+ ```
746
+
747
+ Response:
748
+
749
+ ```json
750
+ {"type": "response", "command": "set_compaction_model", "success": true}
751
+ ```
752
+
753
+ #### set_decision_model
754
+
755
+ Switch the active decision model immediately without restarting or reloading, and persist it to global or project settings (pass `"persist": false` to update only in-memory session state). Pass `""` or `"auto"` for Automatic (current chat model), or an exact registered classifier or chat `provider/model` ID.
756
+
757
+ ```json
758
+ {"type": "set_decision_model", "model": "typesafe/jev-latest", "scope": "global"}
759
+ ```
760
+
761
+ Response:
762
+
763
+ ```json
764
+ {"type": "response", "command": "set_decision_model", "success": true}
765
+ ```
766
+
767
+ #### abort_compaction
768
+
769
+ Abort an in-progress compaction run.
770
+
771
+ ```json
772
+ {"type": "abort_compaction"}
773
+ ```
774
+
775
+ Response:
776
+
777
+ ```json
778
+ {"type": "response", "command": "abort_compaction", "success": true}
779
+ ```
780
+
781
+ #### abort_branch_summary
782
+
783
+ Abort an in-progress branch summary run (for example during `navigate_tree` with `summarize: true`).
784
+
785
+ ```json
786
+ {"type": "abort_branch_summary"}
787
+ ```
788
+
789
+ Response:
790
+
791
+ ```json
792
+ {"type": "response", "command": "abort_branch_summary", "success": true}
793
+ ```
794
+
555
795
  #### set_background_compaction
556
796
 
557
- Background compaction was removed. `set_background_compaction` and `set_background_compaction_threshold` are still accepted so older clients keep working: they succeed and change nothing.
797
+ Background compaction was removed. `set_background_compaction` and `set_background_compaction_threshold` remain accepted as no-ops for backward compatibility.
558
798
 
559
799
  ```json
560
800
  {"type": "set_background_compaction", "enabled": false}
561
801
  ```
562
802
 
563
803
  Response:
804
+
564
805
  ```json
565
806
  {"type": "response", "command": "set_background_compaction", "success": true}
566
807
  ```
@@ -569,82 +810,103 @@ Response:
569
810
 
570
811
  #### set_extension_ui_capabilities
571
812
 
572
- Say what extension UI the client can show. With `questionnaire: true`, `ask_user_question` reaches the client as one [`questionnaire`](/rpc/extension-ui#questionnaire) request instead of failing for lack of a terminal. Off until the client turns it on; an omitted field keeps its value.
813
+ Declare which optional extension UI methods the client supports. With `questionnaire: true`, `ask_user_question` sends one [`questionnaire`](/rpc/extension-ui#questionnaire) request instead of failing for lack of a terminal. Off by default; omitted fields retain their current values.
573
814
 
574
815
  ```json
575
816
  {"type": "set_extension_ui_capabilities", "questionnaire": true}
576
817
  ```
577
818
 
578
819
  Response:
820
+
579
821
  ```json
580
822
  {"type": "response", "command": "set_extension_ui_capabilities", "success": true}
581
823
  ```
582
824
 
583
- An Atomic without this command answers it with an error, so a client can send it at startup and keep its previous behavior when it fails.
825
+ Older Atomic versions that lack this command return an error response, so clients can send it at startup and fall back when unsupported.
584
826
 
585
827
  ### Debug
586
828
 
587
829
  #### set_debug
588
830
 
589
- Turn the engine's [debug mode](/development#debugging) on or off for this process. Work the engine starts afterwards, and child processes it starts afterwards, follow it. It does not change the saved `debug` setting. An `enabled` that is not `true` or `false` is refused with an error response, and nothing changes.
831
+ Enable or disable [debug mode](/development#debugging) for this Atomic process and child processes it starts afterward. Does not modify the saved `debug` setting. Passing a non-boolean `enabled` returns an error response without changing state.
590
832
 
591
833
  ```json
592
834
  {"type": "set_debug", "enabled": true}
593
835
  ```
594
836
 
595
837
  Response:
838
+
596
839
  ```json
597
840
  {"type": "response", "command": "set_debug", "success": true}
598
841
  ```
599
842
 
600
- A refused value names only its type, never the value:
843
+ Error response for a non-boolean value (reports the received type, never the value):
844
+
601
845
  ```json
602
- {"type": "response", "command": "set_debug", "success": false, "error": "Invalid debug setting: enabled is string, not a boolean (invalid-setting). Pass true or false.", "errorCode": "debug_error", "errorDetails": {"name": "DebugConfigError", "code": "invalid-setting", "message": "Invalid debug setting: enabled is string, not a boolean (invalid-setting). Pass true or false.", "hint": "Pass true or false.", "retryable": false, "fields": {"source": "rpc", "field": "enabled", "received": "string"}}}
846
+ {
847
+ "type": "response",
848
+ "command": "set_debug",
849
+ "success": false,
850
+ "error": "Invalid debug setting: enabled is string, not a boolean (invalid-setting). Pass true or false.",
851
+ "errorCode": "debug_error",
852
+ "errorDetails": {
853
+ "name": "DebugConfigError",
854
+ "code": "invalid-setting",
855
+ "message": "Invalid debug setting: enabled is string, not a boolean (invalid-setting). Pass true or false.",
856
+ "hint": "Pass true or false.",
857
+ "retryable": false,
858
+ "fields": {"source": "rpc", "field": "enabled", "received": "string"}
859
+ }
860
+ }
603
861
  ```
604
862
 
605
- `errorDetails` is a serialized [debug error](/sdk/reference#debug-errors); the SDK `RpcClient` rehydrates it.
863
+ `errorDetails` is a serialized [debug error](/sdk/reference#debug-errors) that `RpcClient` rehydrates automatically.
606
864
 
607
865
  ### Retry
608
866
 
609
867
  #### set_auto_retry
610
868
 
611
- Enable or disable automatic retry on transient errors (overloaded, rate limit, 5xx).
869
+ Enable or disable automatic retry on transient provider errors (overloaded, rate limit, 5xx).
612
870
 
613
871
  ```json
614
872
  {"type": "set_auto_retry", "enabled": true}
615
873
  ```
616
874
 
617
875
  Response:
876
+
618
877
  ```json
619
878
  {"type": "response", "command": "set_auto_retry", "success": true}
620
879
  ```
621
880
 
622
881
  #### abort_retry
623
882
 
624
- Cancel a retry or fallback already in progress. If the first request is still running and no retry has started, `abort_retry` does nothing. Use `abort` to interrupt that request.
883
+ Cancel a retry or fallback wait already in progress. If the initial request is still running and no retry has started, `abort_retry` does nothing; use `abort` to cancel the active request.
625
884
 
626
885
  ```json
627
886
  {"type": "abort_retry"}
628
887
  ```
629
888
 
630
889
  Response:
890
+
631
891
  ```json
632
892
  {"type": "response", "command": "abort_retry", "success": true}
633
893
  ```
634
894
 
635
- ### Bash
895
+ ### Shell commands
636
896
 
637
897
  #### bash
638
898
 
639
- Execute a shell command and add output to conversation context.
899
+ Execute a shell command through Atomic's `user_bash` extension hooks and add its output to conversation context (unless `excludeFromContext: true`).
640
900
 
641
901
  ```json
642
- {"type": "bash", "command": "ls -la"}
902
+ {"id": "req-1", "type": "bash", "command": "ls -la", "excludeFromContext": false}
643
903
  ```
644
904
 
645
905
  Response:
906
+
646
907
  ```json
647
908
  {
909
+ "id": "req-1",
648
910
  "type": "response",
649
911
  "command": "bash",
650
912
  "success": true,
@@ -657,18 +919,17 @@ Response:
657
919
  }
658
920
  ```
659
921
 
660
- While the command runs, Atomic emits ordered deltas correlated by the command `id`:
922
+ While running, Atomic emits ordered stdout/stderr deltas correlated by the command `id`:
661
923
 
662
924
  ```json
663
- {"type":"bash_execution_update","id":"req-1","channel":"stdout","delta":"building...\n"}
664
- {"type":"bash_execution_update","id":"req-1","channel":"stderr","delta":"warning\n"}
925
+ {"type": "bash_execution_update", "id": "req-1", "channel": "stdout", "delta": "building...\n"}
926
+ {"type": "bash_execution_update", "id": "req-1", "channel": "stderr", "delta": "warning\n"}
665
927
  ```
666
928
 
667
- `channel` is exactly `"stdout"` or `"stderr"`. Deltas preserve the observed order for each request. Concurrent bash requests may interleave globally but never share IDs.
929
+ `channel` is `"stdout"` or `"stderr"`. Concurrent bash commands may interleave globally but keep distinct IDs. Request ownership survives `new_session`, `switch_session`, `import_session`, `fork`, and `clone`: deltas keep the original ID and results record only into the originating session. Exactly one `response` ends each request.
668
930
 
669
- Request ownership survives `new_session`, `switch_session`, `import_session`, fork, and clone while the command runs. Later deltas keep the original ID and do not contaminate the replacement session. Exactly one ordinary `response` is the terminal record for completion, cancellation, or error.
931
+ If output was truncated, `data.fullOutputPath` points to the full log inside the owner- and session-scoped temp directory (`<tmpdir>/atomic-<uid>/<session-id>/`; see [Persisted tool output](/tools#persisted-tool-output)). `fullOutputPath` is `null` if the log could not be written.
670
932
 
671
- If output was truncated, the response includes `fullOutputPath`. Persisted bash output lives in the owner- and session-scoped temp tree (`<tmpdir>/atomic-<uid>/<session-id>/`), not at the temp root (see [Tools](/tools#persisted-tool-output) for layout, permissions, size cap, and retention):
672
933
  ```json
673
934
  {
674
935
  "type": "response",
@@ -684,51 +945,50 @@ If output was truncated, the response includes `fullOutputPath`. Persisted bash
684
945
  }
685
946
  ```
686
947
 
687
- `fullOutputPath` is `null` when the temp directory could not be created or the write was refused; treat it as absent rather than assuming a path exists.
688
-
689
- **How bash results reach the LLM:**
690
-
691
- The `bash` command returns a `BashResult` and saves output in the session where the request started, even if another session becomes active before completion. The saved `BashExecutionMessage` emits no event of its own.
948
+ **How shell output reaches the model:** When `excludeFromContext` is not `true`, Atomic saves a `BashExecutionMessage` in the originating session (emitting no event of its own) and includes all saved bash outputs on the next `prompt` formatted as:
692
949
 
693
- The initiating session's next prompt includes the output as user context in this format:
694
-
695
- ````
950
+ ````markdown
696
951
  Ran `ls -la`
697
- ```
952
+ ```text
698
953
  total 48
699
954
  drwxr-xr-x ...
700
955
  ```
701
956
  ````
702
957
 
703
- This means:
704
- 1. Bash output is included in the LLM context on the **next prompt**, not immediately
705
- 2. Multiple bash commands can be executed before a prompt; all outputs will be included
706
- 3. No event is emitted for the `BashExecutionMessage` itself
958
+ #### user_bash
959
+
960
+ Alias for interactive user shell commands (`!` / `!!`). Accepts the exact same `{ command, excludeFromContext? }` fields, invokes `user_bash` extension hooks, streams `bash_execution_update` deltas correlated by `id`, and returns a `BashResult` with `"command": "user_bash"`.
961
+
962
+ ```json
963
+ {"id": "req-2", "type": "user_bash", "command": "git status", "excludeFromContext": true}
964
+ ```
707
965
 
708
966
  #### abort_bash
709
967
 
710
- Abort running bash commands. Omit `requestId` to retain the legacy behavior of aborting every active RPC-owned bash request, including requests that began before a session replacement, or provide the target bash command's `id` to cancel only that request. Targeted and legacy cancellation remain isolated across concurrent IDs. Closing RPC cancels and drains remaining owned requests before shutdown.
968
+ Abort running RPC shell commands (`bash` or `user_bash`). Pass `requestId` to cancel one specific command by its request `id`, or omit `requestId` to cancel every active RPC-owned shell command (including ones started before a session switch). Shutting down RPC cancels and drains remaining shell commands automatically.
711
969
 
712
970
  ```json
713
- {"id":"cancel-1","type":"abort_bash","requestId":"req-1"}
971
+ {"id": "cancel-1", "type": "abort_bash", "requestId": "req-1"}
714
972
  ```
715
973
 
716
974
  Response:
975
+
717
976
  ```json
718
- {"id":"cancel-1","type":"response","command":"abort_bash","success":true}
977
+ {"id": "cancel-1", "type": "response", "command": "abort_bash", "success": true}
719
978
  ```
720
979
 
721
980
  ### Session
722
981
 
723
982
  #### get_session_stats
724
983
 
725
- Get token usage, cost statistics, and current context window usage.
984
+ Return token totals, cost statistics, and current context-window usage.
726
985
 
727
986
  ```json
728
987
  {"type": "get_session_stats"}
729
988
  ```
730
989
 
731
990
  Response:
991
+
732
992
  ```json
733
993
  {
734
994
  "type": "response",
@@ -767,21 +1027,18 @@ Response:
767
1027
  }
768
1028
  ```
769
1029
 
770
- `tokens` contains assistant usage totals for the current session state. `contextUsage` contains the actual current context-window estimate used for compaction and footer display.
771
-
772
- `contextUsage` is omitted when no model or context window is available. `contextUsage.tokens` and `contextUsage.percent` are `null` immediately after compaction until a fresh post-compaction assistant response provides valid usage data.
773
-
774
- `latestAssistantUsage` is the usage reported by the newest assistant message, including an aborted or failed one; the interactive footer reads its cache-hit rate from it. It is omitted until the session has an assistant message.
1030
+ `contextUsage` is omitted when no model or context window is active. Immediately after compaction, `contextUsage.tokens` and `contextUsage.percent` are `null` until the next assistant response reports usage. `latestAssistantUsage` reports usage from the newest assistant message (including aborted or failed turns) and is omitted until the session has at least one assistant message.
775
1031
 
776
1032
  #### get_tools
777
1033
 
778
- Explain which tools are active, which are not and why, and which selected tool names nothing registered.
1034
+ Report active tools, inactive tools and why they are off, missing configured tool names, excluded tools, and Git status.
779
1035
 
780
1036
  ```json
781
1037
  {"type": "get_tools"}
782
1038
  ```
783
1039
 
784
- Response, shortened to three tools, for `"defaultTools": ["+codemode", "+tool-search"]`:
1040
+ Response (abbreviated):
1041
+
785
1042
  ```json
786
1043
  {
787
1044
  "type": "response",
@@ -817,7 +1074,7 @@ Response, shortened to three tools, for `"defaultTools": ["+codemode", "+tool-se
817
1074
  "exposure": "model-only",
818
1075
  "source": "built-in extension \"tool-search\"",
819
1076
  "sourcePath": "builtin:tool-search",
820
- "summary": "Search deferred tool metadata with BM25 and load matching tools for the next model call. Some tools may not have been provided upfront; use tool_search to discover currently registered tools.",
1077
+ "summary": "Search deferred tool metadata with BM25 and load matching tools for the next model call.",
821
1078
  "inactiveReason": "opt-in; add \"+tool_search\" to defaultTools or --tools to enable it"
822
1079
  }
823
1080
  ],
@@ -832,22 +1089,20 @@ Response, shortened to three tools, for `"defaultTools": ["+codemode", "+tool-se
832
1089
  }
833
1090
  ```
834
1091
 
835
- `selection.source` is one of `default-tools-setting`, `built-in-defaults`, `tools-allowlist`, `explicit-selection`, `no-built-in-tools`, or `no-tools`; `modifiers` lists `+name`/`-name` entries from `--tools`. `tools` lists active tools first. `excluded` lists selected names that `--exclude-tools` or a mode without user input removed. The command waits until extensions finish loading, so the report includes their tools. `RpcClient.getTools()` returns the same `data`.
1092
+ `selection.source` is `"default-tools-setting"`, `"built-in-defaults"`, `"tools-allowlist"`, `"explicit-selection"`, `"no-built-in-tools"`, or `"no-tools"`. `get_tools` waits until extensions finish loading so their tools are included. `RpcClient.getTools()` returns `data`.
836
1093
 
837
1094
  #### export_html
838
1095
 
839
- Export session to an HTML file.
1096
+ Export the active session to an HTML file.
840
1097
 
841
- ```json
842
- {"type": "export_html"}
843
- ```
844
-
845
- With custom path:
846
1098
  ```json
847
1099
  {"type": "export_html", "outputPath": "/tmp/session.html"}
848
1100
  ```
849
1101
 
1102
+ `outputPath` is optional.
1103
+
850
1104
  Response:
1105
+
851
1106
  ```json
852
1107
  {
853
1108
  "type": "response",
@@ -859,124 +1114,135 @@ Response:
859
1114
 
860
1115
  #### switch_session
861
1116
 
862
- Load a different session by its exact ID. Can be cancelled by a `session_before_switch` extension event handler. `sessionLocation` in `get_state` is optional display text, not a switch target.
1117
+ Load a stored session by its exact `sessionId`. A `session_before_switch` extension hook can cancel the switch. `sessionLocation` from `get_state` is display text, not a switch target.
863
1118
 
864
1119
  ```json
865
1120
  {"type": "switch_session", "sessionId": "abc123"}
866
1121
  ```
867
1122
 
868
- When choosing a session from another project's JSONL store, pass `sessionDirectory` to bind the ID lookup to that directory. IDs may repeat in different project stores; an explicitly selected directory never falls back to another store. `cwdOverride` changes the resumed working directory, not the store used for lookup.
1123
+ When opening a session from another project's JSONL directory, pass `sessionDirectory` so lookup stays pinned to that store. Pass `cwdOverride` to change the resumed working directory without changing the store.
869
1124
 
870
1125
  ```json
871
- {"type": "switch_session", "sessionId": "abc123", "sessionDirectory": "/path/to/project-sessions"}
1126
+ {"type": "switch_session", "sessionId": "abc123", "sessionDirectory": "/path/to/project-sessions", "cwdOverride": "/new/project"}
872
1127
  ```
873
1128
 
874
1129
  Response:
1130
+
875
1131
  ```json
876
1132
  {"type": "response", "command": "switch_session", "success": true, "data": {"cancelled": false, "notices": []}}
877
1133
  ```
878
1134
 
879
- `notices` lists warnings produced during resume (such as a partial [blueprint](/guides/resume-on-any-machine) build) as `{"type": "warning", "message": "..."}` entries.
1135
+ `notices` holds resume warnings (`{"type": "warning", "message": "..."}`), such as partial [blueprint](/guides/resume-on-any-machine) builds.
1136
+
1137
+ When restoring a worktree, `switch_session` responds once the worktree is ready while the blueprint build continues in the background behind the first turn. Tool calls and `bash` commands in that worktree wait for the build, and `blueprint_build_finished` delivers any warnings. Set `resume.waitForBlueprint` to `"prompt"` to wait before responding ([details](/guides/resume-on-any-machine#start-the-first-turn-while-the-build-runs)).
880
1138
 
881
- A switch that restores a worktree responds once the worktree is ready while the blueprint build continues in the background behind the first turn. Tool calls and `bash` commands in that worktree (including those of a later `new_session` there) wait for the build, the first tool call reports build results to the agent, and `blueprint_build_finished` delivers any warnings to the client. Closing stdin cancels an in-progress build so the next resume builds again. Set `resume.waitForBlueprint` to `"prompt"` to wait for the build before responding ([details](/guides/resume-on-any-machine#start-the-first-turn-while-the-build-runs)).
1139
+ If the session's stored working directory does not exist on this machine, `switch_session` fails before opening anything with `errorCode: "missing_session_cwd"` and serialized `MissingSessionCwdError` fields (`sessionCwd`, `fallbackCwd`, and optional `sessionFile`) in `errorDetails`. Retry with `cwdOverride` to open in another directory:
882
1140
 
883
- If an extension cancelled the switch:
884
1141
  ```json
885
- {"type": "response", "command": "switch_session", "success": true, "data": {"cancelled": true}}
1142
+ {
1143
+ "type": "response",
1144
+ "command": "switch_session",
1145
+ "success": false,
1146
+ "error": "Stored session working directory does not exist: /old/project\nCurrent working directory: /new/project",
1147
+ "errorCode": "missing_session_cwd",
1148
+ "errorDetails": {
1149
+ "name": "MissingSessionCwdError",
1150
+ "code": "session-cwd-missing",
1151
+ "message": "Stored session working directory does not exist: /old/project\nCurrent working directory: /new/project",
1152
+ "hint": "Open the session from its original working directory, or continue or fork it when asked.",
1153
+ "retryable": false,
1154
+ "fields": {"sessionCwd": "/old/project", "fallbackCwd": "/new/project"}
1155
+ }
1156
+ }
886
1157
  ```
887
1158
 
888
- If the session's recorded working directory does not exist on this machine, the command fails before it opens anything, with the typed error `MissingSessionCwdError`, in any session storage. The response carries `errorCode: "missing_session_cwd"` and the error's `name`, `code`, `message`, `hint` and `fields` (`sessionCwd`, `fallbackCwd` and, for a session kept in a file, `sessionFile`) in `errorDetails`. Send the command again with `cwdOverride` set to run the session in another directory:
1159
+ #### import_session
1160
+
1161
+ Import a JSONL session export file into the active session store and switch to it. Can be cancelled by `session_before_switch`.
1162
+
1163
+ ```json
1164
+ {"type": "import_session", "inputPath": "/path/to/export.jsonl", "cwdOverride": "/new/project"}
1165
+ ```
1166
+
1167
+ Response:
889
1168
 
890
1169
  ```json
891
- {"type": "response", "command": "switch_session", "success": false, "error": "Stored session working directory does not exist: /old/project\nCurrent working directory: /new/project", "errorCode": "missing_session_cwd", "errorDetails": {"name": "MissingSessionCwdError", "code": "session-cwd-missing", "message": "Stored session working directory does not exist: /old/project\nCurrent working directory: /new/project", "hint": "Open the session from its original working directory, or continue or fork it when asked.", "retryable": false, "fields": {"sessionCwd": "/old/project", "fallbackCwd": "/new/project"}}}
1170
+ {"type": "response", "command": "import_session", "success": true, "data": {"cancelled": false, "notices": []}}
892
1171
  ```
893
1172
 
894
- `import_session` fails the same way when the imported session's working directory is missing, and stores nothing; repeat it with `cwdOverride`.
1173
+ If the exported session's working directory does not exist and `cwdOverride` was omitted, `import_session` stores nothing and fails with `errorCode: "missing_session_cwd"` (same shape as [`switch_session`](#switch_session)). Repeat with `cwdOverride` to import into another directory.
895
1174
 
896
1175
  #### start_pending_recovery
897
1176
 
898
- Recover work an earlier process left unfinished in the current session. Send it after you have shown the transcript, at startup or after `switch_session`.
1177
+ Recover interrupted work left by a previous process in the current session. Send this after displaying the transcript at startup or after `switch_session`.
899
1178
 
900
- Loading or switching a session never recovers anything by itself. Until a client sends this command, interrupted deliveries stay pending in the session. The command runs once per loaded session; repeating it returns the same report. It does not block other commands, so prompts and `abort` keep working while it runs.
1179
+ Opening a session never recovers interrupted work automatically. This command runs once per loaded session (repeating it returns the same report) and does not block prompts or `abort`.
901
1180
 
902
1181
  ```json
903
1182
  {"type": "start_pending_recovery", "reason": "resume"}
904
1183
  ```
905
1184
 
906
- Set the optional `reason` to `"startup"` or `"resume"`.
1185
+ Optional `reason` is `"startup"` or `"resume"`. Extensions restore background work first, interrupted deliveries replay as normal turns, and undelivered notices append without starting a turn.
907
1186
 
908
- Extensions first restore their background work. Interrupted deliveries that are still wanted are then replayed in a turn, which streams like any other turn. Notices and undelivered background task results are appended without starting a turn.
1187
+ Response:
909
1188
 
910
- The response arrives when recovery has finished:
911
1189
  ```json
912
- {"type": "response", "command": "start_pending_recovery", "success": true, "data": {"replayed": 1, "dropped": 1, "completions": 0, "notices": ["Worker reviewer is gone."]}}
1190
+ {
1191
+ "type": "response",
1192
+ "command": "start_pending_recovery",
1193
+ "success": true,
1194
+ "data": {"replayed": 1, "dropped": 1, "completions": 0, "notices": ["Worker reviewer is gone."]}
1195
+ }
913
1196
  ```
914
1197
 
915
1198
  #### fork
916
1199
 
917
- Create a new fork from a previous user message on the active branch. Can be cancelled by a `session_before_fork` extension event handler. Returns the text of the message being forked from.
1200
+ Create a new session forked from a previous user message on the active branch. Can be cancelled by `session_before_fork`.
918
1201
 
919
1202
  ```json
920
1203
  {"type": "fork", "entryId": "abc123"}
921
1204
  ```
922
1205
 
923
1206
  Response:
924
- ```json
925
- {
926
- "type": "response",
927
- "command": "fork",
928
- "success": true,
929
- "data": {"text": "The original prompt text...", "cancelled": false}
930
- }
931
- ```
932
1207
 
933
- If an extension cancelled the fork:
934
1208
  ```json
935
1209
  {
936
1210
  "type": "response",
937
1211
  "command": "fork",
938
1212
  "success": true,
939
- "data": {"text": "The original prompt text...", "cancelled": true}
1213
+ "data": {"text": "The original prompt text...", "cancelled": false}
940
1214
  }
941
1215
  ```
942
1216
 
943
1217
  #### clone
944
1218
 
945
- Duplicate the current active branch into a new session at the current position. Can be cancelled by a `session_before_fork` extension event handler.
1219
+ Duplicate the active branch into a new session at the current leaf entry. Can be cancelled by `session_before_fork`. Fails with `"Cannot clone session: no current entry selected"` on an empty session (`leafId === null`).
946
1220
 
947
1221
  ```json
948
1222
  {"type": "clone"}
949
1223
  ```
950
1224
 
951
1225
  Response:
952
- ```json
953
- {
954
- "type": "response",
955
- "command": "clone",
956
- "success": true,
957
- "data": {"cancelled": false}
958
- }
959
- ```
960
1226
 
961
- If an extension cancelled the clone:
962
1227
  ```json
963
1228
  {
964
1229
  "type": "response",
965
1230
  "command": "clone",
966
1231
  "success": true,
967
- "data": {"cancelled": true}
1232
+ "data": {"cancelled": false}
968
1233
  }
969
1234
  ```
970
1235
 
971
1236
  #### get_fork_messages
972
1237
 
973
- Get user prompts available for forking, including older prompts on every branch. A windowed session obtains them through the same bounded archive reader as `/fork`; long prompts use the picker's short labels. Each original entry ID can be passed to `fork`.
1238
+ List user prompts available for forking across every branch, including older prompts on compacted or branched sessions (long prompts use short picker labels). Pass any returned `entryId` to `fork`.
974
1239
 
975
1240
  ```json
976
1241
  {"type": "get_fork_messages"}
977
1242
  ```
978
1243
 
979
1244
  Response:
1245
+
980
1246
  ```json
981
1247
  {
982
1248
  "type": "response",
@@ -993,20 +1259,16 @@ Response:
993
1259
 
994
1260
  #### get_entries
995
1261
 
996
- Get resident session entries in append order, excluding the session header. `entries` includes the current context window and the earlier state needed to resume it. Use `get_history_page` for pre-compaction history and abandoned branches.
1262
+ Return entries in the loaded context window in append order (excluding the session header). Use [`get_history_page`](#get_history_page) to read pre-compaction history and abandoned branches.
997
1263
 
998
- Entry IDs are stable in the append-only tree. Use the last entry ID you have seen as `since` to get only entries strictly after it, even across client restarts.
999
-
1000
- ```json
1001
- {"type": "get_entries"}
1002
- ```
1264
+ Pass the last entry ID you received as `since` to fetch only strictly newer entries. If `since` points to an older archived entry outside the loaded context window, Atomic resolves its sequence in history and returns all loaded entries with a higher sequence. Only an unknown entry ID returns `success: false`.
1003
1265
 
1004
- With a cursor:
1005
1266
  ```json
1006
1267
  {"type": "get_entries", "since": "abc123"}
1007
1268
  ```
1008
1269
 
1009
1270
  Response:
1271
+
1010
1272
  ```json
1011
1273
  {
1012
1274
  "type": "response",
@@ -1014,32 +1276,75 @@ Response:
1014
1276
  "success": true,
1015
1277
  "data": {
1016
1278
  "entries": [
1017
- {"type": "message", "id": "def456", "parentId": "abc123", "timestamp": "...", "message": {"role": "user", "...": "..."}}
1279
+ {"type": "message", "id": "def456", "parentId": "abc123", "timestamp": "2026-01-01T00:00:00.000Z", "message": {"role": "user", "content": "Hello"}}
1018
1280
  ],
1019
1281
  "leafId": "def456"
1020
1282
  }
1021
1283
  }
1022
1284
  ```
1023
1285
 
1024
- `leafId` is the id of the current leaf entry (`null` for an empty session), so a client can tell in one round trip whether the active branch moved. If `since` does not match any entry id, the response is `success: false`.
1286
+ `leafId` is the current leaf entry ID (`null` on an empty session).
1025
1287
 
1026
1288
  #### get_history_page
1027
1289
 
1028
- Read one page of the saved session in append order, including abandoned branches. Pass optional inclusive `fromSeq` and `toSeq`. A response's `data.items` contains `{seq, entry}` records up to 64 entries and 1 MiB per page; a larger entry returns alone as an oversized reference. Pass `cursor: data.nextCursor` instead of a range to get the next page. Later appends do not change the captured end. `get_tree` and `get_fork_messages` do not need to be called before reading pages.
1290
+ Read one page of the full saved session in append order, including pre-compaction entries and abandoned branches. Pass optional inclusive `fromSeq` / `toSeq` and optional `pageEntries`, or pass `cursor: data.nextCursor` (without a range) to fetch the next page.
1291
+
1292
+ ```json
1293
+ {"type": "get_history_page", "fromSeq": 1, "pageEntries": 64}
1294
+ ```
1295
+
1296
+ Response:
1297
+
1298
+ ```json
1299
+ {
1300
+ "type": "response",
1301
+ "command": "get_history_page",
1302
+ "success": true,
1303
+ "data": {
1304
+ "items": [
1305
+ {"seq": 1, "entry": {"type": "message", "id": "abc123", "parentId": null}}
1306
+ ],
1307
+ "nextCursor": "eyJ..."
1308
+ }
1309
+ }
1310
+ ```
1311
+
1312
+ Each page contains up to 64 entries and 1 MiB of serialized JSON; an entry exceeding that limit is returned alone as an oversized reference item readable via `get_history_chunk`. Later appends do not shift the snapshot's end sequence.
1029
1313
 
1030
1314
  #### get_history_chunk
1031
1315
 
1032
- Read up to 64 KiB of the original UTF-8 bytes of one oversized item. Pass `reference` (the complete item from `get_history_page`) and `offset` (0 for the first chunk). Decode `data.data` from base64 and continue at `data.nextOffset` if present. A replacement is rejected instead of mixing generations.
1316
+ Read up to 64 KiB of the original UTF-8 bytes of one oversized item returned by `get_history_page`. Pass `reference` (the complete oversized item) and `offset` (`0` for the first chunk).
1317
+
1318
+ ```json
1319
+ {"type": "get_history_chunk", "reference": {"oversized": true, "seq": 12, "id": "big123", "byteLength": 2097152}, "offset": 0}
1320
+ ```
1321
+
1322
+ Response:
1323
+
1324
+ ```json
1325
+ {
1326
+ "type": "response",
1327
+ "command": "get_history_chunk",
1328
+ "success": true,
1329
+ "data": {
1330
+ "data": "eyJ0eXBlIjoibWVzc2FnZSI...",
1331
+ "nextOffset": 65536
1332
+ }
1333
+ }
1334
+ ```
1335
+
1336
+ Decode `data.data` from base64 and continue requesting at `data.nextOffset` until `nextOffset` is omitted. Session replacement invalidates prior references.
1033
1337
 
1034
1338
  #### get_tree
1035
1339
 
1036
- Get the resident window as a tree of entries. Each node is `{entry, children, label?, labelTimestamp?}`. A well-formed session has a single root; orphaned entries (broken parent chain) also appear as roots.
1340
+ Return the loaded context window as a tree of entries. Each node is `{ entry, children, label?, labelTimestamp? }`. A well-formed session has one root; orphaned entries also appear as roots.
1037
1341
 
1038
1342
  ```json
1039
1343
  {"type": "get_tree"}
1040
1344
  ```
1041
1345
 
1042
1346
  Response:
1347
+
1043
1348
  ```json
1044
1349
  {
1045
1350
  "type": "response",
@@ -1048,9 +1353,9 @@ Response:
1048
1353
  "data": {
1049
1354
  "tree": [
1050
1355
  {
1051
- "entry": {"type": "message", "id": "abc123", "parentId": null, "...": "..."},
1356
+ "entry": {"type": "message", "id": "abc123", "parentId": null},
1052
1357
  "children": [
1053
- {"entry": {"type": "message", "id": "def456", "parentId": "abc123", "...": "..."}, "children": []}
1358
+ {"entry": {"type": "message", "id": "def456", "parentId": "abc123"}, "children": []}
1054
1359
  ]
1055
1360
  }
1056
1361
  ],
@@ -1059,15 +1364,63 @@ Response:
1059
1364
  }
1060
1365
  ```
1061
1366
 
1367
+ #### navigate_tree
1368
+
1369
+ Move the active branch leaf to `targetId` in the session tree, optionally summarizing the abandoned branch.
1370
+
1371
+ ```json
1372
+ {
1373
+ "type": "navigate_tree",
1374
+ "targetId": "abc123",
1375
+ "options": {
1376
+ "summarize": true,
1377
+ "customInstructions": "Preserve all test outcomes",
1378
+ "replaceInstructions": false,
1379
+ "label": "before-refactor"
1380
+ }
1381
+ }
1382
+ ```
1383
+
1384
+ Response:
1385
+
1386
+ ```json
1387
+ {
1388
+ "type": "response",
1389
+ "command": "navigate_tree",
1390
+ "success": true,
1391
+ "data": {
1392
+ "cancelled": false,
1393
+ "editorText": "Optional prompt text to restore"
1394
+ }
1395
+ }
1396
+ ```
1397
+
1398
+ `data` may also contain `aborted: true` (if branch summarization was cancelled with `abort_branch_summary`) and `summaryEntry` (`BranchSummaryEntry`) when summarization ran.
1399
+
1400
+ #### set_label
1401
+
1402
+ Attach or clear a bookmark label on a session entry. Omit `label` (or pass `undefined`) to clear an existing label.
1403
+
1404
+ ```json
1405
+ {"type": "set_label", "entryId": "abc123", "label": "baseline"}
1406
+ ```
1407
+
1408
+ Response:
1409
+
1410
+ ```json
1411
+ {"type": "response", "command": "set_label", "success": true, "data": {"entryId": "label-entry-id"}}
1412
+ ```
1413
+
1062
1414
  #### get_last_assistant_text
1063
1415
 
1064
- Get the text content of the last assistant message. Messages without text from an aborted or failed turn, or that only call tools, are skipped.
1416
+ Return the text content of the most recent assistant message. Messages without text from aborted or failed turns, or tool-call-only messages, are skipped. Returns `{"text": null}` if none exist.
1065
1417
 
1066
1418
  ```json
1067
1419
  {"type": "get_last_assistant_text"}
1068
1420
  ```
1069
1421
 
1070
1422
  Response:
1423
+
1071
1424
  ```json
1072
1425
  {
1073
1426
  "type": "response",
@@ -1077,57 +1430,87 @@ Response:
1077
1430
  }
1078
1431
  ```
1079
1432
 
1080
- Returns `{"text": null}` if no assistant messages exist.
1081
-
1082
1433
  #### set_session_name
1083
1434
 
1084
- Set a display name for the current session. The name appears in session listings and helps identify sessions.
1435
+ Set a display name for the current session. Empty or whitespace-only names fail with `"Session name cannot be empty"`.
1085
1436
 
1086
1437
  ```json
1087
1438
  {"type": "set_session_name", "name": "my-feature-work"}
1088
1439
  ```
1089
1440
 
1090
1441
  Response:
1442
+
1091
1443
  ```json
1092
- {
1093
- "type": "response",
1094
- "command": "set_session_name",
1095
- "success": true
1096
- }
1444
+ {"type": "response", "command": "set_session_name", "success": true}
1097
1445
  ```
1098
1446
 
1099
- The current session name is available via `get_state` in the `sessionName` field. To set the initial name when starting RPC mode, pass `--name <name>` or `-n <name>` to the `atomic --mode rpc` process.
1447
+ Read the active name from `get_state.data.sessionName`, or set it at startup with `--name <name>` (`-n <name>`).
1100
1448
 
1101
1449
  #### reload
1102
1450
 
1103
- Reload keybindings, extensions, skills, prompts and themes, as `/reload` does in interactive mode.
1451
+ Reload keybindings, extensions, skills, prompt templates, and themes (equivalent to `/reload`).
1104
1452
 
1105
1453
  ```json
1106
1454
  {"type": "reload"}
1107
1455
  ```
1108
1456
 
1109
1457
  Response:
1458
+
1459
+ ```json
1460
+ {"type": "response", "command": "reload", "success": true}
1461
+ ```
1462
+
1463
+ Before responding, Atomic emits one [`extension_error`](#extension_error) event with `"event": "reload"` for each extension that failed to load.
1464
+
1465
+ #### get_shortcuts
1466
+
1467
+ List keyboard shortcuts registered by extensions in the active session.
1468
+
1469
+ ```json
1470
+ {"type": "get_shortcuts"}
1471
+ ```
1472
+
1473
+ Response:
1474
+
1110
1475
  ```json
1111
1476
  {
1112
1477
  "type": "response",
1113
- "command": "reload",
1114
- "success": true
1478
+ "command": "get_shortcuts",
1479
+ "success": true,
1480
+ "data": {
1481
+ "shortcuts": [
1482
+ {"key": "ctrl+alt+p", "description": "Toggle preview"}
1483
+ ]
1484
+ }
1115
1485
  }
1116
1486
  ```
1117
1487
 
1118
- Before the response, Atomic emits one [`extension_error`](#extension_error) event with `"event": "reload"` for each extension that failed to load. The extension stays out of the session until a later reload loads it.
1488
+ #### invoke_shortcut
1119
1489
 
1120
- ### Commands
1490
+ Invoke an extension-registered keyboard shortcut by its `key` string (as returned by `get_shortcuts`).
1491
+
1492
+ ```json
1493
+ {"type": "invoke_shortcut", "key": "ctrl+alt+p"}
1494
+ ```
1495
+
1496
+ Response:
1497
+
1498
+ ```json
1499
+ {"type": "response", "command": "invoke_shortcut", "success": true}
1500
+ ```
1501
+
1502
+ ### Slash commands
1121
1503
 
1122
1504
  #### get_commands
1123
1505
 
1124
- Get available commands (extension commands, prompt templates, and skills). These can be invoked via the `prompt` command by prefixing with `/`.
1506
+ List slash commands available through `prompt` (extension commands, prompt templates, and skills). Invoke any returned command by prefixing its `name` with `/`.
1125
1507
 
1126
1508
  ```json
1127
1509
  {"type": "get_commands"}
1128
1510
  ```
1129
1511
 
1130
1512
  Response:
1513
+
1131
1514
  ```json
1132
1515
  {
1133
1516
  "type": "response",
@@ -1135,117 +1518,192 @@ Response:
1135
1518
  "success": true,
1136
1519
  "data": {
1137
1520
  "commands": [
1138
- {"name": "session-name", "description": "Set or clear session name", "source": "extension", "path": "/home/user/.atomic/agent/extensions/session.ts"},
1139
- {"name": "fix-tests", "description": "Fix failing tests", "source": "prompt", "location": "project", "path": "/home/user/myproject/.atomic/prompts/fix-tests.md"},
1140
- {"name": "skill:brave-search", "description": "Web search via Brave API", "source": "skill", "location": "user", "path": "/home/user/.atomic/agent/skills/brave-search/SKILL.md"}
1521
+ {
1522
+ "name": "session-name",
1523
+ "description": "Set or clear session name",
1524
+ "hasArgumentCompletions": true,
1525
+ "source": "extension",
1526
+ "sourceInfo": {
1527
+ "path": "/home/user/.atomic/agent/extensions/session.ts",
1528
+ "source": "local",
1529
+ "scope": "user",
1530
+ "origin": "top-level",
1531
+ "baseDir": "/home/user/.atomic/agent/extensions"
1532
+ }
1533
+ },
1534
+ {
1535
+ "name": "fix-tests",
1536
+ "description": "Fix failing tests",
1537
+ "source": "prompt",
1538
+ "sourceInfo": {
1539
+ "path": "/home/user/myproject/.atomic/prompts/fix-tests.md",
1540
+ "source": "local",
1541
+ "scope": "project",
1542
+ "origin": "top-level",
1543
+ "baseDir": "/home/user/myproject/.atomic/prompts"
1544
+ }
1545
+ },
1546
+ {
1547
+ "name": "skill:brave-search",
1548
+ "description": "Web search via Brave API",
1549
+ "source": "skill",
1550
+ "sourceInfo": {
1551
+ "path": "/home/user/.atomic/agent/skills/brave-search/SKILL.md",
1552
+ "source": "local",
1553
+ "scope": "user",
1554
+ "origin": "top-level",
1555
+ "baseDir": "/home/user/.atomic/agent/skills/brave-search"
1556
+ }
1557
+ }
1141
1558
  ]
1142
1559
  }
1143
1560
  }
1144
1561
  ```
1145
1562
 
1146
- Each command has:
1147
- - `name`: Command name (invoke with `/name`)
1148
- - `description`: Human-readable description (optional for extension commands)
1149
- - `source`: What kind of command:
1150
- - `"extension"`: Registered via `atomic.registerCommand()` in an extension
1151
- - `"prompt"`: Loaded from a prompt template `.md` file
1152
- - `"skill"`: Loaded from a skill directory (name is prefixed with `skill:`)
1153
- - `location`: Where it was loaded from (optional, not present for extensions):
1154
- - `"user"`: User-level (`~/.atomic/agent/`)
1155
- - `"project"`: Project-level (`./.atomic/`)
1156
- - `"path"`: Explicit path via CLI or settings
1157
- - `path`: Absolute file path to the command source (optional)
1563
+ Each item (`RpcSlashCommand`) contains:
1564
+
1565
+ - `name`: command name without the leading `/` (skills are prefixed with `skill:`).
1566
+ - `description`: optional human-readable description.
1567
+ - `source`: `"extension"`, `"prompt"`, or `"skill"`.
1568
+ - `sourceInfo`: `SourceInfo` object (`{ path, source, scope: "user" | "project" | "temporary", origin: "package" | "top-level", baseDir? }`). There are no top-level `location` or `path` fields.
1569
+ - `hasArgumentCompletions`: present and `true` only on extension commands that implement `getArgumentCompletions`.
1570
+
1571
+ Built-in interactive commands (`/settings`, `/hotkeys`, and similar TUI commands) are omitted because they do not run through RPC `prompt`.
1572
+
1573
+ #### get_command_completions
1574
+
1575
+ Evaluate live argument completions for an extension command that reported `hasArgumentCompletions: true`.
1576
+
1577
+ ```json
1578
+ {"type": "get_command_completions", "commandName": "session-name", "argumentPrefix": "feat"}
1579
+ ```
1158
1580
 
1159
- **Note**: Built-in TUI commands (`/settings`, `/hotkeys`, etc.) are not included. They are handled only in interactive mode and would not execute if sent via `prompt`.
1581
+ Response:
1582
+
1583
+ ```json
1584
+ {
1585
+ "type": "response",
1586
+ "command": "get_command_completions",
1587
+ "success": true,
1588
+ "data": {
1589
+ "completions": [
1590
+ {"value": "feature-auth", "label": "feature-auth", "description": "Auth work"}
1591
+ ]
1592
+ }
1593
+ }
1594
+ ```
1595
+
1596
+ Returns `{"completions": null}` when the command does not exist or does not provide argument completions.
1160
1597
 
1161
1598
  ## Events
1162
1599
 
1163
- Events are streamed to stdout as JSON lines. Most events do not include an `id`; `bash_execution_update` is the deliberate exception and uses the originating bash request ID.
1600
+ Events stream to stdout as JSON lines. Most events carry no `id`; `bash_execution_update` is the exception and carries the originating shell command's `id`.
1164
1601
 
1165
1602
  ### Event types
1166
1603
 
1167
1604
  | Event | Description |
1168
- |-------|-------------|
1169
- | `agent_start` | Agent begins processing |
1170
- | `agent_end` | Agent completes (includes all generated messages) |
1171
- | `turn_start` | New turn begins |
1172
- | `turn_end` | Turn completes (includes assistant message and tool results) |
1605
+ | --- | --- |
1606
+ | `agent_start` | Agent attempt begins (carries optional `turnStartedAt`) |
1607
+ | `agent_end` | One low-level agent loop completed (includes generated `messages` and optional `retryPending: true`) |
1608
+ | `agent_settled` | No automatic session work remains (`{ aborted: boolean }`) |
1609
+ | `session_released` | Session was released to idle storage (`{ released: ReleasedAgentSession }`) |
1610
+ | `entry_appended` | A durable `SessionEntry` was appended (`{ entry: SessionEntry }`) |
1611
+ | `session_info_changed` | Session display name changed (`{ name: string \| undefined }`) |
1612
+ | `model_changed` | Active model changed (`{ model, previousModel, source: "set" \| "cycle" \| "restore" \| "fallback" }`) |
1613
+ | `thinking_level_changed` | Active thinking level changed (`{ level }`) |
1614
+ | `turn_start` | New assistant turn begins |
1615
+ | `turn_end` | Turn completes (includes assistant `message` and `toolResults`) |
1173
1616
  | `message_start` | Message begins |
1174
- | `message_update` | Streaming update (text/thinking/toolcall deltas) |
1175
- | `message_end` | Message completes |
1176
- | `tool_execution_start` | Tool begins execution; includes `toolCallId`, `toolName`, and initial arguments |
1177
- | `tool_execution_update` | Tool execution progress (streaming output) |
1178
- | `tool_execution_end` | Tool completes |
1179
- | `bash_execution_update` | Correlated direct-bash stdout/stderr delta |
1180
- | `queue_update` | Pending steering/follow-up queue changed |
1617
+ | `message_update` | Streaming delta (text, thinking, or tool call) plus cumulative `usage` |
1618
+ | `message_end` | Message completes (carries `entryId` and `seq` when persisted) |
1619
+ | `tool_execution_start` | Tool starts running (`toolCallId`, `toolName`, `args`) |
1620
+ | `tool_execution_update` | Tool streams partial result (`partialResult`) |
1621
+ | `tool_execution_end` | Tool completes (`result`, `isError`, optional `durationMs`) |
1622
+ | `bash_execution_update` | Correlated `bash` / `user_bash` stdout or stderr delta |
1623
+ | `queue_update` | Pending steering and follow-up queues changed |
1181
1624
  | `compaction_start` | Compaction begins |
1182
- | `compaction_end` | Compaction completes, fails, or is cancelled |
1183
- | `compaction_usage` | The compactor model's request returned usage |
1184
- | `child_session_usage` | One model call of a child session, such as a subagent, returned usage |
1185
- | `auto_retry_start` | Auto-retry begins (after transient error) |
1186
- | `auto_retry_end` | Auto-retry completes (success or final failure) |
1187
- | `summarization_retry_scheduled` | Retry scheduled for a transient branch-summary provider error |
1188
- | `summarization_retry_attempt_start` | Retried summarization request starts |
1189
- | `summarization_retry_finished` | Summarization retry loop completes |
1190
- | `extension_error` | Extension threw an error |
1191
- | `shutdown_error` | Disposing the session failed during shutdown; the process exits next |
1192
- | `blueprint_build_waiting` | A resume waits for another Atomic process's blueprint build of the same worktree; `message` says which. Sent once per wait, and may come before the first response |
1193
- | `blueprint_build_finished` | The blueprint build of a resumed session's restored worktree ended; `notices` lists its warnings, empty when it finished cleanly |
1625
+ | `compaction_end` | Compaction completed, failed, or aborted |
1626
+ | `compaction_usage` | Compactor model request returned token usage |
1627
+ | `child_session_usage` | Child session (such as a subagent) completed one model call |
1628
+ | `agent_continue_error` | Post-compaction continuation failed to start (`{ source: "post_compaction", errorMessage }`) |
1629
+ | `auto_retry_start` | Automatic retry scheduled after a transient provider error |
1630
+ | `auto_retry_end` | Automatic retry loop completed or exhausted |
1631
+ | `model_fallback_start` | Fallback switch scheduled (`from`, `to`, optional thinking levels, `reason`, `attempt`) |
1632
+ | `model_fallback_end` | Fallback loop succeeded or exhausted (`success`, optional `from`, `to`, `finalError`) |
1633
+ | `summarization_retry_scheduled` | Branch-summary retry scheduled |
1634
+ | `summarization_retry_attempt_start` | Retried branch-summary request starts |
1635
+ | `summarization_retry_finished` | Branch-summary retry loop completed |
1636
+ | `task_cleanup_quarantined` | Background task cleanup failed and was quarantined (`taskId`, `resources`) |
1637
+ | `worktree_snapshot_unavailable` | Worktree snapshot could not be captured (`reason`) |
1638
+ | `extension_error` | Extension threw an error or failed to load |
1639
+ | `shutdown_error` | Session disposal failed during shutdown (last line before exit) |
1640
+ | `blueprint_build_waiting` | Resume is waiting on another process's blueprint build of the same worktree (may arrive before the first response) |
1641
+ | `blueprint_build_finished` | Background blueprint build for a resumed worktree finished (`notices` lists warnings) |
1194
1642
 
1195
1643
  ### agent_start
1196
1644
 
1197
- Emitted when the agent begins an attempt. `turnStartedAt` identifies when the turn's first request began, even if this attempt is a retry.
1645
+ Emitted when the agent begins an attempt. `turnStartedAt` records when the turn's first request began and stays unchanged across retries.
1198
1646
 
1199
1647
  ```json
1200
1648
  {"type": "agent_start", "turnStartedAt": 1760000000000}
1201
1649
  ```
1202
1650
 
1203
- ### agent_end
1651
+ ### agent_end and agent_settled
1204
1652
 
1205
- Emitted when one agent run completes. Contains all messages generated during that run. If `retryPending` is `true`, the session is still handling a retry or fallback; `abort_retry` cancels it even before the next attempt is announced.
1653
+ `agent_end` fires when one agent loop finishes and carries all messages generated during that loop. If `retryPending` is `true`, a retry or fallback is pending and can be stopped with `abort_retry`.
1206
1654
 
1207
1655
  ```json
1208
- {
1209
- "type": "agent_end",
1210
- "messages": [...]
1211
- }
1656
+ {"type": "agent_end", "messages": []}
1657
+ ```
1658
+
1659
+ `agent_settled` fires once no automatic retries, compaction continuations, or queued turns remain:
1660
+
1661
+ ```json
1662
+ {"type": "agent_settled", "aborted": false}
1212
1663
  ```
1213
1664
 
1665
+ ### Session metadata and fallback events
1666
+
1667
+ - `session_info_changed`: `{"type": "session_info_changed", "name": "my-feature-work"}` (`name` is omitted when cleared).
1668
+ - `model_changed`: `{"type": "model_changed", "model": {}, "previousModel": {}, "source": "set"}` (`source` is `"set"`, `"cycle"`, `"restore"`, or `"fallback"`).
1669
+ - `thinking_level_changed`: `{"type": "thinking_level_changed", "level": "high"}`.
1670
+ - `entry_appended`: `{"type": "entry_appended", "entry": {}}`.
1671
+ - `session_released`: `{"type": "session_released", "released": {}}`.
1672
+ - `agent_continue_error`: `{"type": "agent_continue_error", "source": "post_compaction", "errorMessage": "..."}`.
1673
+ - `model_fallback_start` / `model_fallback_end`: bracket automatic model fallback switches across configured `fallbackModels`.
1674
+ - `task_cleanup_quarantined`: reports background task resources that failed cleanup (`taskId`, `resources`).
1675
+ - `worktree_snapshot_unavailable`: reports why a worktree snapshot could not be recorded (`reason`).
1676
+
1214
1677
  ### turn_start / turn_end
1215
1678
 
1216
- A turn consists of one assistant response plus any resulting tool calls and results.
1679
+ A turn covers one assistant response and any tool calls and tool results it produces.
1217
1680
 
1218
1681
  ```json
1219
1682
  {"type": "turn_start"}
1220
1683
  ```
1221
1684
 
1222
1685
  ```json
1223
- {
1224
- "type": "turn_end",
1225
- "message": {...},
1226
- "toolResults": [...]
1227
- }
1686
+ {"type": "turn_end", "message": {}, "toolResults": []}
1228
1687
  ```
1229
1688
 
1230
1689
  ### message_start / message_end
1231
1690
 
1232
- Emitted when a message begins and completes. The `message` field contains an `AgentMessage`.
1691
+ Emitted when a message begins and completes. `message` is an `AgentMessage`.
1233
1692
 
1234
1693
  ```json
1235
- {"type": "message_start", "message": {...}}
1236
- {"type": "message_end", "message": {...}, "entryId": "a1b2c3d4", "seq": 42}
1694
+ {"type": "message_start", "message": {}}
1695
+ {"type": "message_end", "message": {}, "entryId": "a1b2c3d4", "seq": 42}
1237
1696
  ```
1238
1697
 
1239
- When the session saved the message before ending it, `message_end` also carries the saved entry's `entryId` and its
1240
- sequence `seq` in the session's history. Both are absent for a message the session did not save.
1698
+ When the session saved the message, `message_end` also includes `entryId` and its history sequence `seq`. Both are omitted for unsaved messages.
1241
1699
 
1242
1700
  ### message_update (streaming)
1243
1701
 
1244
- Emitted during streaming of assistant messages. Carries the streaming delta plus the latest cumulative usage.
1702
+ Emitted during assistant message streaming with the delta and cumulative usage.
1245
1703
 
1246
- `message_update` has no cumulative `message`, and `assistantMessageEvent` has no `partial`. Build your message from `message_start` and deltas, then use `message_end` as the final authoritative message.
1704
+ On the wire, `message_update` omits the top-level `message` snapshot and strips `assistantMessageEvent.partial`. Build incremental state from `message_start` plus deltas, then replace with the authoritative message from `message_end`.
1247
1705
 
1248
- The top-level `usage` field carries the latest cumulative provider-reported usage; it may remain zero until completion when a provider does not report usage during streaming. When the provider reports an explicit end-of-turn signal (`AssistantMessage.endTurn` from `@bastani/atomic-ai`, for example OpenAI Codex `end_turn`), the update carries it as a top-level `endTurn` boolean, present only when the provider reported one.
1706
+ Top-level `usage` holds the latest cumulative provider-reported token counts (which may stay zero until completion for providers that report usage only at the end). Top-level `endTurn` is present only when the provider reported an explicit end-of-turn flag (`AssistantMessage.endTurn`, such as OpenAI Codex `end_turn`).
1249
1707
 
1250
1708
  ```json
1251
1709
  {
@@ -1266,10 +1724,10 @@ The top-level `usage` field carries the latest cumulative provider-reported usag
1266
1724
  }
1267
1725
  ```
1268
1726
 
1269
- The `assistantMessageEvent` field contains one of these delta types:
1727
+ `assistantMessageEvent` delta types:
1270
1728
 
1271
1729
  | Type | Description |
1272
- |------|-------------|
1730
+ | --- | --- |
1273
1731
  | `start` | Message generation started |
1274
1732
  | `text_start` | Text content block started |
1275
1733
  | `text_delta` | Text content chunk |
@@ -1277,23 +1735,24 @@ The `assistantMessageEvent` field contains one of these delta types:
1277
1735
  | `thinking_start` | Thinking block started |
1278
1736
  | `thinking_delta` | Thinking content chunk |
1279
1737
  | `thinking_end` | Thinking block ended |
1280
- | `toolcall_start` | Tool call started |
1738
+ | `toolcall_start` | Tool call started (includes top-level `id` and `toolName` added on the wire) |
1281
1739
  | `toolcall_delta` | Tool call arguments chunk |
1282
1740
  | `toolcall_end` | Tool call ended (includes full `toolCall` object) |
1283
- | `done` | Message complete (reason: `"stop"`, `"length"`, `"toolUse"`) |
1284
- | `error` | Error occurred (reason: `"aborted"`, `"error"`) |
1741
+ | `done` | Message complete (`reason`: `"stop"`, `"length"`, `"toolUse"`) |
1742
+ | `error` | Error occurred (`reason`: `"aborted"`, `"error"`) |
1285
1743
 
1286
1744
  Example streaming a text response:
1745
+
1287
1746
  ```json
1288
- {"type":"message_update","usage":{...},"assistantMessageEvent":{"type":"text_start","contentIndex":0}}
1289
- {"type":"message_update","usage":{...},"assistantMessageEvent":{"type":"text_delta","contentIndex":0,"delta":"Hello"}}
1290
- {"type":"message_update","usage":{...},"assistantMessageEvent":{"type":"text_delta","contentIndex":0,"delta":" world"}}
1291
- {"type":"message_update","usage":{...},"assistantMessageEvent":{"type":"text_end","contentIndex":0,"content":"Hello world"}}
1747
+ {"type":"message_update","usage":{},"assistantMessageEvent":{"type":"text_start","contentIndex":0}}
1748
+ {"type":"message_update","usage":{},"assistantMessageEvent":{"type":"text_delta","contentIndex":0,"delta":"Hello"}}
1749
+ {"type":"message_update","usage":{},"assistantMessageEvent":{"type":"text_delta","contentIndex":0,"delta":" world"}}
1750
+ {"type":"message_update","usage":{},"assistantMessageEvent":{"type":"text_end","contentIndex":0,"content":"Hello world"}}
1292
1751
  ```
1293
1752
 
1294
1753
  ### tool_execution_start / tool_execution_update / tool_execution_end
1295
1754
 
1296
- Emitted when a tool begins, streams progress, and completes execution.
1755
+ Emitted when a tool begins, streams accumulated partial output, and completes.
1297
1756
 
1298
1757
  ```json
1299
1758
  {
@@ -1304,8 +1763,6 @@ Emitted when a tool begins, streams progress, and completes execution.
1304
1763
  }
1305
1764
  ```
1306
1765
 
1307
- During execution, `tool_execution_update` events stream partial results (e.g., bash output as it arrives):
1308
-
1309
1766
  ```json
1310
1767
  {
1311
1768
  "type": "tool_execution_update",
@@ -1319,8 +1776,6 @@ During execution, `tool_execution_update` events stream partial results (e.g., b
1319
1776
  }
1320
1777
  ```
1321
1778
 
1322
- When complete:
1323
-
1324
1779
  ```json
1325
1780
  {
1326
1781
  "type": "tool_execution_end",
@@ -1328,17 +1783,18 @@ When complete:
1328
1783
  "toolName": "bash",
1329
1784
  "result": {
1330
1785
  "content": [{"type": "text", "text": "total 48\n..."}],
1331
- "details": {...}
1786
+ "details": {}
1332
1787
  },
1333
- "isError": false
1788
+ "isError": false,
1789
+ "durationMs": 42
1334
1790
  }
1335
1791
  ```
1336
1792
 
1337
- Use `toolCallId` to correlate events. The `partialResult` in `tool_execution_update` contains the accumulated output so far (not just the delta), allowing clients to simply replace their display on each update.
1793
+ Correlate events with `toolCallId`. `partialResult` holds the accumulated output so far, so clients can replace their rendered output on each update. Optional `durationMs` on `tool_execution_end` records execution time in milliseconds using a monotonic clock and is omitted when the tool did not execute.
1338
1794
 
1339
1795
  ### bash_execution_update
1340
1796
 
1341
- Emitted only for direct `bash` and non-intercepted `user_bash` RPC execution. Each event is `{type, id?, channel, delta}` where `channel` is `"stdout"` or `"stderr"`; use `id` to keep concurrent streams separate. Tool-call bash continues to use `tool_execution_update` and its `toolCallId`.
1797
+ Emitted only for direct `bash` and non-intercepted `user_bash` RPC commands. Each event carries `{ type, id?, channel, delta }` where `channel` is `"stdout"` or `"stderr"`. Use `id` to separate concurrent commands. Tool-call bash uses `tool_execution_update` instead.
1342
1798
 
1343
1799
  ### queue_update
1344
1800
 
@@ -1354,20 +1810,18 @@ Emitted whenever the pending steering or follow-up queue changes.
1354
1810
 
1355
1811
  ### compaction_start / compaction_end
1356
1812
 
1357
- Emitted when compaction runs, whether manual or automatic. The result describes the boundary: whether the context was cleared or compacted, and where the earlier conversation is in session history.
1813
+ Emitted when manual or automatic compaction starts and finishes. `reason` is `"manual"`, `"threshold"`, or `"overflow"`.
1358
1814
 
1359
1815
  ```json
1360
1816
  {"type": "compaction_start", "reason": "threshold"}
1361
1817
  ```
1362
1818
 
1363
- The `reason` field is `"manual"`, `"threshold"`, or `"overflow"`.
1364
-
1365
1819
  ```json
1366
1820
  {
1367
1821
  "type": "compaction_end",
1368
1822
  "reason": "threshold",
1369
1823
  "result": {
1370
- "compactedText": "Context compacted. Your earlier conversation (150,000 tokens) was replaced by the compacted text below, produced by morph/morph-compactor. …",
1824
+ "compactedText": "Context compacted. Your earlier conversation (150,000 tokens) was replaced by the compacted text below, produced by morph/morph-compactor. ...",
1371
1825
  "firstKeptEntryId": null,
1372
1826
  "tokensBefore": 150000,
1373
1827
  "promptVersion": 7,
@@ -1391,23 +1845,11 @@ The `reason` field is `"manual"`, `"threshold"`, or `"overflow"`.
1391
1845
  }
1392
1846
  ```
1393
1847
 
1394
- A compactor failure is not a compaction failure: the context is cleared instead, and `result.form` is `"cleared"` with `result.fallbackReason` naming the cause.
1395
-
1396
- If `reason` was `"overflow"` and compaction succeeds, `willRetry` is `true` and the agent will automatically retry the prompt. Public prompt/RPC callers wait for that post-compaction continuation before the prompt is considered complete.
1397
-
1398
- If compaction was aborted, `result` is `null` and `aborted` is `true`.
1399
-
1400
- If compaction failed (for example, the boundary could not be saved), `result` is `null`, `aborted` is `false`, and `errorMessage` contains the error description.
1401
-
1402
- `result` and `errorMessage` are independent. A mid-turn post-tool compaction can commit a boundary and *then* fail the provider hard-input-limit gate, so one `compaction_end` may carry both a non-null `result` and an `errorMessage`. Treat the result as a committed durable boundary in that case; the error describes the follow-up request that was not sent.
1403
-
1404
- If overflow recovery exhausts its one compact-and-retry attempt, `compaction_end` includes `"unresolvedOverflow": true` and an `errorMessage`.
1405
-
1406
- There is no `context_compact` command; Atomic reports it as an unknown command. Use `compact`.
1848
+ If a compactor model fails, Atomic clears the context instead (`result.form: "cleared"` with `result.fallbackReason`). If `reason` is `"overflow"` and compaction succeeds, `willRetry` is `true` and Atomic automatically retries the prompt. If aborted, `result` is `null` and `aborted` is `true`. Check `result` and `errorMessage` independently because a mid-turn compaction can commit a durable boundary before a follow-up request exceeds the provider's hard input limit. Exhausted overflow recovery sets `"unresolvedOverflow": true` alongside `errorMessage`.
1407
1849
 
1408
1850
  ### compaction_usage
1409
1851
 
1410
- Emitted once when a compaction run's compactor request returns usage, including a run that later fails or is cancelled. A clear makes no model call and emits none. `compaction_end.result.usage` holds the same usage for a successful run; do not add both.
1852
+ Emitted once when a compactor model request returns usage, even if the run later fails or cancels. Clearing context emits no `compaction_usage`. For a successful run, `compaction_end.result.usage` reports the same usage; do not double-count both.
1411
1853
 
1412
1854
  ```json
1413
1855
  {"type": "compaction_usage", "reason": "threshold", "usage": {"input": 5000, "output": 20, "cacheRead": 0, "cacheWrite": 0, "totalTokens": 5020, "cost": {"input": 0.5, "output": 0, "cacheRead": 0, "cacheWrite": 0, "total": 0.5}}}
@@ -1415,7 +1857,7 @@ Emitted once when a compaction run's compactor request returns usage, including
1415
1857
 
1416
1858
  ### child_session_usage
1417
1859
 
1418
- Emitted on a session once for every model call of a child session it created, such as an in-process subagent, and of that child's own children: assistant responses, compactor requests and cache warming. `usage` is that one call's usage.
1860
+ Emitted once per model call executed by a child session (such as a subagent or nested subagent): assistant turns, compactor requests, and cache warming.
1419
1861
 
1420
1862
  ```json
1421
1863
  {"type": "child_session_usage", "usage": {"input": 10, "output": 0, "cacheRead": 0, "cacheWrite": 0, "totalTokens": 10, "cost": {"input": 2, "output": 0, "cacheRead": 0, "cacheWrite": 0, "total": 2}}}
@@ -1423,7 +1865,7 @@ Emitted on a session once for every model call of a child session it created, su
1423
1865
 
1424
1866
  ### auto_retry_start / auto_retry_end
1425
1867
 
1426
- Emitted when automatic retry is triggered after a transient error (overloaded, rate limit, 5xx).
1868
+ Emitted when automatic retry runs after a transient error (overloaded, rate limit, 5xx).
1427
1869
 
1428
1870
  ```json
1429
1871
  {
@@ -1436,53 +1878,34 @@ Emitted when automatic retry is triggered after a transient error (overloaded, r
1436
1878
  ```
1437
1879
 
1438
1880
  ```json
1439
- {
1440
- "type": "auto_retry_end",
1441
- "success": true,
1442
- "attempt": 2
1443
- }
1881
+ {"type": "auto_retry_end", "success": true, "attempt": 2}
1444
1882
  ```
1445
1883
 
1446
- On final failure (max retries exceeded):
1884
+ On exhausted retries:
1885
+
1447
1886
  ```json
1448
- {
1449
- "type": "auto_retry_end",
1450
- "success": false,
1451
- "attempt": 3,
1452
- "finalError": "529 overloaded_error: Overloaded"
1453
- }
1887
+ {"type": "auto_retry_end", "success": false, "attempt": 3, "finalError": "529 overloaded_error: Overloaded"}
1454
1888
  ```
1455
1889
 
1456
1890
  ### summarization_retry_scheduled / summarization_retry_attempt_start / summarization_retry_finished
1457
1891
 
1458
- Emitted when branch summarization retries after a transient provider error. These events use the same retry settings as automatic assistant-turn retries. Compaction makes no retried model request: a compactor failure clears the context instead.
1892
+ Emitted when branch summarization retries after a transient provider error. Compaction never retries its compactor call and clears context instead.
1459
1893
 
1460
1894
  ```json
1461
- {
1462
- "type": "summarization_retry_scheduled",
1463
- "attempt": 1,
1464
- "maxAttempts": 3,
1465
- "delayMs": 2000,
1466
- "errorMessage": "terminated"
1467
- }
1895
+ {"type": "summarization_retry_scheduled", "attempt": 1, "maxAttempts": 3, "delayMs": 2000, "errorMessage": "terminated"}
1468
1896
  ```
1469
1897
 
1470
1898
  ```json
1471
- {
1472
- "type": "summarization_retry_attempt_start",
1473
- "source": "branchSummary"
1474
- }
1899
+ {"type": "summarization_retry_attempt_start", "source": "branchSummary"}
1475
1900
  ```
1476
1901
 
1477
- The loop then emits:
1478
-
1479
1902
  ```json
1480
1903
  {"type": "summarization_retry_finished"}
1481
1904
  ```
1482
1905
 
1483
1906
  ### extension_error
1484
1907
 
1485
- Emitted when an extension throws an error. An extension that fails to load is reported with `"event": "startup"` after startup and with `"event": "reload"` after a [`reload`](#reload) command.
1908
+ Emitted when an extension throws an error or fails to load (`"event": "startup"` on initial startup, `"event": "reload"` during [`reload`](#reload)).
1486
1909
 
1487
1910
  ```json
1488
1911
  {
@@ -1495,7 +1918,7 @@ Emitted when an extension throws an error. An extension that fails to load is re
1495
1918
 
1496
1919
  ### shutdown_error
1497
1920
 
1498
- The last line an RPC process writes when disposing its session failed during shutdown. Atomic attempted every cleanup step first. `code` is the failure's code, such as `ShutdownFailed`, when it has one, and `errors` lists the failed cleanup steps when there are several. The process then exits with `exitCode`: `1` after stdin closed or a shutdown request, or the signal's code (`143` for `SIGTERM`, `129` for `SIGHUP`).
1921
+ The final line written when disposing the session failed during shutdown. Atomic attempts every cleanup step first. `code` carries the failure code (such as `"ShutdownFailed"`), and `errors` lists failed cleanup steps when multiple steps failed. The process then exits with `exitCode` (`1` after stdin close or shutdown request, `143` for `SIGTERM`, `129` for `SIGHUP`).
1499
1922
 
1500
1923
  ```json
1501
1924
  {
@@ -1509,7 +1932,7 @@ The last line an RPC process writes when disposing its session failed during shu
1509
1932
 
1510
1933
  ## Error handling
1511
1934
 
1512
- Failed commands return a response with `success: false`:
1935
+ Failed commands return a `response` with `success: false`:
1513
1936
 
1514
1937
  ```json
1515
1938
  {
@@ -1520,7 +1943,7 @@ Failed commands return a response with `success: false`:
1520
1943
  }
1521
1944
  ```
1522
1945
 
1523
- Parse errors:
1946
+ Invalid JSON on stdin returns a parse error response:
1524
1947
 
1525
1948
  ```json
1526
1949
  {
@@ -1531,14 +1954,25 @@ Parse errors:
1531
1954
  }
1532
1955
  ```
1533
1956
 
1957
+ ### Structured error codes (`errorCode` and `errorDetails`)
1958
+
1959
+ Some errors attach typed `errorCode` and `errorDetails` properties that `RpcClient` rehydrates into typed errors:
1960
+
1961
+ | `errorCode` | `errorDetails` shape | When returned |
1962
+ | --- | --- | --- |
1963
+ | `"debug_error"` | `SerializedDebugError` (`name`, `code`, `message`, `hint`, `retryable`, `fields`) | Invalid argument passed to `set_debug`. |
1964
+ | `"missing_session_cwd"` | `SerializedMissingSessionCwdError` (`sessionCwd`, `fallbackCwd`, optional `sessionFile`) | `switch_session` or `import_session` when the recorded `cwd` does not exist and `cwdOverride` was omitted. |
1965
+ | `"credential_synchronization"` | `{ providerId: string, operation: "save" \| "logout" \| "oauth" }` | Credential persistence could not synchronize with the active provider store. |
1966
+
1534
1967
  ## Types
1535
1968
 
1536
1969
  Exported TypeScript definitions:
1537
- - `@bastani/atomic-ai`: `Model`, `UserMessage`, `AssistantMessage`, `ToolResultMessage`.
1970
+
1971
+ - `@bastani/atomic-ai`: `Model`, `UserMessage`, `AssistantMessage`, `ToolResultMessage`, `ImageContent`.
1538
1972
  - `@bastani/atomic-agent-core`: `AgentMessage`, `AgentEvent`.
1539
1973
  - `@bastani/atomic`: augments `AgentMessage` with `BashExecutionMessage`, `CustomMessage`, and `BranchSummaryMessage`, and exports `RpcClient`, `RpcEvent`, and `ModelInfo`.
1540
1974
 
1541
- ### Model
1975
+ ### Model object {#model-type}
1542
1976
 
1543
1977
  ```json
1544
1978
  {
@@ -1560,7 +1994,7 @@ Exported TypeScript definitions:
1560
1994
  }
1561
1995
  ```
1562
1996
 
1563
- `contextWindow` is the model's token budget used by Atomic's local budgeting, footer/stats, and compaction logic.
1997
+ `contextWindow` is the model's token budget used for local token estimates, stats, and compaction.
1564
1998
 
1565
1999
  ### UserMessage
1566
2000
 
@@ -1572,7 +2006,17 @@ Exported TypeScript definitions:
1572
2006
  }
1573
2007
  ```
1574
2008
 
1575
- The `content` field can be a string or an array of `TextContent`/`ImageContent` blocks.
2009
+ `content` is either a string or an array of `TextContent` and `ImageContent` blocks.
2010
+
2011
+ ### ImageContent
2012
+
2013
+ ```json
2014
+ {
2015
+ "type": "image",
2016
+ "data": "base64-encoded-data",
2017
+ "mimeType": "image/png"
2018
+ }
2019
+ ```
1576
2020
 
1577
2021
  ### AssistantMessage
1578
2022
 
@@ -1592,6 +2036,7 @@ The `content` field can be a string or an array of `TextContent`/`ImageContent`
1592
2036
  "output": 50,
1593
2037
  "cacheRead": 0,
1594
2038
  "cacheWrite": 0,
2039
+ "totalTokens": 150,
1595
2040
  "cost": {"input": 0.0003, "output": 0.00075, "cacheRead": 0, "cacheWrite": 0, "total": 0.00105}
1596
2041
  },
1597
2042
  "stopReason": "stop",
@@ -1599,7 +2044,7 @@ The `content` field can be a string or an array of `TextContent`/`ImageContent`
1599
2044
  }
1600
2045
  ```
1601
2046
 
1602
- Stop reasons: `"stop"`, `"length"`, `"toolUse"`, `"error"`, `"aborted"`. A streaming message carries `"pending"` until the terminal event replaces it, so clients switching on `stopReason` should handle `"pending"`; completed messages never carry it. On the wire, `"pending"` appears on `message_start` (`message_update` frames carry no `message` object), and `message_end` carries the terminal reason. A provider that reports an explicit end-of-turn signal (`AssistantMessage.endTurn` from `@bastani/atomic-ai`, for example OpenAI Codex `end_turn`) sets `endTurn: true` on the assistant message, and `message_update` frames echo it as a top-level boolean only when reported.
2047
+ Terminal stop reasons are `"stop"`, `"length"`, `"toolUse"`, `"error"`, and `"aborted"`. On `message_start`, an in-progress assistant message carries `stopReason: "pending"` until `message_end` replaces it with the terminal reason. When a provider sends an explicit end-of-turn flag (`AssistantMessage.endTurn`), `endTurn: true` appears on the message and is echoed at the top level of `message_update`.
1603
2048
 
1604
2049
  ### ToolResultMessage
1605
2050
 
@@ -1616,7 +2061,7 @@ Stop reasons: `"stop"`, `"length"`, `"toolUse"`, `"error"`, `"aborted"`. A strea
1616
2061
 
1617
2062
  ### BashExecutionMessage
1618
2063
 
1619
- Created by the `bash` RPC command (not by LLM tool calls):
2064
+ Created by the direct `bash` and `user_bash` RPC commands (not by model tool calls):
1620
2065
 
1621
2066
  ```json
1622
2067
  {
@@ -1631,17 +2076,30 @@ Created by the `bash` RPC command (not by LLM tool calls):
1631
2076
  }
1632
2077
  ```
1633
2078
 
1634
- ### Attachment
2079
+ ### CustomMessage
2080
+
2081
+ Injected by extensions via `atomic.sendMessage()`:
1635
2082
 
1636
2083
  ```json
1637
2084
  {
1638
- "id": "img1",
1639
- "type": "image",
1640
- "fileName": "photo.jpg",
1641
- "mimeType": "image/jpeg",
1642
- "size": 102400,
1643
- "content": "base64-encoded-data...",
1644
- "extractedText": null,
1645
- "preview": null
2085
+ "role": "custom",
2086
+ "customType": "my-extension",
2087
+ "content": "Deployment check passed.",
2088
+ "display": true,
2089
+ "details": {"status": "ok"},
2090
+ "timestamp": 1733234567890
2091
+ }
2092
+ ```
2093
+
2094
+ ### BranchSummaryMessage
2095
+
2096
+ Inserted when switching branches with `navigate_tree` (`summarize: true`):
2097
+
2098
+ ```json
2099
+ {
2100
+ "role": "branchSummary",
2101
+ "summary": "Explored caching approach before switching back to the main branch.",
2102
+ "fromId": "entry-abc123",
2103
+ "timestamp": 1733234567890
1646
2104
  }
1647
2105
  ```