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

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 (432) hide show
  1. package/CHANGELOG.md +99 -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} +14 -2
  14. package/dist/_shared/{p1b-elig-ENCUPKKJ.js.map → p1b-elig-TVB5CBLL.js.map} +1 -1
  15. package/dist/_shared/runtime-O4KCSG4C.js +3 -3
  16. package/dist/_shared/{sdk-IQMULKFU.js → sdk-B5LEWGGI.js} +340 -163
  17. package/dist/_shared/sdk-B5LEWGGI.js.map +1 -0
  18. package/dist/_shared/session-data-AHTU7IS6.js +2 -2
  19. package/dist/_shared/session-manager-list-2BLEEZVG.js +1 -1
  20. package/dist/_shared/{startup-0-0-3IXNMFM2.js → startup-0-0-EZUKEP4Q.js} +48 -40
  21. package/dist/_shared/startup-0-0-EZUKEP4Q.js.map +1 -0
  22. package/dist/_shared/{startup-0-1-7T2IAE7J.js → startup-0-1-RTOHJFDJ.js} +195 -42
  23. package/dist/_shared/startup-0-1-RTOHJFDJ.js.map +1 -0
  24. package/dist/_shared/startup-0-2-5QHPCEON.js +33 -43
  25. package/dist/_shared/startup-0-2-5QHPCEON.js.map +1 -1
  26. package/dist/_shared/startup-0-3-4ZYBYQNM.js +5 -5
  27. package/dist/_shared/startup-0-4-ZMJV547D.js +12 -7
  28. package/dist/_shared/startup-0-4-ZMJV547D.js.map +1 -1
  29. package/dist/_shared/startup-0-5-YDW47QX6.js +7 -7
  30. package/dist/_shared/startup-0-5-YDW47QX6.js.map +1 -1
  31. package/dist/_shared/startup-10-0-TDQNBDDL.js +6 -6
  32. package/dist/_shared/startup-12-0-55AAXBJZ.js +2 -2
  33. package/dist/_shared/startup-14-0-MLX36RBG.js +4 -5
  34. package/dist/_shared/startup-14-0-MLX36RBG.js.map +1 -1
  35. package/dist/_shared/startup-15-0-YUKGAC63.js +4 -4
  36. package/dist/_shared/startup-15-1-4S7FLMNG.js +19 -27
  37. package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
  38. package/dist/_shared/startup-8-0-34CBHPZH.js +39 -23
  39. package/dist/_shared/startup-8-0-34CBHPZH.js.map +1 -1
  40. package/dist/_shared/{startup-8-1-X32CYSXB.js → startup-8-1-LZFXSD3Z.js} +90 -1176
  41. package/dist/_shared/startup-8-1-LZFXSD3Z.js.map +1 -0
  42. package/dist/_shared/storage-command-7MGXLJGZ.js +186 -35
  43. package/dist/_shared/storage-command-7MGXLJGZ.js.map +1 -1
  44. package/dist/_shared/storage-status-K7PX2RXA.js +557 -0
  45. package/dist/_shared/storage-status-K7PX2RXA.js.map +1 -0
  46. package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
  47. package/dist/_shared/team-DOQKICG2.js +376 -0
  48. package/dist/_shared/team-DOQKICG2.js.map +1 -0
  49. package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
  50. package/dist/builtin/intercom/CHANGELOG.md +23 -0
  51. package/dist/builtin/intercom/README.md +2 -2
  52. package/dist/builtin/intercom/broker/broker.bundle.mjs +913 -289
  53. package/dist/builtin/intercom/broker/database-wake-up-bus.ts +243 -64
  54. package/dist/builtin/intercom/broker/multinode-router.ts +154 -22
  55. package/dist/builtin/intercom/broker/multinode-state-store.ts +30 -3
  56. package/dist/builtin/intercom/broker/open-broker-state.ts +14 -0
  57. package/dist/builtin/intercom/broker/sql-add-column.ts +29 -5
  58. package/dist/builtin/intercom/broker/sql-ended-child-queue-store.ts +3 -2
  59. package/dist/builtin/intercom/broker/sql-held-send-store.ts +2 -2
  60. package/dist/builtin/intercom/broker/sql-known-session-store.ts +43 -19
  61. package/dist/builtin/intercom/broker/sql-lease-store.ts +170 -74
  62. package/dist/builtin/intercom/broker/sql-outbox-store.ts +298 -47
  63. package/dist/builtin/intercom/broker/sql-pending-ask-store.ts +8 -5
  64. package/dist/builtin/intercom/broker/sql-released-ask-store.ts +12 -5
  65. package/dist/builtin/intercom/broker/sql-restoring-reservation-store.ts +24 -7
  66. package/dist/builtin/intercom/broker/sql-retention.ts +141 -0
  67. package/dist/builtin/intercom/broker/sql-schema.ts +136 -19
  68. package/dist/builtin/intercom/broker/sql-sent-message-authority.ts +74 -19
  69. package/dist/builtin/intercom/broker/wake-up-bus.ts +6 -0
  70. package/dist/builtin/intercom/index.bundle.mjs +2 -3
  71. package/dist/builtin/intercom/package.json +1 -1
  72. package/dist/builtin/mcp/index.bundle.mjs +1 -1
  73. package/dist/builtin/mcp/package.json +1 -1
  74. package/dist/builtin/subagents/package.json +1 -1
  75. package/dist/builtin/subagents/src/extension/index.bundle.mjs +1 -1
  76. package/dist/builtin/web-access/index.bundle.mjs +2 -10
  77. package/dist/builtin/web-access/package.json +1 -1
  78. package/dist/bun/bundled-sqlite.js +41 -0
  79. package/dist/bun/bundled-sqlite.js.map +1 -0
  80. package/dist/cli/args.js +2 -2
  81. package/dist/cli/auth-cli.code.js +4 -4
  82. package/dist/cli/auth-cli.impl.js +3 -3
  83. package/dist/cli/auth-cli.js +3 -3
  84. package/dist/cli/blueprint-command.code.js +3 -3
  85. package/dist/cli/blueprint-command.impl.js +3 -3
  86. package/dist/cli/blueprint-command.js +3 -3
  87. package/dist/cli/intercom-command.code.js +3 -3
  88. package/dist/cli/intercom-command.code.js.map +1 -1
  89. package/dist/cli/intercom-command.impl.js +3 -3
  90. package/dist/cli/intercom-command.js +3 -3
  91. package/dist/cli/list-models.code.js +2 -2
  92. package/dist/cli/list-models.impl.js +3 -3
  93. package/dist/cli/list-models.js +3 -3
  94. package/dist/cli/session-picker.code.js +1 -1
  95. package/dist/cli/session-picker.impl.js +3 -3
  96. package/dist/cli/session-picker.js +3 -3
  97. package/dist/cli/startup-ui.code.js +1 -1
  98. package/dist/cli/startup-ui.impl.js +3 -3
  99. package/dist/cli/startup-ui.js +3 -3
  100. package/dist/cli/storage-command.impl.js +3 -3
  101. package/dist/cli/storage-command.js +3 -3
  102. package/dist/cli/storage-search-session.code.js +3 -3
  103. package/dist/cli/storage-search-session.impl.js +3 -3
  104. package/dist/cli/storage-search-session.js +3 -3
  105. package/dist/cli/team-command.code.js +19 -113
  106. package/dist/cli/team-command.code.js.map +1 -1
  107. package/dist/cli/team-command.impl.js +3 -3
  108. package/dist/cli/team-command.js +3 -3
  109. package/dist/cli.js +5 -18
  110. package/dist/cli.js.map +1 -1
  111. package/dist/core/agent-rehydrate-errors.d.ts +4 -9
  112. package/dist/core/compaction/compactor.d.ts +3 -3
  113. package/dist/core/debug.code.js +1 -1
  114. package/dist/core/debug.impl.js +3 -3
  115. package/dist/core/debug.js +3 -3
  116. package/dist/core/export-html/card-projection.impl.js +3 -3
  117. package/dist/core/export-html/card-projection.js +3 -3
  118. package/dist/core/export-html/index.code.js +2 -2
  119. package/dist/core/export-html/index.impl.js +3 -3
  120. package/dist/core/export-html/index.js +3 -3
  121. package/dist/core/export-html/json-spans.impl.js +3 -3
  122. package/dist/core/export-html/json-spans.js +3 -3
  123. package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
  124. package/dist/core/export-html/oversized-render-inputs.js +3 -3
  125. package/dist/core/export-html/tool-renderer.impl.js +3 -3
  126. package/dist/core/export-html/tool-renderer.js +3 -3
  127. package/dist/core/extensions/jiti-loader.impl.js +3 -3
  128. package/dist/core/extensions/jiti-loader.js +3 -3
  129. package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
  130. package/dist/core/extensions/jiti-static-loader.js +3 -3
  131. package/dist/core/extensions/loader-host-modules.code.js +1 -1
  132. package/dist/core/extensions/loader-host-modules.impl.js +3 -3
  133. package/dist/core/extensions/loader-host-modules.js +3 -3
  134. package/dist/core/extensions/loader-virtual-modules.js +1 -1
  135. package/dist/core/extensions/runner-context.js +2 -2
  136. package/dist/core/intercom-broker-control-host.code.js +2 -2
  137. package/dist/core/intercom-broker-control-host.impl.js +3 -3
  138. package/dist/core/intercom-broker-control-host.js +3 -3
  139. package/dist/core/intercom-broker-control.code.js +3 -3
  140. package/dist/core/intercom-broker-control.impl.js +3 -3
  141. package/dist/core/intercom-broker-control.js +3 -3
  142. package/dist/core/package-manager-storage-adapters.code.js +1 -1
  143. package/dist/core/package-manager-storage-adapters.impl.js +3 -3
  144. package/dist/core/package-manager-storage-adapters.js +3 -3
  145. package/dist/core/process-start-token.d.ts +8 -0
  146. package/dist/core/process-tree-containment.d.ts +16 -0
  147. package/dist/core/sdk-types.d.ts +1 -2
  148. package/dist/core/sdk-types.js.map +1 -1
  149. package/dist/core/sdk.code.js +3 -3
  150. package/dist/core/sdk.impl.js +3 -3
  151. package/dist/core/sdk.js +3 -3
  152. package/dist/core/session-manager-core.js +5 -5
  153. package/dist/core/session-manager-list.impl.js +3 -3
  154. package/dist/core/session-manager-list.js +3 -3
  155. package/dist/core/session-manager.code.js +1 -1
  156. package/dist/core/session-manager.impl.js +3 -3
  157. package/dist/core/session-manager.js +3 -3
  158. package/dist/core/session-storage.code.js +1 -1
  159. package/dist/core/session-storage.impl.js +3 -3
  160. package/dist/core/session-storage.js +3 -3
  161. package/dist/core/settings-schema.d.ts +0 -3
  162. package/dist/core/storage/added-exports-0-10-11.js +19 -0
  163. package/dist/core/storage/added-exports-0-10-11.js.map +1 -0
  164. package/dist/core/storage/creation-time.js +105 -0
  165. package/dist/core/storage/creation-time.js.map +1 -0
  166. package/dist/core/storage/database.d.ts +19 -5
  167. package/dist/core/storage/database.js.map +1 -1
  168. package/dist/core/storage/dialect.d.ts +1 -1
  169. package/dist/core/storage/dialect.js +1 -1
  170. package/dist/core/storage/dialect.js.map +1 -1
  171. package/dist/core/storage/errors.d.ts +13 -13
  172. package/dist/core/storage/errors.js +10 -16
  173. package/dist/core/storage/errors.js.map +1 -1
  174. package/dist/core/storage/fenced-paths.d.ts +11 -0
  175. package/dist/core/storage/fenced-paths.js +11 -0
  176. package/dist/core/storage/fenced-paths.js.map +1 -1
  177. package/dist/core/storage/file-identity.d.ts +2 -0
  178. package/dist/core/storage/file-identity.js +24 -8
  179. package/dist/core/storage/file-identity.js.map +1 -1
  180. package/dist/core/storage/index.d.ts +3 -2
  181. package/dist/core/storage/index.js +5 -3
  182. package/dist/core/storage/index.js.map +1 -1
  183. package/dist/core/storage/libsql-removed.d.ts +71 -0
  184. package/dist/core/storage/libsql-removed.js +123 -0
  185. package/dist/core/storage/libsql-removed.js.map +1 -0
  186. package/dist/core/storage/migrations.d.ts +78 -14
  187. package/dist/core/storage/migrations.js +375 -49
  188. package/dist/core/storage/migrations.js.map +1 -1
  189. package/dist/core/storage/node-sqlite-file-gate.js +0 -15
  190. package/dist/core/storage/node-sqlite-file-gate.js.map +1 -1
  191. package/dist/core/storage/node-sqlite-thread.js +8 -13
  192. package/dist/core/storage/node-sqlite-thread.js.map +1 -1
  193. package/dist/core/storage/node-sqlite.js +51 -3
  194. package/dist/core/storage/node-sqlite.js.map +1 -1
  195. package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
  196. package/dist/core/storage/offline-snapshot-file.js +3 -3
  197. package/dist/core/storage/prefix.d.ts +1 -1
  198. package/dist/core/storage/prefix.js +9 -2
  199. package/dist/core/storage/prefix.js.map +1 -1
  200. package/dist/core/storage/process-selection.d.ts +5 -5
  201. package/dist/core/storage/provider.js +2 -2
  202. package/dist/core/storage/schema-catalog.d.ts +7 -8
  203. package/dist/core/storage/schema-catalog.js +8 -8
  204. package/dist/core/storage/schema-catalog.js.map +1 -1
  205. package/dist/core/storage/selection.d.ts +7 -82
  206. package/dist/core/storage/selection.js +20 -235
  207. package/dist/core/storage/selection.js.map +1 -1
  208. package/dist/core/storage/session/branch-fork-source.code.js +2 -2
  209. package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
  210. package/dist/core/storage/session/branch-fork-source.js +3 -3
  211. package/dist/core/storage/session/card-view.impl.js +3 -3
  212. package/dist/core/storage/session/card-view.js +3 -3
  213. package/dist/core/storage/session/child-reader.code.js +3 -3
  214. package/dist/core/storage/session/child-reader.impl.js +3 -3
  215. package/dist/core/storage/session/child-reader.js +3 -3
  216. package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
  217. package/dist/core/storage/session/chunked-resume-projection.js +3 -3
  218. package/dist/core/storage/session/expanded-child-details.code.js +2 -2
  219. package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
  220. package/dist/core/storage/session/expanded-child-details.js +3 -3
  221. package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
  222. package/dist/core/storage/session/fork-row-bytes.js +3 -3
  223. package/dist/core/storage/session/fork-row-index.impl.js +3 -3
  224. package/dist/core/storage/session/fork-row-index.js +3 -3
  225. package/dist/core/storage/session/fork-staging.code.js +4 -7
  226. package/dist/core/storage/session/fork-staging.code.js.map +1 -1
  227. package/dist/core/storage/session/fork-staging.impl.js +3 -3
  228. package/dist/core/storage/session/fork-staging.js +3 -3
  229. package/dist/core/storage/session/fork-window.code.js +3 -3
  230. package/dist/core/storage/session/fork-window.impl.js +3 -3
  231. package/dist/core/storage/session/fork-window.js +3 -3
  232. package/dist/core/storage/session/history-pages.impl.js +3 -3
  233. package/dist/core/storage/session/history-pages.js +3 -3
  234. package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
  235. package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
  236. package/dist/core/storage/session/jsonl-session-store.d.ts +5 -1
  237. package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
  238. package/dist/core/storage/session/jsonl-session-store.js +3 -3
  239. package/dist/core/storage/session/memory-session-store.impl.js +3 -3
  240. package/dist/core/storage/session/memory-session-store.js +3 -3
  241. package/dist/core/storage/session/pinned-branch-resume.code.js +3 -3
  242. package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
  243. package/dist/core/storage/session/pinned-branch-resume.js +3 -3
  244. package/dist/core/storage/session/released-history-files.code.js +3 -3
  245. package/dist/core/storage/session/released-history-files.impl.js +3 -3
  246. package/dist/core/storage/session/released-history-files.js +3 -3
  247. package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
  248. package/dist/core/storage/session/resident-fork-rows.js +3 -3
  249. package/dist/core/storage/session/session-resume.impl.js +3 -3
  250. package/dist/core/storage/session/session-resume.js +3 -3
  251. package/dist/core/storage/session/session-search-index.d.ts +43 -4
  252. package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
  253. package/dist/core/storage/session/snapshot-cut.js +3 -3
  254. package/dist/core/storage/session/snapshot-history.code.js +3 -3
  255. package/dist/core/storage/session/snapshot-history.impl.js +3 -3
  256. package/dist/core/storage/session/snapshot-history.js +3 -3
  257. package/dist/core/storage/session/sql-session-store.code.js +1 -1
  258. package/dist/core/storage/session/sql-session-store.d.ts +48 -11
  259. package/dist/core/storage/session/sql-session-store.impl.js +3 -3
  260. package/dist/core/storage/session/sql-session-store.js +3 -3
  261. package/dist/core/storage/session/tree-outline.impl.js +3 -3
  262. package/dist/core/storage/session/tree-outline.js +3 -3
  263. package/dist/core/storage/session/tree-presentation.impl.js +3 -3
  264. package/dist/core/storage/session/tree-presentation.js +3 -3
  265. package/dist/core/storage/sqlite-facade.d.ts +6 -1
  266. package/dist/core/storage/sqlite-facade.js +1 -0
  267. package/dist/core/storage/sqlite-facade.js.map +1 -1
  268. package/dist/core/storage/storage-status.code.js +1 -1
  269. package/dist/core/storage/storage-status.impl.js +3 -3
  270. package/dist/core/storage/storage-status.js +3 -3
  271. package/dist/core/storage/team.code.js +1 -1
  272. package/dist/core/storage/team.d.ts +26 -115
  273. package/dist/core/storage/team.impl.js +3 -3
  274. package/dist/core/storage/team.js +3 -3
  275. package/dist/core/structured-output/index.code.js +1 -1
  276. package/dist/core/structured-output/index.impl.js +3 -3
  277. package/dist/core/structured-output/index.js +3 -3
  278. package/dist/core/tasks/task-completion-entry.impl.js +3 -3
  279. package/dist/core/tasks/task-completion-entry.js +3 -3
  280. package/dist/core/tasks/task-file-history.code.js +3 -3
  281. package/dist/core/tasks/task-file-history.impl.js +3 -3
  282. package/dist/core/tasks/task-file-history.js +3 -3
  283. package/dist/core/tasks/task-reference-archive.code.js +4 -4
  284. package/dist/core/tasks/task-reference-archive.js +3 -3
  285. package/dist/core/tasks/task-reference-identity.js +3 -3
  286. package/dist/core/tasks/task-reference-stream.impl.js +3 -3
  287. package/dist/core/tasks/task-reference-stream.js +3 -3
  288. package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
  289. package/dist/core/tasks/task-unsaved-answer.js +3 -3
  290. package/dist/core/tasks/task-view-source.code.js +1 -1
  291. package/dist/core/tasks/task-view-source.impl.js +3 -3
  292. package/dist/core/tasks/task-view-source.js +3 -3
  293. package/dist/core/tools/history-tasks.d.ts +3 -2
  294. package/dist/core/tools/read-url.code.js +4 -4
  295. package/dist/core/tools/read-url.impl.js +3 -3
  296. package/dist/core/tools/read-url.js +3 -3
  297. package/dist/core/worktree-snapshot/blob-store.d.ts +40 -3
  298. package/dist/core/worktree-snapshot/blob-store.js +414 -21
  299. package/dist/core/worktree-snapshot/blob-store.js.map +1 -1
  300. package/dist/core/worktree-snapshot/errors.code.js +2 -2
  301. package/dist/core/worktree-snapshot/errors.impl.js +3 -3
  302. package/dist/core/worktree-snapshot/errors.js +3 -3
  303. package/dist/core/worktree-snapshot/fork-blob-guard.js +81 -0
  304. package/dist/core/worktree-snapshot/fork-blob-guard.js.map +1 -0
  305. package/dist/core/worktree-snapshot/fork-snapshot-index.js +79 -38
  306. package/dist/core/worktree-snapshot/fork-snapshot-index.js.map +1 -1
  307. package/dist/core/worktree-snapshot/session-index-reset.code.js +4 -0
  308. package/dist/core/worktree-snapshot/session-index-reset.code.js.map +1 -1
  309. package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
  310. package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
  311. package/dist/extensions/codemode/execute.code.js +1 -1
  312. package/dist/extensions/codemode/execute.impl.js +3 -3
  313. package/dist/extensions/codemode/execute.js +3 -3
  314. package/dist/extensions/codemode/renderer.code.js +2 -2
  315. package/dist/extensions/codemode/renderer.impl.js +3 -3
  316. package/dist/extensions/codemode/renderer.js +3 -3
  317. package/dist/extensions/mcp/cli.code.js +3 -3
  318. package/dist/extensions/mcp/cli.impl.js +3 -3
  319. package/dist/extensions/mcp/cli.js +3 -3
  320. package/dist/extensions/mcp/cli.lazy.code.js +2 -2
  321. package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
  322. package/dist/extensions/mcp/cli.lazy.js +3 -3
  323. package/dist/extensions/mcp/runtime.code.js +1 -1
  324. package/dist/extensions/mcp/runtime.impl.js +3 -3
  325. package/dist/extensions/mcp/runtime.js +3 -3
  326. package/dist/index.d.ts +3 -1
  327. package/dist/index.js +5 -5
  328. package/dist/main-first-time-setup.code.js +1 -1
  329. package/dist/main-first-time-setup.impl.js +3 -3
  330. package/dist/main-first-time-setup.js +3 -3
  331. package/dist/main.js +1 -1
  332. package/dist/modes/interactive/components/stored-tree-view.code.js +2 -2
  333. package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
  334. package/dist/modes/interactive/components/stored-tree-view.js +3 -3
  335. package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
  336. package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
  337. package/dist/modes/interactive/startup-shell-eligibility.js +1 -1
  338. package/dist/modes/interactive-engine/engine-prewarm.d.ts +1 -1
  339. package/dist/modes/print-mode.js +1 -1
  340. package/dist/package-manager-cli.code.js +6 -6
  341. package/dist/package-manager-cli.impl.js +3 -3
  342. package/dist/package-manager-cli.js +3 -3
  343. package/dist/rpc-entry.js +1 -1
  344. package/dist/startup-files.json +1 -1
  345. package/dist/startup-stages/10.js +1 -1
  346. package/dist/startup-stages/11.js +1 -1
  347. package/dist/startup-stages/12.js +1 -1
  348. package/dist/startup-stages/2.js +2 -4
  349. package/dist/startup-stages/3.js +1 -3
  350. package/dist/startup-stages/4.js +1 -2
  351. package/dist/startup-stages/5.js +1 -1
  352. package/dist/startup-stages/6.js +5 -7
  353. package/dist/startup-stages/7.js +3 -10
  354. package/dist/startup-stages/8.js +7 -2
  355. package/dist/startup-stages/9.js +1 -7
  356. package/dist/startup-stages/stages.json +1 -1
  357. package/dist/utils/compile-cache-deferral.js +8 -13
  358. package/dist/utils/compile-cache-deferral.js.map +1 -1
  359. package/dist/utils/compile-cache-warmup-host.js +3 -4
  360. package/dist/utils/compile-cache-warmup-host.js.map +1 -1
  361. package/dist/utils/compile-cache.js +12 -100
  362. package/dist/utils/compile-cache.js.map +1 -1
  363. package/dist/utils/startup-database-spare.code.js +2 -2
  364. package/dist/utils/startup-database-spare.impl.js +3 -3
  365. package/dist/utils/startup-database-spare.js +3 -3
  366. package/dist/utils/tools-manager.code.js +1 -1
  367. package/dist/utils/tools-manager.impl.js +3 -3
  368. package/dist/utils/tools-manager.js +3 -3
  369. package/dist/utils/worker-threads.js +2 -15
  370. package/dist/utils/worker-threads.js.map +1 -1
  371. package/docs/build.md +3 -3
  372. package/docs/changelog.mdx +1421 -69
  373. package/docs/compaction/reference.md +5 -5
  374. package/docs/compaction.md +7 -9
  375. package/docs/containerization.md +2 -2
  376. package/docs/custom-provider/api-reference.md +1 -1
  377. package/docs/docs.json +37 -10
  378. package/docs/environment-variables.md +0 -2
  379. package/docs/extensions/api-reference.md +4 -4
  380. package/docs/getting-started/installation.md +3 -0
  381. package/docs/guides/configuration.md +1 -1
  382. package/docs/guides/non-interactive.md +1 -1
  383. package/docs/guides/resume-on-any-machine.md +14 -22
  384. package/docs/guides/team-setup.md +56 -83
  385. package/docs/guides.md +2 -4
  386. package/docs/herdr.md +1 -1
  387. package/docs/index.md +1 -1
  388. package/docs/intercom/operations.md +26 -21
  389. package/docs/intercom/reference.md +2 -2
  390. package/docs/intercom.md +1 -1
  391. package/docs/libraries/storage-postgres.md +9 -9
  392. package/docs/libraries.md +2 -3
  393. package/docs/models-configuration.md +2 -2
  394. package/docs/models.md +2 -3
  395. package/docs/packages/authoring.md +7 -7
  396. package/docs/packages.md +1 -1
  397. package/docs/programmatic.md +2 -2
  398. package/docs/quickstart.md +1 -1
  399. package/docs/reference/cli.md +6 -11
  400. package/docs/reference.md +2 -2
  401. package/docs/rpc/extension-ui.md +2 -2
  402. package/docs/sdk/reference.md +5 -4
  403. package/docs/sdk/storage.md +8 -92
  404. package/docs/sdk/structured-decisions.md +1 -1
  405. package/docs/sdk/web-server.md +3 -3
  406. package/docs/sdk.md +14 -4
  407. package/docs/security.md +1 -1
  408. package/docs/session-format.md +5 -5
  409. package/docs/sessions.md +29 -49
  410. package/docs/settings.md +7 -8
  411. package/docs/storage/custom-adapters.md +255 -0
  412. package/docs/storage/jsonl.md +117 -0
  413. package/docs/{guides/postgres-pgbouncer.md → storage/postgres/pgbouncer.md} +66 -68
  414. package/docs/storage/postgres/tuning.md +337 -0
  415. package/docs/storage/postgres.md +556 -0
  416. package/docs/storage/sqlite.md +99 -0
  417. package/docs/storage.md +326 -990
  418. package/docs/subagents/authoring.md +1 -1
  419. package/docs/subagents.md +2 -2
  420. package/docs/tools.md +1 -1
  421. package/docs/worktree-snapshots.md +2 -2
  422. package/package.json +9 -9
  423. package/schemas/models.schema.json +2 -2
  424. package/schemas/settings.schema.json +0 -14
  425. package/dist/_shared/sdk-IQMULKFU.js.map +0 -1
  426. package/dist/_shared/startup-0-0-3IXNMFM2.js.map +0 -1
  427. package/dist/_shared/startup-0-1-7T2IAE7J.js.map +0 -1
  428. package/dist/_shared/startup-8-1-X32CYSXB.js.map +0 -1
  429. package/dist/core/intercom-broker-control.d.ts +0 -129
  430. package/dist/startup-stages/13.js +0 -1
  431. package/docs/guides/postgres-tuning.md +0 -311
  432. package/docs/libraries/storage-libsql.md +0 -97
@@ -2,7 +2,7 @@ import type { SqliteDatabase } from "./database.js";
2
2
  import { TeamProfileConfigError } from "./errors.js";
3
3
  import type { StorageSteps } from "./file-identity.js";
4
4
  import type { AdapterOptions, SecretRef, StorageSelection } from "./provider.js";
5
- import type { JoinTeamOptions, LeaveTeamOptions, TeamJoinResult, TeamLeaveResult, TeamProfile, TeamProfileOptions } from "./team.js";
5
+ import type { TeamProfile, TeamProfileOptions } from "./team.js";
6
6
  /** A secret held only in this process's memory: it is never written to settings, environments or files. */
7
7
  export interface InMemorySecretRef {
8
8
  readonly value: string;
@@ -29,51 +29,13 @@ export type StorageInputSelection = StorageSettingsSelection | {
29
29
  export declare function selectStorage(value: StorageInputSelection, source: "sdk" | "settings" | "env" | "cli", field: string, defaultPath: string | (() => string)): StorageSelection;
30
30
  export declare function selectStorageAsync(value: StorageInputSelection, source: "sdk" | "settings" | "env" | "cli", field: string, defaultPath: () => Promise<string>): Promise<StorageSelection>;
31
31
  export declare function selectStorageSteps(value: StorageInputSelection, source: "sdk" | "settings" | "env" | "cli", field: string, defaultPath: string | (() => StorageSteps<string>)): StorageSteps<StorageSelection>;
32
- /** The first-party libSQL / Turso adapter package that team setup and `atomic storage join` select. */
33
- export declare const LIBSQL_ADAPTER_PACKAGE = "@bastani/atomic-storage-libsql";
34
- /** Filename prefix for private token files created by `atomic storage join` and `atomic team join` in the agent directory. */
32
+ /** A token file `atomic storage join` created in the agent directory has this filename prefix. */
35
33
  export declare const STORAGE_TOKEN_FILE = "storage-token";
36
- /** The `sessions.storage` value `team join` writes: the local default store, named explicitly. */
34
+ /** The `sessions.storage` value that pins sessions to the local default store, named explicitly. */
37
35
  export declare const LOCAL_SESSIONS_STORAGE: {
38
36
  readonly path: "workflows/journal.sqlite";
39
37
  };
40
- export declare const TEAM_PROFILE_ENV = "ATOMIC_PROFILE";
41
- export declare const TEAM_URL_ENV = "ATOMIC_TEAM_URL";
42
- export declare const TEAM_TOKEN_ENV = "ATOMIC_TEAM_TOKEN";
43
- export declare const TEAM_TOKEN_FILE_ENV = "ATOMIC_TEAM_TOKEN_FILE";
44
- export declare const TEAM_PREFIX_ENV = "ATOMIC_TEAM_PREFIX";
45
- /** The variables `ATOMIC_PROFILE=ci` reads; setting any of them without the profile is an error. */
46
- export declare const TEAM_VARIABLES: readonly string[];
47
- /** A team database selection in the settings form: usable as `createAgentSession({ storage })`. */
48
- export interface TeamStorageSelection {
49
- readonly adapter: string;
50
- readonly options: Readonly<Record<string, string>>;
51
- readonly secrets?: Readonly<Record<string, SecretRef>>;
52
- readonly prefix?: string;
53
- }
54
- export interface TeamProfileSelectionOptions {
55
- readonly profile: "ci";
56
- /** `libsql://`, `https://`, `wss://` or absolute `file:` URL, without a credential. */
57
- readonly url: string;
58
- /** The database token, held as an in-memory `{ value }` secret that is never serialized or written. */
59
- readonly token?: string;
60
- /** A file holding the database token; relative paths resolve against the working directory. */
61
- readonly tokenFile?: string;
62
- /** An environment variable holding the database token, read when the store opens. */
63
- readonly tokenEnv?: string;
64
- readonly prefix?: string;
65
- }
66
38
  export type TeamInputSource = "sdk" | "cli" | "env";
67
- /** Whether a team database URL needs no token: a local `file:` database. */
68
- export declare function isFileUrl(url: string): boolean;
69
- /**
70
- * Check a team database URL: a supported scheme, an absolute `file:` URL, and no credential in it. `postgres` only
71
- * changes the unsupported-URL hint, for the commands that also take a `postgres://` URL through
72
- * {@link checkSharedDatabaseArguments}.
73
- */
74
- export declare function checkTeamUrl(url: string | undefined, source: TeamInputSource, options?: {
75
- readonly postgres?: boolean;
76
- }): string;
77
39
  /** The first-party PostgreSQL adapter package that `atomic storage join postgres://…` and `--db postgres://…` select. */
78
40
  export declare const POSTGRES_ADAPTER_PACKAGE = "@bastani/atomic-storage-postgres";
79
41
  /** The platform credential a Postgres selection's `auth` option names, instead of a password. */
@@ -85,7 +47,7 @@ export declare function isPostgresUrl(url: string): boolean;
85
47
  /** The shared database a command line names: its URL and where its credential comes from. */
86
48
  export interface SharedDatabaseArguments {
87
49
  readonly url: string;
88
- /** libSQL: the token file. Postgres: a password file another process keeps fresh, referenced in place. */
50
+ /** A password or token file another process keeps fresh, referenced in place. */
89
51
  readonly tokenFile?: string;
90
52
  /** Postgres only: a password file. */
91
53
  readonly passwordFile?: string;
@@ -100,9 +62,9 @@ export interface CheckedSharedDatabase {
100
62
  readonly auth?: PostgresAuth;
101
63
  }
102
64
  /**
103
- * Check the database URL and credential flags of `atomic storage join` and `--db`. A `postgres://` or
104
- * `postgresql://` URL takes exactly one of `--password-file`, `--token-file` and `--auth`; any other URL is a libSQL
105
- * one, checked by {@link checkTeamUrl}, and takes only `--token-file`, which the caller requires or not.
65
+ * Check the database URL and credential flags of `atomic storage join` and `--db`: a `postgres://` or
66
+ * `postgresql://` URL that takes exactly one of `--password-file`, `--token-file` and `--auth`. A URL of the removed
67
+ * libSQL adapter is refused with how to move off it.
106
68
  */
107
69
  export declare function checkSharedDatabaseArguments(input: SharedDatabaseArguments): CheckedSharedDatabase;
108
70
  /** Check a table prefix with the same rules as every storage prefix. */
@@ -112,45 +74,8 @@ export declare function checkTeamPrefix(prefix: string | undefined, source: Team
112
74
  * a file a selection references is read for every connection; an unreadable or empty file is an invalid input.
113
75
  */
114
76
  export declare function readTeamTokenFile(path: string, source: TeamInputSource, field?: string, read?: "trimmed" | "as-connections-read"): string;
115
- export declare function readTeamTokenFileAsync(path: string, source: TeamInputSource, field?: string, read?: "trimmed" | "as-connections-read"): Promise<string>;
116
- /** A missing token for a URL that needs one. */
117
- export declare function missingTeamToken(url: string, source: Exclude<TeamInputSource, "env">): TeamProfileConfigError;
118
77
  /** More than one token source. */
119
78
  export declare function conflictingTeamToken(source: TeamInputSource, fields: readonly string[]): TeamProfileConfigError;
120
- /** A whitespace-only literal token, or an empty variable name. */
121
- export declare function emptyTeamToken(source: TeamInputSource, field?: string): TeamProfileConfigError;
122
- /**
123
- * The CI profile as a team database selection, without reading or writing settings: sessions and Intercom can both
124
- * use it. A literal `token` becomes an in-memory `{ value }` secret that serializes as
125
- * `[redacted]` and that only SDK callers can pass; `tokenFile` (absolute path) and `tokenEnv` are references read
126
- * when the store opens. Inputs are checked first; nothing else happens.
127
- */
128
- export declare function teamProfileSelection(options: TeamProfileSelectionOptions): TeamStorageSelection;
129
- /**
130
- * The selection `ATOMIC_PROFILE=ci` makes from `ATOMIC_TEAM_URL` and `ATOMIC_TEAM_TOKEN` or `ATOMIC_TEAM_TOKEN_FILE`
131
- * (plus an optional `ATOMIC_TEAM_PREFIX`), or `undefined` without a profile. The token is referenced, never copied:
132
- * `{ env: "ATOMIC_TEAM_TOKEN" }` or the token file's absolute path, so the selection can be handed to child processes.
133
- * Invalid input throws {@link TeamProfileConfigError} with `source: "env"`: a team variable without the profile, or
134
- * the profile without its URL or token, is `incomplete-profile` naming every missing variable at once.
135
- */
136
- export declare function environmentTeamProfile(env?: NodeJS.ProcessEnv): TeamStorageSelection | undefined;
137
- export declare function environmentTeamProfileSelection(env?: NodeJS.ProcessEnv): TeamStorageSelection | undefined;
138
- export declare function environmentTeamProfileAsync(env?: NodeJS.ProcessEnv): Promise<TeamStorageSelection | undefined>;
139
- /**
140
- * Use a team database for Intercom while sessions stay private: checks every input and the
141
- * connection first, then sets the global `storage` setting to the team database and `sessions.storage` to the local
142
- * default store in one settings write, and restarts the Intercom broker so it routes through the team database.
143
- * Rejects with `TeamProfileConfigError` for an invalid input and `TeamProfileError` otherwise; on any rejection
144
- * nothing was changed. A failed broker restart is reported in `broker`, not thrown.
145
- */
146
- export declare function joinTeam(options: JoinTeamOptions): Promise<TeamJoinResult>;
147
- /**
148
- * Restore the individual layout: remove the global `storage` setting and the `sessions.storage` pin when they hold
149
- * exactly what `joinTeam` writes, leave every other value in place, delete the removed selection's token file unless
150
- * another setting references it, and restart the Intercom broker when `storage` was removed. Running it again
151
- * changes nothing.
152
- */
153
- export declare function leaveTeam(options?: LeaveTeamOptions): Promise<TeamLeaveResult>;
154
79
  /**
155
80
  * The layout in effect for this process and working directory (`individual`, `team`, `ci` or `custom`), from the
156
81
  * storage each domain selects. Reads only; an invalid selection rejects with its `StorageConfigError`.
@@ -1,7 +1,6 @@
1
1
  import { readFileSync } from "node:fs";
2
- import { readFile } from "node:fs/promises";
3
- import { isAbsolute, resolve } from "node:path";
4
- import { SHARED_STORAGE_JOIN_HINT, StorageConfigError, StoragePrefixError, TeamProfileConfigError, } from "./errors.js";
2
+ import { StorageConfigError, StoragePrefixError, TeamProfileConfigError, } from "./errors.js";
3
+ import { isLibsqlUrl, LIBSQL_REMOVED_HINT, REMOVED_LIBSQL_ADAPTER } from "./libsql-removed.js";
5
4
  import { validateStoragePrefix } from "./prefix.js";
6
5
  /** What every serialization of an in-memory secret shows instead of the secret. */
7
6
  export const REDACTED_SECRET = "[redacted]";
@@ -81,6 +80,8 @@ function selectStorageAt(value, source, field, defaultPath) {
81
80
  if (value.adapter !== undefined) {
82
81
  if (typeof value.adapter !== "string" || value.adapter.length === 0)
83
82
  return invalid("invalid-adapter");
83
+ if (value.adapter === REMOVED_LIBSQL_ADAPTER)
84
+ throw new StorageConfigError(source, field, "libsql-removed", LIBSQL_REMOVED_HINT);
84
85
  if ("path" in value || "memory" in value)
85
86
  return invalid("multiple-selection-forms");
86
87
  if (value.options !== undefined) {
@@ -142,67 +143,18 @@ export function* selectStorageSteps(value, source, field, defaultPath) {
142
143
  const selection = selectStorageAt(value, source, field, PENDING_DEFAULT_PATH);
143
144
  return takesDefaultPath(value, selection) ? { ...selection, path: yield* defaultPath() } : selection;
144
145
  }
145
- /** The first-party libSQL / Turso adapter package that team setup and `atomic storage join` select. */
146
- export const LIBSQL_ADAPTER_PACKAGE = "@bastani/atomic-storage-libsql";
147
- /** Filename prefix for private token files created by `atomic storage join` and `atomic team join` in the agent directory. */
146
+ /** A token file `atomic storage join` created in the agent directory has this filename prefix. */
148
147
  export const STORAGE_TOKEN_FILE = "storage-token";
149
- /** The `sessions.storage` value `team join` writes: the local default store, named explicitly. */
148
+ /** The `sessions.storage` value that pins sessions to the local default store, named explicitly. */
150
149
  export const LOCAL_SESSIONS_STORAGE = { path: "workflows/journal.sqlite" };
151
- export const TEAM_PROFILE_ENV = "ATOMIC_PROFILE";
152
- export const TEAM_URL_ENV = "ATOMIC_TEAM_URL";
153
- export const TEAM_TOKEN_ENV = "ATOMIC_TEAM_TOKEN";
154
- export const TEAM_TOKEN_FILE_ENV = "ATOMIC_TEAM_TOKEN_FILE";
155
- export const TEAM_PREFIX_ENV = "ATOMIC_TEAM_PREFIX";
156
- /** The variables `ATOMIC_PROFILE=ci` reads; setting any of them without the profile is an error. */
157
- export const TEAM_VARIABLES = [TEAM_URL_ENV, TEAM_TOKEN_ENV, TEAM_TOKEN_FILE_ENV, TEAM_PREFIX_ENV];
158
150
  const FIELDS = {
159
- sdk: { profile: "profile", url: "url", token: "token", tokenFile: "tokenFile", prefix: "prefix" },
160
- cli: { profile: "profile", url: "<url>", token: "--token-file", tokenFile: "--token-file", prefix: "--prefix" },
161
- env: {
162
- profile: TEAM_PROFILE_ENV,
163
- url: TEAM_URL_ENV,
164
- token: TEAM_TOKEN_ENV,
165
- tokenFile: TEAM_TOKEN_FILE_ENV,
166
- prefix: TEAM_PREFIX_ENV,
167
- },
151
+ sdk: { url: "url", token: "token", tokenFile: "tokenFile", prefix: "prefix" },
152
+ cli: { url: "<url>", token: "--token-file", tokenFile: "--token-file", prefix: "--prefix" },
153
+ env: { url: "url", token: "token", tokenFile: "tokenFile", prefix: "prefix" },
168
154
  };
169
155
  function invalid(code, source, field, hint, extra = {}) {
170
156
  return new TeamProfileConfigError(code, { source, field, hint, ...extra });
171
157
  }
172
- /** Whether a database URL holds the token itself: userinfo, or the `authToken` query parameter libSQL URLs accept. */
173
- function carriesCredential(url) {
174
- if (!URL.canParse(url))
175
- return false;
176
- const { username, password, searchParams } = new URL(url);
177
- return username !== "" || password !== "" || searchParams.has("authToken");
178
- }
179
- /** Whether a team database URL needs no token: a local `file:` database. */
180
- export function isFileUrl(url) {
181
- return url.startsWith("file:");
182
- }
183
- /**
184
- * Check a team database URL: a supported scheme, an absolute `file:` URL, and no credential in it. `postgres` only
185
- * changes the unsupported-URL hint, for the commands that also take a `postgres://` URL through
186
- * {@link checkSharedDatabaseArguments}.
187
- */
188
- export function checkTeamUrl(url, source, options = {}) {
189
- const field = FIELDS[source].url;
190
- if (url === undefined || url.length === 0) {
191
- throw invalid("missing-url", source, field, "Pass the team database URL, for example libsql://<db>.turso.io.");
192
- }
193
- if (!/^(libsql|https?|wss?):\/\/[^/]/.test(url) && !isFileUrl(url)) {
194
- throw invalid("unsupported-url", source, field, options.postgres === true
195
- ? "Use a postgres://, postgresql://, libsql://, https://, wss://, or absolute file: URL."
196
- : "Use a libsql://, https://, wss://, or absolute file: URL.");
197
- }
198
- if (isFileUrl(url) && !url.startsWith("file:/")) {
199
- throw invalid("relative-file-url", source, field, "Use an absolute file: URL (for example file:///path/to/shared.sqlite), so every working directory uses the same database.");
200
- }
201
- if (carriesCredential(url)) {
202
- throw invalid("credential-in-url", source, field, `The URL carries a credential (user name, password, or authToken). Remove it and pass the token with ${FIELDS[source].token === FIELDS[source].tokenFile ? FIELDS[source].tokenFile : `${FIELDS[source].token} or ${FIELDS[source].tokenFile}`} instead, so it never reaches settings or output.`);
203
- }
204
- return url;
205
- }
206
158
  /** The first-party PostgreSQL adapter package that `atomic storage join postgres://…` and `--db postgres://…` select. */
207
159
  export const POSTGRES_ADAPTER_PACKAGE = "@bastani/atomic-storage-postgres";
208
160
  /** What `--auth` takes, and the `auth` option each value selects; the option values themselves are accepted too. */
@@ -233,9 +185,9 @@ function checkPostgresUrl(url, source) {
233
185
  return url;
234
186
  }
235
187
  /**
236
- * Check the database URL and credential flags of `atomic storage join` and `--db`. A `postgres://` or
237
- * `postgresql://` URL takes exactly one of `--password-file`, `--token-file` and `--auth`; any other URL is a libSQL
238
- * one, checked by {@link checkTeamUrl}, and takes only `--token-file`, which the caller requires or not.
188
+ * Check the database URL and credential flags of `atomic storage join` and `--db`: a `postgres://` or
189
+ * `postgresql://` URL that takes exactly one of `--password-file`, `--token-file` and `--auth`. A URL of the removed
190
+ * libSQL adapter is refused with how to move off it.
239
191
  */
240
192
  export function checkSharedDatabaseArguments(input) {
241
193
  const { url, tokenFile, passwordFile, auth } = input;
@@ -257,14 +209,9 @@ export function checkSharedDatabaseArguments(input) {
257
209
  throw invalid("unsupported-auth", "cli", "--auth", "Use --auth azure, --auth aws or --auth gcp.");
258
210
  return { url, auth: mode };
259
211
  }
260
- for (const [flag, value] of [
261
- ["--password-file", passwordFile],
262
- ["--auth", auth],
263
- ])
264
- if (value !== undefined)
265
- throw invalid("unsupported-option", "cli", flag, `Only postgres:// and postgresql:// URLs take ${flag}; pass a libSQL database token with --token-file.`);
266
- checkTeamUrl(url, "cli", { postgres: true });
267
- return tokenFile === undefined ? { url } : { url, tokenFile };
212
+ throw invalid(isLibsqlUrl(url) ? "libsql-removed" : "unsupported-url", "cli", FIELDS.cli.url, isLibsqlUrl(url)
213
+ ? `Atomic opens shared databases on PostgreSQL only: use a postgres:// or postgresql:// URL. ${LIBSQL_REMOVED_HINT}`
214
+ : "Use a postgres:// or postgresql:// URL, for example postgres://atomic@db.example.com:5432/atomic.");
268
215
  }
269
216
  /** Check a table prefix with the same rules as every storage prefix. */
270
217
  export function checkTeamPrefix(prefix, source) {
@@ -296,16 +243,6 @@ export function readTeamTokenFile(path, source, field = FIELDS[source].tokenFile
296
243
  }
297
244
  return teamTokenOf(text, path, source, field, read);
298
245
  }
299
- export async function readTeamTokenFileAsync(path, source, field = FIELDS[source].tokenFile, read = "trimmed") {
300
- let text;
301
- try {
302
- text = await readFile(path, "utf8");
303
- }
304
- catch (error) {
305
- throw unreadableTokenFile(path, source, field, error);
306
- }
307
- return teamTokenOf(text, path, source, field, read);
308
- }
309
246
  function unreadableTokenFile(path, source, field, cause) {
310
247
  return invalid("unreadable-token-file", source, field, `Check that ${path} exists and is readable.`, {
311
248
  path,
@@ -324,168 +261,16 @@ function teamTokenOf(text, path, source, field, read) {
324
261
  if (token.length === 0) {
325
262
  throw invalid("empty-token", source, field, field === "--password-file"
326
263
  ? `The password file ${path} is empty: write the database password into it.`
327
- : `The token file ${path} is empty: write the token into it, for example with turso db tokens create <db>.`, { path });
264
+ : `The token file ${path} is empty: write the database password or token into it.`, { path });
328
265
  }
329
266
  return token;
330
267
  }
331
- /** A missing token for a URL that needs one. */
332
- export function missingTeamToken(url, source) {
333
- const scheme = url.split(":")[0];
334
- return invalid("missing-token", source, FIELDS[source].token, source === "cli"
335
- ? `--token-file is required for ${scheme}: URLs; only absolute file: URLs need no token.`
336
- : `Pass the database token for ${scheme}: URLs; only absolute file: URLs need no token.`);
337
- }
338
268
  /** More than one token source. */
339
269
  export function conflictingTeamToken(source, fields) {
340
270
  return invalid("conflicting-token", source, fields.join(", "), `Pass only one of ${fields.join(", ")}.`);
341
271
  }
342
- /** A whitespace-only literal token, or an empty variable name. */
343
- export function emptyTeamToken(source, field = FIELDS[source].token) {
344
- return invalid("empty-token", source, field, `${field} is empty: pass the database token.`);
345
- }
346
- function checkProfile(profile, source) {
347
- if (profile === "ci")
348
- return profile;
349
- throw invalid("unknown-profile", source, FIELDS[source].profile, source === "env" ? `Set ${TEAM_PROFILE_ENV} to ci, or unset it.` : 'Pass profile: "ci".');
350
- }
351
- /**
352
- * The CI profile as a team database selection, without reading or writing settings: sessions and Intercom can both
353
- * use it. A literal `token` becomes an in-memory `{ value }` secret that serializes as
354
- * `[redacted]` and that only SDK callers can pass; `tokenFile` (absolute path) and `tokenEnv` are references read
355
- * when the store opens. Inputs are checked first; nothing else happens.
356
- */
357
- export function teamProfileSelection(options) {
358
- checkProfile(options.profile, "sdk");
359
- const url = checkTeamUrl(options.url, "sdk");
360
- const sources = ["token", "tokenFile", "tokenEnv"].filter((name) => options[name] !== undefined);
361
- if (sources.length > 1)
362
- throw conflictingTeamToken("sdk", ["token", "tokenFile", "tokenEnv"]);
363
- const prefix = checkTeamPrefix(options.prefix, "sdk");
364
- let authToken;
365
- if (options.token !== undefined) {
366
- if (options.token.trim().length === 0)
367
- throw emptyTeamToken("sdk");
368
- authToken = inMemorySecret(options.token);
369
- }
370
- else if (options.tokenFile !== undefined) {
371
- const path = resolve(options.tokenFile);
372
- readTeamTokenFile(path, "sdk");
373
- authToken = { file: path };
374
- }
375
- else if (options.tokenEnv !== undefined) {
376
- if (options.tokenEnv.length === 0)
377
- throw emptyTeamToken("sdk", "tokenEnv");
378
- if (!process.env[options.tokenEnv]) {
379
- throw invalid("missing-token", "sdk", "tokenEnv", `Set ${options.tokenEnv} to the database token: the selection reads the token from it when the store opens.`);
380
- }
381
- authToken = { env: options.tokenEnv };
382
- }
383
- else if (!isFileUrl(url)) {
384
- throw missingTeamToken(url, "sdk");
385
- }
386
- return {
387
- adapter: LIBSQL_ADAPTER_PACKAGE,
388
- options: { url },
389
- ...(authToken === undefined ? {} : { secrets: { authToken } }),
390
- ...(prefix === undefined ? {} : { prefix }),
391
- };
392
- }
393
- function environmentValue(env, name) {
394
- const value = env[name];
395
- return value === undefined || value.length === 0 ? undefined : value;
396
- }
397
- /**
398
- * The selection `ATOMIC_PROFILE=ci` makes from `ATOMIC_TEAM_URL` and `ATOMIC_TEAM_TOKEN` or `ATOMIC_TEAM_TOKEN_FILE`
399
- * (plus an optional `ATOMIC_TEAM_PREFIX`), or `undefined` without a profile. The token is referenced, never copied:
400
- * `{ env: "ATOMIC_TEAM_TOKEN" }` or the token file's absolute path, so the selection can be handed to child processes.
401
- * Invalid input throws {@link TeamProfileConfigError} with `source: "env"`: a team variable without the profile, or
402
- * the profile without its URL or token, is `incomplete-profile` naming every missing variable at once.
403
- */
404
- export function environmentTeamProfile(env = process.env) {
405
- const parsed = parseEnvironmentTeamProfile(env);
406
- if (parsed?.tokenFile !== undefined)
407
- readTeamTokenFile(parsed.tokenFile, "env");
408
- return parsed?.selection;
409
- }
410
- export function environmentTeamProfileSelection(env = process.env) {
411
- return parseEnvironmentTeamProfile(env)?.selection;
412
- }
413
- export async function environmentTeamProfileAsync(env = process.env) {
414
- const parsed = parseEnvironmentTeamProfile(env);
415
- if (parsed?.tokenFile !== undefined)
416
- await readTeamTokenFileAsync(parsed.tokenFile, "env");
417
- return parsed?.selection;
418
- }
419
- function parseEnvironmentTeamProfile(env) {
420
- const profile = environmentValue(env, TEAM_PROFILE_ENV);
421
- const url = environmentValue(env, TEAM_URL_ENV);
422
- const token = environmentValue(env, TEAM_TOKEN_ENV);
423
- const tokenFile = environmentValue(env, TEAM_TOKEN_FILE_ENV);
424
- const prefix = environmentValue(env, TEAM_PREFIX_ENV);
425
- if (profile === undefined) {
426
- const set = TEAM_VARIABLES.filter((name) => environmentValue(env, name) !== undefined);
427
- if (set.length === 0)
428
- return undefined;
429
- throw invalid("incomplete-profile", "env", TEAM_PROFILE_ENV, `${set.join(", ")} ${set.length === 1 ? "is" : "are"} set but ${TEAM_PROFILE_ENV} is not: set ${TEAM_PROFILE_ENV}=ci to use the team database in this process, or unset ${set.length === 1 ? "it" : "them"} (to join this machine to the team database instead, run ${SHARED_STORAGE_JOIN_HINT}).`, { missing: [TEAM_PROFILE_ENV] });
430
- }
431
- checkProfile(profile, "env");
432
- const missing = [
433
- ...(url === undefined ? [TEAM_URL_ENV] : []),
434
- ...(token === undefined && tokenFile === undefined && (url === undefined || !isFileUrl(url))
435
- ? [`${TEAM_TOKEN_ENV} or ${TEAM_TOKEN_FILE_ENV}`]
436
- : []),
437
- ];
438
- if (missing.length > 0) {
439
- throw invalid("incomplete-profile", "env", missing.join(", "), `${TEAM_PROFILE_ENV}=ci needs the team database URL and its token: set ${missing.join(" and ")} (only an absolute file: URL needs no token).`, { missing });
440
- }
441
- const checkedUrl = checkTeamUrl(url, "env");
442
- if (token !== undefined && tokenFile !== undefined) {
443
- throw conflictingTeamToken("env", [TEAM_TOKEN_ENV, TEAM_TOKEN_FILE_ENV]);
444
- }
445
- const checkedPrefix = checkTeamPrefix(prefix, "env");
446
- let secrets;
447
- let checkedTokenFile;
448
- if (token !== undefined) {
449
- if (token.trim().length === 0)
450
- throw emptyTeamToken("env");
451
- secrets = { authToken: { env: TEAM_TOKEN_ENV } };
452
- }
453
- else if (tokenFile !== undefined) {
454
- if (!isAbsolute(tokenFile)) {
455
- throw invalid("relative-token-file", "env", TEAM_TOKEN_FILE_ENV, `Set ${TEAM_TOKEN_FILE_ENV} to an absolute path, for example under $RUNNER_TEMP: the processes Atomic starts would resolve a relative path against their own working directory.`);
456
- }
457
- checkedTokenFile = resolve(tokenFile);
458
- secrets = { authToken: { file: checkedTokenFile } };
459
- }
460
- const selection = {
461
- adapter: LIBSQL_ADAPTER_PACKAGE,
462
- options: { url: checkedUrl },
463
- ...(secrets === undefined ? {} : { secrets }),
464
- ...(checkedPrefix === undefined ? {} : { prefix: checkedPrefix }),
465
- };
466
- return checkedTokenFile === undefined ? { selection } : { selection, tokenFile: checkedTokenFile };
467
- }
468
- // The team setup SDK loads the settings and storage machinery on first use, so importing the storage module stays
469
- // cheap for storage adapters and hosts that never set up a team.
470
- /**
471
- * Use a team database for Intercom while sessions stay private: checks every input and the
472
- * connection first, then sets the global `storage` setting to the team database and `sessions.storage` to the local
473
- * default store in one settings write, and restarts the Intercom broker so it routes through the team database.
474
- * Rejects with `TeamProfileConfigError` for an invalid input and `TeamProfileError` otherwise; on any rejection
475
- * nothing was changed. A failed broker restart is reported in `broker`, not thrown.
476
- */
477
- export async function joinTeam(options) {
478
- return (await import("./team.code.js").catch((error) => __atomicOnDemandFailed(error, "session storage"))).joinTeam(options);
479
- }
480
- /**
481
- * Restore the individual layout: remove the global `storage` setting and the `sessions.storage` pin when they hold
482
- * exactly what `joinTeam` writes, leave every other value in place, delete the removed selection's token file unless
483
- * another setting references it, and restart the Intercom broker when `storage` was removed. Running it again
484
- * changes nothing.
485
- */
486
- export async function leaveTeam(options = {}) {
487
- return (await import("./team.code.js").catch((error) => __atomicOnDemandFailed(error, "session storage"))).leaveTeam(options);
488
- }
272
+ // `getTeamProfile` loads the settings and storage machinery on first use, so importing the storage module stays
273
+ // cheap for storage adapters and hosts that never read the layout.
489
274
  /**
490
275
  * The layout in effect for this process and working directory (`individual`, `team`, `ci` or `custom`), from the
491
276
  * storage each domain selects. Reads only; an invalid selection rejects with its `StorageConfigError`.
@@ -500,7 +285,7 @@ function __atomicOnDemandFailed(error, feature) {
500
285
  return (async () => {
501
286
  const root = new URL("../../", import.meta.url);
502
287
  const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
503
- const key = `${root.href}#0.10.11-alpha.2`;
288
+ const key = `${root.href}#0.10.11-alpha.3`;
504
289
  let release = releases.get(key);
505
290
  if (release === undefined) {
506
291
  const current = (async () => {
@@ -528,7 +313,7 @@ function __atomicOnDemandFailed(error, feature) {
528
313
  } catch {
529
314
  // No installation to read, as in a bundle of the package: the release the process runs decides.
530
315
  }
531
- const updatedTo = typeof installed === "string" && installed !== "0.10.11-alpha.2" ? installed : running !== undefined && running.version !== "0.10.11-alpha.2" ? "0.10.11-alpha.2" : undefined;
316
+ const updatedTo = typeof installed === "string" && installed !== "0.10.11-alpha.3" ? installed : running !== undefined && running.version !== "0.10.11-alpha.3" ? "0.10.11-alpha.3" : undefined;
532
317
  if (updatedTo === undefined) throw error;
533
318
  const application = typeof running?.name === "string" ? running.name : "atomic";
534
319
  const restart = new Error(`${application} was updated to ${updatedTo} while this session was running; restart it to keep using ${feature}.`, {