@namzu/cli 36.3.1 → 36.5.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 (253) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +1 -1
  3. package/dist/bin.js +1 -1
  4. package/dist/chunks/{acp-CJ2TTGJD.js → acp-QQHLC6HY.js} +31 -31
  5. package/dist/chunks/{activity-command-MCYEK4Z4.js → activity-command-7A2NGBRO.js} +10 -10
  6. package/dist/chunks/{add-ZQ3YWP4F.js → add-VK7JVGYN.js} +16 -16
  7. package/dist/chunks/{agent-UO62HZPI.js → agent-IYFZOSN7.js} +22 -22
  8. package/dist/chunks/agent-session-FXZ4RXQH.js +46 -0
  9. package/dist/chunks/{archive-VPREZOGC.js → archive-7A5RLRRZ.js} +8 -8
  10. package/dist/chunks/{bin-main-J5ULRXXN.js → bin-main-QWTSTI5W.js} +3 -3
  11. package/dist/chunks/{browser-FZWYOIIJ.js → browser-Z4JR5SV4.js} +6 -6
  12. package/dist/chunks/{chat-BGWKKQTT.js → chat-452HRD23.js} +13 -13
  13. package/dist/chunks/{chunk-HSEJGSXE.js → chunk-2IWLDZNE.js} +2 -2
  14. package/dist/chunks/{chunk-2BZOT2CT.js → chunk-2Y3V7YTY.js} +2 -2
  15. package/dist/chunks/{chunk-E7HLYLD7.js → chunk-3I5CIWA6.js} +3 -3
  16. package/dist/chunks/{chunk-QRT3N2K3.js → chunk-3N54T4H4.js} +2 -2
  17. package/dist/chunks/{chunk-KMHLON54.js → chunk-4BBUZZDS.js} +2 -2
  18. package/dist/chunks/{chunk-LNQ6SCBF.js → chunk-5TIOW3QX.js} +7 -7
  19. package/dist/chunks/{chunk-XCWZZZOW.js → chunk-6G3TX6QD.js} +3 -3
  20. package/dist/chunks/{chunk-F3YQ2CSZ.js → chunk-6YVH6LAU.js} +4 -4
  21. package/dist/chunks/{chunk-RM6HTBJK.js → chunk-7IKMMZ7R.js} +2 -2
  22. package/dist/chunks/{chunk-KHF4IAIH.js → chunk-7NGZ5XGK.js} +10 -12
  23. package/dist/chunks/chunk-7NGZ5XGK.js.map +6 -0
  24. package/dist/chunks/{chunk-HKDPP2JF.js → chunk-7RP7HIBA.js} +2 -2
  25. package/dist/chunks/{chunk-M32YRERZ.js → chunk-7TW2GZ5D.js} +30 -26
  26. package/dist/chunks/chunk-7TW2GZ5D.js.map +6 -0
  27. package/dist/chunks/{chunk-AHYHR5DY.js → chunk-AJLZB6G6.js} +3 -3
  28. package/dist/chunks/{chunk-IQBR45AU.js → chunk-AM6K4LK2.js} +2 -2
  29. package/dist/chunks/{chunk-S6MZK4LD.js → chunk-BQYV3WGF.js} +2 -2
  30. package/dist/chunks/{chunk-74KMYYM2.js → chunk-CAOXGCUA.js} +3 -3
  31. package/dist/chunks/{chunk-AP5KD43Y.js → chunk-DQNJEGUV.js} +2 -2
  32. package/dist/chunks/{chunk-S6DK2YOB.js → chunk-DSODVSO7.js} +9 -9
  33. package/dist/chunks/{chunk-V3ZLK3XQ.js → chunk-E2OJSRDE.js} +19 -16
  34. package/dist/chunks/{chunk-V3ZLK3XQ.js.map → chunk-E2OJSRDE.js.map} +2 -2
  35. package/dist/chunks/{chunk-I6CDUPVR.js → chunk-EZ26PYSK.js} +2 -2
  36. package/dist/chunks/{chunk-MJO6CH5F.js → chunk-FPMRK6W6.js} +3 -3
  37. package/dist/chunks/{chunk-CXSUA2PF.js → chunk-GELWAUNY.js} +3 -3
  38. package/dist/chunks/{chunk-FU4GQ7K2.js → chunk-GKVDZZN6.js} +2 -2
  39. package/dist/chunks/{chunk-UFTNEQFN.js → chunk-HBWHJCNO.js} +10 -10
  40. package/dist/chunks/{chunk-3F5DGROG.js → chunk-HNX3JZWU.js} +2 -2
  41. package/dist/chunks/{chunk-ZHBHRMCI.js → chunk-HUTSLFLA.js} +4 -4
  42. package/dist/chunks/{chunk-AS7UWXMN.js → chunk-IFBWLO7J.js} +4 -4
  43. package/dist/chunks/{chunk-6TDJXZ5W.js → chunk-J7GTTLAZ.js} +4 -4
  44. package/dist/chunks/{chunk-56OUKG5W.js → chunk-KGKBG3U7.js} +3 -3
  45. package/dist/chunks/{chunk-ZB5ETOVE.js → chunk-KI7GP25X.js} +3 -3
  46. package/dist/chunks/{chunk-RBX6RVYO.js → chunk-KJLJVK4Y.js} +6 -6
  47. package/dist/chunks/{chunk-YYVDLVUM.js → chunk-KR2AARGO.js} +2 -2
  48. package/dist/chunks/{chunk-AEPAIDAA.js → chunk-KRUTBAWS.js} +5 -5
  49. package/dist/chunks/{chunk-GSHSAMZJ.js → chunk-KX2JZX4Q.js} +12 -12
  50. package/dist/chunks/{chunk-LYDXPWAZ.js → chunk-LNBO3KD2.js} +4 -4
  51. package/dist/chunks/{chunk-ZG6NVROB.js → chunk-OF6QIV42.js} +2 -2
  52. package/dist/chunks/{chunk-BUCICQWG.js → chunk-OIGLY4EG.js} +2 -2
  53. package/dist/chunks/{chunk-KOG2WB66.js → chunk-OQHSD4WX.js} +4 -4
  54. package/dist/chunks/{chunk-52OVP5BG.js → chunk-P6AM76US.js} +4 -4
  55. package/dist/chunks/{chunk-YYQFUKI7.js → chunk-PDSZNG3C.js} +3 -3
  56. package/dist/chunks/{chunk-QXDKRJZ5.js → chunk-PGEDH5H5.js} +3 -3
  57. package/dist/chunks/{chunk-UXGI3FE5.js → chunk-QB6CLDHT.js} +8 -8
  58. package/dist/chunks/{chunk-LBH5WVXU.js → chunk-QLB4KNQA.js} +21 -6
  59. package/dist/chunks/chunk-QLB4KNQA.js.map +6 -0
  60. package/dist/chunks/{chunk-DYUOXP5Q.js → chunk-QNHDYR4J.js} +13 -13
  61. package/dist/chunks/{chunk-GQN64E36.js → chunk-QQ2TBG2P.js} +3 -3
  62. package/dist/chunks/{chunk-VUOS5SQ3.js → chunk-QXUJNVPO.js} +2 -2
  63. package/dist/chunks/{chunk-BOV53LZO.js → chunk-R5OZ6DCD.js} +2 -2
  64. package/dist/chunks/{chunk-JCDTR2ZU.js → chunk-R5QMJRF7.js} +4 -4
  65. package/dist/chunks/{chunk-NATYSTPM.js → chunk-TC7HMH6P.js} +2 -2
  66. package/dist/chunks/{chunk-H6MWKPHM.js → chunk-WBR7JG42.js} +520 -76
  67. package/dist/chunks/chunk-WBR7JG42.js.map +6 -0
  68. package/dist/chunks/{chunk-46B7KRXY.js → chunk-WEVDA4IS.js} +6 -6
  69. package/dist/chunks/{chunk-EKUJUPFA.js → chunk-XMN2OSBG.js} +4 -4
  70. package/dist/chunks/{chunk-5URT3ZM2.js → chunk-ZBWLULPM.js} +4 -4
  71. package/dist/chunks/{chunk-MBBFX64S.js → chunk-ZHWB7GXV.js} +2 -2
  72. package/dist/chunks/{cli-runtime-NG23IVRM.js → cli-runtime-KHQJO3WG.js} +8 -8
  73. package/dist/chunks/{commands-LQISMOPF.js → commands-GOFR6DU5.js} +5 -5
  74. package/dist/chunks/{crash-report-EYK56MJJ.js → crash-report-BEZJS4TE.js} +6 -6
  75. package/dist/chunks/{dist-PZXF5NU3.js → dist-2PTH7PME.js} +2 -2
  76. package/dist/chunks/{dist-DWB5AYXB.js → dist-AVGYNTRY.js} +2 -2
  77. package/dist/chunks/{dist-AZJ56DQJ.js → dist-B3WFU7LE.js} +2 -2
  78. package/dist/chunks/{dist-3AMBKAG4.js → dist-GR6IFO7M.js} +2 -2
  79. package/dist/chunks/{dist-AUDNCB3F.js → dist-OLFVZDAR.js} +2 -2
  80. package/dist/chunks/{dist-EDKLCZY4.js → dist-TFSA6QEB.js} +2 -2
  81. package/dist/chunks/{dist-XT4V74YL.js → dist-ZIZ457D5.js} +2 -2
  82. package/dist/chunks/{doctor-3EOUWDYB.js → doctor-Y366MZD7.js} +6 -6
  83. package/dist/chunks/{drain-VKGTCFXC.js → drain-CQELENIA.js} +10 -10
  84. package/dist/chunks/{eval-VHWEJ4GG.js → eval-IUIKSMIP.js} +2 -2
  85. package/dist/chunks/{exec-TBNI5CDH.js → exec-CUF3USRR.js} +22 -22
  86. package/dist/chunks/{home-H4GTIYO5.js → home-OZK7SYKC.js} +3 -3
  87. package/dist/chunks/{host-queries-AIZVYFDQ.js → host-queries-OZ3GTNQB.js} +13 -13
  88. package/dist/chunks/{lifecycle-UF7VDCOQ.js → lifecycle-EDPBG4CF.js} +23 -23
  89. package/dist/chunks/{list-JJZ7I5OF.js → list-OKA3E7GI.js} +12 -12
  90. package/dist/chunks/{login-T2RKNHK2.js → login-NMPAF4D4.js} +8 -8
  91. package/dist/chunks/{logs-J6D4SEDY.js → logs-BLEDKYPA.js} +4 -4
  92. package/dist/chunks/{mcp-WONRVJ26.js → mcp-SO43UZSA.js} +15 -15
  93. package/dist/chunks/{message-command-BGQB2TFW.js → message-command-4CG7SPQA.js} +29 -29
  94. package/dist/chunks/{operator-tools-H4MYC5PE.js → operator-tools-BRBJUOP5.js} +11 -11
  95. package/dist/chunks/{output-schema-RFJUTQ2N.js → output-schema-Q74INRDV.js} +3 -3
  96. package/dist/chunks/{pal-AV7AD5MG.js → pal-Q4LLIL3Z.js} +11 -11
  97. package/dist/chunks/{providers-BHF65IUG.js → providers-L4SRCWQ5.js} +6 -6
  98. package/dist/chunks/{resident-YF3MIILM.js → resident-KROFLWQD.js} +18 -18
  99. package/dist/chunks/{resume-command-Y3NYDSI4.js → resume-command-433WHYYJ.js} +4 -4
  100. package/dist/chunks/{schedule-6T2MNPKK.js → schedule-YTD3NQTH.js} +8 -8
  101. package/dist/chunks/{service-2VASPD2V.js → service-X2BXZORB.js} +22 -22
  102. package/dist/chunks/session-step-NTNPJVXZ.js +26 -0
  103. package/dist/chunks/{skills-K3JRZ3IR.js → skills-6U4GTACH.js} +8 -8
  104. package/dist/chunks/{state-QPSQI7U7.js → state-JKH362WC.js} +2 -2
  105. package/dist/chunks/{store-Z3PS6LUZ.js → store-LMUDVSKO.js} +4 -4
  106. package/dist/chunks/{store-PSQKDEPY.js → store-T6ITZS2N.js} +8 -8
  107. package/dist/chunks/{store-7WZWQXKX.js → store-ULDTJXKN.js} +6 -6
  108. package/dist/chunks/{tui-GNG3YLGE.js → tui-T5O5A7F3.js} +1958 -1546
  109. package/dist/chunks/tui-T5O5A7F3.js.map +6 -0
  110. package/dist/chunks/{upgrade-C6QUXRLB.js → upgrade-FUJFUSY5.js} +2 -2
  111. package/dist/chunks/{worktree-KLD2PAMU.js → worktree-KJYHKRHL.js} +10 -10
  112. package/dist/cli.d.ts.map +1 -1
  113. package/dist/index.js +9 -9
  114. package/dist/integrations/resident/runner-worker.js +16 -16
  115. package/dist/integrations/subagents/activity-label.d.ts +40 -0
  116. package/dist/integrations/subagents/activity-label.d.ts.map +1 -0
  117. package/dist/integrations/subagents/activity.d.ts +45 -1
  118. package/dist/integrations/subagents/activity.d.ts.map +1 -1
  119. package/dist/integrations/subagents/label-ledger.d.ts +45 -0
  120. package/dist/integrations/subagents/label-ledger.d.ts.map +1 -0
  121. package/dist/integrations/subagents/runtime.d.ts +23 -1
  122. package/dist/integrations/subagents/runtime.d.ts.map +1 -1
  123. package/dist/permissions/mode.d.ts +17 -2
  124. package/dist/permissions/mode.d.ts.map +1 -1
  125. package/dist/permissions/session-allow.d.ts +65 -0
  126. package/dist/permissions/session-allow.d.ts.map +1 -0
  127. package/dist/tui/AgentExplorer.d.ts +83 -15
  128. package/dist/tui/AgentExplorer.d.ts.map +1 -1
  129. package/dist/tui/App.d.ts.map +1 -1
  130. package/dist/tui/PermissionOverlay.d.ts +35 -16
  131. package/dist/tui/PermissionOverlay.d.ts.map +1 -1
  132. package/dist/tui/StatusBar.d.ts +7 -1
  133. package/dist/tui/StatusBar.d.ts.map +1 -1
  134. package/dist/tui/Transcript.d.ts +6 -0
  135. package/dist/tui/Transcript.d.ts.map +1 -1
  136. package/dist/tui/agent-transcript-rows.d.ts +66 -5
  137. package/dist/tui/agent-transcript-rows.d.ts.map +1 -1
  138. package/dist/tui/agent-view-commands.d.ts +35 -0
  139. package/dist/tui/agent-view-commands.d.ts.map +1 -0
  140. package/dist/tui/agent.d.ts +27 -19
  141. package/dist/tui/agent.d.ts.map +1 -1
  142. package/dist/tui/permission-review.d.ts +0 -16
  143. package/dist/tui/permission-review.d.ts.map +1 -1
  144. package/dist/tui/slashCommands.d.ts +0 -13
  145. package/dist/tui/slashCommands.d.ts.map +1 -1
  146. package/dist/tui/types.d.ts +2 -0
  147. package/dist/tui/types.d.ts.map +1 -1
  148. package/package.json +9 -9
  149. package/dist/chunks/agent-session-DU55LD4P.js +0 -46
  150. package/dist/chunks/chunk-H6MWKPHM.js.map +0 -6
  151. package/dist/chunks/chunk-KHF4IAIH.js.map +0 -6
  152. package/dist/chunks/chunk-LBH5WVXU.js.map +0 -6
  153. package/dist/chunks/chunk-M32YRERZ.js.map +0 -6
  154. package/dist/chunks/session-step-LJ24HVLF.js +0 -26
  155. package/dist/chunks/tui-GNG3YLGE.js.map +0 -6
  156. package/dist/tui/ChildComposer.d.ts +0 -22
  157. package/dist/tui/ChildComposer.d.ts.map +0 -1
  158. /package/dist/chunks/{acp-CJ2TTGJD.js.map → acp-QQHLC6HY.js.map} +0 -0
  159. /package/dist/chunks/{activity-command-MCYEK4Z4.js.map → activity-command-7A2NGBRO.js.map} +0 -0
  160. /package/dist/chunks/{add-ZQ3YWP4F.js.map → add-VK7JVGYN.js.map} +0 -0
  161. /package/dist/chunks/{agent-UO62HZPI.js.map → agent-IYFZOSN7.js.map} +0 -0
  162. /package/dist/chunks/{agent-session-DU55LD4P.js.map → agent-session-FXZ4RXQH.js.map} +0 -0
  163. /package/dist/chunks/{archive-VPREZOGC.js.map → archive-7A5RLRRZ.js.map} +0 -0
  164. /package/dist/chunks/{bin-main-J5ULRXXN.js.map → bin-main-QWTSTI5W.js.map} +0 -0
  165. /package/dist/chunks/{browser-FZWYOIIJ.js.map → browser-Z4JR5SV4.js.map} +0 -0
  166. /package/dist/chunks/{chat-BGWKKQTT.js.map → chat-452HRD23.js.map} +0 -0
  167. /package/dist/chunks/{chunk-HSEJGSXE.js.map → chunk-2IWLDZNE.js.map} +0 -0
  168. /package/dist/chunks/{chunk-2BZOT2CT.js.map → chunk-2Y3V7YTY.js.map} +0 -0
  169. /package/dist/chunks/{chunk-E7HLYLD7.js.map → chunk-3I5CIWA6.js.map} +0 -0
  170. /package/dist/chunks/{chunk-QRT3N2K3.js.map → chunk-3N54T4H4.js.map} +0 -0
  171. /package/dist/chunks/{chunk-KMHLON54.js.map → chunk-4BBUZZDS.js.map} +0 -0
  172. /package/dist/chunks/{chunk-LNQ6SCBF.js.map → chunk-5TIOW3QX.js.map} +0 -0
  173. /package/dist/chunks/{chunk-XCWZZZOW.js.map → chunk-6G3TX6QD.js.map} +0 -0
  174. /package/dist/chunks/{chunk-F3YQ2CSZ.js.map → chunk-6YVH6LAU.js.map} +0 -0
  175. /package/dist/chunks/{chunk-RM6HTBJK.js.map → chunk-7IKMMZ7R.js.map} +0 -0
  176. /package/dist/chunks/{chunk-HKDPP2JF.js.map → chunk-7RP7HIBA.js.map} +0 -0
  177. /package/dist/chunks/{chunk-AHYHR5DY.js.map → chunk-AJLZB6G6.js.map} +0 -0
  178. /package/dist/chunks/{chunk-IQBR45AU.js.map → chunk-AM6K4LK2.js.map} +0 -0
  179. /package/dist/chunks/{chunk-S6MZK4LD.js.map → chunk-BQYV3WGF.js.map} +0 -0
  180. /package/dist/chunks/{chunk-74KMYYM2.js.map → chunk-CAOXGCUA.js.map} +0 -0
  181. /package/dist/chunks/{chunk-AP5KD43Y.js.map → chunk-DQNJEGUV.js.map} +0 -0
  182. /package/dist/chunks/{chunk-S6DK2YOB.js.map → chunk-DSODVSO7.js.map} +0 -0
  183. /package/dist/chunks/{chunk-I6CDUPVR.js.map → chunk-EZ26PYSK.js.map} +0 -0
  184. /package/dist/chunks/{chunk-MJO6CH5F.js.map → chunk-FPMRK6W6.js.map} +0 -0
  185. /package/dist/chunks/{chunk-CXSUA2PF.js.map → chunk-GELWAUNY.js.map} +0 -0
  186. /package/dist/chunks/{chunk-FU4GQ7K2.js.map → chunk-GKVDZZN6.js.map} +0 -0
  187. /package/dist/chunks/{chunk-UFTNEQFN.js.map → chunk-HBWHJCNO.js.map} +0 -0
  188. /package/dist/chunks/{chunk-3F5DGROG.js.map → chunk-HNX3JZWU.js.map} +0 -0
  189. /package/dist/chunks/{chunk-ZHBHRMCI.js.map → chunk-HUTSLFLA.js.map} +0 -0
  190. /package/dist/chunks/{chunk-AS7UWXMN.js.map → chunk-IFBWLO7J.js.map} +0 -0
  191. /package/dist/chunks/{chunk-6TDJXZ5W.js.map → chunk-J7GTTLAZ.js.map} +0 -0
  192. /package/dist/chunks/{chunk-56OUKG5W.js.map → chunk-KGKBG3U7.js.map} +0 -0
  193. /package/dist/chunks/{chunk-ZB5ETOVE.js.map → chunk-KI7GP25X.js.map} +0 -0
  194. /package/dist/chunks/{chunk-RBX6RVYO.js.map → chunk-KJLJVK4Y.js.map} +0 -0
  195. /package/dist/chunks/{chunk-YYVDLVUM.js.map → chunk-KR2AARGO.js.map} +0 -0
  196. /package/dist/chunks/{chunk-AEPAIDAA.js.map → chunk-KRUTBAWS.js.map} +0 -0
  197. /package/dist/chunks/{chunk-GSHSAMZJ.js.map → chunk-KX2JZX4Q.js.map} +0 -0
  198. /package/dist/chunks/{chunk-LYDXPWAZ.js.map → chunk-LNBO3KD2.js.map} +0 -0
  199. /package/dist/chunks/{chunk-ZG6NVROB.js.map → chunk-OF6QIV42.js.map} +0 -0
  200. /package/dist/chunks/{chunk-BUCICQWG.js.map → chunk-OIGLY4EG.js.map} +0 -0
  201. /package/dist/chunks/{chunk-KOG2WB66.js.map → chunk-OQHSD4WX.js.map} +0 -0
  202. /package/dist/chunks/{chunk-52OVP5BG.js.map → chunk-P6AM76US.js.map} +0 -0
  203. /package/dist/chunks/{chunk-YYQFUKI7.js.map → chunk-PDSZNG3C.js.map} +0 -0
  204. /package/dist/chunks/{chunk-QXDKRJZ5.js.map → chunk-PGEDH5H5.js.map} +0 -0
  205. /package/dist/chunks/{chunk-UXGI3FE5.js.map → chunk-QB6CLDHT.js.map} +0 -0
  206. /package/dist/chunks/{chunk-DYUOXP5Q.js.map → chunk-QNHDYR4J.js.map} +0 -0
  207. /package/dist/chunks/{chunk-GQN64E36.js.map → chunk-QQ2TBG2P.js.map} +0 -0
  208. /package/dist/chunks/{chunk-VUOS5SQ3.js.map → chunk-QXUJNVPO.js.map} +0 -0
  209. /package/dist/chunks/{chunk-BOV53LZO.js.map → chunk-R5OZ6DCD.js.map} +0 -0
  210. /package/dist/chunks/{chunk-JCDTR2ZU.js.map → chunk-R5QMJRF7.js.map} +0 -0
  211. /package/dist/chunks/{chunk-NATYSTPM.js.map → chunk-TC7HMH6P.js.map} +0 -0
  212. /package/dist/chunks/{chunk-46B7KRXY.js.map → chunk-WEVDA4IS.js.map} +0 -0
  213. /package/dist/chunks/{chunk-EKUJUPFA.js.map → chunk-XMN2OSBG.js.map} +0 -0
  214. /package/dist/chunks/{chunk-5URT3ZM2.js.map → chunk-ZBWLULPM.js.map} +0 -0
  215. /package/dist/chunks/{chunk-MBBFX64S.js.map → chunk-ZHWB7GXV.js.map} +0 -0
  216. /package/dist/chunks/{cli-runtime-NG23IVRM.js.map → cli-runtime-KHQJO3WG.js.map} +0 -0
  217. /package/dist/chunks/{commands-LQISMOPF.js.map → commands-GOFR6DU5.js.map} +0 -0
  218. /package/dist/chunks/{crash-report-EYK56MJJ.js.map → crash-report-BEZJS4TE.js.map} +0 -0
  219. /package/dist/chunks/{dist-PZXF5NU3.js.map → dist-2PTH7PME.js.map} +0 -0
  220. /package/dist/chunks/{dist-DWB5AYXB.js.map → dist-AVGYNTRY.js.map} +0 -0
  221. /package/dist/chunks/{dist-AZJ56DQJ.js.map → dist-B3WFU7LE.js.map} +0 -0
  222. /package/dist/chunks/{dist-3AMBKAG4.js.map → dist-GR6IFO7M.js.map} +0 -0
  223. /package/dist/chunks/{dist-AUDNCB3F.js.map → dist-OLFVZDAR.js.map} +0 -0
  224. /package/dist/chunks/{dist-EDKLCZY4.js.map → dist-TFSA6QEB.js.map} +0 -0
  225. /package/dist/chunks/{dist-XT4V74YL.js.map → dist-ZIZ457D5.js.map} +0 -0
  226. /package/dist/chunks/{doctor-3EOUWDYB.js.map → doctor-Y366MZD7.js.map} +0 -0
  227. /package/dist/chunks/{drain-VKGTCFXC.js.map → drain-CQELENIA.js.map} +0 -0
  228. /package/dist/chunks/{eval-VHWEJ4GG.js.map → eval-IUIKSMIP.js.map} +0 -0
  229. /package/dist/chunks/{exec-TBNI5CDH.js.map → exec-CUF3USRR.js.map} +0 -0
  230. /package/dist/chunks/{home-H4GTIYO5.js.map → home-OZK7SYKC.js.map} +0 -0
  231. /package/dist/chunks/{host-queries-AIZVYFDQ.js.map → host-queries-OZ3GTNQB.js.map} +0 -0
  232. /package/dist/chunks/{lifecycle-UF7VDCOQ.js.map → lifecycle-EDPBG4CF.js.map} +0 -0
  233. /package/dist/chunks/{list-JJZ7I5OF.js.map → list-OKA3E7GI.js.map} +0 -0
  234. /package/dist/chunks/{login-T2RKNHK2.js.map → login-NMPAF4D4.js.map} +0 -0
  235. /package/dist/chunks/{logs-J6D4SEDY.js.map → logs-BLEDKYPA.js.map} +0 -0
  236. /package/dist/chunks/{mcp-WONRVJ26.js.map → mcp-SO43UZSA.js.map} +0 -0
  237. /package/dist/chunks/{message-command-BGQB2TFW.js.map → message-command-4CG7SPQA.js.map} +0 -0
  238. /package/dist/chunks/{operator-tools-H4MYC5PE.js.map → operator-tools-BRBJUOP5.js.map} +0 -0
  239. /package/dist/chunks/{output-schema-RFJUTQ2N.js.map → output-schema-Q74INRDV.js.map} +0 -0
  240. /package/dist/chunks/{pal-AV7AD5MG.js.map → pal-Q4LLIL3Z.js.map} +0 -0
  241. /package/dist/chunks/{providers-BHF65IUG.js.map → providers-L4SRCWQ5.js.map} +0 -0
  242. /package/dist/chunks/{resident-YF3MIILM.js.map → resident-KROFLWQD.js.map} +0 -0
  243. /package/dist/chunks/{resume-command-Y3NYDSI4.js.map → resume-command-433WHYYJ.js.map} +0 -0
  244. /package/dist/chunks/{schedule-6T2MNPKK.js.map → schedule-YTD3NQTH.js.map} +0 -0
  245. /package/dist/chunks/{service-2VASPD2V.js.map → service-X2BXZORB.js.map} +0 -0
  246. /package/dist/chunks/{session-step-LJ24HVLF.js.map → session-step-NTNPJVXZ.js.map} +0 -0
  247. /package/dist/chunks/{skills-K3JRZ3IR.js.map → skills-6U4GTACH.js.map} +0 -0
  248. /package/dist/chunks/{state-QPSQI7U7.js.map → state-JKH362WC.js.map} +0 -0
  249. /package/dist/chunks/{store-7WZWQXKX.js.map → store-LMUDVSKO.js.map} +0 -0
  250. /package/dist/chunks/{store-PSQKDEPY.js.map → store-T6ITZS2N.js.map} +0 -0
  251. /package/dist/chunks/{store-Z3PS6LUZ.js.map → store-ULDTJXKN.js.map} +0 -0
  252. /package/dist/chunks/{upgrade-C6QUXRLB.js.map → upgrade-FUJFUSY5.js.map} +0 -0
  253. /package/dist/chunks/{worktree-KLD2PAMU.js.map → worktree-KJYHKRHL.js.map} +0 -0
@@ -2,16 +2,16 @@ 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-P6AM76US.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-R5QMJRF7.js";
12
12
  import {
13
13
  createSessionSkillCatalog
14
- } from "./chunk-XCWZZZOW.js";
14
+ } from "./chunk-6G3TX6QD.js";
15
15
  import {
16
16
  SAVE_SKILL_TOOL_NAME,
17
17
  WORKFLOW_TOOL_DESCRIPTION,
@@ -27,10 +27,10 @@ import {
27
27
  viewFromJournal,
28
28
  workflowOffered,
29
29
  workflowRefusal
30
- } from "./chunk-74KMYYM2.js";
30
+ } from "./chunk-CAOXGCUA.js";
31
31
  import {
32
32
  openInBrowser
33
- } from "./chunk-AP5KD43Y.js";
33
+ } from "./chunk-DQNJEGUV.js";
34
34
  import {
35
35
  CredentialRefreshRejectedError,
36
36
  CredentialWithdrawnError,
@@ -38,7 +38,7 @@ import {
38
38
  ensureFreshStoredCodexCredential,
39
39
  readSubscriptionCredential,
40
40
  sameOAuthCredential
41
- } from "./chunk-5URT3ZM2.js";
41
+ } from "./chunk-ZBWLULPM.js";
42
42
  import {
43
43
  debugRequested
44
44
  } from "./chunk-GNBMKISG.js";
@@ -46,7 +46,7 @@ import {
46
46
  configuredPassthroughTools,
47
47
  resolveToolResultScreens,
48
48
  unmatchedPassthroughTools
49
- } from "./chunk-MBBFX64S.js";
49
+ } from "./chunk-ZHWB7GXV.js";
50
50
  import {
51
51
  formatSize,
52
52
  homePath,
@@ -74,7 +74,7 @@ import {
74
74
  requiresCredentialForModel,
75
75
  resolveChainCapabilities,
76
76
  unresolvedMembers
77
- } from "./chunk-DYUOXP5Q.js";
77
+ } from "./chunk-QNHDYR4J.js";
78
78
  import {
79
79
  PROVIDER_REGISTRY,
80
80
  missingCredentialMessage,
@@ -82,11 +82,11 @@ import {
82
82
  } from "./chunk-6LLJQ3KY.js";
83
83
  import {
84
84
  cliLogger
85
- } from "./chunk-FU4GQ7K2.js";
85
+ } from "./chunk-GKVDZZN6.js";
86
86
  import {
87
87
  isPermissionMode,
88
88
  permissionModeLabel
89
- } from "./chunk-LBH5WVXU.js";
89
+ } from "./chunk-QLB4KNQA.js";
90
90
  import {
91
91
  probeCapabilities
92
92
  } from "./chunk-OH6TB27S.js";
@@ -97,7 +97,7 @@ import {
97
97
  import {
98
98
  conversationLogPath,
99
99
  ensureSessionStarted
100
- } from "./chunk-EKUJUPFA.js";
100
+ } from "./chunk-XMN2OSBG.js";
101
101
  import {
102
102
  INSTRUCTIONS_FILENAME,
103
103
  MAX_CHARS_PER_FILE,
@@ -107,13 +107,13 @@ import {
107
107
  } from "./chunk-H6B6AROX.js";
108
108
  import {
109
109
  ensurePrivateStateDirectory
110
- } from "./chunk-S6MZK4LD.js";
110
+ } from "./chunk-BQYV3WGF.js";
111
111
  import {
112
112
  restrictToOwner
113
- } from "./chunk-BOV53LZO.js";
113
+ } from "./chunk-R5OZ6DCD.js";
114
114
  import {
115
115
  namzuHomePath
116
- } from "./chunk-HKDPP2JF.js";
116
+ } from "./chunk-7RP7HIBA.js";
117
117
  import {
118
118
  AgentManager,
119
119
  AgentRegistry,
@@ -183,7 +183,9 @@ import {
183
183
  buildResidentHistoryTools,
184
184
  buildResidentToolEvidenceTools,
185
185
  buildSessionGoalTools,
186
+ builtinCommandArguments,
186
187
  classifyEvidenceSource,
188
+ collectChatCompletion,
187
189
  compactNow,
188
190
  compactSession,
189
191
  computerUseUnavailableReason,
@@ -199,7 +201,9 @@ import {
199
201
  createReviewHandler,
200
202
  createSessionTextEvidenceSource,
201
203
  createSkillTool,
204
+ createSystemMessage,
202
205
  createToolPresenter,
206
+ createUserMessage,
203
207
  deferred,
204
208
  defineTool,
205
209
  discoverAgentDefinitions,
@@ -248,7 +252,7 @@ import {
248
252
  windowsShellNotice,
249
253
  withProviderFallback,
250
254
  wrapUntrusted
251
- } from "./chunk-V3ZLK3XQ.js";
255
+ } from "./chunk-E2OJSRDE.js";
252
256
  import {
253
257
  __name
254
258
  } from "./chunk-76FLAFCG.js";
@@ -3939,7 +3943,7 @@ async function searchConversationCore(sessions, sessionId, request, signal, acti
3939
3943
  result.excludedToolResults = (result.excludedToolResults ?? 0) + page.excludedToolResults;
3940
3944
  if (page.excludedSummaries)
3941
3945
  result.excludedSummaries = (result.excludedSummaries ?? 0) + page.excludedSummaries;
3942
- const matches = page.matches.map(
3946
+ const matches2 = page.matches.map(
3943
3947
  (match) => ({
3944
3948
  seq: match.seq,
3945
3949
  recordedAt: match.recordedAt,
@@ -3954,11 +3958,11 @@ async function searchConversationCore(sessions, sessionId, request, signal, acti
3954
3958
  ...match.characterOffset === void 0 ? {} : { byteOffset: match.byteOffset }
3955
3959
  })
3956
3960
  );
3957
- const bytes = Buffer.byteLength(JSON.stringify(matches));
3961
+ const bytes = Buffer.byteLength(JSON.stringify(matches2));
3958
3962
  if (outputBytes + bytes > OUTPUT_BYTES)
3959
3963
  throw new Error("Evidence exceeded its output allowance.");
3960
3964
  outputBytes += bytes;
3961
- result.matches.push(...matches);
3965
+ result.matches.push(...matches2);
3962
3966
  result.unavailable += page.unavailable.length;
3963
3967
  result.incomplete ||= page.incomplete || page.unavailable.length > 0;
3964
3968
  state.omitted ||= page.incomplete || page.unavailable.length > 0;
@@ -4493,6 +4497,7 @@ var SubagentActivityMonitor = class {
4493
4497
  if (!prior || !prior.closed || this.options.replay)
4494
4498
  throw new Error("This child conversation is not available for continuation.");
4495
4499
  const opened = this.open(input, viewId);
4500
+ opened.record.resumed = true;
4496
4501
  opened.record.rows = [...prior.rows];
4497
4502
  opened.record.sessionId = prior.sessionId;
4498
4503
  pushRow(opened.record, {
@@ -4521,6 +4526,7 @@ var SubagentActivityMonitor = class {
4521
4526
  model: bounded(input.model.trim(), MAX_AGENT_ACTIVITY_LABEL_CODE_UNITS)
4522
4527
  } : {},
4523
4528
  description: bounded(input.description, MAX_AGENT_ACTIVITY_LABEL_CODE_UNITS),
4529
+ ...input.background ? { background: true } : {},
4524
4530
  prompt: bounded(input.prompt, MAX_PROMPT_CODE_UNITS),
4525
4531
  batchId,
4526
4532
  ...input.toolUseId ? { toolUseId: bounded(input.toolUseId, MAX_IDENTITY_LABEL_CODE_UNITS) } : {},
@@ -4561,6 +4567,7 @@ var SubagentActivityMonitor = class {
4561
4567
  return;
4562
4568
  }
4563
4569
  owned.completedAt = handle.completedAt ?? Date.now();
4570
+ owned.queued = 0;
4564
4571
  owned.latestActivity = handle.result?.stopReason && handle.result.stopReason !== "end_turn" ? `Stopped \xB7 ${handle.result.stopReason}` : terminalLabel(owned.status);
4565
4572
  if (owned.rows.length === 0) {
4566
4573
  pushRow(owned, {
@@ -4655,7 +4662,7 @@ var SubagentActivityMonitor = class {
4655
4662
  * matching record (already pruned, or never tracked) is a silent no-op:
4656
4663
  * there is no row left to explain what was sent.
4657
4664
  */
4658
- recordMessage(taskId, text, direction) {
4665
+ recordMessage(taskId, text, direction, kind = "queued") {
4659
4666
  if (this.closed) return;
4660
4667
  const record = [...this.records.values()].find((entry) => entry.taskId === taskId);
4661
4668
  if (!record) return;
@@ -4665,8 +4672,36 @@ var SubagentActivityMonitor = class {
4665
4672
  text: bounded(text, MAX_ROW_CODE_UNITS),
4666
4673
  direction
4667
4674
  });
4675
+ if (kind === "queued" && !isTerminal(record.status)) record.queued = (record.queued ?? 0) + 1;
4668
4676
  this.notifyNow();
4669
4677
  }
4678
+ /**
4679
+ * Records who is stopping a running agent, so the line that closes it can
4680
+ * say. The first answer stands; an agent that has ended is left alone.
4681
+ */
4682
+ markStopped(viewId, by) {
4683
+ const record = this.records.get(viewId);
4684
+ if (!record || this.closed || isTerminal(record.status) || record.stoppedBy) return;
4685
+ record.stoppedBy = by;
4686
+ this.scheduleNotify();
4687
+ }
4688
+ /** The parent's wait on this agent ended before it did; see {@link SubagentActivity.released}. */
4689
+ markReleased(viewId) {
4690
+ const record = this.records.get(viewId);
4691
+ if (!record || this.closed || isTerminal(record.status) || record.released) return;
4692
+ record.released = true;
4693
+ this.scheduleNotify();
4694
+ }
4695
+ /**
4696
+ * Sets the live label of a running agent (see `activity-label.ts`). Ignored
4697
+ * once the agent has ended, and for an unknown row.
4698
+ */
4699
+ setSummary(viewId, label) {
4700
+ const record = this.records.get(viewId);
4701
+ if (!record || this.closed || isTerminal(record.status)) return;
4702
+ record.summary = bounded(label, MAX_AGENT_ACTIVITY_LABEL_CODE_UNITS);
4703
+ this.scheduleNotify();
4704
+ }
4670
4705
  /**
4671
4706
  * Retains one line of PARENT-authored commentary for the rail to show.
4672
4707
  *
@@ -4737,6 +4772,12 @@ var SubagentActivityMonitor = class {
4737
4772
  ...record.tokens !== void 0 ? { tokens: record.tokens } : {},
4738
4773
  ...record.toolCalls !== void 0 ? { toolCalls: record.toolCalls } : {},
4739
4774
  description: record.description,
4775
+ ...record.summary && !isTerminal(record.status) ? { summary: record.summary } : {},
4776
+ ...record.queued ? { queued: record.queued } : {},
4777
+ ...record.resumed ? { resumed: true } : {},
4778
+ ...record.background ? { background: true } : {},
4779
+ ...record.released ? { released: true } : {},
4780
+ ...record.stoppedBy ? { stoppedBy: record.stoppedBy } : {},
4740
4781
  prompt: record.prompt,
4741
4782
  batchId: record.batchId,
4742
4783
  ...record.toolUseId ? { toolUseId: record.toolUseId } : {},
@@ -5004,6 +5045,7 @@ function projectEvent(record, event) {
5004
5045
  };
5005
5046
  }
5006
5047
  }
5048
+ record.queued = 0;
5007
5049
  record.latestActivity = event.isError ? `${event.toolName} failed` : `${event.toolName} done`;
5008
5050
  return;
5009
5051
  }
@@ -5634,6 +5676,147 @@ var NamzuCliAgent = class extends QueryAgent {
5634
5676
  }
5635
5677
  };
5636
5678
 
5679
+ // src/integrations/subagents/activity-label.ts
5680
+ var LABEL_INTERVAL_MS = 3e4;
5681
+ var LABEL_MIN_MESSAGES = 3;
5682
+ var LABEL_MAX_CHARS = 100;
5683
+ var LABEL_CONTEXT_ROWS = 40;
5684
+ var LABEL_ROW_CHARS = 600;
5685
+ var LABEL_INSTRUCTION = [
5686
+ "Say what this agent is doing right now, as a short status label for a list.",
5687
+ '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.',
5688
+ "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.",
5689
+ "If a previous label is shown and the agent is still doing that, repeat it; otherwise say what is new.",
5690
+ "Use no tools. Reply with the label only."
5691
+ ].join("\n");
5692
+ function validateLabel(reply) {
5693
+ const trimmed = reply.trim();
5694
+ if (trimmed.length === 0 || trimmed.length > LABEL_MAX_CHARS) return void 0;
5695
+ if (/[\r\n]/u.test(trimmed)) return void 0;
5696
+ if (trimmed.startsWith("#") || trimmed.includes("```")) return void 0;
5697
+ return trimmed;
5698
+ }
5699
+ __name(validateLabel, "validateLabel");
5700
+ function labelPrompt(agent) {
5701
+ const rows = agent.transcript.slice(-LABEL_CONTEXT_ROWS).map((row) => {
5702
+ const who = row.kind === "assistant" ? "agent" : row.kind === "tool" ? "tool" : row.direction ? "message" : "note";
5703
+ const text = row.kind === "tool" && row.detail ? `${row.text} -> ${row.detail}` : row.text;
5704
+ return `${who}: ${text.replace(/\s+/gu, " ").slice(0, LABEL_ROW_CHARS)}`;
5705
+ }).join("\n");
5706
+ return [
5707
+ `Task given to the agent:
5708
+ ${agent.prompt.slice(0, 1500)}`,
5709
+ `What it has done so far (oldest first):
5710
+ ${rows}`,
5711
+ agent.summary ? `Previous label: ${agent.summary}` : "No previous label."
5712
+ ].join("\n\n");
5713
+ }
5714
+ __name(labelPrompt, "labelPrompt");
5715
+ function messageCount(agent) {
5716
+ return 1 + agent.transcript.length;
5717
+ }
5718
+ __name(messageCount, "messageCount");
5719
+ function signature(agent) {
5720
+ const last = agent.transcript.at(-1);
5721
+ return `${agent.transcript.length}:${last?.id ?? ""}:${last && "text" in last ? last.text.length : 0}`;
5722
+ }
5723
+ __name(signature, "signature");
5724
+ function startActivityLabeler(options) {
5725
+ const seen = /* @__PURE__ */ new Map();
5726
+ const inFlight = /* @__PURE__ */ new Map();
5727
+ const tick = /* @__PURE__ */ __name(() => {
5728
+ const live = /* @__PURE__ */ new Set();
5729
+ for (const agent of options.activity.getSnapshot()) {
5730
+ const running = agent.status === "working" || agent.status === "queued";
5731
+ if (!running) continue;
5732
+ live.add(agent.viewId);
5733
+ if (agent.background !== true || agent.replayed === true) continue;
5734
+ if (agent.workflowRunId !== void 0) continue;
5735
+ if (messageCount(agent) < LABEL_MIN_MESSAGES) continue;
5736
+ if (inFlight.has(agent.viewId)) continue;
5737
+ const sig = signature(agent);
5738
+ if (seen.get(agent.viewId) === sig) continue;
5739
+ seen.set(agent.viewId, sig);
5740
+ const controller = new AbortController();
5741
+ inFlight.set(agent.viewId, controller);
5742
+ void options.ask(agent, LABEL_INSTRUCTION, labelPrompt(agent), controller.signal).then((reply) => {
5743
+ if (!reply || controller.signal.aborted) return;
5744
+ const label = validateLabel(reply.text);
5745
+ if (label) options.activity.setSummary(agent.viewId, label);
5746
+ }).catch(() => void 0).finally(() => {
5747
+ inFlight.delete(agent.viewId);
5748
+ });
5749
+ }
5750
+ for (const [id, controller] of inFlight) {
5751
+ if (!live.has(id)) controller.abort();
5752
+ }
5753
+ for (const id of seen.keys()) if (!live.has(id)) seen.delete(id);
5754
+ }, "tick");
5755
+ const timer = setInterval(tick, options.intervalMs ?? LABEL_INTERVAL_MS);
5756
+ timer.unref?.();
5757
+ return {
5758
+ stop() {
5759
+ clearInterval(timer);
5760
+ for (const controller of inFlight.values()) controller.abort();
5761
+ inFlight.clear();
5762
+ }
5763
+ };
5764
+ }
5765
+ __name(startActivityLabeler, "startActivityLabeler");
5766
+
5767
+ // src/integrations/subagents/label-ledger.ts
5768
+ var LABEL_REQUEST_ALLOWANCE_TOKENS = 8e3;
5769
+ var NOTHING = {
5770
+ promptTokens: 0,
5771
+ completionTokens: 0,
5772
+ totalTokens: 0,
5773
+ cachedTokens: 0,
5774
+ cacheWriteTokens: 0
5775
+ };
5776
+ async function chargeLabelRequest(input) {
5777
+ const { budget, sessionId, signal } = input;
5778
+ let account;
5779
+ try {
5780
+ const remaining = budget.remaining;
5781
+ const limited = Number.isFinite(remaining);
5782
+ const allowance = limited ? Math.min(remaining, LABEL_REQUEST_ALLOWANCE_TOKENS) : 0;
5783
+ if (limited && allowance < input.estimatedPromptTokens) return void 0;
5784
+ account = budget.reserve(allowance);
5785
+ try {
5786
+ account.bindTurn(sessionId, generateTurnId());
5787
+ } catch (error) {
5788
+ account.settle();
5789
+ throw error;
5790
+ }
5791
+ } catch {
5792
+ return void 0;
5793
+ }
5794
+ let requestId;
5795
+ try {
5796
+ requestId = await account.beginRequest();
5797
+ } catch {
5798
+ account.settle();
5799
+ return void 0;
5800
+ }
5801
+ try {
5802
+ const result = await input.request();
5803
+ await account.finishRequest(requestId, result.usage);
5804
+ return result.value;
5805
+ } catch (error) {
5806
+ const cancelled2 = signal.aborted;
5807
+ const prompt = cancelled2 ? Math.max(0, Math.ceil(input.estimatedPromptTokens)) : 0;
5808
+ await account.finishRequest(requestId, {
5809
+ ...NOTHING,
5810
+ promptTokens: prompt,
5811
+ totalTokens: prompt
5812
+ }).catch(() => void 0);
5813
+ throw error;
5814
+ } finally {
5815
+ account.settle();
5816
+ }
5817
+ }
5818
+ __name(chargeLabelRequest, "chargeLabelRequest");
5819
+
5637
5820
  // src/integrations/subagents/policy.ts
5638
5821
  var CLI_INTERACTIVE_TURN_TIMEOUT_MS = 0;
5639
5822
 
@@ -5852,7 +6035,12 @@ var refuseUnownedChildReview = /* @__PURE__ */ __name(async () => ({
5852
6035
  action: "abort",
5853
6036
  reason: "The parent turn no longer owns an interactive review channel for this sub-agent."
5854
6037
  }), "refuseUnownedChildReview");
5855
- async function createSubagentRuntime(opts) {
6038
+ async function createSubagentRuntime(input) {
6039
+ const childMessageListeners = /* @__PURE__ */ new Set();
6040
+ const opts = {
6041
+ ...input,
6042
+ childExtraTools: /* @__PURE__ */ __name(() => childMessageListeners.size > 0 ? [toolset("agents:message-main", [messageMainTool])] : [], "childExtraTools")
6043
+ };
5856
6044
  const registry = new AgentRegistry();
5857
6045
  registry.register(
5858
6046
  buildDefinition(
@@ -6057,6 +6245,7 @@ async function createSubagentRuntime(opts) {
6057
6245
  const runtime = {
6058
6246
  gateway,
6059
6247
  completionInbox,
6248
+ budget,
6060
6249
  close() {
6061
6250
  if (released) return;
6062
6251
  released = true;
@@ -6102,8 +6291,38 @@ async function createSubagentRuntime(opts) {
6102
6291
  return (await pending).completionInbox;
6103
6292
  }, "completionInboxForTurn");
6104
6293
  const activity = new SubagentActivityMonitor();
6294
+ const labeler = startActivityLabeler({
6295
+ activity,
6296
+ ask: /* @__PURE__ */ __name(async (agent, instruction, body, signal) => {
6297
+ const owned = conversations.get(agent.viewId);
6298
+ if (!owned || closed || owned.config.model !== void 0) return void 0;
6299
+ const parent = await resolveParent(owned.turnId);
6300
+ const turn = await parents.get(owned.turnId)?.catch(() => void 0);
6301
+ if (!turn) return void 0;
6302
+ const provider = await opts.buildProvider(parent.sessionId);
6303
+ const model = owned.seed.model ?? opts.model;
6304
+ const text = await chargeLabelRequest({
6305
+ budget: turn.budget,
6306
+ sessionId: parent.sessionId,
6307
+ estimatedPromptTokens: Math.ceil((instruction.length + body.length) / 4),
6308
+ signal,
6309
+ request: /* @__PURE__ */ __name(async () => {
6310
+ const response = await collectChatCompletion(
6311
+ provider.chatStream({
6312
+ model,
6313
+ messages: [createSystemMessage(instruction), createUserMessage(body)],
6314
+ maxTokens: 60,
6315
+ signal
6316
+ })
6317
+ );
6318
+ return { value: response.message.content ?? "", usage: response.usage };
6319
+ }, "request")
6320
+ });
6321
+ return text === void 0 ? void 0 : { text };
6322
+ }, "ask")
6323
+ });
6105
6324
  let dynCounter = 0;
6106
- const launchChild = /* @__PURE__ */ __name(async (input, context, hooks = {}) => {
6325
+ const launchChild = /* @__PURE__ */ __name(async (input2, context, hooks = {}) => {
6107
6326
  const {
6108
6327
  description,
6109
6328
  prompt,
@@ -6118,7 +6337,7 @@ async function createSubagentRuntime(opts) {
6118
6337
  model: requestedModel,
6119
6338
  provider: requestedProvider,
6120
6339
  effort: requestedEffort
6121
- } = input;
6340
+ } = input2;
6122
6341
  if (!requestedModel && (requestedProvider || requestedEffort))
6123
6342
  throw new Error("Supply model when selecting a child provider or effort.");
6124
6343
  const explore = subagent_type === EXPLORE_SUBAGENT;
@@ -6168,6 +6387,7 @@ ${persona}` : persona || (explore ? EXPLORE_PROMPT : SUBAGENT_PROMPT),
6168
6387
  agentId,
6169
6388
  model: selection?.model ?? fileAgent?.model ?? parentModel,
6170
6389
  description,
6390
+ ...run_in_background === true ? { background: true } : {},
6171
6391
  prompt,
6172
6392
  batchId: context.toolBatchId,
6173
6393
  toolUseId: context.toolUseId,
@@ -6283,6 +6503,8 @@ ${persona}` : persona || (explore ? EXPLORE_PROMPT : SUBAGENT_PROMPT),
6283
6503
  } : tracker.onEvent
6284
6504
  }
6285
6505
  });
6506
+ if (outcome.kind === "yielded" && run_in_background !== true)
6507
+ activity.markReleased(tracker.viewId);
6286
6508
  return { outcome, agentId };
6287
6509
  } catch (error) {
6288
6510
  tracker.fail(error);
@@ -6313,7 +6535,7 @@ ${persona}` : persona || (explore ? EXPLORE_PROMPT : SUBAGENT_PROMPT),
6313
6535
  properties: {
6314
6536
  description: {
6315
6537
  type: "string",
6316
- description: "Short label for tracking (shown to the user)."
6538
+ description: "A short (3-5 word) description of the task."
6317
6539
  },
6318
6540
  prompt: {
6319
6541
  type: "string",
@@ -6387,9 +6609,9 @@ ${persona}` : persona || (explore ? EXPLORE_PROMPT : SUBAGENT_PROMPT),
6387
6609
  destructive: false,
6388
6610
  concurrencySafe: true,
6389
6611
  timeoutMs: opts.resolveLimits ? 0 : opts.timeoutMs ?? CLI_INTERACTIVE_TURN_TIMEOUT_MS,
6390
- async execute(input, context) {
6391
- const { description, run_in_background } = input;
6392
- const { outcome, agentId } = await launchChild(input, context);
6612
+ async execute(input2, context) {
6613
+ const { description, run_in_background } = input2;
6614
+ const { outcome, agentId } = await launchChild(input2, context);
6393
6615
  if (outcome.kind === "yielded") {
6394
6616
  const progress = outcome.handle.state === "pending" ? "queued for an available slot" : "still running";
6395
6617
  return {
@@ -6514,8 +6736,8 @@ ${JSON.stringify(launch.schema)}`;
6514
6736
  readOnly: true,
6515
6737
  destructive: false,
6516
6738
  concurrencySafe: true,
6517
- async execute(input, context) {
6518
- const request = input;
6739
+ async execute(input2, context) {
6740
+ const request = input2;
6519
6741
  if (request.history || request.session_id) {
6520
6742
  if (!opts.savedAgents)
6521
6743
  return {
@@ -6536,9 +6758,8 @@ ${JSON.stringify(launch.schema)}`;
6536
6758
  }
6537
6759
  const gateway = await gatewayForTurn(context.turnId);
6538
6760
  const tasks = gateway.listTasks();
6539
- const labels = new Map(
6540
- activity.getSnapshot().map((entry) => [entry.taskId, entry.description])
6541
- );
6761
+ const snapshot = activity.getSnapshot();
6762
+ const labels = new Map(snapshot.map((entry) => [entry.taskId, entry.description]));
6542
6763
  const shown = tasks.slice(-40).map((task) => ({
6543
6764
  description: labels.get(task.taskId) ?? task.agentId,
6544
6765
  task_id: task.taskId,
@@ -6582,10 +6803,10 @@ ${JSON.stringify(launch.schema)}`;
6582
6803
  destructive: false,
6583
6804
  concurrencySafe: true,
6584
6805
  timeoutMs: opts.resolveLimits ? 0 : opts.timeoutMs ?? CLI_INTERACTIVE_TURN_TIMEOUT_MS,
6585
- async execute(input, context) {
6806
+ async execute(input2, context) {
6586
6807
  const gateway = await gatewayForTurn(context.turnId);
6587
6808
  let taskId;
6588
- const asked = input.task_id;
6809
+ const asked = input2.task_id;
6589
6810
  if (typeof asked === "string" && /^w[0-9a-z]{8}$/.test(asked.trim())) {
6590
6811
  return {
6591
6812
  success: true,
@@ -6640,7 +6861,7 @@ ${JSON.stringify(launch.schema)}`;
6640
6861
  });
6641
6862
  const sendMessageTool = defineTool({
6642
6863
  name: "send_message",
6643
- 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.",
6864
+ 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.",
6644
6865
  inputSchema: mcpJsonSchemaToZod({
6645
6866
  type: "object",
6646
6867
  properties: {
@@ -6663,9 +6884,9 @@ ${JSON.stringify(launch.schema)}`;
6663
6884
  readOnly: false,
6664
6885
  destructive: false,
6665
6886
  concurrencySafe: false,
6666
- async execute(input, context) {
6887
+ async execute(input2, context) {
6667
6888
  context.abortSignal.throwIfAborted();
6668
- const { task_id, message: message2 } = input;
6889
+ const { task_id, message: message2 } = input2;
6669
6890
  if (!message2.trim())
6670
6891
  return {
6671
6892
  success: false,
@@ -6681,18 +6902,36 @@ ${JSON.stringify(launch.schema)}`;
6681
6902
  output: "",
6682
6903
  error: `Task ${taskId} does not belong to this parent turn.`
6683
6904
  };
6684
- if (isTerminalAgentTaskState(task.state))
6905
+ if (isTerminalAgentTaskState(task.state)) {
6906
+ const shown = activity.getSnapshot().find((entry) => entry.taskId === String(taskId));
6907
+ const label = shown?.agentId ?? String(taskId);
6908
+ if (!shown)
6909
+ return {
6910
+ success: false,
6911
+ output: "",
6912
+ error: `Task ${taskId} has finished and cannot be resumed from here.`
6913
+ };
6914
+ try {
6915
+ await messageChild(shown.viewId, message2, context.turnId, context.abortSignal, "parent");
6916
+ } catch (error) {
6917
+ return {
6918
+ success: false,
6919
+ output: "",
6920
+ error: error instanceof Error ? error.message : String(error)
6921
+ };
6922
+ }
6685
6923
  return {
6686
- success: false,
6687
- output: "",
6688
- error: "This task has finished; send_message cannot restart it."
6924
+ success: true,
6925
+ output: `Resuming agent ${label}. It will notify you again when it finishes.`,
6926
+ data: { task_id: taskId, status: "resumed" }
6689
6927
  };
6928
+ }
6690
6929
  context.abortSignal.throwIfAborted();
6691
6930
  await gateway.continueTask(taskId, message2);
6692
6931
  activity.recordMessage(String(taskId), message2, "to-child");
6693
6932
  return {
6694
6933
  success: true,
6695
- output: `Message queued for task ${taskId}; it will be available at the child's next request boundary.`,
6934
+ 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.`,
6696
6935
  data: { task_id: taskId, status: "queued" }
6697
6936
  };
6698
6937
  }
@@ -6716,9 +6955,9 @@ ${JSON.stringify(launch.schema)}`;
6716
6955
  readOnly: false,
6717
6956
  destructive: false,
6718
6957
  concurrencySafe: false,
6719
- async execute(input, context) {
6958
+ async execute(input2, context) {
6720
6959
  context.abortSignal.throwIfAborted();
6721
- const taskId = asTaskId(input.task_id);
6960
+ const taskId = asTaskId(input2.task_id);
6722
6961
  const gateway = await gatewayForTurn(context.turnId);
6723
6962
  const task = gateway.getTask(taskId);
6724
6963
  if (!task)
@@ -6733,6 +6972,9 @@ ${JSON.stringify(launch.schema)}`;
6733
6972
  output: `Task ${taskId} already ended: ${agentTaskOutcome(task)}. No cancellation sent.`
6734
6973
  };
6735
6974
  context.abortSignal.throwIfAborted();
6975
+ for (const [shownId, owned] of conversations) {
6976
+ if (owned.task.taskId === taskId) activity.markStopped(shownId, "parent");
6977
+ }
6736
6978
  gateway.cancelTask(taskId, "user");
6737
6979
  return {
6738
6980
  success: true,
@@ -6741,6 +6983,72 @@ ${JSON.stringify(launch.schema)}`;
6741
6983
  };
6742
6984
  }
6743
6985
  });
6986
+ const messageMainTool = defineTool({
6987
+ name: "send_message",
6988
+ 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.',
6989
+ inputSchema: mcpJsonSchemaToZod({
6990
+ type: "object",
6991
+ properties: {
6992
+ to: {
6993
+ type: "string",
6994
+ description: 'Recipient: "main", the main conversation.'
6995
+ },
6996
+ message: {
6997
+ type: "string",
6998
+ minLength: 1,
6999
+ maxLength: 16e3,
7000
+ description: "What to tell the main conversation."
7001
+ }
7002
+ },
7003
+ required: ["to", "message"],
7004
+ additionalProperties: false
7005
+ }),
7006
+ category: "custom",
7007
+ permissions: [],
7008
+ // Reads and writes nothing in the world; the text lands in the main
7009
+ // conversation's context, framed as the child's own words.
7010
+ readOnly: true,
7011
+ destructive: false,
7012
+ concurrencySafe: true,
7013
+ async execute(input2, context) {
7014
+ context.abortSignal.throwIfAborted();
7015
+ const { to, message: message2 } = input2;
7016
+ if (to !== "main")
7017
+ return {
7018
+ success: false,
7019
+ output: "",
7020
+ error: `No agent named '${to}' is currently addressable. Only "main" can be messaged from here.`
7021
+ };
7022
+ if (!message2.trim())
7023
+ return { success: false, output: "", error: "Message must not be blank." };
7024
+ const shown = activity.getSnapshot().find((entry) => entry.sessionId === String(context.sessionId));
7025
+ const owned = shown ? conversations.get(shown.viewId) : void 0;
7026
+ if (!shown || !owned || closed || childMessageListeners.size === 0 || shown.stoppedBy !== void 0)
7027
+ return {
7028
+ success: false,
7029
+ output: "",
7030
+ 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."
7031
+ };
7032
+ const parent = await resolveParent(owned.turnId);
7033
+ for (const listener of [...childMessageListeners]) {
7034
+ try {
7035
+ listener({
7036
+ parentSessionId: String(parent.sessionId),
7037
+ viewId: shown.viewId,
7038
+ agentId: shown.agentId,
7039
+ description: shown.description,
7040
+ ...shown.taskId ? { taskId: shown.taskId } : {},
7041
+ text: message2
7042
+ });
7043
+ } catch {
7044
+ }
7045
+ }
7046
+ return {
7047
+ success: true,
7048
+ output: "Message queued for the main conversation's next turn."
7049
+ };
7050
+ }
7051
+ });
6744
7052
  const narrationTool = defineTool({
6745
7053
  name: NARRATION_TOOL_NAME,
6746
7054
  description: [
@@ -6796,9 +7104,9 @@ ${JSON.stringify(launch.schema)}`;
6796
7104
  label: "Narrating",
6797
7105
  presentation: "activity"
6798
7106
  }), "presentCall"),
6799
- async execute(input, context) {
7107
+ async execute(input2, context) {
6800
7108
  context.abortSignal.throwIfAborted();
6801
- const { line } = input;
7109
+ const { line } = input2;
6802
7110
  const outcome = activity.narrate(line);
6803
7111
  if (outcome.kind === "empty")
6804
7112
  return {
@@ -6819,7 +7127,7 @@ ${JSON.stringify(launch.schema)}`;
6819
7127
  };
6820
7128
  }
6821
7129
  });
6822
- const messageChild = /* @__PURE__ */ __name(async (viewId, message2, turnId, signal) => {
7130
+ const messageChild = /* @__PURE__ */ __name(async (viewId, message2, turnId, signal, source = "operator") => {
6823
7131
  if (closed) throw new Error("Sub-agent runtime is closed.");
6824
7132
  if (!message2.trim() || message2.length > 16e3)
6825
7133
  throw new Error("A child message must contain 1\u201316000 characters.");
@@ -6827,6 +7135,10 @@ ${JSON.stringify(launch.schema)}`;
6827
7135
  const shown = activity.getSnapshot().find((value) => value.viewId === viewId);
6828
7136
  if (!owned || !shown || shown.replayed)
6829
7137
  throw new Error("This child is saved evidence or is no longer owned by this host.");
7138
+ if (shown.status === "cancelled")
7139
+ throw new Error(
7140
+ 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.`
7141
+ );
6830
7142
  if (owned.busy) throw new Error("A message to this child is already being admitted.");
6831
7143
  owned.busy = true;
6832
7144
  const id = randomUUID4();
@@ -6857,7 +7169,7 @@ ${JSON.stringify(launch.schema)}`;
6857
7169
  const parent = await resolveParent(turnId);
6858
7170
  if (owned.parentKey !== sessionKey(parent))
6859
7171
  throw new Error("This child belongs to a different parent conversation.");
6860
- if (opts.paths) {
7172
+ if (opts.paths && source === "operator") {
6861
7173
  const directory = opts.paths.sessionDir({
6862
7174
  sessionId: parent.sessionId
6863
7175
  });
@@ -6918,7 +7230,12 @@ ${JSON.stringify(launch.schema)}`;
6918
7230
  kind = "started";
6919
7231
  }
6920
7232
  admitted = true;
6921
- activity.recordMessage(String(task.taskId), message2, "operator-to-child");
7233
+ activity.recordMessage(
7234
+ String(task.taskId),
7235
+ message2,
7236
+ source === "operator" ? "operator-to-child" : "to-child",
7237
+ kind === "started" ? "started" : "queued"
7238
+ );
6922
7239
  let auditWarning;
6923
7240
  try {
6924
7241
  await audit("accepted", String(task.taskId));
@@ -6951,6 +7268,7 @@ ${JSON.stringify(launch.schema)}`;
6951
7268
  if (closePromise) return closePromise;
6952
7269
  closed = true;
6953
7270
  closePromise = (async () => {
7271
+ labeler.stop();
6954
7272
  await Promise.all([...parents.keys()].map(releaseTurn));
6955
7273
  await Promise.all(
6956
7274
  [...sessions.values()].map(async (entry) => (await entry.ready).manager.dispose())
@@ -6982,11 +7300,11 @@ ${JSON.stringify(launch.schema)}`;
6982
7300
  readOnly: true,
6983
7301
  destructive: false,
6984
7302
  concurrencySafe: true,
6985
- async execute(input, context) {
7303
+ async execute(input2, context) {
6986
7304
  return {
6987
7305
  success: true,
6988
7306
  output: await listModels(
6989
- input.query ?? "",
7307
+ input2.query ?? "",
6990
7308
  context.abortSignal
6991
7309
  )
6992
7310
  };
@@ -6999,10 +7317,17 @@ ${JSON.stringify(launch.schema)}`;
6999
7317
  if (!owned || !shown || shown.replayed) return false;
7000
7318
  const current = owned.gateway.getTask(owned.task.taskId) ?? owned.task;
7001
7319
  if (isTerminalAgentTaskState(current.state)) return false;
7320
+ activity.markStopped(viewId, "user");
7002
7321
  owned.gateway.cancelTask(owned.task.taskId, "user");
7003
7322
  return true;
7004
7323
  }, "stopChild");
7005
7324
  return {
7325
+ onChildMessage(listener) {
7326
+ childMessageListeners.add(listener);
7327
+ return () => {
7328
+ childMessageListeners.delete(listener);
7329
+ };
7330
+ },
7006
7331
  cancelAgentTool,
7007
7332
  modelCatalogueTool,
7008
7333
  messageChild,
@@ -7016,9 +7341,9 @@ ${JSON.stringify(launch.schema)}`;
7016
7341
  sendMessageTool,
7017
7342
  narrationTool,
7018
7343
  allowedAgentIds: agentTypeIds,
7019
- launchesReadOnlyAgent(input) {
7020
- if (typeof input !== "object" || input === null) return false;
7021
- const fields = input;
7344
+ launchesReadOnlyAgent(input2) {
7345
+ if (typeof input2 !== "object" || input2 === null) return false;
7346
+ const fields = input2;
7022
7347
  if (fields.workspace === "worktree") return false;
7023
7348
  if (fields.provider !== void 0 || fields.effort !== void 0) return false;
7024
7349
  const inherits = /* @__PURE__ */ __name((model) => model === void 0 || model === opts.model, "inherits");
@@ -7214,7 +7539,9 @@ ${SUBAGENT_PROMPT}`;
7214
7539
  const environment = opts.readEnvironment ? await opts.readEnvironment(childCwd) : null;
7215
7540
  const parent = options.parentTurnId ? await opts.resolveParent(asTurnId(options.parentTurnId)) : void 0;
7216
7541
  const provider = await opts.buildProvider(parent?.sessionId, selection);
7217
- const toolsets = tools();
7542
+ const roster = tools();
7543
+ const extra = opts.childExtraTools?.() ?? [];
7544
+ const toolsets = extra.length > 0 ? [...roster, ...extra] : roster;
7218
7545
  const webSearch = opts.configureWebSearch?.(provider, options.model ?? model, toolsets);
7219
7546
  const resolvedToolsets = webSearch ? toolsets.map((ts) => filtered(ts, (tool) => tool.name !== "web_search")) : toolsets;
7220
7547
  return {
@@ -8416,6 +8743,121 @@ function createLiveModeControl(options) {
8416
8743
  }
8417
8744
  __name(createLiveModeControl, "createLiveModeControl");
8418
8745
 
8746
+ // src/permissions/session-allow.ts
8747
+ var WEB_FETCH_TOOL = "web_fetch";
8748
+ var MAX_LABEL_COMMAND = 60;
8749
+ function isRecord2(value) {
8750
+ return typeof value === "object" && value !== null && !Array.isArray(value);
8751
+ }
8752
+ __name(isRecord2, "isRecord");
8753
+ function alwaysAsked(call) {
8754
+ return call.escalation !== void 0 || call.requiresApproval === true || call.authorization?.explicitReview === true || call.isDestructive === true;
8755
+ }
8756
+ __name(alwaysAsked, "alwaysAsked");
8757
+ function allowFor(call, commands) {
8758
+ if (alwaysAsked(call)) return void 0;
8759
+ const input = isRecord2(call.input) ? call.input : void 0;
8760
+ const commandArgument = commands.get(call.name);
8761
+ if (commandArgument !== void 0) {
8762
+ const line = input?.[commandArgument];
8763
+ if (typeof line !== "string") return void 0;
8764
+ const command = line.trim();
8765
+ if (command === "" || /[\n\r;&|<>`$()*?{}\\]/.test(command)) return void 0;
8766
+ if (input?.dangerously_disable_sandbox === true) return void 0;
8767
+ return { kind: "command", tool: call.name, command };
8768
+ }
8769
+ if (call.name === WEB_FETCH_TOOL) {
8770
+ const url = input?.url;
8771
+ if (typeof url !== "string") return void 0;
8772
+ try {
8773
+ const host = new URL(url).hostname;
8774
+ if (host === "" || host.includes("*")) return void 0;
8775
+ return { kind: "host", tool: call.name, host };
8776
+ } catch {
8777
+ return void 0;
8778
+ }
8779
+ }
8780
+ if (call.name.startsWith("mcp__")) return { kind: "tool", tool: call.name };
8781
+ return void 0;
8782
+ }
8783
+ __name(allowFor, "allowFor");
8784
+ function allowsForBatch(calls, commands) {
8785
+ if (calls.length === 0) return void 0;
8786
+ const out = [];
8787
+ for (const call of calls) {
8788
+ const allow = allowFor(call, commands);
8789
+ if (!allow) return void 0;
8790
+ if (!out.some((existing) => sameAllow(existing, allow))) out.push(allow);
8791
+ }
8792
+ return out;
8793
+ }
8794
+ __name(allowsForBatch, "allowsForBatch");
8795
+ function sameAllow(a, b) {
8796
+ if (a.kind !== b.kind || a.tool !== b.tool) return false;
8797
+ if (a.kind === "command" && b.kind === "command") return a.command === b.command;
8798
+ if (a.kind === "host" && b.kind === "host") return a.host === b.host;
8799
+ return true;
8800
+ }
8801
+ __name(sameAllow, "sameAllow");
8802
+ function shorten(text) {
8803
+ return text.length > MAX_LABEL_COMMAND ? `${text.slice(0, MAX_LABEL_COMMAND - 1)}\u2026` : text;
8804
+ }
8805
+ __name(shorten, "shorten");
8806
+ function describeAllows(allows) {
8807
+ const parts = allows.map((allow) => {
8808
+ switch (allow.kind) {
8809
+ case "command":
8810
+ return `${shorten(allow.command)} commands`;
8811
+ case "host":
8812
+ return allow.host;
8813
+ case "tool":
8814
+ return allow.tool.replace(/^mcp__/, "").replace(/__/g, " ");
8815
+ }
8816
+ });
8817
+ return parts.length <= 1 ? parts[0] ?? "" : `${parts.slice(0, -1).join(", ")} and ${parts.at(-1)}`;
8818
+ }
8819
+ __name(describeAllows, "describeAllows");
8820
+ function matches(allow, toolName2, toolInput, commands) {
8821
+ if (allow.tool !== toolName2) return false;
8822
+ switch (allow.kind) {
8823
+ case "tool":
8824
+ return true;
8825
+ case "host": {
8826
+ const url = isRecord2(toolInput) ? toolInput.url : void 0;
8827
+ if (typeof url !== "string") return false;
8828
+ try {
8829
+ return new URL(url).hostname === allow.host;
8830
+ } catch {
8831
+ return false;
8832
+ }
8833
+ }
8834
+ case "command": {
8835
+ const argument = commands.get(toolName2);
8836
+ if (argument === void 0 || !isRecord2(toolInput)) return false;
8837
+ const line = toolInput[argument];
8838
+ return typeof line === "string" && line.trim() === allow.command && toolInput.dangerously_disable_sandbox !== true;
8839
+ }
8840
+ }
8841
+ }
8842
+ __name(matches, "matches");
8843
+ function createSessionAllows(commands) {
8844
+ const entries = [];
8845
+ return {
8846
+ add(allows) {
8847
+ for (const allow of allows) {
8848
+ if (!entries.some((existing) => sameAllow(existing, allow))) entries.push(allow);
8849
+ }
8850
+ },
8851
+ list: /* @__PURE__ */ __name(() => [...entries], "list"),
8852
+ rule: {
8853
+ type: "predicate",
8854
+ description: "allowed for this session by an answer at a prompt",
8855
+ decide: /* @__PURE__ */ __name((call) => entries.some((allow) => matches(allow, call.toolName, call.toolInput, commands)) ? "allow" : null, "decide")
8856
+ }
8857
+ };
8858
+ }
8859
+ __name(createSessionAllows, "createSessionAllows");
8860
+
8419
8861
  // src/skills/directory.ts
8420
8862
  function createSkillDirectoryResolver(options) {
8421
8863
  return async (skill, context) => {
@@ -8572,17 +9014,17 @@ async function resolveModelSwitch(request, options) {
8572
9014
  const first = selected ?? usable.find(({ entry }) => entry.id === options.currentProvider);
8573
9015
  if (first && await inspect(first)) return resolve9(first);
8574
9016
  const candidates = selected ? [selected] : usable;
8575
- const matches = selected ? [] : (await Promise.all(
9017
+ const matches2 = selected ? [] : (await Promise.all(
8576
9018
  candidates.filter((candidate) => candidate !== first).map(async (candidate) => await inspect(candidate) ? candidate : void 0)
8577
9019
  )).filter((candidate) => candidate !== void 0);
8578
9020
  signal?.throwIfAborted();
8579
- const uniqueMatch = matches.length === 1 ? matches[0] : void 0;
9021
+ const uniqueMatch = matches2.length === 1 ? matches2[0] : void 0;
8580
9022
  if (uniqueMatch) return resolve9(uniqueMatch);
8581
- if (matches.length > 1) {
9023
+ if (matches2.length > 1) {
8582
9024
  return {
8583
9025
  kind: "rejected",
8584
- reason: `Model "${model}" is available from multiple providers. Specify one: ${matches.map(({ entry }) => entry.id).join(", ")}.`,
8585
- choices: matches.map(({ entry }) => ({ provider: entry.id, model }))
9026
+ reason: `Model "${model}" is available from multiple providers. Specify one: ${matches2.map(({ entry }) => entry.id).join(", ")}.`,
9027
+ choices: matches2.map(({ entry }) => ({ provider: entry.id, model }))
8586
9028
  };
8587
9029
  }
8588
9030
  const choices = candidates.flatMap((candidate) => {
@@ -9001,12 +9443,15 @@ function clipRequestContext(prompt, limit, kind) {
9001
9443
  __name(clipRequestContext, "clipRequestContext");
9002
9444
  async function createAgentSession(prefs, detected, options = {}) {
9003
9445
  if (options.palEnvironment) {
9004
- const { createPalAgentSession } = await import("./agent-session-DU55LD4P.js");
9446
+ const { createPalAgentSession } = await import("./agent-session-FXZ4RXQH.js");
9005
9447
  return createPalAgentSession(prefs, detected, options);
9006
9448
  }
9007
- const { palAtWorkspace } = await import("./store-7WZWQXKX.js");
9449
+ const { palAtWorkspace } = await import("./store-ULDTJXKN.js");
9008
9450
  if (palAtWorkspace(options.cwd ?? process.cwd()))
9009
9451
  throw new Error("This Pal requires its owned virtual computer. Open it with namzu pal chat.");
9452
+ const commandArguments = builtinCommandArguments();
9453
+ const sessionAllows = createSessionAllows(commandArguments);
9454
+ const sessionRules = [...options.rules ?? [], sessionAllows.rule];
9010
9455
  const fileObservations = /* @__PURE__ */ new Map();
9011
9456
  const observationsFor = /* @__PURE__ */ __name((id, prior) => {
9012
9457
  let seeded = fileObservations.get(id);
@@ -9741,10 +10186,10 @@ async function createAgentSession(prefs, detected, options = {}) {
9741
10186
  }
9742
10187
  })
9743
10188
  );
9744
- const matches = catalogues.flat();
10189
+ const matches2 = catalogues.flat();
9745
10190
  return JSON.stringify({
9746
- models: matches.slice(0, 40),
9747
- omitted: Math.max(0, matches.length - 40),
10191
+ models: matches2.slice(0, 40),
10192
+ omitted: Math.max(0, matches2.length - 40),
9748
10193
  guidance: "Use exact IDs. Omitted capability fields are unknown, not unsupported. Narrow query when results are omitted."
9749
10194
  });
9750
10195
  }, "listModels"),
@@ -9780,7 +10225,7 @@ async function createAgentSession(prefs, detected, options = {}) {
9780
10225
  childToolsets.push(toolset("web-search", [createWebSearchTool()]));
9781
10226
  return childToolsets;
9782
10227
  }, "buildTools"),
9783
- authorizationGate: gateFor(options.rules)
10228
+ authorizationGate: gateFor(sessionRules)
9784
10229
  });
9785
10230
  subagentRuntime = sub;
9786
10231
  const agentToolsets = [toolset("agents", [sub.agentTool, sub.waitForTaskTool])];
@@ -9934,7 +10379,7 @@ async function createAgentSession(prefs, detected, options = {}) {
9934
10379
  if (options.openUrl) toolsets.push(toolset("open-url", [createOpenUrlTool()]));
9935
10380
  const decisionTool = maybeCreateDecisionTool(options.decision, process.env);
9936
10381
  if (decisionTool) toolsets.push(toolset("decide", [decisionTool]));
9937
- const operatorPals = await import("./operator-tools-H4MYC5PE.js");
10382
+ const operatorPals = await import("./operator-tools-BRBJUOP5.js");
9938
10383
  toolsets.push(
9939
10384
  readyWhen(
9940
10385
  toolset(
@@ -10294,7 +10739,7 @@ async function createAgentSession(prefs, detected, options = {}) {
10294
10739
  ...subagentRuntime ? {
10295
10740
  taskScheduler: await subagentRuntime.gatewayForTurn(entry2.turnId)
10296
10741
  } : {},
10297
- authorizationGate: gateFor(rules ?? options.rules),
10742
+ authorizationGate: gateFor(rules ?? sessionRules),
10298
10743
  ...pendingDecision ? { pendingDecision } : {},
10299
10744
  compactionConfig: compactionConfigFor(options.compaction),
10300
10745
  retainedToolPreviewChars: options.conversationSessions ? options.compaction?.retainedToolPreviewChars ?? 4e3 : void 0,
@@ -10574,6 +11019,8 @@ async function createAgentSession(prefs, detected, options = {}) {
10574
11019
  directChildReports.delete(listener);
10575
11020
  };
10576
11021
  }, "onSubagentReport"),
11022
+ onSubagentMessage: /* @__PURE__ */ __name((listener) => subagentRuntime?.onChildMessage(listener) ?? (() => {
11023
+ }), "onSubagentMessage"),
10577
11024
  stopSubagent: /* @__PURE__ */ __name((viewId) => subagentRuntime?.stopChild(viewId) ?? false, "stopSubagent"),
10578
11025
  messageSubagent: /* @__PURE__ */ __name((viewId, message2, opts) => operations.promise(opts?.signal, async (signal) => {
10579
11026
  const runtime = subagentRuntime;
@@ -10757,10 +11204,8 @@ async function createAgentSession(prefs, detected, options = {}) {
10757
11204
  errorHint: null,
10758
11205
  errorKind: null,
10759
11206
  // Reads the same object the handler mutates, at call time.
10760
- approvalLatched: /* @__PURE__ */ __name(() => approval.all, "approvalLatched"),
10761
- resetApprovalLatch: /* @__PURE__ */ __name(() => {
10762
- approval.all = false;
10763
- }, "resetApprovalLatch"),
11207
+ allowForSession: /* @__PURE__ */ __name((allows) => sessionAllows.add(allows), "allowForSession"),
11208
+ commandArguments,
10764
11209
  setPermissionMode: /* @__PURE__ */ __name(async (mode, reason) => {
10765
11210
  await Promise.all(
10766
11211
  [...liveModeControls].map(
@@ -11052,7 +11497,7 @@ async function createAgentSession(prefs, detected, options = {}) {
11052
11497
  escalation,
11053
11498
  limits: turnLimits,
11054
11499
  sandboxWorkspace,
11055
- rules: options.rules,
11500
+ rules: sessionRules,
11056
11501
  structuredOutput: options.structuredOutput,
11057
11502
  reviewAnswer: options.reviewAnswer,
11058
11503
  maxAnswerReviews: options.maxAnswerReviews,
@@ -12356,9 +12801,6 @@ function emptySession(errorHint, errorKind = "environment", rawDetail) {
12356
12801
  configNotices: [],
12357
12802
  errorHint,
12358
12803
  // No turn can run here, so no prompt can have been answered.
12359
- approvalLatched: /* @__PURE__ */ __name(() => false, "approvalLatched"),
12360
- resetApprovalLatch: /* @__PURE__ */ __name(() => {
12361
- }, "resetApprovalLatch"),
12362
12804
  // No registry was built, so there is no roster to report on.
12363
12805
  promptExemptTools: /* @__PURE__ */ __name(() => [], "promptExemptTools"),
12364
12806
  send: /* @__PURE__ */ __name(async function* () {
@@ -12417,6 +12859,8 @@ export {
12417
12859
  renderMemorySaveResult,
12418
12860
  renderTypedNoteResult,
12419
12861
  renderStoredMemorySection,
12862
+ allowsForBatch,
12863
+ describeAllows,
12420
12864
  assistantTranscriptTexts,
12421
12865
  projectTurnConversation,
12422
12866
  resolveModelSwitch,
@@ -12446,4 +12890,4 @@ export {
12446
12890
  RESULT_SUMMARY_WHOLE_MAX,
12447
12891
  resultSummaryLine
12448
12892
  };
12449
- //# sourceMappingURL=chunk-H6MWKPHM.js.map
12893
+ //# sourceMappingURL=chunk-WBR7JG42.js.map