@bastani/atomic 0.10.9 → 0.10.10-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (406) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/README.md +226 -163
  3. package/dist/_shared/dist-KOELCESV.js +2 -2
  4. package/dist/_shared/fork-row-index-UAUAQRD5.js +2 -2
  5. package/dist/_shared/lib-4PES5P4V.js +2 -2
  6. package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js +27 -12
  7. package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js.map +1 -1
  8. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +47 -7
  9. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js.map +1 -1
  10. package/dist/_shared/mode-shared-2QJSCUM6.js +48 -19
  11. package/dist/_shared/mode-shared-2QJSCUM6.js.map +1 -1
  12. package/dist/_shared/{p1a-prewarm-UQY3X2UK.js → p1a-prewarm-XIU57JHF.js} +5 -5
  13. package/dist/_shared/{p1a-prewarm-UQY3X2UK.js.map → p1a-prewarm-XIU57JHF.js.map} +1 -1
  14. package/dist/_shared/p2-shell-main-B2WIALFD.js +30 -25
  15. package/dist/_shared/p2-shell-main-B2WIALFD.js.map +1 -1
  16. package/dist/_shared/runtime-O4KCSG4C.js +5 -5
  17. package/dist/_shared/{sdk-OSBEPR3Q.js → sdk-RRLVN7ER.js} +15 -9
  18. package/dist/_shared/sdk-RRLVN7ER.js.map +1 -0
  19. package/dist/_shared/session-data-AHTU7IS6.js +2 -2
  20. package/dist/_shared/session-manager-list-2BLEEZVG.js +1 -1
  21. package/dist/_shared/settings-startup-8-DNZ2RIHM.js +4 -1
  22. package/dist/_shared/settings-startup-8-DNZ2RIHM.js.map +1 -1
  23. package/dist/_shared/{startup-0-0-TYUFUOJZ.js → startup-0-0-4VG2G44V.js} +427 -33
  24. package/dist/_shared/startup-0-0-4VG2G44V.js.map +1 -0
  25. package/dist/_shared/{startup-0-1-W2G2UY7R.js → startup-0-1-XTIL65D4.js} +18 -11
  26. package/dist/_shared/startup-0-1-XTIL65D4.js.map +1 -0
  27. package/dist/_shared/{startup-0-2-UXBUEOXW.js → startup-0-2-27OWFHV6.js} +150 -62
  28. package/dist/_shared/startup-0-2-27OWFHV6.js.map +1 -0
  29. package/dist/_shared/startup-0-3-T4DVFYWX.js +15 -25
  30. package/dist/_shared/startup-0-3-T4DVFYWX.js.map +1 -1
  31. package/dist/_shared/{startup-0-4-HN5EB4K7.js → startup-0-4-ZMJV547D.js} +81 -12
  32. package/dist/_shared/startup-0-4-ZMJV547D.js.map +1 -0
  33. package/dist/_shared/startup-0-5-FD2P735I.js +90 -50
  34. package/dist/_shared/startup-0-5-FD2P735I.js.map +1 -1
  35. package/dist/_shared/startup-10-0-TDQNBDDL.js +5 -5
  36. package/dist/_shared/startup-12-0-55AAXBJZ.js +13 -7
  37. package/dist/_shared/startup-12-0-55AAXBJZ.js.map +1 -1
  38. package/dist/_shared/startup-14-0-MLX36RBG.js +4 -4
  39. package/dist/_shared/startup-15-0-YUKGAC63.js +4 -4
  40. package/dist/_shared/startup-15-1-4S7FLMNG.js +88 -28
  41. package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
  42. package/dist/_shared/startup-8-0-34CBHPZH.js +5 -5
  43. package/dist/_shared/startup-8-1-4KANEHRA.js +61 -17
  44. package/dist/_shared/startup-8-1-4KANEHRA.js.map +1 -1
  45. package/dist/_shared/storage-command-7MGXLJGZ.js +4 -4
  46. package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
  47. package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
  48. package/dist/builtin/intercom/CHANGELOG.md +6 -0
  49. package/dist/builtin/intercom/README.md +87 -116
  50. package/dist/builtin/intercom/broker/broker.bundle.mjs +3 -3
  51. package/dist/builtin/intercom/broker/presence-handler.ts +1 -1
  52. package/dist/builtin/intercom/group.ts +7 -3
  53. package/dist/builtin/intercom/index.bundle.mjs +1 -1
  54. package/dist/builtin/intercom/package.json +1 -1
  55. package/dist/builtin/mcp/README.md +61 -27
  56. package/dist/builtin/mcp/index.bundle.mjs +1 -1
  57. package/dist/builtin/mcp/package.json +1 -1
  58. package/dist/builtin/subagents/CHANGELOG.md +8 -0
  59. package/dist/builtin/subagents/README.md +74 -141
  60. package/dist/builtin/subagents/package.json +1 -1
  61. package/dist/builtin/subagents/src/extension/index.bundle.mjs +213 -74
  62. package/dist/builtin/web-access/CHANGELOG.md +9 -0
  63. package/dist/builtin/web-access/README.md +61 -88
  64. package/dist/builtin/web-access/index.bundle.mjs +387 -351
  65. package/dist/builtin/web-access/package.json +1 -1
  66. package/dist/cli/args.js +2 -2
  67. package/dist/cli/auth-cli.code.js +4 -4
  68. package/dist/cli/auth-cli.impl.js +3 -3
  69. package/dist/cli/auth-cli.js +3 -3
  70. package/dist/cli/blueprint-command.code.js +2 -2
  71. package/dist/cli/blueprint-command.impl.js +3 -3
  72. package/dist/cli/blueprint-command.js +3 -3
  73. package/dist/cli/intercom-command.code.js +3 -3
  74. package/dist/cli/intercom-command.impl.js +3 -3
  75. package/dist/cli/intercom-command.js +3 -3
  76. package/dist/cli/list-models.code.js +3 -3
  77. package/dist/cli/list-models.impl.js +3 -3
  78. package/dist/cli/list-models.js +3 -3
  79. package/dist/cli/session-picker.code.js +2 -2
  80. package/dist/cli/session-picker.impl.js +3 -3
  81. package/dist/cli/session-picker.js +3 -3
  82. package/dist/cli/startup-ui.code.js +2 -2
  83. package/dist/cli/startup-ui.impl.js +3 -3
  84. package/dist/cli/startup-ui.js +3 -3
  85. package/dist/cli/storage-command.impl.js +3 -3
  86. package/dist/cli/storage-command.js +3 -3
  87. package/dist/cli/storage-search-session.code.js +2 -2
  88. package/dist/cli/storage-search-session.impl.js +3 -3
  89. package/dist/cli/storage-search-session.js +3 -3
  90. package/dist/cli/team-command.code.js +2 -2
  91. package/dist/cli/team-command.impl.js +3 -3
  92. package/dist/cli/team-command.js +3 -3
  93. package/dist/cli.js +2 -2
  94. package/dist/core/agent-session-methods.d.ts +4 -1
  95. package/dist/core/agent-session-methods.js.map +1 -1
  96. package/dist/core/agent-session.d.ts +3 -0
  97. package/dist/core/compaction/compactor.d.ts +20 -14
  98. package/dist/core/compaction/errors.d.ts +120 -0
  99. package/dist/core/compaction/index.d.ts +1 -0
  100. package/dist/core/compaction/model-resolver.d.ts +2 -2
  101. package/dist/core/debug.impl.js +3 -3
  102. package/dist/core/debug.js +3 -3
  103. package/dist/core/export-html/card-projection.impl.js +3 -3
  104. package/dist/core/export-html/card-projection.js +3 -3
  105. package/dist/core/export-html/index.code.js +2 -2
  106. package/dist/core/export-html/index.impl.js +3 -3
  107. package/dist/core/export-html/index.js +3 -3
  108. package/dist/core/export-html/json-spans.impl.js +3 -3
  109. package/dist/core/export-html/json-spans.js +3 -3
  110. package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
  111. package/dist/core/export-html/oversized-render-inputs.js +3 -3
  112. package/dist/core/export-html/tool-renderer.code.js +1 -1
  113. package/dist/core/export-html/tool-renderer.impl.js +3 -3
  114. package/dist/core/export-html/tool-renderer.js +3 -3
  115. package/dist/core/extensions/api-types.d.ts +1 -1
  116. package/dist/core/extensions/api-types.js.map +1 -1
  117. package/dist/core/extensions/index.d.ts +1 -1
  118. package/dist/core/extensions/jiti-loader.impl.js +3 -3
  119. package/dist/core/extensions/jiti-loader.js +3 -3
  120. package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
  121. package/dist/core/extensions/jiti-static-loader.js +3 -3
  122. package/dist/core/extensions/loader-host-modules.code.js +1 -1
  123. package/dist/core/extensions/loader-host-modules.impl.js +3 -3
  124. package/dist/core/extensions/loader-host-modules.js +3 -3
  125. package/dist/core/extensions/loader-virtual-modules.js +1 -1
  126. package/dist/core/extensions/provider-types.d.ts +18 -6
  127. package/dist/core/extensions/provider-types.js.map +1 -1
  128. package/dist/core/extensions/runner-context.js +1 -1
  129. package/dist/core/intercom-broker-control-host.code.js +1 -1
  130. package/dist/core/intercom-broker-control-host.impl.js +3 -3
  131. package/dist/core/intercom-broker-control-host.js +3 -3
  132. package/dist/core/intercom-broker-control.code.js +3 -3
  133. package/dist/core/intercom-broker-control.impl.js +3 -3
  134. package/dist/core/intercom-broker-control.js +3 -3
  135. package/dist/core/model-config.d.ts +40 -0
  136. package/dist/core/model-registry.js +1 -1
  137. package/dist/core/model-resolver-scope.d.ts +4 -4
  138. package/dist/core/model-runtime.d.ts +1 -1
  139. package/dist/core/package-manager-storage-adapters.impl.js +3 -3
  140. package/dist/core/package-manager-storage-adapters.js +3 -3
  141. package/dist/core/provider-composer-internal.d.ts +11 -2
  142. package/dist/core/sdk.code.js +3 -3
  143. package/dist/core/sdk.impl.js +3 -3
  144. package/dist/core/sdk.js +3 -3
  145. package/dist/core/session-manager-core.js +5 -5
  146. package/dist/core/session-manager-list.impl.js +3 -3
  147. package/dist/core/session-manager-list.js +3 -3
  148. package/dist/core/session-manager.code.js +1 -1
  149. package/dist/core/session-manager.impl.js +3 -3
  150. package/dist/core/session-manager.js +3 -3
  151. package/dist/core/session-storage.impl.js +3 -3
  152. package/dist/core/session-storage.js +3 -3
  153. package/dist/core/settings-manager-basic-accessors.d.ts +6 -2
  154. package/dist/core/storage/index.js +2 -2
  155. package/dist/core/storage/node-sqlite-thread.js +2 -2
  156. package/dist/core/storage/node-sqlite.js +2 -2
  157. package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
  158. package/dist/core/storage/offline-snapshot-file.js +3 -3
  159. package/dist/core/storage/provider.js +2 -2
  160. package/dist/core/storage/selection.js +2 -2
  161. package/dist/core/storage/session/branch-fork-source.code.js +2 -2
  162. package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
  163. package/dist/core/storage/session/branch-fork-source.js +3 -3
  164. package/dist/core/storage/session/card-view.impl.js +3 -3
  165. package/dist/core/storage/session/card-view.js +3 -3
  166. package/dist/core/storage/session/child-reader.code.js +3 -3
  167. package/dist/core/storage/session/child-reader.impl.js +3 -3
  168. package/dist/core/storage/session/child-reader.js +3 -3
  169. package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
  170. package/dist/core/storage/session/chunked-resume-projection.js +3 -3
  171. package/dist/core/storage/session/expanded-child-details.code.js +2 -2
  172. package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
  173. package/dist/core/storage/session/expanded-child-details.js +3 -3
  174. package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
  175. package/dist/core/storage/session/fork-row-bytes.js +3 -3
  176. package/dist/core/storage/session/fork-row-index.impl.js +3 -3
  177. package/dist/core/storage/session/fork-row-index.js +3 -3
  178. package/dist/core/storage/session/fork-staging.code.js +2 -2
  179. package/dist/core/storage/session/fork-staging.impl.js +3 -3
  180. package/dist/core/storage/session/fork-staging.js +3 -3
  181. package/dist/core/storage/session/fork-window.code.js +3 -3
  182. package/dist/core/storage/session/fork-window.impl.js +3 -3
  183. package/dist/core/storage/session/fork-window.js +3 -3
  184. package/dist/core/storage/session/history-pages.impl.js +3 -3
  185. package/dist/core/storage/session/history-pages.js +3 -3
  186. package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
  187. package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
  188. package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
  189. package/dist/core/storage/session/jsonl-session-store.js +3 -3
  190. package/dist/core/storage/session/memory-session-store.impl.js +3 -3
  191. package/dist/core/storage/session/memory-session-store.js +3 -3
  192. package/dist/core/storage/session/pinned-branch-resume.code.js +3 -3
  193. package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
  194. package/dist/core/storage/session/pinned-branch-resume.js +3 -3
  195. package/dist/core/storage/session/released-history-files.code.js +3 -3
  196. package/dist/core/storage/session/released-history-files.impl.js +3 -3
  197. package/dist/core/storage/session/released-history-files.js +3 -3
  198. package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
  199. package/dist/core/storage/session/resident-fork-rows.js +3 -3
  200. package/dist/core/storage/session/session-resume.impl.js +3 -3
  201. package/dist/core/storage/session/session-resume.js +3 -3
  202. package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
  203. package/dist/core/storage/session/snapshot-cut.js +3 -3
  204. package/dist/core/storage/session/snapshot-history.code.js +3 -3
  205. package/dist/core/storage/session/snapshot-history.impl.js +3 -3
  206. package/dist/core/storage/session/snapshot-history.js +3 -3
  207. package/dist/core/storage/session/sql-session-store.code.js +1 -1
  208. package/dist/core/storage/session/sql-session-store.impl.js +3 -3
  209. package/dist/core/storage/session/sql-session-store.js +3 -3
  210. package/dist/core/storage/session/tree-outline.impl.js +3 -3
  211. package/dist/core/storage/session/tree-outline.js +3 -3
  212. package/dist/core/storage/session/tree-presentation.impl.js +3 -3
  213. package/dist/core/storage/session/tree-presentation.js +3 -3
  214. package/dist/core/storage/storage-status.impl.js +3 -3
  215. package/dist/core/storage/storage-status.js +3 -3
  216. package/dist/core/storage/team.impl.js +3 -3
  217. package/dist/core/storage/team.js +3 -3
  218. package/dist/core/structured-output/index.code.js +1 -1
  219. package/dist/core/structured-output/index.impl.js +3 -3
  220. package/dist/core/structured-output/index.js +3 -3
  221. package/dist/core/tasks/task-completion-entry.impl.js +3 -3
  222. package/dist/core/tasks/task-completion-entry.js +3 -3
  223. package/dist/core/tasks/task-file-history.code.js +3 -3
  224. package/dist/core/tasks/task-file-history.impl.js +3 -3
  225. package/dist/core/tasks/task-file-history.js +3 -3
  226. package/dist/core/tasks/task-reference-archive.code.js +4 -4
  227. package/dist/core/tasks/task-reference-archive.js +3 -3
  228. package/dist/core/tasks/task-reference-identity.code.js +1 -1
  229. package/dist/core/tasks/task-reference-identity.js +3 -3
  230. package/dist/core/tasks/task-reference-stream.impl.js +3 -3
  231. package/dist/core/tasks/task-reference-stream.js +3 -3
  232. package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
  233. package/dist/core/tasks/task-unsaved-answer.js +3 -3
  234. package/dist/core/tasks/task-view-source.impl.js +3 -3
  235. package/dist/core/tasks/task-view-source.js +3 -3
  236. package/dist/core/tools/read-url.code.js +2 -2
  237. package/dist/core/tools/read-url.impl.js +3 -3
  238. package/dist/core/tools/read-url.js +3 -3
  239. package/dist/core/worktree-snapshot/blob-store.js +2 -2
  240. package/dist/core/worktree-snapshot/errors.code.js +3 -3
  241. package/dist/core/worktree-snapshot/errors.impl.js +3 -3
  242. package/dist/core/worktree-snapshot/errors.js +3 -3
  243. package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
  244. package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
  245. package/dist/extensions/codemode/execute.code.js +1 -1
  246. package/dist/extensions/codemode/execute.impl.js +3 -3
  247. package/dist/extensions/codemode/execute.js +3 -3
  248. package/dist/extensions/codemode/renderer.code.js +2 -2
  249. package/dist/extensions/codemode/renderer.impl.js +3 -3
  250. package/dist/extensions/codemode/renderer.js +3 -3
  251. package/dist/extensions/mcp/cli.code.js +2 -2
  252. package/dist/extensions/mcp/cli.impl.js +3 -3
  253. package/dist/extensions/mcp/cli.js +3 -3
  254. package/dist/extensions/mcp/cli.lazy.code.js +2 -2
  255. package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
  256. package/dist/extensions/mcp/cli.lazy.js +3 -3
  257. package/dist/extensions/mcp/runtime.code.js +1 -1
  258. package/dist/extensions/mcp/runtime.impl.js +3 -3
  259. package/dist/extensions/mcp/runtime.js +3 -3
  260. package/dist/index-extensions.d.ts +1 -1
  261. package/dist/index.d.ts +8 -1
  262. package/dist/index.js +7 -7
  263. package/dist/main-first-time-setup.code.js +2 -2
  264. package/dist/main-first-time-setup.impl.js +3 -3
  265. package/dist/main-first-time-setup.js +3 -3
  266. package/dist/modes/interactive/components/settings-selector-types.d.ts +1 -0
  267. package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
  268. package/dist/modes/interactive/components/stored-tree-view.code.js +2 -2
  269. package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
  270. package/dist/modes/interactive/components/stored-tree-view.js +3 -3
  271. package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
  272. package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
  273. package/dist/modes/interactive/theme/color-utils.d.ts +5 -5
  274. package/dist/modes/interactive/theme/theme-loading.d.ts +1 -0
  275. package/dist/modes/interactive-engine/engine-prewarm.js +1 -1
  276. package/dist/modes/interactive-engine/remote-model-catalog.d.ts +1 -0
  277. package/dist/modes/print-mode.js +1 -1
  278. package/dist/modes/rpc/rpc-client-api.d.ts +6 -0
  279. package/dist/modes/rpc/rpc-types.d.ts +29 -2
  280. package/dist/package-manager-cli.code.js +5 -5
  281. package/dist/package-manager-cli.impl.js +3 -3
  282. package/dist/package-manager-cli.js +3 -3
  283. package/dist/rpc-entry.js +1 -1
  284. package/dist/startup-files.json +1 -1
  285. package/dist/startup-stages/5.js +1 -1
  286. package/dist/startup-stages/7.js +1 -1
  287. package/dist/startup-stages/8.js +1 -2
  288. package/dist/startup-stages/9.js +2 -1
  289. package/dist/utils/native-module.d.ts +44 -0
  290. package/dist/utils/startup-database-spare.code.js +3 -3
  291. package/dist/utils/startup-database-spare.impl.js +3 -3
  292. package/dist/utils/startup-database-spare.js +3 -3
  293. package/dist/utils/tools-manager.code.js +1 -1
  294. package/dist/utils/tools-manager.impl.js +3 -3
  295. package/dist/utils/tools-manager.js +3 -3
  296. package/docs/background-tasks.md +238 -243
  297. package/docs/build.md +21 -15
  298. package/docs/changelog.mdx +1 -1
  299. package/docs/codemode.md +68 -51
  300. package/docs/compaction/reference.md +65 -26
  301. package/docs/compaction.md +118 -66
  302. package/docs/computer-use.md +179 -146
  303. package/docs/containerization.md +87 -33
  304. package/docs/custom-provider/api-reference.md +152 -13
  305. package/docs/custom-provider/oauth.md +45 -28
  306. package/docs/custom-provider/override.md +14 -7
  307. package/docs/custom-provider/registration.md +77 -67
  308. package/docs/custom-provider/streaming.md +42 -19
  309. package/docs/custom-provider.md +26 -62
  310. package/docs/development.md +81 -42
  311. package/docs/docs.json +54 -38
  312. package/docs/environment-variables.md +92 -64
  313. package/docs/extensions/api-reference.md +326 -735
  314. package/docs/extensions/authoring.md +186 -269
  315. package/docs/extensions/events.md +308 -375
  316. package/docs/extensions/examples.md +122 -74
  317. package/docs/extensions/ui.md +217 -197
  318. package/docs/extensions.md +189 -259
  319. package/docs/getting-started/authentication.md +27 -14
  320. package/docs/getting-started/first-session.md +25 -26
  321. package/docs/getting-started/installation.md +62 -84
  322. package/docs/getting-started/project-instructions.md +39 -14
  323. package/docs/guides/configuration.md +62 -20
  324. package/docs/guides/intercom.md +20 -12
  325. package/docs/guides/non-interactive.md +31 -16
  326. package/docs/guides/orchestration.md +17 -9
  327. package/docs/guides/resume-on-any-machine.md +63 -52
  328. package/docs/guides/subagents.md +26 -14
  329. package/docs/guides/team-setup.md +49 -27
  330. package/docs/guides.md +30 -23
  331. package/docs/herdr.md +22 -17
  332. package/docs/index.md +24 -17
  333. package/docs/intercom/operations.md +90 -66
  334. package/docs/intercom/reference.md +219 -192
  335. package/docs/intercom.md +111 -92
  336. package/docs/json.md +73 -71
  337. package/docs/keybindings.md +74 -48
  338. package/docs/libraries/agent-core.md +52 -9
  339. package/docs/libraries/ai.md +90 -63
  340. package/docs/libraries/codemode.md +31 -8
  341. package/docs/libraries/schema.md +12 -9
  342. package/docs/libraries/storage-libsql.md +92 -0
  343. package/docs/libraries/storage-postgres.md +119 -0
  344. package/docs/libraries/telemetry.md +42 -9
  345. package/docs/libraries/tui.md +74 -94
  346. package/docs/libraries.md +25 -8
  347. package/docs/llama-cpp.md +38 -33
  348. package/docs/mcp-servers.md +140 -88
  349. package/docs/models/reference.md +53 -36
  350. package/docs/models-configuration.md +19 -13
  351. package/docs/models.md +102 -87
  352. package/docs/orchestration/migrating-workflows.md +22 -20
  353. package/docs/orchestration/patterns.md +36 -21
  354. package/docs/orchestration.md +24 -21
  355. package/docs/packages/authoring.md +29 -18
  356. package/docs/packages/reference.md +77 -16
  357. package/docs/packages.md +34 -34
  358. package/docs/programmatic.md +28 -21
  359. package/docs/prompt-templates.md +65 -41
  360. package/docs/providers/reference.md +36 -20
  361. package/docs/providers.md +78 -76
  362. package/docs/quickstart.md +42 -54
  363. package/docs/reference/cli.md +256 -254
  364. package/docs/reference.md +30 -23
  365. package/docs/rpc/examples.md +121 -17
  366. package/docs/rpc/extension-ui.md +86 -63
  367. package/docs/rpc/protocol.md +817 -358
  368. package/docs/rpc.md +78 -152
  369. package/docs/sdk/reference.md +309 -73
  370. package/docs/sdk/storage.md +614 -0
  371. package/docs/sdk/structured-decisions.md +168 -65
  372. package/docs/sdk/web-server.md +80 -46
  373. package/docs/sdk.md +168 -215
  374. package/docs/security.md +117 -44
  375. package/docs/session-format.md +127 -76
  376. package/docs/sessions.md +155 -113
  377. package/docs/settings.md +293 -205
  378. package/docs/shell-aliases.md +15 -6
  379. package/docs/skills/authoring.md +17 -9
  380. package/docs/skills/reference.md +23 -21
  381. package/docs/skills.md +148 -97
  382. package/docs/storage.md +172 -260
  383. package/docs/subagents/authoring.md +148 -15
  384. package/docs/subagents/reference.md +105 -29
  385. package/docs/subagents.md +247 -250
  386. package/docs/terminal-setup.md +97 -69
  387. package/docs/termux.md +51 -85
  388. package/docs/themes/reference.md +51 -37
  389. package/docs/themes.md +52 -55
  390. package/docs/tmux.md +38 -21
  391. package/docs/tools.md +209 -147
  392. package/docs/tui/reference.md +64 -32
  393. package/docs/tui.md +38 -66
  394. package/docs/usage.md +94 -86
  395. package/docs/verification.md +25 -25
  396. package/docs/web-access.md +106 -54
  397. package/docs/windows.md +55 -57
  398. package/docs/worktree-snapshots.md +82 -74
  399. package/examples/sdk/11-sessions.ts +4 -4
  400. package/package.json +8 -8
  401. package/schemas/models.schema.json +58 -7
  402. package/dist/_shared/sdk-OSBEPR3Q.js.map +0 -1
  403. package/dist/_shared/startup-0-0-TYUFUOJZ.js.map +0 -1
  404. package/dist/_shared/startup-0-1-W2G2UY7R.js.map +0 -1
  405. package/dist/_shared/startup-0-2-UXBUEOXW.js.map +0 -1
  406. package/dist/_shared/startup-0-4-HN5EB4K7.js.map +0 -1
@@ -1,57 +1,70 @@
1
1
  ---
2
- title: "Containerization"
3
- description: "Run Atomic or its tools inside Gondolin, Docker, or OpenShell containers."
2
+ title: "Run Atomic in containers"
3
+ sidebarTitle: "Containers"
4
+ description: "Isolate Atomic or its built-in tools using Gondolin micro-VMs, Docker containers, or NVIDIA OpenShell sandboxes."
4
5
  ---
5
6
 
6
- # Containerization
7
+ Atomic runs with all of your local user permissions by default. To restrict which directories it can access and modify, choose one of two isolation models:
7
8
 
8
- Atomic runs with all local permissions by default. To restrict which directories it can write to and what it can access, choose one of two approaches:
9
+ 1. Run the whole `atomic` process inside a container or managed sandbox.
10
+ 2. Run `atomic` on your host and route built-in file and shell tools into a micro-VM.
9
11
 
10
- 1. Run the whole `atomic` process inside an isolated environment.
11
- 2. Run `atomic` on the host and route tool execution into an isolated environment.
12
+ Containerization is the outer boundary, not the only one. Read [Security and project trust](/security) alongside this page to see how project trust gates which project extensions, skills, and settings load before work starts.
12
13
 
13
- Containerization is the outer boundary, not the only one. Read [Security](/security) alongside this page to see how project trust gates which project-scoped extensions, skills, and settings load in the first place.
14
-
15
- ## Choose a pattern
14
+ ## Choose an isolation pattern
16
15
 
17
16
  | Pattern | What is isolated | Best for | Notes |
18
17
  | --- | --- | --- | --- |
19
- | Gondolin extension | Selected file tools, shell execution, and `!` commands | Local micro-VM tool routing while keeping auth on the host | Other tools, including `search`, remain on the host. See [`examples/extensions/gondolin/`](https://github.com/bastani-inc/atomic/tree/main/packages/coding-agent/examples/extensions/gondolin). |
20
- | Plain Docker | Whole `atomic` process in a local container | Simple local isolation | Provider API keys enter the container. |
21
- | OpenShell | Whole `atomic` process in a policy-controlled sandbox | Local or remote managed sandbox | Requires an OpenShell gateway. |
18
+ | Gondolin micro-VM | Selected file tools, `bash`, and `!` commands | Local VM tool routing while keeping credentials on the host | `search` and custom host extensions remain on the host. See [`examples/extensions/gondolin/`](https://github.com/bastani-inc/atomic/tree/main/packages/coding-agent/examples/extensions/gondolin). |
19
+ | Docker | Whole `atomic` process in a local container | Simple local isolation | Provider API keys enter the container. |
20
+ | NVIDIA OpenShell | Whole `atomic` process in a policy-controlled sandbox | Local or remote managed sandboxes with upstream credential injection | Requires an OpenShell gateway. |
22
21
 
23
- Extensions run wherever the `atomic` process runs. If you run host `atomic` with a tool-routing extension, other custom extension tools still run on the host unless they also delegate their operations.
22
+ Extensions run wherever the `atomic` process runs. If you run host `atomic` with a tool-routing extension, other loaded extensions still run on your host unless they also route their work into the VM. To route built-in file tools and `!` commands to a remote machine over SSH instead of a local micro-VM, see `examples/extensions/ssh.ts` in [Extension examples](/extensions/examples#remote-execution-and-sandboxes).
24
23
 
25
- ## Gondolin
24
+ ## Gondolin micro-VM
26
25
 
27
- [Gondolin](https://github.com/earendil-works/gondolin) is a local Linux micro-VM. Use the [Gondolin example extension](https://github.com/bastani-inc/atomic/tree/main/packages/coding-agent/examples/extensions/gondolin) when you want `atomic` on the host with selected file tools and shell execution routed into the VM. This does not isolate the entire session.
26
+ [Gondolin](https://github.com/earendil-works/gondolin) runs a local Linux micro-VM. Use the [Gondolin example extension](https://github.com/bastani-inc/atomic/tree/main/packages/coding-agent/examples/extensions/gondolin) when you want `atomic` on your host with selected file tools and shell execution routed into the VM. This does not isolate the entire session.
28
27
 
29
- Copy the `examples/extensions/gondolin` folder into `~/.atomic/agent/extensions/gondolin` from your installed `@bastani/atomic` package (or download it from the GitHub link above), then install its dependencies:
28
+ Copy `examples/extensions/gondolin` to a directory **outside** `~/.atomic/agent/extensions/` (for example `~/.local/share/atomic-gondolin`) when you want opt-in per-session use with `-e`, then install its dependencies:
30
29
 
31
30
  ```bash
32
- cp -R "$(npm root -g)/@bastani/atomic/examples/extensions/gondolin" ~/.atomic/agent/extensions/gondolin
33
- cd ~/.atomic/agent/extensions/gondolin
31
+ cp -R "$(npm root -g)/@bastani/atomic/examples/extensions/gondolin" ~/.local/share/atomic-gondolin
32
+ cd ~/.local/share/atomic-gondolin
34
33
  npm ci --ignore-scripts
35
34
  ```
36
35
 
37
- Run Atomic from the project you want mounted:
36
+ Launch Atomic with `-e` from the project directory you want mounted inside the VM:
38
37
 
39
38
  ```bash
40
39
  cd /path/to/project
41
- atomic -e ~/.atomic/agent/extensions/gondolin
40
+ atomic -e ~/.local/share/atomic-gondolin
42
41
  ```
43
42
 
44
- The extension mounts your host working directory at `/workspace` in the VM and overrides `read`, `write`, `edit`, `bash`, `find`, and `ls`, along with interactive `!` commands. File changes under `/workspace` write through to the host.
43
+ Do not copy the extension into `~/.atomic/agent/extensions/gondolin` unless you want **every** `atomic` session on your machine to boot a Gondolin VM automatically. Because that directory contains both `index.ts` and `package.json`, placing it inside `~/.atomic/agent/extensions/` causes Atomic to auto-load it globally even without `-e`.
44
+
45
+ ### What the Gondolin extension routes and omits
46
+
47
+ - **Workspace mount:** Mounts your current host working directory at `/workspace` inside the VM. Edits under `/workspace` write through to your host files.
48
+ - **Routed tools and status:** Overrides `read`, `write`, `edit`, `bash`, `find`, and `ls`, plus interactive `!` commands. Registers the `/gondolin` command (prints VM ID, host workspace, guest workspace, and guest shell) and a footer status item (`Gondolin: <id> (/workspace)`).
49
+ - **Environment isolation:** Does not forward host shell environment variables into VM commands, keeping host API keys out of the VM.
50
+ - **Guest shell and tool caveats:** Probes `bash` first inside the guest and falls back to `/bin/sh`. Routed `find` skips `.git` and `node_modules` only and does not apply `.gitignore`. Routed `read` detects images by filename extension (`.png`, `.jpg`, `.jpeg`, `.gif`, `.webp`), and routed `write` writes UTF-8 text.
51
+ - **Unrouted tools:** `search` stays on the host and is not routed into the VM. Run searches inside the guest through `bash` or `!`.
45
52
 
46
- `search` remains a host tool and is not redirected into the VM. For guest-only content searches, run a shell command through the routed `bash` tool or `!`. To expose only the routed built-in tools, launch with `atomic --tools read,write,edit,bash,find,ls -e ~/.atomic/agent/extensions/gondolin`. Other loaded extensions can still supply host tools; use whole-process isolation when host filesystem access must be prevented.
53
+ To expose only the routed built-in tools in a session:
47
54
 
48
- Requirements: npm for installing dependencies, Node.js 23.6.0 or newer for `@earendil-works/gondolin`, and QEMU installed through your system package manager.
55
+ ```bash
56
+ atomic --tools read,write,edit,bash,find,ls -e ~/.local/share/atomic-gondolin
57
+ ```
49
58
 
50
- ## Plain Docker
59
+ `ls` is a built-in tool that is off by default unless listed. Restricting [`--tools`](/reference/cli#tool-options) to this allowlist also disables `intercom`, `subagent`, and other extension tools; MCP tools stay hidden unless a `mcp__*` pattern is listed. Other loaded host extensions can still run code on the host, so use whole-process isolation when host filesystem access must be prevented completely.
51
60
 
52
- Run the whole `atomic` process in Docker for a simple local container boundary.
61
+ **Requirements:** npm to install dependencies, Node.js 23.6.0 or newer for `@earendil-works/gondolin`, and QEMU installed through your system package manager.
53
62
 
54
- `Dockerfile.atomic`:
63
+ ## Docker
64
+
65
+ Run the whole `atomic` process inside Docker for a clean local container boundary.
66
+
67
+ Create `Dockerfile.atomic` using Node.js and npm:
55
68
 
56
69
  ```dockerfile
57
70
  FROM node:24-bookworm-slim
@@ -80,9 +93,11 @@ WORKDIR /workspace
80
93
  ENTRYPOINT ["atomic"]
81
94
  ```
82
95
 
83
- The archive installer unpacks the self-contained payload and needs no JavaScript runtime or package manager. The extra apt packages support Atomic's shell and common coding tasks.
96
+ The archive installer unpacks a self-contained bundle with no JavaScript runtime required. If you adapt this Dockerfile to a smaller base image, make sure `install.sh` has `uname`, `tar` with `gzip`, core file utilities (`mkdir`, `mv`, `chmod`, `ln`, `rm`, `rmdir`), `curl` or `wget`, `sha256sum` (or `shasum` or `openssl`), and `ldd` on non-Alpine Linux. `debian:bookworm-slim` already includes these tools.
84
97
 
85
- Build and run:
98
+ For Alpine Linux (`musl`), `install.sh` detects `/etc/alpine-release` and downloads the musl release archive (`atomic-linux-x64-musl.tar.gz` or `atomic-linux-arm64-musl.tar.gz`). Those archives bundle `libgcc` and `libstdc++`, so stock Alpine needs no extra C++ runtime libraries; install `bash`, `ca-certificates`, `curl`, `git`, and `ripgrep` for the installer and built-in tools. See [Alpine and musl Linux archives](/getting-started/installation#alpine-and-musl-linux-archives).
99
+
100
+ Build and run the container:
86
101
 
87
102
  ```bash
88
103
  docker build -t atomic-sandbox -f Dockerfile.atomic .
@@ -94,11 +109,29 @@ docker run --rm -it \
94
109
  atomic-sandbox
95
110
  ```
96
111
 
97
- `-v "$PWD:/workspace"` mounts your current directory at `/workspace` inside the container, so edits under `/workspace` write directly to your host files.
112
+ `-v "$PWD:/workspace"` mounts your current directory at `/workspace`, so edits under `/workspace` write directly to your host files.
113
+
114
+ ### Persisting settings and sessions in Docker
98
115
 
99
- Mount a named volume on `/root/.atomic` to persist both container-local agent settings (`/root/.atomic/agent`) and default SQLite sessions (`/root/.atomic/workflows/journal.sqlite`). If you mount only `/root/.atomic/agent`, point `--session-store` or `ATOMIC_CODING_AGENT_DIR` inside that volume so sessions persist too. Avoid mounting your host `~/.atomic` or `~/.atomic/agent` unless the container should have access to host credentials and sessions.
116
+ Mount a named volume on `/root/.atomic` (`-v atomic-home:/root/.atomic`) to persist both container-local settings (`/root/.atomic/agent`) and the default SQLite session database (`/root/.atomic/workflows/journal.sqlite`).
100
117
 
101
- ## OpenShell
118
+ If you mount only `/root/.atomic/agent`, setting `ATOMIC_CODING_AGENT_DIR=/root/.atomic/agent` does **not** keep sessions inside that volume. Because `/root/.atomic/agent` matches the default agent directory, Atomic still places `journal.sqlite` outside the volume at `/root/.atomic/workflows/journal.sqlite`.
119
+
120
+ When mounting only `/root/.atomic/agent`, persist sessions with one of these options:
121
+
122
+ - Pass `--session-store /root/.atomic/agent/journal.sqlite`, or set `ATOMIC_STORAGE` or `ATOMIC_SESSIONS_STORAGE` to point inside `/root/.atomic/agent` ([Selecting storage per process](/storage#selecting-storage-per-process)).
123
+ - Set [`ATOMIC_CODING_AGENT_DIR`](/environment-variables) to a non-default subdirectory inside the volume, such as `/root/.atomic/agent/state`, so Atomic stores sessions at `/root/.atomic/agent/state/workflows/journal.sqlite`.
124
+ - Mount `/root/.atomic` instead of only `/root/.atomic/agent`.
125
+
126
+ Do not bind-mount your host `~/.atomic` or `~/.atomic/agent` into a running container. Beyond exposing host credentials, settings, and sessions, OS file locks on `settings.json`, `auth.json`, `trust.json`, and session claims do not coordinate safely across a host path and a container mount of the same directory ([Locks in the agent directory](/storage#locks-in-the-agent-directory)). Give each container its own agent directory and share sessions through a remote database instead ([Sharing storage across hosts](/storage#sharing-storage-across-hosts), [SDK storage](/sdk/storage)).
127
+
128
+ ### Container runtime, network, and CI options
129
+
130
+ - **Memory and cgroup controls.** For npm and Node.js installs, Atomic sizes the Node.js heap automatically to half of the container's cgroup memory limit when that exceeds Node's default; override with `ATOMIC_HEAP_MB` (`0` keeps Node's default). On Linux with a user-owned cgroup v2 hierarchy, Atomic also uses cgroups to contain background shell process trees; set `ATOMIC_TASK_CGROUP=0` if container cgroup policies block it ([Background tasks](/background-tasks#lifetime-retention-and-cleanup), [Environment variables](/environment-variables#diagnostics-and-performance)).
131
+ - **Restricted networks, proxies, and private CAs.** Pass `--offline` or set `ATOMIC_OFFLINE=1` in restricted-egress containers to disable automatic update checks, telemetry, and binary downloads. Configure `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY` (or `httpProxy` in [Network proxy settings](/settings#network-proxy)), point `NODE_EXTRA_CA_CERTS` at private CA bundles ([Environment variables](/environment-variables#tls-certificates)), and set `ATOMIC_ALLOW_PRIVATE_URL_READS=1` only if `read` needs to reach container-local services. For PostgreSQL over an HTTP `CONNECT` proxy, see [Through an HTTP proxy](/storage#through-an-http-proxy).
132
+ - **Unattended and CI containers.** For headless runs without `-it`, use print mode (`-p`), `--mode json`, or `--mode rpc`, and combine `--no-session` (or shared storage) with explicit `--approve` or `--no-approve` trust flags ([Non-interactive usage](/guides/non-interactive)). In CI or multi-container runs, set `ATOMIC_PROFILE=ci` with `ATOMIC_TEAM_*` variables ([Team and CI setup](/guides/team-setup#ci-and-swarms)), and use `.atomic/blueprint.yaml` with `atomic blueprint prebuild` to pre-install project dependencies and warm caches ([Resume on any machine](/guides/resume-on-any-machine#set-the-environment-up-with-a-blueprint)).
133
+
134
+ ## NVIDIA OpenShell
102
135
 
103
136
  Use [NVIDIA OpenShell](https://docs.nvidia.com/openshell/about/overview) for a policy-controlled sandbox with filesystem, process, network, credential, and inference controls. OpenShell runs sandboxes through a local gateway backed by Docker, Podman, or a VM runtime, or through a remote Kubernetes gateway.
104
137
 
@@ -115,7 +148,7 @@ Launch `atomic` inside an OpenShell sandbox:
115
148
  openshell sandbox create --name atomic-sandbox --from atomic -- atomic
116
149
  ```
117
150
 
118
- In this setup, the whole `atomic` process runs inside the sandbox, so built-in tools, `!` commands, and extension tools execute within the OpenShell boundary.
151
+ The whole `atomic` process runs inside the sandbox, so built-in tools, `!` commands, and extension tools execute inside the OpenShell boundary.
119
152
 
120
153
  With a remote gateway, project files are not bind-mounted from the host, so writes in the sandbox do not modify your local checkout. Clone the repository inside the sandbox or transfer files with OpenShell:
121
154
 
@@ -124,4 +157,25 @@ openshell sandbox upload atomic-sandbox ./repo /workspace
124
157
  openshell sandbox download atomic-sandbox /workspace/repo ./repo-out
125
158
  ```
126
159
 
127
- OpenShell providers can keep raw model API keys outside the sandbox. When inference routing is configured, code inside the sandbox calls `https://inference.local` and the gateway injects provider credentials upstream. Configure Atomic with the matching OpenAI-compatible or Anthropic-compatible endpoint to route model traffic through the gateway.
160
+ ### Routing inference through OpenShell
161
+
162
+ OpenShell providers can keep raw model API keys outside the sandbox. When inference routing is enabled, tools inside the sandbox call `https://inference.local` and the OpenShell gateway injects provider credentials upstream.
163
+
164
+ Point Atomic at `https://inference.local` by adding a provider entry to `~/.atomic/agent/models.json` inside the sandbox. For example, to route an OpenAI-compatible gateway endpoint:
165
+
166
+ ```json
167
+ {
168
+ "providers": {
169
+ "openshell": {
170
+ "baseUrl": "https://inference.local/v1",
171
+ "api": "openai-completions",
172
+ "apiKey": "openshell-managed",
173
+ "models": [
174
+ { "id": "your-model-id" }
175
+ ]
176
+ }
177
+ }
178
+ }
179
+ ```
180
+
181
+ Use `"api": "anthropic-messages"` when your OpenShell gateway exposes an Anthropic-compatible endpoint, or override `baseUrl` on a built-in provider entry. See [Custom models](/models) and [Custom providers](/custom-provider) for full `models.json` options.
@@ -1,9 +1,24 @@
1
1
  ---
2
- title: Provider API reference
3
- description: ProviderConfig and ProviderModelConfig TypeScript contracts for atomic.registerProvider().
2
+ title: "Custom provider API reference"
3
+ sidebarTitle: "Custom provider API"
4
+ description: "TypeScript interfaces and methods for registerProvider(), registerProviderAlias(), unregisterProvider(), and model definitions."
4
5
  ---
5
6
 
6
- # Provider API reference
7
+ ## Extension methods
8
+
9
+ Extensions register, alias, and unregister providers through `ExtensionAPI` (including inline `extensionFactories` in SDK hosts; see [SDK extensions](/sdk/reference#extensions)):
10
+
11
+ ```typescript
12
+ interface ExtensionAPI {
13
+ registerProvider(name: string, config: ProviderConfig): Promise<void>;
14
+ registerProvider(provider: Provider): Promise<void>;
15
+ registerProviderAlias(config: ProviderAliasConfig): Promise<void>;
16
+ unregisterProvider(name: string): Promise<void>;
17
+ }
18
+ ```
19
+
20
+ - Calling `registerProvider(name, config)` again for the same `name` merges defined fields over the previous registration (except when setting or replacing `aliasOf`, which resets it).
21
+ - `registerProvider`, `registerProviderAlias`, and `unregisterProvider` take effect immediately when called after initial extension loading without running `/reload`.
7
22
 
8
23
  ## Config reference
9
24
 
@@ -12,13 +27,16 @@ interface ProviderConfig {
12
27
  /** Display name for the provider in UI such as /login. */
13
28
  name?: string;
14
29
 
15
- /** API endpoint URL. Required when defining models. */
30
+ /** Source provider ID to alias (shorthand equivalent of registerProviderAlias). No other config fields may be set alongside aliasOf except name. */
31
+ aliasOf?: string;
32
+
33
+ /** API endpoint URL. Required at provider or model level when defining models (unless overriding a built-in provider). */
16
34
  baseUrl?: string;
17
35
 
18
- /** API key literal or config value ("$ENV_VAR", "${ENV_VAR}", or "!command"). Required when defining models unless oauth is set. */
36
+ /** Optional API key literal or config value ("$ENV_VAR", "${ENV_VAR}", or "!command"). Omitting it lets users authenticate via /login <provider> in auth.json. */
19
37
  apiKey?: string;
20
38
 
21
- /** Default streaming API for chat models. Required at provider or model level when defining models. */
39
+ /** Default API for chat and compactor models. Required at provider level when supplying streamSimple, and at provider or model level when defining chat or compactor models. */
22
40
  api?: Api;
23
41
 
24
42
  /** Custom streaming implementation for non-standard chat APIs. */
@@ -37,10 +55,10 @@ interface ProviderConfig {
37
55
  /** Custom headers sent with every request. Values use the same config-value syntax as apiKey. */
38
56
  headers?: Record<string, string>;
39
57
 
40
- /** When true, sends Authorization: Bearer <apiKey>. */
58
+ /** When true, sends Authorization: Bearer <apiKey>. Fails if no API key resolves. */
41
59
  authHeader?: boolean;
42
60
 
43
- /** Models to register. Replaces all existing chat, image, and classifier models for this provider. */
61
+ /** Models to register. Replaces all existing chat, image, classifier, and compactor models for this provider. */
44
62
  models?: ProviderModelConfig[];
45
63
 
46
64
  /** Refresh this provider's catalog. Returned definitions replace extension-provided models. */
@@ -54,6 +72,7 @@ interface ProviderConfig {
54
72
  login(callbacks: OAuthLoginCallbacks, signal: AbortSignal): Promise<OAuthCredentials>;
55
73
  refreshToken(credentials: OAuthCredentials, signal: AbortSignal): Promise<OAuthCredentials>;
56
74
  getApiKey(credentials: OAuthCredentials): string;
75
+ /** Adjust chat models based on credentials (image, classifier, and compactor models pass through unchanged). */
57
76
  modifyModels?(models: Model<Api>[], credentials: OAuthCredentials): Model<Api>[];
58
77
  };
59
78
  }
@@ -61,7 +80,7 @@ interface ProviderConfig {
61
80
 
62
81
  ## Model definition reference
63
82
 
64
- `ProviderModelConfig` is a discriminated union of chat (`type?: "chat"`), image (`type: "image"`), and classifier (`type: "classifier"`) model definitions:
83
+ `ProviderModelConfig` is a discriminated union of chat (`type?: "chat"`), image (`type: "image"`), classifier (`type: "classifier"`), and compactor (`type: "compactor"`) model definitions:
65
84
 
66
85
  ```typescript
67
86
  interface ProviderModelConfigBase {
@@ -113,7 +132,13 @@ interface ProviderChatModelConfig extends ProviderModelConfigBase {
113
132
  >;
114
133
  contextWindow: number;
115
134
  maxTokens: number;
135
+ /** Best-effort prompt cache lifetimes in seconds for short and long retention tiers. */
136
+ promptCache?: { short?: number; long?: number };
116
137
  samplingParams?: Record<string, unknown>;
138
+ /** Sampling parameter overrides applied per Atomic thinking level on top of samplingParams. */
139
+ samplingParamsByThinkingLevel?: Partial<
140
+ Record<"off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max", Record<string, unknown>>
141
+ >;
117
142
  /** API-specific compatibility overrides (including Atomic's `supportsGrammarTools` alias). */
118
143
  compat?: AtomicProviderCompat;
119
144
  }
@@ -129,24 +154,138 @@ interface ProviderClassifierModelConfig extends ProviderModelConfigBase {
129
154
  type: "classifier";
130
155
  api?: ClassifierApi;
131
156
  contextWindow: number;
157
+ /** Classifier API compatibility overrides (such as System One imageInput and sendImageOptInHeader). */
158
+ compat?: ClassifierCompat;
159
+ }
160
+
161
+ interface ProviderCompactorModelConfig extends ProviderModelConfigBase {
162
+ type: "compactor";
163
+ /** Compactor API identifier. Required at model or provider level unless overriding an existing compactor model. */
164
+ api?: CompactorApi;
165
+ /** Endpoint path appended to `baseUrl` (default `"/compact"`). Set `""` to POST directly to `baseUrl`. */
166
+ endpointPath?: string;
167
+ /** API-specific request-body parameters merged into `{ messages, query, model }`. Omitted by default so the remote API uses its own defaults. */
168
+ compactionParams?: Record<string, unknown>;
169
+ /** Wall-clock request timeout in milliseconds (default `120000`). */
170
+ timeoutMs?: number;
171
+ /** Upper bound on compacted output in estimated tokens (default `32000`; still capped at 50% of automatic trigger budget). */
172
+ maxTokens?: number;
132
173
  }
133
174
 
134
175
  type ProviderModelConfig =
135
176
  | ProviderChatModelConfig
136
177
  | ProviderImageModelConfig
137
- | ProviderClassifierModelConfig;
178
+ | ProviderClassifierModelConfig
179
+ | ProviderCompactorModelConfig;
138
180
  ```
139
181
 
182
+ For how Atomic sends requests to `ProviderCompactorModelConfig` endpoints, see [Compactor request contract](/compaction/reference#compactor-request-contract).
183
+
140
184
  ### Cost and pricing tiers
141
185
 
142
186
  `cost` matches `Model<Api>["cost"]`. Base rates and every tier must specify all four fields (`input`, `output`, `cacheRead`, and `cacheWrite`). When multiple thresholds match `input + cacheRead + cacheWrite`, `calculateCost()` applies the highest matching tier to all four buckets.
143
187
 
144
188
  ### Compatibility and capability flags
145
189
 
146
- For the full list of `compat` fields (`thinkingFormat`, `chatTemplateKwargs`, `chatTemplateArgs`, `thinkingTokenBudgetField`, `vllmPriority`, `cacheControlFormat`, and API-specific options), see [Models Configuration compatibility fields](/models-configuration#compatibility).
190
+ For the complete list of per-API `compat` fields (`thinkingFormat`, `chatTemplateKwargs`, `chatTemplateArgs`, `thinkingTokenBudgetField`, `vllmPriority`, `cacheControlFormat`, `supportsToolSearch`, `supportsAdditionalTools`, `supportsExplicitPromptCacheMode`, `supportsMidConvoEffort`, and more), see [`models.json` field reference](/models-configuration#compatibility).
147
191
 
148
192
  Keep these rules in mind when declaring capabilities on custom providers:
149
193
 
150
- - **Capability flags are enforcement claims, not preferences.** `supportsStrictMode` controls strict JSON-schema tools for OpenAI-compatible APIs; `supportsStrictTools` applies to Anthropic and Bedrock; `supportsOpenAIGrammarTools` (or Atomic's alias `supportsGrammarTools`, where the canonical field wins on conflict) controls OpenAI Lark/regex custom tools. Leave these unset or `false` unless the endpoint actually enforces them. See [Constrained sampling](/extensions/authoring#constrained-sampling).
151
- - **Session affinity headers differ by OpenAI API.** For `openai-responses`, `compat.sessionAffinityFormat: "openai"` sends `session-id` (hyphen) and `x-client-request-id`, `"openai-nosession"` sends only `x-client-request-id`, and `"openrouter"` sends `x-session-id`. For `openai-completions`, `"openai"` sends `session_id` (underscore), `x-client-request-id`, and `x-session-affinity`.
194
+ - **Capability flags are enforcement claims, not preferences.** `supportsStrictMode` controls strict JSON-schema tools for OpenAI-compatible APIs and Amazon Bedrock Converse (`bedrock-converse-stream`); `supportsStrictTools` applies to Anthropic Messages (`anthropic-messages`) only; `supportsOpenAIGrammarTools` (or Atomic's alias `supportsGrammarTools`, where the canonical field wins on conflict) controls OpenAI Lark/regex custom tools. Leave these unset or `false` unless the endpoint actually enforces them. See [Constrained sampling](/extensions/authoring#constrained-sampling).
195
+ - **Session affinity headers differ by OpenAI API.** For `openai-responses`, `compat.sessionAffinityFormat: "openai"` sends `session-id` (with `-`) and `x-client-request-id`, `"openai-nosession"` sends only `x-client-request-id`, and `"openrouter"` sends `x-session-id`. For `openai-completions`, `"openai"` sends `session_id` (with `_`), `x-client-request-id`, and `x-session-affinity`.
152
196
  - **Responses gateway options.** Set `supportsToolSearch: true` only on `openai-responses` providers that support deferred tool loading. `supportsMaxOutputTokens` defaults to `true`; set it to `false` for Responses-compatible gateways that reject `max_output_tokens` with HTTP 400.
197
+
198
+ ## ProviderAliasConfig
199
+
200
+ Passed to `atomic.registerProviderAlias(config)` to create an account alias for an existing provider:
201
+
202
+ ```typescript
203
+ interface ProviderAliasConfig {
204
+ /** Unique alias ID (cannot match an existing built-in, models.json, or non-alias extension provider). */
205
+ id: string;
206
+
207
+ /** Optional display name shown in /login and /model. */
208
+ name?: string;
209
+
210
+ /** Registered source provider ID (cannot be another alias). */
211
+ provider: string;
212
+ }
213
+ ```
214
+
215
+ ## RefreshModelsContext
216
+
217
+ Passed to `refreshModels(context)` on both `ProviderConfig` and native `Provider` registrations:
218
+
219
+ ```typescript
220
+ interface RefreshModelsContext {
221
+ /** Effective configured credential (OAuth tokens are refreshed before network access). */
222
+ credential?: Credential;
223
+
224
+ /** Immutable provider-scoped catalog snapshot read from models-store.json before this refresh. */
225
+ stored?: Readonly<ModelsStoreEntry>;
226
+
227
+ /** Generation-checked catalog publication used by native Provider registrations. */
228
+ publish(publication: ModelsPublication): Promise<boolean>;
229
+
230
+ /** False during offline or cache-only startup restoration. */
231
+ allowNetwork: boolean;
232
+
233
+ /** True when the caller asked to bypass freshness checks and fetch immediately. */
234
+ force?: boolean;
235
+
236
+ /** Cancellation signal (always provided). */
237
+ signal: AbortSignal;
238
+
239
+ /** Effective base URL of the provider, including overrides. */
240
+ baseUrl?: string;
241
+
242
+ /** Persist account metadata alongside a stored OAuth login or saved API key during network refresh. */
243
+ updateCredential?(update: (current: Credential) => Credential | undefined): Promise<void>;
244
+ }
245
+ ```
246
+
247
+ ## Image and classifier handlers
248
+
249
+ Implement these interfaces for `ProviderConfig.images` and `ProviderConfig.classifiers`:
250
+
251
+ ```typescript
252
+ interface ProviderImages {
253
+ generateImages(
254
+ model: ImageModel<ImageApi>,
255
+ context: ImagesContext,
256
+ options?: ImagesOptions
257
+ ): Promise<AssistantImages>;
258
+ }
259
+
260
+ interface ProviderClassifier {
261
+ classify(
262
+ model: ClassifierModel<ClassifierApi>,
263
+ context: ClassifierContext,
264
+ options?: ClassifierOptions
265
+ ): Promise<ClassifierResult>;
266
+ }
267
+ ```
268
+
269
+ ## Native Provider registration
270
+
271
+ For full control over authentication flows, credential-scoped model filtering, and persisted catalog state, pass a native `Provider<TApi>` object from `@bastani/atomic-ai` directly to `atomic.registerProvider(provider)`:
272
+
273
+ ```typescript
274
+ interface Provider<TApi extends Api = Api> {
275
+ readonly id: string;
276
+ readonly name: string;
277
+ readonly baseUrl?: string;
278
+ readonly headers?: ProviderHeaders;
279
+ readonly auth: ProviderAuth;
280
+ getModels(): readonly Model<TApi>[];
281
+ getAllModels?(): readonly AnyModel[];
282
+ refreshModels?(context: RefreshModelsContext): Promise<void>;
283
+ readonly refreshModelsAuth?: "credential" | "configured";
284
+ filterModels?(models: readonly Model<TApi>[], credential: Credential | undefined): readonly Model<TApi>[];
285
+ filterAllModels?(models: readonly AnyModel[], credential: Credential | undefined): readonly AnyModel[];
286
+ stream<T extends TApi>(model: Model<T>, context: TranscriptContext, options?: ApiStreamOptions<T>): AssistantMessageEventStream;
287
+ streamSimple(model: Model<TApi>, context: TranscriptContext, options?: SimpleStreamOptions): AssistantMessageEventStream;
288
+ generateImages?(model: ImageModel<ImageApi>, context: ImagesContext, options?: ImagesOptions): Promise<AssistantImages>;
289
+ classify?(model: ClassifierModel<ClassifierApi>, context: ClassifierContext, options?: ClassifierOptions): Promise<ClassifierResult>;
290
+ }
291
+ ```
@@ -1,10 +1,9 @@
1
1
  ---
2
- title: Provider OAuth
3
- description: OAuth login callbacks, credential storage, rejected logins, and dynamic catalog refresh.
2
+ title: "Add OAuth login to a provider"
3
+ sidebarTitle: "OAuth login"
4
+ description: "Implement OAuth login callbacks, token refresh, rejected-login errors, and dynamic model catalog refresh."
4
5
  ---
5
6
 
6
- # Provider OAuth
7
-
8
7
  ## OAuth support
9
8
 
10
9
  Add OAuth or SSO login integrated with `/login`:
@@ -58,7 +57,7 @@ await atomic.registerProvider("corporate-ai", {
58
57
  return credentials.access;
59
58
  },
60
59
 
61
- // Optional: adjust models based on the user's token
60
+ // Optional: adjust chat models based on the user's token (image, classifier, and compactor models pass through unchanged)
62
61
  modifyModels(models, credentials) {
63
62
  const region = decodeRegionFromToken(credentials.access);
64
63
  return models.map((model) => ({
@@ -70,19 +69,15 @@ await atomic.registerProvider("corporate-ai", {
70
69
  });
71
70
  ```
72
71
 
73
- Users can then sign in with `/login corporate-ai`.
74
-
75
- Atomic serializes OAuth refreshes so concurrent sessions do not overwrite each other's credentials. Atomic never aborts the `signal` passed to `refreshToken` on timeout because the provider may have already rotated the refresh token; a late response still saves, and normal exit waits up to three seconds for it. Do not add a shorter abort timeout to your token refresh call.
76
-
77
- OAuth callbacks run in the engine process in isolated interactive mode. Use the provided callbacks for all prompts and notices instead of reading terminal process state.
78
-
79
- Set `loginLabel` to customize the login dialog title. Set `usesCallbackServer: true` to show a redirect-URL paste field alongside the local callback server.
80
-
81
- For a native `atomic.registerProvider(provider)` registration, set `provider.auth.oauth.usesCallbackServer: true` when your flow races a local callback server against `interaction.prompt({ type: "manual_code", message: "Paste redirect URL:" })`. The built-in Anthropic, OpenAI, OpenAI Codex, and OpenRouter OAuth objects already set this flag; keep it when wrapping them, or set `false` for a replacement flow without a callback server. `atomic.registerProvider(id, config)` reads `config.oauth.usesCallbackServer`.
72
+ Users can then sign in with `/login corporate-ai`. Note that shell [`atomic auth login`](/reference/cli#credential-commands) does not load extensions; use interactive `/login` for extension providers.
82
73
 
83
- Successful login saves credentials before refreshing the model catalog. Logout removes stored credentials without calling `refreshModels`. Pressing Escape or Ctrl+C cancels login cleanly and keeps prior credentials and models unchanged. Later registrations override earlier ones by provider ID.
74
+ Refresh and callback behavior (see also [Token refresh](/providers#token-refresh) and [Credential resolution order](/providers/reference#resolution-order)):
84
75
 
85
- Intentional cancellation (native `AbortError`, an aborted `signal`, nested abort causes, or the legacy exact `Login cancelled` error) stays quiet. Provider denials, timeouts, network errors, malformed responses, token exchange failures, and storage errors remain visible. Catalog-refresh errors appear in `/model` while keeping cached models usable and never roll back a saved login.
76
+ - **Refresh timing and locking.** Atomic refreshes stored OAuth tokens when fewer than **5 minutes** of validity remain and serializes concurrent refreshes across sessions under a credential lock held for up to **2 minutes**. Catalog refreshes wait up to **60 seconds**, while chat requests allow **15 seconds** for pre-request authentication preparation. Atomic never aborts the `signal` passed to `refreshToken` on caller timeout because the provider may have already rotated the refresh token; a late response still saves, and normal exit waits up to **3 seconds** for it. Do not add a shorter abort timeout to your token refresh call.
77
+ - **Callback isolation.** Always use the provided callbacks for user prompts and notices instead of reading stdin or writing directly to stdout or stderr, because login callbacks may run in a separate background process.
78
+ - **Dialog options.** Set `loginLabel` to customize the login dialog title. Set `usesCallbackServer: true` to show a redirect-URL paste field alongside a local callback server.
79
+ - **Two registration forms.** Config-object registration (`atomic.registerProvider(id, config)`) reads `config.oauth.usesCallbackServer`. Native `Provider` registration (`atomic.registerProvider(provider)`) reads `provider.auth.oauth.usesCallbackServer` when racing a local callback server against `interaction.prompt({ type: "manual_code", message: "Paste redirect URL:" })`. The built-in Anthropic, OpenAI, OpenAI Codex, and OpenRouter OAuth objects already set this flag; keep it when wrapping them, or set `false` for a replacement flow without a callback server. See [Native `Provider` registration](/custom-provider/api-reference#native-provider-registration).
80
+ - **Lifecycle and cancellation.** Successful login saves credentials before refreshing the model catalog. Logout removes stored credentials without calling `refreshModels`. Pressing Escape or Ctrl+C cancels login cleanly and keeps prior credentials and models unchanged. Later registrations override earlier ones by provider ID. Intentional cancellation (native `AbortError`, an aborted `signal`, nested abort causes, or the legacy exact `Login cancelled` error) stays quiet, whereas provider denials, timeouts, network errors, malformed responses, token exchange failures, and storage errors remain visible. Catalog-refresh errors appear in `/model` while keeping cached models usable and never roll back a saved login.
86
81
 
87
82
  ## Rejected logins
88
83
 
@@ -118,7 +113,7 @@ Atomic checks whether another session saved a newer login first. If not, the req
118
113
  OAuth refresh failed for corporate-ai: invalid_grant (Refresh token expired). The provider rejected the stored login; run /login corporate-ai to sign in again.
119
114
  ```
120
115
 
121
- The message displays only the provider ID, error code (or `HTTP <status>`), and description. Pass stored tokens as the third argument so Atomic strips any description that leaks a token, contains a URL, or is too long.
116
+ The message displays only the provider ID, error code (or `HTTP <status>`), and description. Pass stored tokens as the third argument so Atomic strips any description that echoes a secret, contains a URL, or exceeds safe length bounds.
122
117
 
123
118
  Atomic also recognizes rejected logins thrown as plain errors or wrapped in `cause` when they match built-in rejection codes (`invalid_grant`, `refresh_token_expired`, `refresh_token_reused`, `refresh_token_invalidated`) or HTTP 401:
124
119
 
@@ -146,35 +141,57 @@ await atomic.registerProvider("corporate-ai", {
146
141
  });
147
142
  ```
148
143
 
149
- Legacy `ProviderConfig.refreshModels(context)` returns mixed-operation `ProviderModelConfig[]` definitions that replace that registration's live models. A native `Provider` registered with `atomic.registerProvider(provider)` calls `await context.publish({ persist, update })` to persist an optional `ModelsStoreEntry` and install provider-owned model state, then returns the latest list from `getModels()` (or `getAllModels()` for mixed-operation providers).
144
+ - **Config-object registration (`registerProvider(id, config)`):** `refreshModels(context)` returns `ProviderModelConfig[]` definitions (chat, image, classifier, or compactor) that replace that registration's live models. When `allowNetwork` is `false` (offline or cache-only startup restore), return cached models to populate initial availability without making network requests.
145
+ - **Native `Provider` registration (`registerProvider(provider)`):** `refreshModels(context)` calls `await context.publish({ persist, update })` to persist an optional `ModelsStoreEntry` in `models-store.json` and install provider-owned state, then exposes the latest models from `getModels()` (or `getAllModels()` for mixed-operation providers).
150
146
 
151
- The existing catalog stays usable while a refresh runs. Each provider's refresh settles independently; if one fails, times out, or sees an aborted `signal`, it keeps its previous list. Pass `persist` to `context.publish()` only when the catalog should persist across sessions in `models-store.json`.
147
+ The existing catalog stays usable while a refresh runs. Each provider's refresh settles independently; if one fails, times out, or sees an aborted `signal`, it keeps its previous list. For all `RefreshModelsContext` fields (`credential`, `stored`, `publish`, `allowNetwork`, `force`, `signal`, `baseUrl`, and `updateCredential`), see [`RefreshModelsContext`](/custom-provider/api-reference#refreshmodelscontext).
152
148
 
153
- ### OAuthLoginCallbacks
149
+ ## OAuthLoginCallbacks
154
150
 
155
- `callbacks` exposes three user-interaction methods:
151
+ `callbacks` exposes the full user-interaction surface for `config.oauth.login()`:
156
152
 
157
153
  ```typescript
158
154
  interface OAuthLoginCallbacks {
159
- // Open URL in browser (for OAuth redirects)
160
- onAuth(params: { url: string }): void;
155
+ /** Open a URL in the browser (for OAuth redirects). */
156
+ onAuth(info: { url: string; instructions?: string }): void;
161
157
 
162
- // Show device code (for device authorization flow)
163
- onDeviceCode(params: {
158
+ /** Show a device code (for device authorization flows). */
159
+ onDeviceCode(info: {
164
160
  userCode: string;
165
161
  verificationUri: string;
166
162
  openBrowserOnConfirm?: boolean; // default true
167
163
  copyCodeOnConfirm?: boolean; // default true
164
+ intervalSeconds?: number;
165
+ expiresInSeconds?: number;
168
166
  }): void;
169
167
 
170
- // Prompt user for input (for manual token entry)
171
- onPrompt(params: { message: string }): Promise<string>;
168
+ /** Prompt the user for input (for manual code or token entry). */
169
+ onPrompt(prompt: {
170
+ message: string;
171
+ placeholder?: string;
172
+ allowEmpty?: boolean;
173
+ }): Promise<string>;
174
+
175
+ /** Report non-blocking status updates during login. */
176
+ onProgress?(message: string): void;
177
+
178
+ /** Read a manually pasted redirect URL or authorization code. */
179
+ onManualCodeInput?(): Promise<string>;
180
+
181
+ /** Let the user pick from a list of options (for example tenant or workspace). */
182
+ onSelect(prompt: {
183
+ message: string;
184
+ options: Array<{ id: string; label: string }>;
185
+ }): Promise<string | undefined>;
186
+
187
+ /** Cancellation signal for the active login attempt. */
188
+ signal?: AbortSignal;
172
189
  }
173
190
  ```
174
191
 
175
192
  In `/login`, pressing Enter (`tui.select.confirm`) opens the device verification URL and copies the code by default. Disable either action with `openBrowserOnConfirm: false` or `copyCodeOnConfirm: false` in `onDeviceCode` or native `AuthEvent` notifications.
176
193
 
177
- ### OAuthCredentials
194
+ ## OAuthCredentials
178
195
 
179
196
  OAuth credentials save to `~/.atomic/agent/auth.json` (Atomic may also read legacy `~/.pi/agent/auth.json`):
180
197
 
@@ -1,11 +1,10 @@
1
1
  ---
2
- title: Override an existing provider
3
- description: Change the base URL or request headers of a built-in provider while keeping its models.
2
+ title: "Override a built-in provider"
3
+ sidebarTitle: "Override provider"
4
+ description: "Change the base URL or request headers of a built-in provider from an extension while keeping its models."
4
5
  ---
5
6
 
6
- # Override an existing provider
7
-
8
- ## Override existing provider
7
+ ## Override a built-in provider {#override-existing-provider}
9
8
 
10
9
  Redirect an existing built-in provider through a proxy or attach custom headers without redefining its models:
11
10
 
@@ -26,9 +25,17 @@ await atomic.registerProvider("openai", {
26
25
  await atomic.registerProvider("google", {
27
26
  baseUrl: "https://ai-gateway.corp.com/google",
28
27
  headers: {
29
- "X-Corp-Auth": "$CORP_AUTH_TOKEN" // resolves from env; omit $ for a literal
28
+ // Supports $ENV_VAR, ${ENV_VAR}, !command, or literal values ($$ for $, $! for leading !)
29
+ "X-Corp-Auth": "$CORP_AUTH_TOKEN"
30
30
  }
31
31
  });
32
32
  ```
33
33
 
34
- When you pass only `baseUrl` or `headers` (with no `models`), Atomic keeps all existing models and authentication for that provider. To register new models or a new provider, see [Register a provider](/custom-provider/registration).
34
+ When you pass only `baseUrl` or `headers` (with no `models`), Atomic keeps all existing models and authentication for that provider. To register new models or a new provider, see [Register a custom provider](/custom-provider/registration).
35
+
36
+ ## How overrides merge and revert
37
+
38
+ - **Header merging.** Extension `headers` merge over `models.json` `headers` and over provider authentication headers (extension values win on key collision). Header values support `$ENV_VAR`, `${ENV_VAR}`, `!command`, `$$`, and `$!`. See [Value resolution](/models/reference#value-resolution).
39
+ - **Incremental re-registration.** Calling `registerProvider("anthropic", { headers })` after `registerProvider("anthropic", { baseUrl })` keeps `baseUrl`, because defined fields merge over the previous registration.
40
+ - **Derived fast variants.** Overriding `baseUrl` on `anthropic`, `openai`, or `xai` preserves derived `-fast` variants as long as you do not supply a custom `streamSimple` or replace `models`. Supplying `streamSimple` suppresses derived `-fast` variants for that API.
41
+ - **Reverting an override.** Call `await atomic.unregisterProvider("anthropic")` to remove the extension override and restore the built-in provider (along with any `models.json` configuration) immediately without running `/reload`.