@bastani/atomic 0.10.9 → 0.10.10-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (406) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/README.md +226 -163
  3. package/dist/_shared/dist-KOELCESV.js +2 -2
  4. package/dist/_shared/fork-row-index-UAUAQRD5.js +2 -2
  5. package/dist/_shared/lib-4PES5P4V.js +2 -2
  6. package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js +27 -12
  7. package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js.map +1 -1
  8. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +47 -7
  9. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js.map +1 -1
  10. package/dist/_shared/mode-shared-2QJSCUM6.js +48 -19
  11. package/dist/_shared/mode-shared-2QJSCUM6.js.map +1 -1
  12. package/dist/_shared/{p1a-prewarm-UQY3X2UK.js → p1a-prewarm-XIU57JHF.js} +5 -5
  13. package/dist/_shared/{p1a-prewarm-UQY3X2UK.js.map → p1a-prewarm-XIU57JHF.js.map} +1 -1
  14. package/dist/_shared/p2-shell-main-B2WIALFD.js +30 -25
  15. package/dist/_shared/p2-shell-main-B2WIALFD.js.map +1 -1
  16. package/dist/_shared/runtime-O4KCSG4C.js +5 -5
  17. package/dist/_shared/{sdk-OSBEPR3Q.js → sdk-RRLVN7ER.js} +15 -9
  18. package/dist/_shared/sdk-RRLVN7ER.js.map +1 -0
  19. package/dist/_shared/session-data-AHTU7IS6.js +2 -2
  20. package/dist/_shared/session-manager-list-2BLEEZVG.js +1 -1
  21. package/dist/_shared/settings-startup-8-DNZ2RIHM.js +4 -1
  22. package/dist/_shared/settings-startup-8-DNZ2RIHM.js.map +1 -1
  23. package/dist/_shared/{startup-0-0-TYUFUOJZ.js → startup-0-0-4VG2G44V.js} +427 -33
  24. package/dist/_shared/startup-0-0-4VG2G44V.js.map +1 -0
  25. package/dist/_shared/{startup-0-1-W2G2UY7R.js → startup-0-1-XTIL65D4.js} +18 -11
  26. package/dist/_shared/startup-0-1-XTIL65D4.js.map +1 -0
  27. package/dist/_shared/{startup-0-2-UXBUEOXW.js → startup-0-2-27OWFHV6.js} +150 -62
  28. package/dist/_shared/startup-0-2-27OWFHV6.js.map +1 -0
  29. package/dist/_shared/startup-0-3-T4DVFYWX.js +15 -25
  30. package/dist/_shared/startup-0-3-T4DVFYWX.js.map +1 -1
  31. package/dist/_shared/{startup-0-4-HN5EB4K7.js → startup-0-4-ZMJV547D.js} +81 -12
  32. package/dist/_shared/startup-0-4-ZMJV547D.js.map +1 -0
  33. package/dist/_shared/startup-0-5-FD2P735I.js +90 -50
  34. package/dist/_shared/startup-0-5-FD2P735I.js.map +1 -1
  35. package/dist/_shared/startup-10-0-TDQNBDDL.js +5 -5
  36. package/dist/_shared/startup-12-0-55AAXBJZ.js +13 -7
  37. package/dist/_shared/startup-12-0-55AAXBJZ.js.map +1 -1
  38. package/dist/_shared/startup-14-0-MLX36RBG.js +4 -4
  39. package/dist/_shared/startup-15-0-YUKGAC63.js +4 -4
  40. package/dist/_shared/startup-15-1-4S7FLMNG.js +88 -28
  41. package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
  42. package/dist/_shared/startup-8-0-34CBHPZH.js +5 -5
  43. package/dist/_shared/startup-8-1-4KANEHRA.js +61 -17
  44. package/dist/_shared/startup-8-1-4KANEHRA.js.map +1 -1
  45. package/dist/_shared/storage-command-7MGXLJGZ.js +4 -4
  46. package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
  47. package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
  48. package/dist/builtin/intercom/CHANGELOG.md +6 -0
  49. package/dist/builtin/intercom/README.md +87 -116
  50. package/dist/builtin/intercom/broker/broker.bundle.mjs +3 -3
  51. package/dist/builtin/intercom/broker/presence-handler.ts +1 -1
  52. package/dist/builtin/intercom/group.ts +7 -3
  53. package/dist/builtin/intercom/index.bundle.mjs +1 -1
  54. package/dist/builtin/intercom/package.json +1 -1
  55. package/dist/builtin/mcp/README.md +61 -27
  56. package/dist/builtin/mcp/index.bundle.mjs +1 -1
  57. package/dist/builtin/mcp/package.json +1 -1
  58. package/dist/builtin/subagents/CHANGELOG.md +8 -0
  59. package/dist/builtin/subagents/README.md +74 -141
  60. package/dist/builtin/subagents/package.json +1 -1
  61. package/dist/builtin/subagents/src/extension/index.bundle.mjs +213 -74
  62. package/dist/builtin/web-access/CHANGELOG.md +9 -0
  63. package/dist/builtin/web-access/README.md +61 -88
  64. package/dist/builtin/web-access/index.bundle.mjs +387 -351
  65. package/dist/builtin/web-access/package.json +1 -1
  66. package/dist/cli/args.js +2 -2
  67. package/dist/cli/auth-cli.code.js +4 -4
  68. package/dist/cli/auth-cli.impl.js +3 -3
  69. package/dist/cli/auth-cli.js +3 -3
  70. package/dist/cli/blueprint-command.code.js +2 -2
  71. package/dist/cli/blueprint-command.impl.js +3 -3
  72. package/dist/cli/blueprint-command.js +3 -3
  73. package/dist/cli/intercom-command.code.js +3 -3
  74. package/dist/cli/intercom-command.impl.js +3 -3
  75. package/dist/cli/intercom-command.js +3 -3
  76. package/dist/cli/list-models.code.js +3 -3
  77. package/dist/cli/list-models.impl.js +3 -3
  78. package/dist/cli/list-models.js +3 -3
  79. package/dist/cli/session-picker.code.js +2 -2
  80. package/dist/cli/session-picker.impl.js +3 -3
  81. package/dist/cli/session-picker.js +3 -3
  82. package/dist/cli/startup-ui.code.js +2 -2
  83. package/dist/cli/startup-ui.impl.js +3 -3
  84. package/dist/cli/startup-ui.js +3 -3
  85. package/dist/cli/storage-command.impl.js +3 -3
  86. package/dist/cli/storage-command.js +3 -3
  87. package/dist/cli/storage-search-session.code.js +2 -2
  88. package/dist/cli/storage-search-session.impl.js +3 -3
  89. package/dist/cli/storage-search-session.js +3 -3
  90. package/dist/cli/team-command.code.js +2 -2
  91. package/dist/cli/team-command.impl.js +3 -3
  92. package/dist/cli/team-command.js +3 -3
  93. package/dist/cli.js +2 -2
  94. package/dist/core/agent-session-methods.d.ts +4 -1
  95. package/dist/core/agent-session-methods.js.map +1 -1
  96. package/dist/core/agent-session.d.ts +3 -0
  97. package/dist/core/compaction/compactor.d.ts +20 -14
  98. package/dist/core/compaction/errors.d.ts +120 -0
  99. package/dist/core/compaction/index.d.ts +1 -0
  100. package/dist/core/compaction/model-resolver.d.ts +2 -2
  101. package/dist/core/debug.impl.js +3 -3
  102. package/dist/core/debug.js +3 -3
  103. package/dist/core/export-html/card-projection.impl.js +3 -3
  104. package/dist/core/export-html/card-projection.js +3 -3
  105. package/dist/core/export-html/index.code.js +2 -2
  106. package/dist/core/export-html/index.impl.js +3 -3
  107. package/dist/core/export-html/index.js +3 -3
  108. package/dist/core/export-html/json-spans.impl.js +3 -3
  109. package/dist/core/export-html/json-spans.js +3 -3
  110. package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
  111. package/dist/core/export-html/oversized-render-inputs.js +3 -3
  112. package/dist/core/export-html/tool-renderer.code.js +1 -1
  113. package/dist/core/export-html/tool-renderer.impl.js +3 -3
  114. package/dist/core/export-html/tool-renderer.js +3 -3
  115. package/dist/core/extensions/api-types.d.ts +1 -1
  116. package/dist/core/extensions/api-types.js.map +1 -1
  117. package/dist/core/extensions/index.d.ts +1 -1
  118. package/dist/core/extensions/jiti-loader.impl.js +3 -3
  119. package/dist/core/extensions/jiti-loader.js +3 -3
  120. package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
  121. package/dist/core/extensions/jiti-static-loader.js +3 -3
  122. package/dist/core/extensions/loader-host-modules.code.js +1 -1
  123. package/dist/core/extensions/loader-host-modules.impl.js +3 -3
  124. package/dist/core/extensions/loader-host-modules.js +3 -3
  125. package/dist/core/extensions/loader-virtual-modules.js +1 -1
  126. package/dist/core/extensions/provider-types.d.ts +18 -6
  127. package/dist/core/extensions/provider-types.js.map +1 -1
  128. package/dist/core/extensions/runner-context.js +1 -1
  129. package/dist/core/intercom-broker-control-host.code.js +1 -1
  130. package/dist/core/intercom-broker-control-host.impl.js +3 -3
  131. package/dist/core/intercom-broker-control-host.js +3 -3
  132. package/dist/core/intercom-broker-control.code.js +3 -3
  133. package/dist/core/intercom-broker-control.impl.js +3 -3
  134. package/dist/core/intercom-broker-control.js +3 -3
  135. package/dist/core/model-config.d.ts +40 -0
  136. package/dist/core/model-registry.js +1 -1
  137. package/dist/core/model-resolver-scope.d.ts +4 -4
  138. package/dist/core/model-runtime.d.ts +1 -1
  139. package/dist/core/package-manager-storage-adapters.impl.js +3 -3
  140. package/dist/core/package-manager-storage-adapters.js +3 -3
  141. package/dist/core/provider-composer-internal.d.ts +11 -2
  142. package/dist/core/sdk.code.js +3 -3
  143. package/dist/core/sdk.impl.js +3 -3
  144. package/dist/core/sdk.js +3 -3
  145. package/dist/core/session-manager-core.js +5 -5
  146. package/dist/core/session-manager-list.impl.js +3 -3
  147. package/dist/core/session-manager-list.js +3 -3
  148. package/dist/core/session-manager.code.js +1 -1
  149. package/dist/core/session-manager.impl.js +3 -3
  150. package/dist/core/session-manager.js +3 -3
  151. package/dist/core/session-storage.impl.js +3 -3
  152. package/dist/core/session-storage.js +3 -3
  153. package/dist/core/settings-manager-basic-accessors.d.ts +6 -2
  154. package/dist/core/storage/index.js +2 -2
  155. package/dist/core/storage/node-sqlite-thread.js +2 -2
  156. package/dist/core/storage/node-sqlite.js +2 -2
  157. package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
  158. package/dist/core/storage/offline-snapshot-file.js +3 -3
  159. package/dist/core/storage/provider.js +2 -2
  160. package/dist/core/storage/selection.js +2 -2
  161. package/dist/core/storage/session/branch-fork-source.code.js +2 -2
  162. package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
  163. package/dist/core/storage/session/branch-fork-source.js +3 -3
  164. package/dist/core/storage/session/card-view.impl.js +3 -3
  165. package/dist/core/storage/session/card-view.js +3 -3
  166. package/dist/core/storage/session/child-reader.code.js +3 -3
  167. package/dist/core/storage/session/child-reader.impl.js +3 -3
  168. package/dist/core/storage/session/child-reader.js +3 -3
  169. package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
  170. package/dist/core/storage/session/chunked-resume-projection.js +3 -3
  171. package/dist/core/storage/session/expanded-child-details.code.js +2 -2
  172. package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
  173. package/dist/core/storage/session/expanded-child-details.js +3 -3
  174. package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
  175. package/dist/core/storage/session/fork-row-bytes.js +3 -3
  176. package/dist/core/storage/session/fork-row-index.impl.js +3 -3
  177. package/dist/core/storage/session/fork-row-index.js +3 -3
  178. package/dist/core/storage/session/fork-staging.code.js +2 -2
  179. package/dist/core/storage/session/fork-staging.impl.js +3 -3
  180. package/dist/core/storage/session/fork-staging.js +3 -3
  181. package/dist/core/storage/session/fork-window.code.js +3 -3
  182. package/dist/core/storage/session/fork-window.impl.js +3 -3
  183. package/dist/core/storage/session/fork-window.js +3 -3
  184. package/dist/core/storage/session/history-pages.impl.js +3 -3
  185. package/dist/core/storage/session/history-pages.js +3 -3
  186. package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
  187. package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
  188. package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
  189. package/dist/core/storage/session/jsonl-session-store.js +3 -3
  190. package/dist/core/storage/session/memory-session-store.impl.js +3 -3
  191. package/dist/core/storage/session/memory-session-store.js +3 -3
  192. package/dist/core/storage/session/pinned-branch-resume.code.js +3 -3
  193. package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
  194. package/dist/core/storage/session/pinned-branch-resume.js +3 -3
  195. package/dist/core/storage/session/released-history-files.code.js +3 -3
  196. package/dist/core/storage/session/released-history-files.impl.js +3 -3
  197. package/dist/core/storage/session/released-history-files.js +3 -3
  198. package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
  199. package/dist/core/storage/session/resident-fork-rows.js +3 -3
  200. package/dist/core/storage/session/session-resume.impl.js +3 -3
  201. package/dist/core/storage/session/session-resume.js +3 -3
  202. package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
  203. package/dist/core/storage/session/snapshot-cut.js +3 -3
  204. package/dist/core/storage/session/snapshot-history.code.js +3 -3
  205. package/dist/core/storage/session/snapshot-history.impl.js +3 -3
  206. package/dist/core/storage/session/snapshot-history.js +3 -3
  207. package/dist/core/storage/session/sql-session-store.code.js +1 -1
  208. package/dist/core/storage/session/sql-session-store.impl.js +3 -3
  209. package/dist/core/storage/session/sql-session-store.js +3 -3
  210. package/dist/core/storage/session/tree-outline.impl.js +3 -3
  211. package/dist/core/storage/session/tree-outline.js +3 -3
  212. package/dist/core/storage/session/tree-presentation.impl.js +3 -3
  213. package/dist/core/storage/session/tree-presentation.js +3 -3
  214. package/dist/core/storage/storage-status.impl.js +3 -3
  215. package/dist/core/storage/storage-status.js +3 -3
  216. package/dist/core/storage/team.impl.js +3 -3
  217. package/dist/core/storage/team.js +3 -3
  218. package/dist/core/structured-output/index.code.js +1 -1
  219. package/dist/core/structured-output/index.impl.js +3 -3
  220. package/dist/core/structured-output/index.js +3 -3
  221. package/dist/core/tasks/task-completion-entry.impl.js +3 -3
  222. package/dist/core/tasks/task-completion-entry.js +3 -3
  223. package/dist/core/tasks/task-file-history.code.js +3 -3
  224. package/dist/core/tasks/task-file-history.impl.js +3 -3
  225. package/dist/core/tasks/task-file-history.js +3 -3
  226. package/dist/core/tasks/task-reference-archive.code.js +4 -4
  227. package/dist/core/tasks/task-reference-archive.js +3 -3
  228. package/dist/core/tasks/task-reference-identity.code.js +1 -1
  229. package/dist/core/tasks/task-reference-identity.js +3 -3
  230. package/dist/core/tasks/task-reference-stream.impl.js +3 -3
  231. package/dist/core/tasks/task-reference-stream.js +3 -3
  232. package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
  233. package/dist/core/tasks/task-unsaved-answer.js +3 -3
  234. package/dist/core/tasks/task-view-source.impl.js +3 -3
  235. package/dist/core/tasks/task-view-source.js +3 -3
  236. package/dist/core/tools/read-url.code.js +2 -2
  237. package/dist/core/tools/read-url.impl.js +3 -3
  238. package/dist/core/tools/read-url.js +3 -3
  239. package/dist/core/worktree-snapshot/blob-store.js +2 -2
  240. package/dist/core/worktree-snapshot/errors.code.js +3 -3
  241. package/dist/core/worktree-snapshot/errors.impl.js +3 -3
  242. package/dist/core/worktree-snapshot/errors.js +3 -3
  243. package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
  244. package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
  245. package/dist/extensions/codemode/execute.code.js +1 -1
  246. package/dist/extensions/codemode/execute.impl.js +3 -3
  247. package/dist/extensions/codemode/execute.js +3 -3
  248. package/dist/extensions/codemode/renderer.code.js +2 -2
  249. package/dist/extensions/codemode/renderer.impl.js +3 -3
  250. package/dist/extensions/codemode/renderer.js +3 -3
  251. package/dist/extensions/mcp/cli.code.js +2 -2
  252. package/dist/extensions/mcp/cli.impl.js +3 -3
  253. package/dist/extensions/mcp/cli.js +3 -3
  254. package/dist/extensions/mcp/cli.lazy.code.js +2 -2
  255. package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
  256. package/dist/extensions/mcp/cli.lazy.js +3 -3
  257. package/dist/extensions/mcp/runtime.code.js +1 -1
  258. package/dist/extensions/mcp/runtime.impl.js +3 -3
  259. package/dist/extensions/mcp/runtime.js +3 -3
  260. package/dist/index-extensions.d.ts +1 -1
  261. package/dist/index.d.ts +8 -1
  262. package/dist/index.js +7 -7
  263. package/dist/main-first-time-setup.code.js +2 -2
  264. package/dist/main-first-time-setup.impl.js +3 -3
  265. package/dist/main-first-time-setup.js +3 -3
  266. package/dist/modes/interactive/components/settings-selector-types.d.ts +1 -0
  267. package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
  268. package/dist/modes/interactive/components/stored-tree-view.code.js +2 -2
  269. package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
  270. package/dist/modes/interactive/components/stored-tree-view.js +3 -3
  271. package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
  272. package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
  273. package/dist/modes/interactive/theme/color-utils.d.ts +5 -5
  274. package/dist/modes/interactive/theme/theme-loading.d.ts +1 -0
  275. package/dist/modes/interactive-engine/engine-prewarm.js +1 -1
  276. package/dist/modes/interactive-engine/remote-model-catalog.d.ts +1 -0
  277. package/dist/modes/print-mode.js +1 -1
  278. package/dist/modes/rpc/rpc-client-api.d.ts +6 -0
  279. package/dist/modes/rpc/rpc-types.d.ts +29 -2
  280. package/dist/package-manager-cli.code.js +5 -5
  281. package/dist/package-manager-cli.impl.js +3 -3
  282. package/dist/package-manager-cli.js +3 -3
  283. package/dist/rpc-entry.js +1 -1
  284. package/dist/startup-files.json +1 -1
  285. package/dist/startup-stages/5.js +1 -1
  286. package/dist/startup-stages/7.js +1 -1
  287. package/dist/startup-stages/8.js +1 -2
  288. package/dist/startup-stages/9.js +2 -1
  289. package/dist/utils/native-module.d.ts +44 -0
  290. package/dist/utils/startup-database-spare.code.js +3 -3
  291. package/dist/utils/startup-database-spare.impl.js +3 -3
  292. package/dist/utils/startup-database-spare.js +3 -3
  293. package/dist/utils/tools-manager.code.js +1 -1
  294. package/dist/utils/tools-manager.impl.js +3 -3
  295. package/dist/utils/tools-manager.js +3 -3
  296. package/docs/background-tasks.md +238 -243
  297. package/docs/build.md +21 -15
  298. package/docs/changelog.mdx +1 -1
  299. package/docs/codemode.md +68 -51
  300. package/docs/compaction/reference.md +65 -26
  301. package/docs/compaction.md +118 -66
  302. package/docs/computer-use.md +179 -146
  303. package/docs/containerization.md +87 -33
  304. package/docs/custom-provider/api-reference.md +152 -13
  305. package/docs/custom-provider/oauth.md +45 -28
  306. package/docs/custom-provider/override.md +14 -7
  307. package/docs/custom-provider/registration.md +77 -67
  308. package/docs/custom-provider/streaming.md +42 -19
  309. package/docs/custom-provider.md +26 -62
  310. package/docs/development.md +81 -42
  311. package/docs/docs.json +54 -38
  312. package/docs/environment-variables.md +92 -64
  313. package/docs/extensions/api-reference.md +326 -735
  314. package/docs/extensions/authoring.md +186 -269
  315. package/docs/extensions/events.md +308 -375
  316. package/docs/extensions/examples.md +122 -74
  317. package/docs/extensions/ui.md +217 -197
  318. package/docs/extensions.md +189 -259
  319. package/docs/getting-started/authentication.md +27 -14
  320. package/docs/getting-started/first-session.md +25 -26
  321. package/docs/getting-started/installation.md +62 -84
  322. package/docs/getting-started/project-instructions.md +39 -14
  323. package/docs/guides/configuration.md +62 -20
  324. package/docs/guides/intercom.md +20 -12
  325. package/docs/guides/non-interactive.md +31 -16
  326. package/docs/guides/orchestration.md +17 -9
  327. package/docs/guides/resume-on-any-machine.md +63 -52
  328. package/docs/guides/subagents.md +26 -14
  329. package/docs/guides/team-setup.md +49 -27
  330. package/docs/guides.md +30 -23
  331. package/docs/herdr.md +22 -17
  332. package/docs/index.md +24 -17
  333. package/docs/intercom/operations.md +90 -66
  334. package/docs/intercom/reference.md +219 -192
  335. package/docs/intercom.md +111 -92
  336. package/docs/json.md +73 -71
  337. package/docs/keybindings.md +74 -48
  338. package/docs/libraries/agent-core.md +52 -9
  339. package/docs/libraries/ai.md +90 -63
  340. package/docs/libraries/codemode.md +31 -8
  341. package/docs/libraries/schema.md +12 -9
  342. package/docs/libraries/storage-libsql.md +92 -0
  343. package/docs/libraries/storage-postgres.md +119 -0
  344. package/docs/libraries/telemetry.md +42 -9
  345. package/docs/libraries/tui.md +74 -94
  346. package/docs/libraries.md +25 -8
  347. package/docs/llama-cpp.md +38 -33
  348. package/docs/mcp-servers.md +140 -88
  349. package/docs/models/reference.md +53 -36
  350. package/docs/models-configuration.md +19 -13
  351. package/docs/models.md +102 -87
  352. package/docs/orchestration/migrating-workflows.md +22 -20
  353. package/docs/orchestration/patterns.md +36 -21
  354. package/docs/orchestration.md +24 -21
  355. package/docs/packages/authoring.md +29 -18
  356. package/docs/packages/reference.md +77 -16
  357. package/docs/packages.md +34 -34
  358. package/docs/programmatic.md +28 -21
  359. package/docs/prompt-templates.md +65 -41
  360. package/docs/providers/reference.md +36 -20
  361. package/docs/providers.md +78 -76
  362. package/docs/quickstart.md +42 -54
  363. package/docs/reference/cli.md +256 -254
  364. package/docs/reference.md +30 -23
  365. package/docs/rpc/examples.md +121 -17
  366. package/docs/rpc/extension-ui.md +86 -63
  367. package/docs/rpc/protocol.md +817 -358
  368. package/docs/rpc.md +78 -152
  369. package/docs/sdk/reference.md +309 -73
  370. package/docs/sdk/storage.md +614 -0
  371. package/docs/sdk/structured-decisions.md +168 -65
  372. package/docs/sdk/web-server.md +80 -46
  373. package/docs/sdk.md +168 -215
  374. package/docs/security.md +117 -44
  375. package/docs/session-format.md +127 -76
  376. package/docs/sessions.md +155 -113
  377. package/docs/settings.md +293 -205
  378. package/docs/shell-aliases.md +15 -6
  379. package/docs/skills/authoring.md +17 -9
  380. package/docs/skills/reference.md +23 -21
  381. package/docs/skills.md +148 -97
  382. package/docs/storage.md +172 -260
  383. package/docs/subagents/authoring.md +148 -15
  384. package/docs/subagents/reference.md +105 -29
  385. package/docs/subagents.md +247 -250
  386. package/docs/terminal-setup.md +97 -69
  387. package/docs/termux.md +51 -85
  388. package/docs/themes/reference.md +51 -37
  389. package/docs/themes.md +52 -55
  390. package/docs/tmux.md +38 -21
  391. package/docs/tools.md +209 -147
  392. package/docs/tui/reference.md +64 -32
  393. package/docs/tui.md +38 -66
  394. package/docs/usage.md +94 -86
  395. package/docs/verification.md +25 -25
  396. package/docs/web-access.md +106 -54
  397. package/docs/windows.md +55 -57
  398. package/docs/worktree-snapshots.md +82 -74
  399. package/examples/sdk/11-sessions.ts +4 -4
  400. package/package.json +8 -8
  401. package/schemas/models.schema.json +58 -7
  402. package/dist/_shared/sdk-OSBEPR3Q.js.map +0 -1
  403. package/dist/_shared/startup-0-0-TYUFUOJZ.js.map +0 -1
  404. package/dist/_shared/startup-0-1-W2G2UY7R.js.map +0 -1
  405. package/dist/_shared/startup-0-2-UXBUEOXW.js.map +0 -1
  406. package/dist/_shared/startup-0-4-HN5EB4K7.js.map +0 -1
package/docs/packages.md CHANGED
@@ -1,22 +1,19 @@
1
1
  ---
2
- title: "Atomic packages"
3
- description: "Install, manage, and share Atomic packages that bundle extensions, skills, subagents, prompt templates, themes, MCP servers, and storage adapters."
2
+ title: "Install and manage packages"
3
+ sidebarTitle: "Atomic packages"
4
+ description: "Install, update, remove, and configure Atomic packages from npm, git, or local directories."
4
5
  ---
5
6
 
6
- # Atomic packages
7
-
8
7
  Atomic packages bundle extensions, skills, [subagents](/packages/authoring#subagents), prompt templates, themes, MCP servers, and [storage adapters](/storage#adapters-from-atomic-packages) for distribution over npm, git, or local paths. Declare resources under the `atomic` key in `package.json`, or use convention directories.
9
8
 
10
9
  ## Where to go next
11
10
 
12
- - [Creating packages](/packages/authoring). Configure the package manifest, subagents, MCP servers, storage adapters, directory structure, and dependencies.
13
- - [Package reference](/packages/reference). Review per-package filtering, scope precedence, and deduplication rules.
14
-
15
- <a id="table-of-contents" />
11
+ - [Create and publish packages](/packages/authoring). Configure the package manifest, subagents, MCP servers, storage adapters, directory structure, and dependencies.
12
+ - [Package reference](/packages/reference). Review pattern matching, `autoload: false` overrides, resource precedence, and deduplication rules.
16
13
 
17
14
  ## Install and manage
18
15
 
19
- > **Security:** Atomic packages run with full system access. Extensions execute arbitrary code and skills instruct the agent. Review source code before installing third-party packages.
16
+ > **Security:** Atomic packages run with full system access. Extensions execute arbitrary code and skills instruct the agent. Review source code before installing third-party packages. See [Security](/security) for project trust rules and [Package CLI commands](/reference/cli#package-commands) for the full command list.
20
17
 
21
18
  ```bash
22
19
  atomic install npm:@foo/bar@1.0.0
@@ -24,24 +21,28 @@ atomic install git:github.com/user/repo@v1
24
21
  atomic install https://github.com/user/repo # Raw URLs work too
25
22
  atomic install /absolute/path/to/package
26
23
  atomic install ./relative/path/to/package
24
+ atomic install -l npm:@foo/bar # Install into project settings (--local)
27
25
 
28
26
  atomic remove npm:@foo/bar # Alias: atomic uninstall
29
27
  atomic list # Show packages configured in settings
30
28
  atomic update # Update Atomic CLI only
31
29
  atomic update --all # Update Atomic + packages + reconcile git refs
32
30
  atomic update --extensions # Update packages + reconcile git refs only
33
- atomic update --models # Force-refresh authenticated model catalogs
34
- atomic update --self # Update Atomic CLI only
31
+ atomic update --models # Force-refresh authenticated model catalogs (15s timeout)
32
+ atomic update --self # Update Atomic CLI only (also: atomic update self | atomic)
35
33
  atomic update --self --force # Reinstall Atomic even if current
34
+ atomic update --self --extensions # Same as atomic update --all
36
35
  atomic update npm:@foo/bar # Update one package (or --extension <src>)
37
36
  ```
38
37
 
39
- Install and update behavior:
38
+ Install, trust, and update behavior:
40
39
 
41
- - **Global and project scope.** `install` and `remove` edit `~/.atomic/agent/settings.json` by default. Pass `-l` to write to `.atomic/settings.json` (legacy `.pi/settings.json` is also read). Missing project packages install automatically on startup once the project is trusted.
40
+ - **Global and project scope.** `install` and `remove` edit `~/.atomic/agent/settings.json` by default ([Settings](/settings)). Pass `-l` or `--local` to write to `.atomic/settings.json` (legacy `.pi/settings.json` is also read). Missing project packages install automatically on startup once you trust the project.
41
+ - **Project trust gate.** In an untrusted project, `atomic install -l` and `atomic remove -l` exit with code 1 (`Project is not trusted. Use --approve to modify local package config.`) unless you trust the project first ([Security](/security)) or pass `-a` / `--approve`. Both `-a` / `--approve` and `-na` / `--no-approve` are accepted on `install`, `remove`, `update`, `list`, and `config`.
42
42
  - **Update output.** Atomic lists each updated npm version or git commit (for example `npm:@foo/bar 1.2.0 -> 1.3.0`), prints `Packages are already up to date` when nothing changed, prints warnings when no package upgraded, and reports skipped updates in offline mode.
43
- - **Self-update safety.** Atomic installs the exact advertised version (showing any release note first) and only modifies installations managed and writable by the detected global package manager. Otherwise it prints the manual command. To uninstall Atomic itself, see [Uninstall](/getting-started/installation#uninstall).
44
- - **Resilience and concurrency.** Startup install failures (such as offline registries) warn with the `atomic remove` command, skip that package's resources, and retry on the next start or `/reload` (`atomic install` and `atomic update --extensions` still exit non-zero). Concurrent installs serialize per package, interrupted git clones re-clone on retry, and `atomic remove` also cleans orphaned directories.
43
+ - **Offline mode.** Pass `--offline` or set `ATOMIC_OFFLINE=1` to skip automatic startup installs and package updates.
44
+ - **Self-update safety.** Atomic installs the exact advertised version (showing any release note first) and only modifies installations managed and writable by the detected global package manager. On Windows, automatic self-update supports `npm` and `pnpm` installs only unless you override the command. Override auto-detection with `selfUpdateCommand` in global `settings.json` or the `ATOMIC_SELF_UPDATE_COMMAND` environment variable; otherwise Atomic prints the manual update command. To uninstall Atomic itself, see [Uninstall](/getting-started/installation#uninstall).
45
+ - **Resilience and concurrency.** Startup install failures (such as offline registries) warn with the `atomic remove` command, skip that package's resources, and retry on the next start or `/reload` (`atomic install` and `atomic update --extensions` still exit non-zero). Concurrent installs serialize per package, interrupted git clones re-clone on retry, and `atomic remove` cleans up orphaned package directories.
45
46
 
46
47
  Try a package for one run with `-e` or `--extension`:
47
48
 
@@ -50,7 +51,7 @@ atomic -e npm:@foo/bar
50
51
  atomic -e git:github.com/user/repo
51
52
  ```
52
53
 
53
- `-e` installs into a private user-owned cache (`$XDG_RUNTIME_DIR/atomic/extensions`, else `<agentDir>/cache/tmp/extensions`, else `<tmpdir>/atomic-<uid>/extensions`; symlinks or shared or other-owned directories are refused). Unpinned npm specs and non-commit git refs refresh on start and `/reload` (falling back to cache offline or on error). Exact `@1.2.3` npm pins and checked-out git commit hashes are not re-fetched. Local `-e <dir>` paths can also load `<dir>/.atomic`, `<dir>/.pi`, and `<dir>/.agents/skills` after resolving trust for that directory.
54
+ `-e` installs into a private user-owned cache (`$XDG_RUNTIME_DIR/atomic/extensions`, else `<agentDir>/cache/tmp/extensions`, else `<tmpdir>/atomic-<uid>/extensions`; symlinks and shared or other-owned directories are refused). Unpinned npm specs and branch or tag git refs refresh on start and `/reload` (falling back to cache offline or on error). Exact `@1.2.3` npm pins and checked-out git commit hashes (7 to 64 hex characters matching `HEAD`) skip network refresh. Local `-e <dir>` paths can also load `<dir>/.atomic`, `<dir>/.pi`, and `<dir>/.agents/skills` after resolving trust for that directory.
54
55
 
55
56
  ## Package sources
56
57
 
@@ -58,12 +59,14 @@ atomic -e git:github.com/user/repo
58
59
 
59
60
  ```text
60
61
  npm:@scope/pkg@1.2.3
62
+ npm:@scope/pkg@^1.2.0
63
+ npm:pkg@next
61
64
  npm:pkg
62
65
  ```
63
66
 
64
- - Pinned versions (`@1.2.3`) are skipped by `atomic update --extensions` and `--all`.
65
- - Global installs use your npm command. Project installs (`-l`) install under `.atomic/npm/` (legacy `.pi/npm/` fallback).
66
- - Override the npm executable with `npmCommand` in `settings.json` when using version managers such as `mise` or `asdf`:
67
+ - **Install locations.** Global npm packages install under `~/.atomic/agent/npm/` (a dedicated directory managed by Atomic, not your system global `npm -g` root). Atomic falls back to reading your system global `npm`, `pnpm`, or `bun` root only for legacy global installs already present there. Project installs (`-l` / `--local`) install under `.atomic/npm/` (legacy `.pi/npm/` fallback).
68
+ - **Pinning and ranges.** Exact semver versions (`npm:pkg@1.2.3`) are pinned and skipped by `atomic update --extensions` and `--all`. Semver ranges (`^1.2.3`, `~1.2.3`) and dist-tags (`@next`) update within that range or tag when you run `atomic update --extensions` or `--all`.
69
+ - **Custom package manager.** Override the npm executable with `npmCommand` in `settings.json` when using `pnpm`, `bun`, or version managers such as `mise` or `asdf`. Atomic detects `npm`, `pnpm`, and `bun` even inside wrapper commands and passes manager-specific flags to avoid unwanted peer-dependency installs (`--legacy-peer-deps` for npm, `--omit=peer` for bun, `--config.auto-install-peers=false` for pnpm):
67
70
 
68
71
  ```json
69
72
  {
@@ -75,15 +78,16 @@ npm:pkg
75
78
 
76
79
  ```text
77
80
  git:github.com/user/repo@v1
78
- git:git@github.com:user/repo@v1
81
+ git:git@github.com:user/repo@main
79
82
  https://github.com/user/repo@v1
80
83
  ssh://git@github.com/user/repo@v1
81
84
  ```
82
85
 
83
86
  - Bare protocol URLs (`https://`, `http://`, `ssh://`, `git://`) work directly. Shorthand (`github.com/user/repo`, `git@github.com:user/repo`) requires the `git:` prefix.
87
+ - Repository paths must include at least two path segments (`owner/repo`). Single-segment paths, path traversal (`..`, `.`), backslashes, and null bytes are rejected.
84
88
  - SSH uses your configured keys and `~/.ssh/config`. For CI or non-interactive use, set `GIT_TERMINAL_PROMPT=0` and `GIT_SSH_COMMAND="ssh -o BatchMode=yes -o ConnectTimeout=5"`.
85
89
  - Repositories clone to `~/.atomic/agent/git/<host>/<path>` (global) or `.atomic/git/<host>/<path>` (project; legacy `.pi/git/` fallback).
86
- - `@ref` pins a tag or commit. `atomic update --extensions` and `--all` reconcile the clone to that ref (resetting, cleaning, and re-running `npm install` if `package.json` exists) without advancing it. Move a pin with `atomic install git:host/user/repo@new-ref`.
90
+ - `@ref` accepts a branch name, tag, or commit hash. Running `atomic update --extensions` or `--all` fetches that ref (`git fetch origin -- <ref>`) and resets hard to `FETCH_HEAD`: branch refs advance to new commits on that branch, while tags and commit hashes reconcile to their exact target. Whenever the checked-out commit changes, Atomic runs `git clean -fdx` (removing untracked files in the clone) and installs production dependencies if `package.json` exists. Change a pin with `atomic install git:host/user/repo@new-ref`.
87
91
 
88
92
  ```bash
89
93
  atomic install git:git@github.com:user/repo
@@ -98,27 +102,23 @@ atomic install git:git@github.com/user/repo@v1.0.0
98
102
  ./relative/path/to/package
99
103
  ```
100
104
 
101
- Local paths are added to settings in place without copying (relative paths resolve from the settings file). A file loads as a single extension; a directory loads as a package.
105
+ Local paths are referenced in place without copying. When you run `atomic install /absolute/path/to/package`, Atomic stores the path in `settings.json` relative to the settings directory (`~/.atomic/agent` or `.atomic`). A file loads as a single extension; a directory loads as a package.
106
+
107
+ Running `atomic remove <local-path>` deletes only the entry from `settings.json` and never deletes files from your local directory.
102
108
 
103
109
  ## Enable and disable resources
104
110
 
105
111
  Run `atomic config` to toggle extensions, skills, prompt templates, and themes interactively:
106
112
 
107
113
  - Opens global settings (`~/.atomic/agent/settings.json`). Press `Tab` to switch between global and project scope.
108
- - Run `atomic config -l` to open project overrides (`.atomic/settings.json`) with inherited global entries dimmed.
114
+ - Run `atomic config -l` (or `--local`) to open project overrides (`.atomic/settings.json`) with inherited global entries dimmed.
109
115
  - Package subagents do not appear in `atomic config`. Filter them per package with `agents` in settings ([Package filtering](/packages/reference#package-filtering)).
110
- - Toggle built-in inline extensions (`llama.cpp`, `codemode`, `tool-search`) using `builtin:<name>` entries rather than filesystem paths ([Built-in extension resources](/extensions#built-in-extension-resources)).
111
- - If an interactive session crashes with an uncaught error whose stack crosses a loaded extension, Atomic names the extension in the exit output and suggests `atomic config` or `atomic -ne` to isolate it.
112
-
113
- <a id="creating-an-atomic-package" />
114
- <a id="gallery-metadata" />
115
- <a id="package-structure" />
116
- <a id="convention-directories" />
117
- <a id="dependencies" />
118
- <a id="package-filtering" />
119
- <a id="scope-and-deduplication" />
116
+ - Toggle built-in extensions (`llama.cpp`, `codemode`, `tool-search`) using `builtin:<name>` entries rather than filesystem paths ([Built-in extension resources](/extensions#built-in-extension-resources)).
117
+ - If an interactive session crashes with an uncaught error whose stack crosses a loaded extension, Atomic names the extension in the exit output and suggests `atomic config` or `atomic -ne` to narrow down the cause.
120
118
 
121
119
  ## Authoring and reference
122
120
 
123
- - [Creating an Atomic package](/packages/authoring#creating-an-atomic-package). Review manifest fields, [subagents](/packages/authoring#subagents), [MCP servers](/packages/authoring#mcp-servers), [storage adapters](/packages/authoring#storage-adapters), [gallery metadata](/packages/authoring#gallery-metadata), [convention directories](/packages/authoring#convention-directories), and [dependencies](/packages/authoring#dependencies).
121
+ - [Create and publish packages](/packages/authoring#creating-an-atomic-package). Review manifest fields, [subagents](/packages/authoring#subagents), [MCP servers](/packages/authoring#mcp-servers), [storage adapters](/packages/authoring#storage-adapters), [gallery metadata](/packages/authoring#gallery-metadata), [convention directories](/packages/authoring#convention-directories), and [dependencies](/packages/authoring#dependencies).
124
122
  - [Package reference](/packages/reference). Review [package filtering](/packages/reference#package-filtering) and [scope and deduplication](/packages/reference#scope-and-deduplication).
123
+ - [SDK extensions](/sdk/reference#extensions). Load local packages and extensions programmatically with `DefaultResourceLoader({ additionalExtensionPaths })`.
124
+ - [Package CLI commands](/reference/cli#package-commands), [Settings](/settings), and [Security](/security). Review CLI subcommands, `settings.json` keys, and project trust gates.
@@ -1,32 +1,39 @@
1
1
  ---
2
- title: Programmatic use
3
- description: Choose between JSON event stream mode, RPC mode, the SDK, and the TUI component APIs, then follow one minimal integration.
2
+ title: "Programmatic integration"
3
+ sidebarTitle: "Programmatic modes"
4
+ description: "Choose between JSON event stream mode, RPC mode, the TypeScript SDK, storage adapters, and TUI component APIs, then follow a minimal integration."
4
5
  ---
5
6
 
6
- # Programmatic use
7
+ Atomic provides three programmatic integration modes plus a component API for interactive extension interfaces. Choose the smallest mode that fits your integration, run its minimal example, and continue to its reference.
7
8
 
8
- Atomic exposes three integration modes plus a component API for interactive extension interfaces. Pick one mode, complete its minimal example, then continue to its reference.
9
+ ## Choose an integration mode
9
10
 
10
- ## Choose a mode
11
-
12
- | You want | Use | Start at |
11
+ | Goal | Mode | Entry point |
13
12
  | --- | --- | --- |
14
- | A one-shot run whose output you parse as structured events | [JSON event stream mode](/json) | `atomic --mode json` |
15
- | A long-lived process you drive with commands and read events from | [RPC mode](/rpc) | `atomic --mode rpc` |
16
- | Atomic embedded inside a Node.js application, with its resources and lifecycle in-process | [SDK](/sdk) | `@bastani/atomic` |
13
+ | Run one or more prompts and parse structured output as JSON lines | [JSON event stream](/json) | `atomic --mode json` |
14
+ | Drive a long-lived process with commands, interrupts, and extension UI prompts | [RPC mode](/rpc) | `atomic --mode rpc` |
15
+ | Embed Atomic directly inside a Node.js application (Node.js 22.19+) | [TypeScript SDK](/sdk) | `@bastani/atomic` |
16
+
17
+ - **JSON event stream** executes one or more positional prompts in sequence, writes newline-delimited session events to stdout, and exits.
18
+ - **RPC mode** keeps an Atomic subprocess running over stdin/stdout JSON Lines so you can send follow-up prompts, steer or abort turns, switch models, and answer extension dialogs and OAuth prompts.
19
+ - **TypeScript SDK** runs the same agent runtime as a library inside your Node.js application, with direct control over extensions, skills, tools, models, workspaces, and [session storage backends](/sdk/storage).
20
+
21
+ ## SDK guides and APIs
17
22
 
18
- - JSON mode runs one process with one prompt, streams newline-delimited events, then exits.
19
- - RPC mode keeps the process alive so you can send more input, interrupt, switch models, and answer extension UI dialogs and OAuth prompts (see [RPC extension UI protocol](/rpc/extension-ui)).
20
- - The SDK provides the same engine as a library, with programmatic control over extensions, skills, tools, and session storage.
23
+ - [SDK overview](/sdk): create sessions, bind workspaces, configure Intercom policies, and handle lifecycle events.
24
+ - [SDK storage backends](/sdk/storage): configure SQLite, JSONL, in-memory, libSQL/Turso, and PostgreSQL for `createAgentSession()`, `createAgentSessionRuntime()`, and `SessionManager`.
25
+ - [Structured decisions API](/sdk/structured-decisions): run typed classifier or chat decisions with `decide()` and `generateStructuredOutput()`.
26
+ - [Embed Atomic in a web server](/sdk/web-server): build a streaming HTTP API with Next.js App Router and `createAgentSession()`.
27
+ - [SDK API reference](/sdk/reference): complete session options, loaders, tool status, task supervision, run modes, and exports.
28
+ - [Remote compaction models](/models#remote-compaction-models) and [Environment blueprints](/guides/resume-on-any-machine#set-the-environment-up-with-a-blueprint): plug in custom remote compactors and repeatable worktree setup for cross-machine resume.
21
29
 
22
- ## Then continue to the contracts
30
+ ## RPC protocol and client guides
23
31
 
24
- - [RPC protocol](/rpc/protocol): every command, event, and type.
25
- - [RPC extension UI protocol](/rpc/extension-ui): drive extension-rendered UI and OAuth prompts over RPC.
26
- - [RPC client examples](/rpc/examples): additional client implementations.
27
- - [SDK API reference](/sdk/reference): options, loaders, return values, run modes, and exports.
32
+ - [RPC protocol reference](/rpc/protocol): every RPC command, streamed event, error shape, and JSON type.
33
+ - [RPC extension UI protocol](/rpc/extension-ui): handle extension dialogs, widgets, questionnaires, and OAuth flows over RPC.
34
+ - [RPC client examples](/rpc/examples): connect with the typed `RpcClient` or a standalone Node.js script.
28
35
 
29
- ## Build interactive interfaces and use standalone libraries
36
+ ## Terminal UI and standalone libraries
30
37
 
31
- - [TUI components](/tui) covers writing a first component and common interaction patterns. [TUI API reference](/tui/reference) holds the component, focusable, input, and rendering contracts.
32
- - [Libraries](/libraries) documents the standalone `@bastani/atomic-*` packages (`ai`, `agent-core`, `tui`, `codemode`, `schema`, and `telemetry`).
38
+ - [Build TUI components](/tui) walks through custom interactive components and common patterns, and [TUI API reference](/tui/reference) documents the component, focus, input, and rendering contracts.
39
+ - [Standalone libraries](/libraries) covers the six core `@bastani/atomic-*` packages (`ai`, `agent-core`, `tui`, `codemode`, `schema`, and `telemetry`) plus the optional storage adapter packages ([`@bastani/atomic-storage-postgres`](/libraries/storage-postgres) and [`@bastani/atomic-storage-libsql`](/libraries/storage-libsql)).
@@ -1,27 +1,42 @@
1
1
  ---
2
- title: Prompt templates
3
- description: Create reusable Markdown prompts that expand from slash commands with argument substitution.
2
+ title: "Prompt templates"
3
+ sidebarTitle: "Prompt templates"
4
+ description: "Create reusable Markdown slash commands with bash-style argument placeholders, defaults, and slicing."
4
5
  ---
5
6
 
6
- # Prompt templates
7
-
8
7
  Prompt templates are Markdown snippets that expand into full prompts. Type `/name` in the editor to invoke a template, where `name` is the filename without `.md`.
9
8
 
10
9
  **Prerequisites:** Atomic installed and running in a project. See the [Quickstart](/quickstart). No code or build step is required.
11
10
 
12
11
  Use prompt templates when you repeat the same instructions and want a slash command for them. They are Atomic's lightest customization option. Use a [skill](/skills) if the agent should decide when to load the instructions, or an [extension](/extensions) if you need to run code.
13
12
 
14
- ## Locations
13
+ ## Locations and loading rules
14
+
15
+ Atomic loads prompt templates from these sources:
15
16
 
16
- Atomic loads prompt templates from:
17
+ - **Global:** `~/.atomic/agent/prompts/*.md` (legacy `~/.pi/agent/prompts/*.md`)
18
+ - **Project** (only after you grant [project trust](/security#project-trust)): `.atomic/prompts/*.md` (legacy `.pi/prompts/*.md`)
19
+ - **Packages:** `prompts/` directories, `atomic.prompts`, or legacy `pi.prompts` entries in `package.json`
20
+ - **Settings:** `prompts` array in global or project `settings.json` ([Resource settings](/settings#resources)), which accepts files, directories, and filter patterns (`!glob`, `+path`, `-path` with `~` expansion; see [Package filtering](/packages/reference#package-filtering))
21
+ - **CLI:** `--prompt-template <path>` (repeatable; accepts either a `.md` file or a directory, and still loads with `--no-prompt-templates`; see [CLI resource options](/reference/cli#resource-options))
17
22
 
18
- - Global: `~/.atomic/agent/prompts/*.md` (legacy `~/.pi/agent/prompts/*.md`)
19
- - Project: `.atomic/prompts/*.md` (legacy `.pi/prompts/*.md`, only after the project is trusted)
20
- - Packages: `prompts/` directories, `atomic.prompts`, or legacy `pi.prompts` entries in `package.json`
21
- - Settings: `prompts` array with files or directories
22
- - CLI: `--prompt-template <path>` (repeatable)
23
+ Disable default discovery with `--no-prompt-templates` (short flag `-np`). Explicit `--prompt-template` paths and `-e` package prompts still load.
23
24
 
24
- Disable default discovery with `--no-prompt-templates`. Explicit `--prompt-template` paths still load.
25
+ ### Discovery and precedence rules
26
+
27
+ - Auto-discovery in `~/.atomic/agent/prompts/` and `.atomic/prompts/` is non-recursive. To load templates from subdirectories, add them explicitly in `settings.json` `prompts` or in a package manifest.
28
+ - Scanning skips dotfiles, `node_modules`, broken symlinks, and files matched by `.gitignore`, `.ignore`, or `.fdignore` inside the `prompts/` directory. Direct symlinks to `.md` files are followed.
29
+ - When multiple templates share a filename, Atomic keeps the first match in this order:
30
+ 1. Packages passed with `-e` / `--extension`
31
+ 2. Project `settings.json` `prompts` array
32
+ 3. Project auto-discovered directories (`.atomic/prompts/`, then legacy `.pi/prompts/`)
33
+ 4. Global `settings.json` `prompts` array
34
+ 5. Global auto-discovered directories (`~/.atomic/agent/prompts/`, then legacy `~/.pi/agent/prompts/`)
35
+ 6. Configured packages (project packages, then global packages)
36
+ 7. Bundled packages
37
+ 8. Explicit CLI `--prompt-template <path>` paths
38
+ - Exception: if an inherited legacy `.pi` template collides with a bundled template, the bundled template wins.
39
+ - Built-in interactive commands and extension slash commands take precedence over prompt templates with the same name.
25
40
 
26
41
  ## Format
27
42
 
@@ -36,9 +51,9 @@ Review the staged changes (`git diff --cached`). Focus on:
36
51
  ```
37
52
 
38
53
  - The filename becomes the command name. `review.md` becomes `/review`.
39
- - `description` is optional. If missing, the first non-empty line is used (truncated to 60 characters).
54
+ - `description` is optional. If omitted, Atomic uses the first non-empty line of the template body, truncated to 60 characters with `...` appended when longer.
40
55
  - `argument-hint` is optional. When set, the hint appears before the description in the autocomplete dropdown.
41
- - Invalid YAML frontmatter (for example an unquoted `description: Broken: value`) skips only that template and reports a warning naming the file and the parse position. Valid sibling templates still load.
56
+ - Invalid YAML frontmatter (for example an unquoted `description: Broken: value`) skips only that template and reports a warning naming the file and parse position. Valid sibling templates still load.
42
57
 
43
58
  ### Argument hints
44
59
 
@@ -53,37 +68,46 @@ argument-hint: "<PR-URL>"
53
68
 
54
69
  This renders in the autocomplete dropdown as:
55
70
 
56
- ```
57
- → pr <PR-URL> — Review PRs from URLs with structured issue and code analysis
58
- is <issue> — Analyze GitHub issues (bugs or feature requests)
59
- wr [instructions] — Finish the current task end-to-end
60
- cl — Audit changelog entries before release
71
+ ```text
72
+ → pr <PR-URL> Review PRs from URLs with structured issue and code analysis
73
+ is <issue> Analyze GitHub issues (bugs or feature requests)
74
+ wr [instructions] Finish the current task end-to-end
75
+ cl Audit changelog entries before release
61
76
  ```
62
77
 
63
78
  ## Usage
64
79
 
65
- Type `/` followed by the template name in the editor. Autocomplete shows available templates with descriptions.
80
+ Type `/` followed by the template name in the editor. Autocomplete shows available templates with hints and descriptions.
66
81
 
67
- ```
82
+ ```text
68
83
  /review # Expands review.md
69
84
  /component Button # Expands with argument
70
85
  /component Button "click handler" # Multiple arguments
71
86
  ```
72
87
 
73
- The template name ends at the first space, tab, or line break, so arguments can also start on a new line with Shift+Enter. Line breaks inside the arguments are kept. The same rule applies to extension commands and `/skill:name` commands.
88
+ The template name ends at the first space, tab, or line break, so arguments can also start on a new line with Shift+Enter. Line breaks inside the arguments are preserved. The same rule applies to extension commands and `/skill:name` commands.
89
+
90
+ Run `/reload` after adding or editing `.md` template files to pick up changes without restarting Atomic. While viewing a subagent, invoking a prompt template expands and sends the prompt to that viewed subagent rather than `main` ([Commands while viewing a subagent](/background-tasks#commands-while-viewing-a-subagent)).
91
+
92
+ ## Arguments and placeholders
74
93
 
75
- ## Arguments
94
+ Templates support bash-style positional arguments, defaults, and slicing. Substitution is single-pass (not recursive), so argument values containing `$1` or `$@` remain literal text.
76
95
 
77
- Templates support positional arguments, defaults, and simple slicing. Substitution is not recursive, so argument values containing `$1` or `$@` stay as literal text:
96
+ | Placeholder | Expansion |
97
+ | --- | --- |
98
+ | `$1`, `$2`, `$10`, ... | Positional argument by 1-based index. Missing arguments and `$0` expand to `""` (empty string). |
99
+ | `$@` or `$ARGUMENTS` | All arguments joined with single spaces. Interchangeable except for slicing. |
100
+ | `${N:-default}` | Argument `N` when present and non-empty; otherwise `default`. Empty defaults like `${1:-}` expand to `""`. |
101
+ | `${@:-default}` or `${ARGUMENTS:-default}` | All arguments joined with spaces when present and non-empty; otherwise `default`. |
102
+ | `${@:N}` | Arguments from 1-based position `N` to the end, joined with spaces. `N = 0` clamps to `1`; `N` past the last argument expands to `""`. |
103
+ | `${@:N:L}` | Up to `L` arguments starting at 1-based position `N`, joined with spaces. `L = 0` expands to `""`. Slicing works with `@` only (not `${ARGUMENTS:N}`). |
78
104
 
79
- - `$1`, `$2`, ... for positional arguments
80
- - `$@` or `$ARGUMENTS` for all arguments joined with spaces
81
- - `${1:-default}` uses argument 1 when present and non-empty, otherwise `default` (up to 1,024 characters)
82
- - `${@:-default}` or `${ARGUMENTS:-default}` uses all arguments when present and non-empty, otherwise `default`
83
- - `${@:N}` for arguments from the Nth position (1-indexed)
84
- - `${@:N:L}` for `L` arguments starting at N
105
+ Default-value syntax rules:
85
106
 
86
- Example:
107
+ - `default` inside `${N:-default}` or `${@:-default}` cannot contain a closing `}`.
108
+ - If `default` is longer than 1,024 characters, the placeholder does not match and remains literal text in the expanded prompt.
109
+
110
+ Example with positional arguments and `$@`:
87
111
 
88
112
  ```markdown
89
113
  ---
@@ -92,26 +116,26 @@ description: Create a component
92
116
  Create a React component named $1 with features: $@
93
117
  ```
94
118
 
95
- Default values help with optional arguments:
119
+ Usage: `/component Button "onClick handler" "disabled support"`
120
+
121
+ Example with a default value:
96
122
 
97
123
  ```markdown
98
124
  Summarize the current state in ${1:-7} bullet points.
99
125
  ```
100
126
 
101
- Usage: `/component Button "onClick handler" "disabled support"`
102
-
103
127
  Use `""` or `''` to pass an empty argument without shifting later positions. For a template containing `Review $2. Focus: ${1:-correctness}.`, `/review "" src/index.ts` expands to `Review src/index.ts. Focus: correctness.`
104
128
 
105
- A quote only starts quoting at the beginning of an argument, so apostrophes inside words such as `doesn't` stay as text, and a quote with no closing match is kept as text. Inside a quoted argument, a backslash before the same quote character keeps it as text, so `/review "the \"fast\" path"` supplies `the "fast" path`. Other backslashes stay as typed.
106
-
107
- ## Loading rules
129
+ ### Quoting and splitting rules
108
130
 
109
- - Template discovery in `prompts/` is non-recursive.
110
- - If you want templates in subdirectories, add them explicitly via `prompts` settings or a package manifest.
131
+ - Arguments split on space (` `) and tab (`\t`) only, **not on newlines (`\n`)**. If arguments span multiple lines (via Shift+Enter) without spaces or tabs between them, the newline stays inside the same positional argument.
132
+ - Quotes (`"` or `'`) start a quoted argument only at the beginning of a token. Apostrophes inside words such as `doesn't` remain ordinary characters.
133
+ - An unclosed quote is treated as a literal character, and the rest of the text is tokenized normally.
134
+ - Backslash escaping works only for a matching quote inside a quoted argument (`\"` inside `"..."` or `\'` inside `'...'`). For example, `/review "the \"fast\" path"` passes `the "fast" path`. All other backslashes (including `\\` and backslashes outside quotes) remain literal.
111
135
 
112
136
  ## Next steps
113
137
 
114
- - [Skills](/skills). Provide instructions the agent loads on its own when a task matches, instead of requiring an explicit slash command.
138
+ - [Use and organize skills](/skills). Provide instructions the agent loads on its own when a task matches, instead of requiring an explicit slash command.
115
139
  - [Subagents](/subagents). Delegate a focused, bounded task to a child agent.
116
- - [Atomic packages](/packages). Bundle your prompt templates with skills, themes, and extensions to share them.
140
+ - [Install and manage packages](/packages). Bundle your prompt templates with skills, themes, and extensions to share them.
117
141
  - [Build with Atomic](/build). Compare every customization option.
@@ -1,32 +1,42 @@
1
1
  ---
2
- title: Provider reference
3
- description: Provider stop reasons, credential resolution order, and GitHub Copilot error classes.
2
+ title: "Provider reference"
3
+ sidebarTitle: "Providers"
4
+ description: "Credential resolution order, provider stop reasons, and GitHub Copilot error classes and helpers."
4
5
  ---
5
6
 
6
- # Provider reference
7
+ This reference covers credential precedence, terminal stop reasons, and GitHub Copilot's typed error classes. For setup steps, subscriptions, and API keys, see [Authentication](/getting-started/authentication) and [Model providers](/providers).
7
8
 
8
- ## Stop reasons
9
+ ## Credential resolution order {#resolution-order}
9
10
 
10
- Every provider reports why a turn ended. Atomic maps the provider's string (`end_turn`, `MAX_TOKENS`, `tool_calls`, and similar values) onto `stop`, `length`, `toolUse`, `error`, or `aborted`.
11
+ Atomic resolves provider credentials from highest to lowest priority:
11
12
 
12
- An unrecognized terminal reason becomes a provider error that names the raw value instead of an ordinary stop. This surfaces new truncation or safety signals rather than letting a turn appear complete. Provider safety and refusal errors keep their raw reason, such as `Provider stopped with: SAFETY`.
13
+ 1. **CLI [`--api-key`](/reference/cli#model-options) flag** (or [SDK runtime API key override](/sdk/reference#api-keys-and-oauth)).
14
+ 2. **Stored credential in `~/.atomic/agent/auth.json`** (API key or OAuth token; falls back to legacy `~/.pi/agent/auth.json`).
15
+ 3. **Provider configuration `apiKey`** from an extension's [`registerProvider()`](/custom-provider) call, then from [`~/.atomic/agent/models.json`](/models).
16
+ 4. **Built-in [environment variable](/environment-variables#provider-credentials) or ambient credentials** (such as `ANTHROPIC_API_KEY`, AWS profiles/IAM/IRSA, Google Application Default Credentials, or Anthropic Workload Identity Federation).
17
+
18
+ Watch out for two precedence rules:
13
19
 
14
- A streaming partial message carries `pending` until a terminal reason replaces it. A completed turn cannot remain `pending`, so a stream that ends in that state becomes a provider error. See [Custom providers](/custom-provider) for custom streaming requirements.
20
+ - **Unset `$VAR` in `models.json` blocks env fallback.** If you configure `"apiKey": "$UNSET_VAR"` on a built-in provider in `models.json` and `UNSET_VAR` is unset or empty, credential resolution stops and returns no credential instead of falling back to the provider's built-in environment variable.
21
+ - **Anthropic environment variable order.** When no CLI flag, `auth.json` entry, or `models.json` `apiKey` is set for `anthropic`, Atomic checks `ANTHROPIC_AUTH_TOKEN`, then `ANTHROPIC_OAUTH_TOKEN`, then `ANTHROPIC_API_KEY`, then Anthropic Workload Identity Federation.
15
22
 
16
- ## Resolution order
23
+ ### SDK login options
17
24
 
18
- Atomic resolves provider credentials in this order:
25
+ Applications calling [`@bastani/atomic-ai`](/libraries/ai) directly can pass `{ agentName: "my-app" }` as the fourth argument to `models.login()` to set the OpenAI ChatGPT sign-in name hint or Codex login originator. ChatGPT sign-in defaults to `Atomic`. For host session authentication helpers, see [SDK API keys and OAuth](/sdk/reference#api-keys-and-oauth).
26
+
27
+ ## Stop reasons
19
28
 
20
- 1. CLI `--api-key` flag
21
- 2. `~/.atomic/agent/auth.json` entry (API key or OAuth token)
22
- 3. Environment variable
23
- 4. Custom provider keys from `models.json`
29
+ Every provider reports why a turn ended. Atomic maps the provider's raw stop reason (`end_turn`, `MAX_TOKENS`, `tool_calls`, and similar values) onto `stop`, `length`, `toolUse`, `error`, `aborted`, or `deferred` (for asynchronous batch APIs).
30
+
31
+ An unrecognized terminal reason becomes a provider error that names the raw value instead of an ordinary stop. This surfaces new truncation or safety signals rather than letting a turn appear complete. Provider safety and refusal errors keep their raw reason, such as `Provider stopped with: SAFETY`.
32
+
33
+ A streaming partial message carries `pending` until a terminal reason replaces it. A completed turn cannot remain `pending`, so a stream that ends in that state becomes a provider error. See [Implement provider streaming](/custom-provider/streaming#stop-reasons) for custom streaming requirements.
24
34
 
25
35
  ## GitHub Copilot errors
26
36
 
27
- Atomic classifies failed GitHub Copilot requests into typed error classes so retries and [model fallback](/settings#retry) react to the failure cause rather than message text. Each message states what failed, the model, the error code, the next step, and Copilot's response excerpt.
37
+ Atomic classifies failed GitHub Copilot requests into typed error classes so [retries](/settings#retry) and [model fallback](/settings#fallbackmodels) react to the failure cause rather than message text. Each message states what failed, the model, the error code, the next step, and Copilot's response excerpt.
28
38
 
29
- Every `GitHubCopilotError` carries `code`, `retryable`, `hint`, `modelId`, `api`, `status`, `providerCode` (Copilot's error code), `requestId` (Copilot's `x-request-id`), `detail` (a short excerpt of Copilot's response text, which may quote parts of the request), and `cause`.
39
+ Every `GitHubCopilotError` carries `code`, `retryable`, `hint`, `modelId`, `api`, `status`, `providerCode` (Copilot's error code), `requestId` (Copilot's `x-request-id`), `detail` (a response excerpt truncated to 300 characters, which may quote parts of the request), and `cause`.
30
40
 
31
41
  | Class | Code | When | Extra fields | Retried on same model | Falls back to next model | What to do |
32
42
  | --- | --- | --- | --- | --- | --- | --- |
@@ -46,10 +56,16 @@ All 11 classes extend `GitHubCopilotError`. The same retry and fallback rules ap
46
56
 
47
57
  ### GitHub Copilot error helpers
48
58
 
49
- SDK callers can read the typed error from a failed assistant message with `getGitHubCopilotError(message)`. Call `findGitHubCopilotError(error)` to search an error's cause chain or a wrapped message and return the typed `GitHubCopilotError` instance.
50
-
51
- The error is stored in the message `diagnostics`, so it survives workers, RPC, and saved sessions. Use `serializeGitHubCopilotError()` and `deserializeGitHubCopilotError()` for explicit conversion. `deserializeGitHubCopilotError()` returns `undefined` if the class name does not match the code or if the `reason` does not belong to that class.
59
+ SDK callers can inspect, classify, and serialize Copilot errors using functions exported from [`@bastani/atomic`](/sdk) and [`@bastani/atomic-ai`](/libraries/ai):
52
60
 
53
- Type guards such as `isGitHubCopilotError()` and `isGitHubCopilotRateLimitError()` return a plain `boolean` indicating whether an error, its cause chain, or a failed message contains that error, including errors relayed from another process. Call `findGitHubCopilotError()` when you need the instance and its fields. Call `describeGitHubCopilotModel(model)` to inspect a Copilot model's capabilities.
61
+ - **Extract or classify errors:**
62
+ - `getGitHubCopilotError(message)`: reads the typed error from a failed assistant message's `diagnostics`.
63
+ - `findGitHubCopilotError(error)`: searches an error, its `cause` chain, or a wrapped message and returns the typed `GitHubCopilotError` instance.
64
+ - `classifyGitHubCopilotFailure(error, failure)`: maps a raw error and request context into a typed `GitHubCopilotError`.
65
+ - **Serialize across processes:** Errors are stored in assistant message `diagnostics` under `GITHUB_COPILOT_ERROR_DIAGNOSTIC` (`"github_copilot_error"`), so they survive subagent workers, RPC, and saved sessions. Inferred Chat Completions stop reasons are recorded under `GITHUB_COPILOT_INFERRED_STOP_REASON_DIAGNOSTIC` (`"github_copilot_inferred_stop_reason"`). Use `serializeGitHubCopilotError()` and `deserializeGitHubCopilotError()` for explicit conversion; `deserializeGitHubCopilotError()` returns `undefined` if the class name does not match the code or if `reason` does not belong to that class.
66
+ - **Type guards:** Return a plain `boolean` checking an error, its `cause` chain, or a failed message (including errors relayed from another process):
67
+ - `isGitHubCopilotError`, `isRetryableGitHubCopilotError`
68
+ - `isGitHubCopilotModelUnavailableError`, `isGitHubCopilotRateLimitError`, `isGitHubCopilotQuotaExhaustedError`, `isGitHubCopilotContentFilterError`, `isGitHubCopilotPromptTooLargeError`, `isGitHubCopilotInvalidRequestError`, `isGitHubCopilotAuthenticationError`, `isGitHubCopilotServiceUnavailableError`, `isGitHubCopilotStreamEndedEarlyError`, `isGitHubCopilotEmptyResponseError`, `isGitHubCopilotUnrecognizedResponseError`
69
+ - **Model inspection:** Call `describeGitHubCopilotModel(model)` to inspect a Copilot model's capabilities.
54
70
 
55
- The guards and `findGitHubCopilotError()` also reject malformed serialized payloads. Only minimal relays containing `name`, `code`, and an optional string `message` are reconstructed without structured fields; a malformed full payload is never rebuilt with dropped context.
71
+ The guards and `findGitHubCopilotError()` reject malformed serialized payloads. Only minimal serialized error objects containing `name`, `code`, and an optional string `message` are reconstructed without structured fields; a malformed full payload is never rebuilt with dropped context.