@namzu/cli 60.1.0 → 61.0.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 (554) hide show
  1. package/CHANGELOG.md +86 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/chunks/{acp-6R4I2A3Q.js → acp-Q3IA5XHU.js} +294 -133
  4. package/dist/chunks/acp-Q3IA5XHU.js.map +6 -0
  5. package/dist/chunks/{activity-command-JU4HLIQJ.js → activity-command-PXOMQCVV.js} +14 -14
  6. package/dist/chunks/{add-S6JYKDI4.js → add-HIIKDZDN.js} +21 -21
  7. package/dist/chunks/{agent-E343AQV7.js → agent-5OM6GGWO.js} +55 -53
  8. package/dist/chunks/agent-session-MNEGO6RD.js +95 -0
  9. package/dist/chunks/{apply-at-exit-MEOJMGNT.js → apply-at-exit-2TUEV3TN.js} +7 -7
  10. package/dist/chunks/{archive-ZPWC7GZU.js → archive-ESYECN4Y.js} +12 -12
  11. package/dist/chunks/{auth-6NX4TMIG.js → auth-WA6ZXNXM.js} +12 -12
  12. package/dist/chunks/{bin-main-P3KAQDKC.js → bin-main-Y5FDOG2X.js} +8 -8
  13. package/dist/chunks/{binding-6QZVGFQ5.js → binding-7ZF533IJ.js} +3 -3
  14. package/dist/chunks/{browser-KK2U5524.js → browser-HFAVORW3.js} +7 -7
  15. package/dist/chunks/{chat-VEXJRSZN.js → chat-BVA2BLKE.js} +17 -17
  16. package/dist/chunks/{chunk-PS5SVAUJ.js → chunk-2SXME4FG.js} +2 -2
  17. package/dist/chunks/{chunk-VQZPXK4X.js → chunk-2ZA7XJ63.js} +3 -3
  18. package/dist/chunks/{chunk-452SL2Y4.js → chunk-3CEL5P45.js} +2 -2
  19. package/dist/chunks/{chunk-N5CCXOYK.js → chunk-3DCQNM64.js} +7 -7
  20. package/dist/chunks/{chunk-4KVYTHY7.js → chunk-3KCGBW3F.js} +3 -3
  21. package/dist/chunks/{chunk-66QIFMEO.js → chunk-3RDKZZQE.js} +2 -2
  22. package/dist/chunks/{chunk-ZHEEG3NS.js → chunk-5KRUNLE7.js} +2 -2
  23. package/dist/chunks/{chunk-PE4MWWUW.js → chunk-5M44QX4G.js} +3 -3
  24. package/dist/chunks/{chunk-C7E7YCRD.js → chunk-5VKCUXB2.js} +8 -6
  25. package/dist/chunks/chunk-5VKCUXB2.js.map +6 -0
  26. package/dist/chunks/{chunk-SXONHO4H.js → chunk-65ROGOIM.js} +9 -9
  27. package/dist/chunks/{chunk-HM7L5PM2.js → chunk-65ZRPJA5.js} +3 -3
  28. package/dist/chunks/{chunk-BA7KUG6V.js → chunk-6FGEPFFB.js} +2 -2
  29. package/dist/chunks/{chunk-32OIBGYI.js → chunk-6PEEUJSR.js} +10 -8
  30. package/dist/chunks/chunk-6PEEUJSR.js.map +6 -0
  31. package/dist/chunks/{chunk-44YG6EI4.js → chunk-6UWOG6FY.js} +4 -4
  32. package/dist/chunks/{chunk-2KVQVPJ7.js → chunk-6ZZQSHLH.js} +6 -6
  33. package/dist/chunks/{chunk-2KVQVPJ7.js.map → chunk-6ZZQSHLH.js.map} +1 -1
  34. package/dist/chunks/{chunk-AMYP2WPW.js → chunk-752F23K2.js} +8 -8
  35. package/dist/chunks/{chunk-DRSQTKDN.js → chunk-7BRCXPI3.js} +3 -3
  36. package/dist/chunks/{chunk-WOTA5FO5.js → chunk-7TPWEPUT.js} +3 -3
  37. package/dist/chunks/{chunk-PRJO4XM3.js → chunk-A42WH5C5.js} +2 -2
  38. package/dist/chunks/{chunk-RMOTHWPV.js → chunk-AAGA2PWL.js} +17 -6
  39. package/dist/chunks/chunk-AAGA2PWL.js.map +6 -0
  40. package/dist/chunks/{chunk-F5W4TNCR.js → chunk-AHV6BJED.js} +2 -2
  41. package/dist/chunks/{chunk-4CJ3HPOT.js → chunk-AYD4H6VV.js} +2 -2
  42. package/dist/chunks/{chunk-2DCOB33W.js → chunk-B7DL5QPS.js} +19 -6
  43. package/dist/chunks/chunk-B7DL5QPS.js.map +6 -0
  44. package/dist/chunks/{chunk-FK4MAZV2.js → chunk-BXUNIVZB.js} +13 -6
  45. package/dist/chunks/chunk-BXUNIVZB.js.map +6 -0
  46. package/dist/chunks/{chunk-J4PL65DJ.js → chunk-C3KDKOUV.js} +6 -6
  47. package/dist/chunks/{chunk-VWUTJ4EU.js → chunk-CJBRIESJ.js} +3 -3
  48. package/dist/chunks/{chunk-YWRRS7SO.js → chunk-COOEFXWT.js} +2 -2
  49. package/dist/chunks/{chunk-BJT37HR4.js → chunk-CQ2EGIRN.js} +301 -713
  50. package/dist/chunks/chunk-CQ2EGIRN.js.map +6 -0
  51. package/dist/chunks/{chunk-NVWD5XDT.js → chunk-DAZEYCY5.js} +2 -2
  52. package/dist/chunks/{chunk-4Y242BU4.js → chunk-DL5KZGQK.js} +5 -5
  53. package/dist/chunks/{chunk-O4EILTV6.js → chunk-DRYK66N3.js} +78 -25
  54. package/dist/chunks/chunk-DRYK66N3.js.map +6 -0
  55. package/dist/chunks/{chunk-RQAY7REG.js → chunk-EDAEDZ37.js} +3 -3
  56. package/dist/chunks/{chunk-QQ4S6MNH.js → chunk-EDLBZSB2.js} +1198 -305
  57. package/dist/chunks/chunk-EDLBZSB2.js.map +6 -0
  58. package/dist/chunks/{chunk-R6M6EIAH.js → chunk-EEBDKNNP.js} +4 -4
  59. package/dist/chunks/{chunk-GT22EDUB.js → chunk-EOLSGOXC.js} +6 -6
  60. package/dist/chunks/{chunk-O45DCUNX.js → chunk-EYFAHVYO.js} +2 -2
  61. package/dist/chunks/{chunk-NKHEBASJ.js → chunk-EZYMBETQ.js} +2 -2
  62. package/dist/chunks/{chunk-ME4LETA3.js → chunk-F5AHQ4RX.js} +2 -2
  63. package/dist/chunks/{chunk-MUSGZEFY.js → chunk-F5SG7JPB.js} +2 -2
  64. package/dist/chunks/{chunk-MK42KB72.js → chunk-FHKPEPTE.js} +4 -4
  65. package/dist/chunks/{chunk-XDUA6PBP.js → chunk-FHP4D55L.js} +2 -2
  66. package/dist/chunks/{chunk-WDKAL7EW.js → chunk-FIEADS4A.js} +2 -2
  67. package/dist/chunks/{chunk-K2EKXCLZ.js → chunk-G5NS6ASX.js} +3 -3
  68. package/dist/chunks/{chunk-I4RC6KQQ.js → chunk-GS7ST2VG.js} +19 -19
  69. package/dist/chunks/{chunk-XE6XT6R6.js → chunk-GSNTXEOD.js} +4 -4
  70. package/dist/chunks/{chunk-H6NTNPWD.js → chunk-HGBVFYQT.js} +4 -4
  71. package/dist/chunks/{chunk-D2R47LDH.js → chunk-HIJXZ6FI.js} +12 -12
  72. package/dist/chunks/{chunk-5F4DSPZC.js → chunk-HLYITQWD.js} +10 -10
  73. package/dist/chunks/{chunk-42JIZXVL.js → chunk-HN2NZD4E.js} +3 -88
  74. package/dist/chunks/chunk-HN2NZD4E.js.map +6 -0
  75. package/dist/chunks/{chunk-QCV3HH4P.js → chunk-HX3ENA3I.js} +2 -2
  76. package/dist/chunks/{chunk-HKRUNZVI.js → chunk-IWVJDG4L.js} +3 -3
  77. package/dist/chunks/{chunk-PZWSRAE7.js → chunk-J2ITWYQQ.js} +6 -6
  78. package/dist/chunks/{chunk-4BNCVR3U.js → chunk-JR3LFDKN.js} +2 -2
  79. package/dist/chunks/{chunk-BZR5PIFF.js → chunk-JRZSUEK4.js} +367 -176
  80. package/dist/chunks/chunk-JRZSUEK4.js.map +6 -0
  81. package/dist/chunks/{chunk-FMD4REZQ.js → chunk-K4PFUUP7.js} +47 -40
  82. package/dist/chunks/chunk-K4PFUUP7.js.map +6 -0
  83. package/dist/chunks/{chunk-TBJ6XU3T.js → chunk-KDOBJGF2.js} +3 -3
  84. package/dist/chunks/{chunk-EBBT2I5S.js → chunk-KDPGC66S.js} +30 -6
  85. package/dist/chunks/chunk-KDPGC66S.js.map +6 -0
  86. package/dist/chunks/{chunk-QNJXULU7.js → chunk-KKHZG7B2.js} +2 -2
  87. package/dist/chunks/{chunk-6W3UGXGG.js → chunk-KTSPKGEC.js} +4 -4
  88. package/dist/chunks/{chunk-BURGRQWO.js → chunk-KXBZ7P2A.js} +2 -2
  89. package/dist/chunks/{chunk-4473VICE.js → chunk-KZ5XYWKO.js} +3 -3
  90. package/dist/chunks/{chunk-EXJJLYZK.js → chunk-LKWENSPO.js} +7 -60
  91. package/dist/chunks/chunk-LKWENSPO.js.map +6 -0
  92. package/dist/chunks/{chunk-F7KOBJVW.js → chunk-LLVZON4J.js} +4 -4
  93. package/dist/chunks/{chunk-B4AOCHH6.js → chunk-LNMFADLE.js} +3 -3
  94. package/dist/chunks/{chunk-AC5P6W3G.js → chunk-ME7MQ4P2.js} +2 -2
  95. package/dist/chunks/{chunk-JJ72TLOA.js → chunk-MESE2QPT.js} +27 -30
  96. package/dist/chunks/chunk-MESE2QPT.js.map +6 -0
  97. package/dist/chunks/{chunk-FPC3K4TT.js → chunk-MHESN2FM.js} +3 -3
  98. package/dist/chunks/{chunk-SLTJNYOU.js → chunk-MKCZB324.js} +2 -2
  99. package/dist/chunks/{chunk-5IGEQN7L.js → chunk-NE55T7GN.js} +4 -4
  100. package/dist/chunks/{chunk-VG7245VJ.js → chunk-NI2YKSPW.js} +6 -6
  101. package/dist/chunks/{chunk-AYMB4AOZ.js → chunk-NQVSTOUH.js} +4 -4
  102. package/dist/chunks/chunk-NSU3TAZZ.js +74 -0
  103. package/dist/chunks/chunk-NSU3TAZZ.js.map +6 -0
  104. package/dist/chunks/{chunk-QGBR42TV.js → chunk-NVRUHQKC.js} +7 -7
  105. package/dist/chunks/{chunk-PAUMCJPX.js → chunk-O3AEUU3Q.js} +3 -3
  106. package/dist/chunks/{chunk-4DSUVT37.js → chunk-OG7MBIKO.js} +5 -5
  107. package/dist/chunks/{chunk-NBJ5PRAY.js → chunk-OGMRGX5M.js} +3 -3
  108. package/dist/chunks/{chunk-WJ6QRVL6.js → chunk-PFQQ6YFF.js} +2 -2
  109. package/dist/chunks/{chunk-CXW7I2S3.js → chunk-PHEL63BK.js} +2 -2
  110. package/dist/chunks/{chunk-YR3TWNIV.js → chunk-PJORD4FZ.js} +9 -9
  111. package/dist/chunks/{chunk-5ZLKTFU2.js → chunk-PSUJIMQV.js} +3 -3
  112. package/dist/chunks/{chunk-TBGKPWCL.js → chunk-PWSMXR6B.js} +9 -9
  113. package/dist/chunks/{chunk-PRRX5LNR.js → chunk-PYFAJB35.js} +2 -2
  114. package/dist/chunks/{chunk-BWD2TUI4.js → chunk-PYFGTXFQ.js} +5 -5
  115. package/dist/chunks/{chunk-EWPGU4HH.js → chunk-Q5H7EHCH.js} +314 -22
  116. package/dist/chunks/{chunk-EWPGU4HH.js.map → chunk-Q5H7EHCH.js.map} +2 -2
  117. package/dist/chunks/{chunk-BHQHTM3Z.js → chunk-QH4DQR57.js} +5 -5
  118. package/dist/chunks/{chunk-TTKMQW6B.js → chunk-QR5VVGWU.js} +3 -3
  119. package/dist/chunks/{chunk-UCML5ZXB.js → chunk-QR7GTBV3.js} +3 -3
  120. package/dist/chunks/{chunk-T7ILM666.js → chunk-R5BEMFDZ.js} +11 -11
  121. package/dist/chunks/{chunk-D4TXOX34.js → chunk-RQOE2MRO.js} +2 -2
  122. package/dist/chunks/chunk-RYOZ4HYY.js +1221 -0
  123. package/dist/chunks/chunk-RYOZ4HYY.js.map +6 -0
  124. package/dist/chunks/{chunk-6TUHWKXP.js → chunk-RZBIRLZ6.js} +6 -6
  125. package/dist/chunks/{chunk-GTUTBTOV.js → chunk-SLLKDPGZ.js} +3 -3
  126. package/dist/chunks/{chunk-6HYK4DDB.js → chunk-SXI6NW2H.js} +3 -3
  127. package/dist/chunks/{chunk-R2KAESOM.js → chunk-SYJRI5A4.js} +2 -2
  128. package/dist/chunks/{chunk-RKKU2RE4.js → chunk-T26HDLQS.js} +2 -2
  129. package/dist/chunks/{chunk-WYA4QWWE.js → chunk-TBQQRYS2.js} +5 -5
  130. package/dist/chunks/{chunk-IMMUS7IW.js → chunk-TFREQNR5.js} +20 -12
  131. package/dist/chunks/chunk-TFREQNR5.js.map +6 -0
  132. package/dist/chunks/{chunk-GPTYDM26.js → chunk-TQZSXYON.js} +8 -8
  133. package/dist/chunks/{chunk-D6PB3Z7Q.js → chunk-TSN7J4ZH.js} +2 -2
  134. package/dist/chunks/{chunk-Z5OG4HXI.js → chunk-TT3GLF32.js} +133 -89
  135. package/dist/chunks/chunk-TT3GLF32.js.map +6 -0
  136. package/dist/chunks/{chunk-PZLPACNY.js → chunk-TWTZKA46.js} +3 -3
  137. package/dist/chunks/{chunk-K7YZJV2X.js → chunk-U3OY3T54.js} +34 -16
  138. package/dist/chunks/chunk-U3OY3T54.js.map +6 -0
  139. package/dist/chunks/{chunk-MF3SFDBW.js → chunk-U6DACADN.js} +3 -3
  140. package/dist/chunks/chunk-UBDKPN27.js +150 -0
  141. package/dist/chunks/chunk-UBDKPN27.js.map +6 -0
  142. package/dist/chunks/{chunk-75YLZNZW.js → chunk-UDSY3L6M.js} +3 -3
  143. package/dist/chunks/{chunk-WPGVZMSU.js → chunk-UOU7PGPZ.js} +2 -2
  144. package/dist/chunks/{chunk-TSOZBRM6.js → chunk-UY5KPN7B.js} +2 -2
  145. package/dist/chunks/{chunk-DEAG4G5J.js → chunk-V3DMBRE3.js} +2 -2
  146. package/dist/chunks/{chunk-QBLHOG2F.js → chunk-V5K2AOLI.js} +3 -3
  147. package/dist/chunks/{chunk-TTFPWGIU.js → chunk-VAJPCN3B.js} +2 -2
  148. package/dist/chunks/{chunk-JECLB23L.js → chunk-VIURZHCB.js} +6 -6
  149. package/dist/chunks/{chunk-IQ44C7Y3.js → chunk-VOR32IWQ.js} +4 -4
  150. package/dist/chunks/{chunk-XNQY26AE.js → chunk-W3BDNKTN.js} +4 -4
  151. package/dist/chunks/{chunk-JRBFL6WT.js → chunk-W5GDQFZS.js} +2 -2
  152. package/dist/chunks/{chunk-FVIKYFYD.js → chunk-XWGWQBF7.js} +2 -2
  153. package/dist/chunks/{chunk-KSRN5Y2O.js → chunk-Y2HHHKBF.js} +165 -79
  154. package/dist/chunks/chunk-Y2HHHKBF.js.map +6 -0
  155. package/dist/chunks/{chunk-PLCWCIL4.js → chunk-Y5NGMUDN.js} +2 -2
  156. package/dist/chunks/{chunk-TMPP2DEY.js → chunk-YCODODZO.js} +4 -4
  157. package/dist/chunks/{chunk-HG2PPCAE.js → chunk-YENBRA7T.js} +3 -3
  158. package/dist/chunks/{chunk-HCQGZPVT.js → chunk-YHUAVEOM.js} +2 -2
  159. package/dist/chunks/{chunk-4ENL4VUO.js → chunk-YPNF7YFU.js} +4 -4
  160. package/dist/chunks/{chunk-IL4Y3JGT.js → chunk-ZCDOMHZU.js} +13 -13
  161. package/dist/chunks/{chunk-BNLIRJ3M.js → chunk-ZPOMLH5G.js} +4 -4
  162. package/dist/chunks/{cli-runtime-ZJKKIW4H.js → cli-runtime-5IXM6W6M.js} +22 -22
  163. package/dist/chunks/{commands-TQH5DD22.js → commands-LOMIOXZ3.js} +6 -6
  164. package/dist/chunks/{config-APYUJ5UW.js → config-UBOJ3N77.js} +12 -12
  165. package/dist/chunks/{cost-5YV27U7F.js → cost-LM34ZHBI.js} +5 -5
  166. package/dist/chunks/{crash-report-QVXU2YVL.js → crash-report-PTHJP6ZC.js} +6 -6
  167. package/dist/chunks/{dist-AOT4CEP5.js → dist-3P6YD6AW.js} +2 -2
  168. package/dist/chunks/{dist-H7CAJ3ZW.js → dist-3W2E4ZVU.js} +16 -2
  169. package/dist/chunks/{dist-Z2HW2SJR.js → dist-C7M5OJAH.js} +2 -2
  170. package/dist/chunks/{dist-2FSOLP72.js → dist-HJYAXRBL.js} +2 -2
  171. package/dist/chunks/{dist-IZGKRIWL.js → dist-LZAIP6RQ.js} +2 -2
  172. package/dist/chunks/{dist-J4UXFVYR.js → dist-TEFBDQUK.js} +2 -2
  173. package/dist/chunks/{dist-PZYMYR7N.js → dist-Y4YXKFL6.js} +3 -3
  174. package/dist/chunks/{dist-JHKRSGW6.js → dist-ZVUIWK64.js} +2 -2
  175. package/dist/chunks/{doctor-CM6UPXG5.js → doctor-LL6FW4DE.js} +40 -40
  176. package/dist/chunks/{drain-X6RURKKC.js → drain-AX2SKGAZ.js} +31 -31
  177. package/dist/chunks/drain-AX2SKGAZ.js.map +6 -0
  178. package/dist/chunks/{entry-QQDPY6ZL.js → entry-QT6CMKBN.js} +6 -6
  179. package/dist/chunks/{eval-GZA22B4I.js → eval-HKAAPPGO.js} +9 -9
  180. package/dist/chunks/{exec-3NE75Z6E.js → exec-DY3B5KGJ.js} +98 -52
  181. package/dist/chunks/exec-DY3B5KGJ.js.map +6 -0
  182. package/dist/chunks/{extension-N5IQNKVZ.js → extension-55PWXBQY.js} +6 -6
  183. package/dist/chunks/{home-I4FIB6FV.js → home-7KXFLNBX.js} +3 -3
  184. package/dist/chunks/{homes-WTMMXQ6G.js → homes-WYHCCBK6.js} +5 -5
  185. package/dist/chunks/{hooks-R42OTZDT.js → hooks-UZ46HYL4.js} +22 -22
  186. package/dist/chunks/{hooks-report-K6VOPVBR.js → hooks-report-RD53ZGON.js} +18 -18
  187. package/dist/chunks/{host-65UFBZJV.js → host-NUIEARM2.js} +11 -10
  188. package/dist/chunks/host-queries-OB7OWZI6.js +37 -0
  189. package/dist/chunks/{installed-list-7QIWVKLQ.js → installed-list-T3G757YK.js} +4 -4
  190. package/dist/chunks/{learn-NZXLKYV4.js → learn-MTQXTX6E.js} +17 -17
  191. package/dist/chunks/{learn-builtin-RC4XXVBS.js → learn-builtin-3SXUVV7J.js} +20 -20
  192. package/dist/chunks/{lifecycle-NLCZ6OPA.js → lifecycle-MFXCFSJP.js} +33 -30
  193. package/dist/chunks/{list-2U67CAWS.js → list-M6Y24N5J.js} +18 -18
  194. package/dist/chunks/{live-CWJ2NWUQ.js → live-UNUQSBVZ.js} +39 -39
  195. package/dist/chunks/{load-H52QQBVE.js → load-GA4OIEG4.js} +9 -9
  196. package/dist/chunks/{logs-ZIW3QFU4.js → logs-LUPWFBWF.js} +4 -4
  197. package/dist/chunks/{mcp-FNSMEMCM.js → mcp-4GD5Y5W7.js} +98 -36
  198. package/dist/chunks/mcp-4GD5Y5W7.js.map +6 -0
  199. package/dist/chunks/{mcp-serve-ZC2OKIPP.js → mcp-serve-RQKZQNPI.js} +17 -17
  200. package/dist/chunks/{message-command-IHZWL5GI.js → message-command-L5HAX56P.js} +59 -59
  201. package/dist/chunks/{open-AHDQMVXI.js → open-D6QESFR2.js} +7 -7
  202. package/dist/chunks/{operator-tools-P5R4TF6N.js → operator-tools-CFYHXAZS.js} +15 -15
  203. package/dist/chunks/{output-schema-Q5RWHNKE.js → output-schema-WV5RUG66.js} +3 -3
  204. package/dist/chunks/{pal-T42HU4AK.js → pal-JVR6ZLEI.js} +15 -15
  205. package/dist/chunks/{peers-5RYEA7IA.js → peers-EK24T2HF.js} +8 -7
  206. package/dist/chunks/{peers-7ZG3DEBO.js → peers-NCDTNFJV.js} +20 -19
  207. package/dist/chunks/peers-NCDTNFJV.js.map +6 -0
  208. package/dist/chunks/{plugin-DGEINYG5.js → plugin-RR4O7D6C.js} +108 -52
  209. package/dist/chunks/plugin-RR4O7D6C.js.map +6 -0
  210. package/dist/chunks/{providers-I24HYZXG.js → providers-2CLIPXQ2.js} +10 -10
  211. package/dist/chunks/{providers-BXXIM7EW.js → providers-RTRULUUS.js} +17 -17
  212. package/dist/chunks/{pty-WVKM6ATI.js → pty-OHLKFJFA.js} +3 -3
  213. package/dist/chunks/resume-5OWRUFUL.js +25 -0
  214. package/dist/chunks/{resume-command-4I47WN7T.js → resume-command-HIIEMJAT.js} +4 -4
  215. package/dist/chunks/{running-VID6BVT2.js → running-3BAWMUK4.js} +4 -4
  216. package/dist/chunks/{schedule-75IZH76Z.js → schedule-OW54ANKO.js} +12 -12
  217. package/dist/chunks/{send-QRYY2NCG.js → send-5NIU4WFY.js} +20 -19
  218. package/dist/chunks/send-person-RYBIVAML.js +33 -0
  219. package/dist/chunks/{service-B6BNESZB.js → service-MGZ4LEVY.js} +33 -30
  220. package/dist/chunks/service-MGZ4LEVY.js.map +6 -0
  221. package/dist/chunks/{setting-cli-O4YWOIU5.js → setting-cli-CHPHJSAM.js} +12 -12
  222. package/dist/chunks/{skills-PEMVX5C3.js → skills-6DNVYWKR.js} +26 -26
  223. package/dist/chunks/{start-check-EKRXJ5VE.js → start-check-MHUGGAYJ.js} +2 -2
  224. package/dist/chunks/{startup-failure-2UJKPNMR.js → startup-failure-R2AIVZYU.js} +2 -2
  225. package/dist/chunks/{state-X3MKUFYM.js → state-2WEGEDJ5.js} +19 -19
  226. package/dist/chunks/{store-VRKKFOYW.js → store-MCRRV4BB.js} +3 -3
  227. package/dist/chunks/{store-QFNY4BV4.js → store-RITSVC5A.js} +4 -4
  228. package/dist/chunks/{store-MK5IYBE5.js → store-UFRLA47W.js} +8 -8
  229. package/dist/chunks/{store-4OXWHFS5.js → store-WH3C3EPV.js} +12 -12
  230. package/dist/chunks/{tui-MI72TUST.js → tui-5QS4AAMU.js} +98 -96
  231. package/dist/chunks/tui-5QS4AAMU.js.map +6 -0
  232. package/dist/chunks/{update-ELZEXYIX.js → update-3VXQAKVL.js} +8 -8
  233. package/dist/chunks/{watch-HPINGMZZ.js → watch-PMFTONTW.js} +102 -100
  234. package/dist/chunks/watch-PMFTONTW.js.map +6 -0
  235. package/dist/chunks/{workspaces-3LB4SPPS.js → workspaces-N7A3JNL4.js} +16 -15
  236. package/dist/chunks/workspaces-N7A3JNL4.js.map +6 -0
  237. package/dist/chunks/{worktree-5CWUUWNO.js → worktree-6L5FLMVI.js} +24 -24
  238. package/dist/cli.d.ts.map +1 -1
  239. package/dist/commands/acp.d.ts +8 -1
  240. package/dist/commands/acp.d.ts.map +1 -1
  241. package/dist/commands/desktop-host-plugins.d.ts +28 -1
  242. package/dist/commands/desktop-host-plugins.d.ts.map +1 -1
  243. package/dist/commands/desktop-host.d.ts +20 -1
  244. package/dist/commands/desktop-host.d.ts.map +1 -1
  245. package/dist/commands/drain.d.ts.map +1 -1
  246. package/dist/commands/exec-browser.d.ts +19 -0
  247. package/dist/commands/exec-browser.d.ts.map +1 -0
  248. package/dist/commands/exec-flags.d.ts +11 -2
  249. package/dist/commands/exec-flags.d.ts.map +1 -1
  250. package/dist/commands/exec-json.d.ts.map +1 -1
  251. package/dist/commands/exec.d.ts.map +1 -1
  252. package/dist/commands/mcp.d.ts +16 -1
  253. package/dist/commands/mcp.d.ts.map +1 -1
  254. package/dist/commands/plugin-install.d.ts +6 -0
  255. package/dist/commands/plugin-install.d.ts.map +1 -1
  256. package/dist/commands/plugin-records.d.ts +3 -0
  257. package/dist/commands/plugin-records.d.ts.map +1 -1
  258. package/dist/commands/plugin.d.ts.map +1 -1
  259. package/dist/config/load.d.ts.map +1 -1
  260. package/dist/config/schema.d.ts +29 -3
  261. package/dist/config/schema.d.ts.map +1 -1
  262. package/dist/config/session-options.d.ts +116 -0
  263. package/dist/config/session-options.d.ts.map +1 -1
  264. package/dist/config/settings-descriptors.d.ts.map +1 -1
  265. package/dist/index.js +40 -40
  266. package/dist/integrations/archive/zip.d.ts +8 -1
  267. package/dist/integrations/archive/zip.d.ts.map +1 -1
  268. package/dist/integrations/mcp/plugin-remote.d.ts +4 -0
  269. package/dist/integrations/mcp/plugin-remote.d.ts.map +1 -1
  270. package/dist/integrations/peers/process-ancestry.d.ts +10 -0
  271. package/dist/integrations/peers/process-ancestry.d.ts.map +1 -1
  272. package/dist/integrations/plugins/fetch/archive.d.ts.map +1 -1
  273. package/dist/integrations/plugins/fetch/git.d.ts +13 -3
  274. package/dist/integrations/plugins/fetch/git.d.ts.map +1 -1
  275. package/dist/integrations/plugins/fetch/policy.d.ts +40 -0
  276. package/dist/integrations/plugins/fetch/policy.d.ts.map +1 -0
  277. package/dist/integrations/plugins/fetch/source.d.ts +8 -10
  278. package/dist/integrations/plugins/fetch/source.d.ts.map +1 -1
  279. package/dist/integrations/plugins/fetch/url.d.ts +16 -4
  280. package/dist/integrations/plugins/fetch/url.d.ts.map +1 -1
  281. package/dist/integrations/plugins/files.d.ts.map +1 -1
  282. package/dist/integrations/plugins/install-manifest.d.ts +11 -0
  283. package/dist/integrations/plugins/install-manifest.d.ts.map +1 -1
  284. package/dist/integrations/plugins/install-plan.d.ts.map +1 -1
  285. package/dist/integrations/plugins/install-preview.d.ts +1 -2
  286. package/dist/integrations/plugins/install-preview.d.ts.map +1 -1
  287. package/dist/integrations/plugins/install.d.ts.map +1 -1
  288. package/dist/integrations/plugins/installed-source.d.ts +25 -0
  289. package/dist/integrations/plugins/installed-source.d.ts.map +1 -1
  290. package/dist/integrations/plugins/inventory.d.ts.map +1 -1
  291. package/dist/integrations/plugins/remote-marketplace.d.ts +16 -2
  292. package/dist/integrations/plugins/remote-marketplace.d.ts.map +1 -1
  293. package/dist/integrations/plugins/runtime.d.ts.map +1 -1
  294. package/dist/integrations/plugins/surface.d.ts +3 -1
  295. package/dist/integrations/plugins/surface.d.ts.map +1 -1
  296. package/dist/integrations/plugins/update-compare.d.ts +3 -3
  297. package/dist/integrations/plugins/update-compare.d.ts.map +1 -1
  298. package/dist/integrations/plugins/validate.d.ts.map +1 -1
  299. package/dist/integrations/workflows/guidance.d.ts +12 -0
  300. package/dist/integrations/workflows/guidance.d.ts.map +1 -0
  301. package/dist/integrations/workflows/host.d.ts +3 -0
  302. package/dist/integrations/workflows/host.d.ts.map +1 -1
  303. package/dist/integrations/workflows/offering.d.ts +16 -1
  304. package/dist/integrations/workflows/offering.d.ts.map +1 -1
  305. package/dist/integrations/workflows/size.d.ts +17 -3
  306. package/dist/integrations/workflows/size.d.ts.map +1 -1
  307. package/dist/permissions/auto-classifier.d.ts.map +1 -1
  308. package/dist/permissions/send-floor.d.ts +7 -0
  309. package/dist/permissions/send-floor.d.ts.map +1 -1
  310. package/dist/reminders/hypermode.d.ts +6 -0
  311. package/dist/reminders/hypermode.d.ts.map +1 -1
  312. package/dist/reminders/index.d.ts +1 -0
  313. package/dist/reminders/index.d.ts.map +1 -1
  314. package/dist/schedule/fire/fire.d.ts.map +1 -1
  315. package/dist/schedule/policy.d.ts.map +1 -1
  316. package/dist/skills/skill-shell.d.ts +9 -5
  317. package/dist/skills/skill-shell.d.ts.map +1 -1
  318. package/dist/tui/AgentExplorer.d.ts +3 -2
  319. package/dist/tui/AgentExplorer.d.ts.map +1 -1
  320. package/dist/tui/App.d.ts.map +1 -1
  321. package/dist/tui/BackgroundJobsPanel.d.ts.map +1 -1
  322. package/dist/tui/ColouredText.d.ts +11 -0
  323. package/dist/tui/ColouredText.d.ts.map +1 -0
  324. package/dist/tui/LiveActivity.d.ts.map +1 -1
  325. package/dist/tui/Transcript.d.ts +7 -1
  326. package/dist/tui/Transcript.d.ts.map +1 -1
  327. package/dist/tui/agent-tokens.d.ts +7 -0
  328. package/dist/tui/agent-tokens.d.ts.map +1 -1
  329. package/dist/tui/agent-transcript-rows.d.ts +5 -1
  330. package/dist/tui/agent-transcript-rows.d.ts.map +1 -1
  331. package/dist/tui/agent.d.ts +31 -4
  332. package/dist/tui/agent.d.ts.map +1 -1
  333. package/dist/tui/computer-use-screen-approval.d.ts +11 -1
  334. package/dist/tui/computer-use-screen-approval.d.ts.map +1 -1
  335. package/dist/tui/job-result-footer.d.ts +6 -1
  336. package/dist/tui/job-result-footer.d.ts.map +1 -1
  337. package/dist/tui/model-selection-intent.d.ts +5 -1
  338. package/dist/tui/model-selection-intent.d.ts.map +1 -1
  339. package/dist/tui/sgr-colour.d.ts +46 -0
  340. package/dist/tui/sgr-colour.d.ts.map +1 -0
  341. package/dist/tui/shell-cell.d.ts +1 -0
  342. package/dist/tui/shell-cell.d.ts.map +1 -1
  343. package/dist/tui/tidy-tool-output.d.ts +3 -3
  344. package/dist/tui/tidy-tool-output.d.ts.map +1 -1
  345. package/dist/tui/tool-end-rows.d.ts +2 -0
  346. package/dist/tui/tool-end-rows.d.ts.map +1 -1
  347. package/dist/tui/transcript-screen.d.ts.map +1 -1
  348. package/dist/tui/transcript-scroll.d.ts.map +1 -1
  349. package/package.json +4 -4
  350. package/skills/README.md +5 -0
  351. package/skills/workflow-authoring/SKILL.md +101 -0
  352. package/dist/chunks/acp-6R4I2A3Q.js.map +0 -6
  353. package/dist/chunks/agent-session-D6JIOCON.js +0 -95
  354. package/dist/chunks/chunk-2DCOB33W.js.map +0 -6
  355. package/dist/chunks/chunk-32OIBGYI.js.map +0 -6
  356. package/dist/chunks/chunk-42JIZXVL.js.map +0 -6
  357. package/dist/chunks/chunk-BJT37HR4.js.map +0 -6
  358. package/dist/chunks/chunk-BZR5PIFF.js.map +0 -6
  359. package/dist/chunks/chunk-C7E7YCRD.js.map +0 -6
  360. package/dist/chunks/chunk-EBBT2I5S.js.map +0 -6
  361. package/dist/chunks/chunk-EXJJLYZK.js.map +0 -6
  362. package/dist/chunks/chunk-FK4MAZV2.js.map +0 -6
  363. package/dist/chunks/chunk-FMD4REZQ.js.map +0 -6
  364. package/dist/chunks/chunk-IMMUS7IW.js.map +0 -6
  365. package/dist/chunks/chunk-JJ72TLOA.js.map +0 -6
  366. package/dist/chunks/chunk-K7YZJV2X.js.map +0 -6
  367. package/dist/chunks/chunk-KF6IKSF2.js +0 -472
  368. package/dist/chunks/chunk-KF6IKSF2.js.map +0 -6
  369. package/dist/chunks/chunk-KSRN5Y2O.js.map +0 -6
  370. package/dist/chunks/chunk-O4EILTV6.js.map +0 -6
  371. package/dist/chunks/chunk-QQ4S6MNH.js.map +0 -6
  372. package/dist/chunks/chunk-RMOTHWPV.js.map +0 -6
  373. package/dist/chunks/chunk-Z5OG4HXI.js.map +0 -6
  374. package/dist/chunks/drain-X6RURKKC.js.map +0 -6
  375. package/dist/chunks/exec-3NE75Z6E.js.map +0 -6
  376. package/dist/chunks/host-queries-L4PYE2BW.js +0 -37
  377. package/dist/chunks/mcp-FNSMEMCM.js.map +0 -6
  378. package/dist/chunks/peers-7ZG3DEBO.js.map +0 -6
  379. package/dist/chunks/plugin-DGEINYG5.js.map +0 -6
  380. package/dist/chunks/resume-F7JEDBHI.js +0 -25
  381. package/dist/chunks/send-person-VADQNJBN.js +0 -32
  382. package/dist/chunks/service-B6BNESZB.js.map +0 -6
  383. package/dist/chunks/tui-MI72TUST.js.map +0 -6
  384. package/dist/chunks/watch-HPINGMZZ.js.map +0 -6
  385. package/dist/chunks/workspaces-3LB4SPPS.js.map +0 -6
  386. /package/dist/chunks/{activity-command-JU4HLIQJ.js.map → activity-command-PXOMQCVV.js.map} +0 -0
  387. /package/dist/chunks/{add-S6JYKDI4.js.map → add-HIIKDZDN.js.map} +0 -0
  388. /package/dist/chunks/{agent-E343AQV7.js.map → agent-5OM6GGWO.js.map} +0 -0
  389. /package/dist/chunks/{agent-session-D6JIOCON.js.map → agent-session-MNEGO6RD.js.map} +0 -0
  390. /package/dist/chunks/{apply-at-exit-MEOJMGNT.js.map → apply-at-exit-2TUEV3TN.js.map} +0 -0
  391. /package/dist/chunks/{archive-ZPWC7GZU.js.map → archive-ESYECN4Y.js.map} +0 -0
  392. /package/dist/chunks/{auth-6NX4TMIG.js.map → auth-WA6ZXNXM.js.map} +0 -0
  393. /package/dist/chunks/{bin-main-P3KAQDKC.js.map → bin-main-Y5FDOG2X.js.map} +0 -0
  394. /package/dist/chunks/{binding-6QZVGFQ5.js.map → binding-7ZF533IJ.js.map} +0 -0
  395. /package/dist/chunks/{browser-KK2U5524.js.map → browser-HFAVORW3.js.map} +0 -0
  396. /package/dist/chunks/{chat-VEXJRSZN.js.map → chat-BVA2BLKE.js.map} +0 -0
  397. /package/dist/chunks/{chunk-PS5SVAUJ.js.map → chunk-2SXME4FG.js.map} +0 -0
  398. /package/dist/chunks/{chunk-VQZPXK4X.js.map → chunk-2ZA7XJ63.js.map} +0 -0
  399. /package/dist/chunks/{chunk-452SL2Y4.js.map → chunk-3CEL5P45.js.map} +0 -0
  400. /package/dist/chunks/{chunk-N5CCXOYK.js.map → chunk-3DCQNM64.js.map} +0 -0
  401. /package/dist/chunks/{chunk-4KVYTHY7.js.map → chunk-3KCGBW3F.js.map} +0 -0
  402. /package/dist/chunks/{chunk-66QIFMEO.js.map → chunk-3RDKZZQE.js.map} +0 -0
  403. /package/dist/chunks/{chunk-ZHEEG3NS.js.map → chunk-5KRUNLE7.js.map} +0 -0
  404. /package/dist/chunks/{chunk-PE4MWWUW.js.map → chunk-5M44QX4G.js.map} +0 -0
  405. /package/dist/chunks/{chunk-SXONHO4H.js.map → chunk-65ROGOIM.js.map} +0 -0
  406. /package/dist/chunks/{chunk-HM7L5PM2.js.map → chunk-65ZRPJA5.js.map} +0 -0
  407. /package/dist/chunks/{chunk-BA7KUG6V.js.map → chunk-6FGEPFFB.js.map} +0 -0
  408. /package/dist/chunks/{chunk-44YG6EI4.js.map → chunk-6UWOG6FY.js.map} +0 -0
  409. /package/dist/chunks/{chunk-AMYP2WPW.js.map → chunk-752F23K2.js.map} +0 -0
  410. /package/dist/chunks/{chunk-DRSQTKDN.js.map → chunk-7BRCXPI3.js.map} +0 -0
  411. /package/dist/chunks/{chunk-WOTA5FO5.js.map → chunk-7TPWEPUT.js.map} +0 -0
  412. /package/dist/chunks/{chunk-PRJO4XM3.js.map → chunk-A42WH5C5.js.map} +0 -0
  413. /package/dist/chunks/{chunk-F5W4TNCR.js.map → chunk-AHV6BJED.js.map} +0 -0
  414. /package/dist/chunks/{chunk-4CJ3HPOT.js.map → chunk-AYD4H6VV.js.map} +0 -0
  415. /package/dist/chunks/{chunk-J4PL65DJ.js.map → chunk-C3KDKOUV.js.map} +0 -0
  416. /package/dist/chunks/{chunk-VWUTJ4EU.js.map → chunk-CJBRIESJ.js.map} +0 -0
  417. /package/dist/chunks/{chunk-YWRRS7SO.js.map → chunk-COOEFXWT.js.map} +0 -0
  418. /package/dist/chunks/{chunk-NVWD5XDT.js.map → chunk-DAZEYCY5.js.map} +0 -0
  419. /package/dist/chunks/{chunk-4Y242BU4.js.map → chunk-DL5KZGQK.js.map} +0 -0
  420. /package/dist/chunks/{chunk-RQAY7REG.js.map → chunk-EDAEDZ37.js.map} +0 -0
  421. /package/dist/chunks/{chunk-R6M6EIAH.js.map → chunk-EEBDKNNP.js.map} +0 -0
  422. /package/dist/chunks/{chunk-GT22EDUB.js.map → chunk-EOLSGOXC.js.map} +0 -0
  423. /package/dist/chunks/{chunk-O45DCUNX.js.map → chunk-EYFAHVYO.js.map} +0 -0
  424. /package/dist/chunks/{chunk-NKHEBASJ.js.map → chunk-EZYMBETQ.js.map} +0 -0
  425. /package/dist/chunks/{chunk-ME4LETA3.js.map → chunk-F5AHQ4RX.js.map} +0 -0
  426. /package/dist/chunks/{chunk-MUSGZEFY.js.map → chunk-F5SG7JPB.js.map} +0 -0
  427. /package/dist/chunks/{chunk-MK42KB72.js.map → chunk-FHKPEPTE.js.map} +0 -0
  428. /package/dist/chunks/{chunk-XDUA6PBP.js.map → chunk-FHP4D55L.js.map} +0 -0
  429. /package/dist/chunks/{chunk-WDKAL7EW.js.map → chunk-FIEADS4A.js.map} +0 -0
  430. /package/dist/chunks/{chunk-K2EKXCLZ.js.map → chunk-G5NS6ASX.js.map} +0 -0
  431. /package/dist/chunks/{chunk-I4RC6KQQ.js.map → chunk-GS7ST2VG.js.map} +0 -0
  432. /package/dist/chunks/{chunk-XE6XT6R6.js.map → chunk-GSNTXEOD.js.map} +0 -0
  433. /package/dist/chunks/{chunk-H6NTNPWD.js.map → chunk-HGBVFYQT.js.map} +0 -0
  434. /package/dist/chunks/{chunk-D2R47LDH.js.map → chunk-HIJXZ6FI.js.map} +0 -0
  435. /package/dist/chunks/{chunk-5F4DSPZC.js.map → chunk-HLYITQWD.js.map} +0 -0
  436. /package/dist/chunks/{chunk-QCV3HH4P.js.map → chunk-HX3ENA3I.js.map} +0 -0
  437. /package/dist/chunks/{chunk-HKRUNZVI.js.map → chunk-IWVJDG4L.js.map} +0 -0
  438. /package/dist/chunks/{chunk-PZWSRAE7.js.map → chunk-J2ITWYQQ.js.map} +0 -0
  439. /package/dist/chunks/{chunk-4BNCVR3U.js.map → chunk-JR3LFDKN.js.map} +0 -0
  440. /package/dist/chunks/{chunk-TBJ6XU3T.js.map → chunk-KDOBJGF2.js.map} +0 -0
  441. /package/dist/chunks/{chunk-QNJXULU7.js.map → chunk-KKHZG7B2.js.map} +0 -0
  442. /package/dist/chunks/{chunk-6W3UGXGG.js.map → chunk-KTSPKGEC.js.map} +0 -0
  443. /package/dist/chunks/{chunk-BURGRQWO.js.map → chunk-KXBZ7P2A.js.map} +0 -0
  444. /package/dist/chunks/{chunk-4473VICE.js.map → chunk-KZ5XYWKO.js.map} +0 -0
  445. /package/dist/chunks/{chunk-F7KOBJVW.js.map → chunk-LLVZON4J.js.map} +0 -0
  446. /package/dist/chunks/{chunk-B4AOCHH6.js.map → chunk-LNMFADLE.js.map} +0 -0
  447. /package/dist/chunks/{chunk-AC5P6W3G.js.map → chunk-ME7MQ4P2.js.map} +0 -0
  448. /package/dist/chunks/{chunk-FPC3K4TT.js.map → chunk-MHESN2FM.js.map} +0 -0
  449. /package/dist/chunks/{chunk-SLTJNYOU.js.map → chunk-MKCZB324.js.map} +0 -0
  450. /package/dist/chunks/{chunk-5IGEQN7L.js.map → chunk-NE55T7GN.js.map} +0 -0
  451. /package/dist/chunks/{chunk-VG7245VJ.js.map → chunk-NI2YKSPW.js.map} +0 -0
  452. /package/dist/chunks/{chunk-AYMB4AOZ.js.map → chunk-NQVSTOUH.js.map} +0 -0
  453. /package/dist/chunks/{chunk-QGBR42TV.js.map → chunk-NVRUHQKC.js.map} +0 -0
  454. /package/dist/chunks/{chunk-PAUMCJPX.js.map → chunk-O3AEUU3Q.js.map} +0 -0
  455. /package/dist/chunks/{chunk-4DSUVT37.js.map → chunk-OG7MBIKO.js.map} +0 -0
  456. /package/dist/chunks/{chunk-NBJ5PRAY.js.map → chunk-OGMRGX5M.js.map} +0 -0
  457. /package/dist/chunks/{chunk-WJ6QRVL6.js.map → chunk-PFQQ6YFF.js.map} +0 -0
  458. /package/dist/chunks/{chunk-CXW7I2S3.js.map → chunk-PHEL63BK.js.map} +0 -0
  459. /package/dist/chunks/{chunk-YR3TWNIV.js.map → chunk-PJORD4FZ.js.map} +0 -0
  460. /package/dist/chunks/{chunk-5ZLKTFU2.js.map → chunk-PSUJIMQV.js.map} +0 -0
  461. /package/dist/chunks/{chunk-TBGKPWCL.js.map → chunk-PWSMXR6B.js.map} +0 -0
  462. /package/dist/chunks/{chunk-PRRX5LNR.js.map → chunk-PYFAJB35.js.map} +0 -0
  463. /package/dist/chunks/{chunk-BWD2TUI4.js.map → chunk-PYFGTXFQ.js.map} +0 -0
  464. /package/dist/chunks/{chunk-BHQHTM3Z.js.map → chunk-QH4DQR57.js.map} +0 -0
  465. /package/dist/chunks/{chunk-TTKMQW6B.js.map → chunk-QR5VVGWU.js.map} +0 -0
  466. /package/dist/chunks/{chunk-UCML5ZXB.js.map → chunk-QR7GTBV3.js.map} +0 -0
  467. /package/dist/chunks/{chunk-T7ILM666.js.map → chunk-R5BEMFDZ.js.map} +0 -0
  468. /package/dist/chunks/{chunk-D4TXOX34.js.map → chunk-RQOE2MRO.js.map} +0 -0
  469. /package/dist/chunks/{chunk-6TUHWKXP.js.map → chunk-RZBIRLZ6.js.map} +0 -0
  470. /package/dist/chunks/{chunk-GTUTBTOV.js.map → chunk-SLLKDPGZ.js.map} +0 -0
  471. /package/dist/chunks/{chunk-6HYK4DDB.js.map → chunk-SXI6NW2H.js.map} +0 -0
  472. /package/dist/chunks/{chunk-R2KAESOM.js.map → chunk-SYJRI5A4.js.map} +0 -0
  473. /package/dist/chunks/{chunk-RKKU2RE4.js.map → chunk-T26HDLQS.js.map} +0 -0
  474. /package/dist/chunks/{chunk-WYA4QWWE.js.map → chunk-TBQQRYS2.js.map} +0 -0
  475. /package/dist/chunks/{chunk-GPTYDM26.js.map → chunk-TQZSXYON.js.map} +0 -0
  476. /package/dist/chunks/{chunk-D6PB3Z7Q.js.map → chunk-TSN7J4ZH.js.map} +0 -0
  477. /package/dist/chunks/{chunk-PZLPACNY.js.map → chunk-TWTZKA46.js.map} +0 -0
  478. /package/dist/chunks/{chunk-MF3SFDBW.js.map → chunk-U6DACADN.js.map} +0 -0
  479. /package/dist/chunks/{chunk-75YLZNZW.js.map → chunk-UDSY3L6M.js.map} +0 -0
  480. /package/dist/chunks/{chunk-WPGVZMSU.js.map → chunk-UOU7PGPZ.js.map} +0 -0
  481. /package/dist/chunks/{chunk-TSOZBRM6.js.map → chunk-UY5KPN7B.js.map} +0 -0
  482. /package/dist/chunks/{chunk-DEAG4G5J.js.map → chunk-V3DMBRE3.js.map} +0 -0
  483. /package/dist/chunks/{chunk-QBLHOG2F.js.map → chunk-V5K2AOLI.js.map} +0 -0
  484. /package/dist/chunks/{chunk-TTFPWGIU.js.map → chunk-VAJPCN3B.js.map} +0 -0
  485. /package/dist/chunks/{chunk-JECLB23L.js.map → chunk-VIURZHCB.js.map} +0 -0
  486. /package/dist/chunks/{chunk-IQ44C7Y3.js.map → chunk-VOR32IWQ.js.map} +0 -0
  487. /package/dist/chunks/{chunk-XNQY26AE.js.map → chunk-W3BDNKTN.js.map} +0 -0
  488. /package/dist/chunks/{chunk-JRBFL6WT.js.map → chunk-W5GDQFZS.js.map} +0 -0
  489. /package/dist/chunks/{chunk-FVIKYFYD.js.map → chunk-XWGWQBF7.js.map} +0 -0
  490. /package/dist/chunks/{chunk-PLCWCIL4.js.map → chunk-Y5NGMUDN.js.map} +0 -0
  491. /package/dist/chunks/{chunk-TMPP2DEY.js.map → chunk-YCODODZO.js.map} +0 -0
  492. /package/dist/chunks/{chunk-HG2PPCAE.js.map → chunk-YENBRA7T.js.map} +0 -0
  493. /package/dist/chunks/{chunk-HCQGZPVT.js.map → chunk-YHUAVEOM.js.map} +0 -0
  494. /package/dist/chunks/{chunk-4ENL4VUO.js.map → chunk-YPNF7YFU.js.map} +0 -0
  495. /package/dist/chunks/{chunk-IL4Y3JGT.js.map → chunk-ZCDOMHZU.js.map} +0 -0
  496. /package/dist/chunks/{chunk-BNLIRJ3M.js.map → chunk-ZPOMLH5G.js.map} +0 -0
  497. /package/dist/chunks/{cli-runtime-ZJKKIW4H.js.map → cli-runtime-5IXM6W6M.js.map} +0 -0
  498. /package/dist/chunks/{commands-TQH5DD22.js.map → commands-LOMIOXZ3.js.map} +0 -0
  499. /package/dist/chunks/{config-APYUJ5UW.js.map → config-UBOJ3N77.js.map} +0 -0
  500. /package/dist/chunks/{cost-5YV27U7F.js.map → cost-LM34ZHBI.js.map} +0 -0
  501. /package/dist/chunks/{crash-report-QVXU2YVL.js.map → crash-report-PTHJP6ZC.js.map} +0 -0
  502. /package/dist/chunks/{dist-AOT4CEP5.js.map → dist-3P6YD6AW.js.map} +0 -0
  503. /package/dist/chunks/{dist-H7CAJ3ZW.js.map → dist-3W2E4ZVU.js.map} +0 -0
  504. /package/dist/chunks/{dist-Z2HW2SJR.js.map → dist-C7M5OJAH.js.map} +0 -0
  505. /package/dist/chunks/{dist-2FSOLP72.js.map → dist-HJYAXRBL.js.map} +0 -0
  506. /package/dist/chunks/{dist-IZGKRIWL.js.map → dist-LZAIP6RQ.js.map} +0 -0
  507. /package/dist/chunks/{dist-J4UXFVYR.js.map → dist-TEFBDQUK.js.map} +0 -0
  508. /package/dist/chunks/{dist-PZYMYR7N.js.map → dist-Y4YXKFL6.js.map} +0 -0
  509. /package/dist/chunks/{dist-JHKRSGW6.js.map → dist-ZVUIWK64.js.map} +0 -0
  510. /package/dist/chunks/{doctor-CM6UPXG5.js.map → doctor-LL6FW4DE.js.map} +0 -0
  511. /package/dist/chunks/{entry-QQDPY6ZL.js.map → entry-QT6CMKBN.js.map} +0 -0
  512. /package/dist/chunks/{eval-GZA22B4I.js.map → eval-HKAAPPGO.js.map} +0 -0
  513. /package/dist/chunks/{extension-N5IQNKVZ.js.map → extension-55PWXBQY.js.map} +0 -0
  514. /package/dist/chunks/{home-I4FIB6FV.js.map → home-7KXFLNBX.js.map} +0 -0
  515. /package/dist/chunks/{homes-WTMMXQ6G.js.map → homes-WYHCCBK6.js.map} +0 -0
  516. /package/dist/chunks/{hooks-R42OTZDT.js.map → hooks-UZ46HYL4.js.map} +0 -0
  517. /package/dist/chunks/{hooks-report-K6VOPVBR.js.map → hooks-report-RD53ZGON.js.map} +0 -0
  518. /package/dist/chunks/{host-65UFBZJV.js.map → host-NUIEARM2.js.map} +0 -0
  519. /package/dist/chunks/{host-queries-L4PYE2BW.js.map → host-queries-OB7OWZI6.js.map} +0 -0
  520. /package/dist/chunks/{installed-list-7QIWVKLQ.js.map → installed-list-T3G757YK.js.map} +0 -0
  521. /package/dist/chunks/{learn-NZXLKYV4.js.map → learn-MTQXTX6E.js.map} +0 -0
  522. /package/dist/chunks/{learn-builtin-RC4XXVBS.js.map → learn-builtin-3SXUVV7J.js.map} +0 -0
  523. /package/dist/chunks/{lifecycle-NLCZ6OPA.js.map → lifecycle-MFXCFSJP.js.map} +0 -0
  524. /package/dist/chunks/{list-2U67CAWS.js.map → list-M6Y24N5J.js.map} +0 -0
  525. /package/dist/chunks/{live-CWJ2NWUQ.js.map → live-UNUQSBVZ.js.map} +0 -0
  526. /package/dist/chunks/{load-H52QQBVE.js.map → load-GA4OIEG4.js.map} +0 -0
  527. /package/dist/chunks/{logs-ZIW3QFU4.js.map → logs-LUPWFBWF.js.map} +0 -0
  528. /package/dist/chunks/{mcp-serve-ZC2OKIPP.js.map → mcp-serve-RQKZQNPI.js.map} +0 -0
  529. /package/dist/chunks/{message-command-IHZWL5GI.js.map → message-command-L5HAX56P.js.map} +0 -0
  530. /package/dist/chunks/{open-AHDQMVXI.js.map → open-D6QESFR2.js.map} +0 -0
  531. /package/dist/chunks/{operator-tools-P5R4TF6N.js.map → operator-tools-CFYHXAZS.js.map} +0 -0
  532. /package/dist/chunks/{output-schema-Q5RWHNKE.js.map → output-schema-WV5RUG66.js.map} +0 -0
  533. /package/dist/chunks/{pal-T42HU4AK.js.map → pal-JVR6ZLEI.js.map} +0 -0
  534. /package/dist/chunks/{peers-5RYEA7IA.js.map → peers-EK24T2HF.js.map} +0 -0
  535. /package/dist/chunks/{providers-I24HYZXG.js.map → providers-2CLIPXQ2.js.map} +0 -0
  536. /package/dist/chunks/{providers-BXXIM7EW.js.map → providers-RTRULUUS.js.map} +0 -0
  537. /package/dist/chunks/{pty-WVKM6ATI.js.map → pty-OHLKFJFA.js.map} +0 -0
  538. /package/dist/chunks/{resume-F7JEDBHI.js.map → resume-5OWRUFUL.js.map} +0 -0
  539. /package/dist/chunks/{resume-command-4I47WN7T.js.map → resume-command-HIIEMJAT.js.map} +0 -0
  540. /package/dist/chunks/{running-VID6BVT2.js.map → running-3BAWMUK4.js.map} +0 -0
  541. /package/dist/chunks/{schedule-75IZH76Z.js.map → schedule-OW54ANKO.js.map} +0 -0
  542. /package/dist/chunks/{send-QRYY2NCG.js.map → send-5NIU4WFY.js.map} +0 -0
  543. /package/dist/chunks/{send-person-VADQNJBN.js.map → send-person-RYBIVAML.js.map} +0 -0
  544. /package/dist/chunks/{setting-cli-O4YWOIU5.js.map → setting-cli-CHPHJSAM.js.map} +0 -0
  545. /package/dist/chunks/{skills-PEMVX5C3.js.map → skills-6DNVYWKR.js.map} +0 -0
  546. /package/dist/chunks/{start-check-EKRXJ5VE.js.map → start-check-MHUGGAYJ.js.map} +0 -0
  547. /package/dist/chunks/{startup-failure-2UJKPNMR.js.map → startup-failure-R2AIVZYU.js.map} +0 -0
  548. /package/dist/chunks/{state-X3MKUFYM.js.map → state-2WEGEDJ5.js.map} +0 -0
  549. /package/dist/chunks/{store-4OXWHFS5.js.map → store-MCRRV4BB.js.map} +0 -0
  550. /package/dist/chunks/{store-MK5IYBE5.js.map → store-RITSVC5A.js.map} +0 -0
  551. /package/dist/chunks/{store-QFNY4BV4.js.map → store-UFRLA47W.js.map} +0 -0
  552. /package/dist/chunks/{store-VRKKFOYW.js.map → store-WH3C3EPV.js.map} +0 -0
  553. /package/dist/chunks/{update-ELZEXYIX.js.map → update-3VXQAKVL.js.map} +0 -0
  554. /package/dist/chunks/{worktree-5CWUUWNO.js.map → worktree-6L5FLMVI.js.map} +0 -0
@@ -325,7 +325,7 @@ var require_brace_expansion = __commonJS({
325
325
  });
326
326
 
327
327
  // ../sdk/dist/version.js
328
- var VERSION = "69.3.0";
328
+ var VERSION = "70.0.0";
329
329
 
330
330
  // ../sdk/dist/runtime/harness-session/index.js
331
331
  import { posix, win32 } from "node:path";
@@ -24550,6 +24550,67 @@ function isPrivateAddress(address2) {
24550
24550
  return false;
24551
24551
  }
24552
24552
  __name(isPrivateAddress, "isPrivateAddress");
24553
+ async function privateAddressProblem(hostname4, options = {}) {
24554
+ const name3 = hostname4.toLowerCase().replace(/^\[|\]$/g, "");
24555
+ let addresses;
24556
+ if (isIP(name3) !== 0) {
24557
+ addresses = [name3];
24558
+ } else {
24559
+ const resolve46 = options.resolve ?? (async (value) => (await lookup(value, { all: true })).map((r) => r.address));
24560
+ try {
24561
+ addresses = await resolve46(name3, options.signal);
24562
+ } catch (error62) {
24563
+ if (options.proxied === true && !options.signal?.aborted)
24564
+ return void 0;
24565
+ return `${name3} could not be resolved (${error62 instanceof Error ? error62.message : String(error62)}), so nothing here can say where it points`;
24566
+ }
24567
+ if (addresses.length === 0)
24568
+ return `${name3} resolves to no addresses`;
24569
+ }
24570
+ for (const address2 of addresses) {
24571
+ if (isPrivateAddress(address2))
24572
+ return `${name3} resolves to ${address2}, inside this host's own network`;
24573
+ }
24574
+ return void 0;
24575
+ }
24576
+ __name(privateAddressProblem, "privateAddressProblem");
24577
+ function usableProxy(value) {
24578
+ const text12 = (value ?? "").trim();
24579
+ if (text12 === "")
24580
+ return false;
24581
+ try {
24582
+ const url2 = new URL(/^[a-z][a-z0-9+.-]*:\/\//i.test(text12) ? text12 : `http://${text12}`);
24583
+ return (url2.protocol === "http:" || url2.protocol === "https:") && url2.hostname !== "";
24584
+ } catch {
24585
+ return false;
24586
+ }
24587
+ }
24588
+ __name(usableProxy, "usableProxy");
24589
+ function bypassesProxy(env, host) {
24590
+ const bare = host.toLowerCase().replace(/^\[|\]$/g, "").replace(/\.+$/, "");
24591
+ const lists = [env.NO_PROXY, env.no_proxy].filter((v) => typeof v === "string");
24592
+ for (const list3 of lists) {
24593
+ for (const raw of list3.split(",")) {
24594
+ const entry = raw.trim().toLowerCase().replace(/:\d+$/, "");
24595
+ if (entry === "")
24596
+ continue;
24597
+ if (entry === "*")
24598
+ return true;
24599
+ const name3 = entry.replace(/^\*?\./, "");
24600
+ if (bare === name3 || bare.endsWith(`.${name3}`))
24601
+ return true;
24602
+ }
24603
+ }
24604
+ return false;
24605
+ }
24606
+ __name(bypassesProxy, "bypassesProxy");
24607
+ function proxyConfigured(env = process.env, host) {
24608
+ const set5 = [env.HTTPS_PROXY, env.https_proxy, env.HTTP_PROXY, env.http_proxy].some(usableProxy);
24609
+ if (!set5)
24610
+ return false;
24611
+ return host === void 0 || !bypassesProxy(env, host);
24612
+ }
24613
+ __name(proxyConfigured, "proxyConfigured");
24553
24614
  function expandHextets(canonical5) {
24554
24615
  const [head3 = "", tail] = canonical5.split("::");
24555
24616
  const front = head3 === "" ? [] : head3.split(":");
@@ -27975,9 +28036,9 @@ function validateAgainstSchema(value, schema) {
27975
28036
  __name(validateAgainstSchema, "validateAgainstSchema");
27976
28037
  function parseJsonText(text12) {
27977
28038
  const trimmed = text12.trim();
27978
- const fenced = /^```(?:json)?\s*\n([\s\S]*?)\n```$/.exec(trimmed);
28039
+ const fenced2 = /^```(?:json)?\s*\n([\s\S]*?)\n```$/.exec(trimmed);
27979
28040
  try {
27980
- return { ok: true, value: JSON.parse(fenced ? fenced[1] : trimmed) };
28041
+ return { ok: true, value: JSON.parse(fenced2 ? fenced2[1] : trimmed) };
27981
28042
  } catch {
27982
28043
  return { ok: false };
27983
28044
  }
@@ -38958,14 +39019,14 @@ function justRest(rest) {
38958
39019
  return { rest, assignments: NO_ASSIGNMENTS };
38959
39020
  }
38960
39021
  __name(justRest, "justRest");
38961
- function skipOptions(words2, flags, withArg, explicit) {
39022
+ function skipOptions(words3, flags, withArg, explicit) {
38962
39023
  let i2 = 0;
38963
- while (i2 < words2.length) {
38964
- const w = words2[i2];
39024
+ while (i2 < words3.length) {
39025
+ const w = words3[i2];
38965
39026
  if (!LITERAL(w))
38966
- return justRest(words2.slice(i2));
39027
+ return justRest(words3.slice(i2));
38967
39028
  if (w.value === "--")
38968
- return justRest(words2.slice(i2 + 1));
39029
+ return justRest(words3.slice(i2 + 1));
38969
39030
  const reason = explicit?.get(w.value);
38970
39031
  if (reason !== void 0)
38971
39032
  return { unknown: reason };
@@ -38989,38 +39050,38 @@ function skipOptions(words2, flags, withArg, explicit) {
38989
39050
  if (/^--?[A-Za-z]/.test(w.value)) {
38990
39051
  return { unknown: `an option this does not read: ${w.value}` };
38991
39052
  }
38992
- return justRest(words2.slice(i2));
39053
+ return justRest(words3.slice(i2));
38993
39054
  }
38994
39055
  return { none: true };
38995
39056
  }
38996
39057
  __name(skipOptions, "skipOptions");
38997
- function skipAssignmentWords(words2) {
39058
+ function skipAssignmentWords(words3) {
38998
39059
  let i2 = 0;
38999
39060
  const assignments = [];
39000
- while (i2 < words2.length) {
39001
- const w = words2[i2];
39061
+ while (i2 < words3.length) {
39062
+ const w = words3[i2];
39002
39063
  if (!LITERAL(w))
39003
- return { rest: words2.slice(i2), assignments };
39064
+ return { rest: words3.slice(i2), assignments };
39004
39065
  const name3 = assignmentName(w);
39005
39066
  if (name3 === null)
39006
- return { rest: words2.slice(i2), assignments };
39067
+ return { rest: words3.slice(i2), assignments };
39007
39068
  assignments.push(name3);
39008
39069
  i2 += 1;
39009
39070
  }
39010
39071
  return { none: true };
39011
39072
  }
39012
39073
  __name(skipAssignmentWords, "skipAssignmentWords");
39013
- function unwrapEnv(words2) {
39074
+ function unwrapEnv(words3) {
39014
39075
  let i2 = 0;
39015
39076
  const assignments = [];
39016
39077
  for (; ; ) {
39017
- const w = words2[i2];
39078
+ const w = words3[i2];
39018
39079
  if (w === void 0)
39019
39080
  return { none: true };
39020
39081
  if (!LITERAL(w))
39021
- return { rest: words2.slice(i2), assignments };
39082
+ return { rest: words3.slice(i2), assignments };
39022
39083
  if (w.value === "--")
39023
- return { rest: words2.slice(i2 + 1), assignments };
39084
+ return { rest: words3.slice(i2 + 1), assignments };
39024
39085
  if (w.value === "-i" || w.value === "-0" || w.value === "--ignore-environment") {
39025
39086
  i2 += 1;
39026
39087
  continue;
@@ -39041,14 +39102,14 @@ function unwrapEnv(words2) {
39041
39102
  }
39042
39103
  if (/^--?[A-Za-z]/.test(w.value))
39043
39104
  return { unknown: `an option this does not read: ${w.value}` };
39044
- return { rest: words2.slice(i2), assignments };
39105
+ return { rest: words3.slice(i2), assignments };
39045
39106
  }
39046
39107
  }
39047
39108
  __name(unwrapEnv, "unwrapEnv");
39048
- function skipOneReexecWrapper(words2) {
39049
- const head3 = words2[0];
39109
+ function skipOneReexecWrapper(words3) {
39110
+ const head3 = words3[0];
39050
39111
  const name3 = basename4(head3.value);
39051
- const rest = words2.slice(1);
39112
+ const rest = words3.slice(1);
39052
39113
  switch (name3) {
39053
39114
  case "env":
39054
39115
  return unwrapEnv(rest);
@@ -39302,8 +39363,8 @@ var REEXEC_WRAPPER_NAMES = /* @__PURE__ */ new Set([
39302
39363
  "numactl"
39303
39364
  ]);
39304
39365
  var MAX_WRAPPER_DEPTH = 8;
39305
- function unwrapReexecChain(words2) {
39306
- let current2 = words2;
39366
+ function unwrapReexecChain(words3) {
39367
+ let current2 = words3;
39307
39368
  const assignments = [];
39308
39369
  for (let depth = 0; depth < MAX_WRAPPER_DEPTH; depth += 1) {
39309
39370
  const head3 = current2[0];
@@ -39326,17 +39387,17 @@ function unwrapReexecChain(words2) {
39326
39387
  return { unknown: "too many re-exec wrappers to follow" };
39327
39388
  }
39328
39389
  __name(unwrapReexecChain, "unwrapReexecChain");
39329
- function shellInvocation(words2) {
39330
- const head3 = words2[0];
39390
+ function shellInvocation(words3) {
39391
+ const head3 = words3[0];
39331
39392
  if (head3 === void 0 || !LITERAL(head3))
39332
39393
  return null;
39333
39394
  const name3 = basename4(head3.value);
39334
39395
  if (PLAIN_SHELL_NAMES.has(name3))
39335
- return { shell: name3, rest: words2.slice(1) };
39396
+ return { shell: name3, rest: words3.slice(1) };
39336
39397
  if (name3 === "busybox" || name3 === "toybox") {
39337
- const applet = words2[1];
39398
+ const applet = words3[1];
39338
39399
  if (applet !== void 0 && LITERAL(applet) && PLAIN_SHELL_NAMES.has(basename4(applet.value))) {
39339
- return { shell: basename4(applet.value), rest: words2.slice(2) };
39400
+ return { shell: basename4(applet.value), rest: words3.slice(2) };
39340
39401
  }
39341
39402
  }
39342
39403
  return null;
@@ -39386,10 +39447,10 @@ import { dirname as dirname6, isAbsolute as isAbsolute4, join as join11, normali
39386
39447
 
39387
39448
  // ../sdk/dist/authorization/shell-lexer.js
39388
39449
  var NESTED_SHELLS = PLAIN_SHELL_NAMES;
39389
- function nestedShellCommand(words2) {
39390
- if (words2.length === 0)
39450
+ function nestedShellCommand(words3) {
39451
+ if (words3.length === 0)
39391
39452
  return null;
39392
- const chained = unwrapReexecChain(words2);
39453
+ const chained = unwrapReexecChain(words3);
39393
39454
  if ("unknown" in chained)
39394
39455
  return { opaque: chained.unknown };
39395
39456
  if ("none" in chained)
@@ -39462,6 +39523,29 @@ var Context = class {
39462
39523
  opaque(reason) {
39463
39524
  this.reasons.add(reason);
39464
39525
  }
39526
+ /**
39527
+ * A name declared `-i` or `-n` evaluates what is later assigned to it as
39528
+ * arithmetic, and an assigned value that holds a subscript runs the
39529
+ * command inside it. The lexer keeps no variables, so when one line does
39530
+ * both, in either order, it is opaque.
39531
+ */
39532
+ integerDeclared = false;
39533
+ bracketSeen = false;
39534
+ declaredArithmetic() {
39535
+ this.integerDeclared = true;
39536
+ if (this.bracketSeen)
39537
+ this.opaque("arithmetic");
39538
+ }
39539
+ /**
39540
+ * A value that may hold a subscript was stored: a literal one, an
39541
+ * expanding one, or one a `read`, `mapfile`, `printf -v`, `getopts` or
39542
+ * loop variable stores. The lexer cannot see what they hold.
39543
+ */
39544
+ bracketAssigned() {
39545
+ this.bracketSeen = true;
39546
+ if (this.integerDeclared)
39547
+ this.opaque("arithmetic");
39548
+ }
39465
39549
  dialects = /* @__PURE__ */ new Map();
39466
39550
  /** The dialect a string is read in. A string read two ways gets the stricter. */
39467
39551
  setDialect(src, dialect) {
@@ -39567,6 +39651,16 @@ var RESERVED = /* @__PURE__ */ new Set([
39567
39651
  ]);
39568
39652
  var COMPOUND_AFTER = /^(?:\(|(?:\{|if|while|until|for|select|case|\[\[)(?=[\s;&|()<>]|$))/;
39569
39653
  var ASSIGNMENT_BUILTINS = /* @__PURE__ */ new Set(["declare", "typeset", "local", "export", "readonly"]);
39654
+ var PLAIN_ARITHMETIC = /^(?:[A-Za-z_][A-Za-z0-9_]*=)?[0-9\s+\-*/%()<>=!&|^~?:,]*$/;
39655
+ function subscriptOrExpands(word2) {
39656
+ return word2.value.includes("[") || word2.expands;
39657
+ }
39658
+ __name(subscriptOrExpands, "subscriptOrExpands");
39659
+ function subscriptWithExpansion(word2) {
39660
+ return word2.value.includes("[") && (word2.expands || /[$`]/.test(word2.value));
39661
+ }
39662
+ __name(subscriptWithExpansion, "subscriptWithExpansion");
39663
+ var PLAIN_INTEGER_ARGUMENT = /^[A-Za-z_][A-Za-z0-9_]*(?:=[0-9\s+\-*/%()<>=!&|^~?:,]*)?$/;
39570
39664
  var WORD_BREAK = /* @__PURE__ */ new Set([" ", " ", "\n", ";", "&", "|", "(", ")", "<", ">"]);
39571
39665
  var NAME_START = /[A-Za-z_]/;
39572
39666
  var NAME_CHAR = /[A-Za-z0-9_]/;
@@ -39967,6 +40061,7 @@ var Parser = class _Parser {
39967
40061
  if (name3.kind !== "word")
39968
40062
  throw this.unexpected(name3);
39969
40063
  this.context.compoundWords.push(name3.word);
40064
+ this.context.bracketAssigned();
39970
40065
  this.newlines();
39971
40066
  token = this.peek();
39972
40067
  if (token.kind === "word" && !token.word.quoted && token.word.value === "in") {
@@ -40142,15 +40237,15 @@ var Parser = class _Parser {
40142
40237
  }
40143
40238
  }
40144
40239
  simpleCommand() {
40145
- const words2 = [];
40240
+ const words3 = [];
40146
40241
  const redirections = [];
40147
40242
  let assignments = 0;
40148
40243
  let afterAssignment = false;
40149
40244
  let start = -1;
40150
40245
  let end = -1;
40151
40246
  for (; ; ) {
40152
- this.assignmentSyntax = words2.length === 0 || words2.length === assignments && afterAssignment;
40153
- this.allowCompound = this.assignmentSyntax || ASSIGNMENT_BUILTINS.has(words2[assignments]?.value ?? "");
40247
+ this.assignmentSyntax = words3.length === 0 || words3.length === assignments && afterAssignment;
40248
+ this.allowCompound = this.assignmentSyntax || ASSIGNMENT_BUILTINS.has(words3[assignments]?.value ?? "");
40154
40249
  const token = this.peek();
40155
40250
  if (token.kind === "word") {
40156
40251
  this.take();
@@ -40158,7 +40253,7 @@ var Parser = class _Parser {
40158
40253
  start = token.start;
40159
40254
  end = token.end;
40160
40255
  afterAssignment = false;
40161
- if (words2.length === assignments && ASSIGNMENT.test(joined2(token.word.text))) {
40256
+ if (words3.length === assignments && ASSIGNMENT.test(joined2(token.word.text))) {
40162
40257
  assignments += 1;
40163
40258
  if (/^[A-Za-z_][A-Za-z0-9_]*(?:\[|\+=)/.test(joined2(token.word.text)))
40164
40259
  this.bashOnly("array or += assignment");
@@ -40167,7 +40262,7 @@ var Parser = class _Parser {
40167
40262
  if (subscript && !/^\d*$/.test(subscript[1]))
40168
40263
  this.context.opaque("arithmetic subscript");
40169
40264
  }
40170
- words2.push(token.word);
40265
+ words3.push(token.word);
40171
40266
  continue;
40172
40267
  }
40173
40268
  if (token.kind === "op" && REDIRECTIONS.has(token.op)) {
@@ -40175,7 +40270,7 @@ var Parser = class _Parser {
40175
40270
  if (start < 0)
40176
40271
  start = token.start;
40177
40272
  afterAssignment = false;
40178
- const quirk = token.op === "&>>" && words2.length === 0 && redirections.length > 0;
40273
+ const quirk = token.op === "&>>" && words3.length === 0 && redirections.length > 0;
40179
40274
  const redirection = this.redirectionTarget(token, quirk);
40180
40275
  if (quirk && ASSIGNMENT.test(joined2(redirection.target.text)))
40181
40276
  throw new Stop("syntax error");
@@ -40184,7 +40279,7 @@ var Parser = class _Parser {
40184
40279
  this.context.redirections.push(redirection);
40185
40280
  continue;
40186
40281
  }
40187
- if (token.kind === "op" && token.op === "(" && words2.length === 1 && assignments === 0 && redirections.length === 0) {
40282
+ if (token.kind === "op" && token.op === "(" && words3.length === 1 && assignments === 0 && redirections.length === 0) {
40188
40283
  this.context.opaque("function definition");
40189
40284
  this.functionBody(false);
40190
40285
  return;
@@ -40196,7 +40291,7 @@ var Parser = class _Parser {
40196
40291
  if (start < 0)
40197
40292
  throw this.unexpected(this.peek());
40198
40293
  const command = {
40199
- words: words2,
40294
+ words: words3,
40200
40295
  assignments,
40201
40296
  redirections,
40202
40297
  text: this.src.slice(start, end),
@@ -40279,31 +40374,32 @@ var Parser = class _Parser {
40279
40374
  this.context.opaque("parser setting");
40280
40375
  }
40281
40376
  }
40377
+ this.inspectArithmeticBuiltin(command);
40282
40378
  const head3 = command.words[command.assignments];
40283
40379
  if (head3 === void 0 || head3.expands)
40284
40380
  return;
40285
40381
  const name3 = basename5(head3.value);
40286
40382
  if (name3 !== "shopt" && name3 !== "enable" && name3 !== "set" && !NESTED_SHELLS.has(name3) && !REEXEC_WRAPPER_NAMES.has(name3))
40287
40383
  return;
40288
- const words2 = command.words.slice(command.assignments);
40384
+ const words3 = command.words.slice(command.assignments);
40289
40385
  if (name3 === "shopt" || name3 === "enable") {
40290
40386
  this.context.opaque("parser setting");
40291
40387
  return;
40292
40388
  }
40293
40389
  if (name3 === "set") {
40294
- for (let i2 = 1; i2 < words2.length; i2 += 1) {
40295
- const word2 = words2[i2];
40390
+ for (let i2 = 1; i2 < words3.length; i2 += 1) {
40391
+ const word2 = words3[i2];
40296
40392
  if (word2.expands)
40297
40393
  this.context.opaque("parser setting");
40298
40394
  if (/^[-+][A-Za-z]*k/.test(word2.value) || word2.value === "--posix")
40299
40395
  this.context.opaque("parser setting");
40300
- if (/^[-+][A-Za-z]*o$/.test(word2.value) && /^(?:posix|keyword)$/.test(words2[i2 + 1]?.value ?? "")) {
40396
+ if (/^[-+][A-Za-z]*o$/.test(word2.value) && /^(?:posix|keyword)$/.test(words3[i2 + 1]?.value ?? "")) {
40301
40397
  this.context.opaque("parser setting");
40302
40398
  }
40303
40399
  }
40304
40400
  return;
40305
40401
  }
40306
- const nested = nestedShellCommand(words2);
40402
+ const nested = nestedShellCommand(words3);
40307
40403
  if (nested === null)
40308
40404
  return;
40309
40405
  if ("opaque" in nested) {
@@ -40312,6 +40408,223 @@ var Parser = class _Parser {
40312
40408
  }
40313
40409
  this.nestedShell(nested.shell, nested.payload);
40314
40410
  }
40411
+ /**
40412
+ * `unset` evaluates a subscript in a name operand, `unset 'a[$(cmd)]'`,
40413
+ * and runs `cmd`. `--` and the options `-v`, `-n` and `-f` (also
40414
+ * clustered, `-fv`) are read; the last of `-f` and `-v` decides, and with
40415
+ * `-f` the operands are function names, which evaluate nothing. Any other
40416
+ * word that holds a `[` or expands, a fused `-v'a[$(cmd)]'` included, is
40417
+ * opaque.
40418
+ */
40419
+ inspectUnset(args) {
40420
+ let functions = false;
40421
+ let options = true;
40422
+ for (const word2 of args) {
40423
+ if (options && !word2.expands && word2.value === "--") {
40424
+ options = false;
40425
+ continue;
40426
+ }
40427
+ if (options && !word2.expands && /^-[fvn]+$/.test(word2.value)) {
40428
+ const last = word2.value.replace(/[^fv]/g, "").slice(-1);
40429
+ if (last === "f")
40430
+ functions = true;
40431
+ else if (last === "v")
40432
+ functions = false;
40433
+ continue;
40434
+ }
40435
+ if (functions && !word2.expands)
40436
+ continue;
40437
+ if (subscriptOrExpands(word2)) {
40438
+ this.context.opaque("arithmetic");
40439
+ return;
40440
+ }
40441
+ }
40442
+ }
40443
+ /**
40444
+ * Bash evaluates a name that carries a subscript, `a[$(cmd)]`, as
40445
+ * arithmetic and runs `cmd`, quoted or not. Where that happens: each
40446
+ * `let` argument; `declare -i` (also `typeset`, `local`, clustered flags
40447
+ * such as `-ia`) for each `NAME=value`; the name given to `declare`,
40448
+ * `typeset` or `local` with any flags, to `printf -v` and to `read`; the
40449
+ * operand of `-v` or `-R` in `test` and `[`; and a later plain assignment
40450
+ * to a name declared `-i` or `-n` in the same line. A word that is not
40451
+ * plainly safe is opaque: the line asks instead of showing a command with
40452
+ * no inner one.
40453
+ */
40454
+ inspectArithmeticBuiltin(command) {
40455
+ for (let i2 = 0; i2 < command.assignments; i2 += 1)
40456
+ this.noteBracketAssignment(command.words[i2]);
40457
+ let at2 = command.assignments;
40458
+ for (; ; ) {
40459
+ const word2 = command.words[at2];
40460
+ if (word2 === void 0)
40461
+ return;
40462
+ if (word2.expands) {
40463
+ if (command.words.slice(at2 + 1).some(subscriptWithExpansion))
40464
+ this.context.opaque("arithmetic");
40465
+ return;
40466
+ }
40467
+ if ((word2.value === "builtin" || word2.value === "command") && command.words[at2 + 1]) {
40468
+ let next2 = at2 + 1;
40469
+ for (; ; ) {
40470
+ const option = command.words[next2];
40471
+ if (option === void 0 || option.expands || !option.value.startsWith("-"))
40472
+ break;
40473
+ if (option.value === "--") {
40474
+ next2 += 1;
40475
+ break;
40476
+ }
40477
+ if (option.value === "-p") {
40478
+ next2 += 1;
40479
+ continue;
40480
+ }
40481
+ if (word2.value === "command" && (option.value === "-v" || option.value === "-V"))
40482
+ return;
40483
+ this.context.opaque("arithmetic");
40484
+ return;
40485
+ }
40486
+ const target = command.words[next2];
40487
+ if (target === void 0 || target.expands)
40488
+ return;
40489
+ at2 = next2;
40490
+ continue;
40491
+ }
40492
+ break;
40493
+ }
40494
+ const name3 = command.words[at2].value;
40495
+ const args = command.words.slice(at2 + 1);
40496
+ if (name3 === "eval") {
40497
+ if (args.some(subscriptWithExpansion))
40498
+ this.context.opaque("arithmetic");
40499
+ return;
40500
+ }
40501
+ if (name3 === "let") {
40502
+ if (args.some((word2) => !PLAIN_ARITHMETIC.test(word2.value)))
40503
+ this.context.opaque("arithmetic");
40504
+ return;
40505
+ }
40506
+ if (name3 === "printf") {
40507
+ for (let i2 = 0; i2 < args.length; i2 += 1) {
40508
+ const value = args[i2].value;
40509
+ if (value === "--")
40510
+ break;
40511
+ if (!value.startsWith("-"))
40512
+ break;
40513
+ if (value === "-v") {
40514
+ this.context.bracketAssigned();
40515
+ const target = args[i2 + 1];
40516
+ if (target !== void 0 && subscriptOrExpands(target))
40517
+ this.context.opaque("arithmetic");
40518
+ i2 += 1;
40519
+ continue;
40520
+ }
40521
+ if (value.startsWith("-v")) {
40522
+ this.context.bracketAssigned();
40523
+ if (subscriptOrExpands(args[i2]))
40524
+ this.context.opaque("arithmetic");
40525
+ }
40526
+ }
40527
+ return;
40528
+ }
40529
+ if (name3 === "read") {
40530
+ this.context.bracketAssigned();
40531
+ this.inspectRead(args);
40532
+ return;
40533
+ }
40534
+ if (name3 === "unset") {
40535
+ this.inspectUnset(args);
40536
+ return;
40537
+ }
40538
+ if (name3 === "mapfile" || name3 === "readarray" || name3 === "getopts") {
40539
+ this.context.bracketAssigned();
40540
+ if (args.some((word2) => subscriptOrExpands(word2)))
40541
+ this.context.opaque("arithmetic");
40542
+ return;
40543
+ }
40544
+ if (name3 === "test" || name3 === "[") {
40545
+ for (let i2 = 0; i2 < args.length - 1; i2 += 1) {
40546
+ const value = args[i2].value;
40547
+ if ((value === "-v" || value === "-R") && subscriptOrExpands(args[i2 + 1]))
40548
+ this.context.opaque("arithmetic");
40549
+ }
40550
+ return;
40551
+ }
40552
+ if (name3 !== "declare" && name3 !== "typeset" && name3 !== "local")
40553
+ return;
40554
+ let integer7 = false;
40555
+ let nameref = false;
40556
+ let flags = true;
40557
+ for (const word2 of args) {
40558
+ if (flags && word2.value === "--")
40559
+ flags = false;
40560
+ else if (flags && /^-[A-Za-z]*i/.test(word2.value))
40561
+ integer7 = true;
40562
+ else if (flags && word2.expands && !word2.value.includes("="))
40563
+ integer7 = true;
40564
+ if (flags && /^-[A-Za-z]*n/.test(word2.value))
40565
+ nameref = true;
40566
+ }
40567
+ if (integer7 || nameref)
40568
+ this.context.declaredArithmetic();
40569
+ flags = true;
40570
+ for (const word2 of args) {
40571
+ if (flags && word2.value === "--") {
40572
+ flags = false;
40573
+ continue;
40574
+ }
40575
+ if (flags && word2.value.startsWith("-") && !word2.expands)
40576
+ continue;
40577
+ const equals = word2.value.indexOf("=");
40578
+ const nameFor = equals < 0 ? word2.value : word2.value.slice(0, equals);
40579
+ if (nameFor.includes("[") || word2.expands && /[$`]/.test(nameFor))
40580
+ this.context.opaque("arithmetic");
40581
+ else if (nameref && word2.value.slice(equals + 1).includes("[") && equals >= 0)
40582
+ this.context.opaque("arithmetic");
40583
+ else if (integer7 && !PLAIN_INTEGER_ARGUMENT.test(word2.value))
40584
+ this.context.opaque("arithmetic");
40585
+ else
40586
+ this.noteBracketAssignment(word2);
40587
+ }
40588
+ }
40589
+ /** The names `read` stores into, minus the arguments of its options. */
40590
+ inspectRead(args) {
40591
+ let options = true;
40592
+ for (let i2 = 0; i2 < args.length; i2 += 1) {
40593
+ const value = args[i2].value;
40594
+ if (options && value === "--") {
40595
+ options = false;
40596
+ continue;
40597
+ }
40598
+ if (options && value.startsWith("-") && value.length > 1) {
40599
+ for (let k = 1; k < value.length; k += 1) {
40600
+ const letter = value[k];
40601
+ if ("dinNptu".includes(letter) || letter === "a") {
40602
+ const rest = value.slice(k + 1);
40603
+ const operand = rest.length > 0 ? rest : args[i2 + 1]?.value ?? "";
40604
+ if (rest.length === 0)
40605
+ i2 += 1;
40606
+ if (letter === "a" && operand.includes("["))
40607
+ this.context.opaque("arithmetic");
40608
+ break;
40609
+ }
40610
+ }
40611
+ continue;
40612
+ }
40613
+ if (subscriptOrExpands(args[i2]))
40614
+ this.context.opaque("arithmetic");
40615
+ }
40616
+ }
40617
+ /** A plain `NAME=value` whose value holds a subscript: dangerous once NAME is `-i` or `-n`. */
40618
+ noteBracketAssignment(word2) {
40619
+ if (word2 === void 0)
40620
+ return;
40621
+ const equals = word2.value.indexOf("=");
40622
+ if (equals <= 0)
40623
+ return;
40624
+ const value = word2.value.slice(equals + 1);
40625
+ if (value.includes("[") || word2.expands && /[$`]/.test(value))
40626
+ this.context.bracketAssigned();
40627
+ }
40315
40628
  /** Read the payload of `bash -c payload` as a command line of its own. */
40316
40629
  nestedShell(shell, payload) {
40317
40630
  if (this.depth + 1 >= MAX_SHELL_DEPTH) {
@@ -41331,10 +41644,10 @@ __name(basename5, "basename");
41331
41644
 
41332
41645
  // ../sdk/dist/authorization/shell-paths.js
41333
41646
  var EXEC_FLAGS = /* @__PURE__ */ new Set(["-exec", "-execdir", "-ok", "-okdir"]);
41334
- function invocationOf(words2, redirections) {
41335
- if (words2.length === 0)
41647
+ function invocationOf(words3, redirections) {
41648
+ if (words3.length === 0)
41336
41649
  return void 0;
41337
- const step = unwrapReexecChain(words2);
41650
+ const step = unwrapReexecChain(words3);
41338
41651
  if (!("rest" in step))
41339
41652
  return void 0;
41340
41653
  const [head3, ...args] = step.rest;
@@ -42486,10 +42799,10 @@ function findCommands(args) {
42486
42799
  __name(findCommands, "findCommands");
42487
42800
  function layersOfWords(start, vars, used) {
42488
42801
  const layers = [];
42489
- let words2 = start;
42802
+ let words3 = start;
42490
42803
  while (used.n < MAX_LAYERS) {
42491
42804
  used.n += 1;
42492
- let head3 = words2[0];
42805
+ let head3 = words3[0];
42493
42806
  if (head3 === void 0)
42494
42807
  break;
42495
42808
  if (head3.expands) {
@@ -42497,10 +42810,10 @@ function layersOfWords(start, vars, used) {
42497
42810
  if (name3 === void 0)
42498
42811
  break;
42499
42812
  head3 = plainWord(name3);
42500
- words2 = [head3, ...words2.slice(1)];
42813
+ words3 = [head3, ...words3.slice(1)];
42501
42814
  }
42502
42815
  const program = basename5(head3.value);
42503
- const args = words2.slice(1);
42816
+ const args = words3.slice(1);
42504
42817
  layers.push({ program, args });
42505
42818
  if (program === "xargs") {
42506
42819
  const inner = xargsCommand(args);
@@ -42513,10 +42826,10 @@ function layersOfWords(start, vars, used) {
42513
42826
  layers.push(...layersOfWords(inner, vars, used));
42514
42827
  break;
42515
42828
  }
42516
- const step = skipOneReexecWrapper(words2);
42829
+ const step = skipOneReexecWrapper(words3);
42517
42830
  if (step === null || !("rest" in step) || step.rest.length === 0)
42518
42831
  break;
42519
- words2 = step.rest;
42832
+ words3 = step.rest;
42520
42833
  }
42521
42834
  return layers;
42522
42835
  }
@@ -43301,7 +43614,7 @@ __name(looksLikeNetworkPath, "looksLikeNetworkPath");
43301
43614
  function isDynamic(word2) {
43302
43615
  if (word2.substitutes || word2.expands && /[$`]/.test(word2.value))
43303
43616
  return true;
43304
- if (/\{[^{}]*(?:,|\.\.)[^{}]*\}/.test(word2.text))
43617
+ if (/\{[^{}]*(?:,|\.\.)[^{}]*\}/.test(word2.text.replace(/'[^']*'|"(?:\\.|[^"\\])*"/g, "")))
43305
43618
  return true;
43306
43619
  return /^~(?!\/|$)/.test(word2.text);
43307
43620
  }
@@ -43317,6 +43630,14 @@ function valueFits(value, kind) {
43317
43630
  return kind === "string";
43318
43631
  }
43319
43632
  __name(valueFits, "valueFits");
43633
+ function namesProcessEnvironment(word2) {
43634
+ const value = typeof word2 === "string" ? word2 : word2.value;
43635
+ if (/(?:^|\/)environ$/.test(value))
43636
+ return true;
43637
+ const text12 = typeof word2 === "string" ? word2 : word2.text;
43638
+ return /(?:^|\/)proc\//.test(value) && hasUnquotedGlob(text12);
43639
+ }
43640
+ __name(namesProcessEnvironment, "namesProcessEnvironment");
43320
43641
  function dangerousValue(value) {
43321
43642
  return /[$`]/.test(value) || looksLikeNetworkPath(value);
43322
43643
  }
@@ -43633,7 +43954,15 @@ function dockerIsReadOnly(args) {
43633
43954
  return true;
43634
43955
  }
43635
43956
  __name(dockerIsReadOnly, "dockerIsReadOnly");
43636
- function commandIsReadOnly(argv, text12) {
43957
+ var GIT_NEUTRAL_GLOBALS = /* @__PURE__ */ new Set(["--no-optional-locks", "--no-pager"]);
43958
+ function commandIsReadOnly(vector, text12) {
43959
+ let argv = vector;
43960
+ if (argv[0] === "git" && argv[1] !== void 0 && GIT_NEUTRAL_GLOBALS.has(argv[1])) {
43961
+ argv = ["git", ...argv.slice(2)];
43962
+ while (argv[1] !== void 0 && GIT_NEUTRAL_GLOBALS.has(argv[1])) {
43963
+ argv = ["git", ...argv.slice(2)];
43964
+ }
43965
+ }
43637
43966
  const [head3, ...rest] = argv;
43638
43967
  if (head3 === void 0)
43639
43968
  return false;
@@ -43676,18 +44005,18 @@ function commandIsReadOnly(argv, text12) {
43676
44005
  }
43677
44006
  let selected;
43678
44007
  for (const [key7, flagTable2] of Object.entries(FLAG_TABLES)) {
43679
- const words3 = key7.split(" ");
43680
- if (argv.length < words3.length)
44008
+ const words4 = key7.split(" ");
44009
+ if (argv.length < words4.length)
43681
44010
  continue;
43682
- if (!words3.every((w, i2) => argv[i2] === w))
44011
+ if (!words4.every((w, i2) => argv[i2] === w))
43683
44012
  continue;
43684
- if (selected === void 0 || words3.length > selected.words)
43685
- selected = { key: key7, flagTable: flagTable2, words: words3.length };
44013
+ if (selected === void 0 || words4.length > selected.words)
44014
+ selected = { key: key7, flagTable: flagTable2, words: words4.length };
43686
44015
  }
43687
44016
  if (selected === void 0)
43688
44017
  return false;
43689
- const { key: key6, flagTable, words: words2 } = selected;
43690
- const rest2 = argv.slice(words2);
44018
+ const { key: key6, flagTable, words: words3 } = selected;
44019
+ const rest2 = argv.slice(words3);
43691
44020
  for (const word2 of rest2) {
43692
44021
  if (word2.includes("$"))
43693
44022
  return false;
@@ -43698,7 +44027,7 @@ function commandIsReadOnly(argv, text12) {
43698
44027
  if (argv.some((a) => a === "-o" || a === "--server-option" || a.startsWith("--server-option=")))
43699
44028
  return false;
43700
44029
  }
43701
- if (!flagsAreVetted(argv, words2, flagTable, head3))
44030
+ if (!flagsAreVetted(argv, words3, flagTable, head3))
43702
44031
  return false;
43703
44032
  if ((GREP_FAMILY.has(head3) || head3 === "rg") && /[\n\r]/.test(text12))
43704
44033
  return false;
@@ -43725,6 +44054,8 @@ function redirectionsAreHarmless(redirections) {
43725
44054
  if (operator2 === "<") {
43726
44055
  if (looksLikeNetworkPath(value))
43727
44056
  return false;
44057
+ if (namesProcessEnvironment(target))
44058
+ return false;
43728
44059
  if (/^~(?!\/|$)/.test(target.text))
43729
44060
  return false;
43730
44061
  continue;
@@ -43764,23 +44095,25 @@ function isReadOnlyCommandLine(line, dialect = "bash") {
43764
44095
  if (!SAFE_ENVIRONMENT.has(name3) || isDynamic(word2) || word2.expands)
43765
44096
  return false;
43766
44097
  }
43767
- const words2 = command.words.slice(command.assignments);
43768
- const head3 = words2[0];
44098
+ const words3 = command.words.slice(command.assignments);
44099
+ const head3 = words3[0];
43769
44100
  if (head3 === void 0 || head3.expands || head3.quoted)
43770
44101
  return false;
43771
44102
  if (head3.value.includes("/"))
43772
44103
  return false;
43773
- if (words2.some(isDynamic))
44104
+ if (words3.some(isDynamic))
43774
44105
  return false;
43775
44106
  const plainExpansion = /* @__PURE__ */ __name((word2) => hasUnquotedGlob(word2.text) || /^~(?:\/|$)/.test(word2.text), "plainExpansion");
43776
- if (words2.some((word2) => word2.expands && !plainExpansion(word2)))
44107
+ if (words3.some((word2) => word2.expands && !plainExpansion(word2)))
43777
44108
  return false;
43778
- const glob = words2.some((word2) => word2.expands && hasUnquotedGlob(word2.text));
44109
+ const glob = words3.some((word2) => word2.expands && hasUnquotedGlob(word2.text));
43779
44110
  if (glob && !GLOB_OK.has(head3.value))
43780
44111
  return false;
43781
- if (words2.some((word2) => looksLikeNetworkPath(word2.value)))
44112
+ if (words3.some((word2) => looksLikeNetworkPath(word2.value)))
44113
+ return false;
44114
+ if (words3.some(namesProcessEnvironment))
43782
44115
  return false;
43783
- const argv = words2.map((word2) => word2.value);
44116
+ const argv = words3.map((word2) => word2.value);
43784
44117
  if (!commandIsReadOnly(argv, command.text))
43785
44118
  return false;
43786
44119
  if (head3.value === "git")
@@ -53485,7 +53818,11 @@ __name(recordModelDuration, "recordModelDuration");
53485
53818
  var PLAN_MODE_REFUSAL = "Refused: plan mode is read-only. Explore with the reading tools, then present the plan as your reply \u2014 what you would change, in which files, and in what order. The user will switch out of plan mode to have it carried out.";
53486
53819
  var STRICT_MODE_REFUSAL = "Refused: this turn only permits tools an explicit rule allows, and no rule covers this call. Asking again will not change it \u2014 either the operator adds a rule, or this has to be done another way.";
53487
53820
  var PLAN_MODE_REFUSAL_WITH_PLAN_FILE = "Refused: plan mode is read-only. Explore with the reading tools (read, glob, grep, and shell commands that only read; run git on its own, not after cd), write the plan to the plan file, then call exit_plan_mode so the user can approve it. Change nothing else before then.";
53821
+ var CLASSIFY_NESTED_REFUSAL = "auto mode reviews only the commands you run yourself, so it does not run this one from inside a skill; run it as a direct call so it can be reviewed";
53488
53822
  function nestedCallModeRefusal(mode, call2) {
53823
+ if (mode === "classify" && !call2.readOnly && !(call2.allowedByRule && call2.ruleTooWide !== true)) {
53824
+ return CLASSIFY_NESTED_REFUSAL;
53825
+ }
53489
53826
  if (mode === "plan" && !call2.readOnly) {
53490
53827
  return "plan mode only runs commands that read, and this one can change something";
53491
53828
  }
@@ -54134,7 +54471,7 @@ var ToolManager = class {
54134
54471
  return [];
54135
54472
  const descriptionPatterns = new Map(terms2.map((term) => [term, new RegExp(`(?<![a-z0-9])${escapeRegExp(term)}(?![a-z0-9])`)]));
54136
54473
  const scored = [];
54137
- for (const { tool, words: words2, name: name3, mcp } of profiles) {
54474
+ for (const { tool, words: words3, name: name3, mcp } of profiles) {
54138
54475
  const description = tool.description.toLowerCase();
54139
54476
  const argumentNames = listArgumentNames(tool);
54140
54477
  let score2 = 0;
@@ -54143,9 +54480,9 @@ var ToolManager = class {
54143
54480
  let termScore = 0;
54144
54481
  const inDescription = descriptionPatterns.get(term)?.test(description) ?? false;
54145
54482
  const inArguments = argumentNames.some((arg) => arg.includes(term));
54146
- if (words2.includes(term)) {
54483
+ if (words3.includes(term)) {
54147
54484
  termScore += mcp ? SEARCH_WEIGHT_NAME_WORD_MCP : SEARCH_WEIGHT_NAME_WORD;
54148
- } else if (words2.some((word2) => word2.includes(term))) {
54485
+ } else if (words3.some((word2) => word2.includes(term))) {
54149
54486
  termScore += mcp ? SEARCH_WEIGHT_NAME_PART_MCP : SEARCH_WEIGHT_NAME_PART;
54150
54487
  } else if (name3.includes(term)) {
54151
54488
  termScore += SEARCH_WEIGHT_NAME_ANY;
@@ -58802,7 +59139,7 @@ function refusesReasoningControls(error62) {
58802
59139
  if (/rate.?limit|too many requests|overloaded|timed? ?out|\b(429|5\d\d)\b/i.test(text12))
58803
59140
  return false;
58804
59141
  const names = /\b(thinking|reasoning|effort)\b/i.test(text12);
58805
- const rejects = /unsupported|not supported|unsupport|invalid|unknown|unrecogni[sz]ed|unexpected|not allowed|not permitted|does not (?:accept|support|allow)|not accept|extra inputs|bad request|\b400\b|\b422\b/i.test(text12);
59142
+ const rejects = /unsupported|not supported|unsupport|invalid|unknown|unrecogni[sz]ed|unexpected|not allowed|not permitted|does not (?:accept|support|allow)|not accept|extra inputs|bad request|\b400\b|\b422\b|\brequires\b|would not prove/i.test(text12);
58806
59143
  return names && rejects;
58807
59144
  }
58808
59145
  __name(refusesReasoningControls, "refusesReasoningControls");
@@ -59727,6 +60064,75 @@ function withoutVoidAssistantTurns(messages) {
59727
60064
  }
59728
60065
  __name(withoutVoidAssistantTurns, "withoutVoidAssistantTurns");
59729
60066
 
60067
+ // ../sdk/dist/runtime/query/turn/check-scope.js
60068
+ function words2(line) {
60069
+ const out = [];
60070
+ for (const match of line.matchAll(/'[^']*'|"[^"]*"|\S+/gu))
60071
+ out.push(match[0]);
60072
+ return out;
60073
+ }
60074
+ __name(words2, "words");
60075
+ var FILTER_WITH_VALUE = /* @__PURE__ */ new Set(["-t", "--testNamePattern", "-k", "--grep", "-g"]);
60076
+ var looksLikePath = /* @__PURE__ */ __name((word2) => !word2.startsWith("-") && !word2.startsWith("@") && (word2.includes("/") || /\.[cm]?[jt]sx?$/u.test(word2)), "looksLikePath");
60077
+ function scopeOf(command) {
60078
+ const all = words2(command);
60079
+ while (all.length > 0 && /^[A-Za-z_]\w*=/u.test(all[0]))
60080
+ all.shift();
60081
+ const program = [];
60082
+ const options = [];
60083
+ const paths2 = [];
60084
+ let filtered2 = false;
60085
+ let seenPath = false;
60086
+ for (let at2 = 0; at2 < all.length; at2++) {
60087
+ const word2 = all[at2];
60088
+ if (word2 === "--")
60089
+ continue;
60090
+ if (FILTER_WITH_VALUE.has(word2)) {
60091
+ filtered2 = true;
60092
+ at2++;
60093
+ continue;
60094
+ }
60095
+ if (/^--(?:testNamePattern|grep)=/u.test(word2)) {
60096
+ filtered2 = true;
60097
+ continue;
60098
+ }
60099
+ if (word2.startsWith("--reporter")) {
60100
+ if (!word2.includes("="))
60101
+ at2++;
60102
+ continue;
60103
+ }
60104
+ if (looksLikePath(word2)) {
60105
+ seenPath = true;
60106
+ paths2.push(word2.replace(/\/+$/u, ""));
60107
+ } else if (word2.startsWith("-") && program.length > 0)
60108
+ options.push(word2);
60109
+ else if (!seenPath)
60110
+ program.push(word2);
60111
+ else
60112
+ return void 0;
60113
+ }
60114
+ if (program.length === 0)
60115
+ return void 0;
60116
+ return { program: program.join(" "), options: options.sort(), paths: paths2, filtered: filtered2 };
60117
+ }
60118
+ __name(scopeOf, "scopeOf");
60119
+ function laterRunCovers(later, earlier) {
60120
+ const after = scopeOf(later);
60121
+ const before = scopeOf(earlier);
60122
+ if (after === void 0 || before === void 0)
60123
+ return false;
60124
+ if (after.filtered || after.program !== before.program)
60125
+ return false;
60126
+ if (before.options.some((option) => !after.options.includes(option)))
60127
+ return false;
60128
+ if (after.paths.length === 0)
60129
+ return true;
60130
+ if (before.paths.length === 0)
60131
+ return false;
60132
+ return before.paths.every((path2) => after.paths.some((held3) => path2 === held3 || path2.startsWith(`${held3}/`)));
60133
+ }
60134
+ __name(laterRunCovers, "laterRunCovers");
60135
+
59730
60136
  // ../sdk/dist/runtime/query/turn/outcome-ledger.js
59731
60137
  var MAX_REMEMBERED_PATHS = 1e3;
59732
60138
  var MAX_REMEMBERED_CHECKS = 200;
@@ -60185,6 +60591,12 @@ var OutcomeLedger = class {
60185
60591
  return earlier;
60186
60592
  this.checks.delete(key6);
60187
60593
  this.checks.set(key6, state);
60594
+ if (state.result === "passed") {
60595
+ for (const [held3, check4] of this.checks) {
60596
+ if (check4.result === "failed" && laterRunCovers(key6, held3))
60597
+ this.checks.delete(held3);
60598
+ }
60599
+ }
60188
60600
  if (this.checks.size > MAX_REMEMBERED_CHECKS) {
60189
60601
  for (const [candidate, held3] of this.checks) {
60190
60602
  if (held3.result !== "failed" && candidate !== key6) {
@@ -60207,6 +60619,8 @@ var OutcomeLedger = class {
60207
60619
  if (facts.background === true || facts.continued === true || facts.timedOut === true) {
60208
60620
  return { result: "unsettled", ...withCode };
60209
60621
  }
60622
+ if (facts.signal !== void 0 && exitCode === void 0)
60623
+ return { result: "unsettled" };
60210
60624
  if (exitCode === void 0) {
60211
60625
  return { result: call2.isError === true ? "failed" : "unsettled" };
60212
60626
  }
@@ -66348,20 +66762,20 @@ function poisonedByWrapperAssignment(wrapper, name3) {
66348
66762
  return `${wrapper} ${name3}=\u2026 sets ${name3} for the command that follows, so a literal name after it cannot be trusted to resolve to what its text says`;
66349
66763
  }
66350
66764
  __name(poisonedByWrapperAssignment, "poisonedByWrapperAssignment");
66351
- function findDashC(words2, flags, withArg, optionalAttached = []) {
66765
+ function findDashC(words3, flags, withArg, optionalAttached = []) {
66352
66766
  let i2 = 0;
66353
- while (i2 < words2.length) {
66354
- const w = words2[i2];
66767
+ while (i2 < words3.length) {
66768
+ const w = words3[i2];
66355
66769
  if (!LITERAL2(w))
66356
- return { rest: words2.slice(i2) };
66770
+ return { rest: words3.slice(i2) };
66357
66771
  if (w.value === "-c" || w.value === "--command") {
66358
- const payload = words2[i2 + 1];
66772
+ const payload = words3[i2 + 1];
66359
66773
  if (payload === void 0)
66360
66774
  return { unknown: `${w.value} was given no command` };
66361
66775
  return { payload };
66362
66776
  }
66363
66777
  if (w.value === "--")
66364
- return { rest: words2.slice(i2 + 1) };
66778
+ return { rest: words3.slice(i2 + 1) };
66365
66779
  if (flags.has(w.value)) {
66366
66780
  i2 += 1;
66367
66781
  continue;
@@ -66382,19 +66796,19 @@ function findDashC(words2, flags, withArg, optionalAttached = []) {
66382
66796
  if (/^--?[A-Za-z]/.test(w.value)) {
66383
66797
  return { unknown: `an option this does not read: ${w.value}` };
66384
66798
  }
66385
- return { rest: words2.slice(i2) };
66799
+ return { rest: words3.slice(i2) };
66386
66800
  }
66387
- return { rest: words2.slice(i2) };
66801
+ return { rest: words3.slice(i2) };
66388
66802
  }
66389
66803
  __name(findDashC, "findDashC");
66390
- function skipOptions2(words2, flags, withArg, explicit) {
66804
+ function skipOptions2(words3, flags, withArg, explicit) {
66391
66805
  let i2 = 0;
66392
- while (i2 < words2.length) {
66393
- const w = words2[i2];
66806
+ while (i2 < words3.length) {
66807
+ const w = words3[i2];
66394
66808
  if (!LITERAL2(w))
66395
- return { rest: words2.slice(i2) };
66809
+ return { rest: words3.slice(i2) };
66396
66810
  if (w.value === "--")
66397
- return { rest: words2.slice(i2 + 1) };
66811
+ return { rest: words3.slice(i2 + 1) };
66398
66812
  const reason = explicit?.get(w.value);
66399
66813
  if (reason !== void 0)
66400
66814
  return { unknown: reason };
@@ -66418,15 +66832,15 @@ function skipOptions2(words2, flags, withArg, explicit) {
66418
66832
  if (/^--?[A-Za-z]/.test(w.value)) {
66419
66833
  return { unknown: `an option this does not read: ${w.value}` };
66420
66834
  }
66421
- return { rest: words2.slice(i2) };
66835
+ return { rest: words3.slice(i2) };
66422
66836
  }
66423
66837
  return { none: true };
66424
66838
  }
66425
66839
  __name(skipOptions2, "skipOptions");
66426
- function unwrapXargs(words2) {
66840
+ function unwrapXargs(words3) {
66427
66841
  const flags = /* @__PURE__ */ new Set(["-0", "-o", "-p", "-r", "-t", "-x", "--null", "--open-tty", "--verbose"]);
66428
66842
  const withArg = /* @__PURE__ */ new Set(["-a", "-d", "-E", "-e", "-I", "-i", "-L", "-l", "-n", "-P", "-s"]);
66429
- const skipped = skipOptions2(words2, flags, withArg);
66843
+ const skipped = skipOptions2(words3, flags, withArg);
66430
66844
  if ("unknown" in skipped)
66431
66845
  return skipped;
66432
66846
  const rest = "none" in skipped ? [] : skipped.rest;
@@ -66446,10 +66860,10 @@ function unwrapXargs(words2) {
66446
66860
  return { rest };
66447
66861
  }
66448
66862
  __name(unwrapXargs, "unwrapXargs");
66449
- function unwrapOnce(words2) {
66450
- const head3 = words2[0];
66863
+ function unwrapOnce(words3) {
66864
+ const head3 = words3[0];
66451
66865
  const name3 = basename5(head3.value);
66452
- const rest = words2.slice(1);
66866
+ const rest = words3.slice(1);
66453
66867
  switch (name3) {
66454
66868
  case "xargs":
66455
66869
  return unwrapXargs(rest);
@@ -66580,8 +66994,8 @@ function resolveEvalPayload(args, dialect) {
66580
66994
  return resolveScriptPrograms(reading.commands, dialect).flatMap((entry) => entry.positions);
66581
66995
  }
66582
66996
  __name(resolveEvalPayload, "resolveEvalPayload");
66583
- function resolveChain(words2, dialect) {
66584
- let current2 = words2;
66997
+ function resolveChain(words3, dialect) {
66998
+ let current2 = words3;
66585
66999
  for (let depth = 0; depth < MAX_WRAPPER_DEPTH2; depth += 1) {
66586
67000
  const head3 = current2[0];
66587
67001
  if (head3 === void 0)
@@ -66674,21 +67088,21 @@ function resolveWatchArgs(rest, dialect) {
66674
67088
  return usesExec ? resolveChain(afterOptions, dialect) : resolveEvalPayload(afterOptions, dialect);
66675
67089
  }
66676
67090
  __name(resolveWatchArgs, "resolveWatchArgs");
66677
- function findExecPositions(words2, dialect) {
67091
+ function findExecPositions(words3, dialect) {
66678
67092
  const positions = [];
66679
- for (let i2 = 0; i2 < words2.length; i2 += 1) {
66680
- const w = words2[i2];
67093
+ for (let i2 = 0; i2 < words3.length; i2 += 1) {
67094
+ const w = words3[i2];
66681
67095
  if (!LITERAL2(w) || !/^-(?:exec|execdir|ok|okdir)$/.test(w.value))
66682
67096
  continue;
66683
67097
  const clauseStart = i2 + 1;
66684
67098
  let k = clauseStart;
66685
- while (k < words2.length) {
66686
- const term = words2[k];
67099
+ while (k < words3.length) {
67100
+ const term = words3[k];
66687
67101
  if (LITERAL2(term) && (term.value === ";" || term.value === "+"))
66688
67102
  break;
66689
67103
  k += 1;
66690
67104
  }
66691
- const clause = words2.slice(clauseStart, k);
67105
+ const clause = words3.slice(clauseStart, k);
66692
67106
  if (clause.length === 0) {
66693
67107
  positions.push({ unknown: `find's ${w.value} clause has no program` });
66694
67108
  } else {
@@ -66746,8 +67160,8 @@ var DYNAMIC_RESOLUTION_VARIABLES = /* @__PURE__ */ new Set([
66746
67160
  "ENV",
66747
67161
  "IFS"
66748
67162
  ]);
66749
- function assignsPoisoningVariable(words2) {
66750
- for (const word2 of words2) {
67163
+ function assignsPoisoningVariable(words3) {
67164
+ for (const word2 of words3) {
66751
67165
  const name3 = assignmentName2(word2);
66752
67166
  if (name3 !== null && DYNAMIC_RESOLUTION_VARIABLES.has(name3))
66753
67167
  return true;
@@ -67331,11 +67745,11 @@ function followsAndChain(parsed) {
67331
67745
  __name(followsAndChain, "followsAndChain");
67332
67746
  var NO_MATCHES = "No matches found";
67333
67747
  var SEARCH_WORDS = /* @__PURE__ */ new Set(["grep", "rg", "egrep", "fgrep"]);
67334
- function gitSubcommand(words2) {
67335
- if (words2[0] !== "git")
67748
+ function gitSubcommand(words3) {
67749
+ if (words3[0] !== "git")
67336
67750
  return void 0;
67337
- for (let i2 = 1; i2 < words2.length; i2++) {
67338
- const word2 = words2[i2];
67751
+ for (let i2 = 1; i2 < words3.length; i2++) {
67752
+ const word2 = words3[i2];
67339
67753
  if (word2.startsWith("-")) {
67340
67754
  if (word2 === "-C" || word2 === "-c")
67341
67755
  i2 += 1;
@@ -67347,10 +67761,10 @@ function gitSubcommand(words2) {
67347
67761
  }
67348
67762
  __name(gitSubcommand, "gitSubcommand");
67349
67763
  function questionNote(command) {
67350
- const words2 = command.trim().split(/\s+/);
67351
- const first = words2[0] ?? "";
67764
+ const words3 = command.trim().split(/\s+/);
67765
+ const first = words3[0] ?? "";
67352
67766
  if (first === "git") {
67353
- const sub = gitSubcommand(words2);
67767
+ const sub = gitSubcommand(words3);
67354
67768
  if (sub === "diff")
67355
67769
  return "Files differ";
67356
67770
  if (sub === "grep")
@@ -67462,8 +67876,8 @@ function shellShownFiles(line, sandboxed) {
67462
67876
  continue;
67463
67877
  if (command.redirections.some(writes2))
67464
67878
  return [];
67465
- const words2 = command.words.slice(command.assignments);
67466
- const head3 = words2[0];
67879
+ const words3 = command.words.slice(command.assignments);
67880
+ const head3 = words3[0];
67467
67881
  if (head3 === void 0)
67468
67882
  continue;
67469
67883
  if (head3.expands || head3.quoted || head3.substitutes)
@@ -67472,8 +67886,8 @@ function shellShownFiles(line, sandboxed) {
67472
67886
  const feedsPipe = next2 === "|";
67473
67887
  const fedByPipe = joins[index - 1] === "|";
67474
67888
  if (head3.value === "cd") {
67475
- const target = words2[1];
67476
- if (words2.length !== 2 || target === void 0 || target.expands || target.substitutes || target.value === "" || target.value.startsWith("-") || target.value.startsWith("~") || next2 !== "&&") {
67889
+ const target = words3[1];
67890
+ if (words3.length !== 2 || target === void 0 || target.expands || target.substitutes || target.value === "" || target.value.startsWith("-") || target.value.startsWith("~") || next2 !== "&&") {
67477
67891
  return [];
67478
67892
  }
67479
67893
  prefix = isAbsolute7(target.value) ? target.value : join19(prefix, target.value);
@@ -67492,8 +67906,8 @@ function shellShownFiles(line, sandboxed) {
67492
67906
  let scriptGiven = false;
67493
67907
  let optionsEnded = false;
67494
67908
  let ranged = false;
67495
- for (let i2 = 1; i2 < words2.length; i2 += 1) {
67496
- const word2 = words2[i2];
67909
+ for (let i2 = 1; i2 < words3.length; i2 += 1) {
67910
+ const word2 = words3[i2];
67497
67911
  if (word2 === void 0)
67498
67912
  continue;
67499
67913
  const value = word2.value;
@@ -67520,8 +67934,8 @@ function shellShownFiles(line, sandboxed) {
67520
67934
  return [];
67521
67935
  let whole = printer.partial !== true && !ranged && !feedsPipe;
67522
67936
  if (head3.value === "sed") {
67523
- const script = words2.slice(1).find((w) => !w.value.startsWith("-"));
67524
- if (!words2.some((w) => w.value === "-n") || script === void 0 || !PRINT_RANGE.test(script.value)) {
67937
+ const script = words3.slice(1).find((w) => !w.value.startsWith("-"));
67938
+ if (!words3.some((w) => w.value === "-n") || script === void 0 || !PRINT_RANGE.test(script.value)) {
67525
67939
  return [];
67526
67940
  }
67527
67941
  whole = whole && PRINT_ALL.test(script.value);
@@ -68311,7 +68725,13 @@ var PROTECTED_DIRECTORIES = [
68311
68725
  ".yarn",
68312
68726
  ".mvn"
68313
68727
  ];
68314
- var PROTECTED_NESTED_DIRECTORIES = [[".config", "git"]];
68728
+ var PROTECTED_NESTED_DIRECTORIES = [
68729
+ [".config", "git"],
68730
+ // A skill, agent or command folder is read back as instructions, and a
68731
+ // skill's hooks run commands. `.agents/skills` is one of the folders Namzu
68732
+ // loads skills from, at every level from the checkout root down.
68733
+ [".agents", "skills"]
68734
+ ];
68315
68735
  var PROTECTED_FILE_NAMES = [
68316
68736
  ".gitconfig",
68317
68737
  ".gitmodules",
@@ -68352,14 +68772,19 @@ var PROTECTED_FILE_NAMES = [
68352
68772
  "gradle-wrapper.properties",
68353
68773
  "maven-wrapper.properties",
68354
68774
  ".devcontainer.json",
68355
- "pyrightconfig.json"
68775
+ "pyrightconfig.json",
68776
+ // A skill file declares hooks (shell commands run later, outside the bash
68777
+ // prompt) and the tools it pre-approves, wherever the folder it sits in is.
68778
+ "SKILL.md"
68356
68779
  ];
68780
+ var PROTECTED_ROOT_DIRECTORIES = ["skills"];
68357
68781
  var PROJECT_DIRECTORY_AUTHORED_FOLDERS = [
68358
68782
  "skills",
68359
68783
  "agents",
68360
68784
  "commands"
68361
68785
  ];
68362
68786
  var PROJECT_DIRECTORY = ".namzu";
68787
+ var SKILL_FILE = "skill.md";
68363
68788
  function fold2(name3) {
68364
68789
  return name3.toLowerCase().replace(/ı/g, "i").replace(/ſ/g, "s");
68365
68790
  }
@@ -68367,15 +68792,19 @@ __name(fold2, "fold");
68367
68792
  var AUTHORED = new Set(PROJECT_DIRECTORY_AUTHORED_FOLDERS.map(fold2));
68368
68793
  var DIRECTORIES = new Set(PROTECTED_DIRECTORIES.map(fold2));
68369
68794
  var FILE_NAMES = new Set(PROTECTED_FILE_NAMES.map(fold2));
68795
+ var ROOT_DIRECTORIES = new Set(PROTECTED_ROOT_DIRECTORIES.map(fold2));
68370
68796
  var NESTED = PROTECTED_NESTED_DIRECTORIES.map((sequence) => sequence.map(fold2));
68371
- function isProtectedPath(path2) {
68797
+ function isProtectedPath(path2, options = {}) {
68372
68798
  const segments = path2.split(/[\\/]+/).map(fold2);
68799
+ const first = segments[0];
68800
+ if (first !== void 0 && ROOT_DIRECTORIES.has(first) && segments.length > 1)
68801
+ return true;
68373
68802
  let excused = false;
68374
68803
  for (let index = 0; index < segments.length; index += 1) {
68375
68804
  const segment2 = segments[index];
68376
68805
  if (!DIRECTORIES.has(segment2))
68377
68806
  continue;
68378
- if (segment2 === PROJECT_DIRECTORY && !excused) {
68807
+ if (segment2 === PROJECT_DIRECTORY && !excused && options.remoteSession === true) {
68379
68808
  const next2 = segments[index + 1];
68380
68809
  if (next2 !== void 0 && AUTHORED.has(next2)) {
68381
68810
  excused = true;
@@ -68391,7 +68820,9 @@ function isProtectedPath(path2) {
68391
68820
  }
68392
68821
  }
68393
68822
  const last = segments[segments.length - 1];
68394
- return last !== void 0 && last !== "" && FILE_NAMES.has(last);
68823
+ if (last === void 0 || last === "" || !FILE_NAMES.has(last))
68824
+ return false;
68825
+ return !(excused && last === SKILL_FILE);
68395
68826
  }
68396
68827
  __name(isProtectedPath, "isProtectedPath");
68397
68828
 
@@ -68536,10 +68967,10 @@ function topLevelEntriesOfMovers(reading, options) {
68536
68967
  found.add(hit);
68537
68968
  }
68538
68969
  } else if (program === "mv") {
68539
- const words2 = positionals(args);
68970
+ const words3 = positionals(args);
68540
68971
  if (args.some((a) => a.value === "-t" || a.value.startsWith("--target-directory")))
68541
68972
  continue;
68542
- const paths2 = words2.map((w) => literal2(w, options.home, cwd));
68973
+ const paths2 = words3.map((w) => literal2(w, options.home, cwd));
68543
68974
  const sources = paths2.slice(0, -1);
68544
68975
  for (const source of sources) {
68545
68976
  if (source === void 0)
@@ -68549,7 +68980,7 @@ function topLevelEntriesOfMovers(reading, options) {
68549
68980
  found.add(hit);
68550
68981
  }
68551
68982
  const dest = paths2[paths2.length - 1];
68552
- if (dest !== void 0 && words2.length >= 2) {
68983
+ if (dest !== void 0 && words3.length >= 2) {
68553
68984
  const hit = topLevelEntryChange(dest, "mv", options.home, options.exists);
68554
68985
  if (hit !== void 0)
68555
68986
  found.add(hit);
@@ -68961,6 +69392,21 @@ var CLASSIFIER_DELEGATION_TOOLS = /* @__PURE__ */ new Set([
68961
69392
  "create_task",
68962
69393
  "continue_task"
68963
69394
  ]);
69395
+ function allowedCallTooWide(call2) {
69396
+ if (CLASSIFIER_DELEGATION_TOOLS.has(call2.name.toLowerCase()))
69397
+ return true;
69398
+ const argument = call2.tool?.commandArgument;
69399
+ if (call2.tool === void 0 || argument === void 0)
69400
+ return false;
69401
+ if ((call2.allowScope ?? allowRuleScope(call2.allowRule ?? null)) === "tool")
69402
+ return true;
69403
+ const line = call2.input?.[argument];
69404
+ if (typeof line !== "string")
69405
+ return true;
69406
+ const reading = readShellLine(line, call2.tool.commandDialect?.({ sandboxed: false }) ?? "sh");
69407
+ return !reading.complete || reading.invocations.some(launchesCode);
69408
+ }
69409
+ __name(allowedCallTooWide, "allowedCallTooWide");
68964
69410
  var ACCEPT_EDITS_SHELL_COMMANDS = /* @__PURE__ */ new Set([
68965
69411
  "mkdir",
68966
69412
  "touch",
@@ -68970,7 +69416,7 @@ var ACCEPT_EDITS_SHELL_COMMANDS = /* @__PURE__ */ new Set([
68970
69416
  "cp",
68971
69417
  "sed"
68972
69418
  ]);
68973
- var SCREEN_CONSENT_UNATTENDED_REFUSAL = "Refused: this call would send what is on the user's screen to the model provider, which a person agrees to once per session, and nobody can be asked in this session. Nothing in this batch ran. Tell the user computer use needs their consent in an interactive session.";
69419
+ var SCREEN_CONSENT_UNATTENDED_REFUSAL = "Refused: this call would send what is on the user's screen to the model provider, which a person agrees to once per session, and nobody can be asked in this session. Nothing in this batch ran. Do not try again in this run, and do not reach the screen another way. Tell the user computer use needs their consent in an interactive session, or a rule that allows this call by name.";
68974
69420
  var SCREEN_CONSENT_DECLINED_FEEDBACK = "The user declined to share their screen in this session. Nothing in this batch ran. Do not take screenshots or read windows again; ask the user how they want to proceed.";
68975
69421
  function directoryToAllow(path2) {
68976
69422
  const last = path2.split(/[\\/]/).pop() ?? "";
@@ -69223,21 +69669,12 @@ function createReviewHandler(options = {}) {
69223
69669
  return [found, baseline].every((reading2) => reading2.outsidePaths.length === 0 && reading2.protectedPaths.length === 0 && reading2.dangerousRemoval === void 0);
69224
69670
  }, "shellFileCommandsInRoots");
69225
69671
  const acceptEditsAllows = /* @__PURE__ */ __name(async (tc, sessionId5) => !tc.authorization?.explicitReview && tc.escalation === void 0 && !tc.isDestructive && tc.requiresApproval !== true && (ACCEPT_EDITS_TOOLS.has(tc.name) || exempt(tc.name, tc.input) || await shellFileCommandsInRoots(tc, sessionId5)), "acceptEditsAllows");
69226
- const allowRuleTooWide = /* @__PURE__ */ __name((tc) => {
69227
- if (CLASSIFIER_DELEGATION_TOOLS.has(tc.name.toLowerCase()))
69228
- return true;
69229
- const tool = toolOf(tc.name);
69230
- const argument = tool?.commandArgument;
69231
- if (tool === void 0 || argument === void 0)
69232
- return false;
69233
- if (tc.authorization?.allowScope === "tool")
69234
- return true;
69235
- const line = tc.input?.[argument];
69236
- if (typeof line !== "string")
69237
- return true;
69238
- const reading = readShellLine(line, tool.commandDialect?.({ sandboxed: false }) ?? "sh");
69239
- return !reading.complete || reading.invocations.some(launchesCode);
69240
- }, "allowRuleTooWide");
69672
+ const allowRuleTooWide = /* @__PURE__ */ __name((tc) => allowedCallTooWide({
69673
+ name: tc.name,
69674
+ tool: toolOf(tc.name),
69675
+ input: tc.input,
69676
+ allowScope: tc.authorization?.allowScope
69677
+ }), "allowRuleTooWide");
69241
69678
  const neverSent = /* @__PURE__ */ __name(async (tc, sessionId5) => {
69242
69679
  if (tc.authorization?.decision === "allow" && !allowRuleTooWide(tc))
69243
69680
  return true;
@@ -69260,17 +69697,19 @@ function createReviewHandler(options = {}) {
69260
69697
  return request.type === "plan_approval" ? { action: "approve_plan" } : { action: "continue" };
69261
69698
  }
69262
69699
  let answered;
69263
- const ask = /* @__PURE__ */ __name(async (screenConsent) => answered ?? prompt({
69700
+ const ask = /* @__PURE__ */ __name(async (screenConsent, shown2) => answered ?? prompt({
69264
69701
  sessionId: request.sessionId,
69265
69702
  turnId: request.turnId,
69266
- toolCalls: request.toolCalls,
69703
+ toolCalls: shown2 ?? request.toolCalls,
69267
69704
  ...screenConsent ? { screenConsent } : {},
69268
69705
  ...request.perCall ? { perCall: true } : {},
69269
69706
  ...request.perCall && context2?.signal ? { signal: context2.signal } : {}
69270
69707
  }), "ask");
69271
69708
  const consent = options.screenConsent;
69272
69709
  const sessionKey = String(request.sessionId ?? "");
69273
- if (consent && mode !== "auto" && !consent.sessions.has(sessionKey) && request.toolCalls.some((tc) => tc.authorization?.decision !== "allow" && tc.authorization?.decision !== "deny" && capturesScreen2(tc.name, tc.input))) {
69710
+ if (consent && // `auto` answers for a person who is there; with nobody to ask it cannot
69711
+ // answer for them, so the first look is refused in every mode.
69712
+ (mode !== "auto" || !prompt) && !consent.sessions.has(sessionKey) && request.toolCalls.some((tc) => tc.authorization?.decision !== "allow" && tc.authorization?.decision !== "deny" && capturesScreen2(tc.name, tc.input))) {
69274
69713
  if (mode === "strict")
69275
69714
  return { action: "reject_tools", feedback: STRICT_MODE_REFUSAL };
69276
69715
  if (!prompt)
@@ -69311,8 +69750,8 @@ function createReviewHandler(options = {}) {
69311
69750
  if (mode === "strict")
69312
69751
  return { action: "reject_tools", feedback: STRICT_MODE_REFUSAL };
69313
69752
  if (isPermissive(mode)) {
69314
- const askPerson = /* @__PURE__ */ __name(async (escapes3) => {
69315
- const answer2 = await ask();
69753
+ const askPerson = /* @__PURE__ */ __name(async (escapes3, shown2) => {
69754
+ const answer2 = await ask(void 0, shown2);
69316
69755
  if (answer2.kind === "reject") {
69317
69756
  return {
69318
69757
  action: "reject_tools",
@@ -69333,6 +69772,15 @@ function createReviewHandler(options = {}) {
69333
69772
  if (mode === "classify" && !classified) {
69334
69773
  const classifier = options.classifier;
69335
69774
  const transcript = context2?.transcript() ?? [];
69775
+ const unsettled = /* @__PURE__ */ __name(async () => {
69776
+ const kept = [];
69777
+ for (const call2 of request.toolCalls) {
69778
+ if (call2.authorization?.decision === "deny" || isBypassImmune(call2) || !await neverSent(call2, request.sessionId)) {
69779
+ kept.push(call2);
69780
+ }
69781
+ }
69782
+ return kept;
69783
+ }, "unsettled");
69336
69784
  for (const tc of live2) {
69337
69785
  if (isBypassImmune(tc) || await neverSent(tc, request.sessionId))
69338
69786
  continue;
@@ -69362,13 +69810,13 @@ function createReviewHandler(options = {}) {
69362
69810
  reason: "auto mode stopped: the conversation is too long for the safety check"
69363
69811
  };
69364
69812
  }
69365
- return askPerson(escapes2);
69813
+ return askPerson(escapes2, await unsettled());
69366
69814
  }
69367
69815
  transcriptTooLong = false;
69368
69816
  if (decision2.cause === "unavailable" || decision2.cause === "unreadable") {
69369
69817
  if (prompt) {
69370
69818
  options.onClassifierFellBack?.({ reason: decision2.reason });
69371
- return askPerson(escapes2);
69819
+ return askPerson(escapes2, await unsettled());
69372
69820
  }
69373
69821
  }
69374
69822
  if (decision2.noVerdictLimitReached === true) {
@@ -70383,36 +70831,36 @@ function literalPath(word2) {
70383
70831
  }
70384
70832
  __name(literalPath, "literalPath");
70385
70833
  function programWords(command) {
70386
- const words2 = command.words.slice(command.assignments);
70834
+ const words3 = command.words.slice(command.assignments);
70387
70835
  let i2 = 0;
70388
- while (i2 < words2.length && WRAPPERS.has(basename5(words2[i2].value))) {
70836
+ while (i2 < words3.length && WRAPPERS.has(basename5(words3[i2].value))) {
70389
70837
  i2 += 1;
70390
- while (i2 < words2.length && (words2[i2].value.startsWith("-") || /^[A-Za-z_][A-Za-z0-9_]*=/.test(words2[i2].value)))
70838
+ while (i2 < words3.length && (words3[i2].value.startsWith("-") || /^[A-Za-z_][A-Za-z0-9_]*=/.test(words3[i2].value)))
70391
70839
  i2 += 1;
70392
70840
  }
70393
- return words2.slice(i2);
70841
+ return words3.slice(i2);
70394
70842
  }
70395
70843
  __name(programWords, "programWords");
70396
- function gitInvocation(words2, dir) {
70397
- const program = words2[0];
70844
+ function gitInvocation(words3, dir) {
70845
+ const program = words3[0];
70398
70846
  if (program === void 0 || basename5(program.value).replace(/\.exe$/i, "") !== "git") {
70399
70847
  return void 0;
70400
70848
  }
70401
70849
  let at2 = dir;
70402
70850
  let i2 = 1;
70403
- while (i2 < words2.length) {
70404
- const word2 = words2[i2];
70851
+ while (i2 < words3.length) {
70852
+ const word2 = words3[i2];
70405
70853
  const value = word2.value;
70406
70854
  if (!value.startsWith("-"))
70407
70855
  break;
70408
70856
  if (value === "-C") {
70409
- const target = literalPath(words2[i2 + 1]);
70857
+ const target = literalPath(words3[i2 + 1]);
70410
70858
  at2 = at2 !== void 0 && target !== void 0 ? resolve12(at2, target) : void 0;
70411
70859
  i2 += 2;
70412
70860
  continue;
70413
70861
  }
70414
70862
  if (GIT_OPTIONS_WITH_VALUE.has(value)) {
70415
- const next2 = words2[i2 + 1]?.value ?? "";
70863
+ const next2 = words3[i2 + 1]?.value ?? "";
70416
70864
  if (value === "--git-dir" || value === "--work-tree" || value === "-c" && WORK_TREE_CONFIG.test(next2) || value === "--config-env" && WORK_TREE_CONFIG.test(next2))
70417
70865
  at2 = void 0;
70418
70866
  i2 += 2;
@@ -70422,19 +70870,19 @@ function gitInvocation(words2, dir) {
70422
70870
  at2 = void 0;
70423
70871
  i2 += 1;
70424
70872
  }
70425
- const sub = words2[i2]?.value;
70873
+ const sub = words3[i2]?.value;
70426
70874
  if (sub === void 0)
70427
70875
  return void 0;
70428
- return { sub, args: words2.slice(i2 + 1).map((word2) => word2.value), dir: at2 };
70876
+ return { sub, args: words3.slice(i2 + 1).map((word2) => word2.value), dir: at2 };
70429
70877
  }
70430
70878
  __name(gitInvocation, "gitInvocation");
70431
- function followedFolder(words2) {
70432
- const program = words2[0]?.value;
70879
+ function followedFolder(words3) {
70880
+ const program = words3[0]?.value;
70433
70881
  if (program !== "cd" && program !== "pushd")
70434
70882
  return void 0;
70435
- if (words2.length !== 2)
70883
+ if (words3.length !== 2)
70436
70884
  return void 0;
70437
- const arg = words2[1];
70885
+ const arg = words3[1];
70438
70886
  if (arg.value.startsWith("-") || arg.value.startsWith("+"))
70439
70887
  return void 0;
70440
70888
  const target = literalPath(arg);
@@ -70498,10 +70946,10 @@ function destructiveGitDirectory(line, dialect, cwd) {
70498
70946
  const atTop = git.origin === "line" && git.depth === 0;
70499
70947
  let dir = cwd;
70500
70948
  for (const command of before) {
70501
- const words2 = programWords(command);
70502
- if (!FOLDER_CHANGERS.has(words2[0]?.value ?? ""))
70949
+ const words3 = programWords(command);
70950
+ if (!FOLDER_CHANGERS.has(words3[0]?.value ?? ""))
70503
70951
  continue;
70504
- const target = followedFolder(words2);
70952
+ const target = followedFolder(words3);
70505
70953
  if (target === void 0 || !atTop || command.origin !== "line" || command.depth !== 0 || !inForce(command, git, top, line))
70506
70954
  return void 0;
70507
70955
  dir = resolve12(dir, target);
@@ -77715,14 +78163,32 @@ var ToolExecutor = class {
77715
78163
  }
77716
78164
  this.admitScratchpad(preparedCall);
77717
78165
  const nestedEscalation = await this.escalationOrUnfinished(preparedCall);
77718
- const reviewMode = this.config.reviewMode?.();
77719
- const modeRefusal = reviewMode === void 0 ? void 0 : nestedCallModeRefusal(reviewMode, {
77720
- readOnly: isTrustedReadOnly(nestedTool, preparedInput, this.toolSource(name3)),
77721
- allowedByRule: gateResult?.decision === "allow" && gateResult.matchedRule !== null
77722
- });
78166
+ const askMode = /* @__PURE__ */ __name(() => {
78167
+ const mode = this.config.reviewMode?.();
78168
+ return mode === void 0 ? void 0 : nestedCallModeRefusal(mode, {
78169
+ readOnly: isTrustedReadOnly(nestedTool, preparedInput, this.toolSource(name3)),
78170
+ allowedByRule: gateResult?.decision === "allow" && gateResult.matchedRule !== null,
78171
+ ruleTooWide: gateResult?.decision === "allow" && allowedCallTooWide({
78172
+ name: name3,
78173
+ tool: nestedTool,
78174
+ input: preparedInput,
78175
+ allowRule: gateResult.matchedRule
78176
+ })
78177
+ });
78178
+ }, "askMode");
78179
+ const modeRefusal = askMode();
78180
+ const handedOff2 = options?.handOff === true && modeRefusal === CLASSIFY_NESTED_REFUSAL && gateResult?.decision !== "deny";
77723
78181
  const runGranted = modeRefusal === void 0 && gateResult?.decision === "review" && gateResult.matchedRule === null && options?.allow?.({ name: name3, input: preparedInput }) === true;
77724
78182
  if (nestedEscalation || needsApproval || modeRefusal !== void 0 || gateResult && gateResult.decision !== "allow" && !runGranted) {
77725
- const reason = modeRefusal !== void 0 ? `Blocked: ${modeRefusal}.` : nestedEscalation ? "Blocked: this nested call reaches a protected path, removal floor, outside-root boundary or another safety escalation. Call it directly so it can be reviewed." : needsApproval ? `Blocked: "${name3}" requires the person's approval for every call, and an approval cannot be requested from inside another tool. Call it directly.` : gateResult?.decision === "deny" ? `Blocked by the authorization gate: ${gateResult.reason}` : `Blocked by the authorization gate: this nested call requires an explicit allow rule because an operator review cannot be opened from inside another tool. ${gateResult?.reason}`;
78183
+ if (handedOff2 && options?.beforeRun) {
78184
+ const refusal4 = await options.beforeRun({ name: name3, input: preparedInput, toolUseId: nestedId });
78185
+ signal.throwIfAborted();
78186
+ if (refusal4 !== void 0) {
78187
+ await progress.close();
78188
+ return { success: false, output: "", error: refusal4 };
78189
+ }
78190
+ }
78191
+ const reason = modeRefusal !== void 0 && !(modeRefusal === CLASSIFY_NESTED_REFUSAL && gateResult?.decision === "deny") ? `Blocked: ${modeRefusal}.` : nestedEscalation ? "Blocked: this nested call reaches a protected path, removal floor, outside-root boundary or another safety escalation. Call it directly so it can be reviewed." : needsApproval ? `Blocked: "${name3}" requires the person's approval for every call, and an approval cannot be requested from inside another tool. Call it directly.` : gateResult?.decision === "deny" ? `Blocked by the authorization gate: ${gateResult.reason}` : gateResult?.matchedRule === null ? `Blocked by the authorization gate: this nested call requires an explicit allow rule because an operator review cannot be opened from inside another tool. ${gateResult.reason}` : `Blocked by the authorization gate: a rule or safety check asked for this call, an operator review cannot be opened from inside another tool, and no allow rule lifts that: call it directly so a person can review it. ${gateResult?.reason}`;
77726
78192
  const output2 = deniedToolOutput(name3, reason);
77727
78193
  if (!this.config.recordAudit) {
77728
78194
  throw new Error(`Nested tool "${name3}" was refused, but no durable audit recorder is configured.`);
@@ -77752,7 +78218,12 @@ var ToolExecutor = class {
77752
78218
  outputLength: output2.length,
77753
78219
  ...via ? { via } : {}
77754
78220
  });
77755
- return { success: false, output: "", error: reason };
78221
+ return {
78222
+ success: false,
78223
+ output: "",
78224
+ error: reason,
78225
+ ...handedOff2 ? { data: { handedOff: true } } : {}
78226
+ };
77756
78227
  }
77757
78228
  const { toolBatchId: directBatch, approvedPaths: parentPaths, sandboxEscapeApproved: parentEscape, ...contextWithoutDirectBatch } = context2;
77758
78229
  void directBatch;
@@ -77821,6 +78292,30 @@ var ToolExecutor = class {
77821
78292
  });
77822
78293
  return { success: false, output: "", error: message };
77823
78294
  }
78295
+ const lateRefusal = askMode();
78296
+ if (lateRefusal !== void 0) {
78297
+ const message = `Blocked: ${lateRefusal}.`;
78298
+ if (this.config.recordAudit) {
78299
+ await this.config.recordAudit({
78300
+ what: { action: "tool_call", tool: name3 },
78301
+ outcome: "refused",
78302
+ reason: message
78303
+ });
78304
+ }
78305
+ await progress.close();
78306
+ await this.emitEvent({
78307
+ type: "tool_completed",
78308
+ turnId: this.config.turnId,
78309
+ toolUseId: nestedId,
78310
+ toolName: name3,
78311
+ result: deniedToolOutput(name3, message),
78312
+ isError: true,
78313
+ durationMs: Date.now() - startedAt,
78314
+ outputLength: message.length,
78315
+ ...via ? { via } : {}
78316
+ });
78317
+ return { success: false, output: "", error: message };
78318
+ }
77824
78319
  let result;
77825
78320
  try {
77826
78321
  result = await this.runOnce(name3, preparedInput, childContext, preparedCall.kind === "ready" ? preparedCall.prepared : void 0);
@@ -95713,7 +96208,7 @@ function buildEvidenceQueryInput(current2, history) {
95713
96208
  if (current2.length > 1e3 || history.length > 6 || history.some((entry) => entry.text.length > HISTORY_TEXT_MAX))
95714
96209
  return void 0;
95715
96210
  const recent = [...history].reverse();
95716
- const words2 = [
96211
+ const words3 = [
95717
96212
  ...new Set([
95718
96213
  current2,
95719
96214
  ...recent.filter((entry) => entry.role === "user").map((entry) => entry.text),
@@ -95731,27 +96226,27 @@ function buildEvidenceQueryInput(current2, history) {
95731
96226
  ...source ? { source } : {}
95732
96227
  })),
95733
96228
  tokens: [],
95734
- omittedTokens: words2.length
96229
+ omittedTokens: words3.length
95735
96230
  };
95736
96231
  const baseChars = SYSTEM.length + JSON.stringify(input2).length;
95737
96232
  if (baseChars > MAX_INPUT_CHARS)
95738
96233
  return void 0;
95739
96234
  let rowChars = 0;
95740
- for (const word2 of words2) {
96235
+ for (const word2 of words3) {
95741
96236
  if (input2.tokens.length === MAX_VOCABULARY)
95742
96237
  break;
95743
96238
  if (word2.length > 256)
95744
96239
  continue;
95745
96240
  const row = [input2.tokens.length, word2];
95746
96241
  const added = JSON.stringify(row).length + (input2.tokens.length ? 1 : 0);
95747
- const omitted = words2.length - input2.tokens.length - 1;
95748
- const counterDelta = String(omitted).length - String(words2.length).length;
96242
+ const omitted = words3.length - input2.tokens.length - 1;
96243
+ const counterDelta = String(omitted).length - String(words3.length).length;
95749
96244
  if (baseChars + rowChars + added + counterDelta > MAX_INPUT_CHARS)
95750
96245
  continue;
95751
96246
  input2.tokens.push(row);
95752
96247
  rowChars += added;
95753
96248
  }
95754
- input2.omittedTokens = words2.length - input2.tokens.length;
96249
+ input2.omittedTokens = words3.length - input2.tokens.length;
95755
96250
  return {
95756
96251
  prompt: JSON.stringify(input2),
95757
96252
  tokens: input2.tokens.map(([, word2]) => word2),
@@ -96468,8 +96963,8 @@ ${JSON.stringify({
96468
96963
  const matchesFocus = /* @__PURE__ */ __name((group) => {
96469
96964
  if (!focusKeys)
96470
96965
  return true;
96471
- const words2 = new Set(evidenceTokens(group.candidate.excerpt).map((word2) => evidenceTokenKey(word2)));
96472
- return focusKeys.some((key6) => words2.has(key6));
96966
+ const words3 = new Set(evidenceTokens(group.candidate.excerpt).map((word2) => evidenceTokenKey(word2)));
96967
+ return focusKeys.some((key6) => words3.has(key6));
96473
96968
  }, "matchesFocus");
96474
96969
  const groups = passages(candidates);
96475
96970
  const visiblePassages = passages(visibleCandidates);
@@ -96962,14 +97457,14 @@ var GIT_VALUE_OPTIONS = /* @__PURE__ */ new Set([
96962
97457
  "--super-prefix",
96963
97458
  "--config-env"
96964
97459
  ]);
96965
- function peelWrapper(words2) {
96966
- const head3 = basename5(words2[0] ?? "");
97460
+ function peelWrapper(words3) {
97461
+ const head3 = basename5(words3[0] ?? "");
96967
97462
  const valueOptions = WRAPPER_VALUE_OPTIONS[head3];
96968
97463
  if (valueOptions === void 0)
96969
97464
  return void 0;
96970
97465
  let index = 1;
96971
- while (index < words2.length) {
96972
- const word2 = words2[index];
97466
+ while (index < words3.length) {
97467
+ const word2 = words3[index];
96973
97468
  if (word2 === "--") {
96974
97469
  index += 1;
96975
97470
  break;
@@ -96990,21 +97485,21 @@ function peelWrapper(words2) {
96990
97485
  }
96991
97486
  if (head3 === "flock")
96992
97487
  index += 1;
96993
- const rest = words2.slice(index);
97488
+ const rest = words3.slice(index);
96994
97489
  return rest.length > 0 ? rest : void 0;
96995
97490
  }
96996
97491
  __name(peelWrapper, "peelWrapper");
96997
- function findExecutions(words2) {
96998
- if (basename5(words2[0] ?? "") !== "find")
97492
+ function findExecutions(words3) {
97493
+ if (basename5(words3[0] ?? "") !== "find")
96999
97494
  return [];
97000
97495
  const found = [];
97001
- for (let index = 1; index < words2.length; index += 1) {
97002
- const word2 = words2[index];
97496
+ for (let index = 1; index < words3.length; index += 1) {
97497
+ const word2 = words3[index];
97003
97498
  if (word2 !== "-exec" && word2 !== "-execdir" && word2 !== "-ok" && word2 !== "-okdir")
97004
97499
  continue;
97005
97500
  const body = [];
97006
- for (let next2 = index + 1; next2 < words2.length; next2 += 1) {
97007
- const each = words2[next2];
97501
+ for (let next2 = index + 1; next2 < words3.length; next2 += 1) {
97502
+ const each = words3[next2];
97008
97503
  if (each === ";" || each === ";" || each === "+")
97009
97504
  break;
97010
97505
  body.push(each);
@@ -97015,14 +97510,14 @@ function findExecutions(words2) {
97015
97510
  return found;
97016
97511
  }
97017
97512
  __name(findExecutions, "findExecutions");
97018
- function dropGitGlobals(words2) {
97019
- if (basename5(words2[0] ?? "") !== "git")
97513
+ function dropGitGlobals(words3) {
97514
+ if (basename5(words3[0] ?? "") !== "git")
97020
97515
  return void 0;
97021
97516
  const kept = ["git"];
97022
97517
  let index = 1;
97023
97518
  let dropped = false;
97024
- while (index < words2.length) {
97025
- const word2 = words2[index];
97519
+ while (index < words3.length) {
97520
+ const word2 = words3[index];
97026
97521
  if (!word2.startsWith("-"))
97027
97522
  break;
97028
97523
  const name3 = word2.split("=")[0];
@@ -97038,32 +97533,32 @@ function dropGitGlobals(words2) {
97038
97533
  }
97039
97534
  if (!dropped)
97040
97535
  return void 0;
97041
- return [...kept, ...words2.slice(index)];
97536
+ return [...kept, ...words3.slice(index)];
97042
97537
  }
97043
97538
  __name(dropGitGlobals, "dropGitGlobals");
97044
97539
  function variantsOf(start) {
97045
97540
  const seen = /* @__PURE__ */ new Map();
97046
97541
  const queue = [[...start]];
97047
97542
  while (queue.length > 0 && seen.size < MAX_VARIANTS) {
97048
- const words2 = queue.shift();
97049
- const key6 = words2.join("\0");
97543
+ const words3 = queue.shift();
97544
+ const key6 = words3.join("\0");
97050
97545
  if (seen.has(key6))
97051
97546
  continue;
97052
- seen.set(key6, words2);
97053
- const first = words2[0];
97547
+ seen.set(key6, words3);
97548
+ const first = words3[0];
97054
97549
  if (first === void 0)
97055
97550
  continue;
97056
- const peeled = peelWrapper(words2);
97551
+ const peeled = peelWrapper(words3);
97057
97552
  if (peeled !== void 0)
97058
97553
  queue.push([...peeled]);
97059
- for (const body of findExecutions(words2))
97554
+ for (const body of findExecutions(words3))
97060
97555
  queue.push(body);
97061
- const git = dropGitGlobals(words2);
97556
+ const git = dropGitGlobals(words3);
97062
97557
  if (git !== void 0)
97063
97558
  queue.push([...git]);
97064
97559
  const base3 = basename5(first);
97065
97560
  if (base3 !== first)
97066
- queue.push([base3, ...words2.slice(1)]);
97561
+ queue.push([base3, ...words3.slice(1)]);
97067
97562
  }
97068
97563
  return [...seen.values()];
97069
97564
  }
@@ -97075,13 +97570,13 @@ function readHookCommand(line) {
97075
97570
  const candidates = /* @__PURE__ */ new Set();
97076
97571
  let unknowable = false;
97077
97572
  for (const command of lexed.commands) {
97078
- const words2 = command.words.slice(command.assignments);
97079
- const head3 = words2[0];
97573
+ const words3 = command.words.slice(command.assignments);
97574
+ const head3 = words3[0];
97080
97575
  if (head3 === void 0)
97081
97576
  continue;
97082
97577
  if (head3.expands && /[$`]/.test(head3.text))
97083
97578
  unknowable = true;
97084
- for (const variant of variantsOf(words2.map((word2) => word2.value))) {
97579
+ for (const variant of variantsOf(words3.map((word2) => word2.value))) {
97085
97580
  candidates.add(variant.join(" "));
97086
97581
  }
97087
97582
  }
@@ -99732,7 +100227,7 @@ function findInlineShell(text12) {
99732
100227
  running += line.length + 1;
99733
100228
  }
99734
100229
  const endOf = /* @__PURE__ */ __name((i3) => starts[i3] + lines2[i3].length, "endOf");
99735
- const fenced = [];
100230
+ const fenced2 = [];
99736
100231
  let i2 = 0;
99737
100232
  while (i2 < lines2.length) {
99738
100233
  const line = lines2[i2];
@@ -99753,7 +100248,7 @@ function findInlineShell(text12) {
99753
100248
  const start = starts[i2];
99754
100249
  const end = endOf(close);
99755
100250
  markers.push({ kind: "fence", start, end, command, raw: source.slice(start, end) });
99756
- fenced.push({ from: start, to: end });
100251
+ fenced2.push({ from: start, to: end });
99757
100252
  }
99758
100253
  i2 = close + 1;
99759
100254
  continue;
@@ -99773,7 +100268,7 @@ function findInlineShell(text12) {
99773
100268
  }
99774
100269
  }
99775
100270
  const last = close === -1 ? lines2.length - 1 : close;
99776
- fenced.push({ from: starts[i2], to: endOf(last) });
100271
+ fenced2.push({ from: starts[i2], to: endOf(last) });
99777
100272
  i2 = last + 1;
99778
100273
  continue;
99779
100274
  }
@@ -99781,7 +100276,7 @@ function findInlineShell(text12) {
99781
100276
  i2 += 1;
99782
100277
  }
99783
100278
  let at2 = 0;
99784
- for (const gap of fenced) {
100279
+ for (const gap of fenced2) {
99785
100280
  if (gap.from > at2)
99786
100281
  for (const m of inlineMarkers(source, at2, gap.from))
99787
100282
  markers.push(m);
@@ -99944,6 +100439,8 @@ function shellContextAt(prefix) {
99944
100439
  wordStart = false;
99945
100440
  continue;
99946
100441
  }
100442
+ if (i2 === prefix.length - 1)
100443
+ return "unsafe";
99947
100444
  }
99948
100445
  if (c === "`") {
99949
100446
  const end = skipTo(i2 + 1, "`");
@@ -100001,14 +100498,14 @@ function shellQuoteWord(word2) {
100001
100498
  }
100002
100499
  __name(shellQuoteWord, "shellQuoteWord");
100003
100500
  function typedWords(value) {
100004
- const words2 = [];
100501
+ const words3 = [];
100005
100502
  let current2 = "";
100006
100503
  let inWord = false;
100007
100504
  for (let i2 = 0; i2 < value.length; i2++) {
100008
100505
  const c = value[i2];
100009
100506
  if (/\s/.test(c)) {
100010
100507
  if (inWord)
100011
- words2.push(current2);
100508
+ words3.push(current2);
100012
100509
  current2 = "";
100013
100510
  inWord = false;
100014
100511
  continue;
@@ -100045,20 +100542,20 @@ function typedWords(value) {
100045
100542
  current2 += c;
100046
100543
  }
100047
100544
  if (inWord)
100048
- words2.push(current2);
100049
- return words2;
100545
+ words3.push(current2);
100546
+ return words3;
100050
100547
  }
100051
100548
  __name(typedWords, "typedWords");
100052
100549
  function quoteForCommand(value, prefix, dialect) {
100053
100550
  if (dialect === "cmd") {
100054
- const words2 = typedWords(value);
100055
- if (words2.every((word2) => /^[\w.\\/:=+,@-]+$/.test(word2)))
100056
- return words2.join(" ");
100551
+ const words3 = typedWords(value);
100552
+ if (words3.every((word2) => /^[\w.\\/:=+,@-]+$/.test(word2)))
100553
+ return words3.join(" ");
100057
100554
  throw new InlineShellError("A value given to this skill or command has characters that cannot be put safely inside a command for the Windows command interpreter, so it was not loaded.", "injection");
100058
100555
  }
100059
100556
  const context2 = shellContextAt(prefix);
100060
100557
  if (context2 === "unsafe" || value.includes("`")) {
100061
- throw new InlineShellError(context2 === "unsafe" ? "A value given to this skill or command would land inside a here-document or a ${...} or arithmetic expansion of a shell command, where it cannot be quoted, so it was not loaded." : "A value given to this skill or command contains a backtick, which cannot be put inside a shell command, so it was not loaded.", "injection");
100558
+ throw new InlineShellError(context2 === "unsafe" ? "A value given to this skill or command would land inside a here-document, a ${...} or arithmetic expansion, or right after a bare $ of a shell command, where it cannot be quoted, so it was not loaded." : "A value given to this skill or command contains a backtick, which cannot be put inside a shell command, so it was not loaded.", "injection");
100062
100559
  }
100063
100560
  if (context2 === "single")
100064
100561
  return value.replaceAll("'", "'\\''");
@@ -100107,6 +100604,7 @@ function substituteEscaped(template, values, options = {}) {
100107
100604
  return marker.kind === "inline" ? marker.start + 2 : neutral.indexOf("\n", marker.start) + 1;
100108
100605
  }, "commandAt");
100109
100606
  let out = "";
100607
+ const landed = [];
100110
100608
  for (const piece of pieces) {
100111
100609
  if (typeof piece === "string") {
100112
100610
  out += piece;
@@ -100114,9 +100612,22 @@ function substituteEscaped(template, values, options = {}) {
100114
100612
  }
100115
100613
  const value = values[piece.token];
100116
100614
  const from = commandAt(piece.at);
100117
- out += from === void 0 ? escapeBetween(value, piece.before, piece.after) : quoteForCommand(value, neutral.slice(from, piece.at), options.dialect ?? hostCommandShell().dialect);
100118
- }
100119
- if (findInlineShell(out).length > markers.length) {
100615
+ const put = from === void 0 ? escapeBetween(value, piece.before, piece.after) : quoteForCommand(value, neutral.slice(from, piece.at), options.dialect ?? hostCommandShell().dialect);
100616
+ landed.push({ at: piece.at, outAt: out.length, length: put.length });
100617
+ out += put;
100618
+ }
100619
+ const inOutput = /* @__PURE__ */ __name((at2) => {
100620
+ let shift = 0;
100621
+ for (const place of landed) {
100622
+ if (place.at >= at2)
100623
+ break;
100624
+ shift += place.length - 1;
100625
+ }
100626
+ return at2 + shift;
100627
+ }, "inOutput");
100628
+ const expected = markers.map((m) => `${m.kind}\0${out.slice(inOutput(m.start), inOutput(m.end))}`);
100629
+ const found = findInlineShell(out).map((m) => `${m.kind}\0${m.raw}`);
100630
+ if (expected.length !== found.length || expected.some((raw, index) => raw !== found[index])) {
100120
100631
  throw new InlineShellError("A value given to this skill or command contains text that would start a shell command, so it was not loaded.", "injection");
100121
100632
  }
100122
100633
  return out;
@@ -100177,6 +100688,7 @@ async function expandInlineShell(text12, options) {
100177
100688
  }
100178
100689
  }
100179
100690
  const replacements = [];
100691
+ const handedOff2 = [];
100180
100692
  let total2 = 0;
100181
100693
  for (const marker of markers) {
100182
100694
  options.signal?.throwIfAborted();
@@ -100190,6 +100702,11 @@ async function expandInlineShell(text12, options) {
100190
100702
  if (outcome.kind === "denied") {
100191
100703
  throw new InlineShellError(`Shell command permission check failed for pattern "${pattern}": ${outcome.reason}`, "permission");
100192
100704
  }
100705
+ if (outcome.kind === "handoff") {
100706
+ handedOff2.push(marker.command);
100707
+ replacements.push(handedOff2.length - 1);
100708
+ continue;
100709
+ }
100193
100710
  if (outcome.kind === "hook") {
100194
100711
  const verdict2 = outcome.verdict;
100195
100712
  if (verdict2.kind === "stop") {
@@ -100217,9 +100734,48 @@ async function expandInlineShell(text12, options) {
100217
100734
  replacements.push(shaped);
100218
100735
  }
100219
100736
  let n = 0;
100220
- return replaceMarkers(source, markers, () => replacements[n++]);
100737
+ if (handedOff2.length === 0) {
100738
+ return replaceMarkers(source, markers, () => replacements[n++]);
100739
+ }
100740
+ const { header: header2, spot } = handOffNotes(handedOff2);
100741
+ const body = replaceMarkers(source, markers, () => {
100742
+ const r = replacements[n++];
100743
+ return typeof r === "number" ? spot(r) : r;
100744
+ });
100745
+ return header2 === "" ? body : `${header2}
100746
+
100747
+ ${body}`;
100221
100748
  }
100222
100749
  __name(expandInlineShell, "expandInlineShell");
100750
+ function fenced(command) {
100751
+ const longest = Math.max(0, ...(command.match(/`+/g) ?? []).map((run2) => run2.length));
100752
+ const fence = "`".repeat(Math.max(3, longest + 1));
100753
+ return `${fence}
100754
+ ${command}
100755
+ ${fence}`;
100756
+ }
100757
+ __name(fenced, "fenced");
100758
+ function handOffNotes(commands) {
100759
+ const plain = /* @__PURE__ */ __name((command) => !/[`\n]/.test(command), "plain");
100760
+ if (commands.length === 1) {
100761
+ const command = commands[0];
100762
+ const lead = "[run this first, exactly as written, with the bash tool and use its output:";
100763
+ const note = plain(command) ? `${lead} \`${command}\`]` : `${lead}]
100764
+ ${fenced(command)}`;
100765
+ return { header: "", spot: /* @__PURE__ */ __name(() => note, "spot") };
100766
+ }
100767
+ const head3 = `[Run these ${commands.length} commands first, exactly as written, with the bash tool, and use their output where each is named below. Run them one per call.]`;
100768
+ const list3 = commands.map((command, i2) => plain(command) ? `${i2 + 1}. \`${command}\`` : `${i2 + 1}.
100769
+ ${fenced(command)}`);
100770
+ return {
100771
+ header: [head3, ...list3].join("\n"),
100772
+ spot: /* @__PURE__ */ __name((i2) => {
100773
+ const command = commands[i2];
100774
+ return plain(command) ? `[output of command ${i2 + 1}, \`${command}\`]` : `[output of command ${i2 + 1}]`;
100775
+ }, "spot")
100776
+ };
100777
+ }
100778
+ __name(handOffNotes, "handOffNotes");
100223
100779
  function replaceMarkers(source, markers, replacement) {
100224
100780
  let out = "";
100225
100781
  let at2 = 0;
@@ -100371,6 +100927,7 @@ function createToolSkillShellHost(options) {
100371
100927
  try {
100372
100928
  result = await dispatch(toolName, { command }, {
100373
100929
  ...options.allow ? { allow: options.allow } : {},
100930
+ ...options.handOff ? { handOff: true } : {},
100374
100931
  beforeRun: /* @__PURE__ */ __name(async () => {
100375
100932
  const verdict2 = await beforeRun();
100376
100933
  if (verdict2.kind === "run")
@@ -100387,11 +100944,17 @@ function createToolSkillShellHost(options) {
100387
100944
  }
100388
100945
  if (hook !== void 0)
100389
100946
  return { kind: "hook", verdict: hook };
100947
+ if (!result.success && handedOff(result))
100948
+ return { kind: "handoff" };
100390
100949
  return outcomeOf(result);
100391
100950
  }
100392
100951
  };
100393
100952
  }
100394
100953
  __name(createToolSkillShellHost, "createToolSkillShellHost");
100954
+ function handedOff(result) {
100955
+ return result.data !== null && typeof result.data === "object" && result.data.handedOff === true;
100956
+ }
100957
+ __name(handedOff, "handedOff");
100395
100958
  function outcomeOf(result) {
100396
100959
  const data2 = result.data !== null && typeof result.data === "object" ? result.data : void 0;
100397
100960
  const exitCode = typeof data2?.exitCode === "number" ? data2.exitCode : void 0;
@@ -106731,6 +107294,24 @@ function resolvePattern(pattern) {
106731
107294
  __name(resolvePattern, "resolvePattern");
106732
107295
 
106733
107296
  // ../sdk/dist/plugin/hook-module/consent.js
107297
+ function hookModuleRecovery(pluginName) {
107298
+ return `Update or fix the plugin, then start a new session, or turn it off with \`namzu plugin disable ${pluginName}\`.`;
107299
+ }
107300
+ __name(hookModuleRecovery, "hookModuleRecovery");
107301
+ function endedSentence(text12) {
107302
+ const trimmed = text12.trimEnd();
107303
+ return /[.!?]$/.test(trimmed) ? trimmed : `${trimmed}.`;
107304
+ }
107305
+ __name(endedSentence, "endedSentence");
107306
+ function withHookModuleRecovery(text12, pluginName) {
107307
+ const recovery = hookModuleRecovery(pluginName);
107308
+ return text12.includes(recovery) ? text12 : `${endedSentence(text12)} ${recovery}`;
107309
+ }
107310
+ __name(withHookModuleRecovery, "withHookModuleRecovery");
107311
+ function hookFailureRecovery(pluginName) {
107312
+ return `Fix the hook, or turn the plugin off with \`namzu plugin disable ${pluginName}\`.`;
107313
+ }
107314
+ __name(hookFailureRecovery, "hookFailureRecovery");
106734
107315
  function summarizeHookModule(scan) {
106735
107316
  const events = /* @__PURE__ */ new Set();
106736
107317
  const notUsed = [];
@@ -106763,9 +107344,17 @@ function summarizeHookModule(scan) {
106763
107344
  };
106764
107345
  }
106765
107346
  __name(summarizeHookModule, "summarizeHookModule");
107347
+ var GATING_EVENTS = /* @__PURE__ */ new Set([
107348
+ "PreToolUse",
107349
+ "PermissionRequest",
107350
+ "PreSkillShellCommand"
107351
+ ]);
106766
107352
  function hookModuleConsentLines(summary2) {
106767
107353
  const lines2 = [];
106768
107354
  lines2.push(summary2.events.length > 0 ? `hooks ${summary2.events.join(", ")}` : "hooks no event that Namzu runs");
107355
+ if (summary2.events.some((event) => GATING_EVENTS.has(event))) {
107356
+ lines2.push("can approve, deny or change tool calls without asking you");
107357
+ }
106769
107358
  if (summary2.runsCommands)
106770
107359
  lines2.push("runs commands");
106771
107360
  if (summary2.readsFiles)
@@ -107026,8 +107615,8 @@ var isArray = Array.isArray || (function(obj) {
107026
107615
  return toString.call(obj) === "[object Array]";
107027
107616
  });
107028
107617
  var regexpCache = /* @__PURE__ */ Object.create(null);
107029
- function wordsRegexp(words2) {
107030
- return regexpCache[words2] || (regexpCache[words2] = new RegExp("^(?:" + words2.replace(/ /g, "|") + ")$"));
107618
+ function wordsRegexp(words3) {
107619
+ return regexpCache[words3] || (regexpCache[words3] = new RegExp("^(?:" + words3.replace(/ /g, "|") + ")$"));
107031
107620
  }
107032
107621
  __name(wordsRegexp, "wordsRegexp");
107033
107622
  function codePointToString(code) {
@@ -112528,7 +113117,7 @@ function walk(node2, enter, parents = []) {
112528
113117
  }
112529
113118
  __name(walk, "walk");
112530
113119
  function isFunctionNode(node2) {
112531
- return node2 !== void 0 && (node2.type === "FunctionDeclaration" || node2.type === "FunctionExpression" || node2.type === "ArrowFunctionExpression");
113120
+ return node2 != null && (node2.type === "FunctionDeclaration" || node2.type === "FunctionExpression" || node2.type === "ArrowFunctionExpression");
112532
113121
  }
112533
113122
  __name(isFunctionNode, "isFunctionNode");
112534
113123
  function stringValue(node2) {
@@ -113561,7 +114150,7 @@ function noteHookModule(root, out) {
113561
114150
  code: "hooks-module-scan-refused",
113562
114151
  field: "hooks",
113563
114152
  path: refusal4.file,
113564
- message: `${refusal4.file}:${refusal4.line}: ${refusal4.message}. The module does not run; its plain hook entries still load.`
114153
+ message: `${refusal4.file}:${refusal4.line}: ${refusal4.message}. The module does not run, and a tool call is refused until it is fixed or the plugin is turned off; its plain hook entries still load.`
113565
114154
  });
113566
114155
  }
113567
114156
  if (scan.refusals.length > 0)
@@ -113591,7 +114180,7 @@ function noteHookModule(root, out) {
113591
114180
  code: "hooks-module-used",
113592
114181
  field: "hooks",
113593
114182
  path: located.entry,
113594
- message: `${located.entry} runs in an isolated worker (events: ${summary2.events.join(", ") || "none"}).`
114183
+ message: `${located.entry} runs in a worker with your permissions (events: ${summary2.events.join(", ") || "none"}).`
113595
114184
  });
113596
114185
  }
113597
114186
  __name(noteHookModule, "noteHookModule");
@@ -114785,6 +115374,14 @@ var MAX_STORE_BYTES = 1024 * 1024;
114785
115374
  var DEFAULT_PROCESS_TIMEOUT_MS = 3e4;
114786
115375
  var MAX_PROCESS_TIMEOUT_MS = 10 * 6e4;
114787
115376
  var HTTP_TIMEOUT_MS = 3e4;
115377
+ var MAX_HTTP_REDIRECTS = 5;
115378
+ var CROSS_ORIGIN_HEADERS = /* @__PURE__ */ new Set([
115379
+ "accept",
115380
+ "accept-language",
115381
+ "content-type",
115382
+ "user-agent"
115383
+ ]);
115384
+ var METADATA_HEADER = /metadata/i;
114788
115385
  var STORE_FILE = "hook-module-store.json";
114789
115386
  var CHILD_ENVIRONMENT = [
114790
115387
  "PATH",
@@ -115097,25 +115694,52 @@ function createCapabilityBridge(options) {
115097
115694
  } catch {
115098
115695
  throw new Error(`${url2} is not a URL`);
115099
115696
  }
115100
- if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
115101
- throw new Error(`${parsed.protocol} is not http or https`);
115102
- }
115103
115697
  const spec = isRecord6(init) ? init : {};
115104
115698
  const headers = {};
115105
115699
  if (isRecord6(spec.headers)) {
115106
115700
  for (const [key6, value] of Object.entries(spec.headers)) {
115107
- if (typeof value === "string")
115701
+ if (typeof value === "string" && !METADATA_HEADER.test(key6) && key6.toLowerCase() !== "host")
115108
115702
  headers[key6] = value;
115109
115703
  }
115110
115704
  }
115111
115705
  if (spec.body !== void 0 && typeof spec.body !== "string")
115112
115706
  throw new Error("body is text");
115113
- const response = await fetchImpl(parsed, {
115114
- method: typeof spec.method === "string" ? spec.method : "GET",
115115
- headers,
115116
- ...typeof spec.body === "string" ? { body: spec.body } : {},
115117
- signal: AbortSignal.timeout(HTTP_TIMEOUT_MS)
115118
- });
115707
+ let method = typeof spec.method === "string" ? spec.method : "GET";
115708
+ let body = typeof spec.body === "string" ? spec.body : void 0;
115709
+ const deadline = AbortSignal.timeout(HTTP_TIMEOUT_MS);
115710
+ let response;
115711
+ for (let hop = 0; ; hop++) {
115712
+ await assertReachable(parsed, deadline);
115713
+ response = await fetchImpl(parsed, {
115714
+ method,
115715
+ headers,
115716
+ ...body !== void 0 ? { body } : {},
115717
+ redirect: "manual",
115718
+ signal: deadline
115719
+ });
115720
+ const location = response.headers.get("location");
115721
+ if (response.status < 300 || response.status >= 400 || location === null)
115722
+ break;
115723
+ await response.body?.cancel().catch(() => void 0);
115724
+ if (hop >= MAX_HTTP_REDIRECTS)
115725
+ throw new Error(`${parsed.hostname} redirected too many times`);
115726
+ let next2;
115727
+ try {
115728
+ next2 = new URL(location, parsed);
115729
+ } catch {
115730
+ throw new Error(`${parsed.hostname} redirected to something that is not an address`);
115731
+ }
115732
+ if (next2.origin !== parsed.origin) {
115733
+ for (const key6 of Object.keys(headers))
115734
+ if (!CROSS_ORIGIN_HEADERS.has(key6.toLowerCase()))
115735
+ delete headers[key6];
115736
+ }
115737
+ if (response.status === 303 || (response.status === 301 || response.status === 302) && method === "POST") {
115738
+ method = "GET";
115739
+ body = void 0;
115740
+ }
115741
+ parsed = next2;
115742
+ }
115119
115743
  const bytes2 = Buffer.from(await response.arrayBuffer());
115120
115744
  const answered = {};
115121
115745
  response.headers.forEach((value, key6) => {
@@ -115128,6 +115752,25 @@ function createCapabilityBridge(options) {
115128
115752
  text: bytes2.subarray(0, MAX_CAPABILITY_BYTES).toString("utf8")
115129
115753
  };
115130
115754
  }, "httpFetch");
115755
+ const assertReachable = /* @__PURE__ */ __name(async (target, signal) => {
115756
+ if (target.protocol !== "https:" && target.protocol !== "http:") {
115757
+ throw new Error(`${target.protocol} is not http or https`);
115758
+ }
115759
+ const loopback = target.hostname === "127.0.0.1" || target.hostname === "[::1]";
115760
+ if (target.protocol === "http:" && !(options.allowLoopbackHttp === true && loopback)) {
115761
+ throw new Error(`${target.hostname}: only https addresses are fetched`);
115762
+ }
115763
+ if (options.allowLoopbackHttp === true && loopback)
115764
+ return;
115765
+ const problem = await privateAddressProblem(target.hostname, {
115766
+ ...options.resolve !== void 0 ? { resolve: options.resolve } : {},
115767
+ proxied: options.proxied ?? proxyConfigured(process.env, target.hostname),
115768
+ signal
115769
+ });
115770
+ if (problem !== void 0)
115771
+ throw new Error(`${target.hostname} was not fetched: ${problem}`);
115772
+ }, "assertReachable");
115773
+ const allowedCalls = options.allowedCalls === void 0 ? void 0 : new Set(options.allowedCalls);
115131
115774
  return {
115132
115775
  endProcesses() {
115133
115776
  for (const child of children) {
@@ -115139,6 +115782,9 @@ function createCapabilityBridge(options) {
115139
115782
  children.clear();
115140
115783
  },
115141
115784
  async call(noun, method, args) {
115785
+ if (allowedCalls !== void 0 && !allowedCalls.has(`$.${noun}.${method}`)) {
115786
+ throw new Error(`$.${noun}.${method} is not among the calls this module declares`);
115787
+ }
115142
115788
  switch (`${noun}.${method}`) {
115143
115789
  case "fs.read":
115144
115790
  return fs.read(args);
@@ -115185,9 +115831,75 @@ __name(createCapabilityBridge, "createCapabilityBridge");
115185
115831
 
115186
115832
  // ../sdk/dist/plugin/hook-module/worker-source.js
115187
115833
  var BOOTSTRAP_SOURCE = String.raw`
115188
- (function (send, evaluate) {
115834
+ (function (hostSend, hostEvaluate) {
115189
115835
  'use strict'
115190
115836
  const MAX_LOG = 4000
115837
+ const freeze = Object.freeze
115838
+ const setPrototypeOf = Object.setPrototypeOf
115839
+ const getPrototypeOf = Object.getPrototypeOf
115840
+ const objectPrototype = Object.prototype
115841
+
115842
+ // What reaches module code from outside this realm is a frozen object with no prototype, never the object
115843
+ // itself: an error made in the worker's realm has that realm's Function behind its constructor, and a stack
115844
+ // that names its frames.
115845
+ const seal = (name, message) => {
115846
+ const line = name + ': ' + message
115847
+ const toStr = () => line
115848
+ setPrototypeOf(toStr, null)
115849
+ freeze(toStr)
115850
+ return freeze({ __proto__: null, name, message, stack: line, toString: toStr })
115851
+ }
115852
+ const SENTINEL = seal('Error', 'a call to the host failed (details unavailable)')
115853
+
115854
+ // True only for an object whose prototype chain reaches this realm's Object.prototype within 64 hops: a
115855
+ // foreign, null-terminated, throwing or over-long chain is not this realm's.
115856
+ const ownRealm = (value) => {
115857
+ let proto = value
115858
+ for (let i = 0; i < 64; i++) {
115859
+ proto = getPrototypeOf(proto)
115860
+ if (proto === objectPrototype) return true
115861
+ if (proto === null) return false
115862
+ }
115863
+ return false
115864
+ }
115865
+ const launder = (error) => {
115866
+ if (error === null || (typeof error !== 'object' && typeof error !== 'function')) return error
115867
+ try {
115868
+ if (ownRealm(error)) return error
115869
+ } catch (inner) {
115870
+ // Not readable: sealed below.
115871
+ }
115872
+ let name = 'Error'
115873
+ let message = ''
115874
+ try {
115875
+ if (typeof error.name === 'string') name = error.name
115876
+ } catch (inner) {
115877
+ // Keep the default.
115878
+ }
115879
+ try {
115880
+ if (typeof error.message === 'string') message = error.message
115881
+ } catch (inner) {
115882
+ // Keep the default.
115883
+ }
115884
+ return seal(name, message)
115885
+ }
115886
+ // Every function the worker hands in is called through this: what it throws is laundered, and nothing is
115887
+ // called or allocated between a failed launder and the throw.
115888
+ const guarded = (hostFn) => (...args) => {
115889
+ try {
115890
+ return hostFn(...args)
115891
+ } catch (error) {
115892
+ let reason = SENTINEL
115893
+ try {
115894
+ reason = launder(error)
115895
+ } catch (inner) {
115896
+ // The sentinel stands.
115897
+ }
115898
+ throw reason
115899
+ }
115900
+ }
115901
+ const send = guarded(hostSend)
115902
+ const evaluate = guarded(hostEvaluate)
115191
115903
 
115192
115904
  const post = (message) => {
115193
115905
  try {
@@ -115238,7 +115950,7 @@ function call(noun, method, args) {
115238
115950
  pendingCalls.set(id, { resolve, reject })
115239
115951
  if (!post({ t: 'call', cid: id, noun, method, args })) {
115240
115952
  pendingCalls.delete(id)
115241
- reject(new Error('the arguments of $.' + noun + '.' + method + ' are not plain data'))
115953
+ reject(seal('TypeError', 'the arguments of $.' + noun + '.' + method + ' are not plain data'))
115242
115954
  }
115243
115955
  })
115244
115956
  }
@@ -115373,7 +116085,14 @@ function loadProgram(program) {
115373
116085
  cache.set(rel, exports)
115374
116086
  const source = program.files[rel]
115375
116087
  if (typeof source !== 'string') throw new Error('no such file in the module: ' + rel)
115376
- const compiled = evaluate(rel, source)
116088
+ // The worker's evaluate is outside this realm: whatever it throws (a RangeError from a stack that ran
116089
+ // out is made in its realm) is turned into a message here, so no object of that realm is caught by a module.
116090
+ let compiled
116091
+ try {
116092
+ compiled = evaluate(rel, source)
116093
+ } catch (error) {
116094
+ compiled = 'the module could not be compiled'
116095
+ }
115377
116096
  if (typeof compiled === 'string') throw new Error(compiled)
115378
116097
  compiled(exports, load)
115379
116098
  return exports
@@ -115540,7 +116259,7 @@ function receive(json) {
115540
116259
  if (pending === undefined) return
115541
116260
  pendingCalls.delete(message.cid)
115542
116261
  if (message.ok) pending.resolve(message.value)
115543
- else pending.reject(new Error(message.message))
116262
+ else pending.reject(seal('Error', typeof message.message === 'string' ? message.message : 'the call failed'))
115544
116263
  return
115545
116264
  }
115546
116265
  }
@@ -115549,12 +116268,116 @@ function receive(json) {
115549
116268
  return receive
115550
116269
  })
115551
116270
  `;
115552
- var HOOK_WORKER_SOURCE = `const BOOTSTRAP = ${JSON.stringify("(" + BOOTSTRAP_SOURCE.trim() + ")")}
116271
+ var PREPARE_SOURCE = String.raw`(function () {
116272
+ 'use strict'
116273
+ Object.defineProperty(Error, 'prepareStackTrace', {
116274
+ value: function () { return '' },
116275
+ writable: false,
116276
+ configurable: false,
116277
+ })
116278
+ // A stack that overflows is made by the engine, not by prepareStackTrace: with no frames kept it has none to read.
116279
+ Object.defineProperty(Error, 'stackTraceLimit', { value: 0, writable: false, configurable: false })
116280
+ for (const name of ['ShadowRealm', 'WebAssembly', 'FinalizationRegistry', 'WeakRef', 'Atomics',
116281
+ 'SharedArrayBuffer', 'queueMicrotask', '$vm', 'gc', 'edenGC', 'fullGC', 'print', 'readFile', 'Loader']) {
116282
+ delete globalThis[name]
116283
+ }
116284
+ })()`;
116285
+ var FREEZE_SOURCE = String.raw`(function () {
116286
+ 'use strict'
116287
+ // A frozen prototype makes the data properties on it read-only, so "this.name = x" in an Error subclass
116288
+ // would throw: those become accessors whose setter defines the property on the receiver instead.
116289
+ function enableOverride(proto, key) {
116290
+ const d = Object.getOwnPropertyDescriptor(proto, key)
116291
+ if (!d || 'get' in d) return
116292
+ const v = d.value
116293
+ Object.defineProperty(proto, key, {
116294
+ get() { return v },
116295
+ set(nv) {
116296
+ if (this === proto) return
116297
+ Object.defineProperty(this, key, { value: nv, writable: true, enumerable: true, configurable: true })
116298
+ },
116299
+ enumerable: d.enumerable,
116300
+ configurable: true,
116301
+ })
116302
+ }
116303
+ const errorCtors = [Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, URIError,
116304
+ globalThis.AggregateError, globalThis.SuppressedError].filter(Boolean)
116305
+ for (const [proto, keys] of [
116306
+ [Object.prototype, Object.getOwnPropertyNames(Object.prototype)],
116307
+ [Function.prototype, ['toString', 'constructor', 'name', 'length']],
116308
+ [Array.prototype, ['toString', 'constructor']],
116309
+ [Date.prototype, ['toString', 'toLocaleString', 'valueOf', 'constructor']],
116310
+ ...errorCtors.map((C) => [C.prototype, ['name', 'message', 'toString', 'constructor']]),
116311
+ ]) for (const key of keys) enableOverride(proto, key)
116312
+ const freezeBoth = (C) => {
116313
+ Object.freeze(C)
116314
+ if (C.prototype) Object.freeze(C.prototype)
116315
+ }
116316
+ for (const C of [Promise, Object, Array, Function, globalThis.Iterator, Map, Set, WeakMap, WeakSet,
116317
+ String, Number, Boolean, Symbol, BigInt, Date, RegExp, ArrayBuffer, DataView, ...errorCtors,
116318
+ globalThis.DisposableStack, globalThis.AsyncDisposableStack, globalThis.Intl].filter(Boolean)) freezeBoth(C)
116319
+ for (const C of [Object.getPrototypeOf(Int8Array), Int8Array, Uint8Array, Uint8ClampedArray, Int16Array,
116320
+ Uint16Array, Int32Array, Uint32Array, globalThis.Float16Array, Float32Array, Float64Array,
116321
+ BigInt64Array, BigUint64Array].filter(Boolean)) freezeBoth(C)
116322
+ // The constructors of async, generator and async generator functions are reached only from an instance.
116323
+ for (const f of [async () => {}, function* () {}, async function* () {}]) {
116324
+ Object.freeze(f.constructor)
116325
+ Object.freeze(f.constructor.prototype)
116326
+ }
116327
+ for (const namespace of [JSON, Math, Reflect, Proxy]) Object.freeze(namespace)
116328
+ if (typeof Intl !== 'undefined') {
116329
+ for (const key of Object.getOwnPropertyNames(Intl)) {
116330
+ const C = Intl[key]
116331
+ if (typeof C === 'function') freezeBoth(C)
116332
+ }
116333
+ }
116334
+ const iterators = [
116335
+ [][Symbol.iterator](), ''[Symbol.iterator](), new Map()[Symbol.iterator](), new Set()[Symbol.iterator](),
116336
+ 'a'.matchAll(/a/g), (function* () {})(), (async function* () {})(),
116337
+ ]
116338
+ if (typeof Iterator !== 'undefined' && Iterator.from) {
116339
+ iterators.push([].values().map((x) => x), Iterator.from({ next: () => ({ done: true }) }))
116340
+ }
116341
+ try {
116342
+ if (typeof Intl !== 'undefined' && Intl.Segmenter) {
116343
+ const segments = new Intl.Segmenter().segment('a')
116344
+ iterators.push(segments, segments[Symbol.iterator]())
116345
+ }
116346
+ } catch (error) {
116347
+ // No segmenter here: nothing to freeze.
116348
+ }
116349
+ for (const it of iterators) {
116350
+ for (let p = Object.getPrototypeOf(it); p; p = Object.getPrototypeOf(p)) Object.freeze(p)
116351
+ }
116352
+ Object.defineProperty(globalThis, 'then', { value: undefined, writable: false, configurable: false })
116353
+ for (const key of Reflect.ownKeys(globalThis)) {
116354
+ const d = Object.getOwnPropertyDescriptor(globalThis, key)
116355
+ if (d && d.configurable && 'value' in d) {
116356
+ Object.defineProperty(globalThis, key, { value: d.value, writable: false, configurable: false, enumerable: d.enumerable })
116357
+ }
116358
+ }
116359
+ })()`;
116360
+ var HOOK_WORKER_SOURCE = (
116361
+ // 'use strict' is the first statement: a directive after any other statement is only an expression, so
116362
+ // it must come before the BOOTSTRAP constant for the worker's own realm to be strict.
116363
+ `'use strict'
116364
+ const BOOTSTRAP = ${JSON.stringify("(" + BOOTSTRAP_SOURCE.trim() + ")")}
116365
+ const PREPARE_SOURCE = ${JSON.stringify(PREPARE_SOURCE)}
116366
+ const FREEZE_SOURCE = ${JSON.stringify(FREEZE_SOURCE)}
115553
116367
  ` + String.raw`
115554
- 'use strict'
115555
116368
  const { parentPort } = require('node:worker_threads')
115556
116369
  const vm = require('node:vm')
115557
116370
 
116371
+ // The worker's own realm gives a script nothing to read its stack with: a stack that overflows or throws
116372
+ // is made of call sites, and a call site reaches the function that was running.
116373
+ for (const key of ['prepareStackTrace', 'stackTraceLimit']) {
116374
+ Object.defineProperty(Error, key, {
116375
+ value: key === 'stackTraceLimit' ? 0 : undefined,
116376
+ writable: false,
116377
+ configurable: false,
116378
+ })
116379
+ }
116380
+
115558
116381
  // Whatever of the worker's own realm might still be reached must not be able to make code: its
115559
116382
  // function constructors throw.
115560
116383
  {
@@ -115602,34 +116425,25 @@ const evaluate = (rel, source) => {
115602
116425
  }
115603
116426
  }
115604
116427
 
116428
+ function prepareContext() {
116429
+ // 'use strict' first, then the one Error the module has loses captureStackTrace.
116430
+ vm.runInContext("'use strict'; delete Error.captureStackTrace", context)
116431
+ vm.runInContext(PREPARE_SOURCE, context, { filename: 'plugin:prepare' })
116432
+ }
116433
+
115605
116434
  function freezeIntrinsics() {
115606
- vm.runInContext(
115607
- '(function () {' +
115608
- 'const keep = new Set(["Object", "Error"]);' +
115609
- 'for (const name of ["Object", "Array", "Function", "String", "Number", "Boolean", "Symbol", "Promise", "RegExp", "Date", "Map", "Set", "WeakMap", "WeakSet", "Error", "TypeError", "RangeError", "SyntaxError", "BigInt", "ArrayBuffer", "Uint8Array"]) {' +
115610
- 'const ctor = globalThis[name];' +
115611
- 'if (!ctor) continue;' +
115612
- 'if (ctor.prototype && !keep.has(name)) Object.freeze(ctor.prototype);' +
115613
- 'Object.freeze(ctor);' +
115614
- '}' +
115615
- 'for (const name of ["JSON", "Math", "Reflect"]) { if (globalThis[name]) Object.freeze(globalThis[name]); }' +
115616
- 'for (const key of Reflect.ownKeys(globalThis)) {' +
115617
- 'const d = Object.getOwnPropertyDescriptor(globalThis, key);' +
115618
- 'if (d && d.configurable && "value" in d) Object.defineProperty(globalThis, key, { value: d.value, writable: false, configurable: false, enumerable: d.enumerable });' +
115619
- '}' +
115620
- '})()',
115621
- context,
115622
- )
116435
+ vm.runInContext(FREEZE_SOURCE, context, { filename: 'plugin:freeze' })
115623
116436
  }
115624
116437
 
115625
116438
  let receive
115626
116439
 
115627
116440
  function start() {
115628
- // No prototype on the sandbox, so nothing of the worker's realm is found through the global.
116441
+ // No prototype on the context's global, so nothing of the worker's realm is found through the global.
115629
116442
  context = vm.createContext(Object.create(null), {
115630
116443
  name: 'plugin',
115631
116444
  codeGeneration: { strings: false, wasm: false },
115632
116445
  })
116446
+ prepareContext()
115633
116447
  receive = vm.runInContext(BOOTSTRAP, context, { filename: 'plugin:bootstrap' })(send, evaluate)
115634
116448
  freezeIntrinsics()
115635
116449
  }
@@ -115650,7 +116464,8 @@ process.on('unhandledRejection', (reason) =>
115650
116464
  process.on('uncaughtException', (error) =>
115651
116465
  post({ t: 'log', level: 'error', text: 'an uncaught error: ' + messageOf(error) }),
115652
116466
  )
115653
- `;
116467
+ `
116468
+ );
115654
116469
 
115655
116470
  // ../sdk/dist/plugin/hook-module/host.js
115656
116471
  var HOOK_MODULE_BUDGET_MS = 1e4;
@@ -115816,12 +116631,53 @@ async function startHookModule(options) {
115816
116631
  log.warn("Hooks module not loaded", { ...attrs, "namzu.hook_module.reason": why });
115817
116632
  options.onUnload?.(why);
115818
116633
  }, "unload");
115819
- const unloaded = /* @__PURE__ */ __name((why) => {
116634
+ let disposed = false;
116635
+ const recovery = hookModuleRecovery(plugin.name);
116636
+ const withRecovery = /* @__PURE__ */ __name((text12) => withHookModuleRecovery(text12, plugin.name), "withRecovery");
116637
+ const commandLabel = `module ${label5}`;
116638
+ const failurePolicy = /* @__PURE__ */ __name((event, why) => {
116639
+ log.warn("Hooks module hook failed", {
116640
+ ...attrs,
116641
+ "namzu.hook.event": event,
116642
+ "namzu.hook_module.reason": why
116643
+ });
116644
+ const closed = why.includes(recovery) ? why : `${endedSentence(why)} ${hookFailureRecovery(plugin.name)}`;
116645
+ const line = `${commandLabel}: ${closed}`;
116646
+ if (event === "pre_tool_use")
116647
+ return { action: "error", message: line };
116648
+ if (event === "pre_skill_shell_command")
116649
+ return { action: "skip", reason: line };
116650
+ return { action: "continue", notice: line };
116651
+ }, "failurePolicy");
116652
+ const guards = /* @__PURE__ */ new Set([
116653
+ "pre_tool_use",
116654
+ "pre_skill_shell_command",
116655
+ "permission_request"
116656
+ ]);
116657
+ const unloaded = /* @__PURE__ */ __name((why, refusedGuards) => {
115820
116658
  unload(why);
115821
- return { scan, status, message: why, hooks: [], dispose: /* @__PURE__ */ __name(async () => void 0, "dispose") };
116659
+ const hooks2 = [];
116660
+ for (const event of MODULE_HOOK_EVENTS) {
116661
+ if (!refusedGuards?.has(event))
116662
+ continue;
116663
+ hooks2.push({
116664
+ event,
116665
+ handler: /* @__PURE__ */ __name(async () => disposed ? { action: "continue" } : failurePolicy(event, why), "handler")
116666
+ });
116667
+ }
116668
+ return {
116669
+ scan,
116670
+ status,
116671
+ message: why,
116672
+ hooks: hooks2,
116673
+ dispose: /* @__PURE__ */ __name(async () => {
116674
+ disposed = true;
116675
+ }, "dispose")
116676
+ };
115822
116677
  }, "unloaded");
115823
116678
  if (scan.refusals.length > 0 || scan.program === void 0) {
115824
- return unloaded(`hooks module ${label5} not loaded: ${refusalLine(scan)}`);
116679
+ const seen = guards;
116680
+ return unloaded(withRecovery(`hooks module ${label5} not loaded: ${refusalLine(scan)}`), seen);
115825
116681
  }
115826
116682
  const program = scan.program;
115827
116683
  const runnable = /* @__PURE__ */ new Set();
@@ -115836,6 +116692,8 @@ async function startHookModule(options) {
115836
116692
  ...plugin.dataDir !== void 0 ? { dataDir: plugin.dataDir } : {},
115837
116693
  projectDir: options.projectDir,
115838
116694
  envNames: scan.envNames,
116695
+ // What the module's own scan declared is all its calls reach, whatever the worker sends.
116696
+ allowedCalls: scan.calls.filter((call2) => call2.supported).map((call2) => call2.call),
115839
116697
  ...options.environment !== void 0 ? { environment: options.environment } : {},
115840
116698
  ...options.fetch !== void 0 ? { fetch: options.fetch } : {},
115841
116699
  log,
@@ -116029,7 +116887,7 @@ async function startHookModule(options) {
116029
116887
  try {
116030
116888
  await start();
116031
116889
  } catch (error62) {
116032
- const why = `hooks module ${label5} failed to load: ${toErrorMessage(error62)}`;
116890
+ const why = withRecovery(`hooks module ${label5} failed to load: ${toErrorMessage(error62)}`);
116033
116891
  unload(why);
116034
116892
  return { kind: "failed", message: why };
116035
116893
  }
@@ -116071,20 +116929,6 @@ async function startHookModule(options) {
116071
116929
  worker.post({ t: "dispatch", id: id3, name: name3, e, regs: registrations });
116072
116930
  });
116073
116931
  }, "dispatch");
116074
- const commandLabel = `module ${label5}`;
116075
- const failurePolicy = /* @__PURE__ */ __name((event, why) => {
116076
- log.warn("Hooks module hook failed", {
116077
- ...attrs,
116078
- "namzu.hook.event": event,
116079
- "namzu.hook_module.reason": why
116080
- });
116081
- const line = `${commandLabel}: ${why}`;
116082
- if (event === "pre_tool_use")
116083
- return { action: "error", message: line };
116084
- if (event === "pre_skill_shell_command")
116085
- return { action: "skip", reason: line };
116086
- return { action: "continue", notice: line };
116087
- }, "failurePolicy");
116088
116932
  const hooks = [];
116089
116933
  for (const event of MODULE_HOOK_EVENTS) {
116090
116934
  if (!runnable.has(event))
@@ -116093,17 +116937,20 @@ async function startHookModule(options) {
116093
116937
  hooks.push({
116094
116938
  event,
116095
116939
  handler: /* @__PURE__ */ __name(async (context2) => {
116096
- if (status === "unloaded")
116097
- return { action: "continue" };
116940
+ if (status === "unloaded") {
116941
+ if (disposed || !guards.has(event))
116942
+ return { action: "continue" };
116943
+ return failurePolicy(event, message ?? `hooks module ${label5} is not loaded`);
116944
+ }
116098
116945
  const input2 = shellHookInputFor(event, context2, options.shell, { toolNames: "written" });
116099
116946
  const payload = JSON.parse(shellHookPayload(input2));
116100
116947
  const e = event === "pre_tool_use" ? toolEnvelope(payload) : payload;
116101
116948
  try {
116102
116949
  await start();
116103
116950
  } catch (error62) {
116104
- const why = `hooks module ${label5} failed to load: ${toErrorMessage(error62)}`;
116951
+ const why = withRecovery(`hooks module ${label5} failed to load: ${toErrorMessage(error62)}`);
116105
116952
  unload(why);
116106
- return { action: "continue", notice: why };
116953
+ return guards.has(event) ? failurePolicy(event, why) : { action: "continue", notice: why };
116107
116954
  }
116108
116955
  const registrations = [];
116109
116956
  for (const [index, events] of registrationEvents.entries()) {
@@ -116138,6 +116985,7 @@ async function startHookModule(options) {
116138
116985
  },
116139
116986
  hooks,
116140
116987
  dispose: /* @__PURE__ */ __name(async () => {
116988
+ disposed = true;
116141
116989
  status = "unloaded";
116142
116990
  await endWorker("the hooks worker was stopped");
116143
116991
  }, "dispose")
@@ -129931,16 +130779,16 @@ var InMemoryCredentialVault = class {
129931
130779
  };
129932
130780
 
129933
130781
  // ../sdk/dist/vault/instrumentation.js
129934
- function scopeOf(opts) {
130782
+ function scopeOf2(opts) {
129935
130783
  return {
129936
130784
  ...opts.sessionId !== void 0 ? { sessionId: opts.sessionId } : {},
129937
130785
  ...opts.turnId !== void 0 ? { turnId: opts.turnId } : {}
129938
130786
  };
129939
130787
  }
129940
- __name(scopeOf, "scopeOf");
130788
+ __name(scopeOf2, "scopeOf");
129941
130789
  function wrapVaultWithProbes(vault, opts = {}) {
129942
130790
  const probes = opts.probes ?? probe;
129943
- const scope = scopeOf(opts);
130791
+ const scope = scopeOf2(opts);
129944
130792
  const vaultId = opts.vaultId ?? vault.constructor.name;
129945
130793
  const tenantIdHint = opts.tenantId;
129946
130794
  return {
@@ -129996,7 +130844,7 @@ function wrapCredentialProviderWithProbes(provider, opts = {}) {
129996
130844
  // must not be.
129997
130845
  ref: ref2,
129998
130846
  ...opts.tenantId ? { tenantId: opts.tenantId } : {},
129999
- ...scopeOf(opts)
130847
+ ...scopeOf2(opts)
130000
130848
  }, buildProbeContext());
130001
130849
  }, "announce");
130002
130850
  return {
@@ -140793,7 +141641,24 @@ async function* coalesce(stream, options = { windowMs: 16 }) {
140793
141641
  __name(coalesce, "coalesce");
140794
141642
 
140795
141643
  // ../sdk/dist/runtime/query/auto-review/failure.js
140796
- function describeCheckFailure(error62, deadlineMs) {
141644
+ var DETAIL_CHARS = 140;
141645
+ var SENSITIVE_NAME = String.raw`[A-Za-z0-9_.-]*(?:key|token|secret|passw(?:or)?d|pwd|sig|signature|auth|credential|cookie|session)[A-Za-z0-9_.-]*`;
141646
+ function scrubCredentialShapes(input2) {
141647
+ return input2.replace(/(\/\/)[^/@\s]+@/g, "$1[REDACTED:userinfo]@").replace(new RegExp(String.raw`(\b${SENSITIVE_NAME}\b)(\s*[:=]\s*)(?:"[^"]*"|'[^']*'|[^\s&;,"']+)`, "gi"), "$1$2[REDACTED:secret]");
141648
+ }
141649
+ __name(scrubCredentialShapes, "scrubCredentialShapes");
141650
+ function checkFailureDetail(error62) {
141651
+ let text12 = error62 instanceof Error ? error62.message : String(error62);
141652
+ for (const [label5, pattern] of LOG_SECRET_PATTERNS) {
141653
+ pattern.lastIndex = 0;
141654
+ text12 = text12.replace(pattern, `[REDACTED:${label5}]`);
141655
+ }
141656
+ text12 = scrubCredentialShapes(text12);
141657
+ text12 = text12.replace(/\s+/g, " ").trim();
141658
+ return text12.length > DETAIL_CHARS ? `${text12.slice(0, DETAIL_CHARS - 1)}\u2026` : text12;
141659
+ }
141660
+ __name(checkFailureDetail, "checkFailureDetail");
141661
+ function describeCheckFailure(error62, deadlineMs, model) {
140797
141662
  if (error62 instanceof Error && error62.name === "DeadlineError") {
140798
141663
  return deadlineMs !== void 0 ? `timed out after ${Math.round(deadlineMs / 1e3)} s` : "timed out";
140799
141664
  }
@@ -140816,8 +141681,12 @@ function describeCheckFailure(error62, deadlineMs) {
140816
141681
  return "could not reach the provider";
140817
141682
  case "not_found":
140818
141683
  return "the check model was not found";
140819
- default:
140820
- return status !== void 0 ? `provider returned ${status}` : "provider error";
141684
+ default: {
141685
+ const head3 = status !== void 0 ? `provider returned ${status}` : "provider error";
141686
+ const where = model !== void 0 && model !== "" ? ` (${model})` : "";
141687
+ const detail = checkFailureDetail(error62);
141688
+ return detail === "" ? `${head3}${where}` : `${head3}${where}: ${detail}`;
141689
+ }
140821
141690
  }
140822
141691
  }
140823
141692
  __name(describeCheckFailure, "describeCheckFailure");
@@ -141124,6 +141993,11 @@ var DEFAULT_AUTO_REVIEW_LIMITS = { consecutive: 3, total: 20 };
141124
141993
  var DEFAULT_MAX_TRANSCRIPT_CHARS = 4e5;
141125
141994
  var DEFAULT_RETRY_DELAY = { initialDelayMs: 2e3, maxDelayMs: 1e4 };
141126
141995
  var ACTION_CHARS = 8e3;
141996
+ function statusOf3(error62) {
141997
+ const status = classifyProviderError(error62).status;
141998
+ return status !== void 0 ? { "namzu.auto_review.error_status": status } : {};
141999
+ }
142000
+ __name(statusOf3, "statusOf");
141127
142001
  var DeadlineError = class extends Error {
141128
142002
  static {
141129
142003
  __name(this, "DeadlineError");
@@ -141307,11 +142181,14 @@ ${action}${launched}${workingTree}
141307
142181
  if (request.signal?.aborted) {
141308
142182
  return blocked(started, 0, "aborted", "the review was cancelled before it finished");
141309
142183
  }
141310
- const why = describeCheckFailure(error62, options.quickDeadlineMs ?? 6e4);
142184
+ const why = describeCheckFailure(error62, options.quickDeadlineMs ?? 6e4, options.model);
141311
142185
  log.warn("auto review could not complete", {
141312
142186
  "namzu.auto_review.stage": 1,
141313
142187
  "namzu.auto_review.failure": why,
141314
- "namzu.auto_review.error": error62 instanceof Error ? error62.message : String(error62)
142188
+ "namzu.auto_review.model": options.model,
142189
+ "namzu.auto_review.error": error62 instanceof Error ? error62.message : String(error62),
142190
+ "namzu.auto_review.error_code": classifyProviderError(error62).code,
142191
+ ...statusOf3(error62)
141315
142192
  });
141316
142193
  return blocked(started, 0, "unavailable", `the safety check could not be completed (${why}), so the action was not run`);
141317
142194
  }
@@ -141327,11 +142204,14 @@ ${action}${launched}${workingTree}
141327
142204
  if (request.signal?.aborted) {
141328
142205
  return blocked(started, 1, "aborted", "the review was cancelled before it finished");
141329
142206
  }
141330
- const why = describeCheckFailure(error62, options.reasonedDeadlineMs ?? 12e4);
142207
+ const why = describeCheckFailure(error62, options.reasonedDeadlineMs ?? 12e4, options.model);
141331
142208
  log.warn("auto review could not complete", {
141332
142209
  "namzu.auto_review.stage": 2,
141333
142210
  "namzu.auto_review.failure": why,
141334
- "namzu.auto_review.error": error62 instanceof Error ? error62.message : String(error62)
142211
+ "namzu.auto_review.model": options.model,
142212
+ "namzu.auto_review.error": error62 instanceof Error ? error62.message : String(error62),
142213
+ "namzu.auto_review.error_code": classifyProviderError(error62).code,
142214
+ ...statusOf3(error62)
141335
142215
  });
141336
142216
  return blocked(started, 1, "unavailable", `a first look flagged this action and the closer look could not be completed (${why})`);
141337
142217
  }
@@ -141403,7 +142283,7 @@ var CODING_AGENT_WORKING_DOCTRINE = `## How you work
141403
142283
  This section applies only when you were asked to change something.
141404
142284
  - Begin editing once you know the first change; the requested scope is the deliverable, at the size asked. Match the surrounding idiom.
141405
142285
  - Prefer the dedicated tools over shell equivalents (\`read\` over \`cat\`, \`grep\` over a shell grep, \`glob\` over \`find\`, \`edit\` over \`sed -i\`, \`write\` over a redirect); use \`bash\` for the rest.
141406
- - For a defect, reproduce it first with a small script or a failing test; a script stays in the scratch folder unless it becomes a test. After the change, rerun it. Run the project's tests and lint or format check, and add tests for behaviour you introduced. Claim only the checks you ran.
142286
+ - For a defect, reproduce it first with a small script or a failing test; a script stays in the scratch folder unless it becomes a test. After the change, rerun it. Run the project's tests and lint or format check, and add tests for behaviour you introduced. Claim only the checks you ran; name what you skipped, and call a partial count partial.
141407
142287
  - Say where any throwaway file you made is, and which files outside the request you touched.
141408
142288
 
141409
142289
  ### Working with git
@@ -156867,7 +157747,10 @@ var JobTool = defineTool({
156867
157747
  destructive: /* @__PURE__ */ __name((input2) => input2?.action === "kill", "destructive"),
156868
157748
  concurrencySafe: true,
156869
157749
  presentCall(input2) {
156870
- const label5 = input2.action === "list" ? "List background jobs" : `${input2.action === "kill" ? "Stop background job" : "Read background output"} \xB7 ${input2.id ?? "(missing id)"}`;
157750
+ const label5 = input2.action === "list" ? "List background jobs" : (
157751
+ // No id in the row: it is the model's handle on the job, not something the person reads.
157752
+ input2.action === "kill" ? "Stop background job" : "Read background output"
157753
+ );
156871
157754
  return { kind: "generic", presentation: "activity", label: label5 };
156872
157755
  },
156873
157756
  async execute(input2, context2) {
@@ -157332,7 +158215,8 @@ var WaitForJobTool = defineTool({
157332
158215
  return {
157333
158216
  kind: "generic",
157334
158217
  presentation: "activity",
157335
- label: `${input2.output_contains === void 0 ? "Wait for background job" : "Wait for job output"} \xB7 ${input2.id ?? "(missing id)"}`
158218
+ // No id in the row: it is the model's handle on the job, not something the person reads.
158219
+ label: input2.output_contains === void 0 ? "Wait for background job" : "Wait for job output"
157336
158220
  };
157337
158221
  },
157338
158222
  async execute(input2, context2) {
@@ -157696,7 +158580,9 @@ function createSkillTool(options = {}) {
157696
158580
  const result = await expandInlineShell(text12, {
157697
158581
  host: createToolSkillShellHost({
157698
158582
  context: input2.context,
157699
- ...allow ? { allow } : {}
158583
+ ...allow ? { allow } : {},
158584
+ // Only a model loaded this, so only a model can run a command in its own call.
158585
+ ...input2.invokedBy === "model" ? { handOff: true } : {}
157700
158586
  }),
157701
158587
  commandName: input2.name,
157702
158588
  ...block !== void 0 ? { block } : {},
@@ -165299,6 +166185,8 @@ export {
165299
166185
  createMonitorStream,
165300
166186
  WebFetchRefusedError,
165301
166187
  isPrivateAddress,
166188
+ privateAddressProblem,
166189
+ proxyConfigured,
165302
166190
  GuardedFetchProvider,
165303
166191
  assertSandboxStatus,
165304
166192
  SANDBOX_ENVIRONMENTS,
@@ -165863,6 +166751,7 @@ export {
165863
166751
  PLAN_MODE_REFUSAL,
165864
166752
  STRICT_MODE_REFUSAL,
165865
166753
  PLAN_MODE_REFUSAL_WITH_PLAN_FILE,
166754
+ CLASSIFY_NESTED_REFUSAL,
165866
166755
  nestedCallModeRefusal,
165867
166756
  ToolsetConflictError,
165868
166757
  combineToolsets,
@@ -165981,6 +166870,7 @@ export {
165981
166870
  isWithin,
165982
166871
  resolveWithinReal,
165983
166872
  effectiveBashWorkingDirectory,
166873
+ pinBashWorkingDirectory,
165984
166874
  backgroundTasksDisabled,
165985
166875
  execHostShell,
165986
166876
  SANDBOX_ESCAPE_NOT_APPROVED,
@@ -166003,6 +166893,7 @@ export {
166003
166893
  UNFINISHED_CHECK_UNATTENDED_REFUSAL,
166004
166894
  CLASSIFIER_TRANSCRIPT_TOO_LONG_FEEDBACK,
166005
166895
  CLASSIFIER_SAFE_TOOLS,
166896
+ allowedCallTooWide,
166006
166897
  ACCEPT_EDITS_SHELL_COMMANDS,
166007
166898
  SCREEN_CONSENT_UNATTENDED_REFUSAL,
166008
166899
  SCREEN_CONSENT_DECLINED_FEEDBACK,
@@ -166280,6 +167171,8 @@ export {
166280
167171
  ScopedConnectorRegistry,
166281
167172
  AgentRegistry,
166282
167173
  PluginRegistry,
167174
+ hookModuleRecovery,
167175
+ withHookModuleRecovery,
166283
167176
  summarizeHookModule,
166284
167177
  hookModuleConsentLines,
166285
167178
  hookModuleConsentEntry,
@@ -166889,4 +167782,4 @@ export {
166889
167782
  WakeBudget,
166890
167783
  wakeBudgetFromEnv
166891
167784
  };
166892
- //# sourceMappingURL=chunk-QQ4S6MNH.js.map
167785
+ //# sourceMappingURL=chunk-EDLBZSB2.js.map