@qwen-code/qwen-code 0.21.0 → 0.21.1
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.
- package/bundled/qc-helper/docs/configuration/model-providers.md +2 -0
- package/bundled/qc-helper/docs/configuration/settings.md +38 -28
- package/bundled/qc-helper/docs/features/channels/_meta.ts +1 -0
- package/bundled/qc-helper/docs/features/channels/github.md +107 -0
- package/bundled/qc-helper/docs/features/channels/overview.md +61 -6
- package/bundled/qc-helper/docs/features/code-review.md +1 -1
- package/bundled/qc-helper/docs/features/hooks.md +52 -15
- package/bundled/qc-helper/docs/features/mcp.md +9 -1
- package/bundled/qc-helper/docs/features/scheduled-tasks.md +3 -1
- package/bundled/qc-helper/docs/features/sub-agents.md +20 -0
- package/bundled/qc-helper/docs/qwen-serve.md +4 -2
- package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +2 -2
- package/bundled/qc-helper/docs/support/troubleshooting.md +2 -1
- package/bundled/review/DESIGN.md +19 -0
- package/bundled/review/SKILL.md +120 -61
- package/chunks/MaxSizedBox-VI3ROJJA.js +84 -0
- package/chunks/{StandaloneSessionPicker-BIRMPLRD.js → StandaloneSessionPicker-LYXKD2EV.js} +67 -68
- package/chunks/{acp-startup-profiler-RV3IV562.js → acp-startup-profiler-DFVPFQ6C.js} +2 -2
- package/chunks/{acpAgent-6J2U72PQ.js → acpAgent-WN5SRDQO.js} +1373 -553
- package/chunks/agent-K6ECSM64.js +80 -0
- package/chunks/agent-headless-NO4Y2HOE.js +74 -0
- package/chunks/{anthropicContentGenerator-75BKLTSP.js → anthropicContentGenerator-V2QOGVYD.js} +79 -27
- package/chunks/{artifact-tool-Y5T7GG7F.js → artifact-tool-6K6U7XYJ.js} +4 -4
- package/chunks/{askUserQuestion-2H6747FR.js → askUserQuestion-GD2IJJ7I.js} +4 -4
- package/chunks/bridge-3KJEWDNE.js +90 -0
- package/chunks/{build-RV63TIRH.js → build-S6DO7LMM.js} +1 -1
- package/chunks/{ca-25EDXPFZ.js → ca-6W3SK7OQ.js} +6 -1
- package/chunks/channel-management-service-XR7GZSWF.js +403 -0
- package/chunks/channel-settings-store-HW4FXXUA.js +87 -0
- package/chunks/{channel-worker-group-2ZD7TVAT.js → channel-worker-group-XDPTDWTX.js} +11 -6
- package/chunks/{channel-worker-manager-4OA4BCGB.js → channel-worker-manager-YYEHVRRE.js} +11 -6
- package/chunks/{channel-worker-supervisor-V7KCFJTS.js → channel-worker-supervisor-74HTWA2G.js} +7 -5
- package/chunks/{chunk-M5JM7OSF.js → chunk-2DN4J57Y.js} +2 -3
- package/chunks/{chunk-ETSW4KLJ.js → chunk-2FAK6PNM.js} +2 -2
- package/chunks/{chunk-BPJSQIJX.js → chunk-2J3OJGTL.js} +0 -2
- package/chunks/{chunk-EPDRMGT4.js → chunk-2LKVPASC.js} +4 -28
- package/chunks/{chunk-PWTZEM3C.js → chunk-2LQTH543.js} +3 -37
- package/chunks/{chunk-LH2BYDQ5.js → chunk-2N7CODY5.js} +18 -12
- package/chunks/{chunk-4WIZGAH3.js → chunk-2XSLTRFZ.js} +6 -58
- package/chunks/{chunk-FSITMZJH.js → chunk-3EFXSQCM.js} +18 -9
- package/chunks/{chunk-HIJQF5B5.js → chunk-3L2SPEBH.js} +1 -1
- package/chunks/{chunk-BIQWWWJN.js → chunk-4G2BISNC.js} +1 -1
- package/chunks/{chunk-PWVFN2LF.js → chunk-52ZSWYEG.js} +1 -1
- package/chunks/{chunk-ZJHVAS7M.js → chunk-5KTQXHPY.js} +4 -5
- package/chunks/{chunk-PC6JANNU.js → chunk-5MKRTI4T.js} +4 -4
- package/chunks/{chunk-DHHOYAPR.js → chunk-5TBMQLGG.js} +7 -7
- package/chunks/{chunk-A4UCTEB5.js → chunk-5WV5S2GT.js} +0 -1
- package/chunks/chunk-5YKDXHUY.js +463 -0
- package/chunks/chunk-5ZF5XXTS.js +363 -0
- package/chunks/{chunk-K4XWPEWB.js → chunk-64LQLPL7.js} +4 -33
- package/chunks/{chunk-YPE6A4GC.js → chunk-657BH7VM.js} +2 -2
- package/chunks/{chunk-R5AFZNQW.js → chunk-65PQENQP.js} +14 -7
- package/chunks/{chunk-RIBKPMRP.js → chunk-6PE7N3A4.js} +18 -7
- package/chunks/{chunk-JZA3JUDJ.js → chunk-6QIGFD5W.js} +1 -1
- package/chunks/{chunk-JVPM2ULZ.js → chunk-6RPMI2AB.js} +6 -6
- package/chunks/{chunk-OHNBB4XR.js → chunk-75GFAX4R.js} +1 -1
- package/chunks/{chunk-NIBLUX3Y.js → chunk-75MIQ3LV.js} +148 -21
- package/chunks/{chunk-U7M2DMGW.js → chunk-7AEJDLRA.js} +130 -5
- package/chunks/{chunk-TPRQ7RZH.js → chunk-7BAU433D.js} +2293 -945
- package/chunks/{chunk-M4FMGVY4.js → chunk-7DXQIJID.js} +3 -3
- package/chunks/{chunk-RWTEFFPU.js → chunk-7I5GTCT4.js} +620 -383
- package/chunks/{chunk-A5L3JMUA.js → chunk-7XATOOE7.js} +18 -4
- package/chunks/{chunk-Y34KJKDC.js → chunk-A2D5BAVP.js} +1 -1
- package/chunks/{chunk-5I2IWRSH.js → chunk-A3NDJ5SB.js} +2 -2
- package/chunks/{chunk-OFDOK3VM.js → chunk-A4COXFB3.js} +8 -13
- package/chunks/{chunk-JLU636DO.js → chunk-ALMR3E6Q.js} +1 -0
- package/chunks/{chunk-Q4M4MDQ4.js → chunk-AQIDMUGU.js} +1 -1
- package/chunks/{chunk-PJIZUQVC.js → chunk-AZQ3DT76.js} +2 -2
- package/chunks/{chunk-UH3WSE5L.js → chunk-B4AJNNOL.js} +1 -6
- package/chunks/{chunk-BJX6ZSUK.js → chunk-BCZFQXWK.js} +2 -2
- package/chunks/{chunk-MB4MZHMJ.js → chunk-BGTQCTQW.js} +211 -522
- package/chunks/{chunk-MZAXJAUM.js → chunk-BMFALVGQ.js} +1 -1
- package/chunks/{chunk-PSOO6YXD.js → chunk-BNWB5CYE.js} +9 -7
- package/chunks/{chunk-BKHWX6I2.js → chunk-BPZKP57P.js} +11 -3
- package/chunks/{chunk-H4SBPHSA.js → chunk-CAPPWD3X.js} +3 -3
- package/chunks/{chunk-LQIW3YFY.js → chunk-CQL64ESB.js} +7 -7
- package/chunks/{chunk-TOFQCPDC.js → chunk-CVHIL5IG.js} +4 -5
- package/chunks/{chunk-XVNQMZ2I.js → chunk-DGEIYUC3.js} +0 -1
- package/chunks/{chunk-BPZALHVR.js → chunk-DI35ZN7T.js} +1 -1
- package/chunks/chunk-DZLYR4U3.js +1252 -0
- package/chunks/{chunk-TEHGS6UP.js → chunk-EIF3FXTB.js} +117 -24
- package/chunks/{chunk-2SCDWPXI.js → chunk-EJGJIBRS.js} +5 -5
- package/chunks/{chunk-7MVVZO4N.js → chunk-EVKE2FZL.js} +4 -4
- package/chunks/{chunk-OKY7HXPG.js → chunk-FNMZK765.js} +2 -2
- package/chunks/{chunk-VIA5XA4U.js → chunk-FTD6DP4T.js} +3 -1
- package/chunks/chunk-FYJ7W2PI.js +194 -0
- package/chunks/{chunk-L5UHQJTJ.js → chunk-GATT5TKW.js} +1 -1
- package/chunks/{chunk-X5XDDSSH.js → chunk-GEBV2JGB.js} +28 -5
- package/chunks/{chunk-VAK25FTU.js → chunk-GKX7E4CO.js} +1 -1
- package/chunks/{chunk-LS77BEZP.js → chunk-GLCZKT5V.js} +1 -5
- package/chunks/{chunk-5NBDS5S6.js → chunk-GNR2RNMP.js} +162 -7
- package/chunks/{chunk-YH6G52F2.js → chunk-GXIJHV66.js} +4 -4
- package/chunks/chunk-GZ3RCT54.js +76 -0
- package/chunks/{chunk-2X55UKQE.js → chunk-HMRM2A3U.js} +3 -3
- package/chunks/chunk-HV26XH34.js +319 -0
- package/chunks/{chunk-LB6DUZ26.js → chunk-J7OACQDE.js} +229 -172
- package/chunks/{chunk-K36B6G2O.js → chunk-JFMA7Y5M.js} +5 -5
- package/chunks/{chunk-55DJUCI2.js → chunk-JHNRZMHI.js} +53 -43
- package/chunks/{chunk-63P4EL5V.js → chunk-JMONIXMJ.js} +1 -1
- package/chunks/{chunk-L26JL52R.js → chunk-JSD33JG6.js} +47 -64
- package/chunks/{chunk-YBL3QUDD.js → chunk-JTV5K7NH.js} +1 -1
- package/chunks/{chunk-RZIX2G32.js → chunk-JX27F6QS.js} +1 -1
- package/chunks/chunk-JYBU6YUE.js +378 -0
- package/chunks/{chunk-7JURR4JT.js → chunk-KAMYKP7E.js} +167 -81
- package/chunks/{chunk-KMQ33DO4.js → chunk-KCO4FLFJ.js} +4 -4
- package/chunks/{chunk-2W3OOD4W.js → chunk-L55JWS76.js} +6 -3
- package/chunks/{chunk-RHLZR4E5.js → chunk-LGAOC3ZS.js} +1 -1
- package/chunks/{chunk-EBJQ6AXW.js → chunk-LO4ROVP4.js} +262 -16
- package/chunks/{chunk-NH6KE4JX.js → chunk-LW3RFMG7.js} +3 -3
- package/chunks/{chunk-J56UI34H.js → chunk-M7OONWYU.js} +2 -2
- package/chunks/{chunk-2NH6DYI4.js → chunk-MHAIJPTD.js} +12 -12
- package/chunks/{chunk-FODK6UMO.js → chunk-MPHPFVKK.js} +0 -2
- package/chunks/{chunk-VRYUBFMC.js → chunk-MR5EAQ5M.js} +1 -1
- package/chunks/{chunk-JESCGQM3.js → chunk-NAVJD2PQ.js} +8 -7
- package/chunks/{chunk-H5FFA6TH.js → chunk-NOKIVHOL.js} +16 -3
- package/chunks/{chunk-6OUGMXDC.js → chunk-NWNEANAT.js} +7 -7
- package/chunks/{chunk-SQCQ4KO2.js → chunk-OCESJA77.js} +393 -330
- package/chunks/chunk-OCPBI7J5.js +18 -0
- package/chunks/{chunk-E5TUC6CA.js → chunk-OKF7JF3R.js} +3 -3
- package/chunks/{chunk-TGILQ3YH.js → chunk-P4WOAOJW.js} +141 -64
- package/chunks/{chunk-ZFDTEDCF.js → chunk-PB3MBFKG.js} +6 -6
- package/chunks/{chunk-3RN6GBKS.js → chunk-PLDQBIO6.js} +1 -1
- package/chunks/{chunk-FNQ6T3CV.js → chunk-PONHVBRT.js} +10 -7
- package/chunks/{chunk-CIKQ7KKO.js → chunk-PT722TDT.js} +271 -376
- package/chunks/chunk-Q43KPN7X.js +2196 -0
- package/chunks/{chunk-VDDGDZMA.js → chunk-QHWCP53L.js} +14 -7
- package/chunks/{chunk-MVSUYZDT.js → chunk-QIZKCVM3.js} +4 -4
- package/chunks/{chunk-QAF7NMK7.js → chunk-RCUQIPTN.js} +1 -1
- package/chunks/{chunk-6FGBXPWM.js → chunk-RPLGZJV2.js} +38 -44
- package/chunks/{chunk-GSN55ZRI.js → chunk-S4WJVPZW.js} +19 -7
- package/chunks/{chunk-6AM5D4ME.js → chunk-S6LOFUVP.js} +0 -12
- package/chunks/{chunk-BULDBTYC.js → chunk-S7W2GKIO.js} +1 -28
- package/chunks/{chunk-MUP3T3AD.js → chunk-SGFT55XI.js} +1 -35
- package/chunks/{chunk-VYPFXUCB.js → chunk-SZ3KHTDR.js} +1 -1
- package/chunks/chunk-T26EAKDL.js +13 -0
- package/chunks/{chunk-UDX5OBWR.js → chunk-T2QMKU3R.js} +80 -2
- package/chunks/{chunk-IKYJHJNF.js → chunk-T3O2B4XO.js} +3 -3
- package/chunks/{chunk-RF3EXIHJ.js → chunk-T4TXDL7G.js} +32 -21
- package/chunks/{chunk-J24WCGIN.js → chunk-TBBV36Y4.js} +4 -4
- package/chunks/{chunk-LKEJ26GS.js → chunk-TCIFAA7K.js} +16 -11
- package/chunks/{chunk-JXJFVC6E.js → chunk-TDL6LB4K.js} +46 -11
- package/chunks/{chunk-7ZCNENPP.js → chunk-TFRMVU6R.js} +1 -1
- package/chunks/{chunk-VULLI6WQ.js → chunk-TV64SXKD.js} +6 -6
- package/chunks/{chunk-FQK6JAFG.js → chunk-U3E3UQAA.js} +4 -4
- package/chunks/{chunk-LK7CHLVP.js → chunk-U4VTUMMK.js} +0 -60
- package/chunks/{chunk-ACY3A37B.js → chunk-UBEPNVDI.js} +23 -18
- package/chunks/{chunk-NL7LTRLR.js → chunk-UHUSJ6X7.js} +29 -68
- package/chunks/{chunk-ZOIFNCKL.js → chunk-UPUG4GXM.js} +3 -23
- package/chunks/{chunk-6GMVPFB2.js → chunk-UWMLWVCA.js} +19 -6
- package/chunks/{chunk-IKCX4CCL.js → chunk-VCPIZRYH.js} +118 -95
- package/chunks/{chunk-ZNAUOR2I.js → chunk-VWOOBLTY.js} +2 -2
- package/chunks/{chunk-YX324OPW.js → chunk-VYOXCEPJ.js} +1 -1
- package/chunks/{chunk-USTWD7QV.js → chunk-W4MIWP6M.js} +26 -16
- package/chunks/{chunk-HTR4WV6U.js → chunk-W4RQUHY3.js} +31 -1
- package/chunks/{chunk-DLWL3Z7A.js → chunk-WBSMNTSV.js} +3 -3
- package/chunks/{chunk-IO3IX5Q4.js → chunk-WUZ7H6DP.js} +1 -1
- package/chunks/{chunk-2JZBVYTU.js → chunk-WZRWHXFE.js} +1 -8
- package/chunks/{chunk-PHOF65IG.js → chunk-X5WNMMIA.js} +23553 -34321
- package/chunks/chunk-XBYYDKAZ.js +80 -0
- package/chunks/{chunk-COH43MRJ.js → chunk-XCGIMOLN.js} +27 -1
- package/chunks/{chunk-WCXCRJYB.js → chunk-XFZYFU3I.js} +1 -1
- package/chunks/{chunk-3QMGYBFN.js → chunk-XWWKIXVD.js} +1 -80
- package/chunks/{chunk-3SJ43L4W.js → chunk-XZC5VLBZ.js} +2 -0
- package/chunks/{chunk-UUUTRMI2.js → chunk-Y4IHBGBP.js} +1 -1
- package/chunks/{chunk-PR75REBZ.js → chunk-Y6AXW2OG.js} +12 -82
- package/chunks/{chunk-IPUUTYMV.js → chunk-YDLJGZHL.js} +1 -1
- package/chunks/{chunk-IJTOWOD7.js → chunk-YGF33UXG.js} +82 -8
- package/chunks/chunk-Z4X5MTRT.js +133 -0
- package/chunks/{chunk-UW5EOVUN.js → chunk-ZBVS26BY.js} +4 -4
- package/chunks/{chunk-ZD6UTE4A.js → chunk-ZHBO7WVX.js} +1 -1
- package/chunks/{chunk-HTO4JFDZ.js → chunk-ZPJWUGCS.js} +0 -1
- package/chunks/{chunk-KIM5GUMA.js → chunk-ZURDMIDR.js} +368 -156
- package/chunks/{computer-use-SOQ4E3VX.js → computer-use-ZTIDHMMA.js} +49 -50
- package/chunks/{config-utils-7V7GGIW6.js → config-utils-NYSXDMEQ.js} +4 -3
- package/chunks/contextCommand-2PIEU37Z.js +79 -0
- package/chunks/core-runtime-3XEYLQFK.js +133 -0
- package/chunks/{create-sub-session-QRJLW5BV.js → create-sub-session-R76FVXCI.js} +46 -47
- package/chunks/{create-sub-session-IWW2IZ2T.js → create-sub-session-SBYUMSSS.js} +3 -3
- package/chunks/{cron-create-YIID5XAW.js → cron-create-2QK6TCEC.js} +6 -6
- package/chunks/{cron-delete-ZVHYCEP2.js → cron-delete-FDCDFYMG.js} +5 -5
- package/chunks/{cron-list-XEGS463Q.js → cron-list-XN3WVBTP.js} +6 -6
- package/chunks/{daemon-YO6433NF.js → daemon-Q2AB5Z23.js} +356 -15
- package/chunks/daemon-status-provider-3XJI6CAL.js +89 -0
- package/chunks/daemon-trust-policy-ILUDTLHD.js +84 -0
- package/chunks/daemon-trust-policy-monitor-HS3PKKRO.js +171 -0
- package/chunks/{de-HGRCYDEJ.js → de-SY6O76BF.js} +6 -1
- package/chunks/deferred-core-runtime-X4QV662U.js +88 -0
- package/chunks/dist-BSTVRPMT.js +4227 -0
- package/chunks/{dist-46NQKLTW.js → dist-DOLYHMXE.js} +2 -2
- package/chunks/{dist-AIKFMUKK.js → dist-HVRQ2CFL.js} +271 -11
- package/chunks/{dist-WEAHOXDM.js → dist-IXQEQWRG.js} +2 -1
- package/chunks/{dist-BBLXMS3N.js → dist-SSU66DM4.js} +3 -3
- package/chunks/{dist-F6IBUDR4.js → dist-SV7Q3AWJ.js} +1 -1
- package/chunks/{dist-YFNEUWSE.js → dist-YGBBMK3Z.js} +1 -1
- package/chunks/earlyInputCapture-XKLZT7ZD.js +81 -0
- package/chunks/{edit-OBDSQURM.js → edit-HHGIOTQ2.js} +47 -48
- package/chunks/{en-MTWBNGDO.js → en-NBK3JKCE.js} +9 -1
- package/chunks/{enter-worktree-U6MRPQ2P.js → enter-worktree-ZN7PUQ46.js} +47 -48
- package/chunks/{enterPlanMode-BC5QUZZ2.js → enterPlanMode-EIFIDSIV.js} +47 -48
- package/chunks/{environment-W5UFC2CH.js → environment-XXQ75D2Q.js} +48 -49
- package/chunks/errors-4GMVU7CK.js +87 -0
- package/chunks/esm-K5FARBNI.js +5548 -0
- package/chunks/{exit-worktree-DGNYMECB.js → exit-worktree-GXMI4ATY.js} +47 -48
- package/chunks/exitPlanMode-34UVY7M6.js +72 -0
- package/chunks/{fast-path-JJZFJANL.js → fast-path-VPIVA7L6.js} +16 -6
- package/chunks/{fr-45RLL55O.js → fr-4KG5V7UT.js} +6 -1
- package/chunks/{gemini-QS36EBZV.js → gemini-4BWIK4WD.js} +102 -99
- package/chunks/{geminiContentGenerator-AG4KB6CV.js → geminiContentGenerator-3XVV5MSS.js} +40 -11
- package/chunks/{getMachineId-bsd-V7W3GODC.js → getMachineId-bsd-FG7IUY6U.js} +1 -1
- package/chunks/{getMachineId-darwin-TDO75DQP.js → getMachineId-darwin-GLCJI2RA.js} +1 -1
- package/chunks/{getMachineId-linux-TF43WQT2.js → getMachineId-linux-O6OPPAKO.js} +1 -1
- package/chunks/{getMachineId-unsupported-ZGUO3TXT.js → getMachineId-unsupported-S6CKYVGC.js} +1 -1
- package/chunks/{getMachineId-win-ECFYZZFQ.js → getMachineId-win-X5SRNEH7.js} +1 -1
- package/chunks/{glob-V7R3PSK3.js → glob-TZ2ABCJG.js} +47 -48
- package/chunks/{grep-QYPSK7OP.js → grep-BEF463NA.js} +49 -49
- package/chunks/handleAutoUpdate-L6ERF36Y.js +80 -0
- package/chunks/i18n-FMM5FDXR.js +96 -0
- package/chunks/{image-gen-Z3VPGKRC.js → image-gen-HHVLF7HS.js} +12 -12
- package/chunks/initializer-625TIAIO.js +85 -0
- package/chunks/installationInfo-6AM4I2Y3.js +79 -0
- package/chunks/{ja-B7DF7DFG.js → ja-F3GSQXMF.js} +6 -1
- package/chunks/{keychain-token-storage-MDTG3WRM.js → keychain-token-storage-72IYCAZV.js} +3 -3
- package/chunks/lib-RUF3WZA6.js +9 -0
- package/chunks/list-L2GA674Y.js +88 -0
- package/chunks/{list-agents-5KJJHR6I.js → list-agents-R6KDXQR3.js} +3 -3
- package/chunks/loadedSettingsAdapter-SPUTNKAV.js +82 -0
- package/chunks/{loggingContentGenerator-HS3S5H3Q.js → loggingContentGenerator-LKOF7XI7.js} +78 -113
- package/chunks/{loop-wakeup-FXKNNYSY.js → loop-wakeup-3IQKCYAH.js} +7 -7
- package/chunks/{ls-NTK6VOQJ.js → ls-DKZ37A7N.js} +5 -5
- package/chunks/{lsp-2JI24STP.js → lsp-QNWN7KN3.js} +3 -3
- package/chunks/{managed-npm-update-JYEMMXA3.js → managed-npm-update-ACQGGIN5.js} +47 -48
- package/chunks/mcp-SZLHKFJW.js +82 -0
- package/chunks/{monitor-R3ODH5U6.js → monitor-DF52UVHI.js} +47 -48
- package/chunks/nonInteractiveCli-5T7KYKLK.js +144 -0
- package/chunks/{notebook-edit-BNOK452R.js → notebook-edit-FCWS4XVN.js} +47 -48
- package/chunks/{openaiContentGenerator-WMCU3O2H.js → openaiContentGenerator-7LDK3DCJ.js} +26 -27
- package/chunks/pidfile-6ERW3DF4.js +85 -0
- package/chunks/process-registry-2CHQBXH5.js +157 -0
- package/chunks/{processUtils-RT7UNCC2.js → processUtils-COKZAMUP.js} +2 -2
- package/chunks/{pt-22Q3FP73.js → pt-EQ33KWEN.js} +6 -1
- package/chunks/{qwenContentGenerator-HHCRK4SX.js → qwenContentGenerator-TKWUMR7N.js} +52 -53
- package/chunks/{qwenOAuth2-OWLB5AKH.js → qwenOAuth2-7HMU47SF.js} +10 -10
- package/chunks/read-file-X6DRC574.js +29 -0
- package/chunks/{read-mcp-resource-4DKQWGHD.js → read-mcp-resource-GFTWYXMK.js} +4 -4
- package/chunks/{record-artifact-RQKFYO5B.js → record-artifact-XAMSFSW4.js} +3 -3
- package/chunks/resumeHistoryUtils-PFPM2GWM.js +90 -0
- package/chunks/ripGrep-OWV2IVJC.js +72 -0
- package/chunks/{ru-FZCNZHDC.js → ru-7OZAUKGG.js} +6 -1
- package/chunks/{run-qwen-serve-FU6HEM4J.js → run-qwen-serve-TSTCO4XE.js} +953 -249
- package/chunks/{runtime-XXRRTNP6.js → runtime-DAUPSUKI.js} +56 -56
- package/chunks/{scheduler-G2ZS2Z7E.js → scheduler-KMADMT26.js} +46 -47
- package/chunks/{sdk-exporters-grpc-AK3LGHNO.js → sdk-exporters-grpc-54L4LS5L.js} +4 -4
- package/chunks/{sdk-exporters-http-FYBSUCPD.js → sdk-exporters-http-WO556XNU.js} +7 -7
- package/chunks/{sdk-impl-GMVPB7NB.js → sdk-impl-LPAVACSF.js} +14 -14
- package/chunks/{send-message-Q6OOR6BR.js → send-message-SAWK4DZX.js} +6 -6
- package/chunks/serve-NNRWS6F4.js +88 -0
- package/chunks/{server-4UMH7OIZ.js → server-WEH7DVCH.js} +3691 -823
- package/chunks/{session-K3O3Q2SV.js → session-WXC56V2I.js} +98 -95
- package/chunks/{settings-CR2EWTBA.js → settings-DJDXFDZ3.js} +55 -56
- package/chunks/shell-JN5VRQXD.js +82 -0
- package/chunks/{skill-I3SDA4MB.js → skill-SGXPKJCS.js} +20 -21
- package/chunks/skill-settings-VJ5PDMZI.js +90 -0
- package/chunks/spawnChannel-ETMJW7YX.js +81 -0
- package/chunks/standalone-update-MK3Z7KBI.js +91 -0
- package/chunks/{startInteractiveUI-SLZGHRPH.js → startInteractiveUI-ZCGIXPGT.js} +724 -383
- package/chunks/{syntheticOutput-I3757IWH.js → syntheticOutput-355CB6CJ.js} +4 -4
- package/chunks/{task-create-N7WQSGYA.js → task-create-INGWNUG4.js} +10 -10
- package/chunks/{task-list-FOPULZEP.js → task-list-5XNNGTF4.js} +7 -7
- package/chunks/{task-stop-H6RHXFVQ.js → task-stop-4ROAOBXH.js} +3 -3
- package/chunks/{task-update-M57TFZJT.js → task-update-CRK5VWWZ.js} +10 -10
- package/chunks/{team-create-YJALH5D2.js → team-create-QQGAJG7P.js} +49 -50
- package/chunks/{team-delete-QE2UXJL7.js → team-delete-S2RCXA4P.js} +7 -7
- package/chunks/{team-plan-approval-34QFYKGN.js → team-plan-approval-RT7Q5R6O.js} +47 -48
- package/chunks/theme-manager-EEWIQJ7J.js +76 -0
- package/chunks/{todoWrite-VQ7FKOHL.js → todoWrite-7WM3VDMY.js} +7 -7
- package/chunks/{tool-search-NF7GB6LE.js → tool-search-Z3Z4AYKP.js} +19 -21
- package/chunks/total-session-admission-44JKRWQD.js +84 -0
- package/chunks/trustedFolders-X2JEIO57.js +94 -0
- package/chunks/{update-relaunch-WBUZJC5O.js → update-relaunch-VWNPYDIP.js} +5 -5
- package/chunks/updateCheck-KAQH67DV.js +91 -0
- package/chunks/useAutoAcceptIndicator-JH6BCF7S.js +92 -0
- package/chunks/{validateNonInterActiveAuth-3R223G3R.js → validateNonInterActiveAuth-GIUJ2UFS.js} +93 -90
- package/chunks/{version-HS7YSFHV.js → version-BGLYIJUY.js} +1 -1
- package/chunks/{web-fetch-NKCSG7ZE.js → web-fetch-OTDU4VQF.js} +19 -21
- package/chunks/{web-search-S62WAP4S.js → web-search-FP6SIHPR.js} +13 -13
- package/chunks/{workflow-QAGU5RU4.js → workflow-YCIVBYSB.js} +48 -49
- package/chunks/workspace-providers-status-S35YAIUS.js +85 -0
- package/chunks/{workspace-registration-store-24JMHDGF.js → workspace-registration-store-OTMS3H4C.js} +1 -1
- package/chunks/workspace-registry-O63R6IZ4.js +92 -0
- package/chunks/workspace-service-M6LLHKJ5.js +99 -0
- package/chunks/workspace-skills-status-C2V7BAIS.js +85 -0
- package/chunks/workspace-trust-reconciler-IBUPOUJN.js +345 -0
- package/chunks/write-file-3BZC3EAE.js +72 -0
- package/chunks/xterm-headless-NTYVIBT3.js +3475 -0
- package/chunks/{zh-LUIGBD55.js → zh-H3YDK5QW.js} +9 -1
- package/chunks/{zh-TW-F5KG2IYD.js → zh-TW-JYCP7XUA.js} +9 -1
- package/chunks/zoom-image-TZ6S2O57.js +351 -0
- package/cli.js +13 -13
- package/locales/ca.js +7 -2
- package/locales/de.js +7 -2
- package/locales/en.js +10 -2
- package/locales/fr.js +7 -2
- package/locales/ja.js +7 -2
- package/locales/pt.js +7 -2
- package/locales/ru.js +7 -2
- package/locales/zh-TW.js +10 -2
- package/locales/zh.js +10 -2
- package/package.json +5 -4
- package/web-shell/assets/{arc-DcbWnB9T.js → arc-75-Wdeo3.js} +1 -1
- package/web-shell/assets/{architectureDiagram-3BPJPVTR-kMMF5sud.js → architectureDiagram-3BPJPVTR-FKeXQbyP.js} +1 -1
- package/web-shell/assets/{blockDiagram-GPEHLZMM-Htl9vTJS.js → blockDiagram-GPEHLZMM-CY0vc-A3.js} +1 -1
- package/web-shell/assets/{c4Diagram-AAUBKEIU-BnZnm0mQ.js → c4Diagram-AAUBKEIU-CNP-A-8u.js} +1 -1
- package/web-shell/assets/channel-DPYMT76A.js +1 -0
- package/web-shell/assets/{chunk-2J33WTMH-DziB7kDG.js → chunk-2J33WTMH-GybS4Gii.js} +1 -1
- package/web-shell/assets/{chunk-4BX2VUAB-CmkD8daw.js → chunk-4BX2VUAB-02H91V8v.js} +1 -1
- package/web-shell/assets/{chunk-55IACEB6-CHAd9A_U.js → chunk-55IACEB6-D3M-2VT6.js} +1 -1
- package/web-shell/assets/{chunk-727SXJPM-Dqaam3fE.js → chunk-727SXJPM-CCu29u4H.js} +1 -1
- package/web-shell/assets/{chunk-AQP2D5EJ-D_-saBYM.js → chunk-AQP2D5EJ-CaFKWgrn.js} +1 -1
- package/web-shell/assets/{chunk-FMBD7UC4-B9r_veWD.js → chunk-FMBD7UC4-ZZpPqIwQ.js} +1 -1
- package/web-shell/assets/{chunk-ND2GUHAM-B3EaCSpL.js → chunk-ND2GUHAM-D22DqGs8.js} +1 -1
- package/web-shell/assets/{chunk-QZHKN3VN-CYq8x9mn.js → chunk-QZHKN3VN-Bu85S0fw.js} +1 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK--JstsIgL.js +1 -0
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2--JstsIgL.js +1 -0
- package/web-shell/assets/{cose-bilkent-S5V4N54A-D0ng4uiB.js → cose-bilkent-S5V4N54A-f1CK1Gwe.js} +1 -1
- package/web-shell/assets/{dagre-BM42HDAG-DCZollQv.js → dagre-BM42HDAG-D0Ow8F_n.js} +1 -1
- package/web-shell/assets/{diagram-2AECGRRQ-Dfk2pWS0.js → diagram-2AECGRRQ-BPrmTWp8.js} +1 -1
- package/web-shell/assets/{diagram-5GNKFQAL-kX38ltWR.js → diagram-5GNKFQAL-HccuFAzy.js} +1 -1
- package/web-shell/assets/{diagram-KO2AKTUF-CJz2vsXh.js → diagram-KO2AKTUF-BrS76mbA.js} +1 -1
- package/web-shell/assets/{diagram-LMA3HP47-BvMLZm_7.js → diagram-LMA3HP47-V7T9lU-5.js} +1 -1
- package/web-shell/assets/{diagram-OG6HWLK6-l7kfStkO.js → diagram-OG6HWLK6-DKidyJMR.js} +1 -1
- package/web-shell/assets/{erDiagram-TEJ5UH35-BSVa8GGT.js → erDiagram-TEJ5UH35-DBadZIkp.js} +1 -1
- package/web-shell/assets/{flowDiagram-I6XJVG4X-CoawKIXH.js → flowDiagram-I6XJVG4X-BymfqdNJ.js} +1 -1
- package/web-shell/assets/{ganttDiagram-6RSMTGT7-DFUDH0zF.js → ganttDiagram-6RSMTGT7-DOw340jf.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-PVQCEYII-Y2pvpT4e.js → gitGraphDiagram-PVQCEYII-_8EiD8sl.js} +1 -1
- package/web-shell/assets/{index-D0GX0zZf.js → index-CKIadvET.js} +1 -1
- package/web-shell/assets/index-D1eXNRHe.js +1389 -0
- package/web-shell/assets/index-DVLD4CQq.css +5 -0
- package/web-shell/assets/{infoDiagram-5YYISTIA-CU8_zLiX.js → infoDiagram-5YYISTIA-D61KYQBu.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-AVQiV0DU.js → ishikawaDiagram-YF4QCWOH-CsiXSpNx.js} +1 -1
- package/web-shell/assets/{journeyDiagram-JHISSGLW-DQ0VSKa3.js → journeyDiagram-JHISSGLW-Sdfionyh.js} +1 -1
- package/web-shell/assets/{kanban-definition-UN3LZRKU-BqnWqsE_.js → kanban-definition-UN3LZRKU-C3WI3Cnl.js} +1 -1
- package/web-shell/assets/{linear-BkoihsaA.js → linear-Dpigcc62.js} +1 -1
- package/web-shell/assets/{mermaid.core-5RJs-31j.js → mermaid.core-Ct97pqgW.js} +5 -5
- package/web-shell/assets/{mindmap-definition-RKZ34NQL-D33Bxnpd.js → mindmap-definition-RKZ34NQL-BzeaN0rB.js} +1 -1
- package/web-shell/assets/{pieDiagram-4H26LBE5-BuEAw3BH.js → pieDiagram-4H26LBE5-CvjgcbVD.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-W4KKPZXB-Kox_usEq.js → quadrantDiagram-W4KKPZXB-BUzgTNdH.js} +1 -1
- package/web-shell/assets/{requirementDiagram-4Y6WPE33-CNjeUif0.js → requirementDiagram-4Y6WPE33-B7zKlgUQ.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-5OEKKPKP-BCd2OL_U.js → sankeyDiagram-5OEKKPKP-Bb9CQgrT.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-3UESZ5HK-CF2ZTsz0.js → sequenceDiagram-3UESZ5HK-DJ6V7itG.js} +1 -1
- package/web-shell/assets/{stateDiagram-AJRCARHV-qenSzHtm.js → stateDiagram-AJRCARHV-IImflERY.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-CYI_YoNR.js +1 -0
- package/web-shell/assets/{timeline-definition-PNZ67QCA-B5DyWdgs.js → timeline-definition-PNZ67QCA-6Q_uWHKh.js} +1 -1
- package/web-shell/assets/{vennDiagram-CIIHVFJN-DqP4I_o_.js → vennDiagram-CIIHVFJN-TmyKyjwv.js} +1 -1
- package/web-shell/assets/{wardley-L42UT6IY-CJe2e4mg.js → wardley-L42UT6IY-CRh9uiPv.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-YWT4CUSO-BMDSw-Rr.js → wardleyDiagram-YWT4CUSO-59TKAW8w.js} +1 -1
- package/web-shell/assets/{xychartDiagram-2RQKCTM6-BTVZYkxD.js → xychartDiagram-2RQKCTM6-GCSUIK2L.js} +1 -1
- package/web-shell/index.html +2 -2
- package/chunks/MaxSizedBox-5DPPWPGT.js +0 -85
- package/chunks/agent-6ODUANDO.js +0 -81
- package/chunks/agent-headless-7BYQTMHW.js +0 -75
- package/chunks/bridge-ZUB64FAE.js +0 -90
- package/chunks/chunk-LEH5C7FV.js +0 -232
- package/chunks/chunk-SZRN75WQ.js +0 -29
- package/chunks/chunk-UGYMA4EI.js +0 -219
- package/chunks/chunk-Z2BC6UJ5.js +0 -8575
- package/chunks/contextCommand-JLHYA34Z.js +0 -80
- package/chunks/daemon-status-provider-2233Q37D.js +0 -89
- package/chunks/earlyInputCapture-A7NDU3PF.js +0 -82
- package/chunks/errors-M7CLORXH.js +0 -88
- package/chunks/exitPlanMode-GXTBWQAR.js +0 -403
- package/chunks/handleAutoUpdate-6DBEZYPV.js +0 -81
- package/chunks/i18n-VUJJZIMU.js +0 -97
- package/chunks/initializer-UWAK5U5O.js +0 -86
- package/chunks/installationInfo-6O2YAA52.js +0 -80
- package/chunks/list-GB4ESM3T.js +0 -89
- package/chunks/loadedSettingsAdapter-OT6JVQ7U.js +0 -83
- package/chunks/mcp-6DBDJPFU.js +0 -83
- package/chunks/nonInteractiveCli-MOYCYBBU.js +0 -141
- package/chunks/pidfile-TFRZZZIO.js +0 -86
- package/chunks/read-file-APMO3PSX.js +0 -31
- package/chunks/resumeHistoryUtils-6KRYEAWZ.js +0 -91
- package/chunks/ripGrep-BEJDEDXW.js +0 -73
- package/chunks/serve-7BSTXJ4T.js +0 -89
- package/chunks/shell-HH3PF3A2.js +0 -83
- package/chunks/spawnChannel-RWNDBXGA.js +0 -82
- package/chunks/src-GE4TTTML.js +0 -3147
- package/chunks/standalone-update-Q6WFRZZQ.js +0 -92
- package/chunks/theme-manager-SWRILQHI.js +0 -77
- package/chunks/total-session-admission-DLHHHLD3.js +0 -84
- package/chunks/trustedFolders-KHXHY6PY.js +0 -93
- package/chunks/updateCheck-RKL6M5XN.js +0 -92
- package/chunks/useAutoAcceptIndicator-CFQ5BUJL.js +0 -93
- package/chunks/workspace-providers-status-QSVZUETE.js +0 -86
- package/chunks/workspace-registry-UT4RBNBM.js +0 -88
- package/chunks/workspace-service-JFWRUS4V.js +0 -98
- package/chunks/workspace-skills-status-ZBBKJOI2.js +0 -85
- package/chunks/write-file-VHIXW5M7.js +0 -73
- package/web-shell/assets/channel-Cq7YKtfC.js +0 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-CQ9aC1Tg.js +0 -1
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CQ9aC1Tg.js +0 -1
- package/web-shell/assets/index-D9haPt0X.css +0 -5
- package/web-shell/assets/index-ckX9Pq5k.js +0 -1230
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-B7W4zlCr.js +0 -1
- package/chunks/{chunk-TARRHLLG.js → chunk-QUGAUQGJ.js} +25 -25
- package/chunks/{chunk-U7ZFW55U.js → chunk-VOQXFAY5.js} +977 -977
- /package/chunks/{chunk-LXXMOYPL.js → chunk-VXZBKKQR.js} +0 -0
|
@@ -12,49 +12,53 @@ import {
|
|
|
12
12
|
matchMcpServerByRef,
|
|
13
13
|
parseExtensionRef,
|
|
14
14
|
parseMcpServerRef
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-TV64SXKD.js";
|
|
16
16
|
import {
|
|
17
17
|
getAvailableCommands,
|
|
18
18
|
handleSlashCommand,
|
|
19
19
|
insertAfterFunctionResponses,
|
|
20
20
|
isSlashCommand,
|
|
21
21
|
normalizePartList
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import {
|
|
24
|
-
collectContextData,
|
|
25
|
-
formatContextUsageText
|
|
26
|
-
} from "./chunk-R5AFZNQW.js";
|
|
22
|
+
} from "./chunk-J7OACQDE.js";
|
|
27
23
|
import {
|
|
28
24
|
recomputeMcpGating
|
|
29
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-A4COXFB3.js";
|
|
30
26
|
import {
|
|
31
27
|
appEvents,
|
|
32
28
|
buildDisabledSkillNamesProvider,
|
|
29
|
+
cleanupReviewWorktreeLeases,
|
|
33
30
|
loadCliConfig,
|
|
34
31
|
normalizeDisabledToolList
|
|
35
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-7BAU433D.js";
|
|
36
33
|
import {
|
|
37
34
|
getCommandSubcommandNames
|
|
38
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-JX27F6QS.js";
|
|
39
36
|
import {
|
|
40
37
|
getEffectiveSupportedModes
|
|
41
|
-
} from "./chunk-
|
|
42
|
-
import "./chunk-J56UI34H.js";
|
|
43
|
-
import "./chunk-4WGODMVR.js";
|
|
38
|
+
} from "./chunk-7AEJDLRA.js";
|
|
44
39
|
import "./chunk-PQNHRFJC.js";
|
|
45
|
-
import "./chunk-
|
|
46
|
-
import
|
|
47
|
-
|
|
40
|
+
import "./chunk-M7OONWYU.js";
|
|
41
|
+
import {
|
|
42
|
+
collectContextData,
|
|
43
|
+
formatContextUsageText
|
|
44
|
+
} from "./chunk-65PQENQP.js";
|
|
45
|
+
import "./chunk-4WGODMVR.js";
|
|
46
|
+
import "./chunk-GATT5TKW.js";
|
|
47
|
+
import "./chunk-EVKE2FZL.js";
|
|
48
|
+
import "./chunk-T3O2B4XO.js";
|
|
49
|
+
import "./chunk-7DXQIJID.js";
|
|
50
|
+
import "./chunk-YAF2MQZ6.js";
|
|
51
|
+
import {
|
|
52
|
+
computeCpuPercent
|
|
53
|
+
} from "./chunk-HGT6JR3U.js";
|
|
54
|
+
import "./chunk-S4WJVPZW.js";
|
|
48
55
|
import "./chunk-6H67XLET.js";
|
|
49
56
|
import {
|
|
50
57
|
beginAcpBootstrapConfigProfiling,
|
|
51
58
|
buildAndFreezeAcpStartupProfile,
|
|
52
59
|
endAcpBootstrapConfigProfiling,
|
|
53
60
|
markAcpStartup
|
|
54
|
-
} from "./chunk-
|
|
55
|
-
import "./chunk-7MVVZO4N.js";
|
|
56
|
-
import "./chunk-IKYJHJNF.js";
|
|
57
|
-
import "./chunk-YAF2MQZ6.js";
|
|
61
|
+
} from "./chunk-3L2SPEBH.js";
|
|
58
62
|
import {
|
|
59
63
|
GENERATION_MAX_PROMPT_BYTES,
|
|
60
64
|
GENERATION_TIMEOUT_MS,
|
|
@@ -74,7 +78,7 @@ import {
|
|
|
74
78
|
shouldSuppressRememberErrorDetails,
|
|
75
79
|
workspaceMemoryFailureCode,
|
|
76
80
|
workspaceMemoryFailureDiagnostics
|
|
77
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-6PE7N3A4.js";
|
|
78
82
|
import {
|
|
79
83
|
HistoryReplayer,
|
|
80
84
|
MessageEmitter,
|
|
@@ -84,71 +88,48 @@ import {
|
|
|
84
88
|
goalTerminalEventToHistoryItem,
|
|
85
89
|
recordGoalStatusItem,
|
|
86
90
|
restoreGoalFromHistory
|
|
87
|
-
} from "./chunk-
|
|
88
|
-
import "./chunk-
|
|
89
|
-
import "./chunk-
|
|
90
|
-
import "./chunk-
|
|
91
|
+
} from "./chunk-LO4ROVP4.js";
|
|
92
|
+
import "./chunk-LGAOC3ZS.js";
|
|
93
|
+
import "./chunk-XFZYFU3I.js";
|
|
94
|
+
import "./chunk-YDLJGZHL.js";
|
|
91
95
|
import "./chunk-2MIN6GRR.js";
|
|
92
96
|
import "./chunk-QHTIBUWB.js";
|
|
93
97
|
import {
|
|
94
98
|
isTerminalGoalStatusKind
|
|
95
99
|
} from "./chunk-QTERJVPZ.js";
|
|
96
100
|
import "./chunk-3Z43GZUQ.js";
|
|
101
|
+
import "./chunk-RXFQM6FQ.js";
|
|
97
102
|
import {
|
|
98
103
|
PERMISSION_RULE_TYPES,
|
|
99
104
|
PermissionRulesValidationError,
|
|
100
105
|
buildPermissionSettings,
|
|
101
106
|
normalizePermissionRules,
|
|
102
107
|
readPermissionRuleSet
|
|
103
|
-
} from "./chunk-
|
|
108
|
+
} from "./chunk-MR5EAQ5M.js";
|
|
104
109
|
import {
|
|
105
110
|
MAX_AUDIO_BYTES,
|
|
106
111
|
sanitizeVoiceErrorMessage,
|
|
107
112
|
transcribeVoiceAudio
|
|
108
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-CAPPWD3X.js";
|
|
109
114
|
import {
|
|
110
115
|
readVoiceModel
|
|
111
|
-
} from "./chunk-
|
|
112
|
-
import "./chunk-
|
|
113
|
-
import {
|
|
114
|
-
computeCpuPercent
|
|
115
|
-
} from "./chunk-HGT6JR3U.js";
|
|
116
|
-
import "./chunk-RXFQM6FQ.js";
|
|
117
|
-
import "./chunk-PSOO6YXD.js";
|
|
118
|
-
import "./chunk-PC6JANNU.js";
|
|
119
|
-
import "./chunk-57OAHC2Y.js";
|
|
116
|
+
} from "./chunk-JTV5K7NH.js";
|
|
117
|
+
import "./chunk-ZHBO7WVX.js";
|
|
120
118
|
import {
|
|
121
119
|
createLoadedSettingsAdapter
|
|
122
|
-
} from "./chunk-
|
|
123
|
-
import "./chunk-
|
|
124
|
-
import "./chunk-
|
|
120
|
+
} from "./chunk-WUZ7H6DP.js";
|
|
121
|
+
import "./chunk-VXZBKKQR.js";
|
|
122
|
+
import "./chunk-QIZKCVM3.js";
|
|
125
123
|
import "./chunk-E5Z2AVNV.js";
|
|
126
124
|
import {
|
|
127
125
|
parseSessionSource
|
|
128
|
-
} from "./chunk-
|
|
126
|
+
} from "./chunk-ZURDMIDR.js";
|
|
129
127
|
import "./chunk-GLWP3FDB.js";
|
|
130
|
-
import
|
|
131
|
-
|
|
132
|
-
isNotCurrentlyGeneratingCancelError
|
|
133
|
-
} from "./chunk-UH3WSE5L.js";
|
|
134
|
-
import "./chunk-COH43MRJ.js";
|
|
135
|
-
import {
|
|
136
|
-
CHANNEL_STARTUP_PROFILE_META_KEY,
|
|
137
|
-
CHANNEL_STARTUP_PROFILE_VERSION,
|
|
138
|
-
CLIENT_MCP_OVER_WS_CONFIG_FLAG,
|
|
139
|
-
DAEMON_CHANNEL_DELIVERY_META_KEY,
|
|
140
|
-
LOAD_REPLAY_BULK_MODE,
|
|
141
|
-
LOAD_REPLAY_META_KEY,
|
|
142
|
-
LOAD_REPLAY_MODE_META_KEY,
|
|
143
|
-
LOAD_REPLAY_PAGE_SIZE_META_KEY,
|
|
144
|
-
LOAD_REPLAY_VERSION,
|
|
145
|
-
MID_TURN_QUEUE_DRAIN_METHOD,
|
|
146
|
-
PROMPT_CANCEL_METHOD,
|
|
147
|
-
TODO_STOP_GUARD_QUEUE_RELEASE_METHOD
|
|
148
|
-
} from "./chunk-3SJ43L4W.js";
|
|
128
|
+
import "./chunk-XCGIMOLN.js";
|
|
129
|
+
import "./chunk-OCPBI7J5.js";
|
|
149
130
|
import {
|
|
150
131
|
ndJsonStream
|
|
151
|
-
} from "./chunk-
|
|
132
|
+
} from "./chunk-KAMYKP7E.js";
|
|
152
133
|
import {
|
|
153
134
|
ACP_ROUTE_ID_PREFIX,
|
|
154
135
|
buildAcpModelOptions,
|
|
@@ -157,10 +138,10 @@ import {
|
|
|
157
138
|
parseAcpModelOption,
|
|
158
139
|
resolveAcpModelOption,
|
|
159
140
|
sanitizeProviderBaseUrl
|
|
160
|
-
} from "./chunk-
|
|
141
|
+
} from "./chunk-KCO4FLFJ.js";
|
|
161
142
|
import {
|
|
162
143
|
mapSkillConfigToStatus
|
|
163
|
-
} from "./chunk-
|
|
144
|
+
} from "./chunk-L55JWS76.js";
|
|
164
145
|
import {
|
|
165
146
|
ACP_PREFLIGHT_KINDS,
|
|
166
147
|
IDLE_HOOK_EVENTS,
|
|
@@ -168,28 +149,55 @@ import {
|
|
|
168
149
|
SERVE_STATUS_EXT_METHODS,
|
|
169
150
|
STATUS_SCHEMA_VERSION,
|
|
170
151
|
mapDomainErrorToErrorKind
|
|
171
|
-
} from "./chunk-
|
|
172
|
-
import
|
|
173
|
-
|
|
174
|
-
|
|
152
|
+
} from "./chunk-FTD6DP4T.js";
|
|
153
|
+
import {
|
|
154
|
+
resolveSkillSettings
|
|
155
|
+
} from "./chunk-Z4X5MTRT.js";
|
|
156
|
+
import "./chunk-BNWB5CYE.js";
|
|
157
|
+
import "./chunk-5MKRTI4T.js";
|
|
158
|
+
import "./chunk-57OAHC2Y.js";
|
|
159
|
+
import "./chunk-2XSLTRFZ.js";
|
|
160
|
+
import "./chunk-TFRMVU6R.js";
|
|
161
|
+
import "./chunk-XBYYDKAZ.js";
|
|
175
162
|
import "./chunk-V6WHFGST.js";
|
|
176
163
|
import {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
164
|
+
CHANNEL_STARTUP_PROFILE_META_KEY,
|
|
165
|
+
CHANNEL_STARTUP_PROFILE_VERSION,
|
|
166
|
+
CLIENT_MCP_OVER_WS_CONFIG_FLAG,
|
|
167
|
+
DAEMON_CHANNEL_DELIVERY_META_KEY,
|
|
168
|
+
LOAD_REPLAY_BULK_MODE,
|
|
169
|
+
LOAD_REPLAY_META_KEY,
|
|
170
|
+
LOAD_REPLAY_MODE_META_KEY,
|
|
171
|
+
LOAD_REPLAY_PAGE_SIZE_META_KEY,
|
|
172
|
+
LOAD_REPLAY_VERSION,
|
|
173
|
+
MID_TURN_QUEUE_DRAIN_METHOD,
|
|
174
|
+
PROMPT_CANCEL_METHOD,
|
|
175
|
+
TODO_STOP_GUARD_CONTINUATION_CLAIM_METHOD,
|
|
176
|
+
TODO_STOP_GUARD_QUEUE_RELEASE_METHOD
|
|
177
|
+
} from "./chunk-XZC5VLBZ.js";
|
|
178
|
+
import {
|
|
179
|
+
NOT_CURRENTLY_GENERATING_CANCEL_MESSAGE,
|
|
180
|
+
isNotCurrentlyGeneratingCancelError
|
|
181
|
+
} from "./chunk-B4AJNNOL.js";
|
|
181
182
|
import "./chunk-2RFKHEXL.js";
|
|
182
|
-
import "./chunk-
|
|
183
|
-
import "./chunk-
|
|
183
|
+
import "./chunk-FYJ7W2PI.js";
|
|
184
|
+
import "./chunk-U4VTUMMK.js";
|
|
185
|
+
import "./chunk-GZ3RCT54.js";
|
|
186
|
+
import "./chunk-ALMR3E6Q.js";
|
|
184
187
|
import "./chunk-BK2UNYWD.js";
|
|
185
188
|
import "./chunk-M5GB774H.js";
|
|
186
|
-
import "./chunk-
|
|
189
|
+
import "./chunk-4G2BISNC.js";
|
|
190
|
+
import "./chunk-GEBV2JGB.js";
|
|
191
|
+
import "./chunk-7I5GTCT4.js";
|
|
187
192
|
import {
|
|
188
193
|
AgentSideConnection,
|
|
189
194
|
PROTOCOL_VERSION,
|
|
190
195
|
RequestError
|
|
191
196
|
} from "./chunk-UDXSXLER.js";
|
|
192
|
-
import
|
|
197
|
+
import {
|
|
198
|
+
assembleMcpServers,
|
|
199
|
+
loadMcpApprovals
|
|
200
|
+
} from "./chunk-6RPMI2AB.js";
|
|
193
201
|
import {
|
|
194
202
|
getOutputLanguageFilePath,
|
|
195
203
|
getPersistScopeForModelSelection,
|
|
@@ -198,38 +206,39 @@ import {
|
|
|
198
206
|
resolveOutputLanguageOrPreserveAuto,
|
|
199
207
|
updateOutputLanguageFile,
|
|
200
208
|
writeOutputLanguageAndRegisterPath
|
|
201
|
-
} from "./chunk-
|
|
209
|
+
} from "./chunk-EIF3FXTB.js";
|
|
202
210
|
import "./chunk-RKUWKYED.js";
|
|
203
|
-
import "./chunk-GOXKNSDZ.js";
|
|
204
|
-
import {
|
|
205
|
-
getSystemDefaultsPath,
|
|
206
|
-
getSystemSettingsPath
|
|
207
|
-
} from "./chunk-IDS7MSUP.js";
|
|
208
211
|
import {
|
|
209
212
|
SUPPORTED_LANGUAGES,
|
|
210
213
|
getCurrentLanguage,
|
|
211
214
|
setLanguageAsync
|
|
212
|
-
} from "./chunk-
|
|
215
|
+
} from "./chunk-TCIFAA7K.js";
|
|
213
216
|
import {
|
|
214
217
|
findEnvFiles,
|
|
215
218
|
preResolveHomeEnvOverrides,
|
|
216
219
|
reloadEnvironment
|
|
217
|
-
} from "./chunk-
|
|
220
|
+
} from "./chunk-2N7CODY5.js";
|
|
221
|
+
import "./chunk-VWOOBLTY.js";
|
|
222
|
+
import "./chunk-GOXKNSDZ.js";
|
|
223
|
+
import {
|
|
224
|
+
getSystemDefaultsPath,
|
|
225
|
+
getSystemSettingsPath
|
|
226
|
+
} from "./chunk-IDS7MSUP.js";
|
|
218
227
|
import "./chunk-6PEXNQTX.js";
|
|
219
|
-
import "./chunk-
|
|
228
|
+
import "./chunk-XFSFZCM5.js";
|
|
229
|
+
import "./chunk-VYOXCEPJ.js";
|
|
220
230
|
import "./chunk-VJNBRRZG.js";
|
|
221
231
|
import {
|
|
222
232
|
isFolderTrustEnabled,
|
|
223
233
|
isWorkspaceTrusted,
|
|
224
234
|
loadTrustedFolders
|
|
225
|
-
} from "./chunk-
|
|
235
|
+
} from "./chunk-Q43KPN7X.js";
|
|
226
236
|
import "./chunk-ALGGS7UH.js";
|
|
227
237
|
import "./chunk-MR3PXB6E.js";
|
|
228
238
|
import {
|
|
229
239
|
writeStderrLine,
|
|
230
240
|
writeStderrLineSafe
|
|
231
241
|
} from "./chunk-OWAK7LMW.js";
|
|
232
|
-
import "./chunk-XFSFZCM5.js";
|
|
233
242
|
import {
|
|
234
243
|
ALL_PROVIDERS,
|
|
235
244
|
APPROVAL_MODE_INFO,
|
|
@@ -269,6 +278,7 @@ import {
|
|
|
269
278
|
applyAutoModeDecision,
|
|
270
279
|
applyProviderInstallPlan,
|
|
271
280
|
approxBase64Bytes,
|
|
281
|
+
bridgeToolResultImages,
|
|
272
282
|
buildBackgroundEntryLabel,
|
|
273
283
|
buildBtwCacheSafeParams,
|
|
274
284
|
buildBtwPrompt,
|
|
@@ -329,6 +339,7 @@ import {
|
|
|
329
339
|
normalizeEventPayload,
|
|
330
340
|
normalizeSnapshotPayload,
|
|
331
341
|
persistPermissionOutcome,
|
|
342
|
+
promptIdContext,
|
|
332
343
|
readManyFiles,
|
|
333
344
|
recordAllow,
|
|
334
345
|
recordFallbackApprove,
|
|
@@ -352,68 +363,71 @@ import {
|
|
|
352
363
|
updateSetting,
|
|
353
364
|
validatePlanModeShellApproval,
|
|
354
365
|
validatePlanModeShellContext
|
|
355
|
-
} from "./chunk-
|
|
356
|
-
import "./chunk-5M6IDOMF.js";
|
|
366
|
+
} from "./chunk-X5WNMMIA.js";
|
|
357
367
|
import "./chunk-TWPJO254.js";
|
|
358
368
|
import {
|
|
359
369
|
external_exports
|
|
360
370
|
} from "./chunk-H6XPXXMH.js";
|
|
361
|
-
import "./chunk-
|
|
362
|
-
import "./chunk-
|
|
363
|
-
import "./chunk-
|
|
364
|
-
import "./chunk-
|
|
365
|
-
import "./chunk-FNQ6T3CV.js";
|
|
366
|
-
import "./chunk-ZOIFNCKL.js";
|
|
367
|
-
import "./chunk-PWTZEM3C.js";
|
|
371
|
+
import "./chunk-5M6IDOMF.js";
|
|
372
|
+
import "./chunk-UPUG4GXM.js";
|
|
373
|
+
import "./chunk-64LQLPL7.js";
|
|
374
|
+
import "./chunk-2LQTH543.js";
|
|
368
375
|
import "./chunk-KRXPRVGL.js";
|
|
376
|
+
import "./chunk-BMFALVGQ.js";
|
|
377
|
+
import "./chunk-CVHIL5IG.js";
|
|
378
|
+
import "./chunk-IRH27ZC2.js";
|
|
379
|
+
import "./chunk-QHWCP53L.js";
|
|
380
|
+
import "./chunk-PONHVBRT.js";
|
|
381
|
+
import "./chunk-T26EAKDL.js";
|
|
369
382
|
import {
|
|
370
383
|
parsePositiveIntegerEnv
|
|
371
384
|
} from "./chunk-6PVPNMXU.js";
|
|
372
|
-
import "./chunk-MZAXJAUM.js";
|
|
373
|
-
import "./chunk-SZRN75WQ.js";
|
|
374
|
-
import "./chunk-HTO4JFDZ.js";
|
|
375
385
|
import "./chunk-CPBF7KYF.js";
|
|
386
|
+
import "./chunk-6QIGFD5W.js";
|
|
387
|
+
import {
|
|
388
|
+
HookEventName,
|
|
389
|
+
createHookOutput
|
|
390
|
+
} from "./chunk-XWWKIXVD.js";
|
|
391
|
+
import "./chunk-75GFAX4R.js";
|
|
392
|
+
import "./chunk-OKF7JF3R.js";
|
|
376
393
|
import {
|
|
377
394
|
APPROVAL_MODES,
|
|
378
395
|
FORK_SUBAGENT_TYPE,
|
|
379
396
|
getStartupContextLength,
|
|
380
397
|
isSystemReminderContent,
|
|
381
398
|
runWithRuntimeContentGenerator
|
|
382
|
-
} from "./chunk-
|
|
383
|
-
import "./chunk-
|
|
384
|
-
import "./chunk-JZA3JUDJ.js";
|
|
385
|
-
import {
|
|
386
|
-
HookEventName,
|
|
387
|
-
createHookOutput
|
|
388
|
-
} from "./chunk-3QMGYBFN.js";
|
|
399
|
+
} from "./chunk-JSD33JG6.js";
|
|
400
|
+
import "./chunk-S6LOFUVP.js";
|
|
389
401
|
import "./chunk-JCW2R7WC.js";
|
|
390
|
-
import "./chunk-
|
|
391
|
-
import "./chunk-
|
|
392
|
-
import "./chunk-E5TUC6CA.js";
|
|
402
|
+
import "./chunk-2DN4J57Y.js";
|
|
403
|
+
import "./chunk-ZPJWUGCS.js";
|
|
393
404
|
import {
|
|
394
405
|
clearCachedCredentialFile,
|
|
395
406
|
qwenOAuth2Events
|
|
396
|
-
} from "./chunk-
|
|
397
|
-
import "./chunk-
|
|
398
|
-
import "./chunk-
|
|
399
|
-
import "./chunk-
|
|
400
|
-
import "./chunk-
|
|
401
|
-
import "./chunk-
|
|
407
|
+
} from "./chunk-2LKVPASC.js";
|
|
408
|
+
import "./chunk-NAVJD2PQ.js";
|
|
409
|
+
import "./chunk-LW3RFMG7.js";
|
|
410
|
+
import "./chunk-W4MIWP6M.js";
|
|
411
|
+
import "./chunk-DGEIYUC3.js";
|
|
412
|
+
import "./chunk-MPHPFVKK.js";
|
|
402
413
|
import "./chunk-GLNBDYUX.js";
|
|
403
414
|
import "./chunk-DJ2GSRLV.js";
|
|
404
|
-
import "./chunk-
|
|
415
|
+
import "./chunk-5KTQXHPY.js";
|
|
405
416
|
import {
|
|
417
|
+
addToolArgumentsAttributes,
|
|
418
|
+
addToolCallResultAttributes,
|
|
406
419
|
extractDaemonTraceContext,
|
|
407
420
|
registerAcpEventLoopLagGauge,
|
|
408
421
|
startEventLoopLagMonitor,
|
|
409
422
|
withDaemonSpan
|
|
410
|
-
} from "./chunk-
|
|
411
|
-
import "./chunk-
|
|
423
|
+
} from "./chunk-75MIQ3LV.js";
|
|
424
|
+
import "./chunk-2J3OJGTL.js";
|
|
412
425
|
import "./chunk-P3QQPMQA.js";
|
|
413
|
-
import "./chunk-
|
|
426
|
+
import "./chunk-RPLGZJV2.js";
|
|
414
427
|
import {
|
|
415
428
|
getToolCallPreparations
|
|
416
|
-
} from "./chunk-
|
|
429
|
+
} from "./chunk-GLCZKT5V.js";
|
|
430
|
+
import "./chunk-DZLYR4U3.js";
|
|
417
431
|
import {
|
|
418
432
|
ConversationFinishedEvent,
|
|
419
433
|
DiscoveredMCPTool,
|
|
@@ -427,6 +441,7 @@ import {
|
|
|
427
441
|
formatVisionBridgeNotice,
|
|
428
442
|
getAllGeminiMdFilenames,
|
|
429
443
|
getFullTurnVisionModelSelector,
|
|
444
|
+
getInvocationContext,
|
|
430
445
|
getMCPServerStatus,
|
|
431
446
|
getSpecificMimeType,
|
|
432
447
|
hasImageParts,
|
|
@@ -443,25 +458,30 @@ import {
|
|
|
443
458
|
shouldRunVisionBridge,
|
|
444
459
|
splitImageParts,
|
|
445
460
|
uiTelemetryService
|
|
446
|
-
} from "./chunk-
|
|
461
|
+
} from "./chunk-PT722TDT.js";
|
|
447
462
|
import "./chunk-VGC4I5JJ.js";
|
|
448
463
|
import {
|
|
449
464
|
getAutoMemoryRoot,
|
|
450
465
|
getUserAutoMemoryRoot
|
|
451
|
-
} from "./chunk-
|
|
466
|
+
} from "./chunk-SGFT55XI.js";
|
|
467
|
+
import "./chunk-Y4IHBGBP.js";
|
|
452
468
|
import {
|
|
453
|
-
|
|
454
|
-
|
|
469
|
+
ToolConfirmationOutcome,
|
|
470
|
+
ToolNames,
|
|
471
|
+
isShellProgressData
|
|
472
|
+
} from "./chunk-Y6AXW2OG.js";
|
|
473
|
+
import {
|
|
474
|
+
AuthType,
|
|
475
|
+
preloadContentGenerator
|
|
476
|
+
} from "./chunk-VCPIZRYH.js";
|
|
455
477
|
import "./chunk-46UV252V.js";
|
|
456
|
-
import "./chunk-A4UCTEB5.js";
|
|
457
|
-
import "./chunk-XWRJCPHC.js";
|
|
458
478
|
import {
|
|
459
479
|
DEFAULT_TOKEN_LIMIT,
|
|
460
480
|
tokenLimit
|
|
461
|
-
} from "./chunk-
|
|
462
|
-
import "./chunk-
|
|
463
|
-
import "./chunk-
|
|
464
|
-
import "./chunk-
|
|
481
|
+
} from "./chunk-ZBVS26BY.js";
|
|
482
|
+
import "./chunk-WZRWHXFE.js";
|
|
483
|
+
import "./chunk-A3NDJ5SB.js";
|
|
484
|
+
import "./chunk-7XATOOE7.js";
|
|
465
485
|
import {
|
|
466
486
|
endToolExecutionSpan,
|
|
467
487
|
endToolSpan,
|
|
@@ -470,32 +490,26 @@ import {
|
|
|
470
490
|
startToolExecutionSpan,
|
|
471
491
|
startToolSpan,
|
|
472
492
|
withInteractionSpan
|
|
473
|
-
} from "./chunk-
|
|
474
|
-
import "./chunk-
|
|
475
|
-
import "./chunk-
|
|
476
|
-
import "./chunk-U7ZFW55U.js";
|
|
477
|
-
import "./chunk-UUUTRMI2.js";
|
|
478
|
-
import {
|
|
479
|
-
ToolConfirmationOutcome,
|
|
480
|
-
ToolNames,
|
|
481
|
-
isShellProgressData
|
|
482
|
-
} from "./chunk-PR75REBZ.js";
|
|
493
|
+
} from "./chunk-BGTQCTQW.js";
|
|
494
|
+
import "./chunk-W4RQUHY3.js";
|
|
495
|
+
import "./chunk-S7W2GKIO.js";
|
|
483
496
|
import {
|
|
484
497
|
Storage,
|
|
485
498
|
createDebugLogger,
|
|
486
499
|
getErrorMessage,
|
|
487
500
|
getErrorStatus,
|
|
488
501
|
isSubpath
|
|
489
|
-
} from "./chunk-
|
|
490
|
-
import "./chunk-
|
|
502
|
+
} from "./chunk-UHUSJ6X7.js";
|
|
503
|
+
import "./chunk-VOQXFAY5.js";
|
|
504
|
+
import "./chunk-RCUQIPTN.js";
|
|
491
505
|
import {
|
|
492
506
|
runExitCleanup
|
|
493
|
-
} from "./chunk-
|
|
507
|
+
} from "./chunk-52ZSWYEG.js";
|
|
494
508
|
import "./chunk-75DOP5OR.js";
|
|
495
509
|
import "./chunk-DMTGGOSA.js";
|
|
496
510
|
import "./chunk-YQ3U5MUC.js";
|
|
497
511
|
import "./chunk-AMDSOFFV.js";
|
|
498
|
-
import "./chunk-
|
|
512
|
+
import "./chunk-QUGAUQGJ.js";
|
|
499
513
|
import {
|
|
500
514
|
init_esbuild_shims
|
|
501
515
|
} from "./chunk-5O2XNYP6.js";
|
|
@@ -1949,6 +1963,7 @@ var DaemonTodoStopGuard = class {
|
|
|
1949
1963
|
// packages/cli/src/acp-integration/session/Session.ts
|
|
1950
1964
|
var debugLogger6 = createDebugLogger("SESSION");
|
|
1951
1965
|
var USER_CANCEL_ABORT_REASON = "qwen:user-cancel";
|
|
1966
|
+
var SESSION_DISPOSE_ABORT_REASON = "qwen:session-dispose";
|
|
1952
1967
|
var DAEMON_RETRY_META_KEY = "qwen.daemon.retry";
|
|
1953
1968
|
var DAEMON_CONTINUE_META_KEY = "qwen.daemon.continueLastTurn";
|
|
1954
1969
|
var TODO_STOP_GUARD_PROMPT_PREFIX = "[Todo Stop Guard] ";
|
|
@@ -2220,6 +2235,20 @@ function parseMidTurnDrainResponse(response) {
|
|
|
2220
2235
|
).map((message) => ({ kind: "text", message }));
|
|
2221
2236
|
}
|
|
2222
2237
|
__name(parseMidTurnDrainResponse, "parseMidTurnDrainResponse");
|
|
2238
|
+
function isValidMidTurnDrainResponse(response, requireQueuedPromptState) {
|
|
2239
|
+
if (!isRecord2(response) || requireQueuedPromptState && typeof response["hasQueuedPrompt"] !== "boolean") {
|
|
2240
|
+
return false;
|
|
2241
|
+
}
|
|
2242
|
+
if (Array.isArray(response["items"])) {
|
|
2243
|
+
return response["items"].every(
|
|
2244
|
+
(item) => isRecord2(item) && Array.isArray(item["content"]) && item["content"].length > 0 && item["content"].every(isContentBlock)
|
|
2245
|
+
);
|
|
2246
|
+
}
|
|
2247
|
+
return Array.isArray(response["messages"]) && response["messages"].every(
|
|
2248
|
+
(message) => typeof message === "string" && message.trim().length > 0
|
|
2249
|
+
);
|
|
2250
|
+
}
|
|
2251
|
+
__name(isValidMidTurnDrainResponse, "isValidMidTurnDrainResponse");
|
|
2223
2252
|
var MidTurnDrainTimeoutError = class extends Error {
|
|
2224
2253
|
static {
|
|
2225
2254
|
__name(this, "MidTurnDrainTimeoutError");
|
|
@@ -2230,6 +2259,16 @@ var MidTurnDrainTimeoutError = class extends Error {
|
|
|
2230
2259
|
);
|
|
2231
2260
|
}
|
|
2232
2261
|
};
|
|
2262
|
+
var TodoStopGuardClaimTimeoutError = class extends Error {
|
|
2263
|
+
static {
|
|
2264
|
+
__name(this, "TodoStopGuardClaimTimeoutError");
|
|
2265
|
+
}
|
|
2266
|
+
constructor() {
|
|
2267
|
+
super(
|
|
2268
|
+
`Todo Stop Guard continuation claim got no response within ${MID_TURN_QUEUE_DRAIN_TIMEOUT_MS}ms`
|
|
2269
|
+
);
|
|
2270
|
+
}
|
|
2271
|
+
};
|
|
2233
2272
|
function beginChannelDeliveryResponseBlock(capture) {
|
|
2234
2273
|
if (!capture) return void 0;
|
|
2235
2274
|
capture.finalText = "";
|
|
@@ -2563,7 +2602,12 @@ var Session = class {
|
|
|
2563
2602
|
midTurnRecoveredMessages = [];
|
|
2564
2603
|
todoStopGuard;
|
|
2565
2604
|
todoStopGuardBackgroundBaseline;
|
|
2605
|
+
relatedAgentIds = /* @__PURE__ */ new Set();
|
|
2606
|
+
provisionalRelatedAgentCounts = /* @__PURE__ */ new Map();
|
|
2566
2607
|
todoStopGuardQueuedPromptPriority = false;
|
|
2608
|
+
todoStopGuardQueuedPromptOwnerPromptId;
|
|
2609
|
+
todoStopGuardClaimOwnerCounts = /* @__PURE__ */ new Map();
|
|
2610
|
+
todoStopGuardReleasedDuringClaim = /* @__PURE__ */ new Set();
|
|
2567
2611
|
todoStopGuardDrainAutomaticQueuesWhenIdle = false;
|
|
2568
2612
|
// Background notification drain state. ACP does not have the TUI's idle
|
|
2569
2613
|
// hook, so the session serializes registry callbacks through this queue.
|
|
@@ -2615,7 +2659,7 @@ var Session = class {
|
|
|
2615
2659
|
}
|
|
2616
2660
|
const drainSupersededAutomaticQueues = this.todoStopGuard.blocksUnrelatedAutomaticTurns || this.todoStopGuard.hasCommittedContinuation || this.todoStopGuardQueuedPromptPriority;
|
|
2617
2661
|
if (this.config.getApprovalMode() === "plan" /* PLAN */) {
|
|
2618
|
-
this
|
|
2662
|
+
this.#clearTodoStopGuardQueuedPromptWait();
|
|
2619
2663
|
this.todoStopGuard.blockUntilOrdinaryPromptStarts();
|
|
2620
2664
|
return {
|
|
2621
2665
|
startsWorkChain: false,
|
|
@@ -2626,7 +2670,7 @@ var Session = class {
|
|
|
2626
2670
|
const isRetry = params.retry === true || metadata?.[DAEMON_RETRY_META_KEY] === true;
|
|
2627
2671
|
const isContinue = metadata?.[DAEMON_CONTINUE_META_KEY] === true;
|
|
2628
2672
|
if (isRetry || isContinue) {
|
|
2629
|
-
this
|
|
2673
|
+
this.#clearTodoStopGuardQueuedPromptWait();
|
|
2630
2674
|
if (this.todoStopGuard.hasTrustedUnfinishedState) {
|
|
2631
2675
|
this.todoStopGuard.resumeTrustedPrompt();
|
|
2632
2676
|
return {
|
|
@@ -2640,7 +2684,7 @@ var Session = class {
|
|
|
2640
2684
|
drainSupersededAutomaticQueues
|
|
2641
2685
|
};
|
|
2642
2686
|
}
|
|
2643
|
-
this
|
|
2687
|
+
this.#clearTodoStopGuardQueuedPromptWait();
|
|
2644
2688
|
this.todoStopGuard.blockUntilOrdinaryPromptStarts();
|
|
2645
2689
|
return {
|
|
2646
2690
|
startsWorkChain: true,
|
|
@@ -2653,7 +2697,7 @@ var Session = class {
|
|
|
2653
2697
|
this.todoStopGuard.blockUntilOrdinaryPromptStarts();
|
|
2654
2698
|
return;
|
|
2655
2699
|
}
|
|
2656
|
-
if (
|
|
2700
|
+
if (this.todoStopGuard.isHardSuspended) {
|
|
2657
2701
|
return;
|
|
2658
2702
|
}
|
|
2659
2703
|
if (continuesCurrentWorkChain && this.todoStopGuard.hasTrustedUnfinishedState) {
|
|
@@ -2661,7 +2705,7 @@ var Session = class {
|
|
|
2661
2705
|
return;
|
|
2662
2706
|
}
|
|
2663
2707
|
this.todoStopGuard.clearTrust();
|
|
2664
|
-
this
|
|
2708
|
+
this.#resetTodoStopGuardBackgroundLineage();
|
|
2665
2709
|
}
|
|
2666
2710
|
#clearTodoStopGuardTrustAndDrainAutomaticQueues() {
|
|
2667
2711
|
const preserveQueuedPromptPriority = this.todoStopGuardQueuedPromptPriority;
|
|
@@ -2675,35 +2719,116 @@ var Session = class {
|
|
|
2675
2719
|
void this.#drainCronQueue();
|
|
2676
2720
|
void this.#drainNotificationQueue();
|
|
2677
2721
|
}
|
|
2678
|
-
releaseTodoStopGuardQueuedPromptWait() {
|
|
2679
|
-
|
|
2680
|
-
|
|
2722
|
+
releaseTodoStopGuardQueuedPromptWait(promptId) {
|
|
2723
|
+
const matchesCurrentWait = this.todoStopGuardQueuedPromptPriority && this.todoStopGuardQueuedPromptOwnerPromptId === promptId;
|
|
2724
|
+
if (!matchesCurrentWait) {
|
|
2725
|
+
if ((this.todoStopGuardClaimOwnerCounts.get(promptId) ?? 0) === 0) {
|
|
2726
|
+
return false;
|
|
2727
|
+
}
|
|
2728
|
+
this.todoStopGuardReleasedDuringClaim.add(promptId);
|
|
2729
|
+
if (!this.todoStopGuardQueuedPromptPriority) {
|
|
2730
|
+
this.#finishTodoStopGuardQueuedPromptRelease();
|
|
2731
|
+
}
|
|
2732
|
+
return true;
|
|
2733
|
+
}
|
|
2734
|
+
this.#clearTodoStopGuardQueuedPromptWait(promptId);
|
|
2735
|
+
this.#finishTodoStopGuardQueuedPromptRelease();
|
|
2736
|
+
return true;
|
|
2737
|
+
}
|
|
2738
|
+
#finishTodoStopGuardQueuedPromptRelease() {
|
|
2681
2739
|
this.todoStopGuard.blockUntilOrdinaryPromptStarts();
|
|
2682
2740
|
if (this.pendingPrompt) {
|
|
2683
2741
|
this.todoStopGuardDrainAutomaticQueuesWhenIdle = true;
|
|
2684
|
-
return
|
|
2742
|
+
return;
|
|
2685
2743
|
}
|
|
2686
2744
|
void this.#drainCronQueue();
|
|
2687
2745
|
void this.#drainNotificationQueue();
|
|
2688
|
-
return true;
|
|
2689
2746
|
}
|
|
2690
2747
|
clearTodoStopGuardTrust() {
|
|
2691
2748
|
this.#clearTodoStopGuardTrustAndDrainAutomaticQueues();
|
|
2692
2749
|
}
|
|
2693
|
-
|
|
2694
|
-
this
|
|
2750
|
+
hardSuspendTodoStopGuard() {
|
|
2751
|
+
this.#clearTodoStopGuardQueuedPromptWait();
|
|
2752
|
+
this.todoStopGuardDrainAutomaticQueuesWhenIdle = false;
|
|
2753
|
+
this.todoStopGuard.blockUntilOrdinaryPromptStarts();
|
|
2695
2754
|
}
|
|
2696
|
-
#
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2755
|
+
#clearTodoStopGuardQueuedPromptWait(expectedOwner) {
|
|
2756
|
+
if (expectedOwner !== void 0 && this.todoStopGuardQueuedPromptOwnerPromptId !== expectedOwner) {
|
|
2757
|
+
return;
|
|
2758
|
+
}
|
|
2759
|
+
this.todoStopGuardQueuedPromptPriority = false;
|
|
2760
|
+
this.todoStopGuardQueuedPromptOwnerPromptId = void 0;
|
|
2761
|
+
}
|
|
2762
|
+
#awaitTodoStopGuardQueuedPrompt(promptId) {
|
|
2763
|
+
this.todoStopGuard.awaitQueuedPrompt();
|
|
2764
|
+
this.todoStopGuardQueuedPromptPriority = true;
|
|
2765
|
+
this.todoStopGuardQueuedPromptOwnerPromptId = promptId;
|
|
2766
|
+
}
|
|
2767
|
+
async #claimTodoStopGuardContinuation(abortSignal) {
|
|
2768
|
+
const context = getInvocationContext();
|
|
2769
|
+
const ownerPromptId = context?.sessionId === this.sessionId ? context.promptId : void 0;
|
|
2770
|
+
if (ownerPromptId) {
|
|
2771
|
+
this.todoStopGuardClaimOwnerCounts.set(
|
|
2772
|
+
ownerPromptId,
|
|
2773
|
+
(this.todoStopGuardClaimOwnerCounts.get(ownerPromptId) ?? 0) + 1
|
|
2774
|
+
);
|
|
2775
|
+
}
|
|
2776
|
+
let timeoutHandle;
|
|
2777
|
+
try {
|
|
2778
|
+
const claimPromise = this.client.extMethod(
|
|
2779
|
+
TODO_STOP_GUARD_CONTINUATION_CLAIM_METHOD,
|
|
2780
|
+
{
|
|
2781
|
+
sessionId: this.sessionId,
|
|
2782
|
+
...ownerPromptId ? { promptId: ownerPromptId } : {}
|
|
2783
|
+
}
|
|
2784
|
+
);
|
|
2785
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
2786
|
+
timeoutHandle = setTimeout(
|
|
2787
|
+
() => reject(new TodoStopGuardClaimTimeoutError()),
|
|
2788
|
+
MID_TURN_QUEUE_DRAIN_TIMEOUT_MS
|
|
2789
|
+
);
|
|
2790
|
+
});
|
|
2791
|
+
const response = await Promise.race([claimPromise, timeoutPromise]);
|
|
2792
|
+
if (abortSignal.aborted || !isRecord2(response)) {
|
|
2793
|
+
return "unavailable";
|
|
2794
|
+
}
|
|
2795
|
+
if (ownerPromptId && response["claimed"] === false && response["hasQueuedPrompt"] === true) {
|
|
2796
|
+
if (this.closing || this.disposed) return "unavailable";
|
|
2797
|
+
if (this.todoStopGuardReleasedDuringClaim.has(ownerPromptId)) {
|
|
2798
|
+
return "unavailable";
|
|
2799
|
+
}
|
|
2800
|
+
this.#awaitTodoStopGuardQueuedPrompt(ownerPromptId);
|
|
2801
|
+
return "queued";
|
|
2802
|
+
}
|
|
2803
|
+
if (this.todoStopGuard.isHardSuspended) return "unavailable";
|
|
2804
|
+
if (response["claimed"] === true && response["hasQueuedPrompt"] === false) {
|
|
2805
|
+
if (ownerPromptId) {
|
|
2806
|
+
this.#clearTodoStopGuardQueuedPromptWait(ownerPromptId);
|
|
2807
|
+
}
|
|
2808
|
+
this.todoStopGuard.resumeTrustedPrompt();
|
|
2809
|
+
return "claimed";
|
|
2810
|
+
}
|
|
2811
|
+
return "unavailable";
|
|
2812
|
+
} catch (error) {
|
|
2813
|
+
debugLogger6.warn(
|
|
2814
|
+
`Todo Stop Guard continuation claim unavailable [session ${this.sessionId}]: ${this.#formatError(error)}`
|
|
2815
|
+
);
|
|
2816
|
+
return "unavailable";
|
|
2817
|
+
} finally {
|
|
2818
|
+
clearTimeout(timeoutHandle);
|
|
2819
|
+
if (ownerPromptId) {
|
|
2820
|
+
const remaining = (this.todoStopGuardClaimOwnerCounts.get(ownerPromptId) ?? 1) - 1;
|
|
2821
|
+
if (remaining > 0) {
|
|
2822
|
+
this.todoStopGuardClaimOwnerCounts.set(ownerPromptId, remaining);
|
|
2823
|
+
} else {
|
|
2824
|
+
this.todoStopGuardClaimOwnerCounts.delete(ownerPromptId);
|
|
2825
|
+
this.todoStopGuardReleasedDuringClaim.delete(ownerPromptId);
|
|
2826
|
+
}
|
|
2827
|
+
}
|
|
2828
|
+
}
|
|
2701
2829
|
}
|
|
2702
2830
|
#notificationContinuesTodoStopGuardWorkChain(item) {
|
|
2703
|
-
|
|
2704
|
-
if (item.kind === "agent") return !baseline.agents.has(item.taskId);
|
|
2705
|
-
if (item.kind === "shell") return !baseline.shells.has(item.taskId);
|
|
2706
|
-
return !baseline.monitors.has(item.taskId);
|
|
2831
|
+
return item.continuesTodoStopGuardWorkChain;
|
|
2707
2832
|
}
|
|
2708
2833
|
#cronContinuesTodoStopGuardWorkChain(item) {
|
|
2709
2834
|
return item.source === "loop" && item.taskId !== void 0 && !this.todoStopGuardBackgroundBaseline.wakeups.has(item.taskId);
|
|
@@ -2736,6 +2861,37 @@ var Session = class {
|
|
|
2736
2861
|
])
|
|
2737
2862
|
};
|
|
2738
2863
|
}
|
|
2864
|
+
#resetTodoStopGuardBackgroundLineage() {
|
|
2865
|
+
this.relatedAgentIds.clear();
|
|
2866
|
+
this.provisionalRelatedAgentCounts.clear();
|
|
2867
|
+
this.todoStopGuardBackgroundBaseline = this.#captureTodoStopGuardBackgroundBaseline();
|
|
2868
|
+
for (const item of this.notificationQueue) {
|
|
2869
|
+
item.continuesTodoStopGuardWorkChain = false;
|
|
2870
|
+
}
|
|
2871
|
+
}
|
|
2872
|
+
#agentContinuesTodoStopGuardWorkChain(taskId, visiting = /* @__PURE__ */ new Set()) {
|
|
2873
|
+
if (this.relatedAgentIds.has(taskId) || (this.provisionalRelatedAgentCounts.get(taskId) ?? 0) > 0) {
|
|
2874
|
+
return true;
|
|
2875
|
+
}
|
|
2876
|
+
if (this.todoStopGuardBackgroundBaseline.agents.has(taskId)) return false;
|
|
2877
|
+
if (visiting.has(taskId)) return false;
|
|
2878
|
+
const task = this.config.getBackgroundTaskRegistry?.()?.get?.(taskId);
|
|
2879
|
+
if (!task) return false;
|
|
2880
|
+
if (!task.parentAgentId) return true;
|
|
2881
|
+
visiting.add(taskId);
|
|
2882
|
+
const related = this.#agentContinuesTodoStopGuardWorkChain(
|
|
2883
|
+
task.parentAgentId,
|
|
2884
|
+
visiting
|
|
2885
|
+
);
|
|
2886
|
+
visiting.delete(taskId);
|
|
2887
|
+
return related;
|
|
2888
|
+
}
|
|
2889
|
+
#monitorContinuesTodoStopGuardWorkChain(monitorId, ownerAgentId) {
|
|
2890
|
+
if (ownerAgentId) {
|
|
2891
|
+
return this.#agentContinuesTodoStopGuardWorkChain(ownerAgentId);
|
|
2892
|
+
}
|
|
2893
|
+
return !this.todoStopGuardBackgroundBaseline.monitors.has(monitorId);
|
|
2894
|
+
}
|
|
2739
2895
|
#hasRelevantTodoStopGuardBackgroundInput() {
|
|
2740
2896
|
if (this.notificationQueue.some(
|
|
2741
2897
|
(item) => this.#notificationContinuesTodoStopGuardWorkChain(item)
|
|
@@ -2747,7 +2903,7 @@ var Session = class {
|
|
|
2747
2903
|
const baseline = this.todoStopGuardBackgroundBaseline;
|
|
2748
2904
|
const agents = this.config.getBackgroundTaskRegistry?.()?.getAll?.() ?? [];
|
|
2749
2905
|
if (agents.some(
|
|
2750
|
-
(task) =>
|
|
2906
|
+
(task) => this.#agentContinuesTodoStopGuardWorkChain(task.id) && task.isBackgrounded && (task.status === "running" || task.status === "paused" || task.status === "cancelled" && !task.notified)
|
|
2751
2907
|
)) {
|
|
2752
2908
|
return true;
|
|
2753
2909
|
}
|
|
@@ -2759,7 +2915,10 @@ var Session = class {
|
|
|
2759
2915
|
}
|
|
2760
2916
|
const monitors = this.config.getMonitorRegistry?.()?.getAll?.() ?? [];
|
|
2761
2917
|
if (monitors.some(
|
|
2762
|
-
(task) =>
|
|
2918
|
+
(task) => this.#monitorContinuesTodoStopGuardWorkChain(
|
|
2919
|
+
task.id,
|
|
2920
|
+
task.ownerAgentId
|
|
2921
|
+
) && task.status === "running"
|
|
2763
2922
|
)) {
|
|
2764
2923
|
return true;
|
|
2765
2924
|
}
|
|
@@ -2890,12 +3049,19 @@ var Session = class {
|
|
|
2890
3049
|
return this.closeGateCompletion ?? Promise.resolve();
|
|
2891
3050
|
}
|
|
2892
3051
|
async waitForActiveTurnsToSettle() {
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
3052
|
+
while (this.#hasActiveTurn()) {
|
|
3053
|
+
const pending = [
|
|
3054
|
+
this.pendingPromptCompletion,
|
|
3055
|
+
this.cronCompletion,
|
|
3056
|
+
this.notificationCompletion
|
|
3057
|
+
].filter(
|
|
3058
|
+
(completion) => completion !== null
|
|
3059
|
+
);
|
|
3060
|
+
if (pending.length > 0) {
|
|
3061
|
+
await Promise.allSettled(pending);
|
|
3062
|
+
}
|
|
3063
|
+
await new Promise((resolve5) => setImmediate(resolve5));
|
|
3064
|
+
}
|
|
2899
3065
|
}
|
|
2900
3066
|
#deferAutomaticQueueDrainUntilTurnsSettle() {
|
|
2901
3067
|
const completions = [
|
|
@@ -2924,12 +3090,12 @@ var Session = class {
|
|
|
2924
3090
|
dispose() {
|
|
2925
3091
|
this.disposed = true;
|
|
2926
3092
|
this.closing = true;
|
|
3093
|
+
this.pendingPrompt?.abort(SESSION_DISPOSE_ABORT_REASON);
|
|
3094
|
+
this.pendingPrompt = null;
|
|
2927
3095
|
this.resolveCloseGate?.();
|
|
2928
3096
|
this.resolveCloseGate = null;
|
|
2929
3097
|
this.closeGateCompletion = null;
|
|
2930
|
-
this.
|
|
2931
|
-
this.todoStopGuardDrainAutomaticQueuesWhenIdle = false;
|
|
2932
|
-
this.todoStopGuard.clearTrust();
|
|
3098
|
+
this.hardSuspendTodoStopGuard();
|
|
2933
3099
|
this.notificationQueue = [];
|
|
2934
3100
|
this.cronQueue = [];
|
|
2935
3101
|
this.notificationAbortController?.abort();
|
|
@@ -3170,6 +3336,9 @@ var Session = class {
|
|
|
3170
3336
|
throw RequestError.invalidParams(void 0, "Session is closing");
|
|
3171
3337
|
}
|
|
3172
3338
|
await this.assertCanStartTurn();
|
|
3339
|
+
if (this.closing) {
|
|
3340
|
+
throw RequestError.invalidParams(void 0, "Session is closing");
|
|
3341
|
+
}
|
|
3173
3342
|
if (admissionCancellation?.aborted) {
|
|
3174
3343
|
return { stopReason: "cancelled" };
|
|
3175
3344
|
}
|
|
@@ -3231,9 +3400,9 @@ var Session = class {
|
|
|
3231
3400
|
return { stopReason: "cancelled" };
|
|
3232
3401
|
}
|
|
3233
3402
|
if (todoStopGuardPreparation.startsWorkChain) {
|
|
3234
|
-
this
|
|
3403
|
+
this.#clearTodoStopGuardQueuedPromptWait();
|
|
3235
3404
|
this.todoStopGuard.startOrdinaryPrompt();
|
|
3236
|
-
this
|
|
3405
|
+
this.#resetTodoStopGuardBackgroundLineage();
|
|
3237
3406
|
}
|
|
3238
3407
|
this.duplicateProviderToolCallResponseIds.clear();
|
|
3239
3408
|
const channelDelivery = parsePromptChannelDelivery(params);
|
|
@@ -3274,9 +3443,12 @@ var Session = class {
|
|
|
3274
3443
|
}
|
|
3275
3444
|
throw error;
|
|
3276
3445
|
} finally {
|
|
3446
|
+
const stillOwnsPendingPrompt = this.pendingPrompt === pendingSend;
|
|
3277
3447
|
releasePendingSend();
|
|
3278
3448
|
const shouldDrainAutomaticQueues = todoStopGuardPreparation.drainSupersededAutomaticQueues || this.todoStopGuardDrainAutomaticQueuesWhenIdle || this.todoStopGuard.blocksUnrelatedAutomaticTurns || this.todoStopGuard.hasCommittedContinuation || this.todoStopGuardQueuedPromptPriority;
|
|
3279
|
-
|
|
3449
|
+
if (stillOwnsPendingPrompt) {
|
|
3450
|
+
this.todoStopGuardDrainAutomaticQueuesWhenIdle = false;
|
|
3451
|
+
}
|
|
3280
3452
|
if (shouldDrainAutomaticQueues) {
|
|
3281
3453
|
void this.#drainCronQueue();
|
|
3282
3454
|
void this.#drainNotificationQueue();
|
|
@@ -3431,6 +3603,7 @@ var Session = class {
|
|
|
3431
3603
|
}
|
|
3432
3604
|
this.turn += 1;
|
|
3433
3605
|
const promptId = this.config.getSessionId() + "########" + this.turn;
|
|
3606
|
+
promptIdContext.enterWith(promptId);
|
|
3434
3607
|
const parentContext = extractDaemonTraceContext(params);
|
|
3435
3608
|
return await withInteractionSpan(
|
|
3436
3609
|
this.config,
|
|
@@ -3496,6 +3669,9 @@ var Session = class {
|
|
|
3496
3669
|
let parts;
|
|
3497
3670
|
let fullTurnModelOverride;
|
|
3498
3671
|
const onFullTurnModel = /* @__PURE__ */ __name((model) => {
|
|
3672
|
+
if (fullTurnModelOverride === model) {
|
|
3673
|
+
return true;
|
|
3674
|
+
}
|
|
3499
3675
|
if (fullTurnModelOverride) {
|
|
3500
3676
|
return false;
|
|
3501
3677
|
}
|
|
@@ -3704,7 +3880,8 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
3704
3880
|
}
|
|
3705
3881
|
strippedOrphanEntries = null;
|
|
3706
3882
|
}
|
|
3707
|
-
|
|
3883
|
+
const isControlledCancellation = pendingSend.signal.aborted && (pendingSend.signal.reason === USER_CANCEL_ABORT_REASON || pendingSend.signal.reason === SESSION_DISPOSE_ABORT_REASON);
|
|
3884
|
+
if (isControlledCancellation) {
|
|
3708
3885
|
this.todoStopGuard.suspend();
|
|
3709
3886
|
return { stopReason: "cancelled" };
|
|
3710
3887
|
}
|
|
@@ -3756,7 +3933,8 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
3756
3933
|
pendingSend.signal,
|
|
3757
3934
|
promptId,
|
|
3758
3935
|
functionCalls,
|
|
3759
|
-
toolLoopState
|
|
3936
|
+
toolLoopState,
|
|
3937
|
+
onFullTurnModel
|
|
3760
3938
|
)
|
|
3761
3939
|
);
|
|
3762
3940
|
if (toolRun.stopAfterPermissionCancel) {
|
|
@@ -3811,6 +3989,11 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
3811
3989
|
turnCount
|
|
3812
3990
|
)
|
|
3813
3991
|
);
|
|
3992
|
+
cleanupReviewWorktreeLeases({
|
|
3993
|
+
sessionId: this.config.getSessionId(),
|
|
3994
|
+
promptId,
|
|
3995
|
+
repositoryRoot: this.config.getProjectRoot()
|
|
3996
|
+
});
|
|
3814
3997
|
}
|
|
3815
3998
|
},
|
|
3816
3999
|
(result) => result.stopReason === "cancelled" ? "cancelled" : "ok"
|
|
@@ -3823,6 +4006,9 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
3823
4006
|
let stopHookIterationCount = 0;
|
|
3824
4007
|
let stopHookReasons = [];
|
|
3825
4008
|
const onFullTurnModel = /* @__PURE__ */ __name((model) => {
|
|
4009
|
+
if (modelOverride === model) {
|
|
4010
|
+
return true;
|
|
4011
|
+
}
|
|
3826
4012
|
if (modelOverride) {
|
|
3827
4013
|
return false;
|
|
3828
4014
|
}
|
|
@@ -3831,6 +4017,9 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
3831
4017
|
}, "onFullTurnModel");
|
|
3832
4018
|
let midTurnContinuationCount = 0;
|
|
3833
4019
|
while (true) {
|
|
4020
|
+
if (this.pendingPrompt && this.pendingPrompt !== pendingSend) {
|
|
4021
|
+
return { stopReason: "cancelled" };
|
|
4022
|
+
}
|
|
3834
4023
|
if (pendingSend.signal.aborted) {
|
|
3835
4024
|
this.todoStopGuard.suspend();
|
|
3836
4025
|
return { stopReason: "cancelled" };
|
|
@@ -3842,15 +4031,26 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
3842
4031
|
return { stopReason: "end_turn" };
|
|
3843
4032
|
}
|
|
3844
4033
|
if (this.todoStopGuard.needsStopInspection) {
|
|
3845
|
-
this.#beginTodoStopGuardQueuedPromptCheck();
|
|
3846
4034
|
const drained = await this.#drainMidTurnInput(pendingSend.signal, {
|
|
3847
4035
|
watchQueuedPromptForTodoStopGuard: true,
|
|
3848
4036
|
onFullTurnModel
|
|
3849
4037
|
});
|
|
3850
|
-
const waitsForQueuedPrompt = this.#finishTodoStopGuardQueuedPromptCheck(
|
|
3851
|
-
drained.hasQueuedPrompt
|
|
3852
|
-
);
|
|
3853
4038
|
if (drained.parts.length > 0) {
|
|
4039
|
+
if (drained.hasQueuedPrompt) {
|
|
4040
|
+
const claim = await this.#claimTodoStopGuardContinuation(
|
|
4041
|
+
pendingSend.signal
|
|
4042
|
+
);
|
|
4043
|
+
if (claim === "queued") {
|
|
4044
|
+
this.#preserveUnsentMessageHistory(
|
|
4045
|
+
{ role: "user", parts: drained.parts },
|
|
4046
|
+
true
|
|
4047
|
+
);
|
|
4048
|
+
return { stopReason: "end_turn" };
|
|
4049
|
+
}
|
|
4050
|
+
if (claim === "unavailable") {
|
|
4051
|
+
this.todoStopGuard.blockUntilOrdinaryPromptStarts();
|
|
4052
|
+
}
|
|
4053
|
+
}
|
|
3854
4054
|
this.todoStopGuard.acceptMidTurnUserInput();
|
|
3855
4055
|
const continuation2 = await this.#runStopContinuation(
|
|
3856
4056
|
pendingSend,
|
|
@@ -3869,13 +4069,22 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
3869
4069
|
}
|
|
3870
4070
|
continue;
|
|
3871
4071
|
}
|
|
3872
|
-
if (
|
|
3873
|
-
|
|
4072
|
+
if (!drained.reliable) {
|
|
4073
|
+
this.todoStopGuard.blockUntilOrdinaryPromptStarts();
|
|
4074
|
+
} else if (drained.hasQueuedPrompt) {
|
|
4075
|
+
const claim = await this.#claimTodoStopGuardContinuation(
|
|
4076
|
+
pendingSend.signal
|
|
4077
|
+
);
|
|
4078
|
+
if (claim === "queued") {
|
|
4079
|
+
return { stopReason: "end_turn" };
|
|
4080
|
+
}
|
|
4081
|
+
if (claim === "unavailable") {
|
|
4082
|
+
this.todoStopGuard.blockUntilOrdinaryPromptStarts();
|
|
4083
|
+
}
|
|
3874
4084
|
}
|
|
3875
4085
|
}
|
|
3876
4086
|
let externalReason = null;
|
|
3877
4087
|
let stopHookCount = 1;
|
|
3878
|
-
let queuedPromptArrivedDuringStopHook = false;
|
|
3879
4088
|
if (allowExternalHooks && hooksEnabled && messageBus && stopHookIterationCount < stopHookBlockingCap && this.config.hasHooksForEvent?.("Stop")) {
|
|
3880
4089
|
const responseText = this.#getCurrentChat().getLastModelMessageText?.() || "[no response text]";
|
|
3881
4090
|
const contextUsage = buildContextUsage(
|
|
@@ -3906,14 +4115,26 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
3906
4115
|
return { stopReason: "cancelled" };
|
|
3907
4116
|
}
|
|
3908
4117
|
if (this.todoStopGuard.needsStopInspection) {
|
|
3909
|
-
this.#beginTodoStopGuardQueuedPromptCheck();
|
|
3910
4118
|
const drained = await this.#drainMidTurnInput(pendingSend.signal, {
|
|
3911
4119
|
watchQueuedPromptForTodoStopGuard: true,
|
|
3912
4120
|
onFullTurnModel
|
|
3913
4121
|
});
|
|
3914
|
-
const waitsForQueuedPrompt = this.#finishTodoStopGuardQueuedPromptCheck(drained.hasQueuedPrompt);
|
|
3915
|
-
queuedPromptArrivedDuringStopHook = waitsForQueuedPrompt;
|
|
3916
4122
|
if (drained.parts.length > 0) {
|
|
4123
|
+
if (drained.hasQueuedPrompt) {
|
|
4124
|
+
const claim = await this.#claimTodoStopGuardContinuation(
|
|
4125
|
+
pendingSend.signal
|
|
4126
|
+
);
|
|
4127
|
+
if (claim === "queued") {
|
|
4128
|
+
this.#preserveUnsentMessageHistory(
|
|
4129
|
+
{ role: "user", parts: drained.parts },
|
|
4130
|
+
true
|
|
4131
|
+
);
|
|
4132
|
+
return { stopReason: "end_turn" };
|
|
4133
|
+
}
|
|
4134
|
+
if (claim === "unavailable") {
|
|
4135
|
+
this.todoStopGuard.blockUntilOrdinaryPromptStarts();
|
|
4136
|
+
}
|
|
4137
|
+
}
|
|
3917
4138
|
this.todoStopGuard.acceptMidTurnUserInput();
|
|
3918
4139
|
const continuation2 = await this.#runStopContinuation(
|
|
3919
4140
|
pendingSend,
|
|
@@ -3930,6 +4151,20 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
3930
4151
|
if (continuation2.kind === "terminal") {
|
|
3931
4152
|
return { stopReason: continuation2.stopReason };
|
|
3932
4153
|
}
|
|
4154
|
+
continue;
|
|
4155
|
+
}
|
|
4156
|
+
if (!drained.reliable) {
|
|
4157
|
+
this.todoStopGuard.blockUntilOrdinaryPromptStarts();
|
|
4158
|
+
} else if (drained.hasQueuedPrompt) {
|
|
4159
|
+
const claim = await this.#claimTodoStopGuardContinuation(
|
|
4160
|
+
pendingSend.signal
|
|
4161
|
+
);
|
|
4162
|
+
if (claim === "queued") {
|
|
4163
|
+
return { stopReason: "end_turn" };
|
|
4164
|
+
}
|
|
4165
|
+
if (claim === "unavailable") {
|
|
4166
|
+
this.todoStopGuard.blockUntilOrdinaryPromptStarts();
|
|
4167
|
+
}
|
|
3933
4168
|
}
|
|
3934
4169
|
}
|
|
3935
4170
|
const hookOutput = response.output ? createHookOutput("Stop", response.output) : void 0;
|
|
@@ -3942,9 +4177,13 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
3942
4177
|
stopHookIterationCount++;
|
|
3943
4178
|
stopHookReasons = [...stopHookReasons, externalReason];
|
|
3944
4179
|
stopHookCount = response.stopHookCount ?? 1;
|
|
4180
|
+
} else {
|
|
4181
|
+
stopHookIterationCount = 0;
|
|
4182
|
+
stopHookReasons = [];
|
|
4183
|
+
stopHookCount = 1;
|
|
3945
4184
|
}
|
|
3946
4185
|
}
|
|
3947
|
-
const guardDecision =
|
|
4186
|
+
const guardDecision = this.todoStopGuard.decide(
|
|
3948
4187
|
this.todoStopGuard.needsStopInspection ? this.#hasRelevantTodoStopGuardBackgroundInput() : false
|
|
3949
4188
|
);
|
|
3950
4189
|
const guardContinuation = guardDecision?.kind === "continue" ? guardDecision : null;
|
|
@@ -3967,9 +4206,6 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
3967
4206
|
debugLogger6.warn(warning);
|
|
3968
4207
|
return { stopReason: "end_turn" };
|
|
3969
4208
|
}
|
|
3970
|
-
if (queuedPromptArrivedDuringStopHook) {
|
|
3971
|
-
return { stopReason: "end_turn" };
|
|
3972
|
-
}
|
|
3973
4209
|
if (!externalReason && !guardContinuation) {
|
|
3974
4210
|
return { stopReason: "end_turn" };
|
|
3975
4211
|
}
|
|
@@ -4025,8 +4261,27 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4025
4261
|
let initialSend = true;
|
|
4026
4262
|
let automaticContinuationValidated = false;
|
|
4027
4263
|
let supersededAutomaticContinuation = false;
|
|
4264
|
+
const preservePendingMessage = /* @__PURE__ */ __name((message) => {
|
|
4265
|
+
if (initialSend) return;
|
|
4266
|
+
const preservedParts = (message.parts ?? []).filter(
|
|
4267
|
+
(part) => !("text" in part && isTodoStopGuardPromptText(part.text))
|
|
4268
|
+
);
|
|
4269
|
+
this.#preserveUnsentMessageHistory(
|
|
4270
|
+
preservedParts.length > 0 ? { ...message, parts: preservedParts } : null,
|
|
4271
|
+
true
|
|
4272
|
+
);
|
|
4273
|
+
}, "preservePendingMessage");
|
|
4028
4274
|
while (nextMessage !== null) {
|
|
4275
|
+
if (this.pendingPrompt && this.pendingPrompt !== pendingSend) {
|
|
4276
|
+
preservePendingMessage(nextMessage);
|
|
4277
|
+
return {
|
|
4278
|
+
kind: "terminal",
|
|
4279
|
+
stopReason: "cancelled",
|
|
4280
|
+
...supersededAutomaticContinuation ? { supersededAutomaticContinuation: true } : {}
|
|
4281
|
+
};
|
|
4282
|
+
}
|
|
4029
4283
|
if (pendingSend.signal.aborted) {
|
|
4284
|
+
preservePendingMessage(nextMessage);
|
|
4030
4285
|
this.todoStopGuard.suspend();
|
|
4031
4286
|
return {
|
|
4032
4287
|
kind: "terminal",
|
|
@@ -4044,12 +4299,18 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4044
4299
|
let guardForThisSend = nextGuardContinuation;
|
|
4045
4300
|
let preserveGuardOnSkippedSend = false;
|
|
4046
4301
|
let messageForPreservation = nextMessage;
|
|
4302
|
+
let preparedMessage = nextMessage.parts ?? [];
|
|
4303
|
+
let preservePreparedMessageOnSkippedSend = !guardForThisSend && preparedMessage.some(
|
|
4304
|
+
(part) => !("text" in part && isTodoStopGuardPromptText(part.text))
|
|
4305
|
+
);
|
|
4047
4306
|
const externalParts = initialSend ? options.externalParts : void 0;
|
|
4048
4307
|
const promptIdForSend = guardForThisSend && guardForThisSend.attempt !== options.guardContinuation?.attempt ? toolPromptId + "_todo_stop_guard_" + guardForThisSend.attempt : streamPromptId;
|
|
4049
4308
|
const messageDisplay = this.#createMessageDisplayDispatcher(
|
|
4050
4309
|
pendingSend.signal
|
|
4051
4310
|
);
|
|
4052
4311
|
let channelDeliveryResponseBlock;
|
|
4312
|
+
let providerSendChat;
|
|
4313
|
+
let userContentPushCountBeforeSend = 0;
|
|
4053
4314
|
try {
|
|
4054
4315
|
const sendResult = await this.#sendMessageStreamWithAutoCompression(
|
|
4055
4316
|
promptIdForSend,
|
|
@@ -4058,44 +4319,134 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4058
4319
|
{
|
|
4059
4320
|
skipCompression: skipCompression || (guardForThisSend?.attempt ?? 0) > 1,
|
|
4060
4321
|
getModelOverride: options.getModelOverride,
|
|
4061
|
-
|
|
4062
|
-
const
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4322
|
+
prepareBeforeCompression: guardForThisSend ? async () => {
|
|
4323
|
+
const drained = await this.#drainMidTurnInput(
|
|
4324
|
+
pendingSend.signal,
|
|
4325
|
+
{
|
|
4326
|
+
watchQueuedPromptForTodoStopGuard: true,
|
|
4327
|
+
onFullTurnModel: options.onFullTurnModel
|
|
4328
|
+
}
|
|
4329
|
+
);
|
|
4330
|
+
if (drained.parts.length > 0) {
|
|
4331
|
+
if (drained.hasQueuedPrompt) {
|
|
4332
|
+
const claim = await this.#claimTodoStopGuardContinuation(
|
|
4333
|
+
pendingSend.signal
|
|
4334
|
+
);
|
|
4335
|
+
if (claim === "queued") {
|
|
4336
|
+
guardForThisSend = void 0;
|
|
4337
|
+
nextGuardContinuation = void 0;
|
|
4338
|
+
preserveGuardOnSkippedSend = true;
|
|
4339
|
+
preservePreparedMessageOnSkippedSend = true;
|
|
4340
|
+
messageForPreservation = {
|
|
4341
|
+
role: "user",
|
|
4342
|
+
parts: drained.parts
|
|
4343
|
+
};
|
|
4344
|
+
if (initialSend) {
|
|
4345
|
+
supersededAutomaticContinuation = true;
|
|
4346
|
+
}
|
|
4347
|
+
return { kind: "stop", stopReason: "end_turn" };
|
|
4071
4348
|
}
|
|
4349
|
+
if (claim === "unavailable") {
|
|
4350
|
+
this.todoStopGuard.blockUntilOrdinaryPromptStarts();
|
|
4351
|
+
}
|
|
4352
|
+
}
|
|
4353
|
+
preservePreparedMessageOnSkippedSend = true;
|
|
4354
|
+
this.todoStopGuard.acceptMidTurnUserInput();
|
|
4355
|
+
guardForThisSend = void 0;
|
|
4356
|
+
nextGuardContinuation = void 0;
|
|
4357
|
+
if (initialSend) {
|
|
4358
|
+
supersededAutomaticContinuation = true;
|
|
4359
|
+
}
|
|
4360
|
+
preparedMessage = initialSend ? drained.parts : [
|
|
4361
|
+
...(nextMessage?.parts ?? []).filter(
|
|
4362
|
+
(part) => !("text" in part && isTodoStopGuardPromptText(part.text))
|
|
4363
|
+
),
|
|
4364
|
+
...drained.parts
|
|
4365
|
+
];
|
|
4366
|
+
messageForPreservation = {
|
|
4367
|
+
role: "user",
|
|
4368
|
+
parts: preparedMessage
|
|
4369
|
+
};
|
|
4370
|
+
return { kind: "send", message: preparedMessage };
|
|
4371
|
+
}
|
|
4372
|
+
if (!drained.reliable) {
|
|
4373
|
+
this.todoStopGuard.blockUntilOrdinaryPromptStarts();
|
|
4374
|
+
guardForThisSend = void 0;
|
|
4375
|
+
nextGuardContinuation = void 0;
|
|
4376
|
+
if (!options.externalParts) {
|
|
4377
|
+
preserveGuardOnSkippedSend = true;
|
|
4378
|
+
return { kind: "stop", stopReason: "end_turn" };
|
|
4379
|
+
}
|
|
4380
|
+
if (!initialSend && nextMessage) {
|
|
4381
|
+
nextMessage = {
|
|
4382
|
+
...nextMessage,
|
|
4383
|
+
parts: (nextMessage.parts ?? []).filter(
|
|
4384
|
+
(part) => !("text" in part && isTodoStopGuardPromptText(part.text))
|
|
4385
|
+
)
|
|
4386
|
+
};
|
|
4387
|
+
}
|
|
4388
|
+
} else if (drained.hasQueuedPrompt) {
|
|
4389
|
+
const probe = await this.#claimTodoStopGuardContinuation(
|
|
4390
|
+
pendingSend.signal
|
|
4072
4391
|
);
|
|
4073
|
-
|
|
4074
|
-
drained.hasQueuedPrompt
|
|
4075
|
-
);
|
|
4076
|
-
if (drained.parts.length > 0) {
|
|
4077
|
-
this.todoStopGuard.acceptMidTurnUserInput();
|
|
4392
|
+
if (probe === "queued") {
|
|
4078
4393
|
guardForThisSend = void 0;
|
|
4079
4394
|
nextGuardContinuation = void 0;
|
|
4395
|
+
preserveGuardOnSkippedSend = true;
|
|
4080
4396
|
if (initialSend) {
|
|
4081
4397
|
supersededAutomaticContinuation = true;
|
|
4082
4398
|
}
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
}
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4399
|
+
return { kind: "stop", stopReason: "end_turn" };
|
|
4400
|
+
}
|
|
4401
|
+
if (probe === "unavailable") {
|
|
4402
|
+
this.todoStopGuard.blockUntilOrdinaryPromptStarts();
|
|
4403
|
+
guardForThisSend = void 0;
|
|
4404
|
+
nextGuardContinuation = void 0;
|
|
4405
|
+
if (!options.externalParts) {
|
|
4406
|
+
preserveGuardOnSkippedSend = true;
|
|
4407
|
+
return { kind: "stop", stopReason: "end_turn" };
|
|
4408
|
+
}
|
|
4409
|
+
if (!initialSend && nextMessage) {
|
|
4410
|
+
nextMessage = {
|
|
4411
|
+
...nextMessage,
|
|
4412
|
+
parts: (nextMessage.parts ?? []).filter(
|
|
4413
|
+
(part) => !("text" in part && isTodoStopGuardPromptText(part.text))
|
|
4414
|
+
)
|
|
4415
|
+
};
|
|
4416
|
+
}
|
|
4417
|
+
}
|
|
4418
|
+
}
|
|
4419
|
+
if (guardForThisSend && this.config.getApprovalMode() === "plan" /* PLAN */) {
|
|
4420
|
+
this.#clearTodoStopGuardTrustAndDrainAutomaticQueues();
|
|
4421
|
+
}
|
|
4422
|
+
if (guardForThisSend) {
|
|
4423
|
+
const hasRelevantBackgroundInput = this.#hasRelevantTodoStopGuardBackgroundInput();
|
|
4424
|
+
const refreshedDecision = guardForThisSend.toolClosure ? this.todoStopGuard.decideToolClosure(
|
|
4425
|
+
guardForThisSend.attempt - 1,
|
|
4426
|
+
hasRelevantBackgroundInput
|
|
4427
|
+
) : this.todoStopGuard.decide(hasRelevantBackgroundInput);
|
|
4428
|
+
if (refreshedDecision.kind !== "continue" || refreshedDecision.attempt !== guardForThisSend.attempt) {
|
|
4429
|
+
guardForThisSend = void 0;
|
|
4430
|
+
nextGuardContinuation = void 0;
|
|
4431
|
+
if (!options.externalParts) {
|
|
4432
|
+
preserveGuardOnSkippedSend = true;
|
|
4433
|
+
return { kind: "stop", stopReason: "end_turn" };
|
|
4434
|
+
}
|
|
4435
|
+
if (!initialSend && nextMessage) {
|
|
4436
|
+
nextMessage = {
|
|
4437
|
+
...nextMessage,
|
|
4438
|
+
parts: (nextMessage.parts ?? []).filter(
|
|
4439
|
+
(part) => !("text" in part && isTodoStopGuardPromptText(part.text))
|
|
4440
|
+
)
|
|
4441
|
+
};
|
|
4442
|
+
}
|
|
4097
4443
|
}
|
|
4098
|
-
|
|
4444
|
+
}
|
|
4445
|
+
if (guardForThisSend) {
|
|
4446
|
+
const claim = await this.#claimTodoStopGuardContinuation(
|
|
4447
|
+
pendingSend.signal
|
|
4448
|
+
);
|
|
4449
|
+
if (claim === "queued") {
|
|
4099
4450
|
guardForThisSend = void 0;
|
|
4100
4451
|
nextGuardContinuation = void 0;
|
|
4101
4452
|
preserveGuardOnSkippedSend = true;
|
|
@@ -4104,41 +4455,21 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4104
4455
|
}
|
|
4105
4456
|
return { kind: "stop", stopReason: "end_turn" };
|
|
4106
4457
|
}
|
|
4107
|
-
if (
|
|
4108
|
-
this.todoStopGuard.
|
|
4458
|
+
if (claim === "unavailable") {
|
|
4459
|
+
this.todoStopGuard.blockUntilOrdinaryPromptStarts();
|
|
4109
4460
|
guardForThisSend = void 0;
|
|
4110
4461
|
nextGuardContinuation = void 0;
|
|
4111
|
-
if (!externalParts
|
|
4462
|
+
if (!options.externalParts) {
|
|
4112
4463
|
preserveGuardOnSkippedSend = true;
|
|
4113
4464
|
return { kind: "stop", stopReason: "end_turn" };
|
|
4114
4465
|
}
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
guardForThisSend.attempt - 1,
|
|
4123
|
-
hasRelevantBackgroundInput
|
|
4124
|
-
) : this.todoStopGuard.decide(
|
|
4125
|
-
hasRelevantBackgroundInput
|
|
4126
|
-
);
|
|
4127
|
-
if (refreshedDecision.kind !== "continue" || refreshedDecision.attempt !== guardForThisSend.attempt) {
|
|
4128
|
-
guardForThisSend = void 0;
|
|
4129
|
-
nextGuardContinuation = void 0;
|
|
4130
|
-
if (!options.externalParts) {
|
|
4131
|
-
preserveGuardOnSkippedSend = true;
|
|
4132
|
-
return { kind: "stop", stopReason: "end_turn" };
|
|
4133
|
-
}
|
|
4134
|
-
if (!initialSend && nextMessage) {
|
|
4135
|
-
nextMessage = {
|
|
4136
|
-
...nextMessage,
|
|
4137
|
-
parts: (nextMessage.parts ?? []).filter(
|
|
4138
|
-
(part) => !("text" in part && isTodoStopGuardPromptText(part.text))
|
|
4139
|
-
)
|
|
4140
|
-
};
|
|
4141
|
-
}
|
|
4466
|
+
if (!initialSend && nextMessage) {
|
|
4467
|
+
nextMessage = {
|
|
4468
|
+
...nextMessage,
|
|
4469
|
+
parts: (nextMessage.parts ?? []).filter(
|
|
4470
|
+
(part) => !("text" in part && isTodoStopGuardPromptText(part.text))
|
|
4471
|
+
)
|
|
4472
|
+
};
|
|
4142
4473
|
}
|
|
4143
4474
|
}
|
|
4144
4475
|
}
|
|
@@ -4146,16 +4477,42 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4146
4477
|
await options.onAutomaticContinuationValidated();
|
|
4147
4478
|
automaticContinuationValidated = true;
|
|
4148
4479
|
}
|
|
4149
|
-
|
|
4480
|
+
preparedMessage = guardForThisSend || !externalParts ? nextMessage?.parts ?? [] : externalParts;
|
|
4150
4481
|
messageForPreservation = {
|
|
4151
4482
|
role: "user",
|
|
4152
|
-
parts:
|
|
4483
|
+
parts: preparedMessage
|
|
4153
4484
|
};
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4485
|
+
preservePreparedMessageOnSkippedSend = preparedMessage.some(
|
|
4486
|
+
(part) => !("text" in part && isTodoStopGuardPromptText(part.text))
|
|
4487
|
+
);
|
|
4488
|
+
return { kind: "send", message: preparedMessage };
|
|
4489
|
+
} : void 0,
|
|
4490
|
+
beforeSend: /* @__PURE__ */ __name(async ({ compressionFailed }) => {
|
|
4491
|
+
if (guardForThisSend && compressionFailed) {
|
|
4492
|
+
this.todoStopGuard.suspend();
|
|
4493
|
+
guardForThisSend = void 0;
|
|
4494
|
+
nextGuardContinuation = void 0;
|
|
4495
|
+
if (!options.externalParts) {
|
|
4496
|
+
preserveGuardOnSkippedSend = true;
|
|
4497
|
+
return { kind: "stop", stopReason: "end_turn" };
|
|
4498
|
+
}
|
|
4499
|
+
preparedMessage = initialSend && externalParts ? externalParts : preparedMessage.filter(
|
|
4500
|
+
(part) => !("text" in part && isTodoStopGuardPromptText(part.text))
|
|
4501
|
+
);
|
|
4502
|
+
preservePreparedMessageOnSkippedSend = true;
|
|
4503
|
+
}
|
|
4504
|
+
if (!automaticContinuationValidated && options.onAutomaticContinuationValidated) {
|
|
4505
|
+
await options.onAutomaticContinuationValidated();
|
|
4506
|
+
automaticContinuationValidated = true;
|
|
4507
|
+
}
|
|
4508
|
+
messageForPreservation = {
|
|
4509
|
+
role: "user",
|
|
4510
|
+
parts: preparedMessage
|
|
4157
4511
|
};
|
|
4158
|
-
|
|
4512
|
+
providerSendChat = this.#getCurrentChat();
|
|
4513
|
+
userContentPushCountBeforeSend = providerSendChat.getUserContentPushCount?.() ?? 0;
|
|
4514
|
+
return { kind: "send", message: preparedMessage };
|
|
4515
|
+
}, "beforeSend")
|
|
4159
4516
|
}
|
|
4160
4517
|
);
|
|
4161
4518
|
if (!sendResult.responseStream) {
|
|
@@ -4171,7 +4528,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4171
4528
|
);
|
|
4172
4529
|
this.#preserveUnsentMessageHistory(
|
|
4173
4530
|
preservedParts.length > 0 ? { ...messageForPreservation, parts: preservedParts } : null,
|
|
4174
|
-
sendResult.stopReason === "cancelled"
|
|
4531
|
+
sendResult.stopReason === "cancelled" || preservePreparedMessageOnSkippedSend
|
|
4175
4532
|
);
|
|
4176
4533
|
return {
|
|
4177
4534
|
kind: "terminal",
|
|
@@ -4193,7 +4550,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4193
4550
|
if (guardCommitted) {
|
|
4194
4551
|
await this.#emitTodoStopGuardContinuation(guardForThisSend);
|
|
4195
4552
|
}
|
|
4196
|
-
if (!guardCommitted && externalParts) {
|
|
4553
|
+
if (!guardCommitted && options.externalParts) {
|
|
4197
4554
|
guardForThisSend = void 0;
|
|
4198
4555
|
}
|
|
4199
4556
|
}
|
|
@@ -4247,6 +4604,24 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4247
4604
|
}
|
|
4248
4605
|
} catch (error) {
|
|
4249
4606
|
streamFailed = true;
|
|
4607
|
+
const preservedParts = (messageForPreservation.parts ?? []).filter(
|
|
4608
|
+
(part) => !("text" in part && isTodoStopGuardPromptText(part.text))
|
|
4609
|
+
);
|
|
4610
|
+
if (preservedParts.length > 0 && (!providerSendChat || (providerSendChat.getUserContentPushCount?.() ?? 0) <= userContentPushCountBeforeSend)) {
|
|
4611
|
+
this.#preserveUnsentMessageHistory(
|
|
4612
|
+
{ ...messageForPreservation, parts: preservedParts },
|
|
4613
|
+
true
|
|
4614
|
+
);
|
|
4615
|
+
}
|
|
4616
|
+
const isControlledCancellation = pendingSend.signal.aborted && (pendingSend.signal.reason === USER_CANCEL_ABORT_REASON || pendingSend.signal.reason === SESSION_DISPOSE_ABORT_REASON);
|
|
4617
|
+
if (isControlledCancellation) {
|
|
4618
|
+
this.todoStopGuard.suspend();
|
|
4619
|
+
return {
|
|
4620
|
+
kind: "terminal",
|
|
4621
|
+
stopReason: "cancelled",
|
|
4622
|
+
...supersededAutomaticContinuation ? { supersededAutomaticContinuation: true } : {}
|
|
4623
|
+
};
|
|
4624
|
+
}
|
|
4250
4625
|
this.todoStopGuard.pauseForTrustedRetry();
|
|
4251
4626
|
const errorStatus = getErrorStatus(error);
|
|
4252
4627
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -4296,7 +4671,8 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4296
4671
|
pendingSend.signal,
|
|
4297
4672
|
toolPromptId,
|
|
4298
4673
|
functionCalls,
|
|
4299
|
-
toolLoopState
|
|
4674
|
+
toolLoopState,
|
|
4675
|
+
options.onFullTurnModel
|
|
4300
4676
|
)
|
|
4301
4677
|
);
|
|
4302
4678
|
if (toolRun.stopAfterPermissionCancel || toolRun.loopDetected) {
|
|
@@ -4454,6 +4830,19 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4454
4830
|
*/
|
|
4455
4831
|
async #sendMessageStreamWithAutoCompression(promptId, message, abortSignal, options = {}) {
|
|
4456
4832
|
const geminiClient = this.config.getGeminiClient();
|
|
4833
|
+
if (options.prepareBeforeCompression) {
|
|
4834
|
+
const decision = await options.prepareBeforeCompression();
|
|
4835
|
+
if (decision.kind === "stop") {
|
|
4836
|
+
return { responseStream: null, stopReason: decision.stopReason };
|
|
4837
|
+
}
|
|
4838
|
+
message = decision.message;
|
|
4839
|
+
}
|
|
4840
|
+
if (abortSignal.aborted) {
|
|
4841
|
+
debugLogger6.debug(
|
|
4842
|
+
`Send aborted after pre-compression preparation for prompt ${promptId}`
|
|
4843
|
+
);
|
|
4844
|
+
return { responseStream: null, stopReason: "cancelled" };
|
|
4845
|
+
}
|
|
4457
4846
|
let compressionDiagnostic = null;
|
|
4458
4847
|
let compressionInfo = null;
|
|
4459
4848
|
let compressionFailed = false;
|
|
@@ -4475,10 +4864,13 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4475
4864
|
compressionDiagnostic = `IMPORTANT: This conversation ${reasonClause}. A compressed context will be sent for future messages (compressed from: ${compressed.originalTokenCount ?? "unknown"} to ${compressed.newTokenCount ?? "unknown"} tokens).`;
|
|
4476
4865
|
}
|
|
4477
4866
|
} catch (compressionError) {
|
|
4478
|
-
if (abortSignal.aborted
|
|
4867
|
+
if (abortSignal.aborted) {
|
|
4479
4868
|
debugLogger6.debug(`Auto-compression aborted for prompt ${promptId}`);
|
|
4480
4869
|
return { responseStream: null, stopReason: "cancelled" };
|
|
4481
4870
|
}
|
|
4871
|
+
if (this.#isAbortError(compressionError)) {
|
|
4872
|
+
throw compressionError;
|
|
4873
|
+
}
|
|
4482
4874
|
debugLogger6.warn(
|
|
4483
4875
|
`Auto-compression failed for prompt ${promptId}; proceeding without compression: ` + this.#formatError(compressionError)
|
|
4484
4876
|
);
|
|
@@ -4693,7 +5085,8 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4693
5085
|
if (this.midTurnDrainUnavailable) {
|
|
4694
5086
|
return {
|
|
4695
5087
|
parts: await this.#buildMidTurnParts(recovered, abortSignal, options),
|
|
4696
|
-
hasQueuedPrompt: false
|
|
5088
|
+
hasQueuedPrompt: false,
|
|
5089
|
+
reliable: false
|
|
4697
5090
|
};
|
|
4698
5091
|
}
|
|
4699
5092
|
let drainPromise;
|
|
@@ -4716,13 +5109,18 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4716
5109
|
clearTimeout(timeoutHandle);
|
|
4717
5110
|
}
|
|
4718
5111
|
this.midTurnDrainTimeoutStrikes = 0;
|
|
5112
|
+
const reliable = isValidMidTurnDrainResponse(
|
|
5113
|
+
response,
|
|
5114
|
+
options.watchQueuedPromptForTodoStopGuard === true
|
|
5115
|
+
);
|
|
4719
5116
|
return {
|
|
4720
5117
|
parts: await this.#buildMidTurnParts(
|
|
4721
5118
|
[...recovered, ...parseMidTurnDrainResponse(response)],
|
|
4722
5119
|
abortSignal,
|
|
4723
5120
|
options
|
|
4724
5121
|
),
|
|
4725
|
-
hasQueuedPrompt: isRecord2(response) && response["hasQueuedPrompt"] === true
|
|
5122
|
+
hasQueuedPrompt: isRecord2(response) && response["hasQueuedPrompt"] === true,
|
|
5123
|
+
reliable
|
|
4726
5124
|
};
|
|
4727
5125
|
} catch (error) {
|
|
4728
5126
|
const errorMessage = error instanceof Error ? error.message : error && typeof error === "object" && "message" in error ? String(error.message) : String(error);
|
|
@@ -4741,7 +5139,8 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4741
5139
|
);
|
|
4742
5140
|
return {
|
|
4743
5141
|
parts: await this.#buildMidTurnParts(recovered, abortSignal, options),
|
|
4744
|
-
hasQueuedPrompt: false
|
|
5142
|
+
hasQueuedPrompt: false,
|
|
5143
|
+
reliable: false
|
|
4745
5144
|
};
|
|
4746
5145
|
}
|
|
4747
5146
|
}
|
|
@@ -4881,26 +5280,39 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4881
5280
|
);
|
|
4882
5281
|
}
|
|
4883
5282
|
#enqueueCronPrompt(item) {
|
|
4884
|
-
|
|
4885
|
-
|
|
5283
|
+
const automaticWorkDeferred = this.todoStopGuard.blocksUnrelatedAutomaticTurns || this.todoStopGuardQueuedPromptPriority;
|
|
5284
|
+
if (automaticWorkDeferred) {
|
|
5285
|
+
const incomingIsRelated = this.#cronContinuesTodoStopGuardWorkChain(item);
|
|
5286
|
+
let shouldAppend = true;
|
|
5287
|
+
if (!incomingIsRelated && item.taskId) {
|
|
4886
5288
|
const duplicateIndex = this.cronQueue.findIndex(
|
|
4887
5289
|
(queued) => queued.taskId === item.taskId && !this.#cronContinuesTodoStopGuardWorkChain(queued)
|
|
4888
5290
|
);
|
|
4889
5291
|
if (duplicateIndex >= 0) {
|
|
4890
5292
|
this.cronQueue[duplicateIndex] = item;
|
|
4891
|
-
|
|
5293
|
+
shouldAppend = false;
|
|
4892
5294
|
}
|
|
4893
5295
|
}
|
|
4894
|
-
const
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
5296
|
+
const maxBeforeAppend = MAX_DEFERRED_UNRELATED_CRON_QUEUE - (shouldAppend && !incomingIsRelated ? 1 : 0);
|
|
5297
|
+
let unrelatedCount = this.cronQueue.filter(
|
|
5298
|
+
(queued) => !this.#cronContinuesTodoStopGuardWorkChain(queued)
|
|
5299
|
+
).length;
|
|
5300
|
+
const evictedTaskIds = [];
|
|
5301
|
+
while (unrelatedCount > maxBeforeAppend) {
|
|
5302
|
+
const evictedIndex = this.cronQueue.findIndex(
|
|
5303
|
+
(queued) => !this.#cronContinuesTodoStopGuardWorkChain(queued)
|
|
5304
|
+
);
|
|
5305
|
+
if (evictedIndex < 0) break;
|
|
4899
5306
|
const [evicted] = this.cronQueue.splice(evictedIndex, 1);
|
|
5307
|
+
evictedTaskIds.push(evicted?.taskId ?? "unknown");
|
|
5308
|
+
unrelatedCount--;
|
|
5309
|
+
}
|
|
5310
|
+
if (evictedTaskIds.length > 0) {
|
|
4900
5311
|
debugLogger6.warn(
|
|
4901
|
-
`Cron queue overflow while automatic work is deferred:
|
|
5312
|
+
`Cron queue overflow while automatic work is deferred: evicted ${evictedTaskIds.length} unrelated task(s): ${evictedTaskIds.join(", ")}`
|
|
4902
5313
|
);
|
|
4903
5314
|
}
|
|
5315
|
+
if (!shouldAppend) return;
|
|
4904
5316
|
}
|
|
4905
5317
|
this.cronQueue.push(item);
|
|
4906
5318
|
}
|
|
@@ -5302,6 +5714,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5302
5714
|
taskId: meta.agentId,
|
|
5303
5715
|
status: meta.status,
|
|
5304
5716
|
kind: "agent",
|
|
5717
|
+
continuesTodoStopGuardWorkChain: this.#agentContinuesTodoStopGuardWorkChain(meta.agentId),
|
|
5305
5718
|
toolUseId: meta.toolUseId
|
|
5306
5719
|
});
|
|
5307
5720
|
}
|
|
@@ -5317,6 +5730,10 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5317
5730
|
taskId: meta.monitorId,
|
|
5318
5731
|
status: meta.status,
|
|
5319
5732
|
kind: "monitor",
|
|
5733
|
+
continuesTodoStopGuardWorkChain: this.#monitorContinuesTodoStopGuardWorkChain(
|
|
5734
|
+
meta.monitorId,
|
|
5735
|
+
meta.ownerAgentId
|
|
5736
|
+
),
|
|
5320
5737
|
toolUseId: meta.toolUseId
|
|
5321
5738
|
});
|
|
5322
5739
|
});
|
|
@@ -5327,7 +5744,8 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5327
5744
|
modelText,
|
|
5328
5745
|
taskId: meta.shellId,
|
|
5329
5746
|
status: meta.status,
|
|
5330
|
-
kind: "shell"
|
|
5747
|
+
kind: "shell",
|
|
5748
|
+
continuesTodoStopGuardWorkChain: !this.todoStopGuardBackgroundBaseline.shells.has(meta.shellId)
|
|
5331
5749
|
});
|
|
5332
5750
|
});
|
|
5333
5751
|
this.config.getChatRecordingService()?.setTitleRecordedCallback((customTitle, titleSource, sessionId) => {
|
|
@@ -5459,7 +5877,12 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5459
5877
|
if (ac.signal.aborted) return;
|
|
5460
5878
|
await this.#emitBackgroundNotificationDisplay(item);
|
|
5461
5879
|
const notificationParts = [{ text: item.modelText }];
|
|
5462
|
-
this.config.getChatRecordingService()?.recordNotification(notificationParts, item.displayText
|
|
5880
|
+
this.config.getChatRecordingService()?.recordNotification(notificationParts, item.displayText, {
|
|
5881
|
+
taskId: item.taskId,
|
|
5882
|
+
status: item.status,
|
|
5883
|
+
kind: item.kind,
|
|
5884
|
+
toolUseId: item.toolUseId
|
|
5885
|
+
});
|
|
5463
5886
|
const notificationReminders = await this.#buildInitialSystemReminders();
|
|
5464
5887
|
let nextMessage = {
|
|
5465
5888
|
role: "user",
|
|
@@ -5912,7 +6335,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5912
6335
|
* sequential batch to preserve the implicit ordering the model may rely
|
|
5913
6336
|
* on. Response-part ordering matches the original `functionCalls` order.
|
|
5914
6337
|
*/
|
|
5915
|
-
async runToolCalls(abortSignal, promptId, functionCalls, toolLoopState) {
|
|
6338
|
+
async runToolCalls(abortSignal, promptId, functionCalls, toolLoopState, onFullTurnModel) {
|
|
5916
6339
|
const dedupedFunctionCalls = dedupeToolCallsById(functionCalls);
|
|
5917
6340
|
const generatedCallIdBase = randomUUID();
|
|
5918
6341
|
const executionCallIds = new Map(
|
|
@@ -6189,7 +6612,8 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
6189
6612
|
toolLoopState,
|
|
6190
6613
|
recordSkippedToolCall,
|
|
6191
6614
|
queueToolResultRecord,
|
|
6192
|
-
executionCallIds.get(calls[i])
|
|
6615
|
+
executionCallIds.get(calls[i]),
|
|
6616
|
+
onFullTurnModel
|
|
6193
6617
|
);
|
|
6194
6618
|
results[i] = r;
|
|
6195
6619
|
if (r.loopDetected) {
|
|
@@ -6223,7 +6647,8 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
6223
6647
|
toolLoopState,
|
|
6224
6648
|
recordSkippedToolCall,
|
|
6225
6649
|
queueToolResultRecord,
|
|
6226
|
-
executionCallIds.get(calls[idx])
|
|
6650
|
+
executionCallIds.get(calls[idx]),
|
|
6651
|
+
onFullTurnModel
|
|
6227
6652
|
).then((r) => {
|
|
6228
6653
|
results[idx] = r;
|
|
6229
6654
|
}).finally(() => {
|
|
@@ -6347,7 +6772,8 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
6347
6772
|
toolLoopState,
|
|
6348
6773
|
recordSkippedToolCall,
|
|
6349
6774
|
queueToolResultRecord,
|
|
6350
|
-
executionCallIds.get(fc)
|
|
6775
|
+
executionCallIds.get(fc),
|
|
6776
|
+
onFullTurnModel
|
|
6351
6777
|
);
|
|
6352
6778
|
parts.push(...r.parts);
|
|
6353
6779
|
collectMemoryWriteCandidates(r);
|
|
@@ -6412,7 +6838,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
6412
6838
|
}
|
|
6413
6839
|
return reminders;
|
|
6414
6840
|
}
|
|
6415
|
-
async runTool(abortSignal, promptId, fc, onStopAfterPermissionCancel, toolLoopState, recordSkippedToolCall, queueToolResultRecord, generatedCallId) {
|
|
6841
|
+
async runTool(abortSignal, promptId, fc, onStopAfterPermissionCancel, toolLoopState, recordSkippedToolCall, queueToolResultRecord, generatedCallId, onFullTurnModel) {
|
|
6416
6842
|
const callId = fc.id ?? generatedCallId ?? `${fc.name}-${Date.now()}`;
|
|
6417
6843
|
let args = fc.args ?? {};
|
|
6418
6844
|
if (toolLoopState?.loopDetected) {
|
|
@@ -6517,15 +6943,20 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
6517
6943
|
}
|
|
6518
6944
|
const policyToolName = tool.name;
|
|
6519
6945
|
const originalPolicyRequestArgs = policyToolName === ToolNames.SHELL || policyToolName === ToolNames.MONITOR ? structuredClone(args) : args;
|
|
6520
|
-
const toolSpan = startToolSpan(
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6946
|
+
const toolSpan = startToolSpan(
|
|
6947
|
+
policyToolName,
|
|
6948
|
+
{
|
|
6949
|
+
"tool.call_id": callId,
|
|
6950
|
+
"gen_ai.tool.call.id": getProviderToolCallId(fc) ?? callId,
|
|
6951
|
+
// Dual-emit the legacy call_id/tool_name aliases like CoreToolScheduler
|
|
6952
|
+
// (coreToolScheduler.ts) so pre-Phase-2 dashboards keyed off call_id keep
|
|
6953
|
+
// matching daemon/ACP tool spans during the migration window.
|
|
6954
|
+
call_id: callId,
|
|
6955
|
+
tool_name: policyToolName
|
|
6956
|
+
},
|
|
6957
|
+
tool.description,
|
|
6958
|
+
promptId
|
|
6959
|
+
);
|
|
6529
6960
|
let spanSuccess = false;
|
|
6530
6961
|
try {
|
|
6531
6962
|
return await runInToolSpanContext(toolSpan, async () => {
|
|
@@ -6563,6 +6994,10 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
6563
6994
|
let toolBuildSucceeded = false;
|
|
6564
6995
|
try {
|
|
6565
6996
|
const invocation = tool.build(args);
|
|
6997
|
+
if (policyToolName === ToolNames.MONITOR) {
|
|
6998
|
+
const callIdAware = invocation;
|
|
6999
|
+
callIdAware.setCallId?.(callId);
|
|
7000
|
+
}
|
|
6566
7001
|
toolBuildSucceeded = true;
|
|
6567
7002
|
const taskEventEmitter = invocation.eventEmitter;
|
|
6568
7003
|
if (isAgentTool && taskEventEmitter) {
|
|
@@ -7078,6 +7513,33 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7078
7513
|
);
|
|
7079
7514
|
}
|
|
7080
7515
|
}
|
|
7516
|
+
const continuedAgentId = toolName === ToolNames.SEND_MESSAGE && typeof args["task_id"] === "string" && args["task_id"].length > 0 ? args["task_id"] : void 0;
|
|
7517
|
+
const provisionalRelatedAgent = continuedAgentId !== void 0 && !this.relatedAgentIds.has(continuedAgentId);
|
|
7518
|
+
if (provisionalRelatedAgent) {
|
|
7519
|
+
this.provisionalRelatedAgentCounts.set(
|
|
7520
|
+
continuedAgentId,
|
|
7521
|
+
(this.provisionalRelatedAgentCounts.get(continuedAgentId) ?? 0) + 1
|
|
7522
|
+
);
|
|
7523
|
+
}
|
|
7524
|
+
let relatedAgentSettled = false;
|
|
7525
|
+
const settleRelatedAgent = /* @__PURE__ */ __name((succeeded2) => {
|
|
7526
|
+
if (relatedAgentSettled || !provisionalRelatedAgent || !continuedAgentId) {
|
|
7527
|
+
return;
|
|
7528
|
+
}
|
|
7529
|
+
relatedAgentSettled = true;
|
|
7530
|
+
const remaining = (this.provisionalRelatedAgentCounts.get(continuedAgentId) ?? 1) - 1;
|
|
7531
|
+
if (remaining > 0) {
|
|
7532
|
+
this.provisionalRelatedAgentCounts.set(
|
|
7533
|
+
continuedAgentId,
|
|
7534
|
+
remaining
|
|
7535
|
+
);
|
|
7536
|
+
} else {
|
|
7537
|
+
this.provisionalRelatedAgentCounts.delete(continuedAgentId);
|
|
7538
|
+
}
|
|
7539
|
+
if (succeeded2) {
|
|
7540
|
+
this.relatedAgentIds.add(continuedAgentId);
|
|
7541
|
+
}
|
|
7542
|
+
}, "settleRelatedAgent");
|
|
7081
7543
|
const execSpan = startToolExecutionSpan();
|
|
7082
7544
|
let toolResult;
|
|
7083
7545
|
let isExecutionTimeout = false;
|
|
@@ -7116,6 +7578,17 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7116
7578
|
`Qwen Code is executing tool ${toolName}`
|
|
7117
7579
|
);
|
|
7118
7580
|
try {
|
|
7581
|
+
try {
|
|
7582
|
+
addToolArgumentsAttributes(
|
|
7583
|
+
this.config,
|
|
7584
|
+
toolSpan,
|
|
7585
|
+
invocation.params
|
|
7586
|
+
);
|
|
7587
|
+
} catch {
|
|
7588
|
+
debugLogger6.debug(
|
|
7589
|
+
"[Session.runTool] Failed to record tool arguments telemetry"
|
|
7590
|
+
);
|
|
7591
|
+
}
|
|
7119
7592
|
toolResult = await invocation.execute(
|
|
7120
7593
|
activeToolAbortSignal,
|
|
7121
7594
|
onToolProgress
|
|
@@ -7126,6 +7599,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7126
7599
|
}
|
|
7127
7600
|
isExecutionTimeout = toolResult.error?.type === "execution_timeout" /* EXECUTION_TIMEOUT */;
|
|
7128
7601
|
aborted = activeToolAbortSignal.aborted && !isExecutionTimeout;
|
|
7602
|
+
settleRelatedAgent(!toolResult.error && !aborted);
|
|
7129
7603
|
endToolExecutionSpan(execSpan, {
|
|
7130
7604
|
success: !toolResult.error && !aborted,
|
|
7131
7605
|
error: aborted ? "tool_cancelled" : isExecutionTimeout ? "tool_timeout" : toolResult.error ? "tool_error" : void 0,
|
|
@@ -7133,6 +7607,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7133
7607
|
...heartbeatSpanAttributes()
|
|
7134
7608
|
});
|
|
7135
7609
|
} catch (execError) {
|
|
7610
|
+
settleRelatedAgent(false);
|
|
7136
7611
|
endToolExecutionSpan(execSpan, {
|
|
7137
7612
|
success: false,
|
|
7138
7613
|
error: activeToolAbortSignal.aborted ? "tool_cancelled" : "tool_exception",
|
|
@@ -7148,7 +7623,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7148
7623
|
this.#clearTodoStopGuardTrustAndDrainAutomaticQueues();
|
|
7149
7624
|
}
|
|
7150
7625
|
}
|
|
7151
|
-
|
|
7626
|
+
let responseParts = toolResult.error ? convertToFunctionErrorResponse(
|
|
7152
7627
|
toolName,
|
|
7153
7628
|
callId,
|
|
7154
7629
|
toolResult.llmContent,
|
|
@@ -7226,6 +7701,18 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7226
7701
|
artifacts: failureHookResult.artifacts
|
|
7227
7702
|
});
|
|
7228
7703
|
}
|
|
7704
|
+
const visionBridgeNotices = [];
|
|
7705
|
+
responseParts = await bridgeToolResultImages({
|
|
7706
|
+
config: this.config,
|
|
7707
|
+
responseParts,
|
|
7708
|
+
signal: activeToolAbortSignal,
|
|
7709
|
+
onFullTurnModel,
|
|
7710
|
+
onVisionBridgeNotice: /* @__PURE__ */ __name((notice) => visionBridgeNotices.push(notice), "onVisionBridgeNotice")
|
|
7711
|
+
});
|
|
7712
|
+
const visionBridgeNotice = visionBridgeNotices.length > 0 ? visionBridgeNotices.join("\n") : void 0;
|
|
7713
|
+
if (visionBridgeNotice) {
|
|
7714
|
+
await this.messageEmitter.emitAgentMessage(visionBridgeNotice);
|
|
7715
|
+
}
|
|
7229
7716
|
if (isTodoWriteTool) {
|
|
7230
7717
|
const todos = this.planEmitter.extractTodos(
|
|
7231
7718
|
toolResult.returnDisplay,
|
|
@@ -7269,11 +7756,26 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7269
7756
|
callId,
|
|
7270
7757
|
status,
|
|
7271
7758
|
resultDisplay: toolResult.returnDisplay,
|
|
7759
|
+
...visionBridgeNotice !== void 0 ? { visionBridgeNotice } : {},
|
|
7272
7760
|
error: toolResult.error ? new Error(toolResult.error.message) : void 0,
|
|
7273
7761
|
errorType: toolResult.error?.type
|
|
7274
7762
|
}
|
|
7275
7763
|
});
|
|
7276
7764
|
spanSuccess = succeeded;
|
|
7765
|
+
if (succeeded && !nestedPermissionCancelled) {
|
|
7766
|
+
const result = responseParts.find(
|
|
7767
|
+
(part) => part.functionResponse !== void 0
|
|
7768
|
+
)?.functionResponse?.response;
|
|
7769
|
+
if (result !== void 0) {
|
|
7770
|
+
try {
|
|
7771
|
+
addToolCallResultAttributes(this.config, toolSpan, result);
|
|
7772
|
+
} catch {
|
|
7773
|
+
debugLogger6.debug(
|
|
7774
|
+
"[Session.runTool] Failed to record tool result telemetry"
|
|
7775
|
+
);
|
|
7776
|
+
}
|
|
7777
|
+
}
|
|
7778
|
+
}
|
|
7277
7779
|
if (toolResult.error) {
|
|
7278
7780
|
spanError = toolResult.error.message;
|
|
7279
7781
|
} else if (aborted) {
|
|
@@ -7943,7 +8445,8 @@ function serializeMonitorTask(entry, now) {
|
|
|
7943
8445
|
...optionalField("pid", entry.pid),
|
|
7944
8446
|
...optionalField("exitCode", entry.exitCode),
|
|
7945
8447
|
...optionalField("error", entry.error),
|
|
7946
|
-
...optionalField("ownerAgentId", entry.ownerAgentId)
|
|
8448
|
+
...optionalField("ownerAgentId", entry.ownerAgentId),
|
|
8449
|
+
...optionalField("toolUseId", entry.toolUseId)
|
|
7947
8450
|
};
|
|
7948
8451
|
}
|
|
7949
8452
|
__name(serializeMonitorTask, "serializeMonitorTask");
|
|
@@ -8131,6 +8634,9 @@ function buildAcpLocalReadRoots(config) {
|
|
|
8131
8634
|
getUserAutoMemoryRoot(),
|
|
8132
8635
|
...config.storage.getUserSkillsDirs(),
|
|
8133
8636
|
Storage.getUserExtensionsDir(),
|
|
8637
|
+
// Saved plan files (see ReadFileTool.getDefaultPermission for why the
|
|
8638
|
+
// plans dir must be readable without a confirmation prompt).
|
|
8639
|
+
config.getPlansDir(),
|
|
8134
8640
|
...defaultAcpOnlyLocalReadRoots(),
|
|
8135
8641
|
...parseAcpLocalReadRootsEnv()
|
|
8136
8642
|
];
|
|
@@ -9611,7 +10117,97 @@ async function deliverClientMcpMessage(connection, serverName, message, sessionI
|
|
|
9611
10117
|
return payload;
|
|
9612
10118
|
}
|
|
9613
10119
|
__name(deliverClientMcpMessage, "deliverClientMcpMessage");
|
|
10120
|
+
function readRuntimeMcpRequest(params) {
|
|
10121
|
+
const name = params["name"];
|
|
10122
|
+
if (typeof name !== "string" || name.length === 0) {
|
|
10123
|
+
throw RequestError.invalidParams(void 0, "Invalid or missing name");
|
|
10124
|
+
}
|
|
10125
|
+
if (!isValidServerName(name)) {
|
|
10126
|
+
throw RequestError.invalidParams(
|
|
10127
|
+
void 0,
|
|
10128
|
+
"Server name must be \u2264256 chars, alphanumeric + underscore/hyphen, and not a reserved JS property name"
|
|
10129
|
+
);
|
|
10130
|
+
}
|
|
10131
|
+
const originatorClientId = params["originatorClientId"];
|
|
10132
|
+
return {
|
|
10133
|
+
name,
|
|
10134
|
+
runtimeClientId: typeof originatorClientId === "string" && originatorClientId.length > 0 ? originatorClientId : "daemon"
|
|
10135
|
+
};
|
|
10136
|
+
}
|
|
10137
|
+
__name(readRuntimeMcpRequest, "readRuntimeMcpRequest");
|
|
10138
|
+
function readRuntimeMcpAddRequest(params) {
|
|
10139
|
+
const request = readRuntimeMcpRequest(params);
|
|
10140
|
+
const config = params["config"];
|
|
10141
|
+
if (!config || typeof config !== "object" || Array.isArray(config)) {
|
|
10142
|
+
throw RequestError.invalidParams(void 0, "Invalid or missing config");
|
|
10143
|
+
}
|
|
10144
|
+
const {
|
|
10145
|
+
trust: _trust,
|
|
10146
|
+
authProviderType: _auth,
|
|
10147
|
+
includeTools: _inc,
|
|
10148
|
+
excludeTools: _exc,
|
|
10149
|
+
cwd: _cwd,
|
|
10150
|
+
env: _env,
|
|
10151
|
+
oauth: _oauth,
|
|
10152
|
+
headers: _headers,
|
|
10153
|
+
type: _type,
|
|
10154
|
+
[CLIENT_MCP_OVER_WS_CONFIG_FLAG]: clientMcpOverWs,
|
|
10155
|
+
...safeConfig
|
|
10156
|
+
} = config;
|
|
10157
|
+
if (clientMcpOverWs === true) {
|
|
10158
|
+
safeConfig["type"] = "sdk";
|
|
10159
|
+
}
|
|
10160
|
+
return {
|
|
10161
|
+
...request,
|
|
10162
|
+
config: safeConfig
|
|
10163
|
+
};
|
|
10164
|
+
}
|
|
10165
|
+
__name(readRuntimeMcpAddRequest, "readRuntimeMcpAddRequest");
|
|
10166
|
+
function getRuntimeMcpManager(config) {
|
|
10167
|
+
const manager = config.getToolRegistry()?.getMcpClientManager();
|
|
10168
|
+
if (!manager) {
|
|
10169
|
+
throw RequestError.internalError(
|
|
10170
|
+
void 0,
|
|
10171
|
+
"McpClientManager unavailable on this Config"
|
|
10172
|
+
);
|
|
10173
|
+
}
|
|
10174
|
+
return manager;
|
|
10175
|
+
}
|
|
10176
|
+
__name(getRuntimeMcpManager, "getRuntimeMcpManager");
|
|
10177
|
+
async function addRuntimeMcpServer(manager, request) {
|
|
10178
|
+
try {
|
|
10179
|
+
return await manager.addRuntimeMcpServer(
|
|
10180
|
+
request.name,
|
|
10181
|
+
request.config,
|
|
10182
|
+
request.runtimeClientId
|
|
10183
|
+
);
|
|
10184
|
+
} catch (err) {
|
|
10185
|
+
if (err instanceof McpBudgetWouldExceedError) {
|
|
10186
|
+
throw new RequestError(-32099, err.message, {
|
|
10187
|
+
errorKind: err.code,
|
|
10188
|
+
serverName: err.serverName
|
|
10189
|
+
});
|
|
10190
|
+
}
|
|
10191
|
+
if (err instanceof McpServerSpawnFailedError) {
|
|
10192
|
+
throw new RequestError(-32099, err.message, {
|
|
10193
|
+
errorKind: err.code,
|
|
10194
|
+
serverName: err.serverName,
|
|
10195
|
+
...err.details
|
|
10196
|
+
});
|
|
10197
|
+
}
|
|
10198
|
+
if (err instanceof InvalidMcpConfigError) {
|
|
10199
|
+
throw new RequestError(-32099, err.message, {
|
|
10200
|
+
errorKind: err.code,
|
|
10201
|
+
serverName: err.serverName,
|
|
10202
|
+
reason: err.reason
|
|
10203
|
+
});
|
|
10204
|
+
}
|
|
10205
|
+
throw err;
|
|
10206
|
+
}
|
|
10207
|
+
}
|
|
10208
|
+
__name(addRuntimeMcpServer, "addRuntimeMcpServer");
|
|
9614
10209
|
async function runAcpAgent(config, settings, argv, options) {
|
|
10210
|
+
const sessionWriterLeaseEnabledAtStartup = typeof config.isSessionWriterLeaseEnabled === "function" ? config.isSessionWriterLeaseEnabled() : settings.merged.experimental?.sessionWriterLease === true;
|
|
9615
10211
|
const privateParentCapability = options === void 0 ? process.env[PRIVATE_ACP_CAPABILITY_ENV] : options.privateParentCapability;
|
|
9616
10212
|
delete process.env[PRIVATE_ACP_CAPABILITY_ENV];
|
|
9617
10213
|
let acpConnection;
|
|
@@ -9651,12 +10247,31 @@ async function runAcpAgent(config, settings, argv, options) {
|
|
|
9651
10247
|
console.info = console.error;
|
|
9652
10248
|
console.debug = console.error;
|
|
9653
10249
|
let initializeRequestId;
|
|
10250
|
+
const pendingNewSessionRequestIds = /* @__PURE__ */ new Set();
|
|
9654
10251
|
const stream = ndJsonStream(stdout, stdin, {
|
|
9655
10252
|
onMessageObserved: /* @__PURE__ */ __name(({ direction, message }) => {
|
|
9656
|
-
if (direction === "received" && "id" in message && "method" in message
|
|
9657
|
-
|
|
10253
|
+
if (direction === "received" && "id" in message && "method" in message) {
|
|
10254
|
+
if (message.method === "session/new") {
|
|
10255
|
+
pendingNewSessionRequestIds.add(message.id);
|
|
10256
|
+
} else if (message.method === "initialize") {
|
|
10257
|
+
initializeRequestId = message.id;
|
|
10258
|
+
}
|
|
9658
10259
|
return;
|
|
9659
10260
|
}
|
|
10261
|
+
if (direction === "sent" && "id" in message && !("method" in message) && pendingNewSessionRequestIds.delete(message.id) && "result" in message && typeof message.result === "object" && message.result !== null && "sessionId" in message.result && typeof message.result.sessionId === "string") {
|
|
10262
|
+
const sessionId = message.result.sessionId;
|
|
10263
|
+
setImmediate(() => {
|
|
10264
|
+
const session = agentInstance?.getActiveSessions().find((candidate) => candidate.getId() === sessionId);
|
|
10265
|
+
if (!session) return;
|
|
10266
|
+
void preloadContentGenerator(
|
|
10267
|
+
session.getConfig().getContentGenerator()
|
|
10268
|
+
).catch((error) => {
|
|
10269
|
+
debugLogger7.debug(
|
|
10270
|
+
`[ACP] Session provider preload failed for ${sessionId}: ${error instanceof Error ? error.message : String(error)}`
|
|
10271
|
+
);
|
|
10272
|
+
});
|
|
10273
|
+
}).unref();
|
|
10274
|
+
}
|
|
9660
10275
|
if (direction !== "sent" || initializeRequestId === void 0 || !("id" in message) || "method" in message || message.id !== initializeRequestId) {
|
|
9661
10276
|
return;
|
|
9662
10277
|
}
|
|
@@ -9675,7 +10290,8 @@ async function runAcpAgent(config, settings, argv, options) {
|
|
|
9675
10290
|
settings,
|
|
9676
10291
|
argv,
|
|
9677
10292
|
conn,
|
|
9678
|
-
privateParentCapability
|
|
10293
|
+
privateParentCapability,
|
|
10294
|
+
sessionWriterLeaseEnabledAtStartup
|
|
9679
10295
|
);
|
|
9680
10296
|
return agentInstance;
|
|
9681
10297
|
}, stream);
|
|
@@ -9684,48 +10300,136 @@ async function runAcpAgent(config, settings, argv, options) {
|
|
|
9684
10300
|
eventLoopMonitor.dispose();
|
|
9685
10301
|
throw err;
|
|
9686
10302
|
}
|
|
9687
|
-
const drainPoolBeforeExit = /* @__PURE__ */ __name(async (label) => {
|
|
10303
|
+
const drainPoolBeforeExit = /* @__PURE__ */ __name(async (label, strict = false) => {
|
|
9688
10304
|
if (!agentInstance) return;
|
|
9689
10305
|
try {
|
|
9690
10306
|
await agentInstance.shutdownMcpPool(8e3);
|
|
9691
10307
|
} catch (err) {
|
|
9692
10308
|
debugLogger7.error(`[ACP] MCP pool drain (${label}) error:`, err);
|
|
10309
|
+
if (strict) throw err;
|
|
9693
10310
|
}
|
|
9694
10311
|
}, "drainPoolBeforeExit");
|
|
9695
10312
|
let shuttingDown = false;
|
|
10313
|
+
let managedShutdownPromise;
|
|
9696
10314
|
let sessionEndFired = false;
|
|
9697
|
-
const fireSessionEndOnce = /* @__PURE__ */ __name(async (reason) => {
|
|
10315
|
+
const fireSessionEndOnce = /* @__PURE__ */ __name(async (reason, managedConfigs) => {
|
|
9698
10316
|
if (sessionEndFired) return;
|
|
9699
10317
|
sessionEndFired = true;
|
|
9700
|
-
const configs =
|
|
9701
|
-
|
|
9702
|
-
|
|
9703
|
-
|
|
9704
|
-
const
|
|
9705
|
-
|
|
9706
|
-
|
|
10318
|
+
const configs = new Set(managedConfigs ?? [config]);
|
|
10319
|
+
if (!managedConfigs) {
|
|
10320
|
+
const sessions = agentInstance?.getActiveSessions();
|
|
10321
|
+
if (sessions) {
|
|
10322
|
+
for (const session of sessions) {
|
|
10323
|
+
const sessionConfig = session.getConfig?.();
|
|
10324
|
+
if (sessionConfig) {
|
|
10325
|
+
configs.add(sessionConfig);
|
|
10326
|
+
}
|
|
9707
10327
|
}
|
|
9708
10328
|
}
|
|
9709
10329
|
}
|
|
10330
|
+
const failures = [];
|
|
9710
10331
|
for (const cfg of configs) {
|
|
9711
10332
|
const hookSystem = cfg.getHookSystem?.();
|
|
9712
10333
|
const hooksEnabled = !cfg.getDisableAllHooks?.();
|
|
9713
10334
|
if (!hooksEnabled || !hookSystem || !cfg.hasHooksForEvent?.("SessionEnd")) {
|
|
9714
10335
|
continue;
|
|
9715
10336
|
}
|
|
9716
|
-
try {
|
|
9717
|
-
await hookSystem.fireSessionEndEvent(reason);
|
|
9718
|
-
} catch (err) {
|
|
9719
|
-
|
|
9720
|
-
|
|
9721
|
-
|
|
10337
|
+
try {
|
|
10338
|
+
await hookSystem.fireSessionEndEvent(reason);
|
|
10339
|
+
} catch (err) {
|
|
10340
|
+
if (managedConfigs) failures.push(err);
|
|
10341
|
+
debugLogger7.warn(
|
|
10342
|
+
`SessionEnd hook failed: ${err instanceof Error ? err.message : String(err)}`
|
|
10343
|
+
);
|
|
10344
|
+
}
|
|
10345
|
+
}
|
|
10346
|
+
if (failures.length > 0) {
|
|
10347
|
+
throw new AggregateError(failures, "SessionEnd hook shutdown failed");
|
|
10348
|
+
}
|
|
10349
|
+
}, "fireSessionEndOnce");
|
|
10350
|
+
const shutdownManagedAgent = /* @__PURE__ */ __name((reason, label) => {
|
|
10351
|
+
if (managedShutdownPromise) return managedShutdownPromise;
|
|
10352
|
+
const agent = agentInstance;
|
|
10353
|
+
if (!agent?.isTrustedManagedParent()) {
|
|
10354
|
+
return Promise.reject(
|
|
10355
|
+
new Error("Managed shutdown requires a trusted private parent")
|
|
10356
|
+
);
|
|
10357
|
+
}
|
|
10358
|
+
const terminal = agent.beginManagedShutdown();
|
|
10359
|
+
managedShutdownPromise = (async () => {
|
|
10360
|
+
const failures = [];
|
|
10361
|
+
try {
|
|
10362
|
+
await terminal.writerShutdown;
|
|
10363
|
+
} catch (error) {
|
|
10364
|
+
failures.push(error);
|
|
10365
|
+
debugLogger7.error("[ACP] Managed writer shutdown error:", error);
|
|
10366
|
+
const retainedLockPaths = terminal.configs.flatMap((config2) => {
|
|
10367
|
+
if (typeof config2.getSessionRuntimeBaseDir !== "function" || typeof config2.getSessionId !== "function") {
|
|
10368
|
+
return [];
|
|
10369
|
+
}
|
|
10370
|
+
return [
|
|
10371
|
+
path4.join(
|
|
10372
|
+
config2.getSessionRuntimeBaseDir(),
|
|
10373
|
+
"tmp",
|
|
10374
|
+
"session-writer-locks",
|
|
10375
|
+
`${encodeURIComponent(config2.getSessionId())}.lock`
|
|
10376
|
+
)
|
|
10377
|
+
];
|
|
10378
|
+
});
|
|
10379
|
+
writeStderrLineSafe(
|
|
10380
|
+
"qwen --acp: managed session writer shutdown failed; a writer lock may be retained for safety. Verify that no previous writer is running before manual cleanup." + (retainedLockPaths.length > 0 ? ` Candidate lock paths: ${retainedLockPaths.join(", ")}` : "")
|
|
10381
|
+
);
|
|
10382
|
+
}
|
|
10383
|
+
try {
|
|
10384
|
+
await fireSessionEndOnce(reason, terminal.configs);
|
|
10385
|
+
} catch (error) {
|
|
10386
|
+
failures.push(error);
|
|
10387
|
+
}
|
|
10388
|
+
try {
|
|
10389
|
+
await agent.finishManagedShutdown(terminal.configs);
|
|
10390
|
+
} catch (error) {
|
|
10391
|
+
failures.push(error);
|
|
10392
|
+
debugLogger7.error("[ACP] Managed resource shutdown error:", error);
|
|
10393
|
+
}
|
|
10394
|
+
try {
|
|
10395
|
+
await drainPoolBeforeExit(label, true);
|
|
10396
|
+
} catch (error) {
|
|
10397
|
+
failures.push(error);
|
|
10398
|
+
}
|
|
10399
|
+
try {
|
|
10400
|
+
await runExitCleanup();
|
|
10401
|
+
} catch (error) {
|
|
10402
|
+
failures.push(error);
|
|
10403
|
+
debugLogger7.error("[ACP] Cleanup error:", error);
|
|
10404
|
+
}
|
|
10405
|
+
if (failures.length > 0) {
|
|
10406
|
+
throw new AggregateError(failures, "Managed ACP shutdown failed");
|
|
9722
10407
|
}
|
|
9723
|
-
}
|
|
9724
|
-
|
|
10408
|
+
})();
|
|
10409
|
+
return managedShutdownPromise;
|
|
10410
|
+
}, "shutdownManagedAgent");
|
|
9725
10411
|
const shutdownHandler = /* @__PURE__ */ __name(async () => {
|
|
9726
10412
|
if (shuttingDown) return;
|
|
9727
10413
|
shuttingDown = true;
|
|
9728
10414
|
debugLogger7.debug("[ACP] Shutdown signal received, closing streams");
|
|
10415
|
+
if (agentInstance?.isTrustedManagedParent()) {
|
|
10416
|
+
let exitCode = 0;
|
|
10417
|
+
try {
|
|
10418
|
+
await shutdownManagedAgent("other" /* Other */, "signal");
|
|
10419
|
+
} catch (err) {
|
|
10420
|
+
exitCode = 1;
|
|
10421
|
+
debugLogger7.error("[ACP] Managed shutdown error:", err);
|
|
10422
|
+
} finally {
|
|
10423
|
+
eventLoopMonitor.dispose();
|
|
10424
|
+
}
|
|
10425
|
+
try {
|
|
10426
|
+
process.stdin.destroy();
|
|
10427
|
+
process.stdout.destroy();
|
|
10428
|
+
} catch {
|
|
10429
|
+
}
|
|
10430
|
+
process.exit(exitCode);
|
|
10431
|
+
return;
|
|
10432
|
+
}
|
|
9729
10433
|
try {
|
|
9730
10434
|
await fireSessionEndOnce("other" /* Other */);
|
|
9731
10435
|
await agentInstance?.disposeSessions();
|
|
@@ -9753,9 +10457,21 @@ async function runAcpAgent(config, settings, argv, options) {
|
|
|
9753
10457
|
process.on("SIGINT", shutdownHandler);
|
|
9754
10458
|
try {
|
|
9755
10459
|
await connection.closed;
|
|
9756
|
-
|
|
9757
|
-
|
|
9758
|
-
|
|
10460
|
+
if (agentInstance?.isTrustedManagedParent()) {
|
|
10461
|
+
try {
|
|
10462
|
+
await shutdownManagedAgent(
|
|
10463
|
+
"prompt_input_exit" /* PromptInputExit */,
|
|
10464
|
+
"ide_close"
|
|
10465
|
+
);
|
|
10466
|
+
} catch (error) {
|
|
10467
|
+
process.exitCode = 1;
|
|
10468
|
+
throw error;
|
|
10469
|
+
}
|
|
10470
|
+
} else {
|
|
10471
|
+
await fireSessionEndOnce("prompt_input_exit" /* PromptInputExit */);
|
|
10472
|
+
await drainPoolBeforeExit("ide_close");
|
|
10473
|
+
await agentInstance?.disposeSessions();
|
|
10474
|
+
}
|
|
9759
10475
|
} finally {
|
|
9760
10476
|
process.off("SIGTERM", shutdownHandler);
|
|
9761
10477
|
process.off("SIGINT", shutdownHandler);
|
|
@@ -9872,12 +10588,13 @@ function parseAcpSessionListCursor(value) {
|
|
|
9872
10588
|
}
|
|
9873
10589
|
__name(parseAcpSessionListCursor, "parseAcpSessionListCursor");
|
|
9874
10590
|
var QwenAgent = class {
|
|
9875
|
-
constructor(config, settings, argv, connection, expectedPrivateParentCapability) {
|
|
10591
|
+
constructor(config, settings, argv, connection, expectedPrivateParentCapability, sessionWriterLeaseEnabledAtStartup = false) {
|
|
9876
10592
|
this.config = config;
|
|
9877
10593
|
this.settings = settings;
|
|
9878
10594
|
this.argv = argv;
|
|
9879
10595
|
this.connection = connection;
|
|
9880
10596
|
this.expectedPrivateParentCapability = expectedPrivateParentCapability;
|
|
10597
|
+
this.sessionWriterLeaseEnabledAtStartup = sessionWriterLeaseEnabledAtStartup;
|
|
9881
10598
|
if (process.env["QWEN_SERVE_NO_MCP_POOL"] === "1") {
|
|
9882
10599
|
this.mcpPool = void 0;
|
|
9883
10600
|
this.workspaceMcpBudget = void 0;
|
|
@@ -9918,6 +10635,8 @@ var QwenAgent = class {
|
|
|
9918
10635
|
workspaceGenerationControllers = /* @__PURE__ */ new Map();
|
|
9919
10636
|
transcriptReplayConfigCache = /* @__PURE__ */ new Map();
|
|
9920
10637
|
pendingConfigCleanup = /* @__PURE__ */ new Map();
|
|
10638
|
+
initializingConfigs = /* @__PURE__ */ new Set();
|
|
10639
|
+
managedShuttingDown = false;
|
|
9921
10640
|
clientCapabilities;
|
|
9922
10641
|
privateParentState = "uninitialized";
|
|
9923
10642
|
// CPU-usage delta baseline for the daemon's `workspaceResource` extMethod
|
|
@@ -9951,6 +10670,102 @@ var QwenAgent = class {
|
|
|
9951
10670
|
getActiveSessions() {
|
|
9952
10671
|
return [...this.sessions.values()];
|
|
9953
10672
|
}
|
|
10673
|
+
isTrustedManagedParent() {
|
|
10674
|
+
return this.privateParentState === "trusted";
|
|
10675
|
+
}
|
|
10676
|
+
assertManagedSessionAdmission() {
|
|
10677
|
+
if (this.expectedPrivateParentCapability !== void 0 && !this.isTrustedManagedParent()) {
|
|
10678
|
+
throw RequestError.invalidParams(
|
|
10679
|
+
void 0,
|
|
10680
|
+
"Private ACP parent is not initialized"
|
|
10681
|
+
);
|
|
10682
|
+
}
|
|
10683
|
+
if (this.managedShuttingDown) {
|
|
10684
|
+
throw new SessionWriterUnavailableError();
|
|
10685
|
+
}
|
|
10686
|
+
}
|
|
10687
|
+
beginManagedShutdown() {
|
|
10688
|
+
if (!this.isTrustedManagedParent()) {
|
|
10689
|
+
throw new Error("Managed shutdown requires a trusted private parent");
|
|
10690
|
+
}
|
|
10691
|
+
this.managedShuttingDown = true;
|
|
10692
|
+
for (const generation of this.generationControllers.values()) {
|
|
10693
|
+
generation.controller.abort();
|
|
10694
|
+
}
|
|
10695
|
+
this.generationControllers.clear();
|
|
10696
|
+
for (const controller of this.workspaceGenerationControllers.values()) {
|
|
10697
|
+
controller.abort();
|
|
10698
|
+
}
|
|
10699
|
+
this.workspaceGenerationControllers.clear();
|
|
10700
|
+
const configs = /* @__PURE__ */ new Set([this.config, ...this.initializingConfigs]);
|
|
10701
|
+
for (const session of this.sessions.values()) {
|
|
10702
|
+
try {
|
|
10703
|
+
session.beginCloseIfAvailable();
|
|
10704
|
+
} catch (error) {
|
|
10705
|
+
debugLogger7.debug(
|
|
10706
|
+
`Session ${session.getId()} admission close during managed shutdown failed: ${error instanceof Error ? error.message : String(error)}`
|
|
10707
|
+
);
|
|
10708
|
+
}
|
|
10709
|
+
void session.cancelPendingPrompt().catch((error) => {
|
|
10710
|
+
debugLogger7.debug(
|
|
10711
|
+
`Session ${session.getId()} cancel during managed shutdown failed: ${error instanceof Error ? error.message : String(error)}`
|
|
10712
|
+
);
|
|
10713
|
+
});
|
|
10714
|
+
configs.add(session.getConfig());
|
|
10715
|
+
}
|
|
10716
|
+
for (const pending of this.pendingConfigCleanup.values()) {
|
|
10717
|
+
for (const config of pending) configs.add(config);
|
|
10718
|
+
}
|
|
10719
|
+
const configList = [...configs];
|
|
10720
|
+
const writerTerminals = [];
|
|
10721
|
+
for (const config of configList) {
|
|
10722
|
+
try {
|
|
10723
|
+
writerTerminals.push(config.closeSessionWriter());
|
|
10724
|
+
} catch (error) {
|
|
10725
|
+
writerTerminals.push(Promise.reject(error));
|
|
10726
|
+
}
|
|
10727
|
+
}
|
|
10728
|
+
const writerShutdown = Promise.allSettled(writerTerminals).then(
|
|
10729
|
+
(results) => {
|
|
10730
|
+
const failures = results.flatMap(
|
|
10731
|
+
(result) => result.status === "rejected" ? [result.reason] : []
|
|
10732
|
+
);
|
|
10733
|
+
if (failures.length > 0) {
|
|
10734
|
+
throw new AggregateError(
|
|
10735
|
+
failures,
|
|
10736
|
+
"Managed session writer shutdown failed"
|
|
10737
|
+
);
|
|
10738
|
+
}
|
|
10739
|
+
}
|
|
10740
|
+
);
|
|
10741
|
+
return { configs: configList, writerShutdown };
|
|
10742
|
+
}
|
|
10743
|
+
async finishManagedShutdown(configs) {
|
|
10744
|
+
const failures = [];
|
|
10745
|
+
for (const [sessionId, session] of [...this.sessions]) {
|
|
10746
|
+
await this.removeStoredSessionEntry(sessionId, session, failures, {
|
|
10747
|
+
shutdownConfig: false
|
|
10748
|
+
});
|
|
10749
|
+
}
|
|
10750
|
+
const results = await Promise.allSettled(
|
|
10751
|
+
configs.map(
|
|
10752
|
+
(config) => config.shutdown({
|
|
10753
|
+
shutdownTelemetry: false,
|
|
10754
|
+
skipSessionWriter: true,
|
|
10755
|
+
strictResourceCleanup: true
|
|
10756
|
+
})
|
|
10757
|
+
)
|
|
10758
|
+
);
|
|
10759
|
+
for (const result of results) {
|
|
10760
|
+
if (result.status === "rejected") failures.push(result.reason);
|
|
10761
|
+
}
|
|
10762
|
+
this.initializingConfigs.clear();
|
|
10763
|
+
this.pendingConfigCleanup.clear();
|
|
10764
|
+
this.disposeTranscriptReplayConfigs();
|
|
10765
|
+
if (failures.length > 0) {
|
|
10766
|
+
throw new AggregateError(failures, "Managed session cleanup failed");
|
|
10767
|
+
}
|
|
10768
|
+
}
|
|
9954
10769
|
getWorkspaceMcpConfig(serverName) {
|
|
9955
10770
|
if (serverName && this.config.getRuntimeMcpServers?.()[serverName] !== void 0) {
|
|
9956
10771
|
return this.config;
|
|
@@ -10093,16 +10908,18 @@ var QwenAgent = class {
|
|
|
10093
10908
|
for (const config of liveConfigs) {
|
|
10094
10909
|
try {
|
|
10095
10910
|
const cwd = config.getTargetDir();
|
|
10096
|
-
const
|
|
10911
|
+
const isBareOrSafe = config.getBareMode() || config.isSafeMode();
|
|
10912
|
+
const mcpServers = isBareOrSafe ? { ...config.getTopTierMcpServers() } : assembleMcpServers(
|
|
10097
10913
|
settings.merged.mcpServers,
|
|
10098
10914
|
cwd,
|
|
10099
10915
|
config.getTopTierMcpServers()
|
|
10100
10916
|
);
|
|
10101
|
-
const
|
|
10917
|
+
const bootAllowed = config.getCliAllowedMcpServerNames();
|
|
10918
|
+
const gating = isBareOrSafe ? { allowed: bootAllowed ? [...bootAllowed] : void 0 } : recomputeMcpGating(
|
|
10102
10919
|
settings,
|
|
10103
10920
|
mcpServers,
|
|
10104
10921
|
cwd,
|
|
10105
|
-
|
|
10922
|
+
bootAllowed,
|
|
10106
10923
|
config.getApprovalMode() === "yolo" /* YOLO */
|
|
10107
10924
|
);
|
|
10108
10925
|
config.setExcludedMcpServers(gating.excluded ?? []);
|
|
@@ -10195,11 +11012,15 @@ var QwenAgent = class {
|
|
|
10195
11012
|
debugLogger7.warn(
|
|
10196
11013
|
`MCP pool drain: ${result.drained} clean, ${result.forced} timed out, ${result.errors.length} errors`
|
|
10197
11014
|
);
|
|
11015
|
+
throw new Error(
|
|
11016
|
+
`MCP pool drain incomplete: ${result.forced} forced, ${result.errors.length} errors`
|
|
11017
|
+
);
|
|
10198
11018
|
}
|
|
10199
11019
|
} catch (err) {
|
|
10200
11020
|
debugLogger7.error(
|
|
10201
11021
|
`MCP pool drainAll failed: ${err instanceof Error ? err.message : String(err)}`
|
|
10202
11022
|
);
|
|
11023
|
+
throw err;
|
|
10203
11024
|
}
|
|
10204
11025
|
}
|
|
10205
11026
|
async removeStoredSessionEntry(sessionId, session, cleanupErrors = [], options = {}) {
|
|
@@ -10270,11 +11091,13 @@ var QwenAgent = class {
|
|
|
10270
11091
|
try {
|
|
10271
11092
|
await shutdownSessionConfig(config);
|
|
10272
11093
|
} catch (error) {
|
|
11094
|
+
this.initializingConfigs.delete(config);
|
|
10273
11095
|
const pending2 = this.pendingConfigCleanup.get(cleanupKey) ?? /* @__PURE__ */ new Set();
|
|
10274
11096
|
pending2.add(config);
|
|
10275
11097
|
this.pendingConfigCleanup.set(cleanupKey, pending2);
|
|
10276
11098
|
throw mapSessionWriterRequestError(error);
|
|
10277
11099
|
}
|
|
11100
|
+
this.initializingConfigs.delete(config);
|
|
10278
11101
|
const pending = this.pendingConfigCleanup.get(cleanupKey);
|
|
10279
11102
|
pending?.delete(config);
|
|
10280
11103
|
if (pending?.size === 0) {
|
|
@@ -10289,7 +11112,7 @@ var QwenAgent = class {
|
|
|
10289
11112
|
`Session cleanup failed while preserving the original request error: ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}`
|
|
10290
11113
|
);
|
|
10291
11114
|
}
|
|
10292
|
-
throw error;
|
|
11115
|
+
throw mapSessionWriterRequestError(error);
|
|
10293
11116
|
}
|
|
10294
11117
|
pendingConfigCleanupKey(runtimeBaseDir, sessionId) {
|
|
10295
11118
|
return `${path4.resolve(runtimeBaseDir)}\0${sessionId}`;
|
|
@@ -10479,7 +11302,7 @@ var QwenAgent = class {
|
|
|
10479
11302
|
}
|
|
10480
11303
|
this.clientCapabilities = args.clientCapabilities;
|
|
10481
11304
|
const authMethods = buildAuthMethods();
|
|
10482
|
-
const version = "0.21.
|
|
11305
|
+
const version = "0.21.1";
|
|
10483
11306
|
const response = {
|
|
10484
11307
|
protocolVersion: PROTOCOL_VERSION,
|
|
10485
11308
|
agentInfo: {
|
|
@@ -10674,16 +11497,59 @@ var QwenAgent = class {
|
|
|
10674
11497
|
const sessionData = config.getResumedSessionData();
|
|
10675
11498
|
const bulkReplay = isBulkLoadReplayRequest(params);
|
|
10676
11499
|
const replayPageSize = bulkReplay ? getLoadReplayPageSize(params) : void 0;
|
|
10677
|
-
let
|
|
11500
|
+
let replayEnvelope;
|
|
10678
11501
|
try {
|
|
10679
11502
|
await this.ensureAuthenticated(config);
|
|
10680
11503
|
this.setupFileSystem(config);
|
|
10681
|
-
|
|
10682
|
-
|
|
10683
|
-
|
|
10684
|
-
|
|
10685
|
-
|
|
10686
|
-
|
|
11504
|
+
await this.createAndStoreSession(config, settings, sessionData, {
|
|
11505
|
+
...bulkReplay ? { replayHistory: false } : {},
|
|
11506
|
+
beforeStartPostReplayServices: /* @__PURE__ */ __name(async (createdSession) => {
|
|
11507
|
+
if (bulkReplay) {
|
|
11508
|
+
const records = sessionData?.conversation.messages;
|
|
11509
|
+
let replayUpdates = [];
|
|
11510
|
+
if (records) {
|
|
11511
|
+
createdSession.primeTurnFromHistory(records);
|
|
11512
|
+
const replayPage = selectRecentHistoryRecords(
|
|
11513
|
+
records,
|
|
11514
|
+
replayPageSize
|
|
11515
|
+
);
|
|
11516
|
+
const replayUsage = createReplayCumulativeUsage();
|
|
11517
|
+
const replay = await collectHistoryReplayUpdates({
|
|
11518
|
+
sessionId: params.sessionId,
|
|
11519
|
+
config,
|
|
11520
|
+
records: replayPage.records,
|
|
11521
|
+
gaps: sessionData?.historyGaps,
|
|
11522
|
+
cumulativeUsage: replayUsage,
|
|
11523
|
+
supersedeUnrestorableGoal: true,
|
|
11524
|
+
logger: debugLogger7
|
|
11525
|
+
});
|
|
11526
|
+
replayUpdates = replay.updates;
|
|
11527
|
+
copyCumulativeUsage(createdSession.cumulativeUsage, replayUsage);
|
|
11528
|
+
if (replay.replayError !== void 0) {
|
|
11529
|
+
replayEnvelope = {
|
|
11530
|
+
v: LOAD_REPLAY_VERSION,
|
|
11531
|
+
updates: replayUpdates,
|
|
11532
|
+
partial: true,
|
|
11533
|
+
replayError: replay.replayError,
|
|
11534
|
+
...replayPage.hasMore ? { hasMore: true } : {}
|
|
11535
|
+
};
|
|
11536
|
+
}
|
|
11537
|
+
replayEnvelope ??= {
|
|
11538
|
+
v: LOAD_REPLAY_VERSION,
|
|
11539
|
+
updates: replayUpdates,
|
|
11540
|
+
...replayPage.hasMore ? { hasMore: true } : {}
|
|
11541
|
+
};
|
|
11542
|
+
}
|
|
11543
|
+
replayEnvelope ??= {
|
|
11544
|
+
v: LOAD_REPLAY_VERSION,
|
|
11545
|
+
updates: replayUpdates
|
|
11546
|
+
};
|
|
11547
|
+
}
|
|
11548
|
+
await this.#restoreWorktreeOnResume(config, createdSession);
|
|
11549
|
+
await this.#restoreBackgroundAgentsOnResume(config, createdSession);
|
|
11550
|
+
this.#restoreGoalOnResume(config, createdSession);
|
|
11551
|
+
}, "beforeStartPostReplayServices")
|
|
11552
|
+
});
|
|
10687
11553
|
} catch (error) {
|
|
10688
11554
|
return this.cleanupAfterRequestFailure(error, async () => {
|
|
10689
11555
|
if (this.sessions.get(config.getSessionId())?.getConfig() !== config) {
|
|
@@ -10691,72 +11557,6 @@ var QwenAgent = class {
|
|
|
10691
11557
|
}
|
|
10692
11558
|
});
|
|
10693
11559
|
}
|
|
10694
|
-
let replayEnvelope;
|
|
10695
|
-
if (bulkReplay) {
|
|
10696
|
-
try {
|
|
10697
|
-
const records = sessionData?.conversation.messages;
|
|
10698
|
-
let replayUpdates = [];
|
|
10699
|
-
if (records) {
|
|
10700
|
-
session.primeTurnFromHistory(records);
|
|
10701
|
-
const replayPage = selectRecentHistoryRecords(
|
|
10702
|
-
records,
|
|
10703
|
-
replayPageSize
|
|
10704
|
-
);
|
|
10705
|
-
const replayUsage = createReplayCumulativeUsage();
|
|
10706
|
-
const replay = await collectHistoryReplayUpdates({
|
|
10707
|
-
sessionId: params.sessionId,
|
|
10708
|
-
config,
|
|
10709
|
-
records: replayPage.records,
|
|
10710
|
-
gaps: sessionData?.historyGaps,
|
|
10711
|
-
cumulativeUsage: replayUsage,
|
|
10712
|
-
// A resume: the goal restore runs right after this.
|
|
10713
|
-
supersedeUnrestorableGoal: true,
|
|
10714
|
-
logger: debugLogger7
|
|
10715
|
-
});
|
|
10716
|
-
replayUpdates = replay.updates;
|
|
10717
|
-
copyCumulativeUsage(session.cumulativeUsage, replayUsage);
|
|
10718
|
-
if (replay.replayError !== void 0) {
|
|
10719
|
-
replayEnvelope = {
|
|
10720
|
-
v: LOAD_REPLAY_VERSION,
|
|
10721
|
-
updates: replayUpdates,
|
|
10722
|
-
partial: true,
|
|
10723
|
-
replayError: replay.replayError,
|
|
10724
|
-
...replayPage.hasMore ? { hasMore: true } : {}
|
|
10725
|
-
};
|
|
10726
|
-
}
|
|
10727
|
-
replayEnvelope ??= {
|
|
10728
|
-
v: LOAD_REPLAY_VERSION,
|
|
10729
|
-
updates: replayUpdates,
|
|
10730
|
-
...replayPage.hasMore ? { hasMore: true } : {}
|
|
10731
|
-
};
|
|
10732
|
-
}
|
|
10733
|
-
replayEnvelope ??= {
|
|
10734
|
-
v: LOAD_REPLAY_VERSION,
|
|
10735
|
-
updates: replayUpdates
|
|
10736
|
-
};
|
|
10737
|
-
session.installRewriter();
|
|
10738
|
-
session.startCronScheduler();
|
|
10739
|
-
} catch (err) {
|
|
10740
|
-
return this.cleanupAfterRequestFailure(err, async () => {
|
|
10741
|
-
try {
|
|
10742
|
-
await this.discardStoredSessionIfCurrent(params.sessionId, session);
|
|
10743
|
-
} catch (cleanupError) {
|
|
10744
|
-
await this.removeStoredSessionEntry(
|
|
10745
|
-
params.sessionId,
|
|
10746
|
-
session,
|
|
10747
|
-
[cleanupError],
|
|
10748
|
-
{
|
|
10749
|
-
shutdownConfig: false
|
|
10750
|
-
}
|
|
10751
|
-
);
|
|
10752
|
-
await this.cleanupUnstoredConfig(config);
|
|
10753
|
-
}
|
|
10754
|
-
});
|
|
10755
|
-
}
|
|
10756
|
-
}
|
|
10757
|
-
await this.#restoreWorktreeOnResume(config, session);
|
|
10758
|
-
await this.#restoreBackgroundAgentsOnResume(config, session);
|
|
10759
|
-
this.#restoreGoalOnResume(config, session);
|
|
10760
11560
|
const modesData = this.buildModesData(config);
|
|
10761
11561
|
const availableModels = this.buildAvailableModels(config);
|
|
10762
11562
|
const configOptions = this.buildConfigOptions(config);
|
|
@@ -10812,15 +11612,21 @@ var QwenAgent = class {
|
|
|
10812
11612
|
params.sessionId,
|
|
10813
11613
|
true
|
|
10814
11614
|
);
|
|
10815
|
-
let session;
|
|
10816
11615
|
try {
|
|
10817
11616
|
await this.ensureAuthenticated(config);
|
|
10818
11617
|
this.setupFileSystem(config);
|
|
10819
|
-
|
|
11618
|
+
await this.createAndStoreSession(
|
|
10820
11619
|
config,
|
|
10821
11620
|
settings,
|
|
10822
11621
|
config.getResumedSessionData(),
|
|
10823
|
-
{
|
|
11622
|
+
{
|
|
11623
|
+
replayHistory: false,
|
|
11624
|
+
beforeStartPostReplayServices: /* @__PURE__ */ __name(async (createdSession) => {
|
|
11625
|
+
await this.#restoreWorktreeOnResume(config, createdSession);
|
|
11626
|
+
await this.#restoreBackgroundAgentsOnResume(config, createdSession);
|
|
11627
|
+
this.#restoreGoalOnResume(config, createdSession);
|
|
11628
|
+
}, "beforeStartPostReplayServices")
|
|
11629
|
+
}
|
|
10824
11630
|
);
|
|
10825
11631
|
} catch (error) {
|
|
10826
11632
|
return this.cleanupAfterRequestFailure(error, async () => {
|
|
@@ -10829,9 +11635,6 @@ var QwenAgent = class {
|
|
|
10829
11635
|
}
|
|
10830
11636
|
});
|
|
10831
11637
|
}
|
|
10832
|
-
await this.#restoreWorktreeOnResume(config, session);
|
|
10833
|
-
await this.#restoreBackgroundAgentsOnResume(config, session);
|
|
10834
|
-
this.#restoreGoalOnResume(config, session);
|
|
10835
11638
|
const modesData = this.buildModesData(config);
|
|
10836
11639
|
const availableModels = this.buildAvailableModels(config);
|
|
10837
11640
|
const configOptions = this.buildConfigOptions(config);
|
|
@@ -11743,7 +12546,21 @@ var QwenAgent = class {
|
|
|
11743
12546
|
};
|
|
11744
12547
|
}
|
|
11745
12548
|
try {
|
|
11746
|
-
const
|
|
12549
|
+
const resolved = resolveSkillSettings(
|
|
12550
|
+
loadSettings(this.workspaceCwd(config), {
|
|
12551
|
+
consumeCorruptionEnvVars: false,
|
|
12552
|
+
skipLoadEnvironment: true
|
|
12553
|
+
})
|
|
12554
|
+
);
|
|
12555
|
+
const disablements = new Map(
|
|
12556
|
+
Array.from(config.getDisabledSkillNames(), (name) => {
|
|
12557
|
+
const normalizedName = name.trim().toLowerCase();
|
|
12558
|
+
return [
|
|
12559
|
+
normalizedName,
|
|
12560
|
+
resolved.disablements.get(normalizedName) ?? { reason: "hard" }
|
|
12561
|
+
];
|
|
12562
|
+
})
|
|
12563
|
+
);
|
|
11747
12564
|
try {
|
|
11748
12565
|
await config.getExtensionManager().refreshCache();
|
|
11749
12566
|
} catch (error) {
|
|
@@ -11759,7 +12576,7 @@ var QwenAgent = class {
|
|
|
11759
12576
|
const skillsByKey = new Map(
|
|
11760
12577
|
skills.map((skill) => [
|
|
11761
12578
|
`${skill.level}:${skill.extensionName ?? ""}:${skill.name}`,
|
|
11762
|
-
mapSkillConfigToStatus(skill,
|
|
12579
|
+
mapSkillConfigToStatus(skill, disablements, {
|
|
11763
12580
|
disabled: isInactiveExtensionSkill(skill, inactiveSkillRefs)
|
|
11764
12581
|
})
|
|
11765
12582
|
])
|
|
@@ -11780,7 +12597,7 @@ var QwenAgent = class {
|
|
|
11780
12597
|
level: "extension",
|
|
11781
12598
|
extensionName
|
|
11782
12599
|
},
|
|
11783
|
-
|
|
12600
|
+
disablements,
|
|
11784
12601
|
{ disabled: true }
|
|
11785
12602
|
)
|
|
11786
12603
|
);
|
|
@@ -12840,12 +13657,19 @@ var QwenAgent = class {
|
|
|
12840
13657
|
}
|
|
12841
13658
|
case TODO_STOP_GUARD_QUEUE_RELEASE_METHOD: {
|
|
12842
13659
|
const sessionId = params["sessionId"];
|
|
13660
|
+
const promptId = params["promptId"];
|
|
12843
13661
|
if (typeof sessionId !== "string" || sessionId.length === 0) {
|
|
12844
13662
|
throw RequestError.invalidParams(
|
|
12845
13663
|
void 0,
|
|
12846
13664
|
"Invalid or missing sessionId"
|
|
12847
13665
|
);
|
|
12848
13666
|
}
|
|
13667
|
+
if (typeof promptId !== "string" || promptId.length === 0) {
|
|
13668
|
+
throw RequestError.invalidParams(
|
|
13669
|
+
void 0,
|
|
13670
|
+
"Invalid or missing promptId"
|
|
13671
|
+
);
|
|
13672
|
+
}
|
|
12849
13673
|
const session = this.sessions.get(sessionId);
|
|
12850
13674
|
if (!session) {
|
|
12851
13675
|
throw RequestError.invalidParams(
|
|
@@ -12854,7 +13678,7 @@ var QwenAgent = class {
|
|
|
12854
13678
|
);
|
|
12855
13679
|
}
|
|
12856
13680
|
return {
|
|
12857
|
-
released: session.releaseTodoStopGuardQueuedPromptWait()
|
|
13681
|
+
released: session.releaseTodoStopGuardQueuedPromptWait(promptId)
|
|
12858
13682
|
};
|
|
12859
13683
|
}
|
|
12860
13684
|
case "qwen/providers/list": {
|
|
@@ -14275,10 +15099,12 @@ var QwenAgent = class {
|
|
|
14275
15099
|
}
|
|
14276
15100
|
}
|
|
14277
15101
|
const previousCwd = config.getTargetDir();
|
|
14278
|
-
|
|
14279
|
-
|
|
14280
|
-
|
|
14281
|
-
|
|
15102
|
+
let trustValidated = false;
|
|
15103
|
+
const validateTrust = /* @__PURE__ */ __name(() => {
|
|
15104
|
+
if (!isFolderTrustEnabled(this.settings.merged)) {
|
|
15105
|
+
trustValidated = true;
|
|
15106
|
+
return;
|
|
15107
|
+
}
|
|
14282
15108
|
const trustedFolders = loadTrustedFolders();
|
|
14283
15109
|
if (trustedFolders.isPathTrusted(canonicalPath) !== true) {
|
|
14284
15110
|
throw new RequestError(
|
|
@@ -14287,27 +15113,62 @@ var QwenAgent = class {
|
|
|
14287
15113
|
{ errorKind: "directory_not_trusted", path: canonicalPath }
|
|
14288
15114
|
);
|
|
14289
15115
|
}
|
|
15116
|
+
trustValidated = true;
|
|
15117
|
+
}, "validateTrust");
|
|
15118
|
+
if (canonicalPath !== previousCwd) {
|
|
15119
|
+
validateTrust();
|
|
14290
15120
|
}
|
|
14291
|
-
const
|
|
14292
|
-
|
|
14293
|
-
|
|
14294
|
-
canonicalPath,
|
|
14295
|
-
{ skipProcessChdir: true, skipArtifactMigration: true }
|
|
15121
|
+
const releaseGate = await beginSessionCloseAfterCurrentGate(
|
|
15122
|
+
session,
|
|
15123
|
+
SESSION_DRAIN_TIMEOUT_MS
|
|
14296
15124
|
);
|
|
14297
|
-
if (relocation.memoryRefreshError) {
|
|
14298
|
-
warnings.push(
|
|
14299
|
-
`Memory refresh failed: ${relocation.memoryRefreshError instanceof Error ? relocation.memoryRefreshError.message : String(relocation.memoryRefreshError)}`
|
|
14300
|
-
);
|
|
14301
|
-
}
|
|
14302
15125
|
try {
|
|
14303
|
-
|
|
14304
|
-
|
|
14305
|
-
|
|
14306
|
-
|
|
15126
|
+
const settledPreviousCwd = config.getTargetDir();
|
|
15127
|
+
if (canonicalPath === settledPreviousCwd) {
|
|
15128
|
+
return {
|
|
15129
|
+
previousCwd: settledPreviousCwd,
|
|
15130
|
+
newCwd: canonicalPath,
|
|
15131
|
+
warnings: []
|
|
15132
|
+
};
|
|
15133
|
+
}
|
|
15134
|
+
if (!trustValidated) {
|
|
15135
|
+
validateTrust();
|
|
15136
|
+
}
|
|
15137
|
+
session.hardSuspendTodoStopGuard();
|
|
15138
|
+
await waitForSessionDrain(
|
|
15139
|
+
session.waitForActiveTurnsToSettle(),
|
|
15140
|
+
SESSION_DRAIN_TIMEOUT_MS,
|
|
15141
|
+
"close"
|
|
14307
15142
|
);
|
|
15143
|
+
const warnings = [];
|
|
15144
|
+
const relocation = await config.relocateWorkingDirectory(
|
|
15145
|
+
canonicalPath,
|
|
15146
|
+
canonicalPath,
|
|
15147
|
+
{ skipProcessChdir: true, skipArtifactMigration: true }
|
|
15148
|
+
);
|
|
15149
|
+
if (relocation.memoryRefreshError) {
|
|
15150
|
+
warnings.push(
|
|
15151
|
+
`Memory refresh failed: ${relocation.memoryRefreshError instanceof Error ? relocation.memoryRefreshError.message : String(relocation.memoryRefreshError)}`
|
|
15152
|
+
);
|
|
15153
|
+
}
|
|
15154
|
+
try {
|
|
15155
|
+
await config.getGeminiClient()?.addWorkingDirectoryChangedContext(
|
|
15156
|
+
settledPreviousCwd,
|
|
15157
|
+
canonicalPath
|
|
15158
|
+
);
|
|
15159
|
+
} catch (error) {
|
|
15160
|
+
warnings.push(
|
|
15161
|
+
`Model context refresh failed: ${error instanceof Error ? error.message : String(error)}`
|
|
15162
|
+
);
|
|
15163
|
+
}
|
|
15164
|
+
return {
|
|
15165
|
+
previousCwd: settledPreviousCwd,
|
|
15166
|
+
newCwd: canonicalPath,
|
|
15167
|
+
warnings
|
|
15168
|
+
};
|
|
15169
|
+
} finally {
|
|
15170
|
+
releaseGate();
|
|
14308
15171
|
}
|
|
14309
|
-
session.clearTodoStopGuardTrust();
|
|
14310
|
-
return { previousCwd, newCwd: canonicalPath, warnings };
|
|
14311
15172
|
}
|
|
14312
15173
|
case SERVE_CONTROL_EXT_METHODS.sessionApprovalMode: {
|
|
14313
15174
|
const sessionId = params["sessionId"];
|
|
@@ -14823,147 +15684,82 @@ ${outputText}
|
|
|
14823
15684
|
return result;
|
|
14824
15685
|
}
|
|
14825
15686
|
case SERVE_CONTROL_EXT_METHODS.workspaceMcpRuntimeAdd: {
|
|
14826
|
-
const
|
|
14827
|
-
const
|
|
14828
|
-
|
|
14829
|
-
|
|
14830
|
-
|
|
14831
|
-
|
|
14832
|
-
|
|
14833
|
-
|
|
14834
|
-
|
|
14835
|
-
|
|
14836
|
-
|
|
14837
|
-
|
|
14838
|
-
|
|
14839
|
-
|
|
14840
|
-
|
|
14841
|
-
|
|
14842
|
-
|
|
14843
|
-
|
|
14844
|
-
|
|
14845
|
-
|
|
14846
|
-
|
|
14847
|
-
|
|
14848
|
-
|
|
14849
|
-
if (!manager) {
|
|
14850
|
-
throw RequestError.internalError(
|
|
14851
|
-
void 0,
|
|
14852
|
-
"McpClientManager unavailable on this Config"
|
|
14853
|
-
);
|
|
14854
|
-
}
|
|
14855
|
-
try {
|
|
14856
|
-
const {
|
|
14857
|
-
trust: _trust,
|
|
14858
|
-
authProviderType: _auth,
|
|
14859
|
-
includeTools: _inc,
|
|
14860
|
-
excludeTools: _exc,
|
|
14861
|
-
cwd: _cwd,
|
|
14862
|
-
env: _env,
|
|
14863
|
-
oauth: _oauth,
|
|
14864
|
-
headers: _headers,
|
|
14865
|
-
type: _type,
|
|
14866
|
-
// Reverse tool channel marker (issue #5626, Phase 2). The parent
|
|
14867
|
-
// serve process stamps this on a client-hosted (extension) MCP
|
|
14868
|
-
// server's runtime config; it never reaches the transport itself.
|
|
14869
|
-
[CLIENT_MCP_OVER_WS_CONFIG_FLAG]: clientMcpOverWs,
|
|
14870
|
-
...safeConfig
|
|
14871
|
-
} = config;
|
|
14872
|
-
if (clientMcpOverWs === true) {
|
|
14873
|
-
safeConfig["type"] = "sdk";
|
|
14874
|
-
}
|
|
14875
|
-
const result = await manager.addRuntimeMcpServer(
|
|
14876
|
-
name,
|
|
14877
|
-
safeConfig,
|
|
14878
|
-
runtimeClientId
|
|
14879
|
-
);
|
|
14880
|
-
await Promise.all(
|
|
14881
|
-
this.getActiveSessions().map(async (session) => {
|
|
14882
|
-
const sessionManager = session.getConfig().getToolRegistry()?.getMcpClientManager();
|
|
14883
|
-
if (!sessionManager) return;
|
|
14884
|
-
try {
|
|
14885
|
-
await sessionManager.addRuntimeMcpServer(
|
|
14886
|
-
name,
|
|
14887
|
-
safeConfig,
|
|
14888
|
-
runtimeClientId
|
|
14889
|
-
);
|
|
14890
|
-
} catch (sessionErr) {
|
|
14891
|
-
debugLogger7.warn(
|
|
14892
|
-
`workspaceMcpRuntimeAdd: failed to add runtime MCP server '${name}' to active session ${session.getConfig().getSessionId()}: ${sessionErr instanceof Error ? sessionErr.message : String(sessionErr)}`
|
|
14893
|
-
);
|
|
14894
|
-
}
|
|
14895
|
-
})
|
|
14896
|
-
);
|
|
14897
|
-
return result;
|
|
14898
|
-
} catch (err) {
|
|
14899
|
-
if (err instanceof McpBudgetWouldExceedError) {
|
|
14900
|
-
throw new RequestError(-32099, err.message, {
|
|
14901
|
-
errorKind: err.code,
|
|
14902
|
-
serverName: err.serverName
|
|
14903
|
-
});
|
|
14904
|
-
}
|
|
14905
|
-
if (err instanceof McpServerSpawnFailedError) {
|
|
14906
|
-
throw new RequestError(-32099, err.message, {
|
|
14907
|
-
errorKind: err.code,
|
|
14908
|
-
serverName: err.serverName,
|
|
14909
|
-
...err.details
|
|
14910
|
-
});
|
|
14911
|
-
}
|
|
14912
|
-
if (err instanceof InvalidMcpConfigError) {
|
|
14913
|
-
throw new RequestError(-32099, err.message, {
|
|
14914
|
-
errorKind: err.code,
|
|
14915
|
-
serverName: err.serverName,
|
|
14916
|
-
reason: err.reason
|
|
14917
|
-
});
|
|
14918
|
-
}
|
|
14919
|
-
throw err;
|
|
14920
|
-
}
|
|
15687
|
+
const request = readRuntimeMcpAddRequest(params);
|
|
15688
|
+
const result = await addRuntimeMcpServer(
|
|
15689
|
+
getRuntimeMcpManager(this.config),
|
|
15690
|
+
request
|
|
15691
|
+
);
|
|
15692
|
+
await Promise.all(
|
|
15693
|
+
this.getActiveSessions().map(async (session) => {
|
|
15694
|
+
const sessionManager = session.getConfig().getToolRegistry()?.getMcpClientManager();
|
|
15695
|
+
if (!sessionManager) return;
|
|
15696
|
+
try {
|
|
15697
|
+
await sessionManager.addRuntimeMcpServer(
|
|
15698
|
+
request.name,
|
|
15699
|
+
request.config,
|
|
15700
|
+
request.runtimeClientId
|
|
15701
|
+
);
|
|
15702
|
+
} catch (sessionErr) {
|
|
15703
|
+
debugLogger7.warn(
|
|
15704
|
+
`workspaceMcpRuntimeAdd: failed to add runtime MCP server '${request.name}' to active session ${session.getConfig().getSessionId()}: ${sessionErr instanceof Error ? sessionErr.message : String(sessionErr)}`
|
|
15705
|
+
);
|
|
15706
|
+
}
|
|
15707
|
+
})
|
|
15708
|
+
);
|
|
15709
|
+
return result;
|
|
14921
15710
|
}
|
|
14922
15711
|
case SERVE_CONTROL_EXT_METHODS.workspaceMcpRuntimeRemove: {
|
|
14923
|
-
const
|
|
14924
|
-
const
|
|
14925
|
-
|
|
14926
|
-
|
|
14927
|
-
void 0,
|
|
14928
|
-
"Invalid or missing name"
|
|
14929
|
-
);
|
|
14930
|
-
}
|
|
14931
|
-
if (!isValidServerName(name)) {
|
|
14932
|
-
throw RequestError.invalidParams(
|
|
14933
|
-
void 0,
|
|
14934
|
-
"Server name must be \u2264256 chars, alphanumeric + underscore/hyphen, and not a reserved JS property name"
|
|
14935
|
-
);
|
|
14936
|
-
}
|
|
14937
|
-
const runtimeClientId = typeof originatorClientId === "string" && originatorClientId.length > 0 ? originatorClientId : "daemon";
|
|
14938
|
-
const manager = this.config.getToolRegistry()?.getMcpClientManager();
|
|
14939
|
-
if (!manager) {
|
|
14940
|
-
throw RequestError.internalError(
|
|
14941
|
-
void 0,
|
|
14942
|
-
"McpClientManager unavailable on this Config"
|
|
14943
|
-
);
|
|
14944
|
-
}
|
|
14945
|
-
const result = await manager.removeRuntimeMcpServer(
|
|
14946
|
-
name,
|
|
14947
|
-
runtimeClientId
|
|
14948
|
-
);
|
|
15712
|
+
const request = readRuntimeMcpRequest(params);
|
|
15713
|
+
const result = await getRuntimeMcpManager(
|
|
15714
|
+
this.config
|
|
15715
|
+
).removeRuntimeMcpServer(request.name, request.runtimeClientId);
|
|
14949
15716
|
await Promise.all(
|
|
14950
15717
|
this.getActiveSessions().map(async (session) => {
|
|
14951
15718
|
const sessionManager = session.getConfig().getToolRegistry()?.getMcpClientManager();
|
|
14952
15719
|
if (!sessionManager) return;
|
|
14953
15720
|
try {
|
|
14954
15721
|
await sessionManager.removeRuntimeMcpServer(
|
|
14955
|
-
name,
|
|
14956
|
-
runtimeClientId
|
|
15722
|
+
request.name,
|
|
15723
|
+
request.runtimeClientId
|
|
14957
15724
|
);
|
|
14958
15725
|
} catch (sessionErr) {
|
|
14959
15726
|
debugLogger7.warn(
|
|
14960
|
-
`workspaceMcpRuntimeRemove: failed to remove runtime MCP server '${name}' from active session ${session.getConfig().getSessionId()}: ${sessionErr instanceof Error ? sessionErr.message : String(sessionErr)}`
|
|
15727
|
+
`workspaceMcpRuntimeRemove: failed to remove runtime MCP server '${request.name}' from active session ${session.getConfig().getSessionId()}: ${sessionErr instanceof Error ? sessionErr.message : String(sessionErr)}`
|
|
14961
15728
|
);
|
|
14962
15729
|
}
|
|
14963
15730
|
})
|
|
14964
15731
|
);
|
|
14965
15732
|
return result;
|
|
14966
15733
|
}
|
|
15734
|
+
case SERVE_CONTROL_EXT_METHODS.sessionMcpRuntimeAdd: {
|
|
15735
|
+
const sessionId = params["sessionId"];
|
|
15736
|
+
if (typeof sessionId !== "string" || sessionId.length === 0) {
|
|
15737
|
+
throw RequestError.invalidParams(
|
|
15738
|
+
void 0,
|
|
15739
|
+
"Invalid or missing sessionId"
|
|
15740
|
+
);
|
|
15741
|
+
}
|
|
15742
|
+
const session = this.sessionOrThrow(sessionId);
|
|
15743
|
+
return addRuntimeMcpServer(
|
|
15744
|
+
getRuntimeMcpManager(session.getConfig()),
|
|
15745
|
+
readRuntimeMcpAddRequest(params)
|
|
15746
|
+
);
|
|
15747
|
+
}
|
|
15748
|
+
case SERVE_CONTROL_EXT_METHODS.sessionMcpRuntimeRemove: {
|
|
15749
|
+
const sessionId = params["sessionId"];
|
|
15750
|
+
if (typeof sessionId !== "string" || sessionId.length === 0) {
|
|
15751
|
+
throw RequestError.invalidParams(
|
|
15752
|
+
void 0,
|
|
15753
|
+
"Invalid or missing sessionId"
|
|
15754
|
+
);
|
|
15755
|
+
}
|
|
15756
|
+
const session = this.sessionOrThrow(sessionId);
|
|
15757
|
+
const request = readRuntimeMcpRequest(params);
|
|
15758
|
+
const result = await getRuntimeMcpManager(
|
|
15759
|
+
session.getConfig()
|
|
15760
|
+
).removeRuntimeMcpServer(request.name, request.runtimeClientId);
|
|
15761
|
+
return result;
|
|
15762
|
+
}
|
|
14967
15763
|
case SERVE_CONTROL_EXT_METHODS.workspaceExtensionsRefresh: {
|
|
14968
15764
|
const sessionId = params["sessionId"];
|
|
14969
15765
|
const session = this.sessionOrThrow(sessionId);
|
|
@@ -15779,6 +16575,7 @@ ${outputText}
|
|
|
15779
16575
|
}
|
|
15780
16576
|
async newSessionConfig(cwd, mcpServers, settings, sessionId, resume, initializeOptions = {}, chatRecording) {
|
|
15781
16577
|
try {
|
|
16578
|
+
this.assertManagedSessionAdmission();
|
|
15782
16579
|
return await this.runWithPinnedRuntimeBaseDir(settings, cwd, async () => {
|
|
15783
16580
|
await this.retryPendingConfigCleanup(
|
|
15784
16581
|
Storage.getRuntimeBaseDir(),
|
|
@@ -15856,7 +16653,13 @@ ${outputText}
|
|
|
15856
16653
|
continue;
|
|
15857
16654
|
}
|
|
15858
16655
|
}
|
|
15859
|
-
const mergedSettings =
|
|
16656
|
+
const mergedSettings = {
|
|
16657
|
+
...settings.merged,
|
|
16658
|
+
experimental: {
|
|
16659
|
+
...settings.merged.experimental,
|
|
16660
|
+
sessionWriterLease: this.sessionWriterLeaseEnabledAtStartup
|
|
16661
|
+
}
|
|
16662
|
+
};
|
|
15860
16663
|
const sessionArg = resume === true ? { resume: sessionId, sessionId: void 0 } : { sessionId, resume: void 0 };
|
|
15861
16664
|
const argvForSession = {
|
|
15862
16665
|
...this.argv,
|
|
@@ -15891,6 +16694,20 @@ ${outputText}
|
|
|
15891
16694
|
buildDisabledSkillNamesProvider(settings),
|
|
15892
16695
|
sessionMcpServers
|
|
15893
16696
|
);
|
|
16697
|
+
if (chatRecording !== false) {
|
|
16698
|
+
this.initializingConfigs.add(config);
|
|
16699
|
+
}
|
|
16700
|
+
try {
|
|
16701
|
+
this.assertManagedSessionAdmission();
|
|
16702
|
+
if (this.isTrustedManagedParent()) {
|
|
16703
|
+
config.setSessionWriterReclaimPolicy("never");
|
|
16704
|
+
}
|
|
16705
|
+
} catch (error) {
|
|
16706
|
+
return this.cleanupAfterRequestFailure(
|
|
16707
|
+
error,
|
|
16708
|
+
() => this.cleanupUnstoredConfig(config)
|
|
16709
|
+
);
|
|
16710
|
+
}
|
|
15894
16711
|
if (!initializeOptions.skipFileCheckpointing && typeof config.enableFileCheckpointing === "function") {
|
|
15895
16712
|
config.enableFileCheckpointing();
|
|
15896
16713
|
}
|
|
@@ -15931,6 +16748,7 @@ ${outputText}
|
|
|
15931
16748
|
// (the daemon only adds SDK-type runtime servers for client MCP).
|
|
15932
16749
|
sendSdkMcpMessage: this.buildClientMcpSender(wiredSessionId)
|
|
15933
16750
|
});
|
|
16751
|
+
this.assertManagedSessionAdmission();
|
|
15934
16752
|
} catch (error) {
|
|
15935
16753
|
return this.cleanupAfterRequestFailure(
|
|
15936
16754
|
error,
|
|
@@ -15991,17 +16809,20 @@ ${outputText}
|
|
|
15991
16809
|
config.setFileSystemService(acpFileSystemService);
|
|
15992
16810
|
}
|
|
15993
16811
|
async createAndStoreSession(config, settings, sessionData, options = {}) {
|
|
16812
|
+
this.assertManagedSessionAdmission();
|
|
15994
16813
|
const sessionId = config.getSessionId();
|
|
15995
16814
|
const geminiClient = config.getGeminiClient();
|
|
15996
16815
|
const needsInitialize = !geminiClient.isInitialized();
|
|
15997
16816
|
if (needsInitialize) {
|
|
15998
16817
|
await geminiClient.initialize();
|
|
15999
16818
|
}
|
|
16819
|
+
this.assertManagedSessionAdmission();
|
|
16000
16820
|
if (this.sessions.has(sessionId)) {
|
|
16001
16821
|
throw new Error(`Session ${sessionId} is already active.`);
|
|
16002
16822
|
}
|
|
16003
16823
|
const session = new Session(sessionId, config, this.connection, settings);
|
|
16004
16824
|
this.sessions.set(sessionId, session);
|
|
16825
|
+
this.initializingConfigs.delete(config);
|
|
16005
16826
|
try {
|
|
16006
16827
|
if (sessionData?.fileHistorySnapshots?.length) {
|
|
16007
16828
|
config.getFileHistoryService().restoreFromSnapshots(sessionData.fileHistorySnapshots);
|
|
@@ -16015,10 +16836,9 @@ ${outputText}
|
|
|
16015
16836
|
sessionData.historyGaps
|
|
16016
16837
|
);
|
|
16017
16838
|
}
|
|
16018
|
-
|
|
16019
|
-
|
|
16020
|
-
|
|
16021
|
-
}
|
|
16839
|
+
await options.beforeStartPostReplayServices?.(session);
|
|
16840
|
+
session.installRewriter();
|
|
16841
|
+
session.startCronScheduler();
|
|
16022
16842
|
setTimeout(() => {
|
|
16023
16843
|
void session.sendAvailableCommandsUpdate();
|
|
16024
16844
|
}, 0);
|