@qwen-code/qwen-code 0.21.0 → 0.21.1-simplify-system-prompt.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 (228) hide show
  1. package/chunks/{MaxSizedBox-5DPPWPGT.js → MaxSizedBox-INHRH72H.js} +11 -10
  2. package/chunks/{StandaloneSessionPicker-BIRMPLRD.js → StandaloneSessionPicker-O6RKBPU4.js} +25 -24
  3. package/chunks/{acpAgent-6J2U72PQ.js → acpAgent-HYFVXVDR.js} +119 -74
  4. package/chunks/{agent-6ODUANDO.js → agent-VXDAN5JK.js} +10 -9
  5. package/chunks/{agent-headless-7BYQTMHW.js → agent-headless-K4ZMMNBD.js} +10 -9
  6. package/chunks/{anthropicContentGenerator-75BKLTSP.js → anthropicContentGenerator-LXUXMOE7.js} +20 -9
  7. package/chunks/{bridge-ZUB64FAE.js → bridge-LGPZCFHO.js} +14 -13
  8. package/chunks/channel-management-service-G74LFADV.js +403 -0
  9. package/chunks/channel-settings-store-CHCDRTPY.js +89 -0
  10. package/chunks/{channel-worker-group-2ZD7TVAT.js → channel-worker-group-PTJIJSKC.js} +6 -5
  11. package/chunks/{channel-worker-manager-4OA4BCGB.js → channel-worker-manager-WIMGM2FD.js} +6 -5
  12. package/chunks/{channel-worker-supervisor-V7KCFJTS.js → channel-worker-supervisor-KUFTR6P5.js} +5 -4
  13. package/chunks/{chunk-OFDOK3VM.js → chunk-2JM6GZ5D.js} +3 -3
  14. package/chunks/{chunk-H4SBPHSA.js → chunk-2OM7GEXO.js} +1 -1
  15. package/chunks/{chunk-TGILQ3YH.js → chunk-2Q3OT4OV.js} +7 -7
  16. package/chunks/{chunk-PC6JANNU.js → chunk-2YZJCM5T.js} +4 -4
  17. package/chunks/{chunk-QAF7NMK7.js → chunk-32MVHM4T.js} +1 -1
  18. package/chunks/{chunk-K36B6G2O.js → chunk-3HBZKBMQ.js} +3 -3
  19. package/chunks/{chunk-GSN55ZRI.js → chunk-3IXOIAKE.js} +4 -4
  20. package/chunks/{chunk-IJTOWOD7.js → chunk-3JAQDSXN.js} +12 -0
  21. package/chunks/{chunk-UDX5OBWR.js → chunk-3MSHSCSN.js} +2 -2
  22. package/chunks/{chunk-ZFDTEDCF.js → chunk-4M377AZG.js} +3 -3
  23. package/chunks/{chunk-U7M2DMGW.js → chunk-52O2CIUL.js} +2 -2
  24. package/chunks/{chunk-R5AFZNQW.js → chunk-5THCYPLO.js} +3 -3
  25. package/chunks/{chunk-7MVVZO4N.js → chunk-5U4IPFBR.js} +4 -4
  26. package/chunks/{chunk-KIM5GUMA.js → chunk-66RMLJHC.js} +21 -21
  27. package/chunks/{chunk-FSITMZJH.js → chunk-6PSLCFQ2.js} +5 -5
  28. package/chunks/{chunk-ACY3A37B.js → chunk-7FZEBPKS.js} +3 -3
  29. package/chunks/{chunk-7JURR4JT.js → chunk-A6UO2C7C.js} +1 -1
  30. package/chunks/{chunk-JLU636DO.js → chunk-ALMR3E6Q.js} +1 -0
  31. package/chunks/{chunk-PWVFN2LF.js → chunk-B4UMZKMU.js} +1 -1
  32. package/chunks/{chunk-SQCQ4KO2.js → chunk-B6ZJ7SI6.js} +14 -14
  33. package/chunks/{chunk-YPE6A4GC.js → chunk-B7QDM6Z7.js} +1 -1
  34. package/chunks/{chunk-NIBLUX3Y.js → chunk-BO4XCS7P.js} +195 -3
  35. package/chunks/{chunk-WCXCRJYB.js → chunk-BRRAJXPA.js} +1 -1
  36. package/chunks/{chunk-TPRQ7RZH.js → chunk-BYFNTGKI.js} +37 -35
  37. package/chunks/{chunk-Y34KJKDC.js → chunk-C3NS4F2Q.js} +1 -1
  38. package/chunks/{chunk-Q4M4MDQ4.js → chunk-CC4N4M36.js} +1 -1
  39. package/chunks/{chunk-EBJQ6AXW.js → chunk-DM22XS4K.js} +5 -5
  40. package/chunks/{chunk-PHOF65IG.js → chunk-DM4Q4JJH.js} +1059 -722
  41. package/chunks/{chunk-JXJFVC6E.js → chunk-DN6ZX5AY.js} +3 -3
  42. package/chunks/{chunk-J24WCGIN.js → chunk-E5WH5O3C.js} +4 -4
  43. package/chunks/{chunk-4WIZGAH3.js → chunk-ER5LWJR6.js} +5 -57
  44. package/chunks/chunk-FY3M44RD.js +463 -0
  45. package/chunks/{chunk-IO3IX5Q4.js → chunk-G4WFQUYQ.js} +1 -1
  46. package/chunks/{chunk-VULLI6WQ.js → chunk-GDIPH4JY.js} +3 -3
  47. package/chunks/chunk-HV3G62R6.js +76 -0
  48. package/chunks/{chunk-YX324OPW.js → chunk-I7XZ3RY5.js} +1 -1
  49. package/chunks/{chunk-BULDBTYC.js → chunk-INADJJGW.js} +1 -26
  50. package/chunks/{chunk-RIBKPMRP.js → chunk-J6D3VXCC.js} +3 -3
  51. package/chunks/{chunk-TEHGS6UP.js → chunk-JALU3ZDU.js} +6 -6
  52. package/chunks/{chunk-YBL3QUDD.js → chunk-KIUFNBHR.js} +1 -1
  53. package/chunks/{chunk-VIA5XA4U.js → chunk-KU5XMLDK.js} +1 -1
  54. package/chunks/{chunk-KMQ33DO4.js → chunk-LG4GZIVV.js} +3 -3
  55. package/chunks/{chunk-ZNAUOR2I.js → chunk-LNARWLZQ.js} +1 -1
  56. package/chunks/{chunk-LQIW3YFY.js → chunk-LNURQEMZ.js} +4 -4
  57. package/chunks/{chunk-VRYUBFMC.js → chunk-LZEMEFKY.js} +1 -1
  58. package/chunks/{chunk-LB6DUZ26.js → chunk-M4UKFCZ2.js} +65 -46
  59. package/chunks/chunk-MK7VQDN3.js +79 -0
  60. package/chunks/{chunk-RWTEFFPU.js → chunk-ML52PL6O.js} +211 -209
  61. package/chunks/{chunk-RF3EXIHJ.js → chunk-MSLKI6C2.js} +12 -12
  62. package/chunks/{chunk-X5XDDSSH.js → chunk-MVS3NS2N.js} +1 -1
  63. package/chunks/{chunk-5NBDS5S6.js → chunk-N3FAY5CM.js} +7 -5
  64. package/chunks/{chunk-55DJUCI2.js → chunk-OJGCZBB7.js} +14 -9
  65. package/chunks/{chunk-BKHWX6I2.js → chunk-P5V4T7NK.js} +3 -3
  66. package/chunks/{chunk-LH2BYDQ5.js → chunk-PANH4R3B.js} +1 -1
  67. package/chunks/{chunk-RZIX2G32.js → chunk-PHVR5UUY.js} +1 -1
  68. package/chunks/{chunk-MZAXJAUM.js → chunk-PSWQZHEA.js} +1 -1
  69. package/chunks/{chunk-3RN6GBKS.js → chunk-QPDRAXDJ.js} +1 -1
  70. package/chunks/{chunk-2X55UKQE.js → chunk-QY5MMZ6O.js} +2 -2
  71. package/chunks/{chunk-CIKQ7KKO.js → chunk-RWS5VYWC.js} +14 -8
  72. package/chunks/{chunk-MVSUYZDT.js → chunk-SASBXAQL.js} +3 -3
  73. package/chunks/chunk-SQBYH7PX.js +1252 -0
  74. package/chunks/{chunk-MB4MZHMJ.js → chunk-SRZ6DXVG.js} +170 -389
  75. package/chunks/chunk-TF2X2WCT.js +363 -0
  76. package/chunks/{chunk-2SCDWPXI.js → chunk-TQCBGUHN.js} +2 -2
  77. package/chunks/{chunk-LK7CHLVP.js → chunk-U4VTUMMK.js} +0 -60
  78. package/chunks/{chunk-IKCX4CCL.js → chunk-U7TXFVUN.js} +6 -6
  79. package/chunks/{chunk-2NH6DYI4.js → chunk-V6VRAM7B.js} +10 -10
  80. package/chunks/{chunk-Z2BC6UJ5.js → chunk-VCBZUOSI.js} +1 -1
  81. package/chunks/{chunk-IKYJHJNF.js → chunk-VFSJ5VRH.js} +2 -2
  82. package/chunks/{chunk-LKEJ26GS.js → chunk-VV6XU5L7.js} +1 -1
  83. package/chunks/{chunk-7ZCNENPP.js → chunk-W4CQXHT6.js} +1 -1
  84. package/chunks/{chunk-HTR4WV6U.js → chunk-W4RQUHY3.js} +31 -1
  85. package/chunks/{chunk-ETSW4KLJ.js → chunk-WDSWXQU3.js} +1 -1
  86. package/chunks/{chunk-PSOO6YXD.js → chunk-XHRTVPG2.js} +8 -6
  87. package/chunks/{chunk-ZJHVAS7M.js → chunk-YAF5VNU7.js} +1 -1
  88. package/chunks/{chunk-JVPM2ULZ.js → chunk-Z5BLYMZM.js} +4 -4
  89. package/chunks/{chunk-M4FMGVY4.js → chunk-ZE5WPL4I.js} +2 -2
  90. package/chunks/{computer-use-SOQ4E3VX.js → computer-use-DOFAHZAB.js} +10 -9
  91. package/chunks/{config-utils-7V7GGIW6.js → config-utils-VFQXVGNR.js} +4 -3
  92. package/chunks/{contextCommand-JLHYA34Z.js → contextCommand-QIZYHDR5.js} +12 -11
  93. package/chunks/{create-sub-session-QRJLW5BV.js → create-sub-session-7543K2QA.js} +10 -9
  94. package/chunks/{daemon-YO6433NF.js → daemon-VOMQW7KZ.js} +189 -0
  95. package/chunks/{daemon-status-provider-2233Q37D.js → daemon-status-provider-OS5UWBHV.js} +18 -17
  96. package/chunks/{dist-WEAHOXDM.js → dist-ANLAT3GS.js} +1 -1
  97. package/chunks/{dist-BBLXMS3N.js → dist-BRB6EXK4.js} +1 -1
  98. package/chunks/{dist-YFNEUWSE.js → dist-K6Y4E7FX.js} +1 -1
  99. package/chunks/{dist-F6IBUDR4.js → dist-KTYYJ2C5.js} +1 -1
  100. package/chunks/{dist-46NQKLTW.js → dist-NNVBBOGU.js} +2 -2
  101. package/chunks/{dist-AIKFMUKK.js → dist-RTJFMNEZ.js} +1 -1
  102. package/chunks/{earlyInputCapture-A7NDU3PF.js → earlyInputCapture-WQT24RWD.js} +10 -9
  103. package/chunks/{edit-OBDSQURM.js → edit-RIEOJWKB.js} +10 -9
  104. package/chunks/{enter-worktree-U6MRPQ2P.js → enter-worktree-OGK5FQ3R.js} +10 -9
  105. package/chunks/{enterPlanMode-BC5QUZZ2.js → enterPlanMode-IWZYALIB.js} +10 -9
  106. package/chunks/{environment-W5UFC2CH.js → environment-VZ7BRI4Q.js} +12 -11
  107. package/chunks/{errors-M7CLORXH.js → errors-PCX25DVP.js} +12 -11
  108. package/chunks/{exit-worktree-DGNYMECB.js → exit-worktree-4TEYVIVP.js} +10 -9
  109. package/chunks/{exitPlanMode-GXTBWQAR.js → exitPlanMode-GHPUHBZJ.js} +38 -18
  110. package/chunks/{fast-path-JJZFJANL.js → fast-path-HYE7IFEV.js} +5 -5
  111. package/chunks/{gemini-QS36EBZV.js → gemini-NGRQX3YJ.js} +54 -51
  112. package/chunks/{geminiContentGenerator-AG4KB6CV.js → geminiContentGenerator-FQHPFZSR.js} +36 -7
  113. package/chunks/{glob-V7R3PSK3.js → glob-FRTM3X2E.js} +10 -9
  114. package/chunks/{grep-QYPSK7OP.js → grep-RKWVROCW.js} +10 -9
  115. package/chunks/{handleAutoUpdate-6DBEZYPV.js → handleAutoUpdate-2CZQRJ66.js} +14 -13
  116. package/chunks/{i18n-VUJJZIMU.js → i18n-XEQVMRKN.js} +11 -10
  117. package/chunks/{image-gen-Z3VPGKRC.js → image-gen-WIEM7KZA.js} +1 -1
  118. package/chunks/{initializer-UWAK5U5O.js → initializer-OVGZ4FLY.js} +15 -14
  119. package/chunks/{installationInfo-6O2YAA52.js → installationInfo-5UUQJI6Y.js} +11 -10
  120. package/chunks/{list-GB4ESM3T.js → list-HODU6RXD.js} +18 -17
  121. package/chunks/{loadedSettingsAdapter-OT6JVQ7U.js → loadedSettingsAdapter-TYNLBALY.js} +15 -14
  122. package/chunks/{loggingContentGenerator-HS3S5H3Q.js → loggingContentGenerator-WGM27QAW.js} +55 -91
  123. package/chunks/{managed-npm-update-JYEMMXA3.js → managed-npm-update-JQ2CG3RH.js} +11 -10
  124. package/chunks/{mcp-6DBDJPFU.js → mcp-J3DFWX4A.js} +15 -14
  125. package/chunks/{monitor-R3ODH5U6.js → monitor-7FEWXX5F.js} +10 -9
  126. package/chunks/{nonInteractiveCli-MOYCYBBU.js → nonInteractiveCli-F4GYSMHT.js} +50 -47
  127. package/chunks/{notebook-edit-BNOK452R.js → notebook-edit-JGJV2K6J.js} +10 -9
  128. package/chunks/{openaiContentGenerator-WMCU3O2H.js → openaiContentGenerator-JPVXDTAO.js} +8 -7
  129. package/chunks/{pidfile-TFRZZZIO.js → pidfile-4VNAR3EP.js} +10 -9
  130. package/chunks/{processUtils-RT7UNCC2.js → processUtils-V2LCK6T6.js} +2 -2
  131. package/chunks/{qwenContentGenerator-HHCRK4SX.js → qwenContentGenerator-TICV2W2Z.js} +12 -11
  132. package/chunks/{qwenOAuth2-OWLB5AKH.js → qwenOAuth2-XGFI5XJG.js} +1 -1
  133. package/chunks/{read-file-APMO3PSX.js → read-file-LZXUR4TO.js} +5 -5
  134. package/chunks/{resumeHistoryUtils-6KRYEAWZ.js → resumeHistoryUtils-65OX3SGJ.js} +14 -13
  135. package/chunks/{ripGrep-BEJDEDXW.js → ripGrep-2U2FRGMV.js} +10 -9
  136. package/chunks/{run-qwen-serve-FU6HEM4J.js → run-qwen-serve-3VCV4I7E.js} +69 -33
  137. package/chunks/{runtime-XXRRTNP6.js → runtime-AXJWIEDU.js} +20 -18
  138. package/chunks/{scheduler-G2ZS2Z7E.js → scheduler-RS2I6RU5.js} +10 -9
  139. package/chunks/{sdk-exporters-http-FYBSUCPD.js → sdk-exporters-http-FS6ZV7MF.js} +2 -2
  140. package/chunks/{sdk-impl-GMVPB7NB.js → sdk-impl-7FZSCSXB.js} +6 -6
  141. package/chunks/{serve-7BSTXJ4T.js → serve-W2GC47CM.js} +16 -15
  142. package/chunks/{server-4UMH7OIZ.js → server-HRZ23U7M.js} +499 -93
  143. package/chunks/{session-K3O3Q2SV.js → session-7XHZKTVV.js} +51 -48
  144. package/chunks/{settings-CR2EWTBA.js → settings-7ZGZDXAS.js} +14 -13
  145. package/chunks/{shell-HH3PF3A2.js → shell-45IPBDP5.js} +10 -9
  146. package/chunks/{skill-I3SDA4MB.js → skill-LIWXNLDW.js} +7 -6
  147. package/chunks/{spawnChannel-RWNDBXGA.js → spawnChannel-PVXQ5AGV.js} +12 -11
  148. package/chunks/{src-GE4TTTML.js → src-AY65BYR7.js} +36 -17
  149. package/chunks/{standalone-update-Q6WFRZZQ.js → standalone-update-ZMFNKAEY.js} +12 -11
  150. package/chunks/{startInteractiveUI-SLZGHRPH.js → startInteractiveUI-IW3CSKHA.js} +87 -88
  151. package/chunks/{team-create-YJALH5D2.js → team-create-O2FROQ4R.js} +10 -9
  152. package/chunks/{team-plan-approval-34QFYKGN.js → team-plan-approval-Q6WDBXTQ.js} +10 -9
  153. package/chunks/{theme-manager-SWRILQHI.js → theme-manager-YYPZFBAH.js} +10 -9
  154. package/chunks/{tool-search-NF7GB6LE.js → tool-search-APECNQ3Z.js} +5 -5
  155. package/chunks/{total-session-admission-DLHHHLD3.js → total-session-admission-JXES723M.js} +14 -13
  156. package/chunks/{tree-sitter-4D7QS7F6.js → tree-sitter-FS4VPMZA.js} +1 -1
  157. package/chunks/{tree-sitter-bash-VEJGF5XF.js → tree-sitter-bash-6B46JJCV.js} +1 -1
  158. package/chunks/{trustedFolders-KHXHY6PY.js → trustedFolders-HVI7IXUH.js} +11 -10
  159. package/chunks/{update-relaunch-WBUZJC5O.js → update-relaunch-ON5MDJQG.js} +5 -5
  160. package/chunks/{updateCheck-RKL6M5XN.js → updateCheck-WUJGHWZZ.js} +13 -12
  161. package/chunks/{useAutoAcceptIndicator-CFQ5BUJL.js → useAutoAcceptIndicator-CHSTZLZD.js} +17 -16
  162. package/chunks/{validateNonInterActiveAuth-3R223G3R.js → validateNonInterActiveAuth-JBLKBKRD.js} +47 -44
  163. package/chunks/{version-HS7YSFHV.js → version-LTNUBQJY.js} +1 -1
  164. package/chunks/{web-fetch-NKCSG7ZE.js → web-fetch-L5UTI53V.js} +5 -5
  165. package/chunks/{web-search-S62WAP4S.js → web-search-KM33JOS3.js} +2 -2
  166. package/chunks/{workflow-QAGU5RU4.js → workflow-K7FAWV77.js} +11 -10
  167. package/chunks/{workspace-providers-status-QSVZUETE.js → workspace-providers-status-GAKSF4LL.js} +18 -17
  168. package/chunks/{workspace-registration-store-24JMHDGF.js → workspace-registration-store-6TGVDJV5.js} +1 -1
  169. package/chunks/{workspace-registry-UT4RBNBM.js → workspace-registry-A7NQUONG.js} +14 -13
  170. package/chunks/{workspace-service-JFWRUS4V.js → workspace-service-STGVSO4N.js} +19 -18
  171. package/chunks/{workspace-skills-status-ZBBKJOI2.js → workspace-skills-status-66AK3DUA.js} +16 -15
  172. package/chunks/{write-file-VHIXW5M7.js → write-file-HUUCEG4P.js} +10 -9
  173. package/cli.js +12 -12
  174. package/package.json +3 -3
  175. package/web-shell/assets/{arc-DcbWnB9T.js → arc-BbHijhiN.js} +1 -1
  176. package/web-shell/assets/{architectureDiagram-3BPJPVTR-kMMF5sud.js → architectureDiagram-3BPJPVTR-Cb4B_JD0.js} +1 -1
  177. package/web-shell/assets/{blockDiagram-GPEHLZMM-Htl9vTJS.js → blockDiagram-GPEHLZMM-Dsjlh3H-.js} +1 -1
  178. package/web-shell/assets/{c4Diagram-AAUBKEIU-BnZnm0mQ.js → c4Diagram-AAUBKEIU-Cp5AeR4U.js} +1 -1
  179. package/web-shell/assets/channel-Bzdx6E8P.js +1 -0
  180. package/web-shell/assets/{chunk-2J33WTMH-DziB7kDG.js → chunk-2J33WTMH-CLcY7W2e.js} +1 -1
  181. package/web-shell/assets/{chunk-4BX2VUAB-CmkD8daw.js → chunk-4BX2VUAB-BUhvY2LR.js} +1 -1
  182. package/web-shell/assets/{chunk-55IACEB6-CHAd9A_U.js → chunk-55IACEB6-kDIFC_71.js} +1 -1
  183. package/web-shell/assets/{chunk-727SXJPM-Dqaam3fE.js → chunk-727SXJPM-CIBO15f2.js} +1 -1
  184. package/web-shell/assets/{chunk-AQP2D5EJ-D_-saBYM.js → chunk-AQP2D5EJ-BJ_T_slV.js} +1 -1
  185. package/web-shell/assets/{chunk-FMBD7UC4-B9r_veWD.js → chunk-FMBD7UC4-BEkW35J8.js} +1 -1
  186. package/web-shell/assets/{chunk-ND2GUHAM-B3EaCSpL.js → chunk-ND2GUHAM-GGPxofay.js} +1 -1
  187. package/web-shell/assets/{chunk-QZHKN3VN-CYq8x9mn.js → chunk-QZHKN3VN-Bifllrb6.js} +1 -1
  188. package/web-shell/assets/classDiagram-4FO5ZUOK-Cd6wbiuK.js +1 -0
  189. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-Cd6wbiuK.js +1 -0
  190. package/web-shell/assets/{cose-bilkent-S5V4N54A-D0ng4uiB.js → cose-bilkent-S5V4N54A-C-Add_Dp.js} +1 -1
  191. package/web-shell/assets/{dagre-BM42HDAG-DCZollQv.js → dagre-BM42HDAG-B7MfwNq2.js} +1 -1
  192. package/web-shell/assets/{diagram-2AECGRRQ-Dfk2pWS0.js → diagram-2AECGRRQ-CY_0zuDz.js} +1 -1
  193. package/web-shell/assets/{diagram-5GNKFQAL-kX38ltWR.js → diagram-5GNKFQAL-VyYSbCgA.js} +1 -1
  194. package/web-shell/assets/{diagram-KO2AKTUF-CJz2vsXh.js → diagram-KO2AKTUF-CBiIZ2PL.js} +1 -1
  195. package/web-shell/assets/{diagram-LMA3HP47-BvMLZm_7.js → diagram-LMA3HP47-BL3CrVOx.js} +1 -1
  196. package/web-shell/assets/{diagram-OG6HWLK6-l7kfStkO.js → diagram-OG6HWLK6-CZUPx96P.js} +1 -1
  197. package/web-shell/assets/{erDiagram-TEJ5UH35-BSVa8GGT.js → erDiagram-TEJ5UH35-B81xHr1-.js} +1 -1
  198. package/web-shell/assets/{flowDiagram-I6XJVG4X-CoawKIXH.js → flowDiagram-I6XJVG4X-EZWhir-J.js} +1 -1
  199. package/web-shell/assets/{ganttDiagram-6RSMTGT7-DFUDH0zF.js → ganttDiagram-6RSMTGT7-CVFSuIAg.js} +1 -1
  200. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-Y2pvpT4e.js → gitGraphDiagram-PVQCEYII-C1H2uQDv.js} +1 -1
  201. package/web-shell/assets/{index-ckX9Pq5k.js → index-B2bXx96W.js} +273 -254
  202. package/web-shell/assets/{index-D0GX0zZf.js → index-BYo99NBH.js} +1 -1
  203. package/web-shell/assets/{index-D9haPt0X.css → index-_8mKjx8q.css} +1 -1
  204. package/web-shell/assets/{infoDiagram-5YYISTIA-CU8_zLiX.js → infoDiagram-5YYISTIA-BwyFMlF8.js} +1 -1
  205. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-AVQiV0DU.js → ishikawaDiagram-YF4QCWOH-CQ7Yhn2Y.js} +1 -1
  206. package/web-shell/assets/{journeyDiagram-JHISSGLW-DQ0VSKa3.js → journeyDiagram-JHISSGLW-CJn2sf0l.js} +1 -1
  207. package/web-shell/assets/{kanban-definition-UN3LZRKU-BqnWqsE_.js → kanban-definition-UN3LZRKU-DaNRqwVN.js} +1 -1
  208. package/web-shell/assets/{linear-BkoihsaA.js → linear-DCKODZe2.js} +1 -1
  209. package/web-shell/assets/{mermaid.core-5RJs-31j.js → mermaid.core-CTGJOk27.js} +5 -5
  210. package/web-shell/assets/{mindmap-definition-RKZ34NQL-D33Bxnpd.js → mindmap-definition-RKZ34NQL-BKU3_3rg.js} +1 -1
  211. package/web-shell/assets/{pieDiagram-4H26LBE5-BuEAw3BH.js → pieDiagram-4H26LBE5-COcwBJ82.js} +1 -1
  212. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-Kox_usEq.js → quadrantDiagram-W4KKPZXB-CQnQ443x.js} +1 -1
  213. package/web-shell/assets/{requirementDiagram-4Y6WPE33-CNjeUif0.js → requirementDiagram-4Y6WPE33-CZ2oj5cD.js} +1 -1
  214. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-BCd2OL_U.js → sankeyDiagram-5OEKKPKP-BxAv5mNu.js} +1 -1
  215. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-CF2ZTsz0.js → sequenceDiagram-3UESZ5HK-CztaySPs.js} +1 -1
  216. package/web-shell/assets/{stateDiagram-AJRCARHV-qenSzHtm.js → stateDiagram-AJRCARHV-CTQT1oGD.js} +1 -1
  217. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-BjMdT6E_.js +1 -0
  218. package/web-shell/assets/{timeline-definition-PNZ67QCA-B5DyWdgs.js → timeline-definition-PNZ67QCA-K9Mkex5A.js} +1 -1
  219. package/web-shell/assets/{vennDiagram-CIIHVFJN-DqP4I_o_.js → vennDiagram-CIIHVFJN-B2rVIw76.js} +1 -1
  220. package/web-shell/assets/{wardley-L42UT6IY-CJe2e4mg.js → wardley-L42UT6IY-Z1w2JR4M.js} +1 -1
  221. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-BMDSw-Rr.js → wardleyDiagram-YWT4CUSO-CIX9aKXf.js} +1 -1
  222. package/web-shell/assets/{xychartDiagram-2RQKCTM6-BTVZYkxD.js → xychartDiagram-2RQKCTM6-CI9DLIKB.js} +1 -1
  223. package/web-shell/index.html +2 -2
  224. package/chunks/chunk-LEH5C7FV.js +0 -232
  225. package/web-shell/assets/channel-Cq7YKtfC.js +0 -1
  226. package/web-shell/assets/classDiagram-4FO5ZUOK-CQ9aC1Tg.js +0 -1
  227. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CQ9aC1Tg.js +0 -1
  228. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-B7W4zlCr.js +0 -1
@@ -71,7 +71,7 @@ import {
71
71
  RUNTIME_SNAPSHOT_PREFIX,
72
72
  buildModelIdContext,
73
73
  resolveModelId
74
- } from "./chunk-MZAXJAUM.js";
74
+ } from "./chunk-PSWQZHEA.js";
75
75
  import {
76
76
  LEADER_NAME,
77
77
  MAX_TEAMMATES
@@ -188,8 +188,11 @@ import {
188
188
  } from "./chunk-DJ2GSRLV.js";
189
189
  import {
190
190
  DEFAULT_OTLP_ENDPOINT,
191
- DEFAULT_TELEMETRY_TARGET
192
- } from "./chunk-NIBLUX3Y.js";
191
+ DEFAULT_TELEMETRY_TARGET,
192
+ addToolArgumentsAttributes,
193
+ addToolCallResultAttributes,
194
+ addUserPromptAttributes
195
+ } from "./chunk-BO4XCS7P.js";
193
196
  import {
194
197
  InvalidStreamError,
195
198
  getThoughtSummary
@@ -309,7 +312,7 @@ import {
309
312
  updateMCPServerStatus,
310
313
  writeLine,
311
314
  writeLineSync
312
- } from "./chunk-CIKQ7KKO.js";
315
+ } from "./chunk-RWS5VYWC.js";
313
316
  import {
314
317
  E_TIMEOUT,
315
318
  Mutex,
@@ -346,7 +349,7 @@ import {
346
349
  QWEN_OAUTH_MODELS,
347
350
  createContentGenerator,
348
351
  resolveContentGeneratorConfigWithSources
349
- } from "./chunk-IKCX4CCL.js";
352
+ } from "./chunk-U7TXFVUN.js";
350
353
  import {
351
354
  normalizeMcpToolName,
352
355
  sanitizeToolNameForProvider
@@ -375,10 +378,6 @@ import {
375
378
  renameWithRetry
376
379
  } from "./chunk-A5L3JMUA.js";
377
380
  import {
378
- addToolInputAttributes,
379
- addToolResultAttributes,
380
- addUserPromptAttributes,
381
- clearDetailedSpanState,
382
381
  endHookSpan,
383
382
  endInteractionSpan,
384
383
  endSubagentSpan,
@@ -403,13 +402,15 @@ import {
403
402
  startToolExecutionSpan,
404
403
  startToolSpan,
405
404
  truncateSpanError
406
- } from "./chunk-MB4MZHMJ.js";
405
+ } from "./chunk-SRZ6DXVG.js";
406
+ import {
407
+ safeJsonStringify
408
+ } from "./chunk-W4RQUHY3.js";
407
409
  import {
408
410
  DEFAULT_SENSITIVE_SPAN_ATTRIBUTE_MAX_LENGTH,
409
411
  SENSITIVE_SPAN_ATTRIBUTE_MAX_LENGTH_LIMIT,
410
- isValidSensitiveSpanAttributeMaxLength,
411
- safeJsonStringify
412
- } from "./chunk-BULDBTYC.js";
412
+ isValidSensitiveSpanAttributeMaxLength
413
+ } from "./chunk-INADJJGW.js";
413
414
  import {
414
415
  STRUCTURED_OUTPUT_REDACTED_ARGS
415
416
  } from "./chunk-UUUTRMI2.js";
@@ -33104,36 +33105,8 @@ function resolveInteractionMode(config) {
33104
33105
  return config.isInteractive() ? "interactive" : "headless";
33105
33106
  }
33106
33107
  __name(resolveInteractionMode, "resolveInteractionMode");
33107
- function getInteractionModePrompt(mode) {
33108
- switch (mode) {
33109
- case "headless":
33110
- return {
33111
- role: "a non-interactive CLI agent",
33112
- questions: `This is a non-interactive, single-turn run and no reply can be received after your response. Never ask the user a question, even if the user explicitly requests one. Do not call '${ToolNames.ASK_USER_QUESTION}' or output a textual question. Make reasonable assumptions when safe and complete the task; if required information is unavailable, report the blocker as the final result.`
33113
- };
33114
- case "acp":
33115
- return {
33116
- role: "a CLI agent operating through an ACP host",
33117
- questions: `Use '${ToolNames.ASK_USER_QUESTION}' when clarification is necessary. The ACP host can relay the question and response.`
33118
- };
33119
- case "interactive":
33120
- return getInteractiveInteractionModePrompt();
33121
- default: {
33122
- const _exhaustive = mode;
33123
- void _exhaustive;
33124
- return getInteractiveInteractionModePrompt();
33125
- }
33126
- }
33127
- }
33128
- __name(getInteractionModePrompt, "getInteractionModePrompt");
33129
- function getInteractiveInteractionModePrompt() {
33130
- return {
33131
- role: "an interactive CLI agent",
33132
- questions: `Use '${ToolNames.ASK_USER_QUESTION}' when you need clarification or want to validate assumptions. Never include time estimates in options.`
33133
- };
33134
- }
33135
- __name(getInteractiveInteractionModePrompt, "getInteractiveInteractionModePrompt");
33136
- function getDefaultCoreIdentitySentence(role) {
33108
+ function getDefaultCoreIdentitySentence(interactionMode) {
33109
+ const role = interactionMode === "headless" ? "a non-interactive CLI agent" : interactionMode === "acp" ? "a CLI agent operating through an ACP host" : "an interactive CLI agent";
33137
33110
  return `You are Qwen Code, ${role} developed by Alibaba Group, specializing in software engineering tasks. Your primary goal is to help users safely and efficiently, adhering strictly to the following instructions and utilizing your available tools.`;
33138
33111
  }
33139
33112
  __name(getDefaultCoreIdentitySentence, "getDefaultCoreIdentitySentence");
@@ -33223,101 +33196,42 @@ function getCoreSystemPrompt(userMemory, model, appendInstruction, interactionMo
33223
33196
  throw new Error(`missing system prompt file '${systemMdPath}'`);
33224
33197
  }
33225
33198
  }
33226
- const interaction = getInteractionModePrompt(interactionMode);
33227
33199
  let basePrompt;
33228
33200
  if (systemMdEnabled) {
33229
33201
  basePrompt = fs5.readFileSync(systemMdPath, "utf8");
33230
33202
  } else {
33231
- const coreIdentity = resolveCoreIdentityOverride() ?? getDefaultCoreIdentitySentence(interaction.role);
33203
+ const coreIdentity = resolveCoreIdentityOverride() ?? getDefaultCoreIdentitySentence(interactionMode);
33232
33204
  basePrompt = `
33233
33205
  ${coreIdentity}
33234
33206
 
33235
- # Core Mandates
33236
-
33237
- - **Conventions:** Rigorously adhere to existing project conventions when reading or modifying code. Analyze surrounding code, tests, and configuration first.
33238
- - **Libraries/Frameworks:** NEVER assume a library/framework is available or appropriate. Verify its established usage within the project (check imports, configuration files like 'package.json', 'Cargo.toml', 'requirements.txt', 'build.gradle', etc., or observe neighboring files) before employing it.
33239
- - **Style & Structure:** Mimic the style (formatting, naming), structure, framework choices, typing, and architectural patterns of existing code in the project.
33240
- - **Idiomatic Changes:** When editing, understand the local context (imports, functions/classes) to ensure your changes integrate naturally and idiomatically.
33241
- - **Comments:** Default to none. Only add a comment when the _why_ cannot be conveyed through naming or code structure \u2014 a hidden constraint, a subtle invariant, or a workaround for a specific bug. Do not narrate what the code does. Do not edit comments that are separate from the code you are changing. *NEVER* talk to the user or describe your changes through comments.
33242
- - **Proactiveness:** Fulfill the user's request thoroughly. When the task involves code modifications, add tests to verify the change works. Consider all created files, especially tests, to be permanent artifacts unless the user says otherwise.
33243
- - **Confirm Ambiguity/Expansion:** Do not take significant actions beyond the clear scope of the request without following the active interaction mode's question guidance. If asked *how* to do something, explain first, don't just do it.
33244
- - **Do Not revert changes:** Do not revert changes to the codebase unless asked to do so by the user. Only revert changes made by you if they have resulted in an error or if the user has explicitly asked you to revert the changes.
33245
- - **Preserve Existing Work:** Treat existing or unexpected changes as user-owned. Do not modify, stage, commit, or revert unrelated changes. If changes overlap files you need to edit, reread them before modifying and stop to clarify if they conflict with the requested work.
33246
- - **Denied Tool Calls:** If a tool call is denied, do not try to complete the denied action through another tool, shell indirection, generated script, alias, symlink, config change, hook, command file, MCP configuration, encoded payload, or equivalent path. If that action is required, stop and request explicit approval only when the current interaction mode can receive it; otherwise report the blocker. You may continue with unrelated safe work or a genuinely safer alternative that does not accomplish the denied action.
33247
- - **Plan before uncertain work:** If the task is not yet clear enough to safely execute, do not make small speculative edits. Continue read-only investigation, make a plan in the current mode, or follow the active interaction mode's question guidance. Do not enter plan mode or call ${ToolNames.ENTER_PLAN_MODE} on your own just because the task involves planning or complexity. Use plan mode only when the user explicitly asks you to switch to plan mode, has already enabled it, or confirms they want it.
33248
-
33249
-
33250
- # Task Management
33251
- You have access to the ${ToolNames.TODO_WRITE} tool to keep user-visible progress for work that benefits from explicit tracking. Use it for complex, ambiguous, or multi-phase tasks or requests with multiple independent outcomes. Do not use it for simple or single-step queries that you can answer or complete immediately unless the user explicitly asks for a plan.
33252
-
33253
- When you create a todo list:
33254
- - Keep it short and outcome-oriented. Use a few meaningful, logically ordered, verifiable steps rather than one item per error, file, command, or minor edit.
33255
- - Keep at most one item in_progress. Keep the list current, mark finished work completed, and revise it when the scope or approach changes. When work completes together, update multiple statuses in one tool call rather than making bookkeeping-only calls.
33256
- - Do not repeat the full todo list in prose after calling the tool; briefly communicate only important context or the next step.
33257
-
33258
- # Primary Workflows
33259
-
33260
- ## Software Engineering Tasks
33261
- When requested to perform tasks like fixing bugs, adding features, refactoring, or explaining code, follow this iterative approach:
33262
- - **Plan:** Use '${ToolNames.TODO_WRITE}' for complex, ambiguous, or multi-step work when visible progress tracking adds value. Keep the plan short and outcome-oriented; skip it for simple tasks unless the user explicitly requests a plan.
33263
- - **Implement:** Begin implementing while gathering context as needed. Use available search and editing tools strategically, adhering to project conventions (see 'Core Mandates'). Do not add features, refactor code, or make "improvements" beyond what was asked. Don't add error handling, fallbacks, or validation for scenarios that can't happen\u2014only validate at system boundaries (user input, external APIs). Don't create helpers, utilities, or abstractions for one-time operations. Three similar lines of code is better than a premature abstraction. Prefer editing existing files over creating new ones.
33264
- - **Adapt:** Refine your approach as you discover new information or encounter obstacles. If a todo list exists, keep it current as the scope or approach changes. If an approach fails, diagnose why before switching tactics\u2014read the error, check your assumptions, and try a focused fix. Don't retry blindly, but don't abandon a viable approach after a single failure.
33265
- - **Verify (Tests):** If applicable and feasible, verify the changes using the project's testing procedures. Identify the correct test commands and frameworks by examining 'README' files, build/package configuration (e.g., 'package.json'), or existing test execution patterns. NEVER assume standard test commands. Before reporting a task complete, verify it actually works. If you can't verify (no test exists, can't run the code), say so explicitly rather than claiming success.
33266
- - **Verify (Standards):** When your task involves a code or system change, execute the project-specific build, linting and type-checking commands (e.g., 'tsc', 'npm run lint', 'ruff check .') that you have identified for this project (or obtained from the user). This ensures code quality and adherence to standards. Read-only or explanatory turns do not require verification.
33267
- - **Report outcomes faithfully:** If tests fail, say so with the relevant output. If you did not run a verification step, say that rather than implying it succeeded. Never claim "all tests pass" when output shows failures, never suppress failing checks to manufacture a green result, and never characterize incomplete or broken work as done.
33268
-
33269
- **Key Principle:** Start with a reasonable approach based on available information, then adapt as you learn. Users prefer seeing progress quickly rather than waiting for perfect understanding.
33270
-
33271
- - Tool results and user messages may include <system-reminder> tags. <system-reminder> tags contain useful information and reminders. They are NOT part of the user's provided input or the tool result.
33272
- - When you see a <persisted-output> tag in a tool result, the full output was saved to disk because it was too large. Use the read_file tool to access the complete content if the preview is insufficient.
33273
-
33274
- ## New Applications
33275
-
33276
- When a user wants to create a new application, project, website, game, or library from scratch, use the '${ToolNames.SKILL}' tool with skill="new-app" to load the detailed workflow and tech-stack guidance.
33277
-
33278
- # Operational Guidelines
33279
-
33280
- ## Communicating With the User
33281
-
33282
- Before your first tool call, briefly state what you're about to do. While working, give short updates at key moments: when you find something load-bearing (a bug, a root cause), when changing direction, or when you've made progress without an update.
33283
-
33284
- Final responses should be concise by default, but their shape and depth must match the request. Lead with the outcome for simple tasks. For code reviews, explanations, investigations, or substantial changes, provide enough structured detail and include code references, verification results, risks, and next steps when relevant so the user can understand and act on the result.
33285
-
33286
- ## Tone and Style (CLI Interaction)
33287
- - **Concise & Direct:** Adopt a professional, direct, and concise tone suitable for a CLI environment.
33288
- - **Adaptive Detail:** Use the minimum length and structure needed for clarity. A simple result may be one sentence; complex findings may require several paragraphs or sections.
33289
- - **Clarity over Brevity (When Needed):** While conciseness is key, prioritize clarity for essential explanations or when seeking necessary clarification if a request is ambiguous.
33290
- - **No Chitchat:** Avoid conversational filler and chitchat. Get straight to the action or answer.
33291
- - **Formatting:** Use GitHub-flavored Markdown. Responses will be rendered in monospace.
33292
- - **Tools vs. Text:** Use tools for actions, text output *only* for communication. Do not add explanatory comments within tool calls or code blocks unless specifically part of the required code/command itself.
33293
- - **Handling Inability:** If unable/unwilling to fulfill a request, state so briefly (1-2 sentences) without excessive justification. Offer alternatives if appropriate.
33294
-
33295
- ## Security and Safety Rules
33296
- - **Explain Critical Commands:** Before executing commands with '${ToolNames.SHELL}' that modify the file system, codebase, or system state, you *must* provide a brief explanation of the command's purpose and potential impact. Prioritize user understanding and safety. Follow the active permission policy and do not assume an interactive confirmation dialog is available.
33297
- - **Security First:** Always apply security best practices. Never introduce code that exposes, logs, or commits secrets, API keys, or other sensitive information.
33298
-
33299
- ## Using Your Tools
33300
- - **Prefer Dedicated Tools:** Do NOT use the '${ToolNames.SHELL}' to run commands when a relevant dedicated tool is provided. Using dedicated tools allows the user to better understand and review your work. This is CRITICAL to assisting the user:
33301
- - To read files use '${ToolNames.READ_FILE}' instead of cat, head, tail, or sed
33302
- - To edit files use '${ToolNames.EDIT}' instead of sed or awk
33303
- - To create files use '${ToolNames.WRITE_FILE}' instead of cat with heredoc or echo redirection
33304
- - To search for files use '${ToolNames.GLOB}' instead of find or ls
33305
- - To search the content of files, use '${ToolNames.GREP}' instead of grep or rg
33306
- - Reserve using the '${ToolNames.SHELL}' exclusively for system commands and terminal operations that require shell execution. If you are unsure and there is a relevant dedicated tool, default to using the dedicated tool and only fallback on using the '${ToolNames.SHELL}' tool for these if it is absolutely necessary.
33307
- - **Tool Fallback:** If a tool returns empty, unhelpful, or unexpected results, try an alternative tool that can accomplish the same goal before telling the user it cannot be done. Never give up after a single tool failure.
33308
- - **Task Management:** Use '${ToolNames.TODO_WRITE}' only when explicit tracking adds value. Keep plans concise, outcome-oriented, and current; do not create a todo list for simple or single-step work unless the user explicitly requests one.
33309
- - **Parallel Tool Calls:** You can call multiple tools in a single response. If you intend to call multiple tools and there are no dependencies between them, make all independent tool calls in parallel. Maximize use of parallel tool calls where possible to increase efficiency. However, if some tool calls depend on previous calls to inform dependent values, do NOT call these tools in parallel and instead call them sequentially. For instance, if one operation must complete before another starts, run these operations sequentially instead.
33310
- - **File Paths:** Always use absolute paths when referring to files with tools like '${ToolNames.READ_FILE}' or '${ToolNames.WRITE_FILE}'. Relative paths are not supported. You must provide an absolute path.
33311
- - **Background Processes:** Use background execution with \`is_background: true\` for commands that are unlikely to stop on their own, e.g. \`node server.js\`. Do not append a trailing \`&\` when using the shell tool's managed background mode. If unsure, follow the active interaction mode's question guidance.
33312
- - **Interactive Commands:** Try to avoid shell commands that are likely to require user interaction (e.g. \`git rebase -i\`). Use non-interactive versions of commands (e.g. \`npm init -y\` instead of \`npm init\`) when available, and otherwise remind the user that interactive shell commands are not supported and may cause hangs until canceled by the user.
33313
- - **Questions:** ${interaction.questions}
33314
- - **Subagent Delegation:** Use the '${ToolNames.AGENT}' tool with specialized agents when the task at hand matches the agent's description. Subagents are valuable for parallelizing independent queries or for protecting the main context window from excessive results, but they should not be used excessively when not needed. Importantly, avoid duplicating work that subagents are already doing - if you delegate research to a subagent, do not also perform the same searches yourself.
33315
- - **Codebase Search:** For simple, directed codebase searches (e.g. for a specific file/class/function) use the '${ToolNames.GREP}' or '${ToolNames.GLOB}' tools directly. For broader codebase exploration and deep research, use the '${ToolNames.AGENT}' tool with subagent_type=Explore. This is slower than using '${ToolNames.GREP}' or '${ToolNames.GLOB}' directly, so use this only when a simple, directed search proves to be insufficient or when your task will clearly require more than 3 queries.
33316
- - **Respect Tool Decisions:** Tool permissions are enforced by the runtime. If a call is denied or canceled, respect that decision and do _not_ try the same action through another path. Retry only if the user subsequently requests that action.
33317
-
33318
- ## Interaction Details
33319
- - **Help Command:** The user can use '/help' to display help information.
33320
- - **Feedback:** To report a bug or provide feedback, please use the /bug command.
33207
+ You are an agent that helps users with software engineering tasks.
33208
+
33209
+ IMPORTANT: Assist with authorized security testing, defensive security, CTF challenges, and educational contexts. Refuse requests for destructive techniques, DoS attacks, mass targeting, supply chain compromise, or detection evasion for malicious purposes. Dual-use security tools (C2 frameworks, credential testing, exploit development) require clear authorization context: pentesting engagements, CTF competitions, security research, or defensive use cases.
33210
+
33211
+ # Harness
33212
+
33213
+ - Text you output outside of tool use is displayed to the user as GitHub-flavored Markdown in a terminal.
33214
+ - Tool permissions are enforced by the runtime. If a call is denied or canceled, adjust your approach and do not retry the same action through another path.
33215
+ - \`<system-reminder>\` tags in messages and tool results are injected by the harness, not the user. Treat their contents as runtime guidance.
33216
+ - Prefer the dedicated file and search tools over \`${ToolNames.SHELL}\` when one fits: use \`${ToolNames.READ_FILE}\` to read files, \`${ToolNames.WRITE_FILE}\` to create files, \`${ToolNames.EDIT}\` to modify files, \`${ToolNames.GLOB}\` to find files, and \`${ToolNames.GREP}\` to search file contents. Use \`${ToolNames.SHELL}\` for system commands and terminal operations.
33217
+ - Independent tool calls can run in parallel in one response.
33218
+ - Reference code as \`file_path:line_number\` so locations are clickable.
33219
+
33220
+ Write code that reads like the surrounding code: match its comment density, naming, and idiom.
33221
+
33222
+ Before modifying code, inspect the current state and preserve the user's existing or unexpected work. Do not overwrite, revert, stage, or otherwise mix unrelated changes into the requested work.
33223
+
33224
+ For actions that are hard to reverse or outward-facing, confirm first unless durably authorized or explicitly told to proceed without asking; approval in one context doesn't extend to the next. Sending content to an external service publishes it; it may be cached or indexed even if later deleted. Before deleting or overwriting, look at the target. If what you find contradicts how it was described, or you didn't create it, surface that instead of proceeding. Report outcomes faithfully: if tests fail, say so with the output; if a step was skipped, say that; when something is done and verified, state it plainly without hedging.
33225
+
33226
+ # Session-specific guidance
33227
+
33228
+ - When the user invokes a listed skill, use the \`${ToolNames.SKILL}\` tool. Only use skills supplied by the runtime; do not guess names or assume a static skill list.
33229
+
33230
+ # Context management
33231
+
33232
+ When the conversation grows long, some or all of the current context may be summarized. The summary, along with any remaining unsummarized context, is provided in the next context window so work can continue; you don't need to wrap up early or hand off mid-task.
33233
+
33234
+ When you have enough information to act, act. Do not re-derive facts already established in the conversation, re-litigate a decision the user has already made, or narrate options you will not pursue. If you are weighing a choice, give a recommendation, not an exhaustive survey.
33321
33235
 
33322
33236
  ${function() {
33323
33237
  const isSandboxExec = process2.env["SANDBOX"] === "sandbox-exec";
@@ -33335,13 +33249,11 @@ You are running in a sandbox container with limited access to files outside the
33335
33249
  } else {
33336
33250
  return `
33337
33251
  # Outside of Sandbox
33338
- You are running outside of a sandbox container, directly on the user's system. For critical commands that are particularly likely to modify the user's system outside of the project directory or system temp directory, as you explain the command to the user (per the Explain Critical Commands rule above), also remind the user to consider enabling sandboxing.
33252
+ You are running outside of a sandbox container, directly on the user's system. For critical commands that are particularly likely to modify the user's system outside of the project directory or system temp directory, as you explain the command to the user, also remind the user to consider enabling sandboxing.
33339
33253
  `;
33340
33254
  }
33341
33255
  }()}
33342
33256
 
33343
- ${getActionsSection()}
33344
-
33345
33257
  ${function() {
33346
33258
  if (isGitRepository(process2.cwd())) {
33347
33259
  return `
@@ -33369,13 +33281,6 @@ ${function() {
33369
33281
  }
33370
33282
  return "";
33371
33283
  }()}
33372
-
33373
- ${getToolCallExamples(model || "")}
33374
-
33375
- # Final Reminder
33376
- Your core function is efficient and safe assistance. Balance conciseness with the crucial need for clarity, especially regarding safety and potential system modifications. Always prioritize user control and project conventions. Never make assumptions about the contents of files; instead use '${ToolNames.READ_FILE}' to ensure you aren't making broad assumptions. Finally, you are an agent - please keep going until the user's query is completely resolved.
33377
-
33378
- Interaction mode reminder: ${interaction.questions}
33379
33284
  `.trim();
33380
33285
  }
33381
33286
  const writeSystemMdResolution = resolvePathFromEnv(
@@ -33400,21 +33305,6 @@ function buildSystemPromptSuffix(text) {
33400
33305
  ${trimmed2}` : "";
33401
33306
  }
33402
33307
  __name(buildSystemPromptSuffix, "buildSystemPromptSuffix");
33403
- function getActionsSection() {
33404
- return `
33405
- # Executing actions with care
33406
-
33407
- Carefully consider the reversibility and blast radius of actions. Generally you can freely take local, reversible actions like editing files or running tests. But for actions that are hard to reverse, affect shared systems beyond your local environment, or could otherwise be risky or destructive, obtain confirmation when the current interaction mode can receive it; otherwise stop and report the blocker. The cost of pausing to confirm is low, while the cost of an unwanted action (lost work, unintended messages sent, deleted branches) can be very high. For actions like these, consider the context, the action, and user instructions, and by default transparently communicate the action and follow the active interaction mode's question guidance before proceeding. This default can be changed by user instructions - if explicitly asked to operate more autonomously, then you may proceed without confirmation, but still attend to the risks and consequences when taking actions. A user approving an action (like a git push) once does NOT mean that they approve it in all contexts, so unless actions are authorized in advance in durable instructions like QWEN.md files, obtain confirmation only when the current interaction mode can receive it; otherwise report the blocker. Authorization stands for the scope specified, not beyond. Match the scope of your actions to what was actually requested.
33408
-
33409
- Examples of the kind of risky actions that warrant user confirmation:
33410
- - Destructive operations: deleting files/branches, dropping database tables, killing processes, rm -rf, overwriting uncommitted changes
33411
- - Hard-to-reverse operations: force-pushing (can also overwrite upstream), git reset --hard, amending published commits, removing or downgrading packages/dependencies, modifying CI/CD pipelines
33412
- - Actions visible to others or that affect shared state: pushing code, creating/closing/commenting on PRs or issues, sending messages (Slack, email, GitHub), posting to external services, modifying shared infrastructure or permissions
33413
- - Uploading content to third-party web tools (diagram renderers, pastebins, gists) publishes it - consider whether it could be sensitive before sending, since it may be cached or indexed even if later deleted.
33414
-
33415
- When you encounter an obstacle, do not use destructive actions as a shortcut to simply make it go away. For instance, try to identify root causes and fix underlying issues rather than bypassing safety checks (e.g. --no-verify). If you discover unexpected state like unfamiliar files, branches, or configuration, investigate before deleting or overwriting, as it may represent the user's in-progress work. For example, typically resolve merge conflicts rather than discarding changes; similarly, if a lock file exists, investigate what process holds it rather than deleting it. In short: only take risky actions carefully, and when in doubt, follow the active interaction mode's question guidance before acting. Follow both the spirit and letter of these instructions - measure twice, cut once.`;
33416
- }
33417
- __name(getActionsSection, "getActionsSection");
33418
33308
  function getCompressionPrompt() {
33419
33309
  return `
33420
33310
  You are the component that summarizes a conversation when its context window is about to overflow. The summary you produce will become the agent's ONLY memory of everything that happened before this point. The agent will resume its work based solely on this summary plus a small number of restored file / image attachments that follow.
@@ -33488,450 +33378,6 @@ You are a specialized context summarizer that creates a comprehensive markdown s
33488
33378
  `.trim();
33489
33379
  }
33490
33380
  __name(getProjectSummaryPrompt, "getProjectSummaryPrompt");
33491
- var generalToolCallExamples = `
33492
- # Examples (Illustrating Tone and Workflow)
33493
- <example>
33494
- user: 1 + 2
33495
- model: 3
33496
- </example>
33497
-
33498
- <example>
33499
- user: is 13 a prime number?
33500
- model: true
33501
- </example>
33502
-
33503
- <example>
33504
- user: start the server implemented in server.js
33505
- model: [tool_call: ${ToolNames.SHELL} for 'node server.js' with is_background: true because it must run in the background]
33506
- </example>
33507
-
33508
- <example>
33509
- user: Refactor the auth logic in src/auth.py to use the requests library instead of urllib.
33510
- model: Okay, I can refactor 'src/auth.py'.
33511
- First, I'll analyze the code and check for a test safety net before planning any changes.
33512
- [tool_call: ${ToolNames.GLOB} for pattern 'tests/test_auth.py']
33513
- [tool_call: ${ToolNames.READ_FILE} for file_path '/path/to/tests/test_auth.py' with offset 0 and limit 10]
33514
- (After analysis)
33515
- Great, 'tests/test_auth.py' exists and covers the core authentication logic. With this safety net in place, I can safely plan the refactoring.
33516
- I'll also confirm 'requests' is a dependency.
33517
- [tool_call: ${ToolNames.READ_FILE} for file_path '/path/to/requirements.txt']
33518
- (After analysis)
33519
- Looks good, 'requests' is available.
33520
-
33521
- Here's the plan:
33522
- 1. Replace the 'urllib' calls with 'requests'.
33523
- 2. Add proper 'try...except' error handling for the new network calls.
33524
- 3. Remove the old 'urllib' import.
33525
- 4. Run the project's linter and tests to verify the changes.
33526
-
33527
- [tool_call: ${ToolNames.EDIT} for file_path '/path/to/src/auth.py' replacing old_string with new_string]
33528
- Refactoring complete. Running verification...
33529
- [tool_call: ${ToolNames.SHELL} for 'ruff check src/auth.py && pytest']
33530
- (After verification passes)
33531
- All checks passed. This is a stable checkpoint.
33532
- Would you like me to write a commit message and commit these changes?
33533
- </example>
33534
-
33535
- <example>
33536
- user: Delete the temp directory.
33537
- model: I can run \`rm -rf /path/to/project/temp\`. This will permanently delete the directory and all its contents.
33538
- </example>
33539
-
33540
- <example>
33541
- user: Write tests for someFile.ts
33542
- model:
33543
- Okay, I can write those tests. First, I'll read someFile.ts to understand its functionality.
33544
- [tool_call: ${ToolNames.READ_FILE} for file_path '/path/to/someFile.ts']
33545
- Now I'll look for existing or related test files to understand current testing conventions and dependencies.
33546
- [tool_call: ${ToolNames.READ_FILE} for file_path '/path/to/existingTest.test.ts']
33547
- (After reviewing existing tests and the file content)
33548
- [tool_call: ${ToolNames.WRITE_FILE} for file_path '/path/to/someFile.test.ts' with content '(test code content)']
33549
- I've written the tests. Now I'll run the project's test command to verify them.
33550
- [tool_call: ${ToolNames.SHELL} for 'npm run test']
33551
- (After verification passes)
33552
- All checks passed. This is a stable checkpoint.
33553
- </example>
33554
-
33555
- <example>
33556
- user: Where are all the 'app.config' files in this project? I need to check their settings.
33557
- model:
33558
- [tool_call: ${ToolNames.GLOB} for pattern './**/app.config']
33559
- (Assuming GlobTool returns a list of paths like ['/path/to/moduleA/app.config', '/path/to/moduleB/app.config'])
33560
- I found the following 'app.config' files:
33561
- - /path/to/moduleA/app.config
33562
- - /path/to/moduleB/app.config
33563
- To help you check their settings, I can read their contents. Which one would you like to start with, or should I read all of them?
33564
- </example>
33565
- `.trim();
33566
- var qwenCoderToolCallExamples = `
33567
- # Examples (Illustrating Tone and Workflow)
33568
- <example>
33569
- user: 1 + 2
33570
- model: 3
33571
- </example>
33572
-
33573
- <example>
33574
- user: is 13 a prime number?
33575
- model: true
33576
- </example>
33577
-
33578
- <example>
33579
- user: start the server implemented in server.js
33580
- model:
33581
- <tool_call>
33582
- <function=${ToolNames.SHELL}>
33583
- <parameter=command>
33584
- node server.js
33585
- </parameter>
33586
- <parameter=is_background>
33587
- true
33588
- </parameter>
33589
- </function>
33590
- </tool_call>
33591
- </example>
33592
-
33593
- <example>
33594
- user: Refactor the auth logic in src/auth.py to use the requests library instead of urllib.
33595
- model: Okay, I can refactor 'src/auth.py'.
33596
- First, I'll analyze the code and check for a test safety net before planning any changes.
33597
- <tool_call>
33598
- <function=${ToolNames.GLOB}>
33599
- <parameter=pattern>
33600
- tests/test_auth.py
33601
- </parameter>
33602
- </function>
33603
- </tool_call>
33604
- <tool_call>
33605
- <function=${ToolNames.READ_FILE}>
33606
- <parameter=file_path>
33607
- /path/to/tests/test_auth.py
33608
- </parameter>
33609
- <parameter=offset>
33610
- 0
33611
- </parameter>
33612
- <parameter=limit>
33613
- 10
33614
- </parameter>
33615
- </function>
33616
- </tool_call>
33617
- (After analysis)
33618
- Great, 'tests/test_auth.py' exists and covers the core authentication logic. With this safety net in place, I can safely plan the refactoring.
33619
- I'll also confirm 'requests' is a dependency.
33620
- <tool_call>
33621
- <function=${ToolNames.READ_FILE}>
33622
- <parameter=file_path>
33623
- /path/to/requirements.txt
33624
- </parameter>
33625
- </function>
33626
- </tool_call>
33627
- (After analysis)
33628
- Looks good, 'requests' is available.
33629
-
33630
- Here's the plan:
33631
- 1. Replace the 'urllib' calls with 'requests'.
33632
- 2. Add proper 'try...except' error handling for the new network calls.
33633
- 3. Remove the old 'urllib' import.
33634
- 4. Run the project's linter and tests to verify the changes.
33635
-
33636
- <tool_call>
33637
- <function=${ToolNames.EDIT}>
33638
- <parameter=file_path>
33639
- /path/to/src/auth.py
33640
- </parameter>
33641
- <parameter=old_string>
33642
- (old code content)
33643
- </parameter>
33644
- <parameter=new_string>
33645
- (new code content)
33646
- </parameter>
33647
- </function>
33648
- </tool_call>
33649
- Refactoring complete. Running verification...
33650
- <tool_call>
33651
- <function=${ToolNames.SHELL}>
33652
- <parameter=command>
33653
- ruff check src/auth.py && pytest
33654
- </parameter>
33655
- </function>
33656
- </tool_call>
33657
- (After verification passes)
33658
- All checks passed. This is a stable checkpoint.
33659
- Would you like me to write a commit message and commit these changes?
33660
- </example>
33661
-
33662
- <example>
33663
- user: Delete the temp directory.
33664
- model: I can run \`rm -rf /path/to/project/temp\`. This will permanently delete the directory and all its contents.
33665
- </example>
33666
-
33667
- <example>
33668
- user: Write tests for someFile.ts
33669
- model:
33670
- Okay, I can write those tests. First, I'll read someFile.ts to understand its functionality.
33671
- <tool_call>
33672
- <function=${ToolNames.READ_FILE}>
33673
- <parameter=file_path>
33674
- /path/to/someFile.ts
33675
- </parameter>
33676
- </function>
33677
- </tool_call>
33678
- Now I'll look for existing or related test files to understand current testing conventions and dependencies.
33679
- <tool_call>
33680
- <function=${ToolNames.READ_FILE}>
33681
- <parameter=file_path>
33682
- /path/to/existingTest.test.ts
33683
- </parameter>
33684
- </function>
33685
- </tool_call>
33686
- (After reviewing existing tests and the file content)
33687
- <tool_call>
33688
- <function=${ToolNames.WRITE_FILE}>
33689
- <parameter=file_path>
33690
- /path/to/someFile.test.ts
33691
- </parameter>
33692
- <parameter=content>
33693
- (test code content)
33694
- </parameter>
33695
- </function>
33696
- </tool_call>
33697
- I've written the tests. Now I'll run the project's test command to verify them.
33698
- <tool_call>
33699
- <function=${ToolNames.SHELL}>
33700
- <parameter=command>
33701
- npm run test
33702
- </parameter>
33703
- </function>
33704
- </tool_call>
33705
- (After verification passes)
33706
- All checks passed. This is a stable checkpoint.
33707
- </example>
33708
-
33709
- <example>
33710
- user: Where are all the 'app.config' files in this project? I need to check their settings.
33711
- model:
33712
- <tool_call>
33713
- <function=${ToolNames.GLOB}>
33714
- <parameter=pattern>
33715
- ./**/app.config
33716
- </parameter>
33717
- </function>
33718
- </tool_call>
33719
- (Assuming GlobTool returns a list of paths like ['/path/to/moduleA/app.config', '/path/to/moduleB/app.config'])
33720
- I found the following 'app.config' files:
33721
- - /path/to/moduleA/app.config
33722
- - /path/to/moduleB/app.config
33723
- To help you check their settings, I can read their contents. Which one would you like to start with, or should I read all of them?
33724
- </example>
33725
- `.trim();
33726
- var qwenVlToolCallExamples = `
33727
- # Examples (Illustrating Tone and Workflow)
33728
- <example>
33729
- user: 1 + 2
33730
- model: 3
33731
- </example>
33732
-
33733
- <example>
33734
- user: is 13 a prime number?
33735
- model: true
33736
- </example>
33737
-
33738
- <example>
33739
- user: start the server implemented in server.js
33740
- model:
33741
- <tool_call>
33742
- {"name": "${ToolNames.SHELL}", "arguments": {"command": "node server.js", "is_background": true}}
33743
- </tool_call>
33744
- </example>
33745
-
33746
- <example>
33747
- user: Refactor the auth logic in src/auth.py to use the requests library instead of urllib.
33748
- model: Okay, I can refactor 'src/auth.py'.
33749
- First, I'll analyze the code and check for a test safety net before planning any changes.
33750
- <tool_call>
33751
- {"name": "${ToolNames.GLOB}", "arguments": {"pattern": "tests/test_auth.py"}}
33752
- </tool_call>
33753
- <tool_call>
33754
- {"name": "${ToolNames.READ_FILE}", "arguments": {"file_path": "/path/to/tests/test_auth.py", "offset": 0, "limit": 10}}
33755
- </tool_call>
33756
- (After analysis)
33757
- Great, 'tests/test_auth.py' exists and covers the core authentication logic. With this safety net in place, I can safely plan the refactoring.
33758
- I'll also confirm 'requests' is a dependency.
33759
- <tool_call>
33760
- {"name": "${ToolNames.READ_FILE}", "arguments": {"file_path": "/path/to/requirements.txt"}}
33761
- </tool_call>
33762
- (After analysis)
33763
- Looks good, 'requests' is available.
33764
-
33765
- Here's the plan:
33766
- 1. Replace the 'urllib' calls with 'requests'.
33767
- 2. Add proper 'try...except' error handling for the new network calls.
33768
- 3. Remove the old 'urllib' import.
33769
- 4. Run the project's linter and tests to verify the changes.
33770
-
33771
- <tool_call>
33772
- {"name": "${ToolNames.EDIT}", "arguments": {"file_path": "/path/to/src/auth.py", "old_string": "(old code content)", "new_string": "(new code content)"}}
33773
- </tool_call>
33774
- Refactoring complete. Running verification...
33775
- <tool_call>
33776
- {"name": "${ToolNames.SHELL}", "arguments": {"command": "ruff check src/auth.py && pytest"}}
33777
- </tool_call>
33778
- (After verification passes)
33779
- All checks passed. This is a stable checkpoint.
33780
- Would you like me to write a commit message and commit these changes?
33781
- </example>
33782
-
33783
- <example>
33784
- user: Delete the temp directory.
33785
- model: I can run \`rm -rf /path/to/project/temp\`. This will permanently delete the directory and all its contents.
33786
- </example>
33787
-
33788
- <example>
33789
- user: Write tests for someFile.ts
33790
- model:
33791
- Okay, I can write those tests. First, I'll read someFile.ts to understand its functionality.
33792
- <tool_call>
33793
- {"name": "${ToolNames.READ_FILE}", "arguments": {"file_path": "/path/to/someFile.ts"}}
33794
- </tool_call>
33795
- Now I'll look for existing or related test files to understand current testing conventions and dependencies.
33796
- <tool_call>
33797
- {"name": "${ToolNames.READ_FILE}", "arguments": {"file_path": "/path/to/existingTest.test.ts"}}
33798
- </tool_call>
33799
- (After reviewing existing tests and the file content)
33800
- <tool_call>
33801
- {"name": "${ToolNames.WRITE_FILE}", "arguments": {"file_path": "/path/to/someFile.test.ts", "content": "(test code content)"}}
33802
- </tool_call>
33803
- I've written the tests. Now I'll run the project's test command to verify them.
33804
- <tool_call>
33805
- {"name": "${ToolNames.SHELL}", "arguments": {"command": "npm run test"}}
33806
- </tool_call>
33807
- (After verification passes)
33808
- All checks passed. This is a stable checkpoint.
33809
- </example>
33810
-
33811
- <example>
33812
- user: Where are all the 'app.config' files in this project? I need to check their settings.
33813
- model:
33814
- <tool_call>
33815
- {"name": "${ToolNames.GLOB}", "arguments": {"pattern": "./**/app.config"}}
33816
- </tool_call>
33817
- (Assuming GlobTool returns a list of paths like ['/path/to/moduleA/app.config', '/path/to/moduleB/app.config'])
33818
- I found the following 'app.config' files:
33819
- - /path/to/moduleA/app.config
33820
- - /path/to/moduleB/app.config
33821
- To help you check their settings, I can read their contents. Which one would you like to start with, or should I read all of them?
33822
- </example>
33823
- `.trim();
33824
- var gemma4ToolCallExamples = `
33825
- # Examples (Illustrating Tone and Workflow)
33826
- <example>
33827
- user: 1 + 2
33828
- model: 3
33829
- </example>
33830
-
33831
- <example>
33832
- user: is 13 a prime number?
33833
- model: true
33834
- </example>
33835
-
33836
- <example>
33837
- user: start the server implemented in server.js
33838
- model: <|tool_call>call:${ToolNames.SHELL}{command:<|"|>node server.js<|"|>,is_background:true}<tool_call|>
33839
- </example>
33840
-
33841
- <example>
33842
- user: Refactor the auth logic in src/auth.py to use the requests library instead of urllib.
33843
- model: Okay, I can refactor 'src/auth.py'.
33844
- First, I'll analyze the code and check for a test safety net before planning any changes.
33845
- <|tool_call>call:${ToolNames.GLOB}{pattern:<|"|>tests/test_auth.py<|"|>}<tool_call|>
33846
- <|tool_call>call:${ToolNames.READ_FILE}{file_path:<|"|>/path/to/tests/test_auth.py<|"|>,offset:0,limit:10}<tool_call|>
33847
- (After analysis)
33848
- Great, 'tests/test_auth.py' exists and covers the core authentication logic. With this safety net in place, I can safely plan the refactoring.
33849
- I'll also confirm 'requests' is a dependency.
33850
- <|tool_call>call:${ToolNames.READ_FILE}{file_path:<|"|>/path/to/requirements.txt<|"|>}<tool_call|>
33851
- (After analysis)
33852
- Looks good, 'requests' is available.
33853
-
33854
- Here's the plan:
33855
- 1. Replace the 'urllib' calls with 'requests'.
33856
- 2. Add proper 'try...except' error handling for the new network calls.
33857
- 3. Remove the old 'urllib' import.
33858
- 4. Run the project's linter and tests to verify the changes.
33859
-
33860
- <|tool_call>call:${ToolNames.EDIT}{file_path:<|"|>/path/to/src/auth.py<|"|>,old_string:<|"|>(old code content)<|"|>,new_string:<|"|>(new code content)<|"|>}<tool_call|>
33861
- Refactoring complete. Running verification...
33862
- <|tool_call>call:${ToolNames.SHELL}{command:<|"|>ruff check src/auth.py && pytest<|"|>}<tool_call|>
33863
- (After verification passes)
33864
- All checks passed. This is a stable checkpoint.
33865
- Would you like me to write a commit message and commit these changes?
33866
- </example>
33867
-
33868
- <example>
33869
- user: Delete the temp directory.
33870
- model: I can run \`rm -rf /path/to/project/temp\`. This will permanently delete the directory and all its contents.
33871
- </example>
33872
-
33873
- <example>
33874
- user: Write tests for someFile.ts
33875
- model:
33876
- Okay, I can write those tests. First, I'll read someFile.ts to understand its functionality.
33877
- <|tool_call>call:${ToolNames.READ_FILE}{file_path:<|"|>/path/to/someFile.ts<|"|>}<tool_call|>
33878
- Now I'll look for existing or related test files to understand current testing conventions and dependencies.
33879
- <|tool_call>call:${ToolNames.READ_FILE}{file_path:<|"|>/path/to/existingTest.test.ts<|"|>}<tool_call|>
33880
- (After reviewing existing tests and the file content)
33881
- <|tool_call>call:${ToolNames.WRITE_FILE}{file_path:<|"|>/path/to/someFile.test.ts<|"|>,content:<|"|>(test code content)<|"|>}<tool_call|>
33882
- I've written the tests. Now I'll run the project's test command to verify them.
33883
- <|tool_call>call:${ToolNames.SHELL}{command:<|"|>npm run test<|"|>}<tool_call|>
33884
- (After verification passes)
33885
- All checks passed. This is a stable checkpoint.
33886
- </example>
33887
-
33888
- <example>
33889
- user: Where are all the 'app.config' files in this project? I need to check their settings.
33890
- model:
33891
- <|tool_call>call:${ToolNames.GLOB}{pattern:<|"|>./**/app.config<|"|>}<tool_call|>
33892
- (Assuming GlobTool returns a list of paths like ['/path/to/moduleA/app.config', '/path/to/moduleB/app.config'])
33893
- I found the following 'app.config' files:
33894
- - /path/to/moduleA/app.config
33895
- - /path/to/moduleB/app.config
33896
- To help you check their settings, I can read their contents. Which one would you like to start with, or should I read all of them?
33897
- </example>
33898
- `.trim();
33899
- function getToolCallExamples(model) {
33900
- const toolCallStyle = process2.env["QWEN_CODE_TOOL_CALL_STYLE"];
33901
- if (toolCallStyle) {
33902
- switch (toolCallStyle.toLowerCase()) {
33903
- case "qwen-coder":
33904
- return qwenCoderToolCallExamples;
33905
- case "qwen-vl":
33906
- return qwenVlToolCallExamples;
33907
- case "gemma4":
33908
- return gemma4ToolCallExamples;
33909
- case "general":
33910
- return generalToolCallExamples;
33911
- default:
33912
- debugLogger10.warn(
33913
- `Unknown QWEN_CODE_TOOL_CALL_STYLE value: ${toolCallStyle}. Using model-based detection.`
33914
- );
33915
- break;
33916
- }
33917
- }
33918
- if (model && model.length < 100) {
33919
- if (/qwen[^-]*-coder/i.test(model)) {
33920
- return qwenCoderToolCallExamples;
33921
- }
33922
- if (/qwen[^-]*-vl/i.test(model)) {
33923
- return qwenVlToolCallExamples;
33924
- }
33925
- if (/coder-model/i.test(model)) {
33926
- return qwenCoderToolCallExamples;
33927
- }
33928
- if (/gemma[-_]?4/i.test(model)) {
33929
- return gemma4ToolCallExamples;
33930
- }
33931
- }
33932
- return generalToolCallExamples;
33933
- }
33934
- __name(getToolCallExamples, "getToolCallExamples");
33935
33381
  function getPlanModeSystemReminder(planOnly = false) {
33936
33382
  return `<system-reminder>
33937
33383
  Plan mode is active. The user indicated that they do not want you to execute yet -- you MUST NOT make any edits, run tools classified as state-modifying (including changing configs or making commits), or otherwise make changes to the system. A shell command whose safety cannot be determined may run only after the user explicitly approves that exact invocation once, and only when it is necessary for the investigation. This supersedes any other instructions you have received (for example, to make edits).
@@ -33983,6 +33429,12 @@ Your plan is ready when you have addressed all ambiguities and it covers: what t
33983
33429
  </system-reminder>`;
33984
33430
  }
33985
33431
  __name(getPlanModeSystemReminder, "getPlanModeSystemReminder");
33432
+ function getManualPlanExitSystemReminder(currentMode) {
33433
+ return `<system-reminder>
33434
+ The user has manually switched out of plan mode (current approval mode: ${currentMode}). You are no longer in plan mode. Do NOT call ${ToolNames.EXIT_PLAN_MODE} \u2014 there is no plan approval pending. Continue working in the current mode; previous plan-mode restrictions on edits and state-modifying tools no longer apply.
33435
+ </system-reminder>`;
33436
+ }
33437
+ __name(getManualPlanExitSystemReminder, "getManualPlanExitSystemReminder");
33986
33438
  function getArenaSystemReminder(configFilePath2) {
33987
33439
  return `<system-reminder>An Arena session is active. For details, read: ${configFilePath2}. This message is for internal use only. Do not mention this to user in your response.</system-reminder>`;
33988
33440
  }
@@ -47204,7 +46656,6 @@ var GeminiChat = class {
47204
46656
  this.setHistory(newHistory);
47205
46657
  debugLogger22.debug("[FILE_READ_CACHE] clear after auto tryCompress");
47206
46658
  this.config.getFileReadCache().clear();
47207
- clearDetailedSpanState();
47208
46659
  this.lastPromptTokenCount = info.newTokenCount;
47209
46660
  this.lastOutputTokenCount = 0;
47210
46661
  this.telemetryService?.setLastPromptTokenCount(info.newTokenCount);
@@ -47275,7 +46726,6 @@ var GeminiChat = class {
47275
46726
  })
47276
46727
  );
47277
46728
  this.setHistory(newHistory);
47278
- clearDetailedSpanState();
47279
46729
  this.lastPromptTokenCount = adjustedTokenCount;
47280
46730
  this.telemetryService?.setLastPromptTokenCount(adjustedTokenCount);
47281
46731
  this.consecutiveFailures = 0;
@@ -49989,7 +49439,7 @@ __name(computeCharContribution, "computeCharContribution");
49989
49439
  init_esbuild_shims();
49990
49440
  import * as fs89 from "node:fs/promises";
49991
49441
  import * as path93 from "node:path";
49992
- import { randomUUID as randomUUID15 } from "node:crypto";
49442
+ import { randomUUID as randomUUID16 } from "node:crypto";
49993
49443
 
49994
49444
  // packages/core/src/memory/store.ts
49995
49445
  init_esbuild_shims();
@@ -50123,13 +49573,13 @@ init_esbuild_shims();
50123
49573
 
50124
49574
  // packages/core/src/tools/agent/agent.ts
50125
49575
  init_esbuild_shims();
50126
- import { randomUUID as randomUUID14 } from "node:crypto";
49576
+ import { randomUUID as randomUUID15 } from "node:crypto";
50127
49577
  import * as path90 from "node:path";
50128
49578
  import * as fs84 from "node:fs/promises";
50129
49579
 
50130
49580
  // packages/core/src/agents/runtime/agent-core.ts
50131
49581
  init_esbuild_shims();
50132
- import { randomUUID as randomUUID13 } from "node:crypto";
49582
+ import { randomUUID as randomUUID14 } from "node:crypto";
50133
49583
 
50134
49584
  // packages/core/src/core/coreToolScheduler.ts
50135
49585
  init_esbuild_shims();
@@ -55797,12 +55247,12 @@ async function initParser() {
55797
55247
  initPromise = (async () => {
55798
55248
  const { default: ParserClass } = await import("./tree-sitter-YJVE2ZUK.js");
55799
55249
  const treeSitterWasm = await loadWasmBinary(
55800
- () => import("./tree-sitter-4D7QS7F6.js"),
55250
+ () => import("./tree-sitter-FS4VPMZA.js"),
55801
55251
  "web-tree-sitter/tree-sitter.wasm"
55802
55252
  );
55803
55253
  await ParserClass.init({ wasmBinary: treeSitterWasm });
55804
55254
  const bashWasm = await loadWasmBinary(
55805
- () => import("./tree-sitter-bash-VEJGF5XF.js"),
55255
+ () => import("./tree-sitter-bash-6B46JJCV.js"),
55806
55256
  "tree-sitter-wasms/out/tree-sitter-bash.wasm"
55807
55257
  );
55808
55258
  bashLanguage = await ParserClass.Language.load(bashWasm);
@@ -96399,6 +95849,10 @@ function truncateCommandForModel(command) {
96399
95849
  }
96400
95850
  __name(truncateCommandForModel, "truncateCommandForModel");
96401
95851
  var MAX_RETAINED_TERMINAL_SHELLS = 32;
95852
+ function statusFilePathFor(outputFile) {
95853
+ return outputFile.endsWith(".output") ? `${outputFile.slice(0, -".output".length)}.status` : `${outputFile}.status`;
95854
+ }
95855
+ __name(statusFilePathFor, "statusFilePathFor");
96402
95856
  var BackgroundShellRegistry = class {
96403
95857
  static {
96404
95858
  __name(this, "BackgroundShellRegistry");
@@ -96437,6 +95891,7 @@ var BackgroundShellRegistry = class {
96437
95891
  entry.outputOffset = 0;
96438
95892
  entry.notified = false;
96439
95893
  this.entries.set(entry.shellId, entry);
95894
+ this.writeStatusFile(entry);
96440
95895
  this.fireRegister(entry);
96441
95896
  this.fireStatusChange(entry);
96442
95897
  return entry;
@@ -96459,6 +95914,7 @@ var BackgroundShellRegistry = class {
96459
95914
  entry.status = "completed";
96460
95915
  entry.exitCode = exitCode;
96461
95916
  entry.endTime = endTime;
95917
+ this.writeStatusFile(entry);
96462
95918
  this.emitNotification(entry);
96463
95919
  this.pruneTerminalEntries();
96464
95920
  this.fireStatusChange(entry);
@@ -96469,6 +95925,7 @@ var BackgroundShellRegistry = class {
96469
95925
  entry.status = "failed";
96470
95926
  entry.error = error;
96471
95927
  entry.endTime = endTime;
95928
+ this.writeStatusFile(entry);
96472
95929
  this.emitNotification(entry);
96473
95930
  this.pruneTerminalEntries();
96474
95931
  this.fireStatusChange(entry);
@@ -96495,6 +95952,7 @@ var BackgroundShellRegistry = class {
96495
95952
  settleAsCancelled(entry, endTime) {
96496
95953
  entry.status = "cancelled";
96497
95954
  entry.endTime = endTime;
95955
+ this.writeStatusFile(entry);
96498
95956
  entry.abortController.abort();
96499
95957
  }
96500
95958
  /**
@@ -96516,6 +95974,49 @@ var BackgroundShellRegistry = class {
96516
95974
  }
96517
95975
  }
96518
95976
  }
95977
+ /**
95978
+ * Mirrors the entry into a machine-readable JSON sidecar next to the
95979
+ * output file (see {@link statusFilePathFor}) so the model can check
95980
+ * whether a background shell is still alive instead of inferring
95981
+ * liveness from the output file — which block-buffering children keep
95982
+ * empty for their whole run (#7626). Timestamps are ISO strings for
95983
+ * model readability; `pid` is included so a `running` sidecar left
95984
+ * behind by a hard-killed CLI can still be cross-checked.
95985
+ *
95986
+ * Fire-and-forget: a write failure (disk full, permission change)
95987
+ * must not poison the registry or the spawn path — mirror of the
95988
+ * output-stream error handling in shell.ts. Temp-file + rename keeps
95989
+ * readers from ever seeing a half-written JSON document.
95990
+ */
95991
+ writeStatusFile(entry) {
95992
+ const statusPath = statusFilePathFor(entry.outputFile);
95993
+ const payload = {
95994
+ id: entry.id,
95995
+ status: entry.status,
95996
+ command: entry.command,
95997
+ cwd: entry.cwd,
95998
+ startTime: new Date(entry.startTime).toISOString(),
95999
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
96000
+ };
96001
+ if (entry.pid !== void 0) payload["pid"] = entry.pid;
96002
+ if (entry.endTime !== void 0) {
96003
+ payload["endTime"] = new Date(entry.endTime).toISOString();
96004
+ }
96005
+ if (entry.exitCode !== void 0) payload["exitCode"] = entry.exitCode;
96006
+ if (entry.error !== void 0) payload["error"] = entry.error;
96007
+ try {
96008
+ atomicWriteFileSync(statusPath, JSON.stringify(payload, null, 2), {
96009
+ flush: false,
96010
+ mode: 384,
96011
+ forceMode: true,
96012
+ noFollow: true
96013
+ });
96014
+ } catch (error) {
96015
+ debugLogger58.warn(
96016
+ `status sidecar write failed for shell ${entry.shellId}: ${error instanceof Error ? error.message : String(error)}`
96017
+ );
96018
+ }
96019
+ }
96519
96020
  fireRegister(entry) {
96520
96021
  if (!this.registerCallback) return;
96521
96022
  try {
@@ -115775,6 +115276,21 @@ var ExtensionStore = class {
115775
115276
  const legacy = await this.readLegacyProjection();
115776
115277
  if (existing) {
115777
115278
  let changed = false;
115279
+ const loadedIds = new Set(extensions.map((identity) => identity.id));
115280
+ for (const identity of extensions) {
115281
+ assertIdentity(identity);
115282
+ if (existing.extensions[identity.id]) continue;
115283
+ const staleEntry = Object.entries(existing.extensions).find(
115284
+ ([id, policy]) => !loadedIds.has(id) && policy.name.toLowerCase() === identity.name.toLowerCase()
115285
+ );
115286
+ if (staleEntry) {
115287
+ const [staleId, policy] = staleEntry;
115288
+ delete existing.extensions[staleId];
115289
+ policy.name = identity.name;
115290
+ existing.extensions[identity.id] = policy;
115291
+ changed = true;
115292
+ }
115293
+ }
115778
115294
  if (existing.legacyProjectionHash !== projectionHash(legacy)) {
115779
115295
  if (!await this.legacyProjectionIsNewerThanState()) {
115780
115296
  try {
@@ -118437,6 +117953,9 @@ function getExtensionId(config, installMetadata) {
118437
117953
  } else {
118438
117954
  idValue = installMetadata?.source ?? config.name;
118439
117955
  }
117956
+ if (installMetadata?.pluginName) {
117957
+ idValue += `:${installMetadata.pluginName}`;
117958
+ }
118440
117959
  return hashValue(idValue);
118441
117960
  }
118442
117961
  __name(getExtensionId, "getExtensionId");
@@ -133068,10 +132587,147 @@ async function watchRepoBranch(cwd, onChange) {
133068
132587
  }
133069
132588
  __name(watchRepoBranch, "watchRepoBranch");
133070
132589
 
132590
+ // packages/core/src/utils/github-prs.ts
132591
+ init_esbuild_shims();
132592
+ import { execFile as execFile8 } from "node:child_process";
132593
+ var GH_TIMEOUT_MS = 1e4;
132594
+ var GH_MAX_BUFFER = 16 * 1024 * 1024;
132595
+ var GH_ERROR_RAW_MAX = 4096;
132596
+ var GITHUB_PR_ERROR_MESSAGE_MAX = 512;
132597
+ var GITHUB_PR_LIST_LIMIT = 30;
132598
+ var GH_PR_LIST_FIELDS = "number,title,url,author,headRefName,isDraft,reviewDecision,statusCheckRollup,updatedAt";
132599
+ var FAILING_CHECK_RUN_CONCLUSIONS = /* @__PURE__ */ new Set([
132600
+ "FAILURE",
132601
+ "CANCELLED",
132602
+ "TIMED_OUT",
132603
+ "ACTION_REQUIRED",
132604
+ "STARTUP_FAILURE",
132605
+ "STALE"
132606
+ ]);
132607
+ var FAILING_STATUS_CONTEXT_STATES = /* @__PURE__ */ new Set(["ERROR", "FAILURE"]);
132608
+ function aggregateChecks(rollup) {
132609
+ if (!Array.isArray(rollup) || rollup.length === 0) return "none";
132610
+ let sawPassing = false;
132611
+ let sawPending = false;
132612
+ for (const entry of rollup) {
132613
+ if (entry.__typename === "StatusContext") {
132614
+ const state = entry.state?.toUpperCase();
132615
+ if (state && FAILING_STATUS_CONTEXT_STATES.has(state)) return "failing";
132616
+ if (state === "SUCCESS") sawPassing = true;
132617
+ else sawPending = true;
132618
+ } else {
132619
+ const conclusion = entry.conclusion?.toUpperCase();
132620
+ if (conclusion) {
132621
+ if (FAILING_CHECK_RUN_CONCLUSIONS.has(conclusion)) return "failing";
132622
+ sawPassing = true;
132623
+ } else {
132624
+ sawPending = true;
132625
+ }
132626
+ }
132627
+ }
132628
+ if (sawPending) return "pending";
132629
+ return sawPassing ? "passing" : "none";
132630
+ }
132631
+ __name(aggregateChecks, "aggregateChecks");
132632
+ function mapReviewDecision(value) {
132633
+ switch (value) {
132634
+ case "APPROVED":
132635
+ return "approved";
132636
+ case "CHANGES_REQUESTED":
132637
+ return "changes_requested";
132638
+ case "REVIEW_REQUIRED":
132639
+ return "review_required";
132640
+ default:
132641
+ return null;
132642
+ }
132643
+ }
132644
+ __name(mapReviewDecision, "mapReviewDecision");
132645
+ function mapEntry(entry) {
132646
+ if (typeof entry.number !== "number") return null;
132647
+ const parsed = Date.parse(entry.updatedAt ?? "");
132648
+ return {
132649
+ number: entry.number,
132650
+ title: entry.title ?? "",
132651
+ url: entry.url ?? "",
132652
+ author: entry.author?.login ?? "",
132653
+ headRefName: entry.headRefName ?? "",
132654
+ state: entry.isDraft ? "draft" : "open",
132655
+ reviewDecision: mapReviewDecision(entry.reviewDecision),
132656
+ checks: aggregateChecks(entry.statusCheckRollup),
132657
+ updatedAt: Number.isNaN(parsed) ? 0 : Math.floor(parsed / 1e3)
132658
+ };
132659
+ }
132660
+ __name(mapEntry, "mapEntry");
132661
+ function parseGhPrList(stdout) {
132662
+ const parsed = JSON.parse(stdout);
132663
+ if (!Array.isArray(parsed)) {
132664
+ throw new Error("unexpected gh output: expected a JSON array");
132665
+ }
132666
+ return parsed.map((entry) => mapEntry(entry)).filter((entry) => entry !== null).sort((a, b3) => b3.updatedAt - a.updatedAt);
132667
+ }
132668
+ __name(parseGhPrList, "parseGhPrList");
132669
+ function runGhPrList(gitRoot) {
132670
+ return new Promise((resolve39, reject) => {
132671
+ execFile8(
132672
+ "gh",
132673
+ [
132674
+ "pr",
132675
+ "list",
132676
+ "--state",
132677
+ "open",
132678
+ "--limit",
132679
+ String(GITHUB_PR_LIST_LIMIT),
132680
+ "--json",
132681
+ GH_PR_LIST_FIELDS
132682
+ ],
132683
+ {
132684
+ cwd: gitRoot,
132685
+ timeout: GH_TIMEOUT_MS,
132686
+ maxBuffer: GH_MAX_BUFFER,
132687
+ windowsHide: true,
132688
+ encoding: "utf8"
132689
+ },
132690
+ (error, stdout) => {
132691
+ if (error) reject(error);
132692
+ else resolve39(stdout);
132693
+ }
132694
+ );
132695
+ });
132696
+ }
132697
+ __name(runGhPrList, "runGhPrList");
132698
+ function ghErrorMessage(error) {
132699
+ if (error?.killed === true) {
132700
+ return `gh pr list timed out after ${GH_TIMEOUT_MS / 1e3}s`;
132701
+ }
132702
+ const stderr = error?.stderr;
132703
+ const raw = typeof stderr === "string" && stderr.trim() ? stderr : error instanceof Error ? error.message : String(error);
132704
+ return raw.replace(/\s+/g, " ").trim().slice(0, GH_ERROR_RAW_MAX);
132705
+ }
132706
+ __name(ghErrorMessage, "ghErrorMessage");
132707
+ async function fetchGitHubPullRequests(cwd) {
132708
+ const gitRoot = findGitRoot(cwd);
132709
+ if (!gitRoot) return { kind: "not_a_repo" };
132710
+ let stdout;
132711
+ try {
132712
+ stdout = await runGhPrList(gitRoot);
132713
+ } catch (error) {
132714
+ if (error.code === "ENOENT") {
132715
+ return { kind: "cli_unavailable" };
132716
+ }
132717
+ return { kind: "failed", message: ghErrorMessage(error), gitRoot };
132718
+ }
132719
+ try {
132720
+ return { kind: "ok", pullRequests: parseGhPrList(stdout) };
132721
+ } catch (error) {
132722
+ return { kind: "failed", message: ghErrorMessage(error), gitRoot };
132723
+ }
132724
+ }
132725
+ __name(fetchGitHubPullRequests, "fetchGitHubPullRequests");
132726
+
133071
132727
  // packages/core/src/utils/memoryDiagnostics.ts
133072
132728
  init_esbuild_shims();
133073
132729
  import { readdir as readdir13, readFile as readFile22 } from "node:fs/promises";
133074
- import { execFile as execFile8 } from "node:child_process";
132730
+ import { execFile as execFile9 } from "node:child_process";
133075
132731
  import process6 from "node:process";
133076
132732
  import { promisify as promisify5 } from "node:util";
133077
132733
  import v8 from "node:v8";
@@ -133082,7 +132738,7 @@ var ACTIVE_HANDLES_THRESHOLD = 256;
133082
132738
  var ACTIVE_REQUESTS_THRESHOLD = 100;
133083
132739
  var OPEN_FD_THRESHOLD = 500;
133084
132740
  var debugLogger105 = createDebugLogger("MEMORY_DIAGNOSTICS");
133085
- var execFileAsync5 = promisify5(execFile8);
132741
+ var execFileAsync5 = promisify5(execFile9);
133086
132742
  async function collectMemoryDiagnostics(options2 = {}) {
133087
132743
  const now = options2.now ?? (() => /* @__PURE__ */ new Date());
133088
132744
  const platform3 = options2.platform ?? process6.platform;
@@ -142593,6 +142249,687 @@ function createGoalVerifier(config, options2 = {}) {
142593
142249
  }
142594
142250
  __name(createGoalVerifier, "createGoalVerifier");
142595
142251
 
142252
+ // packages/core/src/goals/goal-runtime.ts
142253
+ init_esbuild_shims();
142254
+ import { randomUUID as randomUUID13 } from "node:crypto";
142255
+ function createGoalRuntime(options2) {
142256
+ if (Boolean(options2.evidenceSource) !== Boolean(options2.verifier)) {
142257
+ throw new Error(
142258
+ "Goal evidence source and verifier must be configured together"
142259
+ );
142260
+ }
142261
+ let snapshot = {
142262
+ v: GOAL_STATE_VERSION,
142263
+ goal: null,
142264
+ activity: "idle"
142265
+ };
142266
+ const listeners = /* @__PURE__ */ new Set();
142267
+ let dispatchTail = Promise.resolve();
142268
+ let host;
142269
+ let currentPermit;
142270
+ let currentPermitHost;
142271
+ let currentTurnKey;
142272
+ let queuedTurnKey;
142273
+ let continuationQueued = false;
142274
+ let currentProposal;
142275
+ let pendingProposal;
142276
+ let verificationAttempt;
142277
+ let blockedAudit;
142278
+ let nextVerifierFeedback;
142279
+ let currentTurnFeedback;
142280
+ let restored = false;
142281
+ let disposed = false;
142282
+ let recoveryError;
142283
+ const assertAvailable = /* @__PURE__ */ __name(() => {
142284
+ if (disposed) throw new Error("Goal runtime has been disposed");
142285
+ }, "assertAvailable");
142286
+ const assertOperational = /* @__PURE__ */ __name(() => {
142287
+ assertAvailable();
142288
+ if (recoveryError) throw recoveryError;
142289
+ }, "assertOperational");
142290
+ const getSnapshot = /* @__PURE__ */ __name(() => structuredClone(snapshot), "getSnapshot");
142291
+ const broadcast = /* @__PURE__ */ __name((cause) => {
142292
+ for (const listener of listeners) {
142293
+ try {
142294
+ listener(getSnapshot(), cause);
142295
+ } catch {
142296
+ }
142297
+ }
142298
+ }, "broadcast");
142299
+ const preemptHost = /* @__PURE__ */ __name((reason, target = host) => {
142300
+ try {
142301
+ target?.preemptGoalTurn(reason);
142302
+ } catch {
142303
+ }
142304
+ }, "preemptHost");
142305
+ const flushContinuation = /* @__PURE__ */ __name((cause) => {
142306
+ if (!continuationQueued || !host || currentPermit || pendingProposal || verificationAttempt || snapshot.activity !== "idle" || snapshot.goal?.status !== "active") {
142307
+ return;
142308
+ }
142309
+ continuationQueued = false;
142310
+ const scheduledHost = host;
142311
+ const continuationContext = snapshot.goal.objective;
142312
+ const verifierFeedback = nextVerifierFeedback;
142313
+ nextVerifierFeedback = void 0;
142314
+ currentTurnFeedback = verifierFeedback;
142315
+ currentPermit = {
142316
+ goalId: snapshot.goal.goalId,
142317
+ revision: snapshot.goal.revision,
142318
+ turnId: randomUUID13()
142319
+ };
142320
+ currentPermitHost = scheduledHost;
142321
+ currentTurnKey = `goal-runtime:${currentPermit.turnId}`;
142322
+ const startedPermit = structuredClone(currentPermit);
142323
+ snapshot = { ...snapshot, activity: "running" };
142324
+ broadcast(cause);
142325
+ const handleStartFailure = /* @__PURE__ */ __name(() => {
142326
+ void enqueue(async () => {
142327
+ if (isCurrentPermit(startedPermit)) {
142328
+ const nextTurnKey = queuedTurnKey;
142329
+ currentPermit = void 0;
142330
+ currentPermitHost = void 0;
142331
+ currentTurnKey = void 0;
142332
+ currentProposal = void 0;
142333
+ if (currentTurnFeedback !== void 0) {
142334
+ nextVerifierFeedback ??= currentTurnFeedback;
142335
+ }
142336
+ currentTurnFeedback = void 0;
142337
+ if (host === scheduledHost) host = void 0;
142338
+ if (nextTurnKey && snapshot.goal?.status === "active") {
142339
+ currentPermit = {
142340
+ goalId: snapshot.goal.goalId,
142341
+ revision: snapshot.goal.revision,
142342
+ turnId: randomUUID13()
142343
+ };
142344
+ currentPermitHost = host;
142345
+ currentTurnKey = nextTurnKey;
142346
+ currentTurnFeedback = nextVerifierFeedback;
142347
+ nextVerifierFeedback = void 0;
142348
+ queuedTurnKey = void 0;
142349
+ continuationQueued = false;
142350
+ snapshot = { ...snapshot, activity: "running" };
142351
+ } else {
142352
+ snapshot = { ...snapshot, activity: "idle" };
142353
+ }
142354
+ broadcast();
142355
+ if (!currentPermit) queueContinuation();
142356
+ }
142357
+ }).catch(() => void 0);
142358
+ }, "handleStartFailure");
142359
+ let started;
142360
+ try {
142361
+ started = scheduledHost.startGoalTurn({
142362
+ permit: startedPermit,
142363
+ continuationContext,
142364
+ ...verifierFeedback ? { verifierFeedback } : {}
142365
+ });
142366
+ } catch {
142367
+ handleStartFailure();
142368
+ return;
142369
+ }
142370
+ void started.catch(handleStartFailure);
142371
+ }, "flushContinuation");
142372
+ const queueContinuation = /* @__PURE__ */ __name((cause) => {
142373
+ if (snapshot.goal?.status !== "active" || currentPermit || pendingProposal || verificationAttempt) {
142374
+ return;
142375
+ }
142376
+ continuationQueued = true;
142377
+ flushContinuation(cause);
142378
+ }, "queueContinuation");
142379
+ const enqueue = /* @__PURE__ */ __name((operation) => {
142380
+ const result = dispatchTail.then(operation, operation);
142381
+ dispatchTail = result.then(
142382
+ () => void 0,
142383
+ () => void 0
142384
+ );
142385
+ return result;
142386
+ }, "enqueue");
142387
+ const isCurrentPermit = /* @__PURE__ */ __name((permit) => snapshot.goal?.goalId === permit.goalId && snapshot.goal.revision === permit.revision && currentPermit?.goalId === permit.goalId && currentPermit.revision === permit.revision && currentPermit.turnId === permit.turnId, "isCurrentPermit");
142388
+ const isCurrentVerificationAttempt = /* @__PURE__ */ __name((attempt) => verificationAttempt === attempt && snapshot.goal?.goalId === attempt.permit.goalId && snapshot.goal.revision === attempt.permit.revision && snapshot.goal.status === "active" && snapshot.activity === "verifying", "isCurrentVerificationAttempt");
142389
+ const invalidateVerification = /* @__PURE__ */ __name((reason) => {
142390
+ const attempt = verificationAttempt;
142391
+ verificationAttempt = void 0;
142392
+ pendingProposal = void 0;
142393
+ if (attempt && !attempt.controller.signal.aborted) {
142394
+ attempt.controller.abort(new Error(reason));
142395
+ }
142396
+ }, "invalidateVerification");
142397
+ const verifierInput = /* @__PURE__ */ __name((attempt, evidence) => {
142398
+ const currentDeliveredOutput = evidence.citedRecords.filter(
142399
+ (record2) => record2.proofKind === "delivered_output" && record2.turnId === attempt.permit.turnId
142400
+ ).map((record2) => record2.content);
142401
+ const base = {
142402
+ goal: {
142403
+ goalId: attempt.goal.goalId,
142404
+ revision: attempt.goal.revision,
142405
+ objective: attempt.goal.objective
142406
+ },
142407
+ evidence: evidence.citedRecords,
142408
+ ...currentDeliveredOutput.length > 0 ? { currentDeliveredOutput } : {}
142409
+ };
142410
+ if (attempt.proposal.status === "complete") {
142411
+ return {
142412
+ ...base,
142413
+ proposal: { ...attempt.proposal, status: "complete" }
142414
+ };
142415
+ }
142416
+ return {
142417
+ ...base,
142418
+ proposal: { ...attempt.proposal, status: "blocked" },
142419
+ blockedPolicy: "A blocked Goal is resumable. It may be accepted immediately only when the evidence shows that new user authority or a material user choice is required, or that an external state change is required, and no meaningful in-scope work remains. An ordinary technical blocker requires evidence of the same cause from the current and two immediately preceding Goal turns. Difficulty, uncertainty, incomplete work, or a preference for clarification do not by themselves justify blocked."
142420
+ };
142421
+ }, "verifierInput");
142422
+ const promoteQueuedUserTurn = /* @__PURE__ */ __name(() => {
142423
+ const nextTurnKey = queuedTurnKey;
142424
+ if (!nextTurnKey || currentPermit || snapshot.goal?.status !== "active") {
142425
+ return false;
142426
+ }
142427
+ queuedTurnKey = void 0;
142428
+ continuationQueued = false;
142429
+ currentPermit = {
142430
+ goalId: snapshot.goal.goalId,
142431
+ revision: snapshot.goal.revision,
142432
+ turnId: randomUUID13()
142433
+ };
142434
+ currentPermitHost = host;
142435
+ currentTurnKey = nextTurnKey;
142436
+ currentTurnFeedback = nextVerifierFeedback;
142437
+ nextVerifierFeedback = void 0;
142438
+ snapshot = { ...snapshot, activity: "running" };
142439
+ return true;
142440
+ }, "promoteQueuedUserTurn");
142441
+ const admitAfterRejection = /* @__PURE__ */ __name(() => {
142442
+ continuationQueued = false;
142443
+ if (promoteQueuedUserTurn()) return false;
142444
+ const activityBefore = snapshot.activity;
142445
+ queueContinuation("verifier_reject");
142446
+ return activityBefore !== snapshot.activity;
142447
+ }, "admitAfterRejection");
142448
+ const recordVerificationOutcome = /* @__PURE__ */ __name(async (attempt, outcome) => {
142449
+ await enqueue(async () => {
142450
+ if (!isCurrentVerificationAttempt(attempt) || !snapshot.goal) return;
142451
+ const now = Date.now();
142452
+ if (outcome.kind === "decision" && outcome.result.decision === "accept") {
142453
+ const acceptedGoal = {
142454
+ ...snapshot.goal,
142455
+ activeTimeMs: elapsedActiveTime(snapshot.goal, now),
142456
+ updatedAt: now,
142457
+ lastReason: outcome.result.reason
142458
+ };
142459
+ const acceptedSnapshot = {
142460
+ v: GOAL_STATE_VERSION,
142461
+ goal: acceptedGoal,
142462
+ activity: "idle"
142463
+ };
142464
+ const terminalSnapshot = {
142465
+ v: GOAL_STATE_VERSION,
142466
+ goal: {
142467
+ ...acceptedGoal,
142468
+ status: attempt.proposal.status
142469
+ },
142470
+ activity: "idle"
142471
+ };
142472
+ await options2.journal.recordGoalState(randomUUID13(), {
142473
+ v: GOAL_STATE_VERSION,
142474
+ cause: "verifier_accept",
142475
+ snapshot: acceptedSnapshot
142476
+ });
142477
+ if (!isCurrentVerificationAttempt(attempt) || !snapshot.goal) return;
142478
+ await options2.journal.recordGoalState(randomUUID13(), {
142479
+ v: GOAL_STATE_VERSION,
142480
+ cause: attempt.proposal.status,
142481
+ snapshot: terminalSnapshot
142482
+ });
142483
+ if (!isCurrentVerificationAttempt(attempt) || !snapshot.goal) return;
142484
+ verificationAttempt = void 0;
142485
+ pendingProposal = void 0;
142486
+ if (attempt.proposal.status === "complete") queuedTurnKey = void 0;
142487
+ continuationQueued = false;
142488
+ nextVerifierFeedback = void 0;
142489
+ currentTurnFeedback = void 0;
142490
+ snapshot = structuredClone(terminalSnapshot);
142491
+ broadcast(attempt.proposal.status);
142492
+ return;
142493
+ }
142494
+ if (outcome.kind === "usage_limited") {
142495
+ const limitedSnapshot = {
142496
+ v: GOAL_STATE_VERSION,
142497
+ goal: {
142498
+ ...snapshot.goal,
142499
+ status: "usage_limited",
142500
+ activeTimeMs: elapsedActiveTime(snapshot.goal, now),
142501
+ updatedAt: now,
142502
+ lastReason: outcome.reason
142503
+ },
142504
+ activity: "idle"
142505
+ };
142506
+ await options2.journal.recordGoalState(randomUUID13(), {
142507
+ v: GOAL_STATE_VERSION,
142508
+ cause: "usage_limited",
142509
+ snapshot: limitedSnapshot
142510
+ });
142511
+ if (!isCurrentVerificationAttempt(attempt) || !snapshot.goal) return;
142512
+ verificationAttempt = void 0;
142513
+ pendingProposal = void 0;
142514
+ continuationQueued = false;
142515
+ nextVerifierFeedback = void 0;
142516
+ currentTurnFeedback = void 0;
142517
+ snapshot = structuredClone(limitedSnapshot);
142518
+ broadcast("usage_limited");
142519
+ return;
142520
+ }
142521
+ const rejectedSnapshot = {
142522
+ v: GOAL_STATE_VERSION,
142523
+ goal: {
142524
+ ...snapshot.goal,
142525
+ activeTimeMs: elapsedActiveTime(snapshot.goal, now),
142526
+ updatedAt: now,
142527
+ lastReason: outcome.result.reason
142528
+ },
142529
+ activity: "idle"
142530
+ };
142531
+ await options2.journal.recordGoalState(randomUUID13(), {
142532
+ v: GOAL_STATE_VERSION,
142533
+ cause: "verifier_reject",
142534
+ snapshot: rejectedSnapshot,
142535
+ ...blockedAudit ? { blockedAudit: structuredClone(blockedAudit) } : {}
142536
+ });
142537
+ if (!isCurrentVerificationAttempt(attempt) || !snapshot.goal) return;
142538
+ verificationAttempt = void 0;
142539
+ pendingProposal = void 0;
142540
+ snapshot = structuredClone(rejectedSnapshot);
142541
+ nextVerifierFeedback = outcome.result.reason;
142542
+ const continuationBroadcast = admitAfterRejection();
142543
+ if (!continuationBroadcast) broadcast("verifier_reject");
142544
+ });
142545
+ }, "recordVerificationOutcome");
142546
+ const runVerification = /* @__PURE__ */ __name(async (attempt) => {
142547
+ const evidenceSource = options2.evidenceSource;
142548
+ const verifier = options2.verifier;
142549
+ if (!evidenceSource || !verifier) return;
142550
+ let outcome;
142551
+ try {
142552
+ await evidenceSource.flush();
142553
+ if (attempt.controller.signal.aborted) return;
142554
+ const records = await evidenceSource.readActiveTranscriptChain();
142555
+ if (attempt.controller.signal.aborted) return;
142556
+ const evidence = validateGoalEvidenceReferences({
142557
+ records,
142558
+ goal: attempt.goal,
142559
+ permit: attempt.permit,
142560
+ proposal: attempt.proposal
142561
+ });
142562
+ const result = await verifier(
142563
+ verifierInput(attempt, evidence),
142564
+ attempt.controller.signal
142565
+ );
142566
+ if (attempt.controller.signal.aborted) return;
142567
+ outcome = { kind: "decision", result };
142568
+ } catch (error) {
142569
+ if (attempt.controller.signal.aborted) return;
142570
+ if (error instanceof InvalidGoalEvidenceReferenceError) {
142571
+ outcome = {
142572
+ kind: "decision",
142573
+ result: { decision: "reject", reason: error.message }
142574
+ };
142575
+ } else {
142576
+ const reason = error instanceof EvidenceSourceUnavailableError ? error.message : error instanceof Error ? error.message : String(error);
142577
+ outcome = { kind: "usage_limited", reason };
142578
+ }
142579
+ }
142580
+ await recordVerificationOutcome(attempt, outcome);
142581
+ }, "runVerification");
142582
+ return {
142583
+ getSnapshot,
142584
+ subscribe(listener) {
142585
+ listeners.add(listener);
142586
+ return () => listeners.delete(listener);
142587
+ },
142588
+ restore(records) {
142589
+ return enqueue(async () => {
142590
+ assertAvailable();
142591
+ if (restored) return;
142592
+ const recovery = recoverGoalFromRecords(records);
142593
+ if (recovery.kind === "unsupported") {
142594
+ recoveryError = new Error(recovery.reason);
142595
+ throw recoveryError;
142596
+ }
142597
+ try {
142598
+ let recoveredSnapshot;
142599
+ let recoveredCause;
142600
+ if (recovery.kind === "v2") {
142601
+ recoveredSnapshot = {
142602
+ ...structuredClone(recovery.payload.snapshot),
142603
+ activity: "idle"
142604
+ };
142605
+ blockedAudit = recovery.payload.blockedAudit ? structuredClone(recovery.payload.blockedAudit) : void 0;
142606
+ recoveredCause = recovery.payload.cause;
142607
+ } else if (recovery.kind === "legacy") {
142608
+ const recordUuid = randomUUID13();
142609
+ const payload = createMigratedGoalState({
142610
+ objective: recovery.objective,
142611
+ goalId: randomUUID13(),
142612
+ recordUuid,
142613
+ now: Date.now()
142614
+ });
142615
+ await options2.journal.recordGoalState(recordUuid, payload);
142616
+ assertAvailable();
142617
+ recoveredSnapshot = structuredClone(payload.snapshot);
142618
+ recoveredCause = payload.cause;
142619
+ }
142620
+ if (recoveredSnapshot) snapshot = recoveredSnapshot;
142621
+ recoveryError = void 0;
142622
+ restored = true;
142623
+ if (recoveredSnapshot) broadcast(recoveredCause);
142624
+ queueContinuation();
142625
+ } catch (error) {
142626
+ if (!disposed) {
142627
+ recoveryError = error instanceof Error ? error : new Error(String(error));
142628
+ }
142629
+ throw error;
142630
+ }
142631
+ });
142632
+ },
142633
+ bindHost(nextHost) {
142634
+ assertOperational();
142635
+ host = nextHost;
142636
+ queueContinuation();
142637
+ return () => {
142638
+ if (host === nextHost) host = void 0;
142639
+ };
142640
+ },
142641
+ beginTurn(turnKey) {
142642
+ assertOperational();
142643
+ if (snapshot.goal?.status !== "active") return void 0;
142644
+ if (snapshot.activity === "verifying" || pendingProposal || verificationAttempt) {
142645
+ queuedTurnKey ??= turnKey;
142646
+ continuationQueued = false;
142647
+ return void 0;
142648
+ }
142649
+ if (currentPermit) {
142650
+ if (currentTurnKey === turnKey) return structuredClone(currentPermit);
142651
+ queuedTurnKey ??= turnKey;
142652
+ continuationQueued = false;
142653
+ return void 0;
142654
+ }
142655
+ continuationQueued = false;
142656
+ currentPermit = {
142657
+ goalId: snapshot.goal.goalId,
142658
+ revision: snapshot.goal.revision,
142659
+ turnId: randomUUID13()
142660
+ };
142661
+ currentPermitHost = host;
142662
+ currentTurnKey = turnKey;
142663
+ currentTurnFeedback = nextVerifierFeedback;
142664
+ nextVerifierFeedback = void 0;
142665
+ snapshot = { ...snapshot, activity: "running" };
142666
+ broadcast();
142667
+ return structuredClone(currentPermit);
142668
+ },
142669
+ releaseTurn(turnKey) {
142670
+ return enqueue(async () => {
142671
+ assertOperational();
142672
+ let released = false;
142673
+ if (queuedTurnKey === turnKey) {
142674
+ queuedTurnKey = void 0;
142675
+ released = true;
142676
+ }
142677
+ if (currentPermit && currentTurnKey === turnKey) {
142678
+ if (currentTurnFeedback !== void 0) {
142679
+ nextVerifierFeedback ??= currentTurnFeedback;
142680
+ }
142681
+ currentPermit = void 0;
142682
+ currentPermitHost = void 0;
142683
+ currentTurnKey = void 0;
142684
+ currentTurnFeedback = void 0;
142685
+ currentProposal = void 0;
142686
+ snapshot = { ...snapshot, activity: "idle" };
142687
+ broadcast();
142688
+ released = true;
142689
+ }
142690
+ if (released) queueContinuation();
142691
+ return released;
142692
+ });
142693
+ },
142694
+ permitForTurn(turnKey) {
142695
+ assertOperational();
142696
+ return currentPermit && currentTurnKey === turnKey ? structuredClone(currentPermit) : void 0;
142697
+ },
142698
+ getVerifierFeedback(permit) {
142699
+ assertOperational();
142700
+ if (!isCurrentPermit(permit)) {
142701
+ throw new Error("Goal turn permit is no longer valid");
142702
+ }
142703
+ return currentTurnFeedback;
142704
+ },
142705
+ finishTurn(permit) {
142706
+ const finish = enqueue(
142707
+ async () => {
142708
+ assertOperational();
142709
+ if (!isCurrentPermit(permit) || !snapshot.goal) {
142710
+ throw new Error("Goal turn permit is no longer valid");
142711
+ }
142712
+ const recordUuid = randomUUID13();
142713
+ const nextGoal = reduceGoalTurnFinished(snapshot.goal, {
142714
+ now: Date.now()
142715
+ });
142716
+ const persistedSnapshot = {
142717
+ v: GOAL_STATE_VERSION,
142718
+ goal: nextGoal,
142719
+ activity: "idle"
142720
+ };
142721
+ const persistedBlockedAudit = currentProposal?.blockedAuditCandidate;
142722
+ await options2.journal.recordGoalState(recordUuid, {
142723
+ v: GOAL_STATE_VERSION,
142724
+ cause: "turn_finished",
142725
+ snapshot: persistedSnapshot,
142726
+ ...persistedBlockedAudit ? { blockedAudit: structuredClone(persistedBlockedAudit) } : {}
142727
+ });
142728
+ assertAvailable();
142729
+ const nextTurnKey = queuedTurnKey;
142730
+ const proposal = currentProposal;
142731
+ const activeProposal = proposal && persistedSnapshot.goal?.status === "active" ? proposal : void 0;
142732
+ if (activeProposal?.blockedAuditCandidate) {
142733
+ blockedAudit = activeProposal.blockedAuditCandidate;
142734
+ } else if (persistedSnapshot.goal?.status === "active") {
142735
+ blockedAudit = void 0;
142736
+ }
142737
+ pendingProposal = activeProposal?.readyForVerification && !options2.verifier ? {
142738
+ permit: structuredClone(permit),
142739
+ proposal: structuredClone(activeProposal.proposal)
142740
+ } : void 0;
142741
+ verificationAttempt = activeProposal?.readyForVerification && options2.verifier ? {
142742
+ permit: structuredClone(permit),
142743
+ proposal: structuredClone(activeProposal.proposal),
142744
+ goal: structuredClone(nextGoal),
142745
+ controller: new AbortController()
142746
+ } : void 0;
142747
+ const verifying = Boolean(pendingProposal || verificationAttempt);
142748
+ snapshot = {
142749
+ ...structuredClone(persistedSnapshot),
142750
+ activity: verifying ? "verifying" : "idle"
142751
+ };
142752
+ currentPermit = void 0;
142753
+ currentPermitHost = void 0;
142754
+ currentTurnKey = void 0;
142755
+ currentTurnFeedback = void 0;
142756
+ queuedTurnKey = verifying ? nextTurnKey : void 0;
142757
+ continuationQueued = false;
142758
+ currentProposal = void 0;
142759
+ if (!verifying && nextTurnKey && snapshot.goal?.status === "active") {
142760
+ currentPermit = {
142761
+ goalId: snapshot.goal.goalId,
142762
+ revision: snapshot.goal.revision,
142763
+ turnId: randomUUID13()
142764
+ };
142765
+ currentPermitHost = host;
142766
+ currentTurnKey = nextTurnKey;
142767
+ currentTurnFeedback = nextVerifierFeedback;
142768
+ nextVerifierFeedback = void 0;
142769
+ snapshot = { ...snapshot, activity: "running" };
142770
+ }
142771
+ broadcast("turn_finished");
142772
+ if (!verifying && !currentPermit) {
142773
+ queueContinuation();
142774
+ }
142775
+ return verificationAttempt;
142776
+ }
142777
+ );
142778
+ return finish.then(async (attempt) => {
142779
+ if (attempt) await runVerification(attempt);
142780
+ });
142781
+ },
142782
+ async getGoalForWorker(permit) {
142783
+ assertOperational();
142784
+ if (!isCurrentPermit(permit) || !snapshot.goal) {
142785
+ throw new Error("Goal turn permit is no longer valid");
142786
+ }
142787
+ const goal = structuredClone(snapshot.goal);
142788
+ const verifierFeedback = currentTurnFeedback;
142789
+ const evidenceSource = options2.evidenceSource;
142790
+ if (!evidenceSource) {
142791
+ return {
142792
+ goalId: goal.goalId,
142793
+ revision: goal.revision,
142794
+ objective: goal.objective,
142795
+ evidenceCursor: structuredClone(goal.evidenceCursor),
142796
+ ...verifierFeedback ? { verifierFeedback } : {}
142797
+ };
142798
+ }
142799
+ await evidenceSource.flush();
142800
+ const records = await evidenceSource.readActiveTranscriptChain();
142801
+ const evidenceCatalog = buildGoalEvidenceCatalog({
142802
+ records,
142803
+ goal,
142804
+ permit
142805
+ });
142806
+ if (!isCurrentPermit(permit) || !snapshot.goal) {
142807
+ throw new Error("Goal turn permit is no longer valid");
142808
+ }
142809
+ return {
142810
+ goalId: goal.goalId,
142811
+ revision: goal.revision,
142812
+ objective: goal.objective,
142813
+ evidenceCursor: structuredClone(goal.evidenceCursor),
142814
+ evidenceCatalog,
142815
+ ...verifierFeedback ? { verifierFeedback } : {}
142816
+ };
142817
+ },
142818
+ recordTerminalProposal(permit, proposal) {
142819
+ assertOperational();
142820
+ if (!isCurrentPermit(permit)) {
142821
+ throw new Error("Goal turn permit is no longer valid");
142822
+ }
142823
+ if (currentProposal) {
142824
+ return {
142825
+ recorded: false,
142826
+ readyForVerification: currentProposal.readyForVerification
142827
+ };
142828
+ }
142829
+ let readyForVerification = true;
142830
+ let blockedAuditCandidate;
142831
+ if (proposal.status === "blocked" && proposal.blockerKind !== "authority" && proposal.blockerKind !== "external") {
142832
+ const fingerprint2 = `${proposal.blockerKind ?? ""}
142833
+ ${proposal.reason}`;
142834
+ blockedAuditCandidate = {
142835
+ fingerprint: fingerprint2,
142836
+ count: blockedAudit?.fingerprint === fingerprint2 ? Math.min(blockedAudit.count + 1, 3) : 1,
142837
+ turnIds: blockedAudit?.fingerprint === fingerprint2 ? [...blockedAudit.turnIds, permit.turnId].slice(-3) : [permit.turnId]
142838
+ };
142839
+ readyForVerification = blockedAuditCandidate.count >= 3;
142840
+ }
142841
+ currentProposal = {
142842
+ proposal: structuredClone(proposal),
142843
+ readyForVerification,
142844
+ ...blockedAuditCandidate ? { blockedAuditCandidate } : {}
142845
+ };
142846
+ return { recorded: true, readyForVerification };
142847
+ },
142848
+ takePendingTerminalProposal() {
142849
+ assertOperational();
142850
+ const proposal = pendingProposal;
142851
+ pendingProposal = void 0;
142852
+ return proposal ? structuredClone(proposal) : void 0;
142853
+ },
142854
+ dispatch(request) {
142855
+ const execute = /* @__PURE__ */ __name(async () => {
142856
+ assertOperational();
142857
+ const recordUuid = randomUUID13();
142858
+ const nextGoal = reduceGoalControl(snapshot.goal, {
142859
+ request,
142860
+ now: Date.now(),
142861
+ nextGoalId: randomUUID13(),
142862
+ cursor: request.action === "create" || request.action === "replace" || request.action === "edit" ? { recordId: recordUuid } : options2.journal.getTranscriptCursor()
142863
+ });
142864
+ const nextSnapshot = {
142865
+ v: GOAL_STATE_VERSION,
142866
+ goal: nextGoal,
142867
+ activity: "idle"
142868
+ };
142869
+ await options2.journal.recordGoalState(recordUuid, {
142870
+ v: GOAL_STATE_VERSION,
142871
+ cause: request.action,
142872
+ snapshot: nextSnapshot
142873
+ });
142874
+ assertAvailable();
142875
+ const invalidatesPermit = request.action === "create" || request.action === "replace" || request.action === "edit" || request.action === "pause" || request.action === "clear";
142876
+ const invalidatedHost = currentPermitHost ?? host;
142877
+ if (invalidatesPermit) {
142878
+ invalidateVerification(`Goal ${request.action}`);
142879
+ }
142880
+ if (invalidatesPermit) {
142881
+ currentPermit = void 0;
142882
+ currentPermitHost = void 0;
142883
+ currentTurnKey = void 0;
142884
+ queuedTurnKey = void 0;
142885
+ currentProposal = void 0;
142886
+ pendingProposal = void 0;
142887
+ blockedAudit = void 0;
142888
+ nextVerifierFeedback = void 0;
142889
+ currentTurnFeedback = void 0;
142890
+ continuationQueued = false;
142891
+ } else if (request.action === "resume") {
142892
+ blockedAudit = void 0;
142893
+ }
142894
+ snapshot = {
142895
+ ...structuredClone(nextSnapshot),
142896
+ activity: currentPermit && request.action === "resume" ? "running" : "idle"
142897
+ };
142898
+ if (request.action === "resume") promoteQueuedUserTurn();
142899
+ broadcast(request.action);
142900
+ if (invalidatesPermit) {
142901
+ preemptHost(`Goal ${request.action}`, invalidatedHost);
142902
+ }
142903
+ if (request.action === "resume" || request.action !== "clear" && snapshot.goal?.status === "active") {
142904
+ queueContinuation();
142905
+ }
142906
+ return { snapshot: getSnapshot() };
142907
+ }, "execute");
142908
+ return enqueue(execute);
142909
+ },
142910
+ dispose() {
142911
+ if (disposed) return;
142912
+ disposed = true;
142913
+ const invalidatedHost = currentPermitHost ?? host;
142914
+ currentPermit = void 0;
142915
+ currentPermitHost = void 0;
142916
+ currentTurnKey = void 0;
142917
+ queuedTurnKey = void 0;
142918
+ continuationQueued = false;
142919
+ currentProposal = void 0;
142920
+ pendingProposal = void 0;
142921
+ invalidateVerification("Goal runtime disposed");
142922
+ blockedAudit = void 0;
142923
+ nextVerifierFeedback = void 0;
142924
+ currentTurnFeedback = void 0;
142925
+ preemptHost("Goal runtime disposed", invalidatedHost);
142926
+ host = void 0;
142927
+ listeners.clear();
142928
+ }
142929
+ };
142930
+ }
142931
+ __name(createGoalRuntime, "createGoalRuntime");
142932
+
142596
142933
  // packages/core/src/core/coreToolScheduler.ts
142597
142934
  import { fileURLToPath as fileURLToPath7 } from "node:url";
142598
142935
  var import_fast_levenshtein = __toESM(require_levenshtein(), 1);
@@ -143967,12 +144304,16 @@ var CoreToolScheduler = class {
143967
144304
  }
143968
144305
  const { request: reqInfo, invocation } = toolCall;
143969
144306
  const canonicalName = canonicalToolName2(reqInfo.name);
143970
- const toolSpan = startToolSpan(canonicalName, {
143971
- "tool.call_id": reqInfo.callId,
143972
- "gen_ai.tool.call.id": reqInfo.providerCallId ?? reqInfo.callId,
143973
- call_id: reqInfo.callId,
143974
- tool_name: canonicalName
143975
- });
144307
+ const toolSpan = startToolSpan(
144308
+ canonicalName,
144309
+ {
144310
+ "tool.call_id": reqInfo.callId,
144311
+ "gen_ai.tool.call.id": reqInfo.providerCallId ?? reqInfo.callId,
144312
+ call_id: reqInfo.callId,
144313
+ tool_name: canonicalName
144314
+ },
144315
+ toolCall.tool.description
144316
+ );
143976
144317
  this.toolSpans.set(reqInfo.callId, toolSpan);
143977
144318
  batchState.callIds.add(reqInfo.callId);
143978
144319
  this.callIdToBatch.set(reqInfo.callId, batchState);
@@ -144892,14 +145233,18 @@ var CoreToolScheduler = class {
144892
145233
  let toolSpan = this.toolSpans.get(callId);
144893
145234
  if (!toolSpan) {
144894
145235
  const canonical = canonicalToolName2(toolName);
144895
- toolSpan = startToolSpan(canonical, {
144896
- "tool.call_id": callId,
144897
- "gen_ai.tool.call.id": scheduledCall.request.providerCallId ?? callId,
144898
- call_id: callId,
144899
- // legacy alias — see _schedule for context
144900
- tool_name: canonical
144901
- // legacy alias — see _schedule for context
144902
- });
145236
+ toolSpan = startToolSpan(
145237
+ canonical,
145238
+ {
145239
+ "tool.call_id": callId,
145240
+ "gen_ai.tool.call.id": scheduledCall.request.providerCallId ?? callId,
145241
+ call_id: callId,
145242
+ // legacy alias — see _schedule for context
145243
+ tool_name: canonical
145244
+ // legacy alias — see _schedule for context
145245
+ },
145246
+ scheduledCall.tool.description
145247
+ );
144903
145248
  this.toolSpans.set(callId, toolSpan);
144904
145249
  }
144905
145250
  try {
@@ -145002,18 +145347,18 @@ var CoreToolScheduler = class {
145002
145347
  });
145003
145348
  }
145004
145349
  }
145005
- safelyAddToolInputAttributes(span, toolName, toolInput) {
145350
+ safelyAddToolArgumentsAttributes(span, argumentsValue) {
145006
145351
  try {
145007
- addToolInputAttributes(this.config, span, toolName, toolInput);
145352
+ addToolArgumentsAttributes(this.config, span, argumentsValue);
145008
145353
  } catch (error) {
145009
- debugLogger119.warn("Failed to add tool input span attributes:", error);
145354
+ debugLogger119.warn("Failed to add tool arguments span attribute:", error);
145010
145355
  }
145011
145356
  }
145012
- safelyAddToolResultAttributes(span, toolName, toolResult) {
145357
+ safelyAddToolCallResultAttributes(span, result) {
145013
145358
  try {
145014
- addToolResultAttributes(this.config, span, toolName, toolResult);
145359
+ addToolCallResultAttributes(this.config, span, result);
145015
145360
  } catch (error) {
145016
- debugLogger119.warn("Failed to add tool result span attributes:", error);
145361
+ debugLogger119.warn("Failed to add tool result span attribute:", error);
145017
145362
  }
145018
145363
  }
145019
145364
  async _executeToolCallBody(scheduledCall, signal, span) {
@@ -145029,13 +145374,6 @@ var CoreToolScheduler = class {
145029
145374
  }
145030
145375
  }
145031
145376
  }
145032
- if (this.config.getTelemetryIncludeSensitiveSpanAttributes?.()) {
145033
- this.safelyAddToolInputAttributes(
145034
- span,
145035
- toolName,
145036
- safeJsonStringify(toolInput) ?? "{}"
145037
- );
145038
- }
145039
145377
  const toolUseId = isPostAskReexecution ? this.bouncedToolUseId.get(callId) ?? generateToolUseId() : generateToolUseId();
145040
145378
  const messageBus = this.config.getMessageBus();
145041
145379
  const hooksEnabled = !this.config.getDisableAllHooks();
@@ -145089,11 +145427,6 @@ var CoreToolScheduler = class {
145089
145427
  new Error(blockMessage),
145090
145428
  "execution_denied" /* EXECUTION_DENIED */
145091
145429
  );
145092
- this.safelyAddToolResultAttributes(
145093
- span,
145094
- toolName,
145095
- `BLOCKED: ${blockMessage}`
145096
- );
145097
145430
  this.setStatusInternal(callId, "error", errorResponse);
145098
145431
  setToolSpanFailure(
145099
145432
  span,
@@ -145169,6 +145502,7 @@ var CoreToolScheduler = class {
145169
145502
  );
145170
145503
  return promotableShells.length === 1 && promotableShells[0]?.request.callId === callId;
145171
145504
  }, "canPromoteForegroundShell");
145505
+ this.safelyAddToolArgumentsAttributes(span, invocation.params);
145172
145506
  promise = invocation.execute(
145173
145507
  execSignal,
145174
145508
  liveOutputCallback,
@@ -145178,6 +145512,7 @@ var CoreToolScheduler = class {
145178
145512
  canPromoteForegroundShell
145179
145513
  );
145180
145514
  } else {
145515
+ this.safelyAddToolArgumentsAttributes(span, invocation.params);
145181
145516
  promise = invocation.execute(
145182
145517
  execSignal,
145183
145518
  liveOutputCallback,
@@ -145252,11 +145587,6 @@ ${failureHookResult.additionalContext}`;
145252
145587
  }
145253
145588
  failureHookArtifacts = failureHookResult.artifacts;
145254
145589
  }
145255
- this.safelyAddToolResultAttributes(
145256
- span,
145257
- toolName,
145258
- `CANCELLED: ${cancelMessage}`
145259
- );
145260
145590
  this.setStatusInternal(
145261
145591
  callId,
145262
145592
  "cancelled",
@@ -145331,11 +145661,6 @@ ${failureHookResult.additionalContext}`;
145331
145661
  new Error(stopMessage),
145332
145662
  "execution_denied" /* EXECUTION_DENIED */
145333
145663
  );
145334
- this.safelyAddToolResultAttributes(
145335
- span,
145336
- toolName,
145337
- `STOPPED: ${stopMessage}`
145338
- );
145339
145664
  this.setStatusInternal(callId, "error", errorResponse);
145340
145665
  setToolSpanFailure(
145341
145666
  span,
@@ -145472,13 +145797,6 @@ ${body}
145472
145797
  }
145473
145798
  }
145474
145799
  }
145475
- if (this.config.getTelemetryIncludeSensitiveSpanAttributes?.()) {
145476
- this.safelyAddToolResultAttributes(
145477
- span,
145478
- toolName,
145479
- typeof content === "string" ? content : safeJsonStringify(content) ?? ""
145480
- );
145481
- }
145482
145800
  contentLength = typeof content === "string" ? content.length : void 0;
145483
145801
  const response = convertToFunctionResponse(toolName, callId, content);
145484
145802
  const artifacts = [
@@ -145506,6 +145824,12 @@ ${body}
145506
145824
  span.setAttribute("success", true);
145507
145825
  } catch {
145508
145826
  }
145827
+ const result = response.find(
145828
+ (part) => part.functionResponse !== void 0
145829
+ )?.functionResponse?.response;
145830
+ if (result !== void 0) {
145831
+ this.safelyAddToolCallResultAttributes(span, result);
145832
+ }
145509
145833
  } else {
145510
145834
  const operationalErrorMessage = toolResult.error.message;
145511
145835
  let errorMessage = operationalErrorMessage;
@@ -145567,11 +145891,6 @@ ${failureHookResult.additionalContext}`;
145567
145891
  const error2 = part.functionResponse?.response?.["error"];
145568
145892
  return total + (typeof error2 === "string" ? error2.length : 0);
145569
145893
  }, 0);
145570
- this.safelyAddToolResultAttributes(
145571
- span,
145572
- toolName,
145573
- `ERROR: ${operationalErrorMessage}`
145574
- );
145575
145894
  const artifacts = [
145576
145895
  ...toolResult.artifacts ?? [],
145577
145896
  ...failureHookArtifacts ?? []
@@ -145617,11 +145936,6 @@ ${failureHookResult.additionalContext}`;
145617
145936
  ])
145618
145937
  );
145619
145938
  }
145620
- this.safelyAddToolResultAttributes(
145621
- span,
145622
- toolName,
145623
- `ERROR: ${errorMessage}`
145624
- );
145625
145939
  const error = new Error(errorMessage);
145626
145940
  const errorResponse = createErrorResponse(
145627
145941
  scheduledCall.request,
@@ -145682,11 +145996,6 @@ ${failureHookResult.additionalContext}`;
145682
145996
  }
145683
145997
  failureHookArtifacts = failureHookResult.artifacts;
145684
145998
  }
145685
- this.safelyAddToolResultAttributes(
145686
- span,
145687
- toolName,
145688
- `CANCELLED: ${cancelMessage}`
145689
- );
145690
145999
  this.setStatusInternal(
145691
146000
  callId,
145692
146001
  "cancelled",
@@ -145728,11 +146037,6 @@ ${failureHookResult.additionalContext}`;
145728
146037
  }
145729
146038
  failureHookArtifacts = failureHookResult.artifacts;
145730
146039
  }
145731
- this.safelyAddToolResultAttributes(
145732
- span,
145733
- toolName,
145734
- `EXCEPTION: ${exceptionErrorMessage}`
145735
- );
145736
146040
  this.setStatusInternal(
145737
146041
  callId,
145738
146042
  "error",
@@ -146197,7 +146501,7 @@ var AgentCore = class {
146197
146501
  lastPromptTokenCount = 0;
146198
146502
  toolUsage = /* @__PURE__ */ new Map();
146199
146503
  constructor(name, runtimeContext, promptConfig, modelConfig, runConfig, toolConfig, eventEmitter, hooks, runtimeView) {
146200
- const randomPart = randomUUID13().replace(/-/g, "").slice(0, 8);
146504
+ const randomPart = randomUUID14().replace(/-/g, "").slice(0, 8);
146201
146505
  this.subagentId = `${name}-${randomPart}`;
146202
146506
  this.name = name;
146203
146507
  this.runtimeContext = runtimeContext;
@@ -146458,7 +146762,7 @@ var AgentCore = class {
146458
146762
  }
146459
146763
  async _runReasoningLoopInner(chat, initialMessages, toolsList, abortController, options2) {
146460
146764
  const startTime = options2?.startTimeMs ?? Date.now();
146461
- const runId = randomUUID13();
146765
+ const runId = randomUUID14();
146462
146766
  let currentMessages = initialMessages;
146463
146767
  let turnCounter = 0;
146464
146768
  let finalText = "";
@@ -146915,7 +147219,7 @@ ${text}` : text;
146915
147219
  async processFunctionCalls(functionCalls, abortController, promptId, currentRound, toolsList, responseId, wasOutputTruncated = false, handledProviderToolCallIds = /* @__PURE__ */ new Set(), duplicateProviderToolCallResponseIds = /* @__PURE__ */ new Set()) {
146916
147220
  const responseByCallId = /* @__PURE__ */ new Map();
146917
147221
  const uniqueFunctionCalls = dedupeToolCallsById(functionCalls);
146918
- const generatedCallIdBase = randomUUID13();
147222
+ const generatedCallIdBase = randomUUID14();
146919
147223
  const callIdByFunctionCall = new Map(
146920
147224
  uniqueFunctionCalls.map((functionCall, index) => [
146921
147225
  functionCall,
@@ -149170,7 +149474,7 @@ var AgentToolInvocation = class extends BaseToolInvocation {
149170
149474
  ov.workspaceContext = wtWorkspace;
149171
149475
  ov.getWorkspaceContext = () => wtWorkspace;
149172
149476
  }
149173
- const agentIdSuffix = this.callId ?? randomUUID14().slice(0, 8);
149477
+ const agentIdSuffix = this.callId ?? randomUUID15().slice(0, 8);
149174
149478
  const launchDepth = childLaunchDepth();
149175
149479
  const hookOpts = {
149176
149480
  agentId: `${subagentConfig.name}-${agentIdSuffix}`,
@@ -151767,7 +152071,7 @@ var WRITE_TOOL_NAMES2 = /* @__PURE__ */ new Set([
151767
152071
  function makeTaskRecord(type, projectRoot, sessionId) {
151768
152072
  const now = (/* @__PURE__ */ new Date()).toISOString();
151769
152073
  return {
151770
- id: randomUUID15(),
152074
+ id: randomUUID16(),
151771
152075
  taskType: type,
151772
152076
  projectRoot,
151773
152077
  sessionId,
@@ -154409,6 +154713,10 @@ The current date is: ${today}. Note: This is the authoritative current date \u20
154409
154713
  shouldUsePlanOnlyReminderInSubagentContext() || this.config.getSdkMode()
154410
154714
  )
154411
154715
  );
154716
+ } else if (this.config.consumePendingManualPlanExitNotice()) {
154717
+ systemReminders.push(
154718
+ getManualPlanExitSystemReminder(this.config.getApprovalMode())
154719
+ );
154412
154720
  }
154413
154721
  const arenaManager = this.config.getArenaManager();
154414
154722
  if (arenaManager) {
@@ -156051,14 +156359,14 @@ var ResourceRegistry = class {
156051
156359
  };
156052
156360
 
156053
156361
  // packages/core/src/config/config.ts
156054
- import { randomUUID as randomUUID16 } from "node:crypto";
156362
+ import { randomUUID as randomUUID17 } from "node:crypto";
156055
156363
 
156056
156364
  // packages/core/src/memory/team-memory-sync.ts
156057
156365
  init_esbuild_shims();
156058
- import { execFile as execFile9 } from "node:child_process";
156366
+ import { execFile as execFile10 } from "node:child_process";
156059
156367
  import * as path96 from "node:path";
156060
156368
  import { promisify as promisify6 } from "node:util";
156061
- var execFileAsync6 = promisify6(execFile9);
156369
+ var execFileAsync6 = promisify6(execFile10);
156062
156370
  var debugLogger135 = createDebugLogger("TEAM_MEMORY_SYNC");
156063
156371
  var GIT_TIMEOUT_MS2 = 15e3;
156064
156372
  async function tryGit(cwd, args, killSignal = "SIGTERM") {
@@ -156674,6 +156982,7 @@ var Config = class {
156674
156982
  approvalMode;
156675
156983
  prePlanMode;
156676
156984
  approvalModeRevision = 0;
156985
+ pendingManualPlanExitNotice = false;
156677
156986
  autoModeDenialState = createDenialState();
156678
156987
  accessibility;
156679
156988
  showResponseTokensPerSecond;
@@ -156815,7 +157124,7 @@ var Config = class {
156815
157124
  settingsWatcher;
156816
157125
  constructor(params) {
156817
157126
  this.sessionRuntimeBaseDir = Storage.getRuntimeBaseDir();
156818
- this.sessionId = params.sessionId ?? randomUUID16();
157127
+ this.sessionId = params.sessionId ?? randomUUID17();
156819
157128
  if (!sessionEnvClaimed && process8.env) {
156820
157129
  process8.env["QWEN_CODE_SESSION_ID"] = this.sessionId;
156821
157130
  sessionEnvClaimed = true;
@@ -157926,7 +158235,7 @@ var Config = class {
157926
158235
  void outgoingChatRecordingService?.flush().catch(() => {
157927
158236
  });
157928
158237
  const previousSessionId = this.sessionId;
157929
- this.sessionId = sessionId ?? randomUUID16();
158238
+ this.sessionId = sessionId ?? randomUUID17();
157930
158239
  if (process8.env) {
157931
158240
  process8.env["QWEN_CODE_SESSION_ID"] = this.sessionId;
157932
158241
  }
@@ -159422,7 +159731,6 @@ var Config = class {
159422
159731
  return this.approvalModeRevision;
159423
159732
  }
159424
159733
  setApprovalMode(mode, options2) {
159425
- void options2;
159426
159734
  if (!this.isTrustedFolder() && mode !== "default" /* DEFAULT */ && mode !== "plan" /* PLAN */) {
159427
159735
  throw new TrustGateError(
159428
159736
  "Cannot enable privileged approval modes in an untrusted folder."
@@ -159438,8 +159746,12 @@ var Config = class {
159438
159746
  }
159439
159747
  if (mode === "plan" /* PLAN */ && fromMode !== "plan" /* PLAN */) {
159440
159748
  this.prePlanMode = fromMode;
159749
+ this.pendingManualPlanExitNotice = false;
159441
159750
  } else if (mode !== "plan" /* PLAN */ && fromMode === "plan" /* PLAN */) {
159442
159751
  this.prePlanMode = void 0;
159752
+ if (!options2?.fromApprovedPlanExit) {
159753
+ this.pendingManualPlanExitNotice = true;
159754
+ }
159443
159755
  }
159444
159756
  if (fromMode !== mode) {
159445
159757
  this.autoModeDenialState = resetDenialState();
@@ -159449,6 +159761,16 @@ var Config = class {
159449
159761
  this.approvalModeRevision++;
159450
159762
  }
159451
159763
  }
159764
+ /**
159765
+ * One-shot: returns whether a manual (non-approved) plan-mode exit is
159766
+ * pending model notification, and clears the flag. Consumed by the
159767
+ * system-reminder assembly in `GeminiClient` on the next model-bound turn.
159768
+ */
159769
+ consumePendingManualPlanExitNotice() {
159770
+ const pending = this.pendingManualPlanExitNotice;
159771
+ this.pendingManualPlanExitNotice = false;
159772
+ return pending;
159773
+ }
159452
159774
  /**
159453
159775
  * Returns the directory where this session's plan file is stored.
159454
159776
  */
@@ -160589,7 +160911,7 @@ var Config = class {
160589
160911
  }
160590
160912
  if (!enabled) return;
160591
160913
  registry.registerFactory(ToolNames.IMAGE_GEN, async () => {
160592
- const { ImageGenTool } = await import("./image-gen-Z3VPGKRC.js");
160914
+ const { ImageGenTool } = await import("./image-gen-WIEM7KZA.js");
160593
160915
  return new ImageGenTool(this);
160594
160916
  });
160595
160917
  }
@@ -160625,19 +160947,19 @@ var Config = class {
160625
160947
  }, "registerStructuredOutputIfRequested");
160626
160948
  if (this.getBareMode()) {
160627
160949
  await registerLazy(ToolNames.READ_FILE, async () => {
160628
- const { ReadFileTool } = await import("./read-file-APMO3PSX.js");
160950
+ const { ReadFileTool } = await import("./read-file-LZXUR4TO.js");
160629
160951
  return new ReadFileTool(this);
160630
160952
  });
160631
160953
  await registerLazy(ToolNames.EDIT, async () => {
160632
- const { EditTool } = await import("./edit-OBDSQURM.js");
160954
+ const { EditTool } = await import("./edit-RIEOJWKB.js");
160633
160955
  return new EditTool(this);
160634
160956
  });
160635
160957
  await registerLazy(ToolNames.NOTEBOOK_EDIT, async () => {
160636
- const { NotebookEditTool } = await import("./notebook-edit-BNOK452R.js");
160958
+ const { NotebookEditTool } = await import("./notebook-edit-JGJV2K6J.js");
160637
160959
  return new NotebookEditTool(this);
160638
160960
  });
160639
160961
  await registerLazy(ToolNames.SHELL, async () => {
160640
- const { ShellTool: ShellTool2 } = await import("./shell-HH3PF3A2.js");
160962
+ const { ShellTool: ShellTool2 } = await import("./shell-45IPBDP5.js");
160641
160963
  return new ShellTool2(this);
160642
160964
  });
160643
160965
  await registerStructuredOutputIfRequested();
@@ -160647,7 +160969,7 @@ var Config = class {
160647
160969
  return registry;
160648
160970
  }
160649
160971
  await registerLazy(ToolNames.TOOL_SEARCH, async () => {
160650
- const { ToolSearchTool } = await import("./tool-search-NF7GB6LE.js");
160972
+ const { ToolSearchTool } = await import("./tool-search-APECNQ3Z.js");
160651
160973
  return new ToolSearchTool(this);
160652
160974
  });
160653
160975
  await registerLazy(ToolNames.READ_MCP_RESOURCE, async () => {
@@ -160655,7 +160977,7 @@ var Config = class {
160655
160977
  return new ReadMcpResourceTool(this);
160656
160978
  });
160657
160979
  await registerLazy(ToolNames.AGENT, async () => {
160658
- const { AgentTool: AgentTool2 } = await import("./agent-6ODUANDO.js");
160980
+ const { AgentTool: AgentTool2 } = await import("./agent-VXDAN5JK.js");
160659
160981
  return new AgentTool2(this);
160660
160982
  });
160661
160983
  await registerLazy(ToolNames.LIST_AGENTS, async () => {
@@ -160671,7 +160993,7 @@ var Config = class {
160671
160993
  return new SendMessageTool(this);
160672
160994
  });
160673
160995
  await registerLazy(ToolNames.SKILL, async () => {
160674
- const { SkillTool } = await import("./skill-I3SDA4MB.js");
160996
+ const { SkillTool } = await import("./skill-LIWXNLDW.js");
160675
160997
  return new SkillTool(this);
160676
160998
  });
160677
160999
  await registerLazy(ToolNames.LS, async () => {
@@ -160679,7 +161001,7 @@ var Config = class {
160679
161001
  return new LSTool(this);
160680
161002
  });
160681
161003
  await registerLazy(ToolNames.READ_FILE, async () => {
160682
- const { ReadFileTool } = await import("./read-file-APMO3PSX.js");
161004
+ const { ReadFileTool } = await import("./read-file-LZXUR4TO.js");
160683
161005
  return new ReadFileTool(this);
160684
161006
  });
160685
161007
  if (this.getUseRipgrep()) {
@@ -160694,7 +161016,7 @@ var Config = class {
160694
161016
  recordStartupEvent("config_initialize_ripgrep_probe_end");
160695
161017
  if (useRipgrep) {
160696
161018
  await registerLazy(ToolNames.GREP, async () => {
160697
- const { RipGrepTool: RipGrepTool2 } = await import("./ripGrep-BEJDEDXW.js");
161019
+ const { RipGrepTool: RipGrepTool2 } = await import("./ripGrep-2U2FRGMV.js");
160698
161020
  return new RipGrepTool2(this);
160699
161021
  });
160700
161022
  } else {
@@ -160707,7 +161029,7 @@ var Config = class {
160707
161029
  )
160708
161030
  );
160709
161031
  await registerLazy(ToolNames.GREP, async () => {
160710
- const { GrepTool } = await import("./grep-QYPSK7OP.js");
161032
+ const { GrepTool } = await import("./grep-RKWVROCW.js");
160711
161033
  return new GrepTool(this);
160712
161034
  });
160713
161035
  }
@@ -160715,28 +161037,28 @@ var Config = class {
160715
161037
  recordStartupEvent("config_initialize_ripgrep_probe_start");
160716
161038
  recordStartupEvent("config_initialize_ripgrep_probe_end");
160717
161039
  await registerLazy(ToolNames.GREP, async () => {
160718
- const { GrepTool } = await import("./grep-QYPSK7OP.js");
161040
+ const { GrepTool } = await import("./grep-RKWVROCW.js");
160719
161041
  return new GrepTool(this);
160720
161042
  });
160721
161043
  }
160722
161044
  await registerLazy(ToolNames.GLOB, async () => {
160723
- const { GlobTool } = await import("./glob-V7R3PSK3.js");
161045
+ const { GlobTool } = await import("./glob-FRTM3X2E.js");
160724
161046
  return new GlobTool(this);
160725
161047
  });
160726
161048
  await registerLazy(ToolNames.EDIT, async () => {
160727
- const { EditTool } = await import("./edit-OBDSQURM.js");
161049
+ const { EditTool } = await import("./edit-RIEOJWKB.js");
160728
161050
  return new EditTool(this);
160729
161051
  });
160730
161052
  await registerLazy(ToolNames.NOTEBOOK_EDIT, async () => {
160731
- const { NotebookEditTool } = await import("./notebook-edit-BNOK452R.js");
161053
+ const { NotebookEditTool } = await import("./notebook-edit-JGJV2K6J.js");
160732
161054
  return new NotebookEditTool(this);
160733
161055
  });
160734
161056
  await registerLazy(ToolNames.WRITE_FILE, async () => {
160735
- const { WriteFileTool: WriteFileTool2 } = await import("./write-file-VHIXW5M7.js");
161057
+ const { WriteFileTool: WriteFileTool2 } = await import("./write-file-HUUCEG4P.js");
160736
161058
  return new WriteFileTool2(this);
160737
161059
  });
160738
161060
  await registerLazy(ToolNames.SHELL, async () => {
160739
- const { ShellTool: ShellTool2 } = await import("./shell-HH3PF3A2.js");
161061
+ const { ShellTool: ShellTool2 } = await import("./shell-45IPBDP5.js");
160740
161062
  return new ShellTool2(this);
160741
161063
  });
160742
161064
  await registerLazy(ToolNames.TODO_WRITE, async () => {
@@ -160752,34 +161074,34 @@ var Config = class {
160752
161074
  }
160753
161075
  if (!this.sdkMode && (supportsUserInteraction || options2?.forSubAgent)) {
160754
161076
  await registerLazy(ToolNames.EXIT_PLAN_MODE, async () => {
160755
- const { ExitPlanModeTool } = await import("./exitPlanMode-GXTBWQAR.js");
161077
+ const { ExitPlanModeTool } = await import("./exitPlanMode-GHPUHBZJ.js");
160756
161078
  return new ExitPlanModeTool(this);
160757
161079
  });
160758
161080
  }
160759
161081
  if (!this.sdkMode && supportsUserInteraction) {
160760
161082
  await registerLazy(ToolNames.ENTER_PLAN_MODE, async () => {
160761
- const { EnterPlanModeTool } = await import("./enterPlanMode-BC5QUZZ2.js");
161083
+ const { EnterPlanModeTool } = await import("./enterPlanMode-IWZYALIB.js");
160762
161084
  return new EnterPlanModeTool(this);
160763
161085
  });
160764
161086
  }
160765
161087
  await registerLazy(ToolNames.ENTER_WORKTREE, async () => {
160766
- const { EnterWorktreeTool } = await import("./enter-worktree-U6MRPQ2P.js");
161088
+ const { EnterWorktreeTool } = await import("./enter-worktree-OGK5FQ3R.js");
160767
161089
  return new EnterWorktreeTool(this);
160768
161090
  });
160769
161091
  await registerLazy(ToolNames.EXIT_WORKTREE, async () => {
160770
- const { ExitWorktreeTool } = await import("./exit-worktree-DGNYMECB.js");
161092
+ const { ExitWorktreeTool } = await import("./exit-worktree-4TEYVIVP.js");
160771
161093
  return new ExitWorktreeTool(this);
160772
161094
  });
160773
161095
  await registerLazy(ToolNames.WEB_FETCH, async () => {
160774
- const { WebFetchTool } = await import("./web-fetch-NKCSG7ZE.js");
161096
+ const { WebFetchTool } = await import("./web-fetch-L5UTI53V.js");
160775
161097
  return new WebFetchTool(this);
160776
161098
  });
160777
161099
  if (this.webSearchSettings?.enabled) {
160778
- const { evaluateWebSearchGate } = await import("./web-search-S62WAP4S.js");
161100
+ const { evaluateWebSearchGate } = await import("./web-search-KM33JOS3.js");
160779
161101
  const gate = evaluateWebSearchGate(this);
160780
161102
  if (gate.ok) {
160781
161103
  await registerLazy(ToolNames.WEB_SEARCH, async () => {
160782
- const { WebSearchTool } = await import("./web-search-S62WAP4S.js");
161104
+ const { WebSearchTool } = await import("./web-search-KM33JOS3.js");
160783
161105
  return new WebSearchTool(this);
160784
161106
  });
160785
161107
  } else if (!this.webSearchNoticeEmitted && !options2?.forSubAgent) {
@@ -160831,7 +161153,7 @@ var Config = class {
160831
161153
  });
160832
161154
  if (this.isAgentTeamEnabled()) {
160833
161155
  await registerLazy(ToolNames.TEAM_CREATE, async () => {
160834
- const { TeamCreateTool } = await import("./team-create-YJALH5D2.js");
161156
+ const { TeamCreateTool } = await import("./team-create-O2FROQ4R.js");
160835
161157
  return new TeamCreateTool(this);
160836
161158
  });
160837
161159
  await registerLazy(ToolNames.TEAM_DELETE, async () => {
@@ -160839,7 +161161,7 @@ var Config = class {
160839
161161
  return new TeamDeleteTool(this);
160840
161162
  });
160841
161163
  await registerLazy(ToolNames.TEAM_PLAN_APPROVAL, async () => {
160842
- const { TeamPlanApprovalTool } = await import("./team-plan-approval-34QFYKGN.js");
161164
+ const { TeamPlanApprovalTool } = await import("./team-plan-approval-Q6WDBXTQ.js");
160843
161165
  return new TeamPlanApprovalTool(this);
160844
161166
  });
160845
161167
  await registerLazy(ToolNames.TASK_CREATE, async () => {
@@ -160857,16 +161179,16 @@ var Config = class {
160857
161179
  }
160858
161180
  if (this.isWorkflowsEnabled()) {
160859
161181
  await registerLazy(ToolNames.WORKFLOW, async () => {
160860
- const { WorkflowTool } = await import("./workflow-QAGU5RU4.js");
161182
+ const { WorkflowTool } = await import("./workflow-K7FAWV77.js");
160861
161183
  return new WorkflowTool(this);
160862
161184
  });
160863
161185
  }
160864
161186
  if (this.isComputerUseEnabled()) {
160865
- const { registerComputerUseTools } = await import("./computer-use-SOQ4E3VX.js");
161187
+ const { registerComputerUseTools } = await import("./computer-use-DOFAHZAB.js");
160866
161188
  await registerComputerUseTools(registerLazy, this);
160867
161189
  }
160868
161190
  await registerLazy(ToolNames.MONITOR, async () => {
160869
- const { MonitorTool } = await import("./monitor-R3ODH5U6.js");
161191
+ const { MonitorTool } = await import("./monitor-7FEWXX5F.js");
160870
161192
  return new MonitorTool(this);
160871
161193
  });
160872
161194
  if (this.pendingMcpBudgetCallback) {
@@ -161480,6 +161802,11 @@ __name(buildReplacement, "buildReplacement");
161480
161802
 
161481
161803
  // packages/core/src/tools/shell.ts
161482
161804
  var debugLogger137 = createDebugLogger("SHELL");
161805
+ function statusFileGuidance(outputPath) {
161806
+ return `status file: ${statusFilePathFor(outputPath)}
161807
+ To check whether this process is still running, Read the status file (status: running|completed|failed|cancelled). Do NOT infer liveness from the output file: programs often block-buffer stdout when not attached to a TTY, so an empty output file is normal while the process is alive (for live output, re-run with e.g. \`python -u\` or \`stdbuf -oL\`).`;
161808
+ }
161809
+ __name(statusFileGuidance, "statusFileGuidance");
161483
161810
  function stripTrailingBackgroundAmp2(command) {
161484
161811
  const trimmed2 = command.trimEnd();
161485
161812
  if (!trimmed2.endsWith("&")) return command;
@@ -163437,12 +163764,14 @@ ${longRunHint}` : ""),
163437
163764
  promoteArtifacts.onSettleWired(queued);
163438
163765
  }
163439
163766
  const statusLine = postPromoteSettleObserved ? `Status: ${postPromoteFinalStatus ?? "settled"}. PID: ${result.pid ?? "(unknown)"}.` : `Status: running. PID: ${result.pid ?? "(unknown)"}.`;
163767
+ const statusFileLine = statusFileGuidance(outputPath);
163440
163768
  const inspectLine = `To inspect: \`/tasks\` (text), the Background tasks dialog (\u2193 + Enter on the footer pill), or \`Read\` the output file directly.`;
163441
163769
  const stopLine = postPromoteSettleObserved ? `Process has already exited; no \`task_stop\` needed (the entry is observable in \`/tasks\` for inspection).` : `To stop the now-background process: \`task_stop({ task_id: '${shellId}' })\`.`;
163442
163770
  const llmContent = [
163443
163771
  `Foreground command "${commandToExecute}" promoted to background as ${shellId}.`,
163444
163772
  statusLine,
163445
163773
  `Output snapshot at promote time saved to: ${outputPath}`,
163774
+ statusFileLine,
163446
163775
  inspectLine,
163447
163776
  stopLine
163448
163777
  ].join("\n");
@@ -163568,6 +163897,7 @@ ${longRunHint}` : ""),
163568
163897
  llmContent: `Background shell started.
163569
163898
  id: ${shellId}
163570
163899
  ` + pidLine + `output file: ${outputPath}
163900
+ ${statusFileGuidance(outputPath)}
163571
163901
  To inspect: /tasks (text) or the interactive Background tasks dialog (focus the footer Background tasks pill, then Enter \u2014 detail view + live updates). Read the output file directly to view the captured output.`,
163572
163902
  returnDisplay: `Background shell ${shellId} started${pid !== void 0 ? ` (pid ${pid})` : ""}.`
163573
163903
  };
@@ -164441,6 +164771,7 @@ export {
164441
164771
  getCompressionPrompt,
164442
164772
  getProjectSummaryPrompt,
164443
164773
  getPlanModeSystemReminder,
164774
+ getManualPlanExitSystemReminder,
164444
164775
  getArenaSystemReminder,
164445
164776
  getInsightPrompt,
164446
164777
  PLAN_MODE_ENTRY_SIBLING_SKIP_MESSAGE,
@@ -164735,6 +165066,10 @@ export {
164735
165066
  getShellPagerEnv,
164736
165067
  getShellAbortReasonKind,
164737
165068
  ShellExecutionService,
165069
+ MAX_NOTIFICATION_OUTPUT_TAIL_BYTES,
165070
+ MAX_RETAINED_TERMINAL_SHELLS,
165071
+ statusFilePathFor,
165072
+ BackgroundShellRegistry,
164738
165073
  StructuredToolError,
164739
165074
  checkPriorRead,
164740
165075
  escape,
@@ -164936,9 +165271,6 @@ export {
164936
165271
  MAX_RETAINED_TERMINAL_MONITORS,
164937
165272
  getMonitorOutputPath,
164938
165273
  MonitorRegistry,
164939
- MAX_NOTIFICATION_OUTPUT_TAIL_BYTES,
164940
- MAX_RETAINED_TERMINAL_SHELLS,
164941
- BackgroundShellRegistry,
164942
165274
  MAX_RETAINED_TERMINAL_WORKFLOWS,
164943
165275
  WorkflowRunRegistry,
164944
165276
  FileReadCache,
@@ -165253,6 +165585,10 @@ export {
165253
165585
  readGitHead,
165254
165586
  resolveBranchName,
165255
165587
  watchRepoBranch,
165588
+ GITHUB_PR_ERROR_MESSAGE_MAX,
165589
+ GITHUB_PR_LIST_LIMIT,
165590
+ parseGhPrList,
165591
+ fetchGitHubPullRequests,
165256
165592
  readPathFromWorkspace,
165257
165593
  getWelcomeBackState,
165258
165594
  saveWelcomeBackRestartChoice,
@@ -165292,7 +165628,8 @@ export {
165292
165628
  GoalVerifierInputTooLargeError,
165293
165629
  parseGoalVerifierText,
165294
165630
  validateGoalVerifierText,
165295
- createGoalVerifier
165631
+ createGoalVerifier,
165632
+ createGoalRuntime
165296
165633
  };
165297
165634
  /**
165298
165635
  * @license