@namzu/cli 36.3.0 → 36.4.0

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 (243) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/chunks/{acp-2DS2IECT.js → acp-ERY7R2OY.js} +31 -31
  4. package/dist/chunks/{activity-command-MCYEK4Z4.js → activity-command-KJXWOIHO.js} +10 -10
  5. package/dist/chunks/{add-ZQ3YWP4F.js → add-OQ2SSEQT.js} +16 -16
  6. package/dist/chunks/{agent-PAGVUATH.js → agent-RZNIDLRL.js} +22 -22
  7. package/dist/chunks/agent-session-NATAL4BA.js +46 -0
  8. package/dist/chunks/{archive-VPREZOGC.js → archive-LUOLQEUE.js} +8 -8
  9. package/dist/chunks/{bin-main-MWFKUXP2.js → bin-main-AYEHZYZV.js} +3 -3
  10. package/dist/chunks/{browser-FZWYOIIJ.js → browser-3POB2OSK.js} +6 -6
  11. package/dist/chunks/{chat-W355SFNQ.js → chat-65V4NXAF.js} +13 -13
  12. package/dist/chunks/{chunk-E7HLYLD7.js → chunk-2DECDD7E.js} +3 -3
  13. package/dist/chunks/{chunk-5URT3ZM2.js → chunk-3N3CDMDI.js} +4 -4
  14. package/dist/chunks/{chunk-AHYHR5DY.js → chunk-4BCW647F.js} +3 -3
  15. package/dist/chunks/{chunk-F3YQ2CSZ.js → chunk-4JPJV4QO.js} +4 -4
  16. package/dist/chunks/{chunk-MJO6CH5F.js → chunk-4TZPG75O.js} +3 -3
  17. package/dist/chunks/{chunk-6CGC72OA.js → chunk-5EDECUGH.js} +10 -10
  18. package/dist/chunks/{chunk-VUOS5SQ3.js → chunk-5VB3X4UB.js} +2 -2
  19. package/dist/chunks/{chunk-V3ZLK3XQ.js → chunk-5YWWQUJ5.js} +3 -1
  20. package/dist/chunks/{chunk-5H4LJ4AN.js → chunk-5ZRZZKPU.js} +7 -6
  21. package/dist/chunks/{chunk-GQN64E36.js → chunk-6RJSJGZF.js} +3 -3
  22. package/dist/chunks/{chunk-3M3PMQ3I.js → chunk-6T4UA6AV.js} +7 -7
  23. package/dist/chunks/{chunk-XCWZZZOW.js → chunk-6ZEROVY4.js} +3 -3
  24. package/dist/chunks/{chunk-RM6HTBJK.js → chunk-BPWCZOTB.js} +2 -2
  25. package/dist/chunks/{chunk-PINPSIJ5.js → chunk-BXWH4UAN.js} +5 -5
  26. package/dist/chunks/{chunk-PLKJKF32.js → chunk-COPHNRLH.js} +12 -12
  27. package/dist/chunks/{chunk-ZG6NVROB.js → chunk-CYYGWTKF.js} +2 -2
  28. package/dist/chunks/{chunk-LBH5WVXU.js → chunk-DHXMHWOW.js} +2 -2
  29. package/dist/chunks/{chunk-ZHBHRMCI.js → chunk-EX7TQFIQ.js} +4 -4
  30. package/dist/chunks/{chunk-6TDJXZ5W.js → chunk-FAPXHMTL.js} +4 -4
  31. package/dist/chunks/{chunk-NATYSTPM.js → chunk-GTJVK5TJ.js} +2 -2
  32. package/dist/chunks/{chunk-YYVDLVUM.js → chunk-HZ5AGRNO.js} +2 -2
  33. package/dist/chunks/{chunk-AP5KD43Y.js → chunk-IGHTIUKD.js} +2 -2
  34. package/dist/chunks/{chunk-QRT3N2K3.js → chunk-II72PLUA.js} +2 -2
  35. package/dist/chunks/{chunk-HKDPP2JF.js → chunk-IQKT222K.js} +2 -2
  36. package/dist/chunks/{chunk-2TGQ2B53.js → chunk-JHPCQLRT.js} +3 -3
  37. package/dist/chunks/{chunk-AS7UWXMN.js → chunk-JRVKQITY.js} +4 -4
  38. package/dist/chunks/{chunk-QXDKRJZ5.js → chunk-K5JGJIJV.js} +3 -3
  39. package/dist/chunks/{chunk-I6CDUPVR.js → chunk-KDOMBH7Q.js} +2 -2
  40. package/dist/chunks/{chunk-FU4GQ7K2.js → chunk-KZJUG4HN.js} +2 -2
  41. package/dist/chunks/{chunk-56OUKG5W.js → chunk-LH4NC5YB.js} +3 -3
  42. package/dist/chunks/{chunk-YYQFUKI7.js → chunk-MEWIPARY.js} +3 -3
  43. package/dist/chunks/{chunk-2BZOT2CT.js → chunk-MGFWBSDV.js} +2 -2
  44. package/dist/chunks/{chunk-KMHLON54.js → chunk-MH3JD7CF.js} +2 -2
  45. package/dist/chunks/{chunk-MBBFX64S.js → chunk-MUUBLY7G.js} +2 -2
  46. package/dist/chunks/{chunk-BUCICQWG.js → chunk-NS7TSLQK.js} +2 -2
  47. package/dist/chunks/{chunk-BOV53LZO.js → chunk-O5FRXERG.js} +2 -2
  48. package/dist/chunks/{chunk-S6MZK4LD.js → chunk-PAE4DIXR.js} +2 -2
  49. package/dist/chunks/{chunk-ZB5ETOVE.js → chunk-Q4AASGFT.js} +3 -3
  50. package/dist/chunks/{chunk-DYUOXP5Q.js → chunk-QZSP4UWJ.js} +13 -13
  51. package/dist/chunks/{chunk-SFUUN6B3.js → chunk-RAKBF6PY.js} +462 -63
  52. package/dist/chunks/chunk-RAKBF6PY.js.map +6 -0
  53. package/dist/chunks/{chunk-HSEJGSXE.js → chunk-RDFZIPD5.js} +2 -2
  54. package/dist/chunks/{chunk-LYDXPWAZ.js → chunk-RSRL3R7C.js} +4 -4
  55. package/dist/chunks/{chunk-JCDTR2ZU.js → chunk-TCHEQRJE.js} +4 -4
  56. package/dist/chunks/{chunk-KOG2WB66.js → chunk-UEDWEOYF.js} +4 -4
  57. package/dist/chunks/{chunk-2O7KYX4V.js → chunk-UH5LZDKB.js} +8 -8
  58. package/dist/chunks/{chunk-NBD5MAGK.js → chunk-VSZX76G4.js} +9 -9
  59. package/dist/chunks/{chunk-46B7KRXY.js → chunk-WDIIFX5X.js} +6 -6
  60. package/dist/chunks/{chunk-52OVP5BG.js → chunk-WIPSZYIM.js} +4 -4
  61. package/dist/chunks/{chunk-IQBR45AU.js → chunk-WWTZUAII.js} +2 -2
  62. package/dist/chunks/{chunk-EZ6ZSHYX.js → chunk-XC2EJGYI.js} +26 -26
  63. package/dist/chunks/{chunk-QBAISLAD.js → chunk-ZJXRPK5W.js} +11 -6
  64. package/dist/chunks/{chunk-QBAISLAD.js.map → chunk-ZJXRPK5W.js.map} +1 -1
  65. package/dist/chunks/{chunk-3F5DGROG.js → chunk-ZORZAWSH.js} +2 -2
  66. package/dist/chunks/{chunk-RBX6RVYO.js → chunk-ZPCQBKVG.js} +6 -6
  67. package/dist/chunks/{chunk-EKUJUPFA.js → chunk-ZSPSXPRH.js} +4 -4
  68. package/dist/chunks/{cli-runtime-NG23IVRM.js → cli-runtime-Q2NCEXXY.js} +8 -8
  69. package/dist/chunks/{commands-LQISMOPF.js → commands-QY4JZ2D5.js} +5 -5
  70. package/dist/chunks/{crash-report-EYK56MJJ.js → crash-report-HIJHT4UR.js} +6 -6
  71. package/dist/chunks/{dist-DWB5AYXB.js → dist-AEKRLZ3M.js} +2 -2
  72. package/dist/chunks/{dist-XT4V74YL.js → dist-BT2HNR4P.js} +2 -2
  73. package/dist/chunks/{dist-EDKLCZY4.js → dist-M4QJEZ6W.js} +2 -2
  74. package/dist/chunks/{dist-PZXF5NU3.js → dist-WVLCXQIR.js} +2 -2
  75. package/dist/chunks/{dist-AZJ56DQJ.js → dist-X5AY7IYY.js} +2 -2
  76. package/dist/chunks/{dist-AUDNCB3F.js → dist-YGBNYJXU.js} +2 -2
  77. package/dist/chunks/{dist-3AMBKAG4.js → dist-YW5SKAUO.js} +2 -2
  78. package/dist/chunks/{doctor-3EOUWDYB.js → doctor-NSYFMZUT.js} +6 -6
  79. package/dist/chunks/{drain-IMNF2CDN.js → drain-KYJSJS32.js} +10 -10
  80. package/dist/chunks/{eval-VHWEJ4GG.js → eval-TH3WQFI2.js} +2 -2
  81. package/dist/chunks/{exec-2KM6DH56.js → exec-VOZ3VAVV.js} +22 -22
  82. package/dist/chunks/{home-H4GTIYO5.js → home-RAOAISVY.js} +3 -3
  83. package/dist/chunks/{host-queries-5C4TCX6J.js → host-queries-U4CWSBUK.js} +13 -13
  84. package/dist/chunks/{lifecycle-IHW4P636.js → lifecycle-PXCABRZ5.js} +23 -23
  85. package/dist/chunks/{list-JJZ7I5OF.js → list-TIF25QTK.js} +12 -12
  86. package/dist/chunks/{login-T2RKNHK2.js → login-J42GU7EB.js} +8 -8
  87. package/dist/chunks/{logs-J6D4SEDY.js → logs-BGBHTVT3.js} +4 -4
  88. package/dist/chunks/{mcp-WONRVJ26.js → mcp-WLA36KLN.js} +15 -15
  89. package/dist/chunks/{message-command-F3TFROMK.js → message-command-KQ2ENU5G.js} +29 -29
  90. package/dist/chunks/{operator-tools-H4MYC5PE.js → operator-tools-4NS32VMF.js} +11 -11
  91. package/dist/chunks/{output-schema-RFJUTQ2N.js → output-schema-VUNV5PSI.js} +3 -3
  92. package/dist/chunks/{pal-UCYGJN75.js → pal-JLYSYJZ4.js} +11 -11
  93. package/dist/chunks/{providers-BHF65IUG.js → providers-6S2OD65T.js} +6 -6
  94. package/dist/chunks/{resident-CNS3XQRU.js → resident-FWCWLKM2.js} +18 -18
  95. package/dist/chunks/{resume-command-Y3NYDSI4.js → resume-command-R22OK5SL.js} +4 -4
  96. package/dist/chunks/{schedule-KN5YGOSJ.js → schedule-JP3VSIXA.js} +8 -8
  97. package/dist/chunks/{service-OEOHUGM6.js → service-R7SRZ22P.js} +22 -22
  98. package/dist/chunks/session-step-L4HQYX5J.js +26 -0
  99. package/dist/chunks/{skills-K3JRZ3IR.js → skills-MOVGIR6S.js} +8 -8
  100. package/dist/chunks/{state-QPSQI7U7.js → state-GVVLT2YD.js} +2 -2
  101. package/dist/chunks/{store-PSQKDEPY.js → store-IAAJ4GWU.js} +8 -8
  102. package/dist/chunks/{store-7WZWQXKX.js → store-VVOUETR5.js} +6 -6
  103. package/dist/chunks/{store-Z3PS6LUZ.js → store-WQ5PM4Z2.js} +4 -4
  104. package/dist/chunks/{tui-JKZOXURU.js → tui-23RXXZL2.js} +1891 -1480
  105. package/dist/chunks/tui-23RXXZL2.js.map +6 -0
  106. package/dist/chunks/{upgrade-C6QUXRLB.js → upgrade-2FXGSXCP.js} +2 -2
  107. package/dist/chunks/{worktree-KLD2PAMU.js → worktree-FOHNJC3S.js} +10 -10
  108. package/dist/index.js +9 -9
  109. package/dist/integrations/resident/runner-worker.js +16 -16
  110. package/dist/integrations/subagents/activity-label.d.ts +40 -0
  111. package/dist/integrations/subagents/activity-label.d.ts.map +1 -0
  112. package/dist/integrations/subagents/activity.d.ts +45 -1
  113. package/dist/integrations/subagents/activity.d.ts.map +1 -1
  114. package/dist/integrations/subagents/label-ledger.d.ts +45 -0
  115. package/dist/integrations/subagents/label-ledger.d.ts.map +1 -0
  116. package/dist/integrations/subagents/runtime.d.ts +23 -1
  117. package/dist/integrations/subagents/runtime.d.ts.map +1 -1
  118. package/dist/integrations/workflows/host.d.ts.map +1 -1
  119. package/dist/integrations/workflows/notice.d.ts +2 -0
  120. package/dist/integrations/workflows/notice.d.ts.map +1 -1
  121. package/dist/integrations/workflows/registry.d.ts +12 -0
  122. package/dist/integrations/workflows/registry.d.ts.map +1 -1
  123. package/dist/tui/AgentExplorer.d.ts +83 -15
  124. package/dist/tui/AgentExplorer.d.ts.map +1 -1
  125. package/dist/tui/App.d.ts.map +1 -1
  126. package/dist/tui/StatusBar.d.ts +7 -1
  127. package/dist/tui/StatusBar.d.ts.map +1 -1
  128. package/dist/tui/Transcript.d.ts +6 -0
  129. package/dist/tui/Transcript.d.ts.map +1 -1
  130. package/dist/tui/agent-transcript-rows.d.ts +66 -5
  131. package/dist/tui/agent-transcript-rows.d.ts.map +1 -1
  132. package/dist/tui/agent-view-commands.d.ts +35 -0
  133. package/dist/tui/agent-view-commands.d.ts.map +1 -0
  134. package/dist/tui/agent.d.ts +7 -1
  135. package/dist/tui/agent.d.ts.map +1 -1
  136. package/dist/tui/workflow-runs.d.ts +5 -1
  137. package/dist/tui/workflow-runs.d.ts.map +1 -1
  138. package/package.json +3 -3
  139. package/dist/chunks/agent-session-PLIPF3XG.js +0 -46
  140. package/dist/chunks/chunk-SFUUN6B3.js.map +0 -6
  141. package/dist/chunks/session-step-AYHFVVX6.js +0 -26
  142. package/dist/chunks/tui-JKZOXURU.js.map +0 -6
  143. package/dist/tui/ChildComposer.d.ts +0 -22
  144. package/dist/tui/ChildComposer.d.ts.map +0 -1
  145. /package/dist/chunks/{acp-2DS2IECT.js.map → acp-ERY7R2OY.js.map} +0 -0
  146. /package/dist/chunks/{activity-command-MCYEK4Z4.js.map → activity-command-KJXWOIHO.js.map} +0 -0
  147. /package/dist/chunks/{add-ZQ3YWP4F.js.map → add-OQ2SSEQT.js.map} +0 -0
  148. /package/dist/chunks/{agent-PAGVUATH.js.map → agent-RZNIDLRL.js.map} +0 -0
  149. /package/dist/chunks/{agent-session-PLIPF3XG.js.map → agent-session-NATAL4BA.js.map} +0 -0
  150. /package/dist/chunks/{archive-VPREZOGC.js.map → archive-LUOLQEUE.js.map} +0 -0
  151. /package/dist/chunks/{bin-main-MWFKUXP2.js.map → bin-main-AYEHZYZV.js.map} +0 -0
  152. /package/dist/chunks/{browser-FZWYOIIJ.js.map → browser-3POB2OSK.js.map} +0 -0
  153. /package/dist/chunks/{chat-W355SFNQ.js.map → chat-65V4NXAF.js.map} +0 -0
  154. /package/dist/chunks/{chunk-E7HLYLD7.js.map → chunk-2DECDD7E.js.map} +0 -0
  155. /package/dist/chunks/{chunk-5URT3ZM2.js.map → chunk-3N3CDMDI.js.map} +0 -0
  156. /package/dist/chunks/{chunk-AHYHR5DY.js.map → chunk-4BCW647F.js.map} +0 -0
  157. /package/dist/chunks/{chunk-F3YQ2CSZ.js.map → chunk-4JPJV4QO.js.map} +0 -0
  158. /package/dist/chunks/{chunk-MJO6CH5F.js.map → chunk-4TZPG75O.js.map} +0 -0
  159. /package/dist/chunks/{chunk-6CGC72OA.js.map → chunk-5EDECUGH.js.map} +0 -0
  160. /package/dist/chunks/{chunk-VUOS5SQ3.js.map → chunk-5VB3X4UB.js.map} +0 -0
  161. /package/dist/chunks/{chunk-V3ZLK3XQ.js.map → chunk-5YWWQUJ5.js.map} +0 -0
  162. /package/dist/chunks/{chunk-5H4LJ4AN.js.map → chunk-5ZRZZKPU.js.map} +0 -0
  163. /package/dist/chunks/{chunk-GQN64E36.js.map → chunk-6RJSJGZF.js.map} +0 -0
  164. /package/dist/chunks/{chunk-3M3PMQ3I.js.map → chunk-6T4UA6AV.js.map} +0 -0
  165. /package/dist/chunks/{chunk-XCWZZZOW.js.map → chunk-6ZEROVY4.js.map} +0 -0
  166. /package/dist/chunks/{chunk-RM6HTBJK.js.map → chunk-BPWCZOTB.js.map} +0 -0
  167. /package/dist/chunks/{chunk-PINPSIJ5.js.map → chunk-BXWH4UAN.js.map} +0 -0
  168. /package/dist/chunks/{chunk-PLKJKF32.js.map → chunk-COPHNRLH.js.map} +0 -0
  169. /package/dist/chunks/{chunk-ZG6NVROB.js.map → chunk-CYYGWTKF.js.map} +0 -0
  170. /package/dist/chunks/{chunk-LBH5WVXU.js.map → chunk-DHXMHWOW.js.map} +0 -0
  171. /package/dist/chunks/{chunk-ZHBHRMCI.js.map → chunk-EX7TQFIQ.js.map} +0 -0
  172. /package/dist/chunks/{chunk-6TDJXZ5W.js.map → chunk-FAPXHMTL.js.map} +0 -0
  173. /package/dist/chunks/{chunk-NATYSTPM.js.map → chunk-GTJVK5TJ.js.map} +0 -0
  174. /package/dist/chunks/{chunk-YYVDLVUM.js.map → chunk-HZ5AGRNO.js.map} +0 -0
  175. /package/dist/chunks/{chunk-AP5KD43Y.js.map → chunk-IGHTIUKD.js.map} +0 -0
  176. /package/dist/chunks/{chunk-QRT3N2K3.js.map → chunk-II72PLUA.js.map} +0 -0
  177. /package/dist/chunks/{chunk-HKDPP2JF.js.map → chunk-IQKT222K.js.map} +0 -0
  178. /package/dist/chunks/{chunk-2TGQ2B53.js.map → chunk-JHPCQLRT.js.map} +0 -0
  179. /package/dist/chunks/{chunk-AS7UWXMN.js.map → chunk-JRVKQITY.js.map} +0 -0
  180. /package/dist/chunks/{chunk-QXDKRJZ5.js.map → chunk-K5JGJIJV.js.map} +0 -0
  181. /package/dist/chunks/{chunk-I6CDUPVR.js.map → chunk-KDOMBH7Q.js.map} +0 -0
  182. /package/dist/chunks/{chunk-FU4GQ7K2.js.map → chunk-KZJUG4HN.js.map} +0 -0
  183. /package/dist/chunks/{chunk-56OUKG5W.js.map → chunk-LH4NC5YB.js.map} +0 -0
  184. /package/dist/chunks/{chunk-YYQFUKI7.js.map → chunk-MEWIPARY.js.map} +0 -0
  185. /package/dist/chunks/{chunk-2BZOT2CT.js.map → chunk-MGFWBSDV.js.map} +0 -0
  186. /package/dist/chunks/{chunk-KMHLON54.js.map → chunk-MH3JD7CF.js.map} +0 -0
  187. /package/dist/chunks/{chunk-MBBFX64S.js.map → chunk-MUUBLY7G.js.map} +0 -0
  188. /package/dist/chunks/{chunk-BUCICQWG.js.map → chunk-NS7TSLQK.js.map} +0 -0
  189. /package/dist/chunks/{chunk-BOV53LZO.js.map → chunk-O5FRXERG.js.map} +0 -0
  190. /package/dist/chunks/{chunk-S6MZK4LD.js.map → chunk-PAE4DIXR.js.map} +0 -0
  191. /package/dist/chunks/{chunk-ZB5ETOVE.js.map → chunk-Q4AASGFT.js.map} +0 -0
  192. /package/dist/chunks/{chunk-DYUOXP5Q.js.map → chunk-QZSP4UWJ.js.map} +0 -0
  193. /package/dist/chunks/{chunk-HSEJGSXE.js.map → chunk-RDFZIPD5.js.map} +0 -0
  194. /package/dist/chunks/{chunk-LYDXPWAZ.js.map → chunk-RSRL3R7C.js.map} +0 -0
  195. /package/dist/chunks/{chunk-JCDTR2ZU.js.map → chunk-TCHEQRJE.js.map} +0 -0
  196. /package/dist/chunks/{chunk-KOG2WB66.js.map → chunk-UEDWEOYF.js.map} +0 -0
  197. /package/dist/chunks/{chunk-2O7KYX4V.js.map → chunk-UH5LZDKB.js.map} +0 -0
  198. /package/dist/chunks/{chunk-NBD5MAGK.js.map → chunk-VSZX76G4.js.map} +0 -0
  199. /package/dist/chunks/{chunk-46B7KRXY.js.map → chunk-WDIIFX5X.js.map} +0 -0
  200. /package/dist/chunks/{chunk-52OVP5BG.js.map → chunk-WIPSZYIM.js.map} +0 -0
  201. /package/dist/chunks/{chunk-IQBR45AU.js.map → chunk-WWTZUAII.js.map} +0 -0
  202. /package/dist/chunks/{chunk-EZ6ZSHYX.js.map → chunk-XC2EJGYI.js.map} +0 -0
  203. /package/dist/chunks/{chunk-3F5DGROG.js.map → chunk-ZORZAWSH.js.map} +0 -0
  204. /package/dist/chunks/{chunk-RBX6RVYO.js.map → chunk-ZPCQBKVG.js.map} +0 -0
  205. /package/dist/chunks/{chunk-EKUJUPFA.js.map → chunk-ZSPSXPRH.js.map} +0 -0
  206. /package/dist/chunks/{cli-runtime-NG23IVRM.js.map → cli-runtime-Q2NCEXXY.js.map} +0 -0
  207. /package/dist/chunks/{commands-LQISMOPF.js.map → commands-QY4JZ2D5.js.map} +0 -0
  208. /package/dist/chunks/{crash-report-EYK56MJJ.js.map → crash-report-HIJHT4UR.js.map} +0 -0
  209. /package/dist/chunks/{dist-DWB5AYXB.js.map → dist-AEKRLZ3M.js.map} +0 -0
  210. /package/dist/chunks/{dist-XT4V74YL.js.map → dist-BT2HNR4P.js.map} +0 -0
  211. /package/dist/chunks/{dist-EDKLCZY4.js.map → dist-M4QJEZ6W.js.map} +0 -0
  212. /package/dist/chunks/{dist-PZXF5NU3.js.map → dist-WVLCXQIR.js.map} +0 -0
  213. /package/dist/chunks/{dist-AZJ56DQJ.js.map → dist-X5AY7IYY.js.map} +0 -0
  214. /package/dist/chunks/{dist-AUDNCB3F.js.map → dist-YGBNYJXU.js.map} +0 -0
  215. /package/dist/chunks/{dist-3AMBKAG4.js.map → dist-YW5SKAUO.js.map} +0 -0
  216. /package/dist/chunks/{doctor-3EOUWDYB.js.map → doctor-NSYFMZUT.js.map} +0 -0
  217. /package/dist/chunks/{drain-IMNF2CDN.js.map → drain-KYJSJS32.js.map} +0 -0
  218. /package/dist/chunks/{eval-VHWEJ4GG.js.map → eval-TH3WQFI2.js.map} +0 -0
  219. /package/dist/chunks/{exec-2KM6DH56.js.map → exec-VOZ3VAVV.js.map} +0 -0
  220. /package/dist/chunks/{home-H4GTIYO5.js.map → home-RAOAISVY.js.map} +0 -0
  221. /package/dist/chunks/{host-queries-5C4TCX6J.js.map → host-queries-U4CWSBUK.js.map} +0 -0
  222. /package/dist/chunks/{lifecycle-IHW4P636.js.map → lifecycle-PXCABRZ5.js.map} +0 -0
  223. /package/dist/chunks/{list-JJZ7I5OF.js.map → list-TIF25QTK.js.map} +0 -0
  224. /package/dist/chunks/{login-T2RKNHK2.js.map → login-J42GU7EB.js.map} +0 -0
  225. /package/dist/chunks/{logs-J6D4SEDY.js.map → logs-BGBHTVT3.js.map} +0 -0
  226. /package/dist/chunks/{mcp-WONRVJ26.js.map → mcp-WLA36KLN.js.map} +0 -0
  227. /package/dist/chunks/{message-command-F3TFROMK.js.map → message-command-KQ2ENU5G.js.map} +0 -0
  228. /package/dist/chunks/{operator-tools-H4MYC5PE.js.map → operator-tools-4NS32VMF.js.map} +0 -0
  229. /package/dist/chunks/{output-schema-RFJUTQ2N.js.map → output-schema-VUNV5PSI.js.map} +0 -0
  230. /package/dist/chunks/{pal-UCYGJN75.js.map → pal-JLYSYJZ4.js.map} +0 -0
  231. /package/dist/chunks/{providers-BHF65IUG.js.map → providers-6S2OD65T.js.map} +0 -0
  232. /package/dist/chunks/{resident-CNS3XQRU.js.map → resident-FWCWLKM2.js.map} +0 -0
  233. /package/dist/chunks/{resume-command-Y3NYDSI4.js.map → resume-command-R22OK5SL.js.map} +0 -0
  234. /package/dist/chunks/{schedule-KN5YGOSJ.js.map → schedule-JP3VSIXA.js.map} +0 -0
  235. /package/dist/chunks/{service-OEOHUGM6.js.map → service-R7SRZ22P.js.map} +0 -0
  236. /package/dist/chunks/{session-step-AYHFVVX6.js.map → session-step-L4HQYX5J.js.map} +0 -0
  237. /package/dist/chunks/{skills-K3JRZ3IR.js.map → skills-MOVGIR6S.js.map} +0 -0
  238. /package/dist/chunks/{state-QPSQI7U7.js.map → state-GVVLT2YD.js.map} +0 -0
  239. /package/dist/chunks/{store-7WZWQXKX.js.map → store-IAAJ4GWU.js.map} +0 -0
  240. /package/dist/chunks/{store-PSQKDEPY.js.map → store-VVOUETR5.js.map} +0 -0
  241. /package/dist/chunks/{store-Z3PS6LUZ.js.map → store-WQ5PM4Z2.js.map} +0 -0
  242. /package/dist/chunks/{upgrade-C6QUXRLB.js.map → upgrade-2FXGSXCP.js.map} +0 -0
  243. /package/dist/chunks/{worktree-KLD2PAMU.js.map → worktree-FOHNJC3S.js.map} +0 -0
@@ -2,22 +2,23 @@ import { createRequire as __namzuCreateRequire } from 'node:module';
2
2
  const require = __namzuCreateRequire(import.meta.url);
3
3
  import {
4
4
  openManagedWorktrees
5
- } from "./chunk-52OVP5BG.js";
5
+ } from "./chunk-WIPSZYIM.js";
6
6
  import {
7
7
  createBrowserControl
8
8
  } from "./chunk-WHODOMXA.js";
9
9
  import {
10
10
  connectMcpServers
11
- } from "./chunk-JCDTR2ZU.js";
11
+ } from "./chunk-TCHEQRJE.js";
12
12
  import {
13
13
  createSessionSkillCatalog
14
- } from "./chunk-XCWZZZOW.js";
14
+ } from "./chunk-6ZEROVY4.js";
15
15
  import {
16
16
  SAVE_SKILL_TOOL_NAME,
17
17
  WORKFLOW_TOOL_DESCRIPTION,
18
18
  WORKFLOW_TOOL_NAME,
19
19
  attachAgentView,
20
20
  closeOpenAgents,
21
+ completionNotice,
21
22
  initialRunView,
22
23
  launchedText,
23
24
  readStoredTurnGuards,
@@ -26,10 +27,10 @@ import {
26
27
  viewFromJournal,
27
28
  workflowOffered,
28
29
  workflowRefusal
29
- } from "./chunk-QBAISLAD.js";
30
+ } from "./chunk-ZJXRPK5W.js";
30
31
  import {
31
32
  openInBrowser
32
- } from "./chunk-AP5KD43Y.js";
33
+ } from "./chunk-IGHTIUKD.js";
33
34
  import {
34
35
  CredentialRefreshRejectedError,
35
36
  CredentialWithdrawnError,
@@ -37,7 +38,7 @@ import {
37
38
  ensureFreshStoredCodexCredential,
38
39
  readSubscriptionCredential,
39
40
  sameOAuthCredential
40
- } from "./chunk-5URT3ZM2.js";
41
+ } from "./chunk-3N3CDMDI.js";
41
42
  import {
42
43
  debugRequested
43
44
  } from "./chunk-GNBMKISG.js";
@@ -45,7 +46,7 @@ import {
45
46
  configuredPassthroughTools,
46
47
  resolveToolResultScreens,
47
48
  unmatchedPassthroughTools
48
- } from "./chunk-MBBFX64S.js";
49
+ } from "./chunk-MUUBLY7G.js";
49
50
  import {
50
51
  formatSize,
51
52
  homePath,
@@ -73,7 +74,7 @@ import {
73
74
  requiresCredentialForModel,
74
75
  resolveChainCapabilities,
75
76
  unresolvedMembers
76
- } from "./chunk-DYUOXP5Q.js";
77
+ } from "./chunk-QZSP4UWJ.js";
77
78
  import {
78
79
  PROVIDER_REGISTRY,
79
80
  missingCredentialMessage,
@@ -81,11 +82,11 @@ import {
81
82
  } from "./chunk-6LLJQ3KY.js";
82
83
  import {
83
84
  cliLogger
84
- } from "./chunk-FU4GQ7K2.js";
85
+ } from "./chunk-KZJUG4HN.js";
85
86
  import {
86
87
  isPermissionMode,
87
88
  permissionModeLabel
88
- } from "./chunk-LBH5WVXU.js";
89
+ } from "./chunk-DHXMHWOW.js";
89
90
  import {
90
91
  probeCapabilities
91
92
  } from "./chunk-OH6TB27S.js";
@@ -96,7 +97,7 @@ import {
96
97
  import {
97
98
  conversationLogPath,
98
99
  ensureSessionStarted
99
- } from "./chunk-EKUJUPFA.js";
100
+ } from "./chunk-ZSPSXPRH.js";
100
101
  import {
101
102
  INSTRUCTIONS_FILENAME,
102
103
  MAX_CHARS_PER_FILE,
@@ -106,13 +107,13 @@ import {
106
107
  } from "./chunk-H6B6AROX.js";
107
108
  import {
108
109
  ensurePrivateStateDirectory
109
- } from "./chunk-S6MZK4LD.js";
110
+ } from "./chunk-PAE4DIXR.js";
110
111
  import {
111
112
  restrictToOwner
112
- } from "./chunk-BOV53LZO.js";
113
+ } from "./chunk-O5FRXERG.js";
113
114
  import {
114
115
  namzuHomePath
115
- } from "./chunk-HKDPP2JF.js";
116
+ } from "./chunk-IQKT222K.js";
116
117
  import {
117
118
  AgentManager,
118
119
  AgentRegistry,
@@ -183,6 +184,7 @@ import {
183
184
  buildResidentToolEvidenceTools,
184
185
  buildSessionGoalTools,
185
186
  classifyEvidenceSource,
187
+ collectChatCompletion,
186
188
  compactNow,
187
189
  compactSession,
188
190
  computerUseUnavailableReason,
@@ -198,7 +200,9 @@ import {
198
200
  createReviewHandler,
199
201
  createSessionTextEvidenceSource,
200
202
  createSkillTool,
203
+ createSystemMessage,
201
204
  createToolPresenter,
205
+ createUserMessage,
202
206
  deferred,
203
207
  defineTool,
204
208
  discoverAgentDefinitions,
@@ -247,7 +251,7 @@ import {
247
251
  windowsShellNotice,
248
252
  withProviderFallback,
249
253
  wrapUntrusted
250
- } from "./chunk-V3ZLK3XQ.js";
254
+ } from "./chunk-5YWWQUJ5.js";
251
255
  import {
252
256
  __name
253
257
  } from "./chunk-76FLAFCG.js";
@@ -4492,6 +4496,7 @@ var SubagentActivityMonitor = class {
4492
4496
  if (!prior || !prior.closed || this.options.replay)
4493
4497
  throw new Error("This child conversation is not available for continuation.");
4494
4498
  const opened = this.open(input, viewId);
4499
+ opened.record.resumed = true;
4495
4500
  opened.record.rows = [...prior.rows];
4496
4501
  opened.record.sessionId = prior.sessionId;
4497
4502
  pushRow(opened.record, {
@@ -4520,6 +4525,7 @@ var SubagentActivityMonitor = class {
4520
4525
  model: bounded(input.model.trim(), MAX_AGENT_ACTIVITY_LABEL_CODE_UNITS)
4521
4526
  } : {},
4522
4527
  description: bounded(input.description, MAX_AGENT_ACTIVITY_LABEL_CODE_UNITS),
4528
+ ...input.background ? { background: true } : {},
4523
4529
  prompt: bounded(input.prompt, MAX_PROMPT_CODE_UNITS),
4524
4530
  batchId,
4525
4531
  ...input.toolUseId ? { toolUseId: bounded(input.toolUseId, MAX_IDENTITY_LABEL_CODE_UNITS) } : {},
@@ -4560,6 +4566,7 @@ var SubagentActivityMonitor = class {
4560
4566
  return;
4561
4567
  }
4562
4568
  owned.completedAt = handle.completedAt ?? Date.now();
4569
+ owned.queued = 0;
4563
4570
  owned.latestActivity = handle.result?.stopReason && handle.result.stopReason !== "end_turn" ? `Stopped \xB7 ${handle.result.stopReason}` : terminalLabel(owned.status);
4564
4571
  if (owned.rows.length === 0) {
4565
4572
  pushRow(owned, {
@@ -4654,7 +4661,7 @@ var SubagentActivityMonitor = class {
4654
4661
  * matching record (already pruned, or never tracked) is a silent no-op:
4655
4662
  * there is no row left to explain what was sent.
4656
4663
  */
4657
- recordMessage(taskId, text, direction) {
4664
+ recordMessage(taskId, text, direction, kind = "queued") {
4658
4665
  if (this.closed) return;
4659
4666
  const record = [...this.records.values()].find((entry) => entry.taskId === taskId);
4660
4667
  if (!record) return;
@@ -4664,8 +4671,36 @@ var SubagentActivityMonitor = class {
4664
4671
  text: bounded(text, MAX_ROW_CODE_UNITS),
4665
4672
  direction
4666
4673
  });
4674
+ if (kind === "queued" && !isTerminal(record.status)) record.queued = (record.queued ?? 0) + 1;
4667
4675
  this.notifyNow();
4668
4676
  }
4677
+ /**
4678
+ * Records who is stopping a running agent, so the line that closes it can
4679
+ * say. The first answer stands; an agent that has ended is left alone.
4680
+ */
4681
+ markStopped(viewId, by) {
4682
+ const record = this.records.get(viewId);
4683
+ if (!record || this.closed || isTerminal(record.status) || record.stoppedBy) return;
4684
+ record.stoppedBy = by;
4685
+ this.scheduleNotify();
4686
+ }
4687
+ /** The parent's wait on this agent ended before it did; see {@link SubagentActivity.released}. */
4688
+ markReleased(viewId) {
4689
+ const record = this.records.get(viewId);
4690
+ if (!record || this.closed || isTerminal(record.status) || record.released) return;
4691
+ record.released = true;
4692
+ this.scheduleNotify();
4693
+ }
4694
+ /**
4695
+ * Sets the live label of a running agent (see `activity-label.ts`). Ignored
4696
+ * once the agent has ended, and for an unknown row.
4697
+ */
4698
+ setSummary(viewId, label) {
4699
+ const record = this.records.get(viewId);
4700
+ if (!record || this.closed || isTerminal(record.status)) return;
4701
+ record.summary = bounded(label, MAX_AGENT_ACTIVITY_LABEL_CODE_UNITS);
4702
+ this.scheduleNotify();
4703
+ }
4669
4704
  /**
4670
4705
  * Retains one line of PARENT-authored commentary for the rail to show.
4671
4706
  *
@@ -4736,6 +4771,12 @@ var SubagentActivityMonitor = class {
4736
4771
  ...record.tokens !== void 0 ? { tokens: record.tokens } : {},
4737
4772
  ...record.toolCalls !== void 0 ? { toolCalls: record.toolCalls } : {},
4738
4773
  description: record.description,
4774
+ ...record.summary && !isTerminal(record.status) ? { summary: record.summary } : {},
4775
+ ...record.queued ? { queued: record.queued } : {},
4776
+ ...record.resumed ? { resumed: true } : {},
4777
+ ...record.background ? { background: true } : {},
4778
+ ...record.released ? { released: true } : {},
4779
+ ...record.stoppedBy ? { stoppedBy: record.stoppedBy } : {},
4739
4780
  prompt: record.prompt,
4740
4781
  batchId: record.batchId,
4741
4782
  ...record.toolUseId ? { toolUseId: record.toolUseId } : {},
@@ -5003,6 +5044,7 @@ function projectEvent(record, event) {
5003
5044
  };
5004
5045
  }
5005
5046
  }
5047
+ record.queued = 0;
5006
5048
  record.latestActivity = event.isError ? `${event.toolName} failed` : `${event.toolName} done`;
5007
5049
  return;
5008
5050
  }
@@ -5633,6 +5675,147 @@ var NamzuCliAgent = class extends QueryAgent {
5633
5675
  }
5634
5676
  };
5635
5677
 
5678
+ // src/integrations/subagents/activity-label.ts
5679
+ var LABEL_INTERVAL_MS = 3e4;
5680
+ var LABEL_MIN_MESSAGES = 3;
5681
+ var LABEL_MAX_CHARS = 100;
5682
+ var LABEL_CONTEXT_ROWS = 40;
5683
+ var LABEL_ROW_CHARS = 600;
5684
+ var LABEL_INSTRUCTION = [
5685
+ "Say what this agent is doing right now, as a short status label for a list.",
5686
+ 'Rules: three to five words; present tense (for example "Reading config loader"); name the file or function it is working on rather than a branch or a goal; one line, no quotes, no punctuation at the end, no markdown.',
5687
+ "Write the label in the predominant language of the notes below. A stray word or code token in another language does not change it, and neither does the language of these instructions.",
5688
+ "If a previous label is shown and the agent is still doing that, repeat it; otherwise say what is new.",
5689
+ "Use no tools. Reply with the label only."
5690
+ ].join("\n");
5691
+ function validateLabel(reply) {
5692
+ const trimmed = reply.trim();
5693
+ if (trimmed.length === 0 || trimmed.length > LABEL_MAX_CHARS) return void 0;
5694
+ if (/[\r\n]/u.test(trimmed)) return void 0;
5695
+ if (trimmed.startsWith("#") || trimmed.includes("```")) return void 0;
5696
+ return trimmed;
5697
+ }
5698
+ __name(validateLabel, "validateLabel");
5699
+ function labelPrompt(agent) {
5700
+ const rows = agent.transcript.slice(-LABEL_CONTEXT_ROWS).map((row) => {
5701
+ const who = row.kind === "assistant" ? "agent" : row.kind === "tool" ? "tool" : row.direction ? "message" : "note";
5702
+ const text = row.kind === "tool" && row.detail ? `${row.text} -> ${row.detail}` : row.text;
5703
+ return `${who}: ${text.replace(/\s+/gu, " ").slice(0, LABEL_ROW_CHARS)}`;
5704
+ }).join("\n");
5705
+ return [
5706
+ `Task given to the agent:
5707
+ ${agent.prompt.slice(0, 1500)}`,
5708
+ `What it has done so far (oldest first):
5709
+ ${rows}`,
5710
+ agent.summary ? `Previous label: ${agent.summary}` : "No previous label."
5711
+ ].join("\n\n");
5712
+ }
5713
+ __name(labelPrompt, "labelPrompt");
5714
+ function messageCount(agent) {
5715
+ return 1 + agent.transcript.length;
5716
+ }
5717
+ __name(messageCount, "messageCount");
5718
+ function signature(agent) {
5719
+ const last = agent.transcript.at(-1);
5720
+ return `${agent.transcript.length}:${last?.id ?? ""}:${last && "text" in last ? last.text.length : 0}`;
5721
+ }
5722
+ __name(signature, "signature");
5723
+ function startActivityLabeler(options) {
5724
+ const seen = /* @__PURE__ */ new Map();
5725
+ const inFlight = /* @__PURE__ */ new Map();
5726
+ const tick = /* @__PURE__ */ __name(() => {
5727
+ const live = /* @__PURE__ */ new Set();
5728
+ for (const agent of options.activity.getSnapshot()) {
5729
+ const running = agent.status === "working" || agent.status === "queued";
5730
+ if (!running) continue;
5731
+ live.add(agent.viewId);
5732
+ if (agent.background !== true || agent.replayed === true) continue;
5733
+ if (agent.workflowRunId !== void 0) continue;
5734
+ if (messageCount(agent) < LABEL_MIN_MESSAGES) continue;
5735
+ if (inFlight.has(agent.viewId)) continue;
5736
+ const sig = signature(agent);
5737
+ if (seen.get(agent.viewId) === sig) continue;
5738
+ seen.set(agent.viewId, sig);
5739
+ const controller = new AbortController();
5740
+ inFlight.set(agent.viewId, controller);
5741
+ void options.ask(agent, LABEL_INSTRUCTION, labelPrompt(agent), controller.signal).then((reply) => {
5742
+ if (!reply || controller.signal.aborted) return;
5743
+ const label = validateLabel(reply.text);
5744
+ if (label) options.activity.setSummary(agent.viewId, label);
5745
+ }).catch(() => void 0).finally(() => {
5746
+ inFlight.delete(agent.viewId);
5747
+ });
5748
+ }
5749
+ for (const [id, controller] of inFlight) {
5750
+ if (!live.has(id)) controller.abort();
5751
+ }
5752
+ for (const id of seen.keys()) if (!live.has(id)) seen.delete(id);
5753
+ }, "tick");
5754
+ const timer = setInterval(tick, options.intervalMs ?? LABEL_INTERVAL_MS);
5755
+ timer.unref?.();
5756
+ return {
5757
+ stop() {
5758
+ clearInterval(timer);
5759
+ for (const controller of inFlight.values()) controller.abort();
5760
+ inFlight.clear();
5761
+ }
5762
+ };
5763
+ }
5764
+ __name(startActivityLabeler, "startActivityLabeler");
5765
+
5766
+ // src/integrations/subagents/label-ledger.ts
5767
+ var LABEL_REQUEST_ALLOWANCE_TOKENS = 8e3;
5768
+ var NOTHING = {
5769
+ promptTokens: 0,
5770
+ completionTokens: 0,
5771
+ totalTokens: 0,
5772
+ cachedTokens: 0,
5773
+ cacheWriteTokens: 0
5774
+ };
5775
+ async function chargeLabelRequest(input) {
5776
+ const { budget, sessionId, signal } = input;
5777
+ let account;
5778
+ try {
5779
+ const remaining = budget.remaining;
5780
+ const limited = Number.isFinite(remaining);
5781
+ const allowance = limited ? Math.min(remaining, LABEL_REQUEST_ALLOWANCE_TOKENS) : 0;
5782
+ if (limited && allowance < input.estimatedPromptTokens) return void 0;
5783
+ account = budget.reserve(allowance);
5784
+ try {
5785
+ account.bindTurn(sessionId, generateTurnId());
5786
+ } catch (error) {
5787
+ account.settle();
5788
+ throw error;
5789
+ }
5790
+ } catch {
5791
+ return void 0;
5792
+ }
5793
+ let requestId;
5794
+ try {
5795
+ requestId = await account.beginRequest();
5796
+ } catch {
5797
+ account.settle();
5798
+ return void 0;
5799
+ }
5800
+ try {
5801
+ const result = await input.request();
5802
+ await account.finishRequest(requestId, result.usage);
5803
+ return result.value;
5804
+ } catch (error) {
5805
+ const cancelled2 = signal.aborted;
5806
+ const prompt = cancelled2 ? Math.max(0, Math.ceil(input.estimatedPromptTokens)) : 0;
5807
+ await account.finishRequest(requestId, {
5808
+ ...NOTHING,
5809
+ promptTokens: prompt,
5810
+ totalTokens: prompt
5811
+ }).catch(() => void 0);
5812
+ throw error;
5813
+ } finally {
5814
+ account.settle();
5815
+ }
5816
+ }
5817
+ __name(chargeLabelRequest, "chargeLabelRequest");
5818
+
5636
5819
  // src/integrations/subagents/policy.ts
5637
5820
  var CLI_INTERACTIVE_TURN_TIMEOUT_MS = 0;
5638
5821
 
@@ -5851,7 +6034,12 @@ var refuseUnownedChildReview = /* @__PURE__ */ __name(async () => ({
5851
6034
  action: "abort",
5852
6035
  reason: "The parent turn no longer owns an interactive review channel for this sub-agent."
5853
6036
  }), "refuseUnownedChildReview");
5854
- async function createSubagentRuntime(opts) {
6037
+ async function createSubagentRuntime(input) {
6038
+ const childMessageListeners = /* @__PURE__ */ new Set();
6039
+ const opts = {
6040
+ ...input,
6041
+ childExtraTools: /* @__PURE__ */ __name(() => childMessageListeners.size > 0 ? [toolset("agents:message-main", [messageMainTool])] : [], "childExtraTools")
6042
+ };
5855
6043
  const registry = new AgentRegistry();
5856
6044
  registry.register(
5857
6045
  buildDefinition(
@@ -6056,6 +6244,7 @@ async function createSubagentRuntime(opts) {
6056
6244
  const runtime = {
6057
6245
  gateway,
6058
6246
  completionInbox,
6247
+ budget,
6059
6248
  close() {
6060
6249
  if (released) return;
6061
6250
  released = true;
@@ -6101,8 +6290,38 @@ async function createSubagentRuntime(opts) {
6101
6290
  return (await pending).completionInbox;
6102
6291
  }, "completionInboxForTurn");
6103
6292
  const activity = new SubagentActivityMonitor();
6293
+ const labeler = startActivityLabeler({
6294
+ activity,
6295
+ ask: /* @__PURE__ */ __name(async (agent, instruction, body, signal) => {
6296
+ const owned = conversations.get(agent.viewId);
6297
+ if (!owned || closed || owned.config.model !== void 0) return void 0;
6298
+ const parent = await resolveParent(owned.turnId);
6299
+ const turn = await parents.get(owned.turnId)?.catch(() => void 0);
6300
+ if (!turn) return void 0;
6301
+ const provider = await opts.buildProvider(parent.sessionId);
6302
+ const model = owned.seed.model ?? opts.model;
6303
+ const text = await chargeLabelRequest({
6304
+ budget: turn.budget,
6305
+ sessionId: parent.sessionId,
6306
+ estimatedPromptTokens: Math.ceil((instruction.length + body.length) / 4),
6307
+ signal,
6308
+ request: /* @__PURE__ */ __name(async () => {
6309
+ const response = await collectChatCompletion(
6310
+ provider.chatStream({
6311
+ model,
6312
+ messages: [createSystemMessage(instruction), createUserMessage(body)],
6313
+ maxTokens: 60,
6314
+ signal
6315
+ })
6316
+ );
6317
+ return { value: response.message.content ?? "", usage: response.usage };
6318
+ }, "request")
6319
+ });
6320
+ return text === void 0 ? void 0 : { text };
6321
+ }, "ask")
6322
+ });
6104
6323
  let dynCounter = 0;
6105
- const launchChild = /* @__PURE__ */ __name(async (input, context, hooks = {}) => {
6324
+ const launchChild = /* @__PURE__ */ __name(async (input2, context, hooks = {}) => {
6106
6325
  const {
6107
6326
  description,
6108
6327
  prompt,
@@ -6117,7 +6336,7 @@ async function createSubagentRuntime(opts) {
6117
6336
  model: requestedModel,
6118
6337
  provider: requestedProvider,
6119
6338
  effort: requestedEffort
6120
- } = input;
6339
+ } = input2;
6121
6340
  if (!requestedModel && (requestedProvider || requestedEffort))
6122
6341
  throw new Error("Supply model when selecting a child provider or effort.");
6123
6342
  const explore = subagent_type === EXPLORE_SUBAGENT;
@@ -6167,6 +6386,7 @@ ${persona}` : persona || (explore ? EXPLORE_PROMPT : SUBAGENT_PROMPT),
6167
6386
  agentId,
6168
6387
  model: selection?.model ?? fileAgent?.model ?? parentModel,
6169
6388
  description,
6389
+ ...run_in_background === true ? { background: true } : {},
6170
6390
  prompt,
6171
6391
  batchId: context.toolBatchId,
6172
6392
  toolUseId: context.toolUseId,
@@ -6282,6 +6502,8 @@ ${persona}` : persona || (explore ? EXPLORE_PROMPT : SUBAGENT_PROMPT),
6282
6502
  } : tracker.onEvent
6283
6503
  }
6284
6504
  });
6505
+ if (outcome.kind === "yielded" && run_in_background !== true)
6506
+ activity.markReleased(tracker.viewId);
6285
6507
  return { outcome, agentId };
6286
6508
  } catch (error) {
6287
6509
  tracker.fail(error);
@@ -6312,7 +6534,7 @@ ${persona}` : persona || (explore ? EXPLORE_PROMPT : SUBAGENT_PROMPT),
6312
6534
  properties: {
6313
6535
  description: {
6314
6536
  type: "string",
6315
- description: "Short label for tracking (shown to the user)."
6537
+ description: "A short (3-5 word) description of the task."
6316
6538
  },
6317
6539
  prompt: {
6318
6540
  type: "string",
@@ -6386,9 +6608,9 @@ ${persona}` : persona || (explore ? EXPLORE_PROMPT : SUBAGENT_PROMPT),
6386
6608
  destructive: false,
6387
6609
  concurrencySafe: true,
6388
6610
  timeoutMs: opts.resolveLimits ? 0 : opts.timeoutMs ?? CLI_INTERACTIVE_TURN_TIMEOUT_MS,
6389
- async execute(input, context) {
6390
- const { description, run_in_background } = input;
6391
- const { outcome, agentId } = await launchChild(input, context);
6611
+ async execute(input2, context) {
6612
+ const { description, run_in_background } = input2;
6613
+ const { outcome, agentId } = await launchChild(input2, context);
6392
6614
  if (outcome.kind === "yielded") {
6393
6615
  const progress = outcome.handle.state === "pending" ? "queued for an available slot" : "still running";
6394
6616
  return {
@@ -6513,8 +6735,8 @@ ${JSON.stringify(launch.schema)}`;
6513
6735
  readOnly: true,
6514
6736
  destructive: false,
6515
6737
  concurrencySafe: true,
6516
- async execute(input, context) {
6517
- const request = input;
6738
+ async execute(input2, context) {
6739
+ const request = input2;
6518
6740
  if (request.history || request.session_id) {
6519
6741
  if (!opts.savedAgents)
6520
6742
  return {
@@ -6535,9 +6757,8 @@ ${JSON.stringify(launch.schema)}`;
6535
6757
  }
6536
6758
  const gateway = await gatewayForTurn(context.turnId);
6537
6759
  const tasks = gateway.listTasks();
6538
- const labels = new Map(
6539
- activity.getSnapshot().map((entry) => [entry.taskId, entry.description])
6540
- );
6760
+ const snapshot = activity.getSnapshot();
6761
+ const labels = new Map(snapshot.map((entry) => [entry.taskId, entry.description]));
6541
6762
  const shown = tasks.slice(-40).map((task) => ({
6542
6763
  description: labels.get(task.taskId) ?? task.agentId,
6543
6764
  task_id: task.taskId,
@@ -6570,7 +6791,7 @@ ${JSON.stringify(launch.schema)}`;
6570
6791
  properties: {
6571
6792
  task_id: {
6572
6793
  type: "string",
6573
- description: "The task_id from the Agent launch receipt or task notification metadata."
6794
+ description: "The task_id from the Agent launch receipt or task notification metadata. A workflow run id is not a task id."
6574
6795
  }
6575
6796
  },
6576
6797
  required: ["task_id"]
@@ -6581,11 +6802,19 @@ ${JSON.stringify(launch.schema)}`;
6581
6802
  destructive: false,
6582
6803
  concurrencySafe: true,
6583
6804
  timeoutMs: opts.resolveLimits ? 0 : opts.timeoutMs ?? CLI_INTERACTIVE_TURN_TIMEOUT_MS,
6584
- async execute(input, context) {
6805
+ async execute(input2, context) {
6585
6806
  const gateway = await gatewayForTurn(context.turnId);
6586
6807
  let taskId;
6808
+ const asked = input2.task_id;
6809
+ if (typeof asked === "string" && /^w[0-9a-z]{8}$/.test(asked.trim())) {
6810
+ return {
6811
+ success: true,
6812
+ output: `${asked.trim()} is a workflow run, not a task, so there is nothing to wait for here. You get one message when it ends, with what it returned. End your turn or do other work; do not call wait_for_task for it.`,
6813
+ data: { run_id: asked.trim(), waited: false }
6814
+ };
6815
+ }
6587
6816
  try {
6588
- taskId = asTaskId(input.task_id);
6817
+ taskId = asTaskId(asked);
6589
6818
  } catch {
6590
6819
  return {
6591
6820
  success: false,
@@ -6631,7 +6860,7 @@ ${JSON.stringify(launch.schema)}`;
6631
6860
  });
6632
6861
  const sendMessageTool = defineTool({
6633
6862
  name: "send_message",
6634
- description: "Queue a correction or additional context for a running or queued sub-agent task owned by this turn. The child receives it at its next request boundary; acceptance is not delivery. This does not start new work or restart finished tasks.",
6863
+ description: "Send a correction or additional context to a sub-agent owned by this turn, addressed by its task id. A running or queued agent receives it at its next tool round; acceptance is not delivery. A finished agent is resumed from its own transcript with the message. An agent the user stopped is not resumed.",
6635
6864
  inputSchema: mcpJsonSchemaToZod({
6636
6865
  type: "object",
6637
6866
  properties: {
@@ -6654,9 +6883,9 @@ ${JSON.stringify(launch.schema)}`;
6654
6883
  readOnly: false,
6655
6884
  destructive: false,
6656
6885
  concurrencySafe: false,
6657
- async execute(input, context) {
6886
+ async execute(input2, context) {
6658
6887
  context.abortSignal.throwIfAborted();
6659
- const { task_id, message: message2 } = input;
6888
+ const { task_id, message: message2 } = input2;
6660
6889
  if (!message2.trim())
6661
6890
  return {
6662
6891
  success: false,
@@ -6672,18 +6901,36 @@ ${JSON.stringify(launch.schema)}`;
6672
6901
  output: "",
6673
6902
  error: `Task ${taskId} does not belong to this parent turn.`
6674
6903
  };
6675
- if (isTerminalAgentTaskState(task.state))
6904
+ if (isTerminalAgentTaskState(task.state)) {
6905
+ const shown = activity.getSnapshot().find((entry) => entry.taskId === String(taskId));
6906
+ const label = shown?.agentId ?? String(taskId);
6907
+ if (!shown)
6908
+ return {
6909
+ success: false,
6910
+ output: "",
6911
+ error: `Task ${taskId} has finished and cannot be resumed from here.`
6912
+ };
6913
+ try {
6914
+ await messageChild(shown.viewId, message2, context.turnId, context.abortSignal, "parent");
6915
+ } catch (error) {
6916
+ return {
6917
+ success: false,
6918
+ output: "",
6919
+ error: error instanceof Error ? error.message : String(error)
6920
+ };
6921
+ }
6676
6922
  return {
6677
- success: false,
6678
- output: "",
6679
- error: "This task has finished; send_message cannot restart it."
6923
+ success: true,
6924
+ output: `Resuming agent ${label}. It will notify you again when it finishes.`,
6925
+ data: { task_id: taskId, status: "resumed" }
6680
6926
  };
6927
+ }
6681
6928
  context.abortSignal.throwIfAborted();
6682
6929
  await gateway.continueTask(taskId, message2);
6683
6930
  activity.recordMessage(String(taskId), message2, "to-child");
6684
6931
  return {
6685
6932
  success: true,
6686
- output: `Message queued for task ${taskId}; it will be available at the child's next request boundary.`,
6933
+ output: `Message queued for delivery to task ${taskId} at its next tool round. If it finishes first, it is resumed with the message and notifies again, so wait for that notification before resending.`,
6687
6934
  data: { task_id: taskId, status: "queued" }
6688
6935
  };
6689
6936
  }
@@ -6707,9 +6954,9 @@ ${JSON.stringify(launch.schema)}`;
6707
6954
  readOnly: false,
6708
6955
  destructive: false,
6709
6956
  concurrencySafe: false,
6710
- async execute(input, context) {
6957
+ async execute(input2, context) {
6711
6958
  context.abortSignal.throwIfAborted();
6712
- const taskId = asTaskId(input.task_id);
6959
+ const taskId = asTaskId(input2.task_id);
6713
6960
  const gateway = await gatewayForTurn(context.turnId);
6714
6961
  const task = gateway.getTask(taskId);
6715
6962
  if (!task)
@@ -6724,6 +6971,9 @@ ${JSON.stringify(launch.schema)}`;
6724
6971
  output: `Task ${taskId} already ended: ${agentTaskOutcome(task)}. No cancellation sent.`
6725
6972
  };
6726
6973
  context.abortSignal.throwIfAborted();
6974
+ for (const [shownId, owned] of conversations) {
6975
+ if (owned.task.taskId === taskId) activity.markStopped(shownId, "parent");
6976
+ }
6727
6977
  gateway.cancelTask(taskId, "user");
6728
6978
  return {
6729
6979
  success: true,
@@ -6732,6 +6982,72 @@ ${JSON.stringify(launch.schema)}`;
6732
6982
  };
6733
6983
  }
6734
6984
  });
6985
+ const messageMainTool = defineTool({
6986
+ name: "send_message",
6987
+ description: 'Send a message to the main conversation while you keep working. Your plain text output is not visible to the main conversation; to tell it something before you finish, you must call this tool with to "main". It is delivered with its next turn. Your final response goes to whoever launched you without this. Do not send routine progress: send what the main conversation needs to know or decide now.',
6988
+ inputSchema: mcpJsonSchemaToZod({
6989
+ type: "object",
6990
+ properties: {
6991
+ to: {
6992
+ type: "string",
6993
+ description: 'Recipient: "main", the main conversation.'
6994
+ },
6995
+ message: {
6996
+ type: "string",
6997
+ minLength: 1,
6998
+ maxLength: 16e3,
6999
+ description: "What to tell the main conversation."
7000
+ }
7001
+ },
7002
+ required: ["to", "message"],
7003
+ additionalProperties: false
7004
+ }),
7005
+ category: "custom",
7006
+ permissions: [],
7007
+ // Reads and writes nothing in the world; the text lands in the main
7008
+ // conversation's context, framed as the child's own words.
7009
+ readOnly: true,
7010
+ destructive: false,
7011
+ concurrencySafe: true,
7012
+ async execute(input2, context) {
7013
+ context.abortSignal.throwIfAborted();
7014
+ const { to, message: message2 } = input2;
7015
+ if (to !== "main")
7016
+ return {
7017
+ success: false,
7018
+ output: "",
7019
+ error: `No agent named '${to}' is currently addressable. Only "main" can be messaged from here.`
7020
+ };
7021
+ if (!message2.trim())
7022
+ return { success: false, output: "", error: "Message must not be blank." };
7023
+ const shown = activity.getSnapshot().find((entry) => entry.sessionId === String(context.sessionId));
7024
+ const owned = shown ? conversations.get(shown.viewId) : void 0;
7025
+ if (!shown || !owned || closed || childMessageListeners.size === 0 || shown.stoppedBy !== void 0)
7026
+ return {
7027
+ success: false,
7028
+ output: "",
7029
+ error: "Not sent. You cannot use send_message in this session: it is switched off for sub-agents, or you were stopped. Put what you need to pass on in your final response, which goes to whoever launched or resumed you."
7030
+ };
7031
+ const parent = await resolveParent(owned.turnId);
7032
+ for (const listener of [...childMessageListeners]) {
7033
+ try {
7034
+ listener({
7035
+ parentSessionId: String(parent.sessionId),
7036
+ viewId: shown.viewId,
7037
+ agentId: shown.agentId,
7038
+ description: shown.description,
7039
+ ...shown.taskId ? { taskId: shown.taskId } : {},
7040
+ text: message2
7041
+ });
7042
+ } catch {
7043
+ }
7044
+ }
7045
+ return {
7046
+ success: true,
7047
+ output: "Message queued for the main conversation's next turn."
7048
+ };
7049
+ }
7050
+ });
6735
7051
  const narrationTool = defineTool({
6736
7052
  name: NARRATION_TOOL_NAME,
6737
7053
  description: [
@@ -6787,9 +7103,9 @@ ${JSON.stringify(launch.schema)}`;
6787
7103
  label: "Narrating",
6788
7104
  presentation: "activity"
6789
7105
  }), "presentCall"),
6790
- async execute(input, context) {
7106
+ async execute(input2, context) {
6791
7107
  context.abortSignal.throwIfAborted();
6792
- const { line } = input;
7108
+ const { line } = input2;
6793
7109
  const outcome = activity.narrate(line);
6794
7110
  if (outcome.kind === "empty")
6795
7111
  return {
@@ -6810,7 +7126,7 @@ ${JSON.stringify(launch.schema)}`;
6810
7126
  };
6811
7127
  }
6812
7128
  });
6813
- const messageChild = /* @__PURE__ */ __name(async (viewId, message2, turnId, signal) => {
7129
+ const messageChild = /* @__PURE__ */ __name(async (viewId, message2, turnId, signal, source = "operator") => {
6814
7130
  if (closed) throw new Error("Sub-agent runtime is closed.");
6815
7131
  if (!message2.trim() || message2.length > 16e3)
6816
7132
  throw new Error("A child message must contain 1\u201316000 characters.");
@@ -6818,6 +7134,10 @@ ${JSON.stringify(launch.schema)}`;
6818
7134
  const shown = activity.getSnapshot().find((value) => value.viewId === viewId);
6819
7135
  if (!owned || !shown || shown.replayed)
6820
7136
  throw new Error("This child is saved evidence or is no longer owned by this host.");
7137
+ if (shown.status === "cancelled")
7138
+ throw new Error(
7139
+ source === "operator" ? `${shown.agentId} was stopped, so it cannot take a message. Start a new agent for that work.` : `Agent "${shown.agentId}" was stopped by the user and was not resumed. Treat its work as cancelled; only start a new agent for it if the user explicitly asks.`
7140
+ );
6821
7141
  if (owned.busy) throw new Error("A message to this child is already being admitted.");
6822
7142
  owned.busy = true;
6823
7143
  const id = randomUUID4();
@@ -6848,7 +7168,7 @@ ${JSON.stringify(launch.schema)}`;
6848
7168
  const parent = await resolveParent(turnId);
6849
7169
  if (owned.parentKey !== sessionKey(parent))
6850
7170
  throw new Error("This child belongs to a different parent conversation.");
6851
- if (opts.paths) {
7171
+ if (opts.paths && source === "operator") {
6852
7172
  const directory = opts.paths.sessionDir({
6853
7173
  sessionId: parent.sessionId
6854
7174
  });
@@ -6909,7 +7229,12 @@ ${JSON.stringify(launch.schema)}`;
6909
7229
  kind = "started";
6910
7230
  }
6911
7231
  admitted = true;
6912
- activity.recordMessage(String(task.taskId), message2, "operator-to-child");
7232
+ activity.recordMessage(
7233
+ String(task.taskId),
7234
+ message2,
7235
+ source === "operator" ? "operator-to-child" : "to-child",
7236
+ kind === "started" ? "started" : "queued"
7237
+ );
6913
7238
  let auditWarning;
6914
7239
  try {
6915
7240
  await audit("accepted", String(task.taskId));
@@ -6942,6 +7267,7 @@ ${JSON.stringify(launch.schema)}`;
6942
7267
  if (closePromise) return closePromise;
6943
7268
  closed = true;
6944
7269
  closePromise = (async () => {
7270
+ labeler.stop();
6945
7271
  await Promise.all([...parents.keys()].map(releaseTurn));
6946
7272
  await Promise.all(
6947
7273
  [...sessions.values()].map(async (entry) => (await entry.ready).manager.dispose())
@@ -6973,11 +7299,11 @@ ${JSON.stringify(launch.schema)}`;
6973
7299
  readOnly: true,
6974
7300
  destructive: false,
6975
7301
  concurrencySafe: true,
6976
- async execute(input, context) {
7302
+ async execute(input2, context) {
6977
7303
  return {
6978
7304
  success: true,
6979
7305
  output: await listModels(
6980
- input.query ?? "",
7306
+ input2.query ?? "",
6981
7307
  context.abortSignal
6982
7308
  )
6983
7309
  };
@@ -6990,10 +7316,17 @@ ${JSON.stringify(launch.schema)}`;
6990
7316
  if (!owned || !shown || shown.replayed) return false;
6991
7317
  const current = owned.gateway.getTask(owned.task.taskId) ?? owned.task;
6992
7318
  if (isTerminalAgentTaskState(current.state)) return false;
7319
+ activity.markStopped(viewId, "user");
6993
7320
  owned.gateway.cancelTask(owned.task.taskId, "user");
6994
7321
  return true;
6995
7322
  }, "stopChild");
6996
7323
  return {
7324
+ onChildMessage(listener) {
7325
+ childMessageListeners.add(listener);
7326
+ return () => {
7327
+ childMessageListeners.delete(listener);
7328
+ };
7329
+ },
6997
7330
  cancelAgentTool,
6998
7331
  modelCatalogueTool,
6999
7332
  messageChild,
@@ -7007,9 +7340,9 @@ ${JSON.stringify(launch.schema)}`;
7007
7340
  sendMessageTool,
7008
7341
  narrationTool,
7009
7342
  allowedAgentIds: agentTypeIds,
7010
- launchesReadOnlyAgent(input) {
7011
- if (typeof input !== "object" || input === null) return false;
7012
- const fields = input;
7343
+ launchesReadOnlyAgent(input2) {
7344
+ if (typeof input2 !== "object" || input2 === null) return false;
7345
+ const fields = input2;
7013
7346
  if (fields.workspace === "worktree") return false;
7014
7347
  if (fields.provider !== void 0 || fields.effort !== void 0) return false;
7015
7348
  const inherits = /* @__PURE__ */ __name((model) => model === void 0 || model === opts.model, "inherits");
@@ -7205,7 +7538,9 @@ ${SUBAGENT_PROMPT}`;
7205
7538
  const environment = opts.readEnvironment ? await opts.readEnvironment(childCwd) : null;
7206
7539
  const parent = options.parentTurnId ? await opts.resolveParent(asTurnId(options.parentTurnId)) : void 0;
7207
7540
  const provider = await opts.buildProvider(parent?.sessionId, selection);
7208
- const toolsets = tools();
7541
+ const roster = tools();
7542
+ const extra = opts.childExtraTools?.() ?? [];
7543
+ const toolsets = extra.length > 0 ? [...roster, ...extra] : roster;
7209
7544
  const webSearch = opts.configureWebSearch?.(provider, options.model ?? model, toolsets);
7210
7545
  const resolvedToolsets = webSearch ? toolsets.map((ts) => filtered(ts, (tool) => tool.name !== "web_search")) : toolsets;
7211
7546
  return {
@@ -7342,6 +7677,7 @@ var WorkflowRunRegistry = class {
7342
7677
  };
7343
7678
  this.runs.set(input.runId, run2);
7344
7679
  this.notifySoon(true);
7680
+ let firstAgentSeen = false;
7345
7681
  const settle = /* @__PURE__ */ __name(async (result, error) => {
7346
7682
  const at = this.now();
7347
7683
  if (run2.view.status === "running") {
@@ -7372,6 +7708,10 @@ var WorkflowRunRegistry = class {
7372
7708
  }, "onControl"),
7373
7709
  onEvent: /* @__PURE__ */ __name((event) => {
7374
7710
  run2.view = reduceRunView(run2.view, event);
7711
+ if (event.type === "workflow_agent" && !firstAgentSeen) {
7712
+ firstAgentSeen = true;
7713
+ input.onFirstAgent?.();
7714
+ }
7375
7715
  this.notifySoon(event.type !== "workflow_agent" || event.state !== "progress");
7376
7716
  }, "onEvent"),
7377
7717
  spawnAgent: /* @__PURE__ */ __name((request, signal) => input.spawn(request, signal, (viewId) => {
@@ -7424,6 +7764,18 @@ var WorkflowRunRegistry = class {
7424
7764
  }
7425
7765
  return void 0;
7426
7766
  }
7767
+ /**
7768
+ * Forget one run that has ended, so nothing lists it. For a run the tool
7769
+ * answered inline: it never became background work. False when the run is
7770
+ * unknown or still going.
7771
+ */
7772
+ discard(runId) {
7773
+ const run2 = this.runs.get(runId);
7774
+ if (!run2 || run2.view.status === "running") return false;
7775
+ this.runs.delete(runId);
7776
+ this.notifySoon(true);
7777
+ return true;
7778
+ }
7427
7779
  /** Forget runs that have ended (a new conversation). Running ones are stopped first. */
7428
7780
  reset() {
7429
7781
  for (const run2 of this.runs.values()) run2.abort.abort(new Error("The conversation changed."));
@@ -7473,6 +7825,24 @@ function createWorkflowRunId(isTaken = () => false) {
7473
7825
  }
7474
7826
  }
7475
7827
  __name(createWorkflowRunId, "createWorkflowRunId");
7828
+ function endedBeforeAgents(end, noArgs) {
7829
+ const { view } = end;
7830
+ if (view.status === "completed") {
7831
+ return {
7832
+ success: true,
7833
+ output: completionNotice(view),
7834
+ data: { run_id: view.runId, name: view.name, status: "completed", inline: true }
7835
+ };
7836
+ }
7837
+ const reason = view.error ?? "no reason was given";
7838
+ const hint = view.status === "failed" && noArgs ? '\nThis call passed no "args", so `args` was undefined in the script.' : "";
7839
+ return {
7840
+ success: false,
7841
+ output: "",
7842
+ error: view.status === "stopped" ? `Workflow "${view.name}" was stopped before it started any agent${view.error ? `: ${reason}` : "."}` : `${reason}${hint}`
7843
+ };
7844
+ }
7845
+ __name(endedBeforeAgents, "endedBeforeAgents");
7476
7846
  function toolName(label) {
7477
7847
  if (!label) return { name: "tool" };
7478
7848
  const open3 = label.indexOf("(");
@@ -7508,7 +7878,7 @@ function createWorkflowHost(options) {
7508
7878
  description: "The workflow script: `export const meta = {...}` first, then the code. Plain JavaScript, not wrapped in a function or a code fence."
7509
7879
  },
7510
7880
  args: {
7511
- description: "JSON the script reads as `args`. Keep it small; the operator reads it before the run starts."
7881
+ description: "JSON the script reads as `args`; undefined when omitted, so pass it or hard-code the values. Keep it small; the operator reads it before the run starts."
7512
7882
  },
7513
7883
  description: {
7514
7884
  type: "string",
@@ -7559,6 +7929,19 @@ function createWorkflowHost(options) {
7559
7929
  const limits = options.limitsFor?.(context.turnId);
7560
7930
  const journal = runs === void 0 ? void 0 : new FileWorkflowJournal(join9(runs, runId, "workflow"));
7561
7931
  const phaseDetail = /* @__PURE__ */ __name((title) => title === void 0 ? void 0 : meta.phases.find((phase) => phase.title.trim() === title.trim())?.detail, "phaseDetail");
7932
+ let launching = true;
7933
+ let settleLaunch = /* @__PURE__ */ __name(() => {
7934
+ }, "settleLaunch");
7935
+ const launch = new Promise((resolve9) => {
7936
+ settleLaunch = resolve9;
7937
+ });
7938
+ const detach = /* @__PURE__ */ __name(() => {
7939
+ if (!launching) return;
7940
+ launching = false;
7941
+ settleLaunch({ kind: "background" });
7942
+ }, "detach");
7943
+ const onAbort = /* @__PURE__ */ __name(() => detach(), "onAbort");
7944
+ context.abortSignal.addEventListener("abort", onAbort, { once: true });
7562
7945
  try {
7563
7946
  const view = registry.start({
7564
7947
  runId,
@@ -7569,7 +7952,7 @@ function createWorkflowHost(options) {
7569
7952
  ...journal ? { journal } : {},
7570
7953
  spawn: /* @__PURE__ */ __name(async (request, signal, viewed) => {
7571
7954
  const detail = phaseDetail(request.phaseTitle);
7572
- const outcome = await options.subagents.launchWorkflowAgent({
7955
+ const outcome2 = await options.subagents.launchWorkflowAgent({
7573
7956
  turnId: turn.turnId,
7574
7957
  runId,
7575
7958
  workflowName: meta.name,
@@ -7601,18 +7984,31 @@ function createWorkflowHost(options) {
7601
7984
  }, "onProgress")
7602
7985
  });
7603
7986
  return {
7604
- state: outcome.state,
7605
- ...outcome.text !== void 0 ? { text: outcome.text } : {},
7606
- tokens: outcome.tokens,
7607
- toolCalls: outcome.toolCalls,
7608
- ...outcome.error !== void 0 ? { error: outcome.error } : {}
7987
+ state: outcome2.state,
7988
+ ...outcome2.text !== void 0 ? { text: outcome2.text } : {},
7989
+ tokens: outcome2.tokens,
7990
+ toolCalls: outcome2.toolCalls,
7991
+ ...outcome2.error !== void 0 ? { error: outcome2.error } : {}
7609
7992
  };
7610
7993
  }, "spawn"),
7994
+ onFirstAgent: detach,
7611
7995
  onEnd: /* @__PURE__ */ __name(async (end) => {
7612
7996
  await turn.release().catch(() => void 0);
7997
+ if (launching) {
7998
+ launching = false;
7999
+ settleLaunch({ kind: "ended", end });
8000
+ return;
8001
+ }
7613
8002
  options.onEnd?.(end);
7614
8003
  }, "onEnd")
7615
8004
  });
8005
+ void view;
8006
+ const outcome = await launch;
8007
+ context.abortSignal.removeEventListener("abort", onAbort);
8008
+ if (outcome.kind === "ended") {
8009
+ registry.discard(runId);
8010
+ return endedBeforeAgents(outcome.end, args === void 0);
8011
+ }
7616
8012
  return {
7617
8013
  success: true,
7618
8014
  output: launchedText(view),
@@ -7624,6 +8020,7 @@ function createWorkflowHost(options) {
7624
8020
  }
7625
8021
  };
7626
8022
  } catch (error) {
8023
+ context.abortSignal.removeEventListener("abort", onAbort);
7627
8024
  await turn.release();
7628
8025
  throw error;
7629
8026
  }
@@ -8930,10 +9327,10 @@ function clipRequestContext(prompt, limit, kind) {
8930
9327
  __name(clipRequestContext, "clipRequestContext");
8931
9328
  async function createAgentSession(prefs, detected, options = {}) {
8932
9329
  if (options.palEnvironment) {
8933
- const { createPalAgentSession } = await import("./agent-session-PLIPF3XG.js");
9330
+ const { createPalAgentSession } = await import("./agent-session-NATAL4BA.js");
8934
9331
  return createPalAgentSession(prefs, detected, options);
8935
9332
  }
8936
- const { palAtWorkspace } = await import("./store-7WZWQXKX.js");
9333
+ const { palAtWorkspace } = await import("./store-VVOUETR5.js");
8937
9334
  if (palAtWorkspace(options.cwd ?? process.cwd()))
8938
9335
  throw new Error("This Pal requires its owned virtual computer. Open it with namzu pal chat.");
8939
9336
  const fileObservations = /* @__PURE__ */ new Map();
@@ -9863,7 +10260,7 @@ async function createAgentSession(prefs, detected, options = {}) {
9863
10260
  if (options.openUrl) toolsets.push(toolset("open-url", [createOpenUrlTool()]));
9864
10261
  const decisionTool = maybeCreateDecisionTool(options.decision, process.env);
9865
10262
  if (decisionTool) toolsets.push(toolset("decide", [decisionTool]));
9866
- const operatorPals = await import("./operator-tools-H4MYC5PE.js");
10263
+ const operatorPals = await import("./operator-tools-4NS32VMF.js");
9867
10264
  toolsets.push(
9868
10265
  readyWhen(
9869
10266
  toolset(
@@ -10503,6 +10900,8 @@ async function createAgentSession(prefs, detected, options = {}) {
10503
10900
  directChildReports.delete(listener);
10504
10901
  };
10505
10902
  }, "onSubagentReport"),
10903
+ onSubagentMessage: /* @__PURE__ */ __name((listener) => subagentRuntime?.onChildMessage(listener) ?? (() => {
10904
+ }), "onSubagentMessage"),
10506
10905
  stopSubagent: /* @__PURE__ */ __name((viewId) => subagentRuntime?.stopChild(viewId) ?? false, "stopSubagent"),
10507
10906
  messageSubagent: /* @__PURE__ */ __name((viewId, message2, opts) => operations.promise(opts?.signal, async (signal) => {
10508
10907
  const runtime = subagentRuntime;
@@ -12375,4 +12774,4 @@ export {
12375
12774
  RESULT_SUMMARY_WHOLE_MAX,
12376
12775
  resultSummaryLine
12377
12776
  };
12378
- //# sourceMappingURL=chunk-SFUUN6B3.js.map
12777
+ //# sourceMappingURL=chunk-RAKBF6PY.js.map