@bastani/atomic 0.10.11-alpha.2 → 0.10.11-alpha.4

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 (447) hide show
  1. package/CHANGELOG.md +150 -0
  2. package/README.md +5 -8
  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 +6 -6
  7. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +5 -5
  8. package/dist/_shared/mode-shared-2QJSCUM6.js +6 -6
  9. package/dist/_shared/p0-cli-BB45ZQY6.js +46 -67
  10. package/dist/_shared/p0-cli-BB45ZQY6.js.map +1 -1
  11. package/dist/_shared/p1a-prewarm-XIU57JHF.js +7 -8
  12. package/dist/_shared/p1a-prewarm-XIU57JHF.js.map +1 -1
  13. package/dist/_shared/{p1b-elig-ENCUPKKJ.js → p1b-elig-TVB5CBLL.js} +36 -8
  14. package/dist/_shared/p1b-elig-TVB5CBLL.js.map +1 -0
  15. package/dist/_shared/p2-shell-main-B2WIALFD.js +6 -3
  16. package/dist/_shared/p2-shell-main-B2WIALFD.js.map +1 -1
  17. package/dist/_shared/runtime-O4KCSG4C.js +3 -3
  18. package/dist/_shared/{sdk-IQMULKFU.js → sdk-B5LEWGGI.js} +1218 -657
  19. package/dist/_shared/sdk-B5LEWGGI.js.map +1 -0
  20. package/dist/_shared/session-data-AHTU7IS6.js +2 -2
  21. package/dist/_shared/session-manager-list-2BLEEZVG.js +1 -1
  22. package/dist/_shared/{startup-0-0-3IXNMFM2.js → startup-0-0-XJJDOIEC.js} +50 -48
  23. package/dist/_shared/startup-0-0-XJJDOIEC.js.map +1 -0
  24. package/dist/_shared/{startup-0-1-7T2IAE7J.js → startup-0-1-M6OWAYHH.js} +540 -136
  25. package/dist/_shared/startup-0-1-M6OWAYHH.js.map +1 -0
  26. package/dist/_shared/startup-0-2-5QHPCEON.js +47 -48
  27. package/dist/_shared/startup-0-2-5QHPCEON.js.map +1 -1
  28. package/dist/_shared/startup-0-3-4ZYBYQNM.js +5 -5
  29. package/dist/_shared/startup-0-4-ZMJV547D.js +12 -7
  30. package/dist/_shared/startup-0-4-ZMJV547D.js.map +1 -1
  31. package/dist/_shared/startup-0-5-YDW47QX6.js +7 -7
  32. package/dist/_shared/startup-0-5-YDW47QX6.js.map +1 -1
  33. package/dist/_shared/startup-10-0-TDQNBDDL.js +6 -6
  34. package/dist/_shared/startup-12-0-55AAXBJZ.js +2 -2
  35. package/dist/_shared/startup-14-0-MLX36RBG.js +4 -5
  36. package/dist/_shared/startup-14-0-MLX36RBG.js.map +1 -1
  37. package/dist/_shared/startup-15-0-YUKGAC63.js +4 -4
  38. package/dist/_shared/startup-15-1-4S7FLMNG.js +19 -27
  39. package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
  40. package/dist/_shared/startup-8-0-34CBHPZH.js +2144 -249
  41. package/dist/_shared/startup-8-0-34CBHPZH.js.map +1 -1
  42. package/dist/_shared/{startup-8-1-X32CYSXB.js → startup-8-1-LZFXSD3Z.js} +98 -1184
  43. package/dist/_shared/startup-8-1-LZFXSD3Z.js.map +1 -0
  44. package/dist/_shared/storage-command-7MGXLJGZ.js +188 -37
  45. package/dist/_shared/storage-command-7MGXLJGZ.js.map +1 -1
  46. package/dist/_shared/storage-status-K7PX2RXA.js +557 -0
  47. package/dist/_shared/storage-status-K7PX2RXA.js.map +1 -0
  48. package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
  49. package/dist/_shared/team-DOQKICG2.js +376 -0
  50. package/dist/_shared/team-DOQKICG2.js.map +1 -0
  51. package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
  52. package/dist/builtin/intercom/CHANGELOG.md +42 -0
  53. package/dist/builtin/intercom/README.md +2 -2
  54. package/dist/builtin/intercom/broker/broker.bundle.mjs +1917 -381
  55. package/dist/builtin/intercom/broker/client.ts +8 -0
  56. package/dist/builtin/intercom/broker/database-wake-up-bus.ts +324 -68
  57. package/dist/builtin/intercom/broker/multinode-router.ts +256 -39
  58. package/dist/builtin/intercom/broker/multinode-state-store.ts +71 -5
  59. package/dist/builtin/intercom/broker/open-broker-state.ts +14 -0
  60. package/dist/builtin/intercom/broker/send-order-gate.ts +5 -2
  61. package/dist/builtin/intercom/broker/sql-add-column.ts +50 -5
  62. package/dist/builtin/intercom/broker/sql-ended-child-queue-store.ts +3 -2
  63. package/dist/builtin/intercom/broker/sql-held-send-store.ts +2 -2
  64. package/dist/builtin/intercom/broker/sql-known-session-store.ts +43 -19
  65. package/dist/builtin/intercom/broker/sql-lease-store.ts +473 -121
  66. package/dist/builtin/intercom/broker/sql-outbox-store.ts +821 -79
  67. package/dist/builtin/intercom/broker/sql-pending-ask-store.ts +8 -5
  68. package/dist/builtin/intercom/broker/sql-released-ask-store.ts +12 -5
  69. package/dist/builtin/intercom/broker/sql-restoring-reservation-store.ts +256 -8
  70. package/dist/builtin/intercom/broker/sql-retention.ts +150 -0
  71. package/dist/builtin/intercom/broker/sql-schema.ts +175 -24
  72. package/dist/builtin/intercom/broker/sql-sent-message-authority.ts +74 -19
  73. package/dist/builtin/intercom/broker/wake-up-bus.ts +6 -0
  74. package/dist/builtin/intercom/index.bundle.mjs +14 -4
  75. package/dist/builtin/intercom/package.json +1 -1
  76. package/dist/builtin/mcp/index.bundle.mjs +1 -1
  77. package/dist/builtin/mcp/package.json +1 -1
  78. package/dist/builtin/subagents/CHANGELOG.md +6 -0
  79. package/dist/builtin/subagents/package.json +1 -1
  80. package/dist/builtin/subagents/skills/skill-creator/eval-viewer/generate_review.py +8 -1
  81. package/dist/builtin/subagents/src/extension/index.bundle.mjs +1 -1
  82. package/dist/builtin/web-access/index.bundle.mjs +2 -10
  83. package/dist/builtin/web-access/package.json +1 -1
  84. package/dist/bun/bundled-sqlite.js +41 -0
  85. package/dist/bun/bundled-sqlite.js.map +1 -0
  86. package/dist/cli/args.js +2 -2
  87. package/dist/cli/auth-cli.code.js +4 -4
  88. package/dist/cli/auth-cli.impl.js +3 -3
  89. package/dist/cli/auth-cli.js +3 -3
  90. package/dist/cli/blueprint-command.code.js +3 -3
  91. package/dist/cli/blueprint-command.impl.js +3 -3
  92. package/dist/cli/blueprint-command.js +3 -3
  93. package/dist/cli/intercom-command.code.js +3 -3
  94. package/dist/cli/intercom-command.code.js.map +1 -1
  95. package/dist/cli/intercom-command.impl.js +3 -3
  96. package/dist/cli/intercom-command.js +3 -3
  97. package/dist/cli/list-models.code.js +2 -2
  98. package/dist/cli/list-models.impl.js +3 -3
  99. package/dist/cli/list-models.js +3 -3
  100. package/dist/cli/session-picker.code.js +1 -1
  101. package/dist/cli/session-picker.impl.js +3 -3
  102. package/dist/cli/session-picker.js +3 -3
  103. package/dist/cli/startup-ui.code.js +1 -1
  104. package/dist/cli/startup-ui.impl.js +3 -3
  105. package/dist/cli/startup-ui.js +3 -3
  106. package/dist/cli/storage-command.impl.js +3 -3
  107. package/dist/cli/storage-command.js +3 -3
  108. package/dist/cli/storage-search-session.code.js +3 -3
  109. package/dist/cli/storage-search-session.impl.js +3 -3
  110. package/dist/cli/storage-search-session.js +3 -3
  111. package/dist/cli/team-command.code.js +19 -113
  112. package/dist/cli/team-command.code.js.map +1 -1
  113. package/dist/cli/team-command.impl.js +3 -3
  114. package/dist/cli/team-command.js +3 -3
  115. package/dist/cli.js +5 -18
  116. package/dist/cli.js.map +1 -1
  117. package/dist/core/agent-rehydrate-errors.d.ts +4 -9
  118. package/dist/core/compaction/compactor.d.ts +3 -3
  119. package/dist/core/debug.code.js +1 -1
  120. package/dist/core/debug.impl.js +3 -3
  121. package/dist/core/debug.js +3 -3
  122. package/dist/core/export-html/card-projection.impl.js +3 -3
  123. package/dist/core/export-html/card-projection.js +3 -3
  124. package/dist/core/export-html/index.code.js +4 -4
  125. package/dist/core/export-html/index.code.js.map +1 -1
  126. package/dist/core/export-html/index.impl.js +3 -3
  127. package/dist/core/export-html/index.js +3 -3
  128. package/dist/core/export-html/json-spans.impl.js +3 -3
  129. package/dist/core/export-html/json-spans.js +3 -3
  130. package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
  131. package/dist/core/export-html/oversized-render-inputs.js +3 -3
  132. package/dist/core/export-html/tool-renderer.impl.js +3 -3
  133. package/dist/core/export-html/tool-renderer.js +3 -3
  134. package/dist/core/extensions/jiti-loader.impl.js +3 -3
  135. package/dist/core/extensions/jiti-loader.js +3 -3
  136. package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
  137. package/dist/core/extensions/jiti-static-loader.js +3 -3
  138. package/dist/core/extensions/loader-host-modules.code.js +1 -1
  139. package/dist/core/extensions/loader-host-modules.impl.js +3 -3
  140. package/dist/core/extensions/loader-host-modules.js +3 -3
  141. package/dist/core/extensions/loader-virtual-modules.js +1 -1
  142. package/dist/core/extensions/runner-context.js +2 -2
  143. package/dist/core/intercom-broker-control-host.code.js +2 -2
  144. package/dist/core/intercom-broker-control-host.impl.js +3 -3
  145. package/dist/core/intercom-broker-control-host.js +3 -3
  146. package/dist/core/intercom-broker-control.code.js +3 -3
  147. package/dist/core/intercom-broker-control.impl.js +3 -3
  148. package/dist/core/intercom-broker-control.js +3 -3
  149. package/dist/core/package-manager-storage-adapters.code.js +1 -1
  150. package/dist/core/package-manager-storage-adapters.impl.js +3 -3
  151. package/dist/core/package-manager-storage-adapters.js +3 -3
  152. package/dist/core/process-start-token.d.ts +12 -3
  153. package/dist/core/process-tree-containment.d.ts +16 -0
  154. package/dist/core/sdk-types.d.ts +1 -2
  155. package/dist/core/sdk-types.js.map +1 -1
  156. package/dist/core/sdk.code.js +3 -3
  157. package/dist/core/sdk.impl.js +3 -3
  158. package/dist/core/sdk.js +3 -3
  159. package/dist/core/session-manager-core.js +5 -5
  160. package/dist/core/session-manager-list.impl.js +3 -3
  161. package/dist/core/session-manager-list.js +3 -3
  162. package/dist/core/session-manager.code.js +1 -1
  163. package/dist/core/session-manager.impl.js +3 -3
  164. package/dist/core/session-manager.js +3 -3
  165. package/dist/core/session-storage.code.js +1 -1
  166. package/dist/core/session-storage.impl.js +3 -3
  167. package/dist/core/session-storage.js +3 -3
  168. package/dist/core/settings-schema.d.ts +0 -3
  169. package/dist/core/storage/added-exports-0-10-11.js +19 -0
  170. package/dist/core/storage/added-exports-0-10-11.js.map +1 -0
  171. package/dist/core/storage/creation-time.js +105 -0
  172. package/dist/core/storage/creation-time.js.map +1 -0
  173. package/dist/core/storage/database.d.ts +25 -5
  174. package/dist/core/storage/database.js.map +1 -1
  175. package/dist/core/storage/dialect.d.ts +1 -1
  176. package/dist/core/storage/dialect.js +1 -1
  177. package/dist/core/storage/dialect.js.map +1 -1
  178. package/dist/core/storage/errors.d.ts +13 -13
  179. package/dist/core/storage/errors.js +10 -16
  180. package/dist/core/storage/errors.js.map +1 -1
  181. package/dist/core/storage/fenced-paths.d.ts +18 -6
  182. package/dist/core/storage/fenced-paths.js +18 -6
  183. package/dist/core/storage/fenced-paths.js.map +1 -1
  184. package/dist/core/storage/file-identity.d.ts +2 -0
  185. package/dist/core/storage/file-identity.js +24 -8
  186. package/dist/core/storage/file-identity.js.map +1 -1
  187. package/dist/core/storage/index.d.ts +3 -2
  188. package/dist/core/storage/index.js +5 -3
  189. package/dist/core/storage/index.js.map +1 -1
  190. package/dist/core/storage/libsql-removed.d.ts +71 -0
  191. package/dist/core/storage/libsql-removed.js +123 -0
  192. package/dist/core/storage/libsql-removed.js.map +1 -0
  193. package/dist/core/storage/migrations.d.ts +78 -14
  194. package/dist/core/storage/migrations.js +375 -49
  195. package/dist/core/storage/migrations.js.map +1 -1
  196. package/dist/core/storage/node-sqlite-file-gate.js +0 -15
  197. package/dist/core/storage/node-sqlite-file-gate.js.map +1 -1
  198. package/dist/core/storage/node-sqlite-thread.js +215 -30
  199. package/dist/core/storage/node-sqlite-thread.js.map +1 -1
  200. package/dist/core/storage/node-sqlite.js +484 -72
  201. package/dist/core/storage/node-sqlite.js.map +1 -1
  202. package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
  203. package/dist/core/storage/offline-snapshot-file.js +3 -3
  204. package/dist/core/storage/prefix.d.ts +1 -1
  205. package/dist/core/storage/prefix.js +9 -2
  206. package/dist/core/storage/prefix.js.map +1 -1
  207. package/dist/core/storage/process-selection.d.ts +5 -5
  208. package/dist/core/storage/provider.js +2 -2
  209. package/dist/core/storage/schema-catalog.d.ts +76 -15
  210. package/dist/core/storage/schema-catalog.js +359 -68
  211. package/dist/core/storage/schema-catalog.js.map +1 -1
  212. package/dist/core/storage/selection.d.ts +7 -82
  213. package/dist/core/storage/selection.js +20 -235
  214. package/dist/core/storage/selection.js.map +1 -1
  215. package/dist/core/storage/session/branch-fork-source.code.js +2 -2
  216. package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
  217. package/dist/core/storage/session/branch-fork-source.js +3 -3
  218. package/dist/core/storage/session/card-view.impl.js +3 -3
  219. package/dist/core/storage/session/card-view.js +3 -3
  220. package/dist/core/storage/session/child-reader.code.js +3 -3
  221. package/dist/core/storage/session/child-reader.impl.js +3 -3
  222. package/dist/core/storage/session/child-reader.js +3 -3
  223. package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
  224. package/dist/core/storage/session/chunked-resume-projection.js +3 -3
  225. package/dist/core/storage/session/expanded-child-details.code.js +2 -2
  226. package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
  227. package/dist/core/storage/session/expanded-child-details.js +3 -3
  228. package/dist/core/storage/session/fork-detach.d.ts +11 -1
  229. package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
  230. package/dist/core/storage/session/fork-row-bytes.js +3 -3
  231. package/dist/core/storage/session/fork-row-index.impl.js +3 -3
  232. package/dist/core/storage/session/fork-row-index.js +3 -3
  233. package/dist/core/storage/session/fork-staging.code.js +4 -7
  234. package/dist/core/storage/session/fork-staging.code.js.map +1 -1
  235. package/dist/core/storage/session/fork-staging.impl.js +3 -3
  236. package/dist/core/storage/session/fork-staging.js +3 -3
  237. package/dist/core/storage/session/fork-sweep.js +31 -7
  238. package/dist/core/storage/session/fork-sweep.js.map +1 -1
  239. package/dist/core/storage/session/fork-window.code.js +3 -3
  240. package/dist/core/storage/session/fork-window.impl.js +3 -3
  241. package/dist/core/storage/session/fork-window.js +3 -3
  242. package/dist/core/storage/session/history-pages.impl.js +3 -3
  243. package/dist/core/storage/session/history-pages.js +3 -3
  244. package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
  245. package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
  246. package/dist/core/storage/session/jsonl-session-lock.d.ts +100 -0
  247. package/dist/core/storage/session/jsonl-session-store.d.ts +46 -24
  248. package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
  249. package/dist/core/storage/session/jsonl-session-store.js +3 -3
  250. package/dist/core/storage/session/memory-session-store.impl.js +3 -3
  251. package/dist/core/storage/session/memory-session-store.js +3 -3
  252. package/dist/core/storage/session/pinned-branch-resume.code.js +3 -3
  253. package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
  254. package/dist/core/storage/session/pinned-branch-resume.js +3 -3
  255. package/dist/core/storage/session/released-history-files.code.js +9 -9
  256. package/dist/core/storage/session/released-history-files.code.js.map +1 -1
  257. package/dist/core/storage/session/released-history-files.impl.js +3 -3
  258. package/dist/core/storage/session/released-history-files.js +3 -3
  259. package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
  260. package/dist/core/storage/session/resident-fork-rows.js +3 -3
  261. package/dist/core/storage/session/session-resume.impl.js +3 -3
  262. package/dist/core/storage/session/session-resume.js +3 -3
  263. package/dist/core/storage/session/session-search-index.d.ts +52 -5
  264. package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
  265. package/dist/core/storage/session/snapshot-cut.js +3 -3
  266. package/dist/core/storage/session/snapshot-history.code.js +3 -3
  267. package/dist/core/storage/session/snapshot-history.impl.js +3 -3
  268. package/dist/core/storage/session/snapshot-history.js +3 -3
  269. package/dist/core/storage/session/sql-session-store.code.js +1 -1
  270. package/dist/core/storage/session/sql-session-store.d.ts +99 -18
  271. package/dist/core/storage/session/sql-session-store.impl.js +3 -3
  272. package/dist/core/storage/session/sql-session-store.js +3 -3
  273. package/dist/core/storage/session/tree-outline.impl.js +3 -3
  274. package/dist/core/storage/session/tree-outline.js +3 -3
  275. package/dist/core/storage/session/tree-presentation.impl.js +3 -3
  276. package/dist/core/storage/session/tree-presentation.js +3 -3
  277. package/dist/core/storage/sqlite-facade.d.ts +12 -1
  278. package/dist/core/storage/sqlite-facade.js +310 -33
  279. package/dist/core/storage/sqlite-facade.js.map +1 -1
  280. package/dist/core/storage/sqlite-open-batch.js +10 -0
  281. package/dist/core/storage/sqlite-open-batch.js.map +1 -0
  282. package/dist/core/storage/storage-status.code.js +1 -1
  283. package/dist/core/storage/storage-status.impl.js +3 -3
  284. package/dist/core/storage/storage-status.js +3 -3
  285. package/dist/core/storage/team.code.js +1 -1
  286. package/dist/core/storage/team.d.ts +26 -115
  287. package/dist/core/storage/team.impl.js +3 -3
  288. package/dist/core/storage/team.js +3 -3
  289. package/dist/core/structured-output/index.code.js +1 -1
  290. package/dist/core/structured-output/index.impl.js +3 -3
  291. package/dist/core/structured-output/index.js +3 -3
  292. package/dist/core/tasks/task-completion-entry.impl.js +3 -3
  293. package/dist/core/tasks/task-completion-entry.js +3 -3
  294. package/dist/core/tasks/task-file-history.code.js +3 -3
  295. package/dist/core/tasks/task-file-history.impl.js +3 -3
  296. package/dist/core/tasks/task-file-history.js +3 -3
  297. package/dist/core/tasks/task-reference-archive.code.js +4 -4
  298. package/dist/core/tasks/task-reference-archive.js +3 -3
  299. package/dist/core/tasks/task-reference-identity.js +3 -3
  300. package/dist/core/tasks/task-reference-stream.impl.js +3 -3
  301. package/dist/core/tasks/task-reference-stream.js +3 -3
  302. package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
  303. package/dist/core/tasks/task-unsaved-answer.js +3 -3
  304. package/dist/core/tasks/task-view-source.code.js +1 -1
  305. package/dist/core/tasks/task-view-source.impl.js +3 -3
  306. package/dist/core/tasks/task-view-source.js +3 -3
  307. package/dist/core/tools/history-tasks.d.ts +3 -2
  308. package/dist/core/tools/read-url.code.js +4 -4
  309. package/dist/core/tools/read-url.impl.js +3 -3
  310. package/dist/core/tools/read-url.js +3 -3
  311. package/dist/core/worktree-snapshot/blob-store.d.ts +44 -5
  312. package/dist/core/worktree-snapshot/blob-store.js +553 -30
  313. package/dist/core/worktree-snapshot/blob-store.js.map +1 -1
  314. package/dist/core/worktree-snapshot/errors.code.js +2 -2
  315. package/dist/core/worktree-snapshot/errors.impl.js +3 -3
  316. package/dist/core/worktree-snapshot/errors.js +3 -3
  317. package/dist/core/worktree-snapshot/fork-blob-guard.js +81 -0
  318. package/dist/core/worktree-snapshot/fork-blob-guard.js.map +1 -0
  319. package/dist/core/worktree-snapshot/fork-snapshot-index.js +208 -50
  320. package/dist/core/worktree-snapshot/fork-snapshot-index.js.map +1 -1
  321. package/dist/core/worktree-snapshot/session-index-reset.code.js +4 -0
  322. package/dist/core/worktree-snapshot/session-index-reset.code.js.map +1 -1
  323. package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
  324. package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
  325. package/dist/extensions/codemode/execute.code.js +1 -1
  326. package/dist/extensions/codemode/execute.impl.js +3 -3
  327. package/dist/extensions/codemode/execute.js +3 -3
  328. package/dist/extensions/codemode/renderer.code.js +2 -2
  329. package/dist/extensions/codemode/renderer.impl.js +3 -3
  330. package/dist/extensions/codemode/renderer.js +3 -3
  331. package/dist/extensions/mcp/cli.code.js +3 -3
  332. package/dist/extensions/mcp/cli.impl.js +3 -3
  333. package/dist/extensions/mcp/cli.js +3 -3
  334. package/dist/extensions/mcp/cli.lazy.code.js +2 -2
  335. package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
  336. package/dist/extensions/mcp/cli.lazy.js +3 -3
  337. package/dist/extensions/mcp/runtime.code.js +1 -1
  338. package/dist/extensions/mcp/runtime.impl.js +3 -3
  339. package/dist/extensions/mcp/runtime.js +3 -3
  340. package/dist/index.d.ts +3 -1
  341. package/dist/index.js +5 -5
  342. package/dist/main-first-time-setup.code.js +1 -1
  343. package/dist/main-first-time-setup.impl.js +3 -3
  344. package/dist/main-first-time-setup.js +3 -3
  345. package/dist/main.js +1 -1
  346. package/dist/modes/interactive/components/stored-tree-view.code.js +2 -2
  347. package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
  348. package/dist/modes/interactive/components/stored-tree-view.js +3 -3
  349. package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
  350. package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
  351. package/dist/modes/interactive/startup-shell-eligibility.js +1 -1
  352. package/dist/modes/interactive-engine/engine-prewarm.d.ts +1 -1
  353. package/dist/modes/print-mode.js +1 -1
  354. package/dist/package-manager-cli.code.js +6 -6
  355. package/dist/package-manager-cli.impl.js +3 -3
  356. package/dist/package-manager-cli.js +3 -3
  357. package/dist/rpc-entry.js +1 -1
  358. package/dist/startup-files.json +1 -1
  359. package/dist/startup-stages/10.js +1 -1
  360. package/dist/startup-stages/11.js +1 -1
  361. package/dist/startup-stages/12.js +1 -1
  362. package/dist/startup-stages/2.js +2 -4
  363. package/dist/startup-stages/3.js +1 -3
  364. package/dist/startup-stages/4.js +1 -2
  365. package/dist/startup-stages/5.js +1 -1
  366. package/dist/startup-stages/6.js +5 -7
  367. package/dist/startup-stages/7.js +3 -10
  368. package/dist/startup-stages/8.js +7 -2
  369. package/dist/startup-stages/9.js +1 -7
  370. package/dist/startup-stages/stages.json +1 -1
  371. package/dist/utils/compile-cache-deferral.js +8 -13
  372. package/dist/utils/compile-cache-deferral.js.map +1 -1
  373. package/dist/utils/compile-cache-warmup-host.js +3 -4
  374. package/dist/utils/compile-cache-warmup-host.js.map +1 -1
  375. package/dist/utils/compile-cache.js +12 -100
  376. package/dist/utils/compile-cache.js.map +1 -1
  377. package/dist/utils/startup-database-spare.code.js +2 -2
  378. package/dist/utils/startup-database-spare.impl.js +3 -3
  379. package/dist/utils/startup-database-spare.js +3 -3
  380. package/dist/utils/tools-manager.code.js +1 -1
  381. package/dist/utils/tools-manager.impl.js +3 -3
  382. package/dist/utils/tools-manager.js +3 -3
  383. package/dist/utils/worker-threads.js +2 -15
  384. package/dist/utils/worker-threads.js.map +1 -1
  385. package/docs/build.md +3 -3
  386. package/docs/changelog.mdx +1470 -69
  387. package/docs/compaction/reference.md +5 -5
  388. package/docs/compaction.md +7 -9
  389. package/docs/containerization.md +2 -2
  390. package/docs/custom-provider/api-reference.md +1 -1
  391. package/docs/docs.json +37 -10
  392. package/docs/environment-variables.md +0 -2
  393. package/docs/extensions/api-reference.md +4 -4
  394. package/docs/getting-started/installation.md +3 -0
  395. package/docs/guides/configuration.md +1 -1
  396. package/docs/guides/non-interactive.md +1 -1
  397. package/docs/guides/resume-on-any-machine.md +14 -22
  398. package/docs/guides/team-setup.md +56 -83
  399. package/docs/guides.md +2 -4
  400. package/docs/herdr.md +1 -1
  401. package/docs/index.md +1 -1
  402. package/docs/intercom/operations.md +26 -21
  403. package/docs/intercom/reference.md +2 -2
  404. package/docs/intercom.md +1 -1
  405. package/docs/libraries/storage-postgres.md +9 -9
  406. package/docs/libraries.md +2 -3
  407. package/docs/models-configuration.md +2 -2
  408. package/docs/models.md +2 -3
  409. package/docs/packages/authoring.md +7 -7
  410. package/docs/packages.md +1 -1
  411. package/docs/programmatic.md +2 -2
  412. package/docs/quickstart.md +1 -1
  413. package/docs/reference/cli.md +6 -11
  414. package/docs/reference.md +2 -2
  415. package/docs/rpc/extension-ui.md +2 -2
  416. package/docs/sdk/reference.md +5 -4
  417. package/docs/sdk/storage.md +8 -92
  418. package/docs/sdk/structured-decisions.md +1 -1
  419. package/docs/sdk/web-server.md +3 -3
  420. package/docs/sdk.md +14 -4
  421. package/docs/security.md +1 -1
  422. package/docs/session-format.md +5 -5
  423. package/docs/sessions.md +29 -49
  424. package/docs/settings.md +7 -8
  425. package/docs/storage/custom-adapters.md +255 -0
  426. package/docs/storage/jsonl.md +117 -0
  427. package/docs/{guides/postgres-pgbouncer.md → storage/postgres/pgbouncer.md} +66 -68
  428. package/docs/storage/postgres/tuning.md +337 -0
  429. package/docs/storage/postgres.md +556 -0
  430. package/docs/storage/sqlite.md +99 -0
  431. package/docs/storage.md +326 -990
  432. package/docs/subagents/authoring.md +1 -1
  433. package/docs/subagents.md +2 -2
  434. package/docs/tools.md +1 -1
  435. package/docs/worktree-snapshots.md +2 -2
  436. package/package.json +9 -9
  437. package/schemas/models.schema.json +2 -2
  438. package/schemas/settings.schema.json +0 -14
  439. package/dist/_shared/p1b-elig-ENCUPKKJ.js.map +0 -1
  440. package/dist/_shared/sdk-IQMULKFU.js.map +0 -1
  441. package/dist/_shared/startup-0-0-3IXNMFM2.js.map +0 -1
  442. package/dist/_shared/startup-0-1-7T2IAE7J.js.map +0 -1
  443. package/dist/_shared/startup-8-1-X32CYSXB.js.map +0 -1
  444. package/dist/core/intercom-broker-control.d.ts +0 -129
  445. package/dist/startup-stages/13.js +0 -1
  446. package/docs/guides/postgres-tuning.md +0 -311
  447. package/docs/libraries/storage-libsql.md +0 -97
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  title: "Set up teams and CI"
3
3
  sidebarTitle: "Team and CI setup"
4
- description: "Share Intercom across a team while keeping personal sessions local, and configure CI runners with environment variables."
4
+ description: "Share Intercom across a team through PostgreSQL while keeping personal sessions local, and configure CI runners with environment variables."
5
5
  ---
6
6
 
7
- Share one libSQL or Turso database across machines so teammates can message each other over Intercom while keeping their personal sessions local. CI runners can point both sessions and Intercom at the same database using environment variables alone, so teammates can inspect and resume CI runs.
7
+ Share one PostgreSQL database across machines so teammates can message each other over Intercom while keeping their personal sessions local. CI runners can point both sessions and Intercom at the same database with one environment variable, so teammates can inspect and resume CI runs.
8
8
 
9
- To share both sessions and Intercom across machines, or to use PostgreSQL instead of libSQL, follow the [Storage backends](/storage) guide and use `atomic storage join`.
9
+ > Atomic 0.10.11 removed libSQL and Turso support, together with `atomic team join`, `atomic team leave`, and the `ATOMIC_PROFILE=ci` variables. To move sessions off libSQL, see [Moving off libSQL](/storage#moving-off-libsql).
10
10
 
11
11
  | Scope | Sessions | Intercom |
12
12
  | --- | --- | --- |
@@ -21,55 +21,45 @@ Run `atomic team status` to see the active profile:
21
21
  - `ci`: sessions, Intercom, and shared `storage` all use the same shared adapter database (if you ran `atomic storage join` to share sessions across your own laptops, `atomic team status` also reports `ci`).
22
22
  - `custom`: any other combination, such as JSONL sessions, a non-default local SQLite file, a project `storage` override, or different adapters or prefixes between sessions and Intercom.
23
23
 
24
- ## Join a team
25
-
26
- Install the libSQL adapter once per machine, create a database token, and join:
27
-
28
24
  ```bash
29
- atomic install npm:@bastani/atomic-storage-libsql
30
- turso db tokens create <db> > ~/team-token
31
- atomic team join libsql://<db>.turso.io --token-file ~/team-token
25
+ atomic team status # Profile, project group, and storage report
26
+ atomic team status --json # JSON output
32
27
  ```
33
28
 
34
- Command syntax:
29
+ `atomic team status` exits `1` if the selection is invalid, the adapter fails to load, or the database does not answer.
35
30
 
36
- ```bash
37
- atomic team join <url> [--token-file <path>] [--prefix <prefix>]
38
- ```
31
+ ## Join a team
39
32
 
40
- Only `--token-file <path>` is accepted on the command line (there is no `--token` flag) so database tokens do not leak into shell history or process lists.
33
+ Set up the team's PostgreSQL database as described in [PostgreSQL](/storage/postgres), then on each machine install the adapter and join it:
41
34
 
42
- Before writing anything, Atomic validates the URL, token, prefix, global settings, installed adapter, and a `SELECT 1` health check with a 15-second timeout. If any check fails, Atomic changes nothing. When all checks pass, Atomic performs four steps:
35
+ ```bash
36
+ atomic install npm:@bastani/atomic-storage-postgres
37
+ (umask 077; printf 'Runtime password: '; read -rs password; printf '\n'; printf '%s' "$password" > ~/atomic-db-password)
38
+ atomic storage join 'postgresql://atomic_runtime@db.example.com:5432/atomic?sslmode=verify-full' --password-file ~/atomic-db-password
39
+ rm ~/atomic-db-password # atomic storage join keeps its own copy
40
+ ```
43
41
 
44
- 1. Saves the token to a mode-`600` file in your agent directory, reusing that file if you rerun with the same token.
45
- 2. Updates `~/.atomic/agent/settings.json` atomically while leaving all other settings untouched: sets `storage` to the team database and pins `sessions.storage` to `{ "path": "workflows/journal.sqlite" }` so personal transcripts stay local (printing a notice if this replaces another store). Atomic also writes a `teamJoin` marker used by `atomic team leave`; leave it unchanged.
46
- 3. Restarts the Intercom broker so it routes through the team database.
47
- 4. Prints the active profile, the current project's Intercom group, and the `atomic storage status` report.
42
+ `atomic storage join` checks the URL, the password, the installed adapter, and a `SELECT 1` within 15 seconds before it writes anything, then sets the global `storage` setting to the team database. See [Joining a machine to a shared database](/storage#joining-a-machine-to-a-shared-database) for every option, including `--token-file`, `--auth azure|aws|gcp`, and `--prefix`.
48
43
 
49
- URL and prefix rules:
44
+ To keep your personal sessions on this machine while Intercom uses the team database, add an empty `sessions.storage` selection to `~/.atomic/agent/settings.json`. It selects the default local SQLite file even though top-level `storage` is shared. Keep the `storage` value that `atomic storage join` wrote, including the name of its password file:
50
45
 
51
- - Supported URLs are `libsql://`, `https://`, `http://`, `wss://`, `ws://`, or an absolute `file:` URL (which needs no token). Prefer TLS (`libsql://`, `https://`, or `wss://`) for remote hosts; `http://` and `ws://` work for local or private-network `sqld`. Atomic refuses URLs that contain an embedded token. See [Joining a machine to a shared database](/storage#joining-a-machine-to-a-shared-database) for full database setup.
52
- - Pass `--prefix` to isolate multiple teams inside one database. Everyone on a team must use the same URL and prefix.
53
- - Sessions that were already running keep their previous Intercom group until they restart or run `/reload`.
46
+ ```json
47
+ {
48
+ "storage": { "adapter": "@bastani/atomic-storage-postgres", "options": { "url": "postgresql://atomic_runtime@db.example.com:5432/atomic?sslmode=verify-full" }, "secrets": { "password": { "file": "agent/storage-token.28ab7041-05e2-4ad5-80af-854329035d8c" } } },
49
+ "sessions": { "storage": {} }
50
+ }
51
+ ```
54
52
 
55
- ### Check status and leave
53
+ Then restart the Intercom broker so it routes through the team database, and check the layout:
56
54
 
57
55
  ```bash
58
- atomic team status # Profile, project group, and storage report
59
- atomic team status --json # JSON output
60
- atomic team leave # Return to the individual layout
56
+ atomic intercom restart
57
+ atomic team status
61
58
  ```
62
59
 
63
- `atomic team status` exits `1` if the selection is invalid, the adapter fails to load, or the database does not answer.
64
-
65
- `atomic team leave` reverses a managed join without overwriting manual changes:
66
-
67
- - Removes `storage` and `teamJoin` only when `storage` still matches the `teamJoin` record. Any manual edit leaves `storage` and its token file intact and reports why.
68
- - Keeps a `storage` entry that has no `teamJoin` record. Run `atomic team join` once to record it before leaving.
69
- - Removes `sessions.storage` only while it holds the local pin and no other `storage` selection remains (including a customized `storage`, a trusted project's `storage`, or a legacy `~/.pi/agent/settings.json` `storage` when using the default agent directory).
70
- - Deletes the managed token file only if no remaining setting references it, then restarts the Intercom broker.
71
- - Refuses to modify settings or delete token files if global or project settings cannot be read. Fix the unreadable file first.
72
- - Running `atomic team leave` again makes no changes.
60
+ - Pass `--prefix` to isolate multiple teams inside one database. Everyone on a team must use the same URL and prefix.
61
+ - Sessions that were already running keep their previous Intercom group until they restart or run `/reload`.
62
+ - To leave the team, remove `storage` and `sessions.storage` from `~/.atomic/agent/settings.json` and run `atomic intercom restart`. The password file that `atomic storage join` wrote, `storage-token.<id>` in the agent directory, can then be deleted.
73
63
 
74
64
  ## Project groups
75
65
 
@@ -81,26 +71,14 @@ For multi-node broker behavior, Git lookup errors, and routing checks, see [Runn
81
71
 
82
72
  ## CI and swarms
83
73
 
84
- > Using PostgreSQL in CI? Configure [`ATOMIC_STORAGE`](/storage#selecting-storage-per-process) instead. `ATOMIC_PROFILE=ci` and `teamProfileSelection()` support libSQL and Turso only.
85
-
86
- CI runners do not need a `settings.json` file. Configure them with environment variables:
74
+ CI runners do not need a `settings.json` file. Select the team database for the whole process with `ATOMIC_STORAGE`, and keep the password in an environment variable the selection names:
87
75
 
88
76
  | Variable | Value |
89
77
  | --- | --- |
90
- | `ATOMIC_PROFILE` | `ci` |
91
- | `ATOMIC_TEAM_URL` | Team libSQL/Turso database URL |
92
- | `ATOMIC_TEAM_TOKEN` or `ATOMIC_TEAM_TOKEN_FILE` | Database token, or an absolute path to a token file (such as under `$RUNNER_TEMP`). Omit only for an absolute `file:` URL. Relative paths are rejected at startup because child processes may run in different working directories. |
93
- | `ATOMIC_TEAM_PREFIX` | Optional prefix matching the team's database prefix |
78
+ | `ATOMIC_STORAGE` | `{"adapter":"@bastani/atomic-storage-postgres","options":{"url":"<team database URL>"},"secrets":{"password":{"env":"ATOMIC_DB_PASSWORD"}}}`, plus `"prefix"` when the team uses one |
79
+ | `ATOMIC_DB_PASSWORD` | The database password, read when a store opens |
94
80
 
95
- With `ATOMIC_PROFILE=ci`, both sessions and Intercom use the team database for this process and every child process it spawns. Atomic writes nothing to settings. It reads the token when opening a store and never copies it into settings, logs, or child storage selections.
96
-
97
- Validation and precedence:
98
-
99
- - Atomic validates these variables at startup before opening a session. Leaving **any** of `ATOMIC_TEAM_URL`, `ATOMIC_TEAM_TOKEN`, `ATOMIC_TEAM_TOKEN_FILE`, or `ATOMIC_TEAM_PREFIX` exported without `ATOMIC_PROFILE=ci` fails startup immediately (`incomplete-profile`), so unset them when not using the CI profile.
100
- - Setting both `ATOMIC_TEAM_TOKEN` and `ATOMIC_TEAM_TOKEN_FILE` fails startup (`conflicting-token`). Empty string values (such as `ATOMIC_TEAM_PREFIX=""`) are treated as unset.
101
- - Unknown profiles, invalid URLs or prefixes, and empty or unreadable token files fail immediately with one error listing everything missing.
102
- - `--storage`, `--storage-file`, and `ATOMIC_STORAGE` override the profile for all stores, including Intercom. Session-specific flags and `ATOMIC_SESSIONS_STORAGE` override only sessions. See [Selecting storage per process](/storage#selecting-storage-per-process) for the full precedence order.
103
- - If the libSQL adapter is not installed, startup fails with the `atomic install` command to run.
81
+ Both sessions and Intercom use the team database for this process and every child process it spawns. Atomic writes nothing to settings, and it reads the password only when opening a store, never copying it into settings, logs, or child storage selections. Atomic validates `ATOMIC_STORAGE` at startup, before it opens a session. See [Selecting storage per process](/storage#selecting-storage-per-process) for the precedence order.
104
82
 
105
83
  ### GitHub Actions
106
84
 
@@ -109,17 +87,16 @@ jobs:
109
87
  agent:
110
88
  runs-on: ubuntu-latest
111
89
  env:
112
- ATOMIC_PROFILE: ci
113
- ATOMIC_TEAM_URL: ${{ vars.ATOMIC_TEAM_URL }}
114
- ATOMIC_TEAM_TOKEN: ${{ secrets.ATOMIC_TEAM_TOKEN }}
90
+ ATOMIC_STORAGE: '{"adapter":"@bastani/atomic-storage-postgres","options":{"url":"${{ vars.ATOMIC_DB_URL }}"},"secrets":{"password":{"env":"ATOMIC_DB_PASSWORD"}}}'
91
+ ATOMIC_DB_PASSWORD: ${{ secrets.ATOMIC_DB_PASSWORD }}
115
92
  steps:
116
93
  - uses: actions/checkout@v5
117
94
  - run: npm install -g @bastani/atomic
118
- - run: atomic install npm:@bastani/atomic-storage-libsql
95
+ - run: atomic install npm:@bastani/atomic-storage-postgres
119
96
  - run: atomic -p "Fix the failing test in the checkout"
120
97
  ```
121
98
 
122
- Store the token in an encrypted secret and expose it only to the step that needs it. Every tool the agent runs in that step inherits the step's environment.
99
+ Store the password in an encrypted secret and expose it only to the step that needs it. Every tool the agent runs in that step inherits the step's environment. On Azure, AWS, or Google Cloud, `"options": { "auth": "azure-entra" }` (or `aws-iam`, `gcp-iam`) signs in with the runner's identity instead of a password. See [PostgreSQL](/storage/postgres).
123
100
 
124
101
  ### Caching between runs
125
102
 
@@ -204,31 +181,23 @@ When the agent job resumes a session, Atomic fetches only the commits missing fr
204
181
 
205
182
  ## From the SDK
206
183
 
207
- `@bastani/atomic/storage` exports async helpers `joinTeam()`, `leaveTeam()`, and `getTeamProfile()`, plus `teamProfileSelection()` (libSQL and Turso only).
208
-
209
- `teamProfileSelection()` returns an adapter selection for `@bastani/atomic-storage-libsql`. Because adapter selections resolve from user-scope packages, host extension directories, or the agent directory rather than an application's `node_modules`, install the adapter with `atomic install npm:@bastani/atomic-storage-libsql` (without `-l`), or register a local package directory with `DefaultResourceLoader({ additionalExtensionPaths })`.
210
-
211
- If you prefer managing `@bastani/atomic-storage-libsql` as an ordinary project dependency with `npm install`, call `openLibsqlDatabase()` directly and pass `sessionStore: { kind: "database", database, prefix? }` to `createAgentSession()`, closing `database` in a `finally` block. See [SDK session storage](/sdk/storage) for complete recipes and ownership rules.
212
-
213
- Use `teamProfileSelection({ profile: "ci", url, token })` to pass a storage selection to `createAgentSession({ storage })` without modifying settings:
214
-
215
- - `token` stays in memory, serializes as `[redacted]`, and cannot be reopened by child processes.
216
- - `tokenEnv` stores `{ env: "<VAR>" }` so child processes can reopen the store, and checks immediately at call time that the named environment variable is set (throwing `missing-token` if unset).
217
- - `tokenFile` resolves relative paths against `cwd` and reads the file immediately to verify it is non-empty.
218
-
219
- Intercom runs one broker per agent directory, so pass the CI environment variables to both the host process and any spawned `atomic` processes:
184
+ `@bastani/atomic/storage` exports `getTeamProfile()`, which reports the layout in effect the way `atomic team status` does. To give an embedded agent the team database, pass a storage selection to `createAgentSession({ storage })` and keep the password in memory with `inMemorySecret()`:
220
185
 
221
186
  ```typescript
222
187
  import { spawn } from "node:child_process";
223
188
  import { createAgentSession } from "@bastani/atomic";
224
- import { teamProfileSelection } from "@bastani/atomic/storage";
189
+ import { inMemorySecret } from "@bastani/atomic/storage";
225
190
 
226
191
  const url = process.env.TEAM_DATABASE_URL!;
227
- const token = process.env.TEAM_DATABASE_TOKEN!;
192
+ const password = process.env.TEAM_DATABASE_PASSWORD!;
228
193
 
229
- // Embedded SDK agent: sessions use the team database (requires `atomic install npm:@bastani/atomic-storage-libsql`
194
+ // Embedded SDK agent: sessions use the team database (requires `atomic install npm:@bastani/atomic-storage-postgres`
230
195
  // or `DefaultResourceLoader({ additionalExtensionPaths })`).
231
- const storage = teamProfileSelection({ profile: "ci", url, token });
196
+ const storage = {
197
+ adapter: "@bastani/atomic-storage-postgres",
198
+ options: { url },
199
+ secrets: { password: inMemorySecret(password) },
200
+ };
232
201
  const { session } = await createAgentSession({ storage });
233
202
  try {
234
203
  await session.prompt("Summarize the failing tests");
@@ -238,25 +207,29 @@ try {
238
207
 
239
208
  // Spawned agent process: sessions and Intercom both use the team database.
240
209
  const child = spawn("atomic", ["-p", "Fix the failing test"], {
241
- env: { ...process.env, ATOMIC_PROFILE: "ci", ATOMIC_TEAM_URL: url, ATOMIC_TEAM_TOKEN: token },
210
+ env: {
211
+ ...process.env,
212
+ ATOMIC_STORAGE: JSON.stringify({ adapter: "@bastani/atomic-storage-postgres", options: { url }, secrets: { password: { env: "ATOMIC_DB_PASSWORD" } } }),
213
+ ATOMIC_DB_PASSWORD: password,
214
+ },
242
215
  stdio: "inherit",
243
216
  });
244
217
  ```
245
218
 
246
- See [Team setup errors](/storage#team-setup-errors) for the typed errors these functions throw.
219
+ An in-memory password serializes as `[redacted]`, so child processes cannot reopen the store with it: give them an `{ "env": "<VAR>" }` reference instead, as above. See [SDK session storage](/sdk/storage) for complete recipes and ownership rules, and [Team setup errors](/storage#team-setup-errors) for the typed errors.
247
220
 
248
221
  ## Security
249
222
 
250
223
  Anyone with read access to the team database can read everything stored in it, including CI sessions and Intercom messages until shortly after delivery.
251
224
 
252
- - Give each team its own database and treat database access as full read access.
253
- - With Turso, issue per-database tokens (`turso db tokens create <db>`), set `--expiration` on CI tokens, and rotate access when someone leaves with `turso db tokens invalidate <db>` (Turso cannot revoke a single token).
254
- - In the team profile, personal sessions stay off the shared database only because `sessions.storage` is pinned locally. Share sessions intentionally with `/share` or `atomic storage export` and `atomic storage import`.
225
+ - Give each team its own database, or its own prefix, and treat database access as full read access.
226
+ - Give machines and CI runners a runtime role with only the privileges Atomic needs, rotate its password when someone leaves, and prefer platform identities (`--auth`) where your cloud supports them. See [PostgreSQL](/storage/postgres).
227
+ - In the team layout, personal sessions stay off the shared database only because `sessions.storage` selects the local store. Share sessions intentionally with `/share` or `atomic storage export` and `atomic storage import`.
255
228
 
256
229
  ## Related
257
230
 
258
- - [Storage backends](/storage) for storage setup, selections, precedence, and error reference.
259
- - [SDK session storage](/sdk/storage) for Node.js and TypeScript storage recipes, `openLibsqlDatabase()`, and store ownership rules.
231
+ - [Storage](/storage) for storage setup, selections, precedence, and error reference.
232
+ - [SDK session storage](/sdk/storage) for Node.js and TypeScript storage recipes and store ownership rules.
260
233
  - [Resume sessions on any machine](/guides/resume-on-any-machine) for cross-machine worktree snapshots and environment blueprints.
261
234
  - [Running Intercom across machines](/intercom/operations#running-intercom-across-machines) for multi-node broker details.
262
235
  - [Intercom groups](/intercom/reference#groups) for how groups isolate sessions.
package/docs/guides.md CHANGED
@@ -14,7 +14,7 @@ New to Atomic? Follow the [Quickstart](/quickstart) to install, authenticate, ru
14
14
  - **[Sessions](/sessions).** Save, resume, name, search, and branch sessions.
15
15
  - **[Worktree snapshots](/worktree-snapshots).** Capture and restore repository state alongside your session history.
16
16
  - **[Resume on any machine and blueprints](/guides/resume-on-any-machine).** Continue a session on another machine that shares your storage, and automate dependency rebuilds with [`.atomic/blueprint.yaml` blueprints](/guides/resume-on-any-machine#set-the-environment-up-with-a-blueprint).
17
- - **[Storage backends](/storage).** Choose local SQLite, PostgreSQL, or Turso/libSQL, run migrations, and export or import sessions. For programmatic apps, see [SDK storage backends](/sdk/storage).
17
+ - **[Storage](/storage).** Choose where sessions are kept: a [local SQLite](/storage/sqlite) file, [JSONL files](/storage/jsonl), or a [PostgreSQL](/storage/postgres) database that several machines share. Move sessions between stores with export and import. To run many agents on PostgreSQL, see [PgBouncer](/storage/postgres/pgbouncer) and [server tuning](/storage/postgres/tuning). For apps built on the SDK, see [SDK session storage](/sdk/storage).
18
18
  - **[Context and compaction](/compaction).** Keep long sessions inside the model's context window, or plug in a [custom remote compactor](/compaction#customize-morph-or-add-a-remote-compactor).
19
19
  - **[MCP servers](/mcp-servers).** Connect external tools and data sources over Model Context Protocol.
20
20
 
@@ -24,9 +24,7 @@ New to Atomic? Follow the [Quickstart](/quickstart) to install, authenticate, ru
24
24
  - **[Subagents](/guides/subagents).** Delegate independent tasks to fresh or forked subagents in the background (see the full [Subagents guide](/subagents)).
25
25
  - **[Background tasks](/background-tasks).** Launch, inspect, steer, and stop background subagents and shells.
26
26
  - **[Intercom](/guides/intercom).** Coordinate live sessions and subagents on one machine or across a shared database (see the full [Intercom guide](/intercom)).
27
- - **[Team and CI setup](/guides/team-setup).** Share Intercom with a team through one database while sessions stay private, and configure CI runners from environment variables.
28
- - **[PostgreSQL with PgBouncer](/guides/postgres-pgbouncer).** Run many agents on one PostgreSQL server by putting PgBouncer in front of it.
29
- - **[Tune PostgreSQL](/guides/postgres-tuning).** Tune the PostgreSQL server that many agents share: distance, connections, memory, monitoring, and busy tables.
27
+ - **[Team and CI setup](/guides/team-setup).** Share Intercom with a team through one PostgreSQL database while sessions stay private, and configure CI runners.
30
28
  - **[Structured decisions](/sdk/structured-decisions).** Make typed classifier or chat decisions with `decide()` and `generateStructuredOutput()`.
31
29
  - **[Computer use](/computer-use).** Automate desktop apps, browsers, and terminals across macOS, Linux, and Windows.
32
30
  - **[Verification](/verification).** Reproduce bugs and collect verifiable evidence across terminal, browser, and desktop environments.
package/docs/herdr.md CHANGED
@@ -36,7 +36,7 @@ With Herdr 0.9.2 or newer, Atomic also reports a resume command so Herdr can reo
36
36
 
37
37
  - **Local SQLite sessions (default):** Atomic reports `atomic --session-store <path> --session <id>` (plus `--session-prefix <prefix>` when a table prefix is configured).
38
38
  - **JSONL directory sessions:** Atomic reports `atomic --session-dir <dir> --session <id>`. Session IDs ending in `.jsonl` still use `--session <id>`.
39
- - **Other persisted stores (such as remote libSQL or PostgreSQL):** Atomic reports `atomic --session <id>`.
39
+ - **Other persisted stores (such as PostgreSQL):** Atomic reports `atomic --session <id>`.
40
40
  - **Switching sessions:** Running `/new`, `/resume`, `/fork`, or `/clone` updates the pane to the new session's ID and resume command.
41
41
  - **Unsaved sessions:** Sessions started with `--no-session` report status without a resume command. For a brand-new persisted session, Atomic reports the resume command right away, though reopening succeeds only after the session's first entry is saved to storage.
42
42
  - **Quit vs. stop signals:** Quitting Atomic yourself (`Ctrl+D`, `Ctrl+C` twice, `/quit`, or `/exit`) clears the resume command so Herdr does not reopen the pane. When Herdr or the OS stops Atomic with `SIGTERM`, `SIGHUP`, or a Windows console close or sign-out, the resume command stays registered for restore.
package/docs/index.md CHANGED
@@ -51,7 +51,7 @@ Authenticate with `/login`, run `atomic auth login <provider>` in your shell, or
51
51
 
52
52
  ## Explore by capability
53
53
 
54
- - **Sessions, snapshots, and resume:** Save and branch in [Sessions](/sessions), capture repository state with [Worktree snapshots](/worktree-snapshots), resume across machines with [Environment blueprints](/guides/resume-on-any-machine#set-the-environment-up-with-a-blueprint), and share state over PostgreSQL or Turso/libSQL in [Storage backends](/storage).
54
+ - **Sessions, snapshots, and resume:** Save and branch in [Sessions](/sessions), capture repository state with [Worktree snapshots](/worktree-snapshots), resume across machines with [Environment blueprints](/guides/resume-on-any-machine#set-the-environment-up-with-a-blueprint), and share state over PostgreSQL in [Storage](/storage).
55
55
  - **Multi-agent work:** Delegate focused tasks with [Subagents](/subagents), coordinate live sessions with [Intercom](/intercom), and script multi-step checks with [Orchestration](/orchestration).
56
56
  - **Tools and context:** Connect external tools through [MCP servers](/mcp-servers), keep long runs within budget with [Compaction and custom compactors](/compaction#customize-morph-or-add-a-remote-compactor), and inspect terminal integrations like [Herdr](/herdr).
57
57
  - **Embed and extend:** Drive Atomic from Node.js with the [TypeScript SDK](/sdk), [SDK storage backends](/sdk/storage), [Structured decisions (`decide()`)](/sdk/structured-decisions), [RPC mode](/rpc), and [Standalone libraries](/libraries).
@@ -120,35 +120,40 @@ By default, each machine's broker serves only sessions on that machine. With mul
120
120
 
121
121
  ### Turning it on
122
122
 
123
- For a team, run `atomic team join <url> --token-file <path>` to configure the team database for Intercom while keeping session transcripts local and restarting the broker. CI runners use `ATOMIC_PROFILE=ci` instead. See [Team and CI setup](/guides/team-setup).
123
+ Point every machine at the same [PostgreSQL](/storage/postgres) database, with the same `prefix`:
124
124
 
125
- To configure multi-node routing with a shared database for both sessions and Intercom, install either `@bastani/atomic-storage-libsql` ([Turso and libSQL](/storage#turso-and-libsql), [libSQL adapter library](/libraries/storage-libsql)) or `@bastani/atomic-storage-postgres` ([PostgreSQL](/storage#postgresql), [PostgreSQL adapter library](/libraries/storage-postgres)) on every machine and run `atomic storage join`. See [Sharing storage across hosts](/storage#sharing-storage-across-hosts) and [Storage and Intercom CLI commands](/reference/cli#storage-and-intercom-commands) for all flags and options.
125
+ 1. Set up the database once, as in [Set up the database](/storage/postgres#set-up-the-database). With a prefix, as below, pass the same `--prefix` to `atomic storage migrate`.
126
+ 2. On every machine, install the PostgreSQL adapter, save the runtime role's password in a file, join the database, and restart the broker:
126
127
 
127
- ```bash
128
- # Turso / libSQL
129
- atomic install npm:@bastani/atomic-storage-libsql
130
- atomic storage join libsql://<db>.turso.io --token-file ~/turso-token --prefix team_
131
- atomic intercom restart
128
+ ```bash
129
+ atomic install npm:@bastani/atomic-storage-postgres
130
+ (umask 077; printf 'Runtime password: '; read -rs password; printf '\n'; printf '%s' "$password" > ~/atomic-db-password)
131
+ atomic storage join 'postgresql://atomic_runtime@db.example.com:5432/atomic' --password-file ~/atomic-db-password --prefix team_
132
+ rm ~/atomic-db-password # atomic storage join keeps its own copy
133
+ atomic intercom restart
134
+ ```
132
135
 
133
- # PostgreSQL
134
- atomic install npm:@bastani/atomic-storage-postgres
135
- atomic storage join postgres://atomic@db.example.com:5432/atomic?sslmode=verify-full --password-file ~/pg-password --prefix team_
136
- atomic intercom restart
136
+ `atomic storage join` sets the top-level `storage` setting, which shares sessions too. To share Intercom but keep each machine's sessions local, as [Team and CI setup](/guides/team-setup) describes, also set `sessions.storage` to `{}` in `~/.atomic/agent/settings.json`, which keeps sessions in the default local SQLite file:
137
+
138
+ ```json
139
+ { "sessions": { "storage": {} } }
137
140
  ```
138
141
 
139
- You can also give every machine the same top-level `storage` selection and `prefix` manually, using any database-backed [storage adapter](/storage#selecting-an-adapter) installed as an [Atomic package](/storage#adapters-from-atomic-packages). Both npm installations and standalone binaries support multi-node routing.
142
+ See [Sharing storage across hosts](/storage#sharing-storage-across-hosts) and [Storage and Intercom CLI commands](/reference/cli#storage-and-intercom-commands) for every option. Any database-backed [custom adapter](/storage/custom-adapters#selecting-an-adapter) works too, if every machine uses the same `storage` setting and `prefix`. Both npm installs and standalone binaries support multi-node routing.
143
+
144
+ The broker takes its store from:
140
145
 
141
- The broker reads its storage selection from:
146
+ 1. The process that starts it: `--storage`, `--storage-file`, or `ATOMIC_STORAGE`. See [Selecting storage per process](/storage#selecting-storage-per-process).
147
+ 2. Otherwise, the top-level `storage` setting in `~/.atomic/agent/settings.json`, or in the agent directory that `ATOMIC_CODING_AGENT_DIR` names.
142
148
 
143
- 1. Process overrides on the Atomic process that spawns the broker: `--storage`, `--storage-file`, `ATOMIC_STORAGE`, or `ATOMIC_PROFILE=ci` ([Selecting storage per process](/storage#selecting-storage-per-process)).
144
- 2. Otherwise, the top-level `storage` block in `~/.atomic/agent/settings.json` (or under `ATOMIC_CODING_AGENT_DIR`).
149
+ For example, a setting that reads the password from an environment variable:
145
150
 
146
151
  ```json
147
152
  {
148
153
  "storage": {
149
- "adapter": "@bastani/atomic-storage-libsql",
150
- "options": { "url": "libsql://<db>.turso.io" },
151
- "secrets": { "authToken": { "env": "TURSO_TOKEN" } },
154
+ "adapter": "@bastani/atomic-storage-postgres",
155
+ "options": { "url": "postgresql://atomic_runtime@db.example.com:5432/atomic" },
156
+ "secrets": { "password": { "env": "ATOMIC_DB_PASSWORD" } },
152
157
  "prefix": "team_"
153
158
  }
154
159
  }
@@ -177,7 +182,7 @@ How the project group name is derived:
177
182
 
178
183
  Explicit groups take precedence over the project group: an inherited subagent group, an SDK host policy, `ATOMIC_INTERCOM_GROUP`, or `group` in `config.json`. Joining `default` explicitly while multi-node routing is on prints a warning (in the UI or once on stderr for non-interactive runs) because every teammate sharing the database can message `default`. Running sessions keep their current group until restarted or reloaded.
179
184
 
180
- Before registering, each session verifies the running broker's routing mode so a session never accidentally joins `default` on a multi-node broker or runs locally when shared storage was requested. If the running broker's storage disagrees with the session (for example after switching `storage` or `ATOMIC_PROFILE=ci`), run `atomic intercom restart` and restart the session. For `ProjectGroupError` and the `IntercomRouting*Error` classes (`IntercomRoutingMismatchError`, `IntercomRoutingUnavailableError`, `IntercomRoutingTimeoutError`, `IntercomRoutingChangedError`), see [Routing and project-group errors](/intercom/reference#routing-and-project-group-errors).
185
+ Before registering, each session checks the running broker's routing mode, so a session never joins `default` on a multi-node broker by accident, or runs locally when it asked for shared storage. If the running broker's store differs from the session's, for example after you change `storage`, run `atomic intercom restart` and restart the session. For `ProjectGroupError` and the `IntercomRouting*Error` classes (`IntercomRoutingMismatchError`, `IntercomRoutingUnavailableError`, `IntercomRoutingTimeoutError`, `IntercomRoutingChangedError`), see [Routing and project-group errors](/intercom/reference#routing-and-project-group-errors).
181
186
 
182
187
  ### What works across machines
183
188
 
@@ -193,7 +198,7 @@ If a local session and a remote session share the same name, name lookup prefers
193
198
 
194
199
  ### Latency
195
200
 
196
- Brokers poll the shared database for wake-ups every 0.5 seconds, so cross-machine messages typically arrive within half a second plus database round trips, with `delivered` confirmation taking a similar round trip. A backup poll every 30 seconds recovers missed wake-ups.
201
+ On PostgreSQL, the database notifies the receiving broker of a new message at once, so a cross-machine message usually arrives within a few database round trips. The `delivered` confirmation takes about as long. Brokers also check for missed messages every 5 seconds. When notifications are not available, for example behind a transaction pooler without `listenUrl`, brokers check the database every half second instead. See [Wake-ups](/storage/postgres#wake-ups). With a custom adapter, brokers check every half second. A backup check every 30 seconds recovers anything else.
197
202
 
198
203
  A sender waits about 8 seconds for a live recipient to confirm saving a message. A recipient actively saving reports progress to extend that wait up to 2 minutes, and a claimed remote delivery gets one extra 8-second window (about 16 seconds total) before reporting an uncertain outcome. The message is still delivered once; check with the recipient before resending.
199
204
 
@@ -214,7 +219,7 @@ When a machine or broker stops abruptly, its sessions still look connected for u
214
219
 
215
220
  ### Data and security
216
221
 
217
- - **Retention.** Cross-machine message text, attachments, and sender metadata stay in the shared database until delivered, and delivered rows are pruned about 12 minutes later to protect against duplicate retries. Offline messages stay until delivered or expired after 7 days. Session names, IDs, and group memberships are stored for discovery and routing.
222
+ - **Retention.** Cross-machine message text, attachments, and sender metadata stay in the shared database until delivered, and delivered rows are pruned 12 to 17 minutes later to protect against duplicate retries. Offline messages stay until delivered or expired after 7 days. One broker at a time does this cleanup, every 5 minutes; if it stops, another broker takes over within about 15 minutes. Session names, IDs, and group memberships are stored for discovery and routing.
218
223
  - **Database access.** Anyone who can read the shared database can read cross-machine Intercom messages. Keep credentials in `secrets` (`{ "env": ... }` or `{ "file": ... }`) rather than plain `options`, and use project groups rather than `default` so teammates in other repositories cannot inject prompts into your sessions.
219
224
  - **No open ports.** Intercom opens no network listeners or broker-to-broker sockets. Cross-machine security matches the shared database's authentication and transport security.
220
225
 
@@ -61,7 +61,7 @@ Ambiguous prefixes list only authorized candidates and require the full UUID. Is
61
61
 
62
62
  Reopened sessions and restored background subagents reclaim their previous Intercom session ID so peers can keep using the ID printed by `intercom list`. The session persists this ID as an `intercom_session_identity` entry. While a live session holds an ID, another registration receives a fresh ID instead; once released, only that same Atomic session can reclaim it while the broker remembers its previous holder.
63
63
 
64
- With [multi-node routing](/intercom/operations#running-intercom-across-machines), session ID reclaim works across machines once the shared database has the current schema (on [PostgreSQL storage](/storage#postgresql), run `atomic storage migrate` as the schema owner role):
64
+ With [multi-node routing](/intercom/operations#running-intercom-across-machines), session ID reclaim works across machines once the shared database has the current schema (on [PostgreSQL](/storage/postgres), run `atomic storage migrate` as the schema owner role):
65
65
 
66
66
  - A session that disconnects cleanly reclaims its ID immediately on any machine.
67
67
  - A session whose broker crashed reclaims its ID immediately on the same machine, or on another machine after the crashed broker's 30-second lease expires (until then it receives a fresh ID and automatically rebinds once the lease lapses).
@@ -398,7 +398,7 @@ Exported from `@bastani/atomic` with `isProjectGroupError()`, `isIntercomRouting
398
398
  | Class | `code` | When it happens | Fields | What to do |
399
399
  | --- | --- | --- | --- | --- |
400
400
  | `ProjectGroupError` | `git-unavailable` or `git-failed` | Multi-node routing tried to derive `project:<path>` inside a Git repository, but `git` is missing or failed. Not retried in the background. | `cwd`, `detail`, `hint` | Install Git, fix the repository error, or set `ATOMIC_INTERCOM_GROUP` to skip the lookup. |
401
- | `IntercomRoutingMismatchError` | `broker-routing-mismatch` | The broker routes across machines while the session joined implicitly as `default` (`reason: "implicit-default-on-remote-broker"`), or the session selected shared storage (`storage` or `ATOMIC_PROFILE=ci`) while the running broker started without it (`reason: "shared-storage-not-on-broker"`). Terminal until session restart. | `reason`, `group`, `hint`, `retryable: false` | Run `atomic intercom restart` (if the broker lacks shared storage), then restart the session or set `ATOMIC_INTERCOM_GROUP`. |
401
+ | `IntercomRoutingMismatchError` | `broker-routing-mismatch` | The broker routes across machines while the session joined implicitly as `default` (`reason: "implicit-default-on-remote-broker"`), or the session selected shared storage (`storage`) while the running broker started without it (`reason: "shared-storage-not-on-broker"`). Terminal until session restart. | `reason`, `group`, `hint`, `retryable: false` | Run `atomic intercom restart` (if the broker lacks shared storage), then restart the session or set `ATOMIC_INTERCOM_GROUP`. |
402
402
  | `IntercomRoutingUnavailableError` | `broker-routing-unavailable` | The broker closed status without answering (`reason: "unsupported"`), sent an unreadable report (`"malformed"`), or is an older broker that could not be replaced while multi-node storage is active. | `reason`, `phase`, `hint`, `retryable: true`, optional `cause` | Run `atomic intercom restart` to replace the broker. |
403
403
  | `IntercomRoutingTimeoutError` | `broker-routing-timeout` | The broker accepted the routing status check but did not answer in time. | `timeoutMs`, `elapsedMs`, `phase`, `hint`, `retryable: true` | Wait for reconnect backoff, or run `atomic intercom restart` if it persists. |
404
404
  | `IntercomRoutingChangedError` | `broker-routing-changed` | The broker's routing mode changed between the session's status check and registration, so registration was refused. | `expectedAcrossMachines`, `hint`, `retryable: true` | Wait for automatic retry, or run `atomic intercom restart` if it persists. |
package/docs/intercom.md CHANGED
@@ -323,7 +323,7 @@ Use Intercom for coordinating your own sessions and for peer-to-peer agent swarm
323
323
 
324
324
  - [Operate Intercom](/intercom/operations) for broker lifecycles, upgrades, recovery, and multi-machine routing.
325
325
  - [Intercom reference](/intercom/reference) for tool parameters, targeting rules, reach policies, and error classes.
326
- - [Sharing storage across hosts](/storage#sharing-storage-across-hosts) and [Set up teams and CI](/guides/team-setup) for shared PostgreSQL and libSQL databases.
326
+ - [Sharing storage across hosts](/storage#sharing-storage-across-hosts) and [Set up teams and CI](/guides/team-setup) for a shared PostgreSQL database.
327
327
  - [Intercom group and reach in the SDK](/sdk#intercom-group-and-reach) and [SDK tools](/sdk/reference#tools) for programmatic Intercom policies and `builtins.intercom`.
328
328
  - [Storage and Intercom CLI commands](/reference/cli#storage-and-intercom-commands) for `atomic intercom` and `atomic storage` subcommands.
329
329
  - [Run subagents](/subagents) for delegated subagent runs, supervisor coordination, and result delivery.
@@ -6,10 +6,10 @@ description: "PostgreSQL storage adapter for Atomic sessions and Intercom multi-
6
6
 
7
7
  `@bastani/atomic-storage-postgres` is Atomic's standalone [PostgreSQL](https://www.postgresql.org) storage adapter. It stores sessions and Intercom multi-node routing in one shared PostgreSQL database so multiple machines or SDK hosts can share state. Unlike the six core libraries in [Standalone libraries](/libraries), this package is not bundled inside `@bastani/atomic`; install it only when you use PostgreSQL.
8
8
 
9
- - **PostgreSQL version requirement:** Atomic sessions require **PostgreSQL 16 or later** (for session JSON query functions). The adapter accepts **PostgreSQL 14 or later** on connect for non-session tables and rejects servers older than PostgreSQL 14.
9
+ - **PostgreSQL version requirement:** Atomic needs **PostgreSQL 16 or newer**.
10
10
  - **Plain ESM with types:** Ships plain JavaScript ESM and TypeScript declarations (`postgres.d.ts`), requiring Node.js 24.20+ with no TypeScript loader.
11
11
 
12
- For operator setup, role creation SQL, migrations, and troubleshooting, see [PostgreSQL setup](/storage#postgresql). For all five SDK storage backends and `createAgentSessionRuntime()`, see [SDK storage backends](/sdk/storage).
12
+ For operator setup, role creation SQL, migrations, and troubleshooting, see [PostgreSQL setup](/storage/postgres). For all five SDK storage backends and `createAgentSessionRuntime()`, see [SDK storage backends](/sdk/storage).
13
13
 
14
14
  ## Installation
15
15
 
@@ -27,7 +27,7 @@ If you use [cloud IAM authentication](#cloud-iam-authentication), also install t
27
27
 
28
28
  ## SDK quick start
29
29
 
30
- Create your database roles and run `atomic storage migrate` as the owner role first (see [Set up the database](/storage#set-up-the-database)), then connect from your Node.js application with `openPostgresDatabase()`:
30
+ Create your database roles and run `atomic storage migrate` as the owner role first (see [Set up the database](/storage/postgres#set-up-the-database)), then connect from your Node.js application with `openPostgresDatabase()`:
31
31
 
32
32
  ```typescript
33
33
  import { readFile } from "node:fs/promises";
@@ -64,7 +64,7 @@ Pass the returned `SqliteDatabase` to `createAgentSession({ sessionStore: { kind
64
64
  | `url` | `string` *(required)* | — | A `postgres://` or `postgresql://` URL with a username and no embedded password. Any password in the URL or a `password=` query parameter is rejected with `credential-in-url`. |
65
65
  | `password` | `string \| (() => Promise<string>)` | — | Password string or async callback invoked for each new connection, and once when the database opens to tell its credential apart from other databases' in the shared pool. Omit when using cloud `auth`; combining cloud `auth` with `password` throws `conflicting-token`. |
66
66
  | `auth` | `"password" \| "azure-entra" \| "aws-iam" \| "gcp-iam"` | `"password"` | Credential strategy. Cloud modes request short-lived tokens per new connection via the provider's SDK. |
67
- | `maxConnections` | `number` | `8` (`DEFAULT_MAX_CONNECTIONS`) | Most connections the process's main pool opens. A positive integer. Every database the process opens with the same `url`, role, password, `listenUrl`, `auth`, `schema`, `proxy`, `socket` and pool options shares one main pool, one reader pool and one listening connection, and the last one to close closes them. For high throughput, set it as high as the server's `max_connections` allows. See [Tuning for many concurrent agents](/storage#tuning-for-many-concurrent-agents). |
67
+ | `maxConnections` | `number` | `8` (`DEFAULT_MAX_CONNECTIONS`) | Most connections the process's main pool opens. A positive integer. Every database the process opens with the same `url`, role, password, `listenUrl`, `auth`, `schema`, `proxy`, `socket` and pool options shares one main pool, one reader pool and one listening connection, and the last one to close closes them. To size it, see [Tuning for many concurrent agents](/storage/postgres#tuning-for-many-concurrent-agents). |
68
68
  | `readerMaxConnections` | `number` | `2` (`DEFAULT_READER_MAX_CONNECTIONS`) | Most connections in the reader pool that every handle `openReader()` returns shares, capped at `maxConnections`. A non-negative integer. `0` leaves `openReader` undefined, so reads share the main pool. |
69
69
  | `statementTimeoutMs` | `number` | `30000` (`DEFAULT_STATEMENT_TIMEOUT_MS`) | How long one statement may run, in milliseconds, before the server cancels it. A positive integer. |
70
70
  | `connectTimeoutMs` | `number` | `10000` (`DEFAULT_CONNECT_TIMEOUT_MS`) | How long opening a connection, or waiting for a free pooled one, may take, in milliseconds. A positive integer. |
@@ -96,13 +96,13 @@ On Azure, AWS, and Google Cloud, set `auth` and omit `password` / `secrets.passw
96
96
  | `aws-iam` | `@aws-sdk/rds-signer` | `atomic install npm:@aws-sdk/rds-signer@3.1169.0` | RDS `Signer` using the AWS default credential chain (`AWS_*`, profiles, IRSA, instance profile) |
97
97
  | `gcp-iam` | `google-auth-library` | `atomic install npm:google-auth-library@11.3.4` | `GoogleAuth` for `https://www.googleapis.com/auth/sqlservice.login` (ADC, GKE/GCE/Cloud Run metadata) |
98
98
 
99
- For Azure Database for PostgreSQL Flexible Server (PostgreSQL 16+), Azure HorizonDB (PostgreSQL 17, read/write endpoint), Amazon RDS/Aurora, and Google Cloud SQL role-grant SQL, see [PostgreSQL setup](/storage#azure) and [Cloud identities](/storage#cloud-identities).
99
+ For Azure Database for PostgreSQL Flexible Server (PostgreSQL 16+), Azure HorizonDB (PostgreSQL 17, read/write endpoint), Amazon RDS/Aurora, and Google Cloud SQL role-grant SQL, see [PostgreSQL setup](/storage/postgres#azure) and [Cloud identities](/storage/postgres#cloud-identities).
100
100
 
101
101
  ## TLS, HTTP proxies, and connection poolers
102
102
 
103
103
  - **TLS defaults:** When `url` omits `sslmode`, Atomic applies `sslmode=verify-full` for remote hosts (checking `PGHOST` if omitted from the URL). Add `sslrootcert=/path/to/ca.pem` for private CAs. Without `sslrootcert`, `require` verifies both certificate and hostname like `verify-full` (stricter than libpq). TLS parameter names are case-sensitive; unknown `sslmode` values are rejected.
104
104
  - **HTTP `CONNECT` proxies:** Without `options.proxy`, remote TCP hosts check `HTTPS_PROXY` (`https_proxy`), then `ALL_PROXY` (when HTTP/HTTPS), then `HTTP_PROXY`, respecting `NO_PROXY`. Loopback hosts and Unix socket directories connect directly. Keep `sslmode=verify-full` (or `verify-ca` with a private CA) so TLS runs end to end through the tunnel.
105
- - **Connection poolers and wake-ups:** Works with transaction-mode poolers (PgBouncer, Azure port `6432`, Supabase Supavisor, Neon `-pooler`) with no session-level state. Prepared statements are off by default behind a pooler, when `listenUrl` is set or the port is `6432` or `6543`. On PgBouncer 1.21 and later with `max_prepared_statements` above `0`, the default from 1.24, set `maxPreparedStatements` to turn them on. A process that listens for wake-ups, as an Intercom broker does, opens one extra `LISTEN` connection outside its pools. When `url` uses a transaction pooler, set `listenUrl` to a direct endpoint, or Atomic falls back to polling. See the [PgBouncer guide](/guides/postgres-pgbouncer).
105
+ - **Connection poolers and wake-ups:** Works with transaction-mode poolers (PgBouncer, Azure port `6432`, Supabase Supavisor, Neon `-pooler`) with no session-level state. Prepared statements are off by default behind a pooler, when `listenUrl` is set or the port is `6432` or `6543`. On PgBouncer 1.21 and later with `max_prepared_statements` above `0`, the default from 1.24, set `maxPreparedStatements` to turn them on. A process that listens for wake-ups, as an Intercom broker does, opens one extra `LISTEN` connection outside its pools. When `url` uses a transaction pooler, set `listenUrl` to a direct endpoint, or Atomic falls back to polling. See the [PgBouncer guide](/storage/postgres/pgbouncer).
106
106
  - **Retries and errors:** Connection drops, lock conflicts (`40001`, `40P01`, `55P03`), and canceled statements (`57014`) throw `StorageTransientError` (read-only and unwritten calls retry automatically). Invalid credentials (`28P01`), missing databases (`3D000`), and certificate errors fail immediately. Missing privileges (`42501`) fail immediately with `StorageConfigError` (`reason: "missing-privilege"`) naming the exact `GRANT` or migration command.
107
107
 
108
108
  ## CLI configuration
@@ -110,15 +110,15 @@ For Azure Database for PostgreSQL Flexible Server (PostgreSQL 16+), Azure Horizo
110
110
  Join a machine with the CLI after installing in user scope and running `atomic storage migrate`:
111
111
 
112
112
  ```bash
113
- printf '%s' "$PASSWORD" > ~/atomic-db-password
114
- chmod 600 ~/atomic-db-password
113
+ (umask 077; printf 'Runtime password: '; read -rs password; printf '\n'; printf '%s' "$password" > ~/atomic-db-password)
115
114
  atomic storage join 'postgresql://atomic_runtime@db.example.com:5432/atomic' --password-file ~/atomic-db-password
115
+ rm ~/atomic-db-password # atomic storage join keeps its own copy
116
116
  atomic intercom restart
117
117
  atomic storage status
118
118
  ```
119
119
 
120
120
  ## Related docs
121
121
 
122
- - [PostgreSQL operator guide](/storage#postgresql): role creation SQL, migrations, Azure/RDS/Cloud SQL setup, and troubleshooting.
122
+ - [PostgreSQL operator guide](/storage/postgres): role creation SQL, migrations, Azure/RDS/Cloud SQL setup, and troubleshooting.
123
123
  - [SDK storage backends](/sdk/storage): complete `createAgentSession()`, `createAgentSessionRuntime()`, and error-handling recipes.
124
124
  - [Standalone libraries](/libraries): all published `@bastani/atomic-*` packages.
package/docs/libraries.md CHANGED
@@ -21,14 +21,13 @@ The six core libraries are bundled inside `@bastani/atomic` and provided to exte
21
21
 
22
22
  ## Storage adapter packages
23
23
 
24
- Remote SQL storage adapters are **not** bundled into `@bastani/atomic` and must be installed separately when you use PostgreSQL or libSQL/Turso:
24
+ Remote SQL storage adapters are **not** bundled into `@bastani/atomic` and must be installed separately when you use PostgreSQL:
25
25
 
26
26
  | Package | What it does |
27
27
  | --- | --- |
28
28
  | [`@bastani/atomic-storage-postgres`](/libraries/storage-postgres) | PostgreSQL 16+ storage adapter (`openPostgresDatabase()`, cloud IAM, proxies, poolers) for shared sessions and Intercom |
29
- | [`@bastani/atomic-storage-libsql`](/libraries/storage-libsql) | libSQL and Turso storage adapter (`openLibsqlDatabase()`, namespaces, WAL/sqld retries) for shared sessions and Intercom |
30
29
 
31
- For CLI usage, install storage adapters in user scope with `atomic install npm:@bastani/atomic-storage-postgres` or `atomic install npm:@bastani/atomic-storage-libsql`. For TypeScript SDK applications, install them with `npm install` alongside `@bastani/atomic` (see [SDK storage backends](/sdk/storage)).
30
+ For CLI usage, install storage adapters in user scope with `atomic install npm:@bastani/atomic-storage-postgres`. For TypeScript SDK applications, install them with `npm install` alongside `@bastani/atomic` (see [SDK storage backends](/sdk/storage)).
32
31
 
33
32
  > **Native bindings:** `@bastani/atomic-natives` is an internal N-API native module installed automatically as a runtime dependency of `@bastani/atomic` (with per-platform binary packages in its `optionalDependencies`) and is not intended as a standalone user library.
34
33
 
@@ -55,7 +55,7 @@ Each `models` entry adds a model to the provider. An entry whose `id` matches an
55
55
  | `cost.tiers[].cacheWrite` | number | | Required. Cache-write cost in USD per million tokens. |
56
56
  | `promptCache` | object | | Best-effort prompt cache lifetime in seconds for the short and long retention tiers. Atomic warms only tiers with a known lifetime. |
57
57
  | `contextWindow` | number | `128000` | Context window in tokens. Applies only to chat models. |
58
- | `maxTokens` | number | `16384` | Maximum output tokens. Defaults to 16384 for chat models. When omitted on compactor models, defaults to 32000 estimated tokens, capped at 50% of the automatic trigger. |
58
+ | `maxTokens` | number | `16384` | Maximum output tokens. Defaults to 16384 for chat models. On compactor models it has no default: when set, compacted output longer than this many estimated tokens clears the context instead; when omitted, output has no size limit. |
59
59
  | `timeoutMs` | number | | Wall-clock timeout in milliseconds for one compactor request (default 120000). Applies only to compactor models. |
60
60
  | `samplingParams` | object | | Fields merged into every request body. Applies only to OpenAI-compatible APIs. |
61
61
  | `samplingParamsByThinkingLevel` | object | | samplingParams per thinking level, merged over samplingParams. |
@@ -89,7 +89,7 @@ Each `modelOverrides` key is the ID of a built-in or extension model. Unknown ID
89
89
  | `cost.tiers[].cacheWrite` | number | | Required. Cache-write cost in USD per million tokens. |
90
90
  | `promptCache` | object | | Best-effort prompt cache lifetime in seconds for the short and long retention tiers. Atomic warms only tiers with a known lifetime. |
91
91
  | `contextWindow` | number | | Context window in tokens. Applies only to chat models. |
92
- | `maxTokens` | number | | Maximum output tokens. On compactor models, sets the upper bound on compacted output in estimated tokens, capped at 50% of the automatic trigger. |
92
+ | `maxTokens` | number | | Maximum output tokens. On compactor models, compacted output longer than this many estimated tokens clears the context instead; omit it for no size limit. |
93
93
  | `timeoutMs` | number | | Wall-clock timeout in milliseconds for one compactor request (default 120000). Applies only to compactor models. |
94
94
  | `samplingParams` | object | | Fields merged into every request body. Applies only to OpenAI-compatible APIs. |
95
95
  | `samplingParamsByThinkingLevel` | object | | samplingParams per thinking level, merged over samplingParams. |
package/docs/models.md CHANGED
@@ -172,8 +172,7 @@ Add a custom remote compaction endpoint by setting `"type": "compactor"` on a mo
172
172
  "target_ratio": 0.4,
173
173
  "preserve_recent": 2
174
174
  },
175
- "timeoutMs": 180000,
176
- "maxTokens": 48000
175
+ "timeoutMs": 180000
177
176
  }
178
177
  ]
179
178
  }
@@ -181,7 +180,7 @@ Add a custom remote compaction endpoint by setting `"type": "compactor"` on a mo
181
180
  }
182
181
  ```
183
182
 
184
- Every custom compactor requires `"api"` at the provider or model level (just like custom chat models; built-in Morph defines its own `"api": "morph-compact"`). Atomic sends `{ messages, query, model }` plus any keys in `compactionParams` (omitting `compactionParams` lets the remote API use its own defaults). See [Customize Morph or add a remote compactor](/compaction#customize-morph-or-add-a-remote-compactor) and [Compaction reference](/compaction/reference#compactor-request-contract).
183
+ Every custom compactor requires `"api"` at the provider or model level (just like custom chat models; built-in Morph defines its own `"api": "morph-compact"`). Atomic sends `{ messages, query, model }` plus any keys in `compactionParams` (omitting `compactionParams` lets the remote API use its own defaults). A compactor's output has no built-in size limit; set `maxTokens` on the compactor model to reject output longer than that many estimated tokens, or use the endpoint's own size option in `compactionParams` to ask for shorter output. See [Customize Morph or add a remote compactor](/compaction#customize-morph-or-add-a-remote-compactor) and [Compaction reference](/compaction/reference#compactor-request-contract).
185
184
 
186
185
  ## Use classifier models
187
186
 
@@ -99,20 +99,20 @@ Contribute [MCP servers](/mcp-servers) via `mcpServers` in the manifest (manifes
99
99
 
100
100
  ## Storage adapters
101
101
 
102
- Expose [storage adapters](/storage#selecting-an-adapter) via `storageAdapters` (manifest-only, paths relative to the package root). Put database drivers in `dependencies` and `@bastani/atomic` in `peerDependencies`:
102
+ Expose [storage adapters](/storage/custom-adapters#selecting-an-adapter) via `storageAdapters` (manifest-only, paths relative to the package root). Put database drivers in `dependencies` and `@bastani/atomic` in `peerDependencies`:
103
103
 
104
104
  ```json
105
105
  {
106
- "name": "@example/atomic-libsql",
107
- "dependencies": { "@libsql/client": "0.18.0" },
106
+ "name": "@example/atomic-mydb",
107
+ "dependencies": { "mydb-client": "1.0.0" },
108
108
  "peerDependencies": { "@bastani/atomic": "*" },
109
- "atomic": { "storageAdapters": ["./libsql-adapter.ts"] }
109
+ "atomic": { "storageAdapters": ["./mydb-adapter.ts"] }
110
110
  }
111
111
  ```
112
112
 
113
- - Select an adapter by package name (`"storage": { "adapter": "@example/atomic-libsql" }`), which selects the first entry in `storageAdapters` when a package lists multiple adapters.
114
- - Select a specific adapter from a multi-adapter package with `<package>/<file-stem>`, where `<file-stem>` is the filename without its extension (for example `"@example/atomic-libsql/libsql-adapter"`).
115
- - Storage adapters load only from user-settings packages or explicit extension paths (`--extension <dir>` in [CLI resource options](/reference/cli#resource-options) or [`DefaultResourceLoader({ additionalExtensionPaths })`](/sdk/reference#extensions), which take precedence over settings). Project-installed packages cannot supply storage adapters, and global npm adapter lookup checks `~/.atomic/agent/npm/` only (not the system global npm root). See [Adapters from Atomic packages](/storage#adapters-from-atomic-packages).
113
+ - Select an adapter by package name (`"storage": { "adapter": "@example/atomic-mydb" }`), which selects the first entry in `storageAdapters` when a package lists multiple adapters.
114
+ - Select a specific adapter from a multi-adapter package with `<package>/<file-stem>`, where `<file-stem>` is the filename without its extension (for example `"@example/atomic-mydb/mydb-adapter"`).
115
+ - Storage adapters load only from user-settings packages or explicit extension paths (`--extension <dir>` in [CLI resource options](/reference/cli#resource-options) or [`DefaultResourceLoader({ additionalExtensionPaths })`](/sdk/reference#extensions), which take precedence over settings). Project-installed packages cannot supply storage adapters, and global npm adapter lookup checks `~/.atomic/agent/npm/` only (not the system global npm root). See [Adapters from Atomic packages](/storage/custom-adapters#adapters-from-atomic-packages).
116
116
 
117
117
  ## Gallery metadata
118
118
 
package/docs/packages.md CHANGED
@@ -4,7 +4,7 @@ sidebarTitle: "Atomic packages"
4
4
  description: "Install, update, remove, and configure Atomic packages from npm, git, or local directories."
5
5
  ---
6
6
 
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.
7
+ Atomic packages bundle extensions, skills, [subagents](/packages/authoring#subagents), prompt templates, themes, MCP servers, and [storage adapters](/storage/custom-adapters#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.
8
8
 
9
9
  ## Where to go next
10
10