@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,39 +1,10 @@
1
1
  ---
2
- title: Register a provider
3
- description: Register provider aliases, add or remove custom providers, and choose a streaming API type.
2
+ title: "Register a custom provider"
3
+ sidebarTitle: "Register provider"
4
+ description: "Add custom providers, choose a streaming API, set up multi-account aliases, and unregister providers."
4
5
  ---
5
6
 
6
- # Register a provider
7
-
8
- ## Multiple accounts for one provider
9
-
10
- Use `atomic.registerProviderAlias()` to reuse an existing provider's models, OAuth flows, and transport under separate logins. Register aliases inside the extension factory so they are available at startup:
11
-
12
- ```typescript
13
- import type { ExtensionAPI } from "@bastani/atomic";
14
-
15
- export default async function (atomic: ExtensionAPI) {
16
- for (let account = 1; account <= 7; account++) {
17
- await atomic.registerProviderAlias({
18
- id: `openai-${account}`,
19
- name: `OpenAI account ${account}`,
20
- provider: "openai",
21
- });
22
- }
23
- }
24
- ```
25
-
26
- Run `/login openai-1`, choose **Sign in with ChatGPT**, and select an `openai-1` model in `/model`. Repeat for each alias. The source `openai` uses OpenAI ChatGPT sign-in rather than `openai-codex`.
27
-
28
- Each alias stores and refreshes its own credentials without borrowing the source's stored login or ambient environment keys. Keeping the same alias ID preserves saved credentials. Confirm the intended account in your browser during login; an alias name does not select an account or increase quota.
29
-
30
- Aliases work with OAuth logins and non-empty stored API keys. For ambient-only authentication (such as an AWS profile or environment-based service account), use the original provider or register a full custom provider instead.
31
-
32
- Aliases inherit the source's endpoint, shared headers, models, derived Fast variants, OAuth callbacks, and request handling. Do not hard-code account secrets in source headers; supply per-account credentials through `/login`. Saved messages and callbacks keep the alias ID. Source catalog updates are shared while availability filters run against each alias's credential; aliases do not run separate per-account catalog discovery.
33
-
34
- The source provider must already be registered and cannot be an alias itself. Alias IDs cannot replace an existing provider. Configure endpoints, headers, and `models.json` overrides on the source provider rather than the alias. Call `atomic.unregisterProvider("openai-1")` to remove an alias without deleting its saved credentials.
35
-
36
- ## Register new provider
7
+ ## Register a new provider {#register-new-provider}
37
8
 
38
9
  Specify `models` alongside the provider endpoint and API to register a new provider. For remote model discovery, fetch and register inside an async extension factory so startup waits for the models to load:
39
10
 
@@ -73,7 +44,7 @@ Or register static models directly:
73
44
  ```typescript
74
45
  await atomic.registerProvider("my-llm", {
75
46
  baseUrl: "https://api.my-llm.com/v1",
76
- apiKey: "$MY_LLM_API_KEY", // env var reference; omit $ for a literal value
47
+ apiKey: "$MY_LLM_API_KEY", // supports $ENV_VAR, ${ENV_VAR}, !command, or literal values
77
48
  api: "openai-completions", // streaming API implementation
78
49
  models: [
79
50
  {
@@ -98,37 +69,9 @@ Providing `models` replaces all existing chat, image, and classifier models for
98
69
 
99
70
  Registered providers appear in `/login` like built-in providers: `/login my-llm` prompts for an API key and stores it in `auth.json`, and the selector shows configured status (such as `✓ env: MY_LLM_API_KEY`). Once configured, `/model` lists its models; without credentials, selecting one reports `No API key found for my-llm` with the `/login` hint.
100
71
 
101
- ## Unregister provider
72
+ ### API types
102
73
 
103
- Call `atomic.unregisterProvider(name)` to remove a provider registered with `atomic.registerProvider(name, ...)`:
104
-
105
- ```typescript
106
- await atomic.registerProvider("my-llm", {
107
- baseUrl: "https://api.my-llm.com/v1",
108
- apiKey: "$MY_LLM_API_KEY",
109
- api: "openai-completions",
110
- models: [
111
- {
112
- id: "my-llm-large",
113
- name: "My LLM Large",
114
- reasoning: true,
115
- input: ["text", "image"],
116
- cost: { input: 3.0, output: 15.0, cacheRead: 0.3, cacheWrite: 3.75 },
117
- contextWindow: 200000,
118
- maxTokens: 16384
119
- }
120
- ]
121
- });
122
-
123
- // Remove later without needing /reload
124
- await atomic.unregisterProvider("my-llm");
125
- ```
126
-
127
- Unregistering removes the provider's dynamic models, API key fallback, OAuth registration, and custom stream handlers, restoring any overridden built-in provider behavior. Calls made after initial extension loading take effect immediately without `/reload`.
128
-
129
- ### API Types
130
-
131
- The `api` field selects the built-in streaming implementation:
74
+ The `api` field selects the built-in chat streaming implementation:
132
75
 
133
76
  | API | Use for |
134
77
  | --- | --- |
@@ -141,6 +84,9 @@ The `api` field selects the built-in streaming implementation:
141
84
  | `google-generative-ai` | Google Generative AI API |
142
85
  | `google-vertex` | Google Vertex AI API |
143
86
  | `bedrock-converse-stream` | Amazon Bedrock Converse API |
87
+ | `pi-messages` | Custom gateways speaking the `pi-messages` protocol |
88
+
89
+ Image (`images`) and classifier (`classifiers`) handlers use their own operation-specific `api` keys independent of this chat streaming table.
144
90
 
145
91
  Most OpenAI-compatible servers use `openai-completions`. Configure model-specific thinking controls with `thinkingLevelMap` and endpoint quirks with `compat`:
146
92
 
@@ -174,7 +120,7 @@ models: [{
174
120
 
175
121
  See [Compatibility fields](/models-configuration#compatibility) for every `compat` option (`thinkingFormat`, `cacheControlFormat`, session affinity, and tool flags). Use `mistral-conversations` for native Mistral endpoints; if routing a Mistral-compatible endpoint through `openai-completions`, configure `compat` flags explicitly.
176
122
 
177
- ### Auth Header
123
+ ### Auth header
178
124
 
179
125
  Set `authHeader: true` when an endpoint expects `Authorization: Bearer <key>` using the resolved `apiKey`:
180
126
 
@@ -187,3 +133,67 @@ await atomic.registerProvider("custom-api", {
187
133
  models: []
188
134
  });
189
135
  ```
136
+
137
+ If `authHeader: true` is set and the provider resolves no API key (for example, `$MY_API_KEY` is unset and no key is saved in `auth.json`), requests fail with a missing API key error (`authHeader requires a resolved API key`).
138
+
139
+ ## Multiple accounts for one provider
140
+
141
+ Use `atomic.registerProviderAlias()` to reuse an existing provider's models, OAuth flows, and transport under separate logins. Register aliases inside the extension factory so they are available at startup:
142
+
143
+ ```typescript
144
+ import type { ExtensionAPI } from "@bastani/atomic";
145
+
146
+ export default async function (atomic: ExtensionAPI) {
147
+ for (let account = 1; account <= 7; account++) {
148
+ await atomic.registerProviderAlias({
149
+ id: `openai-${account}`,
150
+ name: `OpenAI account ${account}`,
151
+ provider: "openai",
152
+ });
153
+ }
154
+ }
155
+ ```
156
+
157
+ Run `/login openai-1`, choose **Sign in with ChatGPT**, and select an `openai-1` model in `/model`. Repeat for each alias. The source `openai` uses OpenAI ChatGPT sign-in rather than `openai-codex`.
158
+
159
+ Each alias stores and refreshes its own credentials without borrowing the source's stored login or ambient environment keys. Keeping the same alias ID preserves saved credentials. Confirm the intended account in your browser during login; an alias name does not select an account or increase quota.
160
+
161
+ Aliases work with OAuth logins and non-empty stored API keys. For ambient-only authentication (such as an AWS profile or environment-based service account), use the original provider or register a full custom provider instead.
162
+
163
+ Aliases inherit the source's endpoint, shared headers, models, derived Fast variants, OAuth callbacks, and request handling. Do not hard-code account secrets in source headers; supply per-account credentials through `/login`. Saved messages and callbacks keep the alias ID. Source catalog updates are shared while availability filters run against each alias's credential; aliases do not run separate per-account catalog discovery, except `github-copilot` aliases, which refresh their own account's model list independently.
164
+
165
+ Validation rules for `registerProviderAlias()`:
166
+
167
+ - `id` and `provider` must be distinct, non-empty strings.
168
+ - `id` cannot match any built-in provider, `models.json` provider, or existing non-alias extension provider (throws `Provider alias <id> cannot replace an existing provider.`).
169
+ - `provider` must already be registered and cannot itself be an alias (throws `Provider aliases must refer directly to a source provider, not another alias.`).
170
+ - `registerProviderAlias({ id, name, provider })` is shorthand for `registerProvider(id, { aliasOf: provider, name })`. No other fields (such as `baseUrl` or `headers`) are allowed on an alias; configure endpoints, headers, and `models.json` overrides on the source provider instead.
171
+ - Call `atomic.unregisterProvider("openai-1")` to remove an alias without deleting its saved credentials.
172
+
173
+ ## Unregister a provider {#unregister-provider}
174
+
175
+ Call `atomic.unregisterProvider(name)` to remove a provider registered with `atomic.registerProvider()` or `atomic.registerProviderAlias()`:
176
+
177
+ ```typescript
178
+ await atomic.registerProvider("my-llm", {
179
+ baseUrl: "https://api.my-llm.com/v1",
180
+ apiKey: "$MY_LLM_API_KEY",
181
+ api: "openai-completions",
182
+ models: [
183
+ {
184
+ id: "my-llm-large",
185
+ name: "My LLM Large",
186
+ reasoning: true,
187
+ input: ["text", "image"],
188
+ cost: { input: 3.0, output: 15.0, cacheRead: 0.3, cacheWrite: 3.75 },
189
+ contextWindow: 200000,
190
+ maxTokens: 16384
191
+ }
192
+ ]
193
+ });
194
+
195
+ // Remove later without needing /reload
196
+ await atomic.unregisterProvider("my-llm");
197
+ ```
198
+
199
+ Unregistering removes the provider's dynamic models, API key fallback, OAuth registration, and custom stream handlers, restoring any overridden built-in provider behavior. Calls made after initial extension loading take effect immediately without `/reload`. If the current session is using a model from the unregistered provider, Atomic refreshes the active model immediately. Calling `unregisterProvider()` for a provider that is not registered is a safe no-op.
@@ -1,30 +1,29 @@
1
1
  ---
2
- title: Provider streaming API
3
- description: "Implement a custom streaming API: events, content blocks, tool calls, stop reasons, and usage."
2
+ title: "Implement provider streaming"
3
+ sidebarTitle: "Streaming API"
4
+ description: "Build a custom streamSimple handler with stream events, content blocks, tool calls, stop reasons, and cost calculation."
4
5
  ---
5
6
 
6
- # Provider streaming API
7
-
8
7
  ## Custom streaming API
9
8
 
10
- For providers with non-standard APIs, implement `streamSimple`. Study the existing API implementations before writing your own.
9
+ For providers with non-standard APIs, implement `streamSimple`. Study Atomic's built-in streaming implementations in the [`@bastani/atomic-ai` API source directory](https://github.com/bastani-inc/atomic/tree/main/packages/ai/src/api) before writing your own:
11
10
 
12
- **Reference implementations:**
11
+ - `anthropic-messages.ts`: Anthropic Messages API
12
+ - `mistral-conversations.ts`: Mistral Conversations and Chat streaming
13
+ - `openai-completions.ts`: OpenAI Chat Completions
14
+ - `openai-responses.ts`: OpenAI Responses API
15
+ - `google-generative-ai.ts`: Google Generative AI
16
+ - `bedrock-converse-stream.ts`: Amazon Bedrock Converse API
13
17
 
14
- Atomic uses provider implementations from its installed `@bastani/atomic-ai` dependency. The streaming implementations behind the `api` field live under `node_modules/@bastani/atomic-ai/dist/api/`, including:
15
- - `anthropic-messages.d.ts` / `anthropic-messages.js` - Anthropic Messages API
16
- - `mistral-conversations.d.ts` / `mistral-conversations.js` - Mistral Conversations/Chat streaming
17
- - `openai-completions.d.ts` / `openai-completions.js` - OpenAI Chat Completions
18
- - `openai-responses.d.ts` / `openai-responses.js` - OpenAI Responses API
19
- - `google-generative-ai.d.ts` / `google-generative-ai.js` - Google Generative AI
20
- - `bedrock-converse-stream.d.ts` / `bedrock-converse-stream.js` - Amazon Bedrock Converse API
21
- Per-vendor provider configurations (base URLs, auth, model catalogs) live under `dist/providers/`, for example `anthropic.d.ts` / `anthropic.js` and `mistral.d.ts` / `mistral.js`.
18
+ Built-in provider configurations (base URLs, auth, and model catalogs) live in [`packages/ai/src/providers`](https://github.com/bastani-inc/atomic/tree/main/packages/ai/src/providers). For general library usage, see the [AI library reference](/libraries/ai).
22
19
 
23
- ### Stream Pattern
20
+ ### Stream pattern
24
21
 
25
22
  Return a stream from `createAssistantMessageEventStream()` or construct `AssistantMessageEventStream` directly. A plain `EventStream` subclass does not satisfy the response stream type.
26
23
 
27
- The stream records optional `durationMs` on the final assistant message using a monotonic clock. Set `timestamp` when the request starts. Existing durations stay intact, and messages whose timestamps predate the stream (such as fetched deferred results) remain untimed.
24
+ `AssistantMessageEventStream` populates `output.durationMs` automatically using a monotonic clock when you push a `done` or `error` event. Set `timestamp` when the request starts. Existing durations stay intact, and messages whose timestamps predate the stream (such as fetched deferred results) remain untimed.
25
+
26
+ Note on context types: `@bastani/atomic-ai` types the `context` argument as `TranscriptContext`, while `ProviderConfig.streamSimple` uses the compatible `Context` alias; both pass the normalized message transcript where `getCurrentSystemPrompt(context.messages)` and `getCurrentTools(context.messages)` read the active system prompt and tools.
28
27
 
29
28
  ```typescript
30
29
  import {
@@ -102,6 +101,20 @@ function streamMyProvider(
102
101
  }
103
102
  ```
104
103
 
104
+ Common fields on `options` (`SimpleStreamOptions`):
105
+
106
+ | Option | Purpose |
107
+ | --- | --- |
108
+ | `apiKey`, `headers`, `env` | Resolved request credentials, merged headers, and provider-scoped environment overrides |
109
+ | `signal` | `AbortSignal` for user cancellation or deadlines; forward to `fetch()` |
110
+ | `fetch` | Optional custom `fetch` implementation |
111
+ | `reasoning`, `thinkingBudgets` | Requested thinking level (`off` through `max`) and optional per-level token budgets |
112
+ | `toolChoice` | Provider-neutral tool selection preference |
113
+ | `temperature`, `maxTokens`, `samplingParams` | Generation parameters and custom request-body sampling overrides |
114
+ | `sessionId`, `cacheRetention`, `transport` | Session affinity ID, prompt-cache retention tier, and transport preference |
115
+ | `timeoutMs`, `websocketConnectTimeoutMs`, `streamDeadlineMs`, `retryDeadline` | Request, handshake, idle-stream, and retry timeout bounds |
116
+ | `onPayload`, `onResponse`, `onProviderStreamEvent` | Lifecycle hooks to inspect/modify request payloads, inspect HTTP responses, and observe raw parsed stream events before normalization |
117
+
105
118
  ### Event types
106
119
 
107
120
  Push events with `stream.push()` in this order:
@@ -198,18 +211,28 @@ output.usage.totalTokens =
198
211
  calculateCost(model, output.usage);
199
212
  ```
200
213
 
201
- `calculateCost()` applies one rate set to the whole request. Aggregate input is `usage.input + usage.cacheRead + usage.cacheWrite`; a tier applies only when that total strictly exceeds `inputTokensAbove`, and the highest matching threshold wins. Every tier must define `input`, `output`, `cacheRead`, and `cacheWrite`. Extension-registered models keep these tiers, and `models.json` `modelOverrides` follow the rules in [Request-wide cost tiers](/models/reference#request-wide-cost-tiers).
214
+ `calculateCost(model, output.usage)` mutates `output.usage.cost` in place and returns it. It applies one rate set to the whole request. Aggregate input is `usage.input + usage.cacheRead + usage.cacheWrite`; a tier applies only when that total strictly exceeds `inputTokensAbove`, and the highest matching threshold wins. Every tier must define `input`, `output`, `cacheRead`, and `cacheWrite`. Extension-registered models keep these tiers, and `models.json` `modelOverrides` follow the rules in [Request-wide cost tiers](/models/reference#request-wide-cost-tiers).
202
215
 
203
216
  ### Registration
204
217
 
205
- Register your stream handler with `atomic.registerProvider()`:
218
+ Register your stream handler with `atomic.registerProvider()`. Providing `streamSimple` requires `api` at the provider level and suppresses derived `-fast` variants for that `api`:
206
219
 
207
220
  ```typescript
208
221
  await atomic.registerProvider("my-provider", {
209
222
  baseUrl: "https://api.example.com",
210
223
  apiKey: "$MY_API_KEY",
211
224
  api: "my-custom-api",
212
- models: [],
225
+ models: [
226
+ {
227
+ id: "my-model-1",
228
+ name: "My Model 1",
229
+ reasoning: false,
230
+ input: ["text"],
231
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
232
+ contextWindow: 128000,
233
+ maxTokens: 8192
234
+ }
235
+ ],
213
236
  streamSimple: streamMyProvider
214
237
  });
215
238
  ```
@@ -1,50 +1,35 @@
1
1
  ---
2
- title: "Custom providers"
3
- description: "Implement a provider API or OAuth flow Atomic does not ship."
2
+ title: "Build custom providers"
3
+ sidebarTitle: "Custom providers"
4
+ description: "Register custom model providers, proxies, OAuth login flows, and streaming APIs from an Atomic extension."
4
5
  ---
5
6
 
6
- # Custom providers
7
-
8
- Extensions can register custom model providers with `atomic.registerProvider()`:
7
+ Extensions can register custom model providers with `atomic.registerProvider()`, create multi-account aliases with `atomic.registerProviderAlias()`, and remove overrides with `atomic.unregisterProvider()`:
9
8
 
10
9
  - **Proxies:** Route requests through corporate proxies or API gateways.
11
10
  - **Custom endpoints:** Connect self-hosted or private model deployments.
12
11
  - **OAuth and SSO:** Add custom login flows for enterprise providers.
13
12
  - **Custom APIs:** Implement streaming, image generation, or classification for non-standard APIs.
14
13
 
15
- ## Where to go next
14
+ If you only need to add models for an API Atomic already supports, use [Configure custom models](/models) instead.
16
15
 
17
- Start here for a first working provider extension, then use the focused guides below:
16
+ ## Where to go next
18
17
 
19
- - [Override an existing provider](/custom-provider/override): change `baseUrl` or headers for a built-in provider.
20
- - [Multiple accounts for one provider](/custom-provider/registration#multiple-accounts-for-one-provider): inherit provider behavior with separate logins.
21
- - [Register a provider](/custom-provider/registration): register, unregister, and choose a streaming API type.
22
- - [Provider OAuth](/custom-provider/oauth): login callbacks, credential storage, rejected logins, and dynamic catalog refresh.
23
- - [Provider streaming API](/custom-provider/streaming): stream events, content blocks, tool calls, stop reasons, and cost calculation.
24
- - [Provider API reference](/custom-provider/api-reference): TypeScript interfaces for `ProviderConfig` and `ProviderModelConfig`.
18
+ Start with the quick reference below, then use the focused guides for your scenario:
25
19
 
26
- If you only need to add models for an API Atomic already supports, use [Custom models](/models) instead.
20
+ - [Override a built-in provider](/custom-provider/override): change `baseUrl` or headers for a built-in provider while keeping its models.
21
+ - [Register a custom provider](/custom-provider/registration): add static or dynamically discovered models, choose a streaming API, set up [multi-account aliases](/custom-provider/registration#multiple-accounts-for-one-provider), or unregister providers.
22
+ - [Add OAuth login to a provider](/custom-provider/oauth): implement login callbacks, credential storage, rejected-login handling, and dynamic catalog refresh.
23
+ - [Implement provider streaming](/custom-provider/streaming): build a custom `streamSimple` handler with stream events, tool calls, stop reasons, and cost calculation.
24
+ - [Custom provider API reference](/custom-provider/api-reference): TypeScript interfaces for `ProviderConfig`, `ProviderModelConfig`, `ProviderAliasConfig`, `RefreshModelsContext`, and native `Provider` registrations.
27
25
 
28
26
  ## Example extensions
29
27
 
30
- See these complete provider examples:
28
+ See these complete provider examples in the repository:
31
29
 
32
30
  - [`examples/extensions/custom-provider-anthropic/`](https://github.com/bastani-inc/atomic/tree/main/packages/coding-agent/examples/extensions/custom-provider-anthropic)
33
31
  - [`examples/extensions/custom-provider-gitlab-duo/`](https://github.com/bastani-inc/atomic/tree/main/packages/coding-agent/examples/extensions/custom-provider-gitlab-duo)
34
32
 
35
- ## Contents
36
-
37
- - [Example extensions](#example-extensions)
38
- - [Quick reference](#quick-reference)
39
- - [Override existing provider](/custom-provider/override#override-existing-provider)
40
- - [Register new provider](/custom-provider/registration#register-new-provider)
41
- - [Unregister provider](/custom-provider/registration#unregister-provider)
42
- - [OAuth support](/custom-provider/oauth#oauth-support)
43
- - [Custom streaming API](/custom-provider/streaming#custom-streaming-api)
44
- - [Testing your implementation](#testing-your-implementation)
45
- - [Config reference](/custom-provider/api-reference#config-reference)
46
- - [Model definition reference](/custom-provider/api-reference#model-definition-reference)
47
-
48
33
  ## Quick reference
49
34
 
50
35
  ```typescript
@@ -77,9 +62,18 @@ export default async function (atomic: ExtensionAPI) {
77
62
  }
78
63
  ```
79
64
 
80
- Await provider registration and unregistration. For dynamic model discovery, fetch and register models inside the async extension factory rather than `session_start`. Atomic waits for the factory before startup completes, making the provider available at interactive startup and in `atomic --list-models`.
65
+ ### Registration and merge rules
66
+
67
+ - **Await registration inside the extension factory.** For dynamic model discovery, fetch and register models inside the async extension factory rather than `session_start`. Atomic waits for the factory before startup completes, making the provider available at interactive startup and in `atomic --list-models`.
68
+ - **Two `registerProvider` overloads.** Pass `(id, config)` for config-object registration, or pass a native `Provider` instance from `@bastani/atomic-ai` (`await atomic.registerProvider(provider)`) for full control over auth, filtering, and catalog persistence. See [Custom provider API reference](/custom-provider/api-reference).
69
+ - **Repeated registrations merge defined fields.** Calling `atomic.registerProvider(id, config)` again for the same `id` merges defined fields over the previous registration while keeping `undefined` fields intact, except when registering or replacing an alias (`aliasOf`), which resets the previous registration.
70
+ - **Interaction with `models.json`.** Extension `headers` merge over `models.json` `headers` (extension values win on key collision). `models.json` `modelOverrides` still apply on top of extension-registered chat models.
71
+ - **Partial vs full model registration.** Passing only `baseUrl` or `headers` for an existing provider keeps its built-in models. Supplying `models` replaces that provider's models across chat, image, and classifier operations.
72
+ - **Required fields.** When defining `models`, `baseUrl` is required at provider or model level (unless overriding a built-in provider that already has one), and `api` is required at model level (or provider level for chat models) unless overriding a built-in provider that supplies defaults. When supplying `streamSimple`, `api` is required at provider level. Every model requires `id`, `name`, `input`, and `cost`; chat and classifier models require `contextWindow`; chat models also require `maxTokens` and `reasoning`; image models require `output`.
81
73
 
82
- Passing only `baseUrl` or `headers` for an existing provider keeps its built-in models. Supplying `models` replaces that provider's models across chat, image, and classifier operations. An omitted `type` defaults to `"chat"`; image and classifier entries require explicit `type` discriminants and matching handlers in `images` or `classifiers` keyed by each model's `api`:
74
+ ### Mixed-operation providers
75
+
76
+ An omitted `type` defaults to `"chat"`. Image and classifier entries require explicit `type` discriminants and matching handlers in `images` or `classifiers` keyed by each model's `api`:
83
77
 
84
78
  ```typescript
85
79
  await atomic.registerProvider("media-tools", {
@@ -115,7 +109,7 @@ await atomic.registerProvider("media-tools", {
115
109
  });
116
110
  ```
117
111
 
118
- Model-level `baseUrl` overrides the provider endpoint. Equal model IDs across different operations (chat, image, classifier) stay distinct, including model-specific headers. Every model requires `id`, `name`, `input`, and `cost`; chat and classifier models require `contextWindow`; chat models also require `maxTokens` and `reasoning`; image models require `output`.
112
+ Model-level `baseUrl` overrides the provider endpoint. Equal model IDs across different operations (chat, image, classifier) stay distinct, including model-specific headers.
119
113
 
120
114
  ## Testing your implementation
121
115
 
@@ -134,33 +128,3 @@ Verify your provider and model pairs against these scenarios (filenames are sugg
134
128
  | `image-tool-result.test.ts` | Images returned in tool results |
135
129
  | `total-tokens.test.ts` | Total token calculation |
136
130
  | `cross-provider-handoff.test.ts` | Conversation handoff across providers |
137
-
138
- ## Moved sections
139
-
140
- <a id="override-existing-provider" />
141
- <a id="register-new-provider" />
142
- <a id="unregister-provider" />
143
- <a id="api-types" />
144
- <a id="auth-header" />
145
- <a id="oauth-support" />
146
- <a id="dynamic-model-catalog-refresh" />
147
- <a id="oauthlogincallbacks" />
148
- <a id="oauthcredentials" />
149
- <a id="custom-streaming-api" />
150
- <a id="stream-pattern" />
151
- <a id="event-types" />
152
- <a id="stop-reasons" />
153
- <a id="content-blocks" />
154
- <a id="tool-calls" />
155
- <a id="usage-and-cost" />
156
- <a id="registration" />
157
- <a id="config-reference" />
158
- <a id="model-definition-reference" />
159
-
160
- Detailed sections moved to child pages:
161
-
162
- - [Override an existing provider](/custom-provider/override#override-existing-provider)
163
- - [Register a provider](/custom-provider/registration#register-new-provider): [Unregister provider](/custom-provider/registration#unregister-provider), [API types](/custom-provider/registration#api-types), and [Auth header](/custom-provider/registration#auth-header)
164
- - [Provider OAuth](/custom-provider/oauth#oauth-support): [Dynamic model catalog refresh](/custom-provider/oauth#dynamic-model-catalog-refresh), [OAuthLoginCallbacks](/custom-provider/oauth#oauthlogincallbacks), and [OAuthCredentials](/custom-provider/oauth#oauthcredentials)
165
- - [Provider streaming API](/custom-provider/streaming#custom-streaming-api): [Stream pattern](/custom-provider/streaming#stream-pattern), [Event types](/custom-provider/streaming#event-types), [Stop reasons](/custom-provider/streaming#stop-reasons), [Content blocks](/custom-provider/streaming#content-blocks), [Tool calls](/custom-provider/streaming#tool-calls), [Usage and cost](/custom-provider/streaming#usage-and-cost), and [Registration](/custom-provider/streaming#registration)
166
- - [Provider API reference](/custom-provider/api-reference#config-reference): [Config reference](/custom-provider/api-reference#config-reference) and [Model definition reference](/custom-provider/api-reference#model-definition-reference)
@@ -1,90 +1,94 @@
1
1
  ---
2
- title: "Development"
3
- description: "Debug mode, event-loop stall profiling, PDF diagnostics, and troubleshooting information for Atomic."
2
+ title: "Diagnostics and debugging"
3
+ sidebarTitle: "Diagnostics"
4
+ description: "Enable debug logs, capture UI snapshots, profile event-loop stalls, and collect diagnostics for bug reports."
4
5
  ---
5
6
 
6
- # Development and diagnostics
7
-
8
- For building extensions, custom providers, or SDK integrations, start with [Build with Atomic](/build). To install the CLI, see [Installation](/getting-started/installation).
9
-
10
- <a id="forking--rebranding"></a>
11
-
12
- ## Path resolution
13
-
14
- Atomic supports both package-manager installs and self-contained release archives. Keep an archive's complete directory structure intact so Atomic can resolve its bundled assets and native module.
7
+ Use these tools to inspect failures, diagnose slow startup or UI stalls, and gather bug-report diagnostics. To build extensions, custom providers, or SDK integrations, start with [Build with Atomic](/build). To install the CLI, see [Installation](/getting-started/installation).
15
8
 
16
9
  ## Debugging
17
10
 
18
- Enable debug mode from **Debug mode** in `/settings` (the [`debug` setting](/settings#debug-mode)), by passing `--debug`, or by setting `ATOMIC_DEBUG=1`. The footer displays a `debug` badge while debug mode is active.
11
+ Enable debug mode from **Debug mode** in `/settings` (the global [`debug` setting](/settings#debug-mode)), by passing `--debug`, or by setting `ATOMIC_DEBUG=1` (legacy `PI_DEBUG=1`). The footer displays a `debug` badge while debug mode is active.
19
12
 
20
- When debug mode is on, each diagnostic area appends one JSON line per event to `~/.atomic/agent/atomic-debug.log` in the form `{"at", "pid", "area", "event", "data"}`:
13
+ Only the exact value `"1"` enables debug mode via environment variable (`true` and `yes` are ignored). If `"debug": true` is saved in `~/.atomic/agent/settings.json`, setting `ATOMIC_DEBUG=0` does not turn debug mode off for that run; toggle **Debug mode** in `/settings` or edit `settings.json` instead.
14
+
15
+ When debug mode is active, Atomic appends one JSON line per event to `~/.atomic/agent/atomic-debug.log` in the form `{"at", "pid", "area", "event", "data"}`:
21
16
 
22
17
  | Area | What it records |
23
18
  | --- | --- |
24
19
  | `decision` | A [classifier decision](/settings#decisionmodel) that failed and fell back to the current chat model. |
25
- | `engine` | Interactive engine recovery and detached tool calls dropped after the conversation moved past them (`stale-detached-call`). |
26
- | `storage` | Each [writers' queue degradation](/storage) of a SQLite database, once per reason: its code, reason, adapter, database path, and error code (never the error message). |
20
+ | `engine` | Background session recovery events and late tool results dropped after the conversation moved past them (`stale-detached-call`). |
21
+ | `storage` | Storage fallback and diagnostic events across SQLite [writer queues](/storage), worktree snapshot pools (locks, leases, evictions, seeds, refs), lock releases, compaction backups, resume checkouts and timings, startup progress, and migrations. Writer-queue degradation records its code, reason, adapter, path, and error code; other storage fallback events include redacted error messages and causes. |
27
22
 
28
- Debug logs record IDs, names, counts, and status details, never prompts or conversation text. Common credential formats are replaced with `[redacted]`: bearer tokens, JWTs, GitHub tokens, private key blocks, `sk-...` API keys, and `key: value` or `key=value` pairs whose name is a key, token, secret, or password. Other formats can pass through, so review the log before sharing it. Long fields truncate at 2,000 characters.
23
+ Debug mode logs record IDs, names, counts, and status details, never prompts or conversation text. Common credential formats are replaced with `[redacted]`: bearer tokens, JWTs, GitHub tokens, private key blocks, `sk-...` API keys, credentials embedded in URLs (`https://user:pass@host`), and `key: value` or `key=value` pairs whose name contains a key, token, secret, or password. Other secret formats can pass through, so review the log before sharing it. Individual text fields truncate at 2,000 characters.
29
24
 
30
- The Intercom broker and other child processes started while debug mode is on inherit it, and subagents follow it immediately. Processes already running keep the setting they started with until their next start. If the debug log cannot be written, Atomic prints one warning and keeps running.
25
+ The Intercom broker and other child processes started while debug mode is on inherit it, and subagents follow it right away. Processes already running keep the setting they started with until they restart. If the debug log cannot be written, Atomic prints one warning and keeps running.
31
26
 
32
27
  Extensions and SDK programs can read debug state and append records with the [debug output API](/sdk/reference#debug-output).
33
28
 
34
- ### Debug command
29
+ ### Capture a UI and message snapshot (`/debug`)
30
+
31
+ Run `/debug` (a hidden slash command) or press `Shift+Ctrl+D` anywhere in the TUI (regardless of which element has focus) to append a diagnostic snapshot to `~/.atomic/agent/atomic-debug.log`.
35
32
 
36
- `/debug` (a hidden slash command) appends a snapshot to `~/.atomic/agent/atomic-debug.log` containing:
33
+ Each snapshot appends plain text containing:
37
34
 
38
- - Rendered TUI lines with ANSI codes
39
- - The last messages sent to the model
35
+ - Timestamp, terminal dimensions (`columns x rows`), and total rendered line count
36
+ - Every rendered TUI line, JSON-escaped with ANSI codes and visible widths
37
+ - **All messages in the current session context** as JSONL, **completely unredacted**
40
38
 
41
- Unlike debug mode logs, `/debug` snapshots include conversation content, and every call appends to the same file. Atomic never trims or rotates `atomic-debug.log`. Delete the file before reproducing an issue, and review its contents before sharing.
39
+ Because `/debug` writes your full session messages with no credential redaction and appends plain text into the same `atomic-debug.log` file where debug mode appends JSONL, delete `atomic-debug.log` before reproducing an issue (Atomic never trims or rotates it) and review and redact the file before sharing.
42
40
 
43
- ### Finding what freezes the UI
41
+ ## Finding what freezes the UI
44
42
 
45
- If the interactive UI stalls and keystrokes or streamed output appear late, set `ATOMIC_EVENT_LOOP_BLOCK_MS` to the shortest stall duration (in milliseconds) you want to capture, reproduce the stall, and quit:
43
+ If the interactive UI stalls and keystrokes or streamed output appear late, set `ATOMIC_EVENT_LOOP_BLOCK_MS` to the shortest stall duration in milliseconds you want to capture, reproduce the stall, and quit:
46
44
 
47
45
  ```bash
48
46
  ATOMIC_EVENT_LOOP_BLOCK_MS=100 atomic
49
47
  ```
50
48
 
51
- The UI process (`host`) and the interactive engine process (`engine`) each append JSON lines to `~/.atomic/agent/event-loop-blocks.jsonl`, or to the file path in `ATOMIC_EVENT_LOOP_BLOCK_LOG`. When running without an isolated engine, all records are written by `host`.
49
+ `ATOMIC_EVENT_LOOP_BLOCK_MS` must be a positive whole number (`1` or greater); `"0"`, negative numbers, decimals, and non-numeric values are ignored and no monitor starts.
50
+
51
+ Interactive sessions log both the terminal UI process (`role: "host"`) and the background session worker (`role: "engine"`) to `~/.atomic/agent/event-loop-blocks.jsonl`. Single-process runs write only `role: "host"`. Override the log file path with `ATOMIC_EVENT_LOOP_BLOCK_LOG` (relative paths resolve from the startup working directory). If the file cannot be written at startup, Atomic prints one warning and skips monitoring.
52
52
 
53
53
  | `type` | Written | Fields |
54
54
  | --- | --- | --- |
55
- | `start` | When monitoring starts | `role`, `pid`, `runtime`, `thresholdMs`, and stack-collection mode |
56
- | `block` | After each stall at or above the threshold | `at` (when the UI was due to respond), `durationMs`, `samples`, `hotFrames` (most specific first), and the most common `stacks` |
57
- | `delay` | When ready for input (`startup`), when starting to quit (`session`), and on exit (`shutdown`) | `phase` (`startup`, `session`, or `shutdown`), `p50Ms`, `p99Ms`, `maxMs`, and `ticks` |
55
+ | `start` | When monitoring starts | `at`, `role`, `pid`, `runtime` (`"node"` or `"bun"`), `thresholdMs`, and `stacks` (`"profiler"`, `"disabled"`, or `"unavailable"` if the inspector cannot connect) |
56
+ | `block` | After each stall at or above `thresholdMs` | `at` (when the event loop was due to respond), `role`, `pid`, `durationMs`, `thresholdMs`, `samples`, `hotFrames` (up to 10 most specific functions first), and `stacks` (up to 3 most common stacks, trimmed to the first 12 and last 12 frames) |
57
+ | `delay` | When ready for input (`startup`), when starting to quit (`session`), and on exit (`shutdown`) | `at`, `role`, `pid`, `phase` (`"startup"`, `"session"`, or `"shutdown"`), `durationMs`, `ticks`, `p50Ms`, `p99Ms`, and `maxMs` |
58
58
 
59
- Quit Atomic, close the terminal or console window, or sign out of Windows to record the engine's `shutdown` summary.
59
+ Quit Atomic cleanly, close the terminal or console window, or sign out of Windows so the final `shutdown` delay summary flushes to disk.
60
60
 
61
- Block records contain function names and file paths, never prompts or message text. Atomic never trims the file, so delete it before reproducing a new issue.
61
+ Block records contain function names and source paths, never prompts or message text. Atomic never trims `event-loop-blocks.jsonl`, so delete it before reproducing a new issue.
62
62
 
63
- Stack collection is enabled by default using a sampling CPU profiler rather than debugger pauses. A `debugger;` statement does not pause Atomic just because monitoring is enabled, and an attached debugger keeps control of its own breakpoints.
63
+ The monitor checks the event loop every 20 ms, tracks delay histograms at 10 ms resolution, and samples the CPU every 2 ms using a sampling profiler rather than debugger pauses. A `debugger;` statement does not pause Atomic just because monitoring is active, and an attached debugger keeps control of its own breakpoints. Completed 5-second profile windows stay available until overlapping stalls are recorded, and functions sharing a name are tracked separately by source location.
64
64
 
65
- Profiles rotate every 5 seconds while the event loop runs, and completed profile windows stay available until overlapping stalls are recorded. Functions sharing a name are tracked separately by their source location. Because sampling adds some CPU overhead, disable stack collection when measuring raw latency:
65
+ Because CPU sampling adds some overhead, pass `ATOMIC_EVENT_LOOP_BLOCK_STACKS=0` (must be exact `"0"`; `"false"` leaves stacks enabled) when measuring raw latency:
66
66
 
67
67
  ```bash
68
68
  ATOMIC_EVENT_LOOP_BLOCK_MS=100 ATOMIC_EVENT_LOOP_BLOCK_STACKS=0 atomic
69
69
  ```
70
70
 
71
- In delay-only mode, `start` records report `stacks: "disabled"` and `block` records have zero samples, while every stall duration and delay summary is still written. Monitoring runs only when `ATOMIC_EVENT_LOOP_BLOCK_MS` is a positive integer; when unset, no sampler or monitor starts.
71
+ In delay-only mode, `start` records report `stacks: "disabled"` and `block` records have zero samples, while every stall duration and delay summary is still recorded.
72
72
 
73
- ## PDF and engine diagnostics
73
+ ## Document conversion diagnostics
74
74
 
75
- PDF conversion and engine diagnostics appear as status messages in interactive sessions and on stderr or console output in other modes. Conversion failures also include diagnostic details in the tool error result. Long or noisy diagnostics may truncate, and interactive sessions keep only recent diagnostics.
75
+ Diagnostics from document conversion (`.pdf`, `.doc`, `.docx`, `.ppt`, `.pptx`, `.xls`, `.xlsx`, `.rtf`, and `.epub`) and background session workers appear as status messages in interactive sessions and on stderr or console output in other modes. Conversion failures also include diagnostic details in the tool error result.
76
76
 
77
- Diagnostics render as plain text, not terminal control sequences, and RPC clients receive them separately from JSON responses. Atomic does not write an `atomic-engine-stderr.log` file; include the shown diagnostic text and conversion error when reporting a PDF issue.
77
+ Long or noisy diagnostics may truncate, and interactive sessions keep only recent messages. Atomic strips ANSI escape codes and control characters so diagnostics render as plain text, and RPC clients receive them separately from JSON responses. Atomic does not write an `atomic-engine-stderr.log` file; copy the displayed diagnostic text and conversion error when reporting a document conversion issue.
78
78
 
79
- ## Reporting startup problems
79
+ ## Startup timing and bug reports
80
80
 
81
- When reporting a startup issue, include your OS, terminal emulator, installation method, and `atomic --version` output.
81
+ To profile slow startup or session resume:
82
82
 
83
- <a id="testing"></a>
84
- <a id="installed-package-smoke-test"></a>
83
+ - Set `ATOMIC_TIMING=1` (legacy `PI_TIMING=1`) to print startup timings and `atomic --session` resume timings to stderr.
84
+ - Set `ATOMIC_STARTUP_TRACE=/tmp/atomic-startup.jsonl` (legacy `PI_STARTUP_TRACE`) to append JSONL startup milestones with wall-clock timestamps.
85
85
 
86
- ## Dependency versions and official releases
86
+ When reporting a bug or startup problem, include:
87
87
 
88
- For how Atomic pins dependencies in package-manager installs versus self-contained release archives, and how to download official releases, see [Installation](/getting-started/installation#package-managers).
88
+ - Your OS and version
89
+ - Your terminal emulator (and tmux or Herdr version if applicable)
90
+ - Your installation method (npm/package manager, self-contained release archive, or standalone binary)
91
+ - Output of `atomic --version`
92
+ - Relevant redacted diagnostic logs
89
93
 
90
- <a id="project-structure"></a>
94
+ If you installed from a self-contained release archive, keep the archive's complete directory structure intact so Atomic can locate its bundled assets and native module. For dependency versions and official release downloads, see [Installation](/getting-started/installation#package-managers).