@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
@@ -8,13 +8,14 @@ export * from "./dialect.js";
8
8
  export * from "./errors.js";
9
9
  export * from "./fenced-paths.js";
10
10
  export { claimFileAtomically, claimFileAtomicallyAsync, defaultSessionDatabasePath, defaultSessionDatabasePathAsync, defaultSharedStoragePath, defaultSharedStoragePathAsync, readClaimFile, readClaimFileAsync, type StorageHomeSettings, sameDirectory, sameDirectoryAsync, storageHomeDir, storageHomeDirAsync, storagePathBaseDir, storagePathBaseDirAsync, workflowsStorageDir, workflowsStorageDirAsync, } from "./file-identity.js";
11
+ export { joinTeam, LIBSQL_ADAPTER_PACKAGE, leaveTeam, SHARED_STORAGE_JOIN_HINT, TEAM_PREFIX_ENV, TEAM_PROFILE_ENV, TEAM_TOKEN_ENV, TEAM_TOKEN_FILE_ENV, TEAM_URL_ENV, teamProfileSelection, } from "./libsql-removed.js";
11
12
  export * from "./migrations.js";
12
13
  export { DEFAULT_GROUP_COMMIT_HOLD_MS, getWriterQueueDegradation, getWriterQueueStats, openNodeSqliteDatabase, sqliteFilePath, type WriterQueueStats, wrapNodeSqliteDatabase, } from "./node-sqlite.js";
13
14
  export { POSTGRES_HASHED_STORAGE_IDENTIFIER_SUFFIXES, POSTGRES_MAX_STORAGE_PREFIX_LENGTH, POSTGRES_STORAGE_IDENTIFIER_SUFFIXES, renderStorageIdentifiers, storageMigrationTable, validateStoragePrefix, } from "./prefix.js";
14
15
  export * from "./provider.js";
15
16
  export { assertStorageSchemaVersion, assertStoredSchemaVersion } from "./schema.js";
16
17
  export * from "./schema-catalog.js";
17
- export { getTeamProfile, type InMemorySecretRef, inMemorySecret, isPostgresUrl, joinTeam, LIBSQL_ADAPTER_PACKAGE, LOCAL_SESSIONS_STORAGE, leaveTeam, POSTGRES_ADAPTER_PACKAGE, REDACTED_SECRET, type StorageInputSelection, type StorageSettingsSelection, selectStorage, selectStorageAsync, TEAM_PREFIX_ENV, TEAM_PROFILE_ENV, TEAM_TOKEN_ENV, TEAM_TOKEN_FILE_ENV, TEAM_URL_ENV, type TeamProfileSelectionOptions, type TeamStorageSelection, teamProfileSelection, } from "./selection.js";
18
+ export { getTeamProfile, type InMemorySecretRef, inMemorySecret, isPostgresUrl, LOCAL_SESSIONS_STORAGE, POSTGRES_ADAPTER_PACKAGE, REDACTED_SECRET, type StorageInputSelection, type StorageSettingsSelection, selectStorage, selectStorageAsync, } from "./selection.js";
18
19
  export type { ExpandedChildCall, ExpandedChildDetails } from "./session/expanded-child-details.js";
19
20
  export declare function readExpandedChildDetails(...args: Parameters<typeof import("./session/expanded-child-details.js").readExpandedChildDetails>): Promise<import("./session/expanded-child-details.js").ExpandedChildDetails>;
20
21
  export declare function readSavedChildLaunch(...args: Parameters<typeof import("./session/expanded-child-details.js").readSavedChildLaunch>): Promise<import("./session/types.js").ChildDisplayLaunch | undefined>;
@@ -24,6 +25,6 @@ export declare function readSessionHistory(...args: Parameters<typeof import("./
24
25
  export declare function readSessionHistoryChunks(...args: Parameters<typeof import("./session/history-pages.js").readSessionHistoryChunks>): AsyncGenerator<Uint8Array<ArrayBufferLike>, void, any>;
25
26
  export type { ArchivedChildCatalogEntry, OversizedSessionEntry, SessionBlob, SessionCompactionPoint, SessionEntriesPage, SessionEntriesQuery, SessionEntryAt, SessionEntryRange, SessionEntrySizes, SessionForkWindow, SessionHistoryItem, SessionHistoryPage, SessionHistoryReadOptions, SessionHistoryTotals, SessionRecoveryState, SessionResume, SessionResumeRetainedSetting, SessionResumeRetainedSettings, SessionSearchCoverage, SessionSearchExtendOptions, SessionSearchIndex, SessionSearchText, SessionStateEntry, SessionStore, SessionStoredEntry, SessionTail, SessionTaskReferenceCandidate, SessionTaskReferenceDuplicatePage, SessionTaskReferenceDuplicateQuery, SessionUsageTotals, } from "./session/types.js";
26
27
  export * from "./sqlite-facade.js";
27
- export type { JoinTeamOptions, LeaveTeamOptions, TeamBrokerRestart, TeamJoinResult, TeamKeptSetting, TeamLeaveResult, TeamProfile, TeamProfileName, TeamProfileOptions, TeamSettingKey, } from "./team.js";
28
+ export type { TeamProfile, TeamProfileName, TeamProfileOptions } from "./team.js";
28
29
  export { switchToWriteAheadLog } from "./write-ahead-log.js";
29
30
  //# sourceMappingURL=index.d.ts.map
@@ -5,13 +5,15 @@ export * from "./dialect.js";
5
5
  export * from "./errors.js";
6
6
  export * from "./fenced-paths.js";
7
7
  export { claimFileAtomically, claimFileAtomicallyAsync, defaultSessionDatabasePath, defaultSessionDatabasePathAsync, defaultSharedStoragePath, defaultSharedStoragePathAsync, readClaimFile, readClaimFileAsync, sameDirectory, sameDirectoryAsync, storageHomeDir, storageHomeDirAsync, storagePathBaseDir, storagePathBaseDirAsync, workflowsStorageDir, workflowsStorageDirAsync, } from "./file-identity.js";
8
+ // Removed with libSQL support; see libsql-removed.ts for why they are still exported.
9
+ export { joinTeam, LIBSQL_ADAPTER_PACKAGE, leaveTeam, SHARED_STORAGE_JOIN_HINT, TEAM_PREFIX_ENV, TEAM_PROFILE_ENV, TEAM_TOKEN_ENV, TEAM_TOKEN_FILE_ENV, TEAM_URL_ENV, teamProfileSelection, } from "./libsql-removed.js";
8
10
  export * from "./migrations.js";
9
11
  export { DEFAULT_GROUP_COMMIT_HOLD_MS, getWriterQueueDegradation, getWriterQueueStats, openNodeSqliteDatabase, sqliteFilePath, wrapNodeSqliteDatabase, } from "./node-sqlite.js";
10
12
  export { POSTGRES_HASHED_STORAGE_IDENTIFIER_SUFFIXES, POSTGRES_MAX_STORAGE_PREFIX_LENGTH, POSTGRES_STORAGE_IDENTIFIER_SUFFIXES, renderStorageIdentifiers, storageMigrationTable, validateStoragePrefix, } from "./prefix.js";
11
13
  export * from "./provider.js";
12
14
  export { assertStorageSchemaVersion, assertStoredSchemaVersion } from "./schema.js";
13
15
  export * from "./schema-catalog.js";
14
- export { getTeamProfile, inMemorySecret, isPostgresUrl, joinTeam, LIBSQL_ADAPTER_PACKAGE, LOCAL_SESSIONS_STORAGE, leaveTeam, POSTGRES_ADAPTER_PACKAGE, REDACTED_SECRET, selectStorage, selectStorageAsync, TEAM_PREFIX_ENV, TEAM_PROFILE_ENV, TEAM_TOKEN_ENV, TEAM_TOKEN_FILE_ENV, TEAM_URL_ENV, teamProfileSelection, } from "./selection.js";
16
+ export { getTeamProfile, inMemorySecret, isPostgresUrl, LOCAL_SESSIONS_STORAGE, POSTGRES_ADAPTER_PACKAGE, REDACTED_SECRET, selectStorage, selectStorageAsync, } from "./selection.js";
15
17
  export async function readExpandedChildDetails(...args) {
16
18
  return (await import("./session/expanded-child-details.code.js").catch((error) => __atomicOnDemandFailed(error, "session storage"))).readExpandedChildDetails(...args);
17
19
  }
@@ -40,7 +42,7 @@ function __atomicOnDemandFailed(error, feature) {
40
42
  return (async () => {
41
43
  const root = new URL("../../", import.meta.url);
42
44
  const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
43
- const key = `${root.href}#0.10.11-alpha.2`;
45
+ const key = `${root.href}#0.10.11-alpha.3`;
44
46
  let release = releases.get(key);
45
47
  if (release === undefined) {
46
48
  const current = (async () => {
@@ -68,7 +70,7 @@ function __atomicOnDemandFailed(error, feature) {
68
70
  } catch {
69
71
  // No installation to read, as in a bundle of the package: the release the process runs decides.
70
72
  }
71
- 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;
73
+ 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;
72
74
  if (updatedTo === undefined) throw error;
73
75
  const application = typeof running?.name === "string" ? running.name : "atomic";
74
76
  const restart = new Error(`${application} was updated to ${updatedTo} while this session was running; restart it to keep using ${feature}.`, {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/storage/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAExH,2GAA2G;AAC3G,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAmBzD,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,OAAO,EACN,mBAAmB,EACnB,wBAAwB,EACxB,0BAA0B,EAC1B,+BAA+B,EAC/B,wBAAwB,EACxB,6BAA6B,EAC7B,aAAa,EACb,kBAAkB,EAElB,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,wBAAwB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,OAAO,EACN,4BAA4B,EAC5B,yBAAyB,EACzB,mBAAmB,EACnB,sBAAsB,EACtB,cAAc,EAEd,sBAAsB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,2CAA2C,EAC3C,kCAAkC,EAClC,oCAAoC,EACpC,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,GACrB,MAAM,aAAa,CAAC;AACrB,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACpF,cAAc,qBAAqB,CAAC;AACpC,OAAO,EACN,cAAc,EAEd,cAAc,EACd,aAAa,EACb,QAAQ,EACR,sBAAsB,EACtB,sBAAsB,EACtB,SAAS,EACT,wBAAwB,EACxB,eAAe,EAGf,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,YAAY,EAGZ,oBAAoB,GACpB,MAAM,gBAAgB,CAAC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MemorySnapshotBlobStore, SqlSnapshotBlobStore, snapshotIndexTables } from \"../worktree-snapshot/blob-store.ts\";\nexport type { SnapshotBlob, SnapshotBlobStore } from \"../worktree-snapshot/types.ts\";\n/** @internal How a transaction of a pipelined connection sends its last writes with its commit (#6560). */\nexport { transactionFinisher } from \"./added-exports.js\";\nexport type {\n\tFencedPathId,\n\tSqliteBatchOptions,\n\tSqliteDatabase,\n\tSqliteExecutor,\n\tSqliteRow,\n\tSqliteRunResult,\n\tSqliteStatement,\n\tSqliteTransactionOptions,\n\tSqliteValue,\n\tStorageDescriptor,\n\tStorageListenerState,\n\tStorageNotificationEvent,\n\tStorageNotificationSubscription,\n\tStorageNotifications,\n\tStorageOpenedCatalog,\n\tTransactionConcurrency,\n} from \"./database.js\";\nexport * from \"./dialect.js\";\nexport * from \"./errors.js\";\nexport * from \"./fenced-paths.js\";\nexport {\n\tclaimFileAtomically,\n\tclaimFileAtomicallyAsync,\n\tdefaultSessionDatabasePath,\n\tdefaultSessionDatabasePathAsync,\n\tdefaultSharedStoragePath,\n\tdefaultSharedStoragePathAsync,\n\treadClaimFile,\n\treadClaimFileAsync,\n\ttype StorageHomeSettings,\n\tsameDirectory,\n\tsameDirectoryAsync,\n\tstorageHomeDir,\n\tstorageHomeDirAsync,\n\tstoragePathBaseDir,\n\tstoragePathBaseDirAsync,\n\tworkflowsStorageDir,\n\tworkflowsStorageDirAsync,\n} from \"./file-identity.js\";\nexport * from \"./migrations.js\";\nexport {\n\tDEFAULT_GROUP_COMMIT_HOLD_MS,\n\tgetWriterQueueDegradation,\n\tgetWriterQueueStats,\n\topenNodeSqliteDatabase,\n\tsqliteFilePath,\n\ttype WriterQueueStats,\n\twrapNodeSqliteDatabase,\n} from \"./node-sqlite.js\";\nexport {\n\tPOSTGRES_HASHED_STORAGE_IDENTIFIER_SUFFIXES,\n\tPOSTGRES_MAX_STORAGE_PREFIX_LENGTH,\n\tPOSTGRES_STORAGE_IDENTIFIER_SUFFIXES,\n\trenderStorageIdentifiers,\n\tstorageMigrationTable,\n\tvalidateStoragePrefix,\n} from \"./prefix.js\";\nexport * from \"./provider.js\";\nexport { assertStorageSchemaVersion, assertStoredSchemaVersion } from \"./schema.js\";\nexport * from \"./schema-catalog.js\";\nexport {\n\tgetTeamProfile,\n\ttype InMemorySecretRef,\n\tinMemorySecret,\n\tisPostgresUrl,\n\tjoinTeam,\n\tLIBSQL_ADAPTER_PACKAGE,\n\tLOCAL_SESSIONS_STORAGE,\n\tleaveTeam,\n\tPOSTGRES_ADAPTER_PACKAGE,\n\tREDACTED_SECRET,\n\ttype StorageInputSelection,\n\ttype StorageSettingsSelection,\n\tselectStorage,\n\tselectStorageAsync,\n\tTEAM_PREFIX_ENV,\n\tTEAM_PROFILE_ENV,\n\tTEAM_TOKEN_ENV,\n\tTEAM_TOKEN_FILE_ENV,\n\tTEAM_URL_ENV,\n\ttype TeamProfileSelectionOptions,\n\ttype TeamStorageSelection,\n\tteamProfileSelection,\n} from \"./selection.js\";\nexport type { ExpandedChildCall, ExpandedChildDetails } from \"./session/expanded-child-details.js\";\nexport async function readExpandedChildDetails(\n\t...args: Parameters<typeof import(\"./session/expanded-child-details.js\").readExpandedChildDetails>\n) {\n\treturn (await import(\"./session/expanded-child-details.js\")).readExpandedChildDetails(...args);\n}\nexport async function readSavedChildLaunch(\n\t...args: Parameters<typeof import(\"./session/expanded-child-details.js\").readSavedChildLaunch>\n) {\n\treturn (await import(\"./session/expanded-child-details.js\")).readSavedChildLaunch(...args);\n}\nexport async function readSessionChildCatalog(\n\t...args: Parameters<typeof import(\"./session/child-reader.js\").readSessionChildCatalog>\n) {\n\treturn (await import(\"./session/child-reader.js\")).readSessionChildCatalog(...args);\n}\nexport async function findInSessionHistory(\n\t...args: Parameters<typeof import(\"./session/history-pages.js\").findInSessionHistory>\n) {\n\treturn (await import(\"./session/history-pages.js\")).findInSessionHistory(...args);\n}\n// Ordinary storage setup does not open a transcript reader or import its encoders.\nexport async function* readSessionHistory(\n\t...args: Parameters<typeof import(\"./session/history-pages.js\").readSessionHistory>\n) {\n\tyield* (await import(\"./session/history-pages.js\")).readSessionHistory(...args);\n}\nexport async function* readSessionHistoryChunks(\n\t...args: Parameters<typeof import(\"./session/history-pages.js\").readSessionHistoryChunks>\n) {\n\tyield* (await import(\"./session/history-pages.js\")).readSessionHistoryChunks(...args);\n}\nexport type {\n\tArchivedChildCatalogEntry,\n\tOversizedSessionEntry,\n\tSessionBlob,\n\tSessionCompactionPoint,\n\tSessionEntriesPage,\n\tSessionEntriesQuery,\n\tSessionEntryAt,\n\tSessionEntryRange,\n\tSessionEntrySizes,\n\tSessionForkWindow,\n\tSessionHistoryItem,\n\tSessionHistoryPage,\n\tSessionHistoryReadOptions,\n\tSessionHistoryTotals,\n\tSessionRecoveryState,\n\tSessionResume,\n\tSessionResumeRetainedSetting,\n\tSessionResumeRetainedSettings,\n\tSessionSearchCoverage,\n\tSessionSearchExtendOptions,\n\tSessionSearchIndex,\n\tSessionSearchText,\n\tSessionStateEntry,\n\tSessionStore,\n\tSessionStoredEntry,\n\tSessionTail,\n\tSessionTaskReferenceCandidate,\n\tSessionTaskReferenceDuplicatePage,\n\tSessionTaskReferenceDuplicateQuery,\n\tSessionUsageTotals,\n} from \"./session/types.js\";\nexport * from \"./sqlite-facade.js\";\nexport type {\n\tJoinTeamOptions,\n\tLeaveTeamOptions,\n\tTeamBrokerRestart,\n\tTeamJoinResult,\n\tTeamKeptSetting,\n\tTeamLeaveResult,\n\tTeamProfile,\n\tTeamProfileName,\n\tTeamProfileOptions,\n\tTeamSettingKey,\n} from \"./team.js\";\nexport { switchToWriteAheadLog } from \"./write-ahead-log.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/storage/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAExH,2GAA2G;AAC3G,OAAO,EAAE,mBAAmB,EAAE,MAAM,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AAC;AACD,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACzC,GAAG,IAA2F;IAE9F,OAAO,CAAC,MAAM,MAAM,CAAC,qCAAqC,CAAC,CAAC,CAAC,oBAAoB,CAAC,GAAG,IAAI,CAAC,CAAC;AAC5F,CAAC;AACD,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC5C,GAAG,IAAoF;IAEvF,OAAO,CAAC,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC,CAAC,uBAAuB,CAAC,GAAG,IAAI,CAAC,CAAC;AACrF,CAAC;AACD,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACzC,GAAG,IAAkF;IAErF,OAAO,CAAC,MAAM,MAAM,CAAC,4BAA4B,CAAC,CAAC,CAAC,oBAAoB,CAAC,GAAG,IAAI,CAAC,CAAC;AACnF,CAAC;AACD,mFAAmF;AACnF,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,kBAAkB,CACxC,GAAG,IAAgF;IAEnF,KAAK,CAAC,CAAC,CAAC,MAAM,MAAM,CAAC,4BAA4B,CAAC,CAAC,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC,CAAC;AACjF,CAAC;AACD,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,wBAAwB,CAC9C,GAAG,IAAsF;IAEzF,KAAK,CAAC,CAAC,CAAC,MAAM,MAAM,CAAC,4BAA4B,CAAC,CAAC,CAAC,wBAAwB,CAAC,GAAG,IAAI,CAAC,CAAC;AACvF,CAAC;AAiCD,cAAc,oBAAoB,CAAC;AAEnC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["export type { SnapshotIndexTables } from \"../worktree-snapshot/blob-store.ts\";\nexport { MemorySnapshotBlobStore, SqlSnapshotBlobStore, snapshotIndexTables } from \"../worktree-snapshot/blob-store.ts\";\nexport type { SnapshotBlob, SnapshotBlobStore } from \"../worktree-snapshot/types.ts\";\n/** @internal How a transaction of a pipelined connection sends its last writes with its commit (#6560). */\nexport { transactionFinisher } from \"./added-exports.js\";\nexport type {\n\tFencedPathId,\n\tSqliteBatchOptions,\n\tSqliteDatabase,\n\tSqliteExecutor,\n\tSqliteRow,\n\tSqliteRunResult,\n\tSqliteStatement,\n\tSqliteTransactionOptions,\n\tSqliteValue,\n\tStorageDescriptor,\n\tStorageListenerState,\n\tStorageNotificationEvent,\n\tStorageNotificationSubscription,\n\tStorageNotifications,\n\tStorageOpenedCatalog,\n\tTransactionConcurrency,\n} from \"./database.js\";\nexport * from \"./dialect.js\";\nexport * from \"./errors.js\";\nexport * from \"./fenced-paths.js\";\nexport {\n\tclaimFileAtomically,\n\tclaimFileAtomicallyAsync,\n\tdefaultSessionDatabasePath,\n\tdefaultSessionDatabasePathAsync,\n\tdefaultSharedStoragePath,\n\tdefaultSharedStoragePathAsync,\n\treadClaimFile,\n\treadClaimFileAsync,\n\ttype StorageHomeSettings,\n\tsameDirectory,\n\tsameDirectoryAsync,\n\tstorageHomeDir,\n\tstorageHomeDirAsync,\n\tstoragePathBaseDir,\n\tstoragePathBaseDirAsync,\n\tworkflowsStorageDir,\n\tworkflowsStorageDirAsync,\n} from \"./file-identity.js\";\n// Removed with libSQL support; see libsql-removed.ts for why they are still exported.\nexport {\n\tjoinTeam,\n\tLIBSQL_ADAPTER_PACKAGE,\n\tleaveTeam,\n\tSHARED_STORAGE_JOIN_HINT,\n\tTEAM_PREFIX_ENV,\n\tTEAM_PROFILE_ENV,\n\tTEAM_TOKEN_ENV,\n\tTEAM_TOKEN_FILE_ENV,\n\tTEAM_URL_ENV,\n\tteamProfileSelection,\n} from \"./libsql-removed.js\";\nexport * from \"./migrations.js\";\nexport {\n\tDEFAULT_GROUP_COMMIT_HOLD_MS,\n\tgetWriterQueueDegradation,\n\tgetWriterQueueStats,\n\topenNodeSqliteDatabase,\n\tsqliteFilePath,\n\ttype WriterQueueStats,\n\twrapNodeSqliteDatabase,\n} from \"./node-sqlite.js\";\nexport {\n\tPOSTGRES_HASHED_STORAGE_IDENTIFIER_SUFFIXES,\n\tPOSTGRES_MAX_STORAGE_PREFIX_LENGTH,\n\tPOSTGRES_STORAGE_IDENTIFIER_SUFFIXES,\n\trenderStorageIdentifiers,\n\tstorageMigrationTable,\n\tvalidateStoragePrefix,\n} from \"./prefix.js\";\nexport * from \"./provider.js\";\nexport { assertStorageSchemaVersion, assertStoredSchemaVersion } from \"./schema.js\";\nexport * from \"./schema-catalog.js\";\nexport {\n\tgetTeamProfile,\n\ttype InMemorySecretRef,\n\tinMemorySecret,\n\tisPostgresUrl,\n\tLOCAL_SESSIONS_STORAGE,\n\tPOSTGRES_ADAPTER_PACKAGE,\n\tREDACTED_SECRET,\n\ttype StorageInputSelection,\n\ttype StorageSettingsSelection,\n\tselectStorage,\n\tselectStorageAsync,\n} from \"./selection.js\";\nexport type { ExpandedChildCall, ExpandedChildDetails } from \"./session/expanded-child-details.js\";\nexport async function readExpandedChildDetails(\n\t...args: Parameters<typeof import(\"./session/expanded-child-details.js\").readExpandedChildDetails>\n) {\n\treturn (await import(\"./session/expanded-child-details.js\")).readExpandedChildDetails(...args);\n}\nexport async function readSavedChildLaunch(\n\t...args: Parameters<typeof import(\"./session/expanded-child-details.js\").readSavedChildLaunch>\n) {\n\treturn (await import(\"./session/expanded-child-details.js\")).readSavedChildLaunch(...args);\n}\nexport async function readSessionChildCatalog(\n\t...args: Parameters<typeof import(\"./session/child-reader.js\").readSessionChildCatalog>\n) {\n\treturn (await import(\"./session/child-reader.js\")).readSessionChildCatalog(...args);\n}\nexport async function findInSessionHistory(\n\t...args: Parameters<typeof import(\"./session/history-pages.js\").findInSessionHistory>\n) {\n\treturn (await import(\"./session/history-pages.js\")).findInSessionHistory(...args);\n}\n// Ordinary storage setup does not open a transcript reader or import its encoders.\nexport async function* readSessionHistory(\n\t...args: Parameters<typeof import(\"./session/history-pages.js\").readSessionHistory>\n) {\n\tyield* (await import(\"./session/history-pages.js\")).readSessionHistory(...args);\n}\nexport async function* readSessionHistoryChunks(\n\t...args: Parameters<typeof import(\"./session/history-pages.js\").readSessionHistoryChunks>\n) {\n\tyield* (await import(\"./session/history-pages.js\")).readSessionHistoryChunks(...args);\n}\nexport type {\n\tArchivedChildCatalogEntry,\n\tOversizedSessionEntry,\n\tSessionBlob,\n\tSessionCompactionPoint,\n\tSessionEntriesPage,\n\tSessionEntriesQuery,\n\tSessionEntryAt,\n\tSessionEntryRange,\n\tSessionEntrySizes,\n\tSessionForkWindow,\n\tSessionHistoryItem,\n\tSessionHistoryPage,\n\tSessionHistoryReadOptions,\n\tSessionHistoryTotals,\n\tSessionRecoveryState,\n\tSessionResume,\n\tSessionResumeRetainedSetting,\n\tSessionResumeRetainedSettings,\n\tSessionSearchCoverage,\n\tSessionSearchExtendOptions,\n\tSessionSearchIndex,\n\tSessionSearchText,\n\tSessionStateEntry,\n\tSessionStore,\n\tSessionStoredEntry,\n\tSessionTail,\n\tSessionTaskReferenceCandidate,\n\tSessionTaskReferenceDuplicatePage,\n\tSessionTaskReferenceDuplicateQuery,\n\tSessionUsageTotals,\n} from \"./session/types.js\";\nexport * from \"./sqlite-facade.js\";\nexport type { TeamProfile, TeamProfileName, TeamProfileOptions } from \"./team.js\";\nexport { switchToWriteAheadLog } from \"./write-ahead-log.js\";\n"]}
@@ -0,0 +1,71 @@
1
+ import type { StorageSettingsSelection } from "./selection.js";
2
+ /**
3
+ * What refuses libSQL now that its support is removed (0.10.11), and the exports that went with it.
4
+ *
5
+ * This is a module no earlier release has. A process of an earlier release that an in-place update caught keeps the
6
+ * copies of `selection.js`, `team.js` and the rest it loaded, and can load this build's modules later: a named import
7
+ * of a name those copies lack would fail to link, so the modules that refuse libSQL take it from here. The removed
8
+ * exports below stay, re-exported from the paths that had them, so that the earlier release's own code still links
9
+ * against this build's modules: the constants keep their values, and every function throws the `libsql-removed`
10
+ * refusal.
11
+ */
12
+ /** The removed libSQL adapter package, which a settings file, variable or SDK selection may still name. */
13
+ export declare const REMOVED_LIBSQL_ADAPTER = "@bastani/atomic-storage-libsql";
14
+ /** The variables of the removed `ATOMIC_PROFILE=ci` team profile, which selected a libSQL database. */
15
+ export declare const REMOVED_TEAM_VARIABLES: readonly string[];
16
+ /** Where the docs say how to move sessions off libSQL. */
17
+ export declare const LIBSQL_MIGRATION_DOCS_URL = "https://docs.bastani.ai/storage#moving-off-libsql";
18
+ /** What every refusal of a libSQL selection, URL or team variable says after its own first sentence. */
19
+ export declare const LIBSQL_REMOVED_HINT = "libSQL support (Turso, sqld and libSQL file: databases) was removed in Atomic 0.10.11. To keep your sessions, export them with Atomic 0.10.11-alpha.2, which reads every libSQL database (npx -y @bastani/atomic@0.10.11-alpha.2 storage export <dir> --storage-file <old-storage.json>), then import them into SQLite or PostgreSQL with this release (atomic storage import <dir>). See https://docs.bastani.ai/storage#moving-off-libsql";
20
+ /** Whether a database URL is one only the removed libSQL adapter opened. */
21
+ export declare function isLibsqlUrl(url: string): boolean;
22
+ /**
23
+ * Refuse the variables of the removed `ATOMIC_PROFILE=ci` team profile, all named at once, so a CI job that still sets
24
+ * them fails before any store opens instead of silently using another one.
25
+ */
26
+ export declare function rejectRemovedTeamProfile(env?: NodeJS.ProcessEnv): void;
27
+ /** @deprecated libSQL support was removed in 0.10.11. Use `POSTGRES_ADAPTER_PACKAGE`. */
28
+ export declare const LIBSQL_ADAPTER_PACKAGE = "@bastani/atomic-storage-libsql";
29
+ /** @deprecated The `ATOMIC_PROFILE=ci` team profile was removed with libSQL support in 0.10.11; setting it fails. */
30
+ export declare const TEAM_PROFILE_ENV = "ATOMIC_PROFILE";
31
+ /** @deprecated Removed with the `ATOMIC_PROFILE=ci` team profile in 0.10.11; setting it fails. */
32
+ export declare const TEAM_URL_ENV = "ATOMIC_TEAM_URL";
33
+ /** @deprecated Removed with the `ATOMIC_PROFILE=ci` team profile in 0.10.11; setting it fails. */
34
+ export declare const TEAM_TOKEN_ENV = "ATOMIC_TEAM_TOKEN";
35
+ /** @deprecated Removed with the `ATOMIC_PROFILE=ci` team profile in 0.10.11; setting it fails. */
36
+ export declare const TEAM_TOKEN_FILE_ENV = "ATOMIC_TEAM_TOKEN_FILE";
37
+ /** @deprecated Removed with the `ATOMIC_PROFILE=ci` team profile in 0.10.11; setting it fails. */
38
+ export declare const TEAM_PREFIX_ENV = "ATOMIC_TEAM_PREFIX";
39
+ /** @deprecated Removed with the `ATOMIC_PROFILE=ci` team profile in 0.10.11. */
40
+ export declare const TEAM_PROFILE_SOURCE = "ATOMIC_PROFILE=ci";
41
+ /** @deprecated `atomic team join` was removed with libSQL support in 0.10.11; this names `atomic storage join`. */
42
+ export declare const TEAM_JOIN_COMMAND = "atomic storage join <postgres-url> --password-file <path>";
43
+ /** @deprecated `atomic team join` was removed with libSQL support in 0.10.11; this names `atomic storage join`. */
44
+ export declare const SHARED_STORAGE_JOIN_HINT = "atomic storage join <postgres-url> --password-file <path>";
45
+ /**
46
+ * @deprecated libSQL support was removed in 0.10.11: always throws `TeamProfileConfigError` code `libsql-removed`.
47
+ * Pass `createAgentSession({ storage })` a PostgreSQL selection instead.
48
+ */
49
+ export declare function teamProfileSelection(_options?: object): never;
50
+ /**
51
+ * @deprecated libSQL support was removed in 0.10.11: always rejects with `TeamProfileConfigError` code
52
+ * `libsql-removed`. Run `atomic storage join postgres://…` instead.
53
+ */
54
+ export declare function joinTeam(_options?: object): Promise<never>;
55
+ /** @deprecated Removed with libSQL support in 0.10.11: always rejects like {@link joinTeam}. */
56
+ export declare function joinTeamWith(_options?: object): Promise<never>;
57
+ /**
58
+ * @deprecated libSQL support was removed in 0.10.11: always rejects with `TeamProfileConfigError` code
59
+ * `libsql-removed`. Remove the `storage` setting instead.
60
+ */
61
+ export declare function leaveTeam(_options?: object): Promise<never>;
62
+ /** @deprecated Removed with libSQL support in 0.10.11: always rejects like {@link leaveTeam}. */
63
+ export declare function leaveTeamWith(_options?: object): Promise<never>;
64
+ /**
65
+ * @deprecated Removed with libSQL support in 0.10.11: rejects with `TeamProfileConfigError` code `libsql-removed` when
66
+ * the selection names the removed adapter, and otherwise resolves.
67
+ */
68
+ export declare function assertTeamAdapterInstalled(_agentDir: string, selection?: object): Promise<void>;
69
+ /** @deprecated The fingerprint the removed `teamJoin` setting recorded; nothing in this release reads it. */
70
+ export declare function storageFingerprint(storage: StorageSettingsSelection): string;
71
+ //# sourceMappingURL=libsql-removed.d.ts.map
@@ -0,0 +1,123 @@
1
+ import { createHash } from "node:crypto";
2
+ import { TeamProfileConfigError } from "./errors.js";
3
+ /**
4
+ * What refuses libSQL now that its support is removed (0.10.11), and the exports that went with it.
5
+ *
6
+ * This is a module no earlier release has. A process of an earlier release that an in-place update caught keeps the
7
+ * copies of `selection.js`, `team.js` and the rest it loaded, and can load this build's modules later: a named import
8
+ * of a name those copies lack would fail to link, so the modules that refuse libSQL take it from here. The removed
9
+ * exports below stay, re-exported from the paths that had them, so that the earlier release's own code still links
10
+ * against this build's modules: the constants keep their values, and every function throws the `libsql-removed`
11
+ * refusal.
12
+ */
13
+ /** The removed libSQL adapter package, which a settings file, variable or SDK selection may still name. */
14
+ export const REMOVED_LIBSQL_ADAPTER = "@bastani/atomic-storage-libsql";
15
+ /** The variables of the removed `ATOMIC_PROFILE=ci` team profile, which selected a libSQL database. */
16
+ export const REMOVED_TEAM_VARIABLES = [
17
+ "ATOMIC_PROFILE",
18
+ "ATOMIC_TEAM_URL",
19
+ "ATOMIC_TEAM_TOKEN",
20
+ "ATOMIC_TEAM_TOKEN_FILE",
21
+ "ATOMIC_TEAM_PREFIX",
22
+ ];
23
+ /** Where the docs say how to move sessions off libSQL. */
24
+ export const LIBSQL_MIGRATION_DOCS_URL = "https://docs.bastani.ai/storage#moving-off-libsql";
25
+ /** What every refusal of a libSQL selection, URL or team variable says after its own first sentence. */
26
+ export const LIBSQL_REMOVED_HINT = `libSQL support (Turso, sqld and libSQL file: databases) was removed in Atomic 0.10.11. To keep your sessions, export them with Atomic 0.10.11-alpha.2, which reads every libSQL database (npx -y @bastani/atomic@0.10.11-alpha.2 storage export <dir> --storage-file <old-storage.json>), then import them into SQLite or PostgreSQL with this release (atomic storage import <dir>). See ${LIBSQL_MIGRATION_DOCS_URL}`;
27
+ /** Whether a database URL is one only the removed libSQL adapter opened. */
28
+ export function isLibsqlUrl(url) {
29
+ return /^(libsql|https?|wss?):\/\//.test(url) || url.startsWith("file:");
30
+ }
31
+ /**
32
+ * Refuse the variables of the removed `ATOMIC_PROFILE=ci` team profile, all named at once, so a CI job that still sets
33
+ * them fails before any store opens instead of silently using another one.
34
+ */
35
+ export function rejectRemovedTeamProfile(env = process.env) {
36
+ const set = REMOVED_TEAM_VARIABLES.filter((name) => (env[name] ?? "").length > 0);
37
+ if (set.length === 0)
38
+ return;
39
+ throw new TeamProfileConfigError("libsql-removed", {
40
+ source: "env",
41
+ field: set.join(", "),
42
+ hint: `${set.join(", ")} ${set.length === 1 ? "is" : "are"} set, but the ATOMIC_PROFILE=ci team profile they select was removed with libSQL support. Unset ${set.length === 1 ? "it" : "them"} and select a PostgreSQL database instead: run atomic storage join postgres://… or set ATOMIC_STORAGE. ${LIBSQL_REMOVED_HINT}`,
43
+ });
44
+ }
45
+ /** The refusal a removed libSQL team setup function throws when called. */
46
+ function removedTeamSetup(name) {
47
+ return new TeamProfileConfigError("libsql-removed", {
48
+ source: "sdk",
49
+ field: name,
50
+ hint: `${name}() was removed with libSQL support. Select a PostgreSQL database instead: run atomic storage join postgres://…, or pass createAgentSession({ storage }) a PostgreSQL selection. ${LIBSQL_REMOVED_HINT}`,
51
+ });
52
+ }
53
+ /** @deprecated libSQL support was removed in 0.10.11. Use `POSTGRES_ADAPTER_PACKAGE`. */
54
+ export const LIBSQL_ADAPTER_PACKAGE = REMOVED_LIBSQL_ADAPTER;
55
+ /** @deprecated The `ATOMIC_PROFILE=ci` team profile was removed with libSQL support in 0.10.11; setting it fails. */
56
+ export const TEAM_PROFILE_ENV = "ATOMIC_PROFILE";
57
+ /** @deprecated Removed with the `ATOMIC_PROFILE=ci` team profile in 0.10.11; setting it fails. */
58
+ export const TEAM_URL_ENV = "ATOMIC_TEAM_URL";
59
+ /** @deprecated Removed with the `ATOMIC_PROFILE=ci` team profile in 0.10.11; setting it fails. */
60
+ export const TEAM_TOKEN_ENV = "ATOMIC_TEAM_TOKEN";
61
+ /** @deprecated Removed with the `ATOMIC_PROFILE=ci` team profile in 0.10.11; setting it fails. */
62
+ export const TEAM_TOKEN_FILE_ENV = "ATOMIC_TEAM_TOKEN_FILE";
63
+ /** @deprecated Removed with the `ATOMIC_PROFILE=ci` team profile in 0.10.11; setting it fails. */
64
+ export const TEAM_PREFIX_ENV = "ATOMIC_TEAM_PREFIX";
65
+ /** @deprecated Removed with the `ATOMIC_PROFILE=ci` team profile in 0.10.11. */
66
+ export const TEAM_PROFILE_SOURCE = "ATOMIC_PROFILE=ci";
67
+ /** @deprecated `atomic team join` was removed with libSQL support in 0.10.11; this names `atomic storage join`. */
68
+ export const TEAM_JOIN_COMMAND = "atomic storage join <postgres-url> --password-file <path>";
69
+ /** @deprecated `atomic team join` was removed with libSQL support in 0.10.11; this names `atomic storage join`. */
70
+ export const SHARED_STORAGE_JOIN_HINT = TEAM_JOIN_COMMAND;
71
+ /**
72
+ * @deprecated libSQL support was removed in 0.10.11: always throws `TeamProfileConfigError` code `libsql-removed`.
73
+ * Pass `createAgentSession({ storage })` a PostgreSQL selection instead.
74
+ */
75
+ export function teamProfileSelection(_options) {
76
+ throw removedTeamSetup("teamProfileSelection");
77
+ }
78
+ /**
79
+ * @deprecated libSQL support was removed in 0.10.11: always rejects with `TeamProfileConfigError` code
80
+ * `libsql-removed`. Run `atomic storage join postgres://…` instead.
81
+ */
82
+ export async function joinTeam(_options) {
83
+ throw removedTeamSetup("joinTeam");
84
+ }
85
+ /** @deprecated Removed with libSQL support in 0.10.11: always rejects like {@link joinTeam}. */
86
+ export async function joinTeamWith(_options) {
87
+ throw removedTeamSetup("joinTeam");
88
+ }
89
+ /**
90
+ * @deprecated libSQL support was removed in 0.10.11: always rejects with `TeamProfileConfigError` code
91
+ * `libsql-removed`. Remove the `storage` setting instead.
92
+ */
93
+ export async function leaveTeam(_options) {
94
+ throw removedTeamSetup("leaveTeam");
95
+ }
96
+ /** @deprecated Removed with libSQL support in 0.10.11: always rejects like {@link leaveTeam}. */
97
+ export async function leaveTeamWith(_options) {
98
+ throw removedTeamSetup("leaveTeam");
99
+ }
100
+ /**
101
+ * @deprecated Removed with libSQL support in 0.10.11: rejects with `TeamProfileConfigError` code `libsql-removed` when
102
+ * the selection names the removed adapter, and otherwise resolves.
103
+ */
104
+ export async function assertTeamAdapterInstalled(_agentDir, selection) {
105
+ if (selection !== undefined && "adapter" in selection && selection.adapter === REMOVED_LIBSQL_ADAPTER)
106
+ throw removedTeamSetup("assertTeamAdapterInstalled");
107
+ }
108
+ function canonicalJson(value) {
109
+ if (Array.isArray(value))
110
+ return `[${value.map(canonicalJson).join(",")}]`;
111
+ if (value !== null && typeof value === "object") {
112
+ const entries = Object.entries(value)
113
+ .filter(([, entry]) => entry !== undefined)
114
+ .sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0));
115
+ return `{${entries.map(([key, entry]) => `${JSON.stringify(key)}:${canonicalJson(entry)}`).join(",")}}`;
116
+ }
117
+ return JSON.stringify(value);
118
+ }
119
+ /** @deprecated The fingerprint the removed `teamJoin` setting recorded; nothing in this release reads it. */
120
+ export function storageFingerprint(storage) {
121
+ return `sha256:${createHash("sha256").update(canonicalJson(storage)).digest("hex")}`;
122
+ }
123
+ //# sourceMappingURL=libsql-removed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"libsql-removed.js","sourceRoot":"","sources":["../../../src/core/storage/libsql-removed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAGrD;;;;;;;;;GASG;AAEH,2GAA2G;AAC3G,MAAM,CAAC,MAAM,sBAAsB,GAAG,gCAAgC,CAAC;AACvE,uGAAuG;AACvG,MAAM,CAAC,M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AC;AAC9B,CAAC;AAED,6GAA6G;AAC7G,MAAM,UAAU,kBAAkB,CAAC,OAAiC;IACnE,OAAO,UAAU,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AACtF,CAAC","sourcesContent":["import { createHash } from \"node:crypto\";\nimport { TeamProfileConfigError } from \"./errors.js\";\nimport type { StorageSettingsSelection } from \"./selection.js\";\n\n/**\n * What refuses libSQL now that its support is removed (0.10.11), and the exports that went with it.\n *\n * This is a module no earlier release has. A process of an earlier release that an in-place update caught keeps the\n * copies of `selection.js`, `team.js` and the rest it loaded, and can load this build's modules later: a named import\n * of a name those copies lack would fail to link, so the modules that refuse libSQL take it from here. The removed\n * exports below stay, re-exported from the paths that had them, so that the earlier release's own code still links\n * against this build's modules: the constants keep their values, and every function throws the `libsql-removed`\n * refusal.\n */\n\n/** The removed libSQL adapter package, which a settings file, variable or SDK selection may still name. */\nexport const REMOVED_LIBSQL_ADAPTER = \"@bastani/atomic-storage-libsql\";\n/** The variables of the removed `ATOMIC_PROFILE=ci` team profile, which selected a libSQL database. */\nexport const REMOVED_TEAM_VARIABLES: readonly string[] = [\n\t\"ATOMIC_PROFILE\",\n\t\"ATOMIC_TEAM_URL\",\n\t\"ATOMIC_TEAM_TOKEN\",\n\t\"ATOMIC_TEAM_TOKEN_FILE\",\n\t\"ATOMIC_TEAM_PREFIX\",\n];\n/** Where the docs say how to move sessions off libSQL. */\nexport const LIBSQL_MIGRATION_DOCS_URL = \"https://docs.bastani.ai/storage#moving-off-libsql\";\n/** What every refusal of a libSQL selection, URL or team variable says after its own first sentence. */\nexport const LIBSQL_REMOVED_HINT = `libSQL support (Turso, sqld and libSQL file: databases) was removed in Atomic 0.10.11. To keep your sessions, export them with Atomic 0.10.11-alpha.2, which reads every libSQL database (npx -y @bastani/atomic@0.10.11-alpha.2 storage export <dir> --storage-file <old-storage.json>), then import them into SQLite or PostgreSQL with this release (atomic storage import <dir>). See ${LIBSQL_MIGRATION_DOCS_URL}`;\n\n/** Whether a database URL is one only the removed libSQL adapter opened. */\nexport function isLibsqlUrl(url: string): boolean {\n\treturn /^(libsql|https?|wss?):\\/\\//.test(url) || url.startsWith(\"file:\");\n}\n\n/**\n * Refuse the variables of the removed `ATOMIC_PROFILE=ci` team profile, all named at once, so a CI job that still sets\n * them fails before any store opens instead of silently using another one.\n */\nexport function rejectRemovedTeamProfile(env: NodeJS.ProcessEnv = process.env): void {\n\tconst set = REMOVED_TEAM_VARIABLES.filter((name) => (env[name] ?? \"\").length > 0);\n\tif (set.length === 0) return;\n\tthrow new TeamProfileConfigError(\"libsql-removed\", {\n\t\tsource: \"env\",\n\t\tfield: set.join(\", \"),\n\t\thint: `${set.join(\", \")} ${set.length === 1 ? \"is\" : \"are\"} set, but the ATOMIC_PROFILE=ci team profile they select was removed with libSQL support. Unset ${set.length === 1 ? \"it\" : \"them\"} and select a PostgreSQL database instead: run atomic storage join postgres://… or set ATOMIC_STORAGE. ${LIBSQL_REMOVED_HINT}`,\n\t});\n}\n\n/** The refusal a removed libSQL team setup function throws when called. */\nfunction removedTeamSetup(name: string): TeamProfileConfigError {\n\treturn new TeamProfileConfigError(\"libsql-removed\", {\n\t\tsource: \"sdk\",\n\t\tfield: name,\n\t\thint: `${name}() was removed with libSQL support. Select a PostgreSQL database instead: run atomic storage join postgres://…, or pass createAgentSession({ storage }) a PostgreSQL selection. ${LIBSQL_REMOVED_HINT}`,\n\t});\n}\n\n/** @deprecated libSQL support was removed in 0.10.11. Use `POSTGRES_ADAPTER_PACKAGE`. */\nexport const LIBSQL_ADAPTER_PACKAGE = REMOVED_LIBSQL_ADAPTER;\n/** @deprecated The `ATOMIC_PROFILE=ci` team profile was removed with libSQL support in 0.10.11; setting it fails. */\nexport const TEAM_PROFILE_ENV = \"ATOMIC_PROFILE\";\n/** @deprecated Removed with the `ATOMIC_PROFILE=ci` team profile in 0.10.11; setting it fails. */\nexport const TEAM_URL_ENV = \"ATOMIC_TEAM_URL\";\n/** @deprecated Removed with the `ATOMIC_PROFILE=ci` team profile in 0.10.11; setting it fails. */\nexport const TEAM_TOKEN_ENV = \"ATOMIC_TEAM_TOKEN\";\n/** @deprecated Removed with the `ATOMIC_PROFILE=ci` team profile in 0.10.11; setting it fails. */\nexport const TEAM_TOKEN_FILE_ENV = \"ATOMIC_TEAM_TOKEN_FILE\";\n/** @deprecated Removed with the `ATOMIC_PROFILE=ci` team profile in 0.10.11; setting it fails. */\nexport const TEAM_PREFIX_ENV = \"ATOMIC_TEAM_PREFIX\";\n/** @deprecated Removed with the `ATOMIC_PROFILE=ci` team profile in 0.10.11. */\nexport const TEAM_PROFILE_SOURCE = \"ATOMIC_PROFILE=ci\";\n/** @deprecated `atomic team join` was removed with libSQL support in 0.10.11; this names `atomic storage join`. */\nexport const TEAM_JOIN_COMMAND = \"atomic storage join <postgres-url> --password-file <path>\";\n/** @deprecated `atomic team join` was removed with libSQL support in 0.10.11; this names `atomic storage join`. */\nexport const SHARED_STORAGE_JOIN_HINT = TEAM_JOIN_COMMAND;\n\n/**\n * @deprecated libSQL support was removed in 0.10.11: always throws `TeamProfileConfigError` code `libsql-removed`.\n * Pass `createAgentSession({ storage })` a PostgreSQL selection instead.\n */\nexport function teamProfileSelection(_options?: object): never {\n\tthrow removedTeamSetup(\"teamProfileSelection\");\n}\n\n/**\n * @deprecated libSQL support was removed in 0.10.11: always rejects with `TeamProfileConfigError` code\n * `libsql-removed`. Run `atomic storage join postgres://…` instead.\n */\nexport async function joinTeam(_options?: object): Promise<never> {\n\tthrow removedTeamSetup(\"joinTeam\");\n}\n\n/** @deprecated Removed with libSQL support in 0.10.11: always rejects like {@link joinTeam}. */\nexport async function joinTeamWith(_options?: object): Promise<never> {\n\tthrow removedTeamSetup(\"joinTeam\");\n}\n\n/**\n * @deprecated libSQL support was removed in 0.10.11: always rejects with `TeamProfileConfigError` code\n * `libsql-removed`. Remove the `storage` setting instead.\n */\nexport async function leaveTeam(_options?: object): Promise<never> {\n\tthrow removedTeamSetup(\"leaveTeam\");\n}\n\n/** @deprecated Removed with libSQL support in 0.10.11: always rejects like {@link leaveTeam}. */\nexport async function leaveTeamWith(_options?: object): Promise<never> {\n\tthrow removedTeamSetup(\"leaveTeam\");\n}\n\n/**\n * @deprecated Removed with libSQL support in 0.10.11: rejects with `TeamProfileConfigError` code `libsql-removed` when\n * the selection names the removed adapter, and otherwise resolves.\n */\nexport async function assertTeamAdapterInstalled(_agentDir: string, selection?: object): Promise<void> {\n\tif (selection !== undefined && \"adapter\" in selection && selection.adapter === REMOVED_LIBSQL_ADAPTER)\n\t\tthrow removedTeamSetup(\"assertTeamAdapterInstalled\");\n}\n\nfunction canonicalJson(value: unknown): string {\n\tif (Array.isArray(value)) return `[${value.map(canonicalJson).join(\",\")}]`;\n\tif (value !== null && typeof value === \"object\") {\n\t\tconst entries = Object.entries(value as Record<string, unknown>)\n\t\t\t.filter(([, entry]) => entry !== undefined)\n\t\t\t.sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0));\n\t\treturn `{${entries.map(([key, entry]) => `${JSON.stringify(key)}:${canonicalJson(entry)}`).join(\",\")}}`;\n\t}\n\treturn JSON.stringify(value);\n}\n\n/** @deprecated The fingerprint the removed `teamJoin` setting recorded; nothing in this release reads it. */\nexport function storageFingerprint(storage: StorageSettingsSelection): string {\n\treturn `sha256:${createHash(\"sha256\").update(canonicalJson(storage)).digest(\"hex\")}`;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { SqliteDatabase, SqliteExecutor } from "./database.js";
1
+ import type { SqliteDatabase, SqliteExecutor, SqliteStatement, TransactionConcurrency } from "./database.js";
2
2
  import { type StorageDialect } from "./dialect.js";
3
3
  /** One version of a domain's schema. */
4
4
  export interface StorageMigrationStep {
@@ -20,13 +20,6 @@ export interface StorageMigrationOptions {
20
20
  * them still reads and writes it correctly (#5065).
21
21
  */
22
22
  readonly acceptNewer?: boolean;
23
- /**
24
- * A recorded version above the last step and at most this one is accepted, and nothing runs; a newer one is still
25
- * refused. For versions that only an explicit command records, never a migration this call would run: the sessions
26
- * domain's version 3, which turns on forks that share their parent's history (#6560), and which builds that do not
27
- * list it refuse.
28
- */
29
- readonly recordedThrough?: number;
30
23
  }
31
24
  export interface StorageMigrationResult {
32
25
  /** The versions this call ran, in order. */
@@ -43,6 +36,55 @@ export interface StorageMigrationResult {
43
36
  * own version row stays authoritative there.
44
37
  */
45
38
  export declare function applyStorageMigrations(database: SqliteDatabase, domain: string, steps: readonly StorageMigrationStep[], options?: StorageMigrationOptions): Promise<StorageMigrationResult>;
39
+ /** @internal An advisory lock a {@link setUpStorageOnce} setup takes on PostgreSQL, without waiting for it. */
40
+ export interface StorageSetupLock {
41
+ /** The lock's name. */
42
+ readonly scope: string;
43
+ /**
44
+ * The name is qualified by the transaction's schema, as the adapter names the locks of a serial transaction's domain
45
+ * (`<schema>:<scope>`, and `<scope>` alone in `public`): one that excludes such transactions, as an earlier build runs.
46
+ */
47
+ readonly inSchema?: boolean;
48
+ /** Taken shared, as a serial transaction with a domain takes the database's lock. */
49
+ readonly shared?: boolean;
50
+ }
51
+ /** @internal A schema setup that {@link setUpStorageOnce} runs once among the processes that start it together. */
52
+ export interface StorageSetupOnce<T> {
53
+ /**
54
+ * The advisory locks the setup holds on PostgreSQL: every lock a setup of the same objects by an earlier build takes,
55
+ * so the two never run at once.
56
+ */
57
+ readonly locks: readonly StorageSetupLock[];
58
+ /**
59
+ * On PostgreSQL, the reads the setup makes first, in this order, sent with the try's start: see the transaction
60
+ * option `leading`. Read, with `locks`, at each try.
61
+ */
62
+ readonly leading?: readonly SqliteStatement[];
63
+ /**
64
+ * Reads, without a lock or a transaction, whether the setup is done, such as by another process meanwhile: its answer
65
+ * then, or undefined while it is not. Asked only after a try found the lock held.
66
+ */
67
+ readonly done: () => Promise<T | undefined>;
68
+ /**
69
+ * The setup, in its transaction: it checks again, under the lock, what it would change, and changes only that.
70
+ * `locked` tells that the transaction holds `locks`, which it does not where it waited in the transaction
71
+ * `concurrency` names.
72
+ */
73
+ readonly setup: (transaction: SqliteExecutor, locked: boolean) => Promise<T>;
74
+ /** How the setup's transaction waits for the lock after polling for {@link SETUP_WAIT_MS}, as it did before. */
75
+ readonly concurrency: TransactionConcurrency;
76
+ }
77
+ /**
78
+ * @internal Runs `once.setup`, a schema setup, so that of the processes that start it at once, on a new database say,
79
+ * one runs it and the others wait for it without queueing for its lock (#6560). The setup's transaction tries its locks
80
+ * without waiting: an advisory lock on PostgreSQL (`once.locks`), the database's write lock on a SQLite file. A process
81
+ * that finds them taken holds no lock and no connection while it waits: it polls `once.done`, with growing pauses,
82
+ * until the setup is done, and tries again whenever it is not, so a holder that set up something else, or failed, or
83
+ * died, leaves the setup to the next try. After {@link SETUP_WAIT_MS} ({@link SQLITE_SETUP_WAIT_MS} on SQLite) it
84
+ * waits for the lock in the transaction `once.concurrency` names, as before. Where the database tries no lock without waiting, the setup runs in that
85
+ * transaction at once.
86
+ */
87
+ export declare function setUpStorageOnce<T>(database: SqliteDatabase, once: StorageSetupOnce<T>): Promise<T>;
46
88
  /** One domain's migration for {@link applyStorageMigrationsTogether}: the arguments of {@link applyStorageMigrations}. */
47
89
  export interface StorageDomainMigration {
48
90
  readonly domain: string;
@@ -80,7 +122,7 @@ export interface StorageSchemaSetup {
80
122
  /**
81
123
  * Whether the catalog an open in progress read (`withStorageSchemaCatalog`) records `schema.revision` for the
82
124
  * store already, so {@link ensureStorageSchema} would run nothing: the store's open then skips its schema transaction
83
- * and its lock (#6560). On SQLite and libSQL the store's schema stamp records it, and only while nothing changed the
125
+ * and its lock (#6560). On SQLite the store's schema stamp records it, and only while nothing changed the
84
126
  * schema since (`sqliteSchemaStampTable`). False outside such an open, and when the revision is not recorded.
85
127
  */
86
128
  export declare function storageSchemaCurrent(database: SqliteDatabase, schema: StorageSchemaSetup): Promise<boolean>;
@@ -90,11 +132,31 @@ export declare function storageSchemaCurrent(database: SqliteDatabase, schema: S
90
132
  * database with versioned migrations (PostgreSQL) a current schema runs no DDL at all, so a runtime role with only DML
91
133
  * privileges opens it; a schema that is behind runs `setup` under the store's advisory lock, then records the revision,
92
134
  * so concurrent processes set it up once. A role that may not run the DDL then fails with
93
- * `StorageConfigError` reason `missing-privilege` from the adapter. On SQLite and libSQL, which keep no ledger, `setup`
135
+ * `StorageConfigError` reason `missing-privilege` from the adapter. On SQLite, which keep no ledger, `setup`
94
136
  * runs every time it is called, as before, and then stamps the store with the schema version the transaction leaves,
95
137
  * which {@link storageSchemaCurrent} believes until the schema changes again (#6560).
96
138
  */
97
- export declare function ensureStorageSchema(executor: SqliteExecutor, dialect: StorageDialect, schema: StorageSchemaSetup, setup: () => Promise<void>): Promise<void>;
139
+ export declare function ensureStorageSchema(executor: SqliteExecutor, dialect: StorageDialect, schema: StorageSchemaSetup, setup: () => Promise<void>, options?: EnsureStorageSchemaOptions): Promise<void>;
140
+ /** How {@link ensureStorageSchema} runs in a transaction that holds the setup's locks already. */
141
+ export interface EnsureStorageSchemaOptions {
142
+ /**
143
+ * The transaction holds the setup's locks already, as a {@link setUpStorageOnce} setup does: the ledger is read only
144
+ * under them, and the prefix's setup lock is not taken again.
145
+ */
146
+ readonly locked?: boolean;
147
+ /** With `locked`: the ledger exists, so its version is the first read, as {@link postgresSetupReads} lists them. */
148
+ readonly ledgerExists?: boolean;
149
+ /** The setup is the transaction's last call: its last statements go out with the commit. */
150
+ readonly last?: boolean;
151
+ }
152
+ /**
153
+ * Runs `setup`, a store's idempotent schema statements, as {@link ensureStorageSchema} does, in a transaction of its own:
154
+ * of the processes that open a new database at once, one runs it and the others wait for the ledger to record it,
155
+ * without its lock (`setUpStorageOnce`, #6560). Inside an open, a revision the open's catalog records runs nothing; the
156
+ * caller checks that first (`storageSchemaCurrent`). PostgreSQL; elsewhere the setup runs in a serial transaction of the
157
+ * ledger's domain.
158
+ */
159
+ export declare function ensureStorageSchemaOnce(database: SqliteDatabase, schema: StorageSchemaSetup, setup: (transaction: SqliteExecutor) => Promise<void>): Promise<void>;
98
160
  /** What {@link ensureTableFillfactor} sets, and records under `schema:<domain>` in the ledger. */
99
161
  export interface StorageFillfactorSetup extends StorageSchemaSetup {
100
162
  /** The table, already prefixed. */
@@ -106,9 +168,11 @@ export interface StorageFillfactorSetup extends StorageSchemaSetup {
106
168
  * Sets `setup.table`'s fillfactor on PostgreSQL, once per database, recorded in the ledger as `schema:<domain>`: each
107
169
  * page then keeps room for a new version of the rows on it, so updates of rows that change no indexed column stay on
108
170
  * their page as HOT updates and touch no index (#6560). It applies to the pages written from then on; `VACUUM FULL`
109
- * or pg_repack rewrites the existing ones with it. Nothing runs where the catalog an open read records the step, where
110
- * the table has a fillfactor already, or where this role does not own the table: a runtime role without DDL opens as
111
- * before, and `atomic storage migrate`, run as the owner, sets it. Does nothing on SQLite and libSQL.
171
+ * or pg_repack rewrites the existing ones with it. Nothing runs where the catalog an open read records the step.
172
+ * Otherwise one read of the table's catalog entry decides: nothing runs where the table has a fillfactor already, or
173
+ * where this role does not own the table, so a runtime role without DDL opens as before, and `atomic storage migrate`,
174
+ * run as the owner, sets it. A process reads that once for each database and table, so until migrate records the step
175
+ * only its first open pays the read. Does nothing on SQLite.
112
176
  */
113
177
  export declare function ensureTableFillfactor(database: SqliteDatabase, setup: StorageFillfactorSetup): Promise<void>;
114
178
  //# sourceMappingURL=migrations.d.ts.map