@bastani/atomic 0.10.11-alpha.1 → 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 (457) hide show
  1. package/CHANGELOG.md +155 -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 +9 -9
  7. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +8 -8
  8. package/dist/_shared/mode-shared-2QJSCUM6.js +9 -9
  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 +5 -5
  16. package/dist/_shared/{sdk-AVFII7NK.js → sdk-B5LEWGGI.js} +2633 -488
  17. package/dist/_shared/sdk-B5LEWGGI.js.map +1 -0
  18. package/dist/_shared/session-data-AHTU7IS6.js +3 -3
  19. package/dist/_shared/session-manager-list-2BLEEZVG.js +1 -1
  20. package/dist/_shared/settings-startup-8-DNZ2RIHM.js +1 -1
  21. package/dist/_shared/{settings-startup-4QCVCI53.js → settings-startup-HXQLSUWM.js} +8 -2
  22. package/dist/_shared/settings-startup-HXQLSUWM.js.map +1 -0
  23. package/dist/_shared/{startup-0-0-57KF6LZH.js → startup-0-0-EZUKEP4Q.js} +436 -51
  24. package/dist/_shared/startup-0-0-EZUKEP4Q.js.map +1 -0
  25. package/dist/_shared/{startup-0-1-GIY75K46.js → startup-0-1-RTOHJFDJ.js} +240 -279
  26. package/dist/_shared/startup-0-1-RTOHJFDJ.js.map +1 -0
  27. package/dist/_shared/{startup-0-2-27OWFHV6.js → startup-0-2-5QHPCEON.js} +254 -46
  28. package/dist/_shared/startup-0-2-5QHPCEON.js.map +1 -0
  29. package/dist/_shared/{startup-0-3-T4DVFYWX.js → startup-0-3-4ZYBYQNM.js} +273 -14
  30. package/dist/_shared/startup-0-3-4ZYBYQNM.js.map +1 -0
  31. package/dist/_shared/startup-0-4-ZMJV547D.js +14 -9
  32. package/dist/_shared/startup-0-4-ZMJV547D.js.map +1 -1
  33. package/dist/_shared/startup-0-5-YDW47QX6.js +10 -10
  34. package/dist/_shared/startup-0-5-YDW47QX6.js.map +1 -1
  35. package/dist/_shared/startup-10-0-TDQNBDDL.js +9 -9
  36. package/dist/_shared/startup-12-0-55AAXBJZ.js +3 -3
  37. package/dist/_shared/startup-14-0-MLX36RBG.js +6 -7
  38. package/dist/_shared/startup-14-0-MLX36RBG.js.map +1 -1
  39. package/dist/_shared/startup-15-0-YUKGAC63.js +7 -7
  40. package/dist/_shared/startup-15-1-4S7FLMNG.js +22 -30
  41. package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
  42. package/dist/_shared/startup-8-0-34CBHPZH.js +455 -102
  43. package/dist/_shared/startup-8-0-34CBHPZH.js.map +1 -1
  44. package/dist/_shared/{startup-8-1-X32CYSXB.js → startup-8-1-LZFXSD3Z.js} +162 -1184
  45. package/dist/_shared/startup-8-1-LZFXSD3Z.js.map +1 -0
  46. package/dist/_shared/storage-command-7MGXLJGZ.js +189 -36
  47. package/dist/_shared/storage-command-7MGXLJGZ.js.map +1 -1
  48. package/dist/_shared/storage-status-K7PX2RXA.js +557 -0
  49. package/dist/_shared/storage-status-K7PX2RXA.js.map +1 -0
  50. package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
  51. package/dist/_shared/team-DOQKICG2.js +376 -0
  52. package/dist/_shared/team-DOQKICG2.js.map +1 -0
  53. package/dist/_shared/tree-outline-MUEPK5B7.js +3 -3
  54. package/dist/builtin/intercom/CHANGELOG.md +34 -0
  55. package/dist/builtin/intercom/README.md +2 -2
  56. package/dist/builtin/intercom/broker/broker.bundle.mjs +1091 -344
  57. package/dist/builtin/intercom/broker/database-wake-up-bus.ts +243 -64
  58. package/dist/builtin/intercom/broker/multinode-router.ts +154 -22
  59. package/dist/builtin/intercom/broker/multinode-state-store.ts +30 -3
  60. package/dist/builtin/intercom/broker/open-broker-state.ts +14 -0
  61. package/dist/builtin/intercom/broker/sql-add-column.ts +29 -5
  62. package/dist/builtin/intercom/broker/sql-ended-child-queue-store.ts +3 -2
  63. package/dist/builtin/intercom/broker/sql-held-send-store.ts +2 -2
  64. package/dist/builtin/intercom/broker/sql-known-session-store.ts +43 -19
  65. package/dist/builtin/intercom/broker/sql-lease-store.ts +208 -101
  66. package/dist/builtin/intercom/broker/sql-outbox-store.ts +516 -102
  67. package/dist/builtin/intercom/broker/sql-pending-ask-store.ts +8 -5
  68. package/dist/builtin/intercom/broker/sql-released-ask-store.ts +12 -5
  69. package/dist/builtin/intercom/broker/sql-restoring-reservation-store.ts +24 -7
  70. package/dist/builtin/intercom/broker/sql-retention.ts +141 -0
  71. package/dist/builtin/intercom/broker/sql-schema.ts +199 -27
  72. package/dist/builtin/intercom/broker/sql-sent-message-authority.ts +74 -19
  73. package/dist/builtin/intercom/broker/wake-up-bus.ts +6 -0
  74. package/dist/builtin/intercom/index.bundle.mjs +2 -3
  75. package/dist/builtin/intercom/package.json +1 -1
  76. package/dist/builtin/mcp/index.bundle.mjs +1 -1
  77. package/dist/builtin/mcp/package.json +1 -1
  78. package/dist/builtin/subagents/CHANGELOG.md +6 -0
  79. package/dist/builtin/subagents/package.json +1 -1
  80. package/dist/builtin/subagents/src/extension/index.bundle.mjs +1 -1
  81. package/dist/builtin/web-access/index.bundle.mjs +2 -10
  82. package/dist/builtin/web-access/package.json +1 -1
  83. package/dist/bun/bundled-sqlite.js +41 -0
  84. package/dist/bun/bundled-sqlite.js.map +1 -0
  85. package/dist/cli/args.js +2 -2
  86. package/dist/cli/auth-cli.code.js +6 -6
  87. package/dist/cli/auth-cli.impl.js +3 -3
  88. package/dist/cli/auth-cli.js +3 -3
  89. package/dist/cli/blueprint-command.code.js +4 -4
  90. package/dist/cli/blueprint-command.impl.js +3 -3
  91. package/dist/cli/blueprint-command.js +3 -3
  92. package/dist/cli/intercom-command.code.js +4 -4
  93. package/dist/cli/intercom-command.code.js.map +1 -1
  94. package/dist/cli/intercom-command.impl.js +3 -3
  95. package/dist/cli/intercom-command.js +3 -3
  96. package/dist/cli/list-models.code.js +2 -2
  97. package/dist/cli/list-models.impl.js +3 -3
  98. package/dist/cli/list-models.js +3 -3
  99. package/dist/cli/session-picker.code.js +2 -2
  100. package/dist/cli/session-picker.impl.js +3 -3
  101. package/dist/cli/session-picker.js +3 -3
  102. package/dist/cli/startup-ui.code.js +2 -2
  103. package/dist/cli/startup-ui.impl.js +3 -3
  104. package/dist/cli/startup-ui.js +3 -3
  105. package/dist/cli/storage-command.impl.js +3 -3
  106. package/dist/cli/storage-command.js +3 -3
  107. package/dist/cli/storage-search-session.code.js +3 -3
  108. package/dist/cli/storage-search-session.impl.js +3 -3
  109. package/dist/cli/storage-search-session.js +3 -3
  110. package/dist/cli/team-command.code.js +20 -114
  111. package/dist/cli/team-command.code.js.map +1 -1
  112. package/dist/cli/team-command.impl.js +3 -3
  113. package/dist/cli/team-command.js +3 -3
  114. package/dist/cli.js +5 -18
  115. package/dist/cli.js.map +1 -1
  116. package/dist/core/agent-rehydrate-errors.d.ts +4 -9
  117. package/dist/core/compaction/compactor.d.ts +3 -3
  118. package/dist/core/debug.code.js +1 -1
  119. package/dist/core/debug.impl.js +3 -3
  120. package/dist/core/debug.js +3 -3
  121. package/dist/core/export-html/card-projection.impl.js +3 -3
  122. package/dist/core/export-html/card-projection.js +3 -3
  123. package/dist/core/export-html/index.code.js +2 -2
  124. package/dist/core/export-html/index.impl.js +3 -3
  125. package/dist/core/export-html/index.js +3 -3
  126. package/dist/core/export-html/json-spans.impl.js +3 -3
  127. package/dist/core/export-html/json-spans.js +3 -3
  128. package/dist/core/export-html/oversized-render-inputs.code.js +1 -1
  129. package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
  130. package/dist/core/export-html/oversized-render-inputs.js +3 -3
  131. package/dist/core/export-html/tool-renderer.impl.js +3 -3
  132. package/dist/core/export-html/tool-renderer.js +3 -3
  133. package/dist/core/extensions/jiti-loader.impl.js +3 -3
  134. package/dist/core/extensions/jiti-loader.js +3 -3
  135. package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
  136. package/dist/core/extensions/jiti-static-loader.js +3 -3
  137. package/dist/core/extensions/loader-host-modules.code.js +1 -1
  138. package/dist/core/extensions/loader-host-modules.impl.js +3 -3
  139. package/dist/core/extensions/loader-host-modules.js +3 -3
  140. package/dist/core/extensions/loader-virtual-modules.js +1 -1
  141. package/dist/core/extensions/runner-context.js +3 -3
  142. package/dist/core/intercom-broker-control-host.code.js +2 -2
  143. package/dist/core/intercom-broker-control-host.impl.js +3 -3
  144. package/dist/core/intercom-broker-control-host.js +3 -3
  145. package/dist/core/intercom-broker-control.code.js +3 -3
  146. package/dist/core/intercom-broker-control.impl.js +3 -3
  147. package/dist/core/intercom-broker-control.js +3 -3
  148. package/dist/core/package-manager-storage-adapters.code.js +1 -1
  149. package/dist/core/package-manager-storage-adapters.impl.js +3 -3
  150. package/dist/core/package-manager-storage-adapters.js +3 -3
  151. package/dist/core/process-start-token.d.ts +8 -0
  152. package/dist/core/process-tree-containment.d.ts +16 -0
  153. package/dist/core/sdk-types.d.ts +1 -2
  154. package/dist/core/sdk-types.js.map +1 -1
  155. package/dist/core/sdk.code.js +4 -4
  156. package/dist/core/sdk.impl.js +3 -3
  157. package/dist/core/sdk.js +3 -3
  158. package/dist/core/session-manager-core.js +27 -15
  159. package/dist/core/session-manager-core.js.map +1 -1
  160. package/dist/core/session-manager-list.impl.js +3 -3
  161. package/dist/core/session-manager-list.js +3 -3
  162. package/dist/core/session-manager.code.js +3 -3
  163. package/dist/core/session-manager.impl.js +3 -3
  164. package/dist/core/session-manager.js +3 -3
  165. package/dist/core/session-open-markers.js +3 -0
  166. package/dist/core/session-open-markers.js.map +1 -0
  167. package/dist/core/session-storage.code.js +1 -1
  168. package/dist/core/session-storage.impl.js +3 -3
  169. package/dist/core/session-storage.js +3 -3
  170. package/dist/core/settings-schema.d.ts +0 -3
  171. package/dist/core/storage/added-exports-0-10-11.js +19 -0
  172. package/dist/core/storage/added-exports-0-10-11.js.map +1 -0
  173. package/dist/core/storage/added-exports.js +3 -0
  174. package/dist/core/storage/added-exports.js.map +1 -1
  175. package/dist/core/storage/creation-time.js +105 -0
  176. package/dist/core/storage/creation-time.js.map +1 -0
  177. package/dist/core/storage/database.d.ts +56 -5
  178. package/dist/core/storage/database.js.map +1 -1
  179. package/dist/core/storage/dialect.d.ts +1 -1
  180. package/dist/core/storage/dialect.js +1 -1
  181. package/dist/core/storage/dialect.js.map +1 -1
  182. package/dist/core/storage/errors.d.ts +13 -13
  183. package/dist/core/storage/errors.js +10 -16
  184. package/dist/core/storage/errors.js.map +1 -1
  185. package/dist/core/storage/fenced-paths.d.ts +11 -0
  186. package/dist/core/storage/fenced-paths.js +11 -0
  187. package/dist/core/storage/fenced-paths.js.map +1 -1
  188. package/dist/core/storage/file-identity.d.ts +2 -0
  189. package/dist/core/storage/file-identity.js +24 -8
  190. package/dist/core/storage/file-identity.js.map +1 -1
  191. package/dist/core/storage/index.d.ts +4 -3
  192. package/dist/core/storage/index.js +5 -3
  193. package/dist/core/storage/index.js.map +1 -1
  194. package/dist/core/storage/libsql-removed.d.ts +71 -0
  195. package/dist/core/storage/libsql-removed.js +123 -0
  196. package/dist/core/storage/libsql-removed.js.map +1 -0
  197. package/dist/core/storage/migrations.d.ts +81 -8
  198. package/dist/core/storage/migrations.js +386 -47
  199. package/dist/core/storage/migrations.js.map +1 -1
  200. package/dist/core/storage/node-sqlite-file-gate.js +0 -15
  201. package/dist/core/storage/node-sqlite-file-gate.js.map +1 -1
  202. package/dist/core/storage/node-sqlite-thread.js +36 -12
  203. package/dist/core/storage/node-sqlite-thread.js.map +1 -1
  204. package/dist/core/storage/node-sqlite.js +135 -3
  205. package/dist/core/storage/node-sqlite.js.map +1 -1
  206. package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
  207. package/dist/core/storage/offline-snapshot-file.js +3 -3
  208. package/dist/core/storage/prefix.d.ts +1 -1
  209. package/dist/core/storage/prefix.js +14 -2
  210. package/dist/core/storage/prefix.js.map +1 -1
  211. package/dist/core/storage/process-selection.d.ts +5 -5
  212. package/dist/core/storage/provider.js +2 -2
  213. package/dist/core/storage/schema-catalog.d.ts +82 -5
  214. package/dist/core/storage/schema-catalog.js +244 -34
  215. package/dist/core/storage/schema-catalog.js.map +1 -1
  216. package/dist/core/storage/selection.d.ts +7 -82
  217. package/dist/core/storage/selection.js +20 -235
  218. package/dist/core/storage/selection.js.map +1 -1
  219. package/dist/core/storage/session/branch-fork-source.code.js +9 -8
  220. package/dist/core/storage/session/branch-fork-source.code.js.map +1 -1
  221. package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
  222. package/dist/core/storage/session/branch-fork-source.js +3 -3
  223. package/dist/core/storage/session/card-view.impl.js +3 -3
  224. package/dist/core/storage/session/card-view.js +3 -3
  225. package/dist/core/storage/session/child-reader.code.js +4 -4
  226. package/dist/core/storage/session/child-reader.impl.js +3 -3
  227. package/dist/core/storage/session/child-reader.js +3 -3
  228. package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
  229. package/dist/core/storage/session/chunked-resume-projection.js +3 -3
  230. package/dist/core/storage/session/errors.js +1 -1
  231. package/dist/core/storage/session/expanded-child-details.code.js +3 -3
  232. package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
  233. package/dist/core/storage/session/expanded-child-details.js +3 -3
  234. package/dist/core/storage/session/fork-detach.d.ts +118 -0
  235. package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
  236. package/dist/core/storage/session/fork-row-bytes.js +3 -3
  237. package/dist/core/storage/session/fork-row-index.impl.js +3 -3
  238. package/dist/core/storage/session/fork-row-index.js +3 -3
  239. package/dist/core/storage/session/fork-schema.js +53 -0
  240. package/dist/core/storage/session/fork-schema.js.map +1 -0
  241. package/dist/core/storage/session/fork-segments.d.ts +58 -0
  242. package/dist/core/storage/session/fork-staging.code.js +5 -8
  243. package/dist/core/storage/session/fork-staging.code.js.map +1 -1
  244. package/dist/core/storage/session/fork-staging.impl.js +3 -3
  245. package/dist/core/storage/session/fork-staging.js +3 -3
  246. package/dist/core/storage/session/fork-sweep.js +61 -0
  247. package/dist/core/storage/session/fork-sweep.js.map +1 -0
  248. package/dist/core/storage/session/fork-window.code.js +4 -4
  249. package/dist/core/storage/session/fork-window.impl.js +3 -3
  250. package/dist/core/storage/session/fork-window.js +3 -3
  251. package/dist/core/storage/session/history-pages.impl.js +3 -3
  252. package/dist/core/storage/session/history-pages.js +3 -3
  253. package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
  254. package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
  255. package/dist/core/storage/session/jsonl-session-store.d.ts +42 -2
  256. package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
  257. package/dist/core/storage/session/jsonl-session-store.js +3 -3
  258. package/dist/core/storage/session/memory-session-store.impl.js +3 -3
  259. package/dist/core/storage/session/memory-session-store.js +3 -3
  260. package/dist/core/storage/session/pinned-branch-resume.code.js +3 -3
  261. package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
  262. package/dist/core/storage/session/pinned-branch-resume.js +3 -3
  263. package/dist/core/storage/session/released-history-files.code.js +4 -4
  264. package/dist/core/storage/session/released-history-files.impl.js +3 -3
  265. package/dist/core/storage/session/released-history-files.js +3 -3
  266. package/dist/core/storage/session/resident-fork-rows.code.js +1 -1
  267. package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
  268. package/dist/core/storage/session/resident-fork-rows.js +3 -3
  269. package/dist/core/storage/session/session-resume.impl.js +3 -3
  270. package/dist/core/storage/session/session-resume.js +3 -3
  271. package/dist/core/storage/session/session-search-index.d.ts +43 -4
  272. package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
  273. package/dist/core/storage/session/snapshot-cut.js +3 -3
  274. package/dist/core/storage/session/snapshot-history.code.js +4 -4
  275. package/dist/core/storage/session/snapshot-history.impl.js +3 -3
  276. package/dist/core/storage/session/snapshot-history.js +3 -3
  277. package/dist/core/storage/session/sql-session-store.code.js +1 -1
  278. package/dist/core/storage/session/sql-session-store.d.ts +394 -20
  279. package/dist/core/storage/session/sql-session-store.impl.js +4 -4
  280. package/dist/core/storage/session/sql-session-store.js +4 -4
  281. package/dist/core/storage/session/tree-outline.impl.js +3 -3
  282. package/dist/core/storage/session/tree-outline.js +3 -3
  283. package/dist/core/storage/session/tree-presentation.impl.js +3 -3
  284. package/dist/core/storage/session/tree-presentation.js +3 -3
  285. package/dist/core/storage/session/types.d.ts +22 -0
  286. package/dist/core/storage/sqlite-facade.d.ts +23 -2
  287. package/dist/core/storage/sqlite-facade.js +34 -0
  288. package/dist/core/storage/sqlite-facade.js.map +1 -1
  289. package/dist/core/storage/storage-status.code.js +1 -1
  290. package/dist/core/storage/storage-status.impl.js +3 -3
  291. package/dist/core/storage/storage-status.js +3 -3
  292. package/dist/core/storage/team.code.js +1 -1
  293. package/dist/core/storage/team.d.ts +26 -115
  294. package/dist/core/storage/team.impl.js +3 -3
  295. package/dist/core/storage/team.js +3 -3
  296. package/dist/core/structured-output/index.code.js +1 -1
  297. package/dist/core/structured-output/index.impl.js +3 -3
  298. package/dist/core/structured-output/index.js +3 -3
  299. package/dist/core/tasks/task-completion-entry.impl.js +3 -3
  300. package/dist/core/tasks/task-completion-entry.js +3 -3
  301. package/dist/core/tasks/task-file-history.code.js +4 -4
  302. package/dist/core/tasks/task-file-history.impl.js +3 -3
  303. package/dist/core/tasks/task-file-history.js +3 -3
  304. package/dist/core/tasks/task-reference-archive.code.js +5 -5
  305. package/dist/core/tasks/task-reference-archive.js +3 -3
  306. package/dist/core/tasks/task-reference-identity.js +3 -3
  307. package/dist/core/tasks/task-reference-stream.impl.js +3 -3
  308. package/dist/core/tasks/task-reference-stream.js +3 -3
  309. package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
  310. package/dist/core/tasks/task-unsaved-answer.js +3 -3
  311. package/dist/core/tasks/task-view-source.code.js +1 -1
  312. package/dist/core/tasks/task-view-source.impl.js +3 -3
  313. package/dist/core/tasks/task-view-source.js +3 -3
  314. package/dist/core/tools/history-session.d.ts +2 -0
  315. package/dist/core/tools/history-tasks.d.ts +3 -2
  316. package/dist/core/tools/read-url.code.js +4 -4
  317. package/dist/core/tools/read-url.impl.js +3 -3
  318. package/dist/core/tools/read-url.js +3 -3
  319. package/dist/core/worktree-snapshot/blob-store.d.ts +71 -3
  320. package/dist/core/worktree-snapshot/blob-store.js +575 -67
  321. package/dist/core/worktree-snapshot/blob-store.js.map +1 -1
  322. package/dist/core/worktree-snapshot/errors.code.js +3 -3
  323. package/dist/core/worktree-snapshot/errors.impl.js +3 -3
  324. package/dist/core/worktree-snapshot/errors.js +3 -3
  325. package/dist/core/worktree-snapshot/fork-blob-guard.js +81 -0
  326. package/dist/core/worktree-snapshot/fork-blob-guard.js.map +1 -0
  327. package/dist/core/worktree-snapshot/fork-snapshot-index.js +162 -0
  328. package/dist/core/worktree-snapshot/fork-snapshot-index.js.map +1 -0
  329. package/dist/core/worktree-snapshot/session-index-reset.code.js +4 -0
  330. package/dist/core/worktree-snapshot/session-index-reset.code.js.map +1 -1
  331. package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
  332. package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
  333. package/dist/extensions/codemode/execute.code.js +2 -2
  334. package/dist/extensions/codemode/execute.impl.js +3 -3
  335. package/dist/extensions/codemode/execute.js +3 -3
  336. package/dist/extensions/codemode/renderer.code.js +2 -2
  337. package/dist/extensions/codemode/renderer.impl.js +3 -3
  338. package/dist/extensions/codemode/renderer.js +3 -3
  339. package/dist/extensions/mcp/cli.code.js +3 -3
  340. package/dist/extensions/mcp/cli.impl.js +3 -3
  341. package/dist/extensions/mcp/cli.js +3 -3
  342. package/dist/extensions/mcp/cli.lazy.code.js +2 -2
  343. package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
  344. package/dist/extensions/mcp/cli.lazy.js +3 -3
  345. package/dist/extensions/mcp/runtime.code.js +1 -1
  346. package/dist/extensions/mcp/runtime.impl.js +3 -3
  347. package/dist/extensions/mcp/runtime.js +3 -3
  348. package/dist/index.d.ts +3 -1
  349. package/dist/index.js +8 -8
  350. package/dist/main-first-time-setup.code.js +2 -2
  351. package/dist/main-first-time-setup.impl.js +3 -3
  352. package/dist/main-first-time-setup.js +3 -3
  353. package/dist/main.js +1 -1
  354. package/dist/modes/interactive/components/stored-tree-view.code.js +3 -3
  355. package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
  356. package/dist/modes/interactive/components/stored-tree-view.js +3 -3
  357. package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
  358. package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
  359. package/dist/modes/interactive/startup-shell-eligibility.js +1 -1
  360. package/dist/modes/interactive-engine/engine-prewarm.d.ts +1 -1
  361. package/dist/modes/print-mode.js +1 -1
  362. package/dist/package-manager-cli.code.js +7 -7
  363. package/dist/package-manager-cli.impl.js +3 -3
  364. package/dist/package-manager-cli.js +3 -3
  365. package/dist/rpc-entry.js +1 -1
  366. package/dist/startup-files.json +1 -1
  367. package/dist/startup-stages/10.js +1 -1
  368. package/dist/startup-stages/11.js +1 -1
  369. package/dist/startup-stages/12.js +1 -1
  370. package/dist/startup-stages/2.js +2 -3
  371. package/dist/startup-stages/3.js +1 -3
  372. package/dist/startup-stages/4.js +1 -2
  373. package/dist/startup-stages/5.js +1 -1
  374. package/dist/startup-stages/6.js +5 -7
  375. package/dist/startup-stages/7.js +3 -6
  376. package/dist/startup-stages/8.js +7 -2
  377. package/dist/startup-stages/9.js +1 -7
  378. package/dist/startup-stages/stages.json +1 -1
  379. package/dist/utils/compile-cache-deferral.js +8 -13
  380. package/dist/utils/compile-cache-deferral.js.map +1 -1
  381. package/dist/utils/compile-cache-warmup-host.js +3 -4
  382. package/dist/utils/compile-cache-warmup-host.js.map +1 -1
  383. package/dist/utils/compile-cache.js +12 -100
  384. package/dist/utils/compile-cache.js.map +1 -1
  385. package/dist/utils/startup-database-spare.code.js +3 -3
  386. package/dist/utils/startup-database-spare.impl.js +3 -3
  387. package/dist/utils/startup-database-spare.js +3 -3
  388. package/dist/utils/tools-manager.code.js +1 -1
  389. package/dist/utils/tools-manager.impl.js +3 -3
  390. package/dist/utils/tools-manager.js +3 -3
  391. package/dist/utils/worker-threads.js +2 -15
  392. package/dist/utils/worker-threads.js.map +1 -1
  393. package/docs/build.md +3 -3
  394. package/docs/changelog.mdx +1421 -69
  395. package/docs/compaction/reference.md +5 -5
  396. package/docs/compaction.md +7 -9
  397. package/docs/containerization.md +2 -2
  398. package/docs/custom-provider/api-reference.md +1 -1
  399. package/docs/docs.json +37 -10
  400. package/docs/environment-variables.md +0 -2
  401. package/docs/extensions/api-reference.md +4 -4
  402. package/docs/getting-started/installation.md +3 -0
  403. package/docs/guides/configuration.md +1 -1
  404. package/docs/guides/non-interactive.md +1 -1
  405. package/docs/guides/resume-on-any-machine.md +14 -22
  406. package/docs/guides/team-setup.md +56 -83
  407. package/docs/guides.md +2 -4
  408. package/docs/herdr.md +1 -1
  409. package/docs/index.md +1 -1
  410. package/docs/intercom/operations.md +26 -21
  411. package/docs/intercom/reference.md +2 -2
  412. package/docs/intercom.md +1 -1
  413. package/docs/libraries/storage-postgres.md +9 -9
  414. package/docs/libraries.md +2 -3
  415. package/docs/models-configuration.md +2 -2
  416. package/docs/models.md +2 -3
  417. package/docs/packages/authoring.md +7 -7
  418. package/docs/packages.md +1 -1
  419. package/docs/programmatic.md +2 -2
  420. package/docs/quickstart.md +1 -1
  421. package/docs/reference/cli.md +6 -11
  422. package/docs/reference.md +2 -2
  423. package/docs/rpc/extension-ui.md +2 -2
  424. package/docs/sdk/reference.md +5 -4
  425. package/docs/sdk/storage.md +8 -92
  426. package/docs/sdk/structured-decisions.md +1 -1
  427. package/docs/sdk/web-server.md +3 -3
  428. package/docs/sdk.md +14 -4
  429. package/docs/security.md +1 -1
  430. package/docs/session-format.md +5 -5
  431. package/docs/sessions.md +31 -42
  432. package/docs/settings.md +7 -8
  433. package/docs/storage/custom-adapters.md +255 -0
  434. package/docs/storage/jsonl.md +117 -0
  435. package/docs/{guides/postgres-pgbouncer.md → storage/postgres/pgbouncer.md} +73 -68
  436. package/docs/storage/postgres/tuning.md +337 -0
  437. package/docs/storage/postgres.md +556 -0
  438. package/docs/storage/sqlite.md +99 -0
  439. package/docs/storage.md +333 -956
  440. package/docs/subagents/authoring.md +1 -1
  441. package/docs/subagents.md +2 -2
  442. package/docs/tools.md +1 -1
  443. package/docs/worktree-snapshots.md +2 -2
  444. package/package.json +9 -9
  445. package/schemas/models.schema.json +2 -2
  446. package/schemas/settings.schema.json +0 -14
  447. package/dist/_shared/sdk-AVFII7NK.js.map +0 -1
  448. package/dist/_shared/settings-startup-4QCVCI53.js.map +0 -1
  449. package/dist/_shared/startup-0-0-57KF6LZH.js.map +0 -1
  450. package/dist/_shared/startup-0-1-GIY75K46.js.map +0 -1
  451. package/dist/_shared/startup-0-2-27OWFHV6.js.map +0 -1
  452. package/dist/_shared/startup-0-3-T4DVFYWX.js.map +0 -1
  453. package/dist/_shared/startup-8-1-X32CYSXB.js.map +0 -1
  454. package/dist/core/intercom-broker-control.d.ts +0 -129
  455. package/dist/startup-stages/13.js +0 -1
  456. package/docs/guides/postgres-tuning.md +0 -311
  457. package/docs/libraries/storage-libsql.md +0 -97
@@ -6,7 +6,7 @@ try {
6
6
  } catch (error) {
7
7
  const root = new URL("../", import.meta.url);
8
8
  const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
9
- const key = `${root.href}#0.10.11-alpha.1`;
9
+ const key = `${root.href}#0.10.11-alpha.3`;
10
10
  let release = releases.get(key);
11
11
  if (release === undefined) {
12
12
  const current = (async () => {
@@ -27,8 +27,8 @@ try {
27
27
  release = current;
28
28
  }
29
29
  const running = await release;
30
- if (running === undefined || running.version === "0.10.11-alpha.1") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.1 while this session was running; restart it to keep using session storage.", {
30
+ if (running === undefined || running.version === "0.10.11-alpha.3") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.3 while this session was running; restart it to keep using session storage.", {
32
32
  cause: error,
33
33
  });
34
34
  }
@@ -6,7 +6,7 @@ try {
6
6
  } catch (error) {
7
7
  const root = new URL("../", import.meta.url);
8
8
  const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
9
- const key = `${root.href}#0.10.11-alpha.1`;
9
+ const key = `${root.href}#0.10.11-alpha.3`;
10
10
  let release = releases.get(key);
11
11
  if (release === undefined) {
12
12
  const current = (async () => {
@@ -27,8 +27,8 @@ try {
27
27
  release = current;
28
28
  }
29
29
  const running = await release;
30
- if (running === undefined || running.version === "0.10.11-alpha.1") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.1 while this session was running; restart it to keep using session storage.", {
30
+ if (running === undefined || running.version === "0.10.11-alpha.3") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.3 while this session was running; restart it to keep using session storage.", {
32
32
  cause: error,
33
33
  });
34
34
  }
@@ -1,7 +1,7 @@
1
1
  import "../_shared/rolldown-runtime-BGM3D5V3.js";
2
- import { CURRENT_SESSION_VERSION, getDefaultSessionDir, getDefaultSessionDirPath } from "../_shared/startup-0-0-57KF6LZH.js";
3
- import { buildContextEntries, buildSessionContext, buildSessionProjection, getLatestCompactionBoundaryEntry, getSessionLeafId, sessionEntryToContextMessages } from "../_shared/startup-0-3-T4DVFYWX.js";
4
- import { SESSION_ALREADY_OPEN_EXIT_CODE, SessionAlreadyOpenError, SessionDeletedError, SessionEntryError, SessionHistoryNotLoadedError, SessionIdError, SessionOpenElsewhereError } from "../_shared/settings-startup-4QCVCI53.js";
2
+ import { CURRENT_SESSION_VERSION, getDefaultSessionDir, getDefaultSessionDirPath } from "../_shared/startup-0-0-EZUKEP4Q.js";
3
+ import { buildContextEntries, buildSessionContext, buildSessionProjection, getLatestCompactionBoundaryEntry, getSessionLeafId, sessionEntryToContextMessages } from "../_shared/startup-0-3-4ZYBYQNM.js";
4
+ import { SESSION_ALREADY_OPEN_EXIT_CODE, SessionAlreadyOpenError, SessionDeletedError, SessionEntryError, SessionHistoryNotLoadedError, SessionIdError, SessionOpenElsewhereError } from "../_shared/settings-startup-HXQLSUWM.js";
5
5
  import { assertValidSessionId, findMostRecentSession, isInternalHeader, loadEntriesFromFile, parseSessionEntries } from "../_shared/startup-8-0-34CBHPZH.js";
6
6
  import { SessionManager } from "../_shared/startup-10-0-TDQNBDDL.js";
7
7
  export { CURRENT_SESSION_VERSION, SESSION_ALREADY_OPEN_EXIT_CODE, SessionAlreadyOpenError, SessionDeletedError, SessionEntryError, SessionHistoryNotLoadedError, SessionIdError, SessionManager, SessionOpenElsewhereError, assertValidSessionId, buildContextEntries, buildSessionContext, buildSessionProjection, findMostRecentSession, getDefaultSessionDir, getDefaultSessionDirPath, getLatestCompactionBoundaryEntry, getSessionLeafId, isInternalHeader, loadEntriesFromFile, parseSessionEntries, sessionEntryToContextMessages };
@@ -6,7 +6,7 @@ try {
6
6
  } catch (error) {
7
7
  const root = new URL("../", import.meta.url);
8
8
  const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
9
- const key = `${root.href}#0.10.11-alpha.1`;
9
+ const key = `${root.href}#0.10.11-alpha.3`;
10
10
  let release = releases.get(key);
11
11
  if (release === undefined) {
12
12
  const current = (async () => {
@@ -27,8 +27,8 @@ try {
27
27
  release = current;
28
28
  }
29
29
  const running = await release;
30
- if (running === undefined || running.version === "0.10.11-alpha.1") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.1 while this session was running; restart it to keep using session storage.", {
30
+ if (running === undefined || running.version === "0.10.11-alpha.3") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.3 while this session was running; restart it to keep using session storage.", {
32
32
  cause: error,
33
33
  });
34
34
  }
@@ -6,7 +6,7 @@ try {
6
6
  } catch (error) {
7
7
  const root = new URL("../", import.meta.url);
8
8
  const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
9
- const key = `${root.href}#0.10.11-alpha.1`;
9
+ const key = `${root.href}#0.10.11-alpha.3`;
10
10
  let release = releases.get(key);
11
11
  if (release === undefined) {
12
12
  const current = (async () => {
@@ -27,8 +27,8 @@ try {
27
27
  release = current;
28
28
  }
29
29
  const running = await release;
30
- if (running === undefined || running.version === "0.10.11-alpha.1") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.1 while this session was running; restart it to keep using session storage.", {
30
+ if (running === undefined || running.version === "0.10.11-alpha.3") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.3 while this session was running; restart it to keep using session storage.", {
32
32
  cause: error,
33
33
  });
34
34
  }
@@ -0,0 +1,3 @@
1
+ import "../_shared/rolldown-runtime-BGM3D5V3.js";
2
+ export { assertSessionNotOpenElsewhere, findSessionOpenHolder, holdSessionOpenMarker, prepareSessionOpenMarkers, sessionOpenMarkerRuns } from "../_shared/startup-0-3-4ZYBYQNM.js";
3
+ //# sourceMappingURL=session-open-markers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-open-markers.js","sources":[],"names":[],"mappings":""}
@@ -1,3 +1,3 @@
1
1
  import "../_shared/rolldown-runtime-BGM3D5V3.js";
2
- export { ENGINE_SESSION_STORAGE_FLAG, canIsolateSessionStore, getEngineSessionStorage, projectSettingsChooseSessionStorage, resolveSessionStore, selectSessionSetting, selectSessionStorage, selectSessionStorageWithSettings, selectSessionStorageWithSettingsAsync, sessionStorageSettingsDiffer, takeEngineSessionStorageArg } from "../_shared/startup-8-1-X32CYSXB.js";
2
+ export { ENGINE_SESSION_STORAGE_FLAG, canIsolateSessionStore, getEngineSessionStorage, projectSettingsChooseSessionStorage, resolveSessionStore, selectSessionSetting, selectSessionStorage, selectSessionStorageWithSettings, selectSessionStorageWithSettingsAsync, sessionStorageSettingsDiffer, takeEngineSessionStorageArg } from "../_shared/startup-8-1-LZFXSD3Z.js";
3
3
  //# sourceMappingURL=session-storage.code.js.map
@@ -6,7 +6,7 @@ try {
6
6
  } catch (error) {
7
7
  const root = new URL("../", import.meta.url);
8
8
  const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
9
- const key = `${root.href}#0.10.11-alpha.1`;
9
+ const key = `${root.href}#0.10.11-alpha.3`;
10
10
  let release = releases.get(key);
11
11
  if (release === undefined) {
12
12
  const current = (async () => {
@@ -27,8 +27,8 @@ try {
27
27
  release = current;
28
28
  }
29
29
  const running = await release;
30
- if (running === undefined || running.version === "0.10.11-alpha.1") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.1 while this session was running; restart it to keep using session storage.", {
30
+ if (running === undefined || running.version === "0.10.11-alpha.3") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.3 while this session was running; restart it to keep using session storage.", {
32
32
  cause: error,
33
33
  });
34
34
  }
@@ -6,7 +6,7 @@ try {
6
6
  } catch (error) {
7
7
  const root = new URL("../", import.meta.url);
8
8
  const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
9
- const key = `${root.href}#0.10.11-alpha.1`;
9
+ const key = `${root.href}#0.10.11-alpha.3`;
10
10
  let release = releases.get(key);
11
11
  if (release === undefined) {
12
12
  const current = (async () => {
@@ -27,8 +27,8 @@ try {
27
27
  release = current;
28
28
  }
29
29
  const running = await release;
30
- if (running === undefined || running.version === "0.10.11-alpha.1") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.1 while this session was running; restart it to keep using session storage.", {
30
+ if (running === undefined || running.version === "0.10.11-alpha.3") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.3 while this session was running; restart it to keep using session storage.", {
32
32
  cause: error,
33
33
  });
34
34
  }
@@ -164,9 +164,6 @@ export declare const SettingsSchema: Type.TObject<{
164
164
  dir: Type.TString;
165
165
  }>]>>;
166
166
  }>>;
167
- teamJoin: Type.TOptional<Type.TObject<{
168
- storage: Type.TString;
169
- }>>;
170
167
  lastChangelogVersion: Type.TOptional<Type.TString>;
171
168
  firstRunOnboardingStartedVersion: Type.TOptional<Type.TString>;
172
169
  onboardedVersion: Type.TOptional<Type.TString>;
@@ -0,0 +1,19 @@
1
+ import * as schemaCatalog from "./schema-catalog.js";
2
+ import * as statementSequence from "./statement-sequence.js";
3
+ /**
4
+ * `noteStorageSchemaTables` and `refreshStorageSchemaCatalog` of `schema-catalog.ts`, which the copy 0.10.11-alpha.1
5
+ * loaded lacks, and `MAX_SEQUENCE_REQUEST_STATEMENTS` of `statement-sequence.ts`, which the copies 0.10.3 and 0.10.4's
6
+ * prereleases loaded lack. A process that loaded those copies, or 0.10.11-alpha.1's `added-exports.js`, before an
7
+ * in-place update replaced the installation keeps them, and can load the modules that use these from the update: a
8
+ * named import of any of them would fail to link there, so they take them from here, a path no earlier release has
9
+ * (#6560). With 0.10.11-alpha.1's catalog, which knows nothing of fork tables, an open keeps the catalog it read, as
10
+ * there: the snapshot blob store such a process holds is that release's, which asks the catalog nothing of forks, so its
11
+ * forks still share and read their parent's history (test/integration/in-place-update-forks.test.ts).
12
+ */
13
+ const catalogUpdates = schemaCatalog;
14
+ const sequences = statementSequence;
15
+ export const noteStorageSchemaTables = catalogUpdates.noteStorageSchemaTables ?? (() => { });
16
+ export const refreshStorageSchemaCatalog = catalogUpdates.refreshStorageSchemaCatalog ?? (() => { });
17
+ /** The most statements one request of a sequence carries (#6560). */
18
+ export const MAX_SEQUENCE_REQUEST_STATEMENTS = sequences.MAX_SEQUENCE_REQUEST_STATEMENTS ?? 256;
19
+ //# sourceMappingURL=added-exports-0-10-11.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"added-exports-0-10-11.js","sourceRoot":"","sources":["../../../src/core/storage/added-exports-0-10-11.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,iBAAiB,MAAM,yBAAyB,CAAC;AAE7D;;;;;;;;;GASG;AACH,MAAM,cAAc,GACnB,aAAa,CAAC;AACf,MAAM,SAAS,GAA+E,iBAAiB,CAAC;AAEhH,MAAM,CAAC,MAAM,uBAAuB,GACnC,cAAc,CAAC,uBAAuB,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;AAEtD,MAAM,CAAC,MAAM,2BAA2B,GACvC,cAAc,CAAC,2BAA2B,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;AAE1D,qEAAqE;AACrE,MAAM,CAAC,MAAM,+BAA+B,GAAW,SAAS,CAAC,+BAA+B,IAAI,GAAG,CAAC","sourcesContent":["import * as schemaCatalog from \"./schema-catalog.js\";\nimport * as statementSequence from \"./statement-sequence.js\";\n\n/**\n * `noteStorageSchemaTables` and `refreshStorageSchemaCatalog` of `schema-catalog.ts`, which the copy 0.10.11-alpha.1\n * loaded lacks, and `MAX_SEQUENCE_REQUEST_STATEMENTS` of `statement-sequence.ts`, which the copies 0.10.3 and 0.10.4's\n * prereleases loaded lack. A process that loaded those copies, or 0.10.11-alpha.1's `added-exports.js`, before an\n * in-place update replaced the installation keeps them, and can load the modules that use these from the update: a\n * named import of any of them would fail to link there, so they take them from here, a path no earlier release has\n * (#6560). With 0.10.11-alpha.1's catalog, which knows nothing of fork tables, an open keeps the catalog it read, as\n * there: the snapshot blob store such a process holds is that release's, which asks the catalog nothing of forks, so its\n * forks still share and read their parent's history (test/integration/in-place-update-forks.test.ts).\n */\nconst catalogUpdates: Partial<Pick<typeof schemaCatalog, \"noteStorageSchemaTables\" | \"refreshStorageSchemaCatalog\">> =\n\tschemaCatalog;\nconst sequences: Partial<Pick<typeof statementSequence, \"MAX_SEQUENCE_REQUEST_STATEMENTS\">> = statementSequence;\n\nexport const noteStorageSchemaTables: typeof schemaCatalog.noteStorageSchemaTables =\n\tcatalogUpdates.noteStorageSchemaTables ?? (() => {});\n\nexport const refreshStorageSchemaCatalog: typeof schemaCatalog.refreshStorageSchemaCatalog =\n\tcatalogUpdates.refreshStorageSchemaCatalog ?? (() => {});\n\n/** The most statements one request of a sequence carries (#6560). */\nexport const MAX_SEQUENCE_REQUEST_STATEMENTS: number = sequences.MAX_SEQUENCE_REQUEST_STATEMENTS ?? 256;\n"]}
@@ -7,6 +7,9 @@ import * as statementSequence from "./statement-sequence.js";
7
7
  * can load the modules that use these from the update: a named import of any of them would fail to link there, so they
8
8
  * take them from here, a path no earlier release has (#6560). Without them every open checks its schema in a
9
9
  * transaction, tables keep their default fillfactor, and a transaction's last writes run before its `COMMIT`, as there.
10
+ *
11
+ * Releases since 0.10.11-alpha.1 ship this module with these exports, so a process of one may hold its copy: an export
12
+ * added here would fail to link there. Later additions go in a module no release has, as `added-exports-0-10-11.ts`.
10
13
  */
11
14
  const schemaChecks = migrations;
12
15
  const finishers = statementSequence;
@@ -1 +1 @@
1
- {"version":3,"file":"added-exports.js","sourceRoot":"","sources":["../../../src/core/storage/added-exports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,iBAAiB,MAAM,yBAAyB,CAAC;AAE7D;;;;;;;GAOG;AACH,MAAM,YAAY,GAAuF,UAAU,CAAC;AACpH,MAAM,SAAS,GAAmE,iBAAiB,CAAC;AAEpG,MAAM,CAAC,MAAM,oBAAoB,GAChC,YAAY,CAAC,oBAAoB,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC;AAE1D,MAAM,CAAC,MAAM,qBAAqB,GACjC,YAAY,CAAC,qBAAqB,IAAI,CAAC,KAAK,IAAI,EAAE,GAAE,CAAC,CAAC,CAAC;AAExD,MAAM,CAAC,MAAM,mBAAmB,GAC/B,SAAS,CAAC,mBAAmB,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC","sourcesContent":["import * as migrations from \"./migrations.js\";\nimport * as statementSequence from \"./statement-sequence.js\";\n\n/**\n * `storageSchemaCurrent` and `ensureTableFillfactor` of `migrations.ts` and `transactionFinisher` of\n * `statement-sequence.ts`, which the copies of those modules (and of `statement-batches.ts`) that 0.10.3 and 0.10.4\n * loaded lack. A process that loaded those copies before an in-place update replaced the installation keeps them, and\n * can load the modules that use these from the update: a named import of any of them would fail to link there, so they\n * take them from here, a path no earlier release has (#6560). Without them every open checks its schema in a\n * transaction, tables keep their default fillfactor, and a transaction's last writes run before its `COMMIT`, as there.\n */\nconst schemaChecks: Partial<Pick<typeof migrations, \"storageSchemaCurrent\" | \"ensureTableFillfactor\">> = migrations;\nconst finishers: Partial<Pick<typeof statementSequence, \"transactionFinisher\">> = statementSequence;\n\nexport const storageSchemaCurrent: typeof migrations.storageSchemaCurrent =\n\tschemaChecks.storageSchemaCurrent ?? (async () => false);\n\nexport const ensureTableFillfactor: typeof migrations.ensureTableFillfactor =\n\tschemaChecks.ensureTableFillfactor ?? (async () => {});\n\nexport const transactionFinisher: typeof statementSequence.transactionFinisher =\n\tfinishers.transactionFinisher ?? (() => undefined);\n"]}
1
+ {"version":3,"file":"added-exports.js","sourceRoot":"","sources":["../../../src/core/storage/added-exports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,iBAAiB,MAAM,yBAAyB,CAAC;AAE7D;;;;;;;;;;GAUG;AACH,MAAM,YAAY,GAAuF,UAAU,CAAC;AACpH,MAAM,SAAS,GAAmE,iBAAiB,CAAC;AAEpG,MAAM,CAAC,MAAM,oBAAoB,GAChC,YAAY,CAAC,oBAAoB,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC;AAE1D,MAAM,CAAC,MAAM,qBAAqB,GACjC,YAAY,CAAC,qBAAqB,IAAI,CAAC,KAAK,IAAI,EAAE,GAAE,CAAC,CAAC,CAAC;AAExD,MAAM,CAAC,MAAM,mBAAmB,GAC/B,SAAS,CAAC,mBAAmB,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC","sourcesContent":["import * as migrations from \"./migrations.js\";\nimport * as statementSequence from \"./statement-sequence.js\";\n\n/**\n * `storageSchemaCurrent` and `ensureTableFillfactor` of `migrations.ts` and `transactionFinisher` of\n * `statement-sequence.ts`, which the copies of those modules (and of `statement-batches.ts`) that 0.10.3 and 0.10.4\n * loaded lack. A process that loaded those copies before an in-place update replaced the installation keeps them, and\n * can load the modules that use these from the update: a named import of any of them would fail to link there, so they\n * take them from here, a path no earlier release has (#6560). Without them every open checks its schema in a\n * transaction, tables keep their default fillfactor, and a transaction's last writes run before its `COMMIT`, as there.\n *\n * Releases since 0.10.11-alpha.1 ship this module with these exports, so a process of one may hold its copy: an export\n * added here would fail to link there. Later additions go in a module no release has, as `added-exports-0-10-11.ts`.\n */\nconst schemaChecks: Partial<Pick<typeof migrations, \"storageSchemaCurrent\" | \"ensureTableFillfactor\">> = migrations;\nconst finishers: Partial<Pick<typeof statementSequence, \"transactionFinisher\">> = statementSequence;\n\nexport const storageSchemaCurrent: typeof migrations.storageSchemaCurrent =\n\tschemaChecks.storageSchemaCurrent ?? (async () => false);\n\nexport const ensureTableFillfactor: typeof migrations.ensureTableFillfactor =\n\tschemaChecks.ensureTableFillfactor ?? (async () => {});\n\nexport const transactionFinisher: typeof statementSequence.transactionFinisher =\n\tfinishers.transactionFinisher ?? (() => undefined);\n"]}
@@ -0,0 +1,105 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { statSync, unlinkSync, utimesSync, writeFileSync } from "node:fs";
3
+ import { stat, unlink, utimes, writeFile } from "node:fs/promises";
4
+ import { join } from "node:path";
5
+ /**
6
+ * Whether a file's creation time can tell it from another file with the same device and inode numbers.
7
+ *
8
+ * On macOS, APFS and HFS+ set a file's creation time back to its modified time whenever that is set earlier, as
9
+ * `touch -t` or a backup or sync tool restoring times does, so there the creation time does not stay with the file.
10
+ * Neither reuses an inode number, so the device and inode alone tell files apart. FAT and exFAT keep the creation
11
+ * time, and FAT reuses an inode number as soon as it is free, so there the creation time is kept. Which kind a
12
+ * directory is on is found once per device by setting a new file's modified time earlier and seeing whether its
13
+ * creation time moves. Linux and Windows keep creation times, so nothing is probed there.
14
+ */
15
+ const CREATION_TIME_CAN_MOVE = process.platform === "darwin";
16
+ /** By device, whether creation times stay put on it, as a probe found. A device not probed is taken to be APFS. */
17
+ const staysByDevice = new Map();
18
+ /** Directories already probed, or being probed, so each is probed once. */
19
+ const probedDirectories = new Map();
20
+ /** Whether files on device `dev` keep their creation time; see `CREATION_TIME_CAN_MOVE`. */
21
+ export function creationTimeStays(dev) {
22
+ return !CREATION_TIME_CAN_MOVE || staysByDevice.get(String(dev)) === true;
23
+ }
24
+ /** A file's device and inode, with its creation time where that stays put: what tells it from a file that replaced it. */
25
+ export function fileGenerationOf(stats) {
26
+ return creationTimeStays(stats.dev) ? legacyFileGenerationOf(stats) : `${stats.dev}:${stats.ino}`;
27
+ }
28
+ /** The generation every platform gave a file before macOS left out the creation time, which older builds still use. */
29
+ export function legacyFileGenerationOf(stats) {
30
+ return `${stats.dev}:${stats.ino}:${stats.birthtimeNs}`;
31
+ }
32
+ /** A probe file's name, which no session or storage scan reads. */
33
+ function probePath(directory) {
34
+ return join(directory, `.atomic-creation-time-${randomUUID()}.tmp`);
35
+ }
36
+ /**
37
+ * Learns whether the device `directory` is on keeps creation times, once per directory. One that cannot be written
38
+ * stays unknown, and is taken to be APFS; one that does not exist yet is probed again next time.
39
+ */
40
+ export function learnCreationTime(directory) {
41
+ if (!CREATION_TIME_CAN_MOVE)
42
+ return Promise.resolve();
43
+ let probed = probedDirectories.get(directory);
44
+ if (probed === undefined) {
45
+ probed = (async () => {
46
+ let dev;
47
+ try {
48
+ dev = String((await stat(directory, { bigint: true })).dev);
49
+ }
50
+ catch {
51
+ probedDirectories.delete(directory);
52
+ return;
53
+ }
54
+ if (staysByDevice.has(dev))
55
+ return;
56
+ const path = probePath(directory);
57
+ try {
58
+ await writeFile(path, "", { flag: "wx" });
59
+ const before = await stat(path, { bigint: true });
60
+ const earlier = new Date(Number(before.birthtimeNs / 1000000n) - 86_400_000);
61
+ await utimes(path, earlier, earlier);
62
+ staysByDevice.set(dev, (await stat(path, { bigint: true })).birthtimeNs === before.birthtimeNs);
63
+ }
64
+ catch {
65
+ }
66
+ finally {
67
+ await unlink(path).catch(() => undefined);
68
+ }
69
+ })();
70
+ probedDirectories.set(directory, probed);
71
+ }
72
+ return probed;
73
+ }
74
+ /** `learnCreationTime` for a caller that cannot wait. */
75
+ export function learnCreationTimeSync(directory) {
76
+ if (!CREATION_TIME_CAN_MOVE || probedDirectories.has(directory))
77
+ return;
78
+ let dev;
79
+ try {
80
+ dev = String(statSync(directory, { bigint: true }).dev);
81
+ }
82
+ catch {
83
+ return;
84
+ }
85
+ probedDirectories.set(directory, Promise.resolve());
86
+ if (staysByDevice.has(dev))
87
+ return;
88
+ const path = probePath(directory);
89
+ try {
90
+ writeFileSync(path, "", { flag: "wx" });
91
+ const before = statSync(path, { bigint: true });
92
+ const earlier = new Date(Number(before.birthtimeNs / 1000000n) - 86_400_000);
93
+ utimesSync(path, earlier, earlier);
94
+ staysByDevice.set(dev, statSync(path, { bigint: true }).birthtimeNs === before.birthtimeNs);
95
+ }
96
+ catch {
97
+ }
98
+ finally {
99
+ try {
100
+ unlinkSync(path);
101
+ }
102
+ catch { }
103
+ }
104
+ }
105
+ //# sourceMappingURL=creation-time.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"creation-time.js","sourceRoot":"","sources":["../../../src/core/storage/creation-time.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;;;;;;;GASG;AACH,MAAM,sBAAsB,GAAG,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC;AAE7D,mHAAmH;AACnH,MAAM,aAAa,GAAG,IAAI,GAAG,EAAmB,CAAC;AACjD,2EAA2E;AAC3E,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAyB,CAAC;AAQ3D,4FAA4F;AAC5F,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC5C,OAAO,CAAC,sBAAsB,IAAI,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC;AAC3E,CAAC;AAED,0HAA0H;AAC1H,MAAM,UAAU,gBAAgB,CAAC,KAAwB;IACxD,OAAO,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,EAAE,CAAC;AACnG,CAAC;AAED,uHAAuH;AACvH,MAAM,UAAU,sBAAsB,CAAC,KAAwB;IAC9D,OAAO,GAAG,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;AACzD,CAAC;AAED,mEAAmE;AACnE,SAAS,SAAS,CAAC,SAAiB;IACnC,OAAO,IAAI,CAAC,SAAS,EAAE,yBAAyB,UAAU,EAAE,MAAM,CAAC,CAAC;AACrE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAAiB;IAClD,IAAI,CAAC,sBAAsB;QAAE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IACtD,IAAI,MAAM,GAAG,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC9C,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,GAAG,CAAC,KAAK,IAAI,EAAE;YACpB,IAAI,GAAW,CAAC;YAChB,IAAI,CAAC;gBACJ,GAAG,GAAG,MAAM,CAAC,CAAC,MAAM,IAAI,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YAC7D,CAAC;YAAC,MAAM,CAAC;gBACR,iBAAiB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;gBACpC,OAAO;YACR,CAAC;YACD,IAAI,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,OAAO;YACnC,MAAM,IAAI,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;YAClC,IAAI,CAAC;gBACJ,MAAM,SAAS,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAC1C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;gBAClD,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,GAAG,QAAU,CAAC,GAAG,UAAU,CAAC,CAAC;gBAC/E,MAAM,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;gBACrC,aAAa,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,WAAW,KAAK,MAAM,CAAC,WAAW,CAAC,CAAC;YACjG,CAAC;YAAC,MAAM,CAAC;YACT,CAAC;oBAAS,CAAC;gBACV,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;YAC3C,CAAC;QACF,CAAC,CAAC,EAAE,CAAC;QACL,iBAAiB,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC;AAED,yDAAyD;AACzD,MAAM,UAAU,qBAAqB,CAAC,SAAiB;IACtD,IAAI,CAAC,sBAAsB,IAAI,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC;QAAE,OAAO;IACxE,IAAI,GAAW,CAAC;IAChB,IAAI,CAAC;QACJ,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;IACzD,CAAC;IAAC,MAAM,CAAC;QACR,OAAO;IACR,CAAC;IACD,iBAAiB,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IACpD,IAAI,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC;QAAE,OAAO;IACnC,MAAM,IAAI,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC,IAAI,CAAC;QACJ,aAAa,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACxC,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QAChD,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,GAAG,QAAU,CAAC,GAAG,UAAU,CAAC,CAAC;QAC/E,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACnC,aAAa,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,WAAW,KAAK,MAAM,CAAC,WAAW,CAAC,CAAC;IAC7F,CAAC;IAAC,MAAM,CAAC;IACT,CAAC;YAAS,CAAC;QACV,IAAI,CAAC;YACJ,UAAU,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;IACX,CAAC;AACF,CAAC","sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport { statSync, unlinkSync, utimesSync, writeFileSync } from \"node:fs\";\nimport { stat, unlink, utimes, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\n/**\n * Whether a file's creation time can tell it from another file with the same device and inode numbers.\n *\n * On macOS, APFS and HFS+ set a file's creation time back to its modified time whenever that is set earlier, as\n * `touch -t` or a backup or sync tool restoring times does, so there the creation time does not stay with the file.\n * Neither reuses an inode number, so the device and inode alone tell files apart. FAT and exFAT keep the creation\n * time, and FAT reuses an inode number as soon as it is free, so there the creation time is kept. Which kind a\n * directory is on is found once per device by setting a new file's modified time earlier and seeing whether its\n * creation time moves. Linux and Windows keep creation times, so nothing is probed there.\n */\nconst CREATION_TIME_CAN_MOVE = process.platform === \"darwin\";\n\n/** By device, whether creation times stay put on it, as a probe found. A device not probed is taken to be APFS. */\nconst staysByDevice = new Map<string, boolean>();\n/** Directories already probed, or being probed, so each is probed once. */\nconst probedDirectories = new Map<string, Promise<void>>();\n\ninterface FileIdentityStats {\n\treadonly dev: bigint;\n\treadonly ino: bigint;\n\treadonly birthtimeNs: bigint;\n}\n\n/** Whether files on device `dev` keep their creation time; see `CREATION_TIME_CAN_MOVE`. */\nexport function creationTimeStays(dev: bigint): boolean {\n\treturn !CREATION_TIME_CAN_MOVE || staysByDevice.get(String(dev)) === true;\n}\n\n/** A file's device and inode, with its creation time where that stays put: what tells it from a file that replaced it. */\nexport function fileGenerationOf(stats: FileIdentityStats): string {\n\treturn creationTimeStays(stats.dev) ? legacyFileGenerationOf(stats) : `${stats.dev}:${stats.ino}`;\n}\n\n/** The generation every platform gave a file before macOS left out the creation time, which older builds still use. */\nexport function legacyFileGenerationOf(stats: FileIdentityStats): string {\n\treturn `${stats.dev}:${stats.ino}:${stats.birthtimeNs}`;\n}\n\n/** A probe file's name, which no session or storage scan reads. */\nfunction probePath(directory: string): string {\n\treturn join(directory, `.atomic-creation-time-${randomUUID()}.tmp`);\n}\n\n/**\n * Learns whether the device `directory` is on keeps creation times, once per directory. One that cannot be written\n * stays unknown, and is taken to be APFS; one that does not exist yet is probed again next time.\n */\nexport function learnCreationTime(directory: string): Promise<void> {\n\tif (!CREATION_TIME_CAN_MOVE) return Promise.resolve();\n\tlet probed = probedDirectories.get(directory);\n\tif (probed === undefined) {\n\t\tprobed = (async () => {\n\t\t\tlet dev: string;\n\t\t\ttry {\n\t\t\t\tdev = String((await stat(directory, { bigint: true })).dev);\n\t\t\t} catch {\n\t\t\t\tprobedDirectories.delete(directory);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (staysByDevice.has(dev)) return;\n\t\t\tconst path = probePath(directory);\n\t\t\ttry {\n\t\t\t\tawait writeFile(path, \"\", { flag: \"wx\" });\n\t\t\t\tconst before = await stat(path, { bigint: true });\n\t\t\t\tconst earlier = new Date(Number(before.birthtimeNs / 1_000_000n) - 86_400_000);\n\t\t\t\tawait utimes(path, earlier, earlier);\n\t\t\t\tstaysByDevice.set(dev, (await stat(path, { bigint: true })).birthtimeNs === before.birthtimeNs);\n\t\t\t} catch {\n\t\t\t} finally {\n\t\t\t\tawait unlink(path).catch(() => undefined);\n\t\t\t}\n\t\t})();\n\t\tprobedDirectories.set(directory, probed);\n\t}\n\treturn probed;\n}\n\n/** `learnCreationTime` for a caller that cannot wait. */\nexport function learnCreationTimeSync(directory: string): void {\n\tif (!CREATION_TIME_CAN_MOVE || probedDirectories.has(directory)) return;\n\tlet dev: string;\n\ttry {\n\t\tdev = String(statSync(directory, { bigint: true }).dev);\n\t} catch {\n\t\treturn;\n\t}\n\tprobedDirectories.set(directory, Promise.resolve());\n\tif (staysByDevice.has(dev)) return;\n\tconst path = probePath(directory);\n\ttry {\n\t\twriteFileSync(path, \"\", { flag: \"wx\" });\n\t\tconst before = statSync(path, { bigint: true });\n\t\tconst earlier = new Date(Number(before.birthtimeNs / 1_000_000n) - 86_400_000);\n\t\tutimesSync(path, earlier, earlier);\n\t\tstaysByDevice.set(dev, statSync(path, { bigint: true }).birthtimeNs === before.birthtimeNs);\n\t} catch {\n\t} finally {\n\t\ttry {\n\t\t\tunlinkSync(path);\n\t\t} catch {}\n\t}\n}\n"]}
@@ -51,6 +51,27 @@ export interface SqliteTransactionOptions {
51
51
  * fenced path's one guarded write: it never runs unused. Other drivers ignore it.
52
52
  */
53
53
  readonly leading?: readonly SqliteStatement[];
54
+ /**
55
+ * @internal The callback makes the `leading` calls, all of them in order, and no other. A pipelined driver then sends
56
+ * the commit right behind them, so the whole transaction costs one round trip: a call the callback makes after them
57
+ * fails without being sent. When a leading statement fails, the transaction rolls back and the callback's call of
58
+ * that statement fails. Other drivers ignore it.
59
+ */
60
+ readonly leadingOnly?: boolean;
61
+ /**
62
+ * @internal With `leading`, a `serial` transaction of a domain takes its locks in its first leading statement, a read,
63
+ * and only when that read returns a row, instead of with its start: a transaction whose first read finds nothing
64
+ * takes no lock. Every statement after it starts once the locks are held, so it sees every transaction that held them
65
+ * and committed. A driver that ignores it takes the locks with the start. Other drivers ignore it.
66
+ */
67
+ readonly lockIfLeadingFinds?: boolean;
68
+ /**
69
+ * The commit returns before the server has written the transaction to disk, so a crash of the database server just
70
+ * after it may lose it, though never part of it, and never a transaction that committed after it without this flag.
71
+ * Only for writes whose loss is harmless because a later write repeats them, such as a lease renewal. PostgreSQL
72
+ * turns `synchronous_commit` off for the transaction; other drivers ignore it.
73
+ */
74
+ readonly relaxedDurability?: boolean;
54
75
  }
55
76
  /** How one batch waits for a busy write lock, and whether it goes ahead of the database's queued calls. */
56
77
  export interface SqliteBatchOptions {
@@ -124,16 +145,33 @@ export interface StorageNotificationSubscription {
124
145
  */
125
146
  export interface StorageNotifications {
126
147
  /**
127
- * A statement that sends `payload` to the listeners of `channel` when the transaction it runs in commits, and never
128
- * when it rolls back: run it in the transaction of the write it announces. `channel` is a name such as
129
- * `<prefix>pool_ready`; the database shortens a long one the same way for `notify` and `listen`.
148
+ * A statement that sends `payload` to the listeners of `channel` once the transaction it runs in commits: run it in the
149
+ * transaction of the write it announces. `channel` is a name such as `<prefix>pool_ready`; the database shortens a long
150
+ * one the same way for `notify` and `listen`. With `unless`, a read, the notification goes out only when that read,
151
+ * made as it goes out, returns no row.
152
+ *
153
+ * Postgres answers the statement at once and sends the notification in a transaction of its own, right behind the
154
+ * `COMMIT` in the same round trip: a notifying commit holds a server-wide lock until it is flushed, which would make
155
+ * every other notifying commit wait for it. That transaction may also run when the `COMMIT` rolled back, and commits
156
+ * that send the same notification within a few milliseconds of each other share one, sent once they committed. Older
157
+ * adapters send it in the transaction and ignore `unless`.
130
158
  */
131
- notify(channel: string, payload: string): SqliteStatement;
159
+ notify(channel: string, payload: string, unless?: SqliteStatement): SqliteStatement;
132
160
  /** Delivers `channel`'s events to `listener`, on one listening connection the database shares between channels. */
133
161
  listen(channel: string, listener: (event: StorageNotificationEvent) => void): StorageNotificationSubscription;
134
162
  /** Opens the listening connection when it is not open, and resolves with its state once the first attempt settled. */
135
163
  state(): Promise<StorageListenerState>;
136
164
  }
165
+ /**
166
+ * @internal What a driver read of its schema in its open's own round trip (#6560): the rows of the catalog read
167
+ * `readStorageSchemaCatalog` makes (`kind` `relation`, `trigger` or `column`, with `name` and `detail`) and the
168
+ * versions `ledger` records, as rows of `domain` and `version`; `versions` is undefined when the ledger did not exist.
169
+ */
170
+ export interface StorageOpenedCatalog {
171
+ readonly ledger: string;
172
+ readonly rows: readonly SqliteRow[];
173
+ readonly versions: readonly SqliteRow[] | undefined;
174
+ }
137
175
  export interface SqliteDatabase extends SqliteExecutor {
138
176
  /**
139
177
  * True when the connection refuses writes, as `openNodeSqliteDatabase(path, { readOnly: true })` sets it, so opening a
@@ -157,7 +195,7 @@ export interface SqliteDatabase extends SqliteExecutor {
157
195
  readonly notifications?: StorageNotifications;
158
196
  /**
159
197
  * The bytes this process may still write on the file system that holds the database's file (where a link to the file
160
- * points, and where its write-ahead log goes), as a SQLite or libSQL file database reports them. Absent, or resolving
198
+ * points, and where its write-ahead log goes), as a SQLite file database reports them. Absent, or resolving
161
199
  * undefined, when this process cannot see the database's disk (a server, memory) or the file system does not say.
162
200
  */
163
201
  freeBytes?(): Promise<number | undefined>;
@@ -166,7 +204,20 @@ export interface SqliteDatabase extends SqliteExecutor {
166
204
  tryMaintenance?(callback: (transaction: SqliteExecutor) => Promise<void>): Promise<boolean>;
167
205
  /** Opens a separate handle on this same database for reads. It has its own call queue; the caller must close it. */
168
206
  openReader?(): Promise<SqliteDatabase>;
207
+ /**
208
+ * @internal The schema the driver read when it opened, given once: the first store open answers its schema checks
209
+ * from it instead of reading the catalog again. Undefined after the first call, and where the driver read none.
210
+ */
211
+ takeOpenedCatalog?(): StorageOpenedCatalog | undefined;
169
212
  transaction<T>(callback: (transaction: SqliteExecutor) => Promise<T>, options?: SqliteTransactionOptions): Promise<T>;
213
+ /**
214
+ * @internal Runs `statement` by itself as one request that commits on its own, queued in this process as a
215
+ * transaction of `concurrency` is: behind the calls such a transaction waits for, and ahead of the calls that wait
216
+ * for it. The statement takes on the server whatever locks it needs itself, such as a function that takes the
217
+ * domain's advisory locks. A transient failure that applied nothing runs it again. Resolves with its rows. Present
218
+ * only where the driver runs transactions concurrently (PostgreSQL).
219
+ */
220
+ autocommit?(statement: SqliteStatement, concurrency: TransactionConcurrency): Promise<SqliteRow[]>;
170
221
  /**
171
222
  * Runs the statements in order, in one write transaction, as one call to the database: all of them commit or none
172
223
  * do. Resolves with each statement's rows. Present only when the driver can send a batch in one request, which
@@ -1 +1 @@
1
- {"version":3,"file":"database.js","sourceRoot":"","sources":["../../../src/core/storage/database.ts"],"names":[],"mappings":"","sourcesContent":["import type { StorageDialect } from \"./dialect.js\";\n\nexport type SqliteValue = null | number | bigint | string | Uint8Array;\nexport type SqliteRow = Readonly<Record<string, SqliteValue>>;\n\nexport interface SqliteRunResult {\n\treadonly changes: number;\n}\n\nexport interface SqliteExecutor {\n\texec(sql: string): Promise<void>;\n\trun(sql: string, ...params: readonly SqliteValue[]): Promise<SqliteRunResult>;\n\tget<T extends SqliteRow>(sql: string, ...params: readonly SqliteValue[]): Promise<T | undefined>;\n\tall<T extends SqliteRow>(sql: string, ...params: readonly SqliteValue[]): Promise<T[]>;\n}\n\nexport interface StorageDescriptor {\n\treadonly adapter: string;\n\treadonly location: string;\n}\n\n/** One statement of a batch: SQL with positional `?` parameters. */\nexport interface SqliteStatement {\n\treadonly sql: string;\n\treadonly params: readonly SqliteValue[];\n}\n\n/** How a transaction takes its snapshot or write lock, and whether it may run again. */\nexport interface SqliteTransactionOptions {\n\t/** @internal A consistent read snapshot without a writer lock. The callback must only read. */\n\treadonly readOnly?: boolean;\n\t/**\n\t * How long the transaction keeps waiting for the write lock while it is held and no other connection commits,\n\t * instead of the connection's own lock wait. A writer whose work must not fail because another process stalled\n\t * with the lock held (starved of CPU, paused by garbage collection, stopped by a signal) waits longer: the holder\n\t * still commits or rolls back once it runs again. Adapters without a lock wait of their own ignore it.\n\t */\n\treadonly lockWaitMs?: number;\n\t/**\n\t * Lets a database from `createSqliteDatabase` run the callback again, in a new transaction, when a transient\n\t * failure (`StorageTransientError`) ended the transaction before it committed, so nothing of it was written. Set it\n\t * only for a callback that does nothing but use the transaction handle: anything else it does happens once per run.\n\t * Other databases ignore it.\n\t */\n\treadonly retryTransientFailures?: boolean;\n\t/**\n\t * How the transaction excludes other writers; `{ kind: \"serial\" }` when absent. SQLite runs every kind as\n\t * `BEGIN IMMEDIATE` unless `readOnly` is set; only a driver that runs transactions concurrently (Postgres) tells them apart.\n\t */\n\treadonly concurrency?: TransactionConcurrency;\n\t/**\n\t * @internal The statements the callback makes first, in this order, before it acts on any answer. A driver whose\n\t * transactions are pipelined sends them with the transaction's start, so they cost no round trip of their own, and\n\t * starts the callback once they are answered; each call of the callback that makes the next of them gets its answer.\n\t * Name only reads: a call that differs from the next of them ends the lead, and the answers of the rest go unused,\n\t * though they ran. A write may lead only as the callback's first call, made on every run whatever it reads, such as a\n\t * fenced path's one guarded write: it never runs unused. Other drivers ignore it.\n\t */\n\treadonly leading?: readonly SqliteStatement[];\n}\n\n/** How one batch waits for a busy write lock, and whether it goes ahead of the database's queued calls. */\nexport interface SqliteBatchOptions {\n\t/**\n\t * How long a batch that found the database's write lock busy keeps sending again, with growing randomized waits\n\t * between tries. A busy batch wrote nothing, so sending it again is safe. Adapters without such a retry ignore it.\n\t */\n\treadonly lockWaitMs?: number;\n\t/**\n\t * Runs the batch before calls queued on this database that do not set it, and outside any limit the adapter puts on\n\t * concurrent writes: for small writes that must not wait behind others, such as a lease renewal.\n\t */\n\treadonly priority?: boolean;\n}\n\n/**\n * An audited fenced write path. Only `fencedPath(name)` in `fenced-paths.ts` makes one; a plain string is not one. The\n * brand is a string key, not a unique symbol, so the published declarations and the sources stay one type.\n */\nexport type FencedPathId = string & { readonly __atomicFencedPath: true };\n\n/**\n * `serial`: the body runs as if it were the only writer of `domain`, or of the whole database when `domain` is absent:\n * `BEGIN IMMEDIATE` on SQLite, `BEGIN` plus that domain's transaction advisory lock on Postgres. Several prefixes may\n * share one database, so `domain` names the scope in full: a store passes one of its prefixed table names.\n * `fenced`: the body runs under READ COMMITTED and takes the row locks it relies on itself. With `excludesSerial`, it\n * also waits for and excludes `serial` transactions without a domain, as a `serial` transaction with a domain does,\n * for a body whose check a whole-database writer (such as snapshot garbage collection) could otherwise race\n * (`StorageDialect.lockClause`); `audit` names the reviewed path. Identical to `serial` on SQLite.\n */\nexport type TransactionConcurrency =\n\t| { readonly kind: \"serial\"; readonly domain?: string }\n\t| { readonly kind: \"fenced\"; readonly audit: FencedPathId; readonly excludesSerial?: boolean };\n\n/**\n * What a database's listening connection is doing: `listening`, notifications arrive; `connecting`, it is not known yet;\n * `unavailable`, none arrive, and pollers find the work: `pooler` when the endpoint is a transaction pooler (a\n * notification sent through the database did not reach the listening session), `connection-failed` when the listening\n * connection could not be opened or broke.\n */\nexport type StorageListenerState =\n\t| { readonly status: \"listening\" }\n\t| { readonly status: \"connecting\" }\n\t| { readonly status: \"unavailable\"; readonly reason: \"pooler\" | \"connection-failed\" };\n\n/**\n * `notification`: a transaction that ran `notify(channel, payload)` committed. `listening`: the listening connection\n * began listening again after it was unavailable, so notifications sent meanwhile were lost.\n */\nexport type StorageNotificationEvent =\n\t| { readonly kind: \"notification\"; readonly payload: string }\n\t| { readonly kind: \"listening\" };\n\nexport interface StorageNotificationSubscription {\n\t/** Stops delivering events to this listener; idempotent. */\n\tclose(): void;\n}\n\n/**\n * Wake-ups through the database (#5103): Postgres `LISTEN`/`NOTIFY`. A notification is only a hint that a poller would\n * find the same work at its next poll; notifications are lost while the listening connection is down, and through a\n * transaction pooler none arrive, so a store that sends them keeps its poll.\n */\nexport interface StorageNotifications {\n\t/**\n\t * A statement that sends `payload` to the listeners of `channel` when the transaction it runs in commits, and never\n\t * when it rolls back: run it in the transaction of the write it announces. `channel` is a name such as\n\t * `<prefix>pool_ready`; the database shortens a long one the same way for `notify` and `listen`.\n\t */\n\tnotify(channel: string, payload: string): SqliteStatement;\n\t/** Delivers `channel`'s events to `listener`, on one listening connection the database shares between channels. */\n\tlisten(channel: string, listener: (event: StorageNotificationEvent) => void): StorageNotificationSubscription;\n\t/** Opens the listening connection when it is not open, and resolves with its state once the first attempt settled. */\n\tstate(): Promise<StorageListenerState>;\n}\n\nexport interface SqliteDatabase extends SqliteExecutor {\n\t/**\n\t * True when the connection refuses writes, as `openNodeSqliteDatabase(path, { readOnly: true })` sets it, so opening a\n\t * session store skips a cleanup write that would fail. Optional: a read-only connection that leaves it unset still\n\t * opens a session store, whose failed cleanup is ignored.\n\t */\n\treadonly readOnly?: boolean;\n\treadonly descriptor: StorageDescriptor;\n\t/**\n\t * @internal Which database this handle reaches, for comparison only: two handles this process opened answer the same\n\t * string only when a transaction of either reads and writes the very tables the other does (the same adapter, server\n\t * or file, database, schema or namespace). Undefined, or absent, where that cannot be told, as for a database in\n\t * memory: such a handle is the same database as itself alone.\n\t */\n\tdatabaseIdentity?(): string | undefined;\n\t/** @internal Checks whether this embedded connection can prepare a JSONB extraction without issuing a read. */\n\tsupportsJsonbExtract?(): Promise<boolean>;\n\t/** The SQL dialect the database speaks; absent means SQLite. Read it through `dialectOf(database)`. */\n\treadonly dialect?: StorageDialect;\n\t/** Wake-ups through the database; present only on a database that delivers them (Postgres). */\n\treadonly notifications?: StorageNotifications;\n\t/**\n\t * The bytes this process may still write on the file system that holds the database's file (where a link to the file\n\t * points, and where its write-ahead log goes), as a SQLite or libSQL file database reports them. Absent, or resolving\n\t * undefined, when this process cannot see the database's disk (a server, memory) or the file system does not say.\n\t */\n\tfreeBytes?(): Promise<number | undefined>;\n\t/** @internal Run one short maintenance transaction only if this handle, its writer gate and the database lock\n\t * are immediately available. A backend without no-wait admission leaves this absent. */\n\ttryMaintenance?(callback: (transaction: SqliteExecutor) => Promise<void>): Promise<boolean>;\n\t/** Opens a separate handle on this same database for reads. It has its own call queue; the caller must close it. */\n\topenReader?(): Promise<SqliteDatabase>;\n\ttransaction<T>(\n\t\tcallback: (transaction: SqliteExecutor) => Promise<T>,\n\t\toptions?: SqliteTransactionOptions,\n\t): Promise<T>;\n\t/**\n\t * Runs the statements in order, in one write transaction, as one call to the database: all of them commit or none\n\t * do. Resolves with each statement's rows. Present only when the driver can send a batch in one request, which\n\t * saves a round trip per statement against a remote database.\n\t */\n\tbatch?(statements: readonly SqliteStatement[], options?: SqliteBatchOptions): Promise<SqliteRow[][]>;\n\tclose(): Promise<void>;\n}\n"]}
1
+ {"version":3,"file":"database.js","sourceRoot":"","sources":["../../../src/core/storage/database.ts"],"names":[],"mappings":"","sourcesContent":["import type { StorageDialect } from \"./dialect.js\";\n\nexport type SqliteValue = null | number | bigint | string | Uint8Array;\nexport type SqliteRow = Readonly<Record<string, SqliteValue>>;\n\nexport interface SqliteRunResult {\n\treadonly changes: number;\n}\n\nexport interface SqliteExecutor {\n\texec(sql: string): Promise<void>;\n\trun(sql: string, ...params: readonly SqliteValue[]): Promise<SqliteRunResult>;\n\tget<T extends SqliteRow>(sql: string, ...params: readonly SqliteValue[]): Promise<T | undefined>;\n\tall<T extends SqliteRow>(sql: string, ...params: readonly SqliteValue[]): Promise<T[]>;\n}\n\nexport interface StorageDescriptor {\n\treadonly adapter: string;\n\treadonly location: string;\n}\n\n/** One statement of a batch: SQL with positional `?` parameters. */\nexport interface SqliteStatement {\n\treadonly sql: string;\n\treadonly params: readonly SqliteValue[];\n}\n\n/** How a transaction takes its snapshot or write lock, and whether it may run again. */\nexport interface SqliteTransactionOptions {\n\t/** @internal A consistent read snapshot without a writer lock. The callback must only read. */\n\treadonly readOnly?: boolean;\n\t/**\n\t * How long the transaction keeps waiting for the write lock while it is held and no other connection commits,\n\t * instead of the connection's own lock wait. A writer whose work must not fail because another process stalled\n\t * with the lock held (starved of CPU, paused by garbage collection, stopped by a signal) waits longer: the holder\n\t * still commits or rolls back once it runs again. Adapters without a lock wait of their own ignore it.\n\t */\n\treadonly lockWaitMs?: number;\n\t/**\n\t * Lets a database from `createSqliteDatabase` run the callback again, in a new transaction, when a transient\n\t * failure (`StorageTransientError`) ended the transaction before it committed, so nothing of it was written. Set it\n\t * only for a callback that does nothing but use the transaction handle: anything else it does happens once per run.\n\t * Other databases ignore it.\n\t */\n\treadonly retryTransientFailures?: boolean;\n\t/**\n\t * How the transaction excludes other writers; `{ kind: \"serial\" }` when absent. SQLite runs every kind as\n\t * `BEGIN IMMEDIATE` unless `readOnly` is set; only a driver that runs transactions concurrently (Postgres) tells them apart.\n\t */\n\treadonly concurrency?: TransactionConcurrency;\n\t/**\n\t * @internal The statements the callback makes first, in this order, before it acts on any answer. A driver whose\n\t * transactions are pipelined sends them with the transaction's start, so they cost no round trip of their own, and\n\t * starts the callback once they are answered; each call of the callback that makes the next of them gets its answer.\n\t * Name only reads: a call that differs from the next of them ends the lead, and the answers of the rest go unused,\n\t * though they ran. A write may lead only as the callback's first call, made on every run whatever it reads, such as a\n\t * fenced path's one guarded write: it never runs unused. Other drivers ignore it.\n\t */\n\treadonly leading?: readonly SqliteStatement[];\n\t/**\n\t * @internal The callback makes the `leading` calls, all of them in order, and no other. A pipelined driver then sends\n\t * the commit right behind them, so the whole transaction costs one round trip: a call the callback makes after them\n\t * fails without being sent. When a leading statement fails, the transaction rolls back and the callback's call of\n\t * that statement fails. Other drivers ignore it.\n\t */\n\treadonly leadingOnly?: boolean;\n\t/**\n\t * @internal With `leading`, a `serial` transaction of a domain takes its locks in its first leading statement, a read,\n\t * and only when that read returns a row, instead of with its start: a transaction whose first read finds nothing\n\t * takes no lock. Every statement after it starts once the locks are held, so it sees every transaction that held them\n\t * and committed. A driver that ignores it takes the locks with the start. Other drivers ignore it.\n\t */\n\treadonly lockIfLeadingFinds?: boolean;\n\t/**\n\t * The commit returns before the server has written the transaction to disk, so a crash of the database server just\n\t * after it may lose it, though never part of it, and never a transaction that committed after it without this flag.\n\t * Only for writes whose loss is harmless because a later write repeats them, such as a lease renewal. PostgreSQL\n\t * turns `synchronous_commit` off for the transaction; other drivers ignore it.\n\t */\n\treadonly relaxedDurability?: boolean;\n}\n\n/** How one batch waits for a busy write lock, and whether it goes ahead of the database's queued calls. */\nexport interface SqliteBatchOptions {\n\t/**\n\t * How long a batch that found the database's write lock busy keeps sending again, with growing randomized waits\n\t * between tries. A busy batch wrote nothing, so sending it again is safe. Adapters without such a retry ignore it.\n\t */\n\treadonly lockWaitMs?: number;\n\t/**\n\t * Runs the batch before calls queued on this database that do not set it, and outside any limit the adapter puts on\n\t * concurrent writes: for small writes that must not wait behind others, such as a lease renewal.\n\t */\n\treadonly priority?: boolean;\n}\n\n/**\n * An audited fenced write path. Only `fencedPath(name)` in `fenced-paths.ts` makes one; a plain string is not one. The\n * brand is a string key, not a unique symbol, so the published declarations and the sources stay one type.\n */\nexport type FencedPathId = string & { readonly __atomicFencedPath: true };\n\n/**\n * `serial`: the body runs as if it were the only writer of `domain`, or of the whole database when `domain` is absent:\n * `BEGIN IMMEDIATE` on SQLite, `BEGIN` plus that domain's transaction advisory lock on Postgres. Several prefixes may\n * share one database, so `domain` names the scope in full: a store passes one of its prefixed table names.\n * `fenced`: the body runs under READ COMMITTED and takes the row locks it relies on itself. With `excludesSerial`, it\n * also waits for and excludes `serial` transactions without a domain, as a `serial` transaction with a domain does,\n * for a body whose check a whole-database writer (such as snapshot garbage collection) could otherwise race\n * (`StorageDialect.lockClause`); `audit` names the reviewed path. Identical to `serial` on SQLite.\n */\nexport type TransactionConcurrency =\n\t| { readonly kind: \"serial\"; readonly domain?: string }\n\t| { readonly kind: \"fenced\"; readonly audit: FencedPathId; readonly excludesSerial?: boolean };\n\n/**\n * What a database's listening connection is doing: `listening`, notifications arrive; `connecting`, it is not known yet;\n * `unavailable`, none arrive, and pollers find the work: `pooler` when the endpoint is a transaction pooler (a\n * notification sent through the database did not reach the listening session), `connection-failed` when the listening\n * connection could not be opened or broke.\n */\nexport type StorageListenerState =\n\t| { readonly status: \"listening\" }\n\t| { readonly status: \"connecting\" }\n\t| { readonly status: \"unavailable\"; readonly reason: \"pooler\" | \"connection-failed\" };\n\n/**\n * `notification`: a transaction that ran `notify(channel, payload)` committed. `listening`: the listening connection\n * began listening again after it was unavailable, so notifications sent meanwhile were lost.\n */\nexport type StorageNotificationEvent =\n\t| { readonly kind: \"notification\"; readonly payload: string }\n\t| { readonly kind: \"listening\" };\n\nexport interface StorageNotificationSubscription {\n\t/** Stops delivering events to this listener; idempotent. */\n\tclose(): void;\n}\n\n/**\n * Wake-ups through the database (#5103): Postgres `LISTEN`/`NOTIFY`. A notification is only a hint that a poller would\n * find the same work at its next poll; notifications are lost while the listening connection is down, and through a\n * transaction pooler none arrive, so a store that sends them keeps its poll.\n */\nexport interface StorageNotifications {\n\t/**\n\t * A statement that sends `payload` to the listeners of `channel` once the transaction it runs in commits: run it in the\n\t * transaction of the write it announces. `channel` is a name such as `<prefix>pool_ready`; the database shortens a long\n\t * one the same way for `notify` and `listen`. With `unless`, a read, the notification goes out only when that read,\n\t * made as it goes out, returns no row.\n\t *\n\t * Postgres answers the statement at once and sends the notification in a transaction of its own, right behind the\n\t * `COMMIT` in the same round trip: a notifying commit holds a server-wide lock until it is flushed, which would make\n\t * every other notifying commit wait for it. That transaction may also run when the `COMMIT` rolled back, and commits\n\t * that send the same notification within a few milliseconds of each other share one, sent once they committed. Older\n\t * adapters send it in the transaction and ignore `unless`.\n\t */\n\tnotify(channel: string, payload: string, unless?: SqliteStatement): SqliteStatement;\n\t/** Delivers `channel`'s events to `listener`, on one listening connection the database shares between channels. */\n\tlisten(channel: string, listener: (event: StorageNotificationEvent) => void): StorageNotificationSubscription;\n\t/** Opens the listening connection when it is not open, and resolves with its state once the first attempt settled. */\n\tstate(): Promise<StorageListenerState>;\n}\n\n/**\n * @internal What a driver read of its schema in its open's own round trip (#6560): the rows of the catalog read\n * `readStorageSchemaCatalog` makes (`kind` `relation`, `trigger` or `column`, with `name` and `detail`) and the\n * versions `ledger` records, as rows of `domain` and `version`; `versions` is undefined when the ledger did not exist.\n */\nexport interface StorageOpenedCatalog {\n\treadonly ledger: string;\n\treadonly rows: readonly SqliteRow[];\n\treadonly versions: readonly SqliteRow[] | undefined;\n}\n\nexport interface SqliteDatabase extends SqliteExecutor {\n\t/**\n\t * True when the connection refuses writes, as `openNodeSqliteDatabase(path, { readOnly: true })` sets it, so opening a\n\t * session store skips a cleanup write that would fail. Optional: a read-only connection that leaves it unset still\n\t * opens a session store, whose failed cleanup is ignored.\n\t */\n\treadonly readOnly?: boolean;\n\treadonly descriptor: StorageDescriptor;\n\t/**\n\t * @internal Which database this handle reaches, for comparison only: two handles this process opened answer the same\n\t * string only when a transaction of either reads and writes the very tables the other does (the same adapter, server\n\t * or file, database, schema or namespace). Undefined, or absent, where that cannot be told, as for a database in\n\t * memory: such a handle is the same database as itself alone.\n\t */\n\tdatabaseIdentity?(): string | undefined;\n\t/** @internal Checks whether this embedded connection can prepare a JSONB extraction without issuing a read. */\n\tsupportsJsonbExtract?(): Promise<boolean>;\n\t/** The SQL dialect the database speaks; absent means SQLite. Read it through `dialectOf(database)`. */\n\treadonly dialect?: StorageDialect;\n\t/** Wake-ups through the database; present only on a database that delivers them (Postgres). */\n\treadonly notifications?: StorageNotifications;\n\t/**\n\t * The bytes this process may still write on the file system that holds the database's file (where a link to the file\n\t * points, and where its write-ahead log goes), as a SQLite file database reports them. Absent, or resolving\n\t * undefined, when this process cannot see the database's disk (a server, memory) or the file system does not say.\n\t */\n\tfreeBytes?(): Promise<number | undefined>;\n\t/** @internal Run one short maintenance transaction only if this handle, its writer gate and the database lock\n\t * are immediately available. A backend without no-wait admission leaves this absent. */\n\ttryMaintenance?(callback: (transaction: SqliteExecutor) => Promise<void>): Promise<boolean>;\n\t/** Opens a separate handle on this same database for reads. It has its own call queue; the caller must close it. */\n\topenReader?(): Promise<SqliteDatabase>;\n\t/**\n\t * @internal The schema the driver read when it opened, given once: the first store open answers its schema checks\n\t * from it instead of reading the catalog again. Undefined after the first call, and where the driver read none.\n\t */\n\ttakeOpenedCatalog?(): StorageOpenedCatalog | undefined;\n\ttransaction<T>(\n\t\tcallback: (transaction: SqliteExecutor) => Promise<T>,\n\t\toptions?: SqliteTransactionOptions,\n\t): Promise<T>;\n\t/**\n\t * @internal Runs `statement` by itself as one request that commits on its own, queued in this process as a\n\t * transaction of `concurrency` is: behind the calls such a transaction waits for, and ahead of the calls that wait\n\t * for it. The statement takes on the server whatever locks it needs itself, such as a function that takes the\n\t * domain's advisory locks. A transient failure that applied nothing runs it again. Resolves with its rows. Present\n\t * only where the driver runs transactions concurrently (PostgreSQL).\n\t */\n\tautocommit?(statement: SqliteStatement, concurrency: TransactionConcurrency): Promise<SqliteRow[]>;\n\t/**\n\t * Runs the statements in order, in one write transaction, as one call to the database: all of them commit or none\n\t * do. Resolves with each statement's rows. Present only when the driver can send a batch in one request, which\n\t * saves a round trip per statement against a remote database.\n\t */\n\tbatch?(statements: readonly SqliteStatement[], options?: SqliteBatchOptions): Promise<SqliteRow[][]>;\n\tclose(): Promise<void>;\n}\n"]}
@@ -194,7 +194,7 @@ export interface StorageJsonSource {
194
194
  readonly column: string;
195
195
  readonly element?: string;
196
196
  }
197
- /** SQLite and libSQL: renders exactly the SQL the stores have always run, so schemas and statements stay unchanged. */
197
+ /** SQLite: renders exactly the SQL the stores have always run, so schemas and statements stay unchanged. */
198
198
  export declare const sqliteDialect: StorageDialect;
199
199
  /**
200
200
  * The JSON text in `column` as `jsonb`. SQLite reads any well-formed JSON, but Postgres's `jsonb` (and its `json`
@@ -26,7 +26,7 @@ const sqlString = (text) => `'${text.replaceAll("'", "''")}'`;
26
26
  const jsonEntries = (entries) => entries.map(([key, value]) => `${sqlString(jsonPath([key])[0])}, ${value}`).join(", ");
27
27
  const columnList = (columns) => `(${columns.join(", ")})`;
28
28
  const namedPlaceholders = (names) => names.map(() => "?").join(", ");
29
- /** SQLite and libSQL: renders exactly the SQL the stores have always run, so schemas and statements stay unchanged. */
29
+ /** SQLite: renders exactly the SQL the stores have always run, so schemas and statements stay unchanged. */
30
30
  export const sqliteDialect = Object.freeze({
31
31
  name: "sqlite",
32
32
  textByteLength: (expression) => `length(CAST(${expression} AS BLOB))`,