@bastani/atomic 0.10.10 → 0.10.11-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (402) hide show
  1. package/CHANGELOG.md +139 -0
  2. package/README.md +1 -1
  3. package/dist/_shared/dist-KOELCESV.js +2 -2
  4. package/dist/_shared/fork-row-index-UAUAQRD5.js +2 -2
  5. package/dist/_shared/lib-4PES5P4V.js +2 -2
  6. package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js +11 -13
  7. package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js.map +1 -1
  8. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +9 -9
  9. package/dist/_shared/mode-shared-2QJSCUM6.js +55 -18
  10. package/dist/_shared/mode-shared-2QJSCUM6.js.map +1 -1
  11. package/dist/_shared/p1a-prewarm-XIU57JHF.js +3 -3
  12. package/dist/_shared/runtime-O4KCSG4C.js +5 -5
  13. package/dist/_shared/{sdk-RRLVN7ER.js → sdk-IQMULKFU.js} +2962 -470
  14. package/dist/_shared/sdk-IQMULKFU.js.map +1 -0
  15. package/dist/_shared/session-data-AHTU7IS6.js +4 -4
  16. package/dist/_shared/session-manager-list-2BLEEZVG.js +1 -1
  17. package/dist/_shared/settings-startup-8-DNZ2RIHM.js +1 -1
  18. package/dist/_shared/{settings-startup-4QCVCI53.js → settings-startup-HXQLSUWM.js} +8 -2
  19. package/dist/_shared/settings-startup-HXQLSUWM.js.map +1 -0
  20. package/dist/_shared/{startup-0-0-4VG2G44V.js → startup-0-0-3IXNMFM2.js} +482 -53
  21. package/dist/_shared/startup-0-0-3IXNMFM2.js.map +1 -0
  22. package/dist/_shared/{startup-0-1-XTIL65D4.js → startup-0-1-7T2IAE7J.js} +121 -251
  23. package/dist/_shared/startup-0-1-7T2IAE7J.js.map +1 -0
  24. package/dist/_shared/{startup-0-2-27OWFHV6.js → startup-0-2-5QHPCEON.js} +293 -10
  25. package/dist/_shared/startup-0-2-5QHPCEON.js.map +1 -0
  26. package/dist/_shared/{startup-0-3-T4DVFYWX.js → startup-0-3-4ZYBYQNM.js} +273 -14
  27. package/dist/_shared/startup-0-3-4ZYBYQNM.js.map +1 -0
  28. package/dist/_shared/startup-0-4-ZMJV547D.js +6 -6
  29. package/dist/_shared/{startup-0-5-FD2P735I.js → startup-0-5-YDW47QX6.js} +29 -71
  30. package/dist/_shared/startup-0-5-YDW47QX6.js.map +1 -0
  31. package/dist/_shared/startup-10-0-TDQNBDDL.js +9 -9
  32. package/dist/_shared/startup-12-0-55AAXBJZ.js +4 -4
  33. package/dist/_shared/startup-14-0-MLX36RBG.js +6 -6
  34. package/dist/_shared/startup-15-0-YUKGAC63.js +34 -10
  35. package/dist/_shared/startup-15-0-YUKGAC63.js.map +1 -1
  36. package/dist/_shared/startup-15-1-4S7FLMNG.js +10 -9
  37. package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
  38. package/dist/_shared/startup-8-0-34CBHPZH.js +421 -84
  39. package/dist/_shared/startup-8-0-34CBHPZH.js.map +1 -1
  40. package/dist/_shared/{startup-8-1-4KANEHRA.js → startup-8-1-X32CYSXB.js} +1291 -722
  41. package/dist/_shared/startup-8-1-X32CYSXB.js.map +1 -0
  42. package/dist/_shared/storage-command-7MGXLJGZ.js +17 -9
  43. package/dist/_shared/storage-command-7MGXLJGZ.js.map +1 -1
  44. package/dist/_shared/task-reference-stream-JWMUZSJX.js +1 -1
  45. package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
  46. package/dist/_shared/tree-outline-MUEPK5B7.js +3 -3
  47. package/dist/builtin/intercom/CHANGELOG.md +29 -0
  48. package/dist/builtin/intercom/broker/broker.bundle.mjs +1138 -384
  49. package/dist/builtin/intercom/broker/database-wake-up-bus.ts +103 -24
  50. package/dist/builtin/intercom/broker/multinode-router.ts +42 -21
  51. package/dist/builtin/intercom/broker/multinode-state-store.ts +22 -1
  52. package/dist/builtin/intercom/broker/open-broker-state.ts +82 -31
  53. package/dist/builtin/intercom/broker/paths.ts +8 -4
  54. package/dist/builtin/intercom/broker/released-asker-remote-replies.ts +18 -6
  55. package/dist/builtin/intercom/broker/sql-add-column.ts +4 -1
  56. package/dist/builtin/intercom/broker/sql-ended-child-queue-store.ts +65 -44
  57. package/dist/builtin/intercom/broker/sql-held-send-store.ts +11 -3
  58. package/dist/builtin/intercom/broker/sql-known-session-store.ts +24 -12
  59. package/dist/builtin/intercom/broker/sql-lease-store.ts +386 -65
  60. package/dist/builtin/intercom/broker/sql-outbox-store.ts +462 -130
  61. package/dist/builtin/intercom/broker/sql-pending-ask-store.ts +20 -9
  62. package/dist/builtin/intercom/broker/sql-released-ask-store.ts +14 -6
  63. package/dist/builtin/intercom/broker/sql-restoring-reservation-store.ts +27 -11
  64. package/dist/builtin/intercom/broker/sql-schema.ts +198 -5
  65. package/dist/builtin/intercom/broker/sql-sent-message-authority.ts +97 -34
  66. package/dist/builtin/intercom/index.bundle.mjs +11 -8
  67. package/dist/builtin/intercom/package.json +1 -1
  68. package/dist/builtin/mcp/index.bundle.mjs +1 -1
  69. package/dist/builtin/mcp/package.json +1 -1
  70. package/dist/builtin/subagents/CHANGELOG.md +18 -0
  71. package/dist/builtin/subagents/package.json +1 -1
  72. package/dist/builtin/subagents/skills/skill-creator/SKILL.md +1 -1
  73. package/dist/builtin/subagents/src/extension/index.bundle.mjs +62 -23
  74. package/dist/builtin/web-access/index.bundle.mjs +1 -1
  75. package/dist/builtin/web-access/package.json +1 -1
  76. package/dist/cli/args.js +2 -2
  77. package/dist/cli/auth-cli.code.js +6 -6
  78. package/dist/cli/auth-cli.impl.js +3 -3
  79. package/dist/cli/auth-cli.js +3 -3
  80. package/dist/cli/blueprint-command.code.js +4 -4
  81. package/dist/cli/blueprint-command.impl.js +3 -3
  82. package/dist/cli/blueprint-command.js +3 -3
  83. package/dist/cli/intercom-command.code.js +3 -3
  84. package/dist/cli/intercom-command.impl.js +3 -3
  85. package/dist/cli/intercom-command.js +3 -3
  86. package/dist/cli/list-models.code.js +2 -2
  87. package/dist/cli/list-models.impl.js +3 -3
  88. package/dist/cli/list-models.js +3 -3
  89. package/dist/cli/session-picker.code.js +2 -2
  90. package/dist/cli/session-picker.impl.js +3 -3
  91. package/dist/cli/session-picker.js +3 -3
  92. package/dist/cli/startup-ui.code.js +2 -2
  93. package/dist/cli/startup-ui.impl.js +3 -3
  94. package/dist/cli/startup-ui.js +3 -3
  95. package/dist/cli/storage-command.impl.js +3 -3
  96. package/dist/cli/storage-command.js +3 -3
  97. package/dist/cli/storage-search-session.code.js +3 -3
  98. package/dist/cli/storage-search-session.impl.js +3 -3
  99. package/dist/cli/storage-search-session.js +3 -3
  100. package/dist/cli/team-command.code.js +3 -3
  101. package/dist/cli/team-command.impl.js +3 -3
  102. package/dist/cli/team-command.js +3 -3
  103. package/dist/cli.js +2 -2
  104. package/dist/core/agent-session-methods.d.ts +3 -0
  105. package/dist/core/agent-session-methods.js.map +1 -1
  106. package/dist/core/agent-session.d.ts +1 -0
  107. package/dist/core/compaction/compactor.d.ts +2 -0
  108. package/dist/core/debug.impl.js +3 -3
  109. package/dist/core/debug.js +3 -3
  110. package/dist/core/export-html/card-projection.code.js +1 -1
  111. package/dist/core/export-html/card-projection.impl.js +3 -3
  112. package/dist/core/export-html/card-projection.js +3 -3
  113. package/dist/core/export-html/index.code.js +2 -2
  114. package/dist/core/export-html/index.impl.js +3 -3
  115. package/dist/core/export-html/index.js +3 -3
  116. package/dist/core/export-html/json-spans.impl.js +3 -3
  117. package/dist/core/export-html/json-spans.js +3 -3
  118. package/dist/core/export-html/oversized-render-inputs.code.js +2 -2
  119. package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
  120. package/dist/core/export-html/oversized-render-inputs.js +3 -3
  121. package/dist/core/export-html/tool-renderer.impl.js +3 -3
  122. package/dist/core/export-html/tool-renderer.js +3 -3
  123. package/dist/core/extensions/jiti-loader.impl.js +3 -3
  124. package/dist/core/extensions/jiti-loader.js +3 -3
  125. package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
  126. package/dist/core/extensions/jiti-static-loader.js +3 -3
  127. package/dist/core/extensions/loader-host-modules.code.js +1 -1
  128. package/dist/core/extensions/loader-host-modules.impl.js +3 -3
  129. package/dist/core/extensions/loader-host-modules.js +3 -3
  130. package/dist/core/extensions/loader-virtual-modules.js +2 -2
  131. package/dist/core/extensions/runner-context.js +4 -4
  132. package/dist/core/extensions/runner-context.js.map +1 -1
  133. package/dist/core/intercom-broker-control-host.code.js +1 -1
  134. package/dist/core/intercom-broker-control-host.impl.js +3 -3
  135. package/dist/core/intercom-broker-control-host.js +3 -3
  136. package/dist/core/intercom-broker-control.code.js +3 -3
  137. package/dist/core/intercom-broker-control.impl.js +3 -3
  138. package/dist/core/intercom-broker-control.js +3 -3
  139. package/dist/core/model-registry.js +1 -1
  140. package/dist/core/model-resolver-defaults.d.ts +3 -2
  141. package/dist/core/package-manager-storage-adapters.code.js +1 -1
  142. package/dist/core/package-manager-storage-adapters.impl.js +3 -3
  143. package/dist/core/package-manager-storage-adapters.js +3 -3
  144. package/dist/core/sdk.code.js +4 -5
  145. package/dist/core/sdk.impl.js +3 -3
  146. package/dist/core/sdk.js +3 -3
  147. package/dist/core/session-manager-core.d.ts +5 -2
  148. package/dist/core/session-manager-core.js +39 -23
  149. package/dist/core/session-manager-core.js.map +1 -1
  150. package/dist/core/session-manager-list.impl.js +3 -3
  151. package/dist/core/session-manager-list.js +3 -3
  152. package/dist/core/session-manager.code.js +3 -3
  153. package/dist/core/session-manager.impl.js +3 -3
  154. package/dist/core/session-manager.js +3 -3
  155. package/dist/core/session-open-markers.js +3 -0
  156. package/dist/core/session-open-markers.js.map +1 -0
  157. package/dist/core/session-storage.code.js +1 -1
  158. package/dist/core/session-storage.impl.js +3 -3
  159. package/dist/core/session-storage.js +3 -3
  160. package/dist/core/storage/added-exports.d.ts +6 -0
  161. package/dist/core/storage/added-exports.js +19 -0
  162. package/dist/core/storage/added-exports.js.map +1 -0
  163. package/dist/core/storage/database.d.ts +53 -0
  164. package/dist/core/storage/database.js.map +1 -1
  165. package/dist/core/storage/fenced-paths.d.ts +47 -0
  166. package/dist/core/storage/fenced-paths.js +53 -0
  167. package/dist/core/storage/fenced-paths.js.map +1 -1
  168. package/dist/core/storage/file-identity.js +31 -2
  169. package/dist/core/storage/file-identity.js.map +1 -1
  170. package/dist/core/storage/index.d.ts +4 -1
  171. package/dist/core/storage/index.js +5 -2
  172. package/dist/core/storage/index.js.map +1 -1
  173. package/dist/core/storage/migrations.d.ts +33 -2
  174. package/dist/core/storage/migrations.js +73 -5
  175. package/dist/core/storage/migrations.js.map +1 -1
  176. package/dist/core/storage/node-sqlite-thread.js +48 -6
  177. package/dist/core/storage/node-sqlite-thread.js.map +1 -1
  178. package/dist/core/storage/node-sqlite.js +137 -4
  179. package/dist/core/storage/node-sqlite.js.map +1 -1
  180. package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
  181. package/dist/core/storage/offline-snapshot-file.js +3 -3
  182. package/dist/core/storage/prefix.d.ts +3 -2
  183. package/dist/core/storage/prefix.js +23 -2
  184. package/dist/core/storage/prefix.js.map +1 -1
  185. package/dist/core/storage/provider.js +2 -2
  186. package/dist/core/storage/schema-catalog.d.ts +120 -0
  187. package/dist/core/storage/schema-catalog.js +351 -0
  188. package/dist/core/storage/schema-catalog.js.map +1 -0
  189. package/dist/core/storage/selection.js +2 -2
  190. package/dist/core/storage/session/branch-fork-source.code.js +47 -25
  191. package/dist/core/storage/session/branch-fork-source.code.js.map +1 -1
  192. package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
  193. package/dist/core/storage/session/branch-fork-source.js +3 -3
  194. package/dist/core/storage/session/card-view.impl.js +3 -3
  195. package/dist/core/storage/session/card-view.js +3 -3
  196. package/dist/core/storage/session/child-reader.code.js +4 -4
  197. package/dist/core/storage/session/child-reader.impl.js +3 -3
  198. package/dist/core/storage/session/child-reader.js +3 -3
  199. package/dist/core/storage/session/chunked-resume-projection.code.js +1 -1
  200. package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
  201. package/dist/core/storage/session/chunked-resume-projection.js +3 -3
  202. package/dist/core/storage/session/errors.js +1 -1
  203. package/dist/core/storage/session/expanded-child-details.code.js +4 -4
  204. package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
  205. package/dist/core/storage/session/expanded-child-details.js +3 -3
  206. package/dist/core/storage/session/fork-detach.d.ts +118 -0
  207. package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
  208. package/dist/core/storage/session/fork-row-bytes.js +3 -3
  209. package/dist/core/storage/session/fork-row-index.impl.js +3 -3
  210. package/dist/core/storage/session/fork-row-index.js +3 -3
  211. package/dist/core/storage/session/fork-schema.js +53 -0
  212. package/dist/core/storage/session/fork-schema.js.map +1 -0
  213. package/dist/core/storage/session/fork-segments.d.ts +58 -0
  214. package/dist/core/storage/session/fork-staging.code.js +176 -36
  215. package/dist/core/storage/session/fork-staging.code.js.map +1 -1
  216. package/dist/core/storage/session/fork-staging.impl.js +3 -3
  217. package/dist/core/storage/session/fork-staging.js +3 -3
  218. package/dist/core/storage/session/fork-sweep.js +61 -0
  219. package/dist/core/storage/session/fork-sweep.js.map +1 -0
  220. package/dist/core/storage/session/fork-window.code.js +4 -4
  221. package/dist/core/storage/session/fork-window.impl.js +3 -3
  222. package/dist/core/storage/session/fork-window.js +3 -3
  223. package/dist/core/storage/session/history-pages.impl.js +3 -3
  224. package/dist/core/storage/session/history-pages.js +3 -3
  225. package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
  226. package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
  227. package/dist/core/storage/session/jsonl-session-store.d.ts +37 -1
  228. package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
  229. package/dist/core/storage/session/jsonl-session-store.js +3 -3
  230. package/dist/core/storage/session/memory-session-store.impl.js +3 -3
  231. package/dist/core/storage/session/memory-session-store.js +3 -3
  232. package/dist/core/storage/session/pinned-branch-resume.code.js +3 -3
  233. package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
  234. package/dist/core/storage/session/pinned-branch-resume.js +3 -3
  235. package/dist/core/storage/session/released-history-files.code.js +3 -3
  236. package/dist/core/storage/session/released-history-files.impl.js +3 -3
  237. package/dist/core/storage/session/released-history-files.js +3 -3
  238. package/dist/core/storage/session/resident-fork-rows.code.js +1 -1
  239. package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
  240. package/dist/core/storage/session/resident-fork-rows.js +3 -3
  241. package/dist/core/storage/session/session-resume.impl.js +3 -3
  242. package/dist/core/storage/session/session-resume.js +3 -3
  243. package/dist/core/storage/session/session-search-index.d.ts +5 -0
  244. package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
  245. package/dist/core/storage/session/snapshot-cut.js +3 -3
  246. package/dist/core/storage/session/snapshot-history.code.js +4 -4
  247. package/dist/core/storage/session/snapshot-history.impl.js +3 -3
  248. package/dist/core/storage/session/snapshot-history.js +3 -3
  249. package/dist/core/storage/session/sql-chat-records.d.ts +15 -0
  250. package/dist/core/storage/session/sql-session-store.code.js +1 -1
  251. package/dist/core/storage/session/sql-session-store.d.ts +445 -11
  252. package/dist/core/storage/session/sql-session-store.impl.js +4 -4
  253. package/dist/core/storage/session/sql-session-store.js +4 -4
  254. package/dist/core/storage/session/tree-outline.impl.js +3 -3
  255. package/dist/core/storage/session/tree-outline.js +3 -3
  256. package/dist/core/storage/session/tree-presentation.code.js +1 -1
  257. package/dist/core/storage/session/tree-presentation.impl.js +3 -3
  258. package/dist/core/storage/session/tree-presentation.js +3 -3
  259. package/dist/core/storage/session/types.d.ts +36 -0
  260. package/dist/core/storage/sqlite-facade.d.ts +54 -6
  261. package/dist/core/storage/sqlite-facade.js +384 -18
  262. package/dist/core/storage/sqlite-facade.js.map +1 -1
  263. package/dist/core/storage/statement-sequence.d.ts +83 -0
  264. package/dist/core/storage/statement-sequence.js +21 -0
  265. package/dist/core/storage/statement-sequence.js.map +1 -1
  266. package/dist/core/storage/storage-status.code.js +1 -1
  267. package/dist/core/storage/storage-status.impl.js +3 -3
  268. package/dist/core/storage/storage-status.js +3 -3
  269. package/dist/core/storage/team.code.js +1 -1
  270. package/dist/core/storage/team.impl.js +3 -3
  271. package/dist/core/storage/team.js +3 -3
  272. package/dist/core/structured-output/index.code.js +1 -1
  273. package/dist/core/structured-output/index.impl.js +3 -3
  274. package/dist/core/structured-output/index.js +3 -3
  275. package/dist/core/tasks/task-completion-entry.code.js +1 -1
  276. package/dist/core/tasks/task-completion-entry.impl.js +3 -3
  277. package/dist/core/tasks/task-completion-entry.js +3 -3
  278. package/dist/core/tasks/task-file-history.code.js +4 -4
  279. package/dist/core/tasks/task-file-history.impl.js +3 -3
  280. package/dist/core/tasks/task-file-history.js +3 -3
  281. package/dist/core/tasks/task-reference-archive.code.js +5 -5
  282. package/dist/core/tasks/task-reference-archive.js +3 -3
  283. package/dist/core/tasks/task-reference-identity.js +3 -3
  284. package/dist/core/tasks/task-reference-stream.impl.js +3 -3
  285. package/dist/core/tasks/task-reference-stream.js +3 -3
  286. package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
  287. package/dist/core/tasks/task-unsaved-answer.js +3 -3
  288. package/dist/core/tasks/task-view-source.code.js +1 -1
  289. package/dist/core/tasks/task-view-source.impl.js +3 -3
  290. package/dist/core/tasks/task-view-source.js +3 -3
  291. package/dist/core/tools/bash.d.ts +8 -4
  292. package/dist/core/tools/history-session.d.ts +7 -0
  293. package/dist/core/tools/history-tasks.d.ts +123 -0
  294. package/dist/core/tools/kill.d.ts +5 -2
  295. package/dist/core/tools/powershell.d.ts +2 -2
  296. package/dist/core/tools/read-url.code.js +3 -3
  297. package/dist/core/tools/read-url.impl.js +3 -3
  298. package/dist/core/tools/read-url.js +3 -3
  299. package/dist/core/tools/read.d.ts +12 -2
  300. package/dist/core/tools/resource-selectors.d.ts +2 -0
  301. package/dist/core/tools/search.d.ts +12 -2
  302. package/dist/core/worktree-snapshot/blob-store.d.ts +45 -2
  303. package/dist/core/worktree-snapshot/blob-store.js +228 -60
  304. package/dist/core/worktree-snapshot/blob-store.js.map +1 -1
  305. package/dist/core/worktree-snapshot/errors.code.js +3 -3
  306. package/dist/core/worktree-snapshot/errors.impl.js +3 -3
  307. package/dist/core/worktree-snapshot/errors.js +3 -3
  308. package/dist/core/worktree-snapshot/fork-snapshot-index.js +121 -0
  309. package/dist/core/worktree-snapshot/fork-snapshot-index.js.map +1 -0
  310. package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
  311. package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
  312. package/dist/extensions/codemode/execute.code.js +3 -3
  313. package/dist/extensions/codemode/execute.impl.js +3 -3
  314. package/dist/extensions/codemode/execute.js +3 -3
  315. package/dist/extensions/codemode/renderer.code.js +2 -2
  316. package/dist/extensions/codemode/renderer.impl.js +3 -3
  317. package/dist/extensions/codemode/renderer.js +3 -3
  318. package/dist/extensions/mcp/cli.code.js +3 -3
  319. package/dist/extensions/mcp/cli.impl.js +3 -3
  320. package/dist/extensions/mcp/cli.js +3 -3
  321. package/dist/extensions/mcp/cli.lazy.code.js +2 -2
  322. package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
  323. package/dist/extensions/mcp/cli.lazy.js +3 -3
  324. package/dist/extensions/mcp/runtime.code.js +1 -1
  325. package/dist/extensions/mcp/runtime.impl.js +3 -3
  326. package/dist/extensions/mcp/runtime.js +3 -3
  327. package/dist/index.js +8 -8
  328. package/dist/main-first-time-setup.code.js +2 -2
  329. package/dist/main-first-time-setup.impl.js +3 -3
  330. package/dist/main-first-time-setup.js +3 -3
  331. package/dist/main.js +1 -1
  332. package/dist/modes/interactive/components/agent-panel.d.ts +1 -0
  333. package/dist/modes/interactive/components/stored-tree-view.code.js +3 -3
  334. package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
  335. package/dist/modes/interactive/components/stored-tree-view.js +3 -3
  336. package/dist/modes/interactive/components/task-inspector.d.ts +2 -0
  337. package/dist/modes/interactive/components/user-message-selector-archive.code.js +1 -1
  338. package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
  339. package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
  340. package/dist/modes/interactive/interactive-mode-helpers.d.ts +2 -2
  341. package/dist/modes/print-mode.js +1 -1
  342. package/dist/modes/rpc/agent-panel-bridge.d.ts +5 -0
  343. package/dist/package-manager-cli.code.js +7 -7
  344. package/dist/package-manager-cli.impl.js +3 -3
  345. package/dist/package-manager-cli.js +3 -3
  346. package/dist/rpc-entry.js +1 -1
  347. package/dist/startup-files.json +1 -1
  348. package/dist/startup-stages/0.js +1 -1
  349. package/dist/startup-stages/1.js +1 -1
  350. package/dist/startup-stages/10.js +1 -1
  351. package/dist/startup-stages/12.js +1 -1
  352. package/dist/startup-stages/2.js +9 -1
  353. package/dist/startup-stages/3.js +1 -6
  354. package/dist/startup-stages/5.js +1 -1
  355. package/dist/startup-stages/7.js +1 -1
  356. package/dist/startup-stages/8.js +2 -2
  357. package/dist/utils/startup-database-spare.code.js +3 -3
  358. package/dist/utils/startup-database-spare.impl.js +3 -3
  359. package/dist/utils/startup-database-spare.js +3 -3
  360. package/dist/utils/tools-manager.code.js +1 -1
  361. package/dist/utils/tools-manager.impl.js +3 -3
  362. package/dist/utils/tools-manager.js +3 -3
  363. package/docs/background-tasks.md +123 -23
  364. package/docs/compaction.md +18 -0
  365. package/docs/docs.json +2 -0
  366. package/docs/environment-variables.md +1 -1
  367. package/docs/getting-started/installation.md +9 -2
  368. package/docs/guides/postgres-pgbouncer.md +346 -0
  369. package/docs/guides/postgres-tuning.md +311 -0
  370. package/docs/guides/resume-on-any-machine.md +2 -2
  371. package/docs/guides.md +2 -0
  372. package/docs/index.md +1 -1
  373. package/docs/libraries/agent-core.md +1 -1
  374. package/docs/libraries/ai.md +2 -2
  375. package/docs/libraries/codemode.md +1 -1
  376. package/docs/libraries/storage-libsql.md +6 -1
  377. package/docs/libraries/storage-postgres.md +11 -6
  378. package/docs/libraries/tui.md +1 -1
  379. package/docs/libraries.md +2 -2
  380. package/docs/programmatic.md +1 -1
  381. package/docs/quickstart.md +1 -1
  382. package/docs/sdk/storage.md +1 -1
  383. package/docs/sdk/web-server.md +1 -3
  384. package/docs/sdk.md +1 -7
  385. package/docs/sessions.md +67 -2
  386. package/docs/settings.md +20 -1
  387. package/docs/skills/authoring.md +1 -1
  388. package/docs/skills.md +79 -6
  389. package/docs/storage.md +305 -14
  390. package/docs/subagents/reference.md +2 -2
  391. package/docs/subagents.md +4 -3
  392. package/docs/tools.md +44 -10
  393. package/docs/windows.md +1 -1
  394. package/package.json +9 -9
  395. package/dist/_shared/sdk-RRLVN7ER.js.map +0 -1
  396. package/dist/_shared/settings-startup-4QCVCI53.js.map +0 -1
  397. package/dist/_shared/startup-0-0-4VG2G44V.js.map +0 -1
  398. package/dist/_shared/startup-0-1-XTIL65D4.js.map +0 -1
  399. package/dist/_shared/startup-0-2-27OWFHV6.js.map +0 -1
  400. package/dist/_shared/startup-0-3-T4DVFYWX.js.map +0 -1
  401. package/dist/_shared/startup-0-5-FD2P735I.js.map +0 -1
  402. package/dist/_shared/startup-8-1-4KANEHRA.js.map +0 -1
@@ -1,11 +1,11 @@
1
1
  import { __commonJSMin, __require } from "./rolldown-runtime-BGM3D5V3.js";
2
2
  import { APP_NAME, ENV_SESSION_DIR, VERSION, createChildProcessEnvironment, createModuleRequire, findHelperExecutable, findHelperExecutableAsync, getAgentDir, getBinDir, getProjectConfigDirs, isBunBinary, isBundledBuild, isPathWithin, loadOnDemand, markLifecycleTiming, normalizePath, processLaunch, processLaunchAsync, releaseRetainedWindowsProcessExitHandle, resolutionBaseUrl, resolvePath, resolveSafeWindowsKillCwdLexical, resolveSafeWindowsWorkingDirectoryAsync, retainWindowsProcessExitHandle, spawnLaunchedProcess, spawnLaunchedProcessSync, stripBom } from "./p0-cli-BB45ZQY6.js";
3
- import { ActivityWatchdog, CompactionCancelledError, CompactorFailure, Diff, JSON_RPC_ERROR_CODES, MAX_TOOL_DETACHMENT_AFTER_MS, McpAbortError, McpConnectionClosedError, NON_SECRET_HTTP_HEADERS, ROW_INTENT_META, STARTUP_DECISION_TYPED_TEXT_NOTICE, TASK_MARKS, TaskCleanupAdmissionTimeoutError, TaskEvictedError, TrustDecisionSelector, VisualLinePreview, asyncScope, chatEpoch, collectSecretsForMasking, combineUsage, computeBoxDimensions, createSourceInfo, createTypeScriptSourceSpecifierTransform, defaultModelPerProvider, defineTool, fetchWithRetry, fieldTone, flushable, formatSize, getErrnoCode, getFunctionList, getPiUserAgent, getSyntheticPathSource, getTextOutput, holdProcessDescendants, holdProcessDescendantsResult, invalidArgText, isFlushable, isFunctionList, isJsonRpcRequest, isJsonRpcResponse, isStdoutTakenOver, isStop, isSyntheticPath, isTrustDecision, isValidThinkingLevel, linkPath, many, none, parseJsonRpcMessage, redactCredentials, redactOAuthErrorText, redactOAuthErrorTextCapped, redactWwwAuthenticateHeader, removedProviderMessage, renderBorderedBox, require_applyReviver, require_constants, require_debug, require_identifiers, require_identity, require_parse_options, require_parse_url, resolveDecisionDeadlineMs, resourceInternals, safeTrustChoiceIndex, scrubFetchError, scrubUnknownErrorData, setFunctionList, spanElapsedMs, spawnContainedProcess, str, styleFieldTone, toError, validateTimeoutOverride } from "./startup-0-0-4VG2G44V.js";
4
- import { AgentRehydrateError, AgentReleaseConfigError, EMPTY_OUTPUT_TEXT, ExtensionInputComponent, ExtensionSelectorComponent, FirstTimeSetupComponent, LlamaClient, MULTI_SUBMIT_LABEL, MarkdownContentCache, NestedToolCallRunner, RESERVED_LABELS, SESSION_STORAGE_JOIN, SessionKeyDigests, SessionStorageSelectionSchema, SettingsSchema, StorageSelectionSchema, StringEnum as StringEnum$1, TransportEvents, WorkspaceConfigError, WrappingSelect, acceptsForkReplay, cancelReceiptStatus, chatAnswerIntent, chatNumberingFor, cleanupFailureSummary, computeFocusedOptionHasPreview, currentResourceAdmission, diffLines, discoverChatFile, errorMessage, flush, formatAnswerScalar, formatTokenSegment, genBridge, getBuiltinExtensionEntryLabel, getCommandEnv, getGitShellEnvironmentAsync, getLoaderAgentDirs, getVirtualModules, lifecycleScopeForOwner, llamaInferenceUrl, messageIsLlmVisible, next, normalizeLlamaServerUrl, normalizeMessageContent, normalizeModelFailureSignal, normalizeModelReference, normalizeProviderKeys, parseInteractiveEngineMessage, presentTaskError, readFileChatRecords, readInlineCaret, require_from_url, require_re, require_toJS, require_visit, resizeImageInProcess, resolveInlineDraftValue, runCallback, runSynchronousCallback, selectActivePreviewPaneIndex, selectActiveTabItems, selectConfirmedIndicator, sessionLifecycleCreation, stopIndex, streamCutDurationMs, tokenize, trackTranspileCacheWrite, trackWindowsDirectorySecurityWork, userLikeContentBlockIsLlmVisible, verifyWindowsDirectorySecurity, verifyWindowsDirectorySecurityAsync, waitResultTail, waitStatus, withInlineDraft, withTranspileCacheWriteOwner, withWindowsDirectorySecurityOwner } from "./startup-0-1-XTIL65D4.js";
3
+ import { ActivityWatchdog, CompactionCancelledError, CompactorFailure, Diff, ForkSourceIncompleteError, JSON_RPC_ERROR_CODES, LIVE_COMMAND_LIMIT_MESSAGE, MAX_TOOL_DETACHMENT_AFTER_MS, McpAbortError, McpConnectionClosedError, NON_SECRET_HTTP_HEADERS, ROW_INTENT_META, STARTUP_DECISION_TYPED_TEXT_NOTICE, TASK_MARKS, TaskCleanupAdmissionTimeoutError, TaskEvictedError, TrustDecisionSelector, VisualLinePreview, asyncScope, chatEpoch, collectSecretsForMasking, combineUsage, computeBoxDimensions, createSourceInfo, createTypeScriptSourceSpecifierTransform, defineTool, fetchWithRetry, fieldTone, findProviderDefaultModel, flushable, formatSize, getErrnoCode, getFunctionList, getPiUserAgent, getSyntheticPathSource, getTextOutput, holdProcessDescendants, holdProcessDescendantsResult, invalidArgText, isFlushable, isFunctionList, isJsonRpcRequest, isJsonRpcResponse, isStdoutTakenOver, isStop, isSyntheticPath, isTrustDecision, isValidThinkingLevel, linkPath, many, none, parseJsonRpcMessage, redactCredentials, redactOAuthErrorText, redactOAuthErrorTextCapped, redactWwwAuthenticateHeader, removedProviderMessage, renderBorderedBox, require_applyReviver, require_constants, require_debug, require_identifiers, require_identity, require_parse_options, require_parse_url, resolveDecisionDeadlineMs, resourceInternals, safeTrustChoiceIndex, scrubFetchError, scrubUnknownErrorData, segmentLength, setFunctionList, spanElapsedMs, spawnContainedProcess, str, styleFieldTone, toError, validateTimeoutOverride } from "./startup-0-0-3IXNMFM2.js";
4
+ import { AgentRehydrateError, AgentReleaseConfigError, EMPTY_OUTPUT_TEXT, ExtensionInputComponent, ExtensionSelectorComponent, FirstTimeSetupComponent, LlamaClient, MULTI_SUBMIT_LABEL, MarkdownContentCache, NestedToolCallRunner, RESERVED_LABELS, SESSION_STORAGE_JOIN, SessionKeyDigests, SessionStorageSelectionSchema, SettingsSchema, StorageSelectionSchema, StringEnum as StringEnum$1, TransportEvents, WorkspaceConfigError, WrappingSelect, acceptsForkReplay, cancelReceiptStatus, chatAnswerIntent, chatNumberingFor, cleanupFailureSummary, computeFocusedOptionHasPreview, currentResourceAdmission, diffLines, discoverChatFile, errorMessage, flush, formatAnswerScalar, formatTokenSegment, genBridge, getBuiltinExtensionEntryLabel, getCommandEnv, getGitShellEnvironmentAsync, getLoaderAgentDirs, getVirtualModules, lifecycleScopeForOwner, llamaInferenceUrl, messageIsLlmVisible, next, normalizeLlamaServerUrl, normalizeMessageContent, normalizeModelFailureSignal, normalizeModelReference, normalizeProviderKeys, parseInteractiveEngineMessage, presentTaskError, readFileChatRecords, readInlineCaret, reparentedSegments, require_from_url, require_re, require_toJS, require_visit, resizeImageInProcess, resolveInlineDraftValue, runCallback, runSynchronousCallback, selectActivePreviewPaneIndex, selectActiveTabItems, selectConfirmedIndicator, sessionLifecycleCreation, splitSegment, stopIndex, streamCutDurationMs, tokenize, trackTranspileCacheWrite, trackWindowsDirectorySecurityWork, userLikeContentBlockIsLlmVisible, verifyWindowsDirectorySecurity, verifyWindowsDirectorySecurityAsync, waitResultTail, waitStatus, withInlineDraft, withTranspileCacheWriteOwner, withWindowsDirectorySecurityOwner } from "./startup-0-1-7T2IAE7J.js";
5
5
  import { KeybindingsManager as KeybindingsManager$1, clickableHintText, clickableKeyTextHint, detectTerminalThemeForAuto, graphemeAt, initTheme, keepStartupDialogDraft, parenthesizedKeyHint, setTheme, singleLineDisplayText, terminalDisplayCursor, terminalDisplayText, theme, withEarlyInputHeldForStartupDialog } from "./p2-shell-main-B2WIALFD.js";
6
6
  import { stripJsonComments } from "./p1-shared-RG5I5LJ6.js";
7
7
  import { findInCauseChain, guardLockRemoval, nativeProcessCreationTime, nativeTerminateProcess, redactCredentialShapes, rehydrateErrorCause, releaseLock, releaseLockSync, renameReplacing, renameReplacingAsync, serializeErrorCause, waitForLock, waitForLockSync } from "./p1b-elig-ENCUPKKJ.js";
8
- import { rehydrateDecisionError } from "./settings-startup-4QCVCI53.js";
8
+ import { rehydrateDecisionError } from "./settings-startup-HXQLSUWM.js";
9
9
  import * as fs from "node:fs/promises";
10
10
  import { chmod, lstat, mkdir, mkdtemp, readFile, rm, stat } from "node:fs/promises";
11
11
  import { chmodSync, existsSync, mkdirSync, readFileSync, realpath as realpath$1, realpathSync, rmSync, statSync, writeFileSync } from "fs";
@@ -41,6 +41,7 @@ import { ProviderCompatSchema } from "@bastani/atomic-ai/providers/compat-schema
41
41
  import { Compile } from "@bastani/atomic-ai/utils/typebox/compile";
42
42
  import { buildModelsDevChatModels, finalizeChatModels } from "@bastani/atomic-ai/utils/models-dev-catalog";
43
43
  import { getProviderRetryAfterMs } from "@bastani/atomic-ai/utils/retry-hints";
44
+ import { lookup } from "node:dns/promises";
44
45
  import { anthropicAssistantReplayContent } from "@bastani/atomic-ai/api/anthropic-assistant-content";
45
46
  import { isProducedByModel } from "@bastani/atomic-ai/api/transform-messages";
46
47
  import { Value } from "@bastani/atomic-ai/utils/typebox/value";
@@ -940,6 +941,224 @@ function killProcessTree(pid) {
940
941
  }
941
942
  }
942
943
  }
944
+ // dist/core/storage/session/fork-detach.js
945
+ /**
946
+ * Detaching lazy forks from a session (Neon's detach_ancestor). A fork in a SQL store reads the rows it inherited
947
+ * through segments that point at the sessions owning them, which keep those rows while any segment points at them. To
948
+ * really delete or rewrite such a session, every fork still pointing at it first gets its own copy of those rows:
949
+ *
950
+ * 1. Block: the segments pin the parent's rows, and a progress row records the detach and the child's original map.
951
+ * 2. Copy: a page of the parent's rows moves into the child at the global seqs the segment gave them, and in the same
952
+ * transaction the segment shrinks past them, so every seq is covered by a segment or by a row of the child's own,
953
+ * never both, and the child reads the same at every commit.
954
+ * 3. Publish: each page commits; the segments are the progress, so a crash resumes with the segments that remain.
955
+ * 4-6. The last page also removes the child's last segment on the parent, re-points at the child's copy each other
956
+ * fork of the parent that reads only rows the child's prefix holds (its cut-off at or below the child's), and
957
+ * removes the progress row, in one transaction.
958
+ *
959
+ * A detach locks the sessions whose segments it changes for update, in ID order, and never the parent. The store's
960
+ * delete and replace lock a session for update before they list the references to it, and a fork locks every session
961
+ * its segments name for key share, so neither misses a reference another transaction is adding. Re-pointing a fork at
962
+ * the child adds a reference to the child, which the detach already holds for update. Locking the parent instead
963
+ * would deadlock against the parent's replace, which holds the parent's row while it waits for its forks' rows.
964
+ */
965
+ /**
966
+ * Where a refused copy of shared rows is noted, for debugging: the application sets it once, to its debug log. A refusal
967
+ * also fails the write that needed the copy, so nothing is lost; the note says which fork and which source entry.
968
+ */
969
+ let noteRefusedCopy = () => {};
970
+ function setForkCopyRefusalNote(note) {
971
+ noteRefusedCopy = note;
972
+ }
973
+ /** Notes `error` once when it is a refused copy of shared rows; resolves nothing and never throws. */
974
+ function noteForkCopyRefusal(error, operation) {
975
+ if (!(error instanceof ForkSourceIncompleteError)) return;
976
+ try {
977
+ noteRefusedCopy({
978
+ operation,
979
+ sessionId: error.sessionId,
980
+ sourceId: error.sourceId,
981
+ sourceSeq: error.sourceSeq
982
+ });
983
+ } catch {}
984
+ }
985
+ /**
986
+ * Locks `ids` for update, to change their segments, in ID order, the order every transaction that locks sessions
987
+ * takes them in. A detach never locks the parent: the parent's replace holds the parent's row while it waits for its
988
+ * forks' rows, and only that replace can change the parent's rows a fork reads, after it has detached the fork itself.
989
+ */
990
+ async function lockForUpdate(host, tx, ids) {
991
+ await host.lockForkSources(tx, [...new Set(ids)].sort(), "update");
992
+ }
993
+ /** The forks whose segments name `sessionId`, after locking it for update. */
994
+ async function lockedReferrers(host, tx, sessionId) {
995
+ await host.lockForkSources(tx, [sessionId], "update");
996
+ return (await host.forkChildren(tx, sessionId)).filter((id) => id !== sessionId);
997
+ }
998
+ /** Removes the rows a session stores and its tombstone: nothing names them, and the session is gone or replaced. */
999
+ async function removeStoredRows(host, tx, sessionId) {
1000
+ const { pinTables: tables } = host;
1001
+ for (const table of [
1002
+ tables.blobChunks,
1003
+ tables.blobs,
1004
+ tables.entryChunks,
1005
+ tables.searchTexts,
1006
+ tables.entries
1007
+ ]) await tx.run(`DELETE FROM ${table} WHERE session_id = ?`, sessionId);
1008
+ await tx.run(`DELETE FROM ${tables.tombstones} WHERE session_id = ?`, sessionId);
1009
+ }
1010
+ async function isTombstoned(host, tx, sessionId) {
1011
+ return await tx.get(`SELECT session_id FROM ${host.pinTables.tombstones} WHERE session_id = ?`, sessionId) !== void 0;
1012
+ }
1013
+ function parseProgress(row) {
1014
+ return {
1015
+ reparent: row.reparent !== 0,
1016
+ original: JSON.parse(row.original_segments),
1017
+ epochs: [row.parent_epoch ?? void 0, row.child_epoch ?? void 0]
1018
+ };
1019
+ }
1020
+ /** The rewrite epochs of the parent and the child, read under their locks. */
1021
+ async function rewriteEpochs(host, tx, parentId, childId) {
1022
+ return [await host.forkRewriteEpoch(tx, parentId), await host.forkRewriteEpoch(tx, childId)];
1023
+ }
1024
+ /** Every session whose rows `sessionId` reads, directly or through the sessions it reads. */
1025
+ async function readSources(host, tx, sessionId) {
1026
+ const found = /* @__PURE__ */ new Set();
1027
+ const pending = [sessionId];
1028
+ for (let next = pending.pop(); next !== void 0; next = pending.pop()) for (const { sourceId } of await host.forkSegments(tx, next)) if (!found.has(sourceId)) {
1029
+ found.add(sourceId);
1030
+ pending.push(sourceId);
1031
+ }
1032
+ return found;
1033
+ }
1034
+ /**
1035
+ * Within `tx`, copies every row of `parentId` the child reads into the child and removes its segments on the parent,
1036
+ * as a caller about to rewrite the parent in the same transaction needs. With `reparent`, the parent's other forks are
1037
+ * re-pointed at the child's copy when it holds every row they read of the parent at the same seqs. `started` is how a detach a page at a time found
1038
+ * the child when it started; its map of the child's rows holds only while neither session was rewritten since, so
1039
+ * a rewrite of either skips the re-pointing, and the other forks keep reading the parent. Resolves with the forks
1040
+ * re-pointed.
1041
+ */
1042
+ async function detachForkWithin(host, tx, parentId, childId, reparent, started) {
1043
+ const siblings = reparent ? (await host.forkChildren(tx, parentId)).filter((id) => id !== childId) : [];
1044
+ await lockForUpdate(host, tx, [childId, ...siblings]);
1045
+ const onParent = (await host.forkSegments(tx, childId)).filter((segment) => segment.sourceId === parentId);
1046
+ if (onParent.length > 0) await host.materializeForkSegments(tx, childId, onParent);
1047
+ if (siblings.length === 0) return [];
1048
+ let map = onParent;
1049
+ if (started !== void 0) {
1050
+ const [parentEpoch, childEpoch] = await rewriteEpochs(host, tx, parentId, childId);
1051
+ map = parentEpoch === started.epochs[0] && childEpoch === started.epochs[1] ? started.original : [];
1052
+ }
1053
+ const reparented = [];
1054
+ if (map.length === 0) return reparented;
1055
+ const readByChild = await readSources(host, tx, childId);
1056
+ for (const sibling of siblings) {
1057
+ if (readByChild.has(sibling)) continue;
1058
+ const before = await host.forkSegments(tx, sibling);
1059
+ const after = reparentedSegments(before, parentId, childId, map);
1060
+ if (after !== void 0) {
1061
+ await host.writeForkSegments(tx, sibling, after);
1062
+ reparented.push(sibling);
1063
+ }
1064
+ }
1065
+ return reparented;
1066
+ }
1067
+ /**
1068
+ * Detaches `childId` from `parentId` a page at a time, each page its own transaction; see the module comment. A detach
1069
+ * a crash stopped resumes where it stopped when it runs again, with the options it started with.
1070
+ */
1071
+ async function detachFork(host, parentId, childId, options = {}) {
1072
+ const table = host.forkDetachTable;
1073
+ const pageRows = Math.max(1, Math.floor(options.pageRows ?? 2e3));
1074
+ const progress = await host.forkTransaction(async (tx) => {
1075
+ const row = await tx.get(`SELECT parent_id, child_id, reparent, original_segments, parent_epoch, child_epoch FROM ${table} WHERE parent_id = ? AND child_id = ?`, parentId, childId);
1076
+ if (row !== void 0) return parseProgress(row);
1077
+ await lockForUpdate(host, tx, [childId]);
1078
+ const original = (await host.forkSegments(tx, childId)).filter((segment) => segment.sourceId === parentId);
1079
+ if (original.length === 0) return void 0;
1080
+ const started = {
1081
+ reparent: options.reparent ?? true,
1082
+ original,
1083
+ epochs: await rewriteEpochs(host, tx, parentId, childId)
1084
+ };
1085
+ await tx.run(`INSERT INTO ${table} (parent_id, child_id, reparent, original_segments, parent_epoch, child_epoch) VALUES (?, ?, ?, ?, ?, ?) ON CONFLICT DO NOTHING`, parentId, childId, started.reparent ? 1 : 0, JSON.stringify(original), started.epochs[0] ?? null, started.epochs[1] ?? null);
1086
+ return started;
1087
+ });
1088
+ if (progress === void 0) return {
1089
+ detached: [],
1090
+ reparented: []
1091
+ };
1092
+ for (;;) {
1093
+ const done = await host.forkTransaction(async (tx) => {
1094
+ await lockForUpdate(host, tx, [childId]);
1095
+ const onParent = (await host.forkSegments(tx, childId)).filter((segment) => segment.sourceId === parentId);
1096
+ if (onParent.reduce((rows, segment) => rows + segmentLength(segment), 0) > pageRows) {
1097
+ await host.materializeForkSegments(tx, childId, [splitSegment(onParent[0], pageRows).page]);
1098
+ return;
1099
+ }
1100
+ const reparented = await detachForkWithin(host, tx, parentId, childId, progress.reparent, progress);
1101
+ await tx.run(`DELETE FROM ${table} WHERE parent_id = ? AND child_id = ?`, parentId, childId);
1102
+ return reparented;
1103
+ }).catch(async (error) => {
1104
+ if (error instanceof ForkSourceIncompleteError) await host.forkTransaction((tx) => tx.run(`DELETE FROM ${table} WHERE parent_id = ? AND child_id = ?`, parentId, childId));
1105
+ throw error;
1106
+ });
1107
+ if (done !== void 0) return {
1108
+ detached: [childId],
1109
+ reparented: [...done]
1110
+ };
1111
+ }
1112
+ }
1113
+ /**
1114
+ * Detaches every fork still pointing at `parentId`, so the parent's rows can go: first the fork that holds most of the
1115
+ * parent's rows, re-pointing the others at its copy when it holds all they read, then any fork that still reads
1116
+ * rows only the parent has. Detaches a crash stopped are finished first.
1117
+ */
1118
+ async function detachForkChildren(host, parentId, options = {}) {
1119
+ const detached = [];
1120
+ const reparented = /* @__PURE__ */ new Set();
1121
+ const record = (report) => {
1122
+ detached.push(...report.detached);
1123
+ for (const id of report.reparented) reparented.add(id);
1124
+ };
1125
+ const pending = await host.forkTransaction((tx) => tx.all(`SELECT child_id FROM ${host.forkDetachTable} WHERE parent_id = ? ORDER BY child_id`, parentId));
1126
+ for (const { child_id } of pending) record(await detachFork(host, parentId, child_id, options));
1127
+ for (;;) {
1128
+ const next = await host.forkTransaction(async (tx) => {
1129
+ let best;
1130
+ for (const id of await host.forkChildren(tx, parentId)) {
1131
+ const rows = (await host.forkSegments(tx, id)).filter((segment) => segment.sourceId === parentId).reduce((sum, segment) => sum + segmentLength(segment), 0);
1132
+ if (best === void 0 || rows > best.rows) best = {
1133
+ id,
1134
+ rows
1135
+ };
1136
+ }
1137
+ return best?.id;
1138
+ });
1139
+ if (next === void 0) break;
1140
+ record(await detachFork(host, parentId, next, options));
1141
+ }
1142
+ return {
1143
+ detached,
1144
+ reparented: [...reparented].filter((id) => !detached.includes(id))
1145
+ };
1146
+ }
1147
+ /** Finishes every detach a crash stopped, as each started. */
1148
+ async function resumeForkDetaches(host) {
1149
+ const rows = await host.forkTransaction((tx) => tx.all(`SELECT parent_id, child_id FROM ${host.forkDetachTable} ORDER BY parent_id, child_id`));
1150
+ const detached = [];
1151
+ const reparented = [];
1152
+ for (const { parent_id, child_id } of rows) {
1153
+ const report = await detachFork(host, parent_id, child_id);
1154
+ detached.push(...report.detached);
1155
+ reparented.push(...report.reparented);
1156
+ }
1157
+ return {
1158
+ detached,
1159
+ reparented
1160
+ };
1161
+ }
943
1162
  // ../../node_modules/yaml/dist/doc/directives.js
944
1163
  var require_directives = /* @__PURE__ */ __commonJSMin(((exports) => {
945
1164
  var identity = require_identity();
@@ -1607,8 +1826,7 @@ function isAlias(id) {
1607
1826
  function buildFallbackModel(provider, modelId, availableModels) {
1608
1827
  const providerModels = availableModels.filter((m) => m.provider === provider);
1609
1828
  if (providerModels.length === 0) return void 0;
1610
- const defaultId = defaultModelPerProvider[provider];
1611
- const baseModel = defaultId ? providerModels.find((m) => m.id === defaultId) ?? providerModels[0] : providerModels[0];
1829
+ const baseModel = findProviderDefaultModel(provider, providerModels) ?? providerModels[0];
1612
1830
  const fallbackContextWindow = baseModel.contextWindow;
1613
1831
  return {
1614
1832
  ...baseModel,
@@ -3335,6 +3553,13 @@ var TaskSupervisor = class {
3335
3553
  }
3336
3554
  };
3337
3555
  }
3556
+ if (this.#liveCommandCount(state) >= 64) return {
3557
+ ok: false,
3558
+ error: {
3559
+ code: "CapacityExhausted",
3560
+ message: LIVE_COMMAND_LIMIT_MESSAGE
3561
+ }
3562
+ };
3338
3563
  const snapshot2 = structuredClone(intent);
3339
3564
  const result = this.#launchCommandTask(state, snapshot2, operation, signal);
3340
3565
  const start = {
@@ -3353,6 +3578,17 @@ var TaskSupervisor = class {
3353
3578
  }, forget);
3354
3579
  return result;
3355
3580
  }
3581
+ /**
3582
+ * The owner's commands that are starting, queued or running, its subagents' included, as the owner's own watch
3583
+ * sees them once drained. One stopping is on its way out and leaves its place to a new launch.
3584
+ */
3585
+ #liveCommandCount(state) {
3586
+ const live = new Set(state.commandLaunches.keys());
3587
+ const [watch] = state.watches;
3588
+ watch?.drain();
3589
+ for (const task of watch?.snapshot.tasks ?? []) if (task.kind === "command" && (task.execution.kind === "queued" || task.execution.kind === "running")) live.add(task.launchOperationId);
3590
+ return live.size;
3591
+ }
3356
3592
  async #launchCommandTask(state, intent, operation, signal) {
3357
3593
  let finishAdmission;
3358
3594
  const admission = new Promise((resolve) => {
@@ -11365,6 +11601,51 @@ function responseText(body) {
11365
11601
  const parts = Array.isArray(body.messages) ? body.messages.flatMap((message) => typeof message?.content === "string" && message.content.trim() ? [message.content.trim()] : []) : [];
11366
11602
  return (parts.length > 0 ? parts.join("\n\n") : typeof body.output === "string" ? body.output : "").trim();
11367
11603
  }
11604
+ const SINKHOLE_ADDRESSES = /* @__PURE__ */ new Set([
11605
+ "0.0.0.0",
11606
+ "::",
11607
+ "0:0:0:0:0:0:0:0"
11608
+ ]);
11609
+ const HOST_RESOLVE_MAX_WAIT_MS = 2e3;
11610
+ const CAUSE_CHAIN_MAX_DEPTH = 4;
11611
+ async function resolveHostAddresses(hostname) {
11612
+ return (await lookup(hostname, { all: true })).map((entry) => entry.address);
11613
+ }
11614
+ /** `fetch failed` alone names no reason; the reason is on the cause chain (`ENOTFOUND`, a TLS alert, a refused connection). */
11615
+ function describeWithCauses(error) {
11616
+ const parts = [error.message || error.name];
11617
+ let cause = error.cause;
11618
+ for (let depth = 0; depth < CAUSE_CHAIN_MAX_DEPTH && typeof cause === "object" && cause !== null; depth++) {
11619
+ const { message, code, cause: next } = cause;
11620
+ const text = typeof message === "string" ? message.trim().split("\n")[0] ?? "" : "";
11621
+ const label = typeof code === "string" && !text.includes(code) ? `${code}: ${text}` : text;
11622
+ if (label && !parts.includes(label)) parts.push(label);
11623
+ cause = next;
11624
+ }
11625
+ return parts.join(": ");
11626
+ }
11627
+ /** Names a DNS filter as the reason when the endpoint's host resolves only to an unroutable sinkhole address. */
11628
+ async function sinkholeHint(url, resolveHost) {
11629
+ let hostname;
11630
+ try {
11631
+ hostname = new URL(url).hostname;
11632
+ } catch {
11633
+ return "";
11634
+ }
11635
+ let timer;
11636
+ try {
11637
+ const addresses = await Promise.race([resolveHost(hostname), new Promise((resolve) => {
11638
+ timer = setTimeout(() => resolve([]), HOST_RESOLVE_MAX_WAIT_MS);
11639
+ timer.unref?.();
11640
+ })]);
11641
+ if (addresses.length === 0 || !addresses.every((address) => SINKHOLE_ADDRESSES.has(address))) return "";
11642
+ return ` (${hostname} resolves to ${addresses[0]}, the address DNS filters such as NextDNS, Pi-hole or AdGuard return for blocked domains; allow ${hostname} in the resolver)`;
11643
+ } catch {
11644
+ return "";
11645
+ } finally {
11646
+ clearTimeout(timer);
11647
+ }
11648
+ }
11368
11649
  function trimTrailingSlashes(url) {
11369
11650
  let end = url.length;
11370
11651
  while (end > 0 && url.charCodeAt(end - 1) === 47) end--;
@@ -11451,7 +11732,9 @@ async function requestCompactorOutput(request) {
11451
11732
  signal
11452
11733
  });
11453
11734
  } catch (error) {
11454
- return failure(error instanceof Error ? error : String(error), { code: "network-error" });
11735
+ if (!(error instanceof Error) || signal.aborted) return failure(error instanceof Error ? error : String(error), { code: "network-error" });
11736
+ const hint = await sinkholeHint(url, request.resolveHost ?? resolveHostAddresses);
11737
+ return failure(`${describeWithCauses(error)}${hint}`, { code: "network-error" });
11455
11738
  }
11456
11739
  if (!response.ok) return failure(await httpErrorMessage(response, secrets), {
11457
11740
  code: "http-error",
@@ -12210,16 +12493,16 @@ var RpcTerminalDrain = class {
12210
12493
  return this.generation === generation && this.settlement ? this.settlement : Promise.resolve();
12211
12494
  }
12212
12495
  };
12213
- export { AgentTokenMeter, AgentWakeDispatcher, COMPACTED_OUTPUT_MAX_TOKENS, COMPACTED_OUTPUT_MAX_TRIGGER_SHARE, COMPACTOR_LINE_WIDTH, COMPACTOR_REQUEST_TIMEOUT_MS, ChatRowView, DEFAULT_AGENT_WAIT_BUDGET_MS, DEFAULT_COMPACTION_SETTINGS, DialogView, FILE_HEADERS_ONLY, FileAuthStorageBackend, InMemoryAuthStorageBackend, InteractiveEngineMonitor, JsonRpcLineReader, LLAMA_PROVIDER_ID, LONG_STREAM_CUT_ADVICE, LONG_STREAM_CUT_MS, MAX_LONG_STREAM_CUT_RETRIES, McpAuthRequiredError, McpHttpError, McpSessionExpiredError, MessageAdmissionBoundary, ModelConfig, OptionListView, PreviewBlockRenderer, QuestionnairePropsAdapter, ResumeCatalogTimeoutError, ResumeCatalogUnavailableError, ResumeError, ResumeNotFoundError, ResumePreconditionError, RpcTerminalDrain, SESSIONS_STORAGE_ENV, STORAGE_ENV, STRUCTURED_OUTPUT_TOOL_NAME, SessionWorkUnsettledError, StartupDialogInputGuard, StreamableHttpTransport, TaskSupervisor, TempDirRefusedError, TodoParams, WorkingRunMeter, abortSessionWork, acquireProtectedPaths, addShellOutputPreview, agentTokenTotal, agentWakeDispatcher, applyExtensionSourceInfo, applyProviderRateLimitObservation, armSessionQuitStops, assertPrivateDirectory, assertPrivateDirectoryAsync, assertSessionOpen, assertWorkspace, asyncAuthStorageReads, automaticWaitBudgetMs, bindTaskChatPage, buildCompactorMessages, buildFallbackModel, buildQuestionnaireResponse, buildToolResult, calculateContextTokens, captureChatSnapshot, captureTaskChatFile, chatPageRequest, classifyRepository, clearNestedToolCalls, compactedOutputTokenCap, compactionMeta, configureProviderRequestBudget, createLlamaProvider, createStructuredOutputCapture, createStructuredOutputTool, createToolDefinitionFromAgentTool, createTwoFilesPatch, detectStartupTheme, discoverAppendSystemPromptFile, discoverSystemPromptFile, drainSessionReload, drainSessionWork, drainSessionWorkWithin, dropWrongTypedSettings, ensurePrivateTempDir, ensurePrivateTempDirAsync, ensureSessionTempDirAsync, ensureTempDirAsync, estimateContextTokens, estimateDirectBranchContextTokens, estimateProjectedContextTokens, estimateTextTokens, estimateTokens, executeNestedToolCall, findExactModelReferenceMatch, findResumeError, findSourceInfoForPath, formatDimensionNote, formatKillCall, formatPatch, formatTruncationNotice, formatWorkingElapsed, formatWorkingMeta, fun, gen, getCallableTools, getDefaultSourceInfoForPath, getLastAssistantUsage, getNativeMcpToolIdentity, getPowerShellConfig, getPowerShellConfigAsync, getShellConfig, getShellConfigAsync, getShellEnvAsync, getTempRootDir, hasCallingSessionWork, hasProcessStorageSelection, hasSessionReload, importAfterEvaluation, installHostModuleBridge, invalidSettingMessage, isLongStreamCut, isPowerShellAvailable, isPowerShellAvailableAsync, isProtectedSessionTempDir, isProviderLimitFailure, isProviderRateLimit, isResumeCatalogTimeoutError, isResumeCatalogUnavailableError, isResumeError, isResumeNotFoundError, isResumePreconditionError, isRetryableResumeError, isSelectedNativeMcpTool, isTodoOperationError, isWorkspace, killChildProcessTree, killProcessTree, killSupervisedProcessTrees, killTrackedDetachedChildren, limitQuitShutdownHandlers, loadTaskOwnTranscriptEntries, loadTaskOwnTranscriptHistory, markDetachedChildExited, markNativeMcpToolDefinition, markProviderRateLimitObserved, matchesMcpDirectToolSelection, modelIdForModel, nextRetryDecision, normalizeDerivedSessionEntries, normalizeWorkingRunSnapshot, observeAccountCatalog, observeProviderRateLimits, observedTaskChatWrite, onSessionQuit, ownedSessionManagerStores, ownedSessionPermits, ownedSessionStores, prepareSourceEntries, prepareSourceEntry, previewProcessStorageSelection, previewSessionSettingSelection, processSharedStorageSelection, processSharedStorageSelectionAsync, processStorageEnvironment, processStorageEnvironmentAsync, providerAdmissionTurn, providerCooldownMs, providerIdForModel, providerLimitScope, providerRateLimitObservations, providerRateLimitSnapshot, providerRequestGate, providerRetryHint, providerUnavailableMs, rebuildKillResult, rebuildShellWaitResult, recordNestedToolCalls, recordProviderRateLimit, recordProviderRetryHint, recordProviderSuccess, recordedRepo, reduce, registerSessionRetirement, registerSessionWorkOwner, registerSourceBuiltinLoad, rehydrateResumeError, renewSessionWork, repeatsLongStreamCut, requestCompactorOutput, require_Node, require_anchors, require_directives, require_lib, require_semver, resizeImage, resolveModelReference, resolveSessionTempDirPath, restoreAnthropicReplayThinkingBlocks, retireSessionReloadGeneration, runCommand, runCommandCapture, runCommandSync, runInProgress, runWithConcurrency, sanitizeTempPathComponent, selectChatRowProps, selectDialogProps, selectMultiSelectProps, selectOptionListProps, selectPreviewPaneProps, selectProcessStorage, selectProcessStorageAsync, selectProcessStorageSteps, selectSubmitPickerProps, selectTabBarProps, serializeResumeError, sessionGenerationClosing, sessionLifetime, sessionQuitSignal, setActiveSessionTempId, setCliStorageSelection, setProviderRequestGate, shouldCompact, showFirstTimeSetup, showStartupInput, showStartupSelector, shutdownDeadline, spawnShellProcess, startParentProcessGuardian, structuredPatch, summarizeQuestions, taskChatPage, taskExtensionStatuses, taskOwnTranscriptEntries, taskTranscriptSource, trackDetachedChildPid, trackDetachedChildProcess, trackSessionReload, trackSessionWork, transformTemplate, tryAdmitProviderRequest, untilShutdownHandlerDeadline, untrackDetachedChildPid, validateProcessStorageAsync, validateQuestionnaire, wakeKeyNamespace, watchTaskExtensionStatuses, watchTaskTranscriptBindings, withBuiltinDiagnostics, withDiscoveredModels, withPersonalizedCatalog, withRemoteCatalog, withTaskChatRows, workspace, wrapLongLines, wrapToolDefinition };
12496
+ export { AgentTokenMeter, AgentWakeDispatcher, COMPACTED_OUTPUT_MAX_TOKENS, COMPACTED_OUTPUT_MAX_TRIGGER_SHARE, COMPACTOR_LINE_WIDTH, COMPACTOR_REQUEST_TIMEOUT_MS, ChatRowView, DEFAULT_AGENT_WAIT_BUDGET_MS, DEFAULT_COMPACTION_SETTINGS, DialogView, FILE_HEADERS_ONLY, FileAuthStorageBackend, InMemoryAuthStorageBackend, InteractiveEngineMonitor, JsonRpcLineReader, LLAMA_PROVIDER_ID, LONG_STREAM_CUT_ADVICE, LONG_STREAM_CUT_MS, MAX_LONG_STREAM_CUT_RETRIES, McpAuthRequiredError, McpHttpError, McpSessionExpiredError, MessageAdmissionBoundary, ModelConfig, OptionListView, PreviewBlockRenderer, QuestionnairePropsAdapter, ResumeCatalogTimeoutError, ResumeCatalogUnavailableError, ResumeError, ResumeNotFoundError, ResumePreconditionError, RpcTerminalDrain, SESSIONS_STORAGE_ENV, STORAGE_ENV, STRUCTURED_OUTPUT_TOOL_NAME, SessionWorkUnsettledError, StartupDialogInputGuard, StreamableHttpTransport, TaskSupervisor, TempDirRefusedError, TodoParams, WorkingRunMeter, abortSessionWork, acquireProtectedPaths, addShellOutputPreview, agentTokenTotal, agentWakeDispatcher, applyExtensionSourceInfo, applyProviderRateLimitObservation, armSessionQuitStops, assertPrivateDirectory, assertPrivateDirectoryAsync, assertSessionOpen, assertWorkspace, asyncAuthStorageReads, automaticWaitBudgetMs, bindTaskChatPage, buildCompactorMessages, buildFallbackModel, buildQuestionnaireResponse, buildToolResult, calculateContextTokens, captureChatSnapshot, captureTaskChatFile, chatPageRequest, classifyRepository, clearNestedToolCalls, compactedOutputTokenCap, compactionMeta, configureProviderRequestBudget, createLlamaProvider, createStructuredOutputCapture, createStructuredOutputTool, createToolDefinitionFromAgentTool, createTwoFilesPatch, detachForkChildren, detachForkWithin, detectStartupTheme, discoverAppendSystemPromptFile, discoverSystemPromptFile, drainSessionReload, drainSessionWork, drainSessionWorkWithin, dropWrongTypedSettings, ensurePrivateTempDir, ensurePrivateTempDirAsync, ensureSessionTempDirAsync, ensureTempDirAsync, estimateContextTokens, estimateDirectBranchContextTokens, estimateProjectedContextTokens, estimateTextTokens, estimateTokens, executeNestedToolCall, findExactModelReferenceMatch, findResumeError, findSourceInfoForPath, formatDimensionNote, formatKillCall, formatPatch, formatTruncationNotice, formatWorkingElapsed, formatWorkingMeta, fun, gen, getCallableTools, getDefaultSourceInfoForPath, getLastAssistantUsage, getNativeMcpToolIdentity, getPowerShellConfig, getPowerShellConfigAsync, getShellConfig, getShellConfigAsync, getShellEnvAsync, getTempRootDir, hasCallingSessionWork, hasProcessStorageSelection, hasSessionReload, importAfterEvaluation, installHostModuleBridge, invalidSettingMessage, isLongStreamCut, isPowerShellAvailable, isPowerShellAvailableAsync, isProtectedSessionTempDir, isProviderLimitFailure, isProviderRateLimit, isResumeCatalogTimeoutError, isResumeCatalogUnavailableError, isResumeError, isResumeNotFoundError, isResumePreconditionError, isRetryableResumeError, isSelectedNativeMcpTool, isTodoOperationError, isTombstoned, isWorkspace, killChildProcessTree, killProcessTree, killSupervisedProcessTrees, killTrackedDetachedChildren, limitQuitShutdownHandlers, loadTaskOwnTranscriptEntries, loadTaskOwnTranscriptHistory, lockedReferrers, markDetachedChildExited, markNativeMcpToolDefinition, markProviderRateLimitObserved, matchesMcpDirectToolSelection, modelIdForModel, nextRetryDecision, normalizeDerivedSessionEntries, normalizeWorkingRunSnapshot, noteForkCopyRefusal, observeAccountCatalog, observeProviderRateLimits, observedTaskChatWrite, onSessionQuit, ownedSessionManagerStores, ownedSessionPermits, ownedSessionStores, prepareSourceEntries, prepareSourceEntry, previewProcessStorageSelection, previewSessionSettingSelection, processSharedStorageSelection, processSharedStorageSelectionAsync, processStorageEnvironment, processStorageEnvironmentAsync, providerAdmissionTurn, providerCooldownMs, providerIdForModel, providerLimitScope, providerRateLimitObservations, providerRateLimitSnapshot, providerRequestGate, providerRetryHint, providerUnavailableMs, rebuildKillResult, rebuildShellWaitResult, recordNestedToolCalls, recordProviderRateLimit, recordProviderRetryHint, recordProviderSuccess, recordedRepo, reduce, registerSessionRetirement, registerSessionWorkOwner, registerSourceBuiltinLoad, rehydrateResumeError, removeStoredRows, renewSessionWork, repeatsLongStreamCut, requestCompactorOutput, require_Node, require_anchors, require_directives, require_lib, require_semver, resizeImage, resolveModelReference, resolveSessionTempDirPath, restoreAnthropicReplayThinkingBlocks, resumeForkDetaches, retireSessionReloadGeneration, runCommand, runCommandCapture, runCommandSync, runInProgress, runWithConcurrency, sanitizeTempPathComponent, selectChatRowProps, selectDialogProps, selectMultiSelectProps, selectOptionListProps, selectPreviewPaneProps, selectProcessStorage, selectProcessStorageAsync, selectProcessStorageSteps, selectSubmitPickerProps, selectTabBarProps, serializeResumeError, sessionGenerationClosing, sessionLifetime, sessionQuitSignal, setActiveSessionTempId, setCliStorageSelection, setForkCopyRefusalNote, setProviderRequestGate, shouldCompact, showFirstTimeSetup, showStartupInput, showStartupSelector, shutdownDeadline, spawnShellProcess, startParentProcessGuardian, structuredPatch, summarizeQuestions, taskChatPage, taskExtensionStatuses, taskOwnTranscriptEntries, taskTranscriptSource, trackDetachedChildPid, trackDetachedChildProcess, trackSessionReload, trackSessionWork, transformTemplate, tryAdmitProviderRequest, untilShutdownHandlerDeadline, untrackDetachedChildPid, validateProcessStorageAsync, validateQuestionnaire, wakeKeyNamespace, watchTaskExtensionStatuses, watchTaskTranscriptBindings, withBuiltinDiagnostics, withDiscoveredModels, withPersonalizedCatalog, withRemoteCatalog, withTaskChatRows, workspace, wrapLongLines, wrapToolDefinition };
12214
12497
 
12215
- //# sourceMappingURL=startup-0-2-27OWFHV6.js.map
12498
+ //# sourceMappingURL=startup-0-2-5QHPCEON.js.map
12216
12499
  // __atomicOnDemandFailed: written by the build (scripts/in-place-update-gate.mjs). An import of this release's code on
12217
12500
  // demand that fails in a process an in-place update left running says to restart.
12218
12501
  function __atomicOnDemandFailed(error, feature) {
12219
12502
  return (async () => {
12220
12503
  const root = new URL("../", import.meta.url);
12221
12504
  const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
12222
- const key = `${root.href}#0.10.10`;
12505
+ const key = `${root.href}#0.10.11-alpha.2`;
12223
12506
  let release = releases.get(key);
12224
12507
  if (release === undefined) {
12225
12508
  const current = (async () => {
@@ -12247,7 +12530,7 @@ function __atomicOnDemandFailed(error, feature) {
12247
12530
  } catch {
12248
12531
  // No installation to read, as in a bundle of the package: the release the process runs decides.
12249
12532
  }
12250
- const updatedTo = typeof installed === "string" && installed !== "0.10.10" ? installed : running !== undefined && running.version !== "0.10.10" ? "0.10.10" : undefined;
12533
+ const updatedTo = typeof installed === "string" && installed !== "0.10.11-alpha.2" ? installed : running !== undefined && running.version !== "0.10.11-alpha.2" ? "0.10.11-alpha.2" : undefined;
12251
12534
  if (updatedTo === undefined) throw error;
12252
12535
  const application = typeof running?.name === "string" ? running.name : "atomic";
12253
12536
  const restart = new Error(`${application} was updated to ${updatedTo} while this session was running; restart it to keep using ${feature}.`, {