@bastani/atomic 0.10.10 → 0.10.11-alpha.2

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 (402) hide show
  1. package/CHANGELOG.md +139 -0
  2. package/README.md +1 -1
  3. package/dist/_shared/dist-KOELCESV.js +2 -2
  4. package/dist/_shared/fork-row-index-UAUAQRD5.js +2 -2
  5. package/dist/_shared/lib-4PES5P4V.js +2 -2
  6. package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js +11 -13
  7. package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js.map +1 -1
  8. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +9 -9
  9. package/dist/_shared/mode-shared-2QJSCUM6.js +55 -18
  10. package/dist/_shared/mode-shared-2QJSCUM6.js.map +1 -1
  11. package/dist/_shared/p1a-prewarm-XIU57JHF.js +3 -3
  12. package/dist/_shared/runtime-O4KCSG4C.js +5 -5
  13. package/dist/_shared/{sdk-RRLVN7ER.js → sdk-IQMULKFU.js} +2962 -470
  14. package/dist/_shared/sdk-IQMULKFU.js.map +1 -0
  15. package/dist/_shared/session-data-AHTU7IS6.js +4 -4
  16. package/dist/_shared/session-manager-list-2BLEEZVG.js +1 -1
  17. package/dist/_shared/settings-startup-8-DNZ2RIHM.js +1 -1
  18. package/dist/_shared/{settings-startup-4QCVCI53.js → settings-startup-HXQLSUWM.js} +8 -2
  19. package/dist/_shared/settings-startup-HXQLSUWM.js.map +1 -0
  20. package/dist/_shared/{startup-0-0-4VG2G44V.js → startup-0-0-3IXNMFM2.js} +482 -53
  21. package/dist/_shared/startup-0-0-3IXNMFM2.js.map +1 -0
  22. package/dist/_shared/{startup-0-1-XTIL65D4.js → startup-0-1-7T2IAE7J.js} +121 -251
  23. package/dist/_shared/startup-0-1-7T2IAE7J.js.map +1 -0
  24. package/dist/_shared/{startup-0-2-27OWFHV6.js → startup-0-2-5QHPCEON.js} +293 -10
  25. package/dist/_shared/startup-0-2-5QHPCEON.js.map +1 -0
  26. package/dist/_shared/{startup-0-3-T4DVFYWX.js → startup-0-3-4ZYBYQNM.js} +273 -14
  27. package/dist/_shared/startup-0-3-4ZYBYQNM.js.map +1 -0
  28. package/dist/_shared/startup-0-4-ZMJV547D.js +6 -6
  29. package/dist/_shared/{startup-0-5-FD2P735I.js → startup-0-5-YDW47QX6.js} +29 -71
  30. package/dist/_shared/startup-0-5-YDW47QX6.js.map +1 -0
  31. package/dist/_shared/startup-10-0-TDQNBDDL.js +9 -9
  32. package/dist/_shared/startup-12-0-55AAXBJZ.js +4 -4
  33. package/dist/_shared/startup-14-0-MLX36RBG.js +6 -6
  34. package/dist/_shared/startup-15-0-YUKGAC63.js +34 -10
  35. package/dist/_shared/startup-15-0-YUKGAC63.js.map +1 -1
  36. package/dist/_shared/startup-15-1-4S7FLMNG.js +10 -9
  37. package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
  38. package/dist/_shared/startup-8-0-34CBHPZH.js +421 -84
  39. package/dist/_shared/startup-8-0-34CBHPZH.js.map +1 -1
  40. package/dist/_shared/{startup-8-1-4KANEHRA.js → startup-8-1-X32CYSXB.js} +1291 -722
  41. package/dist/_shared/startup-8-1-X32CYSXB.js.map +1 -0
  42. package/dist/_shared/storage-command-7MGXLJGZ.js +17 -9
  43. package/dist/_shared/storage-command-7MGXLJGZ.js.map +1 -1
  44. package/dist/_shared/task-reference-stream-JWMUZSJX.js +1 -1
  45. package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
  46. package/dist/_shared/tree-outline-MUEPK5B7.js +3 -3
  47. package/dist/builtin/intercom/CHANGELOG.md +29 -0
  48. package/dist/builtin/intercom/broker/broker.bundle.mjs +1138 -384
  49. package/dist/builtin/intercom/broker/database-wake-up-bus.ts +103 -24
  50. package/dist/builtin/intercom/broker/multinode-router.ts +42 -21
  51. package/dist/builtin/intercom/broker/multinode-state-store.ts +22 -1
  52. package/dist/builtin/intercom/broker/open-broker-state.ts +82 -31
  53. package/dist/builtin/intercom/broker/paths.ts +8 -4
  54. package/dist/builtin/intercom/broker/released-asker-remote-replies.ts +18 -6
  55. package/dist/builtin/intercom/broker/sql-add-column.ts +4 -1
  56. package/dist/builtin/intercom/broker/sql-ended-child-queue-store.ts +65 -44
  57. package/dist/builtin/intercom/broker/sql-held-send-store.ts +11 -3
  58. package/dist/builtin/intercom/broker/sql-known-session-store.ts +24 -12
  59. package/dist/builtin/intercom/broker/sql-lease-store.ts +386 -65
  60. package/dist/builtin/intercom/broker/sql-outbox-store.ts +462 -130
  61. package/dist/builtin/intercom/broker/sql-pending-ask-store.ts +20 -9
  62. package/dist/builtin/intercom/broker/sql-released-ask-store.ts +14 -6
  63. package/dist/builtin/intercom/broker/sql-restoring-reservation-store.ts +27 -11
  64. package/dist/builtin/intercom/broker/sql-schema.ts +198 -5
  65. package/dist/builtin/intercom/broker/sql-sent-message-authority.ts +97 -34
  66. package/dist/builtin/intercom/index.bundle.mjs +11 -8
  67. package/dist/builtin/intercom/package.json +1 -1
  68. package/dist/builtin/mcp/index.bundle.mjs +1 -1
  69. package/dist/builtin/mcp/package.json +1 -1
  70. package/dist/builtin/subagents/CHANGELOG.md +18 -0
  71. package/dist/builtin/subagents/package.json +1 -1
  72. package/dist/builtin/subagents/skills/skill-creator/SKILL.md +1 -1
  73. package/dist/builtin/subagents/src/extension/index.bundle.mjs +62 -23
  74. package/dist/builtin/web-access/index.bundle.mjs +1 -1
  75. package/dist/builtin/web-access/package.json +1 -1
  76. package/dist/cli/args.js +2 -2
  77. package/dist/cli/auth-cli.code.js +6 -6
  78. package/dist/cli/auth-cli.impl.js +3 -3
  79. package/dist/cli/auth-cli.js +3 -3
  80. package/dist/cli/blueprint-command.code.js +4 -4
  81. package/dist/cli/blueprint-command.impl.js +3 -3
  82. package/dist/cli/blueprint-command.js +3 -3
  83. package/dist/cli/intercom-command.code.js +3 -3
  84. package/dist/cli/intercom-command.impl.js +3 -3
  85. package/dist/cli/intercom-command.js +3 -3
  86. package/dist/cli/list-models.code.js +2 -2
  87. package/dist/cli/list-models.impl.js +3 -3
  88. package/dist/cli/list-models.js +3 -3
  89. package/dist/cli/session-picker.code.js +2 -2
  90. package/dist/cli/session-picker.impl.js +3 -3
  91. package/dist/cli/session-picker.js +3 -3
  92. package/dist/cli/startup-ui.code.js +2 -2
  93. package/dist/cli/startup-ui.impl.js +3 -3
  94. package/dist/cli/startup-ui.js +3 -3
  95. package/dist/cli/storage-command.impl.js +3 -3
  96. package/dist/cli/storage-command.js +3 -3
  97. package/dist/cli/storage-search-session.code.js +3 -3
  98. package/dist/cli/storage-search-session.impl.js +3 -3
  99. package/dist/cli/storage-search-session.js +3 -3
  100. package/dist/cli/team-command.code.js +3 -3
  101. package/dist/cli/team-command.impl.js +3 -3
  102. package/dist/cli/team-command.js +3 -3
  103. package/dist/cli.js +2 -2
  104. package/dist/core/agent-session-methods.d.ts +3 -0
  105. package/dist/core/agent-session-methods.js.map +1 -1
  106. package/dist/core/agent-session.d.ts +1 -0
  107. package/dist/core/compaction/compactor.d.ts +2 -0
  108. package/dist/core/debug.impl.js +3 -3
  109. package/dist/core/debug.js +3 -3
  110. package/dist/core/export-html/card-projection.code.js +1 -1
  111. package/dist/core/export-html/card-projection.impl.js +3 -3
  112. package/dist/core/export-html/card-projection.js +3 -3
  113. package/dist/core/export-html/index.code.js +2 -2
  114. package/dist/core/export-html/index.impl.js +3 -3
  115. package/dist/core/export-html/index.js +3 -3
  116. package/dist/core/export-html/json-spans.impl.js +3 -3
  117. package/dist/core/export-html/json-spans.js +3 -3
  118. package/dist/core/export-html/oversized-render-inputs.code.js +2 -2
  119. package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
  120. package/dist/core/export-html/oversized-render-inputs.js +3 -3
  121. package/dist/core/export-html/tool-renderer.impl.js +3 -3
  122. package/dist/core/export-html/tool-renderer.js +3 -3
  123. package/dist/core/extensions/jiti-loader.impl.js +3 -3
  124. package/dist/core/extensions/jiti-loader.js +3 -3
  125. package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
  126. package/dist/core/extensions/jiti-static-loader.js +3 -3
  127. package/dist/core/extensions/loader-host-modules.code.js +1 -1
  128. package/dist/core/extensions/loader-host-modules.impl.js +3 -3
  129. package/dist/core/extensions/loader-host-modules.js +3 -3
  130. package/dist/core/extensions/loader-virtual-modules.js +2 -2
  131. package/dist/core/extensions/runner-context.js +4 -4
  132. package/dist/core/extensions/runner-context.js.map +1 -1
  133. package/dist/core/intercom-broker-control-host.code.js +1 -1
  134. package/dist/core/intercom-broker-control-host.impl.js +3 -3
  135. package/dist/core/intercom-broker-control-host.js +3 -3
  136. package/dist/core/intercom-broker-control.code.js +3 -3
  137. package/dist/core/intercom-broker-control.impl.js +3 -3
  138. package/dist/core/intercom-broker-control.js +3 -3
  139. package/dist/core/model-registry.js +1 -1
  140. package/dist/core/model-resolver-defaults.d.ts +3 -2
  141. package/dist/core/package-manager-storage-adapters.code.js +1 -1
  142. package/dist/core/package-manager-storage-adapters.impl.js +3 -3
  143. package/dist/core/package-manager-storage-adapters.js +3 -3
  144. package/dist/core/sdk.code.js +4 -5
  145. package/dist/core/sdk.impl.js +3 -3
  146. package/dist/core/sdk.js +3 -3
  147. package/dist/core/session-manager-core.d.ts +5 -2
  148. package/dist/core/session-manager-core.js +39 -23
  149. package/dist/core/session-manager-core.js.map +1 -1
  150. package/dist/core/session-manager-list.impl.js +3 -3
  151. package/dist/core/session-manager-list.js +3 -3
  152. package/dist/core/session-manager.code.js +3 -3
  153. package/dist/core/session-manager.impl.js +3 -3
  154. package/dist/core/session-manager.js +3 -3
  155. package/dist/core/session-open-markers.js +3 -0
  156. package/dist/core/session-open-markers.js.map +1 -0
  157. package/dist/core/session-storage.code.js +1 -1
  158. package/dist/core/session-storage.impl.js +3 -3
  159. package/dist/core/session-storage.js +3 -3
  160. package/dist/core/storage/added-exports.d.ts +6 -0
  161. package/dist/core/storage/added-exports.js +19 -0
  162. package/dist/core/storage/added-exports.js.map +1 -0
  163. package/dist/core/storage/database.d.ts +53 -0
  164. package/dist/core/storage/database.js.map +1 -1
  165. package/dist/core/storage/fenced-paths.d.ts +47 -0
  166. package/dist/core/storage/fenced-paths.js +53 -0
  167. package/dist/core/storage/fenced-paths.js.map +1 -1
  168. package/dist/core/storage/file-identity.js +31 -2
  169. package/dist/core/storage/file-identity.js.map +1 -1
  170. package/dist/core/storage/index.d.ts +4 -1
  171. package/dist/core/storage/index.js +5 -2
  172. package/dist/core/storage/index.js.map +1 -1
  173. package/dist/core/storage/migrations.d.ts +33 -2
  174. package/dist/core/storage/migrations.js +73 -5
  175. package/dist/core/storage/migrations.js.map +1 -1
  176. package/dist/core/storage/node-sqlite-thread.js +48 -6
  177. package/dist/core/storage/node-sqlite-thread.js.map +1 -1
  178. package/dist/core/storage/node-sqlite.js +137 -4
  179. package/dist/core/storage/node-sqlite.js.map +1 -1
  180. package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
  181. package/dist/core/storage/offline-snapshot-file.js +3 -3
  182. package/dist/core/storage/prefix.d.ts +3 -2
  183. package/dist/core/storage/prefix.js +23 -2
  184. package/dist/core/storage/prefix.js.map +1 -1
  185. package/dist/core/storage/provider.js +2 -2
  186. package/dist/core/storage/schema-catalog.d.ts +120 -0
  187. package/dist/core/storage/schema-catalog.js +351 -0
  188. package/dist/core/storage/schema-catalog.js.map +1 -0
  189. package/dist/core/storage/selection.js +2 -2
  190. package/dist/core/storage/session/branch-fork-source.code.js +47 -25
  191. package/dist/core/storage/session/branch-fork-source.code.js.map +1 -1
  192. package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
  193. package/dist/core/storage/session/branch-fork-source.js +3 -3
  194. package/dist/core/storage/session/card-view.impl.js +3 -3
  195. package/dist/core/storage/session/card-view.js +3 -3
  196. package/dist/core/storage/session/child-reader.code.js +4 -4
  197. package/dist/core/storage/session/child-reader.impl.js +3 -3
  198. package/dist/core/storage/session/child-reader.js +3 -3
  199. package/dist/core/storage/session/chunked-resume-projection.code.js +1 -1
  200. package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
  201. package/dist/core/storage/session/chunked-resume-projection.js +3 -3
  202. package/dist/core/storage/session/errors.js +1 -1
  203. package/dist/core/storage/session/expanded-child-details.code.js +4 -4
  204. package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
  205. package/dist/core/storage/session/expanded-child-details.js +3 -3
  206. package/dist/core/storage/session/fork-detach.d.ts +118 -0
  207. package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
  208. package/dist/core/storage/session/fork-row-bytes.js +3 -3
  209. package/dist/core/storage/session/fork-row-index.impl.js +3 -3
  210. package/dist/core/storage/session/fork-row-index.js +3 -3
  211. package/dist/core/storage/session/fork-schema.js +53 -0
  212. package/dist/core/storage/session/fork-schema.js.map +1 -0
  213. package/dist/core/storage/session/fork-segments.d.ts +58 -0
  214. package/dist/core/storage/session/fork-staging.code.js +176 -36
  215. package/dist/core/storage/session/fork-staging.code.js.map +1 -1
  216. package/dist/core/storage/session/fork-staging.impl.js +3 -3
  217. package/dist/core/storage/session/fork-staging.js +3 -3
  218. package/dist/core/storage/session/fork-sweep.js +61 -0
  219. package/dist/core/storage/session/fork-sweep.js.map +1 -0
  220. package/dist/core/storage/session/fork-window.code.js +4 -4
  221. package/dist/core/storage/session/fork-window.impl.js +3 -3
  222. package/dist/core/storage/session/fork-window.js +3 -3
  223. package/dist/core/storage/session/history-pages.impl.js +3 -3
  224. package/dist/core/storage/session/history-pages.js +3 -3
  225. package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
  226. package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
  227. package/dist/core/storage/session/jsonl-session-store.d.ts +37 -1
  228. package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
  229. package/dist/core/storage/session/jsonl-session-store.js +3 -3
  230. package/dist/core/storage/session/memory-session-store.impl.js +3 -3
  231. package/dist/core/storage/session/memory-session-store.js +3 -3
  232. package/dist/core/storage/session/pinned-branch-resume.code.js +3 -3
  233. package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
  234. package/dist/core/storage/session/pinned-branch-resume.js +3 -3
  235. package/dist/core/storage/session/released-history-files.code.js +3 -3
  236. package/dist/core/storage/session/released-history-files.impl.js +3 -3
  237. package/dist/core/storage/session/released-history-files.js +3 -3
  238. package/dist/core/storage/session/resident-fork-rows.code.js +1 -1
  239. package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
  240. package/dist/core/storage/session/resident-fork-rows.js +3 -3
  241. package/dist/core/storage/session/session-resume.impl.js +3 -3
  242. package/dist/core/storage/session/session-resume.js +3 -3
  243. package/dist/core/storage/session/session-search-index.d.ts +5 -0
  244. package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
  245. package/dist/core/storage/session/snapshot-cut.js +3 -3
  246. package/dist/core/storage/session/snapshot-history.code.js +4 -4
  247. package/dist/core/storage/session/snapshot-history.impl.js +3 -3
  248. package/dist/core/storage/session/snapshot-history.js +3 -3
  249. package/dist/core/storage/session/sql-chat-records.d.ts +15 -0
  250. package/dist/core/storage/session/sql-session-store.code.js +1 -1
  251. package/dist/core/storage/session/sql-session-store.d.ts +445 -11
  252. package/dist/core/storage/session/sql-session-store.impl.js +4 -4
  253. package/dist/core/storage/session/sql-session-store.js +4 -4
  254. package/dist/core/storage/session/tree-outline.impl.js +3 -3
  255. package/dist/core/storage/session/tree-outline.js +3 -3
  256. package/dist/core/storage/session/tree-presentation.code.js +1 -1
  257. package/dist/core/storage/session/tree-presentation.impl.js +3 -3
  258. package/dist/core/storage/session/tree-presentation.js +3 -3
  259. package/dist/core/storage/session/types.d.ts +36 -0
  260. package/dist/core/storage/sqlite-facade.d.ts +54 -6
  261. package/dist/core/storage/sqlite-facade.js +384 -18
  262. package/dist/core/storage/sqlite-facade.js.map +1 -1
  263. package/dist/core/storage/statement-sequence.d.ts +83 -0
  264. package/dist/core/storage/statement-sequence.js +21 -0
  265. package/dist/core/storage/statement-sequence.js.map +1 -1
  266. package/dist/core/storage/storage-status.code.js +1 -1
  267. package/dist/core/storage/storage-status.impl.js +3 -3
  268. package/dist/core/storage/storage-status.js +3 -3
  269. package/dist/core/storage/team.code.js +1 -1
  270. package/dist/core/storage/team.impl.js +3 -3
  271. package/dist/core/storage/team.js +3 -3
  272. package/dist/core/structured-output/index.code.js +1 -1
  273. package/dist/core/structured-output/index.impl.js +3 -3
  274. package/dist/core/structured-output/index.js +3 -3
  275. package/dist/core/tasks/task-completion-entry.code.js +1 -1
  276. package/dist/core/tasks/task-completion-entry.impl.js +3 -3
  277. package/dist/core/tasks/task-completion-entry.js +3 -3
  278. package/dist/core/tasks/task-file-history.code.js +4 -4
  279. package/dist/core/tasks/task-file-history.impl.js +3 -3
  280. package/dist/core/tasks/task-file-history.js +3 -3
  281. package/dist/core/tasks/task-reference-archive.code.js +5 -5
  282. package/dist/core/tasks/task-reference-archive.js +3 -3
  283. package/dist/core/tasks/task-reference-identity.js +3 -3
  284. package/dist/core/tasks/task-reference-stream.impl.js +3 -3
  285. package/dist/core/tasks/task-reference-stream.js +3 -3
  286. package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
  287. package/dist/core/tasks/task-unsaved-answer.js +3 -3
  288. package/dist/core/tasks/task-view-source.code.js +1 -1
  289. package/dist/core/tasks/task-view-source.impl.js +3 -3
  290. package/dist/core/tasks/task-view-source.js +3 -3
  291. package/dist/core/tools/bash.d.ts +8 -4
  292. package/dist/core/tools/history-session.d.ts +7 -0
  293. package/dist/core/tools/history-tasks.d.ts +123 -0
  294. package/dist/core/tools/kill.d.ts +5 -2
  295. package/dist/core/tools/powershell.d.ts +2 -2
  296. package/dist/core/tools/read-url.code.js +3 -3
  297. package/dist/core/tools/read-url.impl.js +3 -3
  298. package/dist/core/tools/read-url.js +3 -3
  299. package/dist/core/tools/read.d.ts +12 -2
  300. package/dist/core/tools/resource-selectors.d.ts +2 -0
  301. package/dist/core/tools/search.d.ts +12 -2
  302. package/dist/core/worktree-snapshot/blob-store.d.ts +45 -2
  303. package/dist/core/worktree-snapshot/blob-store.js +228 -60
  304. package/dist/core/worktree-snapshot/blob-store.js.map +1 -1
  305. package/dist/core/worktree-snapshot/errors.code.js +3 -3
  306. package/dist/core/worktree-snapshot/errors.impl.js +3 -3
  307. package/dist/core/worktree-snapshot/errors.js +3 -3
  308. package/dist/core/worktree-snapshot/fork-snapshot-index.js +121 -0
  309. package/dist/core/worktree-snapshot/fork-snapshot-index.js.map +1 -0
  310. package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
  311. package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
  312. package/dist/extensions/codemode/execute.code.js +3 -3
  313. package/dist/extensions/codemode/execute.impl.js +3 -3
  314. package/dist/extensions/codemode/execute.js +3 -3
  315. package/dist/extensions/codemode/renderer.code.js +2 -2
  316. package/dist/extensions/codemode/renderer.impl.js +3 -3
  317. package/dist/extensions/codemode/renderer.js +3 -3
  318. package/dist/extensions/mcp/cli.code.js +3 -3
  319. package/dist/extensions/mcp/cli.impl.js +3 -3
  320. package/dist/extensions/mcp/cli.js +3 -3
  321. package/dist/extensions/mcp/cli.lazy.code.js +2 -2
  322. package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
  323. package/dist/extensions/mcp/cli.lazy.js +3 -3
  324. package/dist/extensions/mcp/runtime.code.js +1 -1
  325. package/dist/extensions/mcp/runtime.impl.js +3 -3
  326. package/dist/extensions/mcp/runtime.js +3 -3
  327. package/dist/index.js +8 -8
  328. package/dist/main-first-time-setup.code.js +2 -2
  329. package/dist/main-first-time-setup.impl.js +3 -3
  330. package/dist/main-first-time-setup.js +3 -3
  331. package/dist/main.js +1 -1
  332. package/dist/modes/interactive/components/agent-panel.d.ts +1 -0
  333. package/dist/modes/interactive/components/stored-tree-view.code.js +3 -3
  334. package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
  335. package/dist/modes/interactive/components/stored-tree-view.js +3 -3
  336. package/dist/modes/interactive/components/task-inspector.d.ts +2 -0
  337. package/dist/modes/interactive/components/user-message-selector-archive.code.js +1 -1
  338. package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
  339. package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
  340. package/dist/modes/interactive/interactive-mode-helpers.d.ts +2 -2
  341. package/dist/modes/print-mode.js +1 -1
  342. package/dist/modes/rpc/agent-panel-bridge.d.ts +5 -0
  343. package/dist/package-manager-cli.code.js +7 -7
  344. package/dist/package-manager-cli.impl.js +3 -3
  345. package/dist/package-manager-cli.js +3 -3
  346. package/dist/rpc-entry.js +1 -1
  347. package/dist/startup-files.json +1 -1
  348. package/dist/startup-stages/0.js +1 -1
  349. package/dist/startup-stages/1.js +1 -1
  350. package/dist/startup-stages/10.js +1 -1
  351. package/dist/startup-stages/12.js +1 -1
  352. package/dist/startup-stages/2.js +9 -1
  353. package/dist/startup-stages/3.js +1 -6
  354. package/dist/startup-stages/5.js +1 -1
  355. package/dist/startup-stages/7.js +1 -1
  356. package/dist/startup-stages/8.js +2 -2
  357. package/dist/utils/startup-database-spare.code.js +3 -3
  358. package/dist/utils/startup-database-spare.impl.js +3 -3
  359. package/dist/utils/startup-database-spare.js +3 -3
  360. package/dist/utils/tools-manager.code.js +1 -1
  361. package/dist/utils/tools-manager.impl.js +3 -3
  362. package/dist/utils/tools-manager.js +3 -3
  363. package/docs/background-tasks.md +123 -23
  364. package/docs/compaction.md +18 -0
  365. package/docs/docs.json +2 -0
  366. package/docs/environment-variables.md +1 -1
  367. package/docs/getting-started/installation.md +9 -2
  368. package/docs/guides/postgres-pgbouncer.md +346 -0
  369. package/docs/guides/postgres-tuning.md +311 -0
  370. package/docs/guides/resume-on-any-machine.md +2 -2
  371. package/docs/guides.md +2 -0
  372. package/docs/index.md +1 -1
  373. package/docs/libraries/agent-core.md +1 -1
  374. package/docs/libraries/ai.md +2 -2
  375. package/docs/libraries/codemode.md +1 -1
  376. package/docs/libraries/storage-libsql.md +6 -1
  377. package/docs/libraries/storage-postgres.md +11 -6
  378. package/docs/libraries/tui.md +1 -1
  379. package/docs/libraries.md +2 -2
  380. package/docs/programmatic.md +1 -1
  381. package/docs/quickstart.md +1 -1
  382. package/docs/sdk/storage.md +1 -1
  383. package/docs/sdk/web-server.md +1 -3
  384. package/docs/sdk.md +1 -7
  385. package/docs/sessions.md +67 -2
  386. package/docs/settings.md +20 -1
  387. package/docs/skills/authoring.md +1 -1
  388. package/docs/skills.md +79 -6
  389. package/docs/storage.md +305 -14
  390. package/docs/subagents/reference.md +2 -2
  391. package/docs/subagents.md +4 -3
  392. package/docs/tools.md +44 -10
  393. package/docs/windows.md +1 -1
  394. package/package.json +9 -9
  395. package/dist/_shared/sdk-RRLVN7ER.js.map +0 -1
  396. package/dist/_shared/settings-startup-4QCVCI53.js.map +0 -1
  397. package/dist/_shared/startup-0-0-4VG2G44V.js.map +0 -1
  398. package/dist/_shared/startup-0-1-XTIL65D4.js.map +0 -1
  399. package/dist/_shared/startup-0-2-27OWFHV6.js.map +0 -1
  400. package/dist/_shared/startup-0-3-T4DVFYWX.js.map +0 -1
  401. package/dist/_shared/startup-0-5-FD2P735I.js.map +0 -1
  402. package/dist/_shared/startup-8-1-4KANEHRA.js.map +0 -1
@@ -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.10`;
9
+ const key = `${root.href}#0.10.11-alpha.2`;
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.10") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.10 while this session was running; restart it to keep using session storage.", {
30
+ if (running === undefined || running.version === "0.10.11-alpha.2") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.2 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.10`;
9
+ const key = `${root.href}#0.10.11-alpha.2`;
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.10") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.10 while this session was running; restart it to keep using session storage.", {
30
+ if (running === undefined || running.version === "0.10.11-alpha.2") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.2 while this session was running; restart it to keep using session storage.", {
32
32
  cause: error,
33
33
  });
34
34
  }
@@ -1,9 +1,9 @@
1
1
  import "../../../_shared/rolldown-runtime-BGM3D5V3.js";
2
- import { ChildCatalog } from "../../../_shared/startup-0-1-XTIL65D4.js";
2
+ import { ChildCatalog } from "../../../_shared/startup-0-1-7T2IAE7J.js";
3
3
  import { SessionConflictError } from "./errors.js";
4
4
  import { historyChunks, historyPages, readSessionRange } from "../../../_shared/startup-8-0-34CBHPZH.js";
5
5
  import { treeOutlinePages } from "../../../_shared/tree-outline-MUEPK5B7.js";
6
- import "../../../_shared/settings-startup-4QCVCI53.js";
6
+ import "../../../_shared/settings-startup-HXQLSUWM.js";
7
7
  // dist/core/storage/session/child-reader.js
8
8
  async function* headings(store, id, epoch, through, seqs, signal) {
9
9
  for (let at = 0; at < seqs.length;) {
@@ -99,7 +99,7 @@ function __atomicOnDemandFailed(error, feature) {
99
99
  return (async () => {
100
100
  const root = new URL("../../../", import.meta.url);
101
101
  const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
102
- const key = `${root.href}#0.10.10`;
102
+ const key = `${root.href}#0.10.11-alpha.2`;
103
103
  let release = releases.get(key);
104
104
  if (release === undefined) {
105
105
  const current = (async () => {
@@ -127,7 +127,7 @@ function __atomicOnDemandFailed(error, feature) {
127
127
  } catch {
128
128
  // No installation to read, as in a bundle of the package: the release the process runs decides.
129
129
  }
130
- const updatedTo = typeof installed === "string" && installed !== "0.10.10" ? installed : running !== undefined && running.version !== "0.10.10" ? "0.10.10" : undefined;
130
+ const updatedTo = typeof installed === "string" && installed !== "0.10.11-alpha.2" ? installed : running !== undefined && running.version !== "0.10.11-alpha.2" ? "0.10.11-alpha.2" : undefined;
131
131
  if (updatedTo === undefined) throw error;
132
132
  const application = typeof running?.name === "string" ? running.name : "atomic";
133
133
  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.10`;
9
+ const key = `${root.href}#0.10.11-alpha.2`;
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.10") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.10 while this session was running; restart it to keep using session storage.", {
30
+ if (running === undefined || running.version === "0.10.11-alpha.2") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.2 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.10`;
9
+ const key = `${root.href}#0.10.11-alpha.2`;
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.10") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.10 while this session was running; restart it to keep using session storage.", {
30
+ if (running === undefined || running.version === "0.10.11-alpha.2") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.2 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 { chunkedAnswerContent, chunkedAnswerHeader, chunkedBranchState, chunkedChildHeading, chunkedEntryHasId, chunkedForkLink, chunkedPrefixFields, chunkedResumeProjection, chunkedTaskDetailFields, chunkedTreeOutline, forkSeedFields, messageHeadIn, messageRoleIn, projectForkMetadata, read, readChunkedWorkflowRunId, readValue, skip, stringValue } from "../../../_shared/startup-0-5-FD2P735I.js";
2
+ export { chunkedAnswerContent, chunkedAnswerHeader, chunkedBranchState, chunkedChildHeading, chunkedEntryHasId, chunkedForkLink, chunkedPrefixFields, chunkedResumeProjection, chunkedTaskDetailFields, chunkedTreeOutline, forkSeedFields, messageHeadIn, messageRoleIn, projectForkMetadata, read, readChunkedWorkflowRunId, readValue, skip, stringValue } from "../../../_shared/startup-0-5-YDW47QX6.js";
3
3
  //# sourceMappingURL=chunked-resume-projection.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.10`;
9
+ const key = `${root.href}#0.10.11-alpha.2`;
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.10") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.10 while this session was running; restart it to keep using session storage.", {
30
+ if (running === undefined || running.version === "0.10.11-alpha.2") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.2 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.10`;
9
+ const key = `${root.href}#0.10.11-alpha.2`;
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.10") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.10 while this session was running; restart it to keep using session storage.", {
30
+ if (running === undefined || running.version === "0.10.11-alpha.2") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.2 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 "../../../_shared/settings-startup-4QCVCI53.js";
2
+ import "../../../_shared/settings-startup-HXQLSUWM.js";
3
3
  // dist/core/storage/session/errors.js
4
4
  var SessionFormatVersionError = class extends Error {
5
5
  path;
@@ -1,8 +1,8 @@
1
1
  import { __name } from "../../../_shared/rolldown-runtime-BGM3D5V3.js";
2
- import { read, skip, stringValue } from "../../../_shared/startup-0-5-FD2P735I.js";
2
+ import { read, skip, stringValue } from "../../../_shared/startup-0-5-YDW47QX6.js";
3
3
  import { SessionConflictError } from "./errors.js";
4
4
  import { historyChunks } from "../../../_shared/startup-8-0-34CBHPZH.js";
5
- import { SESSION_HISTORY_CHUNK_BYTES, yieldSessionTurn } from "../../../_shared/settings-startup-4QCVCI53.js";
5
+ import { SESSION_HISTORY_CHUNK_BYTES, yieldSessionTurn } from "../../../_shared/settings-startup-HXQLSUWM.js";
6
6
  // dist/core/storage/session/card-message-projection.js
7
7
  function* object(first, fields) {
8
8
  if (first.name !== "startObject") {
@@ -643,7 +643,7 @@ function __atomicOnDemandFailed(error, feature) {
643
643
  return (async () => {
644
644
  const root = new URL("../../../", import.meta.url);
645
645
  const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
646
- const key = `${root.href}#0.10.10`;
646
+ const key = `${root.href}#0.10.11-alpha.2`;
647
647
  let release = releases.get(key);
648
648
  if (release === undefined) {
649
649
  const current = (async () => {
@@ -671,7 +671,7 @@ function __atomicOnDemandFailed(error, feature) {
671
671
  } catch {
672
672
  // No installation to read, as in a bundle of the package: the release the process runs decides.
673
673
  }
674
- const updatedTo = typeof installed === "string" && installed !== "0.10.10" ? installed : running !== undefined && running.version !== "0.10.10" ? "0.10.10" : undefined;
674
+ const updatedTo = typeof installed === "string" && installed !== "0.10.11-alpha.2" ? installed : running !== undefined && running.version !== "0.10.11-alpha.2" ? "0.10.11-alpha.2" : undefined;
675
675
  if (updatedTo === undefined) throw error;
676
676
  const application = typeof running?.name === "string" ? running.name : "atomic";
677
677
  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.10`;
9
+ const key = `${root.href}#0.10.11-alpha.2`;
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.10") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.10 while this session was running; restart it to keep using session storage.", {
30
+ if (running === undefined || running.version === "0.10.11-alpha.2") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.2 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.10`;
9
+ const key = `${root.href}#0.10.11-alpha.2`;
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.10") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.10 while this session was running; restart it to keep using session storage.", {
30
+ if (running === undefined || running.version === "0.10.11-alpha.2") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.2 while this session was running; restart it to keep using session storage.", {
32
32
  cause: error,
33
33
  });
34
34
  }
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Detaching lazy forks from a session (Neon's detach_ancestor). A fork in a SQL store reads the rows it inherited
3
+ * through segments that point at the sessions owning them, which keep those rows while any segment points at them. To
4
+ * really delete or rewrite such a session, every fork still pointing at it first gets its own copy of those rows:
5
+ *
6
+ * 1. Block: the segments pin the parent's rows, and a progress row records the detach and the child's original map.
7
+ * 2. Copy: a page of the parent's rows moves into the child at the global seqs the segment gave them, and in the same
8
+ * transaction the segment shrinks past them, so every seq is covered by a segment or by a row of the child's own,
9
+ * never both, and the child reads the same at every commit.
10
+ * 3. Publish: each page commits; the segments are the progress, so a crash resumes with the segments that remain.
11
+ * 4-6. The last page also removes the child's last segment on the parent, re-points at the child's copy each other
12
+ * fork of the parent that reads only rows the child's prefix holds (its cut-off at or below the child's), and
13
+ * removes the progress row, in one transaction.
14
+ *
15
+ * A detach locks the sessions whose segments it changes for update, in ID order, and never the parent. The store's
16
+ * delete and replace lock a session for update before they list the references to it, and a fork locks every session
17
+ * its segments name for key share, so neither misses a reference another transaction is adding. Re-pointing a fork at
18
+ * the child adds a reference to the child, which the detach already holds for update. Locking the parent instead
19
+ * would deadlock against the parent's replace, which holds the parent's row while it waits for its forks' rows.
20
+ */
21
+ import type { SqliteExecutor } from "../database.js";
22
+ import { type ForkSegment } from "./fork-segments.js";
23
+ export declare function setForkCopyRefusalNote(note: (fields: Readonly<Record<string, string | number>>) => void): void;
24
+ /** Notes `error` once when it is a refused copy of shared rows; resolves nothing and never throws. */
25
+ export declare function noteForkCopyRefusal(error: unknown, operation: string): void;
26
+ /** Rows a detach copies in one transaction, which bounds how long it holds the write lock. */
27
+ export declare const FORK_DETACH_PAGE_ROWS = 2000;
28
+ /** The tables a session's stored rows are in, and the tombstones of deleted sessions forks still read. */
29
+ export interface ForkPinTables {
30
+ readonly entries: string;
31
+ readonly entryChunks: string;
32
+ readonly searchTexts: string;
33
+ readonly blobs: string;
34
+ readonly blobChunks: string;
35
+ readonly tombstones: string;
36
+ readonly forkSegments: string;
37
+ readonly forkLineage: string;
38
+ }
39
+ /** What a SQL session store gives detach: its fork segments, and transactions to change them in. */
40
+ export interface ForkDetachHost {
41
+ readonly pinTables: ForkPinTables;
42
+ /** `<prefix>session_fork_detach`, created with the other fork tables: detaches in progress. */
43
+ readonly forkDetachTable: string;
44
+ /** Runs `body` in one write transaction of the store. */
45
+ forkTransaction<T>(body: (tx: SqliteExecutor) => Promise<T>): Promise<T>;
46
+ /** The session's segments, ordered by `baseSeq`. */
47
+ forkSegments(tx: SqliteExecutor, sessionId: string): Promise<readonly ForkSegment[]>;
48
+ /** The sessions with a segment pointing at `sourceId`, ordered by ID. */
49
+ forkChildren(tx: SqliteExecutor, sourceId: string): Promise<readonly string[]>;
50
+ /**
51
+ * Copies the rows `pieces` map, in seq order with their chunks, search texts and blobs, into the child at the seqs of
52
+ * its view they cover, then removes them from the child's segments. Each piece lies within one of the child's
53
+ * segments, so the child's view is the same before and after.
54
+ */
55
+ materializeForkSegments(tx: SqliteExecutor, childId: string, pieces: readonly ForkSegment[]): Promise<void>;
56
+ /** Replaces the session's segments with `segments`, and moves its fork generation on. */
57
+ writeForkSegments(tx: SqliteExecutor, sessionId: string, segments: readonly ForkSegment[]): Promise<void>;
58
+ /**
59
+ * Locks the sessions `ids` in ID order: `key-share` to add a reference to them (which leaves their appends free),
60
+ * `update` to drop one they hold or to delete them.
61
+ */
62
+ lockForkSources(tx: SqliteExecutor, ids: readonly string[], mode: "key-share" | "update"): Promise<void>;
63
+ /** The clause that locks the rows a read selects, for update or for key share; none where writers run one at a time. */
64
+ lockClause(mode: "key-share" | "update"): string;
65
+ /** The session's rewrite epoch, which a replace or a truncation changes and an append does not. */
66
+ forkRewriteEpoch(tx: SqliteExecutor, sessionId: string): Promise<string | undefined>;
67
+ }
68
+ export interface ForkDetachOptions {
69
+ /** Re-point the parent's other forks at the child's copy of the rows it holds. Default true. */
70
+ readonly reparent?: boolean;
71
+ /** Rows copied a transaction. Default {@link FORK_DETACH_PAGE_ROWS}. */
72
+ readonly pageRows?: number;
73
+ }
74
+ export interface ForkDetachReport {
75
+ /** Forks that copied the parent's rows they read. */
76
+ readonly detached: readonly string[];
77
+ /** Forks re-pointed at a detached fork's copy instead. */
78
+ readonly reparented: readonly string[];
79
+ }
80
+ interface DetachProgress {
81
+ readonly reparent: boolean;
82
+ /** The child's segments on the parent when the detach started: where its copy of each parent row is. */
83
+ readonly original: readonly ForkSegment[];
84
+ /**
85
+ * The parent's and the child's rewrite epochs when the detach started. `original` describes the child's rows only
86
+ * while neither was rewritten: a rewritten parent's seq is another row, a rewritten child's row is another row.
87
+ */
88
+ readonly epochs: readonly [string | undefined, string | undefined];
89
+ }
90
+ /** The forks whose segments name `sessionId`, after locking it for update. */
91
+ export declare function lockedReferrers(host: ForkDetachHost, tx: SqliteExecutor, sessionId: string): Promise<readonly string[]>;
92
+ /** Removes the rows a session stores and its tombstone: nothing names them, and the session is gone or replaced. */
93
+ export declare function removeStoredRows(host: ForkDetachHost, tx: SqliteExecutor, sessionId: string): Promise<void>;
94
+ export declare function isTombstoned(host: ForkDetachHost, tx: SqliteExecutor, sessionId: string): Promise<boolean>;
95
+ /**
96
+ * Within `tx`, copies every row of `parentId` the child reads into the child and removes its segments on the parent,
97
+ * as a caller about to rewrite the parent in the same transaction needs. With `reparent`, the parent's other forks are
98
+ * re-pointed at the child's copy when it holds every row they read of the parent at the same seqs. `started` is how a detach a page at a time found
99
+ * the child when it started; its map of the child's rows holds only while neither session was rewritten since, so
100
+ * a rewrite of either skips the re-pointing, and the other forks keep reading the parent. Resolves with the forks
101
+ * re-pointed.
102
+ */
103
+ export declare function detachForkWithin(host: ForkDetachHost, tx: SqliteExecutor, parentId: string, childId: string, reparent: boolean, started?: Pick<DetachProgress, "original" | "epochs">): Promise<string[]>;
104
+ /**
105
+ * Detaches `childId` from `parentId` a page at a time, each page its own transaction; see the module comment. A detach
106
+ * a crash stopped resumes where it stopped when it runs again, with the options it started with.
107
+ */
108
+ export declare function detachFork(host: ForkDetachHost, parentId: string, childId: string, options?: ForkDetachOptions): Promise<ForkDetachReport>;
109
+ /**
110
+ * Detaches every fork still pointing at `parentId`, so the parent's rows can go: first the fork that holds most of the
111
+ * parent's rows, re-pointing the others at its copy when it holds all they read, then any fork that still reads
112
+ * rows only the parent has. Detaches a crash stopped are finished first.
113
+ */
114
+ export declare function detachForkChildren(host: ForkDetachHost, parentId: string, options?: ForkDetachOptions): Promise<ForkDetachReport>;
115
+ /** Finishes every detach a crash stopped, as each started. */
116
+ export declare function resumeForkDetaches(host: ForkDetachHost): Promise<ForkDetachReport>;
117
+ export {};
118
+ //# sourceMappingURL=fork-detach.d.ts.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.10`;
9
+ const key = `${root.href}#0.10.11-alpha.2`;
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.10") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.10 while this session was running; restart it to keep using session storage.", {
30
+ if (running === undefined || running.version === "0.10.11-alpha.2") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.2 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.10`;
9
+ const key = `${root.href}#0.10.11-alpha.2`;
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.10") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.10 while this session was running; restart it to keep using session storage.", {
30
+ if (running === undefined || running.version === "0.10.11-alpha.2") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.2 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.10`;
9
+ const key = `${root.href}#0.10.11-alpha.2`;
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.10") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.10 while this session was running; restart it to keep using session storage.", {
30
+ if (running === undefined || running.version === "0.10.11-alpha.2") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.2 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.10`;
9
+ const key = `${root.href}#0.10.11-alpha.2`;
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.10") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.10 while this session was running; restart it to keep using session storage.", {
30
+ if (running === undefined || running.version === "0.10.11-alpha.2") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.2 while this session was running; restart it to keep using session storage.", {
32
32
  cause: error,
33
33
  });
34
34
  }
@@ -0,0 +1,53 @@
1
+ import { renderStorageIdentifiers } from "../prefix.js";
2
+ /**
3
+ * The tables of forks that share their parent's history instead of copying it (#6560): `<prefix>session_fork_segments`,
4
+ * which maps a fork's inherited seqs onto the rows its sources store, and `<prefix>session_fork_lineage`, one row per
5
+ * such fork; `<prefix>session_fork_tombstones`, one row per deleted session whose rows forks still read, which those
6
+ * forks and the sweep that removes the rows lock; and `<prefix>session_fork_detach`, the progress of a fork copying
7
+ * the rows it read from a source into its own. They exist only in a store whose sessions schema was raised to version 3
8
+ * by the switch a store's open or `atomic storage migrate` makes once no older build runs a session there, in the same
9
+ * transaction; a store that was not switched keeps only the tables every older build reads.
10
+ */
11
+ export const SESSION_FORK_TABLES = Object.freeze({
12
+ forkSegments: "fork_segments",
13
+ forkLineage: "fork_lineage",
14
+ forkTombstones: "fork_tombstones",
15
+ forkDetach: "fork_detach",
16
+ });
17
+ /** The fork tables under `prefix`. */
18
+ export function sessionForkTables(prefix) {
19
+ return renderStorageIdentifiers("sessions", SESSION_FORK_TABLES, prefix);
20
+ }
21
+ /**
22
+ * The statements that create the fork tables, idempotently: in the transaction that raises the sessions schema to the
23
+ * version that turns shared-history forks on, or in the one that creates a new database's sessions schema at that
24
+ * version. `generation` is a token that changes with every change to a fork's segments and never repeats for an id, so
25
+ * a reader's cached segments are keyed by it.
26
+ */
27
+ export function sharedHistoryTablesScript(dialect, tables) {
28
+ const { int, text } = dialect.types;
29
+ return `
30
+ CREATE TABLE IF NOT EXISTS ${tables.forkSegments} (
31
+ session_id ${text} NOT NULL, idx ${int} NOT NULL, source_id ${text} NOT NULL,
32
+ from_seq ${int} NOT NULL, to_seq ${int} NOT NULL, base_seq ${int} NOT NULL,
33
+ PRIMARY KEY(session_id, idx)
34
+ )${dialect.tableOptions};
35
+ CREATE INDEX IF NOT EXISTS ${tables.forkSegments}_source ON ${tables.forkSegments} (source_id);
36
+ CREATE TABLE IF NOT EXISTS ${tables.forkLineage} (
37
+ session_id ${text} NOT NULL PRIMARY KEY, parent_id ${text}, cut_seq ${int}, generation ${text} NOT NULL
38
+ )${dialect.tableOptions};
39
+ CREATE TABLE IF NOT EXISTS ${tables.forkTombstones} (
40
+ session_id ${text} NOT NULL PRIMARY KEY, deleted_at ${text} NOT NULL
41
+ )${dialect.tableOptions};
42
+ CREATE TABLE IF NOT EXISTS ${tables.forkDetach} (
43
+ parent_id ${text} NOT NULL, child_id ${text} NOT NULL, reparent ${int} NOT NULL,
44
+ original_segments ${text} NOT NULL, parent_epoch ${text}, child_epoch ${text},
45
+ PRIMARY KEY(parent_id, child_id)
46
+ )${dialect.tableOptions};
47
+ `;
48
+ }
49
+ /** Creates the fork tables in `tx`: see {@link sharedHistoryTablesScript}. */
50
+ export async function createSharedHistoryTables(tx, dialect, tables) {
51
+ await tx.exec(sharedHistoryTablesScript(dialect, tables));
52
+ }
53
+ //# sourceMappingURL=fork-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fork-schema.js","sourceRoot":"","sources":["../../../../src/core/storage/session/fork-schema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAExD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC;IAChD,YAAY,EAAE,eAAe;IAC7B,WAAW,EAAE,cAAc;IAC3B,cAAc,EAAE,iBAAiB;IACjC,UAAU,EAAE,aAAa;CACzB,CAAC,CAAC;AAIH,sCAAsC;AACtC,MAAM,UAAU,iBAAiB,CAAC,MAAe;IAChD,OAAO,wBAAwB,CAAC,UAAU,EAAE,mBAAmB,EAAE,MAAM,CAAC,CAAC;AAC1E,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAAuB,EAAE,MAAyB;IAC3F,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC;IACpC,OAAO;+BACuB,MAAM,CAAC,YAAY;gBAClC,IAAI,kBAAkB,GAAG,wBAAwB,IAAI;cACvD,GAAG,qBAAqB,GAAG,uBAAuB,GAAG;;KAE9D,OAAO,CAAC,YAAY;+BACM,MAAM,CAAC,YAAY,cAAc,MAAM,CAAC,YAAY;+BACpD,MAAM,CAAC,WAAW;gBACjC,IAAI,oCAAoC,IAAI,aAAa,GAAG,gBAAgB,IAAI;KAC3F,OAAO,CAAC,YAAY;+BACM,MAAM,CAAC,cAAc;gBACpC,IAAI,qCAAqC,IAAI;KACxD,OAAO,CAAC,YAAY;+BACM,MAAM,CAAC,UAAU;eACjC,IAAI,uBAAuB,IAAI,uBAAuB,GAAG;uBACjD,IAAI,2BAA2B,IAAI,iBAAiB,IAAI;;KAE1E,OAAO,CAAC,YAAY;EACvB,CAAC;AACH,CAAC;AAED,8EAA8E;AAC9E,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC9C,EAAkB,EAClB,OAAuB,EACvB,MAAyB;IAEzB,MAAM,EAAE,CAAC,IAAI,CAAC,yBAAyB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AAC3D,CAAC","sourcesContent":["import type { SqliteExecutor } from \"../database.js\";\nimport type { StorageDialect } from \"../dialect.js\";\nimport { renderStorageIdentifiers } from \"../prefix.js\";\n\n/**\n * The tables of forks that share their parent's history instead of copying it (#6560): `<prefix>session_fork_segments`,\n * which maps a fork's inherited seqs onto the rows its sources store, and `<prefix>session_fork_lineage`, one row per\n * such fork; `<prefix>session_fork_tombstones`, one row per deleted session whose rows forks still read, which those\n * forks and the sweep that removes the rows lock; and `<prefix>session_fork_detach`, the progress of a fork copying\n * the rows it read from a source into its own. They exist only in a store whose sessions schema was raised to version 3\n * by the switch a store's open or `atomic storage migrate` makes once no older build runs a session there, in the same\n * transaction; a store that was not switched keeps only the tables every older build reads.\n */\nexport const SESSION_FORK_TABLES = Object.freeze({\n\tforkSegments: \"fork_segments\",\n\tforkLineage: \"fork_lineage\",\n\tforkTombstones: \"fork_tombstones\",\n\tforkDetach: \"fork_detach\",\n});\n\nexport type SessionForkTables = Readonly<Record<keyof typeof SESSION_FORK_TABLES, string>>;\n\n/** The fork tables under `prefix`. */\nexport function sessionForkTables(prefix?: string): SessionForkTables {\n\treturn renderStorageIdentifiers(\"sessions\", SESSION_FORK_TABLES, prefix);\n}\n\n/**\n * The statements that create the fork tables, idempotently: in the transaction that raises the sessions schema to the\n * version that turns shared-history forks on, or in the one that creates a new database's sessions schema at that\n * version. `generation` is a token that changes with every change to a fork's segments and never repeats for an id, so\n * a reader's cached segments are keyed by it.\n */\nexport function sharedHistoryTablesScript(dialect: StorageDialect, tables: SessionForkTables): string {\n\tconst { int, text } = dialect.types;\n\treturn `\n\t\tCREATE TABLE IF NOT EXISTS ${tables.forkSegments} (\n\t\t\tsession_id ${text} NOT NULL, idx ${int} NOT NULL, source_id ${text} NOT NULL,\n\t\t\tfrom_seq ${int} NOT NULL, to_seq ${int} NOT NULL, base_seq ${int} NOT NULL,\n\t\t\tPRIMARY KEY(session_id, idx)\n\t\t)${dialect.tableOptions};\n\t\tCREATE INDEX IF NOT EXISTS ${tables.forkSegments}_source ON ${tables.forkSegments} (source_id);\n\t\tCREATE TABLE IF NOT EXISTS ${tables.forkLineage} (\n\t\t\tsession_id ${text} NOT NULL PRIMARY KEY, parent_id ${text}, cut_seq ${int}, generation ${text} NOT NULL\n\t\t)${dialect.tableOptions};\n\t\tCREATE TABLE IF NOT EXISTS ${tables.forkTombstones} (\n\t\t\tsession_id ${text} NOT NULL PRIMARY KEY, deleted_at ${text} NOT NULL\n\t\t)${dialect.tableOptions};\n\t\tCREATE TABLE IF NOT EXISTS ${tables.forkDetach} (\n\t\t\tparent_id ${text} NOT NULL, child_id ${text} NOT NULL, reparent ${int} NOT NULL,\n\t\t\toriginal_segments ${text} NOT NULL, parent_epoch ${text}, child_epoch ${text},\n\t\t\tPRIMARY KEY(parent_id, child_id)\n\t\t)${dialect.tableOptions};\n\t`;\n}\n\n/** Creates the fork tables in `tx`: see {@link sharedHistoryTablesScript}. */\nexport async function createSharedHistoryTables(\n\ttx: SqliteExecutor,\n\tdialect: StorageDialect,\n\ttables: SessionForkTables,\n): Promise<void> {\n\tawait tx.exec(sharedHistoryTablesScript(dialect, tables));\n}\n"]}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Where a forked session's inherited entries live, when a fork shares its parent's stored history instead of copying it
3
+ * (#6560). Seqs are 1-based and dense in every session's view. A segment says that the view's seqs `baseSeq + 1` through
4
+ * `baseSeq + (toSeq - fromSeq + 1)` are the rows `fromSeq` through `toSeq`, inclusive, that session `sourceId` stores
5
+ * under its own id. Every seq of a view that no segment covers is a row the session stores itself, under that same seq.
6
+ *
7
+ * Segments are composed when a fork is made, so a source always stores the rows a segment names itself: reading a
8
+ * session never walks a chain of ancestors, whatever the depth of its forks.
9
+ */
10
+ export interface ForkSegment {
11
+ readonly sourceId: string;
12
+ readonly fromSeq: number;
13
+ readonly toSeq: number;
14
+ readonly baseSeq: number;
15
+ }
16
+ /** A run of a session's view in one place: view seqs `firstSeq` on are `sessionId`'s stored seqs `fromSeq` to `toSeq`. */
17
+ export interface ForkPiece {
18
+ readonly sessionId: string;
19
+ readonly fromSeq: number;
20
+ readonly toSeq: number;
21
+ readonly firstSeq: number;
22
+ }
23
+ export declare function segmentLength(segment: ForkSegment): number;
24
+ /**
25
+ * Throws unless `segments` are well formed for the view of session `sessionId`, of `length` seqs: each non-empty, within
26
+ * the view, of another session, with its source rows from seq 1 on, in view order and disjoint, and each source's rows
27
+ * in increasing order, so no stored row is read at two seqs of the view.
28
+ */
29
+ export declare function assertForkSegments(sessionId: string, segments: readonly ForkSegment[], length: number): void;
30
+ /** Where view seq `seq` of session `sessionId` is stored. */
31
+ export declare function locateForkSeq(sessionId: string, segments: readonly ForkSegment[], seq: number): {
32
+ readonly sessionId: string;
33
+ readonly seq: number;
34
+ };
35
+ /**
36
+ * The view seqs `fromSeq` through `toSeq` of session `sessionId` as runs stored in one place each, in view order: what a
37
+ * read of that range reads, one statement a piece.
38
+ */
39
+ export declare function forkPieces(sessionId: string, segments: readonly ForkSegment[], fromSeq: number, toSeq: number): ForkPiece[];
40
+ /**
41
+ * The segments a fork of session `parentId`, whose view has `parentLength` seqs and inherits `parent`, keeps when it
42
+ * takes the parent's view seqs `fromSeq` through `toSeq` as its own view seqs from `baseSeq + 1` on: the parent's own rows
43
+ * as segments of the parent, and its inherited rows as segments of their sources, so no source of the result inherits
44
+ * the rows it names. Throws when the range is not in the parent's view.
45
+ */
46
+ export declare function forkRunSegments(parentId: string, parent: readonly ForkSegment[], parentLength: number, run: {
47
+ readonly fromSeq: number;
48
+ readonly toSeq: number;
49
+ readonly baseSeq: number;
50
+ }): ForkSegment[];
51
+ /**
52
+ * `segments` with each segment that continues the one before it in both its source and its view joined to it: the same
53
+ * view in fewer segments.
54
+ */
55
+ export declare function joinForkSegments(segments: readonly ForkSegment[]): ForkSegment[];
56
+ /** The segments of a fork that keeps the first `cut` seqs of a parent's view, as a prefix of its own view. */
57
+ export declare function prefixForkSegments(parentId: string, parent: readonly ForkSegment[], parentLength: number, cut: number): ForkSegment[];
58
+ //# sourceMappingURL=fork-segments.d.ts.map