@bastani/atomic 0.9.38-alpha.5 → 0.9.38-alpha.7

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 (484) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/README.md +8 -6
  3. package/dist/builtin/intercom/CHANGELOG.md +9 -0
  4. package/dist/builtin/intercom/broker/broker.ts +6 -4
  5. package/dist/builtin/intercom/broker/delivered-message-cache.ts +50 -4
  6. package/dist/builtin/intercom/broker/send-handler.ts +6 -4
  7. package/dist/builtin/intercom/index.bundle.mjs +78 -33
  8. package/dist/builtin/intercom/package.json +2 -2
  9. package/dist/builtin/mcp/package.json +1 -1
  10. package/dist/builtin/subagents/CHANGELOG.md +6 -0
  11. package/dist/builtin/subagents/package.json +3 -3
  12. package/dist/builtin/subagents/src/extension/index.bundle.mjs +140 -145
  13. package/dist/builtin/web-access/CHANGELOG.md +7 -0
  14. package/dist/builtin/web-access/index.bundle.mjs +53 -15
  15. package/dist/builtin/web-access/package.json +2 -2
  16. package/dist/builtin/workflows/CHANGELOG.md +48 -0
  17. package/dist/builtin/workflows/builtin/{chunk-q7dx7kh7.js → chunk-85mx6wcf.js} +6 -6
  18. package/dist/builtin/workflows/builtin/{chunk-xg7kkgf8.js → chunk-8kkv04hz.js} +15 -15
  19. package/dist/builtin/workflows/builtin/{chunk-na3wpwzh.js → chunk-8x61e0s7.js} +396 -363
  20. package/dist/builtin/workflows/builtin/{chunk-qrrkfg9v.js → chunk-y45tkftg.js} +7 -7
  21. package/dist/builtin/workflows/builtin/goal.js +2 -2
  22. package/dist/builtin/workflows/builtin/index.js +4 -4
  23. package/dist/builtin/workflows/builtin/open-claude-design.js +1 -1
  24. package/dist/builtin/workflows/builtin/ralph.js +2 -2
  25. package/dist/builtin/workflows/package.json +2 -2
  26. package/dist/builtin/workflows/src/authoring.d.ts +3 -8
  27. package/dist/builtin/workflows/src/durable/journal/conformance.d.ts +9 -1
  28. package/dist/builtin/workflows/src/durable/journal/internal.d.ts +1 -0
  29. package/dist/builtin/workflows/src/durable/journal/lease-expiry.d.ts +2 -0
  30. package/dist/builtin/workflows/src/durable/journal/memory-run-journal.d.ts +9 -1
  31. package/dist/builtin/workflows/src/durable/journal/resolution.d.ts +19 -8
  32. package/dist/builtin/workflows/src/durable/journal/sql-run-journal.d.ts +45 -0
  33. package/dist/builtin/workflows/src/durable/journal/sqlite-run-journal.d.ts +5 -47
  34. package/dist/builtin/workflows/src/durable/journal/types.d.ts +9 -114
  35. package/dist/builtin/workflows/src/durable/journal/values.d.ts +2 -0
  36. package/dist/builtin/workflows/src/extension/index.bundle.mjs +6963 -6181
  37. package/dist/builtin/workflows/src/index.js +9078 -8395
  38. package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +8 -8
  39. package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +0 -14
  40. package/dist/cli/args.d.ts +3 -0
  41. package/dist/cli/args.d.ts.map +1 -1
  42. package/dist/cli/args.js +35 -5
  43. package/dist/cli/args.js.map +1 -1
  44. package/dist/cli/session-picker.d.ts +2 -2
  45. package/dist/cli/session-picker.d.ts.map +1 -1
  46. package/dist/cli/session-picker.js +5 -5
  47. package/dist/cli/session-picker.js.map +1 -1
  48. package/dist/core/agent-session-auto-compaction.d.ts +1 -1
  49. package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
  50. package/dist/core/agent-session-auto-compaction.js +2 -2
  51. package/dist/core/agent-session-auto-compaction.js.map +1 -1
  52. package/dist/core/agent-session-bash.d.ts +2 -3
  53. package/dist/core/agent-session-bash.d.ts.map +1 -1
  54. package/dist/core/agent-session-bash.js +18 -10
  55. package/dist/core/agent-session-bash.js.map +1 -1
  56. package/dist/core/agent-session-boundaries.d.ts +6 -6
  57. package/dist/core/agent-session-boundaries.d.ts.map +1 -1
  58. package/dist/core/agent-session-boundaries.js +22 -22
  59. package/dist/core/agent-session-boundaries.js.map +1 -1
  60. package/dist/core/agent-session-compaction.js +2 -2
  61. package/dist/core/agent-session-compaction.js.map +1 -1
  62. package/dist/core/agent-session-custom-message-commit.d.ts.map +1 -1
  63. package/dist/core/agent-session-custom-message-commit.js +10 -12
  64. package/dist/core/agent-session-custom-message-commit.js.map +1 -1
  65. package/dist/core/agent-session-events.d.ts.map +1 -1
  66. package/dist/core/agent-session-events.js +26 -14
  67. package/dist/core/agent-session-events.js.map +1 -1
  68. package/dist/core/agent-session-export.js +1 -1
  69. package/dist/core/agent-session-export.js.map +1 -1
  70. package/dist/core/agent-session-extension-bindings.d.ts +2 -2
  71. package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
  72. package/dist/core/agent-session-extension-bindings.js +75 -59
  73. package/dist/core/agent-session-extension-bindings.js.map +1 -1
  74. package/dist/core/agent-session-message-queue.d.ts +2 -2
  75. package/dist/core/agent-session-message-queue.d.ts.map +1 -1
  76. package/dist/core/agent-session-message-queue.js +17 -8
  77. package/dist/core/agent-session-message-queue.js.map +1 -1
  78. package/dist/core/agent-session-methods.d.ts +15 -15
  79. package/dist/core/agent-session-methods.d.ts.map +1 -1
  80. package/dist/core/agent-session-methods.js.map +1 -1
  81. package/dist/core/agent-session-models.d.ts +2 -2
  82. package/dist/core/agent-session-models.d.ts.map +1 -1
  83. package/dist/core/agent-session-models.js +59 -42
  84. package/dist/core/agent-session-models.js.map +1 -1
  85. package/dist/core/agent-session-persistent-custom-messages.d.ts +4 -4
  86. package/dist/core/agent-session-persistent-custom-messages.d.ts.map +1 -1
  87. package/dist/core/agent-session-persistent-custom-messages.js +16 -17
  88. package/dist/core/agent-session-persistent-custom-messages.js.map +1 -1
  89. package/dist/core/agent-session-prompt.d.ts.map +1 -1
  90. package/dist/core/agent-session-prompt.js +6 -8
  91. package/dist/core/agent-session-prompt.js.map +1 -1
  92. package/dist/core/agent-session-retry.d.ts.map +1 -1
  93. package/dist/core/agent-session-retry.js +17 -15
  94. package/dist/core/agent-session-retry.js.map +1 -1
  95. package/dist/core/agent-session-runtime.d.ts +7 -8
  96. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  97. package/dist/core/agent-session-runtime.js +88 -100
  98. package/dist/core/agent-session-runtime.js.map +1 -1
  99. package/dist/core/agent-session-services.d.ts +1 -1
  100. package/dist/core/agent-session-services.d.ts.map +1 -1
  101. package/dist/core/agent-session-services.js +2 -2
  102. package/dist/core/agent-session-services.js.map +1 -1
  103. package/dist/core/agent-session-summary.js +1 -1
  104. package/dist/core/agent-session-summary.js.map +1 -1
  105. package/dist/core/agent-session-tree.d.ts +1 -1
  106. package/dist/core/agent-session-tree.d.ts.map +1 -1
  107. package/dist/core/agent-session-tree.js +7 -7
  108. package/dist/core/agent-session-tree.js.map +1 -1
  109. package/dist/core/cache-warmer.js +1 -1
  110. package/dist/core/cache-warmer.js.map +1 -1
  111. package/dist/core/compaction/branch-summarization.d.ts +1 -4
  112. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  113. package/dist/core/compaction/branch-summarization.js +0 -4
  114. package/dist/core/compaction/branch-summarization.js.map +1 -1
  115. package/dist/core/compaction/pi-summary-fallback.d.ts.map +1 -1
  116. package/dist/core/compaction/pi-summary-fallback.js +1 -3
  117. package/dist/core/compaction/pi-summary-fallback.js.map +1 -1
  118. package/dist/core/export-html/index.js +1 -1
  119. package/dist/core/export-html/index.js.map +1 -1
  120. package/dist/core/export-html/template-js/entries-navigation.js +1 -1
  121. package/dist/core/export-html/template.js +1 -1
  122. package/dist/core/extensions/api-types.d.ts +12 -12
  123. package/dist/core/extensions/api-types.d.ts.map +1 -1
  124. package/dist/core/extensions/api-types.js.map +1 -1
  125. package/dist/core/extensions/context-types.d.ts +4 -2
  126. package/dist/core/extensions/context-types.d.ts.map +1 -1
  127. package/dist/core/extensions/context-types.js.map +1 -1
  128. package/dist/core/extensions/extension-work.d.ts +1 -0
  129. package/dist/core/extensions/extension-work.d.ts.map +1 -1
  130. package/dist/core/extensions/extension-work.js +5 -1
  131. package/dist/core/extensions/extension-work.js.map +1 -1
  132. package/dist/core/extensions/loader-api.d.ts.map +1 -1
  133. package/dist/core/extensions/loader-api.js +40 -42
  134. package/dist/core/extensions/loader-api.js.map +1 -1
  135. package/dist/core/extensions/loader-host-modules.d.ts +1 -1
  136. package/dist/core/extensions/loader-host-modules.d.ts.map +1 -1
  137. package/dist/core/extensions/loader-host-modules.js +6 -2
  138. package/dist/core/extensions/loader-host-modules.js.map +1 -1
  139. package/dist/core/extensions/loader-rollback.d.ts.map +1 -1
  140. package/dist/core/extensions/loader-rollback.js +1 -0
  141. package/dist/core/extensions/loader-rollback.js.map +1 -1
  142. package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
  143. package/dist/core/extensions/loader-virtual-modules.js +1 -0
  144. package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
  145. package/dist/core/extensions/runner-context.d.ts +1 -0
  146. package/dist/core/extensions/runner-context.d.ts.map +1 -1
  147. package/dist/core/extensions/runner-context.js +10 -3
  148. package/dist/core/extensions/runner-context.js.map +1 -1
  149. package/dist/core/extensions/runner-handlers.d.ts +1 -1
  150. package/dist/core/extensions/runner-handlers.d.ts.map +1 -1
  151. package/dist/core/extensions/runner-handlers.js.map +1 -1
  152. package/dist/core/extensions/runner.d.ts +3 -2
  153. package/dist/core/extensions/runner.d.ts.map +1 -1
  154. package/dist/core/extensions/runner.js +20 -12
  155. package/dist/core/extensions/runner.js.map +1 -1
  156. package/dist/core/extensions/runtime-types.d.ts +7 -7
  157. package/dist/core/extensions/runtime-types.d.ts.map +1 -1
  158. package/dist/core/extensions/runtime-types.js.map +1 -1
  159. package/dist/core/extensions/session-events.d.ts +5 -5
  160. package/dist/core/extensions/session-events.d.ts.map +1 -1
  161. package/dist/core/extensions/session-events.js.map +1 -1
  162. package/dist/core/fast-model-routing.d.ts.map +1 -1
  163. package/dist/core/fast-model-routing.js +1 -0
  164. package/dist/core/fast-model-routing.js.map +1 -1
  165. package/dist/core/intercom-runtime-group.js +1 -1
  166. package/dist/core/intercom-runtime-group.js.map +1 -1
  167. package/dist/core/model-config.d.ts +765 -0
  168. package/dist/core/model-config.d.ts.map +1 -1
  169. package/dist/core/model-config.js +46 -24
  170. package/dist/core/model-config.js.map +1 -1
  171. package/dist/core/model-resolver-defaults.js +1 -1
  172. package/dist/core/model-resolver-defaults.js.map +1 -1
  173. package/dist/core/provider-attribution.js +1 -1
  174. package/dist/core/provider-attribution.js.map +1 -1
  175. package/dist/core/resource-loader-reload.js +1 -1
  176. package/dist/core/resource-loader-reload.js.map +1 -1
  177. package/dist/core/resource-loader-types.d.ts +1 -1
  178. package/dist/core/resource-loader-types.d.ts.map +1 -1
  179. package/dist/core/resource-loader-types.js.map +1 -1
  180. package/dist/core/sdk-types.d.ts +4 -0
  181. package/dist/core/sdk-types.d.ts.map +1 -1
  182. package/dist/core/sdk-types.js.map +1 -1
  183. package/dist/core/sdk.d.ts +1 -1
  184. package/dist/core/sdk.d.ts.map +1 -1
  185. package/dist/core/sdk.js +50 -20
  186. package/dist/core/sdk.js.map +1 -1
  187. package/dist/core/session-lifecycle-work.d.ts +3 -0
  188. package/dist/core/session-lifecycle-work.d.ts.map +1 -1
  189. package/dist/core/session-lifecycle-work.js +2 -0
  190. package/dist/core/session-lifecycle-work.js.map +1 -1
  191. package/dist/core/session-manager-archive.d.ts +2 -16
  192. package/dist/core/session-manager-archive.d.ts.map +1 -1
  193. package/dist/core/session-manager-archive.js +8 -104
  194. package/dist/core/session-manager-archive.js.map +1 -1
  195. package/dist/core/session-manager-core.d.ts +53 -51
  196. package/dist/core/session-manager-core.d.ts.map +1 -1
  197. package/dist/core/session-manager-core.js +547 -307
  198. package/dist/core/session-manager-core.js.map +1 -1
  199. package/dist/core/session-manager-entries.d.ts.map +1 -1
  200. package/dist/core/session-manager-entries.js +5 -10
  201. package/dist/core/session-manager-entries.js.map +1 -1
  202. package/dist/core/session-manager-errors.d.ts +10 -0
  203. package/dist/core/session-manager-errors.d.ts.map +1 -0
  204. package/dist/core/session-manager-errors.js +27 -0
  205. package/dist/core/session-manager-errors.js.map +1 -0
  206. package/dist/core/session-manager-list.d.ts +1 -0
  207. package/dist/core/session-manager-list.d.ts.map +1 -1
  208. package/dist/core/session-manager-list.js +21 -14
  209. package/dist/core/session-manager-list.js.map +1 -1
  210. package/dist/core/session-manager-storage.d.ts +3 -13
  211. package/dist/core/session-manager-storage.d.ts.map +1 -1
  212. package/dist/core/session-manager-storage.js +28 -69
  213. package/dist/core/session-manager-storage.js.map +1 -1
  214. package/dist/core/session-manager-types.d.ts +3 -11
  215. package/dist/core/session-manager-types.d.ts.map +1 -1
  216. package/dist/core/session-manager-types.js.map +1 -1
  217. package/dist/core/session-manager-validation.d.ts.map +1 -1
  218. package/dist/core/session-manager-validation.js +3 -2
  219. package/dist/core/session-manager-validation.js.map +1 -1
  220. package/dist/core/session-manager.d.ts +2 -1
  221. package/dist/core/session-manager.d.ts.map +1 -1
  222. package/dist/core/session-manager.js +2 -1
  223. package/dist/core/session-manager.js.map +1 -1
  224. package/dist/core/session-mutation-queue.d.ts +3 -0
  225. package/dist/core/session-mutation-queue.d.ts.map +1 -0
  226. package/dist/core/session-mutation-queue.js +14 -0
  227. package/dist/core/session-mutation-queue.js.map +1 -0
  228. package/dist/core/session-resume-args.d.ts +4 -0
  229. package/dist/core/session-resume-args.d.ts.map +1 -0
  230. package/dist/core/session-resume-args.js +9 -0
  231. package/dist/core/session-resume-args.js.map +1 -0
  232. package/dist/core/session-storage.d.ts +26 -0
  233. package/dist/core/session-storage.d.ts.map +1 -0
  234. package/dist/core/session-storage.js +155 -0
  235. package/dist/core/session-storage.js.map +1 -0
  236. package/dist/core/session-store-list.d.ts +4 -0
  237. package/dist/core/session-store-list.d.ts.map +1 -0
  238. package/dist/core/session-store-list.js +28 -0
  239. package/dist/core/session-store-list.js.map +1 -0
  240. package/dist/core/settings-manager-basic-accessors.d.ts +0 -1
  241. package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
  242. package/dist/core/settings-manager-basic-accessors.js +0 -5
  243. package/dist/core/settings-manager-basic-accessors.js.map +1 -1
  244. package/dist/core/settings-merge.d.ts.map +1 -1
  245. package/dist/core/settings-merge.js +8 -2
  246. package/dist/core/settings-merge.js.map +1 -1
  247. package/dist/core/settings-schema.d.ts +74 -8
  248. package/dist/core/settings-schema.d.ts.map +1 -1
  249. package/dist/core/settings-schema.js +29 -29
  250. package/dist/core/settings-schema.js.map +1 -1
  251. package/dist/core/storage/errors.d.ts +1 -0
  252. package/dist/core/storage/errors.d.ts.map +1 -1
  253. package/dist/core/storage/errors.js.map +1 -1
  254. package/dist/core/storage/index.d.ts +5 -1
  255. package/dist/core/storage/index.d.ts.map +1 -1
  256. package/dist/core/storage/index.js +4 -1
  257. package/dist/core/storage/index.js.map +1 -1
  258. package/dist/core/storage/node-sqlite.d.ts +2 -0
  259. package/dist/core/storage/node-sqlite.d.ts.map +1 -1
  260. package/dist/core/storage/node-sqlite.js +47 -6
  261. package/dist/core/storage/node-sqlite.js.map +1 -1
  262. package/dist/core/storage/provider.d.ts +58 -0
  263. package/dist/core/storage/provider.d.ts.map +1 -0
  264. package/dist/core/storage/provider.js +243 -0
  265. package/dist/core/storage/provider.js.map +1 -0
  266. package/dist/core/storage/run-journal.d.ts +93 -0
  267. package/dist/core/storage/run-journal.d.ts.map +1 -0
  268. package/dist/core/storage/run-journal.js +15 -0
  269. package/dist/core/storage/run-journal.js.map +1 -0
  270. package/dist/core/storage/selection.d.ts +16 -0
  271. package/dist/core/storage/selection.d.ts.map +1 -0
  272. package/dist/core/storage/selection.js +87 -0
  273. package/dist/core/storage/selection.js.map +1 -0
  274. package/dist/core/storage/session/jsonl-session-store.d.ts +11 -2
  275. package/dist/core/storage/session/jsonl-session-store.d.ts.map +1 -1
  276. package/dist/core/storage/session/jsonl-session-store.js +127 -54
  277. package/dist/core/storage/session/jsonl-session-store.js.map +1 -1
  278. package/dist/core/storage/session/legacy-format.d.ts +18 -0
  279. package/dist/core/storage/session/legacy-format.d.ts.map +1 -0
  280. package/dist/core/storage/session/legacy-format.js +63 -0
  281. package/dist/core/storage/session/legacy-format.js.map +1 -0
  282. package/dist/core/storage/session/memory-session-store.d.ts +3 -1
  283. package/dist/core/storage/session/memory-session-store.d.ts.map +1 -1
  284. package/dist/core/storage/session/memory-session-store.js +9 -2
  285. package/dist/core/storage/session/memory-session-store.js.map +1 -1
  286. package/dist/core/storage/session/sql-session-store.d.ts +4 -1
  287. package/dist/core/storage/session/sql-session-store.d.ts.map +1 -1
  288. package/dist/core/storage/session/sql-session-store.js +25 -6
  289. package/dist/core/storage/session/sql-session-store.js.map +1 -1
  290. package/dist/core/storage/session/types.d.ts +4 -0
  291. package/dist/core/storage/session/types.d.ts.map +1 -1
  292. package/dist/core/storage/session/types.js.map +1 -1
  293. package/dist/core/storage/session/validation.js +1 -1
  294. package/dist/core/storage/session/validation.js.map +1 -1
  295. package/dist/core/storage/testing.d.ts +2 -0
  296. package/dist/core/storage/testing.d.ts.map +1 -1
  297. package/dist/core/storage/testing.js +45 -0
  298. package/dist/core/storage/testing.js.map +1 -1
  299. package/dist/core/tasks/completion.d.ts.map +1 -1
  300. package/dist/core/tasks/completion.js +2 -4
  301. package/dist/core/tasks/completion.js.map +1 -1
  302. package/dist/core/tools/bash-session-environment.d.ts.map +1 -1
  303. package/dist/core/tools/bash-session-environment.js +0 -2
  304. package/dist/core/tools/bash-session-environment.js.map +1 -1
  305. package/dist/core/tools/read-url.d.ts.map +1 -1
  306. package/dist/core/tools/read-url.js +6 -1
  307. package/dist/core/tools/read-url.js.map +1 -1
  308. package/dist/core/tools/todos-model.js +3 -3
  309. package/dist/core/tools/todos-model.js.map +1 -1
  310. package/dist/core/tools/todos-mutations.js +2 -2
  311. package/dist/core/tools/todos-mutations.js.map +1 -1
  312. package/dist/core/tools/todos-render.js +1 -1
  313. package/dist/core/tools/todos-render.js.map +1 -1
  314. package/dist/core/tools/todos-storage.js +2 -2
  315. package/dist/core/tools/todos-storage.js.map +1 -1
  316. package/dist/extensions/codemode/execute.d.ts.map +1 -1
  317. package/dist/extensions/codemode/execute.js +14 -1
  318. package/dist/extensions/codemode/execute.js.map +1 -1
  319. package/dist/extensions/codemode/tool.d.ts +1 -1
  320. package/dist/extensions/codemode/tool.d.ts.map +1 -1
  321. package/dist/extensions/codemode/tool.js.map +1 -1
  322. package/dist/extensions/herdr/index.d.ts.map +1 -1
  323. package/dist/extensions/herdr/index.js +6 -8
  324. package/dist/extensions/herdr/index.js.map +1 -1
  325. package/dist/extensions/mcp/index.js +1 -1
  326. package/dist/extensions/mcp/index.js.map +1 -1
  327. package/dist/extensions/mcp/tools.d.ts.map +1 -1
  328. package/dist/extensions/mcp/tools.js +6 -1
  329. package/dist/extensions/mcp/tools.js.map +1 -1
  330. package/dist/index.d.ts +3 -1
  331. package/dist/index.d.ts.map +1 -1
  332. package/dist/index.js +3 -1
  333. package/dist/index.js.map +1 -1
  334. package/dist/main-session.d.ts +12 -2
  335. package/dist/main-session.d.ts.map +1 -1
  336. package/dist/main-session.js +148 -53
  337. package/dist/main-session.js.map +1 -1
  338. package/dist/main.d.ts.map +1 -1
  339. package/dist/main.js +97 -42
  340. package/dist/main.js.map +1 -1
  341. package/dist/modes/interactive/components/chat-session-host.d.ts +3 -1
  342. package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
  343. package/dist/modes/interactive/components/chat-session-host.js +16 -7
  344. package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
  345. package/dist/modes/interactive/components/extension-input.d.ts +1 -1
  346. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
  347. package/dist/modes/interactive/components/extension-input.js +2 -2
  348. package/dist/modes/interactive/components/extension-input.js.map +1 -1
  349. package/dist/modes/interactive/components/host-session-picker.js +1 -1
  350. package/dist/modes/interactive/components/host-session-picker.js.map +1 -1
  351. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  352. package/dist/modes/interactive/components/scoped-models-selector.js +4 -1
  353. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  354. package/dist/modes/interactive/components/session-selector-delete.d.ts +1 -1
  355. package/dist/modes/interactive/components/session-selector-delete.d.ts.map +1 -1
  356. package/dist/modes/interactive/components/session-selector-delete.js.map +1 -1
  357. package/dist/modes/interactive/components/session-selector-list.d.ts +12 -9
  358. package/dist/modes/interactive/components/session-selector-list.d.ts.map +1 -1
  359. package/dist/modes/interactive/components/session-selector-list.js +27 -25
  360. package/dist/modes/interactive/components/session-selector-list.js.map +1 -1
  361. package/dist/modes/interactive/components/session-selector.d.ts +8 -4
  362. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  363. package/dist/modes/interactive/components/session-selector.js +27 -18
  364. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  365. package/dist/modes/interactive/components/tree-selector-component.d.ts +5 -1
  366. package/dist/modes/interactive/components/tree-selector-component.d.ts.map +1 -1
  367. package/dist/modes/interactive/components/tree-selector-component.js +20 -3
  368. package/dist/modes/interactive/components/tree-selector-component.js.map +1 -1
  369. package/dist/modes/interactive/interactive-bash-compact.js +1 -1
  370. package/dist/modes/interactive/interactive-bash-compact.js.map +1 -1
  371. package/dist/modes/interactive/interactive-deferred-startup.js +2 -2
  372. package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
  373. package/dist/modes/interactive/interactive-editor-actions.js +2 -2
  374. package/dist/modes/interactive/interactive-editor-actions.js.map +1 -1
  375. package/dist/modes/interactive/interactive-extension-runtime.js +2 -0
  376. package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
  377. package/dist/modes/interactive/interactive-input-handling.js +6 -4
  378. package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
  379. package/dist/modes/interactive/interactive-mode-helpers.d.ts.map +1 -1
  380. package/dist/modes/interactive/interactive-mode-helpers.js +7 -3
  381. package/dist/modes/interactive/interactive-mode-helpers.js.map +1 -1
  382. package/dist/modes/interactive/interactive-mode-surface.d.ts +5 -5
  383. package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
  384. package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
  385. package/dist/modes/interactive/interactive-model-routing.js +12 -7
  386. package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
  387. package/dist/modes/interactive/interactive-selectors.js +2 -2
  388. package/dist/modes/interactive/interactive-selectors.js.map +1 -1
  389. package/dist/modes/interactive/interactive-session-routing.js +38 -14
  390. package/dist/modes/interactive/interactive-session-routing.js.map +1 -1
  391. package/dist/modes/interactive/interactive-slash-commands.js +5 -3
  392. package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
  393. package/dist/modes/interactive-engine/create-isolated-runtime.d.ts.map +1 -1
  394. package/dist/modes/interactive-engine/create-isolated-runtime.js +8 -1
  395. package/dist/modes/interactive-engine/create-isolated-runtime.js.map +1 -1
  396. package/dist/modes/interactive-engine/engine-args.d.ts.map +1 -1
  397. package/dist/modes/interactive-engine/engine-args.js +11 -4
  398. package/dist/modes/interactive-engine/engine-args.js.map +1 -1
  399. package/dist/modes/interactive-engine/isolated-runtime.d.ts +1 -1
  400. package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
  401. package/dist/modes/interactive-engine/isolated-runtime.js +99 -74
  402. package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
  403. package/dist/modes/rpc/rpc-bash-request-owners.js +1 -1
  404. package/dist/modes/rpc/rpc-bash-request-owners.js.map +1 -1
  405. package/dist/modes/rpc/rpc-client-api.d.ts +1 -1
  406. package/dist/modes/rpc/rpc-client-api.d.ts.map +1 -1
  407. package/dist/modes/rpc/rpc-client-api.js +2 -2
  408. package/dist/modes/rpc/rpc-client-api.js.map +1 -1
  409. package/dist/modes/rpc/rpc-client-process.d.ts +2 -2
  410. package/dist/modes/rpc/rpc-client-process.d.ts.map +1 -1
  411. package/dist/modes/rpc/rpc-client-process.js +20 -7
  412. package/dist/modes/rpc/rpc-client-process.js.map +1 -1
  413. package/dist/modes/rpc/rpc-client.d.ts +4 -1
  414. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  415. package/dist/modes/rpc/rpc-client.js +6 -2
  416. package/dist/modes/rpc/rpc-client.js.map +1 -1
  417. package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
  418. package/dist/modes/rpc/rpc-command-handler.js +12 -9
  419. package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
  420. package/dist/modes/rpc/rpc-provider-auth.js +2 -2
  421. package/dist/modes/rpc/rpc-provider-auth.js.map +1 -1
  422. package/dist/modes/rpc/rpc-terminal-drain.d.ts.map +1 -1
  423. package/dist/modes/rpc/rpc-terminal-drain.js +11 -2
  424. package/dist/modes/rpc/rpc-terminal-drain.js.map +1 -1
  425. package/dist/modes/rpc/rpc-types.d.ts +6 -2
  426. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  427. package/dist/modes/rpc/rpc-types.js.map +1 -1
  428. package/dist/utils/canonical-path.d.ts +5 -0
  429. package/dist/utils/canonical-path.d.ts.map +1 -0
  430. package/dist/utils/canonical-path.js +26 -0
  431. package/dist/utils/canonical-path.js.map +1 -0
  432. package/dist/utils/paths.d.ts +1 -7
  433. package/dist/utils/paths.d.ts.map +1 -1
  434. package/dist/utils/paths.js +1 -15
  435. package/dist/utils/paths.js.map +1 -1
  436. package/docs/codemode.md +2 -0
  437. package/docs/compaction.md +2 -2
  438. package/docs/custom-provider/oauth.md +2 -2
  439. package/docs/custom-provider/override.md +3 -3
  440. package/docs/custom-provider/registration.md +7 -7
  441. package/docs/custom-provider/streaming.md +1 -1
  442. package/docs/custom-provider.md +5 -5
  443. package/docs/docs.json +1 -0
  444. package/docs/environment-variables.md +10 -2
  445. package/docs/extensions/api-reference.md +40 -19
  446. package/docs/extensions/authoring.md +1 -1
  447. package/docs/extensions/events.md +8 -8
  448. package/docs/extensions.md +2 -2
  449. package/docs/getting-started/installation.md +1 -2
  450. package/docs/models/reference.md +2 -0
  451. package/docs/models-configuration.md +206 -0
  452. package/docs/models.md +11 -1
  453. package/docs/providers.md +4 -4
  454. package/docs/quickstart.md +2 -1
  455. package/docs/reference/cli.md +7 -3
  456. package/docs/rpc/protocol.md +10 -4
  457. package/docs/sdk/reference.md +15 -13
  458. package/docs/sdk/web-server.md +5 -6
  459. package/docs/sdk.md +56 -2
  460. package/docs/session-format.md +35 -28
  461. package/docs/sessions.md +50 -17
  462. package/docs/settings.md +44 -7
  463. package/docs/storage.md +346 -2
  464. package/docs/usage.md +3 -2
  465. package/docs/workflows/api-reference.md +80 -16
  466. package/docs/workflows/operations.md +6 -4
  467. package/docs/workflows/reliable-design.md +16 -16
  468. package/examples/extensions/bookmark.ts +2 -2
  469. package/examples/extensions/handoff.ts +2 -2
  470. package/examples/extensions/plan-mode/index.ts +15 -13
  471. package/examples/extensions/preset.ts +8 -8
  472. package/examples/extensions/session-name.ts +1 -1
  473. package/examples/extensions/snake.ts +3 -1
  474. package/examples/extensions/space-invaders.ts +3 -1
  475. package/examples/extensions/tic-tac-toe.ts +80 -80
  476. package/examples/sdk/11-sessions.ts +5 -5
  477. package/examples/sdk/13-session-runtime.ts +7 -7
  478. package/examples/sdk/README.md +1 -1
  479. package/npm-shrinkwrap.json +53 -53
  480. package/package.json +7 -6
  481. package/schemas/models.schema.json +62 -29
  482. package/schemas/settings.schema.json +137 -53
  483. package/dist/builtin/workflows/builtin/chunk-h5fn47y5.js +0 -8
  484. package/dist/builtin/workflows/src/durable/journal/node-sqlite.d.ts +0 -20
@@ -6944,7 +6944,7 @@ var require_public_api = __commonJS(function(exports) {
6944
6944
  });
6945
6945
 
6946
6946
  // dist/builtin/subagents/src/extension/index.ts
6947
- import * as fs22 from "node:fs";
6947
+ import * as fs21 from "node:fs";
6948
6948
  import * as os8 from "node:os";
6949
6949
  import * as path23 from "node:path";
6950
6950
  import {
@@ -10594,21 +10594,12 @@ function createTestSession(sessionManager, spec) {
10594
10594
  let aborted = false;
10595
10595
  let settlePromptAbort;
10596
10596
  const messages = [];
10597
- const promptAbort = new Promise((resolve, reject) => {
10598
- settlePromptAbort = () => {
10599
- if (testOptions.abortResolvesPrompt)
10600
- resolve("aborted");
10601
- else
10602
- reject(new Error("aborted"));
10603
- };
10604
- });
10605
10597
  let userMessages = 0;
10606
10598
  let assistantMessages = 0;
10607
10599
  const zeroTokens = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 };
10608
10600
  const zeroCost = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 };
10609
- const appendAssistant = (content, stopReason) => {
10610
- messages.push({ role: "assistant", content, stopReason });
10611
- sessionManager.appendMessage({
10601
+ const appendAssistant = async (content, stopReason) => {
10602
+ await sessionManager.appendMessage({
10612
10603
  role: "assistant",
10613
10604
  content,
10614
10605
  api: "openai-responses",
@@ -10625,6 +10616,7 @@ function createTestSession(sessionManager, spec) {
10625
10616
  stopReason,
10626
10617
  timestamp: Date.now()
10627
10618
  });
10619
+ messages.push({ role: "assistant", content, stopReason });
10628
10620
  assistantMessages += 1;
10629
10621
  };
10630
10622
  return {
@@ -10674,11 +10666,11 @@ function createTestSession(sessionManager, spec) {
10674
10666
  appendFileSync2(testOptions.promptLogPath, `${text}
10675
10667
  ---PROMPT---
10676
10668
  `, "utf8");
10677
- sessionManager.appendMessage({ role: "user", content: text, timestamp: Date.now() });
10669
+ await sessionManager.appendMessage({ role: "user", content: text, timestamp: Date.now() });
10678
10670
  userMessages += 1;
10679
10671
  if (testOptions.seededAssistantText) {
10680
10672
  lastAssistantText = testOptions.seededAssistantText;
10681
- appendAssistant([{ type: "text", text: lastAssistantText }], "stop");
10673
+ await appendAssistant([{ type: "text", text: lastAssistantText }], "stop");
10682
10674
  }
10683
10675
  if (testOptions.fallbackBeforeGate)
10684
10676
  emitFallback();
@@ -10688,12 +10680,21 @@ function createTestSession(sessionManager, spec) {
10688
10680
  if (testOptions.promptGate) {
10689
10681
  const gateResult = await Promise.race([
10690
10682
  testOptions.promptGate.then(() => "released"),
10691
- promptAbort
10683
+ new Promise((resolve, reject) => {
10684
+ settlePromptAbort = () => {
10685
+ if (testOptions.abortResolvesPrompt)
10686
+ resolve("aborted");
10687
+ else
10688
+ reject(new DOMException("aborted", "AbortError"));
10689
+ };
10690
+ if (aborted)
10691
+ settlePromptAbort();
10692
+ })
10692
10693
  ]);
10693
10694
  if (gateResult === "aborted") {
10694
10695
  if (testOptions.thinkingOnlyOnAbort) {
10695
10696
  lastAssistantText = "";
10696
- appendAssistant([{ type: "thinking", thinking: "aborted mid-thought" }], "aborted");
10697
+ await appendAssistant([{ type: "thinking", thinking: "aborted mid-thought" }], "aborted");
10697
10698
  }
10698
10699
  for (const event of testOptions.events ?? [])
10699
10700
  for (const listener of listeners)
@@ -10708,7 +10709,7 @@ function createTestSession(sessionManager, spec) {
10708
10709
  if (!testOptions.fallbackBeforeGate)
10709
10710
  emitFallback();
10710
10711
  lastAssistantText = testOptions.output ?? "done";
10711
- appendAssistant([{ type: "text", text: lastAssistantText }], "stop");
10712
+ await appendAssistant([{ type: "text", text: lastAssistantText }], "stop");
10712
10713
  return lastAssistantText;
10713
10714
  },
10714
10715
  getLastAssistantText: () => {
@@ -10780,7 +10781,7 @@ function cancelledEnvelope(session, spec, stats) {
10780
10781
  progressPath: spec.progressPath,
10781
10782
  assistantText: lastNonEmptyAssistantText(session?.messages, outputFor(session)),
10782
10783
  toolCount: stats.toolCalls,
10783
- sessionPath: session?.sessionFile ?? spec.sessionFile,
10784
+ sessionPath: session?.sessionFile ?? spec.sessionManager?.getSessionFile(),
10784
10785
  ...spec.progressArtifactPath ? { progressArtifactPath: spec.progressArtifactPath } : {},
10785
10786
  ...spec.outputArtifactPath ? { outputArtifactPath: spec.outputArtifactPath } : {}
10786
10787
  }).text;
@@ -10873,14 +10874,14 @@ class AdmittedChild {
10873
10874
  spec;
10874
10875
  policy;
10875
10876
  sessionDir;
10876
- sessionFile;
10877
+ sessionManager;
10877
10878
  control;
10878
10879
  constructor(input) {
10879
10880
  this.identity = input.identity;
10880
10881
  this.spec = input.spec;
10881
10882
  this.policy = input.policy;
10882
10883
  this.sessionDir = input.sessionDir;
10883
- this.sessionFile = input.sessionFile;
10884
+ this.sessionManager = input.sessionManager;
10884
10885
  this.control = input.control;
10885
10886
  }
10886
10887
  static create(input) {
@@ -10925,7 +10926,7 @@ class SubagentControlRuntime {
10925
10926
  return refusal(native);
10926
10927
  const identity = native.child;
10927
10928
  const childModePolicy = resolveChildModePolicy(spec);
10928
- const sessionDir = spec.sessionFile ? dirname7(spec.sessionFile) : sessionDirectory(this.sessionRoot, identity.path);
10929
+ const sessionDir = spec.sessionManager?.getSessionDir() || sessionDirectory(this.sessionRoot, identity.path);
10929
10930
  mkdirSync4(sessionDir, { recursive: true });
10930
10931
  return {
10931
10932
  admitted: AdmittedChild.create({
@@ -10946,7 +10947,7 @@ class SubagentControlRuntime {
10946
10947
  depth: identity.depth
10947
10948
  },
10948
10949
  sessionDir,
10949
- sessionFile: spec.sessionFile,
10950
+ sessionManager: spec.sessionManager,
10950
10951
  control: this
10951
10952
  })
10952
10953
  };
@@ -11026,7 +11027,6 @@ class SubagentControlRuntime {
11026
11027
  this.attemptTokens.set(admitted.identity.path, token);
11027
11028
  let session;
11028
11029
  const executionEnded = new AbortController;
11029
- let activeSessionManager;
11030
11030
  let termination;
11031
11031
  let terminating;
11032
11032
  let terminationWasKill = false;
@@ -11044,7 +11044,6 @@ class SubagentControlRuntime {
11044
11044
  termination = cause;
11045
11045
  terminating = (async () => {
11046
11046
  try {
11047
- activeSessionManager?.flush();
11048
11047
  await session?.abort();
11049
11048
  } finally {
11050
11049
  try {
@@ -11063,13 +11062,10 @@ class SubagentControlRuntime {
11063
11062
  });
11064
11063
  try {
11065
11064
  const workflow = workflowMetadataFromContext(admitted.spec.parent?.orchestrationContext);
11066
- if (admitted.sessionFile)
11067
- mkdirSync4(dirname7(admitted.sessionFile), { recursive: true });
11068
- const sessionManager = admitted.sessionFile ? SessionManager.open(admitted.sessionFile, admitted.sessionDir, admitted.policy.cwd) : SessionManager.create(admitted.policy.cwd, admitted.sessionDir, workflow ? { internal: true, workflow } : { internal: true });
11069
- activeSessionManager = sessionManager;
11065
+ const sessionManager = admitted.sessionManager ? await SessionManager.open(admitted.sessionManager.getSessionStore(), admitted.sessionManager.getSessionId(), admitted.policy.cwd) : await SessionManager.create(admitted.policy.cwd, admitted.sessionDir, workflow ? { internal: true, workflow } : { internal: true });
11070
11066
  taskHooks?.bindTranscript?.(sessionManager);
11071
11067
  if (workflow)
11072
- sessionManager.markSessionInternal(workflow);
11068
+ await sessionManager.markSessionInternal(workflow);
11073
11069
  let created;
11074
11070
  if (admitted.spec.testSession) {
11075
11071
  created = { session: createTestSession(sessionManager, admitted.spec) };
@@ -11249,7 +11245,8 @@ class SubagentControlRuntime {
11249
11245
  await terminate("abort");
11250
11246
  if (signals.interrupt.aborted)
11251
11247
  await terminate("interrupt");
11252
- await session.prompt(admitted.spec.task);
11248
+ if (!termination)
11249
+ await session.prompt(admitted.spec.task);
11253
11250
  await terminating;
11254
11251
  const stats = statsFor(session, admitted.identity.path);
11255
11252
  const sessionFile = session.sessionFile;
@@ -11336,9 +11333,6 @@ class SubagentControlRuntime {
11336
11333
  try {
11337
11334
  unsubscribe?.();
11338
11335
  } catch {}
11339
- try {
11340
- activeSessionManager?.flush();
11341
- } catch {}
11342
11336
  if (onCleanup) {
11343
11337
  onCleanup((async () => {
11344
11338
  try {
@@ -12526,7 +12520,7 @@ function createExecutionBurstDispatcher(input) {
12526
12520
 
12527
12521
  // dist/builtin/subagents/src/runs/foreground/subagent-executor-context.ts
12528
12522
  import { randomUUID as randomUUID2 } from "node:crypto";
12529
- import * as fs13 from "node:fs";
12523
+ import * as fs12 from "node:fs";
12530
12524
  import * as path13 from "node:path";
12531
12525
 
12532
12526
  // dist/builtin/subagents/src/agents/agent-scope.ts
@@ -12537,67 +12531,71 @@ function resolveExecutionAgentScope(scope) {
12537
12531
  }
12538
12532
 
12539
12533
  // dist/builtin/subagents/src/shared/fork-context.ts
12540
- import * as fs11 from "node:fs";
12541
12534
  import { SessionManager as SessionManager2 } from "@bastani/atomic";
12535
+
12536
+ class SubagentForkContextError extends Error {
12537
+ parentSessionId;
12538
+ reason;
12539
+ constructor(parentSessionId, reason, options) {
12540
+ super(`Cannot fork subagent session ${JSON.stringify(parentSessionId)}: ${reason}`, options);
12541
+ this.parentSessionId = parentSessionId;
12542
+ this.reason = reason;
12543
+ this.name = "SubagentForkContextError";
12544
+ }
12545
+ }
12542
12546
  function resolveSubagentContext(value) {
12543
12547
  return value === "fork" ? "fork" : "fresh";
12544
12548
  }
12545
- function createForkContextResolver(sessionManager, requestedContext, options = {}) {
12549
+ function createForkContextResolver(sessionManager, requestedContext) {
12546
12550
  if (resolveSubagentContext(requestedContext) !== "fork") {
12547
- return {
12548
- sessionFileForIndex: () => {
12549
- return;
12550
- }
12551
- };
12552
- }
12553
- const parentSessionFile = sessionManager.getSessionFile();
12554
- if (!parentSessionFile) {
12555
- throw new Error("Forked subagent context requires a persisted parent session.");
12551
+ return { sessionManagerForIndex: async () => {
12552
+ return;
12553
+ } };
12556
12554
  }
12555
+ const parentSessionId = sessionManager.getSessionId();
12556
+ const store = sessionManager.getSessionStore();
12557
+ const cwd = sessionManager.getCwd();
12557
12558
  const leafId = sessionManager.getLeafId();
12558
- if (!leafId) {
12559
- throw new Error("Forked subagent context requires a current leaf to fork from.");
12560
- }
12561
- const openSession = options.openSession ?? sessionManager.openSession ?? ((file, dir) => SessionManager2.open(file, dir));
12562
- const sessionDir = sessionManager.getSessionDir?.();
12563
- const cachedSessionFiles = new Map;
12559
+ if (leafId === null)
12560
+ throw new SubagentForkContextError(parentSessionId, "no_leaf");
12561
+ const children = new Map;
12564
12562
  return {
12565
- sessionFileForIndex(index = 0) {
12566
- const cached = cachedSessionFiles.get(index);
12567
- if (cached)
12563
+ sessionManagerForIndex(index = 0) {
12564
+ const cached = children.get(index);
12565
+ if (cached !== undefined)
12568
12566
  return cached;
12569
- try {
12570
- if (!fs11.existsSync(parentSessionFile)) {
12571
- throw new Error(`Parent session file does not exist: ${parentSessionFile}. Pi has not persisted enough history to fork yet.`);
12572
- }
12573
- const sourceManager = openSession(parentSessionFile, sessionDir);
12574
- const sessionFile = sourceManager.createBranchedSession(leafId);
12575
- if (!sessionFile) {
12576
- throw new Error("Session manager did not return a forked session file.");
12577
- }
12578
- if (!fs11.existsSync(sessionFile)) {
12579
- throw new Error(`Session manager returned a forked session file that does not exist: ${sessionFile}`);
12567
+ const child = (async () => {
12568
+ try {
12569
+ const source = await SessionManager2.open(store, parentSessionId, cwd);
12570
+ await source.createBranchedSession(leafId);
12571
+ return source;
12572
+ } catch (cause) {
12573
+ children.delete(index);
12574
+ throw new SubagentForkContextError(parentSessionId, "fork_failed", { cause });
12580
12575
  }
12581
- cachedSessionFiles.set(index, sessionFile);
12582
- return sessionFile;
12583
- } catch (error) {
12584
- const cause = error instanceof Error ? error : new Error(String(error));
12585
- throw new Error(`Failed to create forked subagent session: ${cause.message}`, { cause });
12586
- }
12576
+ })();
12577
+ children.set(index, child);
12578
+ return child;
12587
12579
  }
12588
12580
  };
12589
12581
  }
12590
12582
 
12591
12583
  // dist/builtin/subagents/src/shared/session-identity.ts
12584
+ class SubagentSessionIdentityError extends Error {
12585
+ constructor() {
12586
+ super("Current session identity is unavailable.");
12587
+ this.name = "SubagentSessionIdentityError";
12588
+ }
12589
+ }
12592
12590
  function resolveCurrentSessionId(sessionManager) {
12593
- const sessionId = sessionManager.getSessionFile() ?? sessionManager.getSessionId();
12594
- if (!sessionId)
12595
- throw new Error("Current session identity is unavailable.");
12591
+ const sessionId = sessionManager.getSessionId();
12592
+ if (sessionId === undefined || sessionId === null)
12593
+ throw new SubagentSessionIdentityError;
12596
12594
  return sessionId;
12597
12595
  }
12598
12596
 
12599
12597
  // dist/builtin/subagents/src/shared/settings.ts
12600
- import * as fs12 from "node:fs";
12598
+ import * as fs11 from "node:fs";
12601
12599
  import * as path12 from "node:path";
12602
12600
  function normalizeOutputOverride(output) {
12603
12601
  return output === "false" ? false : output;
@@ -12637,8 +12635,8 @@ function buildReadInstruction(reads, cwd) {
12637
12635
  return `[Read from: ${files.join(", ")}]`;
12638
12636
  }
12639
12637
  function writeInitialProgressFile(progressDir) {
12640
- fs12.mkdirSync(progressDir, { recursive: true });
12641
- fs12.writeFileSync(path12.join(progressDir, "progress.md"), INITIAL_PROGRESS_CONTENT);
12638
+ fs11.mkdirSync(progressDir, { recursive: true });
12639
+ fs11.writeFileSync(path12.join(progressDir, "progress.md"), INITIAL_PROGRESS_CONTENT);
12642
12640
  }
12643
12641
  function injectSingleProgressInstruction(task, progressDir) {
12644
12642
  return `${task}
@@ -12754,11 +12752,9 @@ function prepareExecutionContext(input) {
12754
12752
 
12755
12753
  ${effectiveParams.task ?? ""}` };
12756
12754
  }
12757
- let sessionFileForIndex = () => {
12758
- return;
12759
- };
12755
+ let sessionManagerForIndex;
12760
12756
  try {
12761
- sessionFileForIndex = createForkContextResolver(ctx.sessionManager, effectiveParams.context).sessionFileForIndex;
12757
+ sessionManagerForIndex = createForkContextResolver(ctx.sessionManager, effectiveParams.context).sessionManagerForIndex;
12762
12758
  } catch (error) {
12763
12759
  return { error: toExecutionErrorResult(effectiveParams, error) };
12764
12760
  }
@@ -12776,7 +12772,7 @@ ${effectiveParams.task ?? ""}` };
12776
12772
  sessionRoot = path13.join(baseSessionRoot, runId);
12777
12773
  }
12778
12774
  try {
12779
- fs13.mkdirSync(sessionRoot, { recursive: true });
12775
+ fs12.mkdirSync(sessionRoot, { recursive: true });
12780
12776
  } catch (error) {
12781
12777
  const message = error instanceof Error ? error.message : String(error);
12782
12778
  return {
@@ -12784,7 +12780,6 @@ ${effectiveParams.task ?? ""}` };
12784
12780
  };
12785
12781
  }
12786
12782
  const sessionDirForIndex = (idx) => path13.join(sessionRoot, `run-${idx ?? 0}`);
12787
- const childSessionFileForIndex = (idx) => sessionFileForIndex(idx) ?? path13.join(sessionDirForIndex(idx), "session.jsonl");
12788
12783
  const onUpdateWithContext = onUpdate ? (r) => onUpdate(withForkContext(r, effectiveParams.context)) : undefined;
12789
12784
  const execData = {
12790
12785
  params: effectiveParams,
@@ -12798,7 +12793,7 @@ ${effectiveParams.task ?? ""}` };
12798
12793
  shareEnabled,
12799
12794
  sessionRoot,
12800
12795
  sessionDirForIndex,
12801
- sessionFileForIndex: childSessionFileForIndex,
12796
+ sessionManagerForIndex,
12802
12797
  artifactConfig,
12803
12798
  artifactsDir,
12804
12799
  parentDepth: depth,
@@ -13001,7 +12996,7 @@ async function routeSubagentModel(input) {
13001
12996
  }
13002
12997
 
13003
12998
  // dist/builtin/subagents/src/runs/shared/run-history.ts
13004
- import * as fs14 from "node:fs";
12999
+ import * as fs13 from "node:fs";
13005
13000
  import * as os6 from "node:os";
13006
13001
  import * as path14 from "node:path";
13007
13002
  import { getAgentConfigPaths as getAgentConfigPaths4 } from "@bastani/atomic";
@@ -13016,14 +13011,14 @@ function recordRun(agent, task, status, durationMs) {
13016
13011
  status,
13017
13012
  duration: durationMs
13018
13013
  };
13019
- fs14.mkdirSync(path14.dirname(HISTORY_PATH), { recursive: true });
13020
- fs14.appendFileSync(HISTORY_PATH, `${JSON.stringify(entry)}
13014
+ fs13.mkdirSync(path14.dirname(HISTORY_PATH), { recursive: true });
13015
+ fs13.appendFileSync(HISTORY_PATH, `${JSON.stringify(entry)}
13021
13016
  `);
13022
13017
  } catch {}
13023
13018
  }
13024
13019
 
13025
13020
  // dist/builtin/subagents/src/runs/shared/single-output.ts
13026
- import * as fs15 from "node:fs";
13021
+ import * as fs14 from "node:fs";
13027
13022
  import * as path15 from "node:path";
13028
13023
  function normalizeSingleOutputOverride(output, defaultOutput) {
13029
13024
  if (output === false || output === "false")
@@ -13089,7 +13084,7 @@ function captureSingleOutputSnapshot(outputPath) {
13089
13084
  if (!outputPath)
13090
13085
  return;
13091
13086
  try {
13092
- const stat = fs15.statSync(outputPath);
13087
+ const stat = fs14.statSync(outputPath);
13093
13088
  return { exists: true, mtimeMs: stat.mtimeMs, size: stat.size };
13094
13089
  } catch {
13095
13090
  return { exists: false };
@@ -13099,8 +13094,8 @@ function persistSingleOutput(outputPath, fullOutput) {
13099
13094
  if (!outputPath)
13100
13095
  return {};
13101
13096
  try {
13102
- fs15.mkdirSync(path15.dirname(outputPath), { recursive: true });
13103
- fs15.writeFileSync(outputPath, fullOutput, "utf-8");
13097
+ fs14.mkdirSync(path15.dirname(outputPath), { recursive: true });
13098
+ fs14.writeFileSync(outputPath, fullOutput, "utf-8");
13104
13099
  return { savedPath: outputPath };
13105
13100
  } catch (err) {
13106
13101
  return { error: err instanceof Error ? err.message : String(err) };
@@ -13111,7 +13106,7 @@ function resolveSingleOutput(outputPath, fallbackOutput, beforeRun) {
13111
13106
  return { fullOutput: fallbackOutput };
13112
13107
  let changedSinceStart = false;
13113
13108
  try {
13114
- const stat = fs15.statSync(outputPath);
13109
+ const stat = fs14.statSync(outputPath);
13115
13110
  changedSinceStart = !beforeRun?.exists || stat.mtimeMs !== beforeRun.mtimeMs || stat.size !== beforeRun.size;
13116
13111
  } catch (error) {
13117
13112
  const code = error && typeof error === "object" && "code" in error ? error.code : undefined;
@@ -13124,7 +13119,7 @@ function resolveSingleOutput(outputPath, fallbackOutput, beforeRun) {
13124
13119
  }
13125
13120
  if (changedSinceStart) {
13126
13121
  try {
13127
- return { fullOutput: fs15.readFileSync(outputPath, "utf-8"), savedPath: outputPath };
13122
+ return { fullOutput: fs14.readFileSync(outputPath, "utf-8"), savedPath: outputPath };
13128
13123
  } catch (error) {
13129
13124
  return {
13130
13125
  fullOutput: fallbackOutput,
@@ -13161,13 +13156,13 @@ ${params.saveError}`;
13161
13156
 
13162
13157
  // dist/builtin/subagents/src/runs/shared/worktree.ts
13163
13158
  import { spawnSync } from "node:child_process";
13164
- import * as fs18 from "node:fs";
13159
+ import * as fs17 from "node:fs";
13165
13160
  import * as os7 from "node:os";
13166
13161
  import * as path18 from "node:path";
13167
13162
  import { createChildProcessEnvironment as createChildProcessEnvironment3, createGitEnvironment } from "@bastani/atomic";
13168
13163
 
13169
13164
  // dist/builtin/subagents/src/runs/shared/worktree-post-create.ts
13170
- import * as fs16 from "node:fs";
13165
+ import * as fs15 from "node:fs";
13171
13166
  import * as path16 from "node:path";
13172
13167
  function tracked(runGit, repo, relativePath) {
13173
13168
  return runGit(repo, ["ls-files", "--error-unmatch", "--", relativePath]).status === 0;
@@ -13186,10 +13181,10 @@ function hasTrackedPathComponent(runGit, repo, relativePath) {
13186
13181
  function copySettings(runGit, mainRoot, worktreeRoot, relativePath) {
13187
13182
  const source = path16.join(mainRoot, relativePath);
13188
13183
  const destination = path16.join(worktreeRoot, relativePath);
13189
- if (!fs16.existsSync(source) || fs16.existsSync(destination) || hasTrackedPathComponent(runGit, worktreeRoot, relativePath))
13184
+ if (!fs15.existsSync(source) || fs15.existsSync(destination) || hasTrackedPathComponent(runGit, worktreeRoot, relativePath))
13190
13185
  return false;
13191
- fs16.mkdirSync(path16.dirname(destination), { recursive: true });
13192
- fs16.copyFileSync(source, destination);
13186
+ fs15.mkdirSync(path16.dirname(destination), { recursive: true });
13187
+ fs15.copyFileSync(source, destination);
13193
13188
  return true;
13194
13189
  }
13195
13190
  function configureHooks(runGit, mainRoot) {
@@ -13197,12 +13192,12 @@ function configureHooks(runGit, mainRoot) {
13197
13192
  const ordinary = path16.join(mainRoot, ".git", "hooks");
13198
13193
  let desired;
13199
13194
  try {
13200
- if (fs16.statSync(husky).isDirectory())
13195
+ if (fs15.statSync(husky).isDirectory())
13201
13196
  desired = husky;
13202
13197
  } catch {}
13203
13198
  if (!desired) {
13204
13199
  try {
13205
- if (fs16.readdirSync(ordinary, { withFileTypes: true }).some((entry) => entry.isFile() && !entry.name.endsWith(".sample")))
13200
+ if (fs15.readdirSync(ordinary, { withFileTypes: true }).some((entry) => entry.isFile() && !entry.name.endsWith(".sample")))
13206
13201
  desired = ordinary;
13207
13202
  } catch {}
13208
13203
  }
@@ -13216,7 +13211,7 @@ function configureHooks(runGit, mainRoot) {
13216
13211
  throw new Error(result.stderr.trim() || "failed to configure shared core.hooksPath");
13217
13212
  }
13218
13213
  function copyIncludes(runGit, mainRoot, worktreeRoot) {
13219
- if (!fs16.existsSync(path16.join(mainRoot, ".worktreeinclude")))
13214
+ if (!fs15.existsSync(path16.join(mainRoot, ".worktreeinclude")))
13220
13215
  return;
13221
13216
  const ignored = runGit(mainRoot, ["ls-files", "--others", "--ignored", "--exclude-standard"]);
13222
13217
  const included = runGit(mainRoot, ["ls-files", "--others", "--ignored", "--exclude-from=.worktreeinclude"]);
@@ -13229,10 +13224,10 @@ function copyIncludes(runGit, mainRoot, worktreeRoot) {
13229
13224
  const source = path16.join(mainRoot, relativePath);
13230
13225
  const destination = path16.join(worktreeRoot, relativePath);
13231
13226
  try {
13232
- if (!fs16.statSync(source).isFile() || fs16.existsSync(destination))
13227
+ if (!fs15.statSync(source).isFile() || fs15.existsSync(destination))
13233
13228
  continue;
13234
- fs16.mkdirSync(path16.dirname(destination), { recursive: true });
13235
- fs16.copyFileSync(source, destination);
13229
+ fs15.mkdirSync(path16.dirname(destination), { recursive: true });
13230
+ fs15.copyFileSync(source, destination);
13236
13231
  } catch {}
13237
13232
  }
13238
13233
  }
@@ -13246,9 +13241,9 @@ function performPostCreationSetup(runGit, mainRoot, worktreeRoot) {
13246
13241
  configureHooks(runGit, mainRoot);
13247
13242
  const source = path16.join(mainRoot, "node_modules");
13248
13243
  const destination = path16.join(worktreeRoot, "node_modules");
13249
- if (fs16.existsSync(source) && !fs16.existsSync(destination) && !tracked(runGit, worktreeRoot, "node_modules")) {
13244
+ if (fs15.existsSync(source) && !fs15.existsSync(destination) && !tracked(runGit, worktreeRoot, "node_modules")) {
13250
13245
  try {
13251
- fs16.symlinkSync(source, destination, process.platform === "win32" ? "junction" : undefined);
13246
+ fs15.symlinkSync(source, destination, process.platform === "win32" ? "junction" : undefined);
13252
13247
  synthetic.push("node_modules");
13253
13248
  } catch {}
13254
13249
  }
@@ -13257,19 +13252,19 @@ function performPostCreationSetup(runGit, mainRoot, worktreeRoot) {
13257
13252
  }
13258
13253
 
13259
13254
  // dist/builtin/subagents/src/runs/shared/worktree-root.ts
13260
- import * as fs17 from "node:fs";
13255
+ import * as fs16 from "node:fs";
13261
13256
  import * as path17 from "node:path";
13262
13257
  function readText(file) {
13263
13258
  try {
13264
- return fs17.readFileSync(file, "utf8");
13259
+ return fs16.readFileSync(file, "utf8");
13265
13260
  } catch {
13266
13261
  return;
13267
13262
  }
13268
13263
  }
13269
13264
  function samePath(left, right) {
13270
13265
  try {
13271
- const a = fs17.realpathSync.native(left);
13272
- const b = fs17.realpathSync.native(right);
13266
+ const a = fs16.realpathSync.native(left);
13267
+ const b = fs16.realpathSync.native(right);
13273
13268
  return process.platform === "win32" ? a.toLowerCase() === b.toLowerCase() : a === b;
13274
13269
  } catch {
13275
13270
  return false;
@@ -13278,14 +13273,14 @@ function samePath(left, right) {
13278
13273
  function findGitRoot(cwd) {
13279
13274
  let current = path17.resolve(cwd);
13280
13275
  try {
13281
- if (!fs17.statSync(current).isDirectory())
13276
+ if (!fs16.statSync(current).isDirectory())
13282
13277
  current = path17.dirname(current);
13283
13278
  } catch {
13284
13279
  return;
13285
13280
  }
13286
13281
  while (true) {
13287
13282
  try {
13288
- const entry = fs17.statSync(path17.join(current, ".git"));
13283
+ const entry = fs16.statSync(path17.join(current, ".git"));
13289
13284
  if (entry.isDirectory() || entry.isFile())
13290
13285
  return current;
13291
13286
  } catch {}
@@ -13299,7 +13294,7 @@ function resolveMainRepoRoot(repoRoot) {
13299
13294
  const gitEntry = path17.join(repoRoot, ".git");
13300
13295
  let stats;
13301
13296
  try {
13302
- stats = fs17.statSync(gitEntry);
13297
+ stats = fs16.statSync(gitEntry);
13303
13298
  } catch {
13304
13299
  return;
13305
13300
  }
@@ -13386,7 +13381,7 @@ function resolveRepoState(cwd) {
13386
13381
  function normalizeComparableCwd(cwd) {
13387
13382
  const resolved = path18.resolve(cwd);
13388
13383
  try {
13389
- return fs18.realpathSync(resolved);
13384
+ return fs17.realpathSync(resolved);
13390
13385
  } catch {
13391
13386
  return resolved;
13392
13387
  }
@@ -13421,8 +13416,8 @@ function buildWorktreePath(mainRoot, runId, index) {
13421
13416
  }
13422
13417
  function ensureWorktreeIgnore(mainRoot) {
13423
13418
  const root = path18.join(mainRoot, ".atomic", "worktrees");
13424
- fs18.mkdirSync(root, { recursive: true });
13425
- fs18.writeFileSync(path18.join(root, ".gitignore"), `*
13419
+ fs17.mkdirSync(root, { recursive: true });
13420
+ fs17.writeFileSync(path18.join(root, ".gitignore"), `*
13426
13421
  `, "utf8");
13427
13422
  }
13428
13423
  function resolveRepoCwdRelative(cwd) {
@@ -13458,10 +13453,10 @@ function resolveWorktreeSetupHook(repoRoot, config) {
13458
13453
  } else {
13459
13454
  throw new Error("worktree setup hook must be an absolute path or a repo-relative path");
13460
13455
  }
13461
- if (!fs18.existsSync(resolvedPath)) {
13456
+ if (!fs17.existsSync(resolvedPath)) {
13462
13457
  throw new Error(`worktree setup hook not found: ${resolvedPath}`);
13463
13458
  }
13464
- if (fs18.statSync(resolvedPath).isDirectory()) {
13459
+ if (fs17.statSync(resolvedPath).isDirectory()) {
13465
13460
  throw new Error(`worktree setup hook must be a file, got directory: ${resolvedPath}`);
13466
13461
  }
13467
13462
  return {
@@ -13608,7 +13603,7 @@ function removeSyntheticPath(worktree, syntheticPath) {
13608
13603
  }
13609
13604
  let stat;
13610
13605
  try {
13611
- stat = fs18.lstatSync(resolved);
13606
+ stat = fs17.lstatSync(resolved);
13612
13607
  } catch (error) {
13613
13608
  const code = error && typeof error === "object" && "code" in error ? error.code : undefined;
13614
13609
  if (code === "ENOENT")
@@ -13616,14 +13611,14 @@ function removeSyntheticPath(worktree, syntheticPath) {
13616
13611
  throw error;
13617
13612
  }
13618
13613
  if (stat.isSymbolicLink()) {
13619
- fs18.unlinkSync(resolved);
13614
+ fs17.unlinkSync(resolved);
13620
13615
  return;
13621
13616
  }
13622
13617
  if (stat.isDirectory()) {
13623
- fs18.rmSync(resolved, { recursive: true, force: true });
13618
+ fs17.rmSync(resolved, { recursive: true, force: true });
13624
13619
  return;
13625
13620
  }
13626
- fs18.rmSync(resolved, { force: true });
13621
+ fs17.rmSync(resolved, { force: true });
13627
13622
  }
13628
13623
  function removeSyntheticPathsBeforeDiff(worktree) {
13629
13624
  if (worktree.syntheticPaths.length === 0)
@@ -13672,7 +13667,7 @@ function captureWorktreeDiff(setup, worktree, agent, patchPath) {
13672
13667
  const diffStat = runGitChecked(worktree.path, ["diff", "--cached", "--stat", setup.baseCommit]).trim();
13673
13668
  const patch = runGitChecked(worktree.path, ["diff", "--cached", setup.baseCommit]);
13674
13669
  const numstat = runGitChecked(worktree.path, ["diff", "--cached", "--numstat", setup.baseCommit]);
13675
- fs18.writeFileSync(patchPath, patch, "utf-8");
13670
+ fs17.writeFileSync(patchPath, patch, "utf-8");
13676
13671
  if (!patch.trim()) {
13677
13672
  return emptyDiff(worktree.index, agent, worktree.branch, patchPath);
13678
13673
  }
@@ -13690,7 +13685,7 @@ function captureWorktreeDiff(setup, worktree, agent, patchPath) {
13690
13685
  }
13691
13686
  function writeEmptyPatch(patchPath) {
13692
13687
  try {
13693
- fs18.writeFileSync(patchPath, "", "utf-8");
13688
+ fs17.writeFileSync(patchPath, "", "utf-8");
13694
13689
  } catch {}
13695
13690
  }
13696
13691
  function hasWorktreeChanges(diff) {
@@ -13713,7 +13708,7 @@ function createWorktrees(cwd, runId, count, options) {
13713
13708
  }
13714
13709
  function diffWorktrees(setup, agents, diffsDir) {
13715
13710
  try {
13716
- fs18.mkdirSync(diffsDir, { recursive: true });
13711
+ fs17.mkdirSync(diffsDir, { recursive: true });
13717
13712
  } catch {
13718
13713
  return [];
13719
13714
  }
@@ -13940,7 +13935,7 @@ async function runForegroundParallelTasks(input) {
13940
13935
  runId: input.runId,
13941
13936
  index,
13942
13937
  sessionDir: input.sessionDirForIndex(index),
13943
- sessionFile: input.sessionFileForIndex(index),
13938
+ sessionManager: await input.sessionManagerForIndex(index),
13944
13939
  share: input.shareEnabled,
13945
13940
  artifactsDir: input.artifactConfig.enabled ? input.artifactsDir : undefined,
13946
13941
  artifactConfig: input.artifactConfig,
@@ -14513,7 +14508,7 @@ async function runParallelPath(data, deps) {
14513
14508
  signal,
14514
14509
  runId,
14515
14510
  sessionDirForIndex,
14516
- sessionFileForIndex,
14511
+ sessionManagerForIndex,
14517
14512
  shareEnabled,
14518
14513
  artifactConfig,
14519
14514
  artifactsDir,
@@ -14665,7 +14660,7 @@ async function runParallelPath(data, deps) {
14665
14660
  signal,
14666
14661
  runId,
14667
14662
  sessionDirForIndex,
14668
- sessionFileForIndex,
14663
+ sessionManagerForIndex,
14669
14664
  shareEnabled,
14670
14665
  artifactConfig,
14671
14666
  artifactsDir,
@@ -14787,7 +14782,7 @@ ${worktreeSuffix}` : childContent;
14787
14782
  }
14788
14783
 
14789
14784
  // dist/builtin/subagents/src/runs/foreground/inprocess-run-sync.ts
14790
- import { existsSync as existsSync15, statSync as statSync9 } from "node:fs";
14785
+ import { existsSync as existsSync14, statSync as statSync9 } from "node:fs";
14791
14786
  import { join as join20 } from "node:path";
14792
14787
 
14793
14788
  // dist/builtin/subagents/src/runs/shared/model-candidate-filter.ts
@@ -15096,7 +15091,7 @@ function noSpawnableCandidatesResult(agent, task, skippedAttempts) {
15096
15091
  }
15097
15092
  async function runSingleInProcess(runtimeCwd, agent, task, options) {
15098
15093
  const cwd = options.cwd ?? runtimeCwd;
15099
- if (!existsSync15(cwd))
15094
+ if (!existsSync14(cwd))
15100
15095
  return refusedResult(agent, task, `cwd does not exist: ${cwd}`);
15101
15096
  if (!statSync9(cwd).isDirectory())
15102
15097
  return refusedResult(agent, task, `cwd is not a directory: ${cwd}`);
@@ -15157,7 +15152,7 @@ ${task}`);
15157
15152
  agent,
15158
15153
  cwd,
15159
15154
  testSession,
15160
- sessionFile: options.sessionFile,
15155
+ sessionManager: options.sessionManager,
15161
15156
  ...options.progressPath ? { progressPath: options.progressPath } : {},
15162
15157
  ...options.progressArtifactPath ? { progressArtifactPath: options.progressArtifactPath } : options.progressPath && artifactsDir ? { progressArtifactPath: options.progressPath } : {},
15163
15158
  ...artifactPaths?.outputPath ? { outputArtifactPath: artifactPaths.outputPath } : {},
@@ -15402,7 +15397,7 @@ function resolveSubagentExecutorRuntimeDeps(overrides) {
15402
15397
  }
15403
15398
 
15404
15399
  // dist/builtin/subagents/src/runs/foreground/subagent-executor-single.ts
15405
- import * as fs19 from "node:fs";
15400
+ import * as fs18 from "node:fs";
15406
15401
  import * as path20 from "node:path";
15407
15402
  function formatFailedSingleRunOutput(result, displayOutput) {
15408
15403
  const error = result.error || "Failed";
@@ -15421,7 +15416,7 @@ function cleanupTransientProgress(progressDir, artifactsEnabled) {
15421
15416
  if (!progressDir || artifactsEnabled)
15422
15417
  return;
15423
15418
  try {
15424
- fs19.rmSync(progressDir, { recursive: true, force: true });
15419
+ fs18.rmSync(progressDir, { recursive: true, force: true });
15425
15420
  } catch {}
15426
15421
  }
15427
15422
  function createForwardSingleUpdate(onUpdate, foregroundControl, agent, index) {
@@ -15454,7 +15449,7 @@ async function runSinglePath(data, deps) {
15454
15449
  signal,
15455
15450
  runId,
15456
15451
  sessionDirForIndex,
15457
- sessionFileForIndex,
15452
+ sessionManagerForIndex,
15458
15453
  shareEnabled,
15459
15454
  artifactConfig,
15460
15455
  artifactsDir,
@@ -15551,7 +15546,7 @@ async function runSinglePath(data, deps) {
15551
15546
  intercomEvents: deps.pi.events,
15552
15547
  runId,
15553
15548
  sessionDir: sessionDirForIndex(0),
15554
- sessionFile: sessionFileForIndex(0),
15549
+ sessionManager: await sessionManagerForIndex(0),
15555
15550
  share: shareEnabled,
15556
15551
  artifactsDir: artifactConfig.enabled ? artifactsDir : undefined,
15557
15552
  artifactConfig,
@@ -17519,13 +17514,13 @@ function renderSubagentResult(result, options, theme) {
17519
17514
  return appendParentAskOutput(c, handoffOutput, theme);
17520
17515
  }
17521
17516
  // dist/builtin/subagents/src/extension/config.ts
17522
- import * as fs20 from "node:fs";
17517
+ import * as fs19 from "node:fs";
17523
17518
  import { getAgentConfigPaths as getAgentConfigPaths5 } from "@bastani/atomic";
17524
17519
  function loadConfig() {
17525
17520
  for (const configPath of getAgentConfigPaths5("extensions", "subagent", "config.json")) {
17526
17521
  try {
17527
- if (fs20.existsSync(configPath)) {
17528
- return JSON.parse(fs20.readFileSync(configPath, "utf-8"));
17522
+ if (fs19.existsSync(configPath)) {
17523
+ return JSON.parse(fs19.readFileSync(configPath, "utf-8"));
17529
17524
  }
17530
17525
  } catch (error) {
17531
17526
  console.error(`Failed to load subagent config from '${configPath}':`, error);
@@ -17957,11 +17952,11 @@ function getApiScopedSet(pi, key) {
17957
17952
  import * as path22 from "node:path";
17958
17953
 
17959
17954
  // dist/builtin/subagents/src/runs/inprocess/runtime-support/temp-cleanup.ts
17960
- import * as fs21 from "node:fs";
17955
+ import * as fs20 from "node:fs";
17961
17956
  import * as path21 from "node:path";
17962
17957
  var SUBAGENT_RUNTIME_TEMP_DIR = path21.join(TEMP_ROOT_DIR, "nested-subagent-events");
17963
17958
  function hasEntryNewerThan(filePath, cutoff) {
17964
- const stat = fs21.statSync(filePath);
17959
+ const stat = fs20.statSync(filePath);
17965
17960
  if (stat.mtimeMs >= cutoff)
17966
17961
  return true;
17967
17962
  if (!stat.isDirectory())
@@ -17971,14 +17966,14 @@ function hasEntryNewerThan(filePath, cutoff) {
17971
17966
  function directoryHasEntryNewerThan(dirPath, cutoff) {
17972
17967
  let entries;
17973
17968
  try {
17974
- entries = fs21.readdirSync(dirPath);
17969
+ entries = fs20.readdirSync(dirPath);
17975
17970
  } catch {
17976
17971
  return false;
17977
17972
  }
17978
17973
  for (const entry of entries) {
17979
17974
  const childPath = path21.join(dirPath, entry);
17980
17975
  try {
17981
- const stat = fs21.statSync(childPath);
17976
+ const stat = fs20.statSync(childPath);
17982
17977
  if (stat.mtimeMs >= cutoff)
17983
17978
  return true;
17984
17979
  if (stat.isDirectory() && directoryHasEntryNewerThan(childPath, cutoff))
@@ -17990,7 +17985,7 @@ function directoryHasEntryNewerThan(dirPath, cutoff) {
17990
17985
  function cleanupOldSubdirectories(root, maxAgeDays) {
17991
17986
  let entries;
17992
17987
  try {
17993
- entries = fs21.readdirSync(root);
17988
+ entries = fs20.readdirSync(root);
17994
17989
  } catch (error) {
17995
17990
  if (error.code === "ENOENT")
17996
17991
  return;
@@ -18001,7 +17996,7 @@ function cleanupOldSubdirectories(root, maxAgeDays) {
18001
17996
  const entryPath = path21.join(root, entry);
18002
17997
  try {
18003
17998
  if (!hasEntryNewerThan(entryPath, cutoff))
18004
- fs21.rmSync(entryPath, { recursive: true, force: true });
17999
+ fs20.rmSync(entryPath, { recursive: true, force: true });
18005
18000
  } catch {}
18006
18001
  }
18007
18002
  }
@@ -18106,7 +18101,7 @@ function getSubagentSessionRoot(parentSessionFile) {
18106
18101
  const sessionsDir = path23.dirname(parentSessionFile);
18107
18102
  return path23.join(sessionsDir, baseName);
18108
18103
  }
18109
- return fs22.mkdtempSync(path23.join(os8.tmpdir(), `${APP_NAME3}-subagent-session-`));
18104
+ return fs21.mkdtempSync(path23.join(os8.tmpdir(), `${APP_NAME3}-subagent-session-`));
18110
18105
  }
18111
18106
  function expandTilde2(p) {
18112
18107
  return p.startsWith("~/") ? path23.join(os8.homedir(), p.slice(2)) : p;