@bastani/atomic 0.10.18-alpha.1 → 0.10.19-alpha.1

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 (369) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/README.md +27 -5
  3. package/dist/_shared/config-binary-install-SNFYFXWB.js +70 -0
  4. package/dist/_shared/config-binary-install-SNFYFXWB.js.map +1 -0
  5. package/dist/_shared/dist-KOELCESV.js +2 -2
  6. package/dist/_shared/fork-row-index-UAUAQRD5.js +2 -2
  7. package/dist/_shared/lib-4PES5P4V.js +2 -2
  8. package/dist/_shared/{mode-interactive-sdk-7KXUFI2F.js → mode-interactive-sdk-JXBZ3H27.js} +434 -11
  9. package/dist/_shared/mode-interactive-sdk-JXBZ3H27.js.map +1 -0
  10. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +21 -6
  11. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js.map +1 -1
  12. package/dist/_shared/mode-shared-2QJSCUM6.js +7 -6
  13. package/dist/_shared/mode-shared-2QJSCUM6.js.map +1 -1
  14. package/dist/_shared/p0-cli-BB45ZQY6.js +56 -3
  15. package/dist/_shared/p0-cli-BB45ZQY6.js.map +1 -1
  16. package/dist/_shared/p1a-prewarm-XIU57JHF.js +3 -3
  17. package/dist/_shared/runtime-O4KCSG4C.js +3 -3
  18. package/dist/_shared/{sdk-OHKMDJ74.js → sdk-BHX35EPK.js} +47 -17
  19. package/dist/_shared/sdk-BHX35EPK.js.map +1 -0
  20. package/dist/_shared/session-data-AHTU7IS6.js +2 -2
  21. package/dist/_shared/session-manager-list-2BLEEZVG.js +1 -1
  22. package/dist/_shared/{startup-0-0-OV6RAEAP.js → startup-0-0-4EDVBK5P.js} +464 -7
  23. package/dist/_shared/startup-0-0-4EDVBK5P.js.map +1 -0
  24. package/dist/_shared/{startup-0-1-EZAJI6RE.js → startup-0-1-H5IXVRXQ.js} +85 -7
  25. package/dist/_shared/startup-0-1-H5IXVRXQ.js.map +1 -0
  26. package/dist/_shared/startup-0-2-YZZOC22D.js +4 -4
  27. package/dist/_shared/startup-0-3-DE2NCS6A.js +4 -4
  28. package/dist/_shared/startup-0-4-ZMJV547D.js +6 -5
  29. package/dist/_shared/startup-0-4-ZMJV547D.js.map +1 -1
  30. package/dist/_shared/startup-0-5-HZX3ZPTP.js +44 -13
  31. package/dist/_shared/startup-0-5-HZX3ZPTP.js.map +1 -1
  32. package/dist/_shared/startup-10-0-TDQNBDDL.js +5 -5
  33. package/dist/_shared/startup-12-0-55AAXBJZ.js +2 -2
  34. package/dist/_shared/startup-14-0-MLX36RBG.js +3 -3
  35. package/dist/_shared/startup-15-0-YUKGAC63.js +3 -3
  36. package/dist/_shared/{startup-15-1-4S7FLMNG.js → startup-15-1-WQZBOTMZ.js} +70 -28
  37. package/dist/_shared/{startup-15-1-4S7FLMNG.js.map → startup-15-1-WQZBOTMZ.js.map} +1 -1
  38. package/dist/_shared/startup-8-0-34CBHPZH.js +4 -4
  39. package/dist/_shared/{startup-8-1-LZFXSD3Z.js → startup-8-1-QZMXUGHI.js} +242 -20
  40. package/dist/_shared/startup-8-1-QZMXUGHI.js.map +1 -0
  41. package/dist/_shared/storage-command-7MGXLJGZ.js +75 -11
  42. package/dist/_shared/storage-command-7MGXLJGZ.js.map +1 -1
  43. package/dist/_shared/storage-status-K7PX2RXA.js +3 -3
  44. package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
  45. package/dist/_shared/team-DOQKICG2.js +2 -2
  46. package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
  47. package/dist/binary-self-update.js +281 -0
  48. package/dist/binary-self-update.js.map +1 -0
  49. package/dist/builtin/intercom/broker/broker.bundle.mjs +158 -78
  50. package/dist/builtin/intercom/broker/multinode-router.ts +41 -8
  51. package/dist/builtin/intercom/broker/multinode-state-store.ts +6 -1
  52. package/dist/builtin/intercom/broker/sql-lease-store.ts +89 -80
  53. package/dist/builtin/intercom/broker/sql-pending-ask-store.ts +65 -6
  54. package/dist/builtin/intercom/index.bundle.mjs +2 -1
  55. package/dist/builtin/intercom/package.json +1 -1
  56. package/dist/builtin/mcp/index.bundle.mjs +1 -1
  57. package/dist/builtin/mcp/package.json +1 -1
  58. package/dist/builtin/subagents/CHANGELOG.md +15 -0
  59. package/dist/builtin/subagents/package.json +1 -1
  60. package/dist/builtin/subagents/skills/agent-browser/SKILL.md +1 -1
  61. package/dist/builtin/subagents/skills/impeccable/SKILL.md +3 -3
  62. package/dist/builtin/subagents/skills/impeccable/reference/audit.md +2 -2
  63. package/dist/builtin/subagents/skills/impeccable/reference/critique.md +3 -3
  64. package/dist/builtin/subagents/skills/impeccable/reference/generate.md +1 -1
  65. package/dist/builtin/subagents/skills/impeccable/reference/init.md +0 -2
  66. package/dist/builtin/subagents/skills/impeccable/reference/live.md +4 -2
  67. package/dist/builtin/subagents/skills/impeccable/reference/new-work-comp.md +1 -1
  68. package/dist/builtin/subagents/skills/impeccable/reference/new-work-world.md +1 -1
  69. package/dist/builtin/subagents/skills/impeccable/scripts/VERSION +1 -1
  70. package/dist/builtin/subagents/skills/impeccable/scripts/engine-checksums.txt +5 -5
  71. package/dist/builtin/subagents/skills/impeccable/scripts/impeccable +28 -5
  72. package/dist/builtin/subagents/skills/impeccable/scripts/impeccable.cmd +11 -2
  73. package/dist/builtin/subagents/skills/impeccable/scripts/live-browser.js +10 -6
  74. package/dist/builtin/subagents/skills/research-codebase/SKILL.md +13 -19
  75. package/dist/builtin/subagents/skills/skill-creator/SKILL.md +1 -1
  76. package/dist/builtin/subagents/skills/subagent/SKILL.md +7 -7
  77. package/dist/builtin/subagents/skills/workflow/SKILL.md +98 -0
  78. package/dist/builtin/subagents/src/extension/index.bundle.mjs +2 -1
  79. package/dist/builtin/web-access/index.bundle.mjs +2 -1
  80. package/dist/builtin/web-access/package.json +1 -1
  81. package/dist/cli/args.js +2 -2
  82. package/dist/cli/auth-cli.code.js +3 -3
  83. package/dist/cli/auth-cli.impl.js +3 -3
  84. package/dist/cli/auth-cli.js +3 -3
  85. package/dist/cli/blueprint-command.code.js +2 -2
  86. package/dist/cli/blueprint-command.impl.js +3 -3
  87. package/dist/cli/blueprint-command.js +3 -3
  88. package/dist/cli/intercom-command.code.js +2 -2
  89. package/dist/cli/intercom-command.impl.js +3 -3
  90. package/dist/cli/intercom-command.js +3 -3
  91. package/dist/cli/list-models.code.js +2 -2
  92. package/dist/cli/list-models.impl.js +3 -3
  93. package/dist/cli/list-models.js +3 -3
  94. package/dist/cli/session-picker.code.js +1 -1
  95. package/dist/cli/session-picker.impl.js +3 -3
  96. package/dist/cli/session-picker.js +3 -3
  97. package/dist/cli/startup-ui.code.js +1 -1
  98. package/dist/cli/startup-ui.impl.js +3 -3
  99. package/dist/cli/startup-ui.js +3 -3
  100. package/dist/cli/storage-command.impl.js +3 -3
  101. package/dist/cli/storage-command.js +3 -3
  102. package/dist/cli/storage-search-session.code.js +3 -3
  103. package/dist/cli/storage-search-session.impl.js +3 -3
  104. package/dist/cli/storage-search-session.js +3 -3
  105. package/dist/cli/team-command.code.js +1 -1
  106. package/dist/cli/team-command.impl.js +3 -3
  107. package/dist/cli/team-command.js +3 -3
  108. package/dist/cli/usage-command.js +22 -0
  109. package/dist/cli/usage-command.js.map +1 -0
  110. package/dist/cli.js +2 -2
  111. package/dist/config-binary-install.js +3 -0
  112. package/dist/config-binary-install.js.map +1 -0
  113. package/dist/core/agent-session-services.js +3 -0
  114. package/dist/core/agent-session-services.js.map +1 -0
  115. package/dist/core/debug.impl.js +3 -3
  116. package/dist/core/debug.js +3 -3
  117. package/dist/core/export-html/card-projection.impl.js +3 -3
  118. package/dist/core/export-html/card-projection.js +3 -3
  119. package/dist/core/export-html/index.code.js +2 -2
  120. package/dist/core/export-html/index.impl.js +3 -3
  121. package/dist/core/export-html/index.js +3 -3
  122. package/dist/core/export-html/json-spans.impl.js +3 -3
  123. package/dist/core/export-html/json-spans.js +3 -3
  124. package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
  125. package/dist/core/export-html/oversized-render-inputs.js +3 -3
  126. package/dist/core/export-html/tool-renderer.impl.js +3 -3
  127. package/dist/core/export-html/tool-renderer.js +3 -3
  128. package/dist/core/extensions/jiti-loader.impl.js +3 -3
  129. package/dist/core/extensions/jiti-loader.js +3 -3
  130. package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
  131. package/dist/core/extensions/jiti-static-loader.js +3 -3
  132. package/dist/core/extensions/loader-host-modules.code.js +1 -1
  133. package/dist/core/extensions/loader-host-modules.impl.js +3 -3
  134. package/dist/core/extensions/loader-host-modules.js +3 -3
  135. package/dist/core/extensions/loader-virtual-modules.js +1 -1
  136. package/dist/core/extensions/runner-context.js +2 -2
  137. package/dist/core/intercom-broker-control-host.code.js +1 -1
  138. package/dist/core/intercom-broker-control-host.impl.js +3 -3
  139. package/dist/core/intercom-broker-control-host.js +3 -3
  140. package/dist/core/intercom-broker-control.code.js +3 -3
  141. package/dist/core/intercom-broker-control.impl.js +3 -3
  142. package/dist/core/intercom-broker-control.js +3 -3
  143. package/dist/core/{legacy-workflow-files.d.ts → legacy-workflows.d.ts} +1 -1
  144. package/dist/core/model-runtime.d.ts +8 -2
  145. package/dist/core/package-manager-storage-adapters.code.js +1 -1
  146. package/dist/core/package-manager-storage-adapters.impl.js +3 -3
  147. package/dist/core/package-manager-storage-adapters.js +3 -3
  148. package/dist/core/resource-loader-core.d.ts +1 -1
  149. package/dist/core/resource-loader-internals.d.ts +1 -1
  150. package/dist/core/resource-loader-types.d.ts +1 -1
  151. package/dist/core/resource-loader-types.js.map +1 -1
  152. package/dist/core/sdk.code.js +4 -4
  153. package/dist/core/sdk.impl.js +3 -3
  154. package/dist/core/sdk.js +3 -3
  155. package/dist/core/session-manager-core.js +5 -5
  156. package/dist/core/session-manager-list.impl.js +3 -3
  157. package/dist/core/session-manager-list.js +3 -3
  158. package/dist/core/session-manager.code.js +1 -1
  159. package/dist/core/session-manager.impl.js +3 -3
  160. package/dist/core/session-manager.js +3 -3
  161. package/dist/core/session-storage.code.js +1 -1
  162. package/dist/core/session-storage.impl.js +3 -3
  163. package/dist/core/session-storage.js +3 -3
  164. package/dist/core/settings-manager.js +5 -0
  165. package/dist/core/settings-manager.js.map +1 -0
  166. package/dist/core/storage/database.d.ts +6 -2
  167. package/dist/core/storage/database.js.map +1 -1
  168. package/dist/core/storage/fenced-paths.d.ts +15 -0
  169. package/dist/core/storage/fenced-paths.js +25 -0
  170. package/dist/core/storage/fenced-paths.js.map +1 -1
  171. package/dist/core/storage/index.js +2 -2
  172. package/dist/core/storage/migrations.d.ts +2 -11
  173. package/dist/core/storage/migrations.js +2 -9
  174. package/dist/core/storage/migrations.js.map +1 -1
  175. package/dist/core/storage/node-sqlite-thread.js +2 -2
  176. package/dist/core/storage/node-sqlite.js +2 -2
  177. package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
  178. package/dist/core/storage/offline-snapshot-file.js +3 -3
  179. package/dist/core/storage/postgres-locks.d.ts +11 -0
  180. package/dist/core/storage/postgres-locks.js +9 -0
  181. package/dist/core/storage/postgres-locks.js.map +1 -0
  182. package/dist/core/storage/provider.js +2 -2
  183. package/dist/core/storage/selection.js +2 -2
  184. package/dist/core/storage/session/branch-fork-source.code.js +2 -2
  185. package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
  186. package/dist/core/storage/session/branch-fork-source.js +3 -3
  187. package/dist/core/storage/session/card-view.impl.js +3 -3
  188. package/dist/core/storage/session/card-view.js +3 -3
  189. package/dist/core/storage/session/child-reader.code.js +3 -3
  190. package/dist/core/storage/session/child-reader.impl.js +3 -3
  191. package/dist/core/storage/session/child-reader.js +3 -3
  192. package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
  193. package/dist/core/storage/session/chunked-resume-projection.js +3 -3
  194. package/dist/core/storage/session/expanded-child-details.code.js +2 -2
  195. package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
  196. package/dist/core/storage/session/expanded-child-details.js +3 -3
  197. package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
  198. package/dist/core/storage/session/fork-row-bytes.js +3 -3
  199. package/dist/core/storage/session/fork-row-index.impl.js +3 -3
  200. package/dist/core/storage/session/fork-row-index.js +3 -3
  201. package/dist/core/storage/session/fork-staging.code.js +2 -2
  202. package/dist/core/storage/session/fork-staging.impl.js +3 -3
  203. package/dist/core/storage/session/fork-staging.js +3 -3
  204. package/dist/core/storage/session/fork-window.code.js +3 -3
  205. package/dist/core/storage/session/fork-window.impl.js +3 -3
  206. package/dist/core/storage/session/fork-window.js +3 -3
  207. package/dist/core/storage/session/history-pages.impl.js +3 -3
  208. package/dist/core/storage/session/history-pages.js +3 -3
  209. package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
  210. package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
  211. package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
  212. package/dist/core/storage/session/jsonl-session-store.js +3 -3
  213. package/dist/core/storage/session/memory-session-store.impl.js +3 -3
  214. package/dist/core/storage/session/memory-session-store.js +3 -3
  215. package/dist/core/storage/session/pinned-branch-resume.code.js +3 -3
  216. package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
  217. package/dist/core/storage/session/pinned-branch-resume.js +3 -3
  218. package/dist/core/storage/session/released-history-files.code.js +2 -2
  219. package/dist/core/storage/session/released-history-files.impl.js +3 -3
  220. package/dist/core/storage/session/released-history-files.js +3 -3
  221. package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
  222. package/dist/core/storage/session/resident-fork-rows.js +3 -3
  223. package/dist/core/storage/session/session-resume.impl.js +3 -3
  224. package/dist/core/storage/session/session-resume.js +3 -3
  225. package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
  226. package/dist/core/storage/session/snapshot-cut.js +3 -3
  227. package/dist/core/storage/session/snapshot-history.code.js +3 -3
  228. package/dist/core/storage/session/snapshot-history.impl.js +3 -3
  229. package/dist/core/storage/session/snapshot-history.js +3 -3
  230. package/dist/core/storage/session/sql-session-store.code.js +1 -1
  231. package/dist/core/storage/session/sql-session-store.d.ts +1 -1
  232. package/dist/core/storage/session/sql-session-store.impl.js +3 -3
  233. package/dist/core/storage/session/sql-session-store.js +3 -3
  234. package/dist/core/storage/session/tree-outline.impl.js +3 -3
  235. package/dist/core/storage/session/tree-outline.js +3 -3
  236. package/dist/core/storage/session/tree-presentation.impl.js +3 -3
  237. package/dist/core/storage/session/tree-presentation.js +3 -3
  238. package/dist/core/storage/sqlite-facade.js +6 -4
  239. package/dist/core/storage/sqlite-facade.js.map +1 -1
  240. package/dist/core/storage/storage-status.impl.js +3 -3
  241. package/dist/core/storage/storage-status.js +3 -3
  242. package/dist/core/storage/team.impl.js +3 -3
  243. package/dist/core/storage/team.js +3 -3
  244. package/dist/core/structured-output/index.code.js +1 -1
  245. package/dist/core/structured-output/index.impl.js +3 -3
  246. package/dist/core/structured-output/index.js +3 -3
  247. package/dist/core/subscription-usage-credential.d.ts +2 -0
  248. package/dist/core/subscription-usage-endpoints.d.ts +54 -0
  249. package/dist/core/subscription-usage.d.ts +55 -0
  250. package/dist/core/subscription-usage.js +3 -0
  251. package/dist/core/subscription-usage.js.map +1 -0
  252. package/dist/core/tasks/heartbeat-notice.d.ts +0 -1
  253. package/dist/core/tasks/task-completion-entry.impl.js +3 -3
  254. package/dist/core/tasks/task-completion-entry.js +3 -3
  255. package/dist/core/tasks/task-file-history.code.js +3 -3
  256. package/dist/core/tasks/task-file-history.impl.js +3 -3
  257. package/dist/core/tasks/task-file-history.js +3 -3
  258. package/dist/core/tasks/task-reference-archive.code.js +4 -4
  259. package/dist/core/tasks/task-reference-archive.js +3 -3
  260. package/dist/core/tasks/task-reference-identity.js +3 -3
  261. package/dist/core/tasks/task-reference-stream.impl.js +3 -3
  262. package/dist/core/tasks/task-reference-stream.js +3 -3
  263. package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
  264. package/dist/core/tasks/task-unsaved-answer.js +3 -3
  265. package/dist/core/tasks/task-view-source.code.js +1 -1
  266. package/dist/core/tasks/task-view-source.impl.js +3 -3
  267. package/dist/core/tasks/task-view-source.js +3 -3
  268. package/dist/core/tools/edit-diff.d.ts +4 -6
  269. package/dist/core/tools/read-url.code.js +3 -3
  270. package/dist/core/tools/read-url.impl.js +3 -3
  271. package/dist/core/tools/read-url.js +3 -3
  272. package/dist/core/worktree-snapshot/blob-store.d.ts +14 -16
  273. package/dist/core/worktree-snapshot/blob-store.js +194 -81
  274. package/dist/core/worktree-snapshot/blob-store.js.map +1 -1
  275. package/dist/core/worktree-snapshot/collection-claim.js +8 -0
  276. package/dist/core/worktree-snapshot/collection-claim.js.map +1 -0
  277. package/dist/core/worktree-snapshot/errors.code.js +2 -2
  278. package/dist/core/worktree-snapshot/errors.impl.js +3 -3
  279. package/dist/core/worktree-snapshot/errors.js +3 -3
  280. package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
  281. package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
  282. package/dist/core/worktree-snapshot/snapshot-epoch-migration.js +209 -0
  283. package/dist/core/worktree-snapshot/snapshot-epoch-migration.js.map +1 -0
  284. package/dist/core/worktree-snapshot/snapshot-epoch.js +100 -0
  285. package/dist/core/worktree-snapshot/snapshot-epoch.js.map +1 -0
  286. package/dist/extensions/codemode/execute.code.js +1 -1
  287. package/dist/extensions/codemode/execute.impl.js +3 -3
  288. package/dist/extensions/codemode/execute.js +3 -3
  289. package/dist/extensions/codemode/renderer.code.js +2 -2
  290. package/dist/extensions/codemode/renderer.impl.js +3 -3
  291. package/dist/extensions/codemode/renderer.js +3 -3
  292. package/dist/extensions/mcp/cli.code.js +2 -2
  293. package/dist/extensions/mcp/cli.impl.js +3 -3
  294. package/dist/extensions/mcp/cli.js +3 -3
  295. package/dist/extensions/mcp/cli.lazy.code.js +2 -2
  296. package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
  297. package/dist/extensions/mcp/cli.lazy.js +3 -3
  298. package/dist/extensions/mcp/runtime.code.js +1 -1
  299. package/dist/extensions/mcp/runtime.impl.js +3 -3
  300. package/dist/extensions/mcp/runtime.js +3 -3
  301. package/dist/index.d.ts +3 -0
  302. package/dist/index.js +7 -7
  303. package/dist/main-first-time-setup.code.js +1 -1
  304. package/dist/main-first-time-setup.impl.js +3 -3
  305. package/dist/main-first-time-setup.js +3 -3
  306. package/dist/main.js +2 -2
  307. package/dist/modes/interactive/components/stored-tree-view.code.js +2 -2
  308. package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
  309. package/dist/modes/interactive/components/stored-tree-view.js +3 -3
  310. package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
  311. package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
  312. package/dist/modes/interactive/interactive-mode-surface.d.ts +1 -0
  313. package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
  314. package/dist/modes/interactive/interactive-mode.js +1 -1
  315. package/dist/modes/interactive-engine/isolated-runtime.d.ts +3 -0
  316. package/dist/modes/print-mode.js +1 -1
  317. package/dist/modes/rpc/rpc-client-api.d.ts +3 -0
  318. package/dist/modes/rpc/rpc-types.d.ts +25 -0
  319. package/dist/package-manager-cli.code.js +31 -8
  320. package/dist/package-manager-cli.code.js.map +1 -1
  321. package/dist/package-manager-cli.impl.js +3 -3
  322. package/dist/package-manager-cli.js +3 -3
  323. package/dist/rpc-entry.js +2 -2
  324. package/dist/startup-files.json +1 -1
  325. package/dist/startup-stages/12.js +1 -1
  326. package/dist/startup-stages/4.js +1 -1
  327. package/dist/startup-stages/6.js +1 -1
  328. package/dist/subscription-usage-sdk.d.ts +9 -0
  329. package/dist/utils/changelog.d.ts +1 -0
  330. package/dist/utils/startup-database-spare.code.js +2 -2
  331. package/dist/utils/startup-database-spare.impl.js +3 -3
  332. package/dist/utils/startup-database-spare.js +3 -3
  333. package/dist/utils/tools-manager.code.js +1 -1
  334. package/dist/utils/tools-manager.impl.js +3 -3
  335. package/dist/utils/tools-manager.js +3 -3
  336. package/docs/background-tasks/reference.md +1 -1
  337. package/docs/background-tasks.md +1 -1
  338. package/docs/changelog.mdx +53 -1
  339. package/docs/containerization.md +17 -15
  340. package/docs/docs.json +1 -0
  341. package/docs/getting-started/installation.md +132 -80
  342. package/docs/guides/subscription-usage.md +133 -0
  343. package/docs/guides/team-setup.md +14 -3
  344. package/docs/guides.md +3 -0
  345. package/docs/index.md +18 -6
  346. package/docs/intercom/operations.md +1 -1
  347. package/docs/orchestration/migrating-workflows.md +16 -10
  348. package/docs/orchestration/patterns.md +8 -2
  349. package/docs/orchestration.md +17 -8
  350. package/docs/quickstart.md +7 -15
  351. package/docs/reference/cli.md +32 -24
  352. package/docs/rpc/protocol.md +9 -1
  353. package/docs/rpc.md +1 -1
  354. package/docs/sdk/reference.md +5 -1
  355. package/docs/skills.md +20 -4
  356. package/docs/slash-commands.md +3 -2
  357. package/docs/storage/postgres/tuning.md +2 -0
  358. package/docs/storage/postgres.md +17 -0
  359. package/docs/tools.md +57 -12
  360. package/docs/usage.md +1 -0
  361. package/docs/windows.md +4 -4
  362. package/docs/worktree-snapshots/reference.md +1 -1
  363. package/package.json +9 -9
  364. package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js.map +0 -1
  365. package/dist/_shared/sdk-OHKMDJ74.js.map +0 -1
  366. package/dist/_shared/startup-0-0-OV6RAEAP.js.map +0 -1
  367. package/dist/_shared/startup-0-1-EZAJI6RE.js.map +0 -1
  368. package/dist/_shared/startup-8-1-LZFXSD3Z.js.map +0 -1
  369. package/dist/builtin/subagents/skills/workflow-files/SKILL.md +0 -28
@@ -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.18-alpha.1`;
9
+ const key = `${root.href}#0.10.19-alpha.1`;
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.18-alpha.1") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.18-alpha.1 while this session was running; restart it to keep using this feature.", {
30
+ if (running === undefined || running.version === "0.10.19-alpha.1") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.19-alpha.1 while this session was running; restart it to keep using this feature.", {
32
32
  cause: error,
33
33
  });
34
34
  }
@@ -1,7 +1,7 @@
1
1
  import type { Theme } from "../modes/interactive/theme/theme.js";
2
2
  import type { ResourceDiagnostic, ResourceOverlap } from "./diagnostics.ts";
3
3
  import type { LoadExtensionsResult } from "./extensions/types.ts";
4
- import type { LegacyWorkflowFiles } from "./legacy-workflow-files.js";
4
+ import type { LegacyWorkflowFiles } from "./legacy-workflows.js";
5
5
  import type { McpServerContribution } from "./mcp-servers.ts";
6
6
  import type { PromptTemplate } from "./prompt-templates.ts";
7
7
  import type { DeferredStartupSettingsSnapshot } from "./resource-loader-internals.ts";
@@ -3,7 +3,7 @@ import type { ResourceDiagnostic } from "./diagnostics.ts";
3
3
  import type { EventBus } from "./event-bus.js";
4
4
  import type { PackageMcpServerSource } from "./extensions/loader.ts";
5
5
  import type { ExtensionRuntime, InlineExtension, LoadExtensionsResult } from "./extensions/types.ts";
6
- import type { LegacyWorkflowFiles } from "./legacy-workflow-files.js";
6
+ import type { LegacyWorkflowFiles } from "./legacy-workflows.js";
7
7
  import type { McpServerContribution } from "./mcp-servers.ts";
8
8
  import type { DefaultPackageManager, PathMetadata } from "./package-manager.ts";
9
9
  import type { PromptTemplate } from "./prompt-templates.ts";
@@ -2,7 +2,7 @@ import type { Theme } from "../modes/interactive/theme/theme.js";
2
2
  import type { ResourceDiagnostic } from "./diagnostics.ts";
3
3
  import type { EventBus } from "./event-bus.js";
4
4
  import type { InlineExtension, LoadExtensionsResult } from "./extensions/types.ts";
5
- import type { LegacyWorkflowFiles } from "./legacy-workflow-files.js";
5
+ import type { LegacyWorkflowFiles } from "./legacy-workflows.js";
6
6
  import type { McpServerContribution } from "./mcp-servers.ts";
7
7
  import type { PathMetadata, ResolvedResource } from "./package-manager.ts";
8
8
  import type { SourceScope } from "./package-manager-types.ts";
@@ -1 +1 @@
1
- {"version":3,"file":"resource-loader-types.js","sourceRoot":"","sources":["../../src/core/resource-loader-types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Theme } from \"../modes/interactive/theme/theme.js\";\nimport type { ResourceDiagnostic } from \"./diagnostics.ts\";\nimport type { EventBus } from \"./event-bus.js\";\nimport type { InlineExtension, LoadExtensionsResult } from \"./extensions/types.ts\";\nimport type { LegacyWorkflowFiles } from \"./legacy-workflow-files.js\";\nimport type { McpServerContribution } from \"./mcp-servers.ts\";\nimport type { PathMetadata, ResolvedResource } from \"./package-manager.ts\";\nimport type { SourceScope } from \"./package-manager-types.ts\";\nimport type { PromptTemplate } from \"./prompt-templates.ts\";\nimport type { PackageSource, SettingsManager } from \"./settings-manager.ts\";\nimport type { SkillCatalog } from \"./skill-catalog.ts\";\nimport type { Skill } from \"./skills.ts\";\n\nexport interface ResourceExtensionPaths {\n\tskillPaths?: Array<{ path: string; metadata: PathMetadata }>;\n\tpromptPaths?: Array<{ path: string; metadata: PathMetadata }>;\n\tthemePaths?: Array<{ path: string; metadata: PathMetadata }>;\n}\n\nexport interface ResourceLoaderReloadOptions {\n\t/** The host just loaded or removed its project settings layer. Keep the existing user settings for this read. */\n\tuseLoadedSettings?: true;\n\t/**\n\t * Skip loading extension code during this reload, leaving the loader with an\n\t * empty extension set. Skills, prompts, themes, context files, and prompt\n\t * files still load. A later full reload() picks up extensions.\n\t */\n\tdeferExtensions?: boolean;\n\t/**\n\t * Skip all resource discovery and loading during this reload. This is used by\n\t * interactive first-paint startup only when no CLI/startup input can observe\n\t * resources before a later full reload() completes.\n\t */\n\tdeferResources?: boolean;\n\t/** Publish trust-safe extensions now; complete trust after binding a live session and UI. */\n\tdeferProjectTrust?: (complete: () => Promise<void>) => void;\n\t/**\n\t * Narrows the extensions that load before the project's trust decision, which are the ones that can decide it.\n\t * `\"bundled\"`: only Atomic's bundled extensions, for a startup that found no other extension configured and used the\n\t * project at once; an extension configured since then loads after the decision and does not vote on it. `\"voters\"`:\n\t * every source except Atomic's bundled extensions, which answer no `project_trust`, for a decision made before the\n\t * session it serves is opened.\n\t */\n\tpreTrustExtensions?: \"bundled\" | \"voters\";\n\tresolveProjectTrust?: (options: { extensionsResult: LoadExtensionsResult }) => boolean | Promise<boolean>;\n\tresolveBorrowedProjectTrust?: (options: {\n\t\tsource: string;\n\t\tresources: ResolvedResource[];\n\t\textensionsResult: LoadExtensionsResult;\n\t}) => boolean | Promise<boolean>;\n\tonProjectTrustResolved?: () => void | Promise<void>;\n}\nexport interface PreparedResourceLoaderCommit {\n\tcommit(): void;\n\trollback(): void;\n}\n\nexport interface ResourceLoaderReloadTransaction {\n\t/** Fully loaded candidate. Live readers must not observe it before commit. */\n\treadonly loader: ResourceLoader;\n\t/** Rebind the candidate to the live settings identity immediately before commit. */\n\tactivate(settingsManager: SettingsManager): void;\n\t/** Prepare fallible publication work without exposing candidate behavior. */\n\tprepareCommit?(): PreparedResourceLoaderCommit;\n\t/** Publish synchronously after all candidate work has succeeded. */\n\tcommit(): void;\n}\n\n/** A subagent definition file that an installed package ships through its manifest's `agents` field. */\nexport interface PackageAgentFile {\n\t/** Absolute path of the agent's Markdown file. */\n\treadonly path: string;\n\t/** The package source as configured, e.g. `npm:@acme/review-kit`. */\n\treadonly source: string;\n\t/** Where the package is installed: globally (`user`), in the project, or for this run with `-e` (`temporary`). */\n\treadonly scope: SourceScope;\n\t/** The package's root directory. */\n\treadonly packageRoot: string;\n\t/** The `name` in the package's package.json, when it has one. */\n\treadonly packageName?: string;\n}\n\nexport interface ResourceLoader {\n\tgetExtensions(): LoadExtensionsResult;\n\tgetInheritanceSnapshot?(): DefaultResourceLoaderInheritanceSnapshot;\n\t/** Paths to earlier workflow recipes, not executable resources. */\n\tgetLegacyWorkflowFiles?(): LegacyWorkflowFiles | undefined;\n\tgetMcpServerContributions?(): McpServerContribution[];\n\t/** Enabled subagent definitions shipped by installed packages, as of the last reload. */\n\tgetPackageAgents?(): readonly PackageAgentFile[];\n\tgetSkills(): { skills: Skill[]; diagnostics: ResourceDiagnostic[] };\n\tgetSkillCatalog?(): SkillCatalog;\n\tgetPrompts(): { prompts: PromptTemplate[]; diagnostics: ResourceDiagnostic[] };\n\tgetThemes(): { themes: Theme[]; diagnostics: ResourceDiagnostic[] };\n\tgetAgentsFiles(): { agentsFiles: Array<{ path: string; content: string }> };\n\tgetSystemPrompt(): string | undefined;\n\tgetSystemPromptSource(): { path: string } | undefined;\n\tgetAppendSystemPrompt(): string[];\n\tgetAppendSystemPromptSources(): Array<{ path: string }>;\n\textendResources(paths: ResourceExtensionPaths): Promise<void>;\n\treload(options?: ResourceLoaderReloadOptions): Promise<void>;\n\tsupportsTransactionalReload?(): boolean;\n\tprepareReload?(\n\t\tsettingsManager: SettingsManager,\n\t\toptions?: ResourceLoaderReloadOptions,\n\t): Promise<ResourceLoaderReloadTransaction>;\n}\n\nexport interface DefaultResourceLoaderInheritanceSnapshot {\n\treadonly projectTrusted?: boolean;\n\treadonly additionalExtensionPaths?: readonly string[];\n\treadonly additionalSkillPaths?: readonly string[];\n\treadonly additionalPromptTemplatePaths?: readonly string[];\n\treadonly additionalThemePaths?: readonly string[];\n\treadonly builtinPackagePaths?: readonly PackageSource[];\n\treadonly extensionFactories?: readonly InlineExtension[];\n\treadonly noExtensions?: boolean;\n\treadonly disabledBuiltinExtensions?: readonly string[];\n\treadonly noSkills?: boolean;\n\treadonly noPromptTemplates?: boolean;\n\treadonly noThemes?: boolean;\n\treadonly noContextFiles?: boolean;\n\treadonly systemPrompt?: string;\n\treadonly appendSystemPrompt?: readonly string[];\n\treadonly trustedBorrowedProjectLocalSources?: readonly string[];\n}\n\nexport interface DefaultResourceLoaderOptions {\n\tcwd: string;\n\tagentDir: string;\n\tsettingsManager?: SettingsManager;\n\teventBus?: EventBus;\n\tresourceLoaderInheritanceSnapshot?: DefaultResourceLoaderInheritanceSnapshot;\n\tadditionalExtensionPaths?: string[];\n\tadditionalSkillPaths?: string[];\n\tadditionalPromptTemplatePaths?: string[];\n\tadditionalThemePaths?: string[];\n\tbuiltinPackagePaths?: PackageSource[];\n\textensionFactories?: InlineExtension[];\n\tnoExtensions?: boolean;\n\tdisabledBuiltinExtensions?: string[];\n\tnoSkills?: boolean;\n\tnoPromptTemplates?: boolean;\n\tnoThemes?: boolean;\n\tnoContextFiles?: boolean;\n\tsystemPrompt?: string;\n\tappendSystemPrompt?: string[];\n\textensionsOverride?: (base: LoadExtensionsResult) => LoadExtensionsResult;\n\tskillsOverride?: (base: { skills: Skill[]; diagnostics: ResourceDiagnostic[] }) => {\n\t\tskills: Skill[];\n\t\tdiagnostics: ResourceDiagnostic[];\n\t};\n\tpromptsOverride?: (base: { prompts: PromptTemplate[]; diagnostics: ResourceDiagnostic[] }) => {\n\t\tprompts: PromptTemplate[];\n\t\tdiagnostics: ResourceDiagnostic[];\n\t};\n\tthemesOverride?: (base: { themes: Theme[]; diagnostics: ResourceDiagnostic[] }) => {\n\t\tthemes: Theme[];\n\t\tdiagnostics: ResourceDiagnostic[];\n\t};\n\tagentsFilesOverride?: (base: { agentsFiles: Array<{ path: string; content: string }> }) => {\n\t\tagentsFiles: Array<{ path: string; content: string }>;\n\t};\n\tsystemPromptOverride?: (base: string | undefined) => string | undefined;\n\tappendSystemPromptOverride?: (base: string[]) => string[];\n}\n"]}
1
+ {"version":3,"file":"resource-loader-types.js","sourceRoot":"","sources":["../../src/core/resource-loader-types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Theme } from \"../modes/interactive/theme/theme.js\";\nimport type { ResourceDiagnostic } from \"./diagnostics.ts\";\nimport type { EventBus } from \"./event-bus.js\";\nimport type { InlineExtension, LoadExtensionsResult } from \"./extensions/types.ts\";\nimport type { LegacyWorkflowFiles } from \"./legacy-workflows.js\";\nimport type { McpServerContribution } from \"./mcp-servers.ts\";\nimport type { PathMetadata, ResolvedResource } from \"./package-manager.ts\";\nimport type { SourceScope } from \"./package-manager-types.ts\";\nimport type { PromptTemplate } from \"./prompt-templates.ts\";\nimport type { PackageSource, SettingsManager } from \"./settings-manager.ts\";\nimport type { SkillCatalog } from \"./skill-catalog.ts\";\nimport type { Skill } from \"./skills.ts\";\n\nexport interface ResourceExtensionPaths {\n\tskillPaths?: Array<{ path: string; metadata: PathMetadata }>;\n\tpromptPaths?: Array<{ path: string; metadata: PathMetadata }>;\n\tthemePaths?: Array<{ path: string; metadata: PathMetadata }>;\n}\n\nexport interface ResourceLoaderReloadOptions {\n\t/** The host just loaded or removed its project settings layer. Keep the existing user settings for this read. */\n\tuseLoadedSettings?: true;\n\t/**\n\t * Skip loading extension code during this reload, leaving the loader with an\n\t * empty extension set. Skills, prompts, themes, context files, and prompt\n\t * files still load. A later full reload() picks up extensions.\n\t */\n\tdeferExtensions?: boolean;\n\t/**\n\t * Skip all resource discovery and loading during this reload. This is used by\n\t * interactive first-paint startup only when no CLI/startup input can observe\n\t * resources before a later full reload() completes.\n\t */\n\tdeferResources?: boolean;\n\t/** Publish trust-safe extensions now; complete trust after binding a live session and UI. */\n\tdeferProjectTrust?: (complete: () => Promise<void>) => void;\n\t/**\n\t * Narrows the extensions that load before the project's trust decision, which are the ones that can decide it.\n\t * `\"bundled\"`: only Atomic's bundled extensions, for a startup that found no other extension configured and used the\n\t * project at once; an extension configured since then loads after the decision and does not vote on it. `\"voters\"`:\n\t * every source except Atomic's bundled extensions, which answer no `project_trust`, for a decision made before the\n\t * session it serves is opened.\n\t */\n\tpreTrustExtensions?: \"bundled\" | \"voters\";\n\tresolveProjectTrust?: (options: { extensionsResult: LoadExtensionsResult }) => boolean | Promise<boolean>;\n\tresolveBorrowedProjectTrust?: (options: {\n\t\tsource: string;\n\t\tresources: ResolvedResource[];\n\t\textensionsResult: LoadExtensionsResult;\n\t}) => boolean | Promise<boolean>;\n\tonProjectTrustResolved?: () => void | Promise<void>;\n}\nexport interface PreparedResourceLoaderCommit {\n\tcommit(): void;\n\trollback(): void;\n}\n\nexport interface ResourceLoaderReloadTransaction {\n\t/** Fully loaded candidate. Live readers must not observe it before commit. */\n\treadonly loader: ResourceLoader;\n\t/** Rebind the candidate to the live settings identity immediately before commit. */\n\tactivate(settingsManager: SettingsManager): void;\n\t/** Prepare fallible publication work without exposing candidate behavior. */\n\tprepareCommit?(): PreparedResourceLoaderCommit;\n\t/** Publish synchronously after all candidate work has succeeded. */\n\tcommit(): void;\n}\n\n/** A subagent definition file that an installed package ships through its manifest's `agents` field. */\nexport interface PackageAgentFile {\n\t/** Absolute path of the agent's Markdown file. */\n\treadonly path: string;\n\t/** The package source as configured, e.g. `npm:@acme/review-kit`. */\n\treadonly source: string;\n\t/** Where the package is installed: globally (`user`), in the project, or for this run with `-e` (`temporary`). */\n\treadonly scope: SourceScope;\n\t/** The package's root directory. */\n\treadonly packageRoot: string;\n\t/** The `name` in the package's package.json, when it has one. */\n\treadonly packageName?: string;\n}\n\nexport interface ResourceLoader {\n\tgetExtensions(): LoadExtensionsResult;\n\tgetInheritanceSnapshot?(): DefaultResourceLoaderInheritanceSnapshot;\n\t/** Paths to earlier workflow recipes, not executable resources. */\n\tgetLegacyWorkflowFiles?(): LegacyWorkflowFiles | undefined;\n\tgetMcpServerContributions?(): McpServerContribution[];\n\t/** Enabled subagent definitions shipped by installed packages, as of the last reload. */\n\tgetPackageAgents?(): readonly PackageAgentFile[];\n\tgetSkills(): { skills: Skill[]; diagnostics: ResourceDiagnostic[] };\n\tgetSkillCatalog?(): SkillCatalog;\n\tgetPrompts(): { prompts: PromptTemplate[]; diagnostics: ResourceDiagnostic[] };\n\tgetThemes(): { themes: Theme[]; diagnostics: ResourceDiagnostic[] };\n\tgetAgentsFiles(): { agentsFiles: Array<{ path: string; content: string }> };\n\tgetSystemPrompt(): string | undefined;\n\tgetSystemPromptSource(): { path: string } | undefined;\n\tgetAppendSystemPrompt(): string[];\n\tgetAppendSystemPromptSources(): Array<{ path: string }>;\n\textendResources(paths: ResourceExtensionPaths): Promise<void>;\n\treload(options?: ResourceLoaderReloadOptions): Promise<void>;\n\tsupportsTransactionalReload?(): boolean;\n\tprepareReload?(\n\t\tsettingsManager: SettingsManager,\n\t\toptions?: ResourceLoaderReloadOptions,\n\t): Promise<ResourceLoaderReloadTransaction>;\n}\n\nexport interface DefaultResourceLoaderInheritanceSnapshot {\n\treadonly projectTrusted?: boolean;\n\treadonly additionalExtensionPaths?: readonly string[];\n\treadonly additionalSkillPaths?: readonly string[];\n\treadonly additionalPromptTemplatePaths?: readonly string[];\n\treadonly additionalThemePaths?: readonly string[];\n\treadonly builtinPackagePaths?: readonly PackageSource[];\n\treadonly extensionFactories?: readonly InlineExtension[];\n\treadonly noExtensions?: boolean;\n\treadonly disabledBuiltinExtensions?: readonly string[];\n\treadonly noSkills?: boolean;\n\treadonly noPromptTemplates?: boolean;\n\treadonly noThemes?: boolean;\n\treadonly noContextFiles?: boolean;\n\treadonly systemPrompt?: string;\n\treadonly appendSystemPrompt?: readonly string[];\n\treadonly trustedBorrowedProjectLocalSources?: readonly string[];\n}\n\nexport interface DefaultResourceLoaderOptions {\n\tcwd: string;\n\tagentDir: string;\n\tsettingsManager?: SettingsManager;\n\teventBus?: EventBus;\n\tresourceLoaderInheritanceSnapshot?: DefaultResourceLoaderInheritanceSnapshot;\n\tadditionalExtensionPaths?: string[];\n\tadditionalSkillPaths?: string[];\n\tadditionalPromptTemplatePaths?: string[];\n\tadditionalThemePaths?: string[];\n\tbuiltinPackagePaths?: PackageSource[];\n\textensionFactories?: InlineExtension[];\n\tnoExtensions?: boolean;\n\tdisabledBuiltinExtensions?: string[];\n\tnoSkills?: boolean;\n\tnoPromptTemplates?: boolean;\n\tnoThemes?: boolean;\n\tnoContextFiles?: boolean;\n\tsystemPrompt?: string;\n\tappendSystemPrompt?: string[];\n\textensionsOverride?: (base: LoadExtensionsResult) => LoadExtensionsResult;\n\tskillsOverride?: (base: { skills: Skill[]; diagnostics: ResourceDiagnostic[] }) => {\n\t\tskills: Skill[];\n\t\tdiagnostics: ResourceDiagnostic[];\n\t};\n\tpromptsOverride?: (base: { prompts: PromptTemplate[]; diagnostics: ResourceDiagnostic[] }) => {\n\t\tprompts: PromptTemplate[];\n\t\tdiagnostics: ResourceDiagnostic[];\n\t};\n\tthemesOverride?: (base: { themes: Theme[]; diagnostics: ResourceDiagnostic[] }) => {\n\t\tthemes: Theme[];\n\t\tdiagnostics: ResourceDiagnostic[];\n\t};\n\tagentsFilesOverride?: (base: { agentsFiles: Array<{ path: string; content: string }> }) => {\n\t\tagentsFiles: Array<{ path: string; content: string }>;\n\t};\n\tsystemPromptOverride?: (base: string | undefined) => string | undefined;\n\tappendSystemPromptOverride?: (base: string[]) => string[];\n}\n"]}
@@ -1,8 +1,8 @@
1
1
  import "../_shared/rolldown-runtime-BGM3D5V3.js";
2
- import { withFileMutationQueue } from "../_shared/startup-0-0-OV6RAEAP.js";
3
- import { isPowerShellToolResult, withResourceAdmission } from "../_shared/startup-0-1-EZAJI6RE.js";
2
+ import { withFileMutationQueue } from "../_shared/startup-0-0-4EDVBK5P.js";
3
+ import { isPowerShellToolResult, withResourceAdmission } from "../_shared/startup-0-1-H5IXVRXQ.js";
4
4
  import { STRUCTURED_OUTPUT_TOOL_NAME, createStructuredOutputCapture, createStructuredOutputTool, getPowerShellConfig } from "../_shared/startup-0-2-YZZOC22D.js";
5
- import { BASH_SHELL_PRESENTATION, createBashTool, createCodingTools, createEditTool, createFindTool, createKillTool, createLocalPowerShellOperations, createLsTool, createPowerShellTool, createPowerShellToolDefinition, createReadOnlyTools, createReadTool, createSearchTool, createWriteTool } from "../_shared/startup-8-1-LZFXSD3Z.js";
6
- import { AgentSessionRuntime, HOST_STARTED_SESSION, SessionImportFileNotFoundError, createAgentSession, createAgentSessionFromServices, createAgentSessionRuntime, createAgentSessionServices, createUnstartedAgentSession } from "../_shared/startup-15-1-4S7FLMNG.js";
5
+ import { BASH_SHELL_PRESENTATION, createBashTool, createCodingTools, createEditTool, createFindTool, createKillTool, createLocalPowerShellOperations, createLsTool, createPowerShellTool, createPowerShellToolDefinition, createReadOnlyTools, createReadTool, createSearchTool, createWriteTool } from "../_shared/startup-8-1-QZMXUGHI.js";
6
+ import { AgentSessionRuntime, HOST_STARTED_SESSION, SessionImportFileNotFoundError, createAgentSession, createAgentSessionFromServices, createAgentSessionRuntime, createAgentSessionServices, createUnstartedAgentSession } from "../_shared/startup-15-1-WQZBOTMZ.js";
7
7
  export { AgentSessionRuntime, BASH_SHELL_PRESENTATION, HOST_STARTED_SESSION, STRUCTURED_OUTPUT_TOOL_NAME, SessionImportFileNotFoundError, createAgentSession, createAgentSessionFromServices, createAgentSessionRuntime, createAgentSessionServices, createBashTool, createCodingTools, createEditTool, createFindTool, createKillTool, createLocalPowerShellOperations, createLsTool, createPowerShellTool, createPowerShellToolDefinition, createReadOnlyTools, createReadTool, createSearchTool, createStructuredOutputCapture, createStructuredOutputTool, createUnstartedAgentSession, createWriteTool, getPowerShellConfig, isPowerShellToolResult, withFileMutationQueue, withResourceAdmission };
8
8
  //# sourceMappingURL=sdk.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.18-alpha.1`;
9
+ const key = `${root.href}#0.10.19-alpha.1`;
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.18-alpha.1") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.18-alpha.1 while this session was running; restart it to keep using this feature.", {
30
+ if (running === undefined || running.version === "0.10.19-alpha.1") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.19-alpha.1 while this session was running; restart it to keep using this feature.", {
32
32
  cause: error,
33
33
  });
34
34
  }
package/dist/core/sdk.js CHANGED
@@ -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.18-alpha.1`;
9
+ const key = `${root.href}#0.10.19-alpha.1`;
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.18-alpha.1") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.18-alpha.1 while this session was running; restart it to keep using this feature.", {
30
+ if (running === undefined || running.version === "0.10.19-alpha.1") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.19-alpha.1 while this session was running; restart it to keep using this feature.", {
32
32
  cause: error,
33
33
  });
34
34
  }
@@ -5,14 +5,14 @@ import { isProxy } from "node:util/types";
5
5
  import { getCurrentSystemMessage } from "@bastani/atomic-ai";
6
6
  import { recordsStrictToolLimits } from "@bastani/atomic-ai/api/strict-tool-limits";
7
7
  import { createSessionCwdMatcherAsync, getAgentDir, normalizePath, pathsEqual, resolvePath } from "../_shared/p0-cli-BB45ZQY6.js";
8
- import { SessionAppendRecovery, TOOL_DEACTIVATION_ENTRY_TYPE, chatEpoch, classifiedWorkflowMetadata, findMostRecentResumable, forkScope, forkStoreRelation, getDefaultSessionDirPath, postgresAppendRetryableFailure, storedRows, yieldToEventLoop } from "../_shared/startup-0-0-OV6RAEAP.js";
9
- import { ChildCatalog, SessionKeyDigests, TOOL_OUTPUT_ENTRY_TYPE, WorkspaceConfigError, assertSessionBlobStore, carriedTransformedPrompt, carryCompletionEvidence, convertToLlm, copySessionBlobs, sessionBlobHashes, shareCompletionEvidence, storeInlineToolOutputs, storeSessionBlobs, takeInlineToolOutput, takeInlineToolOutputEntry, writeChunksAtomically } from "../_shared/startup-0-1-EZAJI6RE.js";
8
+ import { SessionAppendRecovery, TOOL_DEACTIVATION_ENTRY_TYPE, chatEpoch, classifiedWorkflowMetadata, findMostRecentResumable, forkScope, forkStoreRelation, getDefaultSessionDirPath, postgresAppendRetryableFailure, storedRows, yieldToEventLoop } from "../_shared/startup-0-0-4EDVBK5P.js";
9
+ import { ChildCatalog, SessionKeyDigests, TOOL_OUTPUT_ENTRY_TYPE, WorkspaceConfigError, assertSessionBlobStore, carriedTransformedPrompt, carryCompletionEvidence, convertToLlm, copySessionBlobs, sessionBlobHashes, shareCompletionEvidence, storeInlineToolOutputs, storeSessionBlobs, takeInlineToolOutput, takeInlineToolOutputEntry, writeChunksAtomically } from "../_shared/startup-0-1-H5IXVRXQ.js";
10
10
  import { LEAF_MOVE_ENTRY_TYPE, applyContextEdit, assertSessionNotOpenElsewhere, buildContextEntries, buildSessionIndex, buildSessionProjection, buildSessionTree, collectContextEdits, getBranchPath, getLatestCompactionBoundaryEntry, holdSessionOpenMarker, isLeafMoveEntry } from "../_shared/startup-0-3-DE2NCS6A.js";
11
11
  import { SessionConflictError, SessionFormatVersionError, SessionIdMismatchError, SessionNotFoundError, StorageUnavailableError } from "./storage/session/errors.js";
12
12
  import { EMPTY_SESSION_HISTORY_TOTALS, JsonlSessionStore, MemorySessionStore, addEntryToHistoryTotals, appendFailureWroteNothing, archivedAnswerAt, assertValidSessionId, bindSessionFile, createBranchSummaryEntry, createCompactionEntry, createContextEditEntry, createCustomEntry, createCustomMessageEntry, createLabelEntry, createMessageEntry, createModelChangeEntry, createSessionFilePath, createSessionHeader, createSessionId, createSessionInfoEntry, createSessionSummaryEntry, createThinkingLevelChangeEntry, createWorktreeSnapshotEntry, earlierTranscriptCursor, findInSessionHistory, findWorktreeSnapshotRecords, firstHistoryCursor, generateId, getEntriesWithoutHeader, getLatestSessionName, historyChunks, historyPages, isExtensionCustomState, lastBranchAnswer, markPrivateMemorySessionStore, readSessionRange, recoveryWitnessesOf, savedWindowAnswer, sessionResumeOf, storeSnapshotIndex, updateWorkflowStarts, validateSessionEntryStructure, validateSessionFileEntries, withForkFileWindow, witnessedIn, worktreeSnapshotPages } from "../_shared/startup-8-0-34CBHPZH.js";
13
13
  import { SESSION_HISTORY_SCAN_ENTRIES, SessionDeletedError, SessionEntryError } from "../_shared/settings-startup-HXQLSUWM.js";
14
14
  import { listProjectSessions, resolveParentSessionPaths } from "../_shared/session-manager-list-2BLEEZVG.js";
15
- import { adoptInlineSnapshotBlobs, deleteSessionWithSnapshotRefs } from "../_shared/startup-8-1-LZFXSD3Z.js";
15
+ import { adoptInlineSnapshotBlobs, deleteSessionWithSnapshotRefs } from "../_shared/startup-8-1-QZMXUGHI.js";
16
16
  import { SessionBlobError, StorageRollbackError, isStorageTransientError } from "./storage/errors.js";
17
17
  import "../_shared/startup-0-2-YZZOC22D.js";
18
18
  // dist/core/fork-context-path.js
@@ -2878,7 +2878,7 @@ function __atomicOnDemandFailed(error, feature) {
2878
2878
  return (async () => {
2879
2879
  const root = new URL("../", import.meta.url);
2880
2880
  const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
2881
- const key = `${root.href}#0.10.18-alpha.1`;
2881
+ const key = `${root.href}#0.10.19-alpha.1`;
2882
2882
  let release = releases.get(key);
2883
2883
  if (release === undefined) {
2884
2884
  const current = (async () => {
@@ -2906,7 +2906,7 @@ function __atomicOnDemandFailed(error, feature) {
2906
2906
  } catch {
2907
2907
  // No installation to read, as in a bundle of the package: the release the process runs decides.
2908
2908
  }
2909
- const updatedTo = typeof installed === "string" && installed !== "0.10.18-alpha.1" ? installed : running !== undefined && running.version !== "0.10.18-alpha.1" ? "0.10.18-alpha.1" : undefined;
2909
+ const updatedTo = typeof installed === "string" && installed !== "0.10.19-alpha.1" ? installed : running !== undefined && running.version !== "0.10.19-alpha.1" ? "0.10.19-alpha.1" : undefined;
2910
2910
  if (updatedTo === undefined) throw error;
2911
2911
  const application = typeof running?.name === "string" ? running.name : "atomic";
2912
2912
  const restart = new Error(`${application} was updated to ${updatedTo} while this session was running; restart it to keep using ${feature}.`, {
@@ -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.18-alpha.1`;
9
+ const key = `${root.href}#0.10.19-alpha.1`;
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.18-alpha.1") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.18-alpha.1 while this session was running; restart it to keep using session storage.", {
30
+ if (running === undefined || running.version === "0.10.19-alpha.1") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.19-alpha.1 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.18-alpha.1`;
9
+ const key = `${root.href}#0.10.19-alpha.1`;
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.18-alpha.1") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.18-alpha.1 while this session was running; restart it to keep using session storage.", {
30
+ if (running === undefined || running.version === "0.10.19-alpha.1") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.19-alpha.1 while this session was running; restart it to keep using session storage.", {
32
32
  cause: error,
33
33
  });
34
34
  }
@@ -1,5 +1,5 @@
1
1
  import "../_shared/rolldown-runtime-BGM3D5V3.js";
2
- import { CURRENT_SESSION_VERSION, getDefaultSessionDir, getDefaultSessionDirPath } from "../_shared/startup-0-0-OV6RAEAP.js";
2
+ import { CURRENT_SESSION_VERSION, getDefaultSessionDir, getDefaultSessionDirPath } from "../_shared/startup-0-0-4EDVBK5P.js";
3
3
  import { buildContextEntries, buildSessionContext, buildSessionProjection, getLatestCompactionBoundaryEntry, getSessionLeafId, sessionEntryToContextMessages } from "../_shared/startup-0-3-DE2NCS6A.js";
4
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,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.18-alpha.1`;
9
+ const key = `${root.href}#0.10.19-alpha.1`;
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.18-alpha.1") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.18-alpha.1 while this session was running; restart it to keep using session storage.", {
30
+ if (running === undefined || running.version === "0.10.19-alpha.1") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.19-alpha.1 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.18-alpha.1`;
9
+ const key = `${root.href}#0.10.19-alpha.1`;
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.18-alpha.1") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.18-alpha.1 while this session was running; restart it to keep using session storage.", {
30
+ if (running === undefined || running.version === "0.10.19-alpha.1") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.19-alpha.1 while this session was running; restart it to keep using session storage.", {
32
32
  cause: error,
33
33
  });
34
34
  }
@@ -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-LZFXSD3Z.js";
2
+ export { ENGINE_SESSION_STORAGE_FLAG, canIsolateSessionStore, getEngineSessionStorage, projectSettingsChooseSessionStorage, resolveSessionStore, selectSessionSetting, selectSessionStorage, selectSessionStorageWithSettings, selectSessionStorageWithSettingsAsync, sessionStorageSettingsDiffer, takeEngineSessionStorageArg } from "../_shared/startup-8-1-QZMXUGHI.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.18-alpha.1`;
9
+ const key = `${root.href}#0.10.19-alpha.1`;
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.18-alpha.1") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.18-alpha.1 while this session was running; restart it to keep using session storage.", {
30
+ if (running === undefined || running.version === "0.10.19-alpha.1") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.19-alpha.1 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.18-alpha.1`;
9
+ const key = `${root.href}#0.10.19-alpha.1`;
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.18-alpha.1") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.18-alpha.1 while this session was running; restart it to keep using session storage.", {
30
+ if (running === undefined || running.version === "0.10.19-alpha.1") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.19-alpha.1 while this session was running; restart it to keep using session storage.", {
32
32
  cause: error,
33
33
  });
34
34
  }
@@ -0,0 +1,5 @@
1
+ import "../_shared/rolldown-runtime-BGM3D5V3.js";
2
+ import { CACHE_WARMING_MODES } from "../_shared/startup-0-0-4EDVBK5P.js";
3
+ import { FileSettingsStorage, InMemorySettingsStorage, SettingsManager } from "../_shared/startup-8-1-QZMXUGHI.js";
4
+ export { CACHE_WARMING_MODES, FileSettingsStorage, InMemorySettingsStorage, SettingsManager };
5
+ //# sourceMappingURL=settings-manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings-manager.js","sources":[],"names":[],"mappings":""}
@@ -99,8 +99,10 @@ export type FencedPathId = string & {
99
99
  * share one database, so `domain` names the scope in full: a store passes one of its prefixed table names.
100
100
  * `fenced`: the body runs under READ COMMITTED and takes the row locks it relies on itself. With `excludesSerial`, it
101
101
  * also waits for and excludes `serial` transactions without a domain, as a `serial` transaction with a domain does,
102
- * for a body whose check a whole-database writer (such as snapshot garbage collection) could otherwise race
103
- * (`StorageDialect.lockClause`); `audit` names the reviewed path. Identical to `serial` on SQLite.
102
+ * for a body whose check a whole-database writer (such as legacy snapshot garbage collection) could otherwise race
103
+ * (`StorageDialect.lockClause`); `audit` names the reviewed path. A fenced path that takes its own domain locks may
104
+ * set `queueDomain` to keep its local call order: a string is a local domain, null is the whole local writer queue.
105
+ * Identical to `serial` on SQLite.
104
106
  */
105
107
  export type TransactionConcurrency = {
106
108
  readonly kind: "serial";
@@ -109,6 +111,7 @@ export type TransactionConcurrency = {
109
111
  readonly kind: "fenced";
110
112
  readonly audit: FencedPathId;
111
113
  readonly excludesSerial?: boolean;
114
+ readonly queueDomain?: string | null;
112
115
  };
113
116
  /**
114
117
  * What a database's listening connection is doing: `listening`, notifications arrive; `connecting`, it is not known yet;
@@ -215,6 +218,7 @@ export interface SqliteDatabase extends SqliteExecutor {
215
218
  * from it instead of reading the catalog again. Undefined after the first call, and where the driver read none.
216
219
  */
217
220
  takeOpenedCatalog?(): StorageOpenedCatalog | undefined;
221
+ /** Keep the transaction to database work. Await I/O through `transaction` only; finish other work before opening it or after it commits. */
218
222
  transaction<T>(callback: (transaction: SqliteExecutor) => Promise<T>, options?: SqliteTransactionOptions): Promise<T>;
219
223
  /**
220
224
  * @internal Runs `statement` by itself as one request that commits on its own, queued in this process as a
@@ -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\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/**\n\t * Optional. Sends already-committed notifications produced by `notify` together, outside the database's serial\n\t * call queue so post-commit wake-ups never block or wait behind unrelated transactions. Coalesced within the same\n\t * window as in-transaction notifications, and awaited before the database closes.\n\t */\n\tsend?(notices: readonly SqliteStatement[]): Promise<void>;\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"]}
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 legacy snapshot garbage collection) could otherwise race\n * (`StorageDialect.lockClause`); `audit` names the reviewed path. A fenced path that takes its own domain locks may\n * set `queueDomain` to keep its local call order: a string is a local domain, null is the whole local writer queue.\n * Identical to `serial` on SQLite.\n */\nexport type TransactionConcurrency =\n\t| { readonly kind: \"serial\"; readonly domain?: string }\n\t| {\n\t\t\treadonly kind: \"fenced\";\n\t\t\treadonly audit: FencedPathId;\n\t\t\treadonly excludesSerial?: boolean;\n\t\t\treadonly queueDomain?: string | null;\n\t };\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/**\n\t * Optional. Sends already-committed notifications produced by `notify` together, outside the database's serial\n\t * call queue so post-commit wake-ups never block or wait behind unrelated transactions. Coalesced within the same\n\t * window as in-transaction notifications, and awaited before the database closes.\n\t */\n\tsend?(notices: readonly SqliteStatement[]): Promise<void>;\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\t/** Keep the transaction to database work. Await I/O through `transaction` only; finish other work before opening it or after it commits. */\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"]}
@@ -43,6 +43,11 @@ declare const FENCED_PATHS: {
43
43
  readonly fences: readonly ["acquire only, without the order sequence: the acquisition-order counter row, by the statement's own upsert", "each lease row, by its own guarded upsert or UPDATE, in (kind, key) order"];
44
44
  readonly conformance: "many brokers acquire, renew and release one lease concurrently: never two holders, fencing tokens strictly increase, a stale holder's renewal fails (#6560)";
45
45
  };
46
+ /** Intercom's lost-recipient sweep returns only the asks its guarded UPDATE marks ended. */
47
+ readonly "intercom-lost-ask": {
48
+ readonly fences: readonly ["the sweep leader's exact lease and the recipient's presence rows, FOR SHARE NOWAIT", "open ask rows, in insertion order FOR UPDATE SKIP LOCKED before marking"];
49
+ readonly conformance: "concurrent lost-recipient sweeps return an ask once and never queue on advisory locks (#6831)";
50
+ };
46
51
  /**
47
52
  * Intercom's wake-up hint log (`intercom_wakeups`): a hint is a row inserted once and deleted by its id or its age,
48
53
  * and no write reads the log to decide what to write, so its writers take no lock domain: the bus's `publish`
@@ -90,6 +95,16 @@ declare const FENCED_PATHS: {
90
95
  readonly fences: readonly ["the setup's advisory locks, all tried by its first statement without waiting"];
91
96
  readonly conformance: "many hosts open a new database at once: each schema is set up once, every host opens, and none waits in a lock queue (#6560)";
92
97
  };
98
+ /** Snapshot reference writers and cleanup select the database's coordination mode in the transaction. */
99
+ readonly "snapshot-epoch": {
100
+ readonly fences: readonly ["shared epoch transition gate", "legacy database key only in compatibility mode", "domain key if required"];
101
+ readonly conformance: "an ordinary session writer commits while an older collector holds the old key (#6832)";
102
+ };
103
+ /** Snapshot cleanup backs off outside the transaction if either advisory lock is busy. */
104
+ readonly "snapshot-collection": {
105
+ readonly fences: readonly ["claim bookkeeping: try the database lock shared, then try the collection table's lock exclusively, then update the claim row", "data batches: try the legacy database lock exclusively, then recheck the claim and the data before writing"];
106
+ readonly conformance: "busy snapshot collection does not queue ahead of session writers, then deletes the orphaned blobs (#6831)";
107
+ };
93
108
  /**
94
109
  * `SqlRateBuckets.acquire` and `cooldown`: one `UPDATE … RETURNING` (or upsert) of the scope's bucket row, which locks
95
110
  * no pool row, so it orders after none of them (#4768).
@@ -52,6 +52,14 @@ const FENCED_PATHS = {
52
52
  ],
53
53
  conformance: "many brokers acquire, renew and release one lease concurrently: never two holders, fencing tokens strictly increase, a stale holder's renewal fails (#6560)",
54
54
  },
55
+ /** Intercom's lost-recipient sweep returns only the asks its guarded UPDATE marks ended. */
56
+ "intercom-lost-ask": {
57
+ fences: [
58
+ "the sweep leader's exact lease and the recipient's presence rows, FOR SHARE NOWAIT",
59
+ "open ask rows, in insertion order FOR UPDATE SKIP LOCKED before marking",
60
+ ],
61
+ conformance: "concurrent lost-recipient sweeps return an ask once and never queue on advisory locks (#6831)",
62
+ },
55
63
  /**
56
64
  * Intercom's wake-up hint log (`intercom_wakeups`): a hint is a row inserted once and deleted by its id or its age,
57
65
  * and no write reads the log to decide what to write, so its writers take no lock domain: the bus's `publish`
@@ -102,6 +110,23 @@ const FENCED_PATHS = {
102
110
  fences: ["the setup's advisory locks, all tried by its first statement without waiting"],
103
111
  conformance: "many hosts open a new database at once: each schema is set up once, every host opens, and none waits in a lock queue (#6560)",
104
112
  },
113
+ /** Snapshot reference writers and cleanup select the database's coordination mode in the transaction. */
114
+ "snapshot-epoch": {
115
+ fences: [
116
+ "shared epoch transition gate",
117
+ "legacy database key only in compatibility mode",
118
+ "domain key if required",
119
+ ],
120
+ conformance: "an ordinary session writer commits while an older collector holds the old key (#6832)",
121
+ },
122
+ /** Snapshot cleanup backs off outside the transaction if either advisory lock is busy. */
123
+ "snapshot-collection": {
124
+ fences: [
125
+ "claim bookkeeping: try the database lock shared, then try the collection table's lock exclusively, then update the claim row",
126
+ "data batches: try the legacy database lock exclusively, then recheck the claim and the data before writing",
127
+ ],
128
+ conformance: "busy snapshot collection does not queue ahead of session writers, then deletes the orphaned blobs (#6831)",
129
+ },
105
130
  /**
106
131
  * `SqlRateBuckets.acquire` and `cooldown`: one `UPDATE … RETURNING` (or upsert) of the scope's bucket row, which locks
107
132
  * no pool row, so it orders after none of them (#4768).
@@ -1 +1 @@
1
- {"version":3,"file":"fenced-paths.js","sourceRoot":"","sources":["../../../src/core/storage/fenced-paths.ts"],"names":[],"mappings":"AAUA;;;GAGG;AACH,MAAM,YAAY,GAAG;IACpB,gIAAgI;IAChI,YAAY,EAAE;QACb,MAAM,EAAE;YACP,8BAA8B;YAC9B,2CAA2C;YAC3C,uCAAuC;SACvC;QACD,WAAW,EAAE,6FAA6F;KAC1G;IACD,oHAAoH;IACpH,gBAAgB,EAAE;QACjB,MAAM,EAAE,CAAC,8BAA8B,EAAE,+BAA+B,EAAE,uBAAuB,CAAC;QAClG,WAAW,EAAE,6FAA6F;KAC1G;IACD,qHAAqH;IACrH,aAAa,EAAE;QACd,MAAM,EAAE;YACP,oHAAoH;YACpH,8BAA8B;YAC9B,+BAA+B;YAC/B,yGAAyG;YACzG,uBAAuB;SACvB;QACD,WAAW,EAAE,8EAA8E;KAC3F;IACD,0EAA0E;IAC1E,eAAe,EAAE;QAChB,MAAM,EAAE;YACP,8BAA8B;YAC9B,+BAA+B;YAC/B,2CAA2C;SAC3C;QACD,WAAW,EAAE,6FAA6F;KAC1G;IACD;;;;;;;OAOG;IACH,gBAAgB,EAAE;QACjB,MAAM,EAAE;YACP,4GAA4G;YAC5G,2EAA2E;SAC3E;QACD,WAAW,EACV,6JAA6J;KAC9J;IACD;;;;;OAKG;IACH,sBAAsB,EAAE;QACvB,MAAM,EAAE,CAAC,gDAAgD,CAAC;QAC1D,WAAW,EAAE,oFAAoF;KACjG;IACD;;;;;;;;;OASG;IACH,qBAAqB,EAAE;QACtB,MAAM,EAAE;YACP,mKAAmK;YACnK,mEAAmE;SACnE;QACD,WAAW,EACV,+JAA+J;KAChK;IACD;;;;;;;OAOG;IACH,oBAAoB,EAAE;QACrB,MAAM,EAAE,CAAC,4FAA4F,CAAC;QACtG,WAAW,EACV,6GAA6G;KAC9G;IACD;;;;;;OAMG;IACH,cAAc,EAAE;QACf,MAAM,EAAE,CAAC,8EAA8E,CAAC;QACxF,WAAW,EACV,8HAA8H;KAC/H;IACD;;;OAGG;IACH,aAAa,EAAE;QACd,MAAM,EAAE,CAAC,gDAAgD,CAAC;QAC1D,WAAW,EAAE,iGAAiG;KAC9G;CAC4D,CAAC;AAI/D,yCAAyC;AACzC,MAAM,UAAU,eAAe,CAAC,IAAoB;IACnD,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,UAAU,CAAC,IAAoB;IAC9C,OAAO,IAAoB,CAAC;AAC7B,CAAC","sourcesContent":["import type { FencedPathId } from \"./database.js\";\n\n/** What makes a fenced write path correct without the domain's serial lock. */\nexport interface FencedPathAudit {\n\t/** The rows the path locks, in the order it locks them (the same order on every fenced path, so none deadlock). */\n\treadonly fences: readonly string[];\n\t/** The conformance test that runs the path concurrently on every backend. */\n\treadonly conformance: string;\n}\n\n/**\n * Every audited path that may run a `fenced` transaction. A path is added here, with its fences and its test, in the\n * change that makes it fenced; nothing else can name one.\n */\nconst FENCED_PATHS = {\n\t/** `SqlPoolQueue.claim`: one `UPDATE … WHERE id = (SELECT … FOR UPDATE SKIP LOCKED)`, so claimers never wait on one another. */\n\t\"pool-claim\": {\n\t\tfences: [\n\t\t\t\"root lease row FOR KEY SHARE\",\n\t\t\t\"root run row FOR SHARE, then pool control\",\n\t\t\t\"ready work row FOR UPDATE SKIP LOCKED\",\n\t\t],\n\t\tconformance: \"many hosts claim, commit and complete concurrently: no double claim, no lost settle (#5102)\",\n\t},\n\t/** `SqlPoolQueue.renew`, `extend` and `heartbeat`: the attempt's lease, its claim confirmation and usage report. */\n\t\"pool-heartbeat\": {\n\t\tfences: [\"root lease row FOR KEY SHARE\", \"attempt's work row FOR UPDATE\", \"root usage totals row\"],\n\t\tconformance: \"claim, commit, heartbeat, complete and takeover run concurrently without a deadlock (#5102)\",\n\t},\n\t/** `SqlPoolQueue.commit` of a checkpoint or a session: the event takes the run's next sequence under its run row. */\n\t\"pool-commit\": {\n\t\tfences: [\n\t\t\t\"the database-wide serial lock, shared, only when the checkpoint records worktree snapshots (before every row lock)\",\n\t\t\t\"root lease row FOR KEY SHARE\",\n\t\t\t\"attempt's work row FOR UPDATE\",\n\t\t\t\"root run row FOR UPDATE (FOR SHARE without an event), then pool control and the snapshots' stored blobs\",\n\t\t\t\"root usage totals row\",\n\t\t],\n\t\tconformance: \"32 concurrent writers commit one event per key with a dense sequence (#5102)\",\n\t},\n\t/** `SqlPoolQueue.complete`: the result and the work row's final state. */\n\t\"pool-complete\": {\n\t\tfences: [\n\t\t\t\"root lease row FOR KEY SHARE\",\n\t\t\t\"attempt's work row FOR UPDATE\",\n\t\t\t\"root run row FOR SHARE, then pool control\",\n\t\t],\n\t\tconformance: \"many hosts claim, commit and complete concurrently: no double claim, no lost settle (#5102)\",\n\t},\n\t/**\n\t * Intercom's broker leases (`openSqlBrokerLeaseStore`): `acquire` is one upsert whose guard takes the row only while\n\t * it is free, stale or the acquirer's own, `renew` and `release` one `UPDATE` guarded by holder and fencing token, and\n\t * `renewMany` those updates in (kind, key) order. Each decides on its own row lock, never on an earlier read (#6560).\n\t * On PostgreSQL a first acquisition takes its order from the lease order sequence, which waits for nothing; where\n\t * `atomic storage migrate` has not created it yet, `acquire`'s statement first upserts the acquisition-order counter\n\t * row instead, which no other path locks.\n\t */\n\t\"intercom-lease\": {\n\t\tfences: [\n\t\t\t\"acquire only, without the order sequence: the acquisition-order counter row, by the statement's own upsert\",\n\t\t\t\"each lease row, by its own guarded upsert or UPDATE, in (kind, key) order\",\n\t\t],\n\t\tconformance:\n\t\t\t\"many brokers acquire, renew and release one lease concurrently: never two holders, fencing tokens strictly increase, a stale holder's renewal fails (#6560)\",\n\t},\n\t/**\n\t * Intercom's wake-up hint log (`intercom_wakeups`): a hint is a row inserted once and deleted by its id or its age,\n\t * and no write reads the log to decide what to write, so its writers take no lock domain: the bus's `publish`\n\t * inserts a hint and notifies in one transaction that commits both, an outbox enqueue inserts one inside its own\n\t * transaction, and the bus's poll and pruning delete rows in single statements (#6560).\n\t */\n\t\"intercom-wakeup-hint\": {\n\t\tfences: [\"none: the new hint row only, by its own INSERT\"],\n\t\tconformance: \"delivers each hint published at once from several connections exactly once (#6560)\",\n\t},\n\t/**\n\t * Intercom's outbox rows and sent-message reservations (`openSqlOutboxStore`, `openSqlSentMessageAuthority`), which\n\t * left the outbox's one lock domain (#6560). A claim reads its recipient's undelivered rows `FOR UPDATE` in sequence\n\t * order, then claims them; a single claim's renewal, saving report, release and settlement are each one `UPDATE`\n\t * guarded by message id, claimant, token and state; batched `markDelivered`, `renewClaims`, `releaseClaims`, expiry\n\t * and `releaseClaimsOf` lock their rows in sequence order in a subquery; a reservation, an acceptance and a forget\n\t * are each one statement on the message's row, guarded by its digest. Each decides on the rows it locks, never on an\n\t * earlier read. They exclude the database-wide transactions an older broker runs on these tables (`excludesSerial`).\n\t * A send itself is a serial transaction of its recipient's domain.\n\t */\n\t\"intercom-outbox-row\": {\n\t\tfences: [\n\t\t\t\"outbox rows, FOR UPDATE in sequence order (claim, markDelivered batch, renewClaims, releaseClaims, expiry, releaseClaimsOf), or one row by its own guarded UPDATE\",\n\t\t\t\"one sent-message row, by its own guarded INSERT, UPDATE or DELETE\",\n\t\t],\n\t\tconformance:\n\t\t\t\"a send to one recipient does not wait while another recipient's claim holds its rows; sends to one recipient keep their order and suppress duplicates (#6560)\",\n\t},\n\t/**\n\t * A cleanup's claim of a lapsed fork staging transfer (`cleanupForkStaging`): it reads one lapsed lease row `FOR\n\t * UPDATE SKIP LOCKED`, then takes it over with one `UPDATE` guarded by the lease still being lapsed, so it never waits\n\t * for a live transfer whose writer or publication holds its lease, and two claims never take one transfer. Any lapsed\n\t * transfer may be claimed in any order. The claim names no transfer before it reads, so it takes no lock domain; the\n\t * owner's writes and the cleanup's removals are serial transactions of the transfer's own domain, and each decides on\n\t * the lease row it locks by its token first (#6560).\n\t */\n\t\"fork-staging-claim\": {\n\t\tfences: [\"one lapsed lease row of the staging table, FOR UPDATE SKIP LOCKED, then its guarded UPDATE\"],\n\t\tconformance:\n\t\t\t\"concurrent cleanups take each lapsed transfer over once and never a live one, beside staging clones (#6560)\",\n\t},\n\t/**\n\t * A schema setup that hosts opening a new database at once run once (`setUpStorageOnce`): its first statement tries,\n\t * without waiting, the advisory locks every setup of the same objects takes (the prefix's setup lock, and for a\n\t * domain's migration that domain's lock and the database's, shared, as an earlier build's migration takes them), and\n\t * the setup runs only where it took them all. A process that finds one taken waits outside any transaction until the\n\t * setup is recorded, so the hosts never queue for the lock (#6560).\n\t */\n\t\"schema-setup\": {\n\t\tfences: [\"the setup's advisory locks, all tried by its first statement without waiting\"],\n\t\tconformance:\n\t\t\t\"many hosts open a new database at once: each schema is set up once, every host opens, and none waits in a lock queue (#6560)\",\n\t},\n\t/**\n\t * `SqlRateBuckets.acquire` and `cooldown`: one `UPDATE … RETURNING` (or upsert) of the scope's bucket row, which locks\n\t * no pool row, so it orders after none of them (#4768).\n\t */\n\t\"rate-bucket\": {\n\t\tfences: [\"the scope's rate bucket row, by its own UPDATE\"],\n\t\tconformance: \"many hosts acquire from one rate bucket concurrently and never take more than it allows (#4768)\",\n\t},\n} as const satisfies Readonly<Record<string, FencedPathAudit>>;\n\nexport type FencedPathName = keyof typeof FENCED_PATHS;\n\n/** The audit record of a fenced path. */\nexport function fencedPathAudit(name: FencedPathName): FencedPathAudit {\n\treturn FENCED_PATHS[name];\n}\n\n/** The `FencedPathId` that lets an audited path run `{ kind: \"fenced\", audit }` transactions. */\nexport function fencedPath(name: FencedPathName): FencedPathId {\n\treturn name as FencedPathId;\n}\n"]}
1
+ {"version":3,"file":"fenced-paths.js","sourceRoot":"","sources":["../../../src/core/storage/fenced-paths.ts"],"names":[],"mappings":"AAUA;;;GAGG;AACH,MAAM,YAAY,GAAG;IACpB,gIAAgI;IAChI,YAAY,EAAE;QACb,MAAM,EAAE;YACP,8BAA8B;YAC9B,2CAA2C;YAC3C,uCAAuC;SACvC;QACD,WAAW,EAAE,6FAA6F;KAC1G;IACD,oHAAoH;IACpH,gBAAgB,EAAE;QACjB,MAAM,EAAE,CAAC,8BAA8B,EAAE,+BAA+B,EAAE,uBAAuB,CAAC;QAClG,WAAW,EAAE,6FAA6F;KAC1G;IACD,qHAAqH;IACrH,aAAa,EAAE;QACd,MAAM,EAAE;YACP,oHAAoH;YACpH,8BAA8B;YAC9B,+BAA+B;YAC/B,yGAAyG;YACzG,uBAAuB;SACvB;QACD,WAAW,EAAE,8EAA8E;KAC3F;IACD,0EAA0E;IAC1E,eAAe,EAAE;QAChB,MAAM,EAAE;YACP,8BAA8B;YAC9B,+BAA+B;YAC/B,2CAA2C;SAC3C;QACD,WAAW,EAAE,6FAA6F;KAC1G;IACD;;;;;;;OAOG;IACH,gBAAgB,EAAE;QACjB,MAAM,EAAE;YACP,4GAA4G;YAC5G,2EAA2E;SAC3E;QACD,WAAW,EACV,6JAA6J;KAC9J;IACD,4FAA4F;IAC5F,mBAAmB,EAAE;QACpB,MAAM,EAAE;YACP,oFAAoF;YACpF,yEAAyE;SACzE;QACD,WAAW,EAAE,+FAA+F;KAC5G;IACD;;;;;OAKG;IACH,sBAAsB,EAAE;QACvB,MAAM,EAAE,CAAC,gDAAgD,CAAC;QAC1D,WAAW,EAAE,oFAAoF;KACjG;IACD;;;;;;;;;OASG;IACH,qBAAqB,EAAE;QACtB,MAAM,EAAE;YACP,mKAAmK;YACnK,mEAAmE;SACnE;QACD,WAAW,EACV,+JAA+J;KAChK;IACD;;;;;;;OAOG;IACH,oBAAoB,EAAE;QACrB,MAAM,EAAE,CAAC,4FAA4F,CAAC;QACtG,WAAW,EACV,6GAA6G;KAC9G;IACD;;;;;;OAMG;IACH,cAAc,EAAE;QACf,MAAM,EAAE,CAAC,8EAA8E,CAAC;QACxF,WAAW,EACV,8HAA8H;KAC/H;IACD,yGAAyG;IACzG,gBAAgB,EAAE;QACjB,MAAM,EAAE;YACP,8BAA8B;YAC9B,gDAAgD;YAChD,wBAAwB;SACxB;QACD,WAAW,EAAE,uFAAuF;KACpG;IACD,0FAA0F;IAC1F,qBAAqB,EAAE;QACtB,MAAM,EAAE;YACP,8HAA8H;YAC9H,4GAA4G;SAC5G;QACD,WAAW,EACV,2GAA2G;KAC5G;IACD;;;OAGG;IACH,aAAa,EAAE;QACd,MAAM,EAAE,CAAC,gDAAgD,CAAC;QAC1D,WAAW,EAAE,iGAAiG;KAC9G;CAC4D,CAAC;AAI/D,yCAAyC;AACzC,MAAM,UAAU,eAAe,CAAC,IAAoB;IACnD,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,UAAU,CAAC,IAAoB;IAC9C,OAAO,IAAoB,CAAC;AAC7B,CAAC","sourcesContent":["import type { FencedPathId } from \"./database.js\";\n\n/** What makes a fenced write path correct without the domain's serial lock. */\nexport interface FencedPathAudit {\n\t/** The rows the path locks, in the order it locks them (the same order on every fenced path, so none deadlock). */\n\treadonly fences: readonly string[];\n\t/** The conformance test that runs the path concurrently on every backend. */\n\treadonly conformance: string;\n}\n\n/**\n * Every audited path that may run a `fenced` transaction. A path is added here, with its fences and its test, in the\n * change that makes it fenced; nothing else can name one.\n */\nconst FENCED_PATHS = {\n\t/** `SqlPoolQueue.claim`: one `UPDATE … WHERE id = (SELECT … FOR UPDATE SKIP LOCKED)`, so claimers never wait on one another. */\n\t\"pool-claim\": {\n\t\tfences: [\n\t\t\t\"root lease row FOR KEY SHARE\",\n\t\t\t\"root run row FOR SHARE, then pool control\",\n\t\t\t\"ready work row FOR UPDATE SKIP LOCKED\",\n\t\t],\n\t\tconformance: \"many hosts claim, commit and complete concurrently: no double claim, no lost settle (#5102)\",\n\t},\n\t/** `SqlPoolQueue.renew`, `extend` and `heartbeat`: the attempt's lease, its claim confirmation and usage report. */\n\t\"pool-heartbeat\": {\n\t\tfences: [\"root lease row FOR KEY SHARE\", \"attempt's work row FOR UPDATE\", \"root usage totals row\"],\n\t\tconformance: \"claim, commit, heartbeat, complete and takeover run concurrently without a deadlock (#5102)\",\n\t},\n\t/** `SqlPoolQueue.commit` of a checkpoint or a session: the event takes the run's next sequence under its run row. */\n\t\"pool-commit\": {\n\t\tfences: [\n\t\t\t\"the database-wide serial lock, shared, only when the checkpoint records worktree snapshots (before every row lock)\",\n\t\t\t\"root lease row FOR KEY SHARE\",\n\t\t\t\"attempt's work row FOR UPDATE\",\n\t\t\t\"root run row FOR UPDATE (FOR SHARE without an event), then pool control and the snapshots' stored blobs\",\n\t\t\t\"root usage totals row\",\n\t\t],\n\t\tconformance: \"32 concurrent writers commit one event per key with a dense sequence (#5102)\",\n\t},\n\t/** `SqlPoolQueue.complete`: the result and the work row's final state. */\n\t\"pool-complete\": {\n\t\tfences: [\n\t\t\t\"root lease row FOR KEY SHARE\",\n\t\t\t\"attempt's work row FOR UPDATE\",\n\t\t\t\"root run row FOR SHARE, then pool control\",\n\t\t],\n\t\tconformance: \"many hosts claim, commit and complete concurrently: no double claim, no lost settle (#5102)\",\n\t},\n\t/**\n\t * Intercom's broker leases (`openSqlBrokerLeaseStore`): `acquire` is one upsert whose guard takes the row only while\n\t * it is free, stale or the acquirer's own, `renew` and `release` one `UPDATE` guarded by holder and fencing token, and\n\t * `renewMany` those updates in (kind, key) order. Each decides on its own row lock, never on an earlier read (#6560).\n\t * On PostgreSQL a first acquisition takes its order from the lease order sequence, which waits for nothing; where\n\t * `atomic storage migrate` has not created it yet, `acquire`'s statement first upserts the acquisition-order counter\n\t * row instead, which no other path locks.\n\t */\n\t\"intercom-lease\": {\n\t\tfences: [\n\t\t\t\"acquire only, without the order sequence: the acquisition-order counter row, by the statement's own upsert\",\n\t\t\t\"each lease row, by its own guarded upsert or UPDATE, in (kind, key) order\",\n\t\t],\n\t\tconformance:\n\t\t\t\"many brokers acquire, renew and release one lease concurrently: never two holders, fencing tokens strictly increase, a stale holder's renewal fails (#6560)\",\n\t},\n\t/** Intercom's lost-recipient sweep returns only the asks its guarded UPDATE marks ended. */\n\t\"intercom-lost-ask\": {\n\t\tfences: [\n\t\t\t\"the sweep leader's exact lease and the recipient's presence rows, FOR SHARE NOWAIT\",\n\t\t\t\"open ask rows, in insertion order FOR UPDATE SKIP LOCKED before marking\",\n\t\t],\n\t\tconformance: \"concurrent lost-recipient sweeps return an ask once and never queue on advisory locks (#6831)\",\n\t},\n\t/**\n\t * Intercom's wake-up hint log (`intercom_wakeups`): a hint is a row inserted once and deleted by its id or its age,\n\t * and no write reads the log to decide what to write, so its writers take no lock domain: the bus's `publish`\n\t * inserts a hint and notifies in one transaction that commits both, an outbox enqueue inserts one inside its own\n\t * transaction, and the bus's poll and pruning delete rows in single statements (#6560).\n\t */\n\t\"intercom-wakeup-hint\": {\n\t\tfences: [\"none: the new hint row only, by its own INSERT\"],\n\t\tconformance: \"delivers each hint published at once from several connections exactly once (#6560)\",\n\t},\n\t/**\n\t * Intercom's outbox rows and sent-message reservations (`openSqlOutboxStore`, `openSqlSentMessageAuthority`), which\n\t * left the outbox's one lock domain (#6560). A claim reads its recipient's undelivered rows `FOR UPDATE` in sequence\n\t * order, then claims them; a single claim's renewal, saving report, release and settlement are each one `UPDATE`\n\t * guarded by message id, claimant, token and state; batched `markDelivered`, `renewClaims`, `releaseClaims`, expiry\n\t * and `releaseClaimsOf` lock their rows in sequence order in a subquery; a reservation, an acceptance and a forget\n\t * are each one statement on the message's row, guarded by its digest. Each decides on the rows it locks, never on an\n\t * earlier read. They exclude the database-wide transactions an older broker runs on these tables (`excludesSerial`).\n\t * A send itself is a serial transaction of its recipient's domain.\n\t */\n\t\"intercom-outbox-row\": {\n\t\tfences: [\n\t\t\t\"outbox rows, FOR UPDATE in sequence order (claim, markDelivered batch, renewClaims, releaseClaims, expiry, releaseClaimsOf), or one row by its own guarded UPDATE\",\n\t\t\t\"one sent-message row, by its own guarded INSERT, UPDATE or DELETE\",\n\t\t],\n\t\tconformance:\n\t\t\t\"a send to one recipient does not wait while another recipient's claim holds its rows; sends to one recipient keep their order and suppress duplicates (#6560)\",\n\t},\n\t/**\n\t * A cleanup's claim of a lapsed fork staging transfer (`cleanupForkStaging`): it reads one lapsed lease row `FOR\n\t * UPDATE SKIP LOCKED`, then takes it over with one `UPDATE` guarded by the lease still being lapsed, so it never waits\n\t * for a live transfer whose writer or publication holds its lease, and two claims never take one transfer. Any lapsed\n\t * transfer may be claimed in any order. The claim names no transfer before it reads, so it takes no lock domain; the\n\t * owner's writes and the cleanup's removals are serial transactions of the transfer's own domain, and each decides on\n\t * the lease row it locks by its token first (#6560).\n\t */\n\t\"fork-staging-claim\": {\n\t\tfences: [\"one lapsed lease row of the staging table, FOR UPDATE SKIP LOCKED, then its guarded UPDATE\"],\n\t\tconformance:\n\t\t\t\"concurrent cleanups take each lapsed transfer over once and never a live one, beside staging clones (#6560)\",\n\t},\n\t/**\n\t * A schema setup that hosts opening a new database at once run once (`setUpStorageOnce`): its first statement tries,\n\t * without waiting, the advisory locks every setup of the same objects takes (the prefix's setup lock, and for a\n\t * domain's migration that domain's lock and the database's, shared, as an earlier build's migration takes them), and\n\t * the setup runs only where it took them all. A process that finds one taken waits outside any transaction until the\n\t * setup is recorded, so the hosts never queue for the lock (#6560).\n\t */\n\t\"schema-setup\": {\n\t\tfences: [\"the setup's advisory locks, all tried by its first statement without waiting\"],\n\t\tconformance:\n\t\t\t\"many hosts open a new database at once: each schema is set up once, every host opens, and none waits in a lock queue (#6560)\",\n\t},\n\t/** Snapshot reference writers and cleanup select the database's coordination mode in the transaction. */\n\t\"snapshot-epoch\": {\n\t\tfences: [\n\t\t\t\"shared epoch transition gate\",\n\t\t\t\"legacy database key only in compatibility mode\",\n\t\t\t\"domain key if required\",\n\t\t],\n\t\tconformance: \"an ordinary session writer commits while an older collector holds the old key (#6832)\",\n\t},\n\t/** Snapshot cleanup backs off outside the transaction if either advisory lock is busy. */\n\t\"snapshot-collection\": {\n\t\tfences: [\n\t\t\t\"claim bookkeeping: try the database lock shared, then try the collection table's lock exclusively, then update the claim row\",\n\t\t\t\"data batches: try the legacy database lock exclusively, then recheck the claim and the data before writing\",\n\t\t],\n\t\tconformance:\n\t\t\t\"busy snapshot collection does not queue ahead of session writers, then deletes the orphaned blobs (#6831)\",\n\t},\n\t/**\n\t * `SqlRateBuckets.acquire` and `cooldown`: one `UPDATE … RETURNING` (or upsert) of the scope's bucket row, which locks\n\t * no pool row, so it orders after none of them (#4768).\n\t */\n\t\"rate-bucket\": {\n\t\tfences: [\"the scope's rate bucket row, by its own UPDATE\"],\n\t\tconformance: \"many hosts acquire from one rate bucket concurrently and never take more than it allows (#4768)\",\n\t},\n} as const satisfies Readonly<Record<string, FencedPathAudit>>;\n\nexport type FencedPathName = keyof typeof FENCED_PATHS;\n\n/** The audit record of a fenced path. */\nexport function fencedPathAudit(name: FencedPathName): FencedPathAudit {\n\treturn FENCED_PATHS[name];\n}\n\n/** The `FencedPathId` that lets an audited path run `{ kind: \"fenced\", audit }` transactions. */\nexport function fencedPath(name: FencedPathName): FencedPathId {\n\treturn name as FencedPathId;\n}\n"]}
@@ -42,7 +42,7 @@ function __atomicOnDemandFailed(error, feature) {
42
42
  return (async () => {
43
43
  const root = new URL("../../", import.meta.url);
44
44
  const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
45
- const key = `${root.href}#0.10.18-alpha.1`;
45
+ const key = `${root.href}#0.10.19-alpha.1`;
46
46
  let release = releases.get(key);
47
47
  if (release === undefined) {
48
48
  const current = (async () => {
@@ -70,7 +70,7 @@ function __atomicOnDemandFailed(error, feature) {
70
70
  } catch {
71
71
  // No installation to read, as in a bundle of the package: the release the process runs decides.
72
72
  }
73
- const updatedTo = typeof installed === "string" && installed !== "0.10.18-alpha.1" ? installed : running !== undefined && running.version !== "0.10.18-alpha.1" ? "0.10.18-alpha.1" : undefined;
73
+ const updatedTo = typeof installed === "string" && installed !== "0.10.19-alpha.1" ? installed : running !== undefined && running.version !== "0.10.19-alpha.1" ? "0.10.19-alpha.1" : undefined;
74
74
  if (updatedTo === undefined) throw error;
75
75
  const application = typeof running?.name === "string" ? running.name : "atomic";
76
76
  const restart = new Error(`${application} was updated to ${updatedTo} while this session was running; restart it to keep using ${feature}.`, {