@bastani/atomic 0.10.10-alpha.2 → 0.10.11-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 (381) hide show
  1. package/CHANGELOG.md +142 -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 +8 -10
  7. package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js.map +1 -1
  8. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +6 -6
  9. package/dist/_shared/mode-shared-2QJSCUM6.js +52 -15
  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 +3 -3
  13. package/dist/_shared/{sdk-RRLVN7ER.js → sdk-AVFII7NK.js} +757 -233
  14. package/dist/_shared/sdk-AVFII7NK.js.map +1 -0
  15. package/dist/_shared/session-data-AHTU7IS6.js +3 -3
  16. package/dist/_shared/session-manager-list-2BLEEZVG.js +1 -1
  17. package/dist/_shared/{startup-0-0-4VG2G44V.js → startup-0-0-57KF6LZH.js} +94 -42
  18. package/dist/_shared/startup-0-0-57KF6LZH.js.map +1 -0
  19. package/dist/_shared/{startup-0-1-XTIL65D4.js → startup-0-1-GIY75K46.js} +75 -13
  20. package/dist/_shared/startup-0-1-GIY75K46.js.map +1 -0
  21. package/dist/_shared/startup-0-2-27OWFHV6.js +72 -7
  22. package/dist/_shared/startup-0-2-27OWFHV6.js.map +1 -1
  23. package/dist/_shared/startup-0-3-T4DVFYWX.js +4 -4
  24. package/dist/_shared/startup-0-4-ZMJV547D.js +4 -4
  25. package/dist/_shared/{startup-0-5-FD2P735I.js → startup-0-5-YDW47QX6.js} +27 -69
  26. package/dist/_shared/startup-0-5-YDW47QX6.js.map +1 -0
  27. package/dist/_shared/startup-10-0-TDQNBDDL.js +6 -6
  28. package/dist/_shared/startup-12-0-55AAXBJZ.js +3 -3
  29. package/dist/_shared/startup-14-0-MLX36RBG.js +4 -4
  30. package/dist/_shared/startup-15-0-YUKGAC63.js +31 -7
  31. package/dist/_shared/startup-15-0-YUKGAC63.js.map +1 -1
  32. package/dist/_shared/startup-15-1-4S7FLMNG.js +7 -6
  33. package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
  34. package/dist/_shared/startup-8-0-34CBHPZH.js +4 -4
  35. package/dist/_shared/{startup-8-1-4KANEHRA.js → startup-8-1-X32CYSXB.js} +1219 -714
  36. package/dist/_shared/startup-8-1-X32CYSXB.js.map +1 -0
  37. package/dist/_shared/storage-command-7MGXLJGZ.js +14 -8
  38. package/dist/_shared/storage-command-7MGXLJGZ.js.map +1 -1
  39. package/dist/_shared/task-reference-stream-JWMUZSJX.js +1 -1
  40. package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
  41. package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
  42. package/dist/builtin/intercom/CHANGELOG.md +24 -0
  43. package/dist/builtin/intercom/broker/broker.bundle.mjs +993 -362
  44. package/dist/builtin/intercom/broker/database-wake-up-bus.ts +103 -24
  45. package/dist/builtin/intercom/broker/multinode-router.ts +42 -21
  46. package/dist/builtin/intercom/broker/multinode-state-store.ts +22 -1
  47. package/dist/builtin/intercom/broker/open-broker-state.ts +82 -31
  48. package/dist/builtin/intercom/broker/paths.ts +8 -4
  49. package/dist/builtin/intercom/broker/released-asker-remote-replies.ts +18 -6
  50. package/dist/builtin/intercom/broker/sql-add-column.ts +4 -1
  51. package/dist/builtin/intercom/broker/sql-ended-child-queue-store.ts +65 -44
  52. package/dist/builtin/intercom/broker/sql-held-send-store.ts +11 -3
  53. package/dist/builtin/intercom/broker/sql-known-session-store.ts +24 -12
  54. package/dist/builtin/intercom/broker/sql-lease-store.ts +375 -65
  55. package/dist/builtin/intercom/broker/sql-outbox-store.ts +270 -101
  56. package/dist/builtin/intercom/broker/sql-pending-ask-store.ts +20 -9
  57. package/dist/builtin/intercom/broker/sql-released-ask-store.ts +14 -6
  58. package/dist/builtin/intercom/broker/sql-restoring-reservation-store.ts +27 -11
  59. package/dist/builtin/intercom/broker/sql-schema.ts +139 -1
  60. package/dist/builtin/intercom/broker/sql-sent-message-authority.ts +97 -34
  61. package/dist/builtin/intercom/index.bundle.mjs +11 -8
  62. package/dist/builtin/intercom/package.json +1 -1
  63. package/dist/builtin/mcp/index.bundle.mjs +1 -1
  64. package/dist/builtin/mcp/package.json +1 -1
  65. package/dist/builtin/subagents/CHANGELOG.md +20 -0
  66. package/dist/builtin/subagents/package.json +1 -1
  67. package/dist/builtin/subagents/skills/skill-creator/SKILL.md +1 -1
  68. package/dist/builtin/subagents/src/extension/index.bundle.mjs +62 -23
  69. package/dist/builtin/web-access/CHANGELOG.md +9 -0
  70. package/dist/builtin/web-access/index.bundle.mjs +1 -1
  71. package/dist/builtin/web-access/package.json +1 -1
  72. package/dist/cli/args.js +2 -2
  73. package/dist/cli/auth-cli.code.js +4 -4
  74. package/dist/cli/auth-cli.impl.js +3 -3
  75. package/dist/cli/auth-cli.js +3 -3
  76. package/dist/cli/blueprint-command.code.js +3 -3
  77. package/dist/cli/blueprint-command.impl.js +3 -3
  78. package/dist/cli/blueprint-command.js +3 -3
  79. package/dist/cli/intercom-command.code.js +2 -2
  80. package/dist/cli/intercom-command.impl.js +3 -3
  81. package/dist/cli/intercom-command.js +3 -3
  82. package/dist/cli/list-models.code.js +2 -2
  83. package/dist/cli/list-models.impl.js +3 -3
  84. package/dist/cli/list-models.js +3 -3
  85. package/dist/cli/session-picker.code.js +1 -1
  86. package/dist/cli/session-picker.impl.js +3 -3
  87. package/dist/cli/session-picker.js +3 -3
  88. package/dist/cli/startup-ui.code.js +1 -1
  89. package/dist/cli/startup-ui.impl.js +3 -3
  90. package/dist/cli/startup-ui.js +3 -3
  91. package/dist/cli/storage-command.impl.js +3 -3
  92. package/dist/cli/storage-command.js +3 -3
  93. package/dist/cli/storage-search-session.code.js +3 -3
  94. package/dist/cli/storage-search-session.impl.js +3 -3
  95. package/dist/cli/storage-search-session.js +3 -3
  96. package/dist/cli/team-command.code.js +2 -2
  97. package/dist/cli/team-command.impl.js +3 -3
  98. package/dist/cli/team-command.js +3 -3
  99. package/dist/cli.js +2 -2
  100. package/dist/core/agent-session-methods.d.ts +3 -0
  101. package/dist/core/agent-session-methods.js.map +1 -1
  102. package/dist/core/agent-session.d.ts +1 -0
  103. package/dist/core/compaction/compactor.d.ts +2 -0
  104. package/dist/core/debug.impl.js +3 -3
  105. package/dist/core/debug.js +3 -3
  106. package/dist/core/export-html/card-projection.code.js +1 -1
  107. package/dist/core/export-html/card-projection.impl.js +3 -3
  108. package/dist/core/export-html/card-projection.js +3 -3
  109. package/dist/core/export-html/index.code.js +2 -2
  110. package/dist/core/export-html/index.impl.js +3 -3
  111. package/dist/core/export-html/index.js +3 -3
  112. package/dist/core/export-html/json-spans.impl.js +3 -3
  113. package/dist/core/export-html/json-spans.js +3 -3
  114. package/dist/core/export-html/oversized-render-inputs.code.js +1 -1
  115. package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
  116. package/dist/core/export-html/oversized-render-inputs.js +3 -3
  117. package/dist/core/export-html/tool-renderer.impl.js +3 -3
  118. package/dist/core/export-html/tool-renderer.js +3 -3
  119. package/dist/core/extensions/jiti-loader.impl.js +3 -3
  120. package/dist/core/extensions/jiti-loader.js +3 -3
  121. package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
  122. package/dist/core/extensions/jiti-static-loader.js +3 -3
  123. package/dist/core/extensions/loader-host-modules.code.js +1 -1
  124. package/dist/core/extensions/loader-host-modules.impl.js +3 -3
  125. package/dist/core/extensions/loader-host-modules.js +3 -3
  126. package/dist/core/extensions/loader-virtual-modules.js +2 -2
  127. package/dist/core/extensions/runner-context.js +3 -3
  128. package/dist/core/extensions/runner-context.js.map +1 -1
  129. package/dist/core/intercom-broker-control-host.code.js +1 -1
  130. package/dist/core/intercom-broker-control-host.impl.js +3 -3
  131. package/dist/core/intercom-broker-control-host.js +3 -3
  132. package/dist/core/intercom-broker-control.code.js +3 -3
  133. package/dist/core/intercom-broker-control.impl.js +3 -3
  134. package/dist/core/intercom-broker-control.js +3 -3
  135. package/dist/core/model-registry.js +1 -1
  136. package/dist/core/model-resolver-defaults.d.ts +3 -2
  137. package/dist/core/package-manager-storage-adapters.code.js +1 -1
  138. package/dist/core/package-manager-storage-adapters.impl.js +3 -3
  139. package/dist/core/package-manager-storage-adapters.js +3 -3
  140. package/dist/core/sdk.code.js +3 -4
  141. package/dist/core/sdk.impl.js +3 -3
  142. package/dist/core/sdk.js +3 -3
  143. package/dist/core/session-manager-core.d.ts +5 -2
  144. package/dist/core/session-manager-core.js +17 -13
  145. package/dist/core/session-manager-core.js.map +1 -1
  146. package/dist/core/session-manager-list.impl.js +3 -3
  147. package/dist/core/session-manager-list.js +3 -3
  148. package/dist/core/session-manager.code.js +1 -1
  149. package/dist/core/session-manager.impl.js +3 -3
  150. package/dist/core/session-manager.js +3 -3
  151. package/dist/core/session-storage.code.js +1 -1
  152. package/dist/core/session-storage.impl.js +3 -3
  153. package/dist/core/session-storage.js +3 -3
  154. package/dist/core/storage/added-exports.d.ts +6 -0
  155. package/dist/core/storage/added-exports.js +16 -0
  156. package/dist/core/storage/added-exports.js.map +1 -0
  157. package/dist/core/storage/database.d.ts +16 -0
  158. package/dist/core/storage/database.js.map +1 -1
  159. package/dist/core/storage/fenced-paths.d.ts +47 -0
  160. package/dist/core/storage/fenced-paths.js +53 -0
  161. package/dist/core/storage/fenced-paths.js.map +1 -1
  162. package/dist/core/storage/file-identity.js +31 -2
  163. package/dist/core/storage/file-identity.js.map +1 -1
  164. package/dist/core/storage/index.d.ts +3 -0
  165. package/dist/core/storage/index.js +5 -2
  166. package/dist/core/storage/index.js.map +1 -1
  167. package/dist/core/storage/migrations.d.ts +22 -0
  168. package/dist/core/storage/migrations.js +55 -0
  169. package/dist/core/storage/migrations.js.map +1 -1
  170. package/dist/core/storage/node-sqlite-thread.js +19 -6
  171. package/dist/core/storage/node-sqlite-thread.js.map +1 -1
  172. package/dist/core/storage/node-sqlite.js +53 -4
  173. package/dist/core/storage/node-sqlite.js.map +1 -1
  174. package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
  175. package/dist/core/storage/offline-snapshot-file.js +3 -3
  176. package/dist/core/storage/prefix.d.ts +3 -2
  177. package/dist/core/storage/prefix.js +18 -2
  178. package/dist/core/storage/prefix.js.map +1 -1
  179. package/dist/core/storage/provider.js +2 -2
  180. package/dist/core/storage/schema-catalog.d.ts +42 -0
  181. package/dist/core/storage/schema-catalog.js +141 -0
  182. package/dist/core/storage/schema-catalog.js.map +1 -0
  183. package/dist/core/storage/selection.js +2 -2
  184. package/dist/core/storage/session/branch-fork-source.code.js +41 -20
  185. package/dist/core/storage/session/branch-fork-source.code.js.map +1 -1
  186. package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
  187. package/dist/core/storage/session/branch-fork-source.js +3 -3
  188. package/dist/core/storage/session/card-view.impl.js +3 -3
  189. package/dist/core/storage/session/card-view.js +3 -3
  190. package/dist/core/storage/session/child-reader.code.js +3 -3
  191. package/dist/core/storage/session/child-reader.impl.js +3 -3
  192. package/dist/core/storage/session/child-reader.js +3 -3
  193. package/dist/core/storage/session/chunked-resume-projection.code.js +1 -1
  194. package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
  195. package/dist/core/storage/session/chunked-resume-projection.js +3 -3
  196. package/dist/core/storage/session/expanded-child-details.code.js +3 -3
  197. package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
  198. package/dist/core/storage/session/expanded-child-details.js +3 -3
  199. package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
  200. package/dist/core/storage/session/fork-row-bytes.js +3 -3
  201. package/dist/core/storage/session/fork-row-index.impl.js +3 -3
  202. package/dist/core/storage/session/fork-row-index.js +3 -3
  203. package/dist/core/storage/session/fork-staging.code.js +176 -36
  204. package/dist/core/storage/session/fork-staging.code.js.map +1 -1
  205. package/dist/core/storage/session/fork-staging.impl.js +3 -3
  206. package/dist/core/storage/session/fork-staging.js +3 -3
  207. package/dist/core/storage/session/fork-window.code.js +3 -3
  208. package/dist/core/storage/session/fork-window.impl.js +3 -3
  209. package/dist/core/storage/session/fork-window.js +3 -3
  210. package/dist/core/storage/session/history-pages.impl.js +3 -3
  211. package/dist/core/storage/session/history-pages.js +3 -3
  212. package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
  213. package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
  214. package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
  215. package/dist/core/storage/session/jsonl-session-store.js +3 -3
  216. package/dist/core/storage/session/memory-session-store.impl.js +3 -3
  217. package/dist/core/storage/session/memory-session-store.js +3 -3
  218. package/dist/core/storage/session/pinned-branch-resume.code.js +3 -3
  219. package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
  220. package/dist/core/storage/session/pinned-branch-resume.js +3 -3
  221. package/dist/core/storage/session/released-history-files.code.js +2 -2
  222. package/dist/core/storage/session/released-history-files.impl.js +3 -3
  223. package/dist/core/storage/session/released-history-files.js +3 -3
  224. package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
  225. package/dist/core/storage/session/resident-fork-rows.js +3 -3
  226. package/dist/core/storage/session/session-resume.impl.js +3 -3
  227. package/dist/core/storage/session/session-resume.js +3 -3
  228. package/dist/core/storage/session/session-search-index.d.ts +5 -0
  229. package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
  230. package/dist/core/storage/session/snapshot-cut.js +3 -3
  231. package/dist/core/storage/session/snapshot-history.code.js +3 -3
  232. package/dist/core/storage/session/snapshot-history.impl.js +3 -3
  233. package/dist/core/storage/session/snapshot-history.js +3 -3
  234. package/dist/core/storage/session/sql-chat-records.d.ts +15 -0
  235. package/dist/core/storage/session/sql-session-store.code.js +1 -1
  236. package/dist/core/storage/session/sql-session-store.d.ts +102 -5
  237. package/dist/core/storage/session/sql-session-store.impl.js +4 -4
  238. package/dist/core/storage/session/sql-session-store.js +4 -4
  239. package/dist/core/storage/session/tree-outline.impl.js +3 -3
  240. package/dist/core/storage/session/tree-outline.js +3 -3
  241. package/dist/core/storage/session/tree-presentation.code.js +1 -1
  242. package/dist/core/storage/session/tree-presentation.impl.js +3 -3
  243. package/dist/core/storage/session/tree-presentation.js +3 -3
  244. package/dist/core/storage/session/types.d.ts +14 -0
  245. package/dist/core/storage/sqlite-facade.d.ts +37 -5
  246. package/dist/core/storage/sqlite-facade.js +351 -18
  247. package/dist/core/storage/sqlite-facade.js.map +1 -1
  248. package/dist/core/storage/statement-sequence.d.ts +83 -0
  249. package/dist/core/storage/statement-sequence.js +21 -0
  250. package/dist/core/storage/statement-sequence.js.map +1 -1
  251. package/dist/core/storage/storage-status.code.js +1 -1
  252. package/dist/core/storage/storage-status.impl.js +3 -3
  253. package/dist/core/storage/storage-status.js +3 -3
  254. package/dist/core/storage/team.code.js +1 -1
  255. package/dist/core/storage/team.impl.js +3 -3
  256. package/dist/core/storage/team.js +3 -3
  257. package/dist/core/structured-output/index.code.js +1 -1
  258. package/dist/core/structured-output/index.impl.js +3 -3
  259. package/dist/core/structured-output/index.js +3 -3
  260. package/dist/core/tasks/task-completion-entry.code.js +1 -1
  261. package/dist/core/tasks/task-completion-entry.impl.js +3 -3
  262. package/dist/core/tasks/task-completion-entry.js +3 -3
  263. package/dist/core/tasks/task-file-history.code.js +3 -3
  264. package/dist/core/tasks/task-file-history.impl.js +3 -3
  265. package/dist/core/tasks/task-file-history.js +3 -3
  266. package/dist/core/tasks/task-reference-archive.code.js +4 -4
  267. package/dist/core/tasks/task-reference-archive.js +3 -3
  268. package/dist/core/tasks/task-reference-identity.js +3 -3
  269. package/dist/core/tasks/task-reference-stream.impl.js +3 -3
  270. package/dist/core/tasks/task-reference-stream.js +3 -3
  271. package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
  272. package/dist/core/tasks/task-unsaved-answer.js +3 -3
  273. package/dist/core/tasks/task-view-source.code.js +1 -1
  274. package/dist/core/tasks/task-view-source.impl.js +3 -3
  275. package/dist/core/tasks/task-view-source.js +3 -3
  276. package/dist/core/tools/bash.d.ts +8 -4
  277. package/dist/core/tools/history-session.d.ts +5 -0
  278. package/dist/core/tools/history-tasks.d.ts +123 -0
  279. package/dist/core/tools/kill.d.ts +5 -2
  280. package/dist/core/tools/powershell.d.ts +2 -2
  281. package/dist/core/tools/read-url.code.js +3 -3
  282. package/dist/core/tools/read-url.impl.js +3 -3
  283. package/dist/core/tools/read-url.js +3 -3
  284. package/dist/core/tools/read.d.ts +12 -2
  285. package/dist/core/tools/resource-selectors.d.ts +2 -0
  286. package/dist/core/tools/search.d.ts +12 -2
  287. package/dist/core/worktree-snapshot/blob-store.d.ts +14 -2
  288. package/dist/core/worktree-snapshot/blob-store.js +69 -16
  289. package/dist/core/worktree-snapshot/blob-store.js.map +1 -1
  290. package/dist/core/worktree-snapshot/errors.code.js +2 -2
  291. package/dist/core/worktree-snapshot/errors.impl.js +3 -3
  292. package/dist/core/worktree-snapshot/errors.js +3 -3
  293. package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
  294. package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
  295. package/dist/extensions/codemode/execute.code.js +2 -2
  296. package/dist/extensions/codemode/execute.impl.js +3 -3
  297. package/dist/extensions/codemode/execute.js +3 -3
  298. package/dist/extensions/codemode/renderer.code.js +2 -2
  299. package/dist/extensions/codemode/renderer.impl.js +3 -3
  300. package/dist/extensions/codemode/renderer.js +3 -3
  301. package/dist/extensions/mcp/cli.code.js +3 -3
  302. package/dist/extensions/mcp/cli.impl.js +3 -3
  303. package/dist/extensions/mcp/cli.js +3 -3
  304. package/dist/extensions/mcp/cli.lazy.code.js +2 -2
  305. package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
  306. package/dist/extensions/mcp/cli.lazy.js +3 -3
  307. package/dist/extensions/mcp/runtime.code.js +1 -1
  308. package/dist/extensions/mcp/runtime.impl.js +3 -3
  309. package/dist/extensions/mcp/runtime.js +3 -3
  310. package/dist/index.js +5 -5
  311. package/dist/main-first-time-setup.code.js +1 -1
  312. package/dist/main-first-time-setup.impl.js +3 -3
  313. package/dist/main-first-time-setup.js +3 -3
  314. package/dist/main.js +1 -1
  315. package/dist/modes/interactive/components/agent-panel.d.ts +1 -0
  316. package/dist/modes/interactive/components/stored-tree-view.code.js +2 -2
  317. package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
  318. package/dist/modes/interactive/components/stored-tree-view.js +3 -3
  319. package/dist/modes/interactive/components/task-inspector.d.ts +2 -0
  320. package/dist/modes/interactive/components/user-message-selector-archive.code.js +1 -1
  321. package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
  322. package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
  323. package/dist/modes/interactive/interactive-mode-helpers.d.ts +2 -2
  324. package/dist/modes/print-mode.js +1 -1
  325. package/dist/modes/rpc/agent-panel-bridge.d.ts +5 -0
  326. package/dist/package-manager-cli.code.js +6 -6
  327. package/dist/package-manager-cli.impl.js +3 -3
  328. package/dist/package-manager-cli.js +3 -3
  329. package/dist/rpc-entry.js +1 -1
  330. package/dist/startup-files.json +1 -1
  331. package/dist/startup-stages/0.js +1 -1
  332. package/dist/startup-stages/1.js +1 -1
  333. package/dist/startup-stages/10.js +1 -1
  334. package/dist/startup-stages/12.js +1 -1
  335. package/dist/startup-stages/2.js +8 -1
  336. package/dist/startup-stages/3.js +1 -6
  337. package/dist/startup-stages/5.js +1 -1
  338. package/dist/startup-stages/7.js +1 -5
  339. package/dist/utils/startup-database-spare.code.js +2 -2
  340. package/dist/utils/startup-database-spare.impl.js +3 -3
  341. package/dist/utils/startup-database-spare.js +3 -3
  342. package/dist/utils/tools-manager.code.js +1 -1
  343. package/dist/utils/tools-manager.impl.js +3 -3
  344. package/dist/utils/tools-manager.js +3 -3
  345. package/docs/background-tasks.md +123 -23
  346. package/docs/compaction.md +18 -0
  347. package/docs/docs.json +2 -0
  348. package/docs/environment-variables.md +1 -1
  349. package/docs/getting-started/installation.md +9 -2
  350. package/docs/guides/postgres-pgbouncer.md +339 -0
  351. package/docs/guides/postgres-tuning.md +311 -0
  352. package/docs/guides/resume-on-any-machine.md +2 -2
  353. package/docs/guides.md +2 -0
  354. package/docs/index.md +1 -1
  355. package/docs/libraries/agent-core.md +1 -1
  356. package/docs/libraries/ai.md +2 -2
  357. package/docs/libraries/codemode.md +1 -1
  358. package/docs/libraries/storage-libsql.md +6 -1
  359. package/docs/libraries/storage-postgres.md +11 -6
  360. package/docs/libraries/tui.md +1 -1
  361. package/docs/libraries.md +2 -2
  362. package/docs/programmatic.md +1 -1
  363. package/docs/quickstart.md +1 -1
  364. package/docs/sdk/storage.md +1 -1
  365. package/docs/sdk/web-server.md +1 -3
  366. package/docs/sdk.md +1 -7
  367. package/docs/sessions.md +58 -2
  368. package/docs/settings.md +20 -1
  369. package/docs/skills/authoring.md +1 -1
  370. package/docs/skills.md +79 -6
  371. package/docs/storage.md +262 -12
  372. package/docs/subagents/reference.md +2 -2
  373. package/docs/subagents.md +4 -3
  374. package/docs/tools.md +44 -10
  375. package/docs/windows.md +1 -1
  376. package/package.json +9 -9
  377. package/dist/_shared/sdk-RRLVN7ER.js.map +0 -1
  378. package/dist/_shared/startup-0-0-4VG2G44V.js.map +0 -1
  379. package/dist/_shared/startup-0-1-XTIL65D4.js.map +0 -1
  380. package/dist/_shared/startup-0-5-FD2P735I.js.map +0 -1
  381. package/dist/_shared/startup-8-1-4KANEHRA.js.map +0 -1
@@ -2,8 +2,8 @@ import type { SessionEntry } from "../../session-manager-types.ts";
2
2
  import { SqlSnapshotBlobStore } from "../../worktree-snapshot/blob-store.ts";
3
3
  import type { SqliteDatabase, SqliteExecutor } from "../database.js";
4
4
  import { type StorageDialect } from "../dialect.js";
5
- import { type SessionChatRecords } from "./chat-records.js";
6
5
  import { SqlSessionSearchIndex } from "./session-search-index.js";
6
+ import { type SqlSessionChatRecords } from "./sql-chat-records.js";
7
7
  import type { ChildDisplayLaunch, ForkArchiveSource, OversizedSessionEntry, SessionBlob, SessionBranchPageCut, SessionCompactionPoint, SessionCwdMatcher, SessionEntriesPage, SessionEntriesQuery, SessionEntryRange, SessionEntrySizes, SessionForkSeed, SessionForkStream, SessionListQuery, SessionOpenMarker, SessionOpenMarkerAge, SessionOpenMarkerStore, SessionRecordHeader, SessionResume, SessionScanOptions, SessionScanPage, SessionSnapshot, SessionSnapshotCut, SessionStore, SessionStoredEntry, SessionSummary, SessionTail, SessionTaskReferenceDuplicatePage, SessionTaskReferenceDuplicateQuery, SessionTreeOutlineEntry, SessionWriteOptions, SessionWriteResult, StorageDescriptor } from "./types.js";
8
8
  /**
9
9
  * The newest sessions schema this build reads and writes. Version 2 stores long entries in chunks (#4954), which a build
@@ -14,6 +14,8 @@ import type { ChildDisplayLaunch, ForkArchiveSource, OversizedSessionEntry, Sess
14
14
  export declare const SESSION_SCHEMA_VERSION = 2;
15
15
  /** The schema domain of the session tables in the prefix's migration ledger. */
16
16
  export declare const SESSION_DOMAIN = "sessions";
17
+ /** The ledger step, `schema:session-fillfactor`, that sets the sessions table's fillfactor on PostgreSQL (#6560). */
18
+ export declare const SESSION_FILLFACTOR_DOMAIN = "session-fillfactor";
17
19
  /**
18
20
  * The most bytes of a chunked session blob one row holds. New blobs use a header row and rows of at most this size,
19
21
  * so their bound and returned values stay within it: libSQL servers cap a row and a bound value (sqld's default is
@@ -81,12 +83,14 @@ export declare class SqlSessionStore implements SessionStore {
81
83
  openMarkers: SqlSessionOpenMarkers;
82
84
  readonly searchIndex?: SqlSessionSearchIndex;
83
85
  private chatStore?;
86
+ /** The database's reader handle, once a read opened it: see `readerDatabase`. */
87
+ private reader?;
84
88
  /**
85
89
  * Absent on a local libSQL file, which then behaves as before: @libsql/client waits for another process's write
86
90
  * lock on the calling thread, even to begin a transaction, so a side write would stop the event loop where an
87
91
  * ordinary turn-ending notice writes nothing (#5682).
88
92
  */
89
- get chatRecords(): SessionChatRecords | undefined;
93
+ get chatRecords(): SqlSessionChatRecords | undefined;
90
94
  private readonly entryByteLength;
91
95
  private chunkRowids?;
92
96
  /** Session ids of each recently listed scope, valid while the store's change token is unchanged. */
@@ -111,6 +115,7 @@ export declare class SqlSessionStore implements SessionStore {
111
115
  readonly prefix?: string;
112
116
  readonly cwdMatcher?: SessionCwdMatcher;
113
117
  }): Promise<SqlSessionStore>;
118
+ private static openWithCatalog;
114
119
  /**
115
120
  * Removes, in a bounded number of short transactions, the staged rows of clones that stopped mid-copy and whose lease
116
121
  * lapsed (#5594). Housekeeping: nothing reads those rows, so a failure leaves them to a later open or clone.
@@ -130,6 +135,27 @@ export declare class SqlSessionStore implements SessionStore {
130
135
  * since this store opened it, and what it writes then is not this build's to read or write (#5065).
131
136
  */
132
137
  private transaction;
138
+ /**
139
+ * `options` with the schema check its transaction makes first, before the reads `options.leading` names, sent with
140
+ * the transaction's start where the connection is pipelined.
141
+ */
142
+ private checkedFirst;
143
+ /**
144
+ * `transaction` for a write to the rows of the session `sessionId` only, beside writers of other sessions. `leading`
145
+ * names the reads the body makes first, after the schema check.
146
+ */
147
+ private sessionWrite;
148
+ /**
149
+ * `transaction` for a body that only reads, in one read-only snapshot, on the database's reader handle when it
150
+ * offers one: its reads then wait for neither the writes queued on this store's connection nor their locks.
151
+ */
152
+ private readTransaction;
153
+ /**
154
+ * The database's reader handle, opened at the first read and closed with the store; the database without one. A
155
+ * reader that cannot open, such as when its file can no longer be opened anew, leaves the read on the store's own
156
+ * connection, as every read ran before readers, and the next read tries to open one again.
157
+ */
158
+ private readerDatabase;
133
159
  /**
134
160
  * `transaction` for a body that only reads and writes the database. The version check is sent first, as there, but on
135
161
  * a connection thread the body's first reads go behind it without waiting for its answer: one wait for the thread
@@ -138,12 +164,42 @@ export declare class SqlSessionStore implements SessionStore {
138
164
  * failure reported, whatever the body met.
139
165
  */
140
166
  private transactionCheckedAlongside;
167
+ /** The read that checks the sessions schema version, which every transaction of this store makes first. */
168
+ private schemaCheck;
141
169
  private assertReadableSchema;
142
170
  get descriptor(): StorageDescriptor;
143
171
  create(header: SessionRecordHeader, entries: readonly SessionEntry[]): Promise<SessionWriteResult>;
144
172
  createFork(header: SessionRecordHeader, entries: SessionForkSeed, source: ForkArchiveSource): Promise<(SessionWriteResult & {
145
173
  remainingBlobs?: readonly string[];
146
174
  }) | undefined>;
175
+ /**
176
+ * The source session's head, its row locked for share, once the child is known to be new: both reads go out together,
177
+ * one round trip (#6560). Fails as the source changed when it is no longer the generation the fork read.
178
+ */
179
+ private forkDonor;
180
+ /**
181
+ * The statements that store a fork's `entries`, in seq order: an entry with a receipt as the source stores it, its row
182
+ * and chunks copied in two statements whatever their size, and any other as `create` stores it. A receipt's row that
183
+ * names another entry fails the fork: the source changed under it.
184
+ */
185
+ private receiptForkWrites;
186
+ /**
187
+ * The blob copy of a fork from session `source` of this store's tables (#6560), or undefined when a subclass stores
188
+ * blobs its own way: `createForkArchive` then copies every one through it.
189
+ */
190
+ private forkBlobCopy;
191
+ /**
192
+ * Sends a fork's blob copy behind its entries, then checks, in one round trip with them, that every stored entry of
193
+ * the child has all its chunks and which blobs were copied whole. Resolves with the hashes left for
194
+ * `copySessionBlobs`: those the source does not hold, or all of them where this store does not copy blobs itself.
195
+ */
196
+ private finishForkCopy;
197
+ /**
198
+ * Whether `store` keeps its sessions in this store's very tables, so that this store's transaction reads its rows: this
199
+ * store, or another session store opened on the same database with the same prefix, such as through another handle
200
+ * (#6560). A wrapper that serves sessions of its own does not.
201
+ */
202
+ private sharesTablesWith;
147
203
  /**
148
204
  * Clone a complete session, as `create` with every source entry and blob would, from a store on a handle this one
149
205
  * cannot prove to be its own connection (#5594). The source is read a page at a time into the staging table, never
@@ -158,6 +214,12 @@ export declare class SqlSessionStore implements SessionStore {
158
214
  * runtime role without DDL privileges then stages bounded clones too. Opens never create it.
159
215
  */
160
216
  prepareForkStaging(): Promise<void>;
217
+ /**
218
+ * Creates the chat records' table and index unless the ledger records them, as `atomic storage migrate` does as the
219
+ * owner role: a runtime role without DDL privileges then saves chat records too. Opens never create them; the first
220
+ * chat record does where `migrate` has not run.
221
+ */
222
+ prepareChatRecords(): Promise<void>;
161
223
  private forkStagingTarget;
162
224
  /**
163
225
  * The stored chunk row `index` of the entry `reference` names, whole, in its generation; undefined when the entry is
@@ -166,6 +228,12 @@ export declare class SqlSessionStore implements SessionStore {
166
228
  private readStoredEntryChunk;
167
229
  /** How many chunks the entry `reference` names is stored in, 0 when it is stored whole, in its generation. */
168
230
  private readStoredChunks;
231
+ /**
232
+ * The headers of the blobs `hashes` of session `sessionId` in one read (#6560), each with its first chunk row when it
233
+ * is stored in chunks of at most `maxBytes` in all, as `readBlobPart` reads them at offset 0. A blob the session does
234
+ * not hold is left out; one in the legacy one-row layout comes without its value.
235
+ */
236
+ private readBlobFirstParts;
169
237
  /**
170
238
  * The bytes of a blob from `offset`, a multiple of {@link SESSION_BLOB_CHUNK_BYTES}, so a staged clone never holds
171
239
  * the whole of a large one (#5594): the stored chunk row there, or for a blob in the legacy one-row layout (`chunks`
@@ -173,8 +241,14 @@ export declare class SqlSessionStore implements SessionStore {
173
241
  * cut; with `legacyBytes` 0, only its header. Nothing is converted or written.
174
242
  */
175
243
  private readBlobPart;
176
- private copyForkBlob;
177
244
  private createStreamedFork;
245
+ /**
246
+ * `readEntryChunk` for a fork's reader bound to transaction `tx`, reading session `source` in generation `epoch`: a
247
+ * read of an entry fetches a whole stored chunk row, or a part as large of an entry stored whole, and answers the next
248
+ * reads of it from that, so an entry costs a round trip a chunk, not one every 64 KiB (#6560). The fork holds the
249
+ * source's row, so its generation cannot change meanwhile. Other reads go to `reader` as before.
250
+ */
251
+ private forkChunkReader;
178
252
  /** Keep the legacy inline payload outside the iterator's yielded value and the caller's async frame:
179
253
  * neither may retain this row while the next SQLite result is being delivered. */
180
254
  private writeInlineForkSnapshot;
@@ -257,7 +331,19 @@ export declare class SqlSessionStore implements SessionStore {
257
331
  private read;
258
332
  private readRows;
259
333
  private readSeqs;
334
+ /**
335
+ * The read of the session's row that `resumeSource` makes first: a read transaction that starts with it names it as
336
+ * a leading read, so a pipelined connection sends it with the transaction's start (#6560).
337
+ */
338
+ private resumeRow;
260
339
  private resumeSource;
340
+ /**
341
+ * Runs `read`, a read transaction that finds the session's index with `resumeSource`, at once; only when that index is
342
+ * missing or stale (`resumeSource` rejects with `SessionConflictError`) does it compute the index with
343
+ * `prepareResume` and run `read` again. A current index, the usual case, then costs no read before the transaction:
344
+ * on a server, one round trip fewer (#6560).
345
+ */
346
+ private withResumeIndex;
261
347
  private prepareResume;
262
348
  readTail(sessionId: string, fromSeq: number): Promise<SessionTail>;
263
349
  readRange(sessionId: string, startSeq: number, endSeq: number, expectedEpoch?: string): Promise<SessionEntryRange>;
@@ -351,6 +437,8 @@ export declare class SqlSessionStore implements SessionStore {
351
437
  deferChildRecords: true;
352
438
  }): Promise<SessionResume>;
353
439
  private resumeWindow;
440
+ /** The resume of `index`, the session's index as of the snapshot of `tx`, with `header`. */
441
+ private resumeIn;
354
442
  findLatestCompaction(sessionId: string, leafId?: string): Promise<SessionCompactionPoint | undefined>;
355
443
  /** The JSON of a long entry, from its chunks, one statement each. */
356
444
  private readEntryChunks;
@@ -358,16 +446,24 @@ export declare class SqlSessionStore implements SessionStore {
358
446
  private entryChunks;
359
447
  private readInlineEntryBytes;
360
448
  private forWrite;
449
+ /** The read of the session's row that `forWrite` checks a write against. */
450
+ private headRead;
361
451
  private appendedResume;
362
452
  private seqOfEntry;
363
453
  private saveSummary;
364
454
  /** The statement that saves the session's row as `saveSummary` saves it, with what `saveSummary` returns. */
365
455
  private summaryWrite;
366
456
  private insertEntries;
457
+ /**
458
+ * A fork's version step, once every entry of the child is in, as the transaction's last write: the same row order as
459
+ * an append, which takes the snapshot index's progress rows with its entries inserts and the schema row after them,
460
+ * so the two never deadlock (#6560). The body makes no call after it.
461
+ */
462
+ private finishFork;
367
463
  /**
368
464
  * The statements that store `entries` after `lastSeq`, in order, each entry encoded only when its statements are
369
- * taken: each entry's row and its chunks, the version step a first chunked entry takes, then the entries' search
370
- * texts.
465
+ * taken: each entry's row and its chunks, the version step a first chunked entry takes unless `versionStep` is
466
+ * false (a fork takes it once its last entry is in), then the entries' search texts.
371
467
  */
372
468
  private entryWrites;
373
469
  /**
@@ -376,6 +472,7 @@ export declare class SqlSessionStore implements SessionStore {
376
472
  * it once. A larger one runs its statements one at a time as they are made, as before, so it never holds more than
377
473
  * about that much of them, or sends it, at once.
378
474
  */
475
+ /** Writes the session's row and its entries as the transaction's last calls: the body makes none after them. */
379
476
  private writeEntries;
380
477
  private encode;
381
478
  }
@@ -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-alpha.2`;
9
+ const key = `${root.href}#0.10.11-alpha.1`;
10
10
  let release = releases.get(key);
11
11
  if (release === undefined) {
12
12
  const current = (async () => {
@@ -27,10 +27,10 @@ try {
27
27
  release = current;
28
28
  }
29
29
  const running = await release;
30
- if (running === undefined || running.version === "0.10.10-alpha.2") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.10-alpha.2 while this session was running; restart it to keep using session storage.", {
30
+ if (running === undefined || running.version === "0.10.11-alpha.1") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.1 while this session was running; restart it to keep using session storage.", {
32
32
  cause: error,
33
33
  });
34
34
  }
35
- export const { LISTING_FETCH_BATCH, SESSION_BLOB_CHUNK_BYTES, SESSION_DOMAIN, SESSION_ENTRY_CHUNK_BYTES, SESSION_PRESENCE_DOMAIN, SESSION_PRESENCE_TABLES, SESSION_READ_FETCH, SESSION_READ_PAGE_CHARS, SESSION_RESUME_REBUILD, SESSION_SCHEMA_VERSION, SESSION_TABLES, SqlSessionStore } = module;
35
+ export const { LISTING_FETCH_BATCH, SESSION_BLOB_CHUNK_BYTES, SESSION_DOMAIN, SESSION_ENTRY_CHUNK_BYTES, SESSION_FILLFACTOR_DOMAIN, SESSION_PRESENCE_DOMAIN, SESSION_PRESENCE_TABLES, SESSION_READ_FETCH, SESSION_READ_PAGE_CHARS, SESSION_RESUME_REBUILD, SESSION_SCHEMA_VERSION, SESSION_TABLES, SqlSessionStore } = module;
36
36
  //# sourceMappingURL=sql-session-store.impl.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-alpha.2`;
9
+ const key = `${root.href}#0.10.11-alpha.1`;
10
10
  let release = releases.get(key);
11
11
  if (release === undefined) {
12
12
  const current = (async () => {
@@ -27,10 +27,10 @@ try {
27
27
  release = current;
28
28
  }
29
29
  const running = await release;
30
- if (running === undefined || running.version === "0.10.10-alpha.2") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.10-alpha.2 while this session was running; restart it to keep using session storage.", {
30
+ if (running === undefined || running.version === "0.10.11-alpha.1") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.1 while this session was running; restart it to keep using session storage.", {
32
32
  cause: error,
33
33
  });
34
34
  }
35
- export const { LISTING_FETCH_BATCH, SESSION_BLOB_CHUNK_BYTES, SESSION_DOMAIN, SESSION_ENTRY_CHUNK_BYTES, SESSION_PRESENCE_DOMAIN, SESSION_PRESENCE_TABLES, SESSION_READ_FETCH, SESSION_READ_PAGE_CHARS, SESSION_RESUME_REBUILD, SESSION_SCHEMA_VERSION, SESSION_TABLES, SqlSessionStore } = module;
35
+ export const { LISTING_FETCH_BATCH, SESSION_BLOB_CHUNK_BYTES, SESSION_DOMAIN, SESSION_ENTRY_CHUNK_BYTES, SESSION_FILLFACTOR_DOMAIN, SESSION_PRESENCE_DOMAIN, SESSION_PRESENCE_TABLES, SESSION_READ_FETCH, SESSION_READ_PAGE_CHARS, SESSION_RESUME_REBUILD, SESSION_SCHEMA_VERSION, SESSION_TABLES, SqlSessionStore } = module;
36
36
  //# sourceMappingURL=sql-session-store.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-alpha.2`;
9
+ const key = `${root.href}#0.10.11-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.10-alpha.2") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.10-alpha.2 while this session was running; restart it to keep using /tree.", {
30
+ if (running === undefined || running.version === "0.10.11-alpha.1") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.1 while this session was running; restart it to keep using /tree.", {
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-alpha.2`;
9
+ const key = `${root.href}#0.10.11-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.10-alpha.2") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.10-alpha.2 while this session was running; restart it to keep using /tree.", {
30
+ if (running === undefined || running.version === "0.10.11-alpha.1") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.1 while this session was running; restart it to keep using /tree.", {
32
32
  cause: error,
33
33
  });
34
34
  }
@@ -1,5 +1,5 @@
1
1
  import "../../../_shared/rolldown-runtime-BGM3D5V3.js";
2
- import { read, readValue, skip, stringValue } from "../../../_shared/startup-0-5-FD2P735I.js";
2
+ import { read, readValue, skip, stringValue } from "../../../_shared/startup-0-5-YDW47QX6.js";
3
3
  // dist/core/storage/session/tree-presentation.js
4
4
  var FoldMatches = class FoldMatches {
5
5
  tail = "";
@@ -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-alpha.2`;
9
+ const key = `${root.href}#0.10.11-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.10-alpha.2") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.10-alpha.2 while this session was running; restart it to keep using /tree.", {
30
+ if (running === undefined || running.version === "0.10.11-alpha.1") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.1 while this session was running; restart it to keep using /tree.", {
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-alpha.2`;
9
+ const key = `${root.href}#0.10.11-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.10-alpha.2") throw error;
31
- throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.10-alpha.2 while this session was running; restart it to keep using /tree.", {
30
+ if (running === undefined || running.version === "0.10.11-alpha.1") throw error;
31
+ throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.1 while this session was running; restart it to keep using /tree.", {
32
32
  cause: error,
33
33
  });
34
34
  }
@@ -499,6 +499,14 @@ export interface SessionForkRow {
499
499
  readonly edits?: Readonly<Record<string, string | null>>;
500
500
  readonly extraToolCalls?: number;
501
501
  readonly inlineSnapshot?: true;
502
+ /**
503
+ * Where the source stores this row unchanged: no edits, the source's own bytes. A destination that shares the source's
504
+ * tables may copy the stored row instead of writing `entry` (#6560).
505
+ */
506
+ readonly stored?: {
507
+ readonly sessionId: string;
508
+ readonly seq: number;
509
+ };
502
510
  }
503
511
  export interface SessionForkStream {
504
512
  /** A whole saved session in append order, with sibling branches and labels unchanged. */
@@ -545,6 +553,12 @@ export interface SessionStore {
545
553
  /** The bytes the session stored under `hash`, or `undefined` when it holds none. Absent with `putBlob`. */
546
554
  getBlob?(sessionId: string, hash: string): Promise<Uint8Array | undefined>;
547
555
  create(header: SessionRecordHeader, entries: readonly SessionEntry[]): Promise<SessionWriteResult>;
556
+ /**
557
+ * Adds `entries` after `expectSeq`, or rejects with `SessionConflictError` when the session has moved past it. A
558
+ * failure with the `unknown` outcome may have committed, even later than a read made after it. So a caller that sends
559
+ * the same entries again must take a `SessionConflictError` as possibly its own commit: it checks the store for its
560
+ * entry ids before it writes them after the new tail, as `SessionManager` does (#4970).
561
+ */
548
562
  append(sessionId: string, entries: readonly SessionEntry[], options: SessionWriteOptions): Promise<{
549
563
  readonly lastSeq: number;
550
564
  }>;
@@ -46,6 +46,12 @@ export interface SqliteDriverTransactionOptions {
46
46
  readonly concurrency: TransactionConcurrency;
47
47
  /** The transaction's `SqliteTransactionOptions.lockWaitMs`, when it set one. */
48
48
  readonly lockWaitMs?: number;
49
+ /**
50
+ * Optional. `SqliteTransactionOptions.leading`, with parameters snapshotted and none holding NUL: a driver with
51
+ * `pipelinedTransactions` may send them with the begin and answer the transaction's first calls that make them, in
52
+ * order, from what it got. A call that differs from the next of them ends the lead.
53
+ */
54
+ readonly leading?: readonly SqliteStatement[];
49
55
  }
50
56
  /** The driver calls `createSqliteDatabase` turns into a `SqliteDatabase`. */
51
57
  export interface SqliteDriver extends SqliteDriverExecutor {
@@ -54,15 +60,29 @@ export interface SqliteDriver extends SqliteDriverExecutor {
54
60
  /** The SQL dialect the driver speaks; SQLite when absent. The facade exposes it as `SqliteDatabase.dialect`. */
55
61
  readonly dialect?: StorageDialect;
56
62
  /**
57
- * Optional. The driver runs `fenced` transactions on connections of their own, concurrently with other calls: the
58
- * facade then starts them without waiting for queued calls. Otherwise every transaction waits its turn.
63
+ * Optional. The driver runs transactions on connections of their own, concurrently with other calls: the facade then
64
+ * starts `fenced` transactions without waiting for queued calls, and any other call once no earlier unfinished call
65
+ * conflicts with it (`ScopeQueue`). Otherwise every call waits its turn.
59
66
  */
60
67
  readonly concurrentTransactions?: boolean;
68
+ /**
69
+ * Optional. The driver runs reads on connections or streams of their own, up to this many at once: the facade then
70
+ * lets read-only transactions, and statements outside a transaction that `readsOnly` accepts, run beside each other,
71
+ * while every other call still waits for each call before it, as without it, and a read waits for the writes queued
72
+ * before it. A positive integer; anything else runs every call in turn. A driver with `concurrentTransactions` runs at
73
+ * most this many reads at once when it sets it.
74
+ */
75
+ readonly concurrentReads?: number;
76
+ /**
77
+ * Optional. Whether `sql`, run outside a transaction, only reads: with `concurrentReads` or `concurrentTransactions`,
78
+ * such a statement runs beside other reads. Answer true only for a statement that can never write.
79
+ */
80
+ readsOnly?(sql: string): boolean;
61
81
  /**
62
82
  * Optional. A transaction's connection takes a statement before the one before it is answered, and runs them in the
63
83
  * order it took them (a pipelined connection): the facade then sends each call of a transaction as it is made, so a
64
- * body that makes several calls without awaiting each sends them in one round trip. Otherwise each call waits for
65
- * the one before it to settle.
84
+ * body that makes several calls without awaiting each sends them in one round trip, and the transaction runs
85
+ * statement sequences (`sequenceRunner`) that way. Otherwise each call waits for the one before it to settle.
66
86
  */
67
87
  readonly pipelinedTransactions?: boolean;
68
88
  /**
@@ -78,6 +98,11 @@ export interface SqliteDriver extends SqliteDriverExecutor {
78
98
  * caller's, as `SqliteDatabase.batch` took them.
79
99
  */
80
100
  batch?(statements: readonly SqliteStatement[], options?: SqliteBatchOptions): Awaitable<readonly SqliteDriverResult[]>;
101
+ /**
102
+ * Optional. Opens a driver on this same database, on connections of its own, for reads: the facade offers it as
103
+ * `SqliteDatabase.openReader`, with a call queue of its own, and closes it when this driver's database closes.
104
+ */
105
+ openReader?(): Awaitable<SqliteDriver>;
81
106
  /** Releases the connection. Called once, after accepted work drains. */
82
107
  close(): Awaitable<void>;
83
108
  /** Removes credentials from diagnostic text: the descriptor location and driver failure messages and stacks. */
@@ -109,6 +134,12 @@ export interface SqliteDriver extends SqliteDriverExecutor {
109
134
  * database in a file this process can see, such as a local SQLite or libSQL file.
110
135
  */
111
136
  freeBytes?(): Awaitable<number | undefined>;
137
+ /**
138
+ * @internal Optional. Which database the driver reaches, which the facade exposes as
139
+ * `SqliteDatabase.databaseIdentity`: the same string from two drivers only when each one's transactions read and write
140
+ * the very tables the other's do. Undefined where that cannot be told, as for a database in memory.
141
+ */
142
+ databaseIdentity?(): string | undefined;
112
143
  }
113
144
  /**
114
145
  * How many times the facade runs a call that a transient failure ended before it wrote anything, the first run
@@ -150,7 +181,8 @@ export declare function configuredSecretRedactor(secrets: Iterable<string>, opti
150
181
  export declare function redactSecrets(secrets: Iterable<string>): (text: string) => string;
151
182
  /**
152
183
  * Wraps a SQLite-compatible driver as a `SqliteDatabase`. The facade queues operations in call order and keeps them
153
- * outside active transactions, snapshots binary parameters at call time, rejects NUL text, returns safe-range integers
184
+ * outside active transactions (on a driver that runs transactions concurrently, only operations that conflict wait for
185
+ * each other), snapshots binary parameters at call time, rejects NUL text, returns safe-range integers
154
186
  * as numbers and blobs as `Uint8Array` copies, expires transaction handles when their callback settles, maps driver
155
187
  * failures to `StorageUnavailableError` with credentials redacted, and reports failed rollbacks with
156
188
  * `StorageRollbackError`. A failure the driver recognizes as transient is a `StorageTransientError`; a statement, a