@qwen-code/qwen-code 0.21.11-preview.0 → 0.21.11

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 (360) hide show
  1. package/bundled/coordinate/SKILL.md +52 -0
  2. package/bundled/qc-helper/docs/configuration/model-providers.md +10 -8
  3. package/bundled/qc-helper/docs/features/_meta.ts +1 -0
  4. package/bundled/qc-helper/docs/features/arena.md +4 -3
  5. package/bundled/qc-helper/docs/features/commands.md +7 -6
  6. package/bundled/qc-helper/docs/features/dual-output.md +5 -0
  7. package/bundled/qc-helper/docs/features/headless.md +8 -0
  8. package/bundled/qc-helper/docs/features/multi-agent-coordination.md +30 -0
  9. package/bundled/qc-helper/docs/qwen-serve.md +7 -7
  10. package/bundled/review/SKILL.md +17 -7
  11. package/chunks/{MaxSizedBox-FVSXOMKP.js → MaxSizedBox-G7QPSZTF.js} +45 -44
  12. package/chunks/{StandaloneSessionPicker-Q27UAQ3X.js → StandaloneSessionPicker-3CTEPV7S.js} +65 -64
  13. package/chunks/{acp-startup-profiler-VNTFWYAC.js → acp-startup-profiler-JMJBZDVO.js} +2 -2
  14. package/chunks/{acpAgent-C6TV2BIU.js → acpAgent-43JURWOW.js} +1107 -285
  15. package/chunks/{agent-IPODFZTU.js → agent-MIY4LJJJ.js} +42 -41
  16. package/chunks/agent-headless-LWVA6GR5.js +87 -0
  17. package/chunks/{anthropicContentGenerator-D3Y4RFT4.js → anthropicContentGenerator-7HEP7Q5D.js} +8 -8
  18. package/chunks/{artifact-tool-N652YE4L.js → artifact-tool-M7UAJ5NT.js} +2 -2
  19. package/chunks/{askUserQuestion-ONW74PKJ.js → askUserQuestion-7G3LI3IZ.js} +2 -2
  20. package/chunks/{bridge-YX2R6VVM.js → bridge-PTTJEBNP.js} +47 -46
  21. package/chunks/{ca-ZLKAB4K3.js → ca-4CQ6MYNQ.js} +2 -1
  22. package/chunks/{channel-management-service-PHELKOW2.js → channel-management-service-PQ6SU56M.js} +6 -6
  23. package/chunks/channel-settings-store-IKK34GMH.js +102 -0
  24. package/chunks/{channel-worker-group-WQP4RCDO.js → channel-worker-group-WBRE33ZV.js} +8 -7
  25. package/chunks/{channel-worker-manager-MRDFAKIM.js → channel-worker-manager-V4LYVTPH.js} +8 -7
  26. package/chunks/{channel-worker-supervisor-IVSDIMI4.js → channel-worker-supervisor-YDAGW2RP.js} +6 -5
  27. package/chunks/{chunk-I7XTOGIS.js → chunk-23GFHEM3.js} +4 -4
  28. package/chunks/{chunk-IIJEYBNH.js → chunk-25OFRBH2.js} +188 -58
  29. package/chunks/{chunk-E2XBEWAK.js → chunk-2AAFGCWP.js} +650 -129
  30. package/chunks/{chunk-J6SZID63.js → chunk-2AZMF6G5.js} +2 -2
  31. package/chunks/{chunk-VVSMEI6C.js → chunk-2R2HYSUQ.js} +21 -102
  32. package/chunks/{chunk-DZUO626D.js → chunk-2XZWO53E.js} +3 -3
  33. package/chunks/{chunk-VKJ4KTPJ.js → chunk-3GCU5O2E.js} +1 -1
  34. package/chunks/{chunk-AJ6LQ5A6.js → chunk-3LHYTQ2R.js} +1 -1
  35. package/chunks/{chunk-LU7RJB2W.js → chunk-3SOTXJNO.js} +8 -8
  36. package/chunks/{chunk-SKSOLRPK.js → chunk-45HPDU3F.js} +3 -3
  37. package/chunks/{chunk-OWMAZHIX.js → chunk-47FQVRCO.js} +1 -1
  38. package/chunks/{chunk-K4QON4BH.js → chunk-4C4QSXE3.js} +23 -23
  39. package/chunks/{chunk-UMEB4DHF.js → chunk-4EX3DBFH.js} +4 -4
  40. package/chunks/{chunk-MFDYOYZZ.js → chunk-4MHDNGAV.js} +25 -2
  41. package/chunks/{chunk-SVY7G3WS.js → chunk-4PFKN7CQ.js} +7 -7
  42. package/chunks/{chunk-HV76SFIA.js → chunk-5HBFERG5.js} +3 -3
  43. package/chunks/{chunk-WAUGQKUU.js → chunk-6LYDH7VT.js} +9 -5
  44. package/chunks/{chunk-S6HYI3MF.js → chunk-6S52N6PG.js} +2 -2
  45. package/chunks/{chunk-FVKHVJZQ.js → chunk-732MOPEM.js} +1 -1
  46. package/chunks/{chunk-UHJ5S7DF.js → chunk-7QE3QFU3.js} +8 -8
  47. package/chunks/{chunk-WCG5O7IP.js → chunk-7SUQZ7QH.js} +2 -2
  48. package/chunks/{chunk-CQGGDOR5.js → chunk-AAOONL5N.js} +1 -1
  49. package/chunks/{chunk-B7SQOICP.js → chunk-AKLY5M2C.js} +4 -4
  50. package/chunks/{chunk-UVX4Y6IN.js → chunk-AQHNAA7E.js} +1 -1
  51. package/chunks/{chunk-DVQECPGW.js → chunk-BIXG46YI.js} +12 -12
  52. package/chunks/{chunk-4TRQPFDP.js → chunk-BJKREW56.js} +6 -8
  53. package/chunks/{chunk-7S4DYMFG.js → chunk-BNRNVMOT.js} +27 -18
  54. package/chunks/{chunk-PIA35YOG.js → chunk-BR6TUEKJ.js} +9 -8
  55. package/chunks/{chunk-Q3JQ7OSU.js → chunk-BTYS2JAY.js} +1 -1
  56. package/chunks/{chunk-H6XPXXMH.js → chunk-CQ35AJ4Z.js} +252 -254
  57. package/chunks/{chunk-COBO5EBO.js → chunk-CTQE2NB2.js} +1 -1
  58. package/chunks/{chunk-MTE6R5HF.js → chunk-DEKY5Y7V.js} +3 -3
  59. package/chunks/{chunk-BCZ2TTSH.js → chunk-DM4C3OX5.js} +1 -1
  60. package/chunks/{chunk-HDHLWOG5.js → chunk-DSKLWQHC.js} +2 -2
  61. package/chunks/{chunk-KKBPOU75.js → chunk-EFIMD5VA.js} +1 -1
  62. package/chunks/{chunk-CTJLZLB5.js → chunk-EN2J77G7.js} +1 -1
  63. package/chunks/{chunk-67EWJE77.js → chunk-ENEEQMGM.js} +1 -1
  64. package/chunks/{chunk-RKCPPZV6.js → chunk-EOBM4T2Z.js} +1 -1
  65. package/chunks/{chunk-7C7RTJPC.js → chunk-ESVSQKPY.js} +4 -4
  66. package/chunks/{chunk-CPG6P4GG.js → chunk-EYS3GGM3.js} +1 -1
  67. package/chunks/{chunk-4PYCZH2V.js → chunk-EYW54TBD.js} +3 -3
  68. package/chunks/{chunk-UXV3DYVT.js → chunk-F4T5J34H.js} +1 -1
  69. package/chunks/{chunk-FOGU3LJX.js → chunk-F6AOBFUN.js} +1 -1
  70. package/chunks/{chunk-ZBVS26BY.js → chunk-FPGTNKCP.js} +7 -5
  71. package/chunks/{chunk-BO2VRKY2.js → chunk-G64M7R2Y.js} +5 -5
  72. package/chunks/{chunk-EI3HZX6C.js → chunk-GJJQV4PY.js} +1 -1
  73. package/chunks/{chunk-CKASRHZI.js → chunk-GLWWPFTW.js} +1 -1
  74. package/chunks/{chunk-GM463R2B.js → chunk-GZGDJ4E6.js} +1 -1
  75. package/chunks/{chunk-W5UC37EE.js → chunk-HHGQGTJQ.js} +2 -0
  76. package/chunks/chunk-HHJLM3WQ.js +41 -0
  77. package/chunks/{chunk-2Z6PYTOK.js → chunk-HMCSRTDY.js} +1 -1
  78. package/chunks/{chunk-L2AFWWJE.js → chunk-HUE2M6VI.js} +50 -5
  79. package/chunks/{chunk-F32C6V5B.js → chunk-HZV75ET2.js} +3 -3
  80. package/chunks/{chunk-6ZRFAKXK.js → chunk-IEP44U2R.js} +1 -1
  81. package/chunks/{chunk-AOHJKPKL.js → chunk-IQFYO5BF.js} +1 -1
  82. package/chunks/{chunk-UDXSXLER.js → chunk-IW6RQPQB.js} +14 -4
  83. package/chunks/{chunk-XCWO3SMQ.js → chunk-IX7CFQGA.js} +3 -3
  84. package/chunks/{chunk-UO2N5QWP.js → chunk-J4EVBAB3.js} +27 -4
  85. package/chunks/{chunk-ZZCWJWTF.js → chunk-JHMFKJEP.js} +1 -1
  86. package/chunks/{chunk-Y3NNBNGM.js → chunk-JKEO6OQY.js} +4 -4
  87. package/chunks/{chunk-6Q5ABMTU.js → chunk-JLYYGKRN.js} +23 -19
  88. package/chunks/{chunk-HOUK5CR2.js → chunk-JOXXPM3X.js} +6 -6
  89. package/chunks/{chunk-E2FPSSKP.js → chunk-JPA7IDTE.js} +57 -13
  90. package/chunks/{chunk-OQTXYMKW.js → chunk-JS4Q5NG5.js} +3 -3
  91. package/chunks/{chunk-PBRVUF5B.js → chunk-K7JW6V5O.js} +1 -1
  92. package/chunks/{chunk-3P2LV43B.js → chunk-KCCODSAA.js} +3 -3
  93. package/chunks/{chunk-DREZZAZM.js → chunk-KCDQGIHS.js} +13 -5
  94. package/chunks/{chunk-KHLBIO6M.js → chunk-KFCTC5IJ.js} +11 -11
  95. package/chunks/{chunk-M6HMMKVG.js → chunk-KPVVWKF3.js} +1 -1
  96. package/chunks/{chunk-MVUQRLOH.js → chunk-KT4OWAAZ.js} +3 -3
  97. package/chunks/{chunk-W4RQUHY3.js → chunk-L2GTEEEU.js} +142 -23
  98. package/chunks/{chunk-X7XXP7CN.js → chunk-LA3FF7RO.js} +2 -2
  99. package/chunks/{chunk-DX3RGJMS.js → chunk-LT532KF4.js} +71 -12
  100. package/chunks/{chunk-JT7XS4YW.js → chunk-M2NMFAFR.js} +1 -1
  101. package/chunks/{chunk-YTFDX4PR.js → chunk-M6NDLY2T.js} +1 -1
  102. package/chunks/{chunk-VBU76UYP.js → chunk-MCHGE3EC.js} +302 -290
  103. package/chunks/{chunk-3WOZVMGJ.js → chunk-MDQSCFAZ.js} +7 -7
  104. package/chunks/{chunk-EKPKKXY2.js → chunk-MLZCPGDX.js} +1 -1
  105. package/chunks/{chunk-OIVKILPI.js → chunk-MPBRV3UU.js} +3 -0
  106. package/chunks/{chunk-VFMASYQA.js → chunk-MS7GNABG.js} +3 -0
  107. package/chunks/{chunk-2FRY5CRX.js → chunk-MWZYNOCG.js} +3 -3
  108. package/chunks/{chunk-ONSZH6VM.js → chunk-MZQ4I4AP.js} +2 -2
  109. package/chunks/{chunk-TG3IUQ6M.js → chunk-N3ZWGKXN.js} +4 -4
  110. package/chunks/{chunk-7MH4J33A.js → chunk-N7NBMAMW.js} +2 -2
  111. package/chunks/{chunk-EUNWC2VS.js → chunk-NC4O6UE6.js} +2 -2
  112. package/chunks/{chunk-4P66JPNV.js → chunk-NFSSQDB5.js} +5 -5
  113. package/chunks/{chunk-FTO3P6PZ.js → chunk-NM3E6GGL.js} +3 -3
  114. package/chunks/{chunk-FYTHSJDQ.js → chunk-NQPYPDOY.js} +2 -2
  115. package/chunks/{chunk-HUWENAHO.js → chunk-NWPO6I7V.js} +1 -1
  116. package/chunks/{chunk-SR7RZ4MS.js → chunk-O4BBDP2G.js} +2 -2
  117. package/chunks/{chunk-X76PVMPQ.js → chunk-OC5SKSNX.js} +3 -3
  118. package/chunks/{chunk-6S4NCX23.js → chunk-OGQERNHD.js} +3 -3
  119. package/chunks/{chunk-DA4HRSBW.js → chunk-OPBATTFQ.js} +1 -1
  120. package/chunks/{chunk-5BRSWOSC.js → chunk-P7KCJGBR.js} +4 -4
  121. package/chunks/{chunk-TZ3FN4B2.js → chunk-PBYVS6QT.js} +3 -3
  122. package/chunks/{chunk-VNNWAZSI.js → chunk-QG2IEE2E.js} +3 -3
  123. package/chunks/{chunk-XGLVQQ6F.js → chunk-QGZN4RYB.js} +4 -4
  124. package/chunks/{chunk-2UUMVNYT.js → chunk-QTI7SRXI.js} +3 -3
  125. package/chunks/{chunk-B2GJNDTV.js → chunk-QUESTNOP.js} +1 -1
  126. package/chunks/{chunk-6WIKTX4C.js → chunk-RUKNJEJO.js} +1 -1
  127. package/chunks/{chunk-6CONQTS2.js → chunk-RUVZZKDH.js} +1 -1
  128. package/chunks/{chunk-QUI267ZP.js → chunk-SAQHDAUJ.js} +42 -8
  129. package/chunks/{chunk-DCGYLIYO.js → chunk-SUTP6CZA.js} +5 -5
  130. package/chunks/{chunk-HGBUHVFO.js → chunk-T4576UW4.js} +3 -3
  131. package/chunks/{chunk-TZEZYNYD.js → chunk-T4FTABSW.js} +1 -1
  132. package/chunks/{chunk-SEZ556DZ.js → chunk-T6W4KACQ.js} +1 -1
  133. package/chunks/{chunk-EV3LZGGK.js → chunk-TKAEODJR.js} +572 -42
  134. package/chunks/{chunk-NV3F44FL.js → chunk-TNQLAI6I.js} +2 -2
  135. package/chunks/{chunk-A6PSUNCY.js → chunk-TNS2M7VL.js} +5 -5
  136. package/chunks/{chunk-ZUIOLZ4V.js → chunk-TTB6GBJ6.js} +8323 -2227
  137. package/chunks/{chunk-YGT2AUJ7.js → chunk-U2JLICUY.js} +33 -16
  138. package/chunks/{chunk-PDUIXSYP.js → chunk-U7QUDFPD.js} +7 -7
  139. package/chunks/{chunk-PWYEWOZM.js → chunk-UEUE6LJX.js} +1 -1
  140. package/chunks/{chunk-O3VWAZLP.js → chunk-UIZGNLBP.js} +770 -932
  141. package/chunks/{chunk-V3KCCRKA.js → chunk-UM57UTTV.js} +3 -3
  142. package/chunks/{chunk-EQL65XGA.js → chunk-V3LXMASR.js} +47 -21
  143. package/chunks/{chunk-LHEC5V6G.js → chunk-VRWOMUZM.js} +2 -2
  144. package/chunks/{chunk-5C7FDVHB.js → chunk-W2ITCESM.js} +176 -477
  145. package/chunks/{chunk-7OFX3YZW.js → chunk-W2PNY24B.js} +1 -1
  146. package/chunks/{chunk-T3FNRMFJ.js → chunk-X5GLCWPX.js} +1 -1
  147. package/chunks/{chunk-BSI645OU.js → chunk-XBLYC4MI.js} +3 -3
  148. package/chunks/{chunk-GNPNYXJB.js → chunk-XLQS3VI6.js} +2 -2
  149. package/chunks/{chunk-TCRQD7F6.js → chunk-XT6TGJFD.js} +1 -1
  150. package/chunks/{chunk-PYQADEFD.js → chunk-XTH2OMDS.js} +1 -1
  151. package/chunks/{chunk-PFWPBYL2.js → chunk-XUMBOJC2.js} +3 -3
  152. package/chunks/{chunk-P6RBCBBE.js → chunk-YIKMBYMT.js} +3 -3
  153. package/chunks/{chunk-WOJZWRAZ.js → chunk-YRLW2MSX.js} +1 -1
  154. package/chunks/{chunk-7WUUNAJP.js → chunk-YVVIFFU4.js} +3 -3
  155. package/chunks/chunk-Z7B6SRPM.js +32 -0
  156. package/chunks/{chunk-IA7TGCN2.js → chunk-ZV4XVYL3.js} +4 -4
  157. package/chunks/{chunk-PJRW65JO.js → chunk-ZWPWQEF5.js} +1 -1
  158. package/chunks/{computer-use-5LGM2YO5.js → computer-use-7TIKEXBX.js} +42 -41
  159. package/chunks/{config-utils-ULCSRMWD.js → config-utils-6MVJ54TY.js} +6 -6
  160. package/chunks/{contextCommand-JT44ADUD.js → contextCommand-5QKI7MRY.js} +44 -43
  161. package/chunks/{core-runtime-XHEJM2VB.js → core-runtime-USS7ZF3H.js} +42 -41
  162. package/chunks/{create-sub-session-QIDZUOPU.js → create-sub-session-Y4WYDZGC.js} +2 -2
  163. package/chunks/{create-sub-session-UQBDJF5G.js → create-sub-session-ZD2F3BH2.js} +42 -41
  164. package/chunks/{cron-create-VONA5JYY.js → cron-create-ZOVA3CC2.js} +4 -4
  165. package/chunks/{cron-delete-5JXSP2MI.js → cron-delete-7Z3H4LJY.js} +4 -4
  166. package/chunks/{cron-list-KE4F2CIR.js → cron-list-UHGX3IQG.js} +4 -4
  167. package/chunks/{daemon-GWD7BT6E.js → daemon-Y3NOHFKQ.js} +38 -7
  168. package/chunks/daemon-status-provider-PMP4J7BC.js +103 -0
  169. package/chunks/daemon-trust-policy-2252VKXI.js +99 -0
  170. package/chunks/{daemon-trust-policy-monitor-LUMB46CL.js → daemon-trust-policy-monitor-OSGGKJXT.js} +49 -48
  171. package/chunks/{de-LIW4XVLN.js → de-UBEBKG6V.js} +2 -1
  172. package/chunks/{deferred-core-runtime-BFB6YRTZ.js → deferred-core-runtime-3VD4V6YZ.js} +42 -41
  173. package/chunks/{display-image-NQRSIBXM.js → display-image-ZE3GZNIK.js} +4 -4
  174. package/chunks/{dist-Z3CS4OVP.js → dist-AVUYBK7L.js} +11 -5
  175. package/chunks/{dist-6BMOAE3Z.js → dist-BNWP6IZL.js} +4 -4
  176. package/chunks/{dist-3NTTUAHT.js → dist-EFJILGIS.js} +3 -3
  177. package/chunks/{dist-EZE3V3Q7.js → dist-MAIUUIWN.js} +3 -3
  178. package/chunks/{dist-B2CGTW6T.js → dist-NPS52B2V.js} +3 -3
  179. package/chunks/{dist-J47AXBZC.js → dist-PKSRQAR2.js} +3 -3
  180. package/chunks/{dist-OTUO3AS2.js → dist-Q2WJ2IZU.js} +13 -5
  181. package/chunks/{dist-EWW3J4HQ.js → dist-ZWDH5HLS.js} +3 -3
  182. package/chunks/{earlyInputCapture-GPULMO2H.js → earlyInputCapture-ER4HGLJN.js} +43 -42
  183. package/chunks/{edit-XYMQNMWU.js → edit-B3MT7O53.js} +42 -41
  184. package/chunks/{en-SY5GTIGX.js → en-X6YV7GME.js} +2 -1
  185. package/chunks/{enter-worktree-TIASENJP.js → enter-worktree-WVIYVSDJ.js} +42 -41
  186. package/chunks/{enterPlanMode-K6LTIGWM.js → enterPlanMode-DDCIM6HA.js} +42 -41
  187. package/chunks/{environment-3XX7LUMG.js → environment-LITGMOUP.js} +45 -44
  188. package/chunks/{errors-VTFZ6M4W.js → errors-E5CIOR2I.js} +44 -43
  189. package/chunks/{exit-worktree-IBKPEHUJ.js → exit-worktree-NQ2A6URE.js} +42 -41
  190. package/chunks/exitPlanMode-YXSWN4D3.js +85 -0
  191. package/chunks/{fast-path-QOBSDLA6.js → fast-path-PH3DBS6X.js} +3 -3
  192. package/chunks/{fast-path-settings-RPAVBD7P.js → fast-path-settings-LNOFM2YP.js} +2 -2
  193. package/chunks/{fr-RQFO7U4P.js → fr-VENTC2BS.js} +2 -1
  194. package/chunks/{gemini-OCRXJUWF.js → gemini-4YPO4ADY.js} +88 -87
  195. package/chunks/{geminiContentGenerator-VHSPCS6F.js → geminiContentGenerator-GMSVVXOU.js} +6 -6
  196. package/chunks/{glob-BVX4L3CM.js → glob-3Y3VHLM2.js} +42 -41
  197. package/chunks/{goal-tools-SWNB6GP4.js → goal-tools-JDK2SNMV.js} +4 -4
  198. package/chunks/{grep-CJSUX5NJ.js → grep-VUHUDZYG.js} +42 -41
  199. package/chunks/handleAutoUpdate-OBFFPWSJ.js +94 -0
  200. package/chunks/{i18n-BPEDXABF.js → i18n-4PJA5KKU.js} +43 -42
  201. package/chunks/{image-gen-DEEXNNA2.js → image-gen-4IFV4HES.js} +10 -10
  202. package/chunks/initializer-ZTY3VSWL.js +100 -0
  203. package/chunks/{installationInfo-JCUKPGDB.js → installationInfo-6USRNCD2.js} +43 -42
  204. package/chunks/{ja-KOZKHJHZ.js → ja-QHT4EQTO.js} +2 -1
  205. package/chunks/{keychain-token-storage-TVAMTNP7.js → keychain-token-storage-JTWUYFU7.js} +2 -2
  206. package/chunks/list-U2ZDKYWN.js +103 -0
  207. package/chunks/{list-agents-Z4WABFDZ.js → list-agents-4GQ2XNEU.js} +2 -2
  208. package/chunks/loadedSettingsAdapter-WW4HIVLO.js +97 -0
  209. package/chunks/{loggingContentGenerator-MOOIBKKR.js → loggingContentGenerator-XXG6YWUE.js} +46 -27
  210. package/chunks/{loop-wakeup-UZ5RL5Y2.js → loop-wakeup-HOQI3K5D.js} +5 -5
  211. package/chunks/{ls-TVHDGIES.js → ls-O4VBQRG7.js} +4 -4
  212. package/chunks/{lsp-CVN6OQPI.js → lsp-APQJ5ZEZ.js} +2 -2
  213. package/chunks/{managed-npm-update-7K2LDL7V.js → managed-npm-update-7GM2LPLL.js} +43 -42
  214. package/chunks/mcp-7KZW2T5P.js +97 -0
  215. package/chunks/{monitor-EXI73A5P.js → monitor-RQROQHLD.js} +42 -41
  216. package/chunks/nonInteractiveCli-U7JNJGS6.js +163 -0
  217. package/chunks/{notebook-edit-GKKQJQQU.js → notebook-edit-XQA6YCH2.js} +42 -41
  218. package/chunks/{openaiContentGenerator-NSPCP4FY.js → openaiContentGenerator-BZW2IB42.js} +29 -29
  219. package/chunks/{pidfile-IU4ETBRE.js → pidfile-NX5VZ3IK.js} +43 -42
  220. package/chunks/{processUtils-GZOVMFK4.js → processUtils-M635AD23.js} +2 -2
  221. package/chunks/{pt-U6AOCTMF.js → pt-VL3I5RNY.js} +2 -1
  222. package/chunks/{qwenContentGenerator-BBTNTOMB.js → qwenContentGenerator-KHJ73E2C.js} +48 -48
  223. package/chunks/{qwenOAuth2-D6L2W25Z.js → qwenOAuth2-QMK25XO7.js} +9 -9
  224. package/chunks/read-file-6LKIKKXD.js +32 -0
  225. package/chunks/{read-mcp-resource-PZ4ZF6YL.js → read-mcp-resource-TJSJRH4F.js} +2 -2
  226. package/chunks/{record-artifact-P4HFMS7X.js → record-artifact-FXF5LHPE.js} +3 -3
  227. package/chunks/{resumeHistoryUtils-VUY4B6BO.js → resumeHistoryUtils-RR2KEVH5.js} +49 -48
  228. package/chunks/ripGrep-CF2WRBYV.js +85 -0
  229. package/chunks/{ru-CMX4UMYP.js → ru-4RCKL4PY.js} +2 -1
  230. package/chunks/{run-qwen-serve-7BDTKCFP.js → run-qwen-serve-L5TF57J4.js} +57 -50
  231. package/chunks/{runtime-VMWGIAX7.js → runtime-3RE3BPR4.js} +55 -54
  232. package/chunks/{scheduler-MUKPARY5.js → scheduler-LXQZAMYT.js} +44 -43
  233. package/chunks/{sdk-exporters-http-XVTZQRCE.js → sdk-exporters-http-7SYSCGEO.js} +3 -3
  234. package/chunks/{sdk-impl-7W7AKCS4.js → sdk-impl-VZI6M6EH.js} +6 -6
  235. package/chunks/{send-message-CAMSLG2L.js → send-message-RBYLV5NY.js} +6 -6
  236. package/chunks/{serve-7G5R52HX.js → serve-5D4S7GIA.js} +49 -48
  237. package/chunks/{server-FTSWAHXF.js → server-ILZB6TTC.js} +391 -172
  238. package/chunks/{session-FLUDUMZJ.js → session-SXCZITZ4.js} +114 -94
  239. package/chunks/{settings-CJVTBEW7.js → settings-4RQB3OVF.js} +48 -47
  240. package/chunks/{shell-2DOQIYEE.js → shell-FCTR3OI2.js} +42 -41
  241. package/chunks/{skill-2GOEKN34.js → skill-IAKHPD5H.js} +19 -19
  242. package/chunks/{skill-settings-5FEOMZQS.js → skill-settings-SOR23NOP.js} +48 -47
  243. package/chunks/{spawnChannel-VJRIO75F.js → spawnChannel-I6VAWYQJ.js} +45 -43
  244. package/chunks/{standalone-update-OC5IKJGY.js → standalone-update-5NN3MTYH.js} +44 -43
  245. package/chunks/{startInteractiveUI-HFHFI2ZR.js → startInteractiveUI-OYGL3NZJ.js} +589 -329
  246. package/chunks/{syntheticOutput-PEBJQYJV.js → syntheticOutput-D3Z64LJC.js} +3 -3
  247. package/chunks/{task-create-5NWCQSJF.js → task-create-URFZ5EUX.js} +10 -10
  248. package/chunks/{task-list-53265TRZ.js → task-list-6JDFMPUW.js} +5 -5
  249. package/chunks/{task-stop-FPCOIRYX.js → task-stop-HHUGCD25.js} +2 -2
  250. package/chunks/{task-update-5HN577LS.js → task-update-LCJM3EYG.js} +10 -10
  251. package/chunks/{team-create-ZWAXZR75.js → team-create-J4JP6AXN.js} +44 -43
  252. package/chunks/{team-delete-MMQB4OSC.js → team-delete-PZGGBQLM.js} +5 -5
  253. package/chunks/{team-plan-approval-LH23GCUV.js → team-plan-approval-7BEAIR2H.js} +42 -41
  254. package/chunks/{terminal-image-renderer-7L3GCHD5.js → terminal-image-renderer-SGGTG5LN.js} +44 -43
  255. package/chunks/theme-manager-67TSB7LH.js +89 -0
  256. package/chunks/{todoWrite-JGV6VLOX.js → todoWrite-WINAZSZI.js} +4 -4
  257. package/chunks/{tool-search-BZOZHGKI.js → tool-search-XPOFDWOX.js} +19 -19
  258. package/chunks/{total-session-admission-KP4CJTSB.js → total-session-admission-SZJFAM25.js} +47 -46
  259. package/chunks/{trustedFolders-57QEHV67.js → trustedFolders-44NTYYV4.js} +43 -42
  260. package/chunks/{update-relaunch-53MODFE4.js → update-relaunch-K33Q3WEH.js} +5 -5
  261. package/chunks/{updateCheck-4QDI7CUZ.js → updateCheck-VBRNPLS4.js} +45 -44
  262. package/chunks/{useAutoAcceptIndicator-VVQUPTM5.js → useAutoAcceptIndicator-AUNRB5S7.js} +52 -51
  263. package/chunks/{validateNonInterActiveAuth-KKVD5E43.js → validateNonInterActiveAuth-WTO36MTA.js} +83 -82
  264. package/chunks/{version-IB5ASN63.js → version-JZA6HYPI.js} +1 -1
  265. package/chunks/{web-fetch-APSFQMIH.js → web-fetch-LLHPV2IR.js} +19 -19
  266. package/chunks/{web-search-EWEHMFIW.js → web-search-4HCHRZ3U.js} +11 -11
  267. package/chunks/{workflow-LA4ACRO4.js → workflow-YI74QTWW.js} +43 -42
  268. package/chunks/workspace-providers-status-CI3AO2BH.js +100 -0
  269. package/chunks/{workspace-registration-store-WSLHN7HA.js → workspace-registration-store-KPIKXDHA.js} +1 -1
  270. package/chunks/{workspace-registry-5HXRV7L4.js → workspace-registry-XE22QDE6.js} +47 -46
  271. package/chunks/{workspace-service-SSP4PLBC.js → workspace-service-WI2FD72A.js} +54 -53
  272. package/chunks/workspace-skills-status-FFZU6FXL.js +100 -0
  273. package/chunks/{workspace-trust-reconciler-PASUNEKQ.js → workspace-trust-reconciler-GJLNXR2U.js} +54 -53
  274. package/chunks/write-file-IEAC3XC3.js +87 -0
  275. package/chunks/{zh-AGL2FVBI.js → zh-LMSTK4WD.js} +2 -1
  276. package/chunks/{zh-TW-KI66MHQY.js → zh-TW-SQ4HTSCW.js} +2 -1
  277. package/chunks/{zoom-image-NAVVM4R2.js → zoom-image-GTVVT25J.js} +15 -15
  278. package/cli.js +13 -13
  279. package/locales/ca.js +1 -0
  280. package/locales/de.js +1 -0
  281. package/locales/en.js +1 -0
  282. package/locales/fr.js +1 -0
  283. package/locales/ja.js +1 -0
  284. package/locales/pt.js +1 -0
  285. package/locales/ru.js +1 -0
  286. package/locales/zh-TW.js +1 -0
  287. package/locales/zh.js +1 -0
  288. package/package.json +3 -3
  289. package/web-shell/assets/{arc-BGiARkbG.js → arc-B13-S0Yo.js} +1 -1
  290. package/web-shell/assets/{architectureDiagram-3BPJPVTR-3QBZDeqg.js → architectureDiagram-3BPJPVTR-CHvWNlVW.js} +1 -1
  291. package/web-shell/assets/{blockDiagram-GPEHLZMM-CbJI0j0o.js → blockDiagram-GPEHLZMM-CXebOlXF.js} +1 -1
  292. package/web-shell/assets/{c4Diagram-AAUBKEIU-pita1IYy.js → c4Diagram-AAUBKEIU-BQpx4y3Q.js} +1 -1
  293. package/web-shell/assets/channel-BB_Hm8Rf.js +1 -0
  294. package/web-shell/assets/{chunk-2J33WTMH-WzTFww1i.js → chunk-2J33WTMH-Cak1exSv.js} +1 -1
  295. package/web-shell/assets/{chunk-4BX2VUAB-8TIRo9bL.js → chunk-4BX2VUAB-BIc8BV5_.js} +1 -1
  296. package/web-shell/assets/{chunk-55IACEB6-CuCr34qf.js → chunk-55IACEB6-DoeJ5BL1.js} +1 -1
  297. package/web-shell/assets/{chunk-727SXJPM-Bb_xWEAx.js → chunk-727SXJPM-BDR_wYSu.js} +1 -1
  298. package/web-shell/assets/{chunk-AQP2D5EJ-C8T1b2Qw.js → chunk-AQP2D5EJ-BhRRGRq1.js} +1 -1
  299. package/web-shell/assets/{chunk-FMBD7UC4-kjpyMkNM.js → chunk-FMBD7UC4-BJGAwVXr.js} +1 -1
  300. package/web-shell/assets/{chunk-ND2GUHAM-Dm35jDmi.js → chunk-ND2GUHAM-vhE73bsD.js} +1 -1
  301. package/web-shell/assets/{chunk-QZHKN3VN-BPVKwuby.js → chunk-QZHKN3VN-BuTBZsdR.js} +1 -1
  302. package/web-shell/assets/classDiagram-4FO5ZUOK-B_hFK54Y.js +1 -0
  303. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-B_hFK54Y.js +1 -0
  304. package/web-shell/assets/{cose-bilkent-S5V4N54A-M-7J9Xyz.js → cose-bilkent-S5V4N54A-CVHKipHP.js} +1 -1
  305. package/web-shell/assets/{dagre-BM42HDAG-u6rmS689.js → dagre-BM42HDAG-C1DPa8SV.js} +1 -1
  306. package/web-shell/assets/{diagram-2AECGRRQ-nAisfOUB.js → diagram-2AECGRRQ-BYP_QxkT.js} +1 -1
  307. package/web-shell/assets/{diagram-5GNKFQAL-CpobRd3l.js → diagram-5GNKFQAL-Cray7ruQ.js} +1 -1
  308. package/web-shell/assets/{diagram-KO2AKTUF-B82W_wPq.js → diagram-KO2AKTUF-Ds4vJANi.js} +1 -1
  309. package/web-shell/assets/{diagram-LMA3HP47-ClTkmPW6.js → diagram-LMA3HP47-DxFrDykH.js} +1 -1
  310. package/web-shell/assets/{diagram-OG6HWLK6-42fbxGPW.js → diagram-OG6HWLK6-BdIO-pF_.js} +1 -1
  311. package/web-shell/assets/{erDiagram-TEJ5UH35-8_zQfzlQ.js → erDiagram-TEJ5UH35-5JA8KDYV.js} +1 -1
  312. package/web-shell/assets/{flowDiagram-I6XJVG4X-DQDoN_oV.js → flowDiagram-I6XJVG4X-DL4drKro.js} +1 -1
  313. package/web-shell/assets/{ganttDiagram-6RSMTGT7-Cqd646fB.js → ganttDiagram-6RSMTGT7-ijX2DD6_.js} +1 -1
  314. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-B6qWs_tS.js → gitGraphDiagram-PVQCEYII-_lPsFLFF.js} +1 -1
  315. package/web-shell/assets/index-BTwNYZkp.js +1785 -0
  316. package/web-shell/assets/{index-BCeQB_tk.js → index-C-YoqYbs.js} +1 -1
  317. package/web-shell/assets/{index-eYjX7fQg.css → index-dHAFxPHb.css} +1 -1
  318. package/web-shell/assets/{infoDiagram-5YYISTIA-BVyDAHuu.js → infoDiagram-5YYISTIA-COFClLab.js} +1 -1
  319. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-BBHM904I.js → ishikawaDiagram-YF4QCWOH-Div9KOgO.js} +1 -1
  320. package/web-shell/assets/{journeyDiagram-JHISSGLW-B5Bv5Z_0.js → journeyDiagram-JHISSGLW-VAw5u0wc.js} +1 -1
  321. package/web-shell/assets/{kanban-definition-UN3LZRKU-BwSTb0YF.js → kanban-definition-UN3LZRKU-CncCn8Nl.js} +1 -1
  322. package/web-shell/assets/{linear-CHtTm36c.js → linear-D6ad7e_k.js} +1 -1
  323. package/web-shell/assets/{mermaid.core-vBCuAUkf.js → mermaid.core-BV1IECGb.js} +5 -5
  324. package/web-shell/assets/{mindmap-definition-RKZ34NQL-CNfKHJrA.js → mindmap-definition-RKZ34NQL-a3jeNgPr.js} +1 -1
  325. package/web-shell/assets/{pieDiagram-4H26LBE5-DT6QMLhc.js → pieDiagram-4H26LBE5-DsVRY5BW.js} +1 -1
  326. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-Rb2Dar4i.js → quadrantDiagram-W4KKPZXB-D6zgexJK.js} +1 -1
  327. package/web-shell/assets/{requirementDiagram-4Y6WPE33-CA9YzPUY.js → requirementDiagram-4Y6WPE33-VEpSwJjn.js} +1 -1
  328. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-CJ5SkhJw.js → sankeyDiagram-5OEKKPKP-CYEuOFne.js} +1 -1
  329. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-T31AiuVM.js → sequenceDiagram-3UESZ5HK-CCg0lI-9.js} +1 -1
  330. package/web-shell/assets/{stateDiagram-AJRCARHV-f7Xpd_Xh.js → stateDiagram-AJRCARHV-BHXPsL0B.js} +1 -1
  331. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-eTG8D0QT.js +1 -0
  332. package/web-shell/assets/{timeline-definition-PNZ67QCA-dCwsTscr.js → timeline-definition-PNZ67QCA-gqTf9a0k.js} +1 -1
  333. package/web-shell/assets/{vennDiagram-CIIHVFJN-SQtBFYkQ.js → vennDiagram-CIIHVFJN-C4DXXkBh.js} +1 -1
  334. package/web-shell/assets/{wardley-L42UT6IY-Dfh4eW0B.js → wardley-L42UT6IY-CMK46EiX.js} +1 -1
  335. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-BWBKXBsC.js → wardleyDiagram-YWT4CUSO-DTk1Gzt9.js} +1 -1
  336. package/web-shell/assets/{xychartDiagram-2RQKCTM6-DVqzcaxh.js → xychartDiagram-2RQKCTM6-BcJsM1dH.js} +1 -1
  337. package/web-shell/index.html +2 -2
  338. package/chunks/agent-headless-JOL3STCJ.js +0 -86
  339. package/chunks/channel-settings-store-CDUEUDYS.js +0 -101
  340. package/chunks/chunk-PDPFQ2FO.js +0 -156
  341. package/chunks/daemon-status-provider-67M3LFIJ.js +0 -102
  342. package/chunks/daemon-trust-policy-3XCIBLLT.js +0 -98
  343. package/chunks/exitPlanMode-2U23CG2U.js +0 -84
  344. package/chunks/handleAutoUpdate-2F3RWBIT.js +0 -93
  345. package/chunks/initializer-QRD7X25L.js +0 -99
  346. package/chunks/list-G6SHYRHQ.js +0 -102
  347. package/chunks/loadedSettingsAdapter-S4EPYP35.js +0 -96
  348. package/chunks/mcp-R2Z6IKPN.js +0 -96
  349. package/chunks/nonInteractiveCli-E6CEE6IG.js +0 -162
  350. package/chunks/read-file-S2BROE4F.js +0 -32
  351. package/chunks/ripGrep-V4EX6SLA.js +0 -84
  352. package/chunks/theme-manager-7WO6DXIT.js +0 -88
  353. package/chunks/workspace-providers-status-5C3HGWHF.js +0 -99
  354. package/chunks/workspace-skills-status-DX7CA34S.js +0 -99
  355. package/chunks/write-file-3N2WAE3F.js +0 -86
  356. package/web-shell/assets/channel-3vYOf77E.js +0 -1
  357. package/web-shell/assets/classDiagram-4FO5ZUOK-Dr2aqxvr.js +0 -1
  358. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-Dr2aqxvr.js +0 -1
  359. package/web-shell/assets/index-Dv9zBWC9.js +0 -1775
  360. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-wucbNzkr.js +0 -1
@@ -35,12 +35,12 @@ import {
35
35
  union,
36
36
  unknown,
37
37
  url
38
- } from "./chunk-H6XPXXMH.js";
38
+ } from "./chunk-CQ35AJ4Z.js";
39
39
  import {
40
40
  CronScheduler,
41
41
  DEFAULT_RECURRING_MAX_AGE_DAYS,
42
42
  normalizeRecurringMaxAge
43
- } from "./chunk-2UUMVNYT.js";
43
+ } from "./chunk-QTI7SRXI.js";
44
44
  import {
45
45
  consumeUnread,
46
46
  forwardApproval,
@@ -49,13 +49,13 @@ import {
49
49
  sendStructuredMessage,
50
50
  wrapConfirmWithBadge,
51
51
  writeMessage
52
- } from "./chunk-MVUQRLOH.js";
52
+ } from "./chunk-KT4OWAAZ.js";
53
53
  import {
54
54
  claimTask,
55
55
  listTasks,
56
56
  onTasksUpdated,
57
57
  unassignTeammateTasks
58
- } from "./chunk-XCWO3SMQ.js";
58
+ } from "./chunk-IX7CFQGA.js";
59
59
  import {
60
60
  assignTeammateColor,
61
61
  classifyShutdownResponse,
@@ -63,7 +63,7 @@ import {
63
63
  formatAgentId,
64
64
  generateUniqueTeammateName,
65
65
  writeTeamFile
66
- } from "./chunk-7MH4J33A.js";
66
+ } from "./chunk-N7NBMAMW.js";
67
67
  import {
68
68
  parsePositiveIntegerEnv
69
69
  } from "./chunk-6PVPNMXU.js";
@@ -71,13 +71,13 @@ import {
71
71
  RUNTIME_SNAPSHOT_PREFIX,
72
72
  buildModelIdContext,
73
73
  resolveModelId
74
- } from "./chunk-TCRQD7F6.js";
74
+ } from "./chunk-XT6TGJFD.js";
75
75
  import {
76
76
  ARTIFACT_TITLE_MAX_LENGTH,
77
77
  ARTIFACT_WORKSPACE_PATH_MAX_LENGTH,
78
78
  hasControlCharacter,
79
79
  hasUnsafeDisplayPayload
80
- } from "./chunk-HUWENAHO.js";
80
+ } from "./chunk-NWPO6I7V.js";
81
81
  import {
82
82
  promptIdContext,
83
83
  todoWorkChainContext
@@ -105,7 +105,7 @@ import {
105
105
  require_dist as require_dist2,
106
106
  stringify,
107
107
  validateSkillName
108
- } from "./chunk-J6SZID63.js";
108
+ } from "./chunk-2AZMF6G5.js";
109
109
  import {
110
110
  require_proper_lockfile
111
111
  } from "./chunk-KRXPRVGL.js";
@@ -123,15 +123,15 @@ import {
123
123
  createHookOutput,
124
124
  getHookKey,
125
125
  isToolArtifactLike
126
- } from "./chunk-GM463R2B.js";
126
+ } from "./chunk-GZGDJ4E6.js";
127
127
  import {
128
128
  BaseTokenStorage,
129
129
  KeychainTokenStorage
130
- } from "./chunk-SEZ556DZ.js";
130
+ } from "./chunk-T6W4KACQ.js";
131
131
  import {
132
132
  normalizeImageGenerationBaseUrl,
133
133
  resolveNetworkTarget
134
- } from "./chunk-2FRY5CRX.js";
134
+ } from "./chunk-MWZYNOCG.js";
135
135
  import {
136
136
  GoalPersistenceUnavailableError,
137
137
  PAUSED_GOAL_SYSTEM_REMINDER,
@@ -150,9 +150,10 @@ import {
150
150
  validateTranscriptRecord,
151
151
  walkTranscriptUuidChain,
152
152
  wrapUserPromptSubmitContext
153
- } from "./chunk-QUI267ZP.js";
153
+ } from "./chunk-SAQHDAUJ.js";
154
154
  import {
155
155
  APPROVAL_MODES,
156
+ READ_ONLY_INSPECTION_TOOLS,
156
157
  SUBAGENT_PLAN_LIFECYCLE_TOOLS,
157
158
  buildSubagentPlanToolBlockedResult,
158
159
  getLeaderOnlyToolUnavailableMessage,
@@ -165,17 +166,21 @@ import {
165
166
  isPlanRequiredTeammatePreApprovalAllowedTool,
166
167
  isSubagentLikeExecutionContext,
167
168
  shouldUsePlanOnlyReminderInSubagentContext
168
- } from "./chunk-WAUGQKUU.js";
169
+ } from "./chunk-6LYDH7VT.js";
169
170
  import {
170
171
  DEFAULT_OTLP_ENDPOINT,
171
172
  DEFAULT_TELEMETRY_TARGET,
172
173
  addToolArgumentsAttributes,
173
174
  addToolCallResultAttributes,
174
175
  addUserPromptAttributes
175
- } from "./chunk-4TRQPFDP.js";
176
+ } from "./chunk-BJKREW56.js";
176
177
  import {
177
178
  supportsOpenAIPrefixCaching
178
179
  } from "./chunk-SAH4BD2J.js";
180
+ import {
181
+ DashScopeOpenAICompatibleProvider,
182
+ selectDashScopeThinkingKnob
183
+ } from "./chunk-25OFRBH2.js";
179
184
  import {
180
185
  childLaunchDepth,
181
186
  getCurrentAgentDepth,
@@ -186,7 +191,7 @@ import {
186
191
  runWithAgentContext,
187
192
  runWithRuntimeContentGenerator,
188
193
  spawnBlockReason
189
- } from "./chunk-CPG6P4GG.js";
194
+ } from "./chunk-EYS3GGM3.js";
190
195
  import {
191
196
  getTeammateContext,
192
197
  isTeammate,
@@ -229,7 +234,7 @@ import {
229
234
  selectForkHistory,
230
235
  stripSystemReminderBlocks,
231
236
  validateForkToolList
232
- } from "./chunk-IA7TGCN2.js";
237
+ } from "./chunk-ZV4XVYL3.js";
233
238
  import {
234
239
  collectAvailableSkillEntries,
235
240
  renderAvailableSkillsBlock
@@ -247,7 +252,7 @@ import {
247
252
  getQwenIgnoreFileNames,
248
253
  isPathWithinRoot,
249
254
  require_ignore
250
- } from "./chunk-EQL65XGA.js";
255
+ } from "./chunk-V3LXMASR.js";
251
256
  import {
252
257
  openBrowserSecurely,
253
258
  shouldAttemptBrowserLaunch
@@ -255,11 +260,11 @@ import {
255
260
  import {
256
261
  isUnattendedMode,
257
262
  retryWithBackoff
258
- } from "./chunk-4PYCZH2V.js";
263
+ } from "./chunk-EYW54TBD.js";
259
264
  import {
260
265
  classifyRetryError,
261
266
  isFallbackEligible
262
- } from "./chunk-SR7RZ4MS.js";
267
+ } from "./chunk-O4BBDP2G.js";
263
268
  import {
264
269
  QUOTA_EXHAUSTED_PREFIX,
265
270
  formatQuotaExhaustedMessage,
@@ -269,7 +274,7 @@ import {
269
274
  isQuotaExhaustedError,
270
275
  isRateLimitError,
271
276
  isStructuredError
272
- } from "./chunk-M6HMMKVG.js";
277
+ } from "./chunk-KPVVWKF3.js";
273
278
  import {
274
279
  DEFAULT_OPENAI_BASE_URL
275
280
  } from "./chunk-AXMWHKXA.js";
@@ -284,6 +289,7 @@ import {
284
289
  } from "./chunk-DJ2GSRLV.js";
285
290
  import {
286
291
  ApiRetryEvent,
292
+ COMBINED_PASS_TOLERANCE_FACTOR,
287
293
  ContentRetryEvent,
288
294
  ContentRetryFailureEvent,
289
295
  DiscoveredMCPTool,
@@ -310,6 +316,7 @@ import {
310
316
  StartSessionEvent,
311
317
  SubagentExecutionEvent,
312
318
  TOOL_OUTPUT_TRUNCATED_PREFIX,
319
+ TRUNCATION_FALLBACK_ENVELOPE_SLACK,
313
320
  ToolCallEvent,
314
321
  UiTelemetryService,
315
322
  VISION_BRIDGE_MAX_IMAGES,
@@ -362,6 +369,7 @@ import {
362
369
  logNextSpeakerCheck,
363
370
  logRipgrepFallback,
364
371
  logRipgrepRuntimeRecovery,
372
+ logSessionEnd,
365
373
  logStartSession,
366
374
  logSubagentExecution,
367
375
  logToolCall,
@@ -396,10 +404,11 @@ import {
396
404
  updateMCPServerStatus,
397
405
  writeLine,
398
406
  writeLineSync
399
- } from "./chunk-YGT2AUJ7.js";
407
+ } from "./chunk-U2JLICUY.js";
400
408
  import {
401
- defaultModalities
402
- } from "./chunk-WOJZWRAZ.js";
409
+ defaultModalities,
410
+ isTieredEffortWireModel
411
+ } from "./chunk-YRLW2MSX.js";
403
412
  import {
404
413
  E_TIMEOUT,
405
414
  Mutex,
@@ -424,13 +433,13 @@ import {
424
433
  isManagedMemoryPath,
425
434
  isTeamAutoMemPath,
426
435
  isUserAutoMemPath
427
- } from "./chunk-FVKHVJZQ.js";
436
+ } from "./chunk-732MOPEM.js";
428
437
  import {
429
438
  runSideQuery
430
- } from "./chunk-COBO5EBO.js";
439
+ } from "./chunk-CTQE2NB2.js";
431
440
  import {
432
441
  STRUCTURED_OUTPUT_REDACTED_ARGS
433
- } from "./chunk-6ZRFAKXK.js";
442
+ } from "./chunk-IEP44U2R.js";
434
443
  import {
435
444
  AgentStatistics,
436
445
  BaseDeclarativeTool,
@@ -449,7 +458,7 @@ import {
449
458
  require_dist,
450
459
  require_fast_deep_equal,
451
460
  require_fast_uri
452
- } from "./chunk-PYQADEFD.js";
461
+ } from "./chunk-XTH2OMDS.js";
453
462
  import {
454
463
  AUTH_ENV_MAPPINGS,
455
464
  AuthType,
@@ -461,7 +470,7 @@ import {
461
470
  createContentGenerator,
462
471
  resetPreloadedContentGenerator,
463
472
  resolveContentGeneratorConfigWithSources
464
- } from "./chunk-3WOZVMGJ.js";
473
+ } from "./chunk-MDQSCFAZ.js";
465
474
  import {
466
475
  DEFAULT_QWEN_EMBEDDING_MODEL,
467
476
  DEFAULT_QWEN_MODEL
@@ -478,20 +487,20 @@ import {
478
487
  knownTokenLimit,
479
488
  parsePositiveIntegerEnvValue,
480
489
  tokenLimit
481
- } from "./chunk-ZBVS26BY.js";
490
+ } from "./chunk-FPGTNKCP.js";
482
491
  import {
483
492
  getOrCreateMcpDispatcher,
484
493
  loadUndici,
485
494
  preloadRuntimeFetchModule,
486
495
  redactProxyError,
487
496
  setResolvedProxyUrlForRuntimeFetch
488
- } from "./chunk-KKBPOU75.js";
497
+ } from "./chunk-EFIMD5VA.js";
489
498
  import {
490
499
  atomicWriteFile,
491
500
  atomicWriteFileSync,
492
501
  atomicWriteJSON,
493
502
  renameWithRetry
494
- } from "./chunk-FOGU3LJX.js";
503
+ } from "./chunk-F6AOBFUN.js";
495
504
  import {
496
505
  endHookSpan,
497
506
  endInteractionSpan,
@@ -517,10 +526,10 @@ import {
517
526
  startToolExecutionSpan,
518
527
  startToolSpan,
519
528
  truncateSpanError
520
- } from "./chunk-L2AFWWJE.js";
529
+ } from "./chunk-HUE2M6VI.js";
521
530
  import {
522
531
  safeJsonStringify
523
- } from "./chunk-W4RQUHY3.js";
532
+ } from "./chunk-HHJLM3WQ.js";
524
533
  import {
525
534
  DEFAULT_SENSITIVE_SPAN_ATTRIBUTE_MAX_LENGTH,
526
535
  SENSITIVE_SPAN_ATTRIBUTE_MAX_LENGTH_LIMIT,
@@ -538,7 +547,7 @@ import {
538
547
  TOOL_FAILURE_KIND_TOOL_ERROR,
539
548
  TOOL_FAILURE_KIND_TOOL_EXCEPTION,
540
549
  isValidSensitiveSpanAttributeMaxLength
541
- } from "./chunk-PDPFQ2FO.js";
550
+ } from "./chunk-L2GTEEEU.js";
542
551
  import {
543
552
  FatalConfigError,
544
553
  PATH_ARG_KEYS,
@@ -567,7 +576,7 @@ import {
567
576
  tildeifyPath,
568
577
  toFriendlyError,
569
578
  unescapePath
570
- } from "./chunk-OIVKILPI.js";
579
+ } from "./chunk-MPBRV3UU.js";
571
580
  import {
572
581
  require_src
573
582
  } from "./chunk-AMDSOFFV.js";
@@ -2772,12 +2781,12 @@ var require_code = __commonJS({
2772
2781
  exports2._ = _2;
2773
2782
  var plus = new _Code("+");
2774
2783
  function str(strs, ...args) {
2775
- const expr = [safeStringify2(strs[0])];
2784
+ const expr = [safeStringify(strs[0])];
2776
2785
  let i = 0;
2777
2786
  while (i < args.length) {
2778
2787
  expr.push(plus);
2779
2788
  addCodeArg(expr, args[i]);
2780
- expr.push(plus, safeStringify2(strs[++i]));
2789
+ expr.push(plus, safeStringify(strs[++i]));
2781
2790
  }
2782
2791
  optimize(expr);
2783
2792
  return new _Code(expr);
@@ -2834,19 +2843,19 @@ var require_code = __commonJS({
2834
2843
  __name(strConcat, "strConcat");
2835
2844
  exports2.strConcat = strConcat;
2836
2845
  function interpolate(x) {
2837
- return typeof x == "number" || typeof x == "boolean" || x === null ? x : safeStringify2(Array.isArray(x) ? x.join(",") : x);
2846
+ return typeof x == "number" || typeof x == "boolean" || x === null ? x : safeStringify(Array.isArray(x) ? x.join(",") : x);
2838
2847
  }
2839
2848
  __name(interpolate, "interpolate");
2840
2849
  function stringify2(x) {
2841
- return new _Code(safeStringify2(x));
2850
+ return new _Code(safeStringify(x));
2842
2851
  }
2843
2852
  __name(stringify2, "stringify");
2844
2853
  exports2.stringify = stringify2;
2845
- function safeStringify2(x) {
2854
+ function safeStringify(x) {
2846
2855
  return JSON.stringify(x).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
2847
2856
  }
2848
- __name(safeStringify2, "safeStringify");
2849
- exports2.safeStringify = safeStringify2;
2857
+ __name(safeStringify, "safeStringify");
2858
+ exports2.safeStringify = safeStringify;
2850
2859
  function getProperty(key) {
2851
2860
  return typeof key == "string" && exports2.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _2`[${key}]`;
2852
2861
  }
@@ -8803,7 +8812,7 @@ var require_windows = __commonJS({
8803
8812
  init_esbuild_shims();
8804
8813
  module2.exports = isexe;
8805
8814
  isexe.sync = sync2;
8806
- var fs98 = __require("fs");
8815
+ var fs97 = __require("fs");
8807
8816
  function checkPathExt(path103, options2) {
8808
8817
  var pathext = options2.pathExt !== void 0 ? options2.pathExt : process.env.PATHEXT;
8809
8818
  if (!pathext) {
@@ -8830,13 +8839,13 @@ var require_windows = __commonJS({
8830
8839
  }
8831
8840
  __name(checkStat, "checkStat");
8832
8841
  function isexe(path103, options2, cb) {
8833
- fs98.stat(path103, function(er2, stat22) {
8842
+ fs97.stat(path103, function(er2, stat22) {
8834
8843
  cb(er2, er2 ? false : checkStat(stat22, path103, options2));
8835
8844
  });
8836
8845
  }
8837
8846
  __name(isexe, "isexe");
8838
8847
  function sync2(path103, options2) {
8839
- return checkStat(fs98.statSync(path103), path103, options2);
8848
+ return checkStat(fs97.statSync(path103), path103, options2);
8840
8849
  }
8841
8850
  __name(sync2, "sync");
8842
8851
  }
@@ -8848,15 +8857,15 @@ var require_mode = __commonJS({
8848
8857
  init_esbuild_shims();
8849
8858
  module2.exports = isexe;
8850
8859
  isexe.sync = sync2;
8851
- var fs98 = __require("fs");
8860
+ var fs97 = __require("fs");
8852
8861
  function isexe(path103, options2, cb) {
8853
- fs98.stat(path103, function(er2, stat22) {
8862
+ fs97.stat(path103, function(er2, stat22) {
8854
8863
  cb(er2, er2 ? false : checkStat(stat22, options2));
8855
8864
  });
8856
8865
  }
8857
8866
  __name(isexe, "isexe");
8858
8867
  function sync2(path103, options2) {
8859
- return checkStat(fs98.statSync(path103), options2);
8868
+ return checkStat(fs97.statSync(path103), options2);
8860
8869
  }
8861
8870
  __name(sync2, "sync");
8862
8871
  function checkStat(stat22, options2) {
@@ -8884,7 +8893,7 @@ var require_mode = __commonJS({
8884
8893
  var require_isexe = __commonJS({
8885
8894
  "node_modules/isexe/index.js"(exports2, module2) {
8886
8895
  init_esbuild_shims();
8887
- var fs98 = __require("fs");
8896
+ var fs97 = __require("fs");
8888
8897
  var core;
8889
8898
  if (process.platform === "win32" || globalThis.TESTING_WINDOWS) {
8890
8899
  core = require_windows();
@@ -9161,16 +9170,16 @@ var require_readShebang = __commonJS({
9161
9170
  "node_modules/cross-spawn/lib/util/readShebang.js"(exports2, module2) {
9162
9171
  "use strict";
9163
9172
  init_esbuild_shims();
9164
- var fs98 = __require("fs");
9173
+ var fs97 = __require("fs");
9165
9174
  var shebangCommand = require_shebang_command();
9166
9175
  function readShebang(command) {
9167
9176
  const size = 150;
9168
9177
  const buffer = Buffer.alloc(size);
9169
9178
  let fd;
9170
9179
  try {
9171
- fd = fs98.openSync(command, "r");
9172
- fs98.readSync(fd, buffer, 0, size, 0);
9173
- fs98.closeSync(fd);
9180
+ fd = fs97.openSync(command, "r");
9181
+ fs97.readSync(fd, buffer, 0, size, 0);
9182
+ fs97.closeSync(fd);
9174
9183
  } catch (e) {
9175
9184
  }
9176
9185
  return shebangCommand(buffer.toString());
@@ -11717,7 +11726,7 @@ var require_pend = __commonJS({
11717
11726
  var require_fd_slicer = __commonJS({
11718
11727
  "node_modules/fd-slicer/index.js"(exports2) {
11719
11728
  init_esbuild_shims();
11720
- var fs98 = __require("fs");
11729
+ var fs97 = __require("fs");
11721
11730
  var util = __require("util");
11722
11731
  var stream2 = __require("stream");
11723
11732
  var Readable2 = stream2.Readable;
@@ -11743,7 +11752,7 @@ var require_fd_slicer = __commonJS({
11743
11752
  FdSlicer.prototype.read = function(buffer, offset, length, position, callback) {
11744
11753
  var self2 = this;
11745
11754
  self2.pend.go(function(cb) {
11746
- fs98.read(self2.fd, buffer, offset, length, position, function(err, bytesRead, buffer2) {
11755
+ fs97.read(self2.fd, buffer, offset, length, position, function(err, bytesRead, buffer2) {
11747
11756
  cb();
11748
11757
  callback(err, bytesRead, buffer2);
11749
11758
  });
@@ -11752,7 +11761,7 @@ var require_fd_slicer = __commonJS({
11752
11761
  FdSlicer.prototype.write = function(buffer, offset, length, position, callback) {
11753
11762
  var self2 = this;
11754
11763
  self2.pend.go(function(cb) {
11755
- fs98.write(self2.fd, buffer, offset, length, position, function(err, written, buffer2) {
11764
+ fs97.write(self2.fd, buffer, offset, length, position, function(err, written, buffer2) {
11756
11765
  cb();
11757
11766
  callback(err, written, buffer2);
11758
11767
  });
@@ -11773,7 +11782,7 @@ var require_fd_slicer = __commonJS({
11773
11782
  if (self2.refCount > 0) return;
11774
11783
  if (self2.refCount < 0) throw new Error("invalid unref");
11775
11784
  if (self2.autoClose) {
11776
- fs98.close(self2.fd, onCloseDone);
11785
+ fs97.close(self2.fd, onCloseDone);
11777
11786
  }
11778
11787
  function onCloseDone(err) {
11779
11788
  if (err) {
@@ -11812,7 +11821,7 @@ var require_fd_slicer = __commonJS({
11812
11821
  self2.context.pend.go(function(cb) {
11813
11822
  if (self2.destroyed) return cb();
11814
11823
  var buffer = new Buffer(toRead);
11815
- fs98.read(self2.context.fd, buffer, 0, toRead, self2.pos, function(err, bytesRead) {
11824
+ fs97.read(self2.context.fd, buffer, 0, toRead, self2.pos, function(err, bytesRead) {
11816
11825
  if (err) {
11817
11826
  self2.destroy(err);
11818
11827
  } else if (bytesRead === 0) {
@@ -11860,7 +11869,7 @@ var require_fd_slicer = __commonJS({
11860
11869
  }
11861
11870
  self2.context.pend.go(function(cb) {
11862
11871
  if (self2.destroyed) return cb();
11863
- fs98.write(self2.context.fd, buffer, 0, buffer.length, self2.pos, function(err2, bytes) {
11872
+ fs97.write(self2.context.fd, buffer, 0, buffer.length, self2.pos, function(err2, bytes) {
11864
11873
  if (err2) {
11865
11874
  self2.destroy();
11866
11875
  cb();
@@ -12296,7 +12305,7 @@ var require_buffer_crc32 = __commonJS({
12296
12305
  var require_yauzl = __commonJS({
12297
12306
  "node_modules/yauzl/index.js"(exports2) {
12298
12307
  init_esbuild_shims();
12299
- var fs98 = __require("fs");
12308
+ var fs97 = __require("fs");
12300
12309
  var zlib = __require("zlib");
12301
12310
  var fd_slicer = require_fd_slicer();
12302
12311
  var crc32 = require_buffer_crc32();
@@ -12326,10 +12335,10 @@ var require_yauzl = __commonJS({
12326
12335
  if (options2.validateEntrySizes == null) options2.validateEntrySizes = true;
12327
12336
  if (options2.strictFileNames == null) options2.strictFileNames = false;
12328
12337
  if (callback == null) callback = defaultCallback;
12329
- fs98.open(path103, "r", function(err, fd) {
12338
+ fs97.open(path103, "r", function(err, fd) {
12330
12339
  if (err) return callback(err);
12331
12340
  fromFd(fd, options2, function(err2, zipfile) {
12332
- if (err2) fs98.close(fd, defaultCallback);
12341
+ if (err2) fs97.close(fd, defaultCallback);
12333
12342
  callback(err2, zipfile);
12334
12343
  });
12335
12344
  });
@@ -12347,7 +12356,7 @@ var require_yauzl = __commonJS({
12347
12356
  if (options2.validateEntrySizes == null) options2.validateEntrySizes = true;
12348
12357
  if (options2.strictFileNames == null) options2.strictFileNames = false;
12349
12358
  if (callback == null) callback = defaultCallback;
12350
- fs98.fstat(fd, function(err, stats) {
12359
+ fs97.fstat(fd, function(err, stats) {
12351
12360
  if (err) return callback(err);
12352
12361
  var reader = fd_slicer.createFromFd(fd, { autoClose: true });
12353
12362
  fromRandomAccessReader(reader, stats.size, options2, callback);
@@ -18963,7 +18972,7 @@ init_esbuild_shims();
18963
18972
 
18964
18973
  // packages/core/src/config/config.ts
18965
18974
  init_esbuild_shims();
18966
- import * as fs97 from "node:fs";
18975
+ import * as fs96 from "node:fs";
18967
18976
  import * as fsPromises6 from "node:fs/promises";
18968
18977
  import * as path102 from "node:path";
18969
18978
  import process8 from "node:process";
@@ -20902,53 +20911,13 @@ function getActiveGoal(sessionId) {
20902
20911
  return store.get(sessionId);
20903
20912
  }
20904
20913
  __name(getActiveGoal, "getActiveGoal");
20905
- function setActiveGoal(sessionId, goal) {
20906
- store.set(sessionId, goal);
20907
- }
20908
- __name(setActiveGoal, "setActiveGoal");
20909
20914
  function clearActiveGoal(sessionId) {
20910
20915
  const previous = store.get(sessionId);
20911
20916
  store.delete(sessionId);
20912
20917
  return previous;
20913
20918
  }
20914
20919
  __name(clearActiveGoal, "clearActiveGoal");
20915
- function recordGoalIteration(sessionId, lastReason) {
20916
- const current = store.get(sessionId);
20917
- if (!current) return void 0;
20918
- const updated = {
20919
- ...current,
20920
- iterations: current.iterations + 1,
20921
- deferredEvaluations: 0,
20922
- lastReason
20923
- };
20924
- store.set(sessionId, updated);
20925
- return updated;
20926
- }
20927
- __name(recordGoalIteration, "recordGoalIteration");
20928
- function recordGoalDeferral(sessionId) {
20929
- const current = store.get(sessionId);
20930
- if (!current) return void 0;
20931
- const updated = {
20932
- ...current,
20933
- deferredEvaluations: (current.deferredEvaluations ?? 0) + 1
20934
- };
20935
- store.set(sessionId, updated);
20936
- return updated;
20937
- }
20938
- __name(recordGoalDeferral, "recordGoalDeferral");
20939
- function resetGoalDeferrals(sessionId) {
20940
- const current = store.get(sessionId);
20941
- if (!current || current.deferredEvaluations === 0) return current;
20942
- const updated = { ...current, deferredEvaluations: 0 };
20943
- store.set(sessionId, updated);
20944
- return updated;
20945
- }
20946
- __name(resetGoalDeferrals, "resetGoalDeferrals");
20947
20920
  var observers = /* @__PURE__ */ new Map();
20948
- function setGoalTerminalObserver(sessionId, observer) {
20949
- observers.set(sessionId, observer);
20950
- }
20951
- __name(setGoalTerminalObserver, "setGoalTerminalObserver");
20952
20921
  function clearGoalTerminalObserver(sessionId) {
20953
20922
  observers.delete(sessionId);
20954
20923
  }
@@ -20968,18 +20937,6 @@ function recordLastTerminalEvent(sessionId, event) {
20968
20937
  lastTerminal.set(sessionId, event);
20969
20938
  }
20970
20939
  __name(recordLastTerminalEvent, "recordLastTerminalEvent");
20971
- function getLastGoalTerminal(sessionId) {
20972
- return lastTerminal.get(sessionId);
20973
- }
20974
- __name(getLastGoalTerminal, "getLastGoalTerminal");
20975
- function setLastGoalTerminal(sessionId, event) {
20976
- if (!event) {
20977
- lastTerminal.delete(sessionId);
20978
- return;
20979
- }
20980
- lastTerminal.set(sessionId, event);
20981
- }
20982
- __name(setLastGoalTerminal, "setLastGoalTerminal");
20983
20940
 
20984
20941
  // packages/core/src/goals/goalHook.ts
20985
20942
  init_esbuild_shims();
@@ -20987,400 +20944,12 @@ init_esbuild_shims();
20987
20944
  // packages/core/src/goals/goalJudge.ts
20988
20945
  init_esbuild_shims();
20989
20946
  var debugLogger6 = createDebugLogger("GOAL_JUDGE");
20990
- var JUDGE_SYSTEM_PROMPT = `You are evaluating a stop-condition hook in an autonomous coding agent.
20991
- Read the conversation transcript above carefully, then judge whether the
20992
- user-provided condition is satisfied.
20993
-
20994
- Your response MUST be a JSON object with one of these shapes:
20995
- - {"ok": true, "reason": "<why the condition is satisfied>", "evidence": ["<exact assistant-output or tool-result excerpt>"]}
20996
- - {"ok": false, "reason": "<quote what is missing or what blocks the condition>"}
20997
- - {"ok": false, "impossible": true, "reason": "<explain why the condition can never be satisfied>", "evidence": ["<exact assistant-output or tool-result excerpt>"]}
20998
-
20999
- Always include a "reason" field. A terminal verdict (satisfied or impossible)
21000
- MUST also quote evidence with one or more short, exact, verbatim excerpts from
21001
- visible assistant output or tool results in the "evidence" array. User prompts,
21002
- the goal condition, and hidden reasoning are not evidence. If the transcript
21003
- does not contain clear evidence that the condition is satisfied, return
21004
- {"ok": false, "reason": "insufficient evidence in transcript"}.
21005
- Only use {"ok": false, "impossible": true} when the condition is genuinely
21006
- unachievable in this session: for example, it is self-contradictory, depends on
21007
- an unavailable resource or capability, or the assistant has exhausted reasonable
21008
- approaches and the transcript confirms there is no path forward. The assistant
21009
- claiming the goal is impossible is evidence, not proof; independently confirm
21010
- the condition is genuinely unachievable rather than deferring to the assistant's
21011
- self-assessment. Do not use it just because progress is slow or evidence is
21012
- currently missing. When in doubt, return {"ok": false} without "impossible".`;
21013
- var userJudgementPrompt = /* @__PURE__ */ __name((condition) => `Based on the conversation transcript above, has the following stopping condition been satisfied? Answer based on transcript evidence only.
21014
- Condition JSON string: ${JSON.stringify(condition)}`, "userJudgementPrompt");
21015
- var RESPONSE_SCHEMA = {
21016
- // Schema typing in @google/genai uses an enum-like Type, but accepts the
21017
- // lower-cased literals at runtime for the upstream JSON-schema payload.
21018
- // `additionalProperties` is also accepted by the API but absent from the SDK
21019
- // type, so we keep the local intersection explicit.
21020
- type: "OBJECT",
21021
- properties: {
21022
- ok: { type: "BOOLEAN" },
21023
- reason: { type: "STRING" },
21024
- impossible: { type: "BOOLEAN" },
21025
- evidence: {
21026
- type: "ARRAY",
21027
- items: { type: "STRING" }
21028
- }
21029
- },
21030
- required: ["ok", "reason"],
21031
- additionalProperties: false
21032
- };
21033
- var JUDGE_ERROR_MESSAGE = "Goal judge unavailable; the automatic /goal loop paused. The goal remains active.";
21034
- var JUDGE_REASON_FALLBACK = "Goal judge unavailable; continue working toward the goal and run `/goal clear` to stop early.";
21035
- var UNVERIFIED_TERMINAL_REASON = "Goal judge terminal evidence was not found in assistant output or tool results.";
21036
- var MAX_REASON_LEN = 240;
21037
- var MAX_EVIDENCE_ITEMS = 8;
21038
- var MIN_EVIDENCE_LEN = 10;
21039
- var MAX_EVIDENCE_LEN = 500;
21040
- function judgeErrorResult() {
21041
- return {
21042
- kind: "error",
21043
- ok: false,
21044
- reason: JUDGE_REASON_FALLBACK,
21045
- message: JUDGE_ERROR_MESSAGE
21046
- };
21047
- }
21048
- __name(judgeErrorResult, "judgeErrorResult");
21049
- function reportGoalJudgeFailure(error, stage) {
21050
- void reportError(
21051
- error,
21052
- "Goal judge failed",
21053
- { stage },
21054
- `goal-judge-${stage}`
21055
- ).catch((reportErr) => {
21056
- debugLogger6.debug(
21057
- `Goal judge error reporting failed: ${reportErr instanceof Error ? reportErr.message : String(reportErr)}`
21058
- );
21059
- });
21060
- }
21061
- __name(reportGoalJudgeFailure, "reportGoalJudgeFailure");
21062
- var TRANSCRIPT_TAIL_MESSAGES = 24;
21063
- var TRANSCRIPT_PART_CHAR_CAP = 4e3;
21064
- async function judgeGoal(config, args) {
21065
- const condition = args.condition.trim();
21066
- if (!condition || args.signal.aborted) {
21067
- return judgeErrorResult();
21068
- }
21069
- const transcript = collectTranscript(config, args.lastAssistantText);
21070
- const evidenceSources = collectEvidenceSources(transcript);
21071
- transcript.push({
21072
- role: "user",
21073
- parts: [{ text: userJudgementPrompt(condition) }]
21074
- });
21075
- const model = config.getFastModel() ?? config.getModel();
21076
- try {
21077
- const client = config.getGeminiClient();
21078
- const response = await client.generateContent(
21079
- transcript,
21080
- {
21081
- systemInstruction: JUDGE_SYSTEM_PROMPT,
21082
- temperature: 0,
21083
- responseMimeType: "application/json",
21084
- responseSchema: RESPONSE_SCHEMA,
21085
- // Disable extended thinking: the judge is a binary check, and
21086
- // thinking burns latency and tokens for no quality gain.
21087
- thinkingConfig: { thinkingBudget: 0, includeThoughts: false }
21088
- },
21089
- args.signal,
21090
- model
21091
- );
21092
- const text = extractText(response);
21093
- if (!text) {
21094
- debugLogger6.debug("Goal judge returned empty content; returning error");
21095
- reportGoalJudgeFailure(
21096
- new Error("Empty judge response"),
21097
- "empty-response"
21098
- );
21099
- return judgeErrorResult();
21100
- }
21101
- const parsed = parseJudgeReply(text);
21102
- if (!parsed) {
21103
- debugLogger6.debug(
21104
- `Goal judge reply not parseable as JSON (length=${text.length})`
21105
- );
21106
- reportGoalJudgeFailure(
21107
- new Error("Judge response was not parseable as JSON"),
21108
- "parse"
21109
- );
21110
- return judgeErrorResult();
21111
- }
21112
- return toJudgeResult(parsed, evidenceSources);
21113
- } catch (err) {
21114
- debugLogger6.debug(
21115
- `Goal judge threw: ${err instanceof Error ? err.message : String(err)}`
21116
- );
21117
- reportGoalJudgeFailure(err, "generate-content");
21118
- return judgeErrorResult();
21119
- }
21120
- }
21121
- __name(judgeGoal, "judgeGoal");
21122
- function collectTranscript(config, lastAssistantText) {
21123
- try {
21124
- const client = config.getGeminiClient();
21125
- if (!client.isInitialized()) return fallbackTranscript(lastAssistantText);
21126
- const full = client.getHistoryTail(TRANSCRIPT_TAIL_MESSAGES);
21127
- const tail = full.map(capContent);
21128
- if (tail.length === 0) return fallbackTranscript(lastAssistantText);
21129
- const lastModelText = lastModelTextOf(tail);
21130
- const haveLast = lastModelText.includes(lastAssistantText) || lastAssistantText.trim() === "";
21131
- if (!haveLast && lastAssistantText.trim()) {
21132
- tail.push({
21133
- role: "model",
21134
- parts: [{ text: lastAssistantText.slice(0, TRANSCRIPT_PART_CHAR_CAP) }]
21135
- });
21136
- }
21137
- return tail;
21138
- } catch (err) {
21139
- debugLogger6.debug(
21140
- `Goal judge transcript fetch failed: ${err instanceof Error ? err.message : String(err)}`
21141
- );
21142
- return fallbackTranscript(lastAssistantText);
21143
- }
21144
- }
21145
- __name(collectTranscript, "collectTranscript");
21146
- function fallbackTranscript(lastAssistantText) {
21147
- if (!lastAssistantText.trim()) return [];
21148
- return [
21149
- {
21150
- role: "model",
21151
- parts: [{ text: lastAssistantText.slice(0, TRANSCRIPT_PART_CHAR_CAP) }]
21152
- }
21153
- ];
21154
- }
21155
- __name(fallbackTranscript, "fallbackTranscript");
21156
- function capContent(content) {
21157
- if (!content.parts) return content;
21158
- return {
21159
- ...content,
21160
- parts: content.parts.map(capPart)
21161
- };
21162
- }
21163
- __name(capContent, "capContent");
21164
- function capPart(part) {
21165
- if (typeof part.text === "string") {
21166
- return part.text.length > TRANSCRIPT_PART_CHAR_CAP ? {
21167
- ...part,
21168
- text: part.text.slice(0, TRANSCRIPT_PART_CHAR_CAP) + "\u2026[truncated]"
21169
- } : part;
21170
- }
21171
- if (part.functionResponse) {
21172
- return {
21173
- ...part,
21174
- functionResponse: {
21175
- ...part.functionResponse,
21176
- response: capStructuredValue(
21177
- part.functionResponse.response
21178
- )
21179
- }
21180
- };
21181
- }
21182
- if (part.functionCall) {
21183
- return {
21184
- ...part,
21185
- functionCall: {
21186
- ...part.functionCall,
21187
- args: capStructuredValue(
21188
- part.functionCall.args
21189
- )
21190
- }
21191
- };
21192
- }
21193
- return part;
21194
- }
21195
- __name(capPart, "capPart");
21196
- function capStructuredValue(value) {
21197
- const serialized = safeStringify(value);
21198
- if (serialized.length <= TRANSCRIPT_PART_CHAR_CAP) return value;
21199
- return {
21200
- truncated: true,
21201
- originalLength: serialized.length,
21202
- preview: serialized.slice(0, TRANSCRIPT_PART_CHAR_CAP) + "\u2026[truncated]"
21203
- };
21204
- }
21205
- __name(capStructuredValue, "capStructuredValue");
21206
- function safeStringify(value) {
21207
- try {
21208
- return JSON.stringify(value) ?? String(value);
21209
- } catch {
21210
- return String(value);
21211
- }
21212
- }
21213
- __name(safeStringify, "safeStringify");
21214
- function collectResponseStrings(value) {
21215
- if (typeof value === "string") return [value];
21216
- if (Array.isArray(value)) return value.flatMap(collectResponseStrings);
21217
- if (value && typeof value === "object")
21218
- return Object.values(value).flatMap(
21219
- collectResponseStrings
21220
- );
21221
- return [];
21222
- }
21223
- __name(collectResponseStrings, "collectResponseStrings");
21224
- function lastModelTextOf(transcript) {
21225
- for (let i = transcript.length - 1; i >= 0; i--) {
21226
- const c = transcript[i];
21227
- if (c.role !== "model") continue;
21228
- return (c.parts ?? []).map((p2) => typeof p2.text === "string" ? p2.text : "").join("");
21229
- }
21230
- return "";
21231
- }
21232
- __name(lastModelTextOf, "lastModelTextOf");
21233
- function collectEvidenceSources(transcript) {
21234
- const sources = [];
21235
- for (const content of transcript) {
21236
- const modelTexts = [];
21237
- for (const part of content.parts ?? []) {
21238
- if (content.role === "model" && part.thought !== true && typeof part.text === "string") {
21239
- modelTexts.push(part.text);
21240
- }
21241
- if (part.functionResponse) {
21242
- sources.push(...collectResponseStrings(part.functionResponse.response));
21243
- }
21244
- }
21245
- if (modelTexts.length > 0) {
21246
- sources.push(modelTexts.join(""));
21247
- }
21248
- }
21249
- return sources;
21250
- }
21251
- __name(collectEvidenceSources, "collectEvidenceSources");
21252
- function extractText(response) {
21253
- const candidates = response?.candidates;
21254
- if (!Array.isArray(candidates) || candidates.length === 0) return "";
21255
- const first = candidates[0];
21256
- const parts = first?.content?.parts;
21257
- if (!Array.isArray(parts)) return "";
21258
- return parts.filter((part) => part?.thought !== true).map((p2) => typeof p2?.text === "string" ? p2.text : "").join("").trim();
21259
- }
21260
- __name(extractText, "extractText");
21261
- function parseJudgeReply(text) {
21262
- const cleaned = stripCodeFence(text).trim();
21263
- const start = cleaned.indexOf("{");
21264
- const end = cleaned.lastIndexOf("}");
21265
- if (start === -1 || end === -1 || end < start) return null;
21266
- let payload;
21267
- try {
21268
- payload = JSON.parse(cleaned.slice(start, end + 1));
21269
- } catch {
21270
- return null;
21271
- }
21272
- if (!payload || typeof payload !== "object") return null;
21273
- const ok = payload.ok;
21274
- const reason = payload.reason;
21275
- const impossibleValue = payload.impossible;
21276
- const evidenceValue = payload.evidence;
21277
- if (typeof ok !== "boolean" || typeof reason !== "string" || !reason.trim()) {
21278
- return null;
21279
- }
21280
- if (impossibleValue !== void 0 && typeof impossibleValue !== "boolean") {
21281
- return null;
21282
- }
21283
- const reasonText = reason.trim().slice(0, MAX_REASON_LEN);
21284
- const impossible = impossibleValue === true;
21285
- const evidence = parseEvidence(evidenceValue);
21286
- return {
21287
- ok,
21288
- reason: reasonText,
21289
- ...impossible && !ok ? { impossible: true } : {},
21290
- ...evidence ? { evidence } : {}
21291
- };
21292
- }
21293
- __name(parseJudgeReply, "parseJudgeReply");
21294
- function parseEvidence(value) {
21295
- if (!Array.isArray(value) || value.length === 0 || value.length > MAX_EVIDENCE_ITEMS) {
21296
- return void 0;
21297
- }
21298
- const trimmed = value.map(
21299
- (item) => typeof item === "string" ? item.trim() : null
21300
- );
21301
- if (trimmed.some(
21302
- (s3) => s3 === null || s3.length < MIN_EVIDENCE_LEN || s3.length > MAX_EVIDENCE_LEN
21303
- )) {
21304
- return void 0;
21305
- }
21306
- return trimmed;
21307
- }
21308
- __name(parseEvidence, "parseEvidence");
21309
- function normalizeWhitespace(s3) {
21310
- return s3.replace(/\s+/g, " ").trim();
21311
- }
21312
- __name(normalizeWhitespace, "normalizeWhitespace");
21313
- function hasVerifiableEvidence(evidence, sources) {
21314
- if (evidence === void 0) return false;
21315
- const normalizedSources = sources.map(normalizeWhitespace);
21316
- return evidence.every((excerpt) => {
21317
- const normalized2 = normalizeWhitespace(excerpt);
21318
- return normalizedSources.some((source) => source.includes(normalized2));
21319
- });
21320
- }
21321
- __name(hasVerifiableEvidence, "hasVerifiableEvidence");
21322
- function unverifiedTerminalReason(judgeReason) {
21323
- return `${UNVERIFIED_TERMINAL_REASON} Judge reason: ${judgeReason}`.slice(
21324
- 0,
21325
- MAX_REASON_LEN
21326
- );
21327
- }
21328
- __name(unverifiedTerminalReason, "unverifiedTerminalReason");
21329
- function toJudgeResult(result, evidenceSources) {
21330
- if (result.ok) {
21331
- if (hasVerifiableEvidence(result.evidence, evidenceSources)) {
21332
- return { kind: "met", ok: true, reason: result.reason };
21333
- }
21334
- debugLogger6.debug(
21335
- `Goal judge ok=true evidence unverifiable; judge said: ${result.reason}`
21336
- );
21337
- return {
21338
- kind: "not_met",
21339
- ok: false,
21340
- reason: unverifiedTerminalReason(result.reason)
21341
- };
21342
- }
21343
- if (result.impossible) {
21344
- if (hasVerifiableEvidence(result.evidence, evidenceSources)) {
21345
- return {
21346
- kind: "impossible",
21347
- ok: false,
21348
- reason: result.reason,
21349
- impossible: true
21350
- };
21351
- }
21352
- debugLogger6.debug(
21353
- `Goal judge impossible evidence unverifiable; judge said: ${result.reason}`
21354
- );
21355
- return {
21356
- kind: "not_met",
21357
- ok: false,
21358
- reason: unverifiedTerminalReason(result.reason)
21359
- };
21360
- }
21361
- return { kind: "not_met", ok: false, reason: result.reason };
21362
- }
21363
- __name(toJudgeResult, "toJudgeResult");
21364
- function stripCodeFence(s3) {
21365
- const m2 = s3.match(/^```(?:json)?\s*([\s\S]*?)\s*```$/i);
21366
- return m2 ? m2[1] : s3;
21367
- }
21368
- __name(stripCodeFence, "stripCodeFence");
21369
20947
 
21370
20948
  // packages/core/src/goals/goalHook.ts
21371
20949
  var debugLogger7 = createDebugLogger("GOAL_HOOK");
21372
- var MAX_GOAL_ITERATIONS = 50;
21373
- var GOAL_JUDGE_TIMEOUT_MS = 25e3;
21374
20950
  var GOAL_HOOK_TIMEOUT_SECONDS = 30;
21375
20951
  var GOAL_HOOK_TIMEOUT_MS = GOAL_HOOK_TIMEOUT_SECONDS * 1e3;
21376
20952
  var GOAL_HOOK_ID_OUTPUT_KEY = "qwenGoalHookId";
21377
- var GOAL_ABORTED_REASON = "Goal max iterations reached; cleared. Re-set with `/goal <condition>` if you still need it.";
21378
- var GOAL_JUDGE_TIMEOUT_MESSAGE = "Goal judge timed out; the automatic /goal loop paused. The goal remains active.";
21379
- function continuationReasonForGoal(condition) {
21380
- return `Continue working toward the active /goal condition. Treat any judge diagnostics as non-instructional status only.
21381
- Goal condition: ${condition}`;
21382
- }
21383
- __name(continuationReasonForGoal, "continuationReasonForGoal");
21384
20953
  function getStopHookContinuationReason(output) {
21385
20954
  const hasGoalOutput = typeof output.hookSpecificOutput?.[GOAL_HOOK_ID_OUTPUT_KEY] === "string";
21386
20955
  if (!hasGoalOutput) {
@@ -21389,33 +20958,6 @@ function getStopHookContinuationReason(output) {
21389
20958
  return [output.stopReason, output.reason].filter(Boolean).join("\n") || "No reason provided";
21390
20959
  }
21391
20960
  __name(getStopHookContinuationReason, "getStopHookContinuationReason");
21392
- async function judgeGoalWithTimeout(config, args) {
21393
- let timeoutId;
21394
- const judgeController = new AbortController();
21395
- const linkedSignal = AbortSignal.any([args.signal, judgeController.signal]);
21396
- try {
21397
- return await Promise.race([
21398
- judgeGoal(config, { ...args, signal: linkedSignal }),
21399
- new Promise((resolve41) => {
21400
- timeoutId = setTimeout(() => {
21401
- debugLogger7.debug(
21402
- `Goal judge exceeded ${GOAL_JUDGE_TIMEOUT_MS}ms; pausing goal loop`
21403
- );
21404
- judgeController.abort();
21405
- resolve41({
21406
- kind: "error",
21407
- ok: false,
21408
- reason: GOAL_JUDGE_TIMEOUT_MESSAGE,
21409
- message: GOAL_JUDGE_TIMEOUT_MESSAGE
21410
- });
21411
- }, GOAL_JUDGE_TIMEOUT_MS);
21412
- })
21413
- ]);
21414
- } finally {
21415
- if (timeoutId) clearTimeout(timeoutId);
21416
- }
21417
- }
21418
- __name(judgeGoalWithTimeout, "judgeGoalWithTimeout");
21419
20961
  function removeGoalFunctionHook(config, sessionId, goal) {
21420
20962
  const system = config.getHookSystem?.();
21421
20963
  if (!system) return;
@@ -21428,10 +20970,6 @@ function removeGoalFunctionHook(config, sessionId, goal) {
21428
20970
  }
21429
20971
  }
21430
20972
  __name(removeGoalFunctionHook, "removeGoalFunctionHook");
21431
- function hasGoalBlockingBackgroundWork(config) {
21432
- return config.getBackgroundTaskRegistry().hasRunningTasks() || config.getBackgroundShellRegistry().hasRunningEntries() || config.getWorkflowRunRegistry().hasRunningEntries();
21433
- }
21434
- __name(hasGoalBlockingBackgroundWork, "hasGoalBlockingBackgroundWork");
21435
20973
  function finishGoal(config, sessionId, goal, event) {
21436
20974
  clearActiveGoal(sessionId);
21437
20975
  removeGoalFunctionHook(config, sessionId, goal);
@@ -21453,146 +20991,6 @@ function abortGoalForStopHookCap(config, sessionId, systemMessage) {
21453
20991
  return true;
21454
20992
  }
21455
20993
  __name(abortGoalForStopHookCap, "abortGoalForStopHookCap");
21456
- function createGoalStopHookCallback(args) {
21457
- const { config, sessionId, condition, getExpectedHookId } = args;
21458
- const isCurrentGoal = /* @__PURE__ */ __name((goal) => {
21459
- if (!goal || goal.condition !== condition) return false;
21460
- const expectedHookId = getExpectedHookId?.();
21461
- return expectedHookId === void 0 || goal.hookId === expectedHookId;
21462
- }, "isCurrentGoal");
21463
- return async (input, context2) => {
21464
- const stopInput = input;
21465
- const lastAssistantText = stopInput.last_assistant_message ?? "";
21466
- const current = getActiveGoal(sessionId);
21467
- if (!isCurrentGoal(current)) {
21468
- return { continue: true };
21469
- }
21470
- if (hasGoalBlockingBackgroundWork(config) && (current.deferredEvaluations ?? 0) < MAX_GOAL_ITERATIONS) {
21471
- recordGoalDeferral(sessionId);
21472
- return { continue: true };
21473
- }
21474
- const signal = context2?.signal ?? new AbortController().signal;
21475
- const verdict = await judgeGoalWithTimeout(config, {
21476
- condition,
21477
- lastAssistantText,
21478
- signal
21479
- });
21480
- const latest = getActiveGoal(sessionId);
21481
- if (!isCurrentGoal(latest)) {
21482
- return { continue: true };
21483
- }
21484
- if (verdict.kind === "error") {
21485
- resetGoalDeferrals(sessionId);
21486
- return { continue: true, systemMessage: verdict.message };
21487
- }
21488
- const evaluated = recordGoalIteration(sessionId, verdict.reason);
21489
- if (!isCurrentGoal(evaluated)) {
21490
- return { continue: true };
21491
- }
21492
- if (verdict.kind === "met") {
21493
- finishGoal(config, sessionId, evaluated, {
21494
- kind: "achieved",
21495
- condition: evaluated.condition,
21496
- iterations: evaluated.iterations,
21497
- durationMs: Date.now() - evaluated.setAt,
21498
- lastReason: verdict.reason
21499
- });
21500
- return { continue: true };
21501
- }
21502
- if (verdict.kind === "impossible") {
21503
- debugLogger7.debug("Goal judge ruled impossible; clearing goal.", {
21504
- reason: verdict.reason,
21505
- iterations: evaluated.iterations
21506
- });
21507
- finishGoal(config, sessionId, evaluated, {
21508
- kind: "failed",
21509
- condition: evaluated.condition,
21510
- iterations: evaluated.iterations,
21511
- durationMs: Date.now() - evaluated.setAt,
21512
- lastReason: verdict.reason
21513
- });
21514
- return { continue: true };
21515
- }
21516
- if (evaluated.iterations > MAX_GOAL_ITERATIONS) {
21517
- debugLogger7.debug(
21518
- `Goal exceeded MAX_GOAL_ITERATIONS=${MAX_GOAL_ITERATIONS}; clearing.`
21519
- );
21520
- finishGoal(config, sessionId, evaluated, {
21521
- kind: "aborted",
21522
- condition: evaluated.condition,
21523
- iterations: evaluated.iterations,
21524
- durationMs: Date.now() - evaluated.setAt,
21525
- lastReason: verdict.reason,
21526
- systemMessage: GOAL_ABORTED_REASON
21527
- });
21528
- return {
21529
- continue: true,
21530
- systemMessage: GOAL_ABORTED_REASON
21531
- };
21532
- }
21533
- return {
21534
- decision: "block",
21535
- reason: continuationReasonForGoal(condition),
21536
- hookSpecificOutput: {
21537
- [GOAL_HOOK_ID_OUTPUT_KEY]: evaluated.hookId
21538
- }
21539
- };
21540
- };
21541
- }
21542
- __name(createGoalStopHookCallback, "createGoalStopHookCallback");
21543
- function unregisterGoalHook(config, sessionId) {
21544
- const cleared = clearActiveGoal(sessionId);
21545
- clearGoalTerminalObserver(sessionId);
21546
- if (!cleared) return void 0;
21547
- removeGoalFunctionHook(config, sessionId, cleared);
21548
- return cleared;
21549
- }
21550
- __name(unregisterGoalHook, "unregisterGoalHook");
21551
- function registerGoalHook(args) {
21552
- const { config, sessionId, condition, tokensAtStart } = args;
21553
- const system = config.getHookSystem();
21554
- if (!system) {
21555
- throw new Error("Hook system is not initialized; cannot register /goal");
21556
- }
21557
- unregisterGoalHook(config, sessionId);
21558
- const hookRef = {};
21559
- const callback = createGoalStopHookCallback({
21560
- config,
21561
- sessionId,
21562
- condition,
21563
- getExpectedHookId: /* @__PURE__ */ __name(() => hookRef.hookId, "getExpectedHookId")
21564
- });
21565
- const hookId = system.addFunctionHook(
21566
- sessionId,
21567
- "Stop" /* Stop */,
21568
- "*",
21569
- callback,
21570
- "Goal evaluator failed",
21571
- {
21572
- name: "goal-stop-hook",
21573
- description: `Continue until: ${condition}`,
21574
- statusMessage: "Checking goal\u2026",
21575
- timeout: GOAL_HOOK_TIMEOUT_MS
21576
- }
21577
- );
21578
- hookRef.hookId = hookId;
21579
- const now = Date.now();
21580
- const restoredSetAt = args.initialSetAt;
21581
- const goal = {
21582
- condition,
21583
- iterations: Math.max(0, args.initialIterations ?? 0),
21584
- // A future `setAt` is rejected along with a non-finite or non-positive one.
21585
- // Every duration downstream is `Date.now() - setAt`, so a transcript
21586
- // claiming the goal starts tomorrow would render negative elapsed times
21587
- // rather than fail loudly.
21588
- setAt: typeof restoredSetAt === "number" && Number.isFinite(restoredSetAt) && restoredSetAt > 0 && restoredSetAt <= now ? restoredSetAt : now,
21589
- tokensAtStart,
21590
- hookId
21591
- };
21592
- setActiveGoal(sessionId, goal);
21593
- return goal;
21594
- }
21595
- __name(registerGoalHook, "registerGoalHook");
21596
20994
 
21597
20995
  // packages/core/src/hooks/stopHookCap.ts
21598
20996
  init_esbuild_shims();
@@ -24064,6 +23462,16 @@ function stripDisplayControlChars(text) {
24064
23462
  return out;
24065
23463
  }
24066
23464
  __name(stripDisplayControlChars, "stripDisplayControlChars");
23465
+ var NOTIFICATION_LABEL_MAX_LENGTH = 80;
23466
+ function truncateNotificationLabel(label) {
23467
+ const normalized2 = stripDisplayControlChars(label).replace(/\s+/g, " ").trim();
23468
+ const codePoints = [...normalized2];
23469
+ if (codePoints.length <= NOTIFICATION_LABEL_MAX_LENGTH) {
23470
+ return normalized2;
23471
+ }
23472
+ return codePoints.slice(0, NOTIFICATION_LABEL_MAX_LENGTH - 3).join("") + "...";
23473
+ }
23474
+ __name(truncateNotificationLabel, "truncateNotificationLabel");
24067
23475
 
24068
23476
  // packages/core/src/services/sessionService.ts
24069
23477
  init_esbuild_shims();
@@ -27171,19 +26579,26 @@ async function writeRuntimeStatus(filePath, fields) {
27171
26579
  return filePath;
27172
26580
  }
27173
26581
  __name(writeRuntimeStatus, "writeRuntimeStatus");
27174
- async function readRuntimeStatus(filePath) {
26582
+ async function readRuntimeStatus(filePath, options2 = {}) {
27175
26583
  let raw;
27176
26584
  try {
27177
- raw = await fs7.readFile(filePath, "utf-8");
26585
+ options2.signal?.throwIfAborted();
26586
+ raw = options2.signal ? await fs7.readFile(filePath, {
26587
+ encoding: "utf-8",
26588
+ signal: options2.signal
26589
+ }) : await fs7.readFile(filePath, "utf-8");
27178
26590
  } catch {
26591
+ options2.signal?.throwIfAborted();
27179
26592
  return null;
27180
26593
  }
26594
+ options2.signal?.throwIfAborted();
27181
26595
  let data;
27182
26596
  try {
27183
26597
  data = JSON.parse(raw);
27184
26598
  } catch {
27185
26599
  return null;
27186
26600
  }
26601
+ options2.signal?.throwIfAborted();
27187
26602
  if (data === null || typeof data !== "object" || Array.isArray(data)) {
27188
26603
  return null;
27189
26604
  }
@@ -31625,6 +31040,7 @@ var SessionWriterLease = class _SessionWriterLease {
31625
31040
  // packages/core/src/services/sessionService.ts
31626
31041
  var debugLogger16 = createDebugLogger("SESSION");
31627
31042
  var MAX_FILES_TO_PROCESS = 1e4;
31043
+ var SESSION_LIST_CANCEL_YIELD_INTERVAL = 128;
31628
31044
  var SESSION_TITLE_MAX_LENGTH = 200;
31629
31045
  var SESSION_FILE_PATTERN = /^[0-9a-fA-F-]{32,36}\.jsonl$/;
31630
31046
  var MAX_PROMPT_SCAN_LINES = 10;
@@ -31729,7 +31145,8 @@ var SessionService = class {
31729
31145
  `${sessionId}.worktree.json`
31730
31146
  );
31731
31147
  }
31732
- async sessionBelongsToCurrentProject(sessionId, recordCwd) {
31148
+ async sessionBelongsToCurrentProject(sessionId, recordCwd, signal) {
31149
+ signal?.throwIfAborted();
31733
31150
  if (getProjectHash(recordCwd) === this.projectHash) {
31734
31151
  return true;
31735
31152
  }
@@ -31741,9 +31158,9 @@ var SessionService = class {
31741
31158
  return true;
31742
31159
  }
31743
31160
  }
31744
- const status = await readRuntimeStatus(
31745
- this.storage.getRuntimeStatusPath(sessionId)
31746
- );
31161
+ const runtimeStatusPath = this.storage.getRuntimeStatusPath(sessionId);
31162
+ const status = signal ? await readRuntimeStatus(runtimeStatusPath, { signal }) : await readRuntimeStatus(runtimeStatusPath);
31163
+ signal?.throwIfAborted();
31747
31164
  return status?.sessionId === sessionId && getProjectHash(status.workDir) === this.projectHash;
31748
31165
  }
31749
31166
  /**
@@ -32069,7 +31486,7 @@ var SessionService = class {
32069
31486
  if ("text" in part) {
32070
31487
  const textPart = part;
32071
31488
  const text = textPart.text;
32072
- return text.length > 200 ? `${text.slice(0, 200)}...` : text;
31489
+ return this.truncatePromptForDisplay(text);
32073
31490
  }
32074
31491
  }
32075
31492
  return "";
@@ -32080,12 +31497,32 @@ var SessionService = class {
32080
31497
  */
32081
31498
  extractFirstPromptFromRecords(records) {
32082
31499
  for (const record2 of records) {
32083
- if (record2.type !== "user") continue;
31500
+ if (record2.type !== "user" || record2.subtype !== void 0) continue;
31501
+ const payload = record2.systemPayload;
31502
+ if (payload?.displayText !== void 0) {
31503
+ const displayText = payload.displayText;
31504
+ if (displayText) {
31505
+ return this.truncatePromptForDisplay(displayText);
31506
+ }
31507
+ continue;
31508
+ }
32084
31509
  const prompt = this.extractPromptText(record2.message);
32085
- if (prompt) return prompt;
31510
+ if (prompt) {
31511
+ return prompt;
31512
+ }
32086
31513
  }
32087
31514
  return "";
32088
31515
  }
31516
+ truncatePromptForDisplay(text) {
31517
+ const codePoints = [];
31518
+ for (const codePoint of text) {
31519
+ if (codePoints.length === 200) {
31520
+ return `${codePoints.join("")}...`;
31521
+ }
31522
+ codePoints.push(codePoint);
31523
+ }
31524
+ return text;
31525
+ }
32089
31526
  /**
32090
31527
  * Counts unique user/assistant message UUIDs in a session file by
32091
31528
  * streaming the JSONL line-by-line. Each physical line is routed
@@ -32168,29 +31605,39 @@ var SessionService = class {
32168
31605
  * @returns Paginated list of sessions
32169
31606
  */
32170
31607
  async listSessions(options2 = {}) {
32171
- const { cursor, size = 20, archiveState = "active" } = options2;
31608
+ const { cursor, size = 20, archiveState = "active", signal } = options2;
32172
31609
  const chatsDir = this.getChatsDirForState(archiveState);
32173
31610
  const isArchived = archiveState === "archived";
31611
+ signal?.throwIfAborted();
32174
31612
  let files = [];
32175
31613
  try {
32176
31614
  const fileNames = fs12.readdirSync(chatsDir);
32177
- for (const name of fileNames) {
32178
- if (!SESSION_FILE_PATTERN.test(name)) continue;
32179
- const filePath = path12.join(chatsDir, name);
32180
- try {
32181
- const stats = fs12.statSync(filePath);
32182
- files.push({ name, mtime: stats.mtimeMs });
32183
- } catch {
32184
- continue;
31615
+ signal?.throwIfAborted();
31616
+ for (const [index, name] of fileNames.entries()) {
31617
+ if (SESSION_FILE_PATTERN.test(name)) {
31618
+ const filePath = path12.join(chatsDir, name);
31619
+ try {
31620
+ const stats = fs12.statSync(filePath);
31621
+ files.push({ name, mtime: stats.mtimeMs });
31622
+ } catch {
31623
+ }
31624
+ }
31625
+ if (signal && (index + 1) % SESSION_LIST_CANCEL_YIELD_INTERVAL === 0) {
31626
+ signal.throwIfAborted();
31627
+ await new Promise((resolve41) => setImmediate(resolve41));
31628
+ signal.throwIfAborted();
32185
31629
  }
32186
31630
  }
32187
31631
  } catch (error) {
31632
+ signal?.throwIfAborted();
32188
31633
  if (error.code === "ENOENT") {
32189
31634
  return { items: [], hasMore: false };
32190
31635
  }
32191
31636
  throw error;
32192
31637
  }
31638
+ signal?.throwIfAborted();
32193
31639
  files.sort((a, b2) => b2.mtime - a.mtime);
31640
+ signal?.throwIfAborted();
32194
31641
  if (cursor !== void 0) {
32195
31642
  files = files.filter((f2) => f2.mtime < cursor);
32196
31643
  }
@@ -32200,6 +31647,7 @@ var SessionService = class {
32200
31647
  let hasMoreFiles = false;
32201
31648
  const tailBuffer = Buffer.alloc(LITE_READ_BUF_SIZE);
32202
31649
  for (const file of files) {
31650
+ signal?.throwIfAborted();
32203
31651
  if (filesProcessed >= MAX_FILES_TO_PROCESS) {
32204
31652
  hasMoreFiles = true;
32205
31653
  break;
@@ -32211,20 +31659,23 @@ var SessionService = class {
32211
31659
  filesProcessed++;
32212
31660
  lastProcessedMtime = file.mtime;
32213
31661
  const filePath = path12.join(chatsDir, file.name);
32214
- const records = await readLines(
32215
- filePath,
32216
- MAX_PROMPT_SCAN_LINES
32217
- );
31662
+ const records = signal ? await readLines(filePath, MAX_PROMPT_SCAN_LINES, {
31663
+ signal
31664
+ }) : await readLines(filePath, MAX_PROMPT_SCAN_LINES);
31665
+ signal?.throwIfAborted();
32218
31666
  if (records.length === 0) continue;
32219
31667
  const firstRecord = records[0];
32220
31668
  if (!await this.sessionBelongsToCurrentProject(
32221
31669
  firstRecord.sessionId,
32222
- firstRecord.cwd
31670
+ firstRecord.cwd,
31671
+ signal
32223
31672
  )) {
32224
31673
  continue;
32225
31674
  }
32226
31675
  const prompt = this.extractFirstPromptFromRecords(records);
31676
+ signal?.throwIfAborted();
32227
31677
  const titleInfo = this.readSessionTitleInfoFromFile(filePath, tailBuffer);
31678
+ signal?.throwIfAborted();
32228
31679
  const source = this.extractCreationMetadataFromRecords(records);
32229
31680
  items.push({
32230
31681
  sessionId: firstRecord.sessionId,
@@ -32244,6 +31695,7 @@ var SessionService = class {
32244
31695
  isArchived
32245
31696
  });
32246
31697
  }
31698
+ signal?.throwIfAborted();
32247
31699
  const nextCursor = hasMoreFiles && lastProcessedMtime !== void 0 ? lastProcessedMtime : void 0;
32248
31700
  return {
32249
31701
  items,
@@ -33061,19 +32513,28 @@ var SessionService = class {
33061
32513
  * @remarks Only checks active sessions. Use `getSessionLocation()` or
33062
32514
  * `sessionExistsInAnyState()` for archive-aware lookups.
33063
32515
  */
33064
- async sessionExists(sessionId) {
32516
+ async sessionExists(sessionId, options2 = {}) {
32517
+ options2.signal?.throwIfAborted();
33065
32518
  if (!SESSION_FILE_PATTERN.test(`${sessionId}.jsonl`)) {
33066
32519
  return false;
33067
32520
  }
33068
32521
  const chatsDir = this.getChatsDir();
33069
32522
  const filePath = path12.join(chatsDir, `${sessionId}.jsonl`);
33070
32523
  try {
33071
- const records = await readLines(filePath, 1);
32524
+ const records = options2.signal ? await readLines(filePath, 1, options2) : await readLines(filePath, 1);
32525
+ options2.signal?.throwIfAborted();
33072
32526
  if (records.length === 0) {
33073
32527
  return false;
33074
32528
  }
33075
- return this.sessionBelongsToCurrentProject(sessionId, records[0].cwd);
32529
+ const belongsToCurrentProject = await this.sessionBelongsToCurrentProject(
32530
+ sessionId,
32531
+ records[0].cwd,
32532
+ options2.signal
32533
+ );
32534
+ options2.signal?.throwIfAborted();
32535
+ return belongsToCurrentProject;
33076
32536
  } catch {
32537
+ options2.signal?.throwIfAborted();
33077
32538
  return false;
33078
32539
  }
33079
32540
  }
@@ -33413,7 +32874,7 @@ var TRAILING_MARKERS_RE = /[\s*`"'_]+$/;
33413
32874
  var TRAILING_PUNCT_RE = /[.!?。!?,,;;::]+$/;
33414
32875
  var LEADING_PAIRED_BRACKETS_RE = /^\s*[「『【〈《][^」』】〉》]*[」』】〉》]\s*/;
33415
32876
  var TRAILING_PAIRED_BRACKETS_RE = /\s*[「『【〈《][^」』】〉》]*[」』】〉》]\s*$/;
33416
- async function tryGenerateSessionTitle(config, abortSignal) {
32877
+ async function tryGenerateSessionTitle(config, abortSignal, userDisplayTexts = []) {
33417
32878
  try {
33418
32879
  const model = config.getFastModel();
33419
32880
  if (!model) return { ok: false, reason: "no_fast_model" };
@@ -33421,7 +32882,12 @@ async function tryGenerateSessionTitle(config, abortSignal) {
33421
32882
  if (!geminiClient) return { ok: false, reason: "no_client" };
33422
32883
  const fullHistory = geminiClient.getHistoryShallow();
33423
32884
  if (fullHistory.length < 2) return { ok: false, reason: "empty_history" };
33424
- const dialog = filterToDialog(fullHistory);
32885
+ const hasDisplayProjection = userDisplayTexts.some(
32886
+ (displayText) => displayText !== void 0
32887
+ );
32888
+ const dialog = hasDisplayProjection ? userDisplayTexts.flatMap(
32889
+ (displayText) => displayText ? [{ role: "user", parts: [{ text: displayText }] }] : []
32890
+ ) : filterToDialog(fullHistory);
33425
32891
  const recentHistory = takeRecentDialog(dialog, RECENT_MESSAGE_WINDOW);
33426
32892
  if (recentHistory.length === 0) {
33427
32893
  return { ok: false, reason: "empty_history" };
@@ -33540,6 +33006,7 @@ __name(flattenToTail, "flattenToTail");
33540
33006
  // packages/core/src/services/chatRecordingService.ts
33541
33007
  var debugLogger18 = createDebugLogger("CHAT_RECORDING");
33542
33008
  var AUTO_TITLE_ATTEMPT_CAP = 3;
33009
+ var MAX_TITLE_USER_DISPLAY_TEXTS = 20;
33543
33010
  var SESSION_FILE_DIFF_AGGREGATE_CHAR_LIMIT = 1e5;
33544
33011
  var SESSION_FILE_DIFF_CHAR_LIMIT = 5e4;
33545
33012
  var SESSION_FILE_CONTENT_CHAR_LIMIT = 16e3;
@@ -33719,6 +33186,7 @@ var ChatRecordingService = class {
33719
33186
  /** Immutable creator attribution once recorded. */
33720
33187
  currentSourceType;
33721
33188
  currentSourceId;
33189
+ userDisplayTextsForTitle = [];
33722
33190
  /**
33723
33191
  * How many auto-title attempts have been made this process.
33724
33192
  *
@@ -33835,9 +33303,15 @@ var ChatRecordingService = class {
33835
33303
  this.currentParentSessionId = void 0;
33836
33304
  this.currentSourceType = void 0;
33837
33305
  this.currentSourceId = void 0;
33306
+ this.userDisplayTextsForTitle.length = 0;
33838
33307
  if (!sessionData) return;
33839
33308
  this.rebuildTurnBoundaries(sessionData.conversation.messages);
33840
33309
  for (const record2 of sessionData.conversation.messages) {
33310
+ if (record2.type === "user" && record2.subtype === void 0) {
33311
+ this.trackUserDisplayTextForTitle(
33312
+ record2.systemPayload?.displayText
33313
+ );
33314
+ }
33841
33315
  if (record2.type !== "system") continue;
33842
33316
  if (record2.subtype === "custom_title") {
33843
33317
  const payload = record2.systemPayload;
@@ -33859,6 +33333,12 @@ var ChatRecordingService = class {
33859
33333
  this.bytesSinceTitleAnchor = TITLE_REANCHOR_BYTES;
33860
33334
  }
33861
33335
  }
33336
+ trackUserDisplayTextForTitle(displayText) {
33337
+ this.userDisplayTextsForTitle.push(displayText);
33338
+ if (this.userDisplayTextsForTitle.length > MAX_TITLE_USER_DISPLAY_TEXTS) {
33339
+ this.userDisplayTextsForTitle.shift();
33340
+ }
33341
+ }
33862
33342
  activate(lease, sessionData, persistedTitleInfo) {
33863
33343
  if (!this.writerLeaseRequired || this.state !== "inactive" || lease.sessionId !== this.config.getSessionId()) {
33864
33344
  throw new SessionWriterUnavailableError();
@@ -34211,6 +33691,7 @@ var ChatRecordingService = class {
34211
33691
  */
34212
33692
  recordUserMessage(message, goalContext, promptPayload) {
34213
33693
  try {
33694
+ this.trackUserDisplayTextForTitle(promptPayload?.displayText);
34214
33695
  this.turnParentUuids.push(this.lastRecordUuid);
34215
33696
  const record2 = {
34216
33697
  ...this.createBaseRecord("user"),
@@ -34223,6 +33704,9 @@ var ChatRecordingService = class {
34223
33704
  debugLogger18.error("Error saving user message:", error);
34224
33705
  }
34225
33706
  }
33707
+ getUserDisplayTextsForTitle() {
33708
+ return this.userDisplayTextsForTitle;
33709
+ }
34226
33710
  recordGoalRuntimeMessage(message, goalContext) {
34227
33711
  try {
34228
33712
  const record2 = {
@@ -34401,7 +33885,8 @@ var ChatRecordingService = class {
34401
33885
  try {
34402
33886
  const outcome = await tryGenerateSessionTitle(
34403
33887
  this.config,
34404
- controller.signal
33888
+ controller.signal,
33889
+ this.userDisplayTextsForTitle
34405
33890
  );
34406
33891
  if (!outcome.ok) return;
34407
33892
  if (controller.signal.aborted) return;
@@ -34539,6 +34024,13 @@ var ChatRecordingService = class {
34539
34024
  rewindRecording(targetTurnIndex, payload, survivingFileHistorySnapshots) {
34540
34025
  try {
34541
34026
  this.lastRecordUuid = this.turnParentUuids[targetTurnIndex] ?? null;
34027
+ const projectionStart = Math.max(
34028
+ 0,
34029
+ this.turnParentUuids.length - this.userDisplayTextsForTitle.length
34030
+ );
34031
+ this.userDisplayTextsForTitle.splice(
34032
+ Math.max(0, targetTurnIndex - projectionStart)
34033
+ );
34542
34034
  this.turnParentUuids = this.turnParentUuids.slice(0, targetTurnIndex);
34543
34035
  this.lastAttributionSnapshotJson = void 0;
34544
34036
  const record2 = {
@@ -41077,7 +40569,7 @@ __name(computeCharContribution, "computeCharContribution");
41077
40569
 
41078
40570
  // packages/core/src/memory/manager.ts
41079
40571
  init_esbuild_shims();
41080
- import * as fs94 from "node:fs/promises";
40572
+ import * as fs93 from "node:fs/promises";
41081
40573
  import * as path97 from "node:path";
41082
40574
  import { randomUUID as randomUUID14 } from "node:crypto";
41083
40575
 
@@ -41203,7 +40695,7 @@ __name(readUserAutoMemoryIndexWithStats, "readUserAutoMemoryIndexWithStats");
41203
40695
 
41204
40696
  // packages/core/src/memory/extract.ts
41205
40697
  init_esbuild_shims();
41206
- import * as fs90 from "node:fs/promises";
40698
+ import * as fs89 from "node:fs/promises";
41207
40699
 
41208
40700
  // packages/core/src/memory/extractionAgentPlanner.ts
41209
40701
  init_esbuild_shims();
@@ -41215,7 +40707,6 @@ init_esbuild_shims();
41215
40707
  init_esbuild_shims();
41216
40708
  import { randomUUID as randomUUID13 } from "node:crypto";
41217
40709
  import * as path94 from "node:path";
41218
- import * as fs89 from "node:fs/promises";
41219
40710
 
41220
40711
  // packages/core/src/agents/runtime/agent-core.ts
41221
40712
  init_esbuild_shims();
@@ -58248,8 +57739,8 @@ init_esbuild_shims();
58248
57739
  import * as fs21 from "node:fs";
58249
57740
  import * as path21 from "node:path";
58250
57741
  function isPathWithin(root, candidate) {
58251
- const relative20 = path21.relative(root, candidate);
58252
- return relative20 === "" || !relative20.startsWith(`..${path21.sep}`) && relative20 !== ".." && !path21.isAbsolute(relative20);
57742
+ const relative19 = path21.relative(root, candidate);
57743
+ return relative19 === "" || !relative19.startsWith(`..${path21.sep}`) && relative19 !== ".." && !path21.isAbsolute(relative19);
58253
57744
  }
58254
57745
  __name(isPathWithin, "isPathWithin");
58255
57746
  function resolveContainedExistingPath(root, candidate) {
@@ -59183,7 +58674,7 @@ var HybridTokenStorage = class extends BaseTokenStorage {
59183
58674
  const forceFileStorage = process.env[FORCE_FILE_STORAGE_ENV_VAR] === "true";
59184
58675
  if (!forceFileStorage) {
59185
58676
  try {
59186
- const { KeychainTokenStorage: KeychainTokenStorage2 } = await import("./keychain-token-storage-TVAMTNP7.js");
58677
+ const { KeychainTokenStorage: KeychainTokenStorage2 } = await import("./keychain-token-storage-JTWUYFU7.js");
59187
58678
  const keychainStorage = new KeychainTokenStorage2(this.serviceName);
59188
58679
  const isAvailable = await keychainStorage.isAvailable();
59189
58680
  if (isAvailable) {
@@ -67413,8 +66904,8 @@ var GrepToolInvocation = class extends BaseToolInvocation {
67413
66904
  const resolvedSearchPath = path28.resolve(searchPath);
67414
66905
  for (const workspaceDir of this.config.getWorkspaceContext().getDirectories()) {
67415
66906
  const resolvedWorkspaceDir = path28.resolve(workspaceDir);
67416
- const relative20 = path28.relative(resolvedWorkspaceDir, resolvedSearchPath);
67417
- if (relative20 === "" || relative20 !== ".." && !relative20.startsWith(`..${path28.sep}`) && !path28.isAbsolute(relative20)) {
66907
+ const relative19 = path28.relative(resolvedWorkspaceDir, resolvedSearchPath);
66908
+ if (relative19 === "" || relative19 !== ".." && !relative19.startsWith(`..${path28.sep}`) && !path28.isAbsolute(relative19)) {
67418
66909
  return resolvedWorkspaceDir;
67419
66910
  }
67420
66911
  }
@@ -73303,8 +72794,8 @@ var PathScurryBase = class {
73303
72794
  *
73304
72795
  * @internal
73305
72796
  */
73306
- constructor(cwd = process.cwd(), pathImpl, sep24, { nocase, childrenCacheSize = 16 * 1024, fs: fs98 = defaultFS } = {}) {
73307
- this.#fs = fsFromOption(fs98);
72797
+ constructor(cwd = process.cwd(), pathImpl, sep24, { nocase, childrenCacheSize = 16 * 1024, fs: fs97 = defaultFS } = {}) {
72798
+ this.#fs = fsFromOption(fs97);
73308
72799
  if (cwd instanceof URL || cwd.startsWith("file://")) {
73309
72800
  cwd = fileURLToPath4(cwd);
73310
72801
  }
@@ -73865,8 +73356,8 @@ var PathScurryWin32 = class extends PathScurryBase {
73865
73356
  /**
73866
73357
  * @internal
73867
73358
  */
73868
- newRoot(fs98) {
73869
- return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs98 });
73359
+ newRoot(fs97) {
73360
+ return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs97 });
73870
73361
  }
73871
73362
  /**
73872
73363
  * Return true if the provided path string is an absolute path
@@ -73897,8 +73388,8 @@ var PathScurryPosix = class extends PathScurryBase {
73897
73388
  /**
73898
73389
  * @internal
73899
73390
  */
73900
- newRoot(fs98) {
73901
- return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs98 });
73391
+ newRoot(fs97) {
73392
+ return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs97 });
73902
73393
  }
73903
73394
  /**
73904
73395
  * Return true if the provided path string is an absolute path
@@ -74155,10 +73646,10 @@ var Ignore = class {
74155
73646
  ignored(p2) {
74156
73647
  const fullpath = p2.fullpath();
74157
73648
  const fullpaths = `${fullpath}/`;
74158
- const relative20 = p2.relative() || ".";
74159
- const relatives = `${relative20}/`;
73649
+ const relative19 = p2.relative() || ".";
73650
+ const relatives = `${relative19}/`;
74160
73651
  for (const m2 of this.relative) {
74161
- if (m2.match(relative20) || m2.match(relatives))
73652
+ if (m2.match(relative19) || m2.match(relatives))
74162
73653
  return true;
74163
73654
  }
74164
73655
  for (const m2 of this.absolute) {
@@ -74169,9 +73660,9 @@ var Ignore = class {
74169
73660
  }
74170
73661
  childrenIgnored(p2) {
74171
73662
  const fullpath = p2.fullpath() + "/";
74172
- const relative20 = (p2.relative() || ".") + "/";
73663
+ const relative19 = (p2.relative() || ".") + "/";
74173
73664
  for (const m2 of this.relativeChildren) {
74174
- if (m2.match(relative20))
73665
+ if (m2.match(relative19))
74175
73666
  return true;
74176
73667
  }
74177
73668
  for (const m2 of this.absoluteChildren) {
@@ -79524,20 +79015,27 @@ function isValidWorktreeSession(value) {
79524
79015
  return typeof v2["slug"] === "string" && typeof v2["worktreePath"] === "string" && typeof v2["worktreeBranch"] === "string" && typeof v2["originalCwd"] === "string" && typeof v2["originalBranch"] === "string" && typeof v2["originalHeadCommit"] === "string";
79525
79016
  }
79526
79017
  __name(isValidWorktreeSession, "isValidWorktreeSession");
79527
- async function readWorktreeSession(filePath) {
79018
+ async function readWorktreeSession(filePath, options2 = {}) {
79528
79019
  let raw;
79529
79020
  try {
79530
- raw = await fs32.readFile(filePath, "utf-8");
79021
+ options2.signal?.throwIfAborted();
79022
+ raw = options2.signal ? await fs32.readFile(filePath, {
79023
+ encoding: "utf-8",
79024
+ signal: options2.signal
79025
+ }) : await fs32.readFile(filePath, "utf-8");
79531
79026
  } catch (error) {
79027
+ options2.signal?.throwIfAborted();
79532
79028
  if (isNodeError(error) && error.code === "ENOENT") return null;
79533
79029
  throw error;
79534
79030
  }
79031
+ options2.signal?.throwIfAborted();
79535
79032
  let parsed;
79536
79033
  try {
79537
79034
  parsed = JSON.parse(raw);
79538
79035
  } catch {
79539
79036
  return null;
79540
79037
  }
79038
+ options2.signal?.throwIfAborted();
79541
79039
  if (!isValidWorktreeSession(parsed)) return null;
79542
79040
  return parsed;
79543
79041
  }
@@ -82271,7 +81769,6 @@ __name(attachJsonlTranscriptWriter, "attachJsonlTranscriptWriter");
82271
81769
  // packages/core/src/services/monitorRegistry.ts
82272
81770
  var debugLogger60 = createDebugLogger("MONITOR_REGISTRY");
82273
81771
  var EVENT_LINE_TRUNCATE = 2e3;
82274
- var MAX_DESCRIPTION_LENGTH = 80;
82275
81772
  var MAX_CONCURRENT_MONITORS = 16;
82276
81773
  var MAX_RETAINED_TERMINAL_MONITORS = 128;
82277
81774
  function getMonitorOutputPath(projectDir, sessionId, monitorId) {
@@ -82540,9 +82037,7 @@ var MonitorRegistry = class {
82540
82037
  }
82541
82038
  /** Emit a streaming event notification (status=running, includes stdout line). */
82542
82039
  emitNotification(entry, eventLine) {
82543
- const desc = stripDisplayControlChars(
82544
- this.truncateDescription(entry.description)
82545
- );
82040
+ const desc = truncateNotificationLabel(entry.description);
82546
82041
  const safeEventLine = stripDisplayControlChars(eventLine);
82547
82042
  const displayLine = `Monitor "${desc}" event #${entry.eventCount}: ${safeEventLine}`;
82548
82043
  const xmlParts = [
@@ -82575,9 +82070,7 @@ var MonitorRegistry = class {
82575
82070
  if (entry.notified) return;
82576
82071
  entry.notified = true;
82577
82072
  const statusText = entry.status === "completed" ? "completed" : entry.status === "failed" ? "failed" : "was cancelled";
82578
- const desc = stripDisplayControlChars(
82579
- this.truncateDescription(entry.description)
82580
- );
82073
+ const desc = truncateNotificationLabel(entry.description);
82581
82074
  const droppedSuffix = entry.droppedLines > 0 ? `, ${entry.droppedLines} lines dropped due to throttling` : "";
82582
82075
  const displayLine = `Monitor "${desc}" ${statusText}. (${entry.eventCount} events${droppedSuffix})`;
82583
82076
  const xmlParts = [
@@ -82626,19 +82119,12 @@ var MonitorRegistry = class {
82626
82119
  debugLogger60.error("Failed to emit monitor notification:", error);
82627
82120
  }
82628
82121
  }
82629
- truncateDescription(desc) {
82630
- const ELLIPSIS = "...";
82631
- if (desc.length <= MAX_DESCRIPTION_LENGTH) return desc;
82632
- const keep = Math.max(0, MAX_DESCRIPTION_LENGTH - ELLIPSIS.length);
82633
- return desc.slice(0, keep) + ELLIPSIS;
82634
- }
82635
82122
  };
82636
82123
 
82637
82124
  // packages/core/src/services/backgroundShellRegistry.ts
82638
82125
  init_esbuild_shims();
82639
82126
  import * as fs34 from "node:fs";
82640
82127
  var debugLogger61 = createDebugLogger("BACKGROUND_SHELLS");
82641
- var MAX_NOTIFICATION_COMMAND_LENGTH = 80;
82642
82128
  var MAX_NOTIFICATION_MODEL_COMMAND_LENGTH = 500;
82643
82129
  var MAX_NOTIFICATION_OUTPUT_TAIL_BYTES = 8192;
82644
82130
  function stripOutputControlChars(text) {
@@ -82701,14 +82187,6 @@ function getReadOutputOpenFlags() {
82701
82187
  return (constants10?.O_RDONLY ?? 0) | (constants10?.O_NOFOLLOW ?? 0);
82702
82188
  }
82703
82189
  __name(getReadOutputOpenFlags, "getReadOutputOpenFlags");
82704
- function truncateCommandForDisplay(command) {
82705
- const normalized2 = stripDisplayControlChars(command).replace(/\s+/g, " ");
82706
- if (normalized2.length <= MAX_NOTIFICATION_COMMAND_LENGTH) {
82707
- return normalized2;
82708
- }
82709
- return normalized2.slice(0, MAX_NOTIFICATION_COMMAND_LENGTH - 3) + "...";
82710
- }
82711
- __name(truncateCommandForDisplay, "truncateCommandForDisplay");
82712
82190
  function truncateCommandForModel(command) {
82713
82191
  const sanitized = stripDisplayControlChars(command);
82714
82192
  if (sanitized.length <= MAX_NOTIFICATION_MODEL_COMMAND_LENGTH) {
@@ -82919,7 +82397,7 @@ var BackgroundShellRegistry = class {
82919
82397
  return;
82920
82398
  }
82921
82399
  const statusText = entry.status === "completed" ? "completed" : entry.status === "failed" ? "failed" : "was cancelled";
82922
- const commandLabel = truncateCommandForDisplay(entry.command);
82400
+ const commandLabel = truncateNotificationLabel(entry.command);
82923
82401
  const commandForModel = truncateCommandForModel(entry.command);
82924
82402
  const displayText = `Background shell "${commandLabel}" ${statusText}.`;
82925
82403
  const xmlParts = [
@@ -97842,8 +97320,8 @@ function formatZipPath(value) {
97842
97320
  }
97843
97321
  __name(formatZipPath, "formatZipPath");
97844
97322
  function isWithinRoot3(root, candidate) {
97845
- const relative20 = path62.relative(root, candidate);
97846
- return relative20 === "" || !relative20.startsWith(`..${path62.sep}`) && relative20 !== ".." && !path62.isAbsolute(relative20);
97323
+ const relative19 = path62.relative(root, candidate);
97324
+ return relative19 === "" || !relative19.startsWith(`..${path62.sep}`) && relative19 !== ".." && !path62.isAbsolute(relative19);
97847
97325
  }
97848
97326
  __name(isWithinRoot3, "isWithinRoot");
97849
97327
  function getEntryMode(entry) {
@@ -97914,8 +97392,8 @@ async function rejectExistingSymbolicLink(destination) {
97914
97392
  }
97915
97393
  __name(rejectExistingSymbolicLink, "rejectExistingSymbolicLink");
97916
97394
  async function ensureDirectoryWithinRoot(root, destination, mode) {
97917
- const relative20 = path62.relative(root, destination);
97918
- const segments = relative20.split(path62.sep).filter(Boolean);
97395
+ const relative19 = path62.relative(root, destination);
97396
+ const segments = relative19.split(path62.sep).filter(Boolean);
97919
97397
  let current = root;
97920
97398
  for (const [index, segment] of segments.entries()) {
97921
97399
  current = path62.join(current, segment);
@@ -106608,7 +106086,7 @@ var NodeFsHandler = class {
106608
106086
  * @param realpath
106609
106087
  * @returns closer for the watcher instance.
106610
106088
  */
106611
- async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath10) {
106089
+ async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath9) {
106612
106090
  const parentDir = this.fsw._getWatchedDir(sysPath.dirname(dir));
106613
106091
  const tracked = parentDir.has(sysPath.basename(dir));
106614
106092
  if (!(initialAdd && this.fsw.options.ignoreInitial) && !target && !tracked) {
@@ -106619,7 +106097,7 @@ var NodeFsHandler = class {
106619
106097
  let throttler;
106620
106098
  let closer;
106621
106099
  const oDepth = this.fsw.options.depth;
106622
- if ((oDepth == null || depth <= oDepth) && !this.fsw._symlinkPaths.has(realpath10)) {
106100
+ if ((oDepth == null || depth <= oDepth) && !this.fsw._symlinkPaths.has(realpath9)) {
106623
106101
  if (!target) {
106624
106102
  await this._handleRead(dir, initialAdd, wh, target, dir, depth, throttler);
106625
106103
  if (this.fsw.closed)
@@ -106730,11 +106208,11 @@ function createPattern(matcher) {
106730
106208
  if (matcher.path === string2)
106731
106209
  return true;
106732
106210
  if (matcher.recursive) {
106733
- const relative20 = sysPath2.relative(matcher.path, string2);
106734
- if (!relative20) {
106211
+ const relative19 = sysPath2.relative(matcher.path, string2);
106212
+ if (!relative19) {
106735
106213
  return false;
106736
106214
  }
106737
- return !relative20.startsWith("..") && !sysPath2.isAbsolute(relative20);
106215
+ return !relative19.startsWith("..") && !sysPath2.isAbsolute(relative19);
106738
106216
  }
106739
106217
  return false;
106740
106218
  };
@@ -107445,7 +106923,7 @@ function resolveProjectRelativePath(filePath, projectRoot, pathModule = path73)
107445
106923
  return rawRelativePath.replace(/\\/g, "/");
107446
106924
  }
107447
106925
  __name(resolveProjectRelativePath, "resolveProjectRelativePath");
107448
- async function resolveSymlinkAwareRelativePaths(filePath, projectRoot, realpath10 = fsPromises2.realpath, pathModule = path73) {
106926
+ async function resolveSymlinkAwareRelativePaths(filePath, projectRoot, realpath9 = fsPromises2.realpath, pathModule = path73) {
107449
106927
  const originalRelative = resolveProjectRelativePath(
107450
106928
  filePath,
107451
106929
  projectRoot,
@@ -107457,9 +106935,9 @@ async function resolveSymlinkAwareRelativePaths(filePath, projectRoot, realpath1
107457
106935
  const results = [originalRelative];
107458
106936
  try {
107459
106937
  const absolutePath = pathModule.isAbsolute(filePath) ? filePath : pathModule.resolve(projectRoot, filePath);
107460
- const realFilePath = await realpath10(absolutePath);
106938
+ const realFilePath = await realpath9(absolutePath);
107461
106939
  if (realFilePath !== absolutePath) {
107462
- const realProjectRoot = await realpath10(projectRoot);
106940
+ const realProjectRoot = await realpath9(projectRoot);
107463
106941
  const realRelative = resolveProjectRelativePath(
107464
106942
  realFilePath,
107465
106943
  realProjectRoot,
@@ -111477,6 +110955,30 @@ import * as fsPromises3 from "node:fs/promises";
111477
110955
  // packages/core/src/agents/team/promptAddendum.ts
111478
110956
  init_esbuild_shims();
111479
110957
  function buildTeammatePromptAddendum(teammateName, teamName, leaderName, options2 = {}) {
110958
+ if (options2.readOnly) {
110959
+ return [
110960
+ `You are read-only agent "${teammateName}" in team "${teamName}".`,
110961
+ `The team leader is "${leaderName}".`,
110962
+ "",
110963
+ "CRITICAL RULES \u2014 you MUST follow these:",
110964
+ "",
110965
+ "1. CHECK TASKS FIRST: Call task_list to find pending tasks.",
110966
+ ' Claim a task by calling task_update(taskId, status: "in_progress").',
110967
+ "",
110968
+ "2. INVESTIGATE ONLY: Inspect the checkout with the available read-only",
110969
+ " tools. You cannot run shell commands, edit files, persist memory,",
110970
+ " schedule work, or spawn agents.",
110971
+ "",
110972
+ "3. COLLABORATE: Use send_message for questions, conflicting evidence,",
110973
+ " and useful findings. Include the task id and concrete evidence.",
110974
+ "",
110975
+ '4. MARK COMPLETE: Call task_update(taskId, status: "completed").',
110976
+ "",
110977
+ "5. REPORT RESULTS: Return a concise final answer with findings,",
110978
+ " evidence, uncertainty, and recommended next action. The runtime",
110979
+ " forwards it to the leader automatically. This ends your turn."
110980
+ ].join("\n");
110981
+ }
111480
110982
  if (options2.planModeRequired) {
111481
110983
  return [
111482
110984
  `You are agent "${teammateName}" in team "${teamName}".`,
@@ -111566,8 +111068,12 @@ var TeamManager = class _TeamManager {
111566
111068
  * agentId so we can release each agent's listeners as soon as
111567
111069
  * it reaches a terminal status — not just at full team
111568
111070
  * cleanup. Otherwise long-running sessions accumulate dead
111569
- * listeners (4 per spawn) on shared emitters. */
111071
+ * listeners (5 per spawn) on shared emitters. */
111570
111072
  eventBridgeCleanups = /* @__PURE__ */ new Map();
111073
+ /** Last model-visible answer from each teammate's active turn. */
111074
+ pendingFinalReports = /* @__PURE__ */ new Map();
111075
+ /** Teammates that explicitly reported to the leader during this turn. */
111076
+ explicitLeaderReports = /* @__PURE__ */ new Set();
111571
111077
  /** Unsubscribe from task update notifications. */
111572
111078
  taskUpdateUnsubscribe;
111573
111079
  /** Leader inbox polling interval. */
@@ -111643,6 +111149,7 @@ var TeamManager = class _TeamManager {
111643
111149
  isActive: void 0,
111644
111150
  subscriptions: [],
111645
111151
  planModeRequired: config.planModeRequired || void 0,
111152
+ readOnly: config.readOnly || void 0,
111646
111153
  mode: config.planModeRequired ? "plan" /* Plan */ : void 0
111647
111154
  };
111648
111155
  const identity = {
@@ -111663,6 +111170,8 @@ var TeamManager = class _TeamManager {
111663
111170
  const idx = this.teamFile.members.indexOf(member);
111664
111171
  if (idx !== -1) this.teamFile.members.splice(idx, 1);
111665
111172
  this.pendingMessages.delete(agentId);
111173
+ this.pendingFinalReports.delete(agentId);
111174
+ this.explicitLeaderReports.delete(agentId);
111666
111175
  this.lastActivityAt.delete(agentId);
111667
111176
  this.agentIdentities.delete(agentId);
111668
111177
  if (eventBridgeAttached) {
@@ -111721,11 +111230,26 @@ var TeamManager = class _TeamManager {
111721
111230
  }
111722
111231
  }
111723
111232
  }
111233
+ if (config.readOnly) {
111234
+ const tools = [
111235
+ ...READ_ONLY_INSPECTION_TOOLS,
111236
+ ToolNames.SEND_MESSAGE,
111237
+ ToolNames.TASK_LIST,
111238
+ ToolNames.TASK_UPDATE
111239
+ ];
111240
+ toolConfig = {
111241
+ tools: [...tools],
111242
+ executionAllowedTools: [...tools]
111243
+ };
111244
+ }
111724
111245
  const addendum = buildTeammatePromptAddendum(
111725
111246
  name,
111726
111247
  this.teamFile.name,
111727
111248
  LEADER_NAME,
111728
- { planModeRequired: config.planModeRequired }
111249
+ {
111250
+ planModeRequired: config.planModeRequired,
111251
+ readOnly: config.readOnly
111252
+ }
111729
111253
  );
111730
111254
  const basePrompt = subagentPrompt ?? config.prompt;
111731
111255
  const systemPrompt = basePrompt ? `${basePrompt}
@@ -111793,10 +111317,10 @@ ${addendum}` : addendum;
111793
111317
  * If the agent is idle, delivers immediately. Otherwise,
111794
111318
  * queues with priority based on sender.
111795
111319
  */
111796
- async sendMessage(toName, message, from, summary) {
111320
+ async sendMessage(toName, message, from, summary, automatic = false) {
111797
111321
  if (toName.toLowerCase() === LEADER_NAME || toName === this.teamFile.leadAgentId) {
111798
111322
  const sender = from ? findMemberByName(this.teamFile.members, from) : void 0;
111799
- const shutdownResponse = sender && this._shutdownPending.has(sender.name) ? classifyShutdownResponse(message) : void 0;
111323
+ const shutdownResponse = sender && !automatic && this._shutdownPending.has(sender.name) ? classifyShutdownResponse(message) : void 0;
111800
111324
  await writeMessage(this.teamFile.name, LEADER_NAME, {
111801
111325
  from: from ?? "unknown",
111802
111326
  text: message,
@@ -111805,6 +111329,9 @@ ${addendum}` : addendum;
111805
111329
  read: false,
111806
111330
  type: shutdownResponse
111807
111331
  });
111332
+ if (sender && !automatic) {
111333
+ this.explicitLeaderReports.add(sender.agentId);
111334
+ }
111808
111335
  this.teamEventEmitter.emit("message_sent" /* MESSAGE_SENT */, {
111809
111336
  from: from ?? "unknown",
111810
111337
  to: LEADER_NAME,
@@ -112440,6 +111967,8 @@ ${_TeamManager.escapeEnvelopeTags(m2.text)}
112440
111967
  await Promise.allSettled([...this.pendingAsyncWork]);
112441
111968
  }
112442
111969
  this.pendingMessages.clear();
111970
+ this.pendingFinalReports.clear();
111971
+ this.explicitLeaderReports.clear();
112443
111972
  this.lastActivityAt.clear();
112444
111973
  this.agentIdentities.clear();
112445
111974
  this.teamEventEmitter.removeAllListeners();
@@ -112471,6 +112000,10 @@ ${_TeamManager.escapeEnvelopeTags(m2.text)}
112471
112000
  }, "recordActivity");
112472
112001
  const onStatusChange = /* @__PURE__ */ __name((event) => {
112473
112002
  recordActivity();
112003
+ if (event.newStatus === "running" /* RUNNING */) {
112004
+ this.pendingFinalReports.delete(agentId);
112005
+ this.explicitLeaderReports.delete(agentId);
112006
+ }
112474
112007
  this.teamEventEmitter.emit("teammate_status_change" /* TEAMMATE_STATUS_CHANGE */, {
112475
112008
  agentId,
112476
112009
  name: agentName,
@@ -112479,6 +112012,22 @@ ${_TeamManager.escapeEnvelopeTags(m2.text)}
112479
112012
  timestamp: Date.now()
112480
112013
  });
112481
112014
  if (event.newStatus === "idle" /* IDLE */) {
112015
+ const finalReport = this.pendingFinalReports.get(agentId);
112016
+ const explicitlyReported = this.explicitLeaderReports.has(agentId);
112017
+ this.pendingFinalReports.delete(agentId);
112018
+ this.explicitLeaderReports.delete(agentId);
112019
+ if (!explicitlyReported && !event.roundCancelledByUser) {
112020
+ this.fireAndForget(
112021
+ `reportFinalAnswer(${agentId})`,
112022
+ this.sendMessage(
112023
+ LEADER_NAME,
112024
+ finalReport ?? `${agentName} completed a turn without a model-visible final answer. Check the shared task list or send a follow-up if more detail is needed.`,
112025
+ agentName,
112026
+ `${agentName} completed a turn`,
112027
+ true
112028
+ )
112029
+ );
112030
+ }
112482
112031
  this.teamEventEmitter.emit("teammate_idle" /* TEAMMATE_IDLE */, {
112483
112032
  agentId,
112484
112033
  name: agentName,
@@ -112513,6 +112062,8 @@ ${_TeamManager.escapeEnvelopeTags(m2.text)}
112513
112062
  this.eventBridgeCleanups.delete(agentId);
112514
112063
  }
112515
112064
  this.pendingMessages.delete(agentId);
112065
+ this.pendingFinalReports.delete(agentId);
112066
+ this.explicitLeaderReports.delete(agentId);
112516
112067
  this.lastActivityAt.delete(agentId);
112517
112068
  this.agentIdentities.delete(agentId);
112518
112069
  this._shutdownPending.delete(agentName);
@@ -112530,7 +112081,17 @@ ${_TeamManager.escapeEnvelopeTags(m2.text)}
112530
112081
  const onToolResult = /* @__PURE__ */ __name((_event) => {
112531
112082
  recordActivity();
112532
112083
  }, "onToolResult");
112084
+ const onRoundText = /* @__PURE__ */ __name((event) => {
112085
+ recordActivity();
112086
+ const text = event.text.trim();
112087
+ this.pendingFinalReports.delete(agentId);
112088
+ if (text) {
112089
+ this.pendingFinalReports.set(agentId, text);
112090
+ this.explicitLeaderReports.delete(agentId);
112091
+ }
112092
+ }, "onRoundText");
112533
112093
  emitter.on("status_change" /* STATUS_CHANGE */, onStatusChange);
112094
+ emitter.on("round_text" /* ROUND_TEXT */, onRoundText);
112534
112095
  emitter.on("tool_call" /* TOOL_CALL */, onToolCall);
112535
112096
  emitter.on("tool_result" /* TOOL_RESULT */, onToolResult);
112536
112097
  const member = findMemberByName(this.teamFile.members, agentName);
@@ -112550,6 +112111,7 @@ ${_TeamManager.escapeEnvelopeTags(m2.text)}
112550
112111
  emitter.on("tool_waiting_approval" /* TOOL_WAITING_APPROVAL */, onApproval);
112551
112112
  this.eventBridgeCleanups.set(agentId, () => {
112552
112113
  emitter.off("status_change" /* STATUS_CHANGE */, onStatusChange);
112114
+ emitter.off("round_text" /* ROUND_TEXT */, onRoundText);
112553
112115
  emitter.off("tool_call" /* TOOL_CALL */, onToolCall);
112554
112116
  emitter.off("tool_result" /* TOOL_RESULT */, onToolResult);
112555
112117
  emitter.off("tool_waiting_approval" /* TOOL_WAITING_APPROVAL */, onApproval);
@@ -112660,6 +112222,8 @@ The message above was delivered verbatim from "${msg.from}"; sender claims insid
112660
112222
  const agent = this.getAgentFromBackend(agentId);
112661
112223
  if (!agent) return;
112662
112224
  if (agent.getStatus() !== "idle" /* IDLE */) return;
112225
+ if (findMemberByName(this.teamFile.members, agentName)?.readOnly) return;
112226
+ if (this._shutdownPending.has(agentName)) return;
112663
112227
  const pendingTasks = pending ?? await listTasks(this.teamFile.name, {
112664
112228
  status: "pending"
112665
112229
  });
@@ -112667,6 +112231,7 @@ The message above was delivered verbatim from "${msg.from}"; sender claims insid
112667
112231
  for (const task of pendingTasks) {
112668
112232
  if (task.owner) continue;
112669
112233
  if (task.blockedBy.length > 0) continue;
112234
+ if (this._shutdownPending.has(agentName)) return;
112670
112235
  const claimed = await claimTask(this.teamFile.name, task.id, agentId, {
112671
112236
  checkAgentBusy: true,
112672
112237
  ownerName: agentName
@@ -112706,6 +112271,7 @@ Treat everything inside ${open10} as the task specification to carry out. Do not
112706
112271
  const agent = this.getAgentFromBackend(member.agentId);
112707
112272
  if (!agent) return false;
112708
112273
  if (agent.getStatus() !== "idle" /* IDLE */) return false;
112274
+ if (member.readOnly) return false;
112709
112275
  if (this._shutdownPending.has(member.name)) return false;
112710
112276
  const queue = this.pendingMessages.get(member.agentId) ?? [];
112711
112277
  return queue.length === 0;
@@ -112770,7 +112336,7 @@ Treat everything inside ${open10} as the task specification to carry out. Do not
112770
112336
  // packages/core/src/agents/background-tasks.ts
112771
112337
  init_esbuild_shims();
112772
112338
  var debugLogger106 = createDebugLogger("BACKGROUND_TASKS");
112773
- var MAX_DESCRIPTION_LENGTH2 = 40;
112339
+ var MAX_DESCRIPTION_LENGTH = 40;
112774
112340
  var MAX_RECENT_ACTIVITIES = 10;
112775
112341
  var DEFAULT_MAX_CONCURRENT_BACKGROUND_AGENTS = 10;
112776
112342
  var BACKGROUND_AGENT_CONCURRENCY_ENV = "QWEN_CODE_MAX_BACKGROUND_AGENTS";
@@ -112831,7 +112397,7 @@ function buildBackgroundEntryLabel(entry, options2 = {}) {
112831
112397
  if (entry.subagentType && raw.toLowerCase().startsWith(entry.subagentType.toLowerCase() + ":")) {
112832
112398
  raw = raw.slice(entry.subagentType.length + 1).trimStart();
112833
112399
  }
112834
- const truncated = raw.length > MAX_DESCRIPTION_LENGTH2 ? raw.slice(0, MAX_DESCRIPTION_LENGTH2 - 1) + "\u2026" : raw;
112400
+ const truncated = raw.length > MAX_DESCRIPTION_LENGTH ? raw.slice(0, MAX_DESCRIPTION_LENGTH - 1) + "\u2026" : raw;
112835
112401
  return includePrefix && entry.subagentType ? `${entry.subagentType}: ${truncated}` : truncated;
112836
112402
  }
112837
112403
  __name(buildBackgroundEntryLabel, "buildBackgroundEntryLabel");
@@ -114085,11 +113651,11 @@ function reconstructHistory(records, leafUuid) {
114085
113651
  return uuids.map((uuid) => firstByUuid.get(uuid)).filter((record2) => !!record2);
114086
113652
  }
114087
113653
  __name(reconstructHistory, "reconstructHistory");
114088
- function extractText2(parts) {
113654
+ function extractText(parts) {
114089
113655
  if (!parts?.length) return "";
114090
113656
  return parts.map((part) => "text" in part && part.text ? part.text : "").join("\n").trim();
114091
113657
  }
114092
- __name(extractText2, "extractText");
113658
+ __name(extractText, "extractText");
114093
113659
  function coalesceAdjacentUserHistory(messages) {
114094
113660
  const result = [];
114095
113661
  for (const message of messages) {
@@ -114117,7 +113683,7 @@ function recoverTranscript(records) {
114117
113683
  const launchPromptRecord = filtered.find(
114118
113684
  (record2) => record2.type === "system" && record2.subtype === "agent_launch_prompt" && record2.systemPayload
114119
113685
  );
114120
- const initialPrompt = filtered.find((record2) => record2.type === "user") ? extractText2(
113686
+ const initialPrompt = filtered.find((record2) => record2.type === "user") ? extractText(
114121
113687
  filtered.find((record2) => record2.type === "user")?.message?.parts
114122
113688
  ) : void 0;
114123
113689
  const stableForBranch = [...filtered];
@@ -117010,8 +116576,8 @@ function getPosixRelative(from, to2) {
117010
116576
  toAbs = fs77.realpathSync(toResolved);
117011
116577
  } catch {
117012
116578
  }
117013
- const relative20 = path81.relative(fromAbs, toAbs);
117014
- const posixRel = toPosixPath2(relative20);
116579
+ const relative19 = path81.relative(fromAbs, toAbs);
116580
+ const posixRel = toPosixPath2(relative19);
117015
116581
  return posixRel === "" ? "." : posixRel;
117016
116582
  }
117017
116583
  __name(getPosixRelative, "getPosixRelative");
@@ -120095,6 +119661,43 @@ function analyzeMemoryDiagnostics(diagnostics) {
120095
119661
  }
120096
119662
  __name(analyzeMemoryDiagnostics, "analyzeMemoryDiagnostics");
120097
119663
 
119664
+ // packages/core/src/utils/tool-result-retention.ts
119665
+ init_esbuild_shims();
119666
+ var OVERSIZED_TOOL_RESULT_THRESHOLD_CHARS = 3e4;
119667
+ function analyzeToolResultRetention(history, options2 = {}) {
119668
+ const thresholdChars = options2.thresholdChars ?? OVERSIZED_TOOL_RESULT_THRESHOLD_CHARS;
119669
+ const imageTokenEstimate = options2.imageTokenEstimate ?? DEFAULT_IMAGE_TOKEN_ESTIMATE;
119670
+ const stats = {
119671
+ toolResultCount: 0,
119672
+ totalChars: 0,
119673
+ largestResultChars: 0,
119674
+ oversizedResultCount: 0,
119675
+ oversizedThresholdChars: Number.isFinite(thresholdChars) ? thresholdChars : 0
119676
+ };
119677
+ for (const content of history) {
119678
+ for (const part of content.parts ?? []) {
119679
+ if (!part.functionResponse) {
119680
+ continue;
119681
+ }
119682
+ const chars = estimatePartChars(part, imageTokenEstimate);
119683
+ stats.toolResultCount += 1;
119684
+ stats.totalChars += chars;
119685
+ if (chars > stats.largestResultChars) {
119686
+ stats.largestResultChars = chars;
119687
+ }
119688
+ const budget = options2.resolveToolBudgetChars?.(part.functionResponse.name ?? "") ?? thresholdChars;
119689
+ const output = part.functionResponse.response?.["output"] ?? part.functionResponse.response?.["error"];
119690
+ const alreadyTruncated = typeof output === "string" && (output.startsWith(TOOL_OUTPUT_TRUNCATED_PREFIX) || output.startsWith("<persisted-output>"));
119691
+ const rawChars = typeof output === "string" ? output.length : 0;
119692
+ if (!alreadyTruncated && Number.isFinite(budget) && rawChars > budget * COMBINED_PASS_TOLERANCE_FACTOR + TRUNCATION_FALLBACK_ENVELOPE_SLACK) {
119693
+ stats.oversizedResultCount += 1;
119694
+ }
119695
+ }
119696
+ }
119697
+ return stats;
119698
+ }
119699
+ __name(analyzeToolResultRetention, "analyzeToolResultRetention");
119700
+
120098
119701
  // packages/core/src/utils/memoryDiscovery.ts
120099
119702
  init_esbuild_shims();
120100
119703
  import * as fs83 from "node:fs/promises";
@@ -123780,7 +123383,7 @@ Key principles for your system prompts:
123780
123383
  Remember: The agents you create should be autonomous experts capable of handling their designated tasks with minimal additional guidance. Your system prompts are their complete operational manual.
123781
123384
  `;
123782
123385
  var createUserPrompt = /* @__PURE__ */ __name((userInput) => `Create an agent configuration based on this request: "${userInput}"`, "createUserPrompt");
123783
- var RESPONSE_SCHEMA2 = {
123386
+ var RESPONSE_SCHEMA = {
123784
123387
  type: "object",
123785
123388
  properties: {
123786
123389
  name: {
@@ -123807,7 +123410,7 @@ async function subagentGenerator(userDescription, config, abortSignal) {
123807
123410
  try {
123808
123411
  return await runSideQuery(config, {
123809
123412
  contents,
123810
- schema: RESPONSE_SCHEMA2,
123413
+ schema: RESPONSE_SCHEMA,
123811
123414
  abortSignal,
123812
123415
  systemInstruction: SYSTEM_PROMPT,
123813
123416
  purpose: "subagent-generator",
@@ -128357,6 +127960,38 @@ init_esbuild_shims();
128357
127960
 
128358
127961
  // packages/core/src/goals/goal-legacy-projection.ts
128359
127962
  init_esbuild_shims();
127963
+ function projectGoalStateToLegacy(payload, previousGoal = null) {
127964
+ const snapshotGoal = payload.snapshot.goal;
127965
+ const displayGoal = snapshotGoal ?? previousGoal;
127966
+ const kind = legacyStatusKind(payload);
127967
+ const goalStatus = {
127968
+ type: "goal_status",
127969
+ kind,
127970
+ condition: displayGoal?.objective ?? "",
127971
+ ...displayGoal ? { iterations: displayGoal.turnCount } : {},
127972
+ ...displayGoal ? { setAt: displayGoal.createdAt } : {},
127973
+ ...displayGoal ? { durationMs: displayGoal.activeTimeMs } : {},
127974
+ ...displayGoal?.lastReason === void 0 ? {} : { lastReason: displayGoal.lastReason }
127975
+ };
127976
+ const terminalKind = kind === "achieved" || kind === "failed" || kind === "aborted" ? kind : void 0;
127977
+ return {
127978
+ activeGoal: snapshotGoal?.status === "active" ? {
127979
+ condition: snapshotGoal.objective,
127980
+ iterations: snapshotGoal.turnCount,
127981
+ setAt: snapshotGoal.createdAt,
127982
+ ...snapshotGoal.lastReason === void 0 ? {} : { lastReason: snapshotGoal.lastReason }
127983
+ } : null,
127984
+ goalStatus,
127985
+ goalTerminal: terminalKind && displayGoal ? {
127986
+ kind: terminalKind,
127987
+ condition: displayGoal.objective,
127988
+ iterations: displayGoal.turnCount,
127989
+ durationMs: displayGoal.activeTimeMs,
127990
+ ...displayGoal.lastReason === void 0 ? {} : { lastReason: displayGoal.lastReason }
127991
+ } : null
127992
+ };
127993
+ }
127994
+ __name(projectGoalStateToLegacy, "projectGoalStateToLegacy");
128360
127995
  function isGoalCheckpointBookkeepingTransition(previous, next) {
128361
127996
  const previousGoal = previous?.goal;
128362
127997
  const nextGoal = next.goal;
@@ -128373,6 +128008,41 @@ function isGoalCheckpointBookkeepingRecord(input) {
128373
128008
  return isGoalCheckpointBookkeepingTransition(input.previous, input.next) && isGoalCheckpointBookkeepingCause(input.cause, input.previousCause);
128374
128009
  }
128375
128010
  __name(isGoalCheckpointBookkeepingRecord, "isGoalCheckpointBookkeepingRecord");
128011
+ function legacyStatusKind(payload) {
128012
+ switch (payload.cause) {
128013
+ case "create":
128014
+ case "replace":
128015
+ case "edit":
128016
+ case "resume":
128017
+ return "set";
128018
+ case "complete":
128019
+ return "achieved";
128020
+ case "clear":
128021
+ return "cleared";
128022
+ // A migrated goal is always persisted `paused` (`createMigratedGoalState`),
128023
+ // and nothing drives a paused goal. Projecting it as `set` would re-assert
128024
+ // "active" to every client that derives the live goal from the newest card,
128025
+ // leaving a phantom running goal behind a resumed pre-v2 transcript.
128026
+ case "migrated":
128027
+ case "pause":
128028
+ return "paused";
128029
+ case "blocked":
128030
+ case "usage_limited":
128031
+ return "aborted";
128032
+ case "turn_finished":
128033
+ case "checkpoint":
128034
+ case "verifier_accept":
128035
+ case "verifier_reject":
128036
+ return payload.snapshot.goal?.status === "complete" ? "achieved" : payload.snapshot.goal?.status === "blocked" || payload.snapshot.goal?.status === "usage_limited" ? "aborted" : "checking";
128037
+ default:
128038
+ return assertNever(payload.cause);
128039
+ }
128040
+ }
128041
+ __name(legacyStatusKind, "legacyStatusKind");
128042
+ function assertNever(value) {
128043
+ throw new Error(`Unsupported Goal state cause: ${String(value)}`);
128044
+ }
128045
+ __name(assertNever, "assertNever");
128376
128046
 
128377
128047
  // packages/core/src/goals/goal-verifier.ts
128378
128048
  init_esbuild_shims();
@@ -135323,7 +134993,7 @@ ${body}
135323
134993
  if ((postToolUseAdditionalContext || reminderEnvelope) && typeof content === "string" && !content.startsWith(TOOL_OUTPUT_TRUNCATED_PREFIX)) {
135324
134994
  const baseThreshold = perToolMax ?? this.config.getTruncateToolOutputThreshold();
135325
134995
  const combinedLines = perToolMax !== void 0 ? Number.POSITIVE_INFINITY : this.config.getTruncateToolOutputLines() * 2;
135326
- if (content.length > baseThreshold * 2) {
134996
+ if (content.length > baseThreshold * COMBINED_PASS_TOLERANCE_FACTOR) {
135327
134997
  try {
135328
134998
  const contentBeforeRecombination = content;
135329
134999
  const recombined = await truncateToolOutput(
@@ -135331,7 +135001,7 @@ ${body}
135331
135001
  toolName,
135332
135002
  content,
135333
135003
  {
135334
- threshold: baseThreshold * 2,
135004
+ threshold: baseThreshold * COMBINED_PASS_TOLERANCE_FACTOR,
135335
135005
  lines: combinedLines,
135336
135006
  keep: perToolKeep
135337
135007
  },
@@ -137724,8 +137394,8 @@ function validateForkProfileName(name) {
137724
137394
  }
137725
137395
  __name(validateForkProfileName, "validateForkProfileName");
137726
137396
  function isWithinDirectory(directory, candidate) {
137727
- const relative20 = path93.relative(directory, candidate);
137728
- return relative20 === "" || relative20 !== ".." && !relative20.startsWith(`..${path93.sep}`) && !path93.isAbsolute(relative20);
137397
+ const relative19 = path93.relative(directory, candidate);
137398
+ return relative19 === "" || relative19 !== ".." && !relative19.startsWith(`..${path93.sep}`) && !path93.isAbsolute(relative19);
137729
137399
  }
137730
137400
  __name(isWithinDirectory, "isWithinDirectory");
137731
137401
  function throwForkProfileReadError(error, requestedName, profilePath) {
@@ -137956,14 +137626,6 @@ async function resolveExternalWorktreeDir(config, workingDir) {
137956
137626
  }
137957
137627
  const repoRoot = await probe.getRepoTopLevel() ?? parentCwd;
137958
137628
  const wtService = repoRoot === parentCwd ? probe : new GitWorktreeService(repoRoot);
137959
- const realRepoRoot = await fs89.realpath(repoRoot).catch(() => repoRoot);
137960
- const realResolved = await fs89.realpath(resolvedPath).catch(() => resolvedPath);
137961
- const relToRepo = path94.relative(realRepoRoot, realResolved);
137962
- if (relToRepo.startsWith("..") || path94.isAbsolute(relToRepo)) {
137963
- return {
137964
- error: `working_dir "${resolvedPath}" resolves outside this repository (${realRepoRoot}). Pass a worktree that lives inside the repository.`
137965
- };
137966
- }
137967
137629
  if (!await wtService.isRegisteredLinkedWorktree(resolvedPath)) {
137968
137630
  return {
137969
137631
  error: `working_dir "${resolvedPath}" is not a registered linked worktree of this repository (it is the main working tree, is absent from \`git worktree list\`, or its git metadata could not be read) \u2014 pinning a sub-agent there would not isolate it. Pass a worktree created via \`git worktree add\`.`
@@ -137986,6 +137648,10 @@ var TEAM_AGENT_PLAN_REQUIRED_PROPERTY = {
137986
137648
  type: "boolean",
137987
137649
  description: "When true, the named teammate starts in plan mode and must call exit_plan_mode to request leader approval before executing. Only valid with a named teammate in an active team."
137988
137650
  };
137651
+ var TEAM_AGENT_READ_ONLY_PROPERTY = {
137652
+ type: "boolean",
137653
+ description: "When true, the named teammate can only inspect the checkout and use team coordination tools. Shell, file writes, memory, schedules, and nested agents are blocked by an execution allowlist."
137654
+ };
137989
137655
  function approvalModeToPermissionMode2(mode) {
137990
137656
  switch (mode) {
137991
137657
  case "yolo" /* YOLO */:
@@ -138225,11 +137891,12 @@ var AgentTool = class _AgentTool extends BaseDeclarativeTool {
138225
137891
  run_in_background: {
138226
137892
  type: "boolean",
138227
137893
  default: true,
138228
- description: "Defaults to true for top-level regular subagents. Set to false to run a regular agent in the foreground and return its result inline. Set to true for an interactive fork to receive its completion notification; headless forks always run in the background. Nested agents run in the foreground unless run_in_background is explicitly true, which is rejected because they cannot receive background completion notifications. Caller-owned working_dir launches default to foreground and cannot run in the background."
137894
+ description: "Defaults to true for top-level regular subagents. Set to false to run a regular agent in the foreground and return its result inline. Set to true for an interactive fork to receive its completion notification; headless forks always run in the background. Nested agents run in the foreground unless run_in_background is explicitly true, which is rejected because they cannot receive background completion notifications. Unnamed caller-owned working_dir launches default to foreground. Named teammates may run in the background, but must be shut down before their caller-owned worktree is removed."
138229
137895
  },
138230
137896
  ...config.isAgentTeamEnabled() ? {
138231
137897
  name: TEAM_AGENT_NAME_PROPERTY,
138232
- plan_mode_required: TEAM_AGENT_PLAN_REQUIRED_PROPERTY
137898
+ plan_mode_required: TEAM_AGENT_PLAN_REQUIRED_PROPERTY,
137899
+ read_only: TEAM_AGENT_READ_ONLY_PROPERTY
138233
137900
  } : {},
138234
137901
  isolation: {
138235
137902
  type: "string",
@@ -138238,7 +137905,7 @@ var AgentTool = class _AgentTool extends BaseDeclarativeTool {
138238
137905
  },
138239
137906
  working_dir: {
138240
137907
  type: "string",
138241
- description: "Pin the sub-agent's working directory to an EXISTING git worktree of this repo (absolute path, or relative to the current directory). Unlike 'isolation', the worktree is NOT created or cleaned up \u2014 the caller owns its lifecycle. The sub-agent's cwd-relative file and shell operations resolve inside this directory, and search tools (grep, glob) default to it as their root. This is a cwd pin, not a filesystem sandbox \u2014 file, shell, and search tools can still be pointed outside via an explicit absolute path. Must be a worktree already registered against the current repository, and must live inside it. If both working_dir and isolation are provided, isolation is ignored and the caller-owned worktree is reused."
137908
+ description: "Pin a sub-agent or named teammate to an EXISTING, caller-owned git worktree of this repo (absolute path, or relative to the current directory). Unlike 'isolation', the worktree is NOT created or cleaned up by Agent. Relative file, shell, and search operations resolve inside it. This is a cwd pin, not a filesystem sandbox: explicit absolute paths can still reach outside. The path must be a registered linked worktree of this repository. If both working_dir and isolation are provided, isolation is ignored."
138242
137909
  }
138243
137910
  },
138244
137911
  required: ["description", "prompt"],
@@ -138308,7 +137975,7 @@ var AgentTool = class _AgentTool extends BaseDeclarativeTool {
138308
137975
  } else {
138309
137976
  subagentDescriptions = this.availableSubagents.map((subagent) => `- **${subagent.name}**: ${subagent.description}`).join("\n");
138310
137977
  }
138311
- const teamGuidance = this.config.isAgentTeamEnabled() ? `**For tasks requiring multiple agents to coordinate, communicate, or work as a team**: Use ${ToolNames.TEAM_CREATE} first to create a team, then spawn teammates using the Agent tool with the \`name\` parameter (the active team is selected automatically). Teams enable message passing between agents, shared task lists, and coordinated workflows. If the user asks for agents to collaborate, review each other's work, or produce a consolidated result \u2014 create a team.` : "";
137978
+ const teamGuidance = this.config.isAgentTeamEnabled() ? `**For tasks requiring multiple agents to coordinate, communicate, or work as a team**: Use ${ToolNames.TEAM_CREATE} first to create a team, then spawn teammates using the Agent tool with explicit \`name\` and \`subagent_type\` parameters (the active team is selected automatically). Set \`read_only: true\` for investigation teammates. A single writer teammate may be pinned to a leader-owned Git worktree with \`working_dir\`; shut it down before removing that worktree. Teams enable message passing between agents, shared task lists, and coordinated workflows. If the user asks for agents to collaborate, review each other's work, or produce a consolidated result \u2014 create a team.` : "";
138312
137979
  const baseDescription = `Launch a new agent to handle complex, multi-step tasks autonomously.
138313
137980
  The Agent tool launches specialized agents (subprocesses) that autonomously handle complex tasks. Each agent type has specific capabilities and tools available to it.
138314
137981
 
@@ -138341,7 +138008,7 @@ Usage notes:
138341
138008
  - Clearly tell the agent whether you expect it to write code or just to do research (search, file reads, web fetches, etc.), since it is not aware of the user's intent
138342
138009
  - If the agent description mentions that it should be used proactively, then you should try your best to use it without the user having to ask for it first. Use your judgement.
138343
138010
  - If the user asks for agents "in parallel", group independent launches in a single message with multiple Agent tool use content blocks. Do not parallelize overlapping code changes.
138344
- - Top-level regular subagents run in the background by default. Set \`run_in_background: false\` when the current turn must wait for the result before continuing. Nested agent launches run in the foreground and return to their direct parent; an explicit \`run_in_background: true\` request is rejected because nested agents cannot receive background completion notifications. Caller-owned \`working_dir\` launches default to foreground and cannot run in the background.
138011
+ - Top-level regular subagents run in the background by default. Set \`run_in_background: false\` when the current turn must wait for the result before continuing. Nested agent launches run in the foreground and return to their direct parent; an explicit \`run_in_background: true\` request is rejected because nested agents cannot receive background completion notifications. Unnamed caller-owned \`working_dir\` launches default to foreground and cannot run in the background; named teammates may use one, but must be shut down before it is removed.
138345
138012
  - You can optionally set \`isolation: "worktree"\` to run the agent in a temporary git worktree, giving it an isolated copy of the repository. The worktree is automatically cleaned up if the agent makes no changes; if changes are made, the worktree path and branch are returned in the result so you can review or merge them.
138346
138013
  ## When to fork
138347
138014
 
@@ -138402,9 +138069,11 @@ assistant: Uses the ${ToolNames.AGENT} tool to launch the test-runner agent
138402
138069
  if (this.config.isAgentTeamEnabled()) {
138403
138070
  schema.properties.name = TEAM_AGENT_NAME_PROPERTY;
138404
138071
  schema.properties.plan_mode_required = TEAM_AGENT_PLAN_REQUIRED_PROPERTY;
138072
+ schema.properties.read_only = TEAM_AGENT_READ_ONLY_PROPERTY;
138405
138073
  } else {
138406
138074
  delete schema.properties.name;
138407
138075
  delete schema.properties.plan_mode_required;
138076
+ delete schema.properties.read_only;
138408
138077
  }
138409
138078
  const availableGrades = [
138410
138079
  ...this.subagentManager.getAvailableModelGrades().keys()
@@ -138511,6 +138180,9 @@ assistant: Uses the ${ToolNames.AGENT} tool to launch the test-runner agent
138511
138180
  if (!params.subagent_type || params.subagent_type.toLowerCase() === FORK_SUBAGENT_TYPE) {
138512
138181
  return 'Parameter "isolation" requires an explicit subagent_type (and cannot be "fork").';
138513
138182
  }
138183
+ if (params.name && params.working_dir === void 0 && !isTeammate() && isTopLevelSession() && this.config.getTeamManager()) {
138184
+ return 'Parameter "isolation" cannot be used for a named teammate. Create a leader-owned worktree first, then pass it with "working_dir".';
138185
+ }
138514
138186
  }
138515
138187
  if (params.isolation === "worktree" && typeof params.working_dir === "string" && params.working_dir.trim().length === 0) {
138516
138188
  params.working_dir = void 0;
@@ -138519,7 +138191,7 @@ assistant: Uses the ${ToolNames.AGENT} tool to launch the test-runner agent
138519
138191
  if (typeof params.working_dir !== "string" || params.working_dir.trim().length === 0) {
138520
138192
  return 'Parameter "working_dir" must be a non-empty string when set.';
138521
138193
  }
138522
- if (params.run_in_background === true) {
138194
+ if (params.run_in_background === true && params.name === void 0) {
138523
138195
  return 'Parameters "working_dir" and "run_in_background" are incompatible: the caller owns the worktree lifecycle and could remove it while a background agent is still running.';
138524
138196
  }
138525
138197
  if (!params.subagent_type || params.subagent_type.toLowerCase() === FORK_SUBAGENT_TYPE) {
@@ -138539,6 +138211,22 @@ assistant: Uses the ${ToolNames.AGENT} tool to launch the test-runner agent
138539
138211
  }
138540
138212
  }
138541
138213
  }
138214
+ if (params.read_only !== void 0) {
138215
+ if (typeof params.read_only !== "boolean") {
138216
+ return 'Parameter "read_only" must be a boolean when set.';
138217
+ }
138218
+ if (params.read_only) {
138219
+ if (!params.name || typeof params.name !== "string" || params.name.trim() === "") {
138220
+ return 'Parameter "read_only" requires a named teammate via "name".';
138221
+ }
138222
+ if (!this.config.getTeamManager()) {
138223
+ return 'Parameter "read_only" requires an active team.';
138224
+ }
138225
+ if (params.plan_mode_required === true) {
138226
+ return 'Parameters "read_only" and "plan_mode_required" cannot be used together.';
138227
+ }
138228
+ }
138229
+ }
138542
138230
  return null;
138543
138231
  }
138544
138232
  createInvocation(params) {
@@ -139247,6 +138935,24 @@ var AgentToolInvocation = class extends BaseToolInvocation {
139247
138935
  };
139248
138936
  }
139249
138937
  }
138938
+ if (this.params.read_only === true) {
138939
+ if (!this.params.name || this.params.name.trim() === "" || isSubagentLikeExecutionContext()) {
138940
+ const msg = "read_only can only be used when spawning a named teammate from the team leader.";
138941
+ return {
138942
+ llmContent: msg,
138943
+ returnDisplay: msg,
138944
+ error: { message: msg }
138945
+ };
138946
+ }
138947
+ if (!this.config.getTeamManager()) {
138948
+ const msg = "read_only requires an active team. Use TeamCreate first.";
138949
+ return {
138950
+ llmContent: msg,
138951
+ returnDisplay: msg,
138952
+ error: { message: msg }
138953
+ };
138954
+ }
138955
+ }
139250
138956
  if (this.params.name && !isTeammate() && isTopLevelSession()) {
139251
138957
  if (!this.config.getTeamManager()) {
139252
138958
  debugLogger127.debug(
@@ -139257,10 +138963,10 @@ var AgentToolInvocation = class extends BaseToolInvocation {
139257
138963
  'Error: "model" is not supported for a named teammate.',
139258
138964
  "model is incompatible with a named teammate"
139259
138965
  );
139260
- } else if (this.params.working_dir !== void 0) {
138966
+ } else if (this.params.isolation !== void 0) {
139261
138967
  return this.buildSpawnBlockedResult(
139262
- 'Error: "working_dir" is not supported for a named teammate \u2014 a teammate runs in the parent working tree, so the worktree pin would be silently ignored. Drop "name" to pin a one-shot sub-agent to the worktree, or drop "working_dir".',
139263
- "working_dir is incompatible with a named teammate"
138968
+ 'Error: "isolation" cannot be used for a named teammate. Create a leader-owned worktree first, then pass it with "working_dir".',
138969
+ "isolation is incompatible with a named teammate"
139264
138970
  );
139265
138971
  } else {
139266
138972
  return this.executeTeammate(this.params.name, signal, updateOutput);
@@ -140560,16 +140266,37 @@ ${partial}${wtSuffix}`
140560
140266
  status: "running"
140561
140267
  });
140562
140268
  try {
140269
+ let cwd = this.config.getCwd();
140270
+ if (this.params.working_dir) {
140271
+ const resolved = await resolveExternalWorktreeDir(
140272
+ this.config,
140273
+ this.params.working_dir
140274
+ );
140275
+ if ("error" in resolved) {
140276
+ return this.buildSpawnBlockedResult(
140277
+ `Error: ${resolved.error}`,
140278
+ "Invalid teammate working_dir"
140279
+ );
140280
+ }
140281
+ cwd = resolved.path;
140282
+ }
140283
+ if (signal?.aborted) {
140284
+ return {
140285
+ llmContent: `Teammate spawn aborted before "${name}" was registered.`,
140286
+ returnDisplay: `Teammate spawn aborted.`,
140287
+ error: { message: "Aborted." }
140288
+ };
140289
+ }
140563
140290
  await teamManager.spawnTeammate({
140564
140291
  name,
140565
140292
  prompt: this.params.prompt,
140566
140293
  agentType: this.params.subagent_type,
140567
- cwd: this.config.getCwd(),
140568
- planModeRequired: this.params.plan_mode_required === true
140294
+ cwd,
140295
+ planModeRequired: this.params.plan_mode_required === true,
140296
+ readOnly: this.params.read_only === true
140569
140297
  });
140570
- const msg = `Teammate "${name}" is now running concurrently. Task: ${this.params.description}
140571
-
140572
- You will receive their messages as they arrive. Do NOT call task_list to check on them \u2014 teammates report results via send_message. Spawn more teammates or end your turn and wait.`;
140298
+ const msg = `Teammate "${name}" is now running concurrently. Task: ${this.params.description}` + (this.params.read_only ? "\nMode: enforced read-only." : "") + (this.params.working_dir ? `
140299
+ Worktree: ${cwd}` : "") + "\n\nYou will receive their messages as they arrive. Do NOT call task_list to check on them \u2014 teammates report results via send_message. Spawn more teammates or end your turn and wait.";
140573
140300
  return { llmContent: msg, returnDisplay: msg };
140574
140301
  } catch (error) {
140575
140302
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -141094,7 +140821,7 @@ __name(runAutoMemoryExtractionByAgent, "runAutoMemoryExtractionByAgent");
141094
140821
  var debugLogger130 = createDebugLogger("AUTO_MEMORY_EXTRACT");
141095
140822
  async function readExtractCursor(projectRoot) {
141096
140823
  try {
141097
- const content = await fs90.readFile(
140824
+ const content = await fs89.readFile(
141098
140825
  getAutoMemoryExtractCursorPath(projectRoot),
141099
140826
  "utf-8"
141100
140827
  );
@@ -141119,7 +140846,7 @@ async function writeExtractCursor(projectRoot, cursor) {
141119
140846
  __name(writeExtractCursor, "writeExtractCursor");
141120
140847
  async function bumpMetadata(projectRoot, now, sessionId, touchedTopics) {
141121
140848
  try {
141122
- const content = await fs90.readFile(
140849
+ const content = await fs89.readFile(
141123
140850
  getAutoMemoryMetadataPath(projectRoot),
141124
140851
  "utf-8"
141125
140852
  );
@@ -141216,7 +140943,7 @@ __name(runAutoMemoryExtract, "runAutoMemoryExtract");
141216
140943
 
141217
140944
  // packages/core/src/memory/forget.ts
141218
140945
  init_esbuild_shims();
141219
- import * as fs91 from "node:fs/promises";
140946
+ import * as fs90 from "node:fs/promises";
141220
140947
 
141221
140948
  // packages/core/src/memory/entries.ts
141222
140949
  init_esbuild_shims();
@@ -141507,7 +141234,7 @@ async function selectManagedAutoMemoryForgetCandidates(projectRoot, query, optio
141507
141234
  __name(selectManagedAutoMemoryForgetCandidates, "selectManagedAutoMemoryForgetCandidates");
141508
141235
  async function bumpMetadata2(projectRoot, now) {
141509
141236
  try {
141510
- const content = await fs91.readFile(
141237
+ const content = await fs90.readFile(
141511
141238
  getAutoMemoryMetadataPath(projectRoot),
141512
141239
  "utf-8"
141513
141240
  );
@@ -141552,12 +141279,12 @@ async function forgetManagedAutoMemoryMatches(projectRoot, matches, now = /* @__
141552
141279
  for (const [filePath, fileMatches] of matchesByFile) {
141553
141280
  try {
141554
141281
  options2.abortSignal?.throwIfAborted();
141555
- const rawContent = await fs91.readFile(filePath, "utf-8");
141282
+ const rawContent = await fs90.readFile(filePath, "utf-8");
141556
141283
  options2.abortSignal?.throwIfAborted();
141557
141284
  const fmMatch = rawContent.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);
141558
141285
  if (!fmMatch) {
141559
141286
  options2.abortSignal?.throwIfAborted();
141560
- await fs91.unlink(filePath);
141287
+ await fs90.unlink(filePath);
141561
141288
  removedEntries.push(...fileMatches);
141562
141289
  for (const m2 of fileMatches) touchedTopics.add(m2.topic);
141563
141290
  touchedScopes.add(classifyMemoryScope(filePath, projectRoot));
@@ -141599,7 +141326,7 @@ async function forgetManagedAutoMemoryMatches(projectRoot, matches, now = /* @__
141599
141326
  }
141600
141327
  if (kept.length === 0) {
141601
141328
  options2.abortSignal?.throwIfAborted();
141602
- await fs91.unlink(filePath);
141329
+ await fs90.unlink(filePath);
141603
141330
  } else {
141604
141331
  const heading2 = getAutoMemoryBodyHeading(rawBody);
141605
141332
  const newBody = renderAutoMemoryBody(heading2, kept);
@@ -141717,7 +141444,7 @@ Return a list of filenames for the memories that will clearly be useful to the a
141717
141444
  - If you are unsure if a memory will be useful in processing the user's query, then do not include it in your list. Be selective and discerning.
141718
141445
  - If there are no memories in the list that would clearly be useful, feel free to return an empty list.
141719
141446
  - If a list of recently-used tools is provided, do not select memories that are usage reference, API documentation, parameter schemas, field mappings, guessed call formats, or failed-call transcripts for those tools. Live tool definitions are the source of truth. Do still select durable operational context that cannot be obtained from the live schema, such as credentials location, ownership, external escalation paths, known gotchas, warnings, or confirmed workarounds.`;
141720
- var RESPONSE_SCHEMA3 = {
141447
+ var RESPONSE_SCHEMA2 = {
141721
141448
  type: "object",
141722
141449
  properties: {
141723
141450
  selected_memories: {
@@ -141762,7 +141489,7 @@ ${manifest}${toolsSection}`
141762
141489
  const response = await runSideQuery(config, {
141763
141490
  purpose: "auto-memory-recall",
141764
141491
  contents,
141765
- schema: RESPONSE_SCHEMA3,
141492
+ schema: RESPONSE_SCHEMA2,
141766
141493
  skipOutputLanguagePreference: true,
141767
141494
  // Caller (`GeminiClient.MemoryPrefetchHandle`) owns lifecycle and aborts
141768
141495
  // via its controller on cleanup paths. The 30 s ceiling is a generous
@@ -142088,10 +141815,10 @@ __name(resolveRelevantAutoMemoryPromptForQuery, "resolveRelevantAutoMemoryPrompt
142088
141815
 
142089
141816
  // packages/core/src/memory/status.ts
142090
141817
  init_esbuild_shims();
142091
- import * as fs92 from "node:fs/promises";
141818
+ import * as fs91 from "node:fs/promises";
142092
141819
  async function readJsonFile(filePath) {
142093
141820
  try {
142094
- const content = await fs92.readFile(filePath, "utf-8");
141821
+ const content = await fs91.readFile(filePath, "utf-8");
142095
141822
  return JSON.parse(content);
142096
141823
  } catch {
142097
141824
  return void 0;
@@ -142102,7 +141829,7 @@ async function getManagedAutoMemoryStatus(projectRoot, manager) {
142102
141829
  const root = getAutoMemoryRoot(projectRoot);
142103
141830
  const indexPath = getAutoMemoryIndexPath(projectRoot);
142104
141831
  const [indexContent, cursor, metadata, docs] = await Promise.all([
142105
- fs92.readFile(indexPath, "utf-8").catch(() => ""),
141832
+ fs91.readFile(indexPath, "utf-8").catch(() => ""),
142106
141833
  readJsonFile(
142107
141834
  getAutoMemoryExtractCursorPath(projectRoot)
142108
141835
  ),
@@ -142138,7 +141865,7 @@ __name(getManagedAutoMemoryStatus, "getManagedAutoMemoryStatus");
142138
141865
 
142139
141866
  // packages/core/src/memory/pending-skills.ts
142140
141867
  init_esbuild_shims();
142141
- import { promises as fs93 } from "node:fs";
141868
+ import { promises as fs92 } from "node:fs";
142142
141869
  import * as path96 from "node:path";
142143
141870
  var debugLogger133 = createDebugLogger("AUTO_SKILL_PENDING");
142144
141871
  function parseDescription(content) {
@@ -142174,7 +141901,7 @@ async function stageSkillDirs(touchedFiles, projectRoot, preExistingDirNames = /
142174
141901
  const finalManifestPath = path96.join(skillsRoot, dirName, SKILL_FILE_NAME);
142175
141902
  let content;
142176
141903
  try {
142177
- content = await fs93.readFile(finalManifestPath, "utf-8");
141904
+ content = await fs92.readFile(finalManifestPath, "utf-8");
142178
141905
  } catch (err) {
142179
141906
  debugLogger133.debug(
142180
141907
  `Not staging "${dirName}": ${err instanceof Error ? err.message : String(err)}`
@@ -142182,9 +141909,9 @@ async function stageSkillDirs(touchedFiles, projectRoot, preExistingDirNames = /
142182
141909
  continue;
142183
141910
  }
142184
141911
  const stagedDir = path96.join(pendingRoot, taskId, dirName);
142185
- await fs93.mkdir(path96.dirname(stagedDir), { recursive: true });
142186
- await fs93.rm(stagedDir, { recursive: true, force: true });
142187
- await fs93.rename(skillDir, stagedDir);
141912
+ await fs92.mkdir(path96.dirname(stagedDir), { recursive: true });
141913
+ await fs92.rm(stagedDir, { recursive: true, force: true });
141914
+ await fs92.rename(skillDir, stagedDir);
142188
141915
  debugLogger133.debug(`Staged "${dirName}" for confirmation.`);
142189
141916
  result.push({
142190
141917
  name: dirName,
@@ -142200,10 +141927,10 @@ async function acceptPendingSkill(pending) {
142200
141927
  const stagedDir = path96.dirname(pending.stagedManifestPath);
142201
141928
  const finalDir = path96.dirname(pending.finalManifestPath);
142202
141929
  try {
142203
- await fs93.access(stagedDir);
141930
+ await fs92.access(stagedDir);
142204
141931
  } catch {
142205
141932
  try {
142206
- await fs93.access(finalDir);
141933
+ await fs92.access(finalDir);
142207
141934
  debugLogger133.debug(
142208
141935
  `Accept no-op "${pending.name}": already in the skills library.`
142209
141936
  );
@@ -142214,15 +141941,15 @@ async function acceptPendingSkill(pending) {
142214
141941
  );
142215
141942
  }
142216
141943
  }
142217
- await fs93.mkdir(path96.dirname(finalDir), { recursive: true });
142218
- await fs93.rm(finalDir, { recursive: true, force: true });
142219
- await fs93.rename(stagedDir, finalDir);
141944
+ await fs92.mkdir(path96.dirname(finalDir), { recursive: true });
141945
+ await fs92.rm(finalDir, { recursive: true, force: true });
141946
+ await fs92.rename(stagedDir, finalDir);
142220
141947
  debugLogger133.debug(`Accepted "${pending.name}" into the skills library.`);
142221
141948
  }
142222
141949
  __name(acceptPendingSkill, "acceptPendingSkill");
142223
141950
  async function rejectPendingSkill(pending) {
142224
141951
  const stagedDir = path96.dirname(pending.stagedManifestPath);
142225
- await fs93.rm(stagedDir, { recursive: true, force: true });
141952
+ await fs92.rm(stagedDir, { recursive: true, force: true });
142226
141953
  debugLogger133.debug(`Discarded staged skill "${pending.name}".`);
142227
141954
  }
142228
141955
  __name(rejectPendingSkill, "rejectPendingSkill");
@@ -142293,7 +142020,7 @@ function isProcessRunning(pid) {
142293
142020
  }
142294
142021
  __name(isProcessRunning, "isProcessRunning");
142295
142022
  async function readDreamMetadata(projectRoot) {
142296
- const content = await fs94.readFile(
142023
+ const content = await fs93.readFile(
142297
142024
  getAutoMemoryMetadataPath(projectRoot),
142298
142025
  "utf-8"
142299
142026
  );
@@ -142321,7 +142048,7 @@ async function defaultSessionScanner(projectRoot, sinceMs, excludeSessionId) {
142321
142048
  const chatsDir = path97.join(new Storage(projectRoot).getProjectDir(), "chats");
142322
142049
  let names;
142323
142050
  try {
142324
- names = await fs94.readdir(chatsDir);
142051
+ names = await fs93.readdir(chatsDir);
142325
142052
  } catch {
142326
142053
  return [];
142327
142054
  }
@@ -142332,7 +142059,7 @@ async function defaultSessionScanner(projectRoot, sinceMs, excludeSessionId) {
142332
142059
  const sessionId = name.slice(0, -".jsonl".length);
142333
142060
  if (sessionId === excludeSessionId) return;
142334
142061
  try {
142335
- const stats = await fs94.stat(path97.join(chatsDir, name));
142062
+ const stats = await fs93.stat(path97.join(chatsDir, name));
142336
142063
  if (stats.mtimeMs > sinceMs) results.push(sessionId);
142337
142064
  } catch {
142338
142065
  }
@@ -142347,8 +142074,8 @@ async function dreamLockExists(projectRoot) {
142347
142074
  let holderPid;
142348
142075
  try {
142349
142076
  const [stats, content] = await Promise.all([
142350
- fs94.stat(lockPath),
142351
- fs94.readFile(lockPath, "utf-8").catch(() => "")
142077
+ fs93.stat(lockPath),
142078
+ fs93.readFile(lockPath, "utf-8").catch(() => "")
142352
142079
  ]);
142353
142080
  mtimeMs = stats.mtimeMs;
142354
142081
  const parsed = parseInt(content.trim(), 10);
@@ -142359,15 +142086,15 @@ async function dreamLockExists(projectRoot) {
142359
142086
  const ageMs = Date.now() - mtimeMs;
142360
142087
  if (ageMs <= DREAM_LOCK_STALE_MS) {
142361
142088
  if (holderPid !== void 0 && isProcessRunning(holderPid)) return true;
142362
- await fs94.rm(lockPath, { force: true });
142089
+ await fs93.rm(lockPath, { force: true });
142363
142090
  return false;
142364
142091
  }
142365
- await fs94.rm(lockPath, { force: true });
142092
+ await fs93.rm(lockPath, { force: true });
142366
142093
  return false;
142367
142094
  }
142368
142095
  __name(dreamLockExists, "dreamLockExists");
142369
142096
  async function acquireDreamLock(projectRoot) {
142370
- await fs94.writeFile(
142097
+ await fs93.writeFile(
142371
142098
  getAutoMemoryConsolidationLockPath(projectRoot),
142372
142099
  String(process.pid),
142373
142100
  { flag: "wx" }
@@ -142375,7 +142102,7 @@ async function acquireDreamLock(projectRoot) {
142375
142102
  }
142376
142103
  __name(acquireDreamLock, "acquireDreamLock");
142377
142104
  async function releaseDreamLock(projectRoot) {
142378
- await fs94.rm(getAutoMemoryConsolidationLockPath(projectRoot), {
142105
+ await fs93.rm(getAutoMemoryConsolidationLockPath(projectRoot), {
142379
142106
  force: true
142380
142107
  });
142381
142108
  }
@@ -142862,7 +142589,7 @@ var MemoryManager = class {
142862
142589
  return { status: "skipped", skippedReason: "min_sessions" };
142863
142590
  }
142864
142591
  if (this.dreamLockReleaseFailed) {
142865
- await fs94.rm(getAutoMemoryConsolidationLockPath(params.projectRoot), {
142592
+ await fs93.rm(getAutoMemoryConsolidationLockPath(params.projectRoot), {
142866
142593
  force: true
142867
142594
  }).catch(() => {
142868
142595
  });
@@ -143174,7 +142901,7 @@ var CHECK_PROMPT = `Analyze *only* the content and structure of your immediately
143174
142901
  1. **Model Continues:** If your last response explicitly states an immediate next action *you* intend to take (e.g., "Next, I will...", "Now I'll process...", "Moving on to analyze...", indicates an intended tool call that didn't execute), OR if the response seems clearly incomplete (cut off mid-thought without a natural conclusion), then the **'model'** should speak next.
143175
142902
  2. **Question to User:** If your last response ends with a direct question specifically addressed *to the user*, then the **'user'** should speak next.
143176
142903
  3. **Waiting for User:** If your last response completed a thought, statement, or task *and* does not meet the criteria for Rule 1 (Model Continues) or Rule 2 (Question to User), it implies a pause expecting user input or reaction. In this case, the **'user'** should speak next.`;
143177
- var RESPONSE_SCHEMA4 = {
142904
+ var RESPONSE_SCHEMA3 = {
143178
142905
  type: "object",
143179
142906
  properties: {
143180
142907
  reasoning: {
@@ -143222,7 +142949,7 @@ async function checkNextSpeaker(chat, config, abortSignal, promptId) {
143222
142949
  try {
143223
142950
  return await runSideQuery(config, {
143224
142951
  contents,
143225
- schema: RESPONSE_SCHEMA4,
142952
+ schema: RESPONSE_SCHEMA3,
143226
142953
  abortSignal,
143227
142954
  promptId,
143228
142955
  purpose: "next-speaker",
@@ -146055,7 +145782,7 @@ The current date is: ${today}. Note: This is the authoritative current date \u20
146055
145782
 
146056
145783
  // packages/core/src/services/worktreeCleanup.ts
146057
145784
  init_esbuild_shims();
146058
- import * as fs95 from "node:fs/promises";
145785
+ import * as fs94 from "node:fs/promises";
146059
145786
  import * as path98 from "node:path";
146060
145787
  var debugLogger137 = createDebugLogger("WORKTREE_CLEANUP");
146061
145788
  var EPHEMERAL_WORKTREE_PATTERNS = [
@@ -146072,13 +145799,13 @@ async function cleanupStaleAgentWorktrees(projectRoot, options2 = {}) {
146072
145799
  const service = new GitWorktreeService(projectRoot);
146073
145800
  const worktreesDir = service.getUserWorktreesDir();
146074
145801
  try {
146075
- await fs95.access(worktreesDir);
145802
+ await fs94.access(worktreesDir);
146076
145803
  } catch {
146077
145804
  return 0;
146078
145805
  }
146079
145806
  let entries;
146080
145807
  try {
146081
- entries = await fs95.readdir(worktreesDir, { withFileTypes: true });
145808
+ entries = await fs94.readdir(worktreesDir, { withFileTypes: true });
146082
145809
  } catch (error) {
146083
145810
  if (error.code === "ENOENT") {
146084
145811
  return 0;
@@ -146093,7 +145820,7 @@ async function cleanupStaleAgentWorktrees(projectRoot, options2 = {}) {
146093
145820
  const worktreePath = path98.join(worktreesDir, entry.name);
146094
145821
  let mtimeMs;
146095
145822
  try {
146096
- const stats = await fs95.stat(worktreePath);
145823
+ const stats = await fs94.stat(worktreePath);
146097
145824
  mtimeMs = stats.mtimeMs;
146098
145825
  } catch (error) {
146099
145826
  if (error.code !== "ENOENT") {
@@ -146163,7 +145890,7 @@ import { getHeapStatistics as getHeapStatistics2 } from "node:v8";
146163
145890
 
146164
145891
  // packages/core/src/services/memoryDiagnosticsDumper.ts
146165
145892
  init_esbuild_shims();
146166
- import * as fs96 from "node:fs";
145893
+ import * as fs95 from "node:fs";
146167
145894
  import * as path99 from "node:path";
146168
145895
  import * as v82 from "node:v8";
146169
145896
  var debugLogger138 = createDebugLogger("MEMORY_DUMP");
@@ -146238,7 +145965,7 @@ var MemoryDiagnosticsDumper = class {
146238
145965
  suggestion: this.getSuggestion(trigger),
146239
145966
  collectionComplete: false
146240
145967
  };
146241
- fs96.writeFileSync(
145968
+ fs95.writeFileSync(
146242
145969
  filePath,
146243
145970
  JSON.stringify(minimalPayload, null, 2),
146244
145971
  "utf8"
@@ -146259,7 +145986,7 @@ var MemoryDiagnosticsDumper = class {
146259
145986
  suggestion: this.getSuggestion(trigger),
146260
145987
  collectionComplete: true
146261
145988
  };
146262
- fs96.writeFileSync(filePath, JSON.stringify(fullPayload, null, 2), "utf8");
145989
+ fs95.writeFileSync(filePath, JSON.stringify(fullPayload, null, 2), "utf8");
146263
145990
  debugLogger138.info(
146264
145991
  `Phase 2 diagnostics written to ${filePath} (trigger=${trigger}, dump #${dumpNumber})`
146265
145992
  );
@@ -146274,7 +146001,7 @@ var MemoryDiagnosticsDumper = class {
146274
146001
  ensureDiagnosticsDir() {
146275
146002
  const projectDir = this.config.storage.getProjectDir();
146276
146003
  const diagnosticsDir = path99.join(projectDir, "diagnostics");
146277
- fs96.mkdirSync(diagnosticsDir, { recursive: true });
146004
+ fs95.mkdirSync(diagnosticsDir, { recursive: true });
146278
146005
  return diagnosticsDir;
146279
146006
  }
146280
146007
  collectSessionStats() {
@@ -146604,7 +146331,7 @@ var MemoryPressureMonitor = class extends EventEmitter8 {
146604
146331
  steps: ["evict_stale_cache"]
146605
146332
  };
146606
146333
  default:
146607
- return assertNever(pressure);
146334
+ return assertNever2(pressure);
146608
146335
  }
146609
146336
  }
146610
146337
  executeCleanup(recommendation) {
@@ -146832,7 +146559,7 @@ var MemoryPressureMonitor = class extends EventEmitter8 {
146832
146559
  break;
146833
146560
  }
146834
146561
  default:
146835
- return assertNever(step);
146562
+ return assertNever2(step);
146836
146563
  }
146837
146564
  }
146838
146565
  // Memory metrics
@@ -146916,7 +146643,7 @@ function cleanupActionRank(action) {
146916
146643
  case "none":
146917
146644
  return 0;
146918
146645
  default:
146919
- return assertNever(action);
146646
+ return assertNever2(action);
146920
146647
  }
146921
146648
  }
146922
146649
  __name(cleanupActionRank, "cleanupActionRank");
@@ -146928,10 +146655,10 @@ function formatMiB(bytes) {
146928
146655
  return (bytes / 1024 / 1024).toFixed(0);
146929
146656
  }
146930
146657
  __name(formatMiB, "formatMiB");
146931
- function assertNever(value) {
146658
+ function assertNever2(value) {
146932
146659
  throw new Error(`Unhandled memory pressure monitor value: ${String(value)}`);
146933
146660
  }
146934
- __name(assertNever, "assertNever");
146661
+ __name(assertNever2, "assertNever");
146935
146662
 
146936
146663
  // packages/core/src/prompts/prompt-registry.ts
146937
146664
  init_esbuild_shims();
@@ -147759,6 +147486,13 @@ var Config = class _Config {
147759
147486
  chatRecordingService = void 0;
147760
147487
  goalRuntime;
147761
147488
  goalRuntimeReady;
147489
+ /**
147490
+ * A Goal restore held back because the session writer is not accepting
147491
+ * writes yet. Settled by {@link startPendingGoalRestore} once the
147492
+ * recorder has its lease, or by {@link settlePendingGoalRestore} when the
147493
+ * writer never arrives.
147494
+ */
147495
+ pendingGoalRestore;
147762
147496
  goalTurnHost;
147763
147497
  goalTurnHostUnbind;
147764
147498
  goalTurnHostGeneration = 0;
@@ -148669,6 +148403,7 @@ var Config = class _Config {
148669
148403
  recorder.activate(lease, authoritative, persistedTitleInfo);
148670
148404
  this.pendingSessionWriterLease = void 0;
148671
148405
  lease = void 0;
148406
+ this.startPendingGoalRestore();
148672
148407
  } catch (error) {
148673
148408
  let failure = error;
148674
148409
  if (!(failure instanceof SessionWriterError) && failure && typeof failure === "object" && typeof failure.code === "string") {
@@ -148695,6 +148430,7 @@ var Config = class _Config {
148695
148430
  });
148696
148431
  }
148697
148432
  }
148433
+ this.settlePendingGoalRestore(failure);
148698
148434
  throw failure;
148699
148435
  }
148700
148436
  }
@@ -149106,7 +148842,12 @@ var Config = class _Config {
149106
148842
  void outgoingChatRecordingService?.flush().catch(() => {
149107
148843
  });
149108
148844
  const previousSessionId = this.sessionId;
149109
- this.sessionId = sessionId ?? randomUUID15();
148845
+ const nextSessionId = sessionId ?? randomUUID15();
148846
+ const isSessionTransition = nextSessionId !== previousSessionId;
148847
+ if (isSessionTransition) {
148848
+ logSessionEnd(this);
148849
+ }
148850
+ this.sessionId = nextSessionId;
149110
148851
  if (process8.env) {
149111
148852
  process8.env["QWEN_CODE_SESSION_ID"] = this.sessionId;
149112
148853
  }
@@ -149128,9 +148869,13 @@ var Config = class _Config {
149128
148869
  refreshSessionContext(this.sessionId);
149129
148870
  CommitAttributionService.resetInstance();
149130
148871
  if (this.initialized) {
149131
- logStartSession(this, new StartSessionEvent(this));
148872
+ logStartSession(
148873
+ this,
148874
+ new StartSessionEvent(this),
148875
+ sessionData && isSessionTransition ? previousSessionId : void 0
148876
+ );
149132
148877
  }
149133
- if (this.runtimeStatusEnabled && previousSessionId !== this.sessionId) {
148878
+ if (this.runtimeStatusEnabled && isSessionTransition) {
149134
148879
  const oldPath = this.storage.getRuntimeStatusPath(previousSessionId);
149135
148880
  const newPath = this.storage.getRuntimeStatusPath(this.sessionId);
149136
148881
  const cliVersion = this.cliVersion ?? null;
@@ -149403,6 +149148,45 @@ var Config = class _Config {
149403
149148
  }
149404
149149
  return reasoning.effort;
149405
149150
  }
149151
+ /**
149152
+ * Return a higher-priority static DashScope knob that shadows the current
149153
+ * global effort on qwen3.8-max, so interactive callers can report the
149154
+ * effective outcome instead of confirming a tier that will not reach the
149155
+ * wire. The provider resolves extra_body before samplingParams before the
149156
+ * unified reasoning setting; same-layer explicit effort still wins budget.
149157
+ */
149158
+ getReasoningEffortOverride() {
149159
+ const cfg = this.getContentGeneratorConfig();
149160
+ if (!cfg || !DashScopeOpenAICompatibleProvider.isDashScopeProvider(cfg) || !isTieredEffortWireModel(cfg.model)) {
149161
+ return void 0;
149162
+ }
149163
+ const currentEffort = this.getReasoningEffort();
149164
+ const selected = selectDashScopeThinkingKnob(
149165
+ cfg.model,
149166
+ cfg.extra_body,
149167
+ cfg.samplingParams,
149168
+ currentEffort
149169
+ );
149170
+ if (!selected || selected.source === "reasoning" || selected.field === "reasoning_effort" && selected.value === currentEffort) {
149171
+ return void 0;
149172
+ }
149173
+ if (selected.field === "enable_thinking" && selected.value === true) {
149174
+ if (selected.source !== "extra_body") {
149175
+ return void 0;
149176
+ }
149177
+ const below = selectDashScopeThinkingKnob(
149178
+ cfg.model,
149179
+ void 0,
149180
+ cfg.samplingParams,
149181
+ currentEffort
149182
+ );
149183
+ if (below?.source === "samplingParams" && below.field === "reasoning_effort" && below.value !== currentEffort) {
149184
+ return { source: below.source, field: below.field };
149185
+ }
149186
+ return void 0;
149187
+ }
149188
+ return { source: selected.source, field: selected.field };
149189
+ }
149406
149190
  /**
149407
149191
  * Update the reasoning-effort tier at runtime (e.g. `/effort high`). The
149408
149192
  * request pipeline reads `reasoning.effort` per request, so mutating the live
@@ -149726,20 +149510,20 @@ var Config = class _Config {
149726
149510
  }
149727
149511
  moveFile(from, to2) {
149728
149512
  try {
149729
- fs97.renameSync(from, to2);
149513
+ fs96.renameSync(from, to2);
149730
149514
  } catch (error) {
149731
149515
  if (error.code !== "EXDEV") {
149732
149516
  throw error;
149733
149517
  }
149734
149518
  let copied = false;
149735
149519
  try {
149736
- fs97.copyFileSync(from, to2);
149520
+ fs96.copyFileSync(from, to2);
149737
149521
  copied = true;
149738
- fs97.unlinkSync(from);
149522
+ fs96.unlinkSync(from);
149739
149523
  } catch (fallbackError) {
149740
149524
  if (copied) {
149741
149525
  try {
149742
- fs97.unlinkSync(to2);
149526
+ fs96.unlinkSync(to2);
149743
149527
  } catch {
149744
149528
  }
149745
149529
  }
@@ -149753,17 +149537,17 @@ var Config = class _Config {
149753
149537
  oldStorage,
149754
149538
  newStorage
149755
149539
  )) {
149756
- if (!fs97.existsSync(from)) {
149540
+ if (!fs96.existsSync(from)) {
149757
149541
  continue;
149758
149542
  }
149759
- fs97.mkdirSync(path102.dirname(to2), { recursive: true });
149543
+ fs96.mkdirSync(path102.dirname(to2), { recursive: true });
149760
149544
  try {
149761
149545
  this.moveFile(from, to2);
149762
149546
  moved.push({ from, to: to2 });
149763
149547
  } catch (error) {
149764
149548
  for (const movedArtifact of moved.reverse()) {
149765
149549
  try {
149766
- fs97.mkdirSync(path102.dirname(movedArtifact.from), {
149550
+ fs96.mkdirSync(path102.dirname(movedArtifact.from), {
149767
149551
  recursive: true
149768
149552
  });
149769
149553
  this.moveFile(movedArtifact.to, movedArtifact.from);
@@ -149809,10 +149593,10 @@ var Config = class _Config {
149809
149593
  if (!opts?.skipArtifactMigration && this.chatRecordingService?.hasWriteOwnership()) {
149810
149594
  throw new SessionWriterUnavailableError();
149811
149595
  }
149812
- const oldDir = opts?.skipProcessChdir ? this.cwd : fs97.realpathSync(process8.cwd());
149596
+ const oldDir = opts?.skipProcessChdir ? this.cwd : fs96.realpathSync(process8.cwd());
149813
149597
  const targetPath = path102.resolve(newDir);
149814
- const expected = expectedCanonicalDir ?? fs97.realpathSync(targetPath);
149815
- if (!fs97.statSync(targetPath).isDirectory()) {
149598
+ const expected = expectedCanonicalDir ?? fs96.realpathSync(targetPath);
149599
+ if (!fs96.statSync(targetPath).isDirectory()) {
149816
149600
  throw new Error(`Path is not a directory: ${targetPath}`);
149817
149601
  }
149818
149602
  const workspaceDirectories = WorkspaceContext.resolveRootDirectories(
@@ -149821,7 +149605,7 @@ var Config = class _Config {
149821
149605
  );
149822
149606
  if (!opts?.skipProcessChdir) {
149823
149607
  process8.chdir(targetPath);
149824
- const actualCwd = fs97.realpathSync(process8.cwd());
149608
+ const actualCwd = fs96.realpathSync(process8.cwd());
149825
149609
  if (actualCwd !== expected) {
149826
149610
  process8.chdir(oldDir);
149827
149611
  throw new Error(
@@ -149829,7 +149613,7 @@ var Config = class _Config {
149829
149613
  );
149830
149614
  }
149831
149615
  } else {
149832
- const actualCanonical = fs97.realpathSync(targetPath);
149616
+ const actualCanonical = fs96.realpathSync(targetPath);
149833
149617
  if (actualCanonical !== expected) {
149834
149618
  throw new Error(
149835
149619
  `Realpath mismatch: resolved ${actualCanonical}, expected ${expected}.`
@@ -149998,6 +149782,11 @@ var Config = class _Config {
149998
149782
  if (Object.hasOwn(this, "goalRuntime")) {
149999
149783
  this.goalTurnHostUnbind?.();
150000
149784
  this.goalTurnHostUnbind = void 0;
149785
+ this.settlePendingGoalRestore(
149786
+ new GoalPersistenceUnavailableError(
149787
+ "Config shut down before the session writer became available"
149788
+ )
149789
+ );
150001
149790
  this.goalRuntime?.dispose();
150002
149791
  }
150003
149792
  if (!this.initialized) {
@@ -150917,7 +150706,7 @@ var Config = class _Config {
150917
150706
  }
150918
150707
  getPlanFileNames(plansDir) {
150919
150708
  try {
150920
- return fs97.readdirSync(plansDir).filter((entry) => entry.endsWith(".md"));
150709
+ return fs96.readdirSync(plansDir).filter((entry) => entry.endsWith(".md"));
150921
150710
  } catch (err) {
150922
150711
  const code = err.code;
150923
150712
  if (code === "ENOENT") {
@@ -150948,23 +150737,23 @@ var Config = class _Config {
150948
150737
  this.assertPlansDirWithinTargetDir();
150949
150738
  const filePath = this.getPlanFilePath();
150950
150739
  const dir = path102.dirname(filePath);
150951
- fs97.mkdirSync(dir, { recursive: true });
150740
+ fs96.mkdirSync(dir, { recursive: true });
150952
150741
  const tmpPath = filePath + ".tmp";
150953
- fs97.writeFileSync(tmpPath, plan, "utf-8");
150742
+ fs96.writeFileSync(tmpPath, plan, "utf-8");
150954
150743
  try {
150955
- fs97.renameSync(tmpPath, filePath);
150744
+ fs96.renameSync(tmpPath, filePath);
150956
150745
  } catch (err) {
150957
150746
  if (err.code !== "EXDEV") {
150958
150747
  throw err;
150959
150748
  }
150960
- fs97.copyFileSync(tmpPath, filePath);
150961
- fs97.unlinkSync(tmpPath);
150749
+ fs96.copyFileSync(tmpPath, filePath);
150750
+ fs96.unlinkSync(tmpPath);
150962
150751
  }
150963
150752
  try {
150964
150753
  this.assertPlanFilePathWithinTargetDir(filePath);
150965
150754
  } catch (err) {
150966
150755
  try {
150967
- fs97.unlinkSync(filePath);
150756
+ fs96.unlinkSync(filePath);
150968
150757
  } catch {
150969
150758
  }
150970
150759
  throw err;
@@ -150978,7 +150767,7 @@ var Config = class _Config {
150978
150767
  const filePath = this.getPlanFilePath();
150979
150768
  this.assertPlanFilePathWithinTargetDir(filePath);
150980
150769
  try {
150981
- return fs97.readFileSync(filePath, "utf-8");
150770
+ return fs96.readFileSync(filePath, "utf-8");
150982
150771
  } catch (error) {
150983
150772
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
150984
150773
  return void 0;
@@ -151918,14 +151707,20 @@ var Config = class _Config {
151918
151707
  initializeGoalRuntime(records) {
151919
151708
  this.goalTurnHostUnbind?.();
151920
151709
  this.goalTurnHostUnbind = void 0;
151710
+ this.settlePendingGoalRestore(
151711
+ new GoalPersistenceUnavailableError(
151712
+ "Goal runtime was replaced before the session writer became available"
151713
+ )
151714
+ );
151921
151715
  if (!this.chatRecordingService) {
151922
151716
  this.goalRuntime = void 0;
151923
151717
  this.goalRuntimeReady = void 0;
151924
151718
  return;
151925
151719
  }
151720
+ const recorder = this.chatRecordingService;
151926
151721
  const runtime = createGoalRuntime({
151927
- journal: this.chatRecordingService,
151928
- evidenceSource: this.chatRecordingService,
151722
+ journal: recorder,
151723
+ evidenceSource: recorder,
151929
151724
  verifier: createGoalVerifier(this),
151930
151725
  checkpointVerifier: createGoalCheckpointVerifier(this)
151931
151726
  });
@@ -151933,9 +151728,54 @@ var Config = class _Config {
151933
151728
  if (this.goalTurnHost) {
151934
151729
  this.goalTurnHostUnbind = runtime.bindHost(this.goalTurnHost);
151935
151730
  }
151936
- this.goalRuntimeReady = runtime.restore(records ?? []).then(() => runtime);
151731
+ if (this.sessionWriterLeaseEnabled && !recorder.hasWriteOwnership()) {
151732
+ const ready = new Promise((resolve41, reject) => {
151733
+ this.pendingGoalRestore = { runtime, resolve: resolve41, reject };
151734
+ });
151735
+ this.goalRuntimeReady = ready;
151736
+ } else {
151737
+ this.goalRuntimeReady = runtime.restore(records ?? []).then(() => runtime);
151738
+ }
151937
151739
  void this.goalRuntimeReady.catch(() => void 0);
151938
151740
  }
151741
+ /**
151742
+ * Run the restore that {@link initializeGoalRuntime} deferred because the
151743
+ * session writer was not yet accepting writes.
151744
+ *
151745
+ * Called once `activateChatRecording()` has handed the recorder its lease.
151746
+ * Deliberately re-reads the records from `sessionData`: activation
151747
+ * replaces it with the authoritative transcript loaded under the lease, so
151748
+ * the deferred restore sees newer records than the constructor did.
151749
+ */
151750
+ startPendingGoalRestore() {
151751
+ const pending = this.pendingGoalRestore;
151752
+ if (!pending) return;
151753
+ this.pendingGoalRestore = void 0;
151754
+ if (pending.runtime !== this.goalRuntime) {
151755
+ pending.reject(
151756
+ new GoalPersistenceUnavailableError(
151757
+ "Goal runtime was replaced before the session writer became available"
151758
+ )
151759
+ );
151760
+ return;
151761
+ }
151762
+ void pending.runtime.restore(this.sessionData?.conversation.messages ?? []).then(
151763
+ () => pending.resolve(pending.runtime),
151764
+ (error) => pending.reject(error)
151765
+ );
151766
+ }
151767
+ /**
151768
+ * Fail a deferred restore that can never run — the writer never became
151769
+ * available, or the runtime it belonged to was replaced. Without this the
151770
+ * promise behind {@link getGoalRuntimeReady} would stay pending forever
151771
+ * and every awaiting caller would hang rather than see the failure.
151772
+ */
151773
+ settlePendingGoalRestore(error) {
151774
+ const pending = this.pendingGoalRestore;
151775
+ if (!pending) return;
151776
+ this.pendingGoalRestore = void 0;
151777
+ pending.reject(error);
151778
+ }
151939
151779
  notifyChatRecordingFailure(event) {
151940
151780
  for (const listener of [...this.chatRecordingFailureListeners]) {
151941
151781
  try {
@@ -152259,7 +152099,7 @@ var Config = class _Config {
152259
152099
  }
152260
152100
  if (!enabled) return;
152261
152101
  registry.registerFactory(ToolNames.IMAGE_GEN, async () => {
152262
- const { ImageGenTool } = await import("./image-gen-DEEXNNA2.js");
152102
+ const { ImageGenTool } = await import("./image-gen-4IFV4HES.js");
152263
152103
  return new ImageGenTool(this);
152264
152104
  });
152265
152105
  }
@@ -152289,36 +152129,36 @@ var Config = class _Config {
152289
152129
  if (options2?.forSubAgent) return;
152290
152130
  const schema = this.jsonSchema;
152291
152131
  await registerLazy(ToolNames.STRUCTURED_OUTPUT, async () => {
152292
- const { SyntheticOutputTool } = await import("./syntheticOutput-PEBJQYJV.js");
152132
+ const { SyntheticOutputTool } = await import("./syntheticOutput-D3Z64LJC.js");
152293
152133
  return new SyntheticOutputTool(schema);
152294
152134
  });
152295
152135
  }, "registerStructuredOutputIfRequested");
152296
152136
  const registerGoalWorkerTools = /* @__PURE__ */ __name(async () => {
152297
152137
  if (options2?.forSubAgent) return;
152298
152138
  await registerLazy(ToolNames.GET_GOAL, async () => {
152299
- const { GetGoalTool } = await import("./goal-tools-SWNB6GP4.js");
152139
+ const { GetGoalTool } = await import("./goal-tools-JDK2SNMV.js");
152300
152140
  return new GetGoalTool(this);
152301
152141
  });
152302
152142
  await registerLazy(ToolNames.UPDATE_GOAL, async () => {
152303
- const { UpdateGoalTool } = await import("./goal-tools-SWNB6GP4.js");
152143
+ const { UpdateGoalTool } = await import("./goal-tools-JDK2SNMV.js");
152304
152144
  return new UpdateGoalTool(this);
152305
152145
  });
152306
152146
  }, "registerGoalWorkerTools");
152307
152147
  if (this.getBareMode()) {
152308
152148
  await registerLazy(ToolNames.READ_FILE, async () => {
152309
- const { ReadFileTool } = await import("./read-file-S2BROE4F.js");
152149
+ const { ReadFileTool } = await import("./read-file-6LKIKKXD.js");
152310
152150
  return new ReadFileTool(this);
152311
152151
  });
152312
152152
  await registerLazy(ToolNames.EDIT, async () => {
152313
- const { EditTool } = await import("./edit-XYMQNMWU.js");
152153
+ const { EditTool } = await import("./edit-B3MT7O53.js");
152314
152154
  return new EditTool(this);
152315
152155
  });
152316
152156
  await registerLazy(ToolNames.NOTEBOOK_EDIT, async () => {
152317
- const { NotebookEditTool } = await import("./notebook-edit-GKKQJQQU.js");
152157
+ const { NotebookEditTool } = await import("./notebook-edit-XQA6YCH2.js");
152318
152158
  return new NotebookEditTool(this);
152319
152159
  });
152320
152160
  await registerLazy(ToolNames.SHELL, async () => {
152321
- const { ShellTool: ShellTool2 } = await import("./shell-2DOQIYEE.js");
152161
+ const { ShellTool: ShellTool2 } = await import("./shell-FCTR3OI2.js");
152322
152162
  return new ShellTool2(this);
152323
152163
  });
152324
152164
  await registerGoalWorkerTools();
@@ -152330,43 +152170,43 @@ var Config = class _Config {
152330
152170
  }
152331
152171
  await registerGoalWorkerTools();
152332
152172
  await registerLazy(ToolNames.TOOL_SEARCH, async () => {
152333
- const { ToolSearchTool } = await import("./tool-search-BZOZHGKI.js");
152173
+ const { ToolSearchTool } = await import("./tool-search-XPOFDWOX.js");
152334
152174
  return new ToolSearchTool(this);
152335
152175
  });
152336
152176
  await registerLazy(ToolNames.READ_MCP_RESOURCE, async () => {
152337
- const { ReadMcpResourceTool } = await import("./read-mcp-resource-PZ4ZF6YL.js");
152177
+ const { ReadMcpResourceTool } = await import("./read-mcp-resource-TJSJRH4F.js");
152338
152178
  return new ReadMcpResourceTool(this);
152339
152179
  });
152340
152180
  await registerLazy(ToolNames.AGENT, async () => {
152341
- const { AgentTool: AgentTool2 } = await import("./agent-IPODFZTU.js");
152181
+ const { AgentTool: AgentTool2 } = await import("./agent-MIY4LJJJ.js");
152342
152182
  return new AgentTool2(this);
152343
152183
  });
152344
152184
  await registerLazy(ToolNames.LIST_AGENTS, async () => {
152345
- const { ListAgentsTool } = await import("./list-agents-Z4WABFDZ.js");
152185
+ const { ListAgentsTool } = await import("./list-agents-4GQ2XNEU.js");
152346
152186
  return new ListAgentsTool(this);
152347
152187
  });
152348
152188
  await registerLazy(ToolNames.TASK_STOP, async () => {
152349
- const { TaskStopTool } = await import("./task-stop-FPCOIRYX.js");
152189
+ const { TaskStopTool } = await import("./task-stop-HHUGCD25.js");
152350
152190
  return new TaskStopTool(this);
152351
152191
  });
152352
152192
  await registerLazy(ToolNames.SEND_MESSAGE, async () => {
152353
- const { SendMessageTool } = await import("./send-message-CAMSLG2L.js");
152193
+ const { SendMessageTool } = await import("./send-message-RBYLV5NY.js");
152354
152194
  return new SendMessageTool(this);
152355
152195
  });
152356
152196
  await registerLazy(ToolNames.SKILL, async () => {
152357
- const { SkillTool } = await import("./skill-2GOEKN34.js");
152197
+ const { SkillTool } = await import("./skill-IAKHPD5H.js");
152358
152198
  return new SkillTool(this);
152359
152199
  });
152360
152200
  await registerLazy(ToolNames.LS, async () => {
152361
- const { LSTool } = await import("./ls-TVHDGIES.js");
152201
+ const { LSTool } = await import("./ls-O4VBQRG7.js");
152362
152202
  return new LSTool(this);
152363
152203
  });
152364
152204
  await registerLazy(ToolNames.READ_FILE, async () => {
152365
- const { ReadFileTool } = await import("./read-file-S2BROE4F.js");
152205
+ const { ReadFileTool } = await import("./read-file-6LKIKKXD.js");
152366
152206
  return new ReadFileTool(this);
152367
152207
  });
152368
152208
  await registerLazy(ToolNames.ZOOM_IMAGE, async () => {
152369
- const { ZoomImageTool } = await import("./zoom-image-NAVVM4R2.js");
152209
+ const { ZoomImageTool } = await import("./zoom-image-GTVVT25J.js");
152370
152210
  return new ZoomImageTool(this);
152371
152211
  });
152372
152212
  if (this.getUseRipgrep()) {
@@ -152381,7 +152221,7 @@ var Config = class _Config {
152381
152221
  recordStartupEvent("config_initialize_ripgrep_probe_end");
152382
152222
  if (useRipgrep) {
152383
152223
  await registerLazy(ToolNames.GREP, async () => {
152384
- const { RipGrepTool: RipGrepTool2 } = await import("./ripGrep-V4EX6SLA.js");
152224
+ const { RipGrepTool: RipGrepTool2 } = await import("./ripGrep-CF2WRBYV.js");
152385
152225
  return new RipGrepTool2(this);
152386
152226
  });
152387
152227
  } else {
@@ -152394,7 +152234,7 @@ var Config = class _Config {
152394
152234
  )
152395
152235
  );
152396
152236
  await registerLazy(ToolNames.GREP, async () => {
152397
- const { GrepTool } = await import("./grep-CJSUX5NJ.js");
152237
+ const { GrepTool } = await import("./grep-VUHUDZYG.js");
152398
152238
  return new GrepTool(this);
152399
152239
  });
152400
152240
  }
@@ -152402,77 +152242,77 @@ var Config = class _Config {
152402
152242
  recordStartupEvent("config_initialize_ripgrep_probe_start");
152403
152243
  recordStartupEvent("config_initialize_ripgrep_probe_end");
152404
152244
  await registerLazy(ToolNames.GREP, async () => {
152405
- const { GrepTool } = await import("./grep-CJSUX5NJ.js");
152245
+ const { GrepTool } = await import("./grep-VUHUDZYG.js");
152406
152246
  return new GrepTool(this);
152407
152247
  });
152408
152248
  }
152409
152249
  await registerLazy(ToolNames.GLOB, async () => {
152410
- const { GlobTool } = await import("./glob-BVX4L3CM.js");
152250
+ const { GlobTool } = await import("./glob-3Y3VHLM2.js");
152411
152251
  return new GlobTool(this);
152412
152252
  });
152413
152253
  await registerLazy(ToolNames.EDIT, async () => {
152414
- const { EditTool } = await import("./edit-XYMQNMWU.js");
152254
+ const { EditTool } = await import("./edit-B3MT7O53.js");
152415
152255
  return new EditTool(this);
152416
152256
  });
152417
152257
  await registerLazy(ToolNames.NOTEBOOK_EDIT, async () => {
152418
- const { NotebookEditTool } = await import("./notebook-edit-GKKQJQQU.js");
152258
+ const { NotebookEditTool } = await import("./notebook-edit-XQA6YCH2.js");
152419
152259
  return new NotebookEditTool(this);
152420
152260
  });
152421
152261
  await registerLazy(ToolNames.WRITE_FILE, async () => {
152422
- const { WriteFileTool: WriteFileTool2 } = await import("./write-file-3N2WAE3F.js");
152262
+ const { WriteFileTool: WriteFileTool2 } = await import("./write-file-IEAC3XC3.js");
152423
152263
  return new WriteFileTool2(this);
152424
152264
  });
152425
152265
  await registerLazy(ToolNames.SHELL, async () => {
152426
- const { ShellTool: ShellTool2 } = await import("./shell-2DOQIYEE.js");
152266
+ const { ShellTool: ShellTool2 } = await import("./shell-FCTR3OI2.js");
152427
152267
  return new ShellTool2(this);
152428
152268
  });
152429
152269
  await registerLazy(ToolNames.TODO_WRITE, async () => {
152430
- const { TodoWriteTool } = await import("./todoWrite-JGV6VLOX.js");
152270
+ const { TodoWriteTool } = await import("./todoWrite-WINAZSZI.js");
152431
152271
  return new TodoWriteTool(this);
152432
152272
  });
152433
152273
  const supportsUserInteraction = resolveInteractionMode(this) !== "headless";
152434
152274
  if (supportsUserInteraction) {
152435
152275
  await registerLazy(ToolNames.ASK_USER_QUESTION, async () => {
152436
- const { AskUserQuestionTool } = await import("./askUserQuestion-ONW74PKJ.js");
152276
+ const { AskUserQuestionTool } = await import("./askUserQuestion-7G3LI3IZ.js");
152437
152277
  return new AskUserQuestionTool(this);
152438
152278
  });
152439
152279
  }
152440
152280
  if (!this.sdkMode && (supportsUserInteraction || options2?.forSubAgent)) {
152441
152281
  await registerLazy(ToolNames.EXIT_PLAN_MODE, async () => {
152442
- const { ExitPlanModeTool: ExitPlanModeTool2 } = await import("./exitPlanMode-2U23CG2U.js");
152282
+ const { ExitPlanModeTool: ExitPlanModeTool2 } = await import("./exitPlanMode-YXSWN4D3.js");
152443
152283
  return new ExitPlanModeTool2(this);
152444
152284
  });
152445
152285
  }
152446
152286
  if (!this.sdkMode && supportsUserInteraction) {
152447
152287
  await registerLazy(ToolNames.ENTER_PLAN_MODE, async () => {
152448
- const { EnterPlanModeTool } = await import("./enterPlanMode-K6LTIGWM.js");
152288
+ const { EnterPlanModeTool } = await import("./enterPlanMode-DDCIM6HA.js");
152449
152289
  return new EnterPlanModeTool(this);
152450
152290
  });
152451
152291
  }
152452
152292
  await registerLazy(ToolNames.ENTER_WORKTREE, async () => {
152453
- const { EnterWorktreeTool } = await import("./enter-worktree-TIASENJP.js");
152293
+ const { EnterWorktreeTool } = await import("./enter-worktree-WVIYVSDJ.js");
152454
152294
  return new EnterWorktreeTool(this);
152455
152295
  });
152456
152296
  await registerLazy(ToolNames.EXIT_WORKTREE, async () => {
152457
- const { ExitWorktreeTool } = await import("./exit-worktree-IBKPEHUJ.js");
152297
+ const { ExitWorktreeTool } = await import("./exit-worktree-NQ2A6URE.js");
152458
152298
  return new ExitWorktreeTool(this);
152459
152299
  });
152460
152300
  await registerLazy(ToolNames.WEB_FETCH, async () => {
152461
- const { WebFetchTool } = await import("./web-fetch-APSFQMIH.js");
152301
+ const { WebFetchTool } = await import("./web-fetch-LLHPV2IR.js");
152462
152302
  return new WebFetchTool(this);
152463
152303
  });
152464
152304
  if (resolveInteractionMode(this) === "interactive" && !this.sdkMode && !this.getScreenReader() && !options2?.forSubAgent) {
152465
152305
  await registerLazy(ToolNames.DISPLAY_IMAGE, async () => {
152466
- const { DisplayImageTool } = await import("./display-image-NQRSIBXM.js");
152306
+ const { DisplayImageTool } = await import("./display-image-ZE3GZNIK.js");
152467
152307
  return new DisplayImageTool(this);
152468
152308
  });
152469
152309
  }
152470
152310
  if (this.webSearchSettings?.enabled) {
152471
- const { evaluateWebSearchGate } = await import("./web-search-EWEHMFIW.js");
152311
+ const { evaluateWebSearchGate } = await import("./web-search-4HCHRZ3U.js");
152472
152312
  const gate = evaluateWebSearchGate(this);
152473
152313
  if (gate.ok) {
152474
152314
  await registerLazy(ToolNames.WEB_SEARCH, async () => {
152475
- const { WebSearchTool } = await import("./web-search-EWEHMFIW.js");
152315
+ const { WebSearchTool } = await import("./web-search-4HCHRZ3U.js");
152476
152316
  return new WebSearchTool(this);
152477
152317
  });
152478
152318
  } else if (!this.webSearchNoticeEmitted && !options2?.forSubAgent) {
@@ -152483,83 +152323,83 @@ var Config = class _Config {
152483
152323
  await this.registerImageGenerationTool(registry);
152484
152324
  if (this.isArtifactEnabled()) {
152485
152325
  await registerLazy(ToolNames.ARTIFACT, async () => {
152486
- const { ArtifactTool } = await import("./artifact-tool-N652YE4L.js");
152326
+ const { ArtifactTool } = await import("./artifact-tool-M7UAJ5NT.js");
152487
152327
  return new ArtifactTool(this);
152488
152328
  });
152489
152329
  }
152490
152330
  if (this.isRecordArtifactEnabled()) {
152491
152331
  await registerLazy(ToolNames.RECORD_ARTIFACT, async () => {
152492
- const { RecordArtifactTool } = await import("./record-artifact-P4HFMS7X.js");
152332
+ const { RecordArtifactTool } = await import("./record-artifact-FXF5LHPE.js");
152493
152333
  return new RecordArtifactTool();
152494
152334
  });
152495
152335
  }
152496
152336
  if (this.isLspEnabled() && this.getLspClient()) {
152497
152337
  await registerLazy(ToolNames.LSP, async () => {
152498
- const { LspTool } = await import("./lsp-CVN6OQPI.js");
152338
+ const { LspTool } = await import("./lsp-APQJ5ZEZ.js");
152499
152339
  return new LspTool(this);
152500
152340
  });
152501
152341
  }
152502
152342
  await registerStructuredOutputIfRequested();
152503
152343
  if (this.isCronEnabled()) {
152504
152344
  await registerLazy(ToolNames.CRON_CREATE, async () => {
152505
- const { CronCreateTool } = await import("./cron-create-VONA5JYY.js");
152345
+ const { CronCreateTool } = await import("./cron-create-ZOVA3CC2.js");
152506
152346
  return new CronCreateTool(this);
152507
152347
  });
152508
152348
  await registerLazy(ToolNames.CRON_LIST, async () => {
152509
- const { CronListTool } = await import("./cron-list-KE4F2CIR.js");
152349
+ const { CronListTool } = await import("./cron-list-UHGX3IQG.js");
152510
152350
  return new CronListTool(this);
152511
152351
  });
152512
152352
  await registerLazy(ToolNames.CRON_DELETE, async () => {
152513
- const { CronDeleteTool } = await import("./cron-delete-5JXSP2MI.js");
152353
+ const { CronDeleteTool } = await import("./cron-delete-7Z3H4LJY.js");
152514
152354
  return new CronDeleteTool(this);
152515
152355
  });
152516
152356
  await registerLazy(ToolNames.LOOP_WAKEUP, async () => {
152517
- const { LoopWakeupTool } = await import("./loop-wakeup-UZ5RL5Y2.js");
152357
+ const { LoopWakeupTool } = await import("./loop-wakeup-HOQI3K5D.js");
152518
152358
  return new LoopWakeupTool(this);
152519
152359
  });
152520
152360
  }
152521
152361
  await registerLazy(ToolNames.CREATE_SUB_SESSION, async () => {
152522
- const { CreateSubSessionTool } = await import("./create-sub-session-QIDZUOPU.js");
152362
+ const { CreateSubSessionTool } = await import("./create-sub-session-Y4WYDZGC.js");
152523
152363
  return new CreateSubSessionTool(this);
152524
152364
  });
152525
152365
  if (this.isAgentTeamEnabled()) {
152526
152366
  await registerLazy(ToolNames.TEAM_CREATE, async () => {
152527
- const { TeamCreateTool } = await import("./team-create-ZWAXZR75.js");
152367
+ const { TeamCreateTool } = await import("./team-create-J4JP6AXN.js");
152528
152368
  return new TeamCreateTool(this);
152529
152369
  });
152530
152370
  await registerLazy(ToolNames.TEAM_DELETE, async () => {
152531
- const { TeamDeleteTool } = await import("./team-delete-MMQB4OSC.js");
152371
+ const { TeamDeleteTool } = await import("./team-delete-PZGGBQLM.js");
152532
152372
  return new TeamDeleteTool(this);
152533
152373
  });
152534
152374
  await registerLazy(ToolNames.TEAM_PLAN_APPROVAL, async () => {
152535
- const { TeamPlanApprovalTool } = await import("./team-plan-approval-LH23GCUV.js");
152375
+ const { TeamPlanApprovalTool } = await import("./team-plan-approval-7BEAIR2H.js");
152536
152376
  return new TeamPlanApprovalTool(this);
152537
152377
  });
152538
152378
  await registerLazy(ToolNames.TASK_CREATE, async () => {
152539
- const { TaskCreateTool } = await import("./task-create-5NWCQSJF.js");
152379
+ const { TaskCreateTool } = await import("./task-create-URFZ5EUX.js");
152540
152380
  return new TaskCreateTool(this);
152541
152381
  });
152542
152382
  await registerLazy(ToolNames.TASK_UPDATE, async () => {
152543
- const { TaskUpdateTool } = await import("./task-update-5HN577LS.js");
152383
+ const { TaskUpdateTool } = await import("./task-update-LCJM3EYG.js");
152544
152384
  return new TaskUpdateTool(this);
152545
152385
  });
152546
152386
  await registerLazy(ToolNames.TASK_LIST, async () => {
152547
- const { TaskListTool } = await import("./task-list-53265TRZ.js");
152387
+ const { TaskListTool } = await import("./task-list-6JDFMPUW.js");
152548
152388
  return new TaskListTool(this);
152549
152389
  });
152550
152390
  }
152551
152391
  if (this.isWorkflowsEnabled()) {
152552
152392
  await registerLazy(ToolNames.WORKFLOW, async () => {
152553
- const { WorkflowTool } = await import("./workflow-LA4ACRO4.js");
152393
+ const { WorkflowTool } = await import("./workflow-YI74QTWW.js");
152554
152394
  return new WorkflowTool(this);
152555
152395
  });
152556
152396
  }
152557
152397
  if (this.isComputerUseEnabled()) {
152558
- const { registerComputerUseTools } = await import("./computer-use-5LGM2YO5.js");
152398
+ const { registerComputerUseTools } = await import("./computer-use-7TIKEXBX.js");
152559
152399
  await registerComputerUseTools(registerLazy, this);
152560
152400
  }
152561
152401
  await registerLazy(ToolNames.MONITOR, async () => {
152562
- const { MonitorTool } = await import("./monitor-EXI73A5P.js");
152402
+ const { MonitorTool } = await import("./monitor-RQROQHLD.js");
152563
152403
  return new MonitorTool(this);
152564
152404
  });
152565
152405
  if (this.pendingMcpBudgetCallback) {
@@ -152969,17 +152809,12 @@ export {
152969
152809
  flatMapTextParts,
152970
152810
  appendToLastTextPart,
152971
152811
  getToolResponseDisplayText,
152812
+ resolveSlimmingConfig,
152972
152813
  setStartupEventSink,
152973
152814
  DEFAULT_TOOL_RESULTS_TOTAL_CHARS_THRESHOLD,
152974
152815
  getActiveGoal,
152975
- setGoalTerminalObserver,
152976
- clearGoalTerminalObserver,
152977
- getLastGoalTerminal,
152978
- setLastGoalTerminal,
152979
152816
  getStopHookContinuationReason,
152980
152817
  abortGoalForStopHookCap,
152981
- unregisterGoalHook,
152982
- registerGoalHook,
152983
152818
  DEFAULT_STOP_HOOK_BLOCK_CAP,
152984
152819
  formatStopHookBlockingCapWarning,
152985
152820
  buildContextUsage,
@@ -153005,6 +152840,7 @@ export {
153005
152840
  TERMINAL_CSI_REGEX,
153006
152841
  TERMINAL_SHIFT_DCS_REGEX,
153007
152842
  stripTerminalControlSequences,
152843
+ truncateNotificationLabel,
153008
152844
  persistSessionUsage,
153009
152845
  metricsToUsageRecord,
153010
152846
  loadUsageHistory,
@@ -153367,6 +153203,7 @@ export {
153367
153203
  fetchGitHubPullRequests,
153368
153204
  createGitHubPullRequest,
153369
153205
  getDefaultBranch,
153206
+ analyzeToolResultRetention,
153370
153207
  readPathFromWorkspace,
153371
153208
  getWelcomeBackState,
153372
153209
  saveWelcomeBackRestartChoice,
@@ -153377,6 +153214,7 @@ export {
153377
153214
  BTW_MAX_INPUT_LENGTH,
153378
153215
  buildBtwPrompt,
153379
153216
  buildBtwCacheSafeParams,
153217
+ projectGoalStateToLegacy,
153380
153218
  isGoalCheckpointBookkeepingRecord
153381
153219
  };
153382
153220
  /**