@qwen-code/qwen-code 0.21.12-preview.3 → 0.21.12
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/settings.md +10 -0
- package/bundled/qc-helper/docs/features/channels/overview.md +1 -1
- package/bundled/qc-helper/docs/features/channels/plugins.md +11 -11
- package/bundled/qc-helper/docs/features/code-review.md +1 -1
- package/bundled/qc-helper/docs/qwen-serve.md +99 -34
- package/bundled/review/SKILL.md +55 -36
- package/chunks/{MaxSizedBox-EIK4BHBQ.js → MaxSizedBox-ZSJJ2D5S.js} +46 -46
- package/chunks/{StandaloneSessionPicker-NHVJDRYD.js → StandaloneSessionPicker-WHUHQXSA.js} +65 -66
- package/chunks/{acp-startup-profiler-JMJBZDVO.js → acp-startup-profiler-SVPUHLXV.js} +2 -2
- package/chunks/{acpAgent-37UDZP64.js → acpAgent-7JOAESF5.js} +960 -539
- package/chunks/{agent-FAWBG7PP.js → agent-E6V3VXQR.js} +42 -42
- package/chunks/{agent-headless-SHK4PCCH.js → agent-headless-OEQNFOMH.js} +42 -42
- package/chunks/{anthropicContentGenerator-4JSC3ZFL.js → anthropicContentGenerator-YDT4EOKO.js} +25 -25
- package/chunks/{artifact-tool-FRMBPDPB.js → artifact-tool-4GCQQDZI.js} +5 -5
- package/chunks/{askUserQuestion-7G3LI3IZ.js → askUserQuestion-HZJJLR3Z.js} +2 -2
- package/chunks/{bridge-DEAYNDCI.js → bridge-NPBV53UA.js} +49 -49
- package/chunks/{build-RZS65IIX.js → build-GDBLPA24.js} +1 -1
- package/chunks/{channel-management-service-SKAN6NOB.js → channel-management-service-OADNGQM3.js} +4 -4
- package/chunks/{channel-settings-store-UIGYER6R.js → channel-settings-store-4ODLJ4X2.js} +49 -49
- package/chunks/{channel-worker-group-YPTB5ASD.js → channel-worker-group-IHBIHQ45.js} +7 -7
- package/chunks/{channel-worker-manager-4EHJSPRH.js → channel-worker-manager-GEHYJ5AE.js} +7 -7
- package/chunks/{channel-worker-supervisor-DZKHYFHV.js → channel-worker-supervisor-ZJIIWM4I.js} +5 -5
- package/chunks/{chunk-LHOG4E6Y.js → chunk-22C7BQ6D.js} +3 -3
- package/chunks/{chunk-DP3IHZGG.js → chunk-2AUM35J5.js} +59 -7
- package/chunks/{chunk-2SB4SLKC.js → chunk-2IIJTXYF.js} +1 -3
- package/chunks/{chunk-DYVCDQW2.js → chunk-2IVYL3IF.js} +1 -1
- package/chunks/{chunk-EYW54TBD.js → chunk-2ZWH53I4.js} +3 -3
- package/chunks/{chunk-5I5NMQCU.js → chunk-36XKGB7E.js} +3 -3
- package/chunks/{chunk-AQHNAA7E.js → chunk-3AEKDXKT.js} +1 -1
- package/chunks/{chunk-M6SXIXBV.js → chunk-3GDBZJD6.js} +6 -6
- package/chunks/{chunk-6XZERB6P.js → chunk-3GM5DLBI.js} +5 -5
- package/chunks/{chunk-4M2F7OG7.js → chunk-3LDGOQXZ.js} +6 -6
- package/chunks/{chunk-BKHCW2BI.js → chunk-3VUENPWF.js} +10 -0
- package/chunks/{chunk-ENEEQMGM.js → chunk-45NQKMYB.js} +1 -1
- package/chunks/{chunk-MDFUBQAQ.js → chunk-47BGDLJG.js} +119 -27
- package/chunks/{chunk-EFIMD5VA.js → chunk-4AOVQPJU.js} +1 -1
- package/chunks/{chunk-HB6QW4LM.js → chunk-4KM2SYK5.js} +19 -16
- package/chunks/{chunk-UNCIELQJ.js → chunk-4XA4QIUA.js} +1 -1
- package/chunks/{chunk-2J53A6MV.js → chunk-56HVDG3M.js} +4 -4
- package/chunks/{chunk-N3FJOQX7.js → chunk-5AFGJNY6.js} +4 -4
- package/chunks/{chunk-2AZMF6G5.js → chunk-5RUCD4ED.js} +2 -2
- package/chunks/{chunk-32VOOMEF.js → chunk-62X3CM7Q.js} +7 -7
- package/chunks/{chunk-6LYDH7VT.js → chunk-63FNZTWG.js} +2 -2
- package/chunks/{chunk-P64FPV3G.js → chunk-6JEIRPLN.js} +47 -4
- package/chunks/{chunk-O5G7IQGM.js → chunk-6P5EXEBL.js} +499 -112
- package/chunks/{chunk-3ZYX7AUR.js → chunk-6SPD4Z7F.js} +1 -1
- package/chunks/{chunk-YZJVVQD3.js → chunk-6ZKSO6K7.js} +7 -7
- package/chunks/{chunk-N5ULBHP3.js → chunk-7KJPO7YH.js} +2 -2
- package/chunks/{chunk-MZSJ43WV.js → chunk-7U5G6JXI.js} +24 -2
- package/chunks/{chunk-K7JW6V5O.js → chunk-A6NRNRKE.js} +1 -1
- package/chunks/{chunk-XLQS3VI6.js → chunk-AKBFSOC5.js} +2 -2
- package/chunks/{chunk-LT532KF4.js → chunk-AW27A43Y.js} +10 -12
- package/chunks/{chunk-M4NWDIFU.js → chunk-AZQ3DT76.js} +1 -1
- package/chunks/{chunk-4GLFFNP3.js → chunk-B4VN3VDH.js} +5 -5
- package/chunks/{chunk-YTYPRVIZ.js → chunk-BSR5AXZR.js} +4 -3
- package/chunks/{chunk-AJX4ITUG.js → chunk-BSSLSQEW.js} +3 -3
- package/chunks/{chunk-EYY4IBPV.js → chunk-CGM3E75C.js} +3 -3
- package/chunks/{chunk-V4MJ56RS.js → chunk-CIDQISGM.js} +5 -5
- package/chunks/{chunk-T6W4KACQ.js → chunk-CPFFU46D.js} +1 -1
- package/chunks/{chunk-TYCXSMZU.js → chunk-CQ6IPDQW.js} +3 -3
- package/chunks/{chunk-KIFRFCCB.js → chunk-CZ4OWGQQ.js} +67 -22
- package/chunks/{chunk-N7NBMAMW.js → chunk-D2RNVVH6.js} +2 -2
- package/chunks/{chunk-KPVVWKF3.js → chunk-D7QGE3RT.js} +1 -1
- package/chunks/{chunk-TYGKUOEG.js → chunk-DAV4QFD5.js} +3 -11
- package/chunks/{chunk-QUESTNOP.js → chunk-DD6O3ZRD.js} +1 -1
- package/chunks/{chunk-NWPO6I7V.js → chunk-DEDESZDL.js} +1 -1
- package/chunks/{chunk-7LZ7DK4D.js → chunk-DFVXU5YM.js} +1 -1
- package/chunks/{chunk-TBVNYG5B.js → chunk-DG4IQ6JG.js} +5 -5
- package/chunks/{chunk-SAQHDAUJ.js → chunk-DPTMKFIH.js} +452 -57
- package/chunks/{chunk-M6HXP2SG.js → chunk-EBPLKY6U.js} +2192 -849
- package/chunks/{chunk-3XZYK76R.js → chunk-EJOGLSNJ.js} +2 -2
- package/chunks/{chunk-L7T742G2.js → chunk-FA5K6YI2.js} +47 -3
- package/chunks/{chunk-M2NMFAFR.js → chunk-FMIH5KMQ.js} +1 -1
- package/chunks/{chunk-HHGQGTJQ.js → chunk-FQDCO3CJ.js} +10 -1
- package/chunks/{chunk-V3LXMASR.js → chunk-FRHQQC2Z.js} +1 -1
- package/chunks/{chunk-732MOPEM.js → chunk-G6MUFRNI.js} +1 -1
- package/chunks/{chunk-KNXA5XXK.js → chunk-GXTMEATA.js} +15 -34
- package/chunks/{chunk-7SUQZ7QH.js → chunk-GZDWTBT3.js} +2 -2
- package/chunks/{chunk-IQFYO5BF.js → chunk-H7TMVHKE.js} +1 -1
- package/chunks/{chunk-KNQZXSLW.js → chunk-HG3UBTJ4.js} +23 -9
- package/chunks/{chunk-MPBRV3UU.js → chunk-HOSVOUDK.js} +71 -0
- package/chunks/{chunk-OPBATTFQ.js → chunk-HTYND72J.js} +1 -1
- package/chunks/{chunk-I4XSOFH2.js → chunk-I7BT2MME.js} +1 -1
- package/chunks/{chunk-LHY6HBRA.js → chunk-IH4Z54RJ.js} +7 -5
- package/chunks/{chunk-GYBDYWMV.js → chunk-IRSLAS4M.js} +2 -2
- package/chunks/{chunk-UZPWH6SP.js → chunk-IX4PWUDU.js} +401 -173
- package/chunks/{chunk-KT4OWAAZ.js → chunk-JRIVMPD2.js} +3 -3
- package/chunks/{chunk-Q7YDKOGY.js → chunk-JVEGA3MM.js} +1 -1
- package/chunks/{chunk-O5AZPHYZ.js → chunk-K34GJQOZ.js} +138 -16
- package/chunks/{chunk-L2GTEEEU.js → chunk-K5IDV3PC.js} +44 -1
- package/chunks/{chunk-5HBFERG5.js → chunk-KEC5FHLM.js} +3 -3
- package/chunks/{chunk-5PWLQ7SK.js → chunk-KLOMACIR.js} +15 -8
- package/chunks/{chunk-XWUQ4IH5.js → chunk-KWX56CHZ.js} +7 -7
- package/chunks/{chunk-VQZXRLEX.js → chunk-LCX5B364.js} +3 -3
- package/chunks/{chunk-CTQE2NB2.js → chunk-LSRI3ND3.js} +1 -1
- package/chunks/{chunk-5TXOGH4I.js → chunk-LUISTZXI.js} +3 -3
- package/chunks/{chunk-6AECVSVX.js → chunk-MAKIANMX.js} +3 -3
- package/chunks/{chunk-M4OYAR6J.js → chunk-MDNUCDKZ.js} +2 -2
- package/chunks/{chunk-CZXQ4UZA.js → chunk-MELQSJOU.js} +1 -1
- package/chunks/{chunk-6ZIIHBNV.js → chunk-MUNA4QDC.js} +4 -4
- package/chunks/{chunk-E5BWLU5J.js → chunk-N4SVADAV.js} +305 -143
- package/chunks/{chunk-URK542T4.js → chunk-NF5J2WFA.js} +15 -2
- package/chunks/{chunk-GJJQV4PY.js → chunk-NLFLYSS4.js} +1 -1
- package/chunks/{chunk-FRH4SSGX.js → chunk-NW2GIPG3.js} +2 -4
- package/chunks/{chunk-JS4Q5NG5.js → chunk-NX4A23LY.js} +3 -3
- package/chunks/{chunk-DEG7R6Z6.js → chunk-OK47XBYH.js} +79 -36
- package/chunks/{chunk-7D4KEFOT.js → chunk-OPVF453Q.js} +3 -3
- package/chunks/{chunk-J7DNMZFO.js → chunk-OR64CU46.js} +1 -1
- package/chunks/{chunk-DAX3G67A.js → chunk-OWGRUU7F.js} +1 -1
- package/chunks/{chunk-M2PY7CNK.js → chunk-OWXFBIB6.js} +2 -2
- package/chunks/{chunk-NELCY6JT.js → chunk-OYWVIXHT.js} +1 -3
- package/chunks/{chunk-V7RNNPGC.js → chunk-P5Y23G2L.js} +18 -1
- package/chunks/{chunk-QZ5G26ZE.js → chunk-PTSEETCO.js} +27 -27
- package/chunks/{chunk-IEP44U2R.js → chunk-PVXEJB66.js} +1 -1
- package/chunks/{chunk-NC4O6UE6.js → chunk-PZW46OTB.js} +2 -2
- package/chunks/{chunk-RQVVXDHS.js → chunk-Q4ZPYNIZ.js} +4 -4
- package/chunks/{chunk-QSWDGAIC.js → chunk-QILD6R27.js} +1 -1
- package/chunks/{chunk-GLWWPFTW.js → chunk-QLTATTPS.js} +1 -1
- package/chunks/{chunk-QTI7SRXI.js → chunk-QPBFRWCP.js} +3 -3
- package/chunks/{chunk-3TT6MZHJ.js → chunk-QSD4UH74.js} +842 -62
- package/chunks/{chunk-TEKFBSMY.js → chunk-RDVNSJQU.js} +3 -3
- package/chunks/{chunk-NPE3STIW.js → chunk-ROIJYS5K.js} +6 -6
- package/chunks/{chunk-JEMR2FTD.js → chunk-RQJA2YYO.js} +4 -4
- package/chunks/{chunk-YI6UGZF5.js → chunk-S6TCTH4Z.js} +13 -13
- package/chunks/{chunk-ZGWY4YUB.js → chunk-SYHXR6WM.js} +5 -5
- package/chunks/{chunk-O4BBDP2G.js → chunk-TB4YFWXG.js} +2 -2
- package/chunks/{chunk-ILVATFYJ.js → chunk-TDESMS7M.js} +22 -18
- package/chunks/{chunk-47FQVRCO.js → chunk-TMFWI4RC.js} +1 -1
- package/chunks/{chunk-T4FTABSW.js → chunk-TQDFSQQF.js} +1 -1
- package/chunks/{chunk-ZV4XVYL3.js → chunk-TTRH3RTQ.js} +4 -4
- package/chunks/{chunk-ZWPWQEF5.js → chunk-TXP5NGG3.js} +1 -1
- package/chunks/{chunk-E3GLDLYB.js → chunk-TYAMGABM.js} +0 -6
- package/chunks/{chunk-VWD7SNNN.js → chunk-UI5UGEF4.js} +1082 -926
- package/chunks/{chunk-MWZYNOCG.js → chunk-ULNWG62W.js} +3 -3
- package/chunks/{chunk-HGCQ5SE7.js → chunk-UXEO7E3V.js} +21 -0
- package/chunks/{chunk-U6PTKAOW.js → chunk-V6OBVAST.js} +1 -1
- package/chunks/{chunk-5UPJ774B.js → chunk-VIFA5VJD.js} +1 -1
- package/chunks/{chunk-Y66OOMKS.js → chunk-VLHR7F4E.js} +595 -58
- package/chunks/{chunk-EYS3GGM3.js → chunk-VPV7WBVT.js} +1 -1
- package/chunks/{chunk-XCGIMOLN.js → chunk-WCCLLK7X.js} +14 -1
- package/chunks/{chunk-JL3LC3CQ.js → chunk-WCEI6J56.js} +1 -1
- package/chunks/{chunk-JXK3WAP7.js → chunk-WDVDVWJ3.js} +6 -6
- package/chunks/{chunk-ZQSNP4TG.js → chunk-WI6GIM2M.js} +2 -2
- package/chunks/{chunk-TRYJ3BVE.js → chunk-WM3LUQLO.js} +7 -7
- package/chunks/{chunk-VJNBRRZG.js → chunk-WZMH7II3.js} +1 -1
- package/chunks/{chunk-HBZUU4AE.js → chunk-X5SLJOMF.js} +9 -7
- package/chunks/{chunk-FDWH6CBK.js → chunk-XAFIL4BD.js} +7 -7
- package/chunks/{chunk-P2UCMHDT.js → chunk-XDRXOSAD.js} +3 -3
- package/chunks/{chunk-RRQJPCRQ.js → chunk-XH3KAV2G.js} +2 -2
- package/chunks/{chunk-F6AOBFUN.js → chunk-YBHUXEC6.js} +1 -1
- package/chunks/{chunk-GZGDJ4E6.js → chunk-YBVVOSOH.js} +1 -1
- package/chunks/{chunk-EXG2R5UR.js → chunk-YCHNAKC5.js} +16 -14
- package/chunks/{chunk-XTH2OMDS.js → chunk-YIGGWOJE.js} +1 -1
- package/chunks/{chunk-IX7CFQGA.js → chunk-YILJKX2T.js} +3 -3
- package/chunks/{chunk-SSAOTDK7.js → chunk-YX2RDGAL.js} +1 -1
- package/chunks/{chunk-6S52N6PG.js → chunk-ZBB5EZZV.js} +2 -2
- package/chunks/{chunk-3GCU5O2E.js → chunk-ZLCT4C5A.js} +1 -1
- package/chunks/{chunk-4ETA3KRC.js → chunk-ZMY2P4L3.js} +3 -3
- package/chunks/{chunk-575MI5K3.js → chunk-ZQUY3ZJU.js} +4 -4
- package/chunks/{computer-use-S4JEU5P7.js → computer-use-F4URV4TU.js} +45 -45
- package/chunks/{config-utils-TXVKR27S.js → config-utils-Z3OW3IQG.js} +4 -4
- package/chunks/{contextCommand-2H5OH2HW.js → contextCommand-IGSS2U5J.js} +44 -44
- package/chunks/{core-runtime-IAQ4DD4Y.js → core-runtime-H5CZDN3A.js} +42 -42
- package/chunks/{create-sub-session-EKHKXJAA.js → create-sub-session-PA7MFTHK.js} +42 -42
- package/chunks/{create-sub-session-Y4WYDZGC.js → create-sub-session-XT6DLYOE.js} +2 -2
- package/chunks/{cron-create-ZOVA3CC2.js → cron-create-2JZ2TWTF.js} +4 -4
- package/chunks/{cron-delete-7Z3H4LJY.js → cron-delete-CTPD2P26.js} +4 -4
- package/chunks/{cron-list-UHGX3IQG.js → cron-list-V44KHAF6.js} +4 -4
- package/chunks/{daemon-PXIC4ZDK.js → daemon-GED37WOX.js} +30 -2
- package/chunks/daemon-git-worktree-guard-LZDCNJGV.js +2062 -0
- package/chunks/daemon-status-provider-QYM57Z44.js +102 -0
- package/chunks/{daemon-trust-policy-7JOBVFH3.js → daemon-trust-policy-TSRVEYZR.js} +48 -48
- package/chunks/{daemon-trust-policy-monitor-OU3NRHAR.js → daemon-trust-policy-monitor-2K2YETMT.js} +48 -48
- package/chunks/{deferred-core-runtime-SFT3KI2C.js → deferred-core-runtime-FKJ3OYE7.js} +44 -44
- package/chunks/{devtools-X6ROTKHE.js → devtools-4QFYJT6U.js} +1 -1
- package/chunks/{display-image-ZE3GZNIK.js → display-image-M2ELAVN4.js} +4 -4
- package/chunks/{dist-KTYDJNYM.js → dist-4ZPG4BY6.js} +2 -2
- package/chunks/{dist-NPS52B2V.js → dist-BROOP2EG.js} +1 -1
- package/chunks/{dist-BW2LDPV3.js → dist-IYYN3RUT.js} +2 -2
- package/chunks/{dist-EFJILGIS.js → dist-JWMKPWT5.js} +3 -1
- package/chunks/{dist-AVUYBK7L.js → dist-K7IQB53U.js} +1 -1
- package/chunks/{dist-PKSRQAR2.js → dist-MAQXAQ2Y.js} +1 -1
- package/chunks/{dist-BNWP6IZL.js → dist-WJ4BHIEW.js} +2 -2
- package/chunks/{dist-ZWDH5HLS.js → dist-YEPL4RAW.js} +1 -1
- package/chunks/{earlyInputCapture-27RPWE2D.js → earlyInputCapture-WJBSJQUF.js} +43 -43
- package/chunks/{edit-WXVZ7FHS.js → edit-X73LA4YO.js} +50 -49
- package/chunks/{enter-worktree-TYMVXFLA.js → enter-worktree-CLRQTIVN.js} +47 -47
- package/chunks/{enterPlanMode-FT4MRU5N.js → enterPlanMode-6BDYUQ5T.js} +48 -48
- package/chunks/{environment-Z6OMA34I.js → environment-WOAJXJDJ.js} +44 -44
- package/chunks/{errors-YMXK2GG3.js → errors-7OY5MXYY.js} +44 -44
- package/chunks/{exit-worktree-ODZUQLGJ.js → exit-worktree-TFFJXCRT.js} +47 -47
- package/chunks/{exitPlanMode-MBPAPBBV.js → exitPlanMode-WDURQMIU.js} +42 -42
- package/chunks/{external-tool-guard-provider-5HTGOPGU.js → external-tool-guard-provider-TE4DRY36.js} +1 -1
- package/chunks/{fast-path-ZU5T6XSN.js → fast-path-QQLGC37M.js} +5 -5
- package/chunks/{gemini-OZK6AIMC.js → gemini-VHE62IJL.js} +110 -105
- package/chunks/{geminiContentGenerator-MC6ZKWZG.js → geminiContentGenerator-VSHIEGAQ.js} +11 -11
- package/chunks/{glob-KJ4A4ZOM.js → glob-VMEEDDLO.js} +49 -49
- package/chunks/{goal-tools-JDK2SNMV.js → goal-tools-M4UDAZXP.js} +4 -4
- package/chunks/{grep-QWBLG564.js → grep-F4UAR7KX.js} +47 -47
- package/chunks/{handleAutoUpdate-M3ACKDKF.js → handleAutoUpdate-GN7Z6QAC.js} +46 -46
- package/chunks/{i18n-FPW7XZL5.js → i18n-ETW24DHW.js} +43 -43
- package/chunks/{image-gen-OTFC2S7L.js → image-gen-YPK2AZT4.js} +11 -11
- package/chunks/{initializer-5HKUXXBT.js → initializer-UA6KQ7MS.js} +49 -49
- package/chunks/{installationInfo-4OA6UW7V.js → installationInfo-P7OTIR4P.js} +43 -43
- package/chunks/{keychain-token-storage-JTWUYFU7.js → keychain-token-storage-NKKCUHI2.js} +2 -2
- package/chunks/{list-3TKZ264A.js → list-GRAMIQOT.js} +51 -51
- package/chunks/{list-agents-4GQ2XNEU.js → list-agents-O6WSY4CT.js} +2 -2
- package/chunks/{loadedSettingsAdapter-IRUANLS2.js → loadedSettingsAdapter-5O2TDS3I.js} +48 -48
- package/chunks/{loggingContentGenerator-D4URLH2A.js → loggingContentGenerator-J2J2AANS.js} +151 -120
- package/chunks/{loop-wakeup-HOQI3K5D.js → loop-wakeup-GVQRMUKS.js} +5 -5
- package/chunks/{ls-FSHISLLA.js → ls-6W2D7TKU.js} +6 -6
- package/chunks/{lsp-APQJ5ZEZ.js → lsp-NJ4KFBI2.js} +2 -2
- package/chunks/{managed-npm-update-2O7XSAWJ.js → managed-npm-update-WMV5ITKU.js} +45 -45
- package/chunks/{mcp-AFVHCHKT.js → mcp-XLP33CAI.js} +48 -48
- package/chunks/{monitor-PY4WDSX3.js → monitor-2MM23VDV.js} +47 -47
- package/chunks/{node-YSOU44FX.js → node-UUDY34IG.js} +3 -3
- package/chunks/nonInteractiveCli-KTA5K6FS.js +163 -0
- package/chunks/{notebook-edit-GEPL33NO.js → notebook-edit-QD4TRKLY.js} +47 -47
- package/chunks/{openaiContentGenerator-ACYSXQ6R.js → openaiContentGenerator-KLHSPVN2.js} +31 -31
- package/chunks/{pidfile-SUNYCAA4.js → pidfile-RQGZBNXT.js} +43 -43
- package/chunks/{processUtils-F7LP7YUV.js → processUtils-HZZDA2VV.js} +2 -2
- package/chunks/{qwenContentGenerator-BB6IPELF.js → qwenContentGenerator-T75M2Z3B.js} +50 -50
- package/chunks/{qwenOAuth2-OU3WGDOI.js → qwenOAuth2-5QZU444W.js} +10 -10
- package/chunks/{read-file-GORBXJTS.js → read-file-LOVUSBJC.js} +12 -12
- package/chunks/{read-mcp-resource-TJSJRH4F.js → read-mcp-resource-GWCP23WG.js} +2 -2
- package/chunks/{read-package-up-TCM6I7S2.js → read-package-up-K6RKTL5D.js} +1 -1
- package/chunks/{record-artifact-FXF5LHPE.js → record-artifact-IYQDEYMV.js} +3 -3
- package/chunks/{resumeHistoryUtils-FOAJJJWK.js → resumeHistoryUtils-LVKSSQII.js} +50 -50
- package/chunks/{ripGrep-RNLIZGCY.js → ripGrep-ZJSHKB6H.js} +42 -42
- package/chunks/{run-qwen-serve-GVMMX3IU.js → run-qwen-serve-GZW7B4WK.js} +186 -90
- package/chunks/{runtime-RNBZ5FDD.js → runtime-MYRXEO2E.js} +53 -53
- package/chunks/{scheduler-NTRFSPIP.js → scheduler-DPTPI6FW.js} +44 -44
- package/chunks/{sdk-exporters-grpc-4QKV6MCX.js → sdk-exporters-grpc-54L4LS5L.js} +2 -2
- package/chunks/{sdk-exporters-http-2VPMAPFI.js → sdk-exporters-http-NHBYB5FZ.js} +21 -17
- package/chunks/{sdk-impl-5W3JUCWF.js → sdk-impl-SK4P5WON.js} +17 -14
- package/chunks/{send-message-RBYLV5NY.js → send-message-O7FO63UK.js} +6 -6
- package/chunks/{serve-H3PGA26U.js → serve-XCG4XCDA.js} +52 -52
- package/chunks/{server-SUXD2F3C.js → server-AWQHKXLG.js} +310 -200
- package/chunks/{session-MTFVUWWM.js → session-P5FKNCNR.js} +94 -97
- package/chunks/{settings-GUJ3TN2J.js → settings-CSYVIP2R.js} +47 -47
- package/chunks/{shell-C2UP5FF2.js → shell-EGTSUO2P.js} +42 -42
- package/chunks/{skill-4XCNK55E.js → skill-IFUD72GF.js} +22 -22
- package/chunks/{skill-settings-Y2BU27XM.js → skill-settings-YOE7LBHE.js} +47 -47
- package/chunks/{spawnChannel-UUUUK734.js → spawnChannel-PQSZIOLY.js} +45 -47
- package/chunks/{standalone-update-MJ722XZ4.js → standalone-update-RB2EGUSF.js} +44 -44
- package/chunks/{startInteractiveUI-TCPIPNGN.js → startInteractiveUI-KMYUJ2MU.js} +3040 -2399
- package/chunks/{syntheticOutput-D3Z64LJC.js → syntheticOutput-DVHJMUGV.js} +3 -3
- package/chunks/{task-create-URFZ5EUX.js → task-create-4NC7PDI4.js} +11 -11
- package/chunks/{task-list-6JDFMPUW.js → task-list-LBSRMOC7.js} +5 -5
- package/chunks/{task-stop-HHUGCD25.js → task-stop-YFNATTIM.js} +2 -2
- package/chunks/{task-update-DVV6CUGI.js → task-update-BPLM52GD.js} +12 -12
- package/chunks/{team-create-WZWH2NJI.js → team-create-B6A6MJBT.js} +47 -47
- package/chunks/{team-delete-PZGGBQLM.js → team-delete-MKYMYBFM.js} +5 -5
- package/chunks/{team-plan-approval-SUZQJCWJ.js → team-plan-approval-5WO3CXXU.js} +48 -48
- package/chunks/{terminal-image-renderer-BCUN3Z3W.js → terminal-image-renderer-BTRE2GEU.js} +44 -44
- package/chunks/{theme-manager-UGMFDREN.js → theme-manager-XL2N5SBY.js} +43 -43
- package/chunks/{todoWrite-WINAZSZI.js → todoWrite-K5K7NRE5.js} +4 -4
- package/chunks/{tool-search-B6F3MPUZ.js → tool-search-QNBLXUGR.js} +18 -18
- package/chunks/{total-session-admission-MQLBJ5WL.js → total-session-admission-N4E5SFBO.js} +49 -49
- package/chunks/{trustedFolders-2XST7U5C.js → trustedFolders-MQS46LIU.js} +43 -43
- package/chunks/{update-relaunch-OVC7YNGD.js → update-relaunch-536KRL33.js} +5 -5
- package/chunks/{updateCheck-YAKM36WQ.js → updateCheck-QJI2SYWF.js} +48 -48
- package/chunks/{useAutoAcceptIndicator-RF6FVX3S.js → useAutoAcceptIndicator-7QASHD46.js} +51 -51
- package/chunks/{validateNonInterActiveAuth-IPPXFNQH.js → validateNonInterActiveAuth-ZNRGWBLV.js} +86 -88
- package/chunks/{version-4IDFEXOU.js → version-DBEQAFRW.js} +2 -2
- package/chunks/{web-fetch-NUOLHXPN.js → web-fetch-MBIVXKPE.js} +21 -21
- package/chunks/{web-search-LVOOV4XZ.js → web-search-4LBIN6VF.js} +16 -16
- package/chunks/{workflow-JSTYTG3K.js → workflow-LNMA55HY.js} +127 -61
- package/chunks/{workspace-providers-status-U4EYXA4K.js → workspace-providers-status-PDDMI6ST.js} +51 -51
- package/chunks/{workspace-registration-store-OG66U3CB.js → workspace-registration-store-BGRKKIYR.js} +1 -1
- package/chunks/{workspace-registry-WSHWQRQQ.js → workspace-registry-L4NCJ34K.js} +49 -49
- package/chunks/{workspace-service-QZXQHX2F.js → workspace-service-LOXYKYTR.js} +54 -54
- package/chunks/{workspace-skills-status-VRBHEX5O.js → workspace-skills-status-IJ5FOQI6.js} +49 -49
- package/chunks/{workspace-trust-reconciler-FCRIUIOF.js → workspace-trust-reconciler-H36TCR2S.js} +57 -57
- package/chunks/{write-file-PYL3JCCD.js → write-file-JJAY7JSP.js} +42 -42
- package/chunks/{zoom-image-RS6MU26F.js → zoom-image-4MVVVM7E.js} +12 -12
- package/cli.js +18 -17
- package/package.json +4 -4
- package/web-shell/assets/{arc-CgGUyHWd.js → arc-B-89zHN4.js} +1 -1
- package/web-shell/assets/{architectureDiagram-3BPJPVTR-BR0Qv-1Y.js → architectureDiagram-3BPJPVTR-BkcOncHk.js} +1 -1
- package/web-shell/assets/{blockDiagram-GPEHLZMM-DIoaceaI.js → blockDiagram-GPEHLZMM-DQ4yboaF.js} +1 -1
- package/web-shell/assets/{c4Diagram-AAUBKEIU-Bc5k6BbI.js → c4Diagram-AAUBKEIU-C_8ZjPDI.js} +1 -1
- package/web-shell/assets/channel-Du2WFns8.js +1 -0
- package/web-shell/assets/{chunk-2J33WTMH-DtPEz2WX.js → chunk-2J33WTMH-naKVe1Bm.js} +1 -1
- package/web-shell/assets/{chunk-4BX2VUAB-Dydo6ydE.js → chunk-4BX2VUAB-DdoViKT2.js} +1 -1
- package/web-shell/assets/{chunk-55IACEB6-DD9_VWXm.js → chunk-55IACEB6-DUDQZEwU.js} +1 -1
- package/web-shell/assets/{chunk-727SXJPM-DVI2m59k.js → chunk-727SXJPM-BqpDTR5s.js} +1 -1
- package/web-shell/assets/{chunk-AQP2D5EJ-luatmaTN.js → chunk-AQP2D5EJ-CdmEknkT.js} +1 -1
- package/web-shell/assets/{chunk-FMBD7UC4-Duy8NTIi.js → chunk-FMBD7UC4-CH7fFTLB.js} +1 -1
- package/web-shell/assets/{chunk-ND2GUHAM-CrL1yhms.js → chunk-ND2GUHAM-ObgSuFKF.js} +1 -1
- package/web-shell/assets/{chunk-QZHKN3VN-C7BX6bu1.js → chunk-QZHKN3VN-D9fKdv_s.js} +1 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-Zw0HafH6.js +1 -0
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-Zw0HafH6.js +1 -0
- package/web-shell/assets/{cose-bilkent-S5V4N54A-BTzs7mIi.js → cose-bilkent-S5V4N54A-CvzATMx9.js} +1 -1
- package/web-shell/assets/{dagre-BM42HDAG-3VTUmWts.js → dagre-BM42HDAG-M_xU21QW.js} +1 -1
- package/web-shell/assets/{diagram-2AECGRRQ-Ehdp75GN.js → diagram-2AECGRRQ-CNrl9sW1.js} +1 -1
- package/web-shell/assets/{diagram-5GNKFQAL-B3wu3teE.js → diagram-5GNKFQAL-CUweVT6T.js} +1 -1
- package/web-shell/assets/{diagram-KO2AKTUF-DjgTSf2S.js → diagram-KO2AKTUF-D3n6Lxjo.js} +1 -1
- package/web-shell/assets/{diagram-LMA3HP47-Br9mwjY3.js → diagram-LMA3HP47-0SeFPK4t.js} +1 -1
- package/web-shell/assets/{diagram-OG6HWLK6-D4xz5M-z.js → diagram-OG6HWLK6-DAgyEwge.js} +1 -1
- package/web-shell/assets/{erDiagram-TEJ5UH35-CXayWlG_.js → erDiagram-TEJ5UH35-CzxBBDIK.js} +1 -1
- package/web-shell/assets/{flowDiagram-I6XJVG4X-CLonjQTi.js → flowDiagram-I6XJVG4X-B0uj0jyo.js} +1 -1
- package/web-shell/assets/{ganttDiagram-6RSMTGT7-BTySFT-1.js → ganttDiagram-6RSMTGT7-DFzcj5km.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-PVQCEYII--2WcUjOe.js → gitGraphDiagram-PVQCEYII-DylJ_Fc9.js} +1 -1
- package/web-shell/assets/index-BIGQygTL.css +5 -0
- package/web-shell/assets/{index-DPJHkFOG.js → index-BKSAnXU9.js} +1 -1
- package/web-shell/assets/index-J7OMTqAN.js +1789 -0
- package/web-shell/assets/{infoDiagram-5YYISTIA-9vpgAf1m.js → infoDiagram-5YYISTIA-BYMcJVMI.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-DcRpHnAW.js → ishikawaDiagram-YF4QCWOH-t1quI1S3.js} +1 -1
- package/web-shell/assets/{journeyDiagram-JHISSGLW-C2TKorRm.js → journeyDiagram-JHISSGLW-YM_QVUJm.js} +1 -1
- package/web-shell/assets/{kanban-definition-UN3LZRKU-DdsFwB8b.js → kanban-definition-UN3LZRKU-jw8OddK1.js} +1 -1
- package/web-shell/assets/{linear-7PjRvJrf.js → linear-Dlr3RVuP.js} +1 -1
- package/web-shell/assets/{mermaid.core-raDXa11C.js → mermaid.core-CqGKzNzd.js} +5 -5
- package/web-shell/assets/{mindmap-definition-RKZ34NQL-DLHc-PRN.js → mindmap-definition-RKZ34NQL-BqureoOS.js} +1 -1
- package/web-shell/assets/{pieDiagram-4H26LBE5-BftYpeTW.js → pieDiagram-4H26LBE5-Da20HkK1.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-W4KKPZXB-O-6ygOYn.js → quadrantDiagram-W4KKPZXB-BsNlMvJy.js} +1 -1
- package/web-shell/assets/{requirementDiagram-4Y6WPE33-BmZWVufJ.js → requirementDiagram-4Y6WPE33-DzVCQCse.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-5OEKKPKP-2x5beiWt.js → sankeyDiagram-5OEKKPKP-BMo16voT.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-3UESZ5HK-BH8uKokQ.js → sequenceDiagram-3UESZ5HK-Bgi-pdHk.js} +1 -1
- package/web-shell/assets/{stateDiagram-AJRCARHV-Dq1MFgX_.js → stateDiagram-AJRCARHV-xaPQXwGk.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-D5RqimXD.js +1 -0
- package/web-shell/assets/{timeline-definition-PNZ67QCA-Cl2WKbv9.js → timeline-definition-PNZ67QCA-C_9RuvKG.js} +1 -1
- package/web-shell/assets/{vennDiagram-CIIHVFJN-BqoRo_Q-.js → vennDiagram-CIIHVFJN-Bgu6vdla.js} +1 -1
- package/web-shell/assets/{wardley-L42UT6IY-BTxp-Yot.js → wardley-L42UT6IY-CFTZ8IrX.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-YWT4CUSO-DFXVCSH2.js → wardleyDiagram-YWT4CUSO-BASW9Vmt.js} +1 -1
- package/web-shell/assets/{xychartDiagram-2RQKCTM6-qQhWx0aE.js → xychartDiagram-2RQKCTM6--Nh-CD3F.js} +1 -1
- package/web-shell/index.html +2 -2
- package/chunks/chunk-CG3OQDNY.js +0 -649
- package/chunks/chunk-L34XSHIZ.js +0 -28
- package/chunks/chunk-N2TNM3QB.js +0 -9
- package/chunks/chunk-UOMZKPI5.js +0 -830
- package/chunks/chunk-WFRHWDBT.js +0 -622
- package/chunks/chunk-WLML6VIA.js +0 -18
- package/chunks/chunk-ZBBVBZBR.js +0 -137
- package/chunks/chunk-bdqvmfwv-OHYAFAAO.js +0 -17446
- package/chunks/daemon-status-provider-LPYR2GXY.js +0 -103
- package/chunks/dispatch-B53LNEO4.js +0 -37
- package/chunks/nonInteractiveCli-ZHW6F76F.js +0 -166
- package/chunks/opentui-entry-SBAOWW7M.js +0 -52325
- package/chunks/runtime-gate-T4ICWGQJ.js +0 -89
- package/chunks/wrapper-46Z24CTM.js +0 -35
- package/web-shell/assets/channel-D2b9IYpS.js +0 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-DHatTCmD.js +0 -1
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-DHatTCmD.js +0 -1
- package/web-shell/assets/index-CIFO52Wx.css +0 -5
- package/web-shell/assets/index-bhq3CUUF.js +0 -1789
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-spuAYji6.js +0 -1
- /package/chunks/{chunk-44CTCCLY.js → chunk-NWNEANAT.js} +0 -0
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
} from "./chunk-V4MJ56RS.js";
|
|
6
|
-
import {
|
|
7
|
-
classifyApiError
|
|
8
|
-
} from "./chunk-V7RNNPGC.js";
|
|
9
|
-
import {
|
|
4
|
+
classifyApiError,
|
|
10
5
|
fireSessionDeleteHook
|
|
11
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-P5Y23G2L.js";
|
|
12
7
|
import {
|
|
13
8
|
EXTENSION_CONTEXT_BUDGET,
|
|
14
9
|
buildExtensionMentionContext,
|
|
@@ -18,17 +13,17 @@ import {
|
|
|
18
13
|
matchMcpServerByRef,
|
|
19
14
|
parseExtensionRef,
|
|
20
15
|
parseMcpServerRef
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import "./chunk-WLML6VIA.js";
|
|
16
|
+
} from "./chunk-X5SLJOMF.js";
|
|
23
17
|
import {
|
|
24
18
|
getAvailableCommands,
|
|
25
19
|
handleSlashCommand,
|
|
26
20
|
insertAfterFunctionResponses,
|
|
21
|
+
isSlashCommand,
|
|
27
22
|
normalizePartList
|
|
28
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-QSD4UH74.js";
|
|
29
24
|
import {
|
|
30
|
-
|
|
31
|
-
} from "./chunk-
|
|
25
|
+
recomputeMcpGating
|
|
26
|
+
} from "./chunk-CIDQISGM.js";
|
|
32
27
|
import {
|
|
33
28
|
SessionIdConflictError,
|
|
34
29
|
appEvents,
|
|
@@ -36,46 +31,48 @@ import {
|
|
|
36
31
|
cleanupReviewWorktreeLeases,
|
|
37
32
|
loadCliConfig,
|
|
38
33
|
normalizeDisabledToolList
|
|
39
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-IX4PWUDU.js";
|
|
40
35
|
import {
|
|
41
36
|
getCommandSubcommandNames
|
|
42
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-4XA4QIUA.js";
|
|
43
38
|
import {
|
|
44
39
|
getEffectiveSupportedModes
|
|
45
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-MDNUCDKZ.js";
|
|
41
|
+
import "./chunk-3SH53ANB.js";
|
|
46
42
|
import "./chunk-NYX53SV4.js";
|
|
47
|
-
import "./chunk-
|
|
43
|
+
import "./chunk-NW2GIPG3.js";
|
|
48
44
|
import {
|
|
49
45
|
collectContextData,
|
|
50
46
|
formatContextUsageText
|
|
51
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-62X3CM7Q.js";
|
|
52
48
|
import "./chunk-4WGODMVR.js";
|
|
53
49
|
import {
|
|
54
50
|
isGoalStatusKind
|
|
55
51
|
} from "./chunk-EKTCKZV5.js";
|
|
56
|
-
import "./chunk-
|
|
52
|
+
import "./chunk-OYWVIXHT.js";
|
|
57
53
|
import {
|
|
58
54
|
startNonInteractiveOpenAILogHousekeeping
|
|
59
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-5AFGJNY6.js";
|
|
60
56
|
import "./chunk-KW7NOTN6.js";
|
|
61
|
-
import "./chunk-
|
|
62
|
-
import "./chunk-
|
|
63
|
-
import "./chunk-
|
|
57
|
+
import "./chunk-ZQUY3ZJU.js";
|
|
58
|
+
import "./chunk-RDVNSJQU.js";
|
|
59
|
+
import "./chunk-OPVF453Q.js";
|
|
64
60
|
import "./chunk-YAF2MQZ6.js";
|
|
65
61
|
import {
|
|
66
62
|
computeCpuPercent
|
|
67
63
|
} from "./chunk-LBOVL47Y.js";
|
|
68
|
-
import "./chunk-
|
|
64
|
+
import "./chunk-TDESMS7M.js";
|
|
69
65
|
import "./chunk-6H67XLET.js";
|
|
70
66
|
import {
|
|
71
67
|
beginAcpBootstrapConfigProfiling,
|
|
72
68
|
buildAndFreezeAcpStartupProfile,
|
|
73
69
|
endAcpBootstrapConfigProfiling,
|
|
74
70
|
markAcpStartup
|
|
75
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-FMIH5KMQ.js";
|
|
76
72
|
import {
|
|
77
73
|
GENERATION_MAX_PROMPT_BYTES,
|
|
78
74
|
GENERATION_TIMEOUT_MS,
|
|
75
|
+
HistoryReplayLimitError,
|
|
79
76
|
MAX_REMEMBER_CONTENT_BYTES,
|
|
80
77
|
REDACTED_MCP_SECRET,
|
|
81
78
|
collectHistoryReplayUpdates,
|
|
@@ -94,8 +91,7 @@ import {
|
|
|
94
91
|
shouldSuppressRememberErrorDetails,
|
|
95
92
|
workspaceMemoryFailureCode,
|
|
96
93
|
workspaceMemoryFailureDiagnostics
|
|
97
|
-
} from "./chunk-
|
|
98
|
-
import "./chunk-ZBBVBZBR.js";
|
|
94
|
+
} from "./chunk-CZ4OWGQQ.js";
|
|
99
95
|
import {
|
|
100
96
|
BaseEmitter,
|
|
101
97
|
HistoryReplayer,
|
|
@@ -104,10 +100,10 @@ import {
|
|
|
104
100
|
createTranscriptMessageUpdate,
|
|
105
101
|
createTranscriptUsageUpdate,
|
|
106
102
|
hasFullSessionContext
|
|
107
|
-
} from "./chunk-
|
|
108
|
-
import "./chunk-
|
|
103
|
+
} from "./chunk-UI5UGEF4.js";
|
|
104
|
+
import "./chunk-TMFWI4RC.js";
|
|
109
105
|
import "./chunk-4NFY2S7N.js";
|
|
110
|
-
import "./chunk-
|
|
106
|
+
import "./chunk-V6OBVAST.js";
|
|
111
107
|
import "./chunk-2MIN6GRR.js";
|
|
112
108
|
import "./chunk-QHTIBUWB.js";
|
|
113
109
|
import "./chunk-3Z43GZUQ.js";
|
|
@@ -118,33 +114,25 @@ import {
|
|
|
118
114
|
normalizeSessionIdForLookup,
|
|
119
115
|
parseCallerSuppliedSessionId
|
|
120
116
|
} from "./chunk-TQOF5KBL.js";
|
|
121
|
-
import "./chunk-
|
|
117
|
+
import "./chunk-UXEO7E3V.js";
|
|
122
118
|
import {
|
|
123
119
|
PERMISSION_RULE_TYPES,
|
|
124
120
|
PermissionRulesValidationError,
|
|
125
121
|
buildPermissionSettings,
|
|
126
122
|
normalizePermissionRules,
|
|
127
123
|
readPermissionRuleSet
|
|
128
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-YX2RDGAL.js";
|
|
129
125
|
import {
|
|
130
126
|
MAX_AUDIO_BYTES,
|
|
131
127
|
sanitizeVoiceErrorMessage,
|
|
132
128
|
transcribeVoiceAudio
|
|
133
|
-
} from "./chunk-
|
|
129
|
+
} from "./chunk-LCX5B364.js";
|
|
134
130
|
import {
|
|
135
131
|
readVoiceModel
|
|
136
|
-
} from "./chunk-
|
|
137
|
-
import "./chunk-
|
|
132
|
+
} from "./chunk-VIFA5VJD.js";
|
|
133
|
+
import "./chunk-H7TMVHKE.js";
|
|
138
134
|
import "./chunk-NTTBXH7U.js";
|
|
139
|
-
import "./chunk-
|
|
140
|
-
import "./chunk-3SH53ANB.js";
|
|
141
|
-
import {
|
|
142
|
-
SESSION_SOURCE_META_KEY,
|
|
143
|
-
parseSessionSource
|
|
144
|
-
} from "./chunk-O5G7IQGM.js";
|
|
145
|
-
import "./chunk-MZSJ43WV.js";
|
|
146
|
-
import "./chunk-XCGIMOLN.js";
|
|
147
|
-
import "./chunk-OCPBI7J5.js";
|
|
135
|
+
import "./chunk-RQJA2YYO.js";
|
|
148
136
|
import {
|
|
149
137
|
ACP_ROUTE_ID_PREFIX,
|
|
150
138
|
buildAcpModelOptions,
|
|
@@ -153,26 +141,32 @@ import {
|
|
|
153
141
|
parseAcpModelOption,
|
|
154
142
|
resolveAcpModelOption,
|
|
155
143
|
sanitizeProviderBaseUrl
|
|
156
|
-
} from "./chunk-
|
|
144
|
+
} from "./chunk-ROIJYS5K.js";
|
|
157
145
|
import {
|
|
158
146
|
mapSkillConfigToStatus
|
|
159
147
|
} from "./chunk-BGXZBI5B.js";
|
|
160
148
|
import {
|
|
161
149
|
resolveSkillSettings
|
|
162
150
|
} from "./chunk-Z4X5MTRT.js";
|
|
163
|
-
import "./chunk-
|
|
164
|
-
import "./chunk-
|
|
151
|
+
import "./chunk-WM3LUQLO.js";
|
|
152
|
+
import "./chunk-IH4Z54RJ.js";
|
|
165
153
|
import "./chunk-57OAHC2Y.js";
|
|
166
|
-
import "./chunk-
|
|
167
|
-
import "./chunk-
|
|
168
|
-
import "./chunk-
|
|
169
|
-
import "./chunk-V6WHFGST.js";
|
|
154
|
+
import "./chunk-BSR5AXZR.js";
|
|
155
|
+
import "./chunk-45NQKMYB.js";
|
|
156
|
+
import "./chunk-OK47XBYH.js";
|
|
170
157
|
import {
|
|
171
158
|
createLoadedSettingsAdapter
|
|
172
|
-
} from "./chunk-
|
|
159
|
+
} from "./chunk-2IVYL3IF.js";
|
|
160
|
+
import {
|
|
161
|
+
SESSION_SOURCE_META_KEY,
|
|
162
|
+
parseSessionSource
|
|
163
|
+
} from "./chunk-6P5EXEBL.js";
|
|
164
|
+
import "./chunk-7U5G6JXI.js";
|
|
165
|
+
import "./chunk-WCCLLK7X.js";
|
|
166
|
+
import "./chunk-OCPBI7J5.js";
|
|
173
167
|
import {
|
|
174
168
|
ndJsonStream
|
|
175
|
-
} from "./chunk-
|
|
169
|
+
} from "./chunk-DAV4QFD5.js";
|
|
176
170
|
import {
|
|
177
171
|
ACP_PREFLIGHT_KINDS,
|
|
178
172
|
IDLE_HOOK_EVENTS,
|
|
@@ -180,14 +174,15 @@ import {
|
|
|
180
174
|
SERVE_STATUS_EXT_METHODS,
|
|
181
175
|
STATUS_SCHEMA_VERSION,
|
|
182
176
|
mapDomainErrorToErrorKind
|
|
183
|
-
} from "./chunk-
|
|
184
|
-
import "./chunk-
|
|
185
|
-
import "./chunk-
|
|
177
|
+
} from "./chunk-HTYND72J.js";
|
|
178
|
+
import "./chunk-ZLCT4C5A.js";
|
|
179
|
+
import "./chunk-V6WHFGST.js";
|
|
186
180
|
import {
|
|
187
181
|
ACTIVE_WORK_CLOSE_IF_UNHELD_PARAM,
|
|
188
182
|
ACTIVE_WORK_HEARTBEAT_META_KEY,
|
|
189
183
|
ACTIVE_WORK_HEARTBEAT_VERSION,
|
|
190
184
|
ACTIVE_WORK_HOLD_CATEGORIES,
|
|
185
|
+
ACTIVE_WORK_LEGACY_HOLD_CATEGORIES,
|
|
191
186
|
ACTIVE_WORK_NOTIFICATION_METHOD,
|
|
192
187
|
CHANNEL_STARTUP_PROFILE_META_KEY,
|
|
193
188
|
CHANNEL_STARTUP_PROFILE_VERSION,
|
|
@@ -197,6 +192,8 @@ import {
|
|
|
197
192
|
DAEMON_PROMPT_DISPLAY_TEXT_META_KEY,
|
|
198
193
|
LOAD_REPLAY_BULK_MODE,
|
|
199
194
|
LOAD_REPLAY_HIDE_INHERITED_META_KEY,
|
|
195
|
+
LOAD_REPLAY_MAX_BYTES,
|
|
196
|
+
LOAD_REPLAY_MAX_UPDATES,
|
|
200
197
|
LOAD_REPLAY_META_KEY,
|
|
201
198
|
LOAD_REPLAY_MODE_META_KEY,
|
|
202
199
|
LOAD_REPLAY_PAGE_SIZE_META_KEY,
|
|
@@ -209,7 +206,7 @@ import {
|
|
|
209
206
|
WORKTREE_MCP_DEFER_META_KEY,
|
|
210
207
|
clampActiveWorkIntervalMs,
|
|
211
208
|
isValidTrustedModelPrompt
|
|
212
|
-
} from "./chunk-
|
|
209
|
+
} from "./chunk-FQDCO3CJ.js";
|
|
213
210
|
import {
|
|
214
211
|
NOT_CURRENTLY_GENERATING_CANCEL_MESSAGE,
|
|
215
212
|
isNotCurrentlyGeneratingCancelError
|
|
@@ -217,7 +214,7 @@ import {
|
|
|
217
214
|
import "./chunk-6PLDPT2C.js";
|
|
218
215
|
import "./chunk-FYJ7W2PI.js";
|
|
219
216
|
import "./chunk-YP5KH5Y7.js";
|
|
220
|
-
import "./chunk-
|
|
217
|
+
import "./chunk-A6NRNRKE.js";
|
|
221
218
|
import "./chunk-ALMR3E6Q.js";
|
|
222
219
|
import "./chunk-HIBNSEJE.js";
|
|
223
220
|
import "./chunk-M5GB774H.js";
|
|
@@ -226,22 +223,24 @@ import {
|
|
|
226
223
|
EXTERNAL_TOOL_GUARD_REQUIRED_VALUE,
|
|
227
224
|
EXTERNAL_TOOL_GUARD_TOKEN_ENV,
|
|
228
225
|
PRIVATE_EXTERNAL_TOOL_GUARD_ENV,
|
|
226
|
+
PRIVATE_EXTERNAL_TOOL_GUARD_PROVIDER_ENV,
|
|
227
|
+
SHELL_EXECUTING_TOOL_NAMES,
|
|
229
228
|
isValidExternalToolGuardDenialReason
|
|
230
|
-
} from "./chunk-
|
|
229
|
+
} from "./chunk-3VUENPWF.js";
|
|
230
|
+
import "./chunk-3AEKDXKT.js";
|
|
231
231
|
import {
|
|
232
232
|
ACP_EVENT_LOOP_STALL_RESTART_MS,
|
|
233
233
|
CHANNEL_PROMPT_META_KEY
|
|
234
|
-
} from "./chunk-
|
|
234
|
+
} from "./chunk-AW27A43Y.js";
|
|
235
235
|
import {
|
|
236
236
|
AgentSideConnection,
|
|
237
237
|
PROTOCOL_VERSION,
|
|
238
238
|
RequestError
|
|
239
239
|
} from "./chunk-IW6RQPQB.js";
|
|
240
|
-
import "./chunk-AQHNAA7E.js";
|
|
241
240
|
import {
|
|
242
241
|
assembleMcpServers,
|
|
243
242
|
loadMcpApprovals
|
|
244
|
-
} from "./chunk-
|
|
243
|
+
} from "./chunk-3LDGOQXZ.js";
|
|
245
244
|
import {
|
|
246
245
|
getOutputLanguageFilePath,
|
|
247
246
|
getPersistScopeForModelSelection,
|
|
@@ -250,9 +249,9 @@ import {
|
|
|
250
249
|
resolveOutputLanguageOrPreserveAuto,
|
|
251
250
|
updateOutputLanguageFile,
|
|
252
251
|
writeOutputLanguageAndRegisterPath
|
|
253
|
-
} from "./chunk-
|
|
252
|
+
} from "./chunk-3GDBZJD6.js";
|
|
254
253
|
import "./chunk-RKUWKYED.js";
|
|
255
|
-
import "./chunk-
|
|
254
|
+
import "./chunk-FA5K6YI2.js";
|
|
256
255
|
import "./chunk-GOXKNSDZ.js";
|
|
257
256
|
import {
|
|
258
257
|
getSystemDefaultsPath,
|
|
@@ -261,7 +260,7 @@ import {
|
|
|
261
260
|
import {
|
|
262
261
|
getCurrentLanguage,
|
|
263
262
|
setLanguageAsync
|
|
264
|
-
} from "./chunk-
|
|
263
|
+
} from "./chunk-IRSLAS4M.js";
|
|
265
264
|
import {
|
|
266
265
|
SUPPORTED_LANGUAGES
|
|
267
266
|
} from "./chunk-5EJZE3FP.js";
|
|
@@ -269,17 +268,18 @@ import {
|
|
|
269
268
|
findEnvFiles,
|
|
270
269
|
preResolveHomeEnvOverrides,
|
|
271
270
|
reloadEnvironment
|
|
272
|
-
} from "./chunk-
|
|
271
|
+
} from "./chunk-XH3KAV2G.js";
|
|
273
272
|
import {
|
|
274
273
|
ENV_ACP_REPEATED_TOOL_FAILURE_GUARD
|
|
275
274
|
} from "./chunk-MS7GNABG.js";
|
|
276
|
-
import "./chunk-
|
|
277
|
-
import "./chunk-
|
|
275
|
+
import "./chunk-7KJPO7YH.js";
|
|
276
|
+
import "./chunk-OWXFBIB6.js";
|
|
277
|
+
import "./chunk-WZMH7II3.js";
|
|
278
278
|
import {
|
|
279
279
|
isFolderTrustEnabled,
|
|
280
280
|
isWorkspaceTrusted,
|
|
281
281
|
loadTrustedFolders
|
|
282
|
-
} from "./chunk-
|
|
282
|
+
} from "./chunk-ZMY2P4L3.js";
|
|
283
283
|
import "./chunk-NPQ5ZKRP.js";
|
|
284
284
|
import "./chunk-MR3PXB6E.js";
|
|
285
285
|
import "./chunk-XFSFZCM5.js";
|
|
@@ -332,6 +332,7 @@ import {
|
|
|
332
332
|
buildPermissionCheckContext,
|
|
333
333
|
buildSessionRecoveryPlanFromApiHistory,
|
|
334
334
|
clampInlineMediaPart,
|
|
335
|
+
collectSessionTurnState,
|
|
335
336
|
computeUniqueBranchTitle,
|
|
336
337
|
convertToFunctionErrorResponse,
|
|
337
338
|
convertToFunctionResponse,
|
|
@@ -348,7 +349,6 @@ import {
|
|
|
348
349
|
evaluatePlanModeShellPolicy,
|
|
349
350
|
evaluateToolInvocationGuard,
|
|
350
351
|
finalizeToolResponses,
|
|
351
|
-
findBoundaryAtOrBefore,
|
|
352
352
|
findExistingProviderModels,
|
|
353
353
|
findPlanModeEntryBatchBoundaryIndex,
|
|
354
354
|
findProviderById,
|
|
@@ -381,7 +381,6 @@ import {
|
|
|
381
381
|
isDenialFallbackReason,
|
|
382
382
|
isGatedMcpScope,
|
|
383
383
|
isPlanModeBlocked,
|
|
384
|
-
isReplayTurnStartType,
|
|
385
384
|
markDuplicateProviderToolCallResponseSent,
|
|
386
385
|
matchesAnyServerPattern,
|
|
387
386
|
mcpServerRequiresOAuth,
|
|
@@ -393,7 +392,6 @@ import {
|
|
|
393
392
|
readManyFiles,
|
|
394
393
|
recordAllow,
|
|
395
394
|
recordFallbackApprove,
|
|
396
|
-
redactUrlCredentials,
|
|
397
395
|
refreshMemoryAfterManagedWrite,
|
|
398
396
|
refreshMemoryInstruction,
|
|
399
397
|
resolveBaseUrl,
|
|
@@ -401,7 +399,6 @@ import {
|
|
|
401
399
|
runForkedAgent,
|
|
402
400
|
runManagedAutoMemoryDream,
|
|
403
401
|
runManagedRememberByAgent,
|
|
404
|
-
sessionIdContext,
|
|
405
402
|
shouldClassifyAllShellForAutoMode,
|
|
406
403
|
shouldFallback,
|
|
407
404
|
shouldFirePermissionDeniedForAutoMode,
|
|
@@ -413,25 +410,25 @@ import {
|
|
|
413
410
|
updateSetting,
|
|
414
411
|
validatePlanModeShellApproval,
|
|
415
412
|
validatePlanModeShellContext
|
|
416
|
-
} from "./chunk-
|
|
413
|
+
} from "./chunk-EBPLKY6U.js";
|
|
417
414
|
import "./chunk-GOFAQQZA.js";
|
|
418
415
|
import "./chunk-5M6IDOMF.js";
|
|
419
416
|
import "./chunk-TWPJO254.js";
|
|
420
417
|
import {
|
|
421
418
|
external_exports
|
|
422
419
|
} from "./chunk-CQ35AJ4Z.js";
|
|
423
|
-
import "./chunk-
|
|
424
|
-
import "./chunk-
|
|
425
|
-
import "./chunk-
|
|
426
|
-
import "./chunk-
|
|
420
|
+
import "./chunk-QPBFRWCP.js";
|
|
421
|
+
import "./chunk-JRIVMPD2.js";
|
|
422
|
+
import "./chunk-YILJKX2T.js";
|
|
423
|
+
import "./chunk-D2RNVVH6.js";
|
|
427
424
|
import {
|
|
428
425
|
parsePositiveIntegerEnv
|
|
429
426
|
} from "./chunk-6PVPNMXU.js";
|
|
430
|
-
import "./chunk-
|
|
427
|
+
import "./chunk-I7BT2MME.js";
|
|
431
428
|
import "./chunk-IRH27ZC2.js";
|
|
432
429
|
import "./chunk-QHWCP53L.js";
|
|
433
|
-
import "./chunk-
|
|
434
|
-
import "./chunk-
|
|
430
|
+
import "./chunk-AKBFSOC5.js";
|
|
431
|
+
import "./chunk-DEDESZDL.js";
|
|
435
432
|
import {
|
|
436
433
|
promptIdContext,
|
|
437
434
|
todoWorkChainContext
|
|
@@ -439,39 +436,73 @@ import {
|
|
|
439
436
|
import "./chunk-T26EAKDL.js";
|
|
440
437
|
import "./chunk-ZPJWUGCS.js";
|
|
441
438
|
import "./chunk-CPBF7KYF.js";
|
|
442
|
-
import
|
|
443
|
-
APPROVAL_MODES
|
|
444
|
-
} from "./chunk-6LYDH7VT.js";
|
|
445
|
-
import "./chunk-2AZMF6G5.js";
|
|
439
|
+
import "./chunk-5RUCD4ED.js";
|
|
446
440
|
import "./chunk-KRXPRVGL.js";
|
|
447
441
|
import {
|
|
448
442
|
HookEventName,
|
|
449
443
|
createHookOutput
|
|
450
|
-
} from "./chunk-
|
|
451
|
-
import "./chunk-
|
|
452
|
-
import "./chunk-
|
|
444
|
+
} from "./chunk-YBVVOSOH.js";
|
|
445
|
+
import "./chunk-CPFFU46D.js";
|
|
446
|
+
import "./chunk-ULNWG62W.js";
|
|
453
447
|
import {
|
|
454
448
|
GoalPersistenceUnavailableError,
|
|
455
449
|
emptyGoalSnapshot,
|
|
456
450
|
goalTurnContext,
|
|
451
|
+
parseGoalSnapshotV2,
|
|
452
|
+
parseGoalStateCause,
|
|
457
453
|
wrapUserPromptSubmitContext
|
|
458
|
-
} from "./chunk-
|
|
459
|
-
import
|
|
454
|
+
} from "./chunk-DPTMKFIH.js";
|
|
455
|
+
import {
|
|
456
|
+
APPROVAL_MODES
|
|
457
|
+
} from "./chunk-63FNZTWG.js";
|
|
458
|
+
import "./chunk-3GM5DLBI.js";
|
|
460
459
|
import {
|
|
460
|
+
AgentOutputMessageCapture,
|
|
461
|
+
addAgentInputMessageAttributes,
|
|
462
|
+
addDaemonRequestAttribute,
|
|
461
463
|
addToolArgumentsAttributes,
|
|
462
464
|
addToolCallResultAttributes,
|
|
463
465
|
extractDaemonTraceContext,
|
|
464
466
|
registerAcpEventLoopLagGauge,
|
|
465
467
|
startEventLoopLagMonitor,
|
|
466
468
|
withDaemonSpan
|
|
467
|
-
} from "./chunk-
|
|
469
|
+
} from "./chunk-K34GJQOZ.js";
|
|
468
470
|
import "./chunk-SAH4BD2J.js";
|
|
469
|
-
import "./chunk-
|
|
471
|
+
import "./chunk-KLOMACIR.js";
|
|
470
472
|
import {
|
|
471
473
|
runWithRuntimeContentGenerator
|
|
472
|
-
} from "./chunk-
|
|
474
|
+
} from "./chunk-VPV7WBVT.js";
|
|
473
475
|
import "./chunk-S6LOFUVP.js";
|
|
474
476
|
import "./chunk-2J3OJGTL.js";
|
|
477
|
+
import {
|
|
478
|
+
FORK_SUBAGENT_TYPE,
|
|
479
|
+
getStartupContextLength,
|
|
480
|
+
isSystemReminderContent
|
|
481
|
+
} from "./chunk-TTRH3RTQ.js";
|
|
482
|
+
import "./chunk-K623ENWT.js";
|
|
483
|
+
import "./chunk-AQ37AY7B.js";
|
|
484
|
+
import "./chunk-FRHQQC2Z.js";
|
|
485
|
+
import {
|
|
486
|
+
clearCachedCredentialFile,
|
|
487
|
+
qwenOAuth2Events
|
|
488
|
+
} from "./chunk-DG4IQ6JG.js";
|
|
489
|
+
import "./chunk-NAVJD2PQ.js";
|
|
490
|
+
import "./chunk-KEC5FHLM.js";
|
|
491
|
+
import "./chunk-2ZWH53I4.js";
|
|
492
|
+
import "./chunk-P3QQPMQA.js";
|
|
493
|
+
import "./chunk-TB4YFWXG.js";
|
|
494
|
+
import "./chunk-D7QGE3RT.js";
|
|
495
|
+
import {
|
|
496
|
+
REASONING_EFFORT_TIERS,
|
|
497
|
+
applyReasoningEffort
|
|
498
|
+
} from "./chunk-KM73TBQ4.js";
|
|
499
|
+
import "./chunk-MPHPFVKK.js";
|
|
500
|
+
import "./chunk-AXMWHKXA.js";
|
|
501
|
+
import {
|
|
502
|
+
getToolCallPreparations
|
|
503
|
+
} from "./chunk-GLCZKT5V.js";
|
|
504
|
+
import "./chunk-DJ2GSRLV.js";
|
|
505
|
+
import "./chunk-NLFLYSS4.js";
|
|
475
506
|
import {
|
|
476
507
|
ConversationFinishedEvent,
|
|
477
508
|
DiscoveredMCPTool,
|
|
@@ -504,26 +535,17 @@ import {
|
|
|
504
535
|
shouldRunVisionBridge,
|
|
505
536
|
splitImageParts,
|
|
506
537
|
uiTelemetryService
|
|
507
|
-
} from "./chunk-
|
|
538
|
+
} from "./chunk-4KM2SYK5.js";
|
|
508
539
|
import "./chunk-YRLW2MSX.js";
|
|
509
540
|
import "./chunk-VGC4I5JJ.js";
|
|
510
541
|
import {
|
|
511
542
|
getAutoMemoryRoot,
|
|
512
543
|
getUserAutoMemoryRoot
|
|
513
|
-
} from "./chunk-
|
|
544
|
+
} from "./chunk-G6MUFRNI.js";
|
|
514
545
|
import {
|
|
515
546
|
runSideQuery
|
|
516
|
-
} from "./chunk-
|
|
517
|
-
import "./chunk-
|
|
518
|
-
import "./chunk-IEP44U2R.js";
|
|
519
|
-
import {
|
|
520
|
-
FORK_SUBAGENT_TYPE,
|
|
521
|
-
getStartupContextLength,
|
|
522
|
-
isSystemReminderContent
|
|
523
|
-
} from "./chunk-ZV4XVYL3.js";
|
|
524
|
-
import "./chunk-K623ENWT.js";
|
|
525
|
-
import "./chunk-AQ37AY7B.js";
|
|
526
|
-
import "./chunk-V3LXMASR.js";
|
|
547
|
+
} from "./chunk-LSRI3ND3.js";
|
|
548
|
+
import "./chunk-PVXEJB66.js";
|
|
527
549
|
import {
|
|
528
550
|
BaseDeclarativeTool,
|
|
529
551
|
BaseToolInvocation,
|
|
@@ -531,63 +553,47 @@ import {
|
|
|
531
553
|
ToolNames,
|
|
532
554
|
canonicalToolName,
|
|
533
555
|
isShellProgressData
|
|
534
|
-
} from "./chunk-
|
|
535
|
-
import {
|
|
536
|
-
clearCachedCredentialFile,
|
|
537
|
-
qwenOAuth2Events
|
|
538
|
-
} from "./chunk-TBVNYG5B.js";
|
|
539
|
-
import "./chunk-NAVJD2PQ.js";
|
|
540
|
-
import "./chunk-5HBFERG5.js";
|
|
541
|
-
import "./chunk-EYW54TBD.js";
|
|
542
|
-
import "./chunk-P3QQPMQA.js";
|
|
543
|
-
import "./chunk-O4BBDP2G.js";
|
|
544
|
-
import "./chunk-KPVVWKF3.js";
|
|
556
|
+
} from "./chunk-YIGGWOJE.js";
|
|
545
557
|
import {
|
|
546
558
|
AuthType,
|
|
547
559
|
preloadContentGenerator
|
|
548
|
-
} from "./chunk-
|
|
560
|
+
} from "./chunk-KWX56CHZ.js";
|
|
549
561
|
import "./chunk-F6WFNA7U.js";
|
|
550
|
-
import "./chunk-F6AOBFUN.js";
|
|
551
|
-
import {
|
|
552
|
-
REASONING_EFFORT_TIERS,
|
|
553
|
-
applyReasoningEffort
|
|
554
|
-
} from "./chunk-KM73TBQ4.js";
|
|
555
|
-
import "./chunk-MPHPFVKK.js";
|
|
556
|
-
import "./chunk-AXMWHKXA.js";
|
|
557
|
-
import {
|
|
558
|
-
getToolCallPreparations
|
|
559
|
-
} from "./chunk-GLCZKT5V.js";
|
|
560
|
-
import "./chunk-GJJQV4PY.js";
|
|
561
562
|
import "./chunk-46UV252V.js";
|
|
562
563
|
import {
|
|
563
564
|
DEFAULT_TOKEN_LIMIT,
|
|
564
565
|
tokenLimit
|
|
565
566
|
} from "./chunk-FPGTNKCP.js";
|
|
566
|
-
import "./chunk-
|
|
567
|
-
import "./chunk-
|
|
567
|
+
import "./chunk-4AOVQPJU.js";
|
|
568
|
+
import "./chunk-PZW46OTB.js";
|
|
569
|
+
import "./chunk-YBHUXEC6.js";
|
|
568
570
|
import {
|
|
569
571
|
endToolExecutionSpan,
|
|
570
572
|
endToolSpan,
|
|
573
|
+
getActiveInteractionSpan,
|
|
571
574
|
initializeTelemetry,
|
|
575
|
+
redactUrlCredentials,
|
|
572
576
|
runInToolSpanContext,
|
|
573
577
|
startToolExecutionSpan,
|
|
574
578
|
startToolSpan,
|
|
575
579
|
withInteractionSpan
|
|
576
|
-
} from "./chunk-
|
|
580
|
+
} from "./chunk-N4SVADAV.js";
|
|
577
581
|
import "./chunk-HHJLM3WQ.js";
|
|
578
|
-
import
|
|
582
|
+
import {
|
|
583
|
+
sessionIdContext
|
|
584
|
+
} from "./chunk-K5IDV3PC.js";
|
|
579
585
|
import {
|
|
580
586
|
Storage,
|
|
581
587
|
createDebugLogger,
|
|
582
588
|
getErrorMessage,
|
|
583
589
|
getErrorStatus,
|
|
584
590
|
isSubpath
|
|
585
|
-
} from "./chunk-
|
|
591
|
+
} from "./chunk-HOSVOUDK.js";
|
|
586
592
|
import "./chunk-VOQXFAY5.js";
|
|
587
|
-
import "./chunk-
|
|
593
|
+
import "./chunk-MELQSJOU.js";
|
|
588
594
|
import {
|
|
589
595
|
runExitCleanup
|
|
590
|
-
} from "./chunk-
|
|
596
|
+
} from "./chunk-OR64CU46.js";
|
|
591
597
|
import {
|
|
592
598
|
writeStderrLine,
|
|
593
599
|
writeStderrLineSafe
|
|
@@ -1650,8 +1656,12 @@ var MessageEmitter = class extends BaseEmitter {
|
|
|
1650
1656
|
}
|
|
1651
1657
|
});
|
|
1652
1658
|
}
|
|
1653
|
-
async emitGoalStatus(status) {
|
|
1654
|
-
|
|
1659
|
+
async emitGoalStatus(status, goalState) {
|
|
1660
|
+
const update = buildGoalStatusUpdate(status);
|
|
1661
|
+
if (goalState) {
|
|
1662
|
+
update._meta = { ...update._meta, goalState };
|
|
1663
|
+
}
|
|
1664
|
+
await this.sendUpdate(update);
|
|
1655
1665
|
}
|
|
1656
1666
|
async emitGoalState(snapshot, cause, previousGoal = null) {
|
|
1657
1667
|
await this.sendUpdate(buildGoalStateUpdate(snapshot, cause, previousGoal));
|
|
@@ -1786,6 +1796,58 @@ var MessageEmitter = class extends BaseEmitter {
|
|
|
1786
1796
|
}
|
|
1787
1797
|
};
|
|
1788
1798
|
|
|
1799
|
+
// packages/cli/src/acp-integration/session/recovered-goal-update.ts
|
|
1800
|
+
init_esbuild_shims();
|
|
1801
|
+
async function renderPreparedGoalUpdate(getRuntime, options = {}) {
|
|
1802
|
+
let runtime;
|
|
1803
|
+
try {
|
|
1804
|
+
runtime = await getRuntime();
|
|
1805
|
+
} catch (error) {
|
|
1806
|
+
if (!(error instanceof GoalPersistenceUnavailableError)) throw error;
|
|
1807
|
+
const status = unrestorableGoalStatus(
|
|
1808
|
+
options.replayedRecords,
|
|
1809
|
+
options.bootstrap
|
|
1810
|
+
);
|
|
1811
|
+
return { updates: status ? [buildGoalStatusUpdate(status)] : [] };
|
|
1812
|
+
}
|
|
1813
|
+
const cause = runtime.getRecoveryCause?.();
|
|
1814
|
+
if (!cause) return { updates: [] };
|
|
1815
|
+
const snapshot = runtime.getSnapshot();
|
|
1816
|
+
const publicationKey = goalPublicationKey(snapshot, cause);
|
|
1817
|
+
if (options.hideRuntimeGoal) {
|
|
1818
|
+
return {
|
|
1819
|
+
publicationKey,
|
|
1820
|
+
...snapshot.goal ? {
|
|
1821
|
+
suppressedGoalId: snapshot.goal.goalId
|
|
1822
|
+
} : {},
|
|
1823
|
+
updates: []
|
|
1824
|
+
};
|
|
1825
|
+
}
|
|
1826
|
+
const bootstrapGoal = options.bootstrap?.goalState?.goal;
|
|
1827
|
+
const bootstrapMatchesRuntime = bootstrapGoal != null && snapshot.goal?.goalId === bootstrapGoal.goalId && snapshot.goal?.revision === bootstrapGoal.revision;
|
|
1828
|
+
return {
|
|
1829
|
+
publicationKey,
|
|
1830
|
+
updates: options.bootstrap && bootstrapMatchesRuntime ? [] : [buildGoalStateUpdate(snapshot, cause, options.previousGoal ?? null)]
|
|
1831
|
+
};
|
|
1832
|
+
}
|
|
1833
|
+
__name(renderPreparedGoalUpdate, "renderPreparedGoalUpdate");
|
|
1834
|
+
function unrestorableGoalStatus(replayedRecords, bootstrap) {
|
|
1835
|
+
const active = (replayedRecords?.length ? findGoalToRestore(collectGoalStatusItemsFromRecords(replayedRecords)) : void 0) ?? bootstrap?.goalStatus;
|
|
1836
|
+
if (!active) return void 0;
|
|
1837
|
+
return {
|
|
1838
|
+
kind: "cleared",
|
|
1839
|
+
condition: active.condition,
|
|
1840
|
+
iterations: active.iterations,
|
|
1841
|
+
...active.setAt !== void 0 ? { setAt: active.setAt } : {},
|
|
1842
|
+
lastReason: "Goal not restored: its saved state could not be read, so this session is not driving it."
|
|
1843
|
+
};
|
|
1844
|
+
}
|
|
1845
|
+
__name(unrestorableGoalStatus, "unrestorableGoalStatus");
|
|
1846
|
+
function goalPublicationKey(snapshot, cause) {
|
|
1847
|
+
return cause ? `${cause}:${JSON.stringify(snapshot)}` : void 0;
|
|
1848
|
+
}
|
|
1849
|
+
__name(goalPublicationKey, "goalPublicationKey");
|
|
1850
|
+
|
|
1789
1851
|
// packages/cli/src/acp-integration/session/SubAgentTracker.ts
|
|
1790
1852
|
init_esbuild_shims();
|
|
1791
1853
|
|
|
@@ -3074,6 +3136,7 @@ var DAEMON_INVALID_TOOL_PARAMS_THRESHOLD = 3;
|
|
|
3074
3136
|
var PERMISSION_CANCEL_SKIP_MESSAGE = "Skipped because a permission request was cancelled before the user answered; user input is required before continuing.";
|
|
3075
3137
|
var LOOP_DETECTED_SKIP_MESSAGE = "Skipped because loop detection stopped the current turn before this tool call could run.";
|
|
3076
3138
|
var LOOP_DETECTED_CONTEXT_MESSAGE = "System: this turn was terminated because the model exceeded tool-call safety limits. Try a different approach on the next turn.";
|
|
3139
|
+
var LOOP_DETECTED_TURN_ERROR_MESSAGE = "Tool-call loop protection stopped this turn. The session is still available; send a more specific instruction to continue.";
|
|
3077
3140
|
var TOOL_EXECUTION_CANCELLED_MESSAGE = "Tool execution was cancelled.";
|
|
3078
3141
|
var TOOL_POST_EXECUTION_CANCELLED_MESSAGE = "The tool had already completed; its output was discarded.";
|
|
3079
3142
|
function createDaemonToolLoopState(repeatedToolFailureMode) {
|
|
@@ -3142,6 +3205,7 @@ __name(recordRepeatedToolFailureDecision, "recordRepeatedToolFailureDecision");
|
|
|
3142
3205
|
function recordDaemonLoopDetected(config, promptId, loopType, message, loopState, options = {}) {
|
|
3143
3206
|
if (!loopState.loopDetected) {
|
|
3144
3207
|
loopState.loopDetected = true;
|
|
3208
|
+
loopState.loopType = loopType;
|
|
3145
3209
|
debugLogger6.warn(message);
|
|
3146
3210
|
try {
|
|
3147
3211
|
logLoopDetected(
|
|
@@ -3159,6 +3223,25 @@ function recordDaemonLoopDetected(config, promptId, loopType, message, loopState
|
|
|
3159
3223
|
return true;
|
|
3160
3224
|
}
|
|
3161
3225
|
__name(recordDaemonLoopDetected, "recordDaemonLoopDetected");
|
|
3226
|
+
function createLoopDetectedTurnError(loopState) {
|
|
3227
|
+
return new RequestError(-32603, LOOP_DETECTED_TURN_ERROR_MESSAGE, {
|
|
3228
|
+
code: "LOOP_DETECTED",
|
|
3229
|
+
errorKind: "loop_detected",
|
|
3230
|
+
...loopState.loopType ? { loopType: loopState.loopType } : {}
|
|
3231
|
+
});
|
|
3232
|
+
}
|
|
3233
|
+
__name(createLoopDetectedTurnError, "createLoopDetectedTurnError");
|
|
3234
|
+
function cancelledOrThrowLoopDetected(signal, loopState) {
|
|
3235
|
+
if (signal.aborted) return "cancelled";
|
|
3236
|
+
throw createLoopDetectedTurnError(loopState);
|
|
3237
|
+
}
|
|
3238
|
+
__name(cancelledOrThrowLoopDetected, "cancelledOrThrowLoopDetected");
|
|
3239
|
+
function isLoopDetectedTurnError(error) {
|
|
3240
|
+
if (!(error instanceof RequestError)) return false;
|
|
3241
|
+
const data = error.data;
|
|
3242
|
+
return typeof data === "object" && data !== null && data.code === "LOOP_DETECTED";
|
|
3243
|
+
}
|
|
3244
|
+
__name(isLoopDetectedTurnError, "isLoopDetectedTurnError");
|
|
3162
3245
|
function recordDaemonToolCalls(config, promptId, loopState, calls) {
|
|
3163
3246
|
if (!loopState || loopState.loopDetected)
|
|
3164
3247
|
return loopState?.loopDetected ?? false;
|
|
@@ -3422,14 +3505,16 @@ var TodoStopGuardClaimTimeoutError = class extends Error {
|
|
|
3422
3505
|
}
|
|
3423
3506
|
};
|
|
3424
3507
|
function beginChannelDeliveryResponseBlock(capture) {
|
|
3425
|
-
|
|
3426
|
-
capture
|
|
3508
|
+
capture?.agentOutput.beginResponse();
|
|
3509
|
+
if (!capture?.channelDelivery) return void 0;
|
|
3510
|
+
capture.channelDelivery.finalText = "";
|
|
3427
3511
|
return [];
|
|
3428
3512
|
}
|
|
3429
3513
|
__name(beginChannelDeliveryResponseBlock, "beginChannelDeliveryResponseBlock");
|
|
3430
3514
|
function commitChannelDeliveryResponseBlock(capture, responseBlock, hasFunctionCalls) {
|
|
3431
|
-
|
|
3432
|
-
|
|
3515
|
+
capture?.agentOutput.commitResponse(hasFunctionCalls);
|
|
3516
|
+
if (capture?.channelDelivery && responseBlock && !hasFunctionCalls) {
|
|
3517
|
+
capture.channelDelivery.finalText = responseBlock.join("");
|
|
3433
3518
|
}
|
|
3434
3519
|
}
|
|
3435
3520
|
__name(commitChannelDeliveryResponseBlock, "commitChannelDeliveryResponseBlock");
|
|
@@ -3481,28 +3566,6 @@ function resolveHomeLoopResolverRoots({
|
|
|
3481
3566
|
};
|
|
3482
3567
|
}
|
|
3483
3568
|
__name(resolveHomeLoopResolverRoots, "resolveHomeLoopResolverRoots");
|
|
3484
|
-
function computeInitialTurnFromHistory(records, sessionId) {
|
|
3485
|
-
let maxPromptTurn = 0;
|
|
3486
|
-
let userMessageCount = 0;
|
|
3487
|
-
const promptIdPrefix = `${sessionId}########`;
|
|
3488
|
-
for (const record of records) {
|
|
3489
|
-
if (record.sessionId === sessionId && isUserPromptRecord(record)) {
|
|
3490
|
-
userMessageCount += 1;
|
|
3491
|
-
}
|
|
3492
|
-
for (const promptId of getRecordPromptIds(record)) {
|
|
3493
|
-
if (!promptId.startsWith(promptIdPrefix)) {
|
|
3494
|
-
continue;
|
|
3495
|
-
}
|
|
3496
|
-
const suffix = promptId.slice(promptIdPrefix.length);
|
|
3497
|
-
if (!/^\d+$/.test(suffix)) {
|
|
3498
|
-
continue;
|
|
3499
|
-
}
|
|
3500
|
-
maxPromptTurn = Math.max(maxPromptTurn, Number(suffix));
|
|
3501
|
-
}
|
|
3502
|
-
}
|
|
3503
|
-
return maxPromptTurn > 0 ? maxPromptTurn : userMessageCount;
|
|
3504
|
-
}
|
|
3505
|
-
__name(computeInitialTurnFromHistory, "computeInitialTurnFromHistory");
|
|
3506
3569
|
async function fireSessionPermissionDeniedForAutoMode(config, decision, outcome, toolName, toolParams, callId, signal) {
|
|
3507
3570
|
if (!config.getDisableAllHooks?.() && shouldFirePermissionDeniedForAutoMode(decision, outcome)) {
|
|
3508
3571
|
try {
|
|
@@ -3522,40 +3585,6 @@ async function fireSessionPermissionDeniedForAutoMode(config, decision, outcome,
|
|
|
3522
3585
|
}
|
|
3523
3586
|
}
|
|
3524
3587
|
__name(fireSessionPermissionDeniedForAutoMode, "fireSessionPermissionDeniedForAutoMode");
|
|
3525
|
-
function getRecordPromptIds(record) {
|
|
3526
|
-
const promptIds = [];
|
|
3527
|
-
const recordPromptId = record.promptId;
|
|
3528
|
-
if (typeof recordPromptId === "string") {
|
|
3529
|
-
promptIds.push(recordPromptId);
|
|
3530
|
-
}
|
|
3531
|
-
const telemetryPromptId = readTelemetryPromptId(record.systemPayload);
|
|
3532
|
-
if (telemetryPromptId) {
|
|
3533
|
-
promptIds.push(telemetryPromptId);
|
|
3534
|
-
}
|
|
3535
|
-
return promptIds;
|
|
3536
|
-
}
|
|
3537
|
-
__name(getRecordPromptIds, "getRecordPromptIds");
|
|
3538
|
-
function readTelemetryPromptId(payload) {
|
|
3539
|
-
if (!payload || typeof payload !== "object" || !("uiEvent" in payload)) {
|
|
3540
|
-
return void 0;
|
|
3541
|
-
}
|
|
3542
|
-
const uiEvent = payload.uiEvent;
|
|
3543
|
-
if (!uiEvent || typeof uiEvent !== "object" || !("prompt_id" in uiEvent)) {
|
|
3544
|
-
return void 0;
|
|
3545
|
-
}
|
|
3546
|
-
const promptId = uiEvent.prompt_id;
|
|
3547
|
-
return typeof promptId === "string" ? promptId : void 0;
|
|
3548
|
-
}
|
|
3549
|
-
__name(readTelemetryPromptId, "readTelemetryPromptId");
|
|
3550
|
-
function isUserPromptRecord(record) {
|
|
3551
|
-
if (record.type !== "user" || record.subtype === "realtime_message") {
|
|
3552
|
-
return false;
|
|
3553
|
-
}
|
|
3554
|
-
return record.message?.parts?.some(
|
|
3555
|
-
(part) => typeof part.text === "string" && part.text.trim().length > 0
|
|
3556
|
-
) ?? false;
|
|
3557
|
-
}
|
|
3558
|
-
__name(isUserPromptRecord, "isUserPromptRecord");
|
|
3559
3588
|
var AT_TOKEN_RE = /@([^\s,;!?()[\]{}]+)/g;
|
|
3560
3589
|
function collectExtensionMentionRefs(text, mentions) {
|
|
3561
3590
|
for (const match of text.matchAll(AT_TOKEN_RE)) {
|
|
@@ -3778,6 +3807,7 @@ var Session = class {
|
|
|
3778
3807
|
notificationAbortController = null;
|
|
3779
3808
|
notificationCompletion = null;
|
|
3780
3809
|
currentAgentNotificationTaskId = null;
|
|
3810
|
+
currentShellNotificationActive = false;
|
|
3781
3811
|
persistedBackgroundNotificationTaskIds = /* @__PURE__ */ new Set();
|
|
3782
3812
|
backgroundNotificationAcceptances = /* @__PURE__ */ new Map();
|
|
3783
3813
|
activeAgentNotificationAcceptances = /* @__PURE__ */ new Set();
|
|
@@ -3788,6 +3818,9 @@ var Session = class {
|
|
|
3788
3818
|
goalRuntimeUnsubscribe;
|
|
3789
3819
|
lastGoalSnapshot;
|
|
3790
3820
|
lastGoalPublicationKey;
|
|
3821
|
+
// Set only when runtime recovery selected a Goal that initial replay hid.
|
|
3822
|
+
// Keep that Goal private through activation and later progress updates.
|
|
3823
|
+
suppressedRecoveredGoalId;
|
|
3791
3824
|
goalPublicationTail = Promise.resolve();
|
|
3792
3825
|
// Set true in dispose(). Guards #drainCronQueue and #drainNotificationQueue
|
|
3793
3826
|
// against the race where #drainNotificationQueue's finally block kicks off
|
|
@@ -3802,6 +3835,7 @@ var Session = class {
|
|
|
3802
3835
|
/** The exact status-change callback this Session installed, so dispose can
|
|
3803
3836
|
* retract its own and nobody else's. */
|
|
3804
3837
|
#statusChangeCallback;
|
|
3838
|
+
#shellStatusChangeCallback;
|
|
3805
3839
|
workflowApprovalAbortController = new AbortController();
|
|
3806
3840
|
activeTodoPlanRevision;
|
|
3807
3841
|
// Modular components
|
|
@@ -3899,6 +3933,7 @@ var Session = class {
|
|
|
3899
3933
|
this.goalHostUnbind = void 0;
|
|
3900
3934
|
this.lastGoalSnapshot = void 0;
|
|
3901
3935
|
this.lastGoalPublicationKey = void 0;
|
|
3936
|
+
this.suppressedRecoveredGoalId = void 0;
|
|
3902
3937
|
this.#bindGoalRuntime();
|
|
3903
3938
|
}
|
|
3904
3939
|
/**
|
|
@@ -3936,50 +3971,36 @@ var Session = class {
|
|
|
3936
3971
|
if (!cause) return;
|
|
3937
3972
|
await this.#queueGoalState(runtime.getSnapshot(), cause);
|
|
3938
3973
|
}
|
|
3939
|
-
/**
|
|
3940
|
-
* Render the recovered-Goal cards instead of streaming them.
|
|
3941
|
-
*
|
|
3942
|
-
* The bulk load-replay path (`historyReplay: 'response'`) does not stream
|
|
3943
|
-
* its replay: `loadSession` collects the page into the `LOAD_REPLAY`
|
|
3944
|
-
* envelope and the bridge seeds those updates onto the session's event bus
|
|
3945
|
-
* *after* the ACP `session/load` call returns. A card streamed from inside
|
|
3946
|
-
* that call therefore lands on the bus **before** the replayed
|
|
3947
|
-
* pre-migration `set` card — the reverse of the ordering
|
|
3948
|
-
* {@link publishRecoveredGoalState} exists to produce, leaving the phantom
|
|
3949
|
-
* running goal exactly as it was. Returning the cards lets the caller
|
|
3950
|
-
* append them to the envelope, after the replay page.
|
|
3951
|
-
*
|
|
3952
|
-
* Appending after a truncated page (`hasMore`) is still correct: paging
|
|
3953
|
-
* drops the oldest records, so the authoritative state belongs last either
|
|
3954
|
-
* way.
|
|
3955
|
-
*
|
|
3956
|
-
* Marks the publication as delivered, so the runtime subscription cannot
|
|
3957
|
-
* emit a duplicate card for the same `(cause, snapshot)` once the session
|
|
3958
|
-
* goes live.
|
|
3959
|
-
*/
|
|
3960
3974
|
async renderRecoveredGoalUpdates(replayedRecords) {
|
|
3961
3975
|
if (this.disposed || this.closing) return [];
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3976
|
+
const rendered = await renderPreparedGoalUpdate(
|
|
3977
|
+
() => this.config.getGoalRuntimeReady(),
|
|
3978
|
+
{
|
|
3979
|
+
...replayedRecords ? { replayedRecords } : {},
|
|
3980
|
+
previousGoal: this.lastGoalSnapshot?.goal ?? null
|
|
3981
|
+
}
|
|
3982
|
+
);
|
|
3983
|
+
if (rendered.publicationKey && rendered.publicationKey === this.lastGoalPublicationKey) {
|
|
3984
|
+
return [];
|
|
3969
3985
|
}
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
if (publicationKey
|
|
3975
|
-
this.
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3986
|
+
this.primeRecoveredGoalPublication(rendered.publicationKey);
|
|
3987
|
+
return rendered.updates;
|
|
3988
|
+
}
|
|
3989
|
+
primeRecoveredGoalPublication(publicationKey, suppressedGoalId) {
|
|
3990
|
+
if (publicationKey) this.lastGoalPublicationKey = publicationKey;
|
|
3991
|
+
this.suppressedRecoveredGoalId = suppressedGoalId;
|
|
3992
|
+
}
|
|
3993
|
+
#suppressRecoveredGoalUpdate(snapshot) {
|
|
3994
|
+
const suppressedGoalId = this.suppressedRecoveredGoalId;
|
|
3995
|
+
if (!suppressedGoalId) return false;
|
|
3996
|
+
const goal = snapshot.goal;
|
|
3997
|
+
if (goal?.goalId === suppressedGoalId) return true;
|
|
3998
|
+
if (goal === null) {
|
|
3999
|
+
this.suppressedRecoveredGoalId = void 0;
|
|
4000
|
+
return true;
|
|
4001
|
+
}
|
|
4002
|
+
this.suppressedRecoveredGoalId = void 0;
|
|
4003
|
+
return false;
|
|
3983
4004
|
}
|
|
3984
4005
|
/**
|
|
3985
4006
|
* Emit a trailing `cleared` card for an active legacy goal the runtime
|
|
@@ -4012,11 +4033,9 @@ var Session = class {
|
|
|
4012
4033
|
lastReason: "Goal not restored: its saved state could not be read, so this session is not driving it."
|
|
4013
4034
|
};
|
|
4014
4035
|
}
|
|
4015
|
-
#goalPublicationKey(snapshot, cause) {
|
|
4016
|
-
return cause ? `${cause}:${JSON.stringify(snapshot)}` : void 0;
|
|
4017
|
-
}
|
|
4018
4036
|
async #publishGoalState(snapshot, cause, previousGoal = this.lastGoalSnapshot?.goal ?? null) {
|
|
4019
|
-
|
|
4037
|
+
if (this.#suppressRecoveredGoalUpdate(snapshot)) return;
|
|
4038
|
+
const publicationKey = goalPublicationKey(snapshot, cause);
|
|
4020
4039
|
if (publicationKey && publicationKey === this.lastGoalPublicationKey) {
|
|
4021
4040
|
return;
|
|
4022
4041
|
}
|
|
@@ -4785,6 +4804,10 @@ var Session = class {
|
|
|
4785
4804
|
for (const taskId of notificationIds) {
|
|
4786
4805
|
holds.push({ category: "notification", id: taskId });
|
|
4787
4806
|
}
|
|
4807
|
+
const shellActive = this.config.getBackgroundShellRegistry().hasRunningEntries() || this.notificationQueue.some((item) => item.kind === "shell") || this.currentShellNotificationActive;
|
|
4808
|
+
if (shellActive) {
|
|
4809
|
+
holds.push({ category: "shell", id: "background-shells" });
|
|
4810
|
+
}
|
|
4788
4811
|
return holds;
|
|
4789
4812
|
}
|
|
4790
4813
|
#activeWorkChanged() {
|
|
@@ -4912,7 +4935,12 @@ var Session = class {
|
|
|
4912
4935
|
this.#statusChangeCallback = void 0;
|
|
4913
4936
|
}
|
|
4914
4937
|
this.config.getMonitorRegistry().setNotificationCallback(void 0);
|
|
4915
|
-
this.config.getBackgroundShellRegistry()
|
|
4938
|
+
const shellRegistry = this.config.getBackgroundShellRegistry();
|
|
4939
|
+
shellRegistry.setNotificationCallback(void 0);
|
|
4940
|
+
if (this.#shellStatusChangeCallback) {
|
|
4941
|
+
shellRegistry.clearStatusChangeCallback(this.#shellStatusChangeCallback);
|
|
4942
|
+
this.#shellStatusChangeCallback = void 0;
|
|
4943
|
+
}
|
|
4916
4944
|
this.config.getChatRecordingService()?.setTitleRecordedCallback(void 0);
|
|
4917
4945
|
this.unsubscribeChatRecordingFailure?.();
|
|
4918
4946
|
this.unsubscribeChatRecordingFailure = void 0;
|
|
@@ -4940,22 +4968,25 @@ var Session = class {
|
|
|
4940
4968
|
* Delegates to HistoryReplayer for consistent event emission.
|
|
4941
4969
|
*/
|
|
4942
4970
|
primeTurnFromHistory(records) {
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
if (typeof backgroundTask?.taskId === "string") {
|
|
4947
|
-
this.persistedBackgroundNotificationTaskIds.add(backgroundTask.taskId);
|
|
4948
|
-
}
|
|
4949
|
-
}
|
|
4950
|
-
this.turn = Math.max(
|
|
4951
|
-
this.turn,
|
|
4952
|
-
computeInitialTurnFromHistory(records, this.config.getSessionId())
|
|
4971
|
+
const turnState = collectSessionTurnState(
|
|
4972
|
+
records,
|
|
4973
|
+
this.config.getSessionId()
|
|
4953
4974
|
);
|
|
4975
|
+
this.primeTurnState(
|
|
4976
|
+
turnState.initialTurn,
|
|
4977
|
+
turnState.backgroundNotificationTaskIds
|
|
4978
|
+
);
|
|
4979
|
+
}
|
|
4980
|
+
primeTurnState(initialTurn, backgroundNotificationTaskIds) {
|
|
4981
|
+
for (const taskId of backgroundNotificationTaskIds) {
|
|
4982
|
+
this.persistedBackgroundNotificationTaskIds.add(taskId);
|
|
4983
|
+
}
|
|
4984
|
+
this.turn = Math.max(this.turn, initialTurn);
|
|
4954
4985
|
}
|
|
4955
|
-
async replayHistory(records, gaps) {
|
|
4986
|
+
async replayHistory(records, gaps, options) {
|
|
4956
4987
|
this.primeTurnFromHistory(records);
|
|
4957
4988
|
try {
|
|
4958
|
-
await this.historyReplayer.replay(records, gaps);
|
|
4989
|
+
await this.historyReplayer.replay(records, gaps, options);
|
|
4959
4990
|
} finally {
|
|
4960
4991
|
this.activeTodoPlanRevision = void 0;
|
|
4961
4992
|
}
|
|
@@ -5280,21 +5311,37 @@ var Session = class {
|
|
|
5280
5311
|
}
|
|
5281
5312
|
this.duplicateProviderToolCallResponseIds.clear();
|
|
5282
5313
|
const channelDelivery = parsePromptChannelDelivery(params);
|
|
5283
|
-
const
|
|
5314
|
+
const responseCapture = {
|
|
5315
|
+
...channelDelivery ? { channelDelivery: { finalText: "" } } : {},
|
|
5316
|
+
agentOutput: new AgentOutputMessageCapture(this.config)
|
|
5317
|
+
};
|
|
5318
|
+
const channelPromptTurn = params._meta?.[CHANNEL_PROMPT_META_KEY] === true;
|
|
5284
5319
|
let resolveCompletion;
|
|
5285
5320
|
this.pendingPromptCompletion = new Promise((resolve6) => {
|
|
5286
5321
|
resolveCompletion = resolve6;
|
|
5287
5322
|
});
|
|
5323
|
+
let rejectedByLoopProtection = false;
|
|
5288
5324
|
let promptResult;
|
|
5289
5325
|
let promptFailed = false;
|
|
5290
5326
|
try {
|
|
5291
5327
|
const result = await this.#executePrompt(
|
|
5292
5328
|
params,
|
|
5293
5329
|
pendingSend,
|
|
5294
|
-
|
|
5330
|
+
responseCapture,
|
|
5295
5331
|
invocationContext,
|
|
5296
5332
|
modelPrompt,
|
|
5297
|
-
|
|
5333
|
+
// Channel turns are non-interactive deliveries: like cron,
|
|
5334
|
+
// background-notification, and goal turns they keep the graceful
|
|
5335
|
+
// end-turn handling so the collected response text is still
|
|
5336
|
+
// delivered. Only the authenticated CHANNEL_PROMPT_META_KEY turns
|
|
5337
|
+
// sent by the channel bridges qualify; the delivery meta alone
|
|
5338
|
+
// schedules the delivery but keeps the foreground rejection. Goal
|
|
5339
|
+
// turns bypass the bridge entirely, so a rejection there would
|
|
5340
|
+
// settle the turn as failed and pause the goal without any
|
|
5341
|
+
// turn_error ever being published.
|
|
5342
|
+
!channelPromptTurn && goalTurn === void 0,
|
|
5343
|
+
goalTurn,
|
|
5344
|
+
channelPromptTurn
|
|
5298
5345
|
);
|
|
5299
5346
|
promptResult = result;
|
|
5300
5347
|
releasePendingSend();
|
|
@@ -5308,7 +5355,7 @@ var Session = class {
|
|
|
5308
5355
|
source: "prompt",
|
|
5309
5356
|
target: channelDelivery.target,
|
|
5310
5357
|
text: normalizeChannelDeliveryText(
|
|
5311
|
-
|
|
5358
|
+
responseCapture.channelDelivery?.finalText ?? ""
|
|
5312
5359
|
),
|
|
5313
5360
|
promptId: channelDelivery.deliveryId
|
|
5314
5361
|
});
|
|
@@ -5321,11 +5368,17 @@ var Session = class {
|
|
|
5321
5368
|
errorKind: error.errorKind
|
|
5322
5369
|
});
|
|
5323
5370
|
}
|
|
5371
|
+
rejectedByLoopProtection = isLoopDetectedTurnError(error);
|
|
5324
5372
|
throw error;
|
|
5325
5373
|
} finally {
|
|
5326
5374
|
const stillOwnsPendingPrompt = this.pendingPrompt === pendingSend;
|
|
5327
5375
|
releasePendingSend();
|
|
5328
|
-
const shouldDrainAutomaticQueues =
|
|
5376
|
+
const shouldDrainAutomaticQueues = (
|
|
5377
|
+
// Loop-detected turns resolved end_turn (and drained) before loop
|
|
5378
|
+
// stops became rejections; keep that invariant on the new path so
|
|
5379
|
+
// queued cron/notification work is not stranded.
|
|
5380
|
+
rejectedByLoopProtection || todoStopGuardPreparation.drainSupersededAutomaticQueues || this.todoStopGuardDrainAutomaticQueuesWhenIdle || this.todoStopGuard.blocksUnrelatedAutomaticTurns || this.todoStopGuard.hasCommittedContinuation || this.todoStopGuardQueuedPromptPriority
|
|
5381
|
+
);
|
|
5329
5382
|
if (stillOwnsPendingPrompt) {
|
|
5330
5383
|
this.todoStopGuardDrainAutomaticQueuesWhenIdle = false;
|
|
5331
5384
|
}
|
|
@@ -5463,7 +5516,7 @@ var Session = class {
|
|
|
5463
5516
|
}
|
|
5464
5517
|
})();
|
|
5465
5518
|
}
|
|
5466
|
-
async #executePrompt(params, pendingSend,
|
|
5519
|
+
async #executePrompt(params, pendingSend, responseCapture, invocationContext, modelPrompt, rejectOnLoopDetected = false, goalTurn, channelTurn = false) {
|
|
5467
5520
|
const sessionId = this.config.getSessionId();
|
|
5468
5521
|
if (invocationContext !== void 0 && invocationContext.sessionId !== sessionId) {
|
|
5469
5522
|
throw RequestError.invalidParams(
|
|
@@ -5478,15 +5531,17 @@ var Session = class {
|
|
|
5478
5531
|
() => this.#executePromptInner(
|
|
5479
5532
|
params,
|
|
5480
5533
|
pendingSend,
|
|
5481
|
-
|
|
5534
|
+
responseCapture,
|
|
5482
5535
|
modelPrompt,
|
|
5483
|
-
|
|
5536
|
+
rejectOnLoopDetected,
|
|
5537
|
+
goalTurn,
|
|
5538
|
+
channelTurn
|
|
5484
5539
|
)
|
|
5485
5540
|
)
|
|
5486
5541
|
), "execute");
|
|
5487
5542
|
return goalTurn ? goalTurnContext.run(goalTurn.permit, execute) : goalTurnContext.exit(execute);
|
|
5488
5543
|
}
|
|
5489
|
-
async #executePromptInner(params, pendingSend,
|
|
5544
|
+
async #executePromptInner(params, pendingSend, responseCapture, modelPrompt, rejectOnLoopDetected = false, goalTurn, channelTurn = false) {
|
|
5490
5545
|
return Storage.runWithRuntimeBaseDir(
|
|
5491
5546
|
this.runtimeBaseDir,
|
|
5492
5547
|
this.config.getWorkingDir(),
|
|
@@ -5524,6 +5579,16 @@ var Session = class {
|
|
|
5524
5579
|
);
|
|
5525
5580
|
const isRetry = params.retry === true || params._meta?.[DAEMON_RETRY_META_KEY] === true;
|
|
5526
5581
|
const isContinue = params._meta?.[DAEMON_CONTINUE_META_KEY] === true;
|
|
5582
|
+
if (!isRetry && !isContinue && goalTurn?.origin !== "runtime") {
|
|
5583
|
+
const interactionSpan = getActiveInteractionSpan();
|
|
5584
|
+
if (interactionSpan) {
|
|
5585
|
+
addAgentInputMessageAttributes(
|
|
5586
|
+
this.config,
|
|
5587
|
+
interactionSpan,
|
|
5588
|
+
promptDisplayText ?? promptText
|
|
5589
|
+
);
|
|
5590
|
+
}
|
|
5591
|
+
}
|
|
5527
5592
|
let continuationParts = null;
|
|
5528
5593
|
let strippedOrphanEntries = null;
|
|
5529
5594
|
let orphanPushCountSnapshot = 0;
|
|
@@ -5722,7 +5787,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5722
5787
|
let nextMessage = { role: "user", parts };
|
|
5723
5788
|
let turnCount = 0;
|
|
5724
5789
|
const toolLoopState = createDaemonToolLoopState(
|
|
5725
|
-
|
|
5790
|
+
channelTurn ? "off" : this.repeatedToolFailureGuardMode
|
|
5726
5791
|
);
|
|
5727
5792
|
try {
|
|
5728
5793
|
while (nextMessage !== null) {
|
|
@@ -5742,6 +5807,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5742
5807
|
pendingSend.signal
|
|
5743
5808
|
);
|
|
5744
5809
|
let channelDeliveryResponseBlock;
|
|
5810
|
+
let channelDeliveryCheckpoint = 0;
|
|
5745
5811
|
try {
|
|
5746
5812
|
if (goalTurn) goalTurn.modelStarted = true;
|
|
5747
5813
|
const sendResult = await this.#sendMessageStreamWithAutoCompression(
|
|
@@ -5760,8 +5826,8 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5760
5826
|
}
|
|
5761
5827
|
const responseStream = sendResult.responseStream;
|
|
5762
5828
|
nextMessage = null;
|
|
5763
|
-
channelDeliveryResponseBlock = beginChannelDeliveryResponseBlock(
|
|
5764
|
-
|
|
5829
|
+
channelDeliveryResponseBlock = beginChannelDeliveryResponseBlock(responseCapture);
|
|
5830
|
+
channelDeliveryCheckpoint = channelDeliveryResponseBlock?.length ?? 0;
|
|
5765
5831
|
let streamFailed = false;
|
|
5766
5832
|
try {
|
|
5767
5833
|
for await (const resp of responseStream) {
|
|
@@ -5781,10 +5847,14 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5781
5847
|
part.thought
|
|
5782
5848
|
);
|
|
5783
5849
|
if (!part.thought) {
|
|
5850
|
+
responseCapture.agentOutput.appendText(part.text);
|
|
5784
5851
|
channelDeliveryResponseBlock?.push(part.text);
|
|
5785
5852
|
messageDisplay?.addChunk(part.text);
|
|
5786
5853
|
}
|
|
5787
5854
|
}
|
|
5855
|
+
responseCapture.agentOutput.observeFinishReason(
|
|
5856
|
+
candidate.finishReason
|
|
5857
|
+
);
|
|
5788
5858
|
}
|
|
5789
5859
|
if (resp.type === "chunk" /* CHUNK */ && resp.value.usageMetadata) {
|
|
5790
5860
|
usageMetadata = resp.value.usageMetadata;
|
|
@@ -5797,6 +5867,9 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5797
5867
|
}
|
|
5798
5868
|
}
|
|
5799
5869
|
if (resp.type === "retry" /* RETRY */ || resp.type === "model_fallback" /* MODEL_FALLBACK */) {
|
|
5870
|
+
responseCapture.agentOutput.restartAttempt(
|
|
5871
|
+
resp.type === "retry" /* RETRY */ && resp.isContinuation === true
|
|
5872
|
+
);
|
|
5800
5873
|
if (resp.type === "model_fallback" /* MODEL_FALLBACK */ || !resp.isContinuation) {
|
|
5801
5874
|
if (channelDeliveryResponseBlock) {
|
|
5802
5875
|
channelDeliveryResponseBlock.length = channelDeliveryCheckpoint;
|
|
@@ -5857,7 +5930,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5857
5930
|
await messageDisplay?.finish();
|
|
5858
5931
|
}
|
|
5859
5932
|
commitChannelDeliveryResponseBlock(
|
|
5860
|
-
|
|
5933
|
+
responseCapture,
|
|
5861
5934
|
channelDeliveryResponseBlock,
|
|
5862
5935
|
functionCalls.length > 0
|
|
5863
5936
|
);
|
|
@@ -5901,14 +5974,16 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5901
5974
|
pendingSend.signal,
|
|
5902
5975
|
promptId,
|
|
5903
5976
|
toolLoopState,
|
|
5904
|
-
onFullTurnModel
|
|
5977
|
+
onFullTurnModel,
|
|
5978
|
+
rejectOnLoopDetected
|
|
5905
5979
|
);
|
|
5906
5980
|
nextMessage = nextAfterTools.message;
|
|
5907
5981
|
if (nextAfterTools.stoppedByRepeatedToolFailure) {
|
|
5908
5982
|
return {
|
|
5909
|
-
stopReason:
|
|
5910
|
-
pendingSend.signal
|
|
5911
|
-
|
|
5983
|
+
stopReason: rejectOnLoopDetected ? cancelledOrThrowLoopDetected(
|
|
5984
|
+
pendingSend.signal,
|
|
5985
|
+
toolLoopState
|
|
5986
|
+
) : getAbortAwareEndTurnStopReason(pendingSend.signal)
|
|
5912
5987
|
};
|
|
5913
5988
|
}
|
|
5914
5989
|
if (toolRun.loopDetected) {
|
|
@@ -5918,9 +5993,10 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5918
5993
|
pendingSend.signal
|
|
5919
5994
|
);
|
|
5920
5995
|
return {
|
|
5921
|
-
stopReason:
|
|
5922
|
-
pendingSend.signal
|
|
5923
|
-
|
|
5996
|
+
stopReason: rejectOnLoopDetected ? cancelledOrThrowLoopDetected(
|
|
5997
|
+
pendingSend.signal,
|
|
5998
|
+
toolLoopState
|
|
5999
|
+
) : getAbortAwareEndTurnStopReason(pendingSend.signal)
|
|
5924
6000
|
};
|
|
5925
6001
|
}
|
|
5926
6002
|
}
|
|
@@ -5928,15 +6004,22 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5928
6004
|
if (this.messageRewriter) {
|
|
5929
6005
|
await this.messageRewriter.waitForPendingRewrites();
|
|
5930
6006
|
}
|
|
5931
|
-
|
|
6007
|
+
const result = await this.#handleStopHookLoop(
|
|
5932
6008
|
pendingSend,
|
|
5933
6009
|
promptId,
|
|
5934
6010
|
hooksEnabled,
|
|
5935
6011
|
messageBus,
|
|
5936
6012
|
true,
|
|
5937
6013
|
fullTurnModelOverride,
|
|
5938
|
-
|
|
6014
|
+
responseCapture,
|
|
6015
|
+
rejectOnLoopDetected
|
|
5939
6016
|
);
|
|
6017
|
+
if (result.stopReason !== "cancelled") {
|
|
6018
|
+
responseCapture.agentOutput.writeToSpan(
|
|
6019
|
+
getActiveInteractionSpan()
|
|
6020
|
+
);
|
|
6021
|
+
}
|
|
6022
|
+
return result;
|
|
5940
6023
|
} finally {
|
|
5941
6024
|
logConversationFinishedEvent(
|
|
5942
6025
|
this.config,
|
|
@@ -5957,7 +6040,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5957
6040
|
}
|
|
5958
6041
|
);
|
|
5959
6042
|
}
|
|
5960
|
-
async #handleStopHookLoop(pendingSend, promptId, hooksEnabled, messageBus, allowExternalHooks = true, modelOverride,
|
|
6043
|
+
async #handleStopHookLoop(pendingSend, promptId, hooksEnabled, messageBus, allowExternalHooks = true, modelOverride, responseCapture, rejectOnLoopDetected = false) {
|
|
5961
6044
|
const stopHookBlockingCap = this.config.getStopHookBlockingCap();
|
|
5962
6045
|
let stopHookIterationCount = 0;
|
|
5963
6046
|
let stopHookReasons = [];
|
|
@@ -6017,7 +6100,8 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
6017
6100
|
{
|
|
6018
6101
|
onFullTurnModel,
|
|
6019
6102
|
getModelOverride: /* @__PURE__ */ __name(() => modelOverride, "getModelOverride"),
|
|
6020
|
-
|
|
6103
|
+
responseCapture,
|
|
6104
|
+
rejectOnLoopDetected
|
|
6021
6105
|
}
|
|
6022
6106
|
);
|
|
6023
6107
|
if (continuation2.kind === "terminal") {
|
|
@@ -6101,7 +6185,8 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
6101
6185
|
{
|
|
6102
6186
|
onFullTurnModel,
|
|
6103
6187
|
getModelOverride: /* @__PURE__ */ __name(() => modelOverride, "getModelOverride"),
|
|
6104
|
-
|
|
6188
|
+
responseCapture,
|
|
6189
|
+
rejectOnLoopDetected
|
|
6105
6190
|
}
|
|
6106
6191
|
);
|
|
6107
6192
|
if (continuation2.kind === "terminal") {
|
|
@@ -6200,7 +6285,8 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
6200
6285
|
} : {},
|
|
6201
6286
|
onFullTurnModel,
|
|
6202
6287
|
getModelOverride: /* @__PURE__ */ __name(() => modelOverride, "getModelOverride"),
|
|
6203
|
-
|
|
6288
|
+
responseCapture,
|
|
6289
|
+
rejectOnLoopDetected
|
|
6204
6290
|
}
|
|
6205
6291
|
);
|
|
6206
6292
|
if (continuation.supersededAutomaticContinuation && externalReason) {
|
|
@@ -6267,6 +6353,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
6267
6353
|
pendingSend.signal
|
|
6268
6354
|
);
|
|
6269
6355
|
let channelDeliveryResponseBlock;
|
|
6356
|
+
let channelDeliveryCheckpoint = 0;
|
|
6270
6357
|
let providerSendChat;
|
|
6271
6358
|
let userContentPushCountBeforeSend = 0;
|
|
6272
6359
|
try {
|
|
@@ -6497,9 +6584,9 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
6497
6584
|
const responseStream = sendResult.responseStream;
|
|
6498
6585
|
nextMessage = null;
|
|
6499
6586
|
channelDeliveryResponseBlock = beginChannelDeliveryResponseBlock(
|
|
6500
|
-
options.
|
|
6587
|
+
options.responseCapture
|
|
6501
6588
|
);
|
|
6502
|
-
|
|
6589
|
+
channelDeliveryCheckpoint = channelDeliveryResponseBlock?.length ?? 0;
|
|
6503
6590
|
initialSend = false;
|
|
6504
6591
|
if (guardForThisSend) {
|
|
6505
6592
|
const guardCommitted = this.todoStopGuard.commitContinuation(
|
|
@@ -6531,10 +6618,14 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
6531
6618
|
part.thought
|
|
6532
6619
|
);
|
|
6533
6620
|
if (!part.thought) {
|
|
6621
|
+
options.responseCapture?.agentOutput.appendText(part.text);
|
|
6534
6622
|
channelDeliveryResponseBlock?.push(part.text);
|
|
6535
6623
|
messageDisplay?.addChunk(part.text);
|
|
6536
6624
|
}
|
|
6537
6625
|
}
|
|
6626
|
+
options.responseCapture?.agentOutput.observeFinishReason(
|
|
6627
|
+
candidate.finishReason
|
|
6628
|
+
);
|
|
6538
6629
|
}
|
|
6539
6630
|
if (response.type === "chunk" /* CHUNK */ && response.value.usageMetadata) {
|
|
6540
6631
|
usageMetadata = response.value.usageMetadata;
|
|
@@ -6547,6 +6638,9 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
6547
6638
|
}
|
|
6548
6639
|
}
|
|
6549
6640
|
if (response.type === "retry" /* RETRY */ || response.type === "model_fallback" /* MODEL_FALLBACK */) {
|
|
6641
|
+
options.responseCapture?.agentOutput.restartAttempt(
|
|
6642
|
+
response.type === "retry" /* RETRY */ && response.isContinuation === true
|
|
6643
|
+
);
|
|
6550
6644
|
if (response.type === "model_fallback" /* MODEL_FALLBACK */ || !response.isContinuation) {
|
|
6551
6645
|
if (channelDeliveryResponseBlock) {
|
|
6552
6646
|
channelDeliveryResponseBlock.length = channelDeliveryCheckpoint;
|
|
@@ -6609,7 +6703,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
6609
6703
|
}
|
|
6610
6704
|
}
|
|
6611
6705
|
commitChannelDeliveryResponseBlock(
|
|
6612
|
-
options.
|
|
6706
|
+
options.responseCapture,
|
|
6613
6707
|
channelDeliveryResponseBlock,
|
|
6614
6708
|
functionCalls.length > 0
|
|
6615
6709
|
);
|
|
@@ -6633,7 +6727,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
6633
6727
|
options.onFullTurnModel
|
|
6634
6728
|
)
|
|
6635
6729
|
);
|
|
6636
|
-
if (toolRun.stopAfterPermissionCancel ||
|
|
6730
|
+
if (toolRun.stopAfterPermissionCancel || pendingSend.signal.aborted) {
|
|
6637
6731
|
this.todoStopGuard.suspend();
|
|
6638
6732
|
await this.#preserveStoppedToolRun(toolRun, pendingSend.signal);
|
|
6639
6733
|
return {
|
|
@@ -6642,12 +6736,25 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
6642
6736
|
...supersededAutomaticContinuation ? { supersededAutomaticContinuation: true } : {}
|
|
6643
6737
|
};
|
|
6644
6738
|
}
|
|
6739
|
+
if (toolRun.loopDetected) {
|
|
6740
|
+
this.todoStopGuard.suspend();
|
|
6741
|
+
await this.#preserveStoppedToolRun(toolRun, pendingSend.signal);
|
|
6742
|
+
return {
|
|
6743
|
+
kind: "terminal",
|
|
6744
|
+
// Only the foreground chain rejects a loop-detected stop; cron
|
|
6745
|
+
// and background-notification turns keep the graceful end-turn
|
|
6746
|
+
// handling they had before loop stops became rejections.
|
|
6747
|
+
stopReason: options.rejectOnLoopDetected ? cancelledOrThrowLoopDetected(pendingSend.signal, toolLoopState) : getAbortAwareEndTurnStopReason(pendingSend.signal),
|
|
6748
|
+
...supersededAutomaticContinuation ? { supersededAutomaticContinuation: true } : {}
|
|
6749
|
+
};
|
|
6750
|
+
}
|
|
6645
6751
|
const nextAfterTools = await this.#buildNextMessageAfterToolRun(
|
|
6646
6752
|
toolRun,
|
|
6647
6753
|
pendingSend.signal,
|
|
6648
6754
|
toolPromptId,
|
|
6649
6755
|
toolLoopState,
|
|
6650
|
-
options.onFullTurnModel
|
|
6756
|
+
options.onFullTurnModel,
|
|
6757
|
+
options.rejectOnLoopDetected ?? false
|
|
6651
6758
|
);
|
|
6652
6759
|
nextMessage = nextAfterTools.message;
|
|
6653
6760
|
if (nextAfterTools.hadMidTurnUserInput) {
|
|
@@ -6952,7 +7059,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
6952
7059
|
);
|
|
6953
7060
|
await this.messageRewriter?.waitForPendingRewrites();
|
|
6954
7061
|
}
|
|
6955
|
-
async #buildNextMessageAfterToolRun(toolRun, abortSignal, promptId, toolLoopState, onFullTurnModel) {
|
|
7062
|
+
async #buildNextMessageAfterToolRun(toolRun, abortSignal, promptId, toolLoopState, onFullTurnModel, rejectOnLoopDetected = false) {
|
|
6956
7063
|
if (toolRun.loopDetected) {
|
|
6957
7064
|
debugLogger6.debug("Stopping ACP turn after daemon loop detection.");
|
|
6958
7065
|
return { message: null, hadMidTurnUserInput: false };
|
|
@@ -7042,14 +7149,16 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7042
7149
|
toolLoopState,
|
|
7043
7150
|
{ recordToQwenLogger: false }
|
|
7044
7151
|
);
|
|
7045
|
-
|
|
7046
|
-
|
|
7047
|
-
|
|
7048
|
-
|
|
7049
|
-
|
|
7050
|
-
|
|
7051
|
-
|
|
7052
|
-
|
|
7152
|
+
if (!rejectOnLoopDetected) {
|
|
7153
|
+
try {
|
|
7154
|
+
await this.messageEmitter.emitAgentMessage(
|
|
7155
|
+
REPEATED_TOOL_FAILURE_STOP_MESSAGE
|
|
7156
|
+
);
|
|
7157
|
+
} catch (error) {
|
|
7158
|
+
debugLogger6.warn(
|
|
7159
|
+
`Failed to emit repeated tool failure stop message: ${this.#formatError(error)}`
|
|
7160
|
+
);
|
|
7161
|
+
}
|
|
7053
7162
|
}
|
|
7054
7163
|
return {
|
|
7055
7164
|
message: null,
|
|
@@ -7486,7 +7595,10 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7486
7595
|
const promptId = this.config.getSessionId() + "########cron" + Date.now();
|
|
7487
7596
|
let cronHadError = false;
|
|
7488
7597
|
let cronCompleted = false;
|
|
7489
|
-
const
|
|
7598
|
+
const responseCapture = {
|
|
7599
|
+
...item.delivery ? { channelDelivery: { finalText: "" } } : {},
|
|
7600
|
+
agentOutput: new AgentOutputMessageCapture(this.config)
|
|
7601
|
+
};
|
|
7490
7602
|
await withInteractionSpan(
|
|
7491
7603
|
this.config,
|
|
7492
7604
|
{
|
|
@@ -7599,7 +7711,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7599
7711
|
return;
|
|
7600
7712
|
}
|
|
7601
7713
|
const responseStream = sendResult.responseStream;
|
|
7602
|
-
const channelDeliveryResponseBlock = beginChannelDeliveryResponseBlock(
|
|
7714
|
+
const channelDeliveryResponseBlock = beginChannelDeliveryResponseBlock(responseCapture);
|
|
7603
7715
|
const channelDeliveryCheckpoint = channelDeliveryResponseBlock?.length ?? 0;
|
|
7604
7716
|
if (loopTick && turnCount === 1) {
|
|
7605
7717
|
this.loopTickResolver?.markDelivered();
|
|
@@ -7625,10 +7737,14 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7625
7737
|
part.thought
|
|
7626
7738
|
);
|
|
7627
7739
|
if (!part.thought) {
|
|
7740
|
+
responseCapture.agentOutput.appendText(part.text);
|
|
7628
7741
|
channelDeliveryResponseBlock?.push(part.text);
|
|
7629
7742
|
messageDisplay?.addChunk(part.text);
|
|
7630
7743
|
}
|
|
7631
7744
|
}
|
|
7745
|
+
responseCapture.agentOutput.observeFinishReason(
|
|
7746
|
+
candidate.finishReason
|
|
7747
|
+
);
|
|
7632
7748
|
}
|
|
7633
7749
|
if (resp.type === "chunk" /* CHUNK */ && resp.value.usageMetadata) {
|
|
7634
7750
|
usageMetadata = resp.value.usageMetadata;
|
|
@@ -7641,6 +7757,9 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7641
7757
|
}
|
|
7642
7758
|
}
|
|
7643
7759
|
if (resp.type === "retry" /* RETRY */ || resp.type === "model_fallback" /* MODEL_FALLBACK */) {
|
|
7760
|
+
responseCapture.agentOutput.restartAttempt(
|
|
7761
|
+
resp.type === "retry" /* RETRY */ && resp.isContinuation === true
|
|
7762
|
+
);
|
|
7644
7763
|
if (resp.type === "model_fallback" /* MODEL_FALLBACK */ || !resp.isContinuation) {
|
|
7645
7764
|
if (channelDeliveryResponseBlock) {
|
|
7646
7765
|
channelDeliveryResponseBlock.length = channelDeliveryCheckpoint;
|
|
@@ -7669,7 +7788,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7669
7788
|
}
|
|
7670
7789
|
}
|
|
7671
7790
|
commitChannelDeliveryResponseBlock(
|
|
7672
|
-
|
|
7791
|
+
responseCapture,
|
|
7673
7792
|
channelDeliveryResponseBlock,
|
|
7674
7793
|
functionCalls.length > 0
|
|
7675
7794
|
);
|
|
@@ -7720,7 +7839,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7720
7839
|
void 0,
|
|
7721
7840
|
false,
|
|
7722
7841
|
void 0,
|
|
7723
|
-
|
|
7842
|
+
responseCapture
|
|
7724
7843
|
);
|
|
7725
7844
|
stopReason = guardStop.stopReason;
|
|
7726
7845
|
if (guardStop.stopReason === "max_tokens") {
|
|
@@ -7753,6 +7872,11 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7753
7872
|
)
|
|
7754
7873
|
);
|
|
7755
7874
|
}
|
|
7875
|
+
if (!ac.signal.aborted && !cronHadError) {
|
|
7876
|
+
responseCapture.agentOutput.writeToSpan(
|
|
7877
|
+
getActiveInteractionSpan()
|
|
7878
|
+
);
|
|
7879
|
+
}
|
|
7756
7880
|
},
|
|
7757
7881
|
() => ac.signal.aborted ? "cancelled" : cronHadError ? "error" : "ok"
|
|
7758
7882
|
);
|
|
@@ -7763,7 +7887,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7763
7887
|
source: "scheduled",
|
|
7764
7888
|
target: item.delivery.target,
|
|
7765
7889
|
text: normalizeChannelDeliveryText(
|
|
7766
|
-
|
|
7890
|
+
responseCapture.channelDelivery?.finalText ?? ""
|
|
7767
7891
|
),
|
|
7768
7892
|
taskId: item.taskId,
|
|
7769
7893
|
firedAt: item.firedAt
|
|
@@ -7835,6 +7959,10 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7835
7959
|
});
|
|
7836
7960
|
});
|
|
7837
7961
|
const shellRegistry = this.config.getBackgroundShellRegistry();
|
|
7962
|
+
this.#shellStatusChangeCallback = () => {
|
|
7963
|
+
this.#activeWorkChanged();
|
|
7964
|
+
};
|
|
7965
|
+
shellRegistry.setStatusChangeCallback(this.#shellStatusChangeCallback);
|
|
7838
7966
|
shellRegistry.setNotificationCallback((displayText, modelText, meta) => {
|
|
7839
7967
|
const entry = shellRegistry.get(meta.shellId);
|
|
7840
7968
|
this.#enqueueBackgroundNotification({
|
|
@@ -7993,6 +8121,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7993
8121
|
const [item] = this.notificationQueue.splice(nextIndex, 1);
|
|
7994
8122
|
if (!item) break;
|
|
7995
8123
|
this.currentAgentNotificationTaskId = item.kind === "agent" ? item.taskId : null;
|
|
8124
|
+
this.currentShellNotificationActive = item.kind === "shell";
|
|
7996
8125
|
this.#activeWorkChanged();
|
|
7997
8126
|
try {
|
|
7998
8127
|
await runWithInvocationContext(
|
|
@@ -8004,6 +8133,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
8004
8133
|
);
|
|
8005
8134
|
} finally {
|
|
8006
8135
|
this.currentAgentNotificationTaskId = null;
|
|
8136
|
+
this.currentShellNotificationActive = false;
|
|
8007
8137
|
this.#activeWorkChanged();
|
|
8008
8138
|
}
|
|
8009
8139
|
}
|
|
@@ -10019,6 +10149,13 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
10019
10149
|
toolName: policyToolName,
|
|
10020
10150
|
args: invocation.params,
|
|
10021
10151
|
signal: activeToolAbortSignal,
|
|
10152
|
+
// Same identity and execution scope `CoreToolScheduler`
|
|
10153
|
+
// supplies. This is the path daemon ACP sessions actually
|
|
10154
|
+
// take, so without them a host policy that falls back to the
|
|
10155
|
+
// session — or reasons about where the tool runs — sees
|
|
10156
|
+
// neither on every call made here.
|
|
10157
|
+
sessionId: this.config.getSessionId(),
|
|
10158
|
+
cwd: this.config.getTargetDir(),
|
|
10022
10159
|
...invocationContext ? { invocationContext } : {}
|
|
10023
10160
|
}
|
|
10024
10161
|
);
|
|
@@ -11025,10 +11162,11 @@ ${contextPart.text}`
|
|
|
11025
11162
|
init_esbuild_shims();
|
|
11026
11163
|
var debugLogger7 = createDebugLogger("ACTIVE_WORK");
|
|
11027
11164
|
var ActiveWorkReporter = class {
|
|
11028
|
-
constructor(send, listSources, intervalMs) {
|
|
11165
|
+
constructor(send, listSources, intervalMs, enabledCategories) {
|
|
11029
11166
|
this.send = send;
|
|
11030
11167
|
this.listSources = listSources;
|
|
11031
11168
|
this.intervalMs = intervalMs;
|
|
11169
|
+
this.#enabledCategories = new Set(enabledCategories);
|
|
11032
11170
|
this.#timer = setInterval(() => {
|
|
11033
11171
|
this.#publish();
|
|
11034
11172
|
}, intervalMs);
|
|
@@ -11043,6 +11181,7 @@ var ActiveWorkReporter = class {
|
|
|
11043
11181
|
#coalescing = false;
|
|
11044
11182
|
#timer;
|
|
11045
11183
|
#disposed = false;
|
|
11184
|
+
#enabledCategories;
|
|
11046
11185
|
/**
|
|
11047
11186
|
* Note that some Session's derived state may have changed. Coalesced to
|
|
11048
11187
|
* one snapshot per microtask so a burst of transitions (an agent finishing
|
|
@@ -11090,7 +11229,7 @@ var ActiveWorkReporter = class {
|
|
|
11090
11229
|
for (const source of this.listSources()) {
|
|
11091
11230
|
sessions.push({
|
|
11092
11231
|
sessionId: source.sessionId,
|
|
11093
|
-
holds: source.collectActiveWorkHolds()
|
|
11232
|
+
holds: source.collectActiveWorkHolds().filter((hold) => this.#enabledCategories.has(hold.category))
|
|
11094
11233
|
});
|
|
11095
11234
|
}
|
|
11096
11235
|
} catch (error) {
|
|
@@ -11498,6 +11637,162 @@ function shouldHideInheritedHistory(params) {
|
|
|
11498
11637
|
return meta?.[LOAD_REPLAY_HIDE_INHERITED_META_KEY] === true;
|
|
11499
11638
|
}
|
|
11500
11639
|
__name(shouldHideInheritedHistory, "shouldHideInheritedHistory");
|
|
11640
|
+
function loadRestoreOptions(params) {
|
|
11641
|
+
const hideInheritedHistory = shouldHideInheritedHistory(params);
|
|
11642
|
+
if (!isBulkLoadReplayRequest(params)) {
|
|
11643
|
+
return { replay: { kind: "all", hideInheritedHistory } };
|
|
11644
|
+
}
|
|
11645
|
+
const limit = getLoadReplayPageSize(params);
|
|
11646
|
+
return limit === void 0 ? { replay: { kind: "all", hideInheritedHistory } } : { replay: { kind: "recent", limit, hideInheritedHistory } };
|
|
11647
|
+
}
|
|
11648
|
+
__name(loadRestoreOptions, "loadRestoreOptions");
|
|
11649
|
+
var RESUME_RESTORE_OPTIONS = {
|
|
11650
|
+
replay: { kind: "none" }
|
|
11651
|
+
};
|
|
11652
|
+
function mapSessionRestoreRequestError(error, sessionId) {
|
|
11653
|
+
const mappedWriterError = mapSessionWriterRequestError(error);
|
|
11654
|
+
if (mappedWriterError !== error) return mappedWriterError;
|
|
11655
|
+
if (error instanceof SessionTranscriptSnapshotUnavailableError) {
|
|
11656
|
+
return new RequestError(-32010, error.message, {
|
|
11657
|
+
errorKind: "transcript_snapshot_unavailable",
|
|
11658
|
+
sessionId
|
|
11659
|
+
});
|
|
11660
|
+
}
|
|
11661
|
+
if (error instanceof SessionTranscriptTooLargeError) {
|
|
11662
|
+
return new RequestError(-32011, error.message, {
|
|
11663
|
+
errorKind: "transcript_too_large",
|
|
11664
|
+
sessionId,
|
|
11665
|
+
snapshotSize: error.snapshotSize,
|
|
11666
|
+
maxBytes: error.maxBytes
|
|
11667
|
+
});
|
|
11668
|
+
}
|
|
11669
|
+
if (error instanceof SessionTranscriptPageTooLargeError) {
|
|
11670
|
+
addDaemonRequestAttribute(
|
|
11671
|
+
"qwen-code.daemon.session_restore.envelope_limit_reason",
|
|
11672
|
+
"bytes"
|
|
11673
|
+
);
|
|
11674
|
+
return new RequestError(-32012, error.message, {
|
|
11675
|
+
errorKind: "transcript_page_too_large",
|
|
11676
|
+
sessionId,
|
|
11677
|
+
pageBytes: error.pageBytes,
|
|
11678
|
+
maxBytes: error.maxBytes
|
|
11679
|
+
});
|
|
11680
|
+
}
|
|
11681
|
+
if (error instanceof HistoryReplayLimitError) {
|
|
11682
|
+
addDaemonRequestAttribute(
|
|
11683
|
+
"qwen-code.daemon.session_restore.envelope_limit_reason",
|
|
11684
|
+
error.reason
|
|
11685
|
+
);
|
|
11686
|
+
return new RequestError(-32012, error.message, {
|
|
11687
|
+
errorKind: "transcript_page_too_large",
|
|
11688
|
+
sessionId,
|
|
11689
|
+
reason: error.reason,
|
|
11690
|
+
observed: error.observed,
|
|
11691
|
+
limit: error.limit
|
|
11692
|
+
});
|
|
11693
|
+
}
|
|
11694
|
+
return error;
|
|
11695
|
+
}
|
|
11696
|
+
__name(mapSessionRestoreRequestError, "mapSessionRestoreRequestError");
|
|
11697
|
+
function validateLoadReplayEnvelope(sessionId, envelope, enforceLimits) {
|
|
11698
|
+
if (!enforceLimits) return;
|
|
11699
|
+
if (envelope.updates.length > LOAD_REPLAY_MAX_UPDATES) {
|
|
11700
|
+
throw new HistoryReplayLimitError(
|
|
11701
|
+
sessionId,
|
|
11702
|
+
"updates",
|
|
11703
|
+
envelope.updates.length,
|
|
11704
|
+
LOAD_REPLAY_MAX_UPDATES
|
|
11705
|
+
);
|
|
11706
|
+
}
|
|
11707
|
+
const pageBytes = Buffer.byteLength(JSON.stringify(envelope), "utf8");
|
|
11708
|
+
if (pageBytes > LOAD_REPLAY_MAX_BYTES) {
|
|
11709
|
+
throw new HistoryReplayLimitError(
|
|
11710
|
+
sessionId,
|
|
11711
|
+
"bytes",
|
|
11712
|
+
pageBytes,
|
|
11713
|
+
LOAD_REPLAY_MAX_BYTES
|
|
11714
|
+
);
|
|
11715
|
+
}
|
|
11716
|
+
}
|
|
11717
|
+
__name(validateLoadReplayEnvelope, "validateLoadReplayEnvelope");
|
|
11718
|
+
function replayGoalBootstrap(projection) {
|
|
11719
|
+
if (projection && !("runtime" in projection)) {
|
|
11720
|
+
const sourceUuid2 = projection.goalRecoverySourceUuid;
|
|
11721
|
+
if (!sourceUuid2) return void 0;
|
|
11722
|
+
if (projection.replay?.records.some((record) => record.uuid === sourceUuid2)) {
|
|
11723
|
+
return void 0;
|
|
11724
|
+
}
|
|
11725
|
+
const replay = projection.replay?.replay;
|
|
11726
|
+
if (isObjectRecord(replay)) {
|
|
11727
|
+
const bootstrap = HistoryReplayer.v2GoalBootstrap(
|
|
11728
|
+
replay["goalState"],
|
|
11729
|
+
replay["goalCause"]
|
|
11730
|
+
);
|
|
11731
|
+
if (bootstrap) return bootstrap;
|
|
11732
|
+
}
|
|
11733
|
+
const sourceRecord2 = projection.goalRecords?.find(
|
|
11734
|
+
(record) => record.uuid === sourceUuid2
|
|
11735
|
+
);
|
|
11736
|
+
if (sourceRecord2?.subtype === "goal_state") {
|
|
11737
|
+
const payload = isObjectRecord(sourceRecord2.systemPayload) ? sourceRecord2.systemPayload : void 0;
|
|
11738
|
+
return HistoryReplayer.v2GoalBootstrap(
|
|
11739
|
+
payload?.["snapshot"],
|
|
11740
|
+
payload?.["cause"]
|
|
11741
|
+
);
|
|
11742
|
+
}
|
|
11743
|
+
const active2 = findGoalToRestore(
|
|
11744
|
+
collectGoalStatusItemsFromRecords(projection.goalRecords ?? [])
|
|
11745
|
+
);
|
|
11746
|
+
return active2 ? {
|
|
11747
|
+
goalStatus: {
|
|
11748
|
+
kind: active2.iterations > 0 ? "checking" : "set",
|
|
11749
|
+
condition: active2.condition,
|
|
11750
|
+
iterations: active2.iterations,
|
|
11751
|
+
...active2.setAt !== void 0 ? { setAt: active2.setAt } : {}
|
|
11752
|
+
}
|
|
11753
|
+
} : void 0;
|
|
11754
|
+
}
|
|
11755
|
+
const sourceUuid = projection?.replay?.goalRecoverySourceUuid;
|
|
11756
|
+
if (!projection?.replay || !sourceUuid) return void 0;
|
|
11757
|
+
if (projection.replay.records.some((record) => record.uuid === sourceUuid)) {
|
|
11758
|
+
return void 0;
|
|
11759
|
+
}
|
|
11760
|
+
const goalBootstrapRecords = projection.replay.goalBootstrapRecords ?? [];
|
|
11761
|
+
const sourceRecord = goalBootstrapRecords.find(
|
|
11762
|
+
(record) => record.uuid === sourceUuid
|
|
11763
|
+
);
|
|
11764
|
+
if (sourceRecord?.subtype === "goal_state") {
|
|
11765
|
+
const payload = isObjectRecord(sourceRecord.systemPayload) ? sourceRecord.systemPayload : void 0;
|
|
11766
|
+
return HistoryReplayer.v2GoalBootstrap(
|
|
11767
|
+
payload?.["snapshot"],
|
|
11768
|
+
payload?.["cause"]
|
|
11769
|
+
);
|
|
11770
|
+
}
|
|
11771
|
+
const active = findGoalToRestore(
|
|
11772
|
+
collectGoalStatusItemsFromRecords(goalBootstrapRecords)
|
|
11773
|
+
);
|
|
11774
|
+
if (!active) return void 0;
|
|
11775
|
+
return {
|
|
11776
|
+
goalStatus: {
|
|
11777
|
+
kind: active.iterations > 0 ? "checking" : "set",
|
|
11778
|
+
condition: active.condition,
|
|
11779
|
+
iterations: active.iterations,
|
|
11780
|
+
...active.setAt !== void 0 ? { setAt: active.setAt } : {}
|
|
11781
|
+
}
|
|
11782
|
+
};
|
|
11783
|
+
}
|
|
11784
|
+
__name(replayGoalBootstrap, "replayGoalBootstrap");
|
|
11785
|
+
function replayInitialGoalState(projection) {
|
|
11786
|
+
const replay = projection?.replay?.replay;
|
|
11787
|
+
if (!isObjectRecord(replay)) return {};
|
|
11788
|
+
const initialGoalState = parseGoalSnapshotV2(replay["goalState"]);
|
|
11789
|
+
const initialGoalCause = parseGoalStateCause(replay["goalCause"]);
|
|
11790
|
+
return {
|
|
11791
|
+
...initialGoalState ? { initialGoalState } : {},
|
|
11792
|
+
...initialGoalCause ? { initialGoalCause } : {}
|
|
11793
|
+
};
|
|
11794
|
+
}
|
|
11795
|
+
__name(replayInitialGoalState, "replayInitialGoalState");
|
|
11501
11796
|
function selectVisibleHistoryRecords(records, hideInheritedHistory) {
|
|
11502
11797
|
const sourceBoundary = records.findIndex(
|
|
11503
11798
|
(record) => record.type === "system" && record.subtype === "session_source" && isObjectRecord(record.systemPayload) && record.systemPayload["sourceType"] === "side_task"
|
|
@@ -11538,61 +11833,6 @@ function getLoadReplayPageSize(params) {
|
|
|
11538
11833
|
return value;
|
|
11539
11834
|
}
|
|
11540
11835
|
__name(getLoadReplayPageSize, "getLoadReplayPageSize");
|
|
11541
|
-
function isHistoryTurnStart(record) {
|
|
11542
|
-
return isReplayTurnStartType(record.type, record.subtype);
|
|
11543
|
-
}
|
|
11544
|
-
__name(isHistoryTurnStart, "isHistoryTurnStart");
|
|
11545
|
-
function isHistoryPageStart(record) {
|
|
11546
|
-
return record.subtype !== "realtime_message" && (record.type === "assistant" || isHistoryTurnStart(record));
|
|
11547
|
-
}
|
|
11548
|
-
__name(isHistoryPageStart, "isHistoryPageStart");
|
|
11549
|
-
function historyOrphansToolResult(records, start, end) {
|
|
11550
|
-
for (let i = start; i < end; i++) {
|
|
11551
|
-
if (records[i].type !== "tool_result") continue;
|
|
11552
|
-
for (let owner = i - 1; owner >= start; owner--) {
|
|
11553
|
-
if (isHistoryPageStart(records[owner])) return false;
|
|
11554
|
-
}
|
|
11555
|
-
return true;
|
|
11556
|
-
}
|
|
11557
|
-
return false;
|
|
11558
|
-
}
|
|
11559
|
-
__name(historyOrphansToolResult, "historyOrphansToolResult");
|
|
11560
|
-
function selectRecentHistoryRecords(records, pageSize) {
|
|
11561
|
-
if (pageSize === void 0 || records.length <= pageSize) {
|
|
11562
|
-
return { records, hasMore: false };
|
|
11563
|
-
}
|
|
11564
|
-
let start = records.length - pageSize;
|
|
11565
|
-
for (let i = start; i < records.length; i++) {
|
|
11566
|
-
if (isHistoryTurnStart(records[i])) {
|
|
11567
|
-
start = i;
|
|
11568
|
-
break;
|
|
11569
|
-
}
|
|
11570
|
-
}
|
|
11571
|
-
const expansionFloor = Math.max(0, records.length - 2 * pageSize);
|
|
11572
|
-
const aligned = findBoundaryAtOrBefore(
|
|
11573
|
-
records,
|
|
11574
|
-
start,
|
|
11575
|
-
expansionFloor,
|
|
11576
|
-
isHistoryTurnStart
|
|
11577
|
-
);
|
|
11578
|
-
if (isHistoryTurnStart(records[aligned])) {
|
|
11579
|
-
start = aligned;
|
|
11580
|
-
}
|
|
11581
|
-
if (start > 0 && historyOrphansToolResult(records, start, records.length)) {
|
|
11582
|
-
const pairFloor = Math.max(0, start - pageSize);
|
|
11583
|
-
const owner = findBoundaryAtOrBefore(
|
|
11584
|
-
records,
|
|
11585
|
-
start,
|
|
11586
|
-
pairFloor,
|
|
11587
|
-
isHistoryPageStart
|
|
11588
|
-
);
|
|
11589
|
-
if (isHistoryPageStart(records[owner])) {
|
|
11590
|
-
start = owner;
|
|
11591
|
-
}
|
|
11592
|
-
}
|
|
11593
|
-
return { records: records.slice(start), hasMore: start > 0 };
|
|
11594
|
-
}
|
|
11595
|
-
__name(selectRecentHistoryRecords, "selectRecentHistoryRecords");
|
|
11596
11836
|
function createHiddenWorkspaceMemoryConfig(config) {
|
|
11597
11837
|
return new Proxy(config, {
|
|
11598
11838
|
get(target, prop) {
|
|
@@ -12988,23 +13228,28 @@ async function deliverClientMcpMessage(connection, serverName, message, sessionI
|
|
|
12988
13228
|
return payload;
|
|
12989
13229
|
}
|
|
12990
13230
|
__name(deliverClientMcpMessage, "deliverClientMcpMessage");
|
|
12991
|
-
function createManagedExternalToolGuard(connection
|
|
13231
|
+
function createManagedExternalToolGuard(connection, options = {
|
|
13232
|
+
externalProviderAttached: false
|
|
13233
|
+
}) {
|
|
12992
13234
|
return async (context) => {
|
|
13235
|
+
if (!options.externalProviderAttached && !SHELL_EXECUTING_TOOL_NAMES.has(context.toolName)) {
|
|
13236
|
+
return { allowed: true };
|
|
13237
|
+
}
|
|
12993
13238
|
const invocation = context.invocationContext;
|
|
12994
|
-
if (!invocation) {
|
|
13239
|
+
if (!invocation && options.externalProviderAttached) {
|
|
12995
13240
|
throw new Error(
|
|
12996
13241
|
"Managed external tool guard requires a runtime invocation context."
|
|
12997
13242
|
);
|
|
12998
13243
|
}
|
|
13244
|
+
const sessionId = invocation?.sessionId ?? context.sessionId;
|
|
13245
|
+
if (typeof sessionId !== "string" || sessionId.length === 0) {
|
|
13246
|
+
throw new Error(
|
|
13247
|
+
"Managed external tool guard requires a session identity."
|
|
13248
|
+
);
|
|
13249
|
+
}
|
|
12999
13250
|
if (context.signal.aborted) {
|
|
13000
13251
|
throw new DOMException("Tool invocation aborted", "AbortError");
|
|
13001
13252
|
}
|
|
13002
|
-
if (context.toolName === ToolNames.AGENT || context.toolName === ToolNames.WORKFLOW || context.toolName === ToolNames.CREATE_SUB_SESSION || context.toolName === ToolNames.SEND_MESSAGE) {
|
|
13003
|
-
return {
|
|
13004
|
-
allowed: false,
|
|
13005
|
-
reason: "Managed external tool guard v1 does not support nested or delegated agent execution."
|
|
13006
|
-
};
|
|
13007
|
-
}
|
|
13008
13253
|
let rejectOnAbort;
|
|
13009
13254
|
const aborted = new Promise((_resolve, reject) => {
|
|
13010
13255
|
rejectOnAbort = reject;
|
|
@@ -13019,11 +13264,14 @@ function createManagedExternalToolGuard(connection) {
|
|
|
13019
13264
|
connection.extMethod(
|
|
13020
13265
|
SERVE_CONTROL_EXT_METHODS.externalToolGuardPrepare,
|
|
13021
13266
|
{
|
|
13022
|
-
sessionId
|
|
13023
|
-
promptId: invocation.promptId,
|
|
13267
|
+
sessionId,
|
|
13268
|
+
...invocation ? { promptId: invocation.promptId } : {},
|
|
13024
13269
|
toolCallId: context.callId,
|
|
13025
13270
|
toolName: context.toolName,
|
|
13026
|
-
arguments: context.args
|
|
13271
|
+
arguments: context.args,
|
|
13272
|
+
// A sub-agent pinned to a worktree executes here, not in the
|
|
13273
|
+
// session's own directory; the host validates this before use.
|
|
13274
|
+
...typeof context.cwd === "string" && context.cwd.length > 0 ? { invocationCwd: context.cwd } : {}
|
|
13027
13275
|
}
|
|
13028
13276
|
),
|
|
13029
13277
|
aborted
|
|
@@ -13150,8 +13398,10 @@ async function runAcpAgent(config, settings, argv, options) {
|
|
|
13150
13398
|
const privateParentCapability = options === void 0 ? process.env[PRIVATE_ACP_CAPABILITY_ENV] : options.privateParentCapability;
|
|
13151
13399
|
delete process.env[PRIVATE_ACP_CAPABILITY_ENV];
|
|
13152
13400
|
delete process.env[PRIVATE_EXTERNAL_TOOL_GUARD_ENV];
|
|
13401
|
+
delete process.env[PRIVATE_EXTERNAL_TOOL_GUARD_PROVIDER_ENV];
|
|
13153
13402
|
delete process.env[EXTERNAL_TOOL_GUARD_TOKEN_ENV];
|
|
13154
13403
|
const externalToolGuardRequired = options?.externalToolGuardRequired === true;
|
|
13404
|
+
const externalToolGuardProviderAttached = options?.externalToolGuardProviderAttached === true;
|
|
13155
13405
|
if (externalToolGuardRequired && privateParentCapability === void 0) {
|
|
13156
13406
|
throw new Error(
|
|
13157
13407
|
"Required external tool guard is available only to a private managed ACP parent."
|
|
@@ -13233,7 +13483,9 @@ async function runAcpAgent(config, settings, argv, options) {
|
|
|
13233
13483
|
});
|
|
13234
13484
|
connection = new AgentSideConnection((conn) => {
|
|
13235
13485
|
acpConnection = conn;
|
|
13236
|
-
const managedToolInvocationGuard = externalToolGuardRequired ? createManagedExternalToolGuard(conn
|
|
13486
|
+
const managedToolInvocationGuard = externalToolGuardRequired ? createManagedExternalToolGuard(conn, {
|
|
13487
|
+
externalProviderAttached: externalToolGuardProviderAttached
|
|
13488
|
+
}) : void 0;
|
|
13237
13489
|
agentInstance = new QwenAgent(
|
|
13238
13490
|
config,
|
|
13239
13491
|
settings,
|
|
@@ -13241,7 +13493,8 @@ async function runAcpAgent(config, settings, argv, options) {
|
|
|
13241
13493
|
conn,
|
|
13242
13494
|
privateParentCapability,
|
|
13243
13495
|
sessionWriterLeaseEnabledAtStartup,
|
|
13244
|
-
managedToolInvocationGuard
|
|
13496
|
+
managedToolInvocationGuard,
|
|
13497
|
+
externalToolGuardProviderAttached
|
|
13245
13498
|
);
|
|
13246
13499
|
return agentInstance;
|
|
13247
13500
|
}, stream);
|
|
@@ -13547,7 +13800,7 @@ function isOwnerOnlyDirectory(stats) {
|
|
|
13547
13800
|
}
|
|
13548
13801
|
__name(isOwnerOnlyDirectory, "isOwnerOnlyDirectory");
|
|
13549
13802
|
var QwenAgent = class {
|
|
13550
|
-
constructor(config, settings, argv, connection, expectedPrivateParentCapability, sessionWriterLeaseEnabledAtStartup = false, managedToolInvocationGuard) {
|
|
13803
|
+
constructor(config, settings, argv, connection, expectedPrivateParentCapability, sessionWriterLeaseEnabledAtStartup = false, managedToolInvocationGuard, externalToolGuardProviderAttached = false) {
|
|
13551
13804
|
this.config = config;
|
|
13552
13805
|
this.settings = settings;
|
|
13553
13806
|
this.argv = argv;
|
|
@@ -13555,6 +13808,7 @@ var QwenAgent = class {
|
|
|
13555
13808
|
this.expectedPrivateParentCapability = expectedPrivateParentCapability;
|
|
13556
13809
|
this.sessionWriterLeaseEnabledAtStartup = sessionWriterLeaseEnabledAtStartup;
|
|
13557
13810
|
this.managedToolInvocationGuard = managedToolInvocationGuard;
|
|
13811
|
+
this.externalToolGuardProviderAttached = externalToolGuardProviderAttached;
|
|
13558
13812
|
if (process.env["QWEN_SERVE_NO_MCP_POOL"] === "1") {
|
|
13559
13813
|
this.mcpPool = void 0;
|
|
13560
13814
|
this.workspaceMcpBudget = void 0;
|
|
@@ -13649,7 +13903,7 @@ var QwenAgent = class {
|
|
|
13649
13903
|
}
|
|
13650
13904
|
}
|
|
13651
13905
|
rejectUnsupportedGuardedHiddenAgent(operation) {
|
|
13652
|
-
if (this.managedToolInvocationGuard) {
|
|
13906
|
+
if (this.managedToolInvocationGuard && this.externalToolGuardProviderAttached) {
|
|
13653
13907
|
throw RequestError.invalidParams(
|
|
13654
13908
|
void 0,
|
|
13655
13909
|
`Managed external tool guard v1 does not support ${operation}.`
|
|
@@ -14062,7 +14316,7 @@ var QwenAgent = class {
|
|
|
14062
14316
|
);
|
|
14063
14317
|
}
|
|
14064
14318
|
}
|
|
14065
|
-
async withLiveSessionRestore(sessionId, session, operation) {
|
|
14319
|
+
async withLiveSessionRestore(sessionId, session, options, operation) {
|
|
14066
14320
|
await session.assertCanStartTurn();
|
|
14067
14321
|
const config = session.getConfig();
|
|
14068
14322
|
const releaseGate = session.beginClose();
|
|
@@ -14073,12 +14327,12 @@ var QwenAgent = class {
|
|
|
14073
14327
|
"restore"
|
|
14074
14328
|
);
|
|
14075
14329
|
const recorder = config.getChatRecordingService();
|
|
14076
|
-
const
|
|
14077
|
-
const
|
|
14078
|
-
if (!
|
|
14079
|
-
return await operation(config,
|
|
14330
|
+
const readProjection = /* @__PURE__ */ __name(() => config.getSessionService().readLiveRestoreProjection(sessionId, options), "readProjection");
|
|
14331
|
+
const projection = recorder ? await recorder.runWithWriteBarrier(readProjection) : await readProjection();
|
|
14332
|
+
if (!projection) throw new SessionWriterUnavailableError();
|
|
14333
|
+
return await operation(config, projection);
|
|
14080
14334
|
} catch (error) {
|
|
14081
|
-
throw
|
|
14335
|
+
throw mapSessionRestoreRequestError(error, sessionId);
|
|
14082
14336
|
} finally {
|
|
14083
14337
|
releaseGate();
|
|
14084
14338
|
}
|
|
@@ -14105,7 +14359,7 @@ var QwenAgent = class {
|
|
|
14105
14359
|
this.pendingConfigCleanup.delete(cleanupKey);
|
|
14106
14360
|
}
|
|
14107
14361
|
}
|
|
14108
|
-
async cleanupAfterRequestFailure(error, cleanup) {
|
|
14362
|
+
async cleanupAfterRequestFailure(error, cleanup, sessionId) {
|
|
14109
14363
|
try {
|
|
14110
14364
|
await cleanup();
|
|
14111
14365
|
} catch (cleanupError) {
|
|
@@ -14113,7 +14367,7 @@ var QwenAgent = class {
|
|
|
14113
14367
|
`Session cleanup failed while preserving the original request error: ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}`
|
|
14114
14368
|
);
|
|
14115
14369
|
}
|
|
14116
|
-
throw mapSessionWriterRequestError(error);
|
|
14370
|
+
throw sessionId ? mapSessionRestoreRequestError(error, sessionId) : mapSessionWriterRequestError(error);
|
|
14117
14371
|
}
|
|
14118
14372
|
pendingConfigCleanupKey(runtimeBaseDir, sessionId) {
|
|
14119
14373
|
return `${path4.resolve(runtimeBaseDir)}\0${sessionId}`;
|
|
@@ -14180,6 +14434,12 @@ var QwenAgent = class {
|
|
|
14180
14434
|
drainTimeoutMs,
|
|
14181
14435
|
"close"
|
|
14182
14436
|
);
|
|
14437
|
+
if (opts?.onlyIfUnheld) {
|
|
14438
|
+
const holds = session.collectActiveWorkHolds();
|
|
14439
|
+
if (holds.length > 0) {
|
|
14440
|
+
return { closed: false, holds };
|
|
14441
|
+
}
|
|
14442
|
+
}
|
|
14183
14443
|
recorder?.finalize();
|
|
14184
14444
|
let flushError;
|
|
14185
14445
|
try {
|
|
@@ -14313,7 +14573,7 @@ var QwenAgent = class {
|
|
|
14313
14573
|
}
|
|
14314
14574
|
this.clientCapabilities = args.clientCapabilities;
|
|
14315
14575
|
const authMethods = buildAuthMethods();
|
|
14316
|
-
const version = "0.21.12
|
|
14576
|
+
const version = "0.21.12";
|
|
14317
14577
|
const response = {
|
|
14318
14578
|
protocolVersion: PROTOCOL_VERSION,
|
|
14319
14579
|
agentInfo: {
|
|
@@ -14357,12 +14617,17 @@ var QwenAgent = class {
|
|
|
14357
14617
|
const activeWorkIntervalMs = activeWorkRequested ? clampActiveWorkIntervalMs(
|
|
14358
14618
|
requestedActiveWork["intervalMs"]
|
|
14359
14619
|
) : void 0;
|
|
14620
|
+
const requestedActiveWorkCategories = activeWorkRequested ? requestedActiveWork["categories"] : void 0;
|
|
14621
|
+
const activeWorkCategories = activeWorkRequested ? Array.isArray(requestedActiveWorkCategories) ? ACTIVE_WORK_HOLD_CATEGORIES.filter(
|
|
14622
|
+
(category) => requestedActiveWorkCategories.includes(category)
|
|
14623
|
+
) : ACTIVE_WORK_LEGACY_HOLD_CATEGORIES : void 0;
|
|
14360
14624
|
if (activeWorkIntervalMs !== void 0) {
|
|
14361
14625
|
this.activeWorkReporter?.dispose();
|
|
14362
14626
|
this.activeWorkReporter = new ActiveWorkReporter(
|
|
14363
14627
|
(method, params) => this.connection.extNotification(method, params),
|
|
14364
14628
|
() => this.sessions.values(),
|
|
14365
|
-
activeWorkIntervalMs
|
|
14629
|
+
activeWorkIntervalMs,
|
|
14630
|
+
activeWorkCategories ?? []
|
|
14366
14631
|
);
|
|
14367
14632
|
}
|
|
14368
14633
|
const responseMeta = {
|
|
@@ -14374,7 +14639,7 @@ var QwenAgent = class {
|
|
|
14374
14639
|
[ACTIVE_WORK_HEARTBEAT_META_KEY]: {
|
|
14375
14640
|
v: ACTIVE_WORK_HEARTBEAT_VERSION,
|
|
14376
14641
|
intervalMs: activeWorkIntervalMs,
|
|
14377
|
-
categories: [...
|
|
14642
|
+
categories: [...activeWorkCategories ?? []]
|
|
14378
14643
|
}
|
|
14379
14644
|
} : {}
|
|
14380
14645
|
};
|
|
@@ -14514,6 +14779,7 @@ var QwenAgent = class {
|
|
|
14514
14779
|
async loadSessionWithProfiler(params, initialSessionId, profiler) {
|
|
14515
14780
|
let sessionId = initialSessionId;
|
|
14516
14781
|
const sessionSource = getSessionSource(params);
|
|
14782
|
+
const restoreOptions = loadRestoreOptions(params);
|
|
14517
14783
|
const liveSession = this.sessions.get(sessionId);
|
|
14518
14784
|
if (liveSession) {
|
|
14519
14785
|
const settings = profiler.timeSync(
|
|
@@ -14526,35 +14792,43 @@ var QwenAgent = class {
|
|
|
14526
14792
|
return this.withLiveSessionRestore(
|
|
14527
14793
|
sessionId,
|
|
14528
14794
|
liveSession,
|
|
14529
|
-
|
|
14795
|
+
restoreOptions,
|
|
14796
|
+
async (config, projection) => {
|
|
14530
14797
|
const response = profiler.timeSync(
|
|
14531
14798
|
"response_build",
|
|
14532
14799
|
() => ({
|
|
14533
14800
|
modes: this.buildModesData(config),
|
|
14534
14801
|
models: this.buildAvailableModels(config),
|
|
14535
14802
|
configOptions: this.buildConfigOptions(config),
|
|
14536
|
-
...
|
|
14803
|
+
...projection?.artifactSnapshot ? { artifactSnapshot: projection.artifactSnapshot } : {}
|
|
14537
14804
|
})
|
|
14538
14805
|
);
|
|
14539
|
-
const
|
|
14540
|
-
|
|
14541
|
-
records,
|
|
14542
|
-
shouldHideInheritedHistory(params)
|
|
14543
|
-
);
|
|
14544
|
-
if (visibleRecords.length === 0) return response;
|
|
14806
|
+
const replayPage = projection?.replay;
|
|
14807
|
+
if (!replayPage || replayPage.records.length === 0) return response;
|
|
14545
14808
|
const bulkReplay = isBulkLoadReplayRequest(params);
|
|
14546
|
-
const
|
|
14547
|
-
|
|
14548
|
-
|
|
14549
|
-
|
|
14550
|
-
|
|
14551
|
-
|
|
14552
|
-
|
|
14553
|
-
|
|
14554
|
-
|
|
14555
|
-
|
|
14556
|
-
|
|
14557
|
-
|
|
14809
|
+
const replay = await profiler.time(
|
|
14810
|
+
"history_replay",
|
|
14811
|
+
() => collectHistoryReplayUpdates({
|
|
14812
|
+
sessionId,
|
|
14813
|
+
config,
|
|
14814
|
+
records: replayPage.records,
|
|
14815
|
+
gaps: replayPage.gaps,
|
|
14816
|
+
cumulativeUsage: createReplayCumulativeUsage(),
|
|
14817
|
+
replayState: replayPage.replay,
|
|
14818
|
+
goalBootstrap: replayGoalBootstrap(projection),
|
|
14819
|
+
...restoreOptions.replay.kind === "recent" ? {
|
|
14820
|
+
limits: {
|
|
14821
|
+
maxBytes: LOAD_REPLAY_MAX_BYTES,
|
|
14822
|
+
maxUpdates: LOAD_REPLAY_MAX_UPDATES
|
|
14823
|
+
}
|
|
14824
|
+
} : {},
|
|
14825
|
+
logger: debugLogger8
|
|
14826
|
+
})
|
|
14827
|
+
);
|
|
14828
|
+
addDaemonRequestAttribute(
|
|
14829
|
+
"qwen-code.daemon.session_restore.partial_replay",
|
|
14830
|
+
replay.replayError !== void 0
|
|
14831
|
+
);
|
|
14558
14832
|
if (!bulkReplay) {
|
|
14559
14833
|
try {
|
|
14560
14834
|
for (const update of replay.updates) {
|
|
@@ -14568,18 +14842,25 @@ var QwenAgent = class {
|
|
|
14568
14842
|
}
|
|
14569
14843
|
return response;
|
|
14570
14844
|
}
|
|
14845
|
+
const envelope = {
|
|
14846
|
+
v: LOAD_REPLAY_VERSION,
|
|
14847
|
+
updates: replay.updates,
|
|
14848
|
+
...replayPage.anchorRecordId ? { anchorRecordId: replayPage.anchorRecordId } : {},
|
|
14849
|
+
...replay.replayError !== void 0 ? {
|
|
14850
|
+
partial: true,
|
|
14851
|
+
replayError: replay.replayError
|
|
14852
|
+
} : {},
|
|
14853
|
+
...replayPage.hasMore ? { hasMore: true } : {}
|
|
14854
|
+
};
|
|
14855
|
+
validateLoadReplayEnvelope(
|
|
14856
|
+
sessionId,
|
|
14857
|
+
envelope,
|
|
14858
|
+
restoreOptions.replay.kind === "recent"
|
|
14859
|
+
);
|
|
14571
14860
|
return {
|
|
14572
14861
|
...response,
|
|
14573
14862
|
_meta: {
|
|
14574
|
-
[LOAD_REPLAY_META_KEY]:
|
|
14575
|
-
v: LOAD_REPLAY_VERSION,
|
|
14576
|
-
updates: replay.updates,
|
|
14577
|
-
...replay.replayError !== void 0 ? {
|
|
14578
|
-
partial: true,
|
|
14579
|
-
replayError: replay.replayError
|
|
14580
|
-
} : {},
|
|
14581
|
-
...replayPage.hasMore ? { hasMore: true } : {}
|
|
14582
|
-
}
|
|
14863
|
+
[LOAD_REPLAY_META_KEY]: envelope
|
|
14583
14864
|
}
|
|
14584
14865
|
};
|
|
14585
14866
|
}
|
|
@@ -14621,13 +14902,32 @@ var QwenAgent = class {
|
|
|
14621
14902
|
settings,
|
|
14622
14903
|
sessionSource,
|
|
14623
14904
|
sessionId,
|
|
14624
|
-
true
|
|
14905
|
+
true,
|
|
14906
|
+
{},
|
|
14907
|
+
void 0,
|
|
14908
|
+
restoreOptions
|
|
14625
14909
|
)
|
|
14626
14910
|
);
|
|
14627
|
-
const
|
|
14911
|
+
const projection = config.consumeSessionRestoreProjection?.();
|
|
14912
|
+
const suppressRecoveredGoalPresentation = projection?.runtime.goalRecoverySourceUuid !== void 0 && projection.runtime.goalRecoverySourceUuid !== projection.replay?.goalRecoverySourceUuid;
|
|
14628
14913
|
const bulkReplay = isBulkLoadReplayRequest(params);
|
|
14629
|
-
const replayPageSize = bulkReplay ? getLoadReplayPageSize(params) : void 0;
|
|
14630
14914
|
let replayEnvelope;
|
|
14915
|
+
const replayUsage = createReplayCumulativeUsage();
|
|
14916
|
+
let recoveredGoalPublicationKey;
|
|
14917
|
+
let suppressedRecoveredGoalId;
|
|
14918
|
+
let streamGoalUpdates = [];
|
|
14919
|
+
let response;
|
|
14920
|
+
const buildResponse = /* @__PURE__ */ __name(() => profiler.timeSync("response_build", () => ({
|
|
14921
|
+
modes: this.buildModesData(config),
|
|
14922
|
+
models: this.buildAvailableModels(config),
|
|
14923
|
+
configOptions: this.buildConfigOptions(config),
|
|
14924
|
+
...projection?.runtime.artifactSnapshot ? { artifactSnapshot: projection.runtime.artifactSnapshot } : {},
|
|
14925
|
+
...replayEnvelope ? {
|
|
14926
|
+
_meta: {
|
|
14927
|
+
[LOAD_REPLAY_META_KEY]: replayEnvelope
|
|
14928
|
+
}
|
|
14929
|
+
} : {}
|
|
14930
|
+
})), "buildResponse");
|
|
14631
14931
|
try {
|
|
14632
14932
|
await profiler.time("auth", () => this.ensureAuthenticated(config));
|
|
14633
14933
|
profiler.timeSync(
|
|
@@ -14636,98 +14936,165 @@ var QwenAgent = class {
|
|
|
14636
14936
|
);
|
|
14637
14937
|
await profiler.time(
|
|
14638
14938
|
"session_register",
|
|
14639
|
-
() => this.createAndStoreSession(config, settings,
|
|
14939
|
+
() => this.createAndStoreSession(config, settings, void 0, {
|
|
14640
14940
|
enableLiveScreenContext: isCompatibleLiveSessionSource(
|
|
14641
14941
|
sessionSource ?? {}
|
|
14642
14942
|
),
|
|
14643
|
-
|
|
14644
|
-
|
|
14645
|
-
if (bulkReplay) {
|
|
14646
|
-
const
|
|
14647
|
-
|
|
14648
|
-
|
|
14649
|
-
createdSession.primeTurnFromHistory(records);
|
|
14650
|
-
const visibleRecords = selectVisibleHistoryRecords(
|
|
14651
|
-
records,
|
|
14652
|
-
shouldHideInheritedHistory(params)
|
|
14653
|
-
);
|
|
14654
|
-
const replayPage = selectRecentHistoryRecords(
|
|
14655
|
-
visibleRecords,
|
|
14656
|
-
replayPageSize
|
|
14657
|
-
);
|
|
14658
|
-
const replayUsage = createReplayCumulativeUsage();
|
|
14659
|
-
const replay = await collectHistoryReplayUpdates({
|
|
14943
|
+
replayHistory: false,
|
|
14944
|
+
prepareBeforeSessionCreate: /* @__PURE__ */ __name(async () => {
|
|
14945
|
+
if (bulkReplay && projection?.replay) {
|
|
14946
|
+
const replay = await profiler.time(
|
|
14947
|
+
"history_replay",
|
|
14948
|
+
() => collectHistoryReplayUpdates({
|
|
14660
14949
|
sessionId,
|
|
14661
14950
|
config,
|
|
14662
|
-
records:
|
|
14663
|
-
gaps:
|
|
14951
|
+
records: projection.replay.records,
|
|
14952
|
+
gaps: projection.replay.gaps,
|
|
14664
14953
|
cumulativeUsage: replayUsage,
|
|
14954
|
+
replayState: projection.replay.replay,
|
|
14955
|
+
goalBootstrap: replayGoalBootstrap(projection),
|
|
14956
|
+
...restoreOptions.replay.kind === "recent" ? {
|
|
14957
|
+
limits: {
|
|
14958
|
+
maxBytes: LOAD_REPLAY_MAX_BYTES,
|
|
14959
|
+
maxUpdates: LOAD_REPLAY_MAX_UPDATES
|
|
14960
|
+
}
|
|
14961
|
+
} : {},
|
|
14665
14962
|
logger: debugLogger8
|
|
14666
|
-
})
|
|
14667
|
-
|
|
14668
|
-
|
|
14669
|
-
|
|
14670
|
-
|
|
14671
|
-
|
|
14672
|
-
|
|
14673
|
-
|
|
14674
|
-
|
|
14963
|
+
})
|
|
14964
|
+
);
|
|
14965
|
+
addDaemonRequestAttribute(
|
|
14966
|
+
"qwen-code.daemon.session_restore.partial_replay",
|
|
14967
|
+
replay.replayError !== void 0
|
|
14968
|
+
);
|
|
14969
|
+
replayEnvelope = {
|
|
14970
|
+
v: LOAD_REPLAY_VERSION,
|
|
14971
|
+
updates: replay.updates,
|
|
14972
|
+
...projection.replay.anchorRecordId ? { anchorRecordId: projection.replay.anchorRecordId } : {},
|
|
14973
|
+
...replay.replayError !== void 0 ? {
|
|
14974
|
+
partial: true,
|
|
14975
|
+
replayError: replay.replayError
|
|
14976
|
+
} : {},
|
|
14977
|
+
...projection.replay.hasMore ? { hasMore: true } : {}
|
|
14978
|
+
};
|
|
14979
|
+
validateLoadReplayEnvelope(
|
|
14980
|
+
sessionId,
|
|
14981
|
+
replayEnvelope,
|
|
14982
|
+
restoreOptions.replay.kind === "recent"
|
|
14983
|
+
);
|
|
14984
|
+
}
|
|
14985
|
+
const goalBootstrap = replayGoalBootstrap(projection);
|
|
14986
|
+
const rendered = await renderPreparedGoalUpdate(
|
|
14987
|
+
() => config.getGoalRuntimePrepared(),
|
|
14988
|
+
{
|
|
14989
|
+
...projection?.replay?.records ? { replayedRecords: projection.replay.records } : {},
|
|
14990
|
+
...suppressRecoveredGoalPresentation ? { hideRuntimeGoal: true } : {},
|
|
14991
|
+
...goalBootstrap ? { bootstrap: goalBootstrap } : {}
|
|
14992
|
+
}
|
|
14993
|
+
).catch((error) => {
|
|
14994
|
+
if (suppressRecoveredGoalPresentation) throw error;
|
|
14995
|
+
debugLogger8.debug(
|
|
14996
|
+
`Failed to render recovered Goal state: ${error instanceof Error ? error.message : String(error)}`
|
|
14997
|
+
);
|
|
14998
|
+
return {
|
|
14999
|
+
publicationKey: void 0,
|
|
15000
|
+
suppressedGoalId: void 0,
|
|
15001
|
+
updates: []
|
|
15002
|
+
};
|
|
15003
|
+
});
|
|
15004
|
+
recoveredGoalPublicationKey = rendered.publicationKey;
|
|
15005
|
+
suppressedRecoveredGoalId = rendered.suppressedGoalId;
|
|
15006
|
+
if (!bulkReplay) {
|
|
15007
|
+
streamGoalUpdates = rendered.updates;
|
|
15008
|
+
return;
|
|
15009
|
+
}
|
|
15010
|
+
const goalUpdates = rendered.updates;
|
|
15011
|
+
if (goalUpdates.length > 0) {
|
|
15012
|
+
replayEnvelope ??= {
|
|
15013
|
+
v: LOAD_REPLAY_VERSION,
|
|
15014
|
+
updates: []
|
|
15015
|
+
};
|
|
15016
|
+
replayEnvelope.updates.push(...goalUpdates);
|
|
15017
|
+
validateLoadReplayEnvelope(
|
|
15018
|
+
sessionId,
|
|
15019
|
+
replayEnvelope,
|
|
15020
|
+
restoreOptions.replay.kind === "recent"
|
|
15021
|
+
);
|
|
15022
|
+
}
|
|
15023
|
+
}, "prepareBeforeSessionCreate"),
|
|
15024
|
+
beforeSessionCreate: /* @__PURE__ */ __name(() => {
|
|
15025
|
+
response = buildResponse();
|
|
15026
|
+
}, "beforeSessionCreate"),
|
|
15027
|
+
primeSession: /* @__PURE__ */ __name((createdSession) => {
|
|
15028
|
+
profiler.timeSync("runtime_initialize", () => {
|
|
15029
|
+
if (!projection) return;
|
|
15030
|
+
createdSession.primeTurnState(
|
|
15031
|
+
projection.runtime.initialTurn,
|
|
15032
|
+
projection.runtime.backgroundNotificationTaskIds
|
|
15033
|
+
);
|
|
15034
|
+
copyCumulativeUsage(
|
|
15035
|
+
createdSession.cumulativeUsage,
|
|
15036
|
+
replayUsage
|
|
15037
|
+
);
|
|
15038
|
+
createdSession.primeRecoveredGoalPublication(
|
|
15039
|
+
recoveredGoalPublicationKey,
|
|
15040
|
+
suppressedRecoveredGoalId
|
|
15041
|
+
);
|
|
15042
|
+
});
|
|
15043
|
+
}, "primeSession"),
|
|
15044
|
+
beforeStartPostReplayServices: /* @__PURE__ */ __name(async (createdSession) => {
|
|
15045
|
+
if (!bulkReplay && projection?.replay) {
|
|
15046
|
+
await profiler.time("history_replay", async () => {
|
|
15047
|
+
const goalBootstrap = replayGoalBootstrap(projection);
|
|
15048
|
+
const initialGoalState = replayInitialGoalState(projection);
|
|
15049
|
+
const hasGoalReplayState = goalBootstrap !== void 0 || initialGoalState.initialGoalState !== void 0 || initialGoalState.initialGoalCause !== void 0;
|
|
15050
|
+
if (hasGoalReplayState) {
|
|
15051
|
+
await createdSession.replayHistory(
|
|
15052
|
+
projection.replay.records,
|
|
15053
|
+
projection.replay.gaps,
|
|
15054
|
+
{
|
|
15055
|
+
...goalBootstrap ? { goalBootstrap } : {},
|
|
15056
|
+
...initialGoalState
|
|
15057
|
+
}
|
|
14675
15058
|
);
|
|
14676
|
-
}
|
|
14677
|
-
|
|
14678
|
-
|
|
15059
|
+
} else {
|
|
15060
|
+
await createdSession.replayHistory(
|
|
15061
|
+
projection.replay.records,
|
|
15062
|
+
projection.replay.gaps
|
|
14679
15063
|
);
|
|
14680
15064
|
}
|
|
14681
|
-
|
|
14682
|
-
|
|
14683
|
-
|
|
14684
|
-
|
|
14685
|
-
partial: true,
|
|
14686
|
-
replayError: replay.replayError,
|
|
14687
|
-
...replayPage.hasMore ? { hasMore: true } : {}
|
|
14688
|
-
};
|
|
15065
|
+
});
|
|
15066
|
+
try {
|
|
15067
|
+
for (const update of streamGoalUpdates) {
|
|
15068
|
+
await createdSession.sendUpdate(update);
|
|
14689
15069
|
}
|
|
14690
|
-
|
|
14691
|
-
|
|
14692
|
-
|
|
14693
|
-
|
|
14694
|
-
};
|
|
15070
|
+
} catch (error) {
|
|
15071
|
+
debugLogger8.debug(
|
|
15072
|
+
`Failed to publish recovered Goal state: ${error instanceof Error ? error.message : String(error)}`
|
|
15073
|
+
);
|
|
14695
15074
|
}
|
|
14696
|
-
replayEnvelope ??= {
|
|
14697
|
-
v: LOAD_REPLAY_VERSION,
|
|
14698
|
-
updates: replayUpdates
|
|
14699
|
-
};
|
|
14700
15075
|
}
|
|
14701
|
-
await
|
|
14702
|
-
|
|
14703
|
-
|
|
14704
|
-
|
|
14705
|
-
|
|
15076
|
+
await profiler.time("post_replay_services", async () => {
|
|
15077
|
+
await this.#restoreWorktreeOnResume(config, createdSession);
|
|
15078
|
+
await this.#restoreBackgroundAgentsOnResume(
|
|
15079
|
+
config,
|
|
15080
|
+
createdSession
|
|
15081
|
+
);
|
|
15082
|
+
});
|
|
14706
15083
|
}, "beforeStartPostReplayServices")
|
|
14707
15084
|
})
|
|
14708
15085
|
);
|
|
14709
15086
|
} catch (error) {
|
|
14710
|
-
return this.cleanupAfterRequestFailure(
|
|
14711
|
-
|
|
14712
|
-
|
|
14713
|
-
|
|
14714
|
-
|
|
15087
|
+
return this.cleanupAfterRequestFailure(
|
|
15088
|
+
error,
|
|
15089
|
+
async () => {
|
|
15090
|
+
if (this.sessions.get(config.getSessionId())?.getConfig() !== config) {
|
|
15091
|
+
await this.cleanupUnstoredConfig(config);
|
|
15092
|
+
}
|
|
15093
|
+
},
|
|
15094
|
+
sessionId
|
|
15095
|
+
);
|
|
14715
15096
|
}
|
|
14716
|
-
return
|
|
14717
|
-
const response = {
|
|
14718
|
-
modes: this.buildModesData(config),
|
|
14719
|
-
models: this.buildAvailableModels(config),
|
|
14720
|
-
configOptions: this.buildConfigOptions(config),
|
|
14721
|
-
...sessionData?.artifactSnapshot ? { artifactSnapshot: sessionData.artifactSnapshot } : {}
|
|
14722
|
-
};
|
|
14723
|
-
if (!replayEnvelope) return response;
|
|
14724
|
-
return {
|
|
14725
|
-
...response,
|
|
14726
|
-
_meta: {
|
|
14727
|
-
[LOAD_REPLAY_META_KEY]: replayEnvelope
|
|
14728
|
-
}
|
|
14729
|
-
};
|
|
14730
|
-
});
|
|
15097
|
+
return response;
|
|
14731
15098
|
} finally {
|
|
14732
15099
|
releaseStartingSessionId();
|
|
14733
15100
|
}
|
|
@@ -14765,13 +15132,14 @@ var QwenAgent = class {
|
|
|
14765
15132
|
return this.withLiveSessionRestore(
|
|
14766
15133
|
sessionId,
|
|
14767
15134
|
liveSession,
|
|
14768
|
-
|
|
15135
|
+
RESUME_RESTORE_OPTIONS,
|
|
15136
|
+
async (config, projection) => profiler.timeSync(
|
|
14769
15137
|
"response_build",
|
|
14770
15138
|
() => ({
|
|
14771
15139
|
modes: this.buildModesData(config),
|
|
14772
15140
|
models: this.buildAvailableModels(config),
|
|
14773
15141
|
configOptions: this.buildConfigOptions(config),
|
|
14774
|
-
...
|
|
15142
|
+
...projection?.artifactSnapshot ? { artifactSnapshot: projection.artifactSnapshot } : {}
|
|
14775
15143
|
})
|
|
14776
15144
|
)
|
|
14777
15145
|
);
|
|
@@ -14808,9 +15176,14 @@ var QwenAgent = class {
|
|
|
14808
15176
|
settings,
|
|
14809
15177
|
sessionSource,
|
|
14810
15178
|
sessionId,
|
|
14811
|
-
true
|
|
15179
|
+
true,
|
|
15180
|
+
{},
|
|
15181
|
+
void 0,
|
|
15182
|
+
RESUME_RESTORE_OPTIONS
|
|
14812
15183
|
)
|
|
14813
15184
|
);
|
|
15185
|
+
const projection = config.consumeSessionRestoreProjection?.();
|
|
15186
|
+
let response;
|
|
14814
15187
|
try {
|
|
14815
15188
|
await profiler.time("auth", () => this.ensureAuthenticated(config));
|
|
14816
15189
|
profiler.timeSync(
|
|
@@ -14819,51 +15192,51 @@ var QwenAgent = class {
|
|
|
14819
15192
|
);
|
|
14820
15193
|
await profiler.time(
|
|
14821
15194
|
"session_register",
|
|
14822
|
-
() => this.createAndStoreSession(
|
|
14823
|
-
|
|
14824
|
-
|
|
14825
|
-
|
|
14826
|
-
|
|
14827
|
-
|
|
14828
|
-
|
|
14829
|
-
|
|
14830
|
-
|
|
14831
|
-
|
|
14832
|
-
|
|
14833
|
-
|
|
14834
|
-
|
|
14835
|
-
|
|
14836
|
-
|
|
14837
|
-
|
|
14838
|
-
|
|
14839
|
-
|
|
14840
|
-
|
|
15195
|
+
() => this.createAndStoreSession(config, settings, void 0, {
|
|
15196
|
+
enableLiveScreenContext: isCompatibleLiveSessionSource(
|
|
15197
|
+
sessionSource ?? {}
|
|
15198
|
+
),
|
|
15199
|
+
replayHistory: false,
|
|
15200
|
+
beforeSessionCreate: /* @__PURE__ */ __name(() => {
|
|
15201
|
+
response = profiler.timeSync("response_build", () => ({
|
|
15202
|
+
modes: this.buildModesData(config),
|
|
15203
|
+
models: this.buildAvailableModels(config),
|
|
15204
|
+
configOptions: this.buildConfigOptions(config),
|
|
15205
|
+
...projection?.runtime.artifactSnapshot ? { artifactSnapshot: projection.runtime.artifactSnapshot } : {}
|
|
15206
|
+
}));
|
|
15207
|
+
}, "beforeSessionCreate"),
|
|
15208
|
+
primeSession: /* @__PURE__ */ __name((createdSession) => {
|
|
15209
|
+
profiler.timeSync("runtime_initialize", () => {
|
|
15210
|
+
if (!projection) return;
|
|
15211
|
+
createdSession.primeTurnState(
|
|
15212
|
+
projection.runtime.initialTurn,
|
|
15213
|
+
projection.runtime.backgroundNotificationTaskIds
|
|
15214
|
+
);
|
|
15215
|
+
});
|
|
15216
|
+
}, "primeSession"),
|
|
15217
|
+
beforeStartPostReplayServices: /* @__PURE__ */ __name(async (createdSession) => {
|
|
15218
|
+
await profiler.time("post_replay_services", async () => {
|
|
14841
15219
|
await this.#restoreWorktreeOnResume(config, createdSession);
|
|
14842
15220
|
await this.#restoreBackgroundAgentsOnResume(
|
|
14843
15221
|
config,
|
|
14844
15222
|
createdSession
|
|
14845
15223
|
);
|
|
14846
|
-
}
|
|
14847
|
-
}
|
|
14848
|
-
)
|
|
15224
|
+
});
|
|
15225
|
+
}, "beforeStartPostReplayServices")
|
|
15226
|
+
})
|
|
14849
15227
|
);
|
|
14850
15228
|
} catch (error) {
|
|
14851
|
-
return this.cleanupAfterRequestFailure(
|
|
14852
|
-
|
|
14853
|
-
|
|
14854
|
-
|
|
14855
|
-
|
|
15229
|
+
return this.cleanupAfterRequestFailure(
|
|
15230
|
+
error,
|
|
15231
|
+
async () => {
|
|
15232
|
+
if (this.sessions.get(config.getSessionId())?.getConfig() !== config) {
|
|
15233
|
+
await this.cleanupUnstoredConfig(config);
|
|
15234
|
+
}
|
|
15235
|
+
},
|
|
15236
|
+
sessionId
|
|
15237
|
+
);
|
|
14856
15238
|
}
|
|
14857
|
-
|
|
14858
|
-
return profiler.timeSync(
|
|
14859
|
-
"response_build",
|
|
14860
|
-
() => ({
|
|
14861
|
-
modes: this.buildModesData(config),
|
|
14862
|
-
models: this.buildAvailableModels(config),
|
|
14863
|
-
configOptions: this.buildConfigOptions(config),
|
|
14864
|
-
...sessionData?.artifactSnapshot ? { artifactSnapshot: sessionData.artifactSnapshot } : {}
|
|
14865
|
-
})
|
|
14866
|
-
);
|
|
15239
|
+
return response;
|
|
14867
15240
|
} finally {
|
|
14868
15241
|
releaseStartingSessionId();
|
|
14869
15242
|
}
|
|
@@ -15028,13 +15401,23 @@ var QwenAgent = class {
|
|
|
15028
15401
|
const suppliedContext = meta[INVOCATION_CONTEXT_META_KEY];
|
|
15029
15402
|
const suppliedModelPrompt = meta[DAEMON_MODEL_PROMPT_META_KEY];
|
|
15030
15403
|
const suppliedPromptDisplayText = meta[DAEMON_PROMPT_DISPLAY_TEXT_META_KEY];
|
|
15404
|
+
const suppliedChannelPrompt = meta[CHANNEL_PROMPT_META_KEY];
|
|
15405
|
+
const suppliedChannelDelivery = meta[DAEMON_CHANNEL_DELIVERY_META_KEY];
|
|
15031
15406
|
delete meta[INVOCATION_CONTEXT_META_KEY];
|
|
15032
15407
|
delete meta[DAEMON_MODEL_PROMPT_META_KEY];
|
|
15033
15408
|
delete meta[PRIVATE_PARENT_CAPABILITY_META_KEY];
|
|
15034
15409
|
delete meta[DAEMON_PROMPT_DISPLAY_TEXT_META_KEY];
|
|
15410
|
+
delete meta[CHANNEL_PROMPT_META_KEY];
|
|
15411
|
+
delete meta[DAEMON_CHANNEL_DELIVERY_META_KEY];
|
|
15035
15412
|
if (this.privateParentState === "trusted" && typeof suppliedPromptDisplayText === "string") {
|
|
15036
15413
|
meta[DAEMON_PROMPT_DISPLAY_TEXT_META_KEY] = suppliedPromptDisplayText;
|
|
15037
15414
|
}
|
|
15415
|
+
if (this.privateParentState === "trusted" && suppliedChannelPrompt === true) {
|
|
15416
|
+
meta[CHANNEL_PROMPT_META_KEY] = true;
|
|
15417
|
+
}
|
|
15418
|
+
if (this.privateParentState === "trusted" && suppliedChannelDelivery !== void 0) {
|
|
15419
|
+
meta[DAEMON_CHANNEL_DELIVERY_META_KEY] = suppliedChannelDelivery;
|
|
15420
|
+
}
|
|
15038
15421
|
if (Object.keys(meta).length > 0) {
|
|
15039
15422
|
sanitizedParams._meta = meta;
|
|
15040
15423
|
} else {
|
|
@@ -17391,7 +17774,7 @@ var QwenAgent = class {
|
|
|
17391
17774
|
);
|
|
17392
17775
|
case SERVE_CONTROL_EXT_METHODS.workspaceMemoryRememberAvailability:
|
|
17393
17776
|
return {
|
|
17394
|
-
available: !this.managedToolInvocationGuard && this.config.isManagedMemoryAvailable()
|
|
17777
|
+
available: !(this.managedToolInvocationGuard && this.externalToolGuardProviderAttached) && this.config.isManagedMemoryAvailable()
|
|
17395
17778
|
};
|
|
17396
17779
|
case SERVE_CONTROL_EXT_METHODS.workspaceMemoryRemember: {
|
|
17397
17780
|
this.rejectUnsupportedGuardedHiddenAgent(
|
|
@@ -18948,7 +19331,7 @@ var QwenAgent = class {
|
|
|
18948
19331
|
return { sessionId, answer: result.text || null };
|
|
18949
19332
|
}
|
|
18950
19333
|
case SERVE_CONTROL_EXT_METHODS.sessionForkAgent: {
|
|
18951
|
-
if (this.managedToolInvocationGuard) {
|
|
19334
|
+
if (this.managedToolInvocationGuard && this.externalToolGuardProviderAttached) {
|
|
18952
19335
|
throw RequestError.invalidParams(
|
|
18953
19336
|
void 0,
|
|
18954
19337
|
"Managed external tool guard v1 does not support /fork."
|
|
@@ -20195,7 +20578,7 @@ ${outputText}
|
|
|
20195
20578
|
throw error;
|
|
20196
20579
|
}
|
|
20197
20580
|
}
|
|
20198
|
-
async newSessionConfig(cwd, mcpServers, settings, sessionSource, sessionId, resume, initializeOptions = {}, chatRecording) {
|
|
20581
|
+
async newSessionConfig(cwd, mcpServers, settings, sessionSource, sessionId, resume, initializeOptions = {}, chatRecording, restoreOptions) {
|
|
20199
20582
|
try {
|
|
20200
20583
|
this.assertManagedSessionAdmission();
|
|
20201
20584
|
return await this.runWithPinnedRuntimeBaseDir(settings, cwd, async () => {
|
|
@@ -20211,7 +20594,8 @@ ${outputText}
|
|
|
20211
20594
|
sessionId,
|
|
20212
20595
|
resume,
|
|
20213
20596
|
initializeOptions,
|
|
20214
|
-
chatRecording
|
|
20597
|
+
chatRecording,
|
|
20598
|
+
restoreOptions
|
|
20215
20599
|
);
|
|
20216
20600
|
});
|
|
20217
20601
|
} catch (error) {
|
|
@@ -20227,10 +20611,10 @@ ${outputText}
|
|
|
20227
20611
|
errorKind: writerError.errorKind
|
|
20228
20612
|
});
|
|
20229
20613
|
}
|
|
20230
|
-
throw error;
|
|
20614
|
+
throw sessionId && restoreOptions ? mapSessionRestoreRequestError(error, sessionId) : error;
|
|
20231
20615
|
}
|
|
20232
20616
|
}
|
|
20233
|
-
async newSessionConfigInRuntimeContext(cwd, mcpServers, settings, sessionSource, sessionId, resume, initializeOptions = {}, chatRecording) {
|
|
20617
|
+
async newSessionConfigInRuntimeContext(cwd, mcpServers, settings, sessionSource, sessionId, resume, initializeOptions = {}, chatRecording, restoreOptions) {
|
|
20234
20618
|
const sessionMcpServers = {};
|
|
20235
20619
|
for (const server of mcpServers) {
|
|
20236
20620
|
const stdioServer = toStdioServer(server);
|
|
@@ -20328,7 +20712,19 @@ ${outputText}
|
|
|
20328
20712
|
// not process.exit(1) the shared ACP child and every session on its
|
|
20329
20713
|
// channel. newSessionConfig maps the throw to a RequestError.
|
|
20330
20714
|
true,
|
|
20331
|
-
this.managedToolInvocationGuard ? {
|
|
20715
|
+
this.managedToolInvocationGuard || restoreOptions ? {
|
|
20716
|
+
...this.managedToolInvocationGuard ? { toolInvocationGuard: this.managedToolInvocationGuard } : {},
|
|
20717
|
+
...restoreOptions && sessionId ? {
|
|
20718
|
+
sessionRestore: {
|
|
20719
|
+
projectionSource: /* @__PURE__ */ __name((restoreSessionId) => new SessionService(cwd, {
|
|
20720
|
+
runtimeBaseDir: Storage.getRuntimeBaseDir()
|
|
20721
|
+
}).readRestoreProjection(
|
|
20722
|
+
restoreSessionId,
|
|
20723
|
+
restoreOptions
|
|
20724
|
+
), "projectionSource")
|
|
20725
|
+
}
|
|
20726
|
+
} : {}
|
|
20727
|
+
} : void 0
|
|
20332
20728
|
);
|
|
20333
20729
|
if (sessionSource) {
|
|
20334
20730
|
config.setSessionSource(sessionSource.sourceType, sessionSource.sourceId);
|
|
@@ -20465,6 +20861,16 @@ ${outputText}
|
|
|
20465
20861
|
{ errorKind: "session_id_conflict", sessionId }
|
|
20466
20862
|
);
|
|
20467
20863
|
}
|
|
20864
|
+
await options.prepareBeforeSessionCreate?.();
|
|
20865
|
+
this.assertManagedSessionAdmission();
|
|
20866
|
+
if (this.sessions.has(sessionId)) {
|
|
20867
|
+
throw new RequestError(
|
|
20868
|
+
ACP_ERROR_CODES.INVALID_PARAMS,
|
|
20869
|
+
`Session ${sessionId} is already active.`,
|
|
20870
|
+
{ errorKind: "session_id_conflict", sessionId }
|
|
20871
|
+
);
|
|
20872
|
+
}
|
|
20873
|
+
options.beforeSessionCreate?.();
|
|
20468
20874
|
const session = new Session(
|
|
20469
20875
|
sessionId,
|
|
20470
20876
|
config,
|
|
@@ -20472,10 +20878,14 @@ ${outputText}
|
|
|
20472
20878
|
settings,
|
|
20473
20879
|
() => this.activeWorkReporter?.notifyChanged()
|
|
20474
20880
|
);
|
|
20475
|
-
|
|
20476
|
-
this.activeWorkReporter?.notifyChanged();
|
|
20477
|
-
this.initializingConfigs.delete(config);
|
|
20881
|
+
let published = false;
|
|
20478
20882
|
try {
|
|
20883
|
+
options.primeSession?.(session);
|
|
20884
|
+
config.hydrateSessionRestoreFileHistory?.();
|
|
20885
|
+
this.sessions.set(sessionId, session);
|
|
20886
|
+
published = true;
|
|
20887
|
+
this.activeWorkReporter?.notifyChanged();
|
|
20888
|
+
this.initializingConfigs.delete(config);
|
|
20479
20889
|
if (options.enableLiveScreenContext) {
|
|
20480
20890
|
await session.enableLiveScreenContext();
|
|
20481
20891
|
}
|
|
@@ -20502,12 +20912,23 @@ ${outputText}
|
|
|
20502
20912
|
}
|
|
20503
20913
|
await options.beforeStartPostReplayServices?.(session);
|
|
20504
20914
|
session.installRewriter();
|
|
20915
|
+
config.finalizeSessionRestore?.();
|
|
20505
20916
|
session.startCronScheduler();
|
|
20506
20917
|
setTimeout(() => {
|
|
20507
20918
|
void session.sendAvailableCommandsUpdate();
|
|
20508
20919
|
}, 0);
|
|
20509
20920
|
return session;
|
|
20510
20921
|
} catch (error) {
|
|
20922
|
+
if (!published) {
|
|
20923
|
+
try {
|
|
20924
|
+
session.dispose();
|
|
20925
|
+
} catch (disposeError) {
|
|
20926
|
+
debugLogger8.warn(
|
|
20927
|
+
`Failed to dispose unpublished session ${sessionId}: ${disposeError instanceof Error ? disposeError.message : String(disposeError)}`
|
|
20928
|
+
);
|
|
20929
|
+
}
|
|
20930
|
+
throw error;
|
|
20931
|
+
}
|
|
20511
20932
|
try {
|
|
20512
20933
|
await this.discardStoredSessionIfCurrent(sessionId, session, {
|
|
20513
20934
|
shutdownConfig: false
|