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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (369) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/README.md +27 -5
  3. package/dist/_shared/config-binary-install-SNFYFXWB.js +70 -0
  4. package/dist/_shared/config-binary-install-SNFYFXWB.js.map +1 -0
  5. package/dist/_shared/dist-KOELCESV.js +2 -2
  6. package/dist/_shared/fork-row-index-UAUAQRD5.js +2 -2
  7. package/dist/_shared/lib-4PES5P4V.js +2 -2
  8. package/dist/_shared/{mode-interactive-sdk-7KXUFI2F.js → mode-interactive-sdk-JXBZ3H27.js} +434 -11
  9. package/dist/_shared/mode-interactive-sdk-JXBZ3H27.js.map +1 -0
  10. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +21 -6
  11. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js.map +1 -1
  12. package/dist/_shared/mode-shared-2QJSCUM6.js +7 -6
  13. package/dist/_shared/mode-shared-2QJSCUM6.js.map +1 -1
  14. package/dist/_shared/p0-cli-BB45ZQY6.js +56 -3
  15. package/dist/_shared/p0-cli-BB45ZQY6.js.map +1 -1
  16. package/dist/_shared/p1a-prewarm-XIU57JHF.js +3 -3
  17. package/dist/_shared/runtime-O4KCSG4C.js +3 -3
  18. package/dist/_shared/{sdk-OHKMDJ74.js → sdk-BHX35EPK.js} +47 -17
  19. package/dist/_shared/sdk-BHX35EPK.js.map +1 -0
  20. package/dist/_shared/session-data-AHTU7IS6.js +2 -2
  21. package/dist/_shared/session-manager-list-2BLEEZVG.js +1 -1
  22. package/dist/_shared/{startup-0-0-OV6RAEAP.js → startup-0-0-4EDVBK5P.js} +464 -7
  23. package/dist/_shared/startup-0-0-4EDVBK5P.js.map +1 -0
  24. package/dist/_shared/{startup-0-1-EZAJI6RE.js → startup-0-1-H5IXVRXQ.js} +85 -7
  25. package/dist/_shared/startup-0-1-H5IXVRXQ.js.map +1 -0
  26. package/dist/_shared/startup-0-2-YZZOC22D.js +4 -4
  27. package/dist/_shared/startup-0-3-DE2NCS6A.js +4 -4
  28. package/dist/_shared/startup-0-4-ZMJV547D.js +6 -5
  29. package/dist/_shared/startup-0-4-ZMJV547D.js.map +1 -1
  30. package/dist/_shared/startup-0-5-HZX3ZPTP.js +44 -13
  31. package/dist/_shared/startup-0-5-HZX3ZPTP.js.map +1 -1
  32. package/dist/_shared/startup-10-0-TDQNBDDL.js +5 -5
  33. package/dist/_shared/startup-12-0-55AAXBJZ.js +2 -2
  34. package/dist/_shared/startup-14-0-MLX36RBG.js +3 -3
  35. package/dist/_shared/startup-15-0-YUKGAC63.js +3 -3
  36. package/dist/_shared/{startup-15-1-4S7FLMNG.js → startup-15-1-WQZBOTMZ.js} +70 -28
  37. package/dist/_shared/{startup-15-1-4S7FLMNG.js.map → startup-15-1-WQZBOTMZ.js.map} +1 -1
  38. package/dist/_shared/startup-8-0-34CBHPZH.js +4 -4
  39. package/dist/_shared/{startup-8-1-LZFXSD3Z.js → startup-8-1-QZMXUGHI.js} +242 -20
  40. package/dist/_shared/startup-8-1-QZMXUGHI.js.map +1 -0
  41. package/dist/_shared/storage-command-7MGXLJGZ.js +75 -11
  42. package/dist/_shared/storage-command-7MGXLJGZ.js.map +1 -1
  43. package/dist/_shared/storage-status-K7PX2RXA.js +3 -3
  44. package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
  45. package/dist/_shared/team-DOQKICG2.js +2 -2
  46. package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
  47. package/dist/binary-self-update.js +281 -0
  48. package/dist/binary-self-update.js.map +1 -0
  49. package/dist/builtin/intercom/broker/broker.bundle.mjs +158 -78
  50. package/dist/builtin/intercom/broker/multinode-router.ts +41 -8
  51. package/dist/builtin/intercom/broker/multinode-state-store.ts +6 -1
  52. package/dist/builtin/intercom/broker/sql-lease-store.ts +89 -80
  53. package/dist/builtin/intercom/broker/sql-pending-ask-store.ts +65 -6
  54. package/dist/builtin/intercom/index.bundle.mjs +2 -1
  55. package/dist/builtin/intercom/package.json +1 -1
  56. package/dist/builtin/mcp/index.bundle.mjs +1 -1
  57. package/dist/builtin/mcp/package.json +1 -1
  58. package/dist/builtin/subagents/CHANGELOG.md +15 -0
  59. package/dist/builtin/subagents/package.json +1 -1
  60. package/dist/builtin/subagents/skills/agent-browser/SKILL.md +1 -1
  61. package/dist/builtin/subagents/skills/impeccable/SKILL.md +3 -3
  62. package/dist/builtin/subagents/skills/impeccable/reference/audit.md +2 -2
  63. package/dist/builtin/subagents/skills/impeccable/reference/critique.md +3 -3
  64. package/dist/builtin/subagents/skills/impeccable/reference/generate.md +1 -1
  65. package/dist/builtin/subagents/skills/impeccable/reference/init.md +0 -2
  66. package/dist/builtin/subagents/skills/impeccable/reference/live.md +4 -2
  67. package/dist/builtin/subagents/skills/impeccable/reference/new-work-comp.md +1 -1
  68. package/dist/builtin/subagents/skills/impeccable/reference/new-work-world.md +1 -1
  69. package/dist/builtin/subagents/skills/impeccable/scripts/VERSION +1 -1
  70. package/dist/builtin/subagents/skills/impeccable/scripts/engine-checksums.txt +5 -5
  71. package/dist/builtin/subagents/skills/impeccable/scripts/impeccable +28 -5
  72. package/dist/builtin/subagents/skills/impeccable/scripts/impeccable.cmd +11 -2
  73. package/dist/builtin/subagents/skills/impeccable/scripts/live-browser.js +10 -6
  74. package/dist/builtin/subagents/skills/research-codebase/SKILL.md +13 -19
  75. package/dist/builtin/subagents/skills/skill-creator/SKILL.md +1 -1
  76. package/dist/builtin/subagents/skills/subagent/SKILL.md +7 -7
  77. package/dist/builtin/subagents/skills/workflow/SKILL.md +98 -0
  78. package/dist/builtin/subagents/src/extension/index.bundle.mjs +2 -1
  79. package/dist/builtin/web-access/index.bundle.mjs +2 -1
  80. package/dist/builtin/web-access/package.json +1 -1
  81. package/dist/cli/args.js +2 -2
  82. package/dist/cli/auth-cli.code.js +3 -3
  83. package/dist/cli/auth-cli.impl.js +3 -3
  84. package/dist/cli/auth-cli.js +3 -3
  85. package/dist/cli/blueprint-command.code.js +2 -2
  86. package/dist/cli/blueprint-command.impl.js +3 -3
  87. package/dist/cli/blueprint-command.js +3 -3
  88. package/dist/cli/intercom-command.code.js +2 -2
  89. package/dist/cli/intercom-command.impl.js +3 -3
  90. package/dist/cli/intercom-command.js +3 -3
  91. package/dist/cli/list-models.code.js +2 -2
  92. package/dist/cli/list-models.impl.js +3 -3
  93. package/dist/cli/list-models.js +3 -3
  94. package/dist/cli/session-picker.code.js +1 -1
  95. package/dist/cli/session-picker.impl.js +3 -3
  96. package/dist/cli/session-picker.js +3 -3
  97. package/dist/cli/startup-ui.code.js +1 -1
  98. package/dist/cli/startup-ui.impl.js +3 -3
  99. package/dist/cli/startup-ui.js +3 -3
  100. package/dist/cli/storage-command.impl.js +3 -3
  101. package/dist/cli/storage-command.js +3 -3
  102. package/dist/cli/storage-search-session.code.js +3 -3
  103. package/dist/cli/storage-search-session.impl.js +3 -3
  104. package/dist/cli/storage-search-session.js +3 -3
  105. package/dist/cli/team-command.code.js +1 -1
  106. package/dist/cli/team-command.impl.js +3 -3
  107. package/dist/cli/team-command.js +3 -3
  108. package/dist/cli/usage-command.js +22 -0
  109. package/dist/cli/usage-command.js.map +1 -0
  110. package/dist/cli.js +2 -2
  111. package/dist/config-binary-install.js +3 -0
  112. package/dist/config-binary-install.js.map +1 -0
  113. package/dist/core/agent-session-services.js +3 -0
  114. package/dist/core/agent-session-services.js.map +1 -0
  115. package/dist/core/debug.impl.js +3 -3
  116. package/dist/core/debug.js +3 -3
  117. package/dist/core/export-html/card-projection.impl.js +3 -3
  118. package/dist/core/export-html/card-projection.js +3 -3
  119. package/dist/core/export-html/index.code.js +2 -2
  120. package/dist/core/export-html/index.impl.js +3 -3
  121. package/dist/core/export-html/index.js +3 -3
  122. package/dist/core/export-html/json-spans.impl.js +3 -3
  123. package/dist/core/export-html/json-spans.js +3 -3
  124. package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
  125. package/dist/core/export-html/oversized-render-inputs.js +3 -3
  126. package/dist/core/export-html/tool-renderer.impl.js +3 -3
  127. package/dist/core/export-html/tool-renderer.js +3 -3
  128. package/dist/core/extensions/jiti-loader.impl.js +3 -3
  129. package/dist/core/extensions/jiti-loader.js +3 -3
  130. package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
  131. package/dist/core/extensions/jiti-static-loader.js +3 -3
  132. package/dist/core/extensions/loader-host-modules.code.js +1 -1
  133. package/dist/core/extensions/loader-host-modules.impl.js +3 -3
  134. package/dist/core/extensions/loader-host-modules.js +3 -3
  135. package/dist/core/extensions/loader-virtual-modules.js +1 -1
  136. package/dist/core/extensions/runner-context.js +2 -2
  137. package/dist/core/intercom-broker-control-host.code.js +1 -1
  138. package/dist/core/intercom-broker-control-host.impl.js +3 -3
  139. package/dist/core/intercom-broker-control-host.js +3 -3
  140. package/dist/core/intercom-broker-control.code.js +3 -3
  141. package/dist/core/intercom-broker-control.impl.js +3 -3
  142. package/dist/core/intercom-broker-control.js +3 -3
  143. package/dist/core/{legacy-workflow-files.d.ts → legacy-workflows.d.ts} +1 -1
  144. package/dist/core/model-runtime.d.ts +8 -2
  145. package/dist/core/package-manager-storage-adapters.code.js +1 -1
  146. package/dist/core/package-manager-storage-adapters.impl.js +3 -3
  147. package/dist/core/package-manager-storage-adapters.js +3 -3
  148. package/dist/core/resource-loader-core.d.ts +1 -1
  149. package/dist/core/resource-loader-internals.d.ts +1 -1
  150. package/dist/core/resource-loader-types.d.ts +1 -1
  151. package/dist/core/resource-loader-types.js.map +1 -1
  152. package/dist/core/sdk.code.js +4 -4
  153. package/dist/core/sdk.impl.js +3 -3
  154. package/dist/core/sdk.js +3 -3
  155. package/dist/core/session-manager-core.js +5 -5
  156. package/dist/core/session-manager-list.impl.js +3 -3
  157. package/dist/core/session-manager-list.js +3 -3
  158. package/dist/core/session-manager.code.js +1 -1
  159. package/dist/core/session-manager.impl.js +3 -3
  160. package/dist/core/session-manager.js +3 -3
  161. package/dist/core/session-storage.code.js +1 -1
  162. package/dist/core/session-storage.impl.js +3 -3
  163. package/dist/core/session-storage.js +3 -3
  164. package/dist/core/settings-manager.js +5 -0
  165. package/dist/core/settings-manager.js.map +1 -0
  166. package/dist/core/storage/database.d.ts +6 -2
  167. package/dist/core/storage/database.js.map +1 -1
  168. package/dist/core/storage/fenced-paths.d.ts +15 -0
  169. package/dist/core/storage/fenced-paths.js +25 -0
  170. package/dist/core/storage/fenced-paths.js.map +1 -1
  171. package/dist/core/storage/index.js +2 -2
  172. package/dist/core/storage/migrations.d.ts +2 -11
  173. package/dist/core/storage/migrations.js +2 -9
  174. package/dist/core/storage/migrations.js.map +1 -1
  175. package/dist/core/storage/node-sqlite-thread.js +2 -2
  176. package/dist/core/storage/node-sqlite.js +2 -2
  177. package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
  178. package/dist/core/storage/offline-snapshot-file.js +3 -3
  179. package/dist/core/storage/postgres-locks.d.ts +11 -0
  180. package/dist/core/storage/postgres-locks.js +9 -0
  181. package/dist/core/storage/postgres-locks.js.map +1 -0
  182. package/dist/core/storage/provider.js +2 -2
  183. package/dist/core/storage/selection.js +2 -2
  184. package/dist/core/storage/session/branch-fork-source.code.js +2 -2
  185. package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
  186. package/dist/core/storage/session/branch-fork-source.js +3 -3
  187. package/dist/core/storage/session/card-view.impl.js +3 -3
  188. package/dist/core/storage/session/card-view.js +3 -3
  189. package/dist/core/storage/session/child-reader.code.js +3 -3
  190. package/dist/core/storage/session/child-reader.impl.js +3 -3
  191. package/dist/core/storage/session/child-reader.js +3 -3
  192. package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
  193. package/dist/core/storage/session/chunked-resume-projection.js +3 -3
  194. package/dist/core/storage/session/expanded-child-details.code.js +2 -2
  195. package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
  196. package/dist/core/storage/session/expanded-child-details.js +3 -3
  197. package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
  198. package/dist/core/storage/session/fork-row-bytes.js +3 -3
  199. package/dist/core/storage/session/fork-row-index.impl.js +3 -3
  200. package/dist/core/storage/session/fork-row-index.js +3 -3
  201. package/dist/core/storage/session/fork-staging.code.js +2 -2
  202. package/dist/core/storage/session/fork-staging.impl.js +3 -3
  203. package/dist/core/storage/session/fork-staging.js +3 -3
  204. package/dist/core/storage/session/fork-window.code.js +3 -3
  205. package/dist/core/storage/session/fork-window.impl.js +3 -3
  206. package/dist/core/storage/session/fork-window.js +3 -3
  207. package/dist/core/storage/session/history-pages.impl.js +3 -3
  208. package/dist/core/storage/session/history-pages.js +3 -3
  209. package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
  210. package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
  211. package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
  212. package/dist/core/storage/session/jsonl-session-store.js +3 -3
  213. package/dist/core/storage/session/memory-session-store.impl.js +3 -3
  214. package/dist/core/storage/session/memory-session-store.js +3 -3
  215. package/dist/core/storage/session/pinned-branch-resume.code.js +3 -3
  216. package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
  217. package/dist/core/storage/session/pinned-branch-resume.js +3 -3
  218. package/dist/core/storage/session/released-history-files.code.js +2 -2
  219. package/dist/core/storage/session/released-history-files.impl.js +3 -3
  220. package/dist/core/storage/session/released-history-files.js +3 -3
  221. package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
  222. package/dist/core/storage/session/resident-fork-rows.js +3 -3
  223. package/dist/core/storage/session/session-resume.impl.js +3 -3
  224. package/dist/core/storage/session/session-resume.js +3 -3
  225. package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
  226. package/dist/core/storage/session/snapshot-cut.js +3 -3
  227. package/dist/core/storage/session/snapshot-history.code.js +3 -3
  228. package/dist/core/storage/session/snapshot-history.impl.js +3 -3
  229. package/dist/core/storage/session/snapshot-history.js +3 -3
  230. package/dist/core/storage/session/sql-session-store.code.js +1 -1
  231. package/dist/core/storage/session/sql-session-store.d.ts +1 -1
  232. package/dist/core/storage/session/sql-session-store.impl.js +3 -3
  233. package/dist/core/storage/session/sql-session-store.js +3 -3
  234. package/dist/core/storage/session/tree-outline.impl.js +3 -3
  235. package/dist/core/storage/session/tree-outline.js +3 -3
  236. package/dist/core/storage/session/tree-presentation.impl.js +3 -3
  237. package/dist/core/storage/session/tree-presentation.js +3 -3
  238. package/dist/core/storage/sqlite-facade.js +6 -4
  239. package/dist/core/storage/sqlite-facade.js.map +1 -1
  240. package/dist/core/storage/storage-status.impl.js +3 -3
  241. package/dist/core/storage/storage-status.js +3 -3
  242. package/dist/core/storage/team.impl.js +3 -3
  243. package/dist/core/storage/team.js +3 -3
  244. package/dist/core/structured-output/index.code.js +1 -1
  245. package/dist/core/structured-output/index.impl.js +3 -3
  246. package/dist/core/structured-output/index.js +3 -3
  247. package/dist/core/subscription-usage-credential.d.ts +2 -0
  248. package/dist/core/subscription-usage-endpoints.d.ts +54 -0
  249. package/dist/core/subscription-usage.d.ts +55 -0
  250. package/dist/core/subscription-usage.js +3 -0
  251. package/dist/core/subscription-usage.js.map +1 -0
  252. package/dist/core/tasks/heartbeat-notice.d.ts +0 -1
  253. package/dist/core/tasks/task-completion-entry.impl.js +3 -3
  254. package/dist/core/tasks/task-completion-entry.js +3 -3
  255. package/dist/core/tasks/task-file-history.code.js +3 -3
  256. package/dist/core/tasks/task-file-history.impl.js +3 -3
  257. package/dist/core/tasks/task-file-history.js +3 -3
  258. package/dist/core/tasks/task-reference-archive.code.js +4 -4
  259. package/dist/core/tasks/task-reference-archive.js +3 -3
  260. package/dist/core/tasks/task-reference-identity.js +3 -3
  261. package/dist/core/tasks/task-reference-stream.impl.js +3 -3
  262. package/dist/core/tasks/task-reference-stream.js +3 -3
  263. package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
  264. package/dist/core/tasks/task-unsaved-answer.js +3 -3
  265. package/dist/core/tasks/task-view-source.code.js +1 -1
  266. package/dist/core/tasks/task-view-source.impl.js +3 -3
  267. package/dist/core/tasks/task-view-source.js +3 -3
  268. package/dist/core/tools/edit-diff.d.ts +4 -6
  269. package/dist/core/tools/read-url.code.js +3 -3
  270. package/dist/core/tools/read-url.impl.js +3 -3
  271. package/dist/core/tools/read-url.js +3 -3
  272. package/dist/core/worktree-snapshot/blob-store.d.ts +14 -16
  273. package/dist/core/worktree-snapshot/blob-store.js +194 -81
  274. package/dist/core/worktree-snapshot/blob-store.js.map +1 -1
  275. package/dist/core/worktree-snapshot/collection-claim.js +8 -0
  276. package/dist/core/worktree-snapshot/collection-claim.js.map +1 -0
  277. package/dist/core/worktree-snapshot/errors.code.js +2 -2
  278. package/dist/core/worktree-snapshot/errors.impl.js +3 -3
  279. package/dist/core/worktree-snapshot/errors.js +3 -3
  280. package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
  281. package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
  282. package/dist/core/worktree-snapshot/snapshot-epoch-migration.js +209 -0
  283. package/dist/core/worktree-snapshot/snapshot-epoch-migration.js.map +1 -0
  284. package/dist/core/worktree-snapshot/snapshot-epoch.js +100 -0
  285. package/dist/core/worktree-snapshot/snapshot-epoch.js.map +1 -0
  286. package/dist/extensions/codemode/execute.code.js +1 -1
  287. package/dist/extensions/codemode/execute.impl.js +3 -3
  288. package/dist/extensions/codemode/execute.js +3 -3
  289. package/dist/extensions/codemode/renderer.code.js +2 -2
  290. package/dist/extensions/codemode/renderer.impl.js +3 -3
  291. package/dist/extensions/codemode/renderer.js +3 -3
  292. package/dist/extensions/mcp/cli.code.js +2 -2
  293. package/dist/extensions/mcp/cli.impl.js +3 -3
  294. package/dist/extensions/mcp/cli.js +3 -3
  295. package/dist/extensions/mcp/cli.lazy.code.js +2 -2
  296. package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
  297. package/dist/extensions/mcp/cli.lazy.js +3 -3
  298. package/dist/extensions/mcp/runtime.code.js +1 -1
  299. package/dist/extensions/mcp/runtime.impl.js +3 -3
  300. package/dist/extensions/mcp/runtime.js +3 -3
  301. package/dist/index.d.ts +3 -0
  302. package/dist/index.js +7 -7
  303. package/dist/main-first-time-setup.code.js +1 -1
  304. package/dist/main-first-time-setup.impl.js +3 -3
  305. package/dist/main-first-time-setup.js +3 -3
  306. package/dist/main.js +2 -2
  307. package/dist/modes/interactive/components/stored-tree-view.code.js +2 -2
  308. package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
  309. package/dist/modes/interactive/components/stored-tree-view.js +3 -3
  310. package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
  311. package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
  312. package/dist/modes/interactive/interactive-mode-surface.d.ts +1 -0
  313. package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
  314. package/dist/modes/interactive/interactive-mode.js +1 -1
  315. package/dist/modes/interactive-engine/isolated-runtime.d.ts +3 -0
  316. package/dist/modes/print-mode.js +1 -1
  317. package/dist/modes/rpc/rpc-client-api.d.ts +3 -0
  318. package/dist/modes/rpc/rpc-types.d.ts +25 -0
  319. package/dist/package-manager-cli.code.js +31 -8
  320. package/dist/package-manager-cli.code.js.map +1 -1
  321. package/dist/package-manager-cli.impl.js +3 -3
  322. package/dist/package-manager-cli.js +3 -3
  323. package/dist/rpc-entry.js +2 -2
  324. package/dist/startup-files.json +1 -1
  325. package/dist/startup-stages/12.js +1 -1
  326. package/dist/startup-stages/4.js +1 -1
  327. package/dist/startup-stages/6.js +1 -1
  328. package/dist/subscription-usage-sdk.d.ts +9 -0
  329. package/dist/utils/changelog.d.ts +1 -0
  330. package/dist/utils/startup-database-spare.code.js +2 -2
  331. package/dist/utils/startup-database-spare.impl.js +3 -3
  332. package/dist/utils/startup-database-spare.js +3 -3
  333. package/dist/utils/tools-manager.code.js +1 -1
  334. package/dist/utils/tools-manager.impl.js +3 -3
  335. package/dist/utils/tools-manager.js +3 -3
  336. package/docs/background-tasks/reference.md +1 -1
  337. package/docs/background-tasks.md +1 -1
  338. package/docs/changelog.mdx +53 -1
  339. package/docs/containerization.md +17 -15
  340. package/docs/docs.json +1 -0
  341. package/docs/getting-started/installation.md +132 -80
  342. package/docs/guides/subscription-usage.md +133 -0
  343. package/docs/guides/team-setup.md +14 -3
  344. package/docs/guides.md +3 -0
  345. package/docs/index.md +18 -6
  346. package/docs/intercom/operations.md +1 -1
  347. package/docs/orchestration/migrating-workflows.md +16 -10
  348. package/docs/orchestration/patterns.md +8 -2
  349. package/docs/orchestration.md +17 -8
  350. package/docs/quickstart.md +7 -15
  351. package/docs/reference/cli.md +32 -24
  352. package/docs/rpc/protocol.md +9 -1
  353. package/docs/rpc.md +1 -1
  354. package/docs/sdk/reference.md +5 -1
  355. package/docs/skills.md +20 -4
  356. package/docs/slash-commands.md +3 -2
  357. package/docs/storage/postgres/tuning.md +2 -0
  358. package/docs/storage/postgres.md +17 -0
  359. package/docs/tools.md +57 -12
  360. package/docs/usage.md +1 -0
  361. package/docs/windows.md +4 -4
  362. package/docs/worktree-snapshots/reference.md +1 -1
  363. package/package.json +9 -9
  364. package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js.map +0 -1
  365. package/dist/_shared/sdk-OHKMDJ74.js.map +0 -1
  366. package/dist/_shared/startup-0-0-OV6RAEAP.js.map +0 -1
  367. package/dist/_shared/startup-0-1-EZAJI6RE.js.map +0 -1
  368. package/dist/_shared/startup-8-1-LZFXSD3Z.js.map +0 -1
  369. package/dist/builtin/subagents/skills/workflow-files/SKILL.md +0 -28
@@ -46,6 +46,8 @@ import {
46
46
  type LeaseRenewalRequest,
47
47
  type LeaseRenewResult,
48
48
  type LeaseState,
49
+ LOST_SWEEP_MAINTENANCE,
50
+ LOST_SWEEP_STALE_AFTER_MS,
49
51
  MAINTENANCE_INTERVAL_MS,
50
52
  MAINTENANCE_STALE_AFTER_MS,
51
53
  type MaintenanceSubject,
@@ -1102,6 +1104,8 @@ export class MultiNodeRouter {
1102
1104
  private membership: Lease | undefined;
1103
1105
  /** The maintenance lease while this broker is the swarm's maintainer (`maintain`). */
1104
1106
  private maintenance: Lease | undefined;
1107
+ private lostSweep: Lease | undefined;
1108
+ private lostSweepRunning: Promise<void> | undefined;
1105
1109
  private subscription: WakeUpSubscription | undefined;
1106
1110
  private readonly presence = new Map<BrokerConnectedSession, PresenceEntry>();
1107
1111
  private readonly inflight = new Map<string, Inflight>();
@@ -2793,12 +2797,36 @@ export class MultiNodeRouter {
2793
2797
  * for its return, has its unparked asks failed as "unavailable": marked ended, so of brokers that find it lost at
2794
2798
  * once only the one that marked an ask tells its asker, through the outbox as an ended recipient's failure.
2795
2799
  */
2796
- private async sweepLostRecipients(): Promise<void> {
2800
+ private sweepLostRecipients(): Promise<void> {
2801
+ return (this.lostSweepRunning ??= this.sweepLostRecipientsOnce().finally(() => {
2802
+ this.lostSweepRunning = undefined;
2803
+ }));
2804
+ }
2805
+
2806
+ private async sweepLostRecipientsOnce(): Promise<void> {
2807
+ if (this.closed) return;
2797
2808
  const { afterRestartMs, afterStaleLeaseMs } = this.lostBounds;
2798
- const { leases } = this.state;
2809
+ const { leases, pendingAsks } = this.state;
2810
+ let sweeper: Lease | undefined;
2811
+ if (pendingAsks.coordinatesLostSweep === true) {
2812
+ if (this.lostSweep === undefined) {
2813
+ const current = await leases.read(LOST_SWEEP_MAINTENANCE);
2814
+ if (
2815
+ current.status === "found" &&
2816
+ current.lease.holderId !== this.brokerId &&
2817
+ current.lease.ageMs <= LOST_SWEEP_STALE_AFTER_MS
2818
+ ) return;
2819
+ }
2820
+ const acquired = await leases.acquire(LOST_SWEEP_MAINTENANCE, this.brokerId, LOST_SWEEP_STALE_AFTER_MS);
2821
+ this.lostSweep = sweeper = acquired.status === "acquired" ? acquired.lease : undefined;
2822
+ if (sweeper === undefined) return;
2823
+ if (this.closed) {
2824
+ await leases.release(sweeper);
2825
+ return;
2826
+ }
2827
+ }
2799
2828
  const lostAfterMs = BROKER_LEASE_STALE_AFTER_MS + afterStaleLeaseMs;
2800
- // #6560: only the leases stale past the bound, which while every broker renews its sessions' is none: every
2801
- // broker sweeps every backup poll, and reading every lease each time grew with the square of the swarm.
2829
+ // #6560: read only the leases stale past the bound. While every broker renews its sessions', this is none.
2802
2830
  const aged =
2803
2831
  leases.listAged === undefined
2804
2832
  ? (await leases.listLive("presence", Number.MAX_SAFE_INTEGER)).filter((lease) => lease.ageMs >= lostAfterMs)
@@ -2835,9 +2863,13 @@ export class MultiNodeRouter {
2835
2863
  live.add(subject.targetIdentity);
2836
2864
  }
2837
2865
  for (const [sessionId, { from, targetIdentity, boundMs }] of lost) {
2866
+ if (this.closed) return;
2838
2867
  if (live.has(sessionId) || live.has(targetIdentity) || this.host.sessions.has(sessionId)) continue;
2839
- if (await this.reservedForReturn(sessionId, targetIdentity, from)) continue;
2840
- const ended = await this.state.pendingAsks.endLost(sessionId);
2868
+ if (await this.reservedForReturn(sessionId, targetIdentity, from) || this.host.sessions.has(sessionId)) continue;
2869
+ const ended = await pendingAsks.endLost(
2870
+ sessionId,
2871
+ sweeper === undefined ? undefined : { targetIdentity, sweeper },
2872
+ );
2841
2873
  if (ended.status !== "listed") continue;
2842
2874
  const reason = lostRecipientReason(from.name ?? sessionId, boundMs);
2843
2875
  await this.failAsksTo(from, ended.asks, reason, "ended", "outside-groups", true);
@@ -6596,8 +6628,8 @@ export class MultiNodeRouter {
6596
6628
  * maintainer reads the lease and goes on while another holds it live; the maintainer takes it again, which renews
6597
6629
  * it, and so stays the maintainer while it runs. Once it stops, its lease goes stale after
6598
6630
  * `MAINTENANCE_STALE_AFTER_MS` (or is free at once, when it closed) and the next broker to check takes it over.
6599
- * Nothing here is needed for delivery: a broker's own scans and the sweeps for a stopped broker's recipients stay in
6600
- * `backupPoll`, on every broker.
6631
+ * Nothing here is needed for delivery; that stays in `backupPoll`. On PostgreSQL the more frequent sweep for a
6632
+ * stopped broker's recipients elects its own leader, independently of retention.
6601
6633
  */
6602
6634
  private async maintain(): Promise<void> {
6603
6635
  const { leases } = this.state;
@@ -6764,6 +6796,7 @@ export class MultiNodeRouter {
6764
6796
  if (this.membership !== undefined) await this.state.leases.release(this.membership);
6765
6797
  // Free for the next broker to check, rather than once it went stale.
6766
6798
  if (this.maintenance !== undefined) await this.state.leases.release(this.maintenance);
6799
+ if (this.lostSweep !== undefined) await this.state.leases.release(this.lostSweep);
6767
6800
  } catch (error) {
6768
6801
  this.report(error);
6769
6802
  }
@@ -26,6 +26,9 @@ export const BROKER_LEASE_STALE_AFTER_MS = 30_000;
26
26
  export const OUTBOX_CLAIM_STALE_AFTER_MS = 30_000;
27
27
  /** Safety-net outbox scan interval for brokers whose wake-ups were lost. */
28
28
  export const OUTBOX_BACKUP_POLL_INTERVAL_MS = 30_000;
29
+ /** A backup-poll sweeper that missed two polls no longer gets to mark questions ended. */
30
+ export const LOST_SWEEP_STALE_AFTER_MS = 2 * OUTBOX_BACKUP_POLL_INTERVAL_MS;
31
+ export const LOST_SWEEP_MAINTENANCE: MaintenanceSubject = { kind: "maintenance", task: "lost-recipients" };
29
32
  /**
30
33
  * How often the swarm's maintainer, one broker holding the maintenance lease, prunes the shared state past its retention
31
34
  * and expires the outbox rows left queued too long; each other broker checks this often whether the lease went stale.
@@ -765,7 +768,9 @@ export interface PendingAskStore {
765
768
  * this call marked, so of brokers that find it lost at once only one tells each asker. An ask marked earlier is
766
769
  * left to whoever marked it, or to `listEnded` once that broker stopped.
767
770
  */
768
- endLost(targetSessionId: string): Promise<PendingAskListResult>;
771
+ endLost(targetSessionId: string, guard?: { targetIdentity: string; sweeper: Lease }): Promise<PendingAskListResult>;
772
+ /** Whether the store can recheck this recipient's presence and the sweep leader's fence when it marks asks. */
773
+ readonly coordinatesLostSweep?: true;
769
774
  /** #4992: the ended ask's failure is queued; its route stays only to authorize that failure when it is delivered. */
770
775
  unmarkEnded(route: ReplyRoute): Promise<PendingAskMarkResult>;
771
776
  }
@@ -58,8 +58,6 @@ const LEASE_LOCK_WAIT_MS = 2_000;
58
58
 
59
59
  /** The statement of a presence acquisition's wait for the sends to its recipient under way: it only takes the lock. */
60
60
  const SENDS_PASSED = { sql: "SELECT 1 AS passed", params: [] };
61
- /** The setting a PostgreSQL batched lease renewal sets when any lease missed, so its follow-up read runs. */
62
- const LEASE_RENEW_MISSES = "atomic.intercom_lease_renew_misses";
63
61
 
64
62
  /**
65
63
  * The kind of the row whose `last_token` counts acquisitions on PostgreSQL where the order sequence is missing: see
@@ -474,6 +472,26 @@ async function openBrokerLeaseStoreInCatalog(options: IntercomBrokerStateOptions
474
472
  * spares the server a log flush per broker and per session every interval. Acquisitions and releases stay durable.
475
473
  */
476
474
  const renewal = { ...fenced, relaxedDurability: true } as const;
475
+ const renewPostgresRow = async (
476
+ kind: LeaseKind,
477
+ id: string,
478
+ holderId: string,
479
+ fencingToken: number,
480
+ subject: string | null,
481
+ ): Promise<boolean> => {
482
+ const guarded = [kind, id, holderId, fencingToken];
483
+ const write =
484
+ subject === null
485
+ ? { sql: `UPDATE ${table} SET renewed_at = ${nowMs} WHERE ${owned}`, params: guarded }
486
+ : { sql: `UPDATE ${table} SET renewed_at = ${nowMs}, subject_json = ? WHERE ${owned}`, params: [subject, ...guarded] };
487
+ // The UPDATE and COMMIT leave together. A paused client can delay reporting the result, not releasing its row.
488
+ const { changes } = await database.transaction((tx) => tx.run(write.sql, ...write.params), {
489
+ ...renewal,
490
+ leading: [write],
491
+ leadingOnly: true,
492
+ });
493
+ return changes === 1;
494
+ };
477
495
  /**
478
496
  * The order of a key acquired for the first time. A serial database runs one acquisition at a time, so the
479
497
  * largest order so far, plus one, is unique. PostgreSQL runs acquisitions beside one another, so each takes the
@@ -598,6 +616,16 @@ async function openBrokerLeaseStoreInCatalog(options: IntercomBrokerStateOptions
598
616
  if (subject !== undefined && (subject.kind !== lease.key.kind || keyId(keyOf(subject)) !== keyId(lease.key))) {
599
617
  return invalid("subject-key-mismatch");
600
618
  }
619
+ if (dialect.name === "postgres") {
620
+ const renewed = await renewPostgresRow(
621
+ lease.key.kind,
622
+ keyId(lease.key),
623
+ lease.holderId,
624
+ lease.fencingToken,
625
+ subject === undefined ? null : subjectJson(subject),
626
+ );
627
+ return renewed ? { status: "renewed" } : stale(await holderOf(reader, lease.key));
628
+ }
601
629
  return database.transaction(async (tx) => {
602
630
  const { changes } =
603
631
  subject === undefined
@@ -645,17 +673,13 @@ async function openBrokerLeaseStoreInCatalog(options: IntercomBrokerStateOptions
645
673
  }
646
674
  >();
647
675
  const validPairs = new Map<string, readonly [LeaseKind, string]>();
648
- let hasNonSafeIntToken = false;
649
676
  for (let i = 0; i < requests.length; i++) {
650
677
  if (invalidResults[i] !== undefined) continue;
651
678
  const { lease, subject } = requests[i]!;
652
679
  const id = keyId(lease.key);
653
680
  const pKey = pairKey(lease.key.kind, id);
654
681
  if (!validPairs.has(pKey)) validPairs.set(pKey, [lease.key.kind, id]);
655
- if (!Number.isSafeInteger(lease.fencingToken)) {
656
- hasNonSafeIntToken = true;
657
- continue;
658
- }
682
+ if (!Number.isSafeInteger(lease.fencingToken)) continue;
659
683
  const tKey = tupleKey(lease.key.kind, id, lease.holderId, lease.fencingToken);
660
684
  const nextSubject = subject === undefined ? undefined : subjectJson(subject);
661
685
  const existing = byTuple.get(tKey);
@@ -688,30 +712,21 @@ async function openBrokerLeaseStoreInCatalog(options: IntercomBrokerStateOptions
688
712
  return stale(found.get(pairKey(lease.key.kind, id)));
689
713
  });
690
714
  if (dialect.name === "postgres") {
691
- const pairsParam = JSON.stringify([...validPairs.values()], wellFormed);
692
- if (entries.length === 0) {
693
- const readAll: SqliteStatement = {
694
- sql: `WITH missed AS MATERIALIZED (
695
- SELECT entry ->> 0 AS kind, entry ->> 1 AS key
696
- FROM jsonb_array_elements((?)::jsonb) AS entry
697
- )
698
- SELECT t.kind, t.key, t.holder_id, t.fencing_token
699
- FROM ${table} AS t
700
- JOIN missed ON t.kind = missed.kind AND t.key = missed.key
701
- WHERE t.kind = ANY(ARRAY(SELECT DISTINCT kind FROM missed))
702
- AND t.key = ANY(ARRAY(SELECT DISTINCT key FROM missed))`,
703
- params: [pairsParam],
704
- };
705
- return database.transaction(
706
- async (tx) => {
707
- const found = new Map<string, MissedHolderRow>();
708
- for (const row of await tx.all<MissedHolderRow>(readAll.sql, ...readAll.params))
709
- found.set(pairKey(row.kind, row.key), row);
710
- return answer(new Set(), found);
711
- },
712
- { ...renewal, leading: [readAll], leadingOnly: true },
715
+ const readHolders = async (pairs: ReadonlyMap<string, readonly [LeaseKind, string]>) => {
716
+ const rows = await reader.all<MissedHolderRow>(
717
+ `WITH missed AS MATERIALIZED (
718
+ SELECT entry ->> 0 AS kind, entry ->> 1 AS key
719
+ FROM jsonb_array_elements((?)::jsonb) AS entry
720
+ )
721
+ SELECT t.kind, t.key, t.holder_id, t.fencing_token
722
+ FROM ${table} AS t JOIN missed ON t.kind = missed.kind AND t.key = missed.key
723
+ WHERE t.kind = ANY(ARRAY(SELECT DISTINCT kind FROM missed))
724
+ AND t.key = ANY(ARRAY(SELECT DISTINCT key FROM missed))`,
725
+ JSON.stringify([...pairs.values()], wellFormed),
713
726
  );
714
- }
727
+ return new Map(rows.map((row) => [pairKey(row.kind, row.key), row]));
728
+ };
729
+ if (entries.length === 0) return answer(new Set(), await readHolders(validPairs));
715
730
  const write: SqliteStatement = {
716
731
  sql: `WITH requested AS MATERIALIZED (
717
732
  SELECT
@@ -733,25 +748,14 @@ async function openBrokerLeaseStoreInCatalog(options: IntercomBrokerStateOptions
733
748
  WHERE t.kind = ANY(ARRAY(SELECT DISTINCT kind FROM requested))
734
749
  AND t.key = ANY(ARRAY(SELECT DISTINCT key FROM requested))
735
750
  ORDER BY t.kind, t.key
736
- FOR UPDATE OF t
737
- ),
738
- renewed AS (
739
- UPDATE ${table} AS t
740
- SET renewed_at = ${nowMs}, subject_json = COALESCE(locked.subject_json, t.subject_json)
741
- FROM locked
742
- WHERE t.kind = locked.kind
743
- AND t.key = locked.key
744
- AND t.holder_id = locked.holder_id
745
- AND t.fencing_token = locked.fencing_token
746
- RETURNING t.kind, t.key, t.holder_id, t.fencing_token
747
- ),
748
- gate AS MATERIALIZED (
749
- SELECT set_config('${LEASE_RENEW_MISSES}',
750
- CASE WHEN (SELECT COUNT(*) FROM renewed) < CAST(? AS ${types.int}) THEN '1' ELSE '' END,
751
- true) AS misses
751
+ FOR NO KEY UPDATE OF t SKIP LOCKED
752
752
  )
753
- SELECT renewed.kind, renewed.key, renewed.holder_id, renewed.fencing_token
754
- FROM gate LEFT JOIN renewed ON TRUE`,
753
+ UPDATE ${table} AS t
754
+ SET renewed_at = ${nowMs}, subject_json = COALESCE(locked.subject_json, t.subject_json)
755
+ FROM locked
756
+ WHERE t.kind = locked.kind AND t.key = locked.key
757
+ AND t.holder_id = locked.holder_id AND t.fencing_token = locked.fencing_token
758
+ RETURNING t.kind, t.key, t.holder_id, t.fencing_token`,
755
759
  params: [
756
760
  JSON.stringify(
757
761
  entries.map((entry) => [
@@ -763,41 +767,46 @@ async function openBrokerLeaseStoreInCatalog(options: IntercomBrokerStateOptions
763
767
  ]),
764
768
  wellFormed,
765
769
  ),
766
- entries.length + (hasNonSafeIntToken ? 1 : 0),
767
770
  ],
768
771
  };
769
- const readMisses: SqliteStatement = {
770
- sql: `WITH missed AS MATERIALIZED (
771
- SELECT entry ->> 0 AS kind, entry ->> 1 AS key
772
- FROM jsonb_array_elements((?)::jsonb) AS entry
773
- WHERE current_setting('${LEASE_RENEW_MISSES}', true) = '1'
774
- )
775
- SELECT t.kind, t.key, t.holder_id, t.fencing_token
776
- FROM ${table} AS t
777
- JOIN missed ON t.kind = missed.kind AND t.key = missed.key
778
- WHERE current_setting('${LEASE_RENEW_MISSES}', true) = '1'
779
- AND t.kind = ANY(ARRAY(SELECT DISTINCT kind FROM missed))
780
- AND t.key = ANY(ARRAY(SELECT DISTINCT key FROM missed))`,
781
- params: [pairsParam],
782
- };
783
- return database.transaction(
784
- async (tx) => {
785
- const renewed = new Set<string>();
786
- for (const row of await tx.all<RenewedLeaseRow>(write.sql, ...write.params))
787
- if (
788
- row.kind !== null &&
789
- row.key !== null &&
790
- row.holder_id !== null &&
791
- row.fencing_token !== null
792
- )
793
- renewed.add(tupleKey(row.kind, row.key, row.holder_id, Number(row.fencing_token)));
794
- const found = new Map<string, MissedHolderRow>();
795
- for (const row of await tx.all<MissedHolderRow>(readMisses.sql, ...readMisses.params))
796
- found.set(pairKey(row.kind, row.key), row);
797
- return answer(renewed, found);
798
- },
799
- { ...renewal, leading: [write, readMisses], leadingOnly: true },
772
+ const rows = await database.transaction((tx) => tx.all<MissedHolderRow>(write.sql, ...write.params), {
773
+ ...renewal,
774
+ leading: [write],
775
+ leadingOnly: true,
776
+ });
777
+ const renewed = new Set(
778
+ rows.map((row) => tupleKey(row.kind, row.key, row.holder_id!, Number(row.fencing_token))),
800
779
  );
780
+ const missed = new Map<string, readonly [LeaseKind, string]>();
781
+ for (const [i, { lease }] of requests.entries()) {
782
+ if (invalidResults[i] !== undefined) continue;
783
+ const id = keyId(lease.key);
784
+ if (
785
+ !Number.isSafeInteger(lease.fencingToken) ||
786
+ !renewed.has(tupleKey(lease.key.kind, id, lease.holderId, lease.fencingToken))
787
+ ) missed.set(pairKey(lease.key.kind, id), [lease.key.kind, id]);
788
+ }
789
+ if (missed.size === 0) return answer(renewed, new Map());
790
+ // Commit the batch before looking up misses. A row that still has the exact holder and token was busy:
791
+ // wait for it in its own short transaction, without holding the already-renewed rows locked.
792
+ const found = await readHolders(missed);
793
+ const changed = new Map<string, readonly [LeaseKind, string]>();
794
+ await Promise.all(
795
+ entries.map(async ({ kind, id, holderId, fencingToken, subjectJson }) => {
796
+ const tuple = tupleKey(kind, id, holderId, fencingToken);
797
+ if (renewed.has(tuple)) return;
798
+ const pair = pairKey(kind, id);
799
+ const holder = found.get(pair);
800
+ if (holder?.holder_id !== holderId.toWellFormed() || Number(holder.fencing_token) !== fencingToken) return;
801
+ if (await renewPostgresRow(kind, id, holderId, fencingToken, subjectJson)) renewed.add(tuple);
802
+ else changed.set(pair, [kind, id]);
803
+ }),
804
+ );
805
+ if (changed.size > 0) {
806
+ for (const pair of changed.keys()) found.delete(pair);
807
+ for (const [pair, holder] of await readHolders(changed)) found.set(pair, holder);
808
+ }
809
+ return answer(renewed, found);
801
810
  }
802
811
  const write: SqliteStatement | undefined =
803
812
  entries.length === 0
@@ -1,4 +1,4 @@
1
- import { dialectOf, type SqliteRow, validateStoragePrefix } from "@bastani/atomic/storage";
1
+ import { dialectOf, fencedPath, type SqliteRow, validateStoragePrefix } from "@bastani/atomic/storage";
2
2
  import type {
3
3
  IntercomBrokerStateOptions,
4
4
  InvalidStateInput,
@@ -17,10 +17,15 @@ import type {
17
17
  ReplyRoute,
18
18
  StateStoreInvalidReason,
19
19
  } from "./multinode-state-store.js";
20
- import { SETTLED_ASK_RETENTION_MS } from "./multinode-state-store.js";
20
+ import {
21
+ BROKER_LEASE_STALE_AFTER_MS,
22
+ LOST_SWEEP_MAINTENANCE,
23
+ LOST_SWEEP_STALE_AFTER_MS,
24
+ SETTLED_ASK_RETENTION_MS,
25
+ } from "./multinode-state-store.js";
21
26
  import { addMissingColumns } from "./sql-add-column.js";
22
27
  import { storeNow } from "./sql-retention.js";
23
- import { ensureBrokerSchema, RETRY_UNAPPLIED, withBrokerSchemaCatalog } from "./sql-schema.js";
28
+ import { brokerSchemaCurrent, ensureBrokerSchema, RETRY_UNAPPLIED, withBrokerSchemaCatalog } from "./sql-schema.js";
24
29
 
25
30
  type AskRow = SqliteRow & { sender_session_id: string; target_session_id: string; message_id: string };
26
31
 
@@ -60,8 +65,9 @@ async function openPendingAskStoreInCatalog({
60
65
  database,
61
66
  prefix,
62
67
  }: IntercomBrokerStateOptions): Promise<PendingAskStore> {
63
- const table = `${validateStoragePrefix(prefix, dialectOf(database).name)}intercom_pending_asks`;
64
- const { types, nowMs } = dialectOf(database);
68
+ const { name, types, nowMs } = dialectOf(database);
69
+ const storagePrefix = validateStoragePrefix(prefix, name);
70
+ const table = `${storagePrefix}intercom_pending_asks`;
65
71
  /**
66
72
  * Its transactions read and write this table and the settled asks alone, which no other store touches, so they
67
73
  * exclude one another, not every writer of the database (#6560).
@@ -111,8 +117,11 @@ async function openPendingAskStoreInCatalog({
111
117
  const reverseRoute = "sender_session_id = ? AND target_session_id = ? AND message_id = ?";
112
118
  const reverseParams = (route: ReplyRoute) =>
113
119
  [route.replyTargetSessionId, route.replySenderSessionId, route.replyTo] as const;
120
+ const leases = `${storagePrefix}intercom_leases`;
121
+ let addressColumns: Promise<boolean> | undefined;
114
122
 
115
123
  return {
124
+ ...(name === "postgres" ? { coordinatesLostSweep: true as const } : {}),
116
125
  async record(ask): Promise<PendingAskRecordResult> {
117
126
  const bad = invalidAsk(ask);
118
127
  if (bad !== undefined) return bad;
@@ -288,8 +297,58 @@ async function openPendingAskStoreInCatalog({
288
297
  );
289
298
  return { status: "listed", asks: rows.map(toAsk) };
290
299
  },
291
- async endLost(targetSessionId): Promise<PendingAskListResult> {
300
+ async endLost(targetSessionId, guard): Promise<PendingAskListResult> {
292
301
  if (targetSessionId.length === 0) return invalid("empty-session-id");
302
+ if (name === "postgres") {
303
+ if (
304
+ guard !== undefined &&
305
+ (guard.sweeper.key.kind !== "maintenance" || guard.sweeper.key.task !== LOST_SWEEP_MAINTENANCE.task)
306
+ ) return { status: "listed", asks: [] };
307
+ // The scan is only a hint. Recheck the leader's fence and the recipient in this write's snapshot.
308
+ // Lock existing presence rows too, so an in-flight renewal or takeover causes a retry rather than a
309
+ // decision from the previous version of the row. Do not wait in a queue for any of these locks.
310
+ let fences = "";
311
+ let canMark = "";
312
+ const params: Array<string | number> = [];
313
+ if (guard !== undefined) {
314
+ const indexed = await (addressColumns ??= brokerSchemaCurrent(database, prefix, "lease-addresses"));
315
+ const presenceId = indexed
316
+ ? "presence_id"
317
+ : `CASE WHEN subject_json !~ (chr(92) || chr(92) || 'u(0000|[dD][89a-fA-F])')
318
+ THEN subject_json::json #>> '{session,id}' END`;
319
+ fences = `sweeper AS MATERIALIZED (
320
+ SELECT 1 FROM ${leases} WHERE kind = 'maintenance' AND key = ? AND holder_id = ?
321
+ AND fencing_token = ? AND renewed_at >= ${nowMs} - ? FOR SHARE NOWAIT
322
+ ), recipient AS MATERIALIZED (
323
+ SELECT holder_id, renewed_at FROM ${leases} WHERE kind = 'presence'
324
+ AND (key IN (?, ?) OR ${presenceId} IN (?, ?)) ORDER BY key FOR SHARE NOWAIT
325
+ ), `;
326
+ canMark = `AND EXISTS (SELECT 1 FROM sweeper) AND NOT EXISTS (
327
+ SELECT 1 FROM recipient WHERE holder_id IS NOT NULL AND renewed_at >= ${nowMs} - ?
328
+ )`;
329
+ params.push(
330
+ LOST_SWEEP_MAINTENANCE.task, guard.sweeper.holderId, guard.sweeper.fencingToken, LOST_SWEEP_STALE_AFTER_MS,
331
+ guard.targetIdentity, targetSessionId, targetSessionId, guard.targetIdentity,
332
+ );
333
+ }
334
+ const open = "target_session_id = ? AND park_owner IS NULL AND replied IS NULL AND ended_at IS NULL";
335
+ const mark = {
336
+ sql: `WITH ${fences} open_asks AS MATERIALIZED (
337
+ SELECT "order" FROM ${table} WHERE ${open} ${canMark} ORDER BY "order" FOR UPDATE SKIP LOCKED
338
+ ), marked AS (
339
+ UPDATE ${table} SET ended_at = ${nowMs} WHERE "order" IN (SELECT "order" FROM open_asks)
340
+ RETURNING "order", sender_session_id, target_session_id, message_id
341
+ ) SELECT sender_session_id, target_session_id, message_id FROM marked ORDER BY "order"`,
342
+ params: [...params, targetSessionId, ...(guard === undefined ? [] : [BROKER_LEASE_STALE_AFTER_MS])],
343
+ };
344
+ const rows = await database.transaction((tx) => tx.all<AskRow>(mark.sql, ...mark.params), {
345
+ ...RETRY_UNAPPLIED,
346
+ concurrency: { kind: "fenced", audit: fencedPath("intercom-lost-ask") },
347
+ leading: [mark],
348
+ leadingOnly: true,
349
+ });
350
+ return { status: "listed", asks: rows.map(toAsk) };
351
+ }
293
352
  const rows = await database.transaction(async (tx) => {
294
353
  const open = await tx.all<AskRow & { order: number | bigint }>(
295
354
  `SELECT "order", sender_session_id, target_session_id, message_id FROM ${table}
@@ -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.18-alpha.1") missing.unshift(application + " was updated to 0.10.18-alpha.1 while this session was running; restart it to keep using the intercom extension.");
10
+ if (__atomicHostImport0.VERSION !== "0.10.19-alpha.1") missing.unshift(application + " was updated to 0.10.19-alpha.1 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
  }
@@ -2465,6 +2465,7 @@ var CORE_COMMAND_NAMES;
2465
2465
  var init_builtin_command_names = __esm(() => {
2466
2466
  CORE_COMMAND_NAMES = [
2467
2467
  "settings",
2468
+ "usage",
2468
2469
  "model",
2469
2470
  "tree",
2470
2471
  "thinking",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/intercom",
3
- "version": "0.10.18-alpha.1",
3
+ "version": "0.10.19-alpha.1",
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.18-alpha.1") missing.unshift(application + " was updated to 0.10.18-alpha.1 while this session was running; restart it to keep using the mcp extension.");
9
+ if (__atomicHostImport0.VERSION !== "0.10.19-alpha.1") missing.unshift(application + " was updated to 0.10.19-alpha.1 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.18-alpha.1",
3
+ "version": "0.10.19-alpha.1",
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,21 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.10.19-alpha.1] - 2026-11-28
6
+
7
+ ### Breaking Changes
8
+
9
+ - Atomic renamed the bundled `workflow-files` skill to `workflow`. The old name no longer works. Replace `/skill:workflow-files` with `/skill:workflow` in saved prompts. Use `skill://workflow` in skill links and `workflow` in subagent skill lists ([#6854](https://github.com/bastani-inc/atomic/pull/6854)).
10
+
11
+ ### Changed
12
+
13
+ - The `impeccable` skill stops waiting when a live preview stays idle and keeps the choices you already made. Setup no longer starts by asking you to sign in ([#6851](https://github.com/bastani-inc/atomic/pull/6851)).
14
+
15
+ ### Fixed
16
+
17
+ - The `research-codebase` skill tells the agent how to wait for existing research tasks without starting them again ([#6851](https://github.com/bastani-inc/atomic/pull/6851)).
18
+ - The `subagent` skill now explains when a subagent should reuse the parent conversation and when to give one agent responsibility for editing files ([#6851](https://github.com/bastani-inc/atomic/pull/6851)).
19
+
5
20
  ## [0.10.16] - 2026-11-27
6
21
 
7
22
  ### Fixed
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/subagents",
3
- "version": "0.10.18-alpha.1",
3
+ "version": "0.10.19-alpha.1",
4
4
  "private": true,
5
5
  "description": "Atomic extension for delegating tasks to subagents with parallel execution.",
6
6
  "contributors": [
@@ -4,7 +4,7 @@ description: Browser automation CLI for AI agents. Use when the user needs to in
4
4
  hidden: true
5
5
  metadata:
6
6
  github-path: skills/agent-browser
7
- github-ref: refs/tags/v0.44.0
7
+ github-ref: refs/tags/v0.45.0
8
8
  github-repo: https://github.com/vercel-labs/agent-browser
9
9
  github-tree-sha: d75a393c9a371295c6d6be46c34938e76ef21184
10
10
  name: agent-browser
@@ -1,13 +1,13 @@
1
1
  ---
2
2
  name: impeccable
3
3
  description: "Use when the user wants to design, redesign, shape, critique, audit, polish, simplify, harden, animate, or otherwise improve a frontend interface: websites, landing pages, dashboards, product UI, components, forms, settings, onboarding, empty states, and native iOS or Android screens. Handles UX review, hierarchy, layout, typography, color, motion, UX copy, accessibility, responsive behavior, edge cases, and capturing or documenting design systems (DESIGN.md, tokens). Also for making bland UI bolder, loud UI quieter, or ambitious visual effects. Not for backend-only or non-UI tasks."
4
- version: 4.10.0
4
+ version: 4.11.1
5
5
  license: Apache 2.0
6
6
  metadata:
7
7
  github-repo: https://github.com/pbakaus/impeccable
8
8
  github-path: .pi/skills/impeccable
9
- github-ref: refs/tags/skill-v4.10.0
10
- github-tree-sha: 7599aea6ba9028d2f04369f6955c697fede04e0d
9
+ github-ref: refs/tags/skill-v4.11.1
10
+ github-tree-sha: 3936d8c7fab681cdc1a731047a7c3762d313f33b
11
11
  allowed-tools:
12
12
  - Bash(npx impeccable *)
13
13
  - Bash(.pi/skills/impeccable/scripts/impeccable *)
@@ -150,8 +150,8 @@ Keep P3s few: a long tail of minor issues buries the ones that matter.
150
150
  After the report is delivered, save a copy so the findings outlive this conversation: write it, from the score table through Recommended Actions, to a temp file, then run the write command with the scores as metadata and delete the temp file:
151
151
 
152
152
  ```bash
153
- IMPECCABLE_REPORT_META='{"target":"<user phrasing, or .>","total_score":<n>,"max_score":20,"p0_count":<n>,"p1_count":<n>,"p2_count":<n>,"p3_count":<n>}' \
153
+ IMPECCABLE_REPORT_META='{"target":"<user phrasing, or .>","title":"<page title, or empty>","total_score":<n>,"max_score":20,"p0_count":<n>,"p1_count":<n>,"p2_count":<n>,"p3_count":<n>}' \
154
154
  .pi/skills/impeccable/scripts/impeccable audit-storage write "<resolved target, or . for the whole project>" <temp-file>
155
155
  ```
156
156
 
157
- The helper prints the path it wrote, which you mention in one line; `REPORTS OFF:` means the project opted out, and you mention nothing. Saving never replaces delivering: the user reads the report in chat first.
157
+ Use the observed `<title>` or first h1 for `title`; leave it empty when unknown. The helper prints the path it wrote, which you mention in one line. Pass any `Saved to Impeccable: <url>` or `Not saved to Impeccable: <reason>` line on to the person word for word; `REPORTS OFF:` means the project opted out, and you mention nothing. Saving never replaces delivering: the user reads the report in chat first.
@@ -209,14 +209,14 @@ Skip this step if the Setup slug was null (vague or root-level target), and say
209
209
 
210
210
  1. **Write the body to a temp file** so you can pipe it to the helper. Use the full critique report (heuristic table, design-specificity verdict, priority issues, persona red flags, minor observations, and questions), but stop before the "Ask the User" / "Recommended Actions" sections that come later.
211
211
 
212
- This is a copy of the report you already delivered above, for later commands to read. It is not delivery. If you find yourself composing the report for the first time inside this heredoc, you have skipped Deliver the Report; go back and send it.
212
+ Copy the delivered report for later commands to read. If you are composing it for the first time in this heredoc, you skipped Deliver the Report; go back and send it.
213
213
 
214
214
  2. **Pass the structured metadata** through `IMPECCABLE_CRITIQUE_META` (JSON), then run the write command:
215
215
  ```bash
216
- IMPECCABLE_CRITIQUE_META='{"target":"<user phrasing>","total_score":<n>,"max_score":<n>,"na_heuristics":"<comma-separated numbers, or empty>","p0_count":<n>,"p1_count":<n>}' \
216
+ IMPECCABLE_CRITIQUE_META='{"target":"<user phrasing>","title":"<page title, or empty>","url":"<http(s) URL you viewed, or empty>","pr":"<PR number checked out, or empty>","heuristics":[{"n":<1-10>,"score":<0-4>}],"total_score":<n>,"max_score":<n>,"na_heuristics":"<comma-separated numbers, or empty>","p0_count":<n>,"p1_count":<n>,"p2_count":<n>,"p3_count":<n>}' \
217
217
  .pi/skills/impeccable/scripts/impeccable critique-storage write "<resolved target>" <body-file>
218
218
  ```
219
- `max_score` is the applicable maximum from the heuristic table (40 when every heuristic applied), so a later run can tell a renormalized total from a full one. For a local file target, the helper also records an exact content fingerprint so polish can distinguish the assessed bytes from later edits without relying on Git state or timestamps. The helper prints the absolute path it wrote, and sometimes one more line (`Saved to Impeccable: <link>`, `Not saved to Impeccable: <reason>` or `Keep this critique's history: impeccable login`); put that line in the close word for word. Leave that file on disk. Polish closes it; this run does not. `REPORTS OFF:` instead means the project opted out of saved reports: skip the trend read and carry on.
219
+ Use the observed `<title>` or first h1 for `title`; omit N/A heuristics. `max_score` is the table’s applicable maximum (40 if all apply), distinguishing renormalized totals. For local files the helper records an exact content fingerprint, so polish detects later edits without Git or timestamps. The helper prints the absolute saved path, sometimes followed by a line (`Saved to Impeccable: <link>` or `Not saved to Impeccable: <reason>`); put that line in the close word for word, also from detect (JSON `savedTo`: `Saved to Impeccable: <url>`). Leave that file on disk. Polish closes it; this run does not. `REPORTS OFF:` instead means the project opted out of saved reports: skip the trend read and carry on.
220
220
 
221
221
  3. **Delete the temp body file** after the write attempt completes, whether the write succeeded or failed. If deletion fails, mention `temp-file cleanup failed: <reason>` briefly in the final output, but do not block the critique.
222
222
 
@@ -77,7 +77,7 @@ The event is a standard `generate` event: the picked element's context, a prefli
77
77
  .pi/skills/impeccable/scripts/impeccable live-poll --reply EVENT_ID done --file src/App.jsx --then-poll
78
78
  ```
79
79
 
80
- This replies done (the browser mounts the variants) and then blocks until the user's choice arrives, so run it the way your harness runs a long wait: **Claude Code** in the foreground with your tool's longest timeout (600000 ms), so you are paused until the choice arrives; **Codex** in a yielded foreground exec. Never pass a short `--timeout=`. While it runs there is nothing else to do: never sleep and never poll its output on a timer; a harness that backgrounds it wakes you when it returns. `{"type":"timeout"}` means the user has not chosen yet: run `live-poll` again and keep waiting. If the edit fails after the browser flipped to GENERATING, `--reply EVENT_ID error "Short reason"` (without `--then-poll`) so the bar resets.
80
+ This replies done (the browser mounts the variants) and then blocks until the user's choice arrives, so run it the way your harness runs a long wait: **Claude Code** in the foreground with your tool's longest timeout (600000 ms), so you are paused until the choice arrives; **Codex** in a yielded foreground exec. Never pass a short `--timeout=`. While it runs there is nothing else to do: never sleep and never poll its output on a timer; a harness that backgrounds it wakes you when it returns. `{"type":"timeout"}` means the user has not chosen yet: run `live-poll` again, at most twice (about 30 minutes of waiting in all). After the third timeout, stop polling: tell the user the variants are still live on the page, to Accept or Discard there and then tell you, and end your turn; one `live-poll` collects the queued choice, and Step 4 runs from there. If the edit fails after the browser flipped to GENERATING, `--reply EVENT_ID error "Short reason"` (without `--then-poll`) so the bar resets.
81
81
 
82
82
  Then tell the user, in one line, where their variants are: *"Three [bolder] variants are live on [the pricing cards]: cycle with the floating bar's arrows, adjust the Tune knobs, and Accept the keeper."*
83
83
 
@@ -24,8 +24,6 @@ Form a platform hypothesis: `web`, `ios`, `android`, or `adaptive` (one product
24
24
 
25
25
  ## Step 3: Interview for product truth
26
26
 
27
- **Your first message opens with the sign-in when it's missing.** If `impeccable context` printed `ACCOUNT: not signed in` (or printed no `ACCOUNT:` line and `.pi/skills/impeccable/scripts/impeccable whoami` prints `Not signed in`), the first line of your first message to the person, before any question, structured or plain-chat, is: "Run `npx impeccable login` to keep your critiques and audits in your Impeccable account. It's free, and creates the account if you're new." Say it once per init. Signed in, say nothing about it.
28
-
29
27
  Ask the user directly to clarify what you cannot infer. Ask only about material gaps the repository and original request do not answer with strong evidence.
30
28
 
31
29
  Use the structured question tool when available; otherwise ask and wait. Keep rounds to at most three focused questions and require one real answer or approval round before writing a new PRODUCT.md. Confirm inferences.