@qwen-code/qwen-code 0.21.0 → 0.21.1-nightly.20260731.702932cc7
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 +39 -28
- package/bundled/qc-helper/docs/features/channels/_meta.ts +2 -0
- package/bundled/qc-helper/docs/features/channels/github.md +139 -0
- package/bundled/qc-helper/docs/features/channels/gitlab.md +171 -0
- package/bundled/qc-helper/docs/features/channels/overview.md +61 -6
- package/bundled/qc-helper/docs/features/code-review.md +21 -1
- package/bundled/qc-helper/docs/features/hooks.md +72 -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 +42 -8
- package/bundled/qc-helper/docs/qwen-serve.md +11 -7
- 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-LAFHK4VO.js +88 -0
- package/chunks/{StandaloneSessionPicker-BIRMPLRD.js → StandaloneSessionPicker-EMNOBN3S.js} +71 -68
- package/chunks/{acp-startup-profiler-RV3IV562.js → acp-startup-profiler-2C4A5ZTJ.js} +2 -2
- package/chunks/{acpAgent-6J2U72PQ.js → acpAgent-ERFA6HWV.js} +1674 -591
- package/chunks/agent-PLKF6JK4.js +84 -0
- package/chunks/agent-headless-JAORDQ63.js +78 -0
- package/chunks/{anthropicContentGenerator-75BKLTSP.js → anthropicContentGenerator-OFHSZJBF.js} +79 -27
- package/chunks/{artifact-tool-Y5T7GG7F.js → artifact-tool-RDN2W7ND.js} +4 -4
- package/chunks/{askUserQuestion-2H6747FR.js → askUserQuestion-OZERWH5R.js} +4 -4
- package/chunks/bridge-NYOBVRIT.js +94 -0
- package/chunks/{build-RV63TIRH.js → build-GDBLPA24.js} +1 -1
- package/chunks/{ca-25EDXPFZ.js → ca-6W3SK7OQ.js} +6 -1
- package/chunks/channel-management-service-5S7YCWX5.js +418 -0
- package/chunks/channel-settings-store-NLOKYO23.js +91 -0
- package/chunks/{channel-worker-group-2ZD7TVAT.js → channel-worker-group-OVWGYMZS.js} +11 -6
- package/chunks/{channel-worker-manager-4OA4BCGB.js → channel-worker-manager-H55GKOQA.js} +11 -6
- package/chunks/{channel-worker-supervisor-V7KCFJTS.js → channel-worker-supervisor-CABBXYHK.js} +7 -5
- package/chunks/{chunk-RIBKPMRP.js → chunk-23F4XGWO.js} +19 -6
- package/chunks/{chunk-ACY3A37B.js → chunk-25VHI5T7.js} +23 -18
- package/chunks/{chunk-MZAXJAUM.js → chunk-26JK4RPD.js} +1 -1
- package/chunks/{chunk-6GMVPFB2.js → chunk-2IIJTXYF.js} +45 -16
- package/chunks/{chunk-BPJSQIJX.js → chunk-2J3OJGTL.js} +0 -2
- package/chunks/{chunk-2X55UKQE.js → chunk-2JZR3B4A.js} +3 -3
- package/chunks/{chunk-7JURR4JT.js → chunk-2OQUICDM.js} +167 -81
- package/chunks/{chunk-ZJHVAS7M.js → chunk-2YCYFWYZ.js} +4 -5
- package/chunks/{chunk-3QMGYBFN.js → chunk-3APUUXRF.js} +1 -80
- package/chunks/{chunk-MUP3T3AD.js → chunk-3I6DUGQD.js} +1 -35
- package/chunks/{chunk-JVPM2ULZ.js → chunk-3XZ5SSNR.js} +6 -6
- package/chunks/chunk-42VPM33K.js +319 -0
- package/chunks/{chunk-VAK25FTU.js → chunk-45IOTAUS.js} +1 -1
- package/chunks/chunk-45UYUCJ6.js +363 -0
- package/chunks/{chunk-JZA3JUDJ.js → chunk-4KP2F2TE.js} +1 -1
- package/chunks/{chunk-IO3IX5Q4.js → chunk-4YJQD2IO.js} +1 -1
- package/chunks/{chunk-JXJFVC6E.js → chunk-5G6XUGXO.js} +61 -14
- package/chunks/{chunk-ZOIFNCKL.js → chunk-5NNHICSA.js} +3 -23
- package/chunks/{chunk-A4UCTEB5.js → chunk-5WV5S2GT.js} +0 -1
- package/chunks/{chunk-RHLZR4E5.js → chunk-675H6PLP.js} +1 -1
- package/chunks/chunk-6FMJLI5M.js +1591 -0
- package/chunks/chunk-6MPDY6ZG.js +76 -0
- package/chunks/{chunk-PSOO6YXD.js → chunk-6NUWQ3R7.js} +9 -7
- package/chunks/{chunk-7MVVZO4N.js → chunk-6ZRWX46I.js} +4 -4
- package/chunks/{chunk-TPRQ7RZH.js → chunk-76E5Y3UZ.js} +3117 -993
- package/chunks/{chunk-UUUTRMI2.js → chunk-7ULQIS27.js} +1 -1
- package/chunks/{chunk-BKHWX6I2.js → chunk-A5BZ722X.js} +11 -3
- package/chunks/{chunk-TEHGS6UP.js → chunk-A5T5W7PR.js} +154 -16
- package/chunks/{chunk-VIA5XA4U.js → chunk-A5UODYG3.js} +4 -1
- package/chunks/{chunk-JLU636DO.js → chunk-ALMR3E6Q.js} +1 -0
- package/chunks/{chunk-EBJQ6AXW.js → chunk-ANDVK2JN.js} +358 -14
- package/chunks/{chunk-TOFQCPDC.js → chunk-AOHY3QJ3.js} +14 -8
- package/chunks/chunk-AQ37AY7B.js +93 -0
- package/chunks/{chunk-PJIZUQVC.js → chunk-AZQ3DT76.js} +2 -2
- package/chunks/{chunk-LKEJ26GS.js → chunk-B3TA3IF5.js} +16 -11
- package/chunks/{chunk-Q4M4MDQ4.js → chunk-B43QHWY6.js} +1 -1
- package/chunks/{chunk-UH3WSE5L.js → chunk-B4AJNNOL.js} +1 -6
- package/chunks/{chunk-K36B6G2O.js → chunk-B6FOGNGH.js} +5 -5
- package/chunks/{chunk-PWVFN2LF.js → chunk-BP2H5K25.js} +1 -1
- package/chunks/{chunk-LB6DUZ26.js → chunk-BTWSGZCT.js} +264 -185
- package/chunks/{chunk-ZNAUOR2I.js → chunk-BZBPT52P.js} +2 -2
- package/chunks/{chunk-L26JL52R.js → chunk-CBBP4BMC.js} +64 -67
- package/chunks/{chunk-ZD6UTE4A.js → chunk-CNTR4GR6.js} +1 -1
- package/chunks/{chunk-3SJ43L4W.js → chunk-CPZAH673.js} +6 -0
- package/chunks/{chunk-EPDRMGT4.js → chunk-D4HTUMGX.js} +4 -28
- package/chunks/{chunk-QAF7NMK7.js → chunk-D7CQTWRS.js} +1 -1
- package/chunks/{chunk-XVNQMZ2I.js → chunk-DGEIYUC3.js} +0 -1
- package/chunks/{chunk-BPZALHVR.js → chunk-DI35ZN7T.js} +1 -1
- package/chunks/{chunk-IKCX4CCL.js → chunk-DKPJUF5F.js} +118 -95
- package/chunks/{chunk-DLWL3Z7A.js → chunk-DSFHVTWD.js} +3 -3
- package/chunks/{chunk-FSITMZJH.js → chunk-DYRYLJ3O.js} +18 -9
- package/chunks/{chunk-NL7LTRLR.js → chunk-E2BHWIDT.js} +48 -72
- package/chunks/{chunk-UDX5OBWR.js → chunk-E2FN6SM7.js} +94 -4
- package/chunks/{chunk-USTWD7QV.js → chunk-E6CJ2SMM.js} +26 -16
- package/chunks/{chunk-KMQ33DO4.js → chunk-EDB7A72S.js} +4 -4
- package/chunks/{chunk-7ZCNENPP.js → chunk-FANRZEAJ.js} +1 -1
- package/chunks/{chunk-WBL3FJEU.js → chunk-FC4KQFCS.js} +1 -1
- package/chunks/{chunk-5NBDS5S6.js → chunk-FCYYAB4S.js} +162 -7
- package/chunks/{chunk-OKY7HXPG.js → chunk-FJ5WUMUQ.js} +2 -2
- package/chunks/{chunk-PHOF65IG.js → chunk-FRXG4ARO.js} +36273 -44436
- package/chunks/{chunk-FQK6JAFG.js → chunk-FS674JW4.js} +4 -4
- package/chunks/chunk-FYJ7W2PI.js +194 -0
- package/chunks/{chunk-BULDBTYC.js → chunk-G7XXKQYS.js} +3 -28
- package/chunks/{chunk-LS77BEZP.js → chunk-GLCZKT5V.js} +1 -5
- package/chunks/{chunk-VRYUBFMC.js → chunk-GRUAVQQR.js} +1 -1
- package/chunks/{chunk-MVSUYZDT.js → chunk-GWV7DI3S.js} +4 -4
- package/chunks/{chunk-A5L3JMUA.js → chunk-HC45LTEN.js} +18 -4
- package/chunks/{chunk-PC6JANNU.js → chunk-HKRVXYDN.js} +4 -4
- package/chunks/{chunk-GZXCZHCT.js → chunk-I3G5JWBV.js} +1 -1
- package/chunks/{chunk-4WIZGAH3.js → chunk-I5BT7ADR.js} +6 -58
- package/chunks/{chunk-GSN55ZRI.js → chunk-ID3O7PRB.js} +19 -7
- package/chunks/{chunk-L5UHQJTJ.js → chunk-IGTHU3T4.js} +1 -1
- package/chunks/{chunk-BIQWWWJN.js → chunk-IIUGIWWY.js} +1 -1
- package/chunks/{chunk-RWTEFFPU.js → chunk-JCJ7LKNA.js} +6140 -5616
- package/chunks/{chunk-S3TWXGKA.js → chunk-JE7KQ2UP.js} +4 -2
- package/chunks/{chunk-PWTZEM3C.js → chunk-JXVC2PL3.js} +3 -37
- package/chunks/chunk-JYBU6YUE.js +378 -0
- package/chunks/{chunk-RF3EXIHJ.js → chunk-K3PFMM5U.js} +49 -26
- package/chunks/{chunk-JCW2R7WC.js → chunk-K623ENWT.js} +3 -79
- package/chunks/{chunk-T2NCM2ET.js → chunk-K6KS3LTN.js} +2 -749
- package/chunks/chunk-KWHKHSIS.js +81 -0
- package/chunks/{chunk-DHHOYAPR.js → chunk-L2E5GFAG.js} +7 -7
- package/chunks/{chunk-2W3OOD4W.js → chunk-L55JWS76.js} +6 -3
- package/chunks/{chunk-E5TUC6CA.js → chunk-LHKCY7DY.js} +3 -3
- package/chunks/{chunk-NH6KE4JX.js → chunk-LOY7RWQG.js} +3 -3
- package/chunks/{chunk-U7M2DMGW.js → chunk-M4MSAE7U.js} +130 -5
- package/chunks/{chunk-IJTOWOD7.js → chunk-MB32MS4U.js} +92 -9
- package/chunks/{chunk-PR75REBZ.js → chunk-MM7TH7ZM.js} +12 -82
- package/chunks/{chunk-FODK6UMO.js → chunk-MPHPFVKK.js} +0 -2
- package/chunks/{chunk-M5JM7OSF.js → chunk-N4ACHWNH.js} +2 -3
- package/chunks/{chunk-JESCGQM3.js → chunk-NAVJD2PQ.js} +8 -7
- package/chunks/{chunk-J56UI34H.js → chunk-NBD76HUW.js} +4 -2
- package/chunks/{chunk-2SCDWPXI.js → chunk-NC4U4I3Y.js} +5 -5
- package/chunks/{chunk-H4SBPHSA.js → chunk-NNL7WPPK.js} +3 -3
- package/chunks/{chunk-YBL3QUDD.js → chunk-NQCXWP5D.js} +1 -1
- package/chunks/{chunk-CIKQ7KKO.js → chunk-NVFSGPIF.js} +954 -444
- package/chunks/{chunk-6OUGMXDC.js → chunk-NWNEANAT.js} +7 -7
- package/chunks/chunk-O6GEWCJA.js +21 -0
- package/chunks/chunk-OCPBI7J5.js +18 -0
- package/chunks/{chunk-KIM5GUMA.js → chunk-OE6F6ZWQ.js} +589 -220
- package/chunks/{chunk-SQCQ4KO2.js → chunk-P5DEY3NF.js} +380 -317
- package/chunks/{chunk-2JZBVYTU.js → chunk-Q3T5KA2V.js} +1 -8
- package/chunks/{chunk-MB4MZHMJ.js → chunk-QARJNL2V.js} +211 -522
- package/chunks/{chunk-YH6G52F2.js → chunk-QCXGC7QB.js} +4 -4
- package/chunks/chunk-QDK4F2N5.js +1252 -0
- package/chunks/{chunk-VDDGDZMA.js → chunk-QHWCP53L.js} +14 -7
- package/chunks/{chunk-VULLI6WQ.js → chunk-QIERF2GQ.js} +6 -6
- package/chunks/{chunk-TGILQ3YH.js → chunk-QQTJK5GB.js} +200 -77
- package/chunks/{chunk-H5FFA6TH.js → chunk-QTHQ6Z5X.js} +16 -3
- package/chunks/{chunk-5I2IWRSH.js → chunk-R2XWGR75.js} +2 -2
- package/chunks/{chunk-YPE6A4GC.js → chunk-RT7FNC2O.js} +2 -2
- package/chunks/{chunk-OFDOK3VM.js → chunk-RX7NJOPE.js} +8 -13
- package/chunks/{chunk-6AM5D4ME.js → chunk-S6LOFUVP.js} +0 -12
- package/chunks/{chunk-K4XWPEWB.js → chunk-SHN4KHDK.js} +4 -33
- package/chunks/{chunk-VYPFXUCB.js → chunk-SZ3KHTDR.js} +1 -1
- package/chunks/chunk-T26EAKDL.js +13 -0
- package/chunks/chunk-T3CHYWJZ.js +758 -0
- package/chunks/{chunk-FNQ6T3CV.js → chunk-TEGJSJDF.js} +10 -7
- package/chunks/{chunk-RZIX2G32.js → chunk-THPORXSI.js} +1 -1
- package/chunks/{chunk-OHNBB4XR.js → chunk-THVU3RNH.js} +1 -1
- package/chunks/{record-artifact-RQKFYO5B.js → chunk-TIRRPCFS.js} +22 -7
- package/chunks/{chunk-ETSW4KLJ.js → chunk-TUCOXPHJ.js} +2 -2
- package/chunks/{chunk-63P4EL5V.js → chunk-TZTAV5RH.js} +1 -1
- package/chunks/{chunk-LK7CHLVP.js → chunk-U4VTUMMK.js} +0 -60
- package/chunks/{chunk-3RN6GBKS.js → chunk-U5CODIJW.js} +1 -1
- package/chunks/chunk-UU2B5YG6.js +2196 -0
- package/chunks/{chunk-R5AFZNQW.js → chunk-VAVHTGU4.js} +15 -8
- package/chunks/{chunk-2NH6DYI4.js → chunk-VHPFWR2O.js} +12 -12
- package/chunks/{chunk-IKYJHJNF.js → chunk-VOMQ2P6B.js} +3 -3
- package/chunks/{chunk-ZFDTEDCF.js → chunk-VX22DUW2.js} +6 -6
- package/chunks/{chunk-HTR4WV6U.js → chunk-W4RQUHY3.js} +31 -1
- package/chunks/{chunk-M4FMGVY4.js → chunk-WQP7BKWA.js} +3 -3
- package/chunks/{chunk-LH2BYDQ5.js → chunk-X2E5TFJ5.js} +18 -12
- package/chunks/{chunk-COH43MRJ.js → chunk-XCGIMOLN.js} +27 -1
- package/chunks/{chunk-YX324OPW.js → chunk-XDS22O52.js} +1 -1
- package/chunks/chunk-XP4L6KS3.js +463 -0
- package/chunks/{chunk-6FGBXPWM.js → chunk-XQK4XXTN.js} +38 -44
- package/chunks/{chunk-55DJUCI2.js → chunk-XWYPFDB5.js} +53 -43
- package/chunks/{chunk-Y34KJKDC.js → chunk-Y7BVNVVW.js} +1 -1
- package/chunks/{chunk-IPUUTYMV.js → chunk-YDLJGZHL.js} +1 -1
- package/chunks/{chunk-HIJQF5B5.js → chunk-YGE3IXJP.js} +1 -1
- package/chunks/{chunk-LQIW3YFY.js → chunk-YJFPRUWX.js} +9 -7
- package/chunks/{chunk-J24WCGIN.js → chunk-YQIIG4NA.js} +4 -4
- package/chunks/{chunk-BJX6ZSUK.js → chunk-YUFIEIWC.js} +2 -2
- package/chunks/{chunk-NIBLUX3Y.js → chunk-Z3S5EMOW.js} +148 -21
- package/chunks/{chunk-WCXCRJYB.js → chunk-Z3YLHKB7.js} +1 -1
- package/chunks/chunk-Z4X5MTRT.js +133 -0
- package/chunks/{chunk-UW5EOVUN.js → chunk-ZBVS26BY.js} +4 -4
- package/chunks/{chunk-HTO4JFDZ.js → chunk-ZPJWUGCS.js} +0 -1
- package/chunks/{chunk-X5XDDSSH.js → chunk-ZPZ7ZJEE.js} +28 -5
- package/chunks/{computer-use-SOQ4E3VX.js → computer-use-GOM42LNK.js} +53 -50
- package/chunks/{config-utils-7V7GGIW6.js → config-utils-WADIDWGG.js} +4 -3
- package/chunks/contextCommand-6LVPTIWD.js +83 -0
- package/chunks/core-runtime-253XV2DB.js +137 -0
- package/chunks/{create-sub-session-QRJLW5BV.js → create-sub-session-45POYEVP.js} +50 -47
- package/chunks/{create-sub-session-IWW2IZ2T.js → create-sub-session-62YZWVAY.js} +3 -3
- package/chunks/{cron-create-YIID5XAW.js → cron-create-6E7GIQTG.js} +6 -6
- package/chunks/{cron-delete-ZVHYCEP2.js → cron-delete-JD26XY3W.js} +5 -5
- package/chunks/{cron-list-XEGS463Q.js → cron-list-CUWFB44G.js} +6 -6
- package/chunks/{daemon-YO6433NF.js → daemon-PCNCI5YU.js} +428 -18
- package/chunks/daemon-status-provider-AKALDYJJ.js +93 -0
- package/chunks/daemon-trust-policy-XB7ZSQFQ.js +88 -0
- package/chunks/daemon-trust-policy-monitor-FUTKP42Q.js +175 -0
- package/chunks/{de-HGRCYDEJ.js → de-SY6O76BF.js} +6 -1
- package/chunks/deferred-core-runtime-RKLCO7V5.js +92 -0
- package/chunks/dist-26BIMQT6.js +4487 -0
- package/chunks/{dist-F6IBUDR4.js → dist-2PERFI23.js} +12 -9
- package/chunks/{dist-46NQKLTW.js → dist-OAOC5OV4.js} +2 -2
- package/chunks/{dist-YFNEUWSE.js → dist-PVEAFLHY.js} +5 -4
- package/chunks/{dist-AIKFMUKK.js → dist-SL2LUMML.js} +1449 -14
- package/chunks/dist-ULIG4M5H.js +13415 -0
- package/chunks/{dist-WEAHOXDM.js → dist-WGMNT3JQ.js} +2 -1
- package/chunks/{dist-BBLXMS3N.js → dist-ZHXOBXDN.js} +3 -3
- package/chunks/earlyInputCapture-FCWU47OB.js +85 -0
- package/chunks/{edit-OBDSQURM.js → edit-TTACM3LN.js} +51 -48
- package/chunks/{en-MTWBNGDO.js → en-NBK3JKCE.js} +9 -1
- package/chunks/{enter-worktree-U6MRPQ2P.js → enter-worktree-R34GFDX6.js} +51 -48
- package/chunks/{enterPlanMode-BC5QUZZ2.js → enterPlanMode-KJPBB6G5.js} +51 -48
- package/chunks/environment-IJG3N2PR.js +105 -0
- package/chunks/errors-MRON5OJD.js +91 -0
- package/chunks/esm-K5FARBNI.js +5548 -0
- package/chunks/{exit-worktree-DGNYMECB.js → exit-worktree-UBA66Y4I.js} +51 -48
- package/chunks/exitPlanMode-SMSPGNSK.js +76 -0
- package/chunks/{fast-path-JJZFJANL.js → fast-path-ZBAMZDCP.js} +16 -6
- package/chunks/{fr-45RLL55O.js → fr-4KG5V7UT.js} +6 -1
- package/chunks/{gemini-QS36EBZV.js → gemini-XFT7HRNL.js} +106 -99
- package/chunks/{geminiContentGenerator-AG4KB6CV.js → geminiContentGenerator-XD3MLYQX.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-HFKY7HXZ.js} +51 -48
- package/chunks/goal-tools-HGO6VXPB.js +335 -0
- package/chunks/{grep-QYPSK7OP.js → grep-EO5Z3PFV.js} +53 -49
- package/chunks/handleAutoUpdate-WRENFE6C.js +84 -0
- package/chunks/i18n-ZG5OTVSV.js +100 -0
- package/chunks/{image-gen-Z3VPGKRC.js → image-gen-CKWZ4MJI.js} +12 -12
- package/chunks/initializer-FYPLLRC7.js +89 -0
- package/chunks/installationInfo-5RV4HRMC.js +83 -0
- package/chunks/{ja-B7DF7DFG.js → ja-F3GSQXMF.js} +6 -1
- package/chunks/{keychain-token-storage-MDTG3WRM.js → keychain-token-storage-IKO4G53C.js} +3 -3
- package/chunks/lib-RUF3WZA6.js +9 -0
- package/chunks/list-ZNWVL3AT.js +92 -0
- package/chunks/{list-agents-5KJJHR6I.js → list-agents-PXJ7ZUFB.js} +3 -3
- package/chunks/loadedSettingsAdapter-GQGNHP5I.js +86 -0
- package/chunks/{loggingContentGenerator-HS3S5H3Q.js → loggingContentGenerator-MS5DFAWH.js} +78 -113
- package/chunks/{loop-wakeup-FXKNNYSY.js → loop-wakeup-Y26NQZ5I.js} +15 -8
- package/chunks/{ls-NTK6VOQJ.js → ls-ONQTTMQR.js} +5 -5
- package/chunks/{lsp-2JI24STP.js → lsp-YGHHRGMD.js} +3 -3
- package/chunks/{managed-npm-update-JYEMMXA3.js → managed-npm-update-67AK4GTL.js} +51 -48
- package/chunks/mcp-FVQ4VTLM.js +86 -0
- package/chunks/{monitor-R3ODH5U6.js → monitor-BXB33EOZ.js} +51 -48
- package/chunks/nonInteractiveCli-CN2GYSN3.js +148 -0
- package/chunks/{notebook-edit-BNOK452R.js → notebook-edit-FKYRBV4L.js} +51 -48
- package/chunks/{openaiContentGenerator-WMCU3O2H.js → openaiContentGenerator-UUXV5DGU.js} +26 -27
- package/chunks/pidfile-MV347TTZ.js +89 -0
- package/chunks/process-registry-2CHQBXH5.js +157 -0
- package/chunks/{processUtils-RT7UNCC2.js → processUtils-LKFG52RV.js} +2 -2
- package/chunks/{pt-22Q3FP73.js → pt-EQ33KWEN.js} +6 -1
- package/chunks/{qwenContentGenerator-HHCRK4SX.js → qwenContentGenerator-3WYI2HRW.js} +56 -53
- package/chunks/{qwenOAuth2-OWLB5AKH.js → qwenOAuth2-B46MW45O.js} +10 -10
- package/chunks/read-file-ACSHVWP3.js +29 -0
- package/chunks/{read-mcp-resource-4DKQWGHD.js → read-mcp-resource-U2IJN5HM.js} +4 -4
- package/chunks/record-artifact-MGPJ7EG4.js +21 -0
- package/chunks/resumeHistoryUtils-AMS4767B.js +94 -0
- package/chunks/ripGrep-BAPM2UKC.js +76 -0
- package/chunks/{ru-FZCNZHDC.js → ru-7OZAUKGG.js} +6 -1
- package/chunks/{run-qwen-serve-FU6HEM4J.js → run-qwen-serve-JEN6FO2A.js} +1018 -263
- package/chunks/runtime-WVP22ISH.js +122 -0
- package/chunks/{scheduler-G2ZS2Z7E.js → scheduler-HTX5ACVR.js} +50 -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-4BQANSJ6.js} +7 -7
- package/chunks/{sdk-impl-GMVPB7NB.js → sdk-impl-Z4VXWVFX.js} +14 -14
- package/chunks/{send-message-Q6OOR6BR.js → send-message-PMP4ATVM.js} +8 -13
- package/chunks/serve-ELQIVNWN.js +92 -0
- package/chunks/{server-4UMH7OIZ.js → server-JNW2NOSQ.js} +5288 -1364
- package/chunks/{session-K3O3Q2SV.js → session-NC356XNS.js} +102 -95
- package/chunks/{settings-CR2EWTBA.js → settings-73RMIOJ6.js} +54 -51
- package/chunks/shell-NMHF5TFG.js +86 -0
- package/chunks/{skill-I3SDA4MB.js → skill-XPGXHEKO.js} +22 -22
- package/chunks/skill-settings-5IGIJDGA.js +94 -0
- package/chunks/spawnChannel-T5THBHFN.js +85 -0
- package/chunks/standalone-update-ODXEPDLP.js +95 -0
- package/chunks/{startInteractiveUI-SLZGHRPH.js → startInteractiveUI-S27DXVAE.js} +1241 -905
- package/chunks/{syntheticOutput-I3757IWH.js → syntheticOutput-D7E6ZFKR.js} +4 -4
- package/chunks/task-create-NFCYD43L.js +26 -0
- package/chunks/{task-list-FOPULZEP.js → task-list-TAVMGEVD.js} +7 -7
- package/chunks/{task-stop-H6RHXFVQ.js → task-stop-ZDF2UJRM.js} +3 -3
- package/chunks/{task-update-M57TFZJT.js → task-update-6L7LHGEX.js} +12 -11
- package/chunks/{team-create-YJALH5D2.js → team-create-CTLQWTJ2.js} +53 -50
- package/chunks/{team-delete-QE2UXJL7.js → team-delete-DPGGRQBU.js} +7 -7
- package/chunks/{team-plan-approval-34QFYKGN.js → team-plan-approval-WKRUAPJ4.js} +51 -48
- package/chunks/theme-manager-XQHXQQX6.js +80 -0
- package/chunks/{todoWrite-VQ7FKOHL.js → todoWrite-2UO5G6G6.js} +34 -6
- package/chunks/{tool-search-NF7GB6LE.js → tool-search-45YINAJA.js} +21 -22
- package/chunks/total-session-admission-QPUKGHKO.js +88 -0
- package/chunks/trustedFolders-YMUTRHEQ.js +98 -0
- package/chunks/{update-relaunch-WBUZJC5O.js → update-relaunch-PZUXTVHC.js} +5 -5
- package/chunks/updateCheck-IZAN4XTB.js +95 -0
- package/chunks/useAutoAcceptIndicator-CGL2MAYE.js +96 -0
- package/chunks/{validateNonInterActiveAuth-3R223G3R.js → validateNonInterActiveAuth-GBGNJ65K.js} +97 -90
- package/chunks/{version-HS7YSFHV.js → version-Z7EX24NZ.js} +1 -1
- package/chunks/{web-fetch-NKCSG7ZE.js → web-fetch-ETTT2H3V.js} +19 -21
- package/chunks/{web-search-S62WAP4S.js → web-search-Y3ZSVRJ6.js} +13 -13
- package/chunks/{workflow-QAGU5RU4.js → workflow-ATRJSAO7.js} +52 -49
- package/chunks/workspace-providers-status-YM3WLW3N.js +89 -0
- package/chunks/{workspace-registration-store-24JMHDGF.js → workspace-registration-store-4EGNCIPG.js} +1 -1
- package/chunks/workspace-registry-NGZOZKQP.js +96 -0
- package/chunks/workspace-service-SVWOXX2B.js +103 -0
- package/chunks/workspace-skills-status-YZHZ3PT5.js +89 -0
- package/chunks/workspace-trust-reconciler-GGBQV2U5.js +349 -0
- package/chunks/write-file-HLGCEB72.js +78 -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-LDECT475.js +224 -0
- package/cli.js +50 -16
- 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-Dpy_U6Bb.js} +1 -1
- package/web-shell/assets/{architectureDiagram-3BPJPVTR-kMMF5sud.js → architectureDiagram-3BPJPVTR-DgDOg-c5.js} +1 -1
- package/web-shell/assets/{blockDiagram-GPEHLZMM-Htl9vTJS.js → blockDiagram-GPEHLZMM-tADd9Ja3.js} +1 -1
- package/web-shell/assets/{c4Diagram-AAUBKEIU-BnZnm0mQ.js → c4Diagram-AAUBKEIU-68wj9MCU.js} +1 -1
- package/web-shell/assets/channel-Do7fFnFl.js +1 -0
- package/web-shell/assets/{chunk-2J33WTMH-DziB7kDG.js → chunk-2J33WTMH-DjJLOeVU.js} +1 -1
- package/web-shell/assets/{chunk-4BX2VUAB-CmkD8daw.js → chunk-4BX2VUAB-CMbzGeVC.js} +1 -1
- package/web-shell/assets/{chunk-55IACEB6-CHAd9A_U.js → chunk-55IACEB6-SlKgejv9.js} +1 -1
- package/web-shell/assets/{chunk-727SXJPM-Dqaam3fE.js → chunk-727SXJPM-CijXssHZ.js} +1 -1
- package/web-shell/assets/{chunk-AQP2D5EJ-D_-saBYM.js → chunk-AQP2D5EJ-D8w25nvR.js} +1 -1
- package/web-shell/assets/{chunk-FMBD7UC4-B9r_veWD.js → chunk-FMBD7UC4-Bv9dcx_e.js} +1 -1
- package/web-shell/assets/{chunk-ND2GUHAM-B3EaCSpL.js → chunk-ND2GUHAM-Bzf6sAOd.js} +1 -1
- package/web-shell/assets/{chunk-QZHKN3VN-CYq8x9mn.js → chunk-QZHKN3VN-whNoNeW5.js} +1 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-By_XOP3X.js +1 -0
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-By_XOP3X.js +1 -0
- package/web-shell/assets/{cose-bilkent-S5V4N54A-D0ng4uiB.js → cose-bilkent-S5V4N54A-rpQS44Lz.js} +1 -1
- package/web-shell/assets/{dagre-BM42HDAG-DCZollQv.js → dagre-BM42HDAG-Ck7VE6nT.js} +1 -1
- package/web-shell/assets/{diagram-2AECGRRQ-Dfk2pWS0.js → diagram-2AECGRRQ-CgRrsodR.js} +1 -1
- package/web-shell/assets/{diagram-5GNKFQAL-kX38ltWR.js → diagram-5GNKFQAL-CsTZtE5A.js} +1 -1
- package/web-shell/assets/{diagram-KO2AKTUF-CJz2vsXh.js → diagram-KO2AKTUF-D5EAdVq4.js} +1 -1
- package/web-shell/assets/{diagram-LMA3HP47-BvMLZm_7.js → diagram-LMA3HP47-DNrjHC7Z.js} +1 -1
- package/web-shell/assets/{diagram-OG6HWLK6-l7kfStkO.js → diagram-OG6HWLK6-ClJSJGgC.js} +1 -1
- package/web-shell/assets/{erDiagram-TEJ5UH35-BSVa8GGT.js → erDiagram-TEJ5UH35-DuVnos_y.js} +1 -1
- package/web-shell/assets/{flowDiagram-I6XJVG4X-CoawKIXH.js → flowDiagram-I6XJVG4X-DEpIVl1s.js} +1 -1
- package/web-shell/assets/{ganttDiagram-6RSMTGT7-DFUDH0zF.js → ganttDiagram-6RSMTGT7-COnQM2-C.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-PVQCEYII-Y2pvpT4e.js → gitGraphDiagram-PVQCEYII-C-lX5H3_.js} +1 -1
- package/web-shell/assets/index-C2GE3DAF.js +74 -0
- package/web-shell/assets/{index-D0GX0zZf.js → index-DfcyS2E7.js} +1 -1
- package/web-shell/assets/index-Qxt6kN7i.js +1700 -0
- package/web-shell/assets/index-bo0Z8hfu.css +5 -0
- package/web-shell/assets/{infoDiagram-5YYISTIA-CU8_zLiX.js → infoDiagram-5YYISTIA-D0WP-wmU.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-AVQiV0DU.js → ishikawaDiagram-YF4QCWOH-DgsI3Clu.js} +1 -1
- package/web-shell/assets/{journeyDiagram-JHISSGLW-DQ0VSKa3.js → journeyDiagram-JHISSGLW-4yCoMZO6.js} +1 -1
- package/web-shell/assets/{kanban-definition-UN3LZRKU-BqnWqsE_.js → kanban-definition-UN3LZRKU-D_05au1N.js} +1 -1
- package/web-shell/assets/{linear-BkoihsaA.js → linear-B38fDz0Q.js} +1 -1
- package/web-shell/assets/{mermaid.core-5RJs-31j.js → mermaid.core-aGNwTaHi.js} +5 -5
- package/web-shell/assets/{mindmap-definition-RKZ34NQL-D33Bxnpd.js → mindmap-definition-RKZ34NQL-C2yf_5WM.js} +1 -1
- package/web-shell/assets/{pieDiagram-4H26LBE5-BuEAw3BH.js → pieDiagram-4H26LBE5-DiHABBT-.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-W4KKPZXB-Kox_usEq.js → quadrantDiagram-W4KKPZXB-W9xkeAGe.js} +1 -1
- package/web-shell/assets/{requirementDiagram-4Y6WPE33-CNjeUif0.js → requirementDiagram-4Y6WPE33-BGmRXl9k.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-5OEKKPKP-BCd2OL_U.js → sankeyDiagram-5OEKKPKP-CvOmT43_.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-3UESZ5HK-CF2ZTsz0.js → sequenceDiagram-3UESZ5HK-C8pdd0Z-.js} +1 -1
- package/web-shell/assets/{stateDiagram-AJRCARHV-qenSzHtm.js → stateDiagram-AJRCARHV-C-CYdFx2.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-BieEHeN9.js +1 -0
- package/web-shell/assets/{timeline-definition-PNZ67QCA-B5DyWdgs.js → timeline-definition-PNZ67QCA-w2KQn1cI.js} +1 -1
- package/web-shell/assets/{vennDiagram-CIIHVFJN-DqP4I_o_.js → vennDiagram-CIIHVFJN-DuorhRku.js} +1 -1
- package/web-shell/assets/{wardley-L42UT6IY-CJe2e4mg.js → wardley-L42UT6IY-BAXm2cWy.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-YWT4CUSO-BMDSw-Rr.js → wardleyDiagram-YWT4CUSO-8PHaOXn5.js} +1 -1
- package/web-shell/assets/{xychartDiagram-2RQKCTM6-BTVZYkxD.js → xychartDiagram-2RQKCTM6-Do84JFSc.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/environment-W5UFC2CH.js +0 -102
- 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/runtime-XXRRTNP6.js +0 -118
- 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/task-create-N7WQSGYA.js +0 -25
- 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,48 +12,47 @@ import {
|
|
|
12
12
|
matchMcpServerByRef,
|
|
13
13
|
parseExtensionRef,
|
|
14
14
|
parseMcpServerRef
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-QIERF2GQ.js";
|
|
16
16
|
import {
|
|
17
17
|
getAvailableCommands,
|
|
18
18
|
handleSlashCommand,
|
|
19
19
|
insertAfterFunctionResponses,
|
|
20
20
|
isSlashCommand,
|
|
21
21
|
normalizePartList
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-BTWSGZCT.js";
|
|
23
23
|
import {
|
|
24
24
|
collectContextData,
|
|
25
25
|
formatContextUsageText
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-VAVHTGU4.js";
|
|
27
27
|
import {
|
|
28
28
|
recomputeMcpGating
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-RX7NJOPE.js";
|
|
30
30
|
import {
|
|
31
31
|
appEvents,
|
|
32
32
|
buildDisabledSkillNamesProvider,
|
|
33
|
+
cleanupReviewWorktreeLeases,
|
|
33
34
|
loadCliConfig,
|
|
34
35
|
normalizeDisabledToolList
|
|
35
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-76E5Y3UZ.js";
|
|
36
37
|
import {
|
|
37
38
|
getCommandSubcommandNames
|
|
38
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-THPORXSI.js";
|
|
39
40
|
import {
|
|
40
41
|
getEffectiveSupportedModes
|
|
41
|
-
} from "./chunk-
|
|
42
|
-
import "./chunk-J56UI34H.js";
|
|
42
|
+
} from "./chunk-M4MSAE7U.js";
|
|
43
43
|
import "./chunk-4WGODMVR.js";
|
|
44
44
|
import "./chunk-PQNHRFJC.js";
|
|
45
|
-
import "./chunk-
|
|
46
|
-
import "./chunk-
|
|
47
|
-
import "./chunk-GSN55ZRI.js";
|
|
48
|
-
import "./chunk-6H67XLET.js";
|
|
45
|
+
import "./chunk-NBD76HUW.js";
|
|
46
|
+
import "./chunk-IGTHU3T4.js";
|
|
49
47
|
import {
|
|
50
48
|
beginAcpBootstrapConfigProfiling,
|
|
51
49
|
buildAndFreezeAcpStartupProfile,
|
|
52
50
|
endAcpBootstrapConfigProfiling,
|
|
53
51
|
markAcpStartup
|
|
54
|
-
} from "./chunk-
|
|
55
|
-
import "./chunk-
|
|
56
|
-
import "./chunk-
|
|
52
|
+
} from "./chunk-YGE3IXJP.js";
|
|
53
|
+
import "./chunk-6ZRWX46I.js";
|
|
54
|
+
import "./chunk-VOMQ2P6B.js";
|
|
55
|
+
import "./chunk-WQP7BKWA.js";
|
|
57
56
|
import "./chunk-YAF2MQZ6.js";
|
|
58
57
|
import {
|
|
59
58
|
GENERATION_MAX_PROMPT_BYTES,
|
|
@@ -74,7 +73,7 @@ import {
|
|
|
74
73
|
shouldSuppressRememberErrorDetails,
|
|
75
74
|
workspaceMemoryFailureCode,
|
|
76
75
|
workspaceMemoryFailureDiagnostics
|
|
77
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-23F4XGWO.js";
|
|
78
77
|
import {
|
|
79
78
|
HistoryReplayer,
|
|
80
79
|
MessageEmitter,
|
|
@@ -84,71 +83,57 @@ import {
|
|
|
84
83
|
goalTerminalEventToHistoryItem,
|
|
85
84
|
recordGoalStatusItem,
|
|
86
85
|
restoreGoalFromHistory
|
|
87
|
-
} from "./chunk-
|
|
88
|
-
import "./chunk-
|
|
89
|
-
import "./chunk-
|
|
90
|
-
import "./chunk-
|
|
86
|
+
} from "./chunk-ANDVK2JN.js";
|
|
87
|
+
import "./chunk-675H6PLP.js";
|
|
88
|
+
import "./chunk-YDLJGZHL.js";
|
|
89
|
+
import "./chunk-Z3YLHKB7.js";
|
|
91
90
|
import "./chunk-2MIN6GRR.js";
|
|
92
91
|
import "./chunk-QHTIBUWB.js";
|
|
93
92
|
import {
|
|
94
93
|
isTerminalGoalStatusKind
|
|
95
94
|
} from "./chunk-QTERJVPZ.js";
|
|
96
95
|
import "./chunk-3Z43GZUQ.js";
|
|
96
|
+
import {
|
|
97
|
+
computeCpuPercent
|
|
98
|
+
} from "./chunk-HGT6JR3U.js";
|
|
99
|
+
import "./chunk-RXFQM6FQ.js";
|
|
100
|
+
import "./chunk-ID3O7PRB.js";
|
|
101
|
+
import "./chunk-6H67XLET.js";
|
|
102
|
+
import {
|
|
103
|
+
mapSkillConfigToStatus
|
|
104
|
+
} from "./chunk-L55JWS76.js";
|
|
97
105
|
import {
|
|
98
106
|
PERMISSION_RULE_TYPES,
|
|
99
107
|
PermissionRulesValidationError,
|
|
100
108
|
buildPermissionSettings,
|
|
101
109
|
normalizePermissionRules,
|
|
102
110
|
readPermissionRuleSet
|
|
103
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-GRUAVQQR.js";
|
|
104
112
|
import {
|
|
105
113
|
MAX_AUDIO_BYTES,
|
|
106
114
|
sanitizeVoiceErrorMessage,
|
|
107
115
|
transcribeVoiceAudio
|
|
108
|
-
} from "./chunk-
|
|
116
|
+
} from "./chunk-NNL7WPPK.js";
|
|
109
117
|
import {
|
|
110
118
|
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";
|
|
119
|
+
} from "./chunk-NQCXWP5D.js";
|
|
120
|
+
import "./chunk-CNTR4GR6.js";
|
|
120
121
|
import {
|
|
121
122
|
createLoadedSettingsAdapter
|
|
122
|
-
} from "./chunk-
|
|
123
|
-
import "./chunk-
|
|
124
|
-
import "./chunk-
|
|
123
|
+
} from "./chunk-4YJQD2IO.js";
|
|
124
|
+
import "./chunk-VXZBKKQR.js";
|
|
125
|
+
import "./chunk-GWV7DI3S.js";
|
|
125
126
|
import "./chunk-E5Z2AVNV.js";
|
|
126
127
|
import {
|
|
128
|
+
SESSION_SOURCE_META_KEY,
|
|
127
129
|
parseSessionSource
|
|
128
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-OE6F6ZWQ.js";
|
|
129
131
|
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";
|
|
132
|
+
import "./chunk-XCGIMOLN.js";
|
|
133
|
+
import "./chunk-OCPBI7J5.js";
|
|
149
134
|
import {
|
|
150
135
|
ndJsonStream
|
|
151
|
-
} from "./chunk-
|
|
136
|
+
} from "./chunk-2OQUICDM.js";
|
|
152
137
|
import {
|
|
153
138
|
ACP_ROUTE_ID_PREFIX,
|
|
154
139
|
buildAcpModelOptions,
|
|
@@ -157,10 +142,7 @@ import {
|
|
|
157
142
|
parseAcpModelOption,
|
|
158
143
|
resolveAcpModelOption,
|
|
159
144
|
sanitizeProviderBaseUrl
|
|
160
|
-
} from "./chunk-
|
|
161
|
-
import {
|
|
162
|
-
mapSkillConfigToStatus
|
|
163
|
-
} from "./chunk-2W3OOD4W.js";
|
|
145
|
+
} from "./chunk-EDB7A72S.js";
|
|
164
146
|
import {
|
|
165
147
|
ACP_PREFLIGHT_KINDS,
|
|
166
148
|
IDLE_HOOK_EVENTS,
|
|
@@ -168,28 +150,57 @@ import {
|
|
|
168
150
|
SERVE_STATUS_EXT_METHODS,
|
|
169
151
|
STATUS_SCHEMA_VERSION,
|
|
170
152
|
mapDomainErrorToErrorKind
|
|
171
|
-
} from "./chunk-
|
|
172
|
-
import
|
|
173
|
-
|
|
174
|
-
|
|
153
|
+
} from "./chunk-A5UODYG3.js";
|
|
154
|
+
import {
|
|
155
|
+
resolveSkillSettings
|
|
156
|
+
} from "./chunk-Z4X5MTRT.js";
|
|
157
|
+
import "./chunk-6NUWQ3R7.js";
|
|
158
|
+
import "./chunk-HKRVXYDN.js";
|
|
159
|
+
import "./chunk-57OAHC2Y.js";
|
|
160
|
+
import "./chunk-I5BT7ADR.js";
|
|
161
|
+
import "./chunk-FANRZEAJ.js";
|
|
162
|
+
import "./chunk-KWHKHSIS.js";
|
|
175
163
|
import "./chunk-V6WHFGST.js";
|
|
176
164
|
import {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
165
|
+
CHANNEL_STARTUP_PROFILE_META_KEY,
|
|
166
|
+
CHANNEL_STARTUP_PROFILE_VERSION,
|
|
167
|
+
CLIENT_MCP_OVER_WS_CONFIG_FLAG,
|
|
168
|
+
DAEMON_CHANNEL_DELIVERY_META_KEY,
|
|
169
|
+
LOAD_REPLAY_BULK_MODE,
|
|
170
|
+
LOAD_REPLAY_HIDE_INHERITED_META_KEY,
|
|
171
|
+
LOAD_REPLAY_META_KEY,
|
|
172
|
+
LOAD_REPLAY_MODE_META_KEY,
|
|
173
|
+
LOAD_REPLAY_PAGE_SIZE_META_KEY,
|
|
174
|
+
LOAD_REPLAY_VERSION,
|
|
175
|
+
MID_TURN_QUEUE_DRAIN_METHOD,
|
|
176
|
+
PROMPT_CANCEL_METHOD,
|
|
177
|
+
TODO_STOP_GUARD_CONTINUATION_CLAIM_METHOD,
|
|
178
|
+
TODO_STOP_GUARD_QUEUE_RELEASE_METHOD,
|
|
179
|
+
WORKTREE_MCP_DEFER_META_KEY
|
|
180
|
+
} from "./chunk-CPZAH673.js";
|
|
181
|
+
import {
|
|
182
|
+
NOT_CURRENTLY_GENERATING_CANCEL_MESSAGE,
|
|
183
|
+
isNotCurrentlyGeneratingCancelError
|
|
184
|
+
} from "./chunk-B4AJNNOL.js";
|
|
181
185
|
import "./chunk-2RFKHEXL.js";
|
|
182
|
-
import "./chunk-
|
|
183
|
-
import "./chunk-
|
|
186
|
+
import "./chunk-FYJ7W2PI.js";
|
|
187
|
+
import "./chunk-U4VTUMMK.js";
|
|
188
|
+
import "./chunk-6MPDY6ZG.js";
|
|
189
|
+
import "./chunk-ALMR3E6Q.js";
|
|
184
190
|
import "./chunk-BK2UNYWD.js";
|
|
185
191
|
import "./chunk-M5GB774H.js";
|
|
186
|
-
import "./chunk-
|
|
192
|
+
import "./chunk-IIUGIWWY.js";
|
|
193
|
+
import "./chunk-ZPZ7ZJEE.js";
|
|
194
|
+
import "./chunk-JCJ7LKNA.js";
|
|
187
195
|
import {
|
|
188
196
|
AgentSideConnection,
|
|
189
197
|
PROTOCOL_VERSION,
|
|
190
198
|
RequestError
|
|
191
199
|
} from "./chunk-UDXSXLER.js";
|
|
192
|
-
import
|
|
200
|
+
import {
|
|
201
|
+
assembleMcpServers,
|
|
202
|
+
loadMcpApprovals
|
|
203
|
+
} from "./chunk-3XZ5SSNR.js";
|
|
193
204
|
import {
|
|
194
205
|
getOutputLanguageFilePath,
|
|
195
206
|
getPersistScopeForModelSelection,
|
|
@@ -198,7 +209,7 @@ import {
|
|
|
198
209
|
resolveOutputLanguageOrPreserveAuto,
|
|
199
210
|
updateOutputLanguageFile,
|
|
200
211
|
writeOutputLanguageAndRegisterPath
|
|
201
|
-
} from "./chunk-
|
|
212
|
+
} from "./chunk-A5T5W7PR.js";
|
|
202
213
|
import "./chunk-RKUWKYED.js";
|
|
203
214
|
import "./chunk-GOXKNSDZ.js";
|
|
204
215
|
import {
|
|
@@ -209,27 +220,28 @@ import {
|
|
|
209
220
|
SUPPORTED_LANGUAGES,
|
|
210
221
|
getCurrentLanguage,
|
|
211
222
|
setLanguageAsync
|
|
212
|
-
} from "./chunk-
|
|
223
|
+
} from "./chunk-B3TA3IF5.js";
|
|
213
224
|
import {
|
|
214
225
|
findEnvFiles,
|
|
215
226
|
preResolveHomeEnvOverrides,
|
|
216
227
|
reloadEnvironment
|
|
217
|
-
} from "./chunk-
|
|
228
|
+
} from "./chunk-X2E5TFJ5.js";
|
|
218
229
|
import "./chunk-6PEXNQTX.js";
|
|
219
|
-
import "./chunk-
|
|
220
|
-
import "./chunk-VJNBRRZG.js";
|
|
230
|
+
import "./chunk-BZBPT52P.js";
|
|
221
231
|
import {
|
|
222
232
|
isFolderTrustEnabled,
|
|
223
233
|
isWorkspaceTrusted,
|
|
224
234
|
loadTrustedFolders
|
|
225
|
-
} from "./chunk-
|
|
235
|
+
} from "./chunk-UU2B5YG6.js";
|
|
226
236
|
import "./chunk-ALGGS7UH.js";
|
|
227
237
|
import "./chunk-MR3PXB6E.js";
|
|
238
|
+
import "./chunk-XFSFZCM5.js";
|
|
239
|
+
import "./chunk-XDS22O52.js";
|
|
240
|
+
import "./chunk-VJNBRRZG.js";
|
|
228
241
|
import {
|
|
229
242
|
writeStderrLine,
|
|
230
243
|
writeStderrLineSafe
|
|
231
244
|
} from "./chunk-OWAK7LMW.js";
|
|
232
|
-
import "./chunk-XFSFZCM5.js";
|
|
233
245
|
import {
|
|
234
246
|
ALL_PROVIDERS,
|
|
235
247
|
APPROVAL_MODE_INFO,
|
|
@@ -269,6 +281,7 @@ import {
|
|
|
269
281
|
applyAutoModeDecision,
|
|
270
282
|
applyProviderInstallPlan,
|
|
271
283
|
approxBase64Bytes,
|
|
284
|
+
bridgeToolResultImages,
|
|
272
285
|
buildBackgroundEntryLabel,
|
|
273
286
|
buildBtwCacheSafeParams,
|
|
274
287
|
buildBtwPrompt,
|
|
@@ -351,69 +364,80 @@ import {
|
|
|
351
364
|
unregisterGoalHook,
|
|
352
365
|
updateSetting,
|
|
353
366
|
validatePlanModeShellApproval,
|
|
354
|
-
validatePlanModeShellContext
|
|
355
|
-
|
|
367
|
+
validatePlanModeShellContext,
|
|
368
|
+
wrapUserPromptSubmitContext
|
|
369
|
+
} from "./chunk-FRXG4ARO.js";
|
|
356
370
|
import "./chunk-5M6IDOMF.js";
|
|
357
371
|
import "./chunk-TWPJO254.js";
|
|
358
372
|
import {
|
|
359
373
|
external_exports
|
|
360
374
|
} 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";
|
|
375
|
+
import "./chunk-AOHY3QJ3.js";
|
|
376
|
+
import "./chunk-5NNHICSA.js";
|
|
377
|
+
import "./chunk-SHN4KHDK.js";
|
|
378
|
+
import "./chunk-JXVC2PL3.js";
|
|
368
379
|
import "./chunk-KRXPRVGL.js";
|
|
369
380
|
import {
|
|
370
381
|
parsePositiveIntegerEnv
|
|
371
382
|
} from "./chunk-6PVPNMXU.js";
|
|
372
|
-
import "./chunk-
|
|
373
|
-
import "./chunk-
|
|
374
|
-
import "./chunk-
|
|
383
|
+
import "./chunk-26JK4RPD.js";
|
|
384
|
+
import "./chunk-IRH27ZC2.js";
|
|
385
|
+
import "./chunk-QHWCP53L.js";
|
|
386
|
+
import "./chunk-TEGJSJDF.js";
|
|
387
|
+
import "./chunk-TIRRPCFS.js";
|
|
388
|
+
import {
|
|
389
|
+
promptIdContext,
|
|
390
|
+
todoWorkChainContext
|
|
391
|
+
} from "./chunk-O6GEWCJA.js";
|
|
392
|
+
import "./chunk-T26EAKDL.js";
|
|
375
393
|
import "./chunk-CPBF7KYF.js";
|
|
394
|
+
import "./chunk-4KP2F2TE.js";
|
|
395
|
+
import {
|
|
396
|
+
HookEventName,
|
|
397
|
+
createHookOutput
|
|
398
|
+
} from "./chunk-3APUUXRF.js";
|
|
399
|
+
import "./chunk-THVU3RNH.js";
|
|
400
|
+
import "./chunk-LHKCY7DY.js";
|
|
401
|
+
import "./chunk-6FMJLI5M.js";
|
|
376
402
|
import {
|
|
377
403
|
APPROVAL_MODES,
|
|
378
404
|
FORK_SUBAGENT_TYPE,
|
|
379
405
|
getStartupContextLength,
|
|
380
406
|
isSystemReminderContent,
|
|
381
407
|
runWithRuntimeContentGenerator
|
|
382
|
-
} from "./chunk-
|
|
383
|
-
import "./chunk-
|
|
384
|
-
import "./chunk-
|
|
385
|
-
import
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
} from "./chunk-3QMGYBFN.js";
|
|
389
|
-
import "./chunk-JCW2R7WC.js";
|
|
390
|
-
import "./chunk-M5JM7OSF.js";
|
|
391
|
-
import "./chunk-OHNBB4XR.js";
|
|
392
|
-
import "./chunk-E5TUC6CA.js";
|
|
408
|
+
} from "./chunk-CBBP4BMC.js";
|
|
409
|
+
import "./chunk-S6LOFUVP.js";
|
|
410
|
+
import "./chunk-K623ENWT.js";
|
|
411
|
+
import "./chunk-AQ37AY7B.js";
|
|
412
|
+
import "./chunk-N4ACHWNH.js";
|
|
413
|
+
import "./chunk-ZPJWUGCS.js";
|
|
393
414
|
import {
|
|
394
415
|
clearCachedCredentialFile,
|
|
395
416
|
qwenOAuth2Events
|
|
396
|
-
} from "./chunk-
|
|
397
|
-
import "./chunk-
|
|
398
|
-
import "./chunk-
|
|
399
|
-
import "./chunk-
|
|
400
|
-
import "./chunk-
|
|
401
|
-
import "./chunk-
|
|
417
|
+
} from "./chunk-D4HTUMGX.js";
|
|
418
|
+
import "./chunk-NAVJD2PQ.js";
|
|
419
|
+
import "./chunk-LOY7RWQG.js";
|
|
420
|
+
import "./chunk-E6CJ2SMM.js";
|
|
421
|
+
import "./chunk-DGEIYUC3.js";
|
|
422
|
+
import "./chunk-MPHPFVKK.js";
|
|
402
423
|
import "./chunk-GLNBDYUX.js";
|
|
403
424
|
import "./chunk-DJ2GSRLV.js";
|
|
404
|
-
import "./chunk-
|
|
425
|
+
import "./chunk-2YCYFWYZ.js";
|
|
405
426
|
import {
|
|
427
|
+
addToolArgumentsAttributes,
|
|
428
|
+
addToolCallResultAttributes,
|
|
406
429
|
extractDaemonTraceContext,
|
|
407
430
|
registerAcpEventLoopLagGauge,
|
|
408
431
|
startEventLoopLagMonitor,
|
|
409
432
|
withDaemonSpan
|
|
410
|
-
} from "./chunk-
|
|
411
|
-
import "./chunk-
|
|
433
|
+
} from "./chunk-Z3S5EMOW.js";
|
|
434
|
+
import "./chunk-2J3OJGTL.js";
|
|
412
435
|
import "./chunk-P3QQPMQA.js";
|
|
413
|
-
import "./chunk-
|
|
436
|
+
import "./chunk-XQK4XXTN.js";
|
|
414
437
|
import {
|
|
415
438
|
getToolCallPreparations
|
|
416
|
-
} from "./chunk-
|
|
439
|
+
} from "./chunk-GLCZKT5V.js";
|
|
440
|
+
import "./chunk-QDK4F2N5.js";
|
|
417
441
|
import {
|
|
418
442
|
ConversationFinishedEvent,
|
|
419
443
|
DiscoveredMCPTool,
|
|
@@ -427,6 +451,7 @@ import {
|
|
|
427
451
|
formatVisionBridgeNotice,
|
|
428
452
|
getAllGeminiMdFilenames,
|
|
429
453
|
getFullTurnVisionModelSelector,
|
|
454
|
+
getInvocationContext,
|
|
430
455
|
getMCPServerStatus,
|
|
431
456
|
getSpecificMimeType,
|
|
432
457
|
hasImageParts,
|
|
@@ -443,25 +468,30 @@ import {
|
|
|
443
468
|
shouldRunVisionBridge,
|
|
444
469
|
splitImageParts,
|
|
445
470
|
uiTelemetryService
|
|
446
|
-
} from "./chunk-
|
|
471
|
+
} from "./chunk-NVFSGPIF.js";
|
|
447
472
|
import "./chunk-VGC4I5JJ.js";
|
|
448
473
|
import {
|
|
449
474
|
getAutoMemoryRoot,
|
|
450
475
|
getUserAutoMemoryRoot
|
|
451
|
-
} from "./chunk-
|
|
476
|
+
} from "./chunk-3I6DUGQD.js";
|
|
477
|
+
import "./chunk-7ULQIS27.js";
|
|
452
478
|
import {
|
|
453
|
-
|
|
454
|
-
|
|
479
|
+
ToolConfirmationOutcome,
|
|
480
|
+
ToolNames,
|
|
481
|
+
isShellProgressData
|
|
482
|
+
} from "./chunk-MM7TH7ZM.js";
|
|
483
|
+
import {
|
|
484
|
+
AuthType,
|
|
485
|
+
preloadContentGenerator
|
|
486
|
+
} from "./chunk-DKPJUF5F.js";
|
|
455
487
|
import "./chunk-46UV252V.js";
|
|
456
|
-
import "./chunk-A4UCTEB5.js";
|
|
457
|
-
import "./chunk-XWRJCPHC.js";
|
|
458
488
|
import {
|
|
459
489
|
DEFAULT_TOKEN_LIMIT,
|
|
460
490
|
tokenLimit
|
|
461
|
-
} from "./chunk-
|
|
462
|
-
import "./chunk-
|
|
463
|
-
import "./chunk-
|
|
464
|
-
import "./chunk-
|
|
491
|
+
} from "./chunk-ZBVS26BY.js";
|
|
492
|
+
import "./chunk-Q3T5KA2V.js";
|
|
493
|
+
import "./chunk-R2XWGR75.js";
|
|
494
|
+
import "./chunk-HC45LTEN.js";
|
|
465
495
|
import {
|
|
466
496
|
endToolExecutionSpan,
|
|
467
497
|
endToolSpan,
|
|
@@ -470,32 +500,26 @@ import {
|
|
|
470
500
|
startToolExecutionSpan,
|
|
471
501
|
startToolSpan,
|
|
472
502
|
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";
|
|
503
|
+
} from "./chunk-QARJNL2V.js";
|
|
504
|
+
import "./chunk-W4RQUHY3.js";
|
|
505
|
+
import "./chunk-G7XXKQYS.js";
|
|
483
506
|
import {
|
|
484
507
|
Storage,
|
|
485
508
|
createDebugLogger,
|
|
486
509
|
getErrorMessage,
|
|
487
510
|
getErrorStatus,
|
|
488
511
|
isSubpath
|
|
489
|
-
} from "./chunk-
|
|
490
|
-
import "./chunk-
|
|
512
|
+
} from "./chunk-E2BHWIDT.js";
|
|
513
|
+
import "./chunk-VOQXFAY5.js";
|
|
514
|
+
import "./chunk-D7CQTWRS.js";
|
|
491
515
|
import {
|
|
492
516
|
runExitCleanup
|
|
493
|
-
} from "./chunk-
|
|
517
|
+
} from "./chunk-BP2H5K25.js";
|
|
494
518
|
import "./chunk-75DOP5OR.js";
|
|
495
519
|
import "./chunk-DMTGGOSA.js";
|
|
496
520
|
import "./chunk-YQ3U5MUC.js";
|
|
497
521
|
import "./chunk-AMDSOFFV.js";
|
|
498
|
-
import "./chunk-
|
|
522
|
+
import "./chunk-QUGAUQGJ.js";
|
|
499
523
|
import {
|
|
500
524
|
init_esbuild_shims
|
|
501
525
|
} from "./chunk-5O2XNYP6.js";
|
|
@@ -1949,6 +1973,7 @@ var DaemonTodoStopGuard = class {
|
|
|
1949
1973
|
// packages/cli/src/acp-integration/session/Session.ts
|
|
1950
1974
|
var debugLogger6 = createDebugLogger("SESSION");
|
|
1951
1975
|
var USER_CANCEL_ABORT_REASON = "qwen:user-cancel";
|
|
1976
|
+
var SESSION_DISPOSE_ABORT_REASON = "qwen:session-dispose";
|
|
1952
1977
|
var DAEMON_RETRY_META_KEY = "qwen.daemon.retry";
|
|
1953
1978
|
var DAEMON_CONTINUE_META_KEY = "qwen.daemon.continueLastTurn";
|
|
1954
1979
|
var TODO_STOP_GUARD_PROMPT_PREFIX = "[Todo Stop Guard] ";
|
|
@@ -2220,6 +2245,20 @@ function parseMidTurnDrainResponse(response) {
|
|
|
2220
2245
|
).map((message) => ({ kind: "text", message }));
|
|
2221
2246
|
}
|
|
2222
2247
|
__name(parseMidTurnDrainResponse, "parseMidTurnDrainResponse");
|
|
2248
|
+
function isValidMidTurnDrainResponse(response, requireQueuedPromptState) {
|
|
2249
|
+
if (!isRecord2(response) || requireQueuedPromptState && typeof response["hasQueuedPrompt"] !== "boolean") {
|
|
2250
|
+
return false;
|
|
2251
|
+
}
|
|
2252
|
+
if (Array.isArray(response["items"])) {
|
|
2253
|
+
return response["items"].every(
|
|
2254
|
+
(item) => isRecord2(item) && Array.isArray(item["content"]) && item["content"].length > 0 && item["content"].every(isContentBlock)
|
|
2255
|
+
);
|
|
2256
|
+
}
|
|
2257
|
+
return Array.isArray(response["messages"]) && response["messages"].every(
|
|
2258
|
+
(message) => typeof message === "string" && message.trim().length > 0
|
|
2259
|
+
);
|
|
2260
|
+
}
|
|
2261
|
+
__name(isValidMidTurnDrainResponse, "isValidMidTurnDrainResponse");
|
|
2223
2262
|
var MidTurnDrainTimeoutError = class extends Error {
|
|
2224
2263
|
static {
|
|
2225
2264
|
__name(this, "MidTurnDrainTimeoutError");
|
|
@@ -2230,6 +2269,16 @@ var MidTurnDrainTimeoutError = class extends Error {
|
|
|
2230
2269
|
);
|
|
2231
2270
|
}
|
|
2232
2271
|
};
|
|
2272
|
+
var TodoStopGuardClaimTimeoutError = class extends Error {
|
|
2273
|
+
static {
|
|
2274
|
+
__name(this, "TodoStopGuardClaimTimeoutError");
|
|
2275
|
+
}
|
|
2276
|
+
constructor() {
|
|
2277
|
+
super(
|
|
2278
|
+
`Todo Stop Guard continuation claim got no response within ${MID_TURN_QUEUE_DRAIN_TIMEOUT_MS}ms`
|
|
2279
|
+
);
|
|
2280
|
+
}
|
|
2281
|
+
};
|
|
2233
2282
|
function beginChannelDeliveryResponseBlock(capture) {
|
|
2234
2283
|
if (!capture) return void 0;
|
|
2235
2284
|
capture.finalText = "";
|
|
@@ -2486,12 +2535,7 @@ var Session = class {
|
|
|
2486
2535
|
this.runtimeBaseDir = config.storage.getRuntimeBaseDir();
|
|
2487
2536
|
const todoStopGuardEnabled = this.settings.merged.experimental?.todoStopGuard === true && !this.config.getBareMode() && !this.config.isSafeMode();
|
|
2488
2537
|
this.todoStopGuard = new DaemonTodoStopGuard(todoStopGuardEnabled);
|
|
2489
|
-
this.todoStopGuardBackgroundBaseline =
|
|
2490
|
-
agents: /* @__PURE__ */ new Set(),
|
|
2491
|
-
shells: /* @__PURE__ */ new Set(),
|
|
2492
|
-
monitors: /* @__PURE__ */ new Set(),
|
|
2493
|
-
wakeups: /* @__PURE__ */ new Set()
|
|
2494
|
-
};
|
|
2538
|
+
this.todoStopGuardBackgroundBaseline = this.#captureTodoStopGuardBackgroundBaseline();
|
|
2495
2539
|
this.toolCallEmitter = new ToolCallEmitter(this);
|
|
2496
2540
|
this.planEmitter = new PlanEmitter(this);
|
|
2497
2541
|
this.historyReplayer = new HistoryReplayer(this, {
|
|
@@ -2523,6 +2567,7 @@ var Session = class {
|
|
|
2523
2567
|
*/
|
|
2524
2568
|
followupAbort = null;
|
|
2525
2569
|
turn = 0;
|
|
2570
|
+
activeTodoWorkChainPromptId;
|
|
2526
2571
|
createdAt = Date.now();
|
|
2527
2572
|
/**
|
|
2528
2573
|
* Running cumulative usage for this session, snapshotted onto each todo/plan
|
|
@@ -2563,7 +2608,12 @@ var Session = class {
|
|
|
2563
2608
|
midTurnRecoveredMessages = [];
|
|
2564
2609
|
todoStopGuard;
|
|
2565
2610
|
todoStopGuardBackgroundBaseline;
|
|
2611
|
+
relatedAgentIds = /* @__PURE__ */ new Set();
|
|
2612
|
+
provisionalRelatedAgentCounts = /* @__PURE__ */ new Map();
|
|
2566
2613
|
todoStopGuardQueuedPromptPriority = false;
|
|
2614
|
+
todoStopGuardQueuedPromptOwnerPromptId;
|
|
2615
|
+
todoStopGuardClaimOwnerCounts = /* @__PURE__ */ new Map();
|
|
2616
|
+
todoStopGuardReleasedDuringClaim = /* @__PURE__ */ new Set();
|
|
2567
2617
|
todoStopGuardDrainAutomaticQueuesWhenIdle = false;
|
|
2568
2618
|
// Background notification drain state. ACP does not have the TUI's idle
|
|
2569
2619
|
// hook, so the session serializes registry callbacks through this queue.
|
|
@@ -2615,7 +2665,7 @@ var Session = class {
|
|
|
2615
2665
|
}
|
|
2616
2666
|
const drainSupersededAutomaticQueues = this.todoStopGuard.blocksUnrelatedAutomaticTurns || this.todoStopGuard.hasCommittedContinuation || this.todoStopGuardQueuedPromptPriority;
|
|
2617
2667
|
if (this.config.getApprovalMode() === "plan" /* PLAN */) {
|
|
2618
|
-
this
|
|
2668
|
+
this.#clearTodoStopGuardQueuedPromptWait();
|
|
2619
2669
|
this.todoStopGuard.blockUntilOrdinaryPromptStarts();
|
|
2620
2670
|
return {
|
|
2621
2671
|
startsWorkChain: false,
|
|
@@ -2626,7 +2676,7 @@ var Session = class {
|
|
|
2626
2676
|
const isRetry = params.retry === true || metadata?.[DAEMON_RETRY_META_KEY] === true;
|
|
2627
2677
|
const isContinue = metadata?.[DAEMON_CONTINUE_META_KEY] === true;
|
|
2628
2678
|
if (isRetry || isContinue) {
|
|
2629
|
-
this
|
|
2679
|
+
this.#clearTodoStopGuardQueuedPromptWait();
|
|
2630
2680
|
if (this.todoStopGuard.hasTrustedUnfinishedState) {
|
|
2631
2681
|
this.todoStopGuard.resumeTrustedPrompt();
|
|
2632
2682
|
return {
|
|
@@ -2640,7 +2690,7 @@ var Session = class {
|
|
|
2640
2690
|
drainSupersededAutomaticQueues
|
|
2641
2691
|
};
|
|
2642
2692
|
}
|
|
2643
|
-
this
|
|
2693
|
+
this.#clearTodoStopGuardQueuedPromptWait();
|
|
2644
2694
|
this.todoStopGuard.blockUntilOrdinaryPromptStarts();
|
|
2645
2695
|
return {
|
|
2646
2696
|
startsWorkChain: true,
|
|
@@ -2653,7 +2703,7 @@ var Session = class {
|
|
|
2653
2703
|
this.todoStopGuard.blockUntilOrdinaryPromptStarts();
|
|
2654
2704
|
return;
|
|
2655
2705
|
}
|
|
2656
|
-
if (
|
|
2706
|
+
if (this.todoStopGuard.isHardSuspended) {
|
|
2657
2707
|
return;
|
|
2658
2708
|
}
|
|
2659
2709
|
if (continuesCurrentWorkChain && this.todoStopGuard.hasTrustedUnfinishedState) {
|
|
@@ -2661,7 +2711,7 @@ var Session = class {
|
|
|
2661
2711
|
return;
|
|
2662
2712
|
}
|
|
2663
2713
|
this.todoStopGuard.clearTrust();
|
|
2664
|
-
this
|
|
2714
|
+
this.#resetTodoStopGuardBackgroundLineage();
|
|
2665
2715
|
}
|
|
2666
2716
|
#clearTodoStopGuardTrustAndDrainAutomaticQueues() {
|
|
2667
2717
|
const preserveQueuedPromptPriority = this.todoStopGuardQueuedPromptPriority;
|
|
@@ -2675,35 +2725,116 @@ var Session = class {
|
|
|
2675
2725
|
void this.#drainCronQueue();
|
|
2676
2726
|
void this.#drainNotificationQueue();
|
|
2677
2727
|
}
|
|
2678
|
-
releaseTodoStopGuardQueuedPromptWait() {
|
|
2679
|
-
|
|
2680
|
-
|
|
2728
|
+
releaseTodoStopGuardQueuedPromptWait(promptId) {
|
|
2729
|
+
const matchesCurrentWait = this.todoStopGuardQueuedPromptPriority && this.todoStopGuardQueuedPromptOwnerPromptId === promptId;
|
|
2730
|
+
if (!matchesCurrentWait) {
|
|
2731
|
+
if ((this.todoStopGuardClaimOwnerCounts.get(promptId) ?? 0) === 0) {
|
|
2732
|
+
return false;
|
|
2733
|
+
}
|
|
2734
|
+
this.todoStopGuardReleasedDuringClaim.add(promptId);
|
|
2735
|
+
if (!this.todoStopGuardQueuedPromptPriority) {
|
|
2736
|
+
this.#finishTodoStopGuardQueuedPromptRelease();
|
|
2737
|
+
}
|
|
2738
|
+
return true;
|
|
2739
|
+
}
|
|
2740
|
+
this.#clearTodoStopGuardQueuedPromptWait(promptId);
|
|
2741
|
+
this.#finishTodoStopGuardQueuedPromptRelease();
|
|
2742
|
+
return true;
|
|
2743
|
+
}
|
|
2744
|
+
#finishTodoStopGuardQueuedPromptRelease() {
|
|
2681
2745
|
this.todoStopGuard.blockUntilOrdinaryPromptStarts();
|
|
2682
2746
|
if (this.pendingPrompt) {
|
|
2683
2747
|
this.todoStopGuardDrainAutomaticQueuesWhenIdle = true;
|
|
2684
|
-
return
|
|
2748
|
+
return;
|
|
2685
2749
|
}
|
|
2686
2750
|
void this.#drainCronQueue();
|
|
2687
2751
|
void this.#drainNotificationQueue();
|
|
2688
|
-
return true;
|
|
2689
2752
|
}
|
|
2690
2753
|
clearTodoStopGuardTrust() {
|
|
2691
2754
|
this.#clearTodoStopGuardTrustAndDrainAutomaticQueues();
|
|
2692
2755
|
}
|
|
2693
|
-
|
|
2694
|
-
this
|
|
2756
|
+
hardSuspendTodoStopGuard() {
|
|
2757
|
+
this.#clearTodoStopGuardQueuedPromptWait();
|
|
2758
|
+
this.todoStopGuardDrainAutomaticQueuesWhenIdle = false;
|
|
2759
|
+
this.todoStopGuard.blockUntilOrdinaryPromptStarts();
|
|
2695
2760
|
}
|
|
2696
|
-
#
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2761
|
+
#clearTodoStopGuardQueuedPromptWait(expectedOwner) {
|
|
2762
|
+
if (expectedOwner !== void 0 && this.todoStopGuardQueuedPromptOwnerPromptId !== expectedOwner) {
|
|
2763
|
+
return;
|
|
2764
|
+
}
|
|
2765
|
+
this.todoStopGuardQueuedPromptPriority = false;
|
|
2766
|
+
this.todoStopGuardQueuedPromptOwnerPromptId = void 0;
|
|
2767
|
+
}
|
|
2768
|
+
#awaitTodoStopGuardQueuedPrompt(promptId) {
|
|
2769
|
+
this.todoStopGuard.awaitQueuedPrompt();
|
|
2770
|
+
this.todoStopGuardQueuedPromptPriority = true;
|
|
2771
|
+
this.todoStopGuardQueuedPromptOwnerPromptId = promptId;
|
|
2772
|
+
}
|
|
2773
|
+
async #claimTodoStopGuardContinuation(abortSignal) {
|
|
2774
|
+
const context = getInvocationContext();
|
|
2775
|
+
const ownerPromptId = context?.sessionId === this.sessionId ? context.promptId : void 0;
|
|
2776
|
+
if (ownerPromptId) {
|
|
2777
|
+
this.todoStopGuardClaimOwnerCounts.set(
|
|
2778
|
+
ownerPromptId,
|
|
2779
|
+
(this.todoStopGuardClaimOwnerCounts.get(ownerPromptId) ?? 0) + 1
|
|
2780
|
+
);
|
|
2781
|
+
}
|
|
2782
|
+
let timeoutHandle;
|
|
2783
|
+
try {
|
|
2784
|
+
const claimPromise = this.client.extMethod(
|
|
2785
|
+
TODO_STOP_GUARD_CONTINUATION_CLAIM_METHOD,
|
|
2786
|
+
{
|
|
2787
|
+
sessionId: this.sessionId,
|
|
2788
|
+
...ownerPromptId ? { promptId: ownerPromptId } : {}
|
|
2789
|
+
}
|
|
2790
|
+
);
|
|
2791
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
2792
|
+
timeoutHandle = setTimeout(
|
|
2793
|
+
() => reject(new TodoStopGuardClaimTimeoutError()),
|
|
2794
|
+
MID_TURN_QUEUE_DRAIN_TIMEOUT_MS
|
|
2795
|
+
);
|
|
2796
|
+
});
|
|
2797
|
+
const response = await Promise.race([claimPromise, timeoutPromise]);
|
|
2798
|
+
if (abortSignal.aborted || !isRecord2(response)) {
|
|
2799
|
+
return "unavailable";
|
|
2800
|
+
}
|
|
2801
|
+
if (ownerPromptId && response["claimed"] === false && response["hasQueuedPrompt"] === true) {
|
|
2802
|
+
if (this.closing || this.disposed) return "unavailable";
|
|
2803
|
+
if (this.todoStopGuardReleasedDuringClaim.has(ownerPromptId)) {
|
|
2804
|
+
return "unavailable";
|
|
2805
|
+
}
|
|
2806
|
+
this.#awaitTodoStopGuardQueuedPrompt(ownerPromptId);
|
|
2807
|
+
return "queued";
|
|
2808
|
+
}
|
|
2809
|
+
if (this.todoStopGuard.isHardSuspended) return "unavailable";
|
|
2810
|
+
if (response["claimed"] === true && response["hasQueuedPrompt"] === false) {
|
|
2811
|
+
if (ownerPromptId) {
|
|
2812
|
+
this.#clearTodoStopGuardQueuedPromptWait(ownerPromptId);
|
|
2813
|
+
}
|
|
2814
|
+
this.todoStopGuard.resumeTrustedPrompt();
|
|
2815
|
+
return "claimed";
|
|
2816
|
+
}
|
|
2817
|
+
return "unavailable";
|
|
2818
|
+
} catch (error) {
|
|
2819
|
+
debugLogger6.warn(
|
|
2820
|
+
`Todo Stop Guard continuation claim unavailable [session ${this.sessionId}]: ${this.#formatError(error)}`
|
|
2821
|
+
);
|
|
2822
|
+
return "unavailable";
|
|
2823
|
+
} finally {
|
|
2824
|
+
clearTimeout(timeoutHandle);
|
|
2825
|
+
if (ownerPromptId) {
|
|
2826
|
+
const remaining = (this.todoStopGuardClaimOwnerCounts.get(ownerPromptId) ?? 1) - 1;
|
|
2827
|
+
if (remaining > 0) {
|
|
2828
|
+
this.todoStopGuardClaimOwnerCounts.set(ownerPromptId, remaining);
|
|
2829
|
+
} else {
|
|
2830
|
+
this.todoStopGuardClaimOwnerCounts.delete(ownerPromptId);
|
|
2831
|
+
this.todoStopGuardReleasedDuringClaim.delete(ownerPromptId);
|
|
2832
|
+
}
|
|
2833
|
+
}
|
|
2834
|
+
}
|
|
2701
2835
|
}
|
|
2702
2836
|
#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);
|
|
2837
|
+
return item.continuesTodoStopGuardWorkChain;
|
|
2707
2838
|
}
|
|
2708
2839
|
#cronContinuesTodoStopGuardWorkChain(item) {
|
|
2709
2840
|
return item.source === "loop" && item.taskId !== void 0 && !this.todoStopGuardBackgroundBaseline.wakeups.has(item.taskId);
|
|
@@ -2736,6 +2867,37 @@ var Session = class {
|
|
|
2736
2867
|
])
|
|
2737
2868
|
};
|
|
2738
2869
|
}
|
|
2870
|
+
#resetTodoStopGuardBackgroundLineage() {
|
|
2871
|
+
this.relatedAgentIds.clear();
|
|
2872
|
+
this.provisionalRelatedAgentCounts.clear();
|
|
2873
|
+
this.todoStopGuardBackgroundBaseline = this.#captureTodoStopGuardBackgroundBaseline();
|
|
2874
|
+
for (const item of this.notificationQueue) {
|
|
2875
|
+
item.continuesTodoStopGuardWorkChain = false;
|
|
2876
|
+
}
|
|
2877
|
+
}
|
|
2878
|
+
#agentContinuesTodoStopGuardWorkChain(taskId, visiting = /* @__PURE__ */ new Set()) {
|
|
2879
|
+
if (this.relatedAgentIds.has(taskId) || (this.provisionalRelatedAgentCounts.get(taskId) ?? 0) > 0) {
|
|
2880
|
+
return true;
|
|
2881
|
+
}
|
|
2882
|
+
if (this.todoStopGuardBackgroundBaseline.agents.has(taskId)) return false;
|
|
2883
|
+
if (visiting.has(taskId)) return false;
|
|
2884
|
+
const task = this.config.getBackgroundTaskRegistry?.()?.get?.(taskId);
|
|
2885
|
+
if (!task) return false;
|
|
2886
|
+
if (!task.parentAgentId) return true;
|
|
2887
|
+
visiting.add(taskId);
|
|
2888
|
+
const related = this.#agentContinuesTodoStopGuardWorkChain(
|
|
2889
|
+
task.parentAgentId,
|
|
2890
|
+
visiting
|
|
2891
|
+
);
|
|
2892
|
+
visiting.delete(taskId);
|
|
2893
|
+
return related;
|
|
2894
|
+
}
|
|
2895
|
+
#monitorContinuesTodoStopGuardWorkChain(monitorId, ownerAgentId) {
|
|
2896
|
+
if (ownerAgentId) {
|
|
2897
|
+
return this.#agentContinuesTodoStopGuardWorkChain(ownerAgentId);
|
|
2898
|
+
}
|
|
2899
|
+
return !this.todoStopGuardBackgroundBaseline.monitors.has(monitorId);
|
|
2900
|
+
}
|
|
2739
2901
|
#hasRelevantTodoStopGuardBackgroundInput() {
|
|
2740
2902
|
if (this.notificationQueue.some(
|
|
2741
2903
|
(item) => this.#notificationContinuesTodoStopGuardWorkChain(item)
|
|
@@ -2747,7 +2909,7 @@ var Session = class {
|
|
|
2747
2909
|
const baseline = this.todoStopGuardBackgroundBaseline;
|
|
2748
2910
|
const agents = this.config.getBackgroundTaskRegistry?.()?.getAll?.() ?? [];
|
|
2749
2911
|
if (agents.some(
|
|
2750
|
-
(task) =>
|
|
2912
|
+
(task) => this.#agentContinuesTodoStopGuardWorkChain(task.id) && task.isBackgrounded && (task.status === "running" || task.status === "paused" || task.status === "cancelled" && !task.notified)
|
|
2751
2913
|
)) {
|
|
2752
2914
|
return true;
|
|
2753
2915
|
}
|
|
@@ -2759,7 +2921,10 @@ var Session = class {
|
|
|
2759
2921
|
}
|
|
2760
2922
|
const monitors = this.config.getMonitorRegistry?.()?.getAll?.() ?? [];
|
|
2761
2923
|
if (monitors.some(
|
|
2762
|
-
(task) =>
|
|
2924
|
+
(task) => this.#monitorContinuesTodoStopGuardWorkChain(
|
|
2925
|
+
task.id,
|
|
2926
|
+
task.ownerAgentId
|
|
2927
|
+
) && task.status === "running"
|
|
2763
2928
|
)) {
|
|
2764
2929
|
return true;
|
|
2765
2930
|
}
|
|
@@ -2890,12 +3055,19 @@ var Session = class {
|
|
|
2890
3055
|
return this.closeGateCompletion ?? Promise.resolve();
|
|
2891
3056
|
}
|
|
2892
3057
|
async waitForActiveTurnsToSettle() {
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
3058
|
+
while (this.#hasActiveTurn()) {
|
|
3059
|
+
const pending = [
|
|
3060
|
+
this.pendingPromptCompletion,
|
|
3061
|
+
this.cronCompletion,
|
|
3062
|
+
this.notificationCompletion
|
|
3063
|
+
].filter(
|
|
3064
|
+
(completion) => completion !== null
|
|
3065
|
+
);
|
|
3066
|
+
if (pending.length > 0) {
|
|
3067
|
+
await Promise.allSettled(pending);
|
|
3068
|
+
}
|
|
3069
|
+
await new Promise((resolve5) => setImmediate(resolve5));
|
|
3070
|
+
}
|
|
2899
3071
|
}
|
|
2900
3072
|
#deferAutomaticQueueDrainUntilTurnsSettle() {
|
|
2901
3073
|
const completions = [
|
|
@@ -2924,12 +3096,12 @@ var Session = class {
|
|
|
2924
3096
|
dispose() {
|
|
2925
3097
|
this.disposed = true;
|
|
2926
3098
|
this.closing = true;
|
|
3099
|
+
this.pendingPrompt?.abort(SESSION_DISPOSE_ABORT_REASON);
|
|
3100
|
+
this.pendingPrompt = null;
|
|
2927
3101
|
this.resolveCloseGate?.();
|
|
2928
3102
|
this.resolveCloseGate = null;
|
|
2929
3103
|
this.closeGateCompletion = null;
|
|
2930
|
-
this.
|
|
2931
|
-
this.todoStopGuardDrainAutomaticQueuesWhenIdle = false;
|
|
2932
|
-
this.todoStopGuard.clearTrust();
|
|
3104
|
+
this.hardSuspendTodoStopGuard();
|
|
2933
3105
|
this.notificationQueue = [];
|
|
2934
3106
|
this.cronQueue = [];
|
|
2935
3107
|
this.notificationAbortController?.abort();
|
|
@@ -3170,6 +3342,9 @@ var Session = class {
|
|
|
3170
3342
|
throw RequestError.invalidParams(void 0, "Session is closing");
|
|
3171
3343
|
}
|
|
3172
3344
|
await this.assertCanStartTurn();
|
|
3345
|
+
if (this.closing) {
|
|
3346
|
+
throw RequestError.invalidParams(void 0, "Session is closing");
|
|
3347
|
+
}
|
|
3173
3348
|
if (admissionCancellation?.aborted) {
|
|
3174
3349
|
return { stopReason: "cancelled" };
|
|
3175
3350
|
}
|
|
@@ -3231,9 +3406,9 @@ var Session = class {
|
|
|
3231
3406
|
return { stopReason: "cancelled" };
|
|
3232
3407
|
}
|
|
3233
3408
|
if (todoStopGuardPreparation.startsWorkChain) {
|
|
3234
|
-
this
|
|
3409
|
+
this.#clearTodoStopGuardQueuedPromptWait();
|
|
3235
3410
|
this.todoStopGuard.startOrdinaryPrompt();
|
|
3236
|
-
this
|
|
3411
|
+
this.#resetTodoStopGuardBackgroundLineage();
|
|
3237
3412
|
}
|
|
3238
3413
|
this.duplicateProviderToolCallResponseIds.clear();
|
|
3239
3414
|
const channelDelivery = parsePromptChannelDelivery(params);
|
|
@@ -3274,9 +3449,12 @@ var Session = class {
|
|
|
3274
3449
|
}
|
|
3275
3450
|
throw error;
|
|
3276
3451
|
} finally {
|
|
3452
|
+
const stillOwnsPendingPrompt = this.pendingPrompt === pendingSend;
|
|
3277
3453
|
releasePendingSend();
|
|
3278
3454
|
const shouldDrainAutomaticQueues = todoStopGuardPreparation.drainSupersededAutomaticQueues || this.todoStopGuardDrainAutomaticQueuesWhenIdle || this.todoStopGuard.blocksUnrelatedAutomaticTurns || this.todoStopGuard.hasCommittedContinuation || this.todoStopGuardQueuedPromptPriority;
|
|
3279
|
-
|
|
3455
|
+
if (stillOwnsPendingPrompt) {
|
|
3456
|
+
this.todoStopGuardDrainAutomaticQueuesWhenIdle = false;
|
|
3457
|
+
}
|
|
3280
3458
|
if (shouldDrainAutomaticQueues) {
|
|
3281
3459
|
void this.#drainCronQueue();
|
|
3282
3460
|
void this.#drainNotificationQueue();
|
|
@@ -3431,6 +3609,9 @@ var Session = class {
|
|
|
3431
3609
|
}
|
|
3432
3610
|
this.turn += 1;
|
|
3433
3611
|
const promptId = this.config.getSessionId() + "########" + this.turn;
|
|
3612
|
+
const promptMetadata = params._meta;
|
|
3613
|
+
const continuesCurrentWorkChain = params.retry === true || promptMetadata?.[DAEMON_RETRY_META_KEY] === true || promptMetadata?.[DAEMON_CONTINUE_META_KEY] === true;
|
|
3614
|
+
promptIdContext.enterWith(promptId);
|
|
3434
3615
|
const parentContext = extractDaemonTraceContext(params);
|
|
3435
3616
|
return await withInteractionSpan(
|
|
3436
3617
|
this.config,
|
|
@@ -3496,6 +3677,9 @@ var Session = class {
|
|
|
3496
3677
|
let parts;
|
|
3497
3678
|
let fullTurnModelOverride;
|
|
3498
3679
|
const onFullTurnModel = /* @__PURE__ */ __name((model) => {
|
|
3680
|
+
if (fullTurnModelOverride === model) {
|
|
3681
|
+
return true;
|
|
3682
|
+
}
|
|
3499
3683
|
if (fullTurnModelOverride) {
|
|
3500
3684
|
return false;
|
|
3501
3685
|
}
|
|
@@ -3551,9 +3735,20 @@ var Session = class {
|
|
|
3551
3735
|
}
|
|
3552
3736
|
const additionalContext = hookOutput?.getAdditionalContext();
|
|
3553
3737
|
if (additionalContext) {
|
|
3554
|
-
parts = [
|
|
3738
|
+
parts = [
|
|
3739
|
+
...parts,
|
|
3740
|
+
{ text: wrapUserPromptSubmitContext(additionalContext) }
|
|
3741
|
+
];
|
|
3555
3742
|
}
|
|
3556
3743
|
}
|
|
3744
|
+
if (!continuesCurrentWorkChain && !this.todoStopGuard.enabled) {
|
|
3745
|
+
this.#resetTodoStopGuardBackgroundLineage();
|
|
3746
|
+
}
|
|
3747
|
+
this.config.startActiveTodoWorkChain(
|
|
3748
|
+
promptId,
|
|
3749
|
+
continuesCurrentWorkChain ? this.activeTodoWorkChainPromptId : void 0
|
|
3750
|
+
);
|
|
3751
|
+
this.activeTodoWorkChainPromptId = promptId;
|
|
3557
3752
|
try {
|
|
3558
3753
|
const fileHistoryService = this.config.getFileHistoryService();
|
|
3559
3754
|
await fileHistoryService.makeSnapshot(promptId);
|
|
@@ -3599,6 +3794,15 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
3599
3794
|
parts = insertAfterFunctionResponses(parts, [noticePart]);
|
|
3600
3795
|
this.pendingRecoveredAgentsNotice = null;
|
|
3601
3796
|
}
|
|
3797
|
+
const activeTodoReminder = this.config.takeActiveTodoReminder(
|
|
3798
|
+
promptId,
|
|
3799
|
+
true
|
|
3800
|
+
);
|
|
3801
|
+
if (activeTodoReminder && !parts.some((part) => part.text === activeTodoReminder)) {
|
|
3802
|
+
parts = insertAfterFunctionResponses(parts, [
|
|
3803
|
+
{ text: activeTodoReminder }
|
|
3804
|
+
]);
|
|
3805
|
+
}
|
|
3602
3806
|
let nextMessage = { role: "user", parts };
|
|
3603
3807
|
let turnCount = 0;
|
|
3604
3808
|
const toolLoopState = createDaemonToolLoopState();
|
|
@@ -3704,7 +3908,8 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
3704
3908
|
}
|
|
3705
3909
|
strippedOrphanEntries = null;
|
|
3706
3910
|
}
|
|
3707
|
-
|
|
3911
|
+
const isControlledCancellation = pendingSend.signal.aborted && (pendingSend.signal.reason === USER_CANCEL_ABORT_REASON || pendingSend.signal.reason === SESSION_DISPOSE_ABORT_REASON);
|
|
3912
|
+
if (isControlledCancellation) {
|
|
3708
3913
|
this.todoStopGuard.suspend();
|
|
3709
3914
|
return { stopReason: "cancelled" };
|
|
3710
3915
|
}
|
|
@@ -3756,7 +3961,8 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
3756
3961
|
pendingSend.signal,
|
|
3757
3962
|
promptId,
|
|
3758
3963
|
functionCalls,
|
|
3759
|
-
toolLoopState
|
|
3964
|
+
toolLoopState,
|
|
3965
|
+
onFullTurnModel
|
|
3760
3966
|
)
|
|
3761
3967
|
);
|
|
3762
3968
|
if (toolRun.stopAfterPermissionCancel) {
|
|
@@ -3774,6 +3980,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
3774
3980
|
const nextAfterTools = await this.#buildNextMessageAfterToolRun(
|
|
3775
3981
|
toolRun,
|
|
3776
3982
|
pendingSend.signal,
|
|
3983
|
+
promptId,
|
|
3777
3984
|
onFullTurnModel
|
|
3778
3985
|
);
|
|
3779
3986
|
nextMessage = nextAfterTools.message;
|
|
@@ -3811,6 +4018,11 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
3811
4018
|
turnCount
|
|
3812
4019
|
)
|
|
3813
4020
|
);
|
|
4021
|
+
cleanupReviewWorktreeLeases({
|
|
4022
|
+
sessionId: this.config.getSessionId(),
|
|
4023
|
+
promptId,
|
|
4024
|
+
repositoryRoot: this.config.getProjectRoot()
|
|
4025
|
+
});
|
|
3814
4026
|
}
|
|
3815
4027
|
},
|
|
3816
4028
|
(result) => result.stopReason === "cancelled" ? "cancelled" : "ok"
|
|
@@ -3823,6 +4035,9 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
3823
4035
|
let stopHookIterationCount = 0;
|
|
3824
4036
|
let stopHookReasons = [];
|
|
3825
4037
|
const onFullTurnModel = /* @__PURE__ */ __name((model) => {
|
|
4038
|
+
if (modelOverride === model) {
|
|
4039
|
+
return true;
|
|
4040
|
+
}
|
|
3826
4041
|
if (modelOverride) {
|
|
3827
4042
|
return false;
|
|
3828
4043
|
}
|
|
@@ -3831,6 +4046,9 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
3831
4046
|
}, "onFullTurnModel");
|
|
3832
4047
|
let midTurnContinuationCount = 0;
|
|
3833
4048
|
while (true) {
|
|
4049
|
+
if (this.pendingPrompt && this.pendingPrompt !== pendingSend) {
|
|
4050
|
+
return { stopReason: "cancelled" };
|
|
4051
|
+
}
|
|
3834
4052
|
if (pendingSend.signal.aborted) {
|
|
3835
4053
|
this.todoStopGuard.suspend();
|
|
3836
4054
|
return { stopReason: "cancelled" };
|
|
@@ -3842,15 +4060,26 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
3842
4060
|
return { stopReason: "end_turn" };
|
|
3843
4061
|
}
|
|
3844
4062
|
if (this.todoStopGuard.needsStopInspection) {
|
|
3845
|
-
this.#beginTodoStopGuardQueuedPromptCheck();
|
|
3846
4063
|
const drained = await this.#drainMidTurnInput(pendingSend.signal, {
|
|
3847
4064
|
watchQueuedPromptForTodoStopGuard: true,
|
|
3848
4065
|
onFullTurnModel
|
|
3849
4066
|
});
|
|
3850
|
-
const waitsForQueuedPrompt = this.#finishTodoStopGuardQueuedPromptCheck(
|
|
3851
|
-
drained.hasQueuedPrompt
|
|
3852
|
-
);
|
|
3853
4067
|
if (drained.parts.length > 0) {
|
|
4068
|
+
if (drained.hasQueuedPrompt) {
|
|
4069
|
+
const claim = await this.#claimTodoStopGuardContinuation(
|
|
4070
|
+
pendingSend.signal
|
|
4071
|
+
);
|
|
4072
|
+
if (claim === "queued") {
|
|
4073
|
+
this.#preserveUnsentMessageHistory(
|
|
4074
|
+
{ role: "user", parts: drained.parts },
|
|
4075
|
+
true
|
|
4076
|
+
);
|
|
4077
|
+
return { stopReason: "end_turn" };
|
|
4078
|
+
}
|
|
4079
|
+
if (claim === "unavailable") {
|
|
4080
|
+
this.todoStopGuard.blockUntilOrdinaryPromptStarts();
|
|
4081
|
+
}
|
|
4082
|
+
}
|
|
3854
4083
|
this.todoStopGuard.acceptMidTurnUserInput();
|
|
3855
4084
|
const continuation2 = await this.#runStopContinuation(
|
|
3856
4085
|
pendingSend,
|
|
@@ -3869,13 +4098,22 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
3869
4098
|
}
|
|
3870
4099
|
continue;
|
|
3871
4100
|
}
|
|
3872
|
-
if (
|
|
3873
|
-
|
|
4101
|
+
if (!drained.reliable) {
|
|
4102
|
+
this.todoStopGuard.blockUntilOrdinaryPromptStarts();
|
|
4103
|
+
} else if (drained.hasQueuedPrompt) {
|
|
4104
|
+
const claim = await this.#claimTodoStopGuardContinuation(
|
|
4105
|
+
pendingSend.signal
|
|
4106
|
+
);
|
|
4107
|
+
if (claim === "queued") {
|
|
4108
|
+
return { stopReason: "end_turn" };
|
|
4109
|
+
}
|
|
4110
|
+
if (claim === "unavailable") {
|
|
4111
|
+
this.todoStopGuard.blockUntilOrdinaryPromptStarts();
|
|
4112
|
+
}
|
|
3874
4113
|
}
|
|
3875
4114
|
}
|
|
3876
4115
|
let externalReason = null;
|
|
3877
4116
|
let stopHookCount = 1;
|
|
3878
|
-
let queuedPromptArrivedDuringStopHook = false;
|
|
3879
4117
|
if (allowExternalHooks && hooksEnabled && messageBus && stopHookIterationCount < stopHookBlockingCap && this.config.hasHooksForEvent?.("Stop")) {
|
|
3880
4118
|
const responseText = this.#getCurrentChat().getLastModelMessageText?.() || "[no response text]";
|
|
3881
4119
|
const contextUsage = buildContextUsage(
|
|
@@ -3906,14 +4144,26 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
3906
4144
|
return { stopReason: "cancelled" };
|
|
3907
4145
|
}
|
|
3908
4146
|
if (this.todoStopGuard.needsStopInspection) {
|
|
3909
|
-
this.#beginTodoStopGuardQueuedPromptCheck();
|
|
3910
4147
|
const drained = await this.#drainMidTurnInput(pendingSend.signal, {
|
|
3911
4148
|
watchQueuedPromptForTodoStopGuard: true,
|
|
3912
4149
|
onFullTurnModel
|
|
3913
4150
|
});
|
|
3914
|
-
const waitsForQueuedPrompt = this.#finishTodoStopGuardQueuedPromptCheck(drained.hasQueuedPrompt);
|
|
3915
|
-
queuedPromptArrivedDuringStopHook = waitsForQueuedPrompt;
|
|
3916
4151
|
if (drained.parts.length > 0) {
|
|
4152
|
+
if (drained.hasQueuedPrompt) {
|
|
4153
|
+
const claim = await this.#claimTodoStopGuardContinuation(
|
|
4154
|
+
pendingSend.signal
|
|
4155
|
+
);
|
|
4156
|
+
if (claim === "queued") {
|
|
4157
|
+
this.#preserveUnsentMessageHistory(
|
|
4158
|
+
{ role: "user", parts: drained.parts },
|
|
4159
|
+
true
|
|
4160
|
+
);
|
|
4161
|
+
return { stopReason: "end_turn" };
|
|
4162
|
+
}
|
|
4163
|
+
if (claim === "unavailable") {
|
|
4164
|
+
this.todoStopGuard.blockUntilOrdinaryPromptStarts();
|
|
4165
|
+
}
|
|
4166
|
+
}
|
|
3917
4167
|
this.todoStopGuard.acceptMidTurnUserInput();
|
|
3918
4168
|
const continuation2 = await this.#runStopContinuation(
|
|
3919
4169
|
pendingSend,
|
|
@@ -3930,6 +4180,20 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
3930
4180
|
if (continuation2.kind === "terminal") {
|
|
3931
4181
|
return { stopReason: continuation2.stopReason };
|
|
3932
4182
|
}
|
|
4183
|
+
continue;
|
|
4184
|
+
}
|
|
4185
|
+
if (!drained.reliable) {
|
|
4186
|
+
this.todoStopGuard.blockUntilOrdinaryPromptStarts();
|
|
4187
|
+
} else if (drained.hasQueuedPrompt) {
|
|
4188
|
+
const claim = await this.#claimTodoStopGuardContinuation(
|
|
4189
|
+
pendingSend.signal
|
|
4190
|
+
);
|
|
4191
|
+
if (claim === "queued") {
|
|
4192
|
+
return { stopReason: "end_turn" };
|
|
4193
|
+
}
|
|
4194
|
+
if (claim === "unavailable") {
|
|
4195
|
+
this.todoStopGuard.blockUntilOrdinaryPromptStarts();
|
|
4196
|
+
}
|
|
3933
4197
|
}
|
|
3934
4198
|
}
|
|
3935
4199
|
const hookOutput = response.output ? createHookOutput("Stop", response.output) : void 0;
|
|
@@ -3942,9 +4206,13 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
3942
4206
|
stopHookIterationCount++;
|
|
3943
4207
|
stopHookReasons = [...stopHookReasons, externalReason];
|
|
3944
4208
|
stopHookCount = response.stopHookCount ?? 1;
|
|
4209
|
+
} else {
|
|
4210
|
+
stopHookIterationCount = 0;
|
|
4211
|
+
stopHookReasons = [];
|
|
4212
|
+
stopHookCount = 1;
|
|
3945
4213
|
}
|
|
3946
4214
|
}
|
|
3947
|
-
const guardDecision =
|
|
4215
|
+
const guardDecision = this.todoStopGuard.decide(
|
|
3948
4216
|
this.todoStopGuard.needsStopInspection ? this.#hasRelevantTodoStopGuardBackgroundInput() : false
|
|
3949
4217
|
);
|
|
3950
4218
|
const guardContinuation = guardDecision?.kind === "continue" ? guardDecision : null;
|
|
@@ -3967,9 +4235,6 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
3967
4235
|
debugLogger6.warn(warning);
|
|
3968
4236
|
return { stopReason: "end_turn" };
|
|
3969
4237
|
}
|
|
3970
|
-
if (queuedPromptArrivedDuringStopHook) {
|
|
3971
|
-
return { stopReason: "end_turn" };
|
|
3972
|
-
}
|
|
3973
4238
|
if (!externalReason && !guardContinuation) {
|
|
3974
4239
|
return { stopReason: "end_turn" };
|
|
3975
4240
|
}
|
|
@@ -4025,8 +4290,27 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4025
4290
|
let initialSend = true;
|
|
4026
4291
|
let automaticContinuationValidated = false;
|
|
4027
4292
|
let supersededAutomaticContinuation = false;
|
|
4293
|
+
const preservePendingMessage = /* @__PURE__ */ __name((message) => {
|
|
4294
|
+
if (initialSend) return;
|
|
4295
|
+
const preservedParts = (message.parts ?? []).filter(
|
|
4296
|
+
(part) => !("text" in part && isTodoStopGuardPromptText(part.text))
|
|
4297
|
+
);
|
|
4298
|
+
this.#preserveUnsentMessageHistory(
|
|
4299
|
+
preservedParts.length > 0 ? { ...message, parts: preservedParts } : null,
|
|
4300
|
+
true
|
|
4301
|
+
);
|
|
4302
|
+
}, "preservePendingMessage");
|
|
4028
4303
|
while (nextMessage !== null) {
|
|
4304
|
+
if (this.pendingPrompt && this.pendingPrompt !== pendingSend) {
|
|
4305
|
+
preservePendingMessage(nextMessage);
|
|
4306
|
+
return {
|
|
4307
|
+
kind: "terminal",
|
|
4308
|
+
stopReason: "cancelled",
|
|
4309
|
+
...supersededAutomaticContinuation ? { supersededAutomaticContinuation: true } : {}
|
|
4310
|
+
};
|
|
4311
|
+
}
|
|
4029
4312
|
if (pendingSend.signal.aborted) {
|
|
4313
|
+
preservePendingMessage(nextMessage);
|
|
4030
4314
|
this.todoStopGuard.suspend();
|
|
4031
4315
|
return {
|
|
4032
4316
|
kind: "terminal",
|
|
@@ -4044,12 +4328,18 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4044
4328
|
let guardForThisSend = nextGuardContinuation;
|
|
4045
4329
|
let preserveGuardOnSkippedSend = false;
|
|
4046
4330
|
let messageForPreservation = nextMessage;
|
|
4331
|
+
let preparedMessage = nextMessage.parts ?? [];
|
|
4332
|
+
let preservePreparedMessageOnSkippedSend = !guardForThisSend && preparedMessage.some(
|
|
4333
|
+
(part) => !("text" in part && isTodoStopGuardPromptText(part.text))
|
|
4334
|
+
);
|
|
4047
4335
|
const externalParts = initialSend ? options.externalParts : void 0;
|
|
4048
4336
|
const promptIdForSend = guardForThisSend && guardForThisSend.attempt !== options.guardContinuation?.attempt ? toolPromptId + "_todo_stop_guard_" + guardForThisSend.attempt : streamPromptId;
|
|
4049
4337
|
const messageDisplay = this.#createMessageDisplayDispatcher(
|
|
4050
4338
|
pendingSend.signal
|
|
4051
4339
|
);
|
|
4052
4340
|
let channelDeliveryResponseBlock;
|
|
4341
|
+
let providerSendChat;
|
|
4342
|
+
let userContentPushCountBeforeSend = 0;
|
|
4053
4343
|
try {
|
|
4054
4344
|
const sendResult = await this.#sendMessageStreamWithAutoCompression(
|
|
4055
4345
|
promptIdForSend,
|
|
@@ -4058,44 +4348,134 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4058
4348
|
{
|
|
4059
4349
|
skipCompression: skipCompression || (guardForThisSend?.attempt ?? 0) > 1,
|
|
4060
4350
|
getModelOverride: options.getModelOverride,
|
|
4061
|
-
|
|
4062
|
-
const
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4351
|
+
prepareBeforeCompression: guardForThisSend ? async () => {
|
|
4352
|
+
const drained = await this.#drainMidTurnInput(
|
|
4353
|
+
pendingSend.signal,
|
|
4354
|
+
{
|
|
4355
|
+
watchQueuedPromptForTodoStopGuard: true,
|
|
4356
|
+
onFullTurnModel: options.onFullTurnModel
|
|
4357
|
+
}
|
|
4358
|
+
);
|
|
4359
|
+
if (drained.parts.length > 0) {
|
|
4360
|
+
if (drained.hasQueuedPrompt) {
|
|
4361
|
+
const claim = await this.#claimTodoStopGuardContinuation(
|
|
4362
|
+
pendingSend.signal
|
|
4363
|
+
);
|
|
4364
|
+
if (claim === "queued") {
|
|
4365
|
+
guardForThisSend = void 0;
|
|
4366
|
+
nextGuardContinuation = void 0;
|
|
4367
|
+
preserveGuardOnSkippedSend = true;
|
|
4368
|
+
preservePreparedMessageOnSkippedSend = true;
|
|
4369
|
+
messageForPreservation = {
|
|
4370
|
+
role: "user",
|
|
4371
|
+
parts: drained.parts
|
|
4372
|
+
};
|
|
4373
|
+
if (initialSend) {
|
|
4374
|
+
supersededAutomaticContinuation = true;
|
|
4375
|
+
}
|
|
4376
|
+
return { kind: "stop", stopReason: "end_turn" };
|
|
4071
4377
|
}
|
|
4378
|
+
if (claim === "unavailable") {
|
|
4379
|
+
this.todoStopGuard.blockUntilOrdinaryPromptStarts();
|
|
4380
|
+
}
|
|
4381
|
+
}
|
|
4382
|
+
preservePreparedMessageOnSkippedSend = true;
|
|
4383
|
+
this.todoStopGuard.acceptMidTurnUserInput();
|
|
4384
|
+
guardForThisSend = void 0;
|
|
4385
|
+
nextGuardContinuation = void 0;
|
|
4386
|
+
if (initialSend) {
|
|
4387
|
+
supersededAutomaticContinuation = true;
|
|
4388
|
+
}
|
|
4389
|
+
preparedMessage = initialSend ? drained.parts : [
|
|
4390
|
+
...(nextMessage?.parts ?? []).filter(
|
|
4391
|
+
(part) => !("text" in part && isTodoStopGuardPromptText(part.text))
|
|
4392
|
+
),
|
|
4393
|
+
...drained.parts
|
|
4394
|
+
];
|
|
4395
|
+
messageForPreservation = {
|
|
4396
|
+
role: "user",
|
|
4397
|
+
parts: preparedMessage
|
|
4398
|
+
};
|
|
4399
|
+
return { kind: "send", message: preparedMessage };
|
|
4400
|
+
}
|
|
4401
|
+
if (!drained.reliable) {
|
|
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
|
+
} else if (drained.hasQueuedPrompt) {
|
|
4418
|
+
const probe = await this.#claimTodoStopGuardContinuation(
|
|
4419
|
+
pendingSend.signal
|
|
4072
4420
|
);
|
|
4073
|
-
|
|
4074
|
-
drained.hasQueuedPrompt
|
|
4075
|
-
);
|
|
4076
|
-
if (drained.parts.length > 0) {
|
|
4077
|
-
this.todoStopGuard.acceptMidTurnUserInput();
|
|
4421
|
+
if (probe === "queued") {
|
|
4078
4422
|
guardForThisSend = void 0;
|
|
4079
4423
|
nextGuardContinuation = void 0;
|
|
4424
|
+
preserveGuardOnSkippedSend = true;
|
|
4080
4425
|
if (initialSend) {
|
|
4081
4426
|
supersededAutomaticContinuation = true;
|
|
4082
4427
|
}
|
|
4083
|
-
|
|
4084
|
-
...(nextMessage?.parts ?? []).filter(
|
|
4085
|
-
(part) => !("text" in part && isTodoStopGuardPromptText(part.text))
|
|
4086
|
-
),
|
|
4087
|
-
...drained.parts
|
|
4088
|
-
];
|
|
4089
|
-
messageForPreservation = {
|
|
4090
|
-
role: "user",
|
|
4091
|
-
parts: replacementMessage
|
|
4092
|
-
};
|
|
4093
|
-
return {
|
|
4094
|
-
kind: "send",
|
|
4095
|
-
message: replacementMessage
|
|
4096
|
-
};
|
|
4428
|
+
return { kind: "stop", stopReason: "end_turn" };
|
|
4097
4429
|
}
|
|
4098
|
-
if (
|
|
4430
|
+
if (probe === "unavailable") {
|
|
4431
|
+
this.todoStopGuard.blockUntilOrdinaryPromptStarts();
|
|
4432
|
+
guardForThisSend = void 0;
|
|
4433
|
+
nextGuardContinuation = void 0;
|
|
4434
|
+
if (!options.externalParts) {
|
|
4435
|
+
preserveGuardOnSkippedSend = true;
|
|
4436
|
+
return { kind: "stop", stopReason: "end_turn" };
|
|
4437
|
+
}
|
|
4438
|
+
if (!initialSend && nextMessage) {
|
|
4439
|
+
nextMessage = {
|
|
4440
|
+
...nextMessage,
|
|
4441
|
+
parts: (nextMessage.parts ?? []).filter(
|
|
4442
|
+
(part) => !("text" in part && isTodoStopGuardPromptText(part.text))
|
|
4443
|
+
)
|
|
4444
|
+
};
|
|
4445
|
+
}
|
|
4446
|
+
}
|
|
4447
|
+
}
|
|
4448
|
+
if (guardForThisSend && this.config.getApprovalMode() === "plan" /* PLAN */) {
|
|
4449
|
+
this.#clearTodoStopGuardTrustAndDrainAutomaticQueues();
|
|
4450
|
+
}
|
|
4451
|
+
if (guardForThisSend) {
|
|
4452
|
+
const hasRelevantBackgroundInput = this.#hasRelevantTodoStopGuardBackgroundInput();
|
|
4453
|
+
const refreshedDecision = guardForThisSend.toolClosure ? this.todoStopGuard.decideToolClosure(
|
|
4454
|
+
guardForThisSend.attempt - 1,
|
|
4455
|
+
hasRelevantBackgroundInput
|
|
4456
|
+
) : this.todoStopGuard.decide(hasRelevantBackgroundInput);
|
|
4457
|
+
if (refreshedDecision.kind !== "continue" || refreshedDecision.attempt !== guardForThisSend.attempt) {
|
|
4458
|
+
guardForThisSend = void 0;
|
|
4459
|
+
nextGuardContinuation = void 0;
|
|
4460
|
+
if (!options.externalParts) {
|
|
4461
|
+
preserveGuardOnSkippedSend = true;
|
|
4462
|
+
return { kind: "stop", stopReason: "end_turn" };
|
|
4463
|
+
}
|
|
4464
|
+
if (!initialSend && nextMessage) {
|
|
4465
|
+
nextMessage = {
|
|
4466
|
+
...nextMessage,
|
|
4467
|
+
parts: (nextMessage.parts ?? []).filter(
|
|
4468
|
+
(part) => !("text" in part && isTodoStopGuardPromptText(part.text))
|
|
4469
|
+
)
|
|
4470
|
+
};
|
|
4471
|
+
}
|
|
4472
|
+
}
|
|
4473
|
+
}
|
|
4474
|
+
if (guardForThisSend) {
|
|
4475
|
+
const claim = await this.#claimTodoStopGuardContinuation(
|
|
4476
|
+
pendingSend.signal
|
|
4477
|
+
);
|
|
4478
|
+
if (claim === "queued") {
|
|
4099
4479
|
guardForThisSend = void 0;
|
|
4100
4480
|
nextGuardContinuation = void 0;
|
|
4101
4481
|
preserveGuardOnSkippedSend = true;
|
|
@@ -4104,41 +4484,21 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4104
4484
|
}
|
|
4105
4485
|
return { kind: "stop", stopReason: "end_turn" };
|
|
4106
4486
|
}
|
|
4107
|
-
if (
|
|
4108
|
-
this.todoStopGuard.
|
|
4487
|
+
if (claim === "unavailable") {
|
|
4488
|
+
this.todoStopGuard.blockUntilOrdinaryPromptStarts();
|
|
4109
4489
|
guardForThisSend = void 0;
|
|
4110
4490
|
nextGuardContinuation = void 0;
|
|
4111
|
-
if (!externalParts
|
|
4491
|
+
if (!options.externalParts) {
|
|
4112
4492
|
preserveGuardOnSkippedSend = true;
|
|
4113
4493
|
return { kind: "stop", stopReason: "end_turn" };
|
|
4114
4494
|
}
|
|
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
|
-
}
|
|
4495
|
+
if (!initialSend && nextMessage) {
|
|
4496
|
+
nextMessage = {
|
|
4497
|
+
...nextMessage,
|
|
4498
|
+
parts: (nextMessage.parts ?? []).filter(
|
|
4499
|
+
(part) => !("text" in part && isTodoStopGuardPromptText(part.text))
|
|
4500
|
+
)
|
|
4501
|
+
};
|
|
4142
4502
|
}
|
|
4143
4503
|
}
|
|
4144
4504
|
}
|
|
@@ -4146,16 +4506,42 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4146
4506
|
await options.onAutomaticContinuationValidated();
|
|
4147
4507
|
automaticContinuationValidated = true;
|
|
4148
4508
|
}
|
|
4149
|
-
|
|
4509
|
+
preparedMessage = guardForThisSend || !externalParts ? nextMessage?.parts ?? [] : externalParts;
|
|
4150
4510
|
messageForPreservation = {
|
|
4151
4511
|
role: "user",
|
|
4152
|
-
parts:
|
|
4512
|
+
parts: preparedMessage
|
|
4153
4513
|
};
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4514
|
+
preservePreparedMessageOnSkippedSend = preparedMessage.some(
|
|
4515
|
+
(part) => !("text" in part && isTodoStopGuardPromptText(part.text))
|
|
4516
|
+
);
|
|
4517
|
+
return { kind: "send", message: preparedMessage };
|
|
4518
|
+
} : void 0,
|
|
4519
|
+
beforeSend: /* @__PURE__ */ __name(async ({ compressionFailed }) => {
|
|
4520
|
+
if (guardForThisSend && compressionFailed) {
|
|
4521
|
+
this.todoStopGuard.suspend();
|
|
4522
|
+
guardForThisSend = void 0;
|
|
4523
|
+
nextGuardContinuation = void 0;
|
|
4524
|
+
if (!options.externalParts) {
|
|
4525
|
+
preserveGuardOnSkippedSend = true;
|
|
4526
|
+
return { kind: "stop", stopReason: "end_turn" };
|
|
4527
|
+
}
|
|
4528
|
+
preparedMessage = initialSend && externalParts ? externalParts : preparedMessage.filter(
|
|
4529
|
+
(part) => !("text" in part && isTodoStopGuardPromptText(part.text))
|
|
4530
|
+
);
|
|
4531
|
+
preservePreparedMessageOnSkippedSend = true;
|
|
4532
|
+
}
|
|
4533
|
+
if (!automaticContinuationValidated && options.onAutomaticContinuationValidated) {
|
|
4534
|
+
await options.onAutomaticContinuationValidated();
|
|
4535
|
+
automaticContinuationValidated = true;
|
|
4536
|
+
}
|
|
4537
|
+
messageForPreservation = {
|
|
4538
|
+
role: "user",
|
|
4539
|
+
parts: preparedMessage
|
|
4157
4540
|
};
|
|
4158
|
-
|
|
4541
|
+
providerSendChat = this.#getCurrentChat();
|
|
4542
|
+
userContentPushCountBeforeSend = providerSendChat.getUserContentPushCount?.() ?? 0;
|
|
4543
|
+
return { kind: "send", message: preparedMessage };
|
|
4544
|
+
}, "beforeSend")
|
|
4159
4545
|
}
|
|
4160
4546
|
);
|
|
4161
4547
|
if (!sendResult.responseStream) {
|
|
@@ -4171,7 +4557,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4171
4557
|
);
|
|
4172
4558
|
this.#preserveUnsentMessageHistory(
|
|
4173
4559
|
preservedParts.length > 0 ? { ...messageForPreservation, parts: preservedParts } : null,
|
|
4174
|
-
sendResult.stopReason === "cancelled"
|
|
4560
|
+
sendResult.stopReason === "cancelled" || preservePreparedMessageOnSkippedSend
|
|
4175
4561
|
);
|
|
4176
4562
|
return {
|
|
4177
4563
|
kind: "terminal",
|
|
@@ -4193,7 +4579,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4193
4579
|
if (guardCommitted) {
|
|
4194
4580
|
await this.#emitTodoStopGuardContinuation(guardForThisSend);
|
|
4195
4581
|
}
|
|
4196
|
-
if (!guardCommitted && externalParts) {
|
|
4582
|
+
if (!guardCommitted && options.externalParts) {
|
|
4197
4583
|
guardForThisSend = void 0;
|
|
4198
4584
|
}
|
|
4199
4585
|
}
|
|
@@ -4247,6 +4633,24 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4247
4633
|
}
|
|
4248
4634
|
} catch (error) {
|
|
4249
4635
|
streamFailed = true;
|
|
4636
|
+
const preservedParts = (messageForPreservation.parts ?? []).filter(
|
|
4637
|
+
(part) => !("text" in part && isTodoStopGuardPromptText(part.text))
|
|
4638
|
+
);
|
|
4639
|
+
if (preservedParts.length > 0 && (!providerSendChat || (providerSendChat.getUserContentPushCount?.() ?? 0) <= userContentPushCountBeforeSend)) {
|
|
4640
|
+
this.#preserveUnsentMessageHistory(
|
|
4641
|
+
{ ...messageForPreservation, parts: preservedParts },
|
|
4642
|
+
true
|
|
4643
|
+
);
|
|
4644
|
+
}
|
|
4645
|
+
const isControlledCancellation = pendingSend.signal.aborted && (pendingSend.signal.reason === USER_CANCEL_ABORT_REASON || pendingSend.signal.reason === SESSION_DISPOSE_ABORT_REASON);
|
|
4646
|
+
if (isControlledCancellation) {
|
|
4647
|
+
this.todoStopGuard.suspend();
|
|
4648
|
+
return {
|
|
4649
|
+
kind: "terminal",
|
|
4650
|
+
stopReason: "cancelled",
|
|
4651
|
+
...supersededAutomaticContinuation ? { supersededAutomaticContinuation: true } : {}
|
|
4652
|
+
};
|
|
4653
|
+
}
|
|
4250
4654
|
this.todoStopGuard.pauseForTrustedRetry();
|
|
4251
4655
|
const errorStatus = getErrorStatus(error);
|
|
4252
4656
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -4296,7 +4700,8 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4296
4700
|
pendingSend.signal,
|
|
4297
4701
|
toolPromptId,
|
|
4298
4702
|
functionCalls,
|
|
4299
|
-
toolLoopState
|
|
4703
|
+
toolLoopState,
|
|
4704
|
+
options.onFullTurnModel
|
|
4300
4705
|
)
|
|
4301
4706
|
);
|
|
4302
4707
|
if (toolRun.stopAfterPermissionCancel || toolRun.loopDetected) {
|
|
@@ -4311,6 +4716,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4311
4716
|
const nextAfterTools = await this.#buildNextMessageAfterToolRun(
|
|
4312
4717
|
toolRun,
|
|
4313
4718
|
pendingSend.signal,
|
|
4719
|
+
toolPromptId,
|
|
4314
4720
|
options.onFullTurnModel
|
|
4315
4721
|
);
|
|
4316
4722
|
nextMessage = nextAfterTools.message;
|
|
@@ -4454,6 +4860,19 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4454
4860
|
*/
|
|
4455
4861
|
async #sendMessageStreamWithAutoCompression(promptId, message, abortSignal, options = {}) {
|
|
4456
4862
|
const geminiClient = this.config.getGeminiClient();
|
|
4863
|
+
if (options.prepareBeforeCompression) {
|
|
4864
|
+
const decision = await options.prepareBeforeCompression();
|
|
4865
|
+
if (decision.kind === "stop") {
|
|
4866
|
+
return { responseStream: null, stopReason: decision.stopReason };
|
|
4867
|
+
}
|
|
4868
|
+
message = decision.message;
|
|
4869
|
+
}
|
|
4870
|
+
if (abortSignal.aborted) {
|
|
4871
|
+
debugLogger6.debug(
|
|
4872
|
+
`Send aborted after pre-compression preparation for prompt ${promptId}`
|
|
4873
|
+
);
|
|
4874
|
+
return { responseStream: null, stopReason: "cancelled" };
|
|
4875
|
+
}
|
|
4457
4876
|
let compressionDiagnostic = null;
|
|
4458
4877
|
let compressionInfo = null;
|
|
4459
4878
|
let compressionFailed = false;
|
|
@@ -4475,10 +4894,13 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4475
4894
|
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
4895
|
}
|
|
4477
4896
|
} catch (compressionError) {
|
|
4478
|
-
if (abortSignal.aborted
|
|
4897
|
+
if (abortSignal.aborted) {
|
|
4479
4898
|
debugLogger6.debug(`Auto-compression aborted for prompt ${promptId}`);
|
|
4480
4899
|
return { responseStream: null, stopReason: "cancelled" };
|
|
4481
4900
|
}
|
|
4901
|
+
if (this.#isAbortError(compressionError)) {
|
|
4902
|
+
throw compressionError;
|
|
4903
|
+
}
|
|
4482
4904
|
debugLogger6.warn(
|
|
4483
4905
|
`Auto-compression failed for prompt ${promptId}; proceeding without compression: ` + this.#formatError(compressionError)
|
|
4484
4906
|
);
|
|
@@ -4584,7 +5006,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4584
5006
|
);
|
|
4585
5007
|
await this.messageRewriter?.waitForPendingRewrites();
|
|
4586
5008
|
}
|
|
4587
|
-
async #buildNextMessageAfterToolRun(toolRun, abortSignal, onFullTurnModel) {
|
|
5009
|
+
async #buildNextMessageAfterToolRun(toolRun, abortSignal, promptId, onFullTurnModel) {
|
|
4588
5010
|
if (toolRun.loopDetected) {
|
|
4589
5011
|
debugLogger6.debug("Stopping ACP turn after daemon loop detection.");
|
|
4590
5012
|
return { message: null, hadMidTurnUserInput: false };
|
|
@@ -4603,7 +5025,12 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4603
5025
|
if (hadMidTurnUserInput) {
|
|
4604
5026
|
this.todoStopGuard.acceptMidTurnUserInput();
|
|
4605
5027
|
}
|
|
4606
|
-
const
|
|
5028
|
+
const activeTodoReminder = this.config.takeActiveTodoReminder(promptId);
|
|
5029
|
+
const parts = [
|
|
5030
|
+
...toolRun.parts,
|
|
5031
|
+
...activeTodoReminder ? [{ text: activeTodoReminder }] : [],
|
|
5032
|
+
...drained.parts
|
|
5033
|
+
];
|
|
4607
5034
|
return {
|
|
4608
5035
|
message: { role: "user", parts },
|
|
4609
5036
|
hadMidTurnUserInput
|
|
@@ -4693,7 +5120,8 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4693
5120
|
if (this.midTurnDrainUnavailable) {
|
|
4694
5121
|
return {
|
|
4695
5122
|
parts: await this.#buildMidTurnParts(recovered, abortSignal, options),
|
|
4696
|
-
hasQueuedPrompt: false
|
|
5123
|
+
hasQueuedPrompt: false,
|
|
5124
|
+
reliable: false
|
|
4697
5125
|
};
|
|
4698
5126
|
}
|
|
4699
5127
|
let drainPromise;
|
|
@@ -4716,13 +5144,18 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4716
5144
|
clearTimeout(timeoutHandle);
|
|
4717
5145
|
}
|
|
4718
5146
|
this.midTurnDrainTimeoutStrikes = 0;
|
|
5147
|
+
const reliable = isValidMidTurnDrainResponse(
|
|
5148
|
+
response,
|
|
5149
|
+
options.watchQueuedPromptForTodoStopGuard === true
|
|
5150
|
+
);
|
|
4719
5151
|
return {
|
|
4720
5152
|
parts: await this.#buildMidTurnParts(
|
|
4721
5153
|
[...recovered, ...parseMidTurnDrainResponse(response)],
|
|
4722
5154
|
abortSignal,
|
|
4723
5155
|
options
|
|
4724
5156
|
),
|
|
4725
|
-
hasQueuedPrompt: isRecord2(response) && response["hasQueuedPrompt"] === true
|
|
5157
|
+
hasQueuedPrompt: isRecord2(response) && response["hasQueuedPrompt"] === true,
|
|
5158
|
+
reliable
|
|
4726
5159
|
};
|
|
4727
5160
|
} catch (error) {
|
|
4728
5161
|
const errorMessage = error instanceof Error ? error.message : error && typeof error === "object" && "message" in error ? String(error.message) : String(error);
|
|
@@ -4741,7 +5174,8 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4741
5174
|
);
|
|
4742
5175
|
return {
|
|
4743
5176
|
parts: await this.#buildMidTurnParts(recovered, abortSignal, options),
|
|
4744
|
-
hasQueuedPrompt: false
|
|
5177
|
+
hasQueuedPrompt: false,
|
|
5178
|
+
reliable: false
|
|
4745
5179
|
};
|
|
4746
5180
|
}
|
|
4747
5181
|
}
|
|
@@ -4861,7 +5295,8 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4861
5295
|
source: job.cronExpr === "@wakeup" ? "loop" : "cron",
|
|
4862
5296
|
...job.id ? { taskId: job.id } : {},
|
|
4863
5297
|
...job.lastFiredAt !== void 0 ? { firedAt: job.lastFiredAt } : {},
|
|
4864
|
-
...job.delivery ? { delivery: job.delivery } : {}
|
|
5298
|
+
...job.delivery ? { delivery: job.delivery } : {},
|
|
5299
|
+
...job.todoWorkChainId ? { todoWorkChainId: job.todoWorkChainId } : {}
|
|
4865
5300
|
});
|
|
4866
5301
|
void this.#drainCronQueue();
|
|
4867
5302
|
});
|
|
@@ -4881,26 +5316,39 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4881
5316
|
);
|
|
4882
5317
|
}
|
|
4883
5318
|
#enqueueCronPrompt(item) {
|
|
4884
|
-
|
|
4885
|
-
|
|
5319
|
+
const automaticWorkDeferred = this.todoStopGuard.blocksUnrelatedAutomaticTurns || this.todoStopGuardQueuedPromptPriority;
|
|
5320
|
+
if (automaticWorkDeferred) {
|
|
5321
|
+
const incomingIsRelated = this.#cronContinuesTodoStopGuardWorkChain(item);
|
|
5322
|
+
let shouldAppend = true;
|
|
5323
|
+
if (!incomingIsRelated && item.taskId) {
|
|
4886
5324
|
const duplicateIndex = this.cronQueue.findIndex(
|
|
4887
5325
|
(queued) => queued.taskId === item.taskId && !this.#cronContinuesTodoStopGuardWorkChain(queued)
|
|
4888
5326
|
);
|
|
4889
5327
|
if (duplicateIndex >= 0) {
|
|
4890
5328
|
this.cronQueue[duplicateIndex] = item;
|
|
4891
|
-
|
|
5329
|
+
shouldAppend = false;
|
|
4892
5330
|
}
|
|
4893
5331
|
}
|
|
4894
|
-
const
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
5332
|
+
const maxBeforeAppend = MAX_DEFERRED_UNRELATED_CRON_QUEUE - (shouldAppend && !incomingIsRelated ? 1 : 0);
|
|
5333
|
+
let unrelatedCount = this.cronQueue.filter(
|
|
5334
|
+
(queued) => !this.#cronContinuesTodoStopGuardWorkChain(queued)
|
|
5335
|
+
).length;
|
|
5336
|
+
const evictedTaskIds = [];
|
|
5337
|
+
while (unrelatedCount > maxBeforeAppend) {
|
|
5338
|
+
const evictedIndex = this.cronQueue.findIndex(
|
|
5339
|
+
(queued) => !this.#cronContinuesTodoStopGuardWorkChain(queued)
|
|
5340
|
+
);
|
|
5341
|
+
if (evictedIndex < 0) break;
|
|
4899
5342
|
const [evicted] = this.cronQueue.splice(evictedIndex, 1);
|
|
5343
|
+
evictedTaskIds.push(evicted?.taskId ?? "unknown");
|
|
5344
|
+
unrelatedCount--;
|
|
5345
|
+
}
|
|
5346
|
+
if (evictedTaskIds.length > 0) {
|
|
4900
5347
|
debugLogger6.warn(
|
|
4901
|
-
`Cron queue overflow while automatic work is deferred:
|
|
5348
|
+
`Cron queue overflow while automatic work is deferred: evicted ${evictedTaskIds.length} unrelated task(s): ${evictedTaskIds.join(", ")}`
|
|
4902
5349
|
);
|
|
4903
5350
|
}
|
|
5351
|
+
if (!shouldAppend) return;
|
|
4904
5352
|
}
|
|
4905
5353
|
this.cronQueue.push(item);
|
|
4906
5354
|
}
|
|
@@ -5004,9 +5452,8 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5004
5452
|
async () => {
|
|
5005
5453
|
const ac = new AbortController();
|
|
5006
5454
|
this.cronAbortController = ac;
|
|
5007
|
-
this.#
|
|
5008
|
-
|
|
5009
|
-
);
|
|
5455
|
+
const continuesCurrentWorkChain = this.#cronContinuesTodoStopGuardWorkChain(item);
|
|
5456
|
+
this.#prepareTodoStopGuardForAutomaticTurn(continuesCurrentWorkChain);
|
|
5010
5457
|
const promptId = this.config.getSessionId() + "########cron" + Date.now();
|
|
5011
5458
|
let cronHadError = false;
|
|
5012
5459
|
let cronCompleted = false;
|
|
@@ -5023,6 +5470,10 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5023
5470
|
try {
|
|
5024
5471
|
await this.assertCanStartTurn();
|
|
5025
5472
|
if (ac.signal.aborted) return;
|
|
5473
|
+
this.config.startAutomaticActiveTodoWorkChain(
|
|
5474
|
+
promptId,
|
|
5475
|
+
item.todoWorkChainId
|
|
5476
|
+
);
|
|
5026
5477
|
const loopMode = detectLoopSentinel(prompt);
|
|
5027
5478
|
const autonomousMode = loopMode ? null : detectAutonomousSentinel(prompt);
|
|
5028
5479
|
let loopTick = null;
|
|
@@ -5077,9 +5528,17 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5077
5528
|
_meta: { source: item.source }
|
|
5078
5529
|
});
|
|
5079
5530
|
const cronReminders = await this.#buildInitialSystemReminders();
|
|
5531
|
+
const activeTodoReminder = this.config.takeActiveTodoReminder(
|
|
5532
|
+
promptId,
|
|
5533
|
+
true
|
|
5534
|
+
);
|
|
5080
5535
|
let nextMessage = {
|
|
5081
5536
|
role: "user",
|
|
5082
|
-
parts: [
|
|
5537
|
+
parts: [
|
|
5538
|
+
...cronReminders,
|
|
5539
|
+
...activeTodoReminder ? [{ text: activeTodoReminder }] : [],
|
|
5540
|
+
{ text: modelText }
|
|
5541
|
+
]
|
|
5083
5542
|
};
|
|
5084
5543
|
const toolLoopState = createDaemonToolLoopState();
|
|
5085
5544
|
while (nextMessage !== null) {
|
|
@@ -5211,7 +5670,8 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5211
5670
|
}
|
|
5212
5671
|
const nextAfterTools = await this.#buildNextMessageAfterToolRun(
|
|
5213
5672
|
toolRun,
|
|
5214
|
-
ac.signal
|
|
5673
|
+
ac.signal,
|
|
5674
|
+
promptId
|
|
5215
5675
|
);
|
|
5216
5676
|
nextMessage = nextAfterTools.message;
|
|
5217
5677
|
if (toolRun.loopDetected) {
|
|
@@ -5251,6 +5711,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5251
5711
|
`[${item.source} error] ${msg}`
|
|
5252
5712
|
);
|
|
5253
5713
|
} finally {
|
|
5714
|
+
this.config.endAutomaticActiveTodoWorkChain(promptId);
|
|
5254
5715
|
if (this.cronAbortController === ac) {
|
|
5255
5716
|
this.cronAbortController = null;
|
|
5256
5717
|
}
|
|
@@ -5302,7 +5763,9 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5302
5763
|
taskId: meta.agentId,
|
|
5303
5764
|
status: meta.status,
|
|
5304
5765
|
kind: "agent",
|
|
5305
|
-
|
|
5766
|
+
continuesTodoStopGuardWorkChain: this.#agentContinuesTodoStopGuardWorkChain(meta.agentId),
|
|
5767
|
+
toolUseId: meta.toolUseId,
|
|
5768
|
+
todoWorkChainId: meta.todoWorkChainId
|
|
5306
5769
|
});
|
|
5307
5770
|
}
|
|
5308
5771
|
);
|
|
@@ -5317,7 +5780,12 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5317
5780
|
taskId: meta.monitorId,
|
|
5318
5781
|
status: meta.status,
|
|
5319
5782
|
kind: "monitor",
|
|
5320
|
-
|
|
5783
|
+
continuesTodoStopGuardWorkChain: this.#monitorContinuesTodoStopGuardWorkChain(
|
|
5784
|
+
meta.monitorId,
|
|
5785
|
+
meta.ownerAgentId
|
|
5786
|
+
),
|
|
5787
|
+
toolUseId: meta.toolUseId,
|
|
5788
|
+
todoWorkChainId: meta.todoWorkChainId
|
|
5321
5789
|
});
|
|
5322
5790
|
});
|
|
5323
5791
|
const shellRegistry = this.config.getBackgroundShellRegistry();
|
|
@@ -5327,7 +5795,9 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5327
5795
|
modelText,
|
|
5328
5796
|
taskId: meta.shellId,
|
|
5329
5797
|
status: meta.status,
|
|
5330
|
-
kind: "shell"
|
|
5798
|
+
kind: "shell",
|
|
5799
|
+
continuesTodoStopGuardWorkChain: !this.todoStopGuardBackgroundBaseline.shells.has(meta.shellId),
|
|
5800
|
+
todoWorkChainId: meta.todoWorkChainId
|
|
5331
5801
|
});
|
|
5332
5802
|
});
|
|
5333
5803
|
this.config.getChatRecordingService()?.setTitleRecordedCallback((customTitle, titleSource, sessionId) => {
|
|
@@ -5450,20 +5920,36 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5450
5920
|
async () => {
|
|
5451
5921
|
const ac = new AbortController();
|
|
5452
5922
|
this.notificationAbortController = ac;
|
|
5453
|
-
this.#
|
|
5454
|
-
|
|
5455
|
-
);
|
|
5923
|
+
const continuesCurrentWorkChain = this.#notificationContinuesTodoStopGuardWorkChain(item);
|
|
5924
|
+
this.#prepareTodoStopGuardForAutomaticTurn(continuesCurrentWorkChain);
|
|
5456
5925
|
const promptId = this.config.getSessionId() + "########notification" + Date.now();
|
|
5457
5926
|
try {
|
|
5458
5927
|
await this.assertCanStartTurn();
|
|
5459
5928
|
if (ac.signal.aborted) return;
|
|
5929
|
+
this.config.startAutomaticActiveTodoWorkChain(
|
|
5930
|
+
promptId,
|
|
5931
|
+
item.todoWorkChainId
|
|
5932
|
+
);
|
|
5460
5933
|
await this.#emitBackgroundNotificationDisplay(item);
|
|
5461
5934
|
const notificationParts = [{ text: item.modelText }];
|
|
5462
|
-
this.config.getChatRecordingService()?.recordNotification(notificationParts, item.displayText
|
|
5935
|
+
this.config.getChatRecordingService()?.recordNotification(notificationParts, item.displayText, {
|
|
5936
|
+
taskId: item.taskId,
|
|
5937
|
+
status: item.status,
|
|
5938
|
+
kind: item.kind,
|
|
5939
|
+
toolUseId: item.toolUseId
|
|
5940
|
+
});
|
|
5463
5941
|
const notificationReminders = await this.#buildInitialSystemReminders();
|
|
5942
|
+
const activeTodoReminder = this.config.takeActiveTodoReminder(
|
|
5943
|
+
promptId,
|
|
5944
|
+
true
|
|
5945
|
+
);
|
|
5464
5946
|
let nextMessage = {
|
|
5465
5947
|
role: "user",
|
|
5466
|
-
parts: [
|
|
5948
|
+
parts: [
|
|
5949
|
+
...notificationReminders,
|
|
5950
|
+
...activeTodoReminder ? [{ text: activeTodoReminder }] : [],
|
|
5951
|
+
...notificationParts
|
|
5952
|
+
]
|
|
5467
5953
|
};
|
|
5468
5954
|
const toolLoopState = createDaemonToolLoopState();
|
|
5469
5955
|
while (nextMessage !== null) {
|
|
@@ -5593,7 +6079,8 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5593
6079
|
}
|
|
5594
6080
|
const nextAfterTools = await this.#buildNextMessageAfterToolRun(
|
|
5595
6081
|
toolRun,
|
|
5596
|
-
ac.signal
|
|
6082
|
+
ac.signal,
|
|
6083
|
+
promptId
|
|
5597
6084
|
);
|
|
5598
6085
|
nextMessage = nextAfterTools.message;
|
|
5599
6086
|
if (toolRun.loopDetected) {
|
|
@@ -5644,6 +6131,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5644
6131
|
await this.#emitBackgroundNotificationEndTurn("end_turn");
|
|
5645
6132
|
}
|
|
5646
6133
|
} finally {
|
|
6134
|
+
this.config.endAutomaticActiveTodoWorkChain(promptId);
|
|
5647
6135
|
if (this.notificationAbortController === ac) {
|
|
5648
6136
|
this.notificationAbortController = null;
|
|
5649
6137
|
}
|
|
@@ -5708,8 +6196,10 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5708
6196
|
debugLogger6.error("Error sending available commands update:", error);
|
|
5709
6197
|
}
|
|
5710
6198
|
}
|
|
5711
|
-
async refreshSkillsFromSettings() {
|
|
5712
|
-
|
|
6199
|
+
async refreshSkillsFromSettings(options = {}) {
|
|
6200
|
+
if (options.reloadSettings ?? true) {
|
|
6201
|
+
this.reloadSkillSettings();
|
|
6202
|
+
}
|
|
5713
6203
|
const skillManager = this.config.getSkillManager();
|
|
5714
6204
|
let updateFailed = false;
|
|
5715
6205
|
let updateError;
|
|
@@ -5719,7 +6209,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5719
6209
|
updateFailed = true;
|
|
5720
6210
|
updateError = error;
|
|
5721
6211
|
}
|
|
5722
|
-
if (skillManager) {
|
|
6212
|
+
if (skillManager && (options.notifyConfigChanged ?? true)) {
|
|
5723
6213
|
try {
|
|
5724
6214
|
skillManager.suppressNextSlashReload();
|
|
5725
6215
|
await skillManager.notifyConfigChanged();
|
|
@@ -5733,6 +6223,9 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5733
6223
|
}
|
|
5734
6224
|
if (updateFailed) throw updateError;
|
|
5735
6225
|
}
|
|
6226
|
+
reloadSkillSettings() {
|
|
6227
|
+
this.settings.reloadScopeFromDisk("Workspace" /* Workspace */);
|
|
6228
|
+
}
|
|
5736
6229
|
async sendAvailableCommandsUpdateOrThrow() {
|
|
5737
6230
|
const { availableCommands, availableSkills, availableSkillDetails } = await buildAvailableCommandsSnapshot(
|
|
5738
6231
|
this.config,
|
|
@@ -5912,7 +6405,11 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5912
6405
|
* sequential batch to preserve the implicit ordering the model may rely
|
|
5913
6406
|
* on. Response-part ordering matches the original `functionCalls` order.
|
|
5914
6407
|
*/
|
|
5915
|
-
async runToolCalls(abortSignal, promptId, functionCalls, toolLoopState) {
|
|
6408
|
+
async runToolCalls(abortSignal, promptId, functionCalls, toolLoopState, onFullTurnModel) {
|
|
6409
|
+
promptIdContext.enterWith(promptId);
|
|
6410
|
+
todoWorkChainContext.enterWith(
|
|
6411
|
+
this.config.getActiveTodoWorkChainOwner(promptId)
|
|
6412
|
+
);
|
|
5916
6413
|
const dedupedFunctionCalls = dedupeToolCallsById(functionCalls);
|
|
5917
6414
|
const generatedCallIdBase = randomUUID();
|
|
5918
6415
|
const executionCallIds = new Map(
|
|
@@ -6189,7 +6686,8 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
6189
6686
|
toolLoopState,
|
|
6190
6687
|
recordSkippedToolCall,
|
|
6191
6688
|
queueToolResultRecord,
|
|
6192
|
-
executionCallIds.get(calls[i])
|
|
6689
|
+
executionCallIds.get(calls[i]),
|
|
6690
|
+
onFullTurnModel
|
|
6193
6691
|
);
|
|
6194
6692
|
results[i] = r;
|
|
6195
6693
|
if (r.loopDetected) {
|
|
@@ -6223,7 +6721,8 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
6223
6721
|
toolLoopState,
|
|
6224
6722
|
recordSkippedToolCall,
|
|
6225
6723
|
queueToolResultRecord,
|
|
6226
|
-
executionCallIds.get(calls[idx])
|
|
6724
|
+
executionCallIds.get(calls[idx]),
|
|
6725
|
+
onFullTurnModel
|
|
6227
6726
|
).then((r) => {
|
|
6228
6727
|
results[idx] = r;
|
|
6229
6728
|
}).finally(() => {
|
|
@@ -6347,7 +6846,8 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
6347
6846
|
toolLoopState,
|
|
6348
6847
|
recordSkippedToolCall,
|
|
6349
6848
|
queueToolResultRecord,
|
|
6350
|
-
executionCallIds.get(fc)
|
|
6849
|
+
executionCallIds.get(fc),
|
|
6850
|
+
onFullTurnModel
|
|
6351
6851
|
);
|
|
6352
6852
|
parts.push(...r.parts);
|
|
6353
6853
|
collectMemoryWriteCandidates(r);
|
|
@@ -6412,7 +6912,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
6412
6912
|
}
|
|
6413
6913
|
return reminders;
|
|
6414
6914
|
}
|
|
6415
|
-
async runTool(abortSignal, promptId, fc, onStopAfterPermissionCancel, toolLoopState, recordSkippedToolCall, queueToolResultRecord, generatedCallId) {
|
|
6915
|
+
async runTool(abortSignal, promptId, fc, onStopAfterPermissionCancel, toolLoopState, recordSkippedToolCall, queueToolResultRecord, generatedCallId, onFullTurnModel) {
|
|
6416
6916
|
const callId = fc.id ?? generatedCallId ?? `${fc.name}-${Date.now()}`;
|
|
6417
6917
|
let args = fc.args ?? {};
|
|
6418
6918
|
if (toolLoopState?.loopDetected) {
|
|
@@ -6517,15 +7017,20 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
6517
7017
|
}
|
|
6518
7018
|
const policyToolName = tool.name;
|
|
6519
7019
|
const originalPolicyRequestArgs = policyToolName === ToolNames.SHELL || policyToolName === ToolNames.MONITOR ? structuredClone(args) : args;
|
|
6520
|
-
const toolSpan = startToolSpan(
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
7020
|
+
const toolSpan = startToolSpan(
|
|
7021
|
+
policyToolName,
|
|
7022
|
+
{
|
|
7023
|
+
"tool.call_id": callId,
|
|
7024
|
+
"gen_ai.tool.call.id": getProviderToolCallId(fc) ?? callId,
|
|
7025
|
+
// Dual-emit the legacy call_id/tool_name aliases like CoreToolScheduler
|
|
7026
|
+
// (coreToolScheduler.ts) so pre-Phase-2 dashboards keyed off call_id keep
|
|
7027
|
+
// matching daemon/ACP tool spans during the migration window.
|
|
7028
|
+
call_id: callId,
|
|
7029
|
+
tool_name: policyToolName
|
|
7030
|
+
},
|
|
7031
|
+
tool.description,
|
|
7032
|
+
promptId
|
|
7033
|
+
);
|
|
6529
7034
|
let spanSuccess = false;
|
|
6530
7035
|
try {
|
|
6531
7036
|
return await runInToolSpanContext(toolSpan, async () => {
|
|
@@ -6563,6 +7068,10 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
6563
7068
|
let toolBuildSucceeded = false;
|
|
6564
7069
|
try {
|
|
6565
7070
|
const invocation = tool.build(args);
|
|
7071
|
+
if (policyToolName === ToolNames.MONITOR) {
|
|
7072
|
+
const callIdAware = invocation;
|
|
7073
|
+
callIdAware.setCallId?.(callId);
|
|
7074
|
+
}
|
|
6566
7075
|
toolBuildSucceeded = true;
|
|
6567
7076
|
const taskEventEmitter = invocation.eventEmitter;
|
|
6568
7077
|
if (isAgentTool && taskEventEmitter) {
|
|
@@ -7078,6 +7587,33 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7078
7587
|
);
|
|
7079
7588
|
}
|
|
7080
7589
|
}
|
|
7590
|
+
const continuedAgentId = toolName === ToolNames.SEND_MESSAGE && typeof args["task_id"] === "string" && args["task_id"].length > 0 ? args["task_id"] : void 0;
|
|
7591
|
+
const provisionalRelatedAgent = continuedAgentId !== void 0 && !this.relatedAgentIds.has(continuedAgentId);
|
|
7592
|
+
if (provisionalRelatedAgent) {
|
|
7593
|
+
this.provisionalRelatedAgentCounts.set(
|
|
7594
|
+
continuedAgentId,
|
|
7595
|
+
(this.provisionalRelatedAgentCounts.get(continuedAgentId) ?? 0) + 1
|
|
7596
|
+
);
|
|
7597
|
+
}
|
|
7598
|
+
let relatedAgentSettled = false;
|
|
7599
|
+
const settleRelatedAgent = /* @__PURE__ */ __name((succeeded2) => {
|
|
7600
|
+
if (relatedAgentSettled || !provisionalRelatedAgent || !continuedAgentId) {
|
|
7601
|
+
return;
|
|
7602
|
+
}
|
|
7603
|
+
relatedAgentSettled = true;
|
|
7604
|
+
const remaining = (this.provisionalRelatedAgentCounts.get(continuedAgentId) ?? 1) - 1;
|
|
7605
|
+
if (remaining > 0) {
|
|
7606
|
+
this.provisionalRelatedAgentCounts.set(
|
|
7607
|
+
continuedAgentId,
|
|
7608
|
+
remaining
|
|
7609
|
+
);
|
|
7610
|
+
} else {
|
|
7611
|
+
this.provisionalRelatedAgentCounts.delete(continuedAgentId);
|
|
7612
|
+
}
|
|
7613
|
+
if (succeeded2) {
|
|
7614
|
+
this.relatedAgentIds.add(continuedAgentId);
|
|
7615
|
+
}
|
|
7616
|
+
}, "settleRelatedAgent");
|
|
7081
7617
|
const execSpan = startToolExecutionSpan();
|
|
7082
7618
|
let toolResult;
|
|
7083
7619
|
let isExecutionTimeout = false;
|
|
@@ -7116,6 +7652,17 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7116
7652
|
`Qwen Code is executing tool ${toolName}`
|
|
7117
7653
|
);
|
|
7118
7654
|
try {
|
|
7655
|
+
try {
|
|
7656
|
+
addToolArgumentsAttributes(
|
|
7657
|
+
this.config,
|
|
7658
|
+
toolSpan,
|
|
7659
|
+
invocation.params
|
|
7660
|
+
);
|
|
7661
|
+
} catch {
|
|
7662
|
+
debugLogger6.debug(
|
|
7663
|
+
"[Session.runTool] Failed to record tool arguments telemetry"
|
|
7664
|
+
);
|
|
7665
|
+
}
|
|
7119
7666
|
toolResult = await invocation.execute(
|
|
7120
7667
|
activeToolAbortSignal,
|
|
7121
7668
|
onToolProgress
|
|
@@ -7126,6 +7673,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7126
7673
|
}
|
|
7127
7674
|
isExecutionTimeout = toolResult.error?.type === "execution_timeout" /* EXECUTION_TIMEOUT */;
|
|
7128
7675
|
aborted = activeToolAbortSignal.aborted && !isExecutionTimeout;
|
|
7676
|
+
settleRelatedAgent(!toolResult.error && !aborted);
|
|
7129
7677
|
endToolExecutionSpan(execSpan, {
|
|
7130
7678
|
success: !toolResult.error && !aborted,
|
|
7131
7679
|
error: aborted ? "tool_cancelled" : isExecutionTimeout ? "tool_timeout" : toolResult.error ? "tool_error" : void 0,
|
|
@@ -7133,6 +7681,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7133
7681
|
...heartbeatSpanAttributes()
|
|
7134
7682
|
});
|
|
7135
7683
|
} catch (execError) {
|
|
7684
|
+
settleRelatedAgent(false);
|
|
7136
7685
|
endToolExecutionSpan(execSpan, {
|
|
7137
7686
|
success: false,
|
|
7138
7687
|
error: activeToolAbortSignal.aborted ? "tool_cancelled" : "tool_exception",
|
|
@@ -7148,7 +7697,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7148
7697
|
this.#clearTodoStopGuardTrustAndDrainAutomaticQueues();
|
|
7149
7698
|
}
|
|
7150
7699
|
}
|
|
7151
|
-
|
|
7700
|
+
let responseParts = toolResult.error ? convertToFunctionErrorResponse(
|
|
7152
7701
|
toolName,
|
|
7153
7702
|
callId,
|
|
7154
7703
|
toolResult.llmContent,
|
|
@@ -7226,6 +7775,18 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7226
7775
|
artifacts: failureHookResult.artifacts
|
|
7227
7776
|
});
|
|
7228
7777
|
}
|
|
7778
|
+
const visionBridgeNotices = [];
|
|
7779
|
+
responseParts = await bridgeToolResultImages({
|
|
7780
|
+
config: this.config,
|
|
7781
|
+
responseParts,
|
|
7782
|
+
signal: activeToolAbortSignal,
|
|
7783
|
+
onFullTurnModel,
|
|
7784
|
+
onVisionBridgeNotice: /* @__PURE__ */ __name((notice) => visionBridgeNotices.push(notice), "onVisionBridgeNotice")
|
|
7785
|
+
});
|
|
7786
|
+
const visionBridgeNotice = visionBridgeNotices.length > 0 ? visionBridgeNotices.join("\n") : void 0;
|
|
7787
|
+
if (visionBridgeNotice) {
|
|
7788
|
+
await this.messageEmitter.emitAgentMessage(visionBridgeNotice);
|
|
7789
|
+
}
|
|
7229
7790
|
if (isTodoWriteTool) {
|
|
7230
7791
|
const todos = this.planEmitter.extractTodos(
|
|
7231
7792
|
toolResult.returnDisplay,
|
|
@@ -7269,11 +7830,26 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7269
7830
|
callId,
|
|
7270
7831
|
status,
|
|
7271
7832
|
resultDisplay: toolResult.returnDisplay,
|
|
7833
|
+
...visionBridgeNotice !== void 0 ? { visionBridgeNotice } : {},
|
|
7272
7834
|
error: toolResult.error ? new Error(toolResult.error.message) : void 0,
|
|
7273
7835
|
errorType: toolResult.error?.type
|
|
7274
7836
|
}
|
|
7275
7837
|
});
|
|
7276
7838
|
spanSuccess = succeeded;
|
|
7839
|
+
if (succeeded && !nestedPermissionCancelled) {
|
|
7840
|
+
const result = responseParts.find(
|
|
7841
|
+
(part) => part.functionResponse !== void 0
|
|
7842
|
+
)?.functionResponse?.response;
|
|
7843
|
+
if (result !== void 0) {
|
|
7844
|
+
try {
|
|
7845
|
+
addToolCallResultAttributes(this.config, toolSpan, result);
|
|
7846
|
+
} catch {
|
|
7847
|
+
debugLogger6.debug(
|
|
7848
|
+
"[Session.runTool] Failed to record tool result telemetry"
|
|
7849
|
+
);
|
|
7850
|
+
}
|
|
7851
|
+
}
|
|
7852
|
+
}
|
|
7277
7853
|
if (toolResult.error) {
|
|
7278
7854
|
spanError = toolResult.error.message;
|
|
7279
7855
|
} else if (aborted) {
|
|
@@ -7943,7 +8519,8 @@ function serializeMonitorTask(entry, now) {
|
|
|
7943
8519
|
...optionalField("pid", entry.pid),
|
|
7944
8520
|
...optionalField("exitCode", entry.exitCode),
|
|
7945
8521
|
...optionalField("error", entry.error),
|
|
7946
|
-
...optionalField("ownerAgentId", entry.ownerAgentId)
|
|
8522
|
+
...optionalField("ownerAgentId", entry.ownerAgentId),
|
|
8523
|
+
...optionalField("toolUseId", entry.toolUseId)
|
|
7947
8524
|
};
|
|
7948
8525
|
}
|
|
7949
8526
|
__name(serializeMonitorTask, "serializeMonitorTask");
|
|
@@ -8131,6 +8708,9 @@ function buildAcpLocalReadRoots(config) {
|
|
|
8131
8708
|
getUserAutoMemoryRoot(),
|
|
8132
8709
|
...config.storage.getUserSkillsDirs(),
|
|
8133
8710
|
Storage.getUserExtensionsDir(),
|
|
8711
|
+
// Saved plan files (see ReadFileTool.getDefaultPermission for why the
|
|
8712
|
+
// plans dir must be readable without a confirmation prompt).
|
|
8713
|
+
config.getPlansDir(),
|
|
8134
8714
|
...defaultAcpOnlyLocalReadRoots(),
|
|
8135
8715
|
...parseAcpLocalReadRootsEnv()
|
|
8136
8716
|
];
|
|
@@ -8182,6 +8762,32 @@ function isBulkLoadReplayRequest(params) {
|
|
|
8182
8762
|
return meta?.[LOAD_REPLAY_MODE_META_KEY] === LOAD_REPLAY_BULK_MODE;
|
|
8183
8763
|
}
|
|
8184
8764
|
__name(isBulkLoadReplayRequest, "isBulkLoadReplayRequest");
|
|
8765
|
+
function shouldHideInheritedHistory(params) {
|
|
8766
|
+
const meta = isObjectRecord(params._meta) ? params._meta : void 0;
|
|
8767
|
+
return meta?.[LOAD_REPLAY_HIDE_INHERITED_META_KEY] === true;
|
|
8768
|
+
}
|
|
8769
|
+
__name(shouldHideInheritedHistory, "shouldHideInheritedHistory");
|
|
8770
|
+
function selectVisibleHistoryRecords(records, hideInheritedHistory) {
|
|
8771
|
+
const sourceBoundary = records.findIndex(
|
|
8772
|
+
(record) => record.type === "system" && record.subtype === "session_source" && isObjectRecord(record.systemPayload) && record.systemPayload["sourceType"] === "side_task"
|
|
8773
|
+
);
|
|
8774
|
+
if (sourceBoundary >= 0) {
|
|
8775
|
+
return records.slice(sourceBoundary).filter((record) => record.forkedFrom === void 0);
|
|
8776
|
+
}
|
|
8777
|
+
return hideInheritedHistory ? records.filter((record) => record.forkedFrom === void 0) : records;
|
|
8778
|
+
}
|
|
8779
|
+
__name(selectVisibleHistoryRecords, "selectVisibleHistoryRecords");
|
|
8780
|
+
function isChannelSessionRequest(params) {
|
|
8781
|
+
const meta = isObjectRecord(params._meta) ? params._meta : void 0;
|
|
8782
|
+
const value = meta?.[SESSION_SOURCE_META_KEY];
|
|
8783
|
+
return isObjectRecord(value) && value["sourceType"] === "channel";
|
|
8784
|
+
}
|
|
8785
|
+
__name(isChannelSessionRequest, "isChannelSessionRequest");
|
|
8786
|
+
function shouldDeferMcpDiscovery(params) {
|
|
8787
|
+
const meta = isObjectRecord(params._meta) ? params._meta : void 0;
|
|
8788
|
+
return meta?.[WORKTREE_MCP_DEFER_META_KEY] === true;
|
|
8789
|
+
}
|
|
8790
|
+
__name(shouldDeferMcpDiscovery, "shouldDeferMcpDiscovery");
|
|
8185
8791
|
function getLoadReplayPageSize(params) {
|
|
8186
8792
|
const meta = isObjectRecord(params._meta) ? params._meta : void 0;
|
|
8187
8793
|
const value = meta?.[LOAD_REPLAY_PAGE_SIZE_META_KEY];
|
|
@@ -9611,7 +10217,97 @@ async function deliverClientMcpMessage(connection, serverName, message, sessionI
|
|
|
9611
10217
|
return payload;
|
|
9612
10218
|
}
|
|
9613
10219
|
__name(deliverClientMcpMessage, "deliverClientMcpMessage");
|
|
10220
|
+
function readRuntimeMcpRequest(params) {
|
|
10221
|
+
const name = params["name"];
|
|
10222
|
+
if (typeof name !== "string" || name.length === 0) {
|
|
10223
|
+
throw RequestError.invalidParams(void 0, "Invalid or missing name");
|
|
10224
|
+
}
|
|
10225
|
+
if (!isValidServerName(name)) {
|
|
10226
|
+
throw RequestError.invalidParams(
|
|
10227
|
+
void 0,
|
|
10228
|
+
"Server name must be \u2264256 chars, alphanumeric + underscore/hyphen, and not a reserved JS property name"
|
|
10229
|
+
);
|
|
10230
|
+
}
|
|
10231
|
+
const originatorClientId = params["originatorClientId"];
|
|
10232
|
+
return {
|
|
10233
|
+
name,
|
|
10234
|
+
runtimeClientId: typeof originatorClientId === "string" && originatorClientId.length > 0 ? originatorClientId : "daemon"
|
|
10235
|
+
};
|
|
10236
|
+
}
|
|
10237
|
+
__name(readRuntimeMcpRequest, "readRuntimeMcpRequest");
|
|
10238
|
+
function readRuntimeMcpAddRequest(params) {
|
|
10239
|
+
const request = readRuntimeMcpRequest(params);
|
|
10240
|
+
const config = params["config"];
|
|
10241
|
+
if (!config || typeof config !== "object" || Array.isArray(config)) {
|
|
10242
|
+
throw RequestError.invalidParams(void 0, "Invalid or missing config");
|
|
10243
|
+
}
|
|
10244
|
+
const {
|
|
10245
|
+
trust: _trust,
|
|
10246
|
+
authProviderType: _auth,
|
|
10247
|
+
includeTools: _inc,
|
|
10248
|
+
excludeTools: _exc,
|
|
10249
|
+
cwd: _cwd,
|
|
10250
|
+
env: _env,
|
|
10251
|
+
oauth: _oauth,
|
|
10252
|
+
headers: _headers,
|
|
10253
|
+
type: _type,
|
|
10254
|
+
[CLIENT_MCP_OVER_WS_CONFIG_FLAG]: clientMcpOverWs,
|
|
10255
|
+
...safeConfig
|
|
10256
|
+
} = config;
|
|
10257
|
+
if (clientMcpOverWs === true) {
|
|
10258
|
+
safeConfig["type"] = "sdk";
|
|
10259
|
+
}
|
|
10260
|
+
return {
|
|
10261
|
+
...request,
|
|
10262
|
+
config: safeConfig
|
|
10263
|
+
};
|
|
10264
|
+
}
|
|
10265
|
+
__name(readRuntimeMcpAddRequest, "readRuntimeMcpAddRequest");
|
|
10266
|
+
function getRuntimeMcpManager(config) {
|
|
10267
|
+
const manager = config.getToolRegistry()?.getMcpClientManager();
|
|
10268
|
+
if (!manager) {
|
|
10269
|
+
throw RequestError.internalError(
|
|
10270
|
+
void 0,
|
|
10271
|
+
"McpClientManager unavailable on this Config"
|
|
10272
|
+
);
|
|
10273
|
+
}
|
|
10274
|
+
return manager;
|
|
10275
|
+
}
|
|
10276
|
+
__name(getRuntimeMcpManager, "getRuntimeMcpManager");
|
|
10277
|
+
async function addRuntimeMcpServer(manager, request) {
|
|
10278
|
+
try {
|
|
10279
|
+
return await manager.addRuntimeMcpServer(
|
|
10280
|
+
request.name,
|
|
10281
|
+
request.config,
|
|
10282
|
+
request.runtimeClientId
|
|
10283
|
+
);
|
|
10284
|
+
} catch (err) {
|
|
10285
|
+
if (err instanceof McpBudgetWouldExceedError) {
|
|
10286
|
+
throw new RequestError(-32099, err.message, {
|
|
10287
|
+
errorKind: err.code,
|
|
10288
|
+
serverName: err.serverName
|
|
10289
|
+
});
|
|
10290
|
+
}
|
|
10291
|
+
if (err instanceof McpServerSpawnFailedError) {
|
|
10292
|
+
throw new RequestError(-32099, err.message, {
|
|
10293
|
+
errorKind: err.code,
|
|
10294
|
+
serverName: err.serverName,
|
|
10295
|
+
...err.details
|
|
10296
|
+
});
|
|
10297
|
+
}
|
|
10298
|
+
if (err instanceof InvalidMcpConfigError) {
|
|
10299
|
+
throw new RequestError(-32099, err.message, {
|
|
10300
|
+
errorKind: err.code,
|
|
10301
|
+
serverName: err.serverName,
|
|
10302
|
+
reason: err.reason
|
|
10303
|
+
});
|
|
10304
|
+
}
|
|
10305
|
+
throw err;
|
|
10306
|
+
}
|
|
10307
|
+
}
|
|
10308
|
+
__name(addRuntimeMcpServer, "addRuntimeMcpServer");
|
|
9614
10309
|
async function runAcpAgent(config, settings, argv, options) {
|
|
10310
|
+
const sessionWriterLeaseEnabledAtStartup = typeof config.isSessionWriterLeaseEnabled === "function" ? config.isSessionWriterLeaseEnabled() : settings.merged.experimental?.sessionWriterLease === true;
|
|
9615
10311
|
const privateParentCapability = options === void 0 ? process.env[PRIVATE_ACP_CAPABILITY_ENV] : options.privateParentCapability;
|
|
9616
10312
|
delete process.env[PRIVATE_ACP_CAPABILITY_ENV];
|
|
9617
10313
|
let acpConnection;
|
|
@@ -9651,12 +10347,31 @@ async function runAcpAgent(config, settings, argv, options) {
|
|
|
9651
10347
|
console.info = console.error;
|
|
9652
10348
|
console.debug = console.error;
|
|
9653
10349
|
let initializeRequestId;
|
|
10350
|
+
const pendingNewSessionRequestIds = /* @__PURE__ */ new Set();
|
|
9654
10351
|
const stream = ndJsonStream(stdout, stdin, {
|
|
9655
10352
|
onMessageObserved: /* @__PURE__ */ __name(({ direction, message }) => {
|
|
9656
|
-
if (direction === "received" && "id" in message && "method" in message
|
|
9657
|
-
|
|
10353
|
+
if (direction === "received" && "id" in message && "method" in message) {
|
|
10354
|
+
if (message.method === "session/new") {
|
|
10355
|
+
pendingNewSessionRequestIds.add(message.id);
|
|
10356
|
+
} else if (message.method === "initialize") {
|
|
10357
|
+
initializeRequestId = message.id;
|
|
10358
|
+
}
|
|
9658
10359
|
return;
|
|
9659
10360
|
}
|
|
10361
|
+
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") {
|
|
10362
|
+
const sessionId = message.result.sessionId;
|
|
10363
|
+
setImmediate(() => {
|
|
10364
|
+
const session = agentInstance?.getActiveSessions().find((candidate) => candidate.getId() === sessionId);
|
|
10365
|
+
if (!session) return;
|
|
10366
|
+
void preloadContentGenerator(
|
|
10367
|
+
session.getConfig().getContentGenerator()
|
|
10368
|
+
).catch((error) => {
|
|
10369
|
+
debugLogger7.debug(
|
|
10370
|
+
`[ACP] Session provider preload failed for ${sessionId}: ${error instanceof Error ? error.message : String(error)}`
|
|
10371
|
+
);
|
|
10372
|
+
});
|
|
10373
|
+
}).unref();
|
|
10374
|
+
}
|
|
9660
10375
|
if (direction !== "sent" || initializeRequestId === void 0 || !("id" in message) || "method" in message || message.id !== initializeRequestId) {
|
|
9661
10376
|
return;
|
|
9662
10377
|
}
|
|
@@ -9675,7 +10390,8 @@ async function runAcpAgent(config, settings, argv, options) {
|
|
|
9675
10390
|
settings,
|
|
9676
10391
|
argv,
|
|
9677
10392
|
conn,
|
|
9678
|
-
privateParentCapability
|
|
10393
|
+
privateParentCapability,
|
|
10394
|
+
sessionWriterLeaseEnabledAtStartup
|
|
9679
10395
|
);
|
|
9680
10396
|
return agentInstance;
|
|
9681
10397
|
}, stream);
|
|
@@ -9684,29 +10400,34 @@ async function runAcpAgent(config, settings, argv, options) {
|
|
|
9684
10400
|
eventLoopMonitor.dispose();
|
|
9685
10401
|
throw err;
|
|
9686
10402
|
}
|
|
9687
|
-
const drainPoolBeforeExit = /* @__PURE__ */ __name(async (label) => {
|
|
10403
|
+
const drainPoolBeforeExit = /* @__PURE__ */ __name(async (label, strict = false) => {
|
|
9688
10404
|
if (!agentInstance) return;
|
|
9689
10405
|
try {
|
|
9690
10406
|
await agentInstance.shutdownMcpPool(8e3);
|
|
9691
10407
|
} catch (err) {
|
|
9692
10408
|
debugLogger7.error(`[ACP] MCP pool drain (${label}) error:`, err);
|
|
10409
|
+
if (strict) throw err;
|
|
9693
10410
|
}
|
|
9694
10411
|
}, "drainPoolBeforeExit");
|
|
9695
10412
|
let shuttingDown = false;
|
|
10413
|
+
let managedShutdownPromise;
|
|
9696
10414
|
let sessionEndFired = false;
|
|
9697
|
-
const fireSessionEndOnce = /* @__PURE__ */ __name(async (reason) => {
|
|
10415
|
+
const fireSessionEndOnce = /* @__PURE__ */ __name(async (reason, managedConfigs) => {
|
|
9698
10416
|
if (sessionEndFired) return;
|
|
9699
10417
|
sessionEndFired = true;
|
|
9700
|
-
const configs =
|
|
9701
|
-
|
|
9702
|
-
|
|
9703
|
-
|
|
9704
|
-
const
|
|
9705
|
-
|
|
9706
|
-
|
|
10418
|
+
const configs = new Set(managedConfigs ?? [config]);
|
|
10419
|
+
if (!managedConfigs) {
|
|
10420
|
+
const sessions = agentInstance?.getActiveSessions();
|
|
10421
|
+
if (sessions) {
|
|
10422
|
+
for (const session of sessions) {
|
|
10423
|
+
const sessionConfig = session.getConfig?.();
|
|
10424
|
+
if (sessionConfig) {
|
|
10425
|
+
configs.add(sessionConfig);
|
|
10426
|
+
}
|
|
9707
10427
|
}
|
|
9708
10428
|
}
|
|
9709
10429
|
}
|
|
10430
|
+
const failures = [];
|
|
9710
10431
|
for (const cfg of configs) {
|
|
9711
10432
|
const hookSystem = cfg.getHookSystem?.();
|
|
9712
10433
|
const hooksEnabled = !cfg.getDisableAllHooks?.();
|
|
@@ -9716,16 +10437,99 @@ async function runAcpAgent(config, settings, argv, options) {
|
|
|
9716
10437
|
try {
|
|
9717
10438
|
await hookSystem.fireSessionEndEvent(reason);
|
|
9718
10439
|
} catch (err) {
|
|
10440
|
+
if (managedConfigs) failures.push(err);
|
|
9719
10441
|
debugLogger7.warn(
|
|
9720
10442
|
`SessionEnd hook failed: ${err instanceof Error ? err.message : String(err)}`
|
|
9721
10443
|
);
|
|
9722
10444
|
}
|
|
9723
10445
|
}
|
|
10446
|
+
if (failures.length > 0) {
|
|
10447
|
+
throw new AggregateError(failures, "SessionEnd hook shutdown failed");
|
|
10448
|
+
}
|
|
9724
10449
|
}, "fireSessionEndOnce");
|
|
10450
|
+
const shutdownManagedAgent = /* @__PURE__ */ __name((reason, label) => {
|
|
10451
|
+
if (managedShutdownPromise) return managedShutdownPromise;
|
|
10452
|
+
const agent = agentInstance;
|
|
10453
|
+
if (!agent?.isTrustedManagedParent()) {
|
|
10454
|
+
return Promise.reject(
|
|
10455
|
+
new Error("Managed shutdown requires a trusted private parent")
|
|
10456
|
+
);
|
|
10457
|
+
}
|
|
10458
|
+
const terminal = agent.beginManagedShutdown();
|
|
10459
|
+
managedShutdownPromise = (async () => {
|
|
10460
|
+
const failures = [];
|
|
10461
|
+
try {
|
|
10462
|
+
await terminal.writerShutdown;
|
|
10463
|
+
} catch (error) {
|
|
10464
|
+
failures.push(error);
|
|
10465
|
+
debugLogger7.error("[ACP] Managed writer shutdown error:", error);
|
|
10466
|
+
const retainedLockPaths = terminal.configs.flatMap((config2) => {
|
|
10467
|
+
if (typeof config2.getSessionRuntimeBaseDir !== "function" || typeof config2.getSessionId !== "function") {
|
|
10468
|
+
return [];
|
|
10469
|
+
}
|
|
10470
|
+
return [
|
|
10471
|
+
path4.join(
|
|
10472
|
+
config2.getSessionRuntimeBaseDir(),
|
|
10473
|
+
"tmp",
|
|
10474
|
+
"session-writer-locks",
|
|
10475
|
+
`${encodeURIComponent(config2.getSessionId())}.lock`
|
|
10476
|
+
)
|
|
10477
|
+
];
|
|
10478
|
+
});
|
|
10479
|
+
writeStderrLineSafe(
|
|
10480
|
+
"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(", ")}` : "")
|
|
10481
|
+
);
|
|
10482
|
+
}
|
|
10483
|
+
try {
|
|
10484
|
+
await fireSessionEndOnce(reason, terminal.configs);
|
|
10485
|
+
} catch (error) {
|
|
10486
|
+
failures.push(error);
|
|
10487
|
+
}
|
|
10488
|
+
try {
|
|
10489
|
+
await agent.finishManagedShutdown(terminal.configs);
|
|
10490
|
+
} catch (error) {
|
|
10491
|
+
failures.push(error);
|
|
10492
|
+
debugLogger7.error("[ACP] Managed resource shutdown error:", error);
|
|
10493
|
+
}
|
|
10494
|
+
try {
|
|
10495
|
+
await drainPoolBeforeExit(label, true);
|
|
10496
|
+
} catch (error) {
|
|
10497
|
+
failures.push(error);
|
|
10498
|
+
}
|
|
10499
|
+
try {
|
|
10500
|
+
await runExitCleanup();
|
|
10501
|
+
} catch (error) {
|
|
10502
|
+
failures.push(error);
|
|
10503
|
+
debugLogger7.error("[ACP] Cleanup error:", error);
|
|
10504
|
+
}
|
|
10505
|
+
if (failures.length > 0) {
|
|
10506
|
+
throw new AggregateError(failures, "Managed ACP shutdown failed");
|
|
10507
|
+
}
|
|
10508
|
+
})();
|
|
10509
|
+
return managedShutdownPromise;
|
|
10510
|
+
}, "shutdownManagedAgent");
|
|
9725
10511
|
const shutdownHandler = /* @__PURE__ */ __name(async () => {
|
|
9726
10512
|
if (shuttingDown) return;
|
|
9727
10513
|
shuttingDown = true;
|
|
9728
10514
|
debugLogger7.debug("[ACP] Shutdown signal received, closing streams");
|
|
10515
|
+
if (agentInstance?.isTrustedManagedParent()) {
|
|
10516
|
+
let exitCode = 0;
|
|
10517
|
+
try {
|
|
10518
|
+
await shutdownManagedAgent("other" /* Other */, "signal");
|
|
10519
|
+
} catch (err) {
|
|
10520
|
+
exitCode = 1;
|
|
10521
|
+
debugLogger7.error("[ACP] Managed shutdown error:", err);
|
|
10522
|
+
} finally {
|
|
10523
|
+
eventLoopMonitor.dispose();
|
|
10524
|
+
}
|
|
10525
|
+
try {
|
|
10526
|
+
process.stdin.destroy();
|
|
10527
|
+
process.stdout.destroy();
|
|
10528
|
+
} catch {
|
|
10529
|
+
}
|
|
10530
|
+
process.exit(exitCode);
|
|
10531
|
+
return;
|
|
10532
|
+
}
|
|
9729
10533
|
try {
|
|
9730
10534
|
await fireSessionEndOnce("other" /* Other */);
|
|
9731
10535
|
await agentInstance?.disposeSessions();
|
|
@@ -9753,9 +10557,21 @@ async function runAcpAgent(config, settings, argv, options) {
|
|
|
9753
10557
|
process.on("SIGINT", shutdownHandler);
|
|
9754
10558
|
try {
|
|
9755
10559
|
await connection.closed;
|
|
9756
|
-
|
|
9757
|
-
|
|
9758
|
-
|
|
10560
|
+
if (agentInstance?.isTrustedManagedParent()) {
|
|
10561
|
+
try {
|
|
10562
|
+
await shutdownManagedAgent(
|
|
10563
|
+
"prompt_input_exit" /* PromptInputExit */,
|
|
10564
|
+
"ide_close"
|
|
10565
|
+
);
|
|
10566
|
+
} catch (error) {
|
|
10567
|
+
process.exitCode = 1;
|
|
10568
|
+
throw error;
|
|
10569
|
+
}
|
|
10570
|
+
} else {
|
|
10571
|
+
await fireSessionEndOnce("prompt_input_exit" /* PromptInputExit */);
|
|
10572
|
+
await drainPoolBeforeExit("ide_close");
|
|
10573
|
+
await agentInstance?.disposeSessions();
|
|
10574
|
+
}
|
|
9759
10575
|
} finally {
|
|
9760
10576
|
process.off("SIGTERM", shutdownHandler);
|
|
9761
10577
|
process.off("SIGINT", shutdownHandler);
|
|
@@ -9872,12 +10688,13 @@ function parseAcpSessionListCursor(value) {
|
|
|
9872
10688
|
}
|
|
9873
10689
|
__name(parseAcpSessionListCursor, "parseAcpSessionListCursor");
|
|
9874
10690
|
var QwenAgent = class {
|
|
9875
|
-
constructor(config, settings, argv, connection, expectedPrivateParentCapability) {
|
|
10691
|
+
constructor(config, settings, argv, connection, expectedPrivateParentCapability, sessionWriterLeaseEnabledAtStartup = false) {
|
|
9876
10692
|
this.config = config;
|
|
9877
10693
|
this.settings = settings;
|
|
9878
10694
|
this.argv = argv;
|
|
9879
10695
|
this.connection = connection;
|
|
9880
10696
|
this.expectedPrivateParentCapability = expectedPrivateParentCapability;
|
|
10697
|
+
this.sessionWriterLeaseEnabledAtStartup = sessionWriterLeaseEnabledAtStartup;
|
|
9881
10698
|
if (process.env["QWEN_SERVE_NO_MCP_POOL"] === "1") {
|
|
9882
10699
|
this.mcpPool = void 0;
|
|
9883
10700
|
this.workspaceMcpBudget = void 0;
|
|
@@ -9912,12 +10729,15 @@ var QwenAgent = class {
|
|
|
9912
10729
|
workspaceMcpDiscoveryConfig;
|
|
9913
10730
|
workspaceMcpDiscoveryPromise;
|
|
9914
10731
|
workspaceMcpDiscoveryError;
|
|
10732
|
+
workspaceExtensionStatusRefreshPromise;
|
|
9915
10733
|
pendingMcpAuthentications = /* @__PURE__ */ new Map();
|
|
9916
10734
|
mcpAuthenticationResults = /* @__PURE__ */ new Map();
|
|
9917
10735
|
generationControllers = /* @__PURE__ */ new Map();
|
|
9918
10736
|
workspaceGenerationControllers = /* @__PURE__ */ new Map();
|
|
9919
10737
|
transcriptReplayConfigCache = /* @__PURE__ */ new Map();
|
|
9920
10738
|
pendingConfigCleanup = /* @__PURE__ */ new Map();
|
|
10739
|
+
initializingConfigs = /* @__PURE__ */ new Set();
|
|
10740
|
+
managedShuttingDown = false;
|
|
9921
10741
|
clientCapabilities;
|
|
9922
10742
|
privateParentState = "uninitialized";
|
|
9923
10743
|
// CPU-usage delta baseline for the daemon's `workspaceResource` extMethod
|
|
@@ -9951,12 +10771,141 @@ var QwenAgent = class {
|
|
|
9951
10771
|
getActiveSessions() {
|
|
9952
10772
|
return [...this.sessions.values()];
|
|
9953
10773
|
}
|
|
10774
|
+
isTrustedManagedParent() {
|
|
10775
|
+
return this.privateParentState === "trusted";
|
|
10776
|
+
}
|
|
10777
|
+
assertManagedSessionAdmission() {
|
|
10778
|
+
if (this.expectedPrivateParentCapability !== void 0 && !this.isTrustedManagedParent()) {
|
|
10779
|
+
throw RequestError.invalidParams(
|
|
10780
|
+
void 0,
|
|
10781
|
+
"Private ACP parent is not initialized"
|
|
10782
|
+
);
|
|
10783
|
+
}
|
|
10784
|
+
if (this.managedShuttingDown) {
|
|
10785
|
+
throw new SessionWriterUnavailableError();
|
|
10786
|
+
}
|
|
10787
|
+
}
|
|
10788
|
+
beginManagedShutdown() {
|
|
10789
|
+
if (!this.isTrustedManagedParent()) {
|
|
10790
|
+
throw new Error("Managed shutdown requires a trusted private parent");
|
|
10791
|
+
}
|
|
10792
|
+
this.managedShuttingDown = true;
|
|
10793
|
+
for (const generation of this.generationControllers.values()) {
|
|
10794
|
+
generation.controller.abort();
|
|
10795
|
+
}
|
|
10796
|
+
this.generationControllers.clear();
|
|
10797
|
+
for (const controller of this.workspaceGenerationControllers.values()) {
|
|
10798
|
+
controller.abort();
|
|
10799
|
+
}
|
|
10800
|
+
this.workspaceGenerationControllers.clear();
|
|
10801
|
+
const configs = /* @__PURE__ */ new Set([this.config, ...this.initializingConfigs]);
|
|
10802
|
+
for (const session of this.sessions.values()) {
|
|
10803
|
+
try {
|
|
10804
|
+
session.beginCloseIfAvailable();
|
|
10805
|
+
} catch (error) {
|
|
10806
|
+
debugLogger7.debug(
|
|
10807
|
+
`Session ${session.getId()} admission close during managed shutdown failed: ${error instanceof Error ? error.message : String(error)}`
|
|
10808
|
+
);
|
|
10809
|
+
}
|
|
10810
|
+
void session.cancelPendingPrompt().catch((error) => {
|
|
10811
|
+
debugLogger7.debug(
|
|
10812
|
+
`Session ${session.getId()} cancel during managed shutdown failed: ${error instanceof Error ? error.message : String(error)}`
|
|
10813
|
+
);
|
|
10814
|
+
});
|
|
10815
|
+
configs.add(session.getConfig());
|
|
10816
|
+
}
|
|
10817
|
+
for (const pending of this.pendingConfigCleanup.values()) {
|
|
10818
|
+
for (const config of pending) configs.add(config);
|
|
10819
|
+
}
|
|
10820
|
+
const configList = [...configs];
|
|
10821
|
+
const writerTerminals = [];
|
|
10822
|
+
for (const config of configList) {
|
|
10823
|
+
try {
|
|
10824
|
+
writerTerminals.push(config.closeSessionWriter({ handoff: true }));
|
|
10825
|
+
} catch (error) {
|
|
10826
|
+
writerTerminals.push(Promise.reject(error));
|
|
10827
|
+
}
|
|
10828
|
+
}
|
|
10829
|
+
const writerShutdown = Promise.allSettled(writerTerminals).then(
|
|
10830
|
+
(results) => {
|
|
10831
|
+
const failures = results.flatMap(
|
|
10832
|
+
(result) => result.status === "rejected" ? [result.reason] : []
|
|
10833
|
+
);
|
|
10834
|
+
if (failures.length > 0) {
|
|
10835
|
+
throw new AggregateError(
|
|
10836
|
+
failures,
|
|
10837
|
+
"Managed session writer shutdown failed"
|
|
10838
|
+
);
|
|
10839
|
+
}
|
|
10840
|
+
}
|
|
10841
|
+
);
|
|
10842
|
+
return { configs: configList, writerShutdown };
|
|
10843
|
+
}
|
|
10844
|
+
async finishManagedShutdown(configs) {
|
|
10845
|
+
const failures = [];
|
|
10846
|
+
for (const [sessionId, session] of [...this.sessions]) {
|
|
10847
|
+
await this.removeStoredSessionEntry(sessionId, session, failures, {
|
|
10848
|
+
shutdownConfig: false
|
|
10849
|
+
});
|
|
10850
|
+
}
|
|
10851
|
+
const results = await Promise.allSettled(
|
|
10852
|
+
configs.map(
|
|
10853
|
+
(config) => config.shutdown({
|
|
10854
|
+
shutdownTelemetry: false,
|
|
10855
|
+
skipSessionWriter: true,
|
|
10856
|
+
strictResourceCleanup: true
|
|
10857
|
+
})
|
|
10858
|
+
)
|
|
10859
|
+
);
|
|
10860
|
+
for (const result of results) {
|
|
10861
|
+
if (result.status === "rejected") failures.push(result.reason);
|
|
10862
|
+
}
|
|
10863
|
+
this.initializingConfigs.clear();
|
|
10864
|
+
this.pendingConfigCleanup.clear();
|
|
10865
|
+
this.disposeTranscriptReplayConfigs();
|
|
10866
|
+
if (failures.length > 0) {
|
|
10867
|
+
throw new AggregateError(failures, "Managed session cleanup failed");
|
|
10868
|
+
}
|
|
10869
|
+
}
|
|
9954
10870
|
getWorkspaceMcpConfig(serverName) {
|
|
9955
10871
|
if (serverName && this.config.getRuntimeMcpServers?.()[serverName] !== void 0) {
|
|
9956
10872
|
return this.config;
|
|
9957
10873
|
}
|
|
9958
10874
|
return this.workspaceMcpDiscoveryConfig ?? this.config;
|
|
9959
10875
|
}
|
|
10876
|
+
refreshBootstrapExtensionStatus() {
|
|
10877
|
+
if (this.workspaceExtensionStatusRefreshPromise) {
|
|
10878
|
+
return this.workspaceExtensionStatusRefreshPromise;
|
|
10879
|
+
}
|
|
10880
|
+
const promise = (async () => {
|
|
10881
|
+
const errors = [];
|
|
10882
|
+
try {
|
|
10883
|
+
await this.config.getExtensionManager().refreshCache();
|
|
10884
|
+
} catch (error) {
|
|
10885
|
+
errors.push(error);
|
|
10886
|
+
}
|
|
10887
|
+
try {
|
|
10888
|
+
await this.config.getSkillManager()?.refreshCache();
|
|
10889
|
+
} catch (error) {
|
|
10890
|
+
errors.push(error);
|
|
10891
|
+
}
|
|
10892
|
+
if (errors.length === 1) throw errors[0];
|
|
10893
|
+
if (errors.length > 1) {
|
|
10894
|
+
throw new AggregateError(
|
|
10895
|
+
errors,
|
|
10896
|
+
"Bootstrap extension status refresh failed"
|
|
10897
|
+
);
|
|
10898
|
+
}
|
|
10899
|
+
})();
|
|
10900
|
+
this.workspaceExtensionStatusRefreshPromise = promise;
|
|
10901
|
+
const clear = /* @__PURE__ */ __name(() => {
|
|
10902
|
+
if (this.workspaceExtensionStatusRefreshPromise === promise) {
|
|
10903
|
+
this.workspaceExtensionStatusRefreshPromise = void 0;
|
|
10904
|
+
}
|
|
10905
|
+
}, "clear");
|
|
10906
|
+
void promise.then(clear, clear);
|
|
10907
|
+
return promise;
|
|
10908
|
+
}
|
|
9960
10909
|
getLiveMcpConfigs(serverName) {
|
|
9961
10910
|
return [
|
|
9962
10911
|
.../* @__PURE__ */ new Set([
|
|
@@ -10093,16 +11042,18 @@ var QwenAgent = class {
|
|
|
10093
11042
|
for (const config of liveConfigs) {
|
|
10094
11043
|
try {
|
|
10095
11044
|
const cwd = config.getTargetDir();
|
|
10096
|
-
const
|
|
11045
|
+
const isBareOrSafe = config.getBareMode() || config.isSafeMode();
|
|
11046
|
+
const mcpServers = isBareOrSafe ? { ...config.getTopTierMcpServers() } : assembleMcpServers(
|
|
10097
11047
|
settings.merged.mcpServers,
|
|
10098
11048
|
cwd,
|
|
10099
11049
|
config.getTopTierMcpServers()
|
|
10100
11050
|
);
|
|
10101
|
-
const
|
|
11051
|
+
const bootAllowed = config.getCliAllowedMcpServerNames();
|
|
11052
|
+
const gating = isBareOrSafe ? { allowed: bootAllowed ? [...bootAllowed] : void 0 } : recomputeMcpGating(
|
|
10102
11053
|
settings,
|
|
10103
11054
|
mcpServers,
|
|
10104
11055
|
cwd,
|
|
10105
|
-
|
|
11056
|
+
bootAllowed,
|
|
10106
11057
|
config.getApprovalMode() === "yolo" /* YOLO */
|
|
10107
11058
|
);
|
|
10108
11059
|
config.setExcludedMcpServers(gating.excluded ?? []);
|
|
@@ -10195,11 +11146,15 @@ var QwenAgent = class {
|
|
|
10195
11146
|
debugLogger7.warn(
|
|
10196
11147
|
`MCP pool drain: ${result.drained} clean, ${result.forced} timed out, ${result.errors.length} errors`
|
|
10197
11148
|
);
|
|
11149
|
+
throw new Error(
|
|
11150
|
+
`MCP pool drain incomplete: ${result.forced} forced, ${result.errors.length} errors`
|
|
11151
|
+
);
|
|
10198
11152
|
}
|
|
10199
11153
|
} catch (err) {
|
|
10200
11154
|
debugLogger7.error(
|
|
10201
11155
|
`MCP pool drainAll failed: ${err instanceof Error ? err.message : String(err)}`
|
|
10202
11156
|
);
|
|
11157
|
+
throw err;
|
|
10203
11158
|
}
|
|
10204
11159
|
}
|
|
10205
11160
|
async removeStoredSessionEntry(sessionId, session, cleanupErrors = [], options = {}) {
|
|
@@ -10270,11 +11225,13 @@ var QwenAgent = class {
|
|
|
10270
11225
|
try {
|
|
10271
11226
|
await shutdownSessionConfig(config);
|
|
10272
11227
|
} catch (error) {
|
|
11228
|
+
this.initializingConfigs.delete(config);
|
|
10273
11229
|
const pending2 = this.pendingConfigCleanup.get(cleanupKey) ?? /* @__PURE__ */ new Set();
|
|
10274
11230
|
pending2.add(config);
|
|
10275
11231
|
this.pendingConfigCleanup.set(cleanupKey, pending2);
|
|
10276
11232
|
throw mapSessionWriterRequestError(error);
|
|
10277
11233
|
}
|
|
11234
|
+
this.initializingConfigs.delete(config);
|
|
10278
11235
|
const pending = this.pendingConfigCleanup.get(cleanupKey);
|
|
10279
11236
|
pending?.delete(config);
|
|
10280
11237
|
if (pending?.size === 0) {
|
|
@@ -10289,7 +11246,7 @@ var QwenAgent = class {
|
|
|
10289
11246
|
`Session cleanup failed while preserving the original request error: ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}`
|
|
10290
11247
|
);
|
|
10291
11248
|
}
|
|
10292
|
-
throw error;
|
|
11249
|
+
throw mapSessionWriterRequestError(error);
|
|
10293
11250
|
}
|
|
10294
11251
|
pendingConfigCleanupKey(runtimeBaseDir, sessionId) {
|
|
10295
11252
|
return `${path4.resolve(runtimeBaseDir)}\0${sessionId}`;
|
|
@@ -10479,7 +11436,7 @@ var QwenAgent = class {
|
|
|
10479
11436
|
}
|
|
10480
11437
|
this.clientCapabilities = args.clientCapabilities;
|
|
10481
11438
|
const authMethods = buildAuthMethods();
|
|
10482
|
-
const version = "0.21.
|
|
11439
|
+
const version = "0.21.1-nightly.20260731.702932cc7";
|
|
10483
11440
|
const response = {
|
|
10484
11441
|
protocolVersion: PROTOCOL_VERSION,
|
|
10485
11442
|
agentInfo: {
|
|
@@ -10553,6 +11510,7 @@ var QwenAgent = class {
|
|
|
10553
11510
|
}
|
|
10554
11511
|
async newSession(params) {
|
|
10555
11512
|
const { cwd, mcpServers } = params;
|
|
11513
|
+
const isChannelSession = isChannelSessionRequest(params);
|
|
10556
11514
|
const parentContext = extractDaemonTraceContext(params);
|
|
10557
11515
|
return await withDaemonSpan(
|
|
10558
11516
|
"qwen-code.daemon.session_start",
|
|
@@ -10566,7 +11524,15 @@ var QwenAgent = class {
|
|
|
10566
11524
|
this.settings = settings;
|
|
10567
11525
|
const config = await profiler.time(
|
|
10568
11526
|
"config_setup",
|
|
10569
|
-
() => this.newSessionConfig(
|
|
11527
|
+
() => this.newSessionConfig(
|
|
11528
|
+
cwd,
|
|
11529
|
+
mcpServers,
|
|
11530
|
+
settings,
|
|
11531
|
+
isChannelSession,
|
|
11532
|
+
void 0,
|
|
11533
|
+
void 0,
|
|
11534
|
+
shouldDeferMcpDiscovery(params) ? { skipMcpDiscovery: true } : void 0
|
|
11535
|
+
)
|
|
10570
11536
|
);
|
|
10571
11537
|
let session;
|
|
10572
11538
|
try {
|
|
@@ -10598,6 +11564,7 @@ var QwenAgent = class {
|
|
|
10598
11564
|
);
|
|
10599
11565
|
}
|
|
10600
11566
|
async loadSession(params) {
|
|
11567
|
+
const isChannelSession = isChannelSessionRequest(params);
|
|
10601
11568
|
const settings = loadSettingsCached(params.cwd);
|
|
10602
11569
|
const liveSession = this.sessions.get(params.sessionId);
|
|
10603
11570
|
if (liveSession) {
|
|
@@ -10614,9 +11581,16 @@ var QwenAgent = class {
|
|
|
10614
11581
|
...sessionData2.artifactSnapshot ? { artifactSnapshot: sessionData2.artifactSnapshot } : {}
|
|
10615
11582
|
};
|
|
10616
11583
|
const records = sessionData2.conversation.messages;
|
|
10617
|
-
|
|
11584
|
+
const visibleRecords = selectVisibleHistoryRecords(
|
|
11585
|
+
records,
|
|
11586
|
+
shouldHideInheritedHistory(params)
|
|
11587
|
+
);
|
|
11588
|
+
if (visibleRecords.length === 0) return response2;
|
|
10618
11589
|
const bulkReplay2 = isBulkLoadReplayRequest(params);
|
|
10619
|
-
const replayPage = bulkReplay2 ? selectRecentHistoryRecords(
|
|
11590
|
+
const replayPage = bulkReplay2 ? selectRecentHistoryRecords(
|
|
11591
|
+
visibleRecords,
|
|
11592
|
+
getLoadReplayPageSize(params)
|
|
11593
|
+
) : { records: visibleRecords, hasMore: false };
|
|
10620
11594
|
const replay = await collectHistoryReplayUpdates({
|
|
10621
11595
|
sessionId: params.sessionId,
|
|
10622
11596
|
config: config2,
|
|
@@ -10668,22 +11642,70 @@ var QwenAgent = class {
|
|
|
10668
11642
|
// a `null`/`undefined` would otherwise throw `TypeError`.
|
|
10669
11643
|
params.mcpServers ?? [],
|
|
10670
11644
|
settings,
|
|
11645
|
+
isChannelSession,
|
|
10671
11646
|
params.sessionId,
|
|
10672
11647
|
true
|
|
10673
11648
|
);
|
|
10674
11649
|
const sessionData = config.getResumedSessionData();
|
|
10675
11650
|
const bulkReplay = isBulkLoadReplayRequest(params);
|
|
10676
11651
|
const replayPageSize = bulkReplay ? getLoadReplayPageSize(params) : void 0;
|
|
10677
|
-
let
|
|
11652
|
+
let replayEnvelope;
|
|
10678
11653
|
try {
|
|
10679
11654
|
await this.ensureAuthenticated(config);
|
|
10680
11655
|
this.setupFileSystem(config);
|
|
10681
|
-
|
|
10682
|
-
|
|
10683
|
-
|
|
10684
|
-
|
|
10685
|
-
|
|
10686
|
-
|
|
11656
|
+
await this.createAndStoreSession(config, settings, sessionData, {
|
|
11657
|
+
...bulkReplay ? { replayHistory: false } : {},
|
|
11658
|
+
beforeStartPostReplayServices: /* @__PURE__ */ __name(async (createdSession) => {
|
|
11659
|
+
if (bulkReplay) {
|
|
11660
|
+
const records = sessionData?.conversation.messages;
|
|
11661
|
+
let replayUpdates = [];
|
|
11662
|
+
if (records) {
|
|
11663
|
+
createdSession.primeTurnFromHistory(records);
|
|
11664
|
+
const visibleRecords = selectVisibleHistoryRecords(
|
|
11665
|
+
records,
|
|
11666
|
+
shouldHideInheritedHistory(params)
|
|
11667
|
+
);
|
|
11668
|
+
const replayPage = selectRecentHistoryRecords(
|
|
11669
|
+
visibleRecords,
|
|
11670
|
+
replayPageSize
|
|
11671
|
+
);
|
|
11672
|
+
const replayUsage = createReplayCumulativeUsage();
|
|
11673
|
+
const replay = await collectHistoryReplayUpdates({
|
|
11674
|
+
sessionId: params.sessionId,
|
|
11675
|
+
config,
|
|
11676
|
+
records: replayPage.records,
|
|
11677
|
+
gaps: sessionData?.historyGaps,
|
|
11678
|
+
cumulativeUsage: replayUsage,
|
|
11679
|
+
supersedeUnrestorableGoal: true,
|
|
11680
|
+
logger: debugLogger7
|
|
11681
|
+
});
|
|
11682
|
+
replayUpdates = replay.updates;
|
|
11683
|
+
copyCumulativeUsage(createdSession.cumulativeUsage, replayUsage);
|
|
11684
|
+
if (replay.replayError !== void 0) {
|
|
11685
|
+
replayEnvelope = {
|
|
11686
|
+
v: LOAD_REPLAY_VERSION,
|
|
11687
|
+
updates: replayUpdates,
|
|
11688
|
+
partial: true,
|
|
11689
|
+
replayError: replay.replayError,
|
|
11690
|
+
...replayPage.hasMore ? { hasMore: true } : {}
|
|
11691
|
+
};
|
|
11692
|
+
}
|
|
11693
|
+
replayEnvelope ??= {
|
|
11694
|
+
v: LOAD_REPLAY_VERSION,
|
|
11695
|
+
updates: replayUpdates,
|
|
11696
|
+
...replayPage.hasMore ? { hasMore: true } : {}
|
|
11697
|
+
};
|
|
11698
|
+
}
|
|
11699
|
+
replayEnvelope ??= {
|
|
11700
|
+
v: LOAD_REPLAY_VERSION,
|
|
11701
|
+
updates: replayUpdates
|
|
11702
|
+
};
|
|
11703
|
+
}
|
|
11704
|
+
await this.#restoreWorktreeOnResume(config, createdSession);
|
|
11705
|
+
await this.#restoreBackgroundAgentsOnResume(config, createdSession);
|
|
11706
|
+
this.#restoreGoalOnResume(config, createdSession);
|
|
11707
|
+
}, "beforeStartPostReplayServices")
|
|
11708
|
+
});
|
|
10687
11709
|
} catch (error) {
|
|
10688
11710
|
return this.cleanupAfterRequestFailure(error, async () => {
|
|
10689
11711
|
if (this.sessions.get(config.getSessionId())?.getConfig() !== config) {
|
|
@@ -10691,72 +11713,6 @@ var QwenAgent = class {
|
|
|
10691
11713
|
}
|
|
10692
11714
|
});
|
|
10693
11715
|
}
|
|
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
11716
|
const modesData = this.buildModesData(config);
|
|
10761
11717
|
const availableModels = this.buildAvailableModels(config);
|
|
10762
11718
|
const configOptions = this.buildConfigOptions(config);
|
|
@@ -10777,6 +11733,7 @@ var QwenAgent = class {
|
|
|
10777
11733
|
};
|
|
10778
11734
|
}
|
|
10779
11735
|
async unstable_resumeSession(params) {
|
|
11736
|
+
const isChannelSession = isChannelSessionRequest(params);
|
|
10780
11737
|
const settings = loadSettingsCached(params.cwd);
|
|
10781
11738
|
const liveSession = this.sessions.get(params.sessionId);
|
|
10782
11739
|
if (liveSession) {
|
|
@@ -10809,18 +11766,25 @@ var QwenAgent = class {
|
|
|
10809
11766
|
params.cwd,
|
|
10810
11767
|
params.mcpServers ?? [],
|
|
10811
11768
|
settings,
|
|
11769
|
+
isChannelSession,
|
|
10812
11770
|
params.sessionId,
|
|
10813
11771
|
true
|
|
10814
11772
|
);
|
|
10815
|
-
let session;
|
|
10816
11773
|
try {
|
|
10817
11774
|
await this.ensureAuthenticated(config);
|
|
10818
11775
|
this.setupFileSystem(config);
|
|
10819
|
-
|
|
11776
|
+
await this.createAndStoreSession(
|
|
10820
11777
|
config,
|
|
10821
11778
|
settings,
|
|
10822
11779
|
config.getResumedSessionData(),
|
|
10823
|
-
{
|
|
11780
|
+
{
|
|
11781
|
+
replayHistory: false,
|
|
11782
|
+
beforeStartPostReplayServices: /* @__PURE__ */ __name(async (createdSession) => {
|
|
11783
|
+
await this.#restoreWorktreeOnResume(config, createdSession);
|
|
11784
|
+
await this.#restoreBackgroundAgentsOnResume(config, createdSession);
|
|
11785
|
+
this.#restoreGoalOnResume(config, createdSession);
|
|
11786
|
+
}, "beforeStartPostReplayServices")
|
|
11787
|
+
}
|
|
10824
11788
|
);
|
|
10825
11789
|
} catch (error) {
|
|
10826
11790
|
return this.cleanupAfterRequestFailure(error, async () => {
|
|
@@ -10829,9 +11793,6 @@ var QwenAgent = class {
|
|
|
10829
11793
|
}
|
|
10830
11794
|
});
|
|
10831
11795
|
}
|
|
10832
|
-
await this.#restoreWorktreeOnResume(config, session);
|
|
10833
|
-
await this.#restoreBackgroundAgentsOnResume(config, session);
|
|
10834
|
-
this.#restoreGoalOnResume(config, session);
|
|
10835
11796
|
const modesData = this.buildModesData(config);
|
|
10836
11797
|
const availableModels = this.buildAvailableModels(config);
|
|
10837
11798
|
const configOptions = this.buildConfigOptions(config);
|
|
@@ -11732,34 +12693,70 @@ var QwenAgent = class {
|
|
|
11732
12693
|
...inferred ? { errorKind: inferred } : {}
|
|
11733
12694
|
};
|
|
11734
12695
|
}
|
|
12696
|
+
/**
|
|
12697
|
+
* Keeps the extension-derived half of the skill snapshot self-healing.
|
|
12698
|
+
*
|
|
12699
|
+
* Skills have a watcher (`SkillManager.startWatching`); extensions do not, so
|
|
12700
|
+
* without this the child would never notice an extension installed, removed,
|
|
12701
|
+
* enabled, or disabled outside the daemon — and extension-level skills are
|
|
12702
|
+
* derived from that set, so a skill-watcher tick alone cannot recover it.
|
|
12703
|
+
*
|
|
12704
|
+
* The check is one `readdir` plus a bounded number of `stat`s, and refreshes
|
|
12705
|
+
* only when the sources actually moved, so a steady-state read still parses
|
|
12706
|
+
* no manifest and no `SKILL.md`. Failures are logged and swallowed: a status
|
|
12707
|
+
* read must not fail because revalidation could not run.
|
|
12708
|
+
*
|
|
12709
|
+
* Skipped in safe and bare mode. Those modes deliberately never populate the
|
|
12710
|
+
* extension cache (`Config.initialize` omits the refresh), and the snapshot
|
|
12711
|
+
* derives extension skills from `getExtensions()` — so revalidating here
|
|
12712
|
+
* would load the extensions those modes exist to exclude.
|
|
12713
|
+
*/
|
|
12714
|
+
async revalidateExtensionSources(config) {
|
|
12715
|
+
try {
|
|
12716
|
+
if (config.isSafeMode() || config.getBareMode()) return;
|
|
12717
|
+
const changed = await config.getExtensionManager().refreshCacheIfSourcesChanged();
|
|
12718
|
+
if (!changed) return;
|
|
12719
|
+
await config.getSkillManager()?.refreshCache();
|
|
12720
|
+
} catch (error) {
|
|
12721
|
+
debugLogger7.warn("Extension source revalidation failed:", error);
|
|
12722
|
+
}
|
|
12723
|
+
}
|
|
11735
12724
|
async buildWorkspaceSkillsStatus(config) {
|
|
11736
12725
|
const skillManager = config.getSkillManager();
|
|
11737
12726
|
if (!skillManager) {
|
|
11738
12727
|
return {
|
|
11739
12728
|
v: STATUS_SCHEMA_VERSION,
|
|
11740
12729
|
workspaceCwd: this.workspaceCwd(config),
|
|
11741
|
-
initialized:
|
|
12730
|
+
initialized: false,
|
|
11742
12731
|
skills: []
|
|
11743
12732
|
};
|
|
11744
12733
|
}
|
|
12734
|
+
await this.revalidateExtensionSources(config);
|
|
11745
12735
|
try {
|
|
11746
|
-
const
|
|
11747
|
-
|
|
11748
|
-
|
|
11749
|
-
|
|
11750
|
-
|
|
11751
|
-
|
|
11752
|
-
|
|
11753
|
-
|
|
11754
|
-
} catch (error) {
|
|
11755
|
-
debugLogger7.warn("Skill cache refresh failed:", error);
|
|
12736
|
+
const skills = skillManager.getCachedSkills();
|
|
12737
|
+
if (skills === null) {
|
|
12738
|
+
return {
|
|
12739
|
+
v: STATUS_SCHEMA_VERSION,
|
|
12740
|
+
workspaceCwd: this.workspaceCwd(config),
|
|
12741
|
+
initialized: false,
|
|
12742
|
+
skills: []
|
|
12743
|
+
};
|
|
11756
12744
|
}
|
|
11757
|
-
const
|
|
12745
|
+
const resolved = resolveSkillSettings(this.settings);
|
|
12746
|
+
const disablements = new Map(
|
|
12747
|
+
Array.from(config.getDisabledSkillNames(), (name) => {
|
|
12748
|
+
const normalizedName = name.trim().toLowerCase();
|
|
12749
|
+
return [
|
|
12750
|
+
normalizedName,
|
|
12751
|
+
resolved.disablements.get(normalizedName) ?? { reason: "hard" }
|
|
12752
|
+
];
|
|
12753
|
+
})
|
|
12754
|
+
);
|
|
11758
12755
|
const inactiveSkillRefs = inactiveExtensionSkillRefs(config);
|
|
11759
12756
|
const skillsByKey = new Map(
|
|
11760
12757
|
skills.map((skill) => [
|
|
11761
12758
|
`${skill.level}:${skill.extensionName ?? ""}:${skill.name}`,
|
|
11762
|
-
mapSkillConfigToStatus(skill,
|
|
12759
|
+
mapSkillConfigToStatus(skill, disablements, {
|
|
11763
12760
|
disabled: isInactiveExtensionSkill(skill, inactiveSkillRefs)
|
|
11764
12761
|
})
|
|
11765
12762
|
])
|
|
@@ -11780,7 +12777,7 @@ var QwenAgent = class {
|
|
|
11780
12777
|
level: "extension",
|
|
11781
12778
|
extensionName
|
|
11782
12779
|
},
|
|
11783
|
-
|
|
12780
|
+
disablements,
|
|
11784
12781
|
{ disabled: true }
|
|
11785
12782
|
)
|
|
11786
12783
|
);
|
|
@@ -12840,12 +13837,19 @@ var QwenAgent = class {
|
|
|
12840
13837
|
}
|
|
12841
13838
|
case TODO_STOP_GUARD_QUEUE_RELEASE_METHOD: {
|
|
12842
13839
|
const sessionId = params["sessionId"];
|
|
13840
|
+
const promptId = params["promptId"];
|
|
12843
13841
|
if (typeof sessionId !== "string" || sessionId.length === 0) {
|
|
12844
13842
|
throw RequestError.invalidParams(
|
|
12845
13843
|
void 0,
|
|
12846
13844
|
"Invalid or missing sessionId"
|
|
12847
13845
|
);
|
|
12848
13846
|
}
|
|
13847
|
+
if (typeof promptId !== "string" || promptId.length === 0) {
|
|
13848
|
+
throw RequestError.invalidParams(
|
|
13849
|
+
void 0,
|
|
13850
|
+
"Invalid or missing promptId"
|
|
13851
|
+
);
|
|
13852
|
+
}
|
|
12849
13853
|
const session = this.sessions.get(sessionId);
|
|
12850
13854
|
if (!session) {
|
|
12851
13855
|
throw RequestError.invalidParams(
|
|
@@ -12854,7 +13858,7 @@ var QwenAgent = class {
|
|
|
12854
13858
|
);
|
|
12855
13859
|
}
|
|
12856
13860
|
return {
|
|
12857
|
-
released: session.releaseTodoStopGuardQueuedPromptWait()
|
|
13861
|
+
released: session.releaseTodoStopGuardQueuedPromptWait(promptId)
|
|
12858
13862
|
};
|
|
12859
13863
|
}
|
|
12860
13864
|
case "qwen/providers/list": {
|
|
@@ -14275,10 +15279,12 @@ var QwenAgent = class {
|
|
|
14275
15279
|
}
|
|
14276
15280
|
}
|
|
14277
15281
|
const previousCwd = config.getTargetDir();
|
|
14278
|
-
|
|
14279
|
-
|
|
14280
|
-
|
|
14281
|
-
|
|
15282
|
+
let trustValidated = false;
|
|
15283
|
+
const validateTrust = /* @__PURE__ */ __name(() => {
|
|
15284
|
+
if (!isFolderTrustEnabled(this.settings.merged)) {
|
|
15285
|
+
trustValidated = true;
|
|
15286
|
+
return;
|
|
15287
|
+
}
|
|
14282
15288
|
const trustedFolders = loadTrustedFolders();
|
|
14283
15289
|
if (trustedFolders.isPathTrusted(canonicalPath) !== true) {
|
|
14284
15290
|
throw new RequestError(
|
|
@@ -14287,27 +15293,67 @@ var QwenAgent = class {
|
|
|
14287
15293
|
{ errorKind: "directory_not_trusted", path: canonicalPath }
|
|
14288
15294
|
);
|
|
14289
15295
|
}
|
|
15296
|
+
trustValidated = true;
|
|
15297
|
+
}, "validateTrust");
|
|
15298
|
+
if (canonicalPath !== previousCwd) {
|
|
15299
|
+
validateTrust();
|
|
14290
15300
|
}
|
|
14291
|
-
const
|
|
14292
|
-
|
|
14293
|
-
|
|
14294
|
-
canonicalPath,
|
|
14295
|
-
{ skipProcessChdir: true, skipArtifactMigration: true }
|
|
15301
|
+
const releaseGate = await beginSessionCloseAfterCurrentGate(
|
|
15302
|
+
session,
|
|
15303
|
+
SESSION_DRAIN_TIMEOUT_MS
|
|
14296
15304
|
);
|
|
14297
|
-
if (relocation.memoryRefreshError) {
|
|
14298
|
-
warnings.push(
|
|
14299
|
-
`Memory refresh failed: ${relocation.memoryRefreshError instanceof Error ? relocation.memoryRefreshError.message : String(relocation.memoryRefreshError)}`
|
|
14300
|
-
);
|
|
14301
|
-
}
|
|
14302
15305
|
try {
|
|
14303
|
-
|
|
14304
|
-
|
|
14305
|
-
|
|
14306
|
-
|
|
15306
|
+
const settledPreviousCwd = config.getTargetDir();
|
|
15307
|
+
if (canonicalPath === settledPreviousCwd) {
|
|
15308
|
+
return {
|
|
15309
|
+
previousCwd: settledPreviousCwd,
|
|
15310
|
+
newCwd: canonicalPath,
|
|
15311
|
+
warnings: []
|
|
15312
|
+
};
|
|
15313
|
+
}
|
|
15314
|
+
if (!trustValidated) {
|
|
15315
|
+
validateTrust();
|
|
15316
|
+
}
|
|
15317
|
+
session.hardSuspendTodoStopGuard();
|
|
15318
|
+
await waitForSessionDrain(
|
|
15319
|
+
session.waitForActiveTurnsToSettle(),
|
|
15320
|
+
SESSION_DRAIN_TIMEOUT_MS,
|
|
15321
|
+
"close"
|
|
15322
|
+
);
|
|
15323
|
+
const warnings = [];
|
|
15324
|
+
const relocation = await config.relocateWorkingDirectory(
|
|
15325
|
+
canonicalPath,
|
|
15326
|
+
canonicalPath,
|
|
15327
|
+
{ skipProcessChdir: true, skipArtifactMigration: true }
|
|
14307
15328
|
);
|
|
15329
|
+
if (relocation.memoryRefreshError) {
|
|
15330
|
+
warnings.push(
|
|
15331
|
+
`Memory refresh failed: ${relocation.memoryRefreshError instanceof Error ? relocation.memoryRefreshError.message : String(relocation.memoryRefreshError)}`
|
|
15332
|
+
);
|
|
15333
|
+
}
|
|
15334
|
+
if (relocation.mcpRefreshError) {
|
|
15335
|
+
warnings.push(
|
|
15336
|
+
`MCP refresh failed: ${relocation.mcpRefreshError instanceof Error ? relocation.mcpRefreshError.message : String(relocation.mcpRefreshError)}`
|
|
15337
|
+
);
|
|
15338
|
+
}
|
|
15339
|
+
try {
|
|
15340
|
+
await config.getGeminiClient()?.addWorkingDirectoryChangedContext(
|
|
15341
|
+
settledPreviousCwd,
|
|
15342
|
+
canonicalPath
|
|
15343
|
+
);
|
|
15344
|
+
} catch (error) {
|
|
15345
|
+
warnings.push(
|
|
15346
|
+
`Model context refresh failed: ${error instanceof Error ? error.message : String(error)}`
|
|
15347
|
+
);
|
|
15348
|
+
}
|
|
15349
|
+
return {
|
|
15350
|
+
previousCwd: settledPreviousCwd,
|
|
15351
|
+
newCwd: canonicalPath,
|
|
15352
|
+
warnings
|
|
15353
|
+
};
|
|
15354
|
+
} finally {
|
|
15355
|
+
releaseGate();
|
|
14308
15356
|
}
|
|
14309
|
-
session.clearTodoStopGuardTrust();
|
|
14310
|
-
return { previousCwd, newCwd: canonicalPath, warnings };
|
|
14311
15357
|
}
|
|
14312
15358
|
case SERVE_CONTROL_EXT_METHODS.sessionApprovalMode: {
|
|
14313
15359
|
const sessionId = params["sessionId"];
|
|
@@ -14823,149 +15869,91 @@ ${outputText}
|
|
|
14823
15869
|
return result;
|
|
14824
15870
|
}
|
|
14825
15871
|
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
|
-
}
|
|
15872
|
+
const request = readRuntimeMcpAddRequest(params);
|
|
15873
|
+
const result = await addRuntimeMcpServer(
|
|
15874
|
+
getRuntimeMcpManager(this.config),
|
|
15875
|
+
request
|
|
15876
|
+
);
|
|
15877
|
+
await Promise.all(
|
|
15878
|
+
this.getActiveSessions().map(async (session) => {
|
|
15879
|
+
const sessionManager = session.getConfig().getToolRegistry()?.getMcpClientManager();
|
|
15880
|
+
if (!sessionManager) return;
|
|
15881
|
+
try {
|
|
15882
|
+
await sessionManager.addRuntimeMcpServer(
|
|
15883
|
+
request.name,
|
|
15884
|
+
request.config,
|
|
15885
|
+
request.runtimeClientId
|
|
15886
|
+
);
|
|
15887
|
+
} catch (sessionErr) {
|
|
15888
|
+
debugLogger7.warn(
|
|
15889
|
+
`workspaceMcpRuntimeAdd: failed to add runtime MCP server '${request.name}' to active session ${session.getConfig().getSessionId()}: ${sessionErr instanceof Error ? sessionErr.message : String(sessionErr)}`
|
|
15890
|
+
);
|
|
15891
|
+
}
|
|
15892
|
+
})
|
|
15893
|
+
);
|
|
15894
|
+
return result;
|
|
14921
15895
|
}
|
|
14922
15896
|
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
|
-
);
|
|
15897
|
+
const request = readRuntimeMcpRequest(params);
|
|
15898
|
+
const result = await getRuntimeMcpManager(
|
|
15899
|
+
this.config
|
|
15900
|
+
).removeRuntimeMcpServer(request.name, request.runtimeClientId);
|
|
14949
15901
|
await Promise.all(
|
|
14950
15902
|
this.getActiveSessions().map(async (session) => {
|
|
14951
15903
|
const sessionManager = session.getConfig().getToolRegistry()?.getMcpClientManager();
|
|
14952
15904
|
if (!sessionManager) return;
|
|
14953
15905
|
try {
|
|
14954
15906
|
await sessionManager.removeRuntimeMcpServer(
|
|
14955
|
-
name,
|
|
14956
|
-
runtimeClientId
|
|
15907
|
+
request.name,
|
|
15908
|
+
request.runtimeClientId
|
|
14957
15909
|
);
|
|
14958
15910
|
} catch (sessionErr) {
|
|
14959
15911
|
debugLogger7.warn(
|
|
14960
|
-
`workspaceMcpRuntimeRemove: failed to remove runtime MCP server '${name}' from active session ${session.getConfig().getSessionId()}: ${sessionErr instanceof Error ? sessionErr.message : String(sessionErr)}`
|
|
15912
|
+
`workspaceMcpRuntimeRemove: failed to remove runtime MCP server '${request.name}' from active session ${session.getConfig().getSessionId()}: ${sessionErr instanceof Error ? sessionErr.message : String(sessionErr)}`
|
|
14961
15913
|
);
|
|
14962
15914
|
}
|
|
14963
15915
|
})
|
|
14964
15916
|
);
|
|
14965
15917
|
return result;
|
|
14966
15918
|
}
|
|
15919
|
+
case SERVE_CONTROL_EXT_METHODS.sessionMcpRuntimeAdd: {
|
|
15920
|
+
const sessionId = params["sessionId"];
|
|
15921
|
+
if (typeof sessionId !== "string" || sessionId.length === 0) {
|
|
15922
|
+
throw RequestError.invalidParams(
|
|
15923
|
+
void 0,
|
|
15924
|
+
"Invalid or missing sessionId"
|
|
15925
|
+
);
|
|
15926
|
+
}
|
|
15927
|
+
const session = this.sessionOrThrow(sessionId);
|
|
15928
|
+
return addRuntimeMcpServer(
|
|
15929
|
+
getRuntimeMcpManager(session.getConfig()),
|
|
15930
|
+
readRuntimeMcpAddRequest(params)
|
|
15931
|
+
);
|
|
15932
|
+
}
|
|
15933
|
+
case SERVE_CONTROL_EXT_METHODS.sessionMcpRuntimeRemove: {
|
|
15934
|
+
const sessionId = params["sessionId"];
|
|
15935
|
+
if (typeof sessionId !== "string" || sessionId.length === 0) {
|
|
15936
|
+
throw RequestError.invalidParams(
|
|
15937
|
+
void 0,
|
|
15938
|
+
"Invalid or missing sessionId"
|
|
15939
|
+
);
|
|
15940
|
+
}
|
|
15941
|
+
const session = this.sessionOrThrow(sessionId);
|
|
15942
|
+
const request = readRuntimeMcpRequest(params);
|
|
15943
|
+
const result = await getRuntimeMcpManager(
|
|
15944
|
+
session.getConfig()
|
|
15945
|
+
).removeRuntimeMcpServer(request.name, request.runtimeClientId);
|
|
15946
|
+
return result;
|
|
15947
|
+
}
|
|
14967
15948
|
case SERVE_CONTROL_EXT_METHODS.workspaceExtensionsRefresh: {
|
|
14968
15949
|
const sessionId = params["sessionId"];
|
|
15950
|
+
const rawRefreshBootstrap = params["refreshBootstrap"];
|
|
15951
|
+
if (rawRefreshBootstrap !== void 0 && typeof rawRefreshBootstrap !== "boolean") {
|
|
15952
|
+
throw RequestError.invalidParams(
|
|
15953
|
+
void 0,
|
|
15954
|
+
"refreshBootstrap must be a boolean"
|
|
15955
|
+
);
|
|
15956
|
+
}
|
|
14969
15957
|
const session = this.sessionOrThrow(sessionId);
|
|
14970
15958
|
const config = session.getConfig();
|
|
14971
15959
|
const extensionManager = config.getExtensionManager();
|
|
@@ -14979,6 +15967,12 @@ ${outputText}
|
|
|
14979
15967
|
}, "runRefresh");
|
|
14980
15968
|
await runRefresh(async () => await extensionManager.refreshCache());
|
|
14981
15969
|
await runRefresh(async () => await extensionManager.refreshTools());
|
|
15970
|
+
const bootstrapConfig = this.config;
|
|
15971
|
+
if (rawRefreshBootstrap !== false && bootstrapConfig !== config) {
|
|
15972
|
+
await runRefresh(
|
|
15973
|
+
async () => await this.refreshBootstrapExtensionStatus()
|
|
15974
|
+
);
|
|
15975
|
+
}
|
|
14982
15976
|
const discoveryConfig = this.workspaceMcpDiscoveryConfig;
|
|
14983
15977
|
if (discoveryConfig && discoveryConfig !== config) {
|
|
14984
15978
|
const discoveryExtensionManager = discoveryConfig.getExtensionManager();
|
|
@@ -15282,7 +16276,9 @@ ${outputText}
|
|
|
15282
16276
|
apiKeyEnvKey: cfg?.apiKeyEnvKey ?? null
|
|
15283
16277
|
};
|
|
15284
16278
|
}
|
|
15285
|
-
case SERVE_CONTROL_EXT_METHODS.sessionBranch:
|
|
16279
|
+
case SERVE_CONTROL_EXT_METHODS.sessionBranch:
|
|
16280
|
+
case SERVE_CONTROL_EXT_METHODS.sessionSideTask: {
|
|
16281
|
+
const isSideTask = method === SERVE_CONTROL_EXT_METHODS.sessionSideTask;
|
|
15286
16282
|
const sessionId = params["sessionId"];
|
|
15287
16283
|
if (typeof sessionId !== "string" || !SESSION_ID_RE.test(sessionId)) {
|
|
15288
16284
|
throw RequestError.invalidParams(
|
|
@@ -15305,7 +16301,17 @@ ${outputText}
|
|
|
15305
16301
|
}
|
|
15306
16302
|
const newSessionId = randomUUID2();
|
|
15307
16303
|
const sessionService = sourceConfig.getSessionService();
|
|
15308
|
-
|
|
16304
|
+
const fork = /* @__PURE__ */ __name(() => isSideTask ? sessionService.forkSession(sessionId, newSessionId, {
|
|
16305
|
+
source: {
|
|
16306
|
+
sourceType: "side_task",
|
|
16307
|
+
sourceId: sessionId
|
|
16308
|
+
}
|
|
16309
|
+
}) : sessionService.forkSession(sessionId, newSessionId), "fork");
|
|
16310
|
+
if (isSideTask && recording) {
|
|
16311
|
+
await recording.runWithWriteBarrier(fork);
|
|
16312
|
+
} else {
|
|
16313
|
+
await fork();
|
|
16314
|
+
}
|
|
15309
16315
|
let title;
|
|
15310
16316
|
try {
|
|
15311
16317
|
let baseName;
|
|
@@ -15320,7 +16326,7 @@ ${outputText}
|
|
|
15320
16326
|
baseName = sessionId.slice(0, 8);
|
|
15321
16327
|
}
|
|
15322
16328
|
}
|
|
15323
|
-
title = await computeUniqueBranchTitle(baseName, sessionService);
|
|
16329
|
+
title = isSideTask ? baseName : await computeUniqueBranchTitle(baseName, sessionService);
|
|
15324
16330
|
const renamed = await sessionService.renameSession(
|
|
15325
16331
|
newSessionId,
|
|
15326
16332
|
title,
|
|
@@ -15654,16 +16660,58 @@ ${outputText}
|
|
|
15654
16660
|
};
|
|
15655
16661
|
}
|
|
15656
16662
|
case SERVE_CONTROL_EXT_METHODS.workspaceSkillsRefresh: {
|
|
15657
|
-
|
|
16663
|
+
const rawReason = params["reason"];
|
|
16664
|
+
if (rawReason !== void 0 && rawReason !== "settings" && rawReason !== "content" && rawReason !== "all") {
|
|
16665
|
+
throw RequestError.invalidParams(
|
|
16666
|
+
void 0,
|
|
16667
|
+
"reason must be settings, content, or all"
|
|
16668
|
+
);
|
|
16669
|
+
}
|
|
16670
|
+
const reason = rawReason ?? "all";
|
|
16671
|
+
const refreshSettings = reason !== "content";
|
|
16672
|
+
const refreshContent = reason !== "settings";
|
|
16673
|
+
if (refreshSettings) {
|
|
16674
|
+
this.settings.reloadScopeFromDisk("Workspace" /* Workspace */);
|
|
16675
|
+
}
|
|
15658
16676
|
const sessions = this.getActiveSessions();
|
|
16677
|
+
const settingsReloadResults = refreshSettings ? await Promise.allSettled(
|
|
16678
|
+
sessions.map(
|
|
16679
|
+
(session) => Promise.resolve().then(() => session.reloadSkillSettings())
|
|
16680
|
+
)
|
|
16681
|
+
) : void 0;
|
|
16682
|
+
let configResults = [];
|
|
16683
|
+
if (refreshContent) {
|
|
16684
|
+
const skillManagers = new Set(
|
|
16685
|
+
[this.config, ...sessions.map((session) => session.getConfig())].map((config) => config.getSkillManager()).filter(
|
|
16686
|
+
(manager) => manager !== void 0
|
|
16687
|
+
)
|
|
16688
|
+
);
|
|
16689
|
+
configResults = await Promise.allSettled(
|
|
16690
|
+
[...skillManagers].map((manager) => manager.refreshCache())
|
|
16691
|
+
);
|
|
16692
|
+
for (const result of configResults) {
|
|
16693
|
+
if (result.status === "rejected") {
|
|
16694
|
+
debugLogger7.warn(`Skill config refresh failed: ${result.reason}`);
|
|
16695
|
+
}
|
|
16696
|
+
}
|
|
16697
|
+
}
|
|
15659
16698
|
const results = await Promise.allSettled(
|
|
15660
|
-
sessions.map((session) =>
|
|
16699
|
+
sessions.map((session, index) => {
|
|
16700
|
+
const settingsReload = settingsReloadResults?.[index];
|
|
16701
|
+
if (settingsReload?.status === "rejected") {
|
|
16702
|
+
return Promise.reject(settingsReload.reason);
|
|
16703
|
+
}
|
|
16704
|
+
return session.refreshSkillsFromSettings({
|
|
16705
|
+
reloadSettings: false,
|
|
16706
|
+
notifyConfigChanged: !refreshContent
|
|
16707
|
+
});
|
|
16708
|
+
})
|
|
15661
16709
|
);
|
|
15662
16710
|
for (let i = 0; i < results.length; i++) {
|
|
15663
16711
|
if (results[i].status === "rejected") {
|
|
15664
|
-
const
|
|
16712
|
+
const reason2 = results[i].reason;
|
|
15665
16713
|
debugLogger7.warn(
|
|
15666
|
-
`Session ${sessions[i].getId()} skill refresh failed: ${
|
|
16714
|
+
`Session ${sessions[i].getId()} skill refresh failed: ${reason2}`
|
|
15667
16715
|
);
|
|
15668
16716
|
}
|
|
15669
16717
|
}
|
|
@@ -15673,7 +16721,14 @@ ${outputText}
|
|
|
15673
16721
|
).length,
|
|
15674
16722
|
sessionsFailed: results.filter(
|
|
15675
16723
|
(result) => result.status === "rejected"
|
|
15676
|
-
).length
|
|
16724
|
+
).length,
|
|
16725
|
+
configsRefreshed: configResults.filter(
|
|
16726
|
+
(result) => result.status === "fulfilled"
|
|
16727
|
+
).length,
|
|
16728
|
+
configsFailed: configResults.filter(
|
|
16729
|
+
(result) => result.status === "rejected"
|
|
16730
|
+
).length,
|
|
16731
|
+
reason
|
|
15677
16732
|
};
|
|
15678
16733
|
}
|
|
15679
16734
|
default:
|
|
@@ -15736,6 +16791,7 @@ ${outputText}
|
|
|
15736
16791
|
[],
|
|
15737
16792
|
settings,
|
|
15738
16793
|
void 0,
|
|
16794
|
+
void 0,
|
|
15739
16795
|
false,
|
|
15740
16796
|
{
|
|
15741
16797
|
skipMcpDiscovery: true,
|
|
@@ -15777,8 +16833,9 @@ ${outputText}
|
|
|
15777
16833
|
throw error;
|
|
15778
16834
|
}
|
|
15779
16835
|
}
|
|
15780
|
-
async newSessionConfig(cwd, mcpServers, settings, sessionId, resume, initializeOptions = {}, chatRecording) {
|
|
16836
|
+
async newSessionConfig(cwd, mcpServers, settings, isChannelSession, sessionId, resume, initializeOptions = {}, chatRecording) {
|
|
15781
16837
|
try {
|
|
16838
|
+
this.assertManagedSessionAdmission();
|
|
15782
16839
|
return await this.runWithPinnedRuntimeBaseDir(settings, cwd, async () => {
|
|
15783
16840
|
await this.retryPendingConfigCleanup(
|
|
15784
16841
|
Storage.getRuntimeBaseDir(),
|
|
@@ -15788,6 +16845,7 @@ ${outputText}
|
|
|
15788
16845
|
cwd,
|
|
15789
16846
|
mcpServers,
|
|
15790
16847
|
settings,
|
|
16848
|
+
isChannelSession,
|
|
15791
16849
|
sessionId,
|
|
15792
16850
|
resume,
|
|
15793
16851
|
initializeOptions,
|
|
@@ -15804,7 +16862,7 @@ ${outputText}
|
|
|
15804
16862
|
throw error;
|
|
15805
16863
|
}
|
|
15806
16864
|
}
|
|
15807
|
-
async newSessionConfigInRuntimeContext(cwd, mcpServers, settings, sessionId, resume, initializeOptions = {}, chatRecording) {
|
|
16865
|
+
async newSessionConfigInRuntimeContext(cwd, mcpServers, settings, isChannelSession, sessionId, resume, initializeOptions = {}, chatRecording) {
|
|
15808
16866
|
const sessionMcpServers = {};
|
|
15809
16867
|
for (const server of mcpServers) {
|
|
15810
16868
|
const stdioServer = toStdioServer(server);
|
|
@@ -15816,8 +16874,7 @@ ${outputText}
|
|
|
15816
16874
|
sessionMcpServers[stdioServer.name] = new MCPServerConfig(
|
|
15817
16875
|
stdioServer.command,
|
|
15818
16876
|
stdioServer.args,
|
|
15819
|
-
env
|
|
15820
|
-
cwd
|
|
16877
|
+
env
|
|
15821
16878
|
);
|
|
15822
16879
|
continue;
|
|
15823
16880
|
}
|
|
@@ -15856,7 +16913,14 @@ ${outputText}
|
|
|
15856
16913
|
continue;
|
|
15857
16914
|
}
|
|
15858
16915
|
}
|
|
15859
|
-
const mergedSettings =
|
|
16916
|
+
const mergedSettings = {
|
|
16917
|
+
...settings.merged,
|
|
16918
|
+
experimental: {
|
|
16919
|
+
...settings.merged.experimental,
|
|
16920
|
+
sessionWriterLease: this.sessionWriterLeaseEnabledAtStartup,
|
|
16921
|
+
...isChannelSession ? { cron: false } : {}
|
|
16922
|
+
}
|
|
16923
|
+
};
|
|
15860
16924
|
const sessionArg = resume === true ? { resume: sessionId, sessionId: void 0 } : { sessionId, resume: void 0 };
|
|
15861
16925
|
const argvForSession = {
|
|
15862
16926
|
...this.argv,
|
|
@@ -15891,6 +16955,21 @@ ${outputText}
|
|
|
15891
16955
|
buildDisabledSkillNamesProvider(settings),
|
|
15892
16956
|
sessionMcpServers
|
|
15893
16957
|
);
|
|
16958
|
+
if (chatRecording !== false) {
|
|
16959
|
+
this.initializingConfigs.add(config);
|
|
16960
|
+
}
|
|
16961
|
+
try {
|
|
16962
|
+
this.assertManagedSessionAdmission();
|
|
16963
|
+
if (this.isTrustedManagedParent()) {
|
|
16964
|
+
config.setSessionWriterReclaimPolicy("never");
|
|
16965
|
+
config.setSessionWriterTakeoverPolicy("certified");
|
|
16966
|
+
}
|
|
16967
|
+
} catch (error) {
|
|
16968
|
+
return this.cleanupAfterRequestFailure(
|
|
16969
|
+
error,
|
|
16970
|
+
() => this.cleanupUnstoredConfig(config)
|
|
16971
|
+
);
|
|
16972
|
+
}
|
|
15894
16973
|
if (!initializeOptions.skipFileCheckpointing && typeof config.enableFileCheckpointing === "function") {
|
|
15895
16974
|
config.enableFileCheckpointing();
|
|
15896
16975
|
}
|
|
@@ -15931,6 +17010,7 @@ ${outputText}
|
|
|
15931
17010
|
// (the daemon only adds SDK-type runtime servers for client MCP).
|
|
15932
17011
|
sendSdkMcpMessage: this.buildClientMcpSender(wiredSessionId)
|
|
15933
17012
|
});
|
|
17013
|
+
this.assertManagedSessionAdmission();
|
|
15934
17014
|
} catch (error) {
|
|
15935
17015
|
return this.cleanupAfterRequestFailure(
|
|
15936
17016
|
error,
|
|
@@ -15991,17 +17071,20 @@ ${outputText}
|
|
|
15991
17071
|
config.setFileSystemService(acpFileSystemService);
|
|
15992
17072
|
}
|
|
15993
17073
|
async createAndStoreSession(config, settings, sessionData, options = {}) {
|
|
17074
|
+
this.assertManagedSessionAdmission();
|
|
15994
17075
|
const sessionId = config.getSessionId();
|
|
15995
17076
|
const geminiClient = config.getGeminiClient();
|
|
15996
17077
|
const needsInitialize = !geminiClient.isInitialized();
|
|
15997
17078
|
if (needsInitialize) {
|
|
15998
17079
|
await geminiClient.initialize();
|
|
15999
17080
|
}
|
|
17081
|
+
this.assertManagedSessionAdmission();
|
|
16000
17082
|
if (this.sessions.has(sessionId)) {
|
|
16001
17083
|
throw new Error(`Session ${sessionId} is already active.`);
|
|
16002
17084
|
}
|
|
16003
17085
|
const session = new Session(sessionId, config, this.connection, settings);
|
|
16004
17086
|
this.sessions.set(sessionId, session);
|
|
17087
|
+
this.initializingConfigs.delete(config);
|
|
16005
17088
|
try {
|
|
16006
17089
|
if (sessionData?.fileHistorySnapshots?.length) {
|
|
16007
17090
|
config.getFileHistoryService().restoreFromSnapshots(sessionData.fileHistorySnapshots);
|
|
@@ -16015,10 +17098,9 @@ ${outputText}
|
|
|
16015
17098
|
sessionData.historyGaps
|
|
16016
17099
|
);
|
|
16017
17100
|
}
|
|
16018
|
-
|
|
16019
|
-
|
|
16020
|
-
|
|
16021
|
-
}
|
|
17101
|
+
await options.beforeStartPostReplayServices?.(session);
|
|
17102
|
+
session.installRewriter();
|
|
17103
|
+
session.startCronScheduler();
|
|
16022
17104
|
setTimeout(() => {
|
|
16023
17105
|
void session.sendAvailableCommandsUpdate();
|
|
16024
17106
|
}, 0);
|
|
@@ -16149,6 +17231,7 @@ export {
|
|
|
16149
17231
|
fetchAllowedGitHub,
|
|
16150
17232
|
normalizeCoreSettingValue,
|
|
16151
17233
|
runAcpAgent,
|
|
17234
|
+
selectVisibleHistoryRecords,
|
|
16152
17235
|
toHttpServer,
|
|
16153
17236
|
toSseServer,
|
|
16154
17237
|
toStdioServer
|