@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
@@ -11,7 +11,7 @@ import { sqliteDialect } from "./dialect.js";
11
11
  import { payloadTooLargeKind, SQLITE_PAYLOAD_LIMITS, StorageAdapterLoadError, StorageConfigError, StorageInvalidTextError, StoragePayloadTooLargeError, StorageRollbackError, StorageTransactionClosedError, StorageUnavailableError, StorageUnsupportedOperationError, StorageWriteLockTimeoutError, StorageWriterQueueDegradedError, StorageWriterQueueUnusableError, StoreClosedError, } from "./errors.js";
12
12
  import { fileIdentity, fileIdentityAsync } from "./file-identity.js";
13
13
  import { connectionWaits, currentHoldScope, forgetPlans, heldElsewhere, holdFile, inBacklog, modeOf, releaseHold, runDeferred, runInHold, runTryingFirst, runWhenFree, sqliteBusyError, useFileLock, useWrappedFile, } from "./node-sqlite-file-gate.js";
14
- import { ThreadConnection, } from "./node-sqlite-thread.js";
14
+ import { STATEMENT_CACHE_SIZE, ThreadConnection, } from "./node-sqlite-thread.js";
15
15
  import { MAX_SEQUENCE_REQUEST_STATEMENTS, offerSequences, } from "./statement-sequence.js";
16
16
  import { configureConnection, isSqliteBusy, switchToWriteAheadLogSync } from "./write-ahead-log.js";
17
17
  /** Loaded at the first degradation only, so opening a database does not load debug output. */
@@ -1087,9 +1087,13 @@ function normalizeRow(row) {
1087
1087
  class CallerThreadConnection {
1088
1088
  connection;
1089
1089
  ownsConnection;
1090
+ /** Statements kept for reuse; only on a connection of its own, so a caller's connection holds none of them. */
1091
+ prepared;
1090
1092
  constructor(connection, ownsConnection) {
1091
1093
  this.connection = connection;
1092
1094
  this.ownsConnection = ownsConnection;
1095
+ if (ownsConnection)
1096
+ this.prepared = new Map();
1093
1097
  }
1094
1098
  request(request) {
1095
1099
  switch (request.kind) {
@@ -1126,6 +1130,7 @@ class CallerThreadConnection {
1126
1130
  throw error;
1127
1131
  }
1128
1132
  case "close":
1133
+ this.prepared?.clear();
1129
1134
  if (this.ownsConnection)
1130
1135
  this.connection.close();
1131
1136
  finalizeReleasedStatements();
@@ -1133,8 +1138,19 @@ class CallerThreadConnection {
1133
1138
  }
1134
1139
  }
1135
1140
  statement(sql) {
1141
+ const cached = this.prepared?.get(sql);
1142
+ if (cached !== undefined) {
1143
+ this.prepared.delete(sql);
1144
+ this.prepared.set(sql, cached);
1145
+ return cached;
1146
+ }
1136
1147
  const prepared = this.connection.prepare(sql);
1137
1148
  prepared.setReadBigInts(true);
1149
+ if (this.prepared !== undefined) {
1150
+ this.prepared.set(sql, prepared);
1151
+ if (this.prepared.size > STATEMENT_CACHE_SIZE)
1152
+ this.prepared.delete(this.prepared.keys().next().value);
1153
+ }
1138
1154
  return prepared;
1139
1155
  }
1140
1156
  /** One `BEGIN IMMEDIATE` that does not wait for a busy lock; see `NodeSqliteDatabase.tryBegin`. */
@@ -1239,6 +1255,11 @@ class NodeSqliteDatabase {
1239
1255
  closing = false;
1240
1256
  closePromise;
1241
1257
  executor;
1258
+ openReader;
1259
+ /** Readers this database opened and that are not closed; closing closes them. */
1260
+ readers = new Set();
1261
+ /** Called once this database closed. */
1262
+ closed;
1242
1263
  transactionIdentity;
1243
1264
  lockWaitMs;
1244
1265
  groupCommitHoldMs;
@@ -1287,6 +1308,12 @@ class NodeSqliteDatabase {
1287
1308
  this.holderRecord = new SqliteHolderRecord(transactionIdentity, (cause) => this.degraded("holder-record-unavailable", cause));
1288
1309
  }
1289
1310
  }
1311
+ /** The database file's canonical path; undefined for a database in memory or a caller's wrapped connection. */
1312
+ databaseIdentity() {
1313
+ return typeof this.transactionIdentity === "string"
1314
+ ? JSON.stringify(["sqlite", this.transactionIdentity])
1315
+ : undefined;
1316
+ }
1290
1317
  supportsJsonbExtract() {
1291
1318
  // Bun on macOS loads the system SQLite. Its functions need not match the build-time version.
1292
1319
  this.jsonbExtract ??= this.enqueueStatement(() => this.executor.checkJsonbExtract(), true).catch(() => {
@@ -2024,10 +2051,29 @@ class NodeSqliteDatabase {
2024
2051
  // SQLite already rolled the transaction back; there is nothing left to undo.
2025
2052
  }
2026
2053
  }
2054
+ /**
2055
+ * Offers `openReader`: each reader is a connection of its own to the database's file, which `open` opens, with a
2056
+ * call queue of its own; in WAL mode it reads the last commit without waiting for this connection's writes.
2057
+ */
2058
+ offerReaders(open) {
2059
+ this.openReader = async () => {
2060
+ if (this.closing)
2061
+ throw new StoreClosedError(this.descriptor);
2062
+ const reader = (await open());
2063
+ if (this.closing) {
2064
+ await reader.close();
2065
+ throw new StoreClosedError(this.descriptor);
2066
+ }
2067
+ this.readers.add(reader);
2068
+ reader.closed = () => this.readers.delete(reader);
2069
+ return reader;
2070
+ };
2071
+ }
2027
2072
  close() {
2028
2073
  if (!this.closePromise) {
2029
2074
  this.closing = true;
2030
- this.closePromise = this.tail.then(async () => {
2075
+ const readers = Promise.allSettled([...this.readers].map((reader) => reader.close()));
2076
+ this.closePromise = Promise.all([this.tail, readers]).then(async () => {
2031
2077
  try {
2032
2078
  if (this.fileGate?.role === "waits")
2033
2079
  forgetPlans(this.fileGate.file, this.connection);
@@ -2038,6 +2084,7 @@ class NodeSqliteDatabase {
2038
2084
  this.wrappedUse?.release();
2039
2085
  this.fileLock?.release();
2040
2086
  await releaseOpenLock(this.openLock);
2087
+ this.closed?.();
2041
2088
  }
2042
2089
  });
2043
2090
  }
@@ -2150,6 +2197,8 @@ export async function openNodeSqliteDatabase(path, { busyTimeoutMs = 5000, lockW
2150
2197
  : undefined;
2151
2198
  const database = new NodeSqliteDatabase(connection, descriptor, identity, lockWaitMs, holdMs, heldOpenLock, gateFile === undefined ? undefined : { file: gateFile, role: "holds" });
2152
2199
  Object.defineProperty(database, "readOnly", { value: readOnly });
2200
+ if (!isInMemoryDatabase(path))
2201
+ database.offerReaders(() => openNodeSqliteDatabase(path, { busyTimeoutMs, readOnly: true }));
2153
2202
  opening = database;
2154
2203
  const [configuredSettings] = await Promise.allSettled([
2155
2204
  settings,
@@ -2228,7 +2277,7 @@ function __atomicOnDemandFailed(error, feature) {
2228
2277
  return (async () => {
2229
2278
  const root = new URL("../../", import.meta.url);
2230
2279
  const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
2231
- const key = `${root.href}#0.10.10-alpha.2`;
2280
+ const key = `${root.href}#0.10.11-alpha.1`;
2232
2281
  let release = releases.get(key);
2233
2282
  if (release === undefined) {
2234
2283
  const current = (async () => {
@@ -2256,7 +2305,7 @@ function __atomicOnDemandFailed(error, feature) {
2256
2305
  } catch {
2257
2306
  // No installation to read, as in a bundle of the package: the release the process runs decides.
2258
2307
  }
2259
- const updatedTo = typeof installed === "string" && installed !== "0.10.10-alpha.2" ? installed : running !== undefined && running.version !== "0.10.10-alpha.2" ? "0.10.10-alpha.2" : undefined;
2308
+ const updatedTo = typeof installed === "string" && installed !== "0.10.11-alpha.1" ? installed : running !== undefined && running.version !== "0.10.11-alpha.1" ? "0.10.11-alpha.1" : undefined;
2260
2309
  if (updatedTo === undefined) throw error;
2261
2310
  const application = typeof running?.name === "string" ? running.name : "atomic";
2262
2311
  const restart = new Error(`${application} was updated to ${updatedTo} while this session was running; restart it to keep using ${feature}.`, {