@bastani/atomic 0.10.4 → 0.10.5

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 (537) hide show
  1. package/CHANGELOG.md +122 -0
  2. package/dist/_shared/compile-cache-warmup-host-RU5L7I7A.js +1 -1
  3. package/dist/_shared/dist-KOELCESV.js +48 -3
  4. package/dist/_shared/fork-row-index-UAUAQRD5.js +47 -2
  5. package/dist/_shared/http-YFAPTIZD.js +16 -4
  6. package/dist/_shared/http-YFAPTIZD.js.map +1 -1
  7. package/dist/_shared/lib-4PES5P4V.js +59 -14
  8. package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js +1706 -258
  9. package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js.map +1 -1
  10. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +317 -64
  11. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js.map +1 -1
  12. package/dist/_shared/{mode-shared-HP7GUA7J.js → mode-shared-2QJSCUM6.js} +432 -81
  13. package/dist/_shared/mode-shared-2QJSCUM6.js.map +1 -0
  14. package/dist/_shared/p0-cli-BB45ZQY6.js +3482 -0
  15. package/dist/_shared/p0-cli-BB45ZQY6.js.map +1 -0
  16. package/dist/_shared/p0-cli-GUFK7TPN.js +2 -2838
  17. package/dist/_shared/p0-cli-GUFK7TPN.js.map +1 -1
  18. package/dist/_shared/{p1a-prewarm-YK3KDTLN.js → p1a-prewarm-UQY3X2UK.js} +270 -73
  19. package/dist/_shared/p1a-prewarm-UQY3X2UK.js.map +1 -0
  20. package/dist/_shared/{p1b-elig-PXQA2FYP.js → p1b-elig-ENCUPKKJ.js} +190 -121
  21. package/dist/_shared/p1b-elig-ENCUPKKJ.js.map +1 -0
  22. package/dist/_shared/p2-common-YLSYXMDQ.js +1 -3
  23. package/dist/_shared/p2-common-YLSYXMDQ.js.map +1 -1
  24. package/dist/_shared/p2-shell-TJBYQMCJ.js +1 -1
  25. package/dist/_shared/p2-shell-main-B2WIALFD.js +500 -127
  26. package/dist/_shared/p2-shell-main-B2WIALFD.js.map +1 -1
  27. package/dist/_shared/runtime-O4KCSG4C.js +4 -4
  28. package/dist/_shared/sdk-WQIOHVKO.js +56 -11
  29. package/dist/_shared/session-data-AHTU7IS6.js +48 -3
  30. package/dist/_shared/session-manager-list-2BLEEZVG.js +2 -2
  31. package/dist/_shared/settings-startup-65YEWRV2.js.map +1 -1
  32. package/dist/_shared/sql-session-store-5FD3WBMZ.js +57 -12
  33. package/dist/_shared/{startup-0-0-X4NF3GKM.js → startup-0-0-TYUFUOJZ.js} +519 -316
  34. package/dist/_shared/startup-0-0-TYUFUOJZ.js.map +1 -0
  35. package/dist/_shared/{startup-0-1-7QTG6VJZ.js → startup-0-1-D4LGGINF.js} +284 -81
  36. package/dist/_shared/startup-0-1-D4LGGINF.js.map +1 -0
  37. package/dist/_shared/{startup-0-2-KFDYPDJK.js → startup-0-2-SZGQIWHI.js} +483 -154
  38. package/dist/_shared/startup-0-2-SZGQIWHI.js.map +1 -0
  39. package/dist/_shared/startup-0-3-T4DVFYWX.js +340 -110
  40. package/dist/_shared/startup-0-3-T4DVFYWX.js.map +1 -1
  41. package/dist/_shared/startup-0-4-HN5EB4K7.js +261 -59
  42. package/dist/_shared/startup-0-4-HN5EB4K7.js.map +1 -1
  43. package/dist/_shared/startup-0-5-OHJNE6JH.js +421 -148
  44. package/dist/_shared/startup-0-5-OHJNE6JH.js.map +1 -1
  45. package/dist/_shared/startup-10-0-TDQNBDDL.js +62 -11
  46. package/dist/_shared/startup-10-0-TDQNBDDL.js.map +1 -1
  47. package/dist/_shared/startup-12-0-55AAXBJZ.js +3 -3
  48. package/dist/_shared/startup-14-0-MLX36RBG.js +12 -11
  49. package/dist/_shared/startup-14-0-MLX36RBG.js.map +1 -1
  50. package/dist/_shared/startup-15-0-YUKGAC63.js +53 -158
  51. package/dist/_shared/startup-15-0-YUKGAC63.js.map +1 -1
  52. package/dist/_shared/startup-15-1-4S7FLMNG.js +231 -46
  53. package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
  54. package/dist/_shared/startup-8-0-34CBHPZH.js +115 -35
  55. package/dist/_shared/startup-8-0-34CBHPZH.js.map +1 -1
  56. package/dist/_shared/{startup-8-1-KQJBDKRU.js → startup-8-1-SJW2GMAM.js} +203 -62
  57. package/dist/_shared/startup-8-1-SJW2GMAM.js.map +1 -0
  58. package/dist/_shared/storage-command-7MGXLJGZ.js +55 -10
  59. package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +47 -2
  60. package/dist/_shared/tree-outline-MUEPK5B7.js +48 -3
  61. package/dist/builtin/intercom/CHANGELOG.md +42 -0
  62. package/dist/builtin/intercom/README.md +0 -1
  63. package/dist/builtin/intercom/broker/broker-instance.ts +13 -57
  64. package/dist/builtin/intercom/broker/broker-process.ts +30 -10
  65. package/dist/builtin/intercom/broker/broker-routing.ts +12 -2
  66. package/dist/builtin/intercom/broker/broker.bundle.mjs +2557 -498
  67. package/dist/builtin/intercom/broker/broker.ts +164 -55
  68. package/dist/builtin/intercom/broker/client.ts +36 -16
  69. package/dist/builtin/intercom/broker/control.ts +83 -20
  70. package/dist/builtin/intercom/broker/durable-ended-queue.ts +65 -19
  71. package/dist/builtin/intercom/broker/host-command-environment.ts +7 -2
  72. package/dist/builtin/intercom/broker/multinode-router.ts +1675 -387
  73. package/dist/builtin/intercom/broker/multinode-state-store.ts +10 -0
  74. package/dist/builtin/intercom/broker/paths.ts +68 -6
  75. package/dist/builtin/intercom/broker/pending-send-registry.ts +5 -0
  76. package/dist/builtin/intercom/broker/registration-bounds.ts +38 -0
  77. package/dist/builtin/intercom/broker/retiring-broker-check.ts +178 -0
  78. package/dist/builtin/intercom/broker/return-paths.ts +268 -7
  79. package/dist/builtin/intercom/broker/send-handler.ts +253 -28
  80. package/dist/builtin/intercom/broker/send-order-gate.ts +410 -0
  81. package/dist/builtin/intercom/broker/spawn.ts +950 -202
  82. package/dist/builtin/intercom/broker/sql-lease-store.ts +37 -0
  83. package/dist/builtin/intercom/broker/sql-outbox-store.ts +7 -0
  84. package/dist/builtin/intercom/broker/windows-cwd.ts +546 -0
  85. package/dist/builtin/intercom/index.bundle.mjs +3506 -2328
  86. package/dist/builtin/intercom/package.json +1 -1
  87. package/dist/builtin/intercom/retry-policy.ts +4 -0
  88. package/dist/builtin/intercom/types.ts +2 -0
  89. package/dist/builtin/mcp/index.bundle.mjs +1 -1
  90. package/dist/builtin/mcp/package.json +1 -1
  91. package/dist/builtin/subagents/CHANGELOG.md +12 -0
  92. package/dist/builtin/subagents/package.json +1 -1
  93. package/dist/builtin/subagents/src/extension/index.bundle.mjs +336 -86
  94. package/dist/builtin/web-access/index.bundle.mjs +23 -38
  95. package/dist/builtin/web-access/package.json +1 -1
  96. package/dist/bun/cli.js +1 -1
  97. package/dist/bun/cli.js.map +1 -1
  98. package/dist/bun/internal-intercom-broker.js +119 -4
  99. package/dist/bun/internal-intercom-broker.js.map +1 -1
  100. package/dist/bun/register-theme-validator.js +6 -0
  101. package/dist/bun/register-theme-validator.js.map +1 -0
  102. package/dist/cli/args.js +2 -2
  103. package/dist/cli/auth-cli.code.js +1102 -0
  104. package/dist/cli/auth-cli.code.js.map +1 -0
  105. package/dist/cli/auth-cli.impl.js +30 -1096
  106. package/dist/cli/auth-cli.impl.js.map +1 -1
  107. package/dist/cli/auth-cli.js +11 -7
  108. package/dist/cli/blueprint-command.code.js +906 -0
  109. package/dist/cli/blueprint-command.code.js.map +1 -0
  110. package/dist/cli/blueprint-command.impl.js +30 -900
  111. package/dist/cli/blueprint-command.impl.js.map +1 -1
  112. package/dist/cli/blueprint-command.js +11 -7
  113. package/dist/cli/intercom-command.code.js +153 -0
  114. package/dist/cli/intercom-command.code.js.map +1 -0
  115. package/dist/cli/intercom-command.impl.js +33 -105
  116. package/dist/cli/intercom-command.impl.js.map +1 -1
  117. package/dist/cli/intercom-command.js +11 -7
  118. package/dist/cli/list-models.code.js +60 -0
  119. package/dist/cli/list-models.code.js.map +1 -0
  120. package/dist/cli/list-models.impl.js +33 -57
  121. package/dist/cli/list-models.impl.js.map +1 -1
  122. package/dist/cli/list-models.js +11 -7
  123. package/dist/cli/session-picker.code.js +55 -0
  124. package/dist/cli/session-picker.code.js.map +1 -0
  125. package/dist/cli/session-picker.impl.js +33 -52
  126. package/dist/cli/session-picker.impl.js.map +1 -1
  127. package/dist/cli/session-picker.js +11 -7
  128. package/dist/cli/startup-ui.code.js +5 -0
  129. package/dist/cli/startup-ui.code.js.map +1 -0
  130. package/dist/cli/startup-ui.impl.js +35 -4
  131. package/dist/cli/startup-ui.js +11 -7
  132. package/dist/cli/storage-command.code.js +3 -0
  133. package/dist/cli/storage-command.code.js.map +1 -0
  134. package/dist/cli/storage-command.impl.js +35 -2
  135. package/dist/cli/storage-command.js +11 -7
  136. package/dist/cli/storage-search-session.code.js +189 -0
  137. package/dist/cli/storage-search-session.code.js.map +1 -0
  138. package/dist/cli/storage-search-session.impl.js +33 -186
  139. package/dist/cli/storage-search-session.impl.js.map +1 -1
  140. package/dist/cli/storage-search-session.js +11 -7
  141. package/dist/cli/team-command.code.js +217 -0
  142. package/dist/cli/team-command.code.js.map +1 -0
  143. package/dist/cli/team-command.impl.js +32 -213
  144. package/dist/cli/team-command.impl.js.map +1 -1
  145. package/dist/cli/team-command.js +11 -7
  146. package/dist/cli.js +60 -11
  147. package/dist/cli.js.map +1 -1
  148. package/dist/config.js +1 -1
  149. package/dist/core/agent-session-methods.d.ts +4 -3
  150. package/dist/core/agent-session-methods.js.map +1 -1
  151. package/dist/core/agent-session-types.d.ts +5 -0
  152. package/dist/core/compaction/compaction.d.ts +6 -0
  153. package/dist/core/compaction/model-resolver.d.ts +1 -1
  154. package/dist/core/debug.code.js +3 -0
  155. package/dist/core/debug.code.js.map +1 -0
  156. package/dist/core/debug.impl.js +35 -2
  157. package/dist/core/debug.js +11 -7
  158. package/dist/core/default-model-api-prewarm.d.ts +5 -0
  159. package/dist/core/export-html/card-projection.code.js +257 -0
  160. package/dist/core/export-html/card-projection.code.js.map +1 -0
  161. package/dist/core/export-html/card-projection.impl.js +34 -255
  162. package/dist/core/export-html/card-projection.impl.js.map +1 -1
  163. package/dist/core/export-html/card-projection.js +11 -7
  164. package/dist/core/export-html/index.code.js +655 -0
  165. package/dist/core/export-html/index.code.js.map +1 -0
  166. package/dist/core/export-html/index.impl.js +30 -604
  167. package/dist/core/export-html/index.impl.js.map +1 -1
  168. package/dist/core/export-html/index.js +11 -7
  169. package/dist/core/export-html/json-spans.code.js +3 -0
  170. package/dist/core/export-html/json-spans.code.js.map +1 -0
  171. package/dist/core/export-html/json-spans.impl.js +35 -2
  172. package/dist/core/export-html/json-spans.js +11 -7
  173. package/dist/core/export-html/oversized-render-inputs.code.js +125 -0
  174. package/dist/core/export-html/oversized-render-inputs.code.js.map +1 -0
  175. package/dist/core/export-html/oversized-render-inputs.impl.js +31 -120
  176. package/dist/core/export-html/oversized-render-inputs.impl.js.map +1 -1
  177. package/dist/core/export-html/oversized-render-inputs.js +11 -7
  178. package/dist/core/export-html/tool-renderer.code.js +350 -0
  179. package/dist/core/export-html/tool-renderer.code.js.map +1 -0
  180. package/dist/core/export-html/tool-renderer.impl.js +33 -347
  181. package/dist/core/export-html/tool-renderer.impl.js.map +1 -1
  182. package/dist/core/export-html/tool-renderer.js +11 -7
  183. package/dist/core/extensions/jiti-loader.code.js +3 -0
  184. package/dist/core/extensions/jiti-loader.code.js.map +1 -0
  185. package/dist/core/extensions/jiti-loader.impl.js +35 -2
  186. package/dist/core/extensions/jiti-loader.js +11 -7
  187. package/dist/core/extensions/jiti-static-loader.code.js +3 -0
  188. package/dist/core/extensions/jiti-static-loader.code.js.map +1 -0
  189. package/dist/core/extensions/jiti-static-loader.impl.js +35 -2
  190. package/dist/core/extensions/jiti-static-loader.js +11 -7
  191. package/dist/core/extensions/loader-host-modules.code.js +3 -0
  192. package/dist/core/extensions/loader-host-modules.code.js.map +1 -0
  193. package/dist/core/extensions/loader-host-modules.impl.js +35 -2
  194. package/dist/core/extensions/loader-host-modules.js +11 -7
  195. package/dist/core/extensions/loader-virtual-modules.d.ts +1 -6
  196. package/dist/core/extensions/loader-virtual-modules.js +1 -1
  197. package/dist/core/extensions/runner-context.js +3 -3
  198. package/dist/core/extensions/session-events.d.ts +4 -0
  199. package/dist/core/extensions/session-events.js.map +1 -1
  200. package/dist/core/intercom-broker-control-host.code.js +5 -0
  201. package/dist/core/intercom-broker-control-host.code.js.map +1 -0
  202. package/dist/core/intercom-broker-control-host.impl.js +35 -4
  203. package/dist/core/intercom-broker-control-host.js +11 -7
  204. package/dist/core/intercom-broker-control.code.js +63 -0
  205. package/dist/core/intercom-broker-control.code.js.map +1 -0
  206. package/dist/core/intercom-broker-control.d.ts +21 -0
  207. package/dist/core/intercom-broker-control.impl.js +35 -17
  208. package/dist/core/intercom-broker-control.impl.js.map +1 -1
  209. package/dist/core/intercom-broker-control.js +11 -7
  210. package/dist/core/package-manager-storage-adapters.code.js +3 -0
  211. package/dist/core/package-manager-storage-adapters.code.js.map +1 -0
  212. package/dist/core/package-manager-storage-adapters.impl.js +35 -2
  213. package/dist/core/package-manager-storage-adapters.js +11 -7
  214. package/dist/core/process-start-token.d.ts +8 -2
  215. package/dist/core/process-tree-containment.d.ts +27 -0
  216. package/dist/core/queued-message-delivery.d.ts +5 -2
  217. package/dist/core/resume/blueprint/process.d.ts +3 -1
  218. package/dist/core/sdk.code.js +9 -0
  219. package/dist/core/sdk.code.js.map +1 -0
  220. package/dist/core/sdk.impl.js +35 -8
  221. package/dist/core/sdk.js +11 -7
  222. package/dist/core/session-manager-core.d.ts +15 -5
  223. package/dist/core/session-manager-core.js +195 -38
  224. package/dist/core/session-manager-core.js.map +1 -1
  225. package/dist/core/session-manager-list.code.js +3 -0
  226. package/dist/core/session-manager-list.code.js.map +1 -0
  227. package/dist/core/session-manager-list.impl.js +35 -2
  228. package/dist/core/session-manager-list.js +11 -7
  229. package/dist/core/session-manager-types.d.ts +20 -0
  230. package/dist/core/session-manager.code.js +8 -0
  231. package/dist/core/session-manager.code.js.map +1 -0
  232. package/dist/core/session-manager.d.ts +1 -1
  233. package/dist/core/session-manager.impl.js +35 -7
  234. package/dist/core/session-manager.js +11 -7
  235. package/dist/core/session-storage.code.js +3 -0
  236. package/dist/core/session-storage.code.js.map +1 -0
  237. package/dist/core/session-storage.impl.js +35 -2
  238. package/dist/core/session-storage.js +11 -7
  239. package/dist/core/storage/file-identity.d.ts +3 -0
  240. package/dist/core/storage/file-identity.js +296 -86
  241. package/dist/core/storage/file-identity.js.map +1 -1
  242. package/dist/core/storage/index.d.ts +1 -1
  243. package/dist/core/storage/index.js +52 -7
  244. package/dist/core/storage/index.js.map +1 -1
  245. package/dist/core/storage/node-sqlite-thread.js +47 -2
  246. package/dist/core/storage/node-sqlite.js +49 -4
  247. package/dist/core/storage/node-sqlite.js.map +1 -1
  248. package/dist/core/storage/offline-snapshot-file.code.js +37 -0
  249. package/dist/core/storage/offline-snapshot-file.code.js.map +1 -0
  250. package/dist/core/storage/offline-snapshot-file.impl.js +33 -34
  251. package/dist/core/storage/offline-snapshot-file.impl.js.map +1 -1
  252. package/dist/core/storage/offline-snapshot-file.js +11 -7
  253. package/dist/core/storage/provider.js +52 -7
  254. package/dist/core/storage/selection.js +49 -4
  255. package/dist/core/storage/session/branch-fork-source.code.js +146 -0
  256. package/dist/core/storage/session/branch-fork-source.code.js.map +1 -0
  257. package/dist/core/storage/session/branch-fork-source.impl.js +32 -97
  258. package/dist/core/storage/session/branch-fork-source.impl.js.map +1 -1
  259. package/dist/core/storage/session/branch-fork-source.js +11 -7
  260. package/dist/core/storage/session/card-view.code.js +60 -0
  261. package/dist/core/storage/session/card-view.code.js.map +1 -0
  262. package/dist/core/storage/session/card-view.impl.js +34 -58
  263. package/dist/core/storage/session/card-view.impl.js.map +1 -1
  264. package/dist/core/storage/session/card-view.js +11 -7
  265. package/dist/core/storage/session/child-reader.code.js +139 -0
  266. package/dist/core/storage/session/child-reader.code.js.map +1 -0
  267. package/dist/core/storage/session/child-reader.d.ts +1 -0
  268. package/dist/core/storage/session/child-reader.impl.js +33 -91
  269. package/dist/core/storage/session/child-reader.impl.js.map +1 -1
  270. package/dist/core/storage/session/child-reader.js +11 -7
  271. package/dist/core/storage/session/chunked-resume-projection.code.js +3 -0
  272. package/dist/core/storage/session/chunked-resume-projection.code.js.map +1 -0
  273. package/dist/core/storage/session/chunked-resume-projection.impl.js +35 -2
  274. package/dist/core/storage/session/chunked-resume-projection.js +11 -7
  275. package/dist/core/storage/session/expanded-child-details.code.js +684 -0
  276. package/dist/core/storage/session/expanded-child-details.code.js.map +1 -0
  277. package/dist/core/storage/session/expanded-child-details.impl.js +31 -634
  278. package/dist/core/storage/session/expanded-child-details.impl.js.map +1 -1
  279. package/dist/core/storage/session/expanded-child-details.js +11 -7
  280. package/dist/core/storage/session/fork-row-bytes.code.js +3 -0
  281. package/dist/core/storage/session/fork-row-bytes.code.js.map +1 -0
  282. package/dist/core/storage/session/fork-row-bytes.impl.js +35 -2
  283. package/dist/core/storage/session/fork-row-bytes.js +11 -7
  284. package/dist/core/storage/session/fork-row-index.code.js +3 -0
  285. package/dist/core/storage/session/fork-row-index.code.js.map +1 -0
  286. package/dist/core/storage/session/fork-row-index.impl.js +35 -2
  287. package/dist/core/storage/session/fork-row-index.js +11 -7
  288. package/dist/core/storage/session/fork-staging.code.js +580 -0
  289. package/dist/core/storage/session/fork-staging.code.js.map +1 -0
  290. package/dist/core/storage/session/fork-staging.impl.js +30 -574
  291. package/dist/core/storage/session/fork-staging.impl.js.map +1 -1
  292. package/dist/core/storage/session/fork-staging.js +11 -7
  293. package/dist/core/storage/session/fork-window.code.js +522 -0
  294. package/dist/core/storage/session/fork-window.code.js.map +1 -0
  295. package/dist/core/storage/session/fork-window.impl.js +30 -471
  296. package/dist/core/storage/session/fork-window.impl.js.map +1 -1
  297. package/dist/core/storage/session/fork-window.js +11 -7
  298. package/dist/core/storage/session/history-pages.code.js +3 -0
  299. package/dist/core/storage/session/history-pages.code.js.map +1 -0
  300. package/dist/core/storage/session/history-pages.impl.js +35 -2
  301. package/dist/core/storage/session/history-pages.js +11 -7
  302. package/dist/core/storage/session/jsonl-entry-projection.code.js +3 -0
  303. package/dist/core/storage/session/jsonl-entry-projection.code.js.map +1 -0
  304. package/dist/core/storage/session/jsonl-entry-projection.impl.js +35 -2
  305. package/dist/core/storage/session/jsonl-entry-projection.js +11 -7
  306. package/dist/core/storage/session/jsonl-session-store.code.js +3 -0
  307. package/dist/core/storage/session/jsonl-session-store.code.js.map +1 -0
  308. package/dist/core/storage/session/jsonl-session-store.impl.js +35 -2
  309. package/dist/core/storage/session/jsonl-session-store.js +11 -7
  310. package/dist/core/storage/session/memory-session-store.code.js +3 -0
  311. package/dist/core/storage/session/memory-session-store.code.js.map +1 -0
  312. package/dist/core/storage/session/memory-session-store.impl.js +35 -2
  313. package/dist/core/storage/session/memory-session-store.js +11 -7
  314. package/dist/core/storage/session/pinned-branch-resume.code.js +117 -0
  315. package/dist/core/storage/session/pinned-branch-resume.code.js.map +1 -0
  316. package/dist/core/storage/session/pinned-branch-resume.impl.js +33 -69
  317. package/dist/core/storage/session/pinned-branch-resume.impl.js.map +1 -1
  318. package/dist/core/storage/session/pinned-branch-resume.js +11 -7
  319. package/dist/core/storage/session/released-history-files.code.js +465 -0
  320. package/dist/core/storage/session/released-history-files.code.js.map +1 -0
  321. package/dist/core/storage/session/released-history-files.impl.js +32 -461
  322. package/dist/core/storage/session/released-history-files.impl.js.map +1 -1
  323. package/dist/core/storage/session/released-history-files.js +11 -7
  324. package/dist/core/storage/session/resident-fork-rows.code.js +57 -0
  325. package/dist/core/storage/session/resident-fork-rows.code.js.map +1 -0
  326. package/dist/core/storage/session/resident-fork-rows.impl.js +32 -53
  327. package/dist/core/storage/session/resident-fork-rows.impl.js.map +1 -1
  328. package/dist/core/storage/session/resident-fork-rows.js +11 -7
  329. package/dist/core/storage/session/session-resume.code.js +3 -0
  330. package/dist/core/storage/session/session-resume.code.js.map +1 -0
  331. package/dist/core/storage/session/session-resume.impl.js +35 -2
  332. package/dist/core/storage/session/session-resume.js +11 -7
  333. package/dist/core/storage/session/snapshot-cut.code.js +3 -0
  334. package/dist/core/storage/session/snapshot-cut.code.js.map +1 -0
  335. package/dist/core/storage/session/snapshot-cut.impl.js +35 -2
  336. package/dist/core/storage/session/snapshot-cut.js +11 -7
  337. package/dist/core/storage/session/snapshot-history.code.js +107 -0
  338. package/dist/core/storage/session/snapshot-history.code.js.map +1 -0
  339. package/dist/core/storage/session/snapshot-history.impl.js +34 -60
  340. package/dist/core/storage/session/snapshot-history.impl.js.map +1 -1
  341. package/dist/core/storage/session/snapshot-history.js +11 -7
  342. package/dist/core/storage/session/sql-session-store.code.js +3 -0
  343. package/dist/core/storage/session/sql-session-store.code.js.map +1 -0
  344. package/dist/core/storage/session/sql-session-store.impl.js +35 -2
  345. package/dist/core/storage/session/sql-session-store.js +11 -7
  346. package/dist/core/storage/session/tree-outline.code.js +3 -0
  347. package/dist/core/storage/session/tree-outline.code.js.map +1 -0
  348. package/dist/core/storage/session/tree-outline.impl.js +35 -2
  349. package/dist/core/storage/session/tree-outline.js +11 -7
  350. package/dist/core/storage/session/tree-presentation.code.js +342 -0
  351. package/dist/core/storage/session/tree-presentation.code.js.map +1 -0
  352. package/dist/core/storage/session/tree-presentation.impl.js +31 -337
  353. package/dist/core/storage/session/tree-presentation.impl.js.map +1 -1
  354. package/dist/core/storage/session/tree-presentation.js +11 -7
  355. package/dist/core/storage/session/types.d.ts +26 -0
  356. package/dist/core/storage/storage-status.code.js +3 -0
  357. package/dist/core/storage/storage-status.code.js.map +1 -0
  358. package/dist/core/storage/storage-status.impl.js +35 -2
  359. package/dist/core/storage/storage-status.js +11 -7
  360. package/dist/core/storage/team.code.js +3 -0
  361. package/dist/core/storage/team.code.js.map +1 -0
  362. package/dist/core/storage/team.impl.js +35 -2
  363. package/dist/core/storage/team.js +11 -7
  364. package/dist/core/structured-output/index.code.js +3 -0
  365. package/dist/core/structured-output/index.code.js.map +1 -0
  366. package/dist/core/structured-output/index.impl.js +35 -2
  367. package/dist/core/structured-output/index.js +11 -7
  368. package/dist/core/tasks/command-output.d.ts +4 -1
  369. package/dist/core/tasks/supervisor.d.ts +2 -0
  370. package/dist/core/tasks/task-completion-entry.code.js +254 -0
  371. package/dist/core/tasks/task-completion-entry.code.js.map +1 -0
  372. package/dist/core/tasks/task-completion-entry.impl.js +33 -251
  373. package/dist/core/tasks/task-completion-entry.impl.js.map +1 -1
  374. package/dist/core/tasks/task-completion-entry.js +11 -7
  375. package/dist/core/tasks/task-file-history.code.js +424 -0
  376. package/dist/core/tasks/task-file-history.code.js.map +1 -0
  377. package/dist/core/tasks/task-file-history.impl.js +32 -375
  378. package/dist/core/tasks/task-file-history.impl.js.map +1 -1
  379. package/dist/core/tasks/task-file-history.js +11 -7
  380. package/dist/core/tasks/{task-reference-archive.impl.js → task-reference-archive.code.js} +51 -6
  381. package/dist/core/tasks/{task-reference-archive.impl.js.map → task-reference-archive.code.js.map} +1 -1
  382. package/dist/core/tasks/task-reference-archive.js +11 -7
  383. package/dist/core/tasks/{task-reference-identity.impl.js → task-reference-identity.code.js} +1 -1
  384. package/dist/core/tasks/{task-reference-identity.impl.js.map → task-reference-identity.code.js.map} +1 -1
  385. package/dist/core/tasks/task-reference-identity.js +11 -7
  386. package/dist/core/tasks/task-reference-stream.code.js +3 -0
  387. package/dist/core/tasks/task-reference-stream.code.js.map +1 -0
  388. package/dist/core/tasks/task-reference-stream.impl.js +35 -2
  389. package/dist/core/tasks/task-reference-stream.js +11 -7
  390. package/dist/core/tasks/task-unsaved-answer.code.js +3 -0
  391. package/dist/core/tasks/task-unsaved-answer.code.js.map +1 -0
  392. package/dist/core/tasks/task-unsaved-answer.impl.js +35 -2
  393. package/dist/core/tasks/task-unsaved-answer.js +11 -7
  394. package/dist/core/tasks/task-view-source.code.js +3 -0
  395. package/dist/core/tasks/task-view-source.code.js.map +1 -0
  396. package/dist/core/tasks/task-view-source.d.ts +9 -0
  397. package/dist/core/tasks/task-view-source.impl.js +35 -2
  398. package/dist/core/tasks/task-view-source.js +12 -8
  399. package/dist/core/tools/read-url.code.js +1530 -0
  400. package/dist/core/tools/read-url.code.js.map +1 -0
  401. package/dist/core/tools/read-url.impl.js +30 -1524
  402. package/dist/core/tools/read-url.impl.js.map +1 -1
  403. package/dist/core/tools/read-url.js +11 -7
  404. package/dist/core/worktree-snapshot/blob-store.js +50 -5
  405. package/dist/core/worktree-snapshot/errors.code.js +6 -0
  406. package/dist/core/worktree-snapshot/errors.code.js.map +1 -0
  407. package/dist/core/worktree-snapshot/errors.impl.js +35 -5
  408. package/dist/core/worktree-snapshot/errors.js +11 -7
  409. package/dist/core/worktree-snapshot/session-index-reset.code.js +136 -0
  410. package/dist/core/worktree-snapshot/session-index-reset.code.js.map +1 -0
  411. package/dist/core/worktree-snapshot/session-index-reset.impl.js +34 -134
  412. package/dist/core/worktree-snapshot/session-index-reset.impl.js.map +1 -1
  413. package/dist/core/worktree-snapshot/session-index-reset.js +11 -7
  414. package/dist/extensions/codemode/execute.code.js +618 -0
  415. package/dist/extensions/codemode/execute.code.js.map +1 -0
  416. package/dist/extensions/codemode/execute.impl.js +30 -612
  417. package/dist/extensions/codemode/execute.impl.js.map +1 -1
  418. package/dist/extensions/codemode/execute.js +11 -7
  419. package/dist/extensions/codemode/renderer.code.js +110 -0
  420. package/dist/extensions/codemode/renderer.code.js.map +1 -0
  421. package/dist/extensions/codemode/renderer.impl.js +33 -107
  422. package/dist/extensions/codemode/renderer.impl.js.map +1 -1
  423. package/dist/extensions/codemode/renderer.js +11 -7
  424. package/dist/extensions/mcp/cli.code.js +565 -0
  425. package/dist/extensions/mcp/cli.code.js.map +1 -0
  426. package/dist/extensions/mcp/cli.impl.js +32 -561
  427. package/dist/extensions/mcp/cli.impl.js.map +1 -1
  428. package/dist/extensions/mcp/cli.js +11 -7
  429. package/dist/extensions/mcp/cli.lazy.code.js +52 -0
  430. package/dist/extensions/mcp/cli.lazy.code.js.map +1 -0
  431. package/dist/extensions/mcp/cli.lazy.impl.js +36 -7
  432. package/dist/extensions/mcp/cli.lazy.impl.js.map +1 -1
  433. package/dist/extensions/mcp/cli.lazy.js +11 -7
  434. package/dist/extensions/mcp/client/transports/stdio.d.ts +2 -0
  435. package/dist/extensions/mcp/runtime.code.js +5 -0
  436. package/dist/extensions/mcp/runtime.code.js.map +1 -0
  437. package/dist/extensions/mcp/runtime.impl.js +35 -4
  438. package/dist/extensions/mcp/runtime.js +11 -7
  439. package/dist/index.d.ts +1 -1
  440. package/dist/index.js +8 -8
  441. package/dist/main-first-time-setup.code.js +12 -0
  442. package/dist/main-first-time-setup.code.js.map +1 -0
  443. package/dist/main-first-time-setup.impl.js +35 -11
  444. package/dist/main-first-time-setup.impl.js.map +1 -1
  445. package/dist/main-first-time-setup.js +11 -7
  446. package/dist/main.d.ts +1 -1
  447. package/dist/main.js +2 -2
  448. package/dist/modes/interactive/agent-view/agent-view-switcher.d.ts +6 -1
  449. package/dist/modes/interactive/agent-view/contracts.d.ts +4 -0
  450. package/dist/modes/interactive/chat-reader-records.d.ts +1 -1
  451. package/dist/modes/interactive/components/stored-tree-view.code.js +338 -0
  452. package/dist/modes/interactive/components/stored-tree-view.code.js.map +1 -0
  453. package/dist/modes/interactive/components/stored-tree-view.impl.js +33 -290
  454. package/dist/modes/interactive/components/stored-tree-view.impl.js.map +1 -1
  455. package/dist/modes/interactive/components/stored-tree-view.js +11 -7
  456. package/dist/modes/interactive/components/task-selection-state.d.ts +8 -3
  457. package/dist/modes/interactive/components/task-transcript-page.d.ts +1 -0
  458. package/dist/modes/interactive/components/user-message-selector-archive.code.js +191 -0
  459. package/dist/modes/interactive/components/user-message-selector-archive.code.js.map +1 -0
  460. package/dist/modes/interactive/components/user-message-selector-archive.impl.js +34 -189
  461. package/dist/modes/interactive/components/user-message-selector-archive.impl.js.map +1 -1
  462. package/dist/modes/interactive/components/user-message-selector-archive.js +11 -7
  463. package/dist/modes/interactive/interactive-mode-base.d.ts +6 -0
  464. package/dist/modes/interactive/interactive-mode.js +1 -1
  465. package/dist/modes/interactive/interactive-queueing.d.ts +4 -0
  466. package/dist/modes/interactive/interactive-render-chat.d.ts +22 -0
  467. package/dist/modes/interactive/interactive-startup.d.ts +2 -0
  468. package/dist/modes/interactive/program-status-reporter.d.ts +2 -1
  469. package/dist/modes/interactive/startup-shell-eligibility.js +1 -1
  470. package/dist/modes/interactive/steering-queue-controller.d.ts +4 -0
  471. package/dist/modes/interactive/theme/theme-schema-factory.d.ts +26 -0
  472. package/dist/modes/interactive/theme/theme-schema.d.ts +4 -5
  473. package/dist/modes/interactive-engine/engine-prewarm.d.ts +30 -5
  474. package/dist/modes/interactive-engine/engine-prewarm.js +1 -1
  475. package/dist/modes/interactive-engine/isolated-runtime.d.ts +7 -0
  476. package/dist/modes/interactive-engine/protocol.d.ts +32 -1
  477. package/dist/modes/rpc/agent-view-rpc-types.d.ts +12 -1
  478. package/dist/modes/rpc/agent-view-rpc-types.js.map +1 -1
  479. package/dist/modes/rpc/rpc-client-api.d.ts +3 -1
  480. package/dist/modes/rpc/rpc-types.d.ts +12 -0
  481. package/dist/package-manager-cli.code.js +1140 -0
  482. package/dist/package-manager-cli.code.js.map +1 -0
  483. package/dist/package-manager-cli.impl.js +36 -1067
  484. package/dist/package-manager-cli.impl.js.map +1 -1
  485. package/dist/package-manager-cli.js +11 -7
  486. package/dist/rpc-entry.js +2 -2
  487. package/dist/startup-files.json +1 -1
  488. package/dist/startup-stages/10.js +1 -1
  489. package/dist/startup-stages/11.js +1 -1
  490. package/dist/startup-stages/12.js +1 -1
  491. package/dist/startup-stages/13.js +1 -0
  492. package/dist/startup-stages/2.js +1 -7
  493. package/dist/startup-stages/3.js +6 -2
  494. package/dist/startup-stages/4.js +2 -1
  495. package/dist/startup-stages/5.js +1 -7
  496. package/dist/startup-stages/6.js +7 -10
  497. package/dist/startup-stages/7.js +10 -3
  498. package/dist/startup-stages/8.js +3 -6
  499. package/dist/startup-stages/9.js +6 -1
  500. package/dist/startup-stages/stages.json +1 -1
  501. package/dist/utils/canonical-path.js +2 -0
  502. package/dist/utils/canonical-path.js.map +1 -1
  503. package/dist/utils/child-process.d.ts +41 -1
  504. package/dist/utils/compile-cache-warmup-host.js +63 -18
  505. package/dist/utils/compile-cache-warmup-host.js.map +1 -1
  506. package/dist/utils/credential-redaction.d.ts +50 -1
  507. package/dist/utils/interactive-engine-bootstrap.d.ts +2 -0
  508. package/dist/utils/interactive-engine-env.d.ts +2 -0
  509. package/dist/utils/memoize-async.d.ts +32 -0
  510. package/dist/utils/memoize-async.js +91 -0
  511. package/dist/utils/memoize-async.js.map +1 -0
  512. package/dist/utils/photon.js +19 -29
  513. package/dist/utils/photon.js.map +1 -1
  514. package/dist/utils/shell.d.ts +7 -4
  515. package/dist/utils/startup-database-spare.code.js +108 -0
  516. package/dist/utils/startup-database-spare.code.js.map +1 -0
  517. package/dist/utils/startup-database-spare.impl.js +33 -105
  518. package/dist/utils/startup-database-spare.impl.js.map +1 -1
  519. package/dist/utils/startup-database-spare.js +11 -7
  520. package/dist/utils/tools-manager.code.js +3 -0
  521. package/dist/utils/tools-manager.code.js.map +1 -0
  522. package/dist/utils/tools-manager.impl.js +35 -2
  523. package/dist/utils/tools-manager.js +11 -7
  524. package/dist/utils/windows-cwd.js +585 -0
  525. package/dist/utils/windows-cwd.js.map +1 -0
  526. package/docs/extensions.md +1 -1
  527. package/docs/getting-started/installation.md +2 -0
  528. package/docs/intercom/operations.md +1 -0
  529. package/docs/reference/cli.md +1 -1
  530. package/package.json +24 -24
  531. package/dist/_shared/mode-shared-HP7GUA7J.js.map +0 -1
  532. package/dist/_shared/p1a-prewarm-YK3KDTLN.js.map +0 -1
  533. package/dist/_shared/p1b-elig-PXQA2FYP.js.map +0 -1
  534. package/dist/_shared/startup-0-0-X4NF3GKM.js.map +0 -1
  535. package/dist/_shared/startup-0-1-7QTG6VJZ.js.map +0 -1
  536. package/dist/_shared/startup-0-2-KFDYPDJK.js.map +0 -1
  537. package/dist/_shared/startup-8-1-KQJBDKRU.js.map +0 -1
@@ -0,0 +1,684 @@
1
+ import { __name } from "../../../_shared/rolldown-runtime-BGM3D5V3.js";
2
+ import { SESSION_HISTORY_CHUNK_BYTES, yieldSessionTurn } from "../../../_shared/settings-startup-65YEWRV2.js";
3
+ import { historyChunks } from "../../../_shared/startup-8-0-34CBHPZH.js";
4
+ import { read, skip, stringValue } from "../../../_shared/startup-0-5-OHJNE6JH.js";
5
+ import { SessionConflictError } from "./errors.js";
6
+ // dist/core/storage/session/card-message-projection.js
7
+ function* object(first, fields) {
8
+ if (first.name !== "startObject") {
9
+ yield* skip(first);
10
+ return;
11
+ }
12
+ const limit = Math.max(...Object.keys(fields).map((k) => k.length)) + 1;
13
+ for (let k = yield; k.name !== "endObject"; k = yield) {
14
+ const key = yield* stringValue(limit);
15
+ const value = yield;
16
+ if (Object.hasOwn(fields, key)) yield* fields[key](value);
17
+ else yield* skip(value);
18
+ }
19
+ }
20
+ /** A copy of a string a card keeps, so it holds that text and not the decoded page a streamed value is a slice of. */
21
+ const own = (s) => s.length > 12 ? ` ${s}`.slice(1) : s;
22
+ const isRecord$1 = /* @__PURE__ */ __name((v) => typeof v === "object" && v !== null && !Array.isArray(v), "isRecord");
23
+ function* json(t) {
24
+ if (t.name === "startObject") {
25
+ const r = {};
26
+ for (let k = yield; k.name !== "endObject"; k = yield) {
27
+ const key = yield* stringValue();
28
+ Object.defineProperty(r, key, {
29
+ value: yield* json(yield),
30
+ configurable: true,
31
+ enumerable: true,
32
+ writable: true
33
+ });
34
+ }
35
+ return r;
36
+ }
37
+ if (t.name === "startArray") {
38
+ const a = [];
39
+ for (let v = yield; v.name !== "endArray"; v = yield) a.push(yield* json(v));
40
+ return a;
41
+ }
42
+ if (t.name === "startString") return own(yield* stringValue());
43
+ if (t.name === "numberValue") return Number(t.value);
44
+ if (t.name === "trueValue" || t.name === "falseValue" || t.name === "nullValue") return t.value;
45
+ throw new SyntaxError("Invalid stored JSON value");
46
+ }
47
+ const MARKER = "\n\nTask:\n";
48
+ /** A text value read piece by piece: a streamed value in its chunks, a parsed one as one piece. */
49
+ var TextReader = class {
50
+ raw;
51
+ preview = "";
52
+ space = false;
53
+ marker = false;
54
+ left = "";
55
+ right = "";
56
+ constructor(full) {
57
+ this.raw = full ? "" : void 0;
58
+ }
59
+ add(s) {
60
+ if (this.raw !== void 0) this.raw += s;
61
+ this.marker ||= (this.right + s).includes(MARKER);
62
+ this.left += s.slice(0, Math.max(0, 8 - this.left.length));
63
+ this.right = (this.right + s).slice(-8);
64
+ if (this.preview.length > 201) return;
65
+ for (const m of s.matchAll(/\s+|\S+/gu)) {
66
+ if (/\s/u.test(m[0][0])) this.space = true;
67
+ else {
68
+ if (this.space && this.preview) this.preview += " ";
69
+ this.preview += m[0].slice(0, 202 - this.preview.length);
70
+ this.space = false;
71
+ }
72
+ if (this.preview.length >= 202) break;
73
+ }
74
+ }
75
+ done() {
76
+ return {
77
+ raw: this.raw === void 0 ? void 0 : own(this.raw),
78
+ preview: this.preview,
79
+ marker: this.marker,
80
+ left: this.left,
81
+ right: this.right
82
+ };
83
+ }
84
+ };
85
+ function* text(t, full) {
86
+ if (t.name !== "startString") {
87
+ yield* skip(t);
88
+ return;
89
+ }
90
+ const reader = new TextReader(full);
91
+ for (let p = yield; p.name === "stringChunk"; p = yield) reader.add(p.value);
92
+ return reader.done();
93
+ }
94
+ function textOf(s, full) {
95
+ const reader = new TextReader(full);
96
+ reader.add(s);
97
+ return reader.done();
98
+ }
99
+ const emptyPiece = () => ({
100
+ lines: [],
101
+ calls: [],
102
+ nonblank: false,
103
+ marker: false
104
+ });
105
+ /** What one message's content shows on its card, whether its content was streamed or parsed. */
106
+ var PieceBuilder = class {
107
+ output;
108
+ pieces = 0;
109
+ tail = "";
110
+ role;
111
+ full;
112
+ constructor(role, full) {
113
+ this.role = role;
114
+ this.full = full;
115
+ this.output = {
116
+ ...emptyPiece(),
117
+ ...full ? { text: "" } : {}
118
+ };
119
+ }
120
+ line(s) {
121
+ if (s.length > 200) {
122
+ let end = 199;
123
+ if (/[\uD800-\uDBFF]/.test(s.charAt(end - 1)) && /[\uDC00-\uDFFF]/.test(s.charAt(end))) end--;
124
+ s = `${s.slice(0, end)}…`;
125
+ }
126
+ this.output.lines.push(own(s));
127
+ if (this.output.lines.length > 12) this.output.lines.shift();
128
+ }
129
+ part(v) {
130
+ if (!v) return;
131
+ const { output } = this;
132
+ const join = this.pieces ? "\n" : "";
133
+ output.nonblank ||= !!v.preview;
134
+ output.marker ||= v.marker || (this.tail + join + v.left).includes(MARKER);
135
+ this.tail = (this.tail + join + v.right).slice(-8);
136
+ if (this.full) output.text += join + (v.raw ?? "");
137
+ this.pieces++;
138
+ if (v.preview) this.line((this.role === "user" ? "› " : "") + v.preview);
139
+ }
140
+ block(index, type, name, id, v, args) {
141
+ if (type === "text") this.part(v);
142
+ else if (type === "toolCall" && name) {
143
+ this.line(`→ ${name}`);
144
+ if (this.role === "assistant") this.output.calls.push({
145
+ index,
146
+ id,
147
+ name,
148
+ ...args === void 0 ? {} : { args: isRecord$1(args) ? args : {} }
149
+ });
150
+ }
151
+ }
152
+ done() {
153
+ const { output } = this;
154
+ if (output.text !== void 0) output.text = own(output.text);
155
+ return output;
156
+ }
157
+ };
158
+ function* content(t, role, full, args) {
159
+ const builder = new PieceBuilder(role, full);
160
+ if (t.name === "startString") builder.part(yield* text(t, full));
161
+ else if (t.name === "startArray") {
162
+ let index = 0;
163
+ const wanted = (at) => args === "all" || !!args?.has(at);
164
+ for (let b = yield; b.name !== "endArray"; b = yield, index++) {
165
+ let type = "";
166
+ let name = "";
167
+ let id = "";
168
+ let v;
169
+ let argumentsValue;
170
+ yield* object(b, {
171
+ type: function* (x) {
172
+ if (x.name === "startString") type = yield* stringValue(16);
173
+ else yield* skip(x);
174
+ },
175
+ name: function* (x) {
176
+ if (x.name === "startString") name = own(yield* stringValue());
177
+ else yield* skip(x);
178
+ },
179
+ id: function* (x) {
180
+ if (x.name === "startString") id = own(yield* stringValue());
181
+ else yield* skip(x);
182
+ },
183
+ text: function* (x) {
184
+ v = yield* text(x, full);
185
+ },
186
+ arguments: function* (x) {
187
+ if (wanted(index)) argumentsValue = yield* json(x);
188
+ else yield* skip(x);
189
+ }
190
+ });
191
+ builder.block(index, type, name, id, v, wanted(index) ? argumentsValue ?? null : void 0);
192
+ }
193
+ } else yield* skip(t);
194
+ return builder.done();
195
+ }
196
+ async function cardPiece(chunks, role, edit, full = false, args) {
197
+ return read(chunks, (function* () {
198
+ let p = emptyPiece();
199
+ yield* object(yield, { [edit ? "replacement" : "message"]: function* (t) {
200
+ yield* object(t, { content: function* (c) {
201
+ p = yield* content(c, role, full, args);
202
+ } });
203
+ } });
204
+ return p;
205
+ })());
206
+ }
207
+ /** The same projection as {@link cardPiece} of a message's `content`, when the row was parsed whole. */
208
+ function cardPieceOf(value, role, full = false, args) {
209
+ if (value === void 0) return emptyPiece();
210
+ const builder = new PieceBuilder(role, full);
211
+ if (typeof value === "string") builder.part(textOf(value, full));
212
+ else if (Array.isArray(value)) value.forEach((b, index) => {
213
+ if (!isRecord$1(b)) return;
214
+ const withArgs = args === "all" || !!args?.has(index);
215
+ builder.block(index, typeof b.type === "string" ? b.type.slice(0, 16) : "", typeof b.name === "string" ? b.name : "", typeof b.id === "string" ? b.id : "", typeof b.text === "string" ? textOf(b.text, full) : void 0, withArgs ? b.arguments ?? null : void 0);
216
+ });
217
+ return builder.done();
218
+ }
219
+ /** A row's kind, ID, role and tool call ID, read only as far into the entry as needed. Atomic writes `type` and `id`
220
+ * before a row's payload, and `role` and `toolCallId` before a message's content, so a large row is not streamed to
221
+ * find them. A key written later is still found by reading on. */
222
+ async function cardHeader(chunks) {
223
+ return read(chunks, (function* () {
224
+ const h = {};
225
+ const seen = /* @__PURE__ */ new Set();
226
+ const known = () => seen.has("type") && (h.type !== "message" || seen.has("id") && seen.has("role") && (h.role !== "toolResult" || seen.has("toolCallId")));
227
+ const first = yield;
228
+ if (first.name !== "startObject") {
229
+ yield* skip(first);
230
+ return h;
231
+ }
232
+ for (let k = yield; k.name !== "endObject"; k = yield) {
233
+ const key = yield* stringValue(8);
234
+ const value = yield;
235
+ if (key === "type") {
236
+ seen.add(key);
237
+ if (value.name === "startString") h.type = yield* stringValue(64);
238
+ else yield* skip(value);
239
+ } else if (key === "id") {
240
+ seen.add(key);
241
+ h.id = yield* json(value);
242
+ } else if (key === "message" && value.name === "startObject") for (let m = yield; m.name !== "endObject"; m = yield) {
243
+ const field = yield* stringValue(11);
244
+ const v = yield;
245
+ if (field === "role") {
246
+ seen.add(field);
247
+ if (v.name === "startString") h.role = yield* stringValue(64);
248
+ else yield* skip(v);
249
+ } else if (field === "toolCallId") {
250
+ seen.add(field);
251
+ h.toolCallId = yield* json(v);
252
+ } else yield* skip(v);
253
+ if (known()) return h;
254
+ }
255
+ else yield* skip(value);
256
+ if (known()) return h;
257
+ }
258
+ return h;
259
+ })());
260
+ }
261
+ async function cardFields(chunks, kind) {
262
+ return read(chunks, (function* () {
263
+ const r = {};
264
+ const value = (k) => function* (t) {
265
+ r[k] = yield* json(t);
266
+ };
267
+ const tag = (k) => function* (t) {
268
+ if (t.name === "startString") r[k] = yield* stringValue(64);
269
+ else yield* skip(t);
270
+ };
271
+ const child = (f) => function* (t) {
272
+ yield* object(t, f);
273
+ };
274
+ const fields = kind === "boundary" ? { details: child({ backend: tag("backend") }) } : kind === "edit" ? {
275
+ targetId: value("targetId"),
276
+ replacement: function* (t) {
277
+ r.omit = t.name === "nullValue";
278
+ yield* skip(t);
279
+ }
280
+ } : kind === "replacement" ? { replacement: child({ content: value("content") }) } : kind === "result" || kind === "editedResult" ? { message: child({
281
+ ...kind === "result" ? { content: value("content") } : {},
282
+ details: value("details"),
283
+ toolCallId: value("toolCallId"),
284
+ isError: value("isError"),
285
+ durationMs: value("durationMs")
286
+ }) } : {
287
+ type: tag("type"),
288
+ customType: tag("customType"),
289
+ id: value("id"),
290
+ data: child({
291
+ version: value("version"),
292
+ state: tag("state"),
293
+ runId: tag("runId"),
294
+ agent: tag("agent"),
295
+ cwd: tag("cwd"),
296
+ index: value("index"),
297
+ childId: value("childId"),
298
+ launchLeafId: value("launchLeafId"),
299
+ launchLeafSeq: value("launchLeafSeq"),
300
+ forked: value("forked")
301
+ })
302
+ };
303
+ yield* object(yield, fields);
304
+ return r;
305
+ })());
306
+ }
307
+ // dist/core/storage/session/expanded-child-details.js
308
+ /** An operator explicitly expanded this card. Keep what its renderers are passed, but not thinking,
309
+ * hidden notices, discarded answers, unmatched outputs, or the session manager. Reads use one generation. */
310
+ async function readExpandedChildDetails(store, id, launch = {}, options = {}) {
311
+ const { signal } = options;
312
+ signal?.throwIfAborted();
313
+ if (!store.readChildDisplayCut || !store.readEntrySizes || !store.readEntryChunk || !store.readBranchSpan) {
314
+ const snap = await store.load(id);
315
+ signal?.throwIfAborted();
316
+ const { foldSessionResume, transcriptBranchSpan } = await import("./session-resume.code.js").catch((error) => __atomicOnDemandFailed(error, "session storage"));
317
+ const { childDisplayCut } = await import("./card-view.code.js").catch((error) => __atomicOnDemandFailed(error, "session storage"));
318
+ const index = foldSessionResume(void 0, snap.entries);
319
+ const cut = childDisplayCut(index, launch, typeof launch.launchLeafId === "string" ? snap.entries.findLastIndex((e) => e.id === launch.launchLeafId) + 1 || void 0 : void 0);
320
+ let cached;
321
+ return projectExpanded({
322
+ descriptor: store.descriptor,
323
+ readEntrySizes: async (_id, from, to) => ({
324
+ epoch: index.epoch,
325
+ lastSeq: snap.lastSeq,
326
+ sizes: snap.entries.slice(from - 1, to).map((e, i) => ({
327
+ seq: from + i,
328
+ bytes: Buffer.byteLength(JSON.stringify(e))
329
+ }))
330
+ }),
331
+ readRange: async (_id, startSeq, end) => ({
332
+ epoch: index.epoch,
333
+ lastSeq: snap.lastSeq,
334
+ startSeq,
335
+ entries: snap.entries.slice(startSeq - 1, end)
336
+ }),
337
+ readTreeOutline: async (_id, from, to) => snap.entries.slice(from - 1, to).map((e, i) => ({
338
+ seq: from + i,
339
+ id: e.id,
340
+ parentId: e.parentId,
341
+ type: e.type,
342
+ timestamp: e.timestamp,
343
+ ...e.type === "message" ? { role: e.message.role } : {}
344
+ })),
345
+ readEntryChunk: async (ref, off) => {
346
+ if (cached?.seq !== ref.seq) cached = {
347
+ seq: ref.seq,
348
+ bytes: Buffer.from(JSON.stringify(snap.entries[ref.seq - 1]))
349
+ };
350
+ return cached.bytes.subarray(off, off + SESSION_HISTORY_CHUNK_BYTES);
351
+ },
352
+ readBranchSpan: async (key, range) => transcriptBranchSpan(key, index, range)
353
+ }, id, launch, cut, signal);
354
+ }
355
+ return projectExpanded(store, id, launch, await store.readChildDisplayCut(id, launch), signal);
356
+ }
357
+ /** Rows up to this size are read together, about this much at a time, and parsed whole; a larger row is streamed. */
358
+ const BATCH_BYTES = 1048576;
359
+ /** A row an outline shows the card never displays is read with its neighbours only when it is this small. */
360
+ const PASSING_BYTES = 16384;
361
+ const isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
362
+ async function projectExpanded(store, id, launch, cut, signal) {
363
+ const at = (seq, bytes) => ({
364
+ kind: "oversized",
365
+ sessionId: id,
366
+ epoch: cut.epoch,
367
+ seq,
368
+ bytes
369
+ });
370
+ let head;
371
+ async function* chunks(ref) {
372
+ let offset = 0;
373
+ if (head?.seq === ref.seq) {
374
+ offset = head.bytes.length;
375
+ yield head.bytes;
376
+ }
377
+ if (offset < ref.bytes) yield* historyChunks(store, id, cut.epoch, ref, {
378
+ signal,
379
+ offset
380
+ });
381
+ }
382
+ const headerOf = (ref) => {
383
+ head = void 0;
384
+ return cardHeader((async function* () {
385
+ for await (const bytes of historyChunks(store, id, cut.epoch, ref, { signal })) {
386
+ head ??= {
387
+ seq: ref.seq,
388
+ bytes
389
+ };
390
+ yield bytes;
391
+ }
392
+ })());
393
+ };
394
+ const shown = (type, role, seq) => type === "message" && (role === "user" || role === "assistant" || role === "toolResult") || !!cut.model && (type === "context_edit" || type === "compaction" && seq === cut.boundary);
395
+ const argsOf = (role) => role === "assistant" ? "all" : void 0;
396
+ let active = !cut.model || !launch.forked;
397
+ let prompt;
398
+ let answer;
399
+ let lines = [];
400
+ const calls = [];
401
+ const wanted = /* @__PURE__ */ new Set();
402
+ const results = /* @__PURE__ */ new Map();
403
+ const show = (row) => {
404
+ if (row.role === "toolResult") {
405
+ if (active && typeof row.toolCallId === "string") results.set(row.toolCallId, row);
406
+ return;
407
+ }
408
+ if (!active && row.role !== "user") return;
409
+ const p = row.piece;
410
+ if (!active) {
411
+ if (!p.marker) return;
412
+ active = true;
413
+ }
414
+ if (row.role === "user" && !prompt && p.nonblank) prompt = row;
415
+ else if (row.role === "assistant" && p.nonblank) answer = row;
416
+ lines.push(...p.lines);
417
+ if (lines.length > 12) lines = lines.slice(-12);
418
+ for (const c of p.calls) {
419
+ calls.push(c);
420
+ if (c.id) wanted.add(c.id);
421
+ }
422
+ };
423
+ const held = [];
424
+ const edits = /* @__PURE__ */ new Map();
425
+ let boundary;
426
+ const take = (row) => cut.model ? held.push(row) : show(row);
427
+ const parsed = (seq, bytes, e) => {
428
+ if (!isRecord(e) || typeof e.type !== "string") return;
429
+ const message = isRecord(e.message) ? e.message : void 0;
430
+ const role = typeof message?.role === "string" ? message.role : void 0;
431
+ if (!shown(e.type, role, seq)) return;
432
+ if (e.type === "message") {
433
+ if (role === "toolResult") take({
434
+ seq,
435
+ bytes,
436
+ role,
437
+ id: e.id,
438
+ toolCallId: message.toolCallId,
439
+ fields: message
440
+ });
441
+ else take({
442
+ seq,
443
+ bytes,
444
+ role,
445
+ id: e.id,
446
+ piece: cardPieceOf(message.content, role, false, argsOf(role))
447
+ });
448
+ } else if (e.type === "context_edit") {
449
+ if (typeof e.targetId === "string") edits.set(e.targetId, e.replacement === null ? null : {
450
+ seq,
451
+ bytes,
452
+ content: { value: isRecord(e.replacement) ? e.replacement.content : void 0 }
453
+ });
454
+ } else boundary = { backend: isRecord(e.details) && typeof e.details.backend === "string" ? e.details.backend.slice(0, 64) : void 0 };
455
+ };
456
+ const streamed = async (seq, bytes, outline) => {
457
+ const ref = at(seq, bytes);
458
+ const h = outline ?? await headerOf(ref);
459
+ const role = typeof h.role === "string" ? h.role : void 0;
460
+ if (typeof h.type !== "string" || !shown(h.type, role, seq)) return;
461
+ if (h.type === "message") {
462
+ if (role === "toolResult") take({
463
+ seq,
464
+ bytes,
465
+ role,
466
+ id: h.id,
467
+ toolCallId: outline ? (await headerOf(ref)).toolCallId : h.toolCallId
468
+ });
469
+ else take({
470
+ seq,
471
+ bytes,
472
+ role,
473
+ id: h.id,
474
+ piece: await cardPiece(chunks(ref), role, false, false, argsOf(role))
475
+ });
476
+ } else if (h.type === "context_edit") {
477
+ const e = await cardFields(chunks(ref), "edit");
478
+ if (typeof e.targetId === "string") edits.set(e.targetId, e.omit ? null : {
479
+ seq,
480
+ bytes
481
+ });
482
+ } else boundary = { backend: (await cardFields(chunks(ref), "boundary")).backend };
483
+ };
484
+ const batch = async (rows) => {
485
+ if (!rows.length) return;
486
+ if (!store.readRange) {
487
+ for (const { seq, bytes } of rows) await streamed(seq, bytes);
488
+ return;
489
+ }
490
+ const range = await store.readRange(id, rows[0].seq, rows.at(-1).seq, cut.epoch);
491
+ if (range.epoch !== void 0 && range.epoch !== cut.epoch) throw new SessionConflictError(id, cut.through, range.lastSeq);
492
+ const sizes = new Map(rows.map((r) => [r.seq, r.bytes]));
493
+ range.entries.forEach((e, i) => {
494
+ const seq = range.seqs?.[i] ?? range.startSeq + i;
495
+ const bytes = sizes.get(seq);
496
+ if (bytes !== void 0) parsed(seq, bytes, e);
497
+ });
498
+ await yieldSessionTurn();
499
+ };
500
+ const segments = cut.earlier.map((seq) => [seq, seq]);
501
+ if (cut.from <= cut.leaf) segments.push([cut.from, cut.leaf]);
502
+ for (const [first, last] of segments) for (let pivot = first; pivot <= last;) {
503
+ signal?.throwIfAborted();
504
+ const span = await store.readBranchSpan(id, {
505
+ leaf: cut.leaf,
506
+ first,
507
+ last,
508
+ pivot,
509
+ backward: false,
510
+ epoch: cut.epoch
511
+ });
512
+ if (!span) break;
513
+ const hi = Math.min(span.end, span.start + 64 - 1);
514
+ const sizes = await store.readEntrySizes(id, span.start, hi);
515
+ if (sizes.epoch !== cut.epoch || sizes.lastSeq < cut.through) throw new SessionConflictError(id, cut.through, sizes.lastSeq);
516
+ const outline = await store.readTreeOutline?.(id, span.start, hi, cut.epoch);
517
+ let pending = [];
518
+ let pendingBytes = 0;
519
+ for (const { seq, bytes } of sizes.sizes) {
520
+ signal?.throwIfAborted();
521
+ const info = outline?.[seq - span.start];
522
+ const known = info && !("streamed" in info) ? info : void 0;
523
+ const skipped = known !== void 0 && !shown(known.type, known.role, seq);
524
+ if (bytes > BATCH_BYTES || skipped && bytes > PASSING_BYTES || pendingBytes + bytes > BATCH_BYTES) {
525
+ await batch(pending);
526
+ pending = [];
527
+ pendingBytes = 0;
528
+ }
529
+ if (skipped && bytes > PASSING_BYTES) continue;
530
+ if (bytes > BATCH_BYTES) await streamed(seq, bytes, known);
531
+ else {
532
+ pending.push({
533
+ seq,
534
+ bytes
535
+ });
536
+ pendingBytes += bytes;
537
+ }
538
+ }
539
+ await batch(pending);
540
+ pivot = hi + 1;
541
+ if (pivot <= last) await yieldSessionTurn();
542
+ }
543
+ if (cut.model) {
544
+ const covered = boundary && boundary.backend !== "summary" ? cut.covered ?? 0 : 0;
545
+ for (const row of held) {
546
+ if (row.seq <= covered) continue;
547
+ const edit = edits.get(row.id);
548
+ if (edit === null) continue;
549
+ if (edit) {
550
+ row.edit = edit;
551
+ if (row.role !== "toolResult") row.piece = edit.content ? cardPieceOf(edit.content.value, row.role, false, argsOf(row.role)) : await cardPiece(chunks(at(edit.seq, edit.bytes)), row.role, true, false, argsOf(row.role));
552
+ }
553
+ show(row);
554
+ }
555
+ held.length = 0;
556
+ }
557
+ const replacementOf = async (edit) => edit.content ? edit.content.value : (await cardFields(chunks(at(edit.seq, edit.bytes)), "replacement")).content;
558
+ const values = /* @__PURE__ */ new Map();
559
+ for (const [call, row] of results) {
560
+ if (!wanted.has(call)) continue;
561
+ const r = row.fields ?? await cardFields(chunks(at(row.seq, row.bytes)), row.edit ? "editedResult" : "result");
562
+ const replacement = row.edit ? await replacementOf(row.edit) : void 0;
563
+ const c = replacement === void 0 ? r.content : typeof replacement === "string" ? [{
564
+ type: "text",
565
+ text: replacement
566
+ }] : replacement;
567
+ const content = Array.isArray(c) ? c : [];
568
+ values.set(call, {
569
+ resultContent: content,
570
+ ...r.details !== void 0 ? { resultDetails: r.details } : {},
571
+ resultText: typeof c === "string" ? c : content.flatMap((b) => b?.type === "text" && typeof b.text === "string" ? [b.text] : []).join("\n"),
572
+ isError: r.isError === true,
573
+ ...typeof r.durationMs === "number" ? { durationMs: r.durationMs } : {},
574
+ completed: true
575
+ });
576
+ }
577
+ const toolCalls = calls.map((c) => ({
578
+ id: c.id,
579
+ name: c.name,
580
+ args: c.args ?? {},
581
+ ...values.get(c.id) ?? { completed: false }
582
+ }));
583
+ /** The whole text of the prompt or the answer: only the excerpt of each row was kept while reading. */
584
+ const textOf = async (row) => {
585
+ if (row.edit?.content) return cardPieceOf(row.edit.content.value, row.role, true).text;
586
+ if (row.edit) return (await cardPiece(chunks(at(row.edit.seq, row.edit.bytes)), row.role, true, true)).text;
587
+ if (row.bytes <= BATCH_BYTES && store.readRange) {
588
+ const e = (await store.readRange(id, row.seq, row.seq, cut.epoch)).entries[0];
589
+ return cardPieceOf(isRecord(e) && isRecord(e.message) ? e.message.content : void 0, row.role, true).text;
590
+ }
591
+ return (await cardPiece(chunks(at(row.seq, row.bytes)), row.role, false, true)).text;
592
+ };
593
+ signal?.throwIfAborted();
594
+ return {
595
+ ...prompt ? { prompt: await textOf(prompt) } : {},
596
+ toolCalls,
597
+ ...answer ? { result: (await textOf(answer))?.trim() } : {},
598
+ lines
599
+ };
600
+ }
601
+ /** Only the launch cursor is needed to choose a child's own rows; don't load the owner's unrelated children or its transcript. */
602
+ async function readSavedChildLaunch(store, id, entryId, childId, signal) {
603
+ if (!store.findEntrySeq || !store.readEntrySizes || !store.readEntryChunk) {
604
+ const e = (await store.load(id)).entries.find((e) => e.id === entryId);
605
+ if (e?.type === "custom" && e.customType === "subagent-child") {
606
+ const d = e.data;
607
+ if (d?.version === 1 && d.childId === childId && typeof d.runId === "string" && typeof d.agent === "string" && typeof d.cwd === "string" && typeof d.index === "number" && (d.state === "terminal" || d.state === "running")) return {
608
+ launchLeafId: d.launchLeafId,
609
+ launchLeafSeq: d.launchLeafSeq,
610
+ forked: d.forked
611
+ };
612
+ return;
613
+ }
614
+ return;
615
+ }
616
+ const cut = await store.readEntrySizes(id, 1, 0);
617
+ const seq = await store.findEntrySeq(id, entryId);
618
+ if (!seq || seq > cut.lastSeq) return void 0;
619
+ const sized = await store.readEntrySizes(id, seq, seq);
620
+ if (sized.epoch !== cut.epoch || sized.lastSeq < cut.lastSeq) throw new SessionConflictError(id, cut.lastSeq, sized.lastSeq);
621
+ const size = sized.sizes[0];
622
+ if (!size) return void 0;
623
+ const r = await cardFields(historyChunks(store, id, cut.epoch, {
624
+ kind: "oversized",
625
+ sessionId: id,
626
+ epoch: cut.epoch,
627
+ seq,
628
+ bytes: size.bytes
629
+ }, { signal }), "launch");
630
+ if (r.id !== entryId || r.customType !== "subagent-child" || r.type !== "custom" || r.version !== 1 || typeof r.runId !== "string" || typeof r.agent !== "string" || typeof r.cwd !== "string" || typeof r.index !== "number" || r.state !== "terminal" && r.state !== "running" || r.childId !== childId) return void 0;
631
+ return {
632
+ ...typeof r.launchLeafId === "string" || r.launchLeafId === null ? { launchLeafId: r.launchLeafId } : {},
633
+ ...typeof r.launchLeafSeq === "number" ? { launchLeafSeq: r.launchLeafSeq } : {},
634
+ ...typeof r.forked === "boolean" ? { forked: r.forked } : {}
635
+ };
636
+ }
637
+ export { readExpandedChildDetails, readSavedChildLaunch };
638
+
639
+ //# sourceMappingURL=expanded-child-details.code.js.map
640
+ // __atomicOnDemandFailed: written by the build (scripts/in-place-update-gate.mjs). An import of this release's code on
641
+ // demand that fails in a process an in-place update left running says to restart.
642
+ function __atomicOnDemandFailed(error, feature) {
643
+ return (async () => {
644
+ const root = new URL("../../../", import.meta.url);
645
+ const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
646
+ const key = `${root.href}#0.10.5`;
647
+ let release = releases.get(key);
648
+ if (release === undefined) {
649
+ const current = (async () => {
650
+ for (const path of ["modes/interactive/interactive-mode-deps.js","_shared/chunk-CDOYTDYM.js","_shared/p0-cli-GUFK7TPN.js"]) {
651
+ try {
652
+ const held = await import(new URL(path, root).href);
653
+ if (typeof held.VERSION === "string") return { version: held.VERSION, name: held.APP_NAME };
654
+ } catch {
655
+ // Not a file this process can load: the next.
656
+ }
657
+ }
658
+ return undefined;
659
+ })().then((found) => {
660
+ if (found === undefined && releases.get(key) === current) releases.delete(key);
661
+ return found;
662
+ });
663
+ releases.set(key, current);
664
+ release = current;
665
+ }
666
+ const running = await release;
667
+ let installed;
668
+ try {
669
+ const { readFile } = process.getBuiltinModule("node:fs/promises");
670
+ installed = JSON.parse(await readFile(new URL("../package.json", root), "utf8")).version;
671
+ } catch {
672
+ // No installation to read, as in a bundle of the package: the release the process runs decides.
673
+ }
674
+ const updatedTo = typeof installed === "string" && installed !== "0.10.5" ? installed : running !== undefined && running.version !== "0.10.5" ? "0.10.5" : undefined;
675
+ if (updatedTo === undefined) throw error;
676
+ const application = typeof running?.name === "string" ? running.name : "atomic";
677
+ const restart = new Error(`${application} was updated to ${updatedTo} while this session was running; restart it to keep using ${feature}.`, {
678
+ cause: error,
679
+ });
680
+ restart.name = "UpdatedInstallError";
681
+ restart[Symbol.for("atomic.on-demand-restart.v1")] = { application, updatedTo, feature };
682
+ throw restart;
683
+ })();
684
+ }