@bastani/atomic 0.10.11-alpha.2 → 0.10.11

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 (447) hide show
  1. package/CHANGELOG.md +307 -0
  2. package/README.md +5 -8
  3. package/dist/_shared/dist-KOELCESV.js +2 -2
  4. package/dist/_shared/fork-row-index-UAUAQRD5.js +2 -2
  5. package/dist/_shared/lib-4PES5P4V.js +2 -2
  6. package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js +6 -6
  7. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +5 -5
  8. package/dist/_shared/mode-shared-2QJSCUM6.js +6 -6
  9. package/dist/_shared/p0-cli-BB45ZQY6.js +46 -67
  10. package/dist/_shared/p0-cli-BB45ZQY6.js.map +1 -1
  11. package/dist/_shared/p1a-prewarm-XIU57JHF.js +7 -8
  12. package/dist/_shared/p1a-prewarm-XIU57JHF.js.map +1 -1
  13. package/dist/_shared/{p1b-elig-ENCUPKKJ.js → p1b-elig-TVB5CBLL.js} +36 -8
  14. package/dist/_shared/p1b-elig-TVB5CBLL.js.map +1 -0
  15. package/dist/_shared/p2-shell-main-B2WIALFD.js +6 -3
  16. package/dist/_shared/p2-shell-main-B2WIALFD.js.map +1 -1
  17. package/dist/_shared/runtime-O4KCSG4C.js +3 -3
  18. package/dist/_shared/{sdk-IQMULKFU.js → sdk-B5LEWGGI.js} +1218 -657
  19. package/dist/_shared/sdk-B5LEWGGI.js.map +1 -0
  20. package/dist/_shared/session-data-AHTU7IS6.js +2 -2
  21. package/dist/_shared/session-manager-list-2BLEEZVG.js +1 -1
  22. package/dist/_shared/{startup-0-0-3IXNMFM2.js → startup-0-0-XJJDOIEC.js} +50 -48
  23. package/dist/_shared/startup-0-0-XJJDOIEC.js.map +1 -0
  24. package/dist/_shared/{startup-0-1-7T2IAE7J.js → startup-0-1-M6OWAYHH.js} +540 -136
  25. package/dist/_shared/startup-0-1-M6OWAYHH.js.map +1 -0
  26. package/dist/_shared/startup-0-2-5QHPCEON.js +47 -48
  27. package/dist/_shared/startup-0-2-5QHPCEON.js.map +1 -1
  28. package/dist/_shared/startup-0-3-4ZYBYQNM.js +5 -5
  29. package/dist/_shared/startup-0-4-ZMJV547D.js +12 -7
  30. package/dist/_shared/startup-0-4-ZMJV547D.js.map +1 -1
  31. package/dist/_shared/startup-0-5-YDW47QX6.js +7 -7
  32. package/dist/_shared/startup-0-5-YDW47QX6.js.map +1 -1
  33. package/dist/_shared/startup-10-0-TDQNBDDL.js +6 -6
  34. package/dist/_shared/startup-12-0-55AAXBJZ.js +2 -2
  35. package/dist/_shared/startup-14-0-MLX36RBG.js +4 -5
  36. package/dist/_shared/startup-14-0-MLX36RBG.js.map +1 -1
  37. package/dist/_shared/startup-15-0-YUKGAC63.js +4 -4
  38. package/dist/_shared/startup-15-1-4S7FLMNG.js +19 -27
  39. package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
  40. package/dist/_shared/startup-8-0-34CBHPZH.js +2144 -249
  41. package/dist/_shared/startup-8-0-34CBHPZH.js.map +1 -1
  42. package/dist/_shared/{startup-8-1-X32CYSXB.js → startup-8-1-LZFXSD3Z.js} +98 -1184
  43. package/dist/_shared/startup-8-1-LZFXSD3Z.js.map +1 -0
  44. package/dist/_shared/storage-command-7MGXLJGZ.js +188 -37
  45. package/dist/_shared/storage-command-7MGXLJGZ.js.map +1 -1
  46. package/dist/_shared/storage-status-K7PX2RXA.js +557 -0
  47. package/dist/_shared/storage-status-K7PX2RXA.js.map +1 -0
  48. package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
  49. package/dist/_shared/team-DOQKICG2.js +376 -0
  50. package/dist/_shared/team-DOQKICG2.js.map +1 -0
  51. package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
  52. package/dist/builtin/intercom/CHANGELOG.md +88 -0
  53. package/dist/builtin/intercom/README.md +2 -2
  54. package/dist/builtin/intercom/broker/broker.bundle.mjs +1917 -381
  55. package/dist/builtin/intercom/broker/client.ts +8 -0
  56. package/dist/builtin/intercom/broker/database-wake-up-bus.ts +324 -68
  57. package/dist/builtin/intercom/broker/multinode-router.ts +256 -39
  58. package/dist/builtin/intercom/broker/multinode-state-store.ts +71 -5
  59. package/dist/builtin/intercom/broker/open-broker-state.ts +14 -0
  60. package/dist/builtin/intercom/broker/send-order-gate.ts +5 -2
  61. package/dist/builtin/intercom/broker/sql-add-column.ts +50 -5
  62. package/dist/builtin/intercom/broker/sql-ended-child-queue-store.ts +3 -2
  63. package/dist/builtin/intercom/broker/sql-held-send-store.ts +2 -2
  64. package/dist/builtin/intercom/broker/sql-known-session-store.ts +43 -19
  65. package/dist/builtin/intercom/broker/sql-lease-store.ts +473 -121
  66. package/dist/builtin/intercom/broker/sql-outbox-store.ts +821 -79
  67. package/dist/builtin/intercom/broker/sql-pending-ask-store.ts +8 -5
  68. package/dist/builtin/intercom/broker/sql-released-ask-store.ts +12 -5
  69. package/dist/builtin/intercom/broker/sql-restoring-reservation-store.ts +256 -8
  70. package/dist/builtin/intercom/broker/sql-retention.ts +150 -0
  71. package/dist/builtin/intercom/broker/sql-schema.ts +175 -24
  72. package/dist/builtin/intercom/broker/sql-sent-message-authority.ts +74 -19
  73. package/dist/builtin/intercom/broker/wake-up-bus.ts +6 -0
  74. package/dist/builtin/intercom/index.bundle.mjs +14 -4
  75. package/dist/builtin/intercom/package.json +1 -1
  76. package/dist/builtin/mcp/index.bundle.mjs +1 -1
  77. package/dist/builtin/mcp/package.json +1 -1
  78. package/dist/builtin/subagents/CHANGELOG.md +20 -0
  79. package/dist/builtin/subagents/package.json +1 -1
  80. package/dist/builtin/subagents/skills/skill-creator/eval-viewer/generate_review.py +8 -1
  81. package/dist/builtin/subagents/src/extension/index.bundle.mjs +1 -1
  82. package/dist/builtin/web-access/index.bundle.mjs +2 -10
  83. package/dist/builtin/web-access/package.json +1 -1
  84. package/dist/bun/bundled-sqlite.js +41 -0
  85. package/dist/bun/bundled-sqlite.js.map +1 -0
  86. package/dist/cli/args.js +2 -2
  87. package/dist/cli/auth-cli.code.js +4 -4
  88. package/dist/cli/auth-cli.impl.js +3 -3
  89. package/dist/cli/auth-cli.js +3 -3
  90. package/dist/cli/blueprint-command.code.js +3 -3
  91. package/dist/cli/blueprint-command.impl.js +3 -3
  92. package/dist/cli/blueprint-command.js +3 -3
  93. package/dist/cli/intercom-command.code.js +3 -3
  94. package/dist/cli/intercom-command.code.js.map +1 -1
  95. package/dist/cli/intercom-command.impl.js +3 -3
  96. package/dist/cli/intercom-command.js +3 -3
  97. package/dist/cli/list-models.code.js +2 -2
  98. package/dist/cli/list-models.impl.js +3 -3
  99. package/dist/cli/list-models.js +3 -3
  100. package/dist/cli/session-picker.code.js +1 -1
  101. package/dist/cli/session-picker.impl.js +3 -3
  102. package/dist/cli/session-picker.js +3 -3
  103. package/dist/cli/startup-ui.code.js +1 -1
  104. package/dist/cli/startup-ui.impl.js +3 -3
  105. package/dist/cli/startup-ui.js +3 -3
  106. package/dist/cli/storage-command.impl.js +3 -3
  107. package/dist/cli/storage-command.js +3 -3
  108. package/dist/cli/storage-search-session.code.js +3 -3
  109. package/dist/cli/storage-search-session.impl.js +3 -3
  110. package/dist/cli/storage-search-session.js +3 -3
  111. package/dist/cli/team-command.code.js +19 -113
  112. package/dist/cli/team-command.code.js.map +1 -1
  113. package/dist/cli/team-command.impl.js +3 -3
  114. package/dist/cli/team-command.js +3 -3
  115. package/dist/cli.js +5 -18
  116. package/dist/cli.js.map +1 -1
  117. package/dist/core/agent-rehydrate-errors.d.ts +4 -9
  118. package/dist/core/compaction/compactor.d.ts +3 -3
  119. package/dist/core/debug.code.js +1 -1
  120. package/dist/core/debug.impl.js +3 -3
  121. package/dist/core/debug.js +3 -3
  122. package/dist/core/export-html/card-projection.impl.js +3 -3
  123. package/dist/core/export-html/card-projection.js +3 -3
  124. package/dist/core/export-html/index.code.js +4 -4
  125. package/dist/core/export-html/index.code.js.map +1 -1
  126. package/dist/core/export-html/index.impl.js +3 -3
  127. package/dist/core/export-html/index.js +3 -3
  128. package/dist/core/export-html/json-spans.impl.js +3 -3
  129. package/dist/core/export-html/json-spans.js +3 -3
  130. package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
  131. package/dist/core/export-html/oversized-render-inputs.js +3 -3
  132. package/dist/core/export-html/tool-renderer.impl.js +3 -3
  133. package/dist/core/export-html/tool-renderer.js +3 -3
  134. package/dist/core/extensions/jiti-loader.impl.js +3 -3
  135. package/dist/core/extensions/jiti-loader.js +3 -3
  136. package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
  137. package/dist/core/extensions/jiti-static-loader.js +3 -3
  138. package/dist/core/extensions/loader-host-modules.code.js +1 -1
  139. package/dist/core/extensions/loader-host-modules.impl.js +3 -3
  140. package/dist/core/extensions/loader-host-modules.js +3 -3
  141. package/dist/core/extensions/loader-virtual-modules.js +1 -1
  142. package/dist/core/extensions/runner-context.js +2 -2
  143. package/dist/core/intercom-broker-control-host.code.js +2 -2
  144. package/dist/core/intercom-broker-control-host.impl.js +3 -3
  145. package/dist/core/intercom-broker-control-host.js +3 -3
  146. package/dist/core/intercom-broker-control.code.js +3 -3
  147. package/dist/core/intercom-broker-control.impl.js +3 -3
  148. package/dist/core/intercom-broker-control.js +3 -3
  149. package/dist/core/package-manager-storage-adapters.code.js +1 -1
  150. package/dist/core/package-manager-storage-adapters.impl.js +3 -3
  151. package/dist/core/package-manager-storage-adapters.js +3 -3
  152. package/dist/core/process-start-token.d.ts +12 -3
  153. package/dist/core/process-tree-containment.d.ts +16 -0
  154. package/dist/core/sdk-types.d.ts +1 -2
  155. package/dist/core/sdk-types.js.map +1 -1
  156. package/dist/core/sdk.code.js +3 -3
  157. package/dist/core/sdk.impl.js +3 -3
  158. package/dist/core/sdk.js +3 -3
  159. package/dist/core/session-manager-core.js +5 -5
  160. package/dist/core/session-manager-list.impl.js +3 -3
  161. package/dist/core/session-manager-list.js +3 -3
  162. package/dist/core/session-manager.code.js +1 -1
  163. package/dist/core/session-manager.impl.js +3 -3
  164. package/dist/core/session-manager.js +3 -3
  165. package/dist/core/session-storage.code.js +1 -1
  166. package/dist/core/session-storage.impl.js +3 -3
  167. package/dist/core/session-storage.js +3 -3
  168. package/dist/core/settings-schema.d.ts +0 -3
  169. package/dist/core/storage/added-exports-0-10-11.js +19 -0
  170. package/dist/core/storage/added-exports-0-10-11.js.map +1 -0
  171. package/dist/core/storage/creation-time.js +105 -0
  172. package/dist/core/storage/creation-time.js.map +1 -0
  173. package/dist/core/storage/database.d.ts +25 -5
  174. package/dist/core/storage/database.js.map +1 -1
  175. package/dist/core/storage/dialect.d.ts +1 -1
  176. package/dist/core/storage/dialect.js +1 -1
  177. package/dist/core/storage/dialect.js.map +1 -1
  178. package/dist/core/storage/errors.d.ts +13 -13
  179. package/dist/core/storage/errors.js +10 -16
  180. package/dist/core/storage/errors.js.map +1 -1
  181. package/dist/core/storage/fenced-paths.d.ts +18 -6
  182. package/dist/core/storage/fenced-paths.js +18 -6
  183. package/dist/core/storage/fenced-paths.js.map +1 -1
  184. package/dist/core/storage/file-identity.d.ts +2 -0
  185. package/dist/core/storage/file-identity.js +24 -8
  186. package/dist/core/storage/file-identity.js.map +1 -1
  187. package/dist/core/storage/index.d.ts +3 -2
  188. package/dist/core/storage/index.js +5 -3
  189. package/dist/core/storage/index.js.map +1 -1
  190. package/dist/core/storage/libsql-removed.d.ts +71 -0
  191. package/dist/core/storage/libsql-removed.js +123 -0
  192. package/dist/core/storage/libsql-removed.js.map +1 -0
  193. package/dist/core/storage/migrations.d.ts +78 -14
  194. package/dist/core/storage/migrations.js +375 -49
  195. package/dist/core/storage/migrations.js.map +1 -1
  196. package/dist/core/storage/node-sqlite-file-gate.js +0 -15
  197. package/dist/core/storage/node-sqlite-file-gate.js.map +1 -1
  198. package/dist/core/storage/node-sqlite-thread.js +215 -30
  199. package/dist/core/storage/node-sqlite-thread.js.map +1 -1
  200. package/dist/core/storage/node-sqlite.js +484 -72
  201. package/dist/core/storage/node-sqlite.js.map +1 -1
  202. package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
  203. package/dist/core/storage/offline-snapshot-file.js +3 -3
  204. package/dist/core/storage/prefix.d.ts +1 -1
  205. package/dist/core/storage/prefix.js +9 -2
  206. package/dist/core/storage/prefix.js.map +1 -1
  207. package/dist/core/storage/process-selection.d.ts +5 -5
  208. package/dist/core/storage/provider.js +2 -2
  209. package/dist/core/storage/schema-catalog.d.ts +76 -15
  210. package/dist/core/storage/schema-catalog.js +359 -68
  211. package/dist/core/storage/schema-catalog.js.map +1 -1
  212. package/dist/core/storage/selection.d.ts +7 -82
  213. package/dist/core/storage/selection.js +20 -235
  214. package/dist/core/storage/selection.js.map +1 -1
  215. package/dist/core/storage/session/branch-fork-source.code.js +2 -2
  216. package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
  217. package/dist/core/storage/session/branch-fork-source.js +3 -3
  218. package/dist/core/storage/session/card-view.impl.js +3 -3
  219. package/dist/core/storage/session/card-view.js +3 -3
  220. package/dist/core/storage/session/child-reader.code.js +3 -3
  221. package/dist/core/storage/session/child-reader.impl.js +3 -3
  222. package/dist/core/storage/session/child-reader.js +3 -3
  223. package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
  224. package/dist/core/storage/session/chunked-resume-projection.js +3 -3
  225. package/dist/core/storage/session/expanded-child-details.code.js +2 -2
  226. package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
  227. package/dist/core/storage/session/expanded-child-details.js +3 -3
  228. package/dist/core/storage/session/fork-detach.d.ts +11 -1
  229. package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
  230. package/dist/core/storage/session/fork-row-bytes.js +3 -3
  231. package/dist/core/storage/session/fork-row-index.impl.js +3 -3
  232. package/dist/core/storage/session/fork-row-index.js +3 -3
  233. package/dist/core/storage/session/fork-staging.code.js +4 -7
  234. package/dist/core/storage/session/fork-staging.code.js.map +1 -1
  235. package/dist/core/storage/session/fork-staging.impl.js +3 -3
  236. package/dist/core/storage/session/fork-staging.js +3 -3
  237. package/dist/core/storage/session/fork-sweep.js +31 -7
  238. package/dist/core/storage/session/fork-sweep.js.map +1 -1
  239. package/dist/core/storage/session/fork-window.code.js +3 -3
  240. package/dist/core/storage/session/fork-window.impl.js +3 -3
  241. package/dist/core/storage/session/fork-window.js +3 -3
  242. package/dist/core/storage/session/history-pages.impl.js +3 -3
  243. package/dist/core/storage/session/history-pages.js +3 -3
  244. package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
  245. package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
  246. package/dist/core/storage/session/jsonl-session-lock.d.ts +100 -0
  247. package/dist/core/storage/session/jsonl-session-store.d.ts +46 -24
  248. package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
  249. package/dist/core/storage/session/jsonl-session-store.js +3 -3
  250. package/dist/core/storage/session/memory-session-store.impl.js +3 -3
  251. package/dist/core/storage/session/memory-session-store.js +3 -3
  252. package/dist/core/storage/session/pinned-branch-resume.code.js +3 -3
  253. package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
  254. package/dist/core/storage/session/pinned-branch-resume.js +3 -3
  255. package/dist/core/storage/session/released-history-files.code.js +9 -9
  256. package/dist/core/storage/session/released-history-files.code.js.map +1 -1
  257. package/dist/core/storage/session/released-history-files.impl.js +3 -3
  258. package/dist/core/storage/session/released-history-files.js +3 -3
  259. package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
  260. package/dist/core/storage/session/resident-fork-rows.js +3 -3
  261. package/dist/core/storage/session/session-resume.impl.js +3 -3
  262. package/dist/core/storage/session/session-resume.js +3 -3
  263. package/dist/core/storage/session/session-search-index.d.ts +52 -5
  264. package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
  265. package/dist/core/storage/session/snapshot-cut.js +3 -3
  266. package/dist/core/storage/session/snapshot-history.code.js +3 -3
  267. package/dist/core/storage/session/snapshot-history.impl.js +3 -3
  268. package/dist/core/storage/session/snapshot-history.js +3 -3
  269. package/dist/core/storage/session/sql-session-store.code.js +1 -1
  270. package/dist/core/storage/session/sql-session-store.d.ts +99 -18
  271. package/dist/core/storage/session/sql-session-store.impl.js +3 -3
  272. package/dist/core/storage/session/sql-session-store.js +3 -3
  273. package/dist/core/storage/session/tree-outline.impl.js +3 -3
  274. package/dist/core/storage/session/tree-outline.js +3 -3
  275. package/dist/core/storage/session/tree-presentation.impl.js +3 -3
  276. package/dist/core/storage/session/tree-presentation.js +3 -3
  277. package/dist/core/storage/sqlite-facade.d.ts +12 -1
  278. package/dist/core/storage/sqlite-facade.js +310 -33
  279. package/dist/core/storage/sqlite-facade.js.map +1 -1
  280. package/dist/core/storage/sqlite-open-batch.js +10 -0
  281. package/dist/core/storage/sqlite-open-batch.js.map +1 -0
  282. package/dist/core/storage/storage-status.code.js +1 -1
  283. package/dist/core/storage/storage-status.impl.js +3 -3
  284. package/dist/core/storage/storage-status.js +3 -3
  285. package/dist/core/storage/team.code.js +1 -1
  286. package/dist/core/storage/team.d.ts +26 -115
  287. package/dist/core/storage/team.impl.js +3 -3
  288. package/dist/core/storage/team.js +3 -3
  289. package/dist/core/structured-output/index.code.js +1 -1
  290. package/dist/core/structured-output/index.impl.js +3 -3
  291. package/dist/core/structured-output/index.js +3 -3
  292. package/dist/core/tasks/task-completion-entry.impl.js +3 -3
  293. package/dist/core/tasks/task-completion-entry.js +3 -3
  294. package/dist/core/tasks/task-file-history.code.js +3 -3
  295. package/dist/core/tasks/task-file-history.impl.js +3 -3
  296. package/dist/core/tasks/task-file-history.js +3 -3
  297. package/dist/core/tasks/task-reference-archive.code.js +4 -4
  298. package/dist/core/tasks/task-reference-archive.js +3 -3
  299. package/dist/core/tasks/task-reference-identity.js +3 -3
  300. package/dist/core/tasks/task-reference-stream.impl.js +3 -3
  301. package/dist/core/tasks/task-reference-stream.js +3 -3
  302. package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
  303. package/dist/core/tasks/task-unsaved-answer.js +3 -3
  304. package/dist/core/tasks/task-view-source.code.js +1 -1
  305. package/dist/core/tasks/task-view-source.impl.js +3 -3
  306. package/dist/core/tasks/task-view-source.js +3 -3
  307. package/dist/core/tools/history-tasks.d.ts +3 -2
  308. package/dist/core/tools/read-url.code.js +4 -4
  309. package/dist/core/tools/read-url.impl.js +3 -3
  310. package/dist/core/tools/read-url.js +3 -3
  311. package/dist/core/worktree-snapshot/blob-store.d.ts +44 -5
  312. package/dist/core/worktree-snapshot/blob-store.js +553 -30
  313. package/dist/core/worktree-snapshot/blob-store.js.map +1 -1
  314. package/dist/core/worktree-snapshot/errors.code.js +2 -2
  315. package/dist/core/worktree-snapshot/errors.impl.js +3 -3
  316. package/dist/core/worktree-snapshot/errors.js +3 -3
  317. package/dist/core/worktree-snapshot/fork-blob-guard.js +81 -0
  318. package/dist/core/worktree-snapshot/fork-blob-guard.js.map +1 -0
  319. package/dist/core/worktree-snapshot/fork-snapshot-index.js +208 -50
  320. package/dist/core/worktree-snapshot/fork-snapshot-index.js.map +1 -1
  321. package/dist/core/worktree-snapshot/session-index-reset.code.js +4 -0
  322. package/dist/core/worktree-snapshot/session-index-reset.code.js.map +1 -1
  323. package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
  324. package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
  325. package/dist/extensions/codemode/execute.code.js +1 -1
  326. package/dist/extensions/codemode/execute.impl.js +3 -3
  327. package/dist/extensions/codemode/execute.js +3 -3
  328. package/dist/extensions/codemode/renderer.code.js +2 -2
  329. package/dist/extensions/codemode/renderer.impl.js +3 -3
  330. package/dist/extensions/codemode/renderer.js +3 -3
  331. package/dist/extensions/mcp/cli.code.js +3 -3
  332. package/dist/extensions/mcp/cli.impl.js +3 -3
  333. package/dist/extensions/mcp/cli.js +3 -3
  334. package/dist/extensions/mcp/cli.lazy.code.js +2 -2
  335. package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
  336. package/dist/extensions/mcp/cli.lazy.js +3 -3
  337. package/dist/extensions/mcp/runtime.code.js +1 -1
  338. package/dist/extensions/mcp/runtime.impl.js +3 -3
  339. package/dist/extensions/mcp/runtime.js +3 -3
  340. package/dist/index.d.ts +3 -1
  341. package/dist/index.js +5 -5
  342. package/dist/main-first-time-setup.code.js +1 -1
  343. package/dist/main-first-time-setup.impl.js +3 -3
  344. package/dist/main-first-time-setup.js +3 -3
  345. package/dist/main.js +1 -1
  346. package/dist/modes/interactive/components/stored-tree-view.code.js +2 -2
  347. package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
  348. package/dist/modes/interactive/components/stored-tree-view.js +3 -3
  349. package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
  350. package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
  351. package/dist/modes/interactive/startup-shell-eligibility.js +1 -1
  352. package/dist/modes/interactive-engine/engine-prewarm.d.ts +1 -1
  353. package/dist/modes/print-mode.js +1 -1
  354. package/dist/package-manager-cli.code.js +6 -6
  355. package/dist/package-manager-cli.impl.js +3 -3
  356. package/dist/package-manager-cli.js +3 -3
  357. package/dist/rpc-entry.js +1 -1
  358. package/dist/startup-files.json +1 -1
  359. package/dist/startup-stages/10.js +1 -1
  360. package/dist/startup-stages/11.js +1 -1
  361. package/dist/startup-stages/12.js +1 -1
  362. package/dist/startup-stages/2.js +2 -4
  363. package/dist/startup-stages/3.js +1 -3
  364. package/dist/startup-stages/4.js +1 -2
  365. package/dist/startup-stages/5.js +1 -1
  366. package/dist/startup-stages/6.js +5 -7
  367. package/dist/startup-stages/7.js +3 -10
  368. package/dist/startup-stages/8.js +7 -2
  369. package/dist/startup-stages/9.js +1 -7
  370. package/dist/startup-stages/stages.json +1 -1
  371. package/dist/utils/compile-cache-deferral.js +8 -13
  372. package/dist/utils/compile-cache-deferral.js.map +1 -1
  373. package/dist/utils/compile-cache-warmup-host.js +3 -4
  374. package/dist/utils/compile-cache-warmup-host.js.map +1 -1
  375. package/dist/utils/compile-cache.js +12 -100
  376. package/dist/utils/compile-cache.js.map +1 -1
  377. package/dist/utils/startup-database-spare.code.js +2 -2
  378. package/dist/utils/startup-database-spare.impl.js +3 -3
  379. package/dist/utils/startup-database-spare.js +3 -3
  380. package/dist/utils/tools-manager.code.js +1 -1
  381. package/dist/utils/tools-manager.impl.js +3 -3
  382. package/dist/utils/tools-manager.js +3 -3
  383. package/dist/utils/worker-threads.js +2 -15
  384. package/dist/utils/worker-threads.js.map +1 -1
  385. package/docs/build.md +3 -3
  386. package/docs/changelog.mdx +1498 -69
  387. package/docs/compaction/reference.md +5 -5
  388. package/docs/compaction.md +7 -9
  389. package/docs/containerization.md +2 -2
  390. package/docs/custom-provider/api-reference.md +1 -1
  391. package/docs/docs.json +37 -10
  392. package/docs/environment-variables.md +0 -2
  393. package/docs/extensions/api-reference.md +4 -4
  394. package/docs/getting-started/installation.md +3 -0
  395. package/docs/guides/configuration.md +1 -1
  396. package/docs/guides/non-interactive.md +1 -1
  397. package/docs/guides/resume-on-any-machine.md +14 -22
  398. package/docs/guides/team-setup.md +56 -83
  399. package/docs/guides.md +2 -4
  400. package/docs/herdr.md +1 -1
  401. package/docs/index.md +1 -1
  402. package/docs/intercom/operations.md +26 -21
  403. package/docs/intercom/reference.md +2 -2
  404. package/docs/intercom.md +1 -1
  405. package/docs/libraries/storage-postgres.md +9 -9
  406. package/docs/libraries.md +2 -3
  407. package/docs/models-configuration.md +2 -2
  408. package/docs/models.md +2 -3
  409. package/docs/packages/authoring.md +7 -7
  410. package/docs/packages.md +1 -1
  411. package/docs/programmatic.md +2 -2
  412. package/docs/quickstart.md +1 -1
  413. package/docs/reference/cli.md +6 -11
  414. package/docs/reference.md +2 -2
  415. package/docs/rpc/extension-ui.md +2 -2
  416. package/docs/sdk/reference.md +5 -4
  417. package/docs/sdk/storage.md +8 -92
  418. package/docs/sdk/structured-decisions.md +1 -1
  419. package/docs/sdk/web-server.md +3 -3
  420. package/docs/sdk.md +14 -4
  421. package/docs/security.md +1 -1
  422. package/docs/session-format.md +5 -5
  423. package/docs/sessions.md +29 -49
  424. package/docs/settings.md +7 -8
  425. package/docs/storage/custom-adapters.md +255 -0
  426. package/docs/storage/jsonl.md +117 -0
  427. package/docs/{guides/postgres-pgbouncer.md → storage/postgres/pgbouncer.md} +66 -68
  428. package/docs/storage/postgres/tuning.md +337 -0
  429. package/docs/storage/postgres.md +556 -0
  430. package/docs/storage/sqlite.md +99 -0
  431. package/docs/storage.md +326 -990
  432. package/docs/subagents/authoring.md +1 -1
  433. package/docs/subagents.md +2 -2
  434. package/docs/tools.md +1 -1
  435. package/docs/worktree-snapshots.md +2 -2
  436. package/package.json +9 -9
  437. package/schemas/models.schema.json +2 -2
  438. package/schemas/settings.schema.json +0 -14
  439. package/dist/_shared/p1b-elig-ENCUPKKJ.js.map +0 -1
  440. package/dist/_shared/sdk-IQMULKFU.js.map +0 -1
  441. package/dist/_shared/startup-0-0-3IXNMFM2.js.map +0 -1
  442. package/dist/_shared/startup-0-1-7T2IAE7J.js.map +0 -1
  443. package/dist/_shared/startup-8-1-X32CYSXB.js.map +0 -1
  444. package/dist/core/intercom-broker-control.d.ts +0 -129
  445. package/dist/startup-stages/13.js +0 -1
  446. package/docs/guides/postgres-tuning.md +0 -311
  447. package/docs/libraries/storage-libsql.md +0 -97
@@ -1,5 +1,12 @@
1
1
  import * as storage from "@bastani/atomic/storage";
2
- import { dialectOf, ensureStorageSchema, type SqliteDatabase, type SqliteExecutor, storageMigrationTable } from "@bastani/atomic/storage";
2
+ import {
3
+ dialectOf,
4
+ ensureStorageSchema,
5
+ type SqliteDatabase,
6
+ type SqliteExecutor,
7
+ type SqliteStatement,
8
+ storageMigrationTable,
9
+ } from "@bastani/atomic/storage";
3
10
 
4
11
  /**
5
12
  * `storageSchemaCurrent`, `schemaCatalogOf` and `withStorageSchemaCatalog` of the storage API, which an Atomic
@@ -9,10 +16,26 @@ import { dialectOf, ensureStorageSchema, type SqliteDatabase, type SqliteExecuto
9
16
  const catalogApi: Partial<
10
17
  Pick<
11
18
  typeof storage,
12
- "storageSchemaCurrent" | "schemaCatalogOf" | "withStorageSchemaCatalog" | "restampStorageSchemaAtOpenEnd"
19
+ | "storageSchemaCurrent"
20
+ | "schemaCatalogOf"
21
+ | "withStorageSchemaCatalog"
22
+ | "restampStorageSchemaAtOpenEnd"
23
+ | "refreshStorageSchemaCatalog"
24
+ | "setUpStorageOnce"
25
+ | "ensureStorageSchemaOnce"
26
+ | "queueSqliteSchemaSetup"
13
27
  >
14
28
  > = storage;
15
29
 
30
+ /**
31
+ * What every transaction of the broker's state asks of the database besides its locks: run again, after a short
32
+ * randomized wait, when a lock wait that outlasted the database's lock timeout, a deadlock or a serialization failure
33
+ * ended it before it wrote anything, rather than failing the send, renewal, claim or delivery it makes. A busy shared
34
+ * database ends one now and then even when nothing is wrong. Each callback only uses its transaction handle, so running
35
+ * it again repeats nothing else; a database that cannot tell what a failure applied ignores it.
36
+ */
37
+ export const RETRY_UNAPPLIED = { retryTransientFailures: true } as const;
38
+
16
39
  /**
17
40
  * Runs `open`, a broker store's open on `database`, with one read of the prefix's schema catalog, which its schema
18
41
  * checks answer from: a store whose schema is current opens with no schema transaction and no lock, whether the broker
@@ -29,16 +52,28 @@ export async function withBrokerSchemaCatalog<T>(
29
52
  return withCatalog === undefined ? open() : withCatalog(database, storageMigrationTable(prefix), open, views);
30
53
  }
31
54
 
55
+ /**
56
+ * Queues a SQLite schema setup into the broker open's active schema catalog scope so every needed store setup commits
57
+ * in one write transaction before the open returns (#6709). Returns false on PostgreSQL, outside an open scope, or on
58
+ * an Atomic installation older than #6709.
59
+ */
60
+ export function queueBrokerSqliteSetup(
61
+ database: SqliteDatabase,
62
+ prefix: string | undefined,
63
+ setup: storage.SqliteSchemaBatchSetup,
64
+ ): boolean {
65
+ const queue = catalogApi.queueSqliteSchemaSetup;
66
+ if (queue === undefined || dialectOf(database).versionedMigrations) return false;
67
+ return queue(database, prefix === undefined ? undefined : storageMigrationTable(prefix), setup);
68
+ }
69
+
32
70
  /**
33
71
  * Runs `setup`, a broker store's idempotent schema statements, in a transaction of its own, unless the prefix's ledger
34
72
  * records `revision` for `store` already (#5218): on PostgreSQL a current schema runs no DDL, so a role with only DML
35
73
  * privileges opens the store. Raise `revision` whenever `setup` creates or alters anything new. Inside an open that read
36
- * the catalog (`withStorageSchemaCatalog`), a revision it found recorded skips the transaction too (#6560). On SQLite and
37
- * libSQL the store's stamp records it. A setup that runs stamps nothing: later setups of the same open would leave its
38
- * stamp behind, and stamping costs a new database's first open statements and a transaction. The next open finds the
39
- * store in the catalog instead; there a setup whose objects the catalog holds is checked again, and a counter it seeds
40
- * seeded, in the one transaction the open's end stamps every such store in, so later opens of a current schema take no
41
- * write lock and answer every store from its stamp.
74
+ * the catalog (`withStorageSchemaCatalog`), a revision it found recorded skips the transaction too (#6560). On SQLite,
75
+ * setups needed within one open scope are queued and committed together in one write transaction with their stamps
76
+ * (#6709), so subsequent opens answer every store from its stamp with no write lock.
42
77
  */
43
78
  export async function ensureBrokerSchema(
44
79
  database: SqliteDatabase,
@@ -50,28 +85,141 @@ export async function ensureBrokerSchema(
50
85
  const schema = { ledger: storageMigrationTable(prefix), domain: `intercom-${store}`, revision };
51
86
  if (await catalogApi.storageSchemaCurrent?.(database, schema)) return;
52
87
  const found = await foundInCatalog(database, setup);
53
- if (found?.present === true) {
54
- const options = { verify: found.verify, deferred: found.seeds };
55
- if (catalogApi.restampStorageSchemaAtOpenEnd?.(database, schema, setup, options) === true) return;
56
- if (!found.seeds) return;
57
- }
58
88
  const dialect = dialectOf(database);
59
- await database.transaction(async (tx) => {
60
- if (!dialect.versionedMigrations) {
61
- await setup(tx);
62
- return;
63
- }
64
- await ensureStorageSchema(tx, dialect, schema, async () => {
89
+ if (
90
+ !dialect.versionedMigrations &&
91
+ queueBrokerSqliteSetup(database, prefix ?? "", {
92
+ stamp: schema,
93
+ verify: found?.verify,
94
+ run: async (ctx) => {
95
+ if (found !== undefined) {
96
+ if (ctx.catalog !== undefined && found.verify(ctx.catalog) && !found.seeds) return;
97
+ for (const script of found.scripts) ctx.enqueue(script);
98
+ for (const table of found.tables) ctx.noteTableCreated(table);
99
+ return;
100
+ }
101
+ await ctx.flushWrites();
102
+ await setup(ctx.tx);
103
+ },
104
+ })
105
+ )
106
+ return;
107
+ if (foundSetUp(database, schema, setup, found)) return;
108
+ // Idempotent, and run again when a busy database ended it before it wrote anything. Brokers that open a new
109
+ // database at once set each store up once: the others wait for it without its lock, and find
110
+ // it set up in the catalog they read again (#6560).
111
+ const ensureOnce = catalogApi.ensureStorageSchemaOnce;
112
+ if (dialect.versionedMigrations && ensureOnce !== undefined) {
113
+ await ensureOnce(database, schema, async (tx) => {
65
114
  await setup(tx);
66
115
  });
67
- });
116
+ return;
117
+ }
118
+ const once = catalogApi.setUpStorageOnce;
119
+ const refresh = catalogApi.refreshStorageSchemaCatalog;
120
+ const run = async (tx: SqliteExecutor) => {
121
+ if (!dialect.versionedMigrations) await setup(tx);
122
+ else
123
+ await ensureStorageSchema(tx, dialect, schema, async () => {
124
+ await setup(tx);
125
+ });
126
+ return "ran" as const;
127
+ };
128
+ const outcome =
129
+ dialect.versionedMigrations || once === undefined || refresh === undefined
130
+ ? await database.transaction(run, RETRY_UNAPPLIED)
131
+ : await once(database, {
132
+ locks: [],
133
+ done: async () => {
134
+ refresh(database);
135
+ if (await catalogApi.storageSchemaCurrent?.(database, schema)) return "found" as const;
136
+ return foundSetUp(database, schema, setup, await foundInCatalog(database, setup)) ? "found" : undefined;
137
+ },
138
+ setup: run,
139
+ concurrency: { kind: "serial" },
140
+ });
68
141
  // Stamped where the end of the open takes a transaction for other stores anyway, as after a repair or an upgrade.
69
- if (!dialect.versionedMigrations)
142
+ if (outcome === "ran" && !dialect.versionedMigrations)
70
143
  catalogApi.restampStorageSchemaAtOpenEnd?.(database, schema, setup, { verify: found?.verify, alongside: true });
71
144
  }
72
145
 
73
146
  /**
74
- * Asks the open of `database` in progress to stamp `store`'s `setup` at its end, on SQLite and libSQL, where the open
147
+ * Whether the ledger, or the catalog an open in progress read, records `revision` of `store`'s setup, without a
148
+ * transaction; false where the storage API cannot tell.
149
+ */
150
+ export async function brokerSchemaCurrent(
151
+ database: SqliteDatabase,
152
+ prefix: string | undefined,
153
+ store: string,
154
+ revision = 1,
155
+ ): Promise<boolean> {
156
+ const schema = { ledger: storageMigrationTable(prefix), domain: `intercom-${store}`, revision };
157
+ return (await catalogApi.storageSchemaCurrent?.(database, schema)) === true;
158
+ }
159
+
160
+ /**
161
+ * Whether `found`, what the open's catalog holds of a setup on SQLite ({@link foundInCatalog}), leaves the setup nothing
162
+ * to do now: every object it creates is there, and the open's end stamps it, or it seeds no rows. A setup that seeds
163
+ * rows, outside an open, still runs.
164
+ */
165
+ function foundSetUp(
166
+ database: SqliteDatabase,
167
+ schema: { readonly ledger: string; readonly domain: string; readonly revision: number },
168
+ setup: (tx: SqliteExecutor) => Promise<unknown>,
169
+ found: Awaited<ReturnType<typeof foundInCatalog>>,
170
+ ): boolean {
171
+ if (found?.present !== true) return false;
172
+ const options = { verify: found.verify, deferred: found.seeds };
173
+ return catalogApi.restampStorageSchemaAtOpenEnd?.(database, schema, setup, options) === true || !found.seeds;
174
+ }
175
+
176
+ /**
177
+ * Runs `setup`, schema statements no ledger records, such as columns a store adds, once among the brokers that open a
178
+ * new database at once: the one that takes the lock `scope` names runs it, and the others wait without it until `done`,
179
+ * read again outside any transaction, finds it done (#6560). Without the storage API for it, an installation older than
180
+ * #6560, it runs in a serial transaction of the whole database, as before.
181
+ */
182
+ export async function setUpBrokerSchemaOnce(
183
+ database: SqliteDatabase,
184
+ scope: string,
185
+ done: () => Promise<boolean>,
186
+ setup: (tx: SqliteExecutor) => Promise<unknown>,
187
+ /** The reads `setup` makes first, in this order: on PostgreSQL they go out with the transaction's start. */
188
+ leading: readonly SqliteStatement[] = [],
189
+ ): Promise<void> {
190
+ const once = catalogApi.setUpStorageOnce;
191
+ if (once === undefined) {
192
+ await database.transaction(setup, RETRY_UNAPPLIED);
193
+ return;
194
+ }
195
+ await once(database, {
196
+ locks: [{ scope }],
197
+ leading,
198
+ done: async () => ((await done()) ? true : undefined),
199
+ setup: async (tx) => {
200
+ await setup(tx);
201
+ return true;
202
+ },
203
+ concurrency: { kind: "serial" },
204
+ });
205
+ }
206
+
207
+ /**
208
+ * Whether the schema, read again into the catalog of the open in progress, satisfies `check`: for a setup another broker
209
+ * may have run since the open read it. False outside an open, and without the storage API to read it again.
210
+ */
211
+ export async function foundInCatalogAgain(
212
+ database: SqliteDatabase,
213
+ check: (catalog: storage.StorageSchemaCatalog) => boolean,
214
+ ): Promise<boolean> {
215
+ if (catalogApi.refreshStorageSchemaCatalog === undefined) return false;
216
+ catalogApi.refreshStorageSchemaCatalog(database);
217
+ const catalog = await openCatalogOf(database);
218
+ return catalog !== undefined && check(catalog);
219
+ }
220
+
221
+ /**
222
+ * Asks the open of `database` in progress to stamp `store`'s `setup` at its end, on SQLite, where the open
75
223
  * found the store current in the catalog, `verify` says, rather than by its stamp, which a schema change since left
76
224
  * behind: the next open then answers from the stamp (#6560). Does nothing where the stamp is current, elsewhere, and
77
225
  * outside an open.
@@ -90,7 +238,7 @@ export async function stampBrokerSchemaAtOpenEnd(
90
238
  }
91
239
 
92
240
  /**
93
- * What `setup` creates on a SQLite or libSQL database, where it only runs `CREATE TABLE` and `CREATE INDEX` statements
241
+ * What `setup` creates on a SQLite database, where it only runs `CREATE TABLE` and `CREATE INDEX` statements
94
242
  * with `IF NOT EXISTS` and seeds rows with `INSERT … ON CONFLICT … DO NOTHING`: `present`, whether the catalog an open
95
243
  * in progress read found each object, as a table or an index as the statement names it; `verify`, the same check
96
244
  * against another catalog; and `seeds`, whether it seeds rows, which still have to be written. SQLite records no
@@ -107,6 +255,8 @@ async function foundInCatalog(
107
255
  readonly verify: (catalog: storage.StorageSchemaCatalog) => boolean;
108
256
  readonly seeds: boolean;
109
257
  readonly present: boolean;
258
+ readonly scripts: readonly string[];
259
+ readonly tables: readonly string[];
110
260
  }
111
261
  | undefined
112
262
  > {
@@ -148,7 +298,8 @@ async function foundInCatalog(
148
298
  }
149
299
  const verify = (found: storage.StorageSchemaCatalog) =>
150
300
  created.every(({ name, type }) => found.sqliteObjectType?.(name) === type);
151
- return { verify, seeds, present: verify(catalog) };
301
+ const tables = created.filter(({ type }) => type === "table").map(({ name }) => name);
302
+ return { verify, seeds, present: verify(catalog), scripts, tables };
152
303
  }
153
304
 
154
305
  /** `INSERT INTO … ON CONFLICT … DO NOTHING`: rows a setup seeds once, which writing again leaves as they are. */
@@ -19,6 +19,7 @@ import type {
19
19
  SentQuestionRoute,
20
20
  } from "./multinode-state-store.js";
21
21
  import { rowTransaction } from "./sql-outbox-store.js";
22
+ import { deleteInBatches, storeNow } from "./sql-retention.js";
22
23
  import { ensureBrokerSchema, withBrokerSchemaCatalog } from "./sql-schema.js";
23
24
 
24
25
  type SentRow = SqliteRow & {
@@ -53,6 +54,27 @@ export interface SqlSentMessageAuthority extends SentMessageAuthority {
53
54
  * send's outbox row is inserted only under it, after the send's own `reserveStatement` (#6560).
54
55
  */
55
56
  reservedCondition(key: SentMessageKey): SqliteStatement;
57
+ /**
58
+ * The writes and reads of `reservation`'s row a send makes in one round trip on PostgreSQL, each decided by the
59
+ * database (`OutboxReservation`); undefined for a reservation `reserveIn` refuses without writing.
60
+ */
61
+ reservationOf(reservation: SentMessageReservation): OutboxReservation | undefined;
62
+ }
63
+
64
+ /**
65
+ * The statements of the sent-message table a send's one-round-trip transaction makes (`SqlOutboxStore.enqueueAtOnce`):
66
+ * the reservation's insert and delete, each made only while a condition the caller gives holds, and reads of it.
67
+ */
68
+ export interface OutboxReservation {
69
+ readonly digest: string;
70
+ /** Inserts the reservation as `reserveStatement` does, only while `condition` holds, answering `returning` if it did. */
71
+ reserveWhere(condition: SqliteStatement, returning: string): SqliteStatement;
72
+ /** Deletes the reservation, only while it holds this digest and `condition` holds. */
73
+ forgetWhere(condition: SqliteStatement): SqliteStatement;
74
+ /** A read, usable as a scalar subquery, of the digest that holds the message now, or null. */
75
+ readonly holder: SqliteStatement;
76
+ /** An SQL condition that holds while this digest holds the message (`reservedCondition`). */
77
+ readonly held: SqliteStatement;
56
78
  }
57
79
 
58
80
  /**
@@ -100,19 +122,51 @@ async function openSentMessageAuthorityInCatalog({
100
122
  return executor.get<SentRow>(sql, ...params);
101
123
  };
102
124
 
125
+ /** The values of `reservation`'s row, in the order of `reserveStatement`'s columns. */
126
+ const reservedValues = (reservation: SentMessageReservation) => [
127
+ reservation.messageId,
128
+ reservation.digest,
129
+ reservation.targetIdentity,
130
+ reservation.questionRoute === undefined
131
+ ? null
132
+ : JSON.stringify({
133
+ targetSessionId: reservation.questionRoute.targetSessionId,
134
+ senderGroupIdentity: reservation.questionRoute.senderGroupIdentity,
135
+ }),
136
+ ];
137
+ const reserved = `INSERT INTO ${table}(message_id, digest, target_identity, question_route_json, state, recorded_at)`;
138
+
103
139
  const reserveStatement = (reservation: SentMessageReservation): SqliteStatement | undefined => {
104
140
  if (reservation.messageId.length === 0 || reservation.targetIdentity.length === 0) return undefined;
105
- const route =
106
- reservation.questionRoute === undefined
107
- ? null
108
- : JSON.stringify({
109
- targetSessionId: reservation.questionRoute.targetSessionId,
110
- senderGroupIdentity: reservation.questionRoute.senderGroupIdentity,
111
- });
112
141
  return {
113
- sql: `INSERT INTO ${table}(message_id, digest, target_identity, question_route_json, state, recorded_at)
142
+ sql: `${reserved}
114
143
  VALUES (?, ?, ?, ?, 'reserved', ${nowMs}) ON CONFLICT(message_id) DO NOTHING`,
115
- params: [reservation.messageId, reservation.digest, reservation.targetIdentity, route],
144
+ params: reservedValues(reservation),
145
+ };
146
+ };
147
+
148
+ const reservedCondition = (key: SentMessageKey): SqliteStatement => ({
149
+ sql: `EXISTS (SELECT 1 FROM ${table} WHERE message_id = ? AND digest = ?)`,
150
+ params: [key.messageId, key.digest],
151
+ });
152
+
153
+ const reservationOf = (reservation: SentMessageReservation): OutboxReservation | undefined => {
154
+ if (reservation.messageId.length === 0 || reservation.targetIdentity.length === 0) return undefined;
155
+ const { messageId, digest } = reservation;
156
+ return {
157
+ digest,
158
+ reserveWhere: (condition, returning) => ({
159
+ sql: `${reserved}
160
+ SELECT ?, ?, ?, ?, 'reserved', ${nowMs} WHERE ${condition.sql} ON CONFLICT(message_id) DO NOTHING
161
+ RETURNING ${returning}`,
162
+ params: [...reservedValues(reservation), ...condition.params],
163
+ }),
164
+ forgetWhere: (condition) => ({
165
+ sql: `DELETE FROM ${table} WHERE message_id = ? AND digest = ? AND (${condition.sql})`,
166
+ params: [messageId, digest, ...condition.params],
167
+ }),
168
+ holder: { sql: `SELECT digest FROM ${table} WHERE message_id = ?`, params: [messageId] },
169
+ held: reservedCondition({ messageId, digest }),
116
170
  };
117
171
  };
118
172
 
@@ -179,10 +233,8 @@ async function openSentMessageAuthorityInCatalog({
179
233
  forgetIn,
180
234
  lookupStatement,
181
235
  reserveStatement,
182
- reservedCondition: (key) => ({
183
- sql: `EXISTS (SELECT 1 FROM ${table} WHERE message_id = ? AND digest = ?)`,
184
- params: [key.messageId, key.digest],
185
- }),
236
+ reservedCondition,
237
+ reservationOf,
186
238
  async reserve(reservation): Promise<SentMessageReserveResult> {
187
239
  if (reservation.messageId.length === 0) return emptyMessageId;
188
240
  if (reservation.targetIdentity.length === 0) return { status: "invalid", reason: "empty-target-identity" };
@@ -203,12 +255,15 @@ async function openSentMessageAuthorityInCatalog({
203
255
  if (key.messageId.length === 0) return emptyMessageId;
204
256
  return database.transaction((tx) => forgetIn(tx, key), leadingWith(forgetStatement(key)));
205
257
  },
206
- async prune(olderThanMs: number): Promise<number> {
207
- const { changes } = await database.run(
208
- `DELETE FROM ${table} WHERE ${nowMs} - recorded_at > ?`,
209
- olderThanMs,
210
- );
211
- return changes;
258
+ prune(olderThanMs: number): Promise<number> {
259
+ // Oldest first, from `<table>_recorded`, in batches.
260
+ return deleteInBatches(database, {
261
+ table,
262
+ key: "message_id",
263
+ where: `recorded_at < ${storeNow(database)} - ?`,
264
+ params: [olderThanMs],
265
+ orderBy: "recorded_at",
266
+ });
212
267
  },
213
268
  };
214
269
  }
@@ -17,6 +17,12 @@ export interface WakeUpHint {
17
17
  * skips one because of its version.
18
18
  */
19
19
  readonly version: number;
20
+ /**
21
+ * The recipient whose queue the hint is about (`deliveryTargetIdentity`), when one is: the broker then reads that
22
+ * queue alone instead of every recipient it hosts. Absent from hints that concern no single recipient and from those of
23
+ * earlier releases.
24
+ */
25
+ readonly targetIdentity?: string;
20
26
  }
21
27
 
22
28
  export type WakeUpEvent =
@@ -7,7 +7,7 @@ import * as __atomicHostImport1 from "@bastani/atomic-ai";
7
7
  if (!(name in namespace)) missing.push(`The requested module '${specifier}' does not provide an export named '${name}'`);
8
8
  if (missing.length > 0) {
9
9
  const application = typeof __atomicHostImport0.APP_NAME === "string" ? __atomicHostImport0.APP_NAME : "atomic";
10
- if (__atomicHostImport0.VERSION !== "0.10.11-alpha.2") missing.unshift(application + " was updated to 0.10.11-alpha.2 while this session was running; restart it to keep using the intercom extension.");
10
+ if (__atomicHostImport0.VERSION !== "0.10.11") missing.unshift(application + " was updated to 0.10.11 while this session was running; restart it to keep using the intercom extension.");
11
11
  throw new Error(missing.join("\n"));
12
12
  }
13
13
  }
@@ -10511,6 +10511,10 @@ var init_client = __esm(() => {
10511
10511
  this.heardOutcomes.set(messageId, "saved");
10512
10512
  writeMessage(this.requireActiveSocket(), { type: "received", messageId, ...paused ? { paused: true } : {} });
10513
10513
  }
10514
+ forgetUnsavedOutcome(messageId) {
10515
+ if (this.heardOutcomes.get(messageId) === "heard")
10516
+ this.heardOutcomes.delete(messageId);
10517
+ }
10514
10518
  heardOutcomeAgain(message) {
10515
10519
  if (message.replyTo === undefined)
10516
10520
  return false;
@@ -16983,11 +16987,10 @@ function piIntercomExtension(atomic, testOverrides = {}) {
16983
16987
  throw new IntercomRuntimeInactiveError;
16984
16988
  const actual = routing?.acrossMachines ?? false;
16985
16989
  const explicit = explicitHomeGroup(config, ctx);
16986
- const strictSharedProfile = selectedShared && (process.env.ATOMIC_PROFILE ?? "").trim() === "ci";
16987
16990
  if (routing !== undefined) {
16988
16991
  brokerRouting = actual;
16989
16992
  const brokerLacksSelectedStorage = !routing.hasSharedStorage && selectedShared;
16990
- if (brokerLacksSelectedStorage || strictSharedProfile && !actual) {
16993
+ if (brokerLacksSelectedStorage) {
16991
16994
  if (sessionHomeGroup === null)
16992
16995
  await warmProjectGroup(ctx);
16993
16996
  throw new IntercomRoutingMismatchError("shared-storage-not-on-broker", resolveSessionHomeGroup());
@@ -17269,6 +17272,8 @@ function piIntercomExtension(atomic, testOverrides = {}) {
17269
17272
  saved.finally(() => clearInterval(saving)).catch(() => {});
17270
17273
  saved.then(async (arrival) => {
17271
17274
  if (arrival !== "fresh") {
17275
+ if (arrival === "unsaved")
17276
+ receiver.forgetUnsavedOutcome(message.id);
17272
17277
  place.cancel();
17273
17278
  return;
17274
17279
  }
@@ -17277,9 +17282,13 @@ function piIntercomExtension(atomic, testOverrides = {}) {
17277
17282
  await handleIncomingMessage(liveContext, from, bounded, channel, place);
17278
17283
  else
17279
17284
  place.cancel();
17280
- }).catch(() => place.cancel()).finally(() => arrived.resolve());
17285
+ }).catch(() => {
17286
+ receiver.forgetUnsavedOutcome(message.id);
17287
+ place.cancel();
17288
+ }).finally(() => arrived.resolve());
17281
17289
  }, () => {
17282
17290
  clearInterval(saving);
17291
+ receiver.forgetUnsavedOutcome(message.id);
17283
17292
  place.cancel();
17284
17293
  arrived.resolve();
17285
17294
  });
@@ -17516,6 +17525,7 @@ function piIntercomExtension(atomic, testOverrides = {}) {
17516
17525
  function attachClientHandlers(nextClient) {
17517
17526
  nextClient.on("message", (from, message, channel) => {
17518
17527
  if (client !== nextClient || !getLiveContext()) {
17528
+ nextClient.forgetUnsavedOutcome(message.id);
17519
17529
  return;
17520
17530
  }
17521
17531
  receiveIncomingMessage(nextClient, from, message, channel);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/intercom",
3
- "version": "0.10.11-alpha.2",
3
+ "version": "0.10.11",
4
4
  "private": true,
5
5
  "description": "Atomic extension for direct messaging and coordination between parent, child, and peer agent sessions.",
6
6
  "contributors": [
@@ -6,7 +6,7 @@ import * as __atomicHostImport0 from "@bastani/atomic";
6
6
  if (!(name in namespace)) missing.push(`The requested module '${specifier}' does not provide an export named '${name}'`);
7
7
  if (missing.length > 0) {
8
8
  const application = typeof __atomicHostImport0.APP_NAME === "string" ? __atomicHostImport0.APP_NAME : "atomic";
9
- if (__atomicHostImport0.VERSION !== "0.10.11-alpha.2") missing.unshift(application + " was updated to 0.10.11-alpha.2 while this session was running; restart it to keep using the mcp extension.");
9
+ if (__atomicHostImport0.VERSION !== "0.10.11") missing.unshift(application + " was updated to 0.10.11 while this session was running; restart it to keep using the mcp extension.");
10
10
  throw new Error(missing.join("\n"));
11
11
  }
12
12
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/mcp",
3
- "version": "0.10.11-alpha.2",
3
+ "version": "0.10.11",
4
4
  "private": true,
5
5
  "description": "Atomic's MCP integration for server connections, OAuth, tools, resources, and terminal management.",
6
6
  "contributors": [
@@ -2,6 +2,26 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.10.11] - 2026-11-27
6
+
7
+ ### Changed
8
+
9
+ - A subagent started with `context: "fork"` now shares its parent's history in the session store instead of copying it, so it starts about as fast from a long conversation as from a short one. It reads, resumes and exports as before. See [Shared-history forks](../coding-agent/docs/storage.md#shared-history-forks) in Atomic's storage guide ([#6608](https://github.com/bastani-inc/atomic/pull/6608), [#6560](https://github.com/bastani-inc/atomic/issues/6560)).
10
+ - A subagent's session is now always kept in the session store of the session that launched it, whatever that store is. A subagent of a session kept in JSONL files now has its session file in the same directory as its parent's, instead of a directory of its own. The launch's `sessionDir` and `defaultSessionDir` in `config.json` are ignored, with a one-time deprecation warning. A child's working directory, its worktree, the storage settings of the project it runs in, and a resume after a restart never choose another store. A subagent that was queued but never started relaunches in its parent's store after a restart, even when an earlier release recorded a directory for it. Sessions written as files by earlier releases stay readable and restorable ([#6594](https://github.com/bastani-inc/atomic/pull/6594)).
11
+ - A `context: "fork"` subagent's session is now internal, like a fresh subagent's. `/resume`, `atomic -r`, `-c` and the `history://sessions` list leave it out, and a fork differs from a fresh subagent only in starting from its parent's conversation ([#6594](https://github.com/bastani-inc/atomic/pull/6594)).
12
+ - A skill given to a subagent now arrives with its `skill://<name>` address and the note `References are relative to skill://<name>/.`, so the subagent can open the skill's other files and scripts ([#6589](https://github.com/bastani-inc/atomic/pull/6589)).
13
+
14
+ ### Fixed
15
+
16
+ - The skill-creator's review viewer now prints its URL and opens the browser as soon as it serves. Before, it first looked up the name of 127.0.0.1, which could take many seconds when the resolver was slow to answer, as on some Macs ([#6687](https://github.com/bastani-inc/atomic/pull/6687), [#6691](https://github.com/bastani-inc/atomic/issues/6691)).
17
+ - When a subagent cannot start on a model, the error now says whether the model does not exist (`no such model in the catalog`) or is left out by `enabledModels`. For a Fast or Ultrafast version whose base model is allowed, the error names the exact ID to add, such as `Add "openai-codex/gpt-6.2-sol-ultrafast" to enabledModels.` ([#6569](https://github.com/bastani-inc/atomic/pull/6569)).
18
+
19
+ ## [0.10.11-alpha.4] - 2026-11-27
20
+
21
+ ### Fixed
22
+
23
+ - The skill-creator's review viewer now prints its URL and opens the browser as soon as it serves. Before, it first looked up the name of 127.0.0.1, which could take many seconds when the resolver was slow to answer, as on some Macs ([#6691](https://github.com/bastani-inc/atomic/issues/6691)).
24
+
5
25
  ## [0.10.11-alpha.2] - 2026-11-26
6
26
 
7
27
  ### Changed
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/subagents",
3
- "version": "0.10.11-alpha.2",
3
+ "version": "0.10.11",
4
4
  "private": true,
5
5
  "description": "Atomic extension for delegating tasks to subagents with parallel execution.",
6
6
  "contributors": [
@@ -26,6 +26,7 @@ import os
26
26
  import re
27
27
  import secrets
28
28
  import socket
29
+ import socketserver
29
30
  import stat
30
31
  import sys
31
32
  import time
@@ -573,6 +574,10 @@ class ReviewServer(HTTPServer):
573
574
 
574
575
  On Windows, SO_REUSEADDR would let it bind a port that is already in use,
575
576
  so it asks for the port exclusively there instead.
577
+
578
+ It binds without HTTPServer's lookup of its address's name (socket.getfqdn),
579
+ a reverse DNS query that can wait many seconds for a resolver before the URL
580
+ is printed. It serves only 127.0.0.1, so its name is localhost.
576
581
  """
577
582
 
578
583
  allow_reuse_address = os.name != "nt"
@@ -580,7 +585,9 @@ class ReviewServer(HTTPServer):
580
585
  def server_bind(self) -> None:
581
586
  if os.name == "nt":
582
587
  self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_EXCLUSIVEADDRUSE, 1)
583
- super().server_bind()
588
+ socketserver.TCPServer.server_bind(self)
589
+ self.server_name = "localhost"
590
+ self.server_port = self.server_address[1]
584
591
 
585
592
 
586
593
  def start_server(port: int, handler) -> HTTPServer:
@@ -10,7 +10,7 @@ import * as __atomicHostImport4 from "@bastani/atomic-ai";
10
10
  if (!(name in namespace)) missing.push(`The requested module '${specifier}' does not provide an export named '${name}'`);
11
11
  if (missing.length > 0) {
12
12
  const application = typeof __atomicHostImport0.APP_NAME === "string" ? __atomicHostImport0.APP_NAME : "atomic";
13
- if (__atomicHostImport0.VERSION !== "0.10.11-alpha.2") missing.unshift(application + " was updated to 0.10.11-alpha.2 while this session was running; restart it to keep using the subagents extension.");
13
+ if (__atomicHostImport0.VERSION !== "0.10.11") missing.unshift(application + " was updated to 0.10.11 while this session was running; restart it to keep using the subagents extension.");
14
14
  throw new Error(missing.join("\n"));
15
15
  }
16
16
  }
@@ -8,7 +8,7 @@ import * as __atomicHostImport2 from "@bastani/atomic-ai/compat";
8
8
  if (!(name in namespace)) missing.push(`The requested module '${specifier}' does not provide an export named '${name}'`);
9
9
  if (missing.length > 0) {
10
10
  const application = typeof __atomicHostImport0.APP_NAME === "string" ? __atomicHostImport0.APP_NAME : "atomic";
11
- if (__atomicHostImport0.VERSION !== "0.10.11-alpha.2") missing.unshift(application + " was updated to 0.10.11-alpha.2 while this session was running; restart it to keep using the web-access extension.");
11
+ if (__atomicHostImport0.VERSION !== "0.10.11") missing.unshift(application + " was updated to 0.10.11 while this session was running; restart it to keep using the web-access extension.");
12
12
  throw new Error(missing.join("\n"));
13
13
  }
14
14
  }
@@ -4383,13 +4383,6 @@ process.emitWarning = (warning, ...args) => {
4383
4383
  return origEmitWarning(warning, ...args);
4384
4384
  };
4385
4385
 
4386
- function supportsReadBigInts() {
4387
- const [major, minor] = process.versions.node.split(".").map(Number);
4388
- if (major > 24) return true;
4389
- if (major < 24) return false;
4390
- return minor >= 4;
4391
- }
4392
-
4393
4386
  function readMetaVersion(sqlite, dbPath, opts) {
4394
4387
  const db = new sqlite.DatabaseSync(dbPath, opts);
4395
4388
  try {
@@ -4433,8 +4426,7 @@ try {
4433
4426
  if (!sqlite) {
4434
4427
  parentPort?.postMessage({ metaVersion: 0, rows: null });
4435
4428
  } else {
4436
- const opts = { readOnly: true };
4437
- if (supportsReadBigInts()) opts.readBigInts = true;
4429
+ const opts = { readOnly: true, readBigInts: true };
4438
4430
  let metaVersion = 0;
4439
4431
  try {
4440
4432
  metaVersion = readMetaVersion(sqlite, workerData.dbPath, opts);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/web-access",
3
- "version": "0.10.11-alpha.2",
3
+ "version": "0.10.11",
4
4
  "private": true,
5
5
  "description": "Atomic extension for web search, URL fetching, GitHub repository cloning, and PDF and video extraction.",
6
6
  "contributors": [
@@ -0,0 +1,41 @@
1
+ import { existsSync } from "node:fs";
2
+ import { createRequire } from "node:module";
3
+ import { join } from "node:path";
4
+ import { pathToFileURL } from "node:url";
5
+ /**
6
+ * Where the macOS standalone binary's SQLite library is, relative to the binary's directory. `build-binaries.sh`
7
+ * stages it there from `scripts/build-macos-sqlite.sh`: the SQLite release Node's `node:sqlite` bundles, pinned in
8
+ * `scripts/bundled-sqlite.json`, built with Node's compile options.
9
+ */
10
+ export const BUNDLED_SQLITE_LIBRARY = join("lib", "libsqlite3.dylib");
11
+ /** The library Bun loads on macOS when it is given no other: the system's. */
12
+ const SYSTEM_SQLITE_LIBRARY = "libsqlite3.dylib";
13
+ /**
14
+ * Points Bun at the SQLite library shipped next to the macOS binary in `executableDir`, before anything opens a
15
+ * database. Bun's SQLite on macOS, `node:sqlite` included, is otherwise the system's, whose version depends on the
16
+ * macOS release and can be older than the one Atomic is tested with. Bun loads the library here, so a library that
17
+ * cannot be loaded is found now: Atomic then warns once with `warn` and keeps the system's. Does nothing on other
18
+ * platforms, under Node, and where no library was shipped, as for a binary built without one.
19
+ */
20
+ export function useBundledSqlite(executableDir, warn) {
21
+ if (process.platform !== "darwin" || process.versions.bun === undefined)
22
+ return;
23
+ const library = join(executableDir, BUNDLED_SQLITE_LIBRARY);
24
+ if (!existsSync(library))
25
+ return;
26
+ const { Database } = createRequire(pathToFileURL(join(executableDir, "atomic")).href)("bun:sqlite");
27
+ try {
28
+ Database.setCustomSQLite(library);
29
+ }
30
+ catch (error) {
31
+ // Bun keeps the failed path, so every open would fail with it: give it the system's back.
32
+ try {
33
+ Database.setCustomSQLite(SYSTEM_SQLITE_LIBRARY);
34
+ }
35
+ catch {
36
+ // The system's loads on first use, as it did before.
37
+ }
38
+ warn(`Atomic could not load its own SQLite library (${library}): ${error.message}. It uses the system's SQLite instead.`);
39
+ }
40
+ }
41
+ //# sourceMappingURL=bundled-sqlite.js.map