@qwen-code/qwen-code 0.21.10 → 0.21.11-nightly.20260814.45c2e73080
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/coordinate/SKILL.md +52 -0
- package/bundled/qc-helper/docs/configuration/model-providers.md +10 -8
- package/bundled/qc-helper/docs/configuration/settings.md +10 -0
- package/bundled/qc-helper/docs/extension/_meta.ts +1 -0
- package/bundled/qc-helper/docs/extension/agent-plugins.md +50 -0
- package/bundled/qc-helper/docs/extension/extension-releasing.md +3 -3
- package/bundled/qc-helper/docs/extension/introduction.md +17 -3
- package/bundled/qc-helper/docs/features/_meta.ts +1 -0
- package/bundled/qc-helper/docs/features/arena.md +4 -3
- package/bundled/qc-helper/docs/features/code-review.md +1 -1
- package/bundled/qc-helper/docs/features/commands.md +7 -6
- package/bundled/qc-helper/docs/features/dual-output.md +5 -0
- package/bundled/qc-helper/docs/features/headless.md +8 -0
- package/bundled/qc-helper/docs/features/multi-agent-coordination.md +30 -0
- package/bundled/qc-helper/docs/qwen-serve.md +40 -40
- package/bundled/review/SKILL.md +45 -23
- package/chunks/{MaxSizedBox-FKXYULMW.js → MaxSizedBox-P4Z76535.js} +45 -44
- package/chunks/{StandaloneSessionPicker-OQS3M7AY.js → StandaloneSessionPicker-TRWDBCJG.js} +65 -64
- package/chunks/{acp-startup-profiler-VNTFWYAC.js → acp-startup-profiler-TVI2OVUN.js} +2 -2
- package/chunks/{acpAgent-AGS6HLQQ.js → acpAgent-MSZHQSZ7.js} +1645 -579
- package/chunks/{agent-4NCVO27U.js → agent-TMTEYQGK.js} +42 -41
- package/chunks/agent-headless-54WWND2M.js +87 -0
- package/chunks/{anthropicContentGenerator-D3Y4RFT4.js → anthropicContentGenerator-7ZK7U65G.js} +8 -8
- package/chunks/{artifact-tool-N652YE4L.js → artifact-tool-7HVSSXYZ.js} +2 -2
- package/chunks/{askUserQuestion-ONW74PKJ.js → askUserQuestion-IQCA2SOX.js} +2 -2
- package/chunks/{bridge-FHINXZMN.js → bridge-CI2NKV64.js} +49 -48
- package/chunks/{ca-ZLKAB4K3.js → ca-4CQ6MYNQ.js} +2 -1
- package/chunks/{channel-management-service-PHELKOW2.js → channel-management-service-LNEYNMDX.js} +6 -6
- package/chunks/channel-settings-store-QU4WFXHO.js +102 -0
- package/chunks/{channel-worker-group-WQP4RCDO.js → channel-worker-group-Q5WQVOMZ.js} +8 -7
- package/chunks/{channel-worker-manager-MRDFAKIM.js → channel-worker-manager-Z3JLH72P.js} +8 -7
- package/chunks/{channel-worker-supervisor-IVSDIMI4.js → channel-worker-supervisor-CG5HHT7K.js} +6 -5
- package/chunks/{chunk-A7XMDZRI.js → chunk-2AG524A4.js} +5 -5
- package/chunks/{chunk-GM463R2B.js → chunk-2ASWIM4A.js} +1 -1
- package/chunks/{chunk-DP3IHZGG.js → chunk-2AUM35J5.js} +59 -7
- package/chunks/{chunk-TZEZYNYD.js → chunk-2N6CV4PW.js} +1 -1
- package/chunks/{chunk-BSI645OU.js → chunk-3LHSUFPE.js} +3 -3
- package/chunks/{chunk-DCZEPFB4.js → chunk-3XLWKV4S.js} +3 -3
- package/chunks/{chunk-YWPSGJFI.js → chunk-4IBNVBGJ.js} +2 -2
- package/chunks/{chunk-ZRBMO3C7.js → chunk-4IWFPTAH.js} +1 -1
- package/chunks/{chunk-B2GJNDTV.js → chunk-4JS2QK7P.js} +1 -1
- package/chunks/{chunk-5MZCSWI4.js → chunk-4NV6L4GZ.js} +1184 -1450
- package/chunks/{chunk-Y3OVRWRY.js → chunk-4QC6SUVN.js} +1 -1
- package/chunks/{chunk-AOHJKPKL.js → chunk-5KZNWF2M.js} +1 -1
- package/chunks/{chunk-UMD7WQTR.js → chunk-5XNR53C7.js} +10 -8
- package/chunks/{chunk-IIJEYBNH.js → chunk-66PLFJQ7.js} +197 -60
- package/chunks/{chunk-SEZ556DZ.js → chunk-67F2BEYW.js} +1 -1
- package/chunks/{chunk-7GTMV7UE.js → chunk-6KXHEN6M.js} +8700 -2449
- package/chunks/{chunk-FVKHVJZQ.js → chunk-6OJDN5ZT.js} +1 -1
- package/chunks/{chunk-CKASRHZI.js → chunk-6SU6OW5Z.js} +1 -1
- package/chunks/{chunk-NEOXOWYH.js → chunk-6YUEAYJ5.js} +7 -7
- package/chunks/{chunk-QGNOFE5E.js → chunk-766PXUQ3.js} +1 -1
- package/chunks/{chunk-UVX4Y6IN.js → chunk-7JL5YBSA.js} +1 -1
- package/chunks/{chunk-2PLNY5TN.js → chunk-7MAHENBD.js} +4 -4
- package/chunks/{chunk-L2AFWWJE.js → chunk-7UNST76G.js} +105 -24
- package/chunks/{chunk-HUWENAHO.js → chunk-7WUMS2UA.js} +1 -1
- package/chunks/{chunk-MVUQRLOH.js → chunk-A4BAHMJF.js} +3 -3
- package/chunks/{chunk-7MH4J33A.js → chunk-A6GQUQ7I.js} +2 -2
- package/chunks/{chunk-GNPNYXJB.js → chunk-AAZWJAPQ.js} +2 -2
- package/chunks/{chunk-DX3RGJMS.js → chunk-ADJDLEVO.js} +72 -13
- package/chunks/{chunk-IWTMYQ32.js → chunk-AN3LCBS7.js} +9 -8
- package/chunks/{chunk-LHEC5V6G.js → chunk-AXEL55JW.js} +2 -2
- package/chunks/{chunk-QUI267ZP.js → chunk-B66LYK4B.js} +492 -63
- package/chunks/{chunk-VNNWAZSI.js → chunk-BCGJZGFI.js} +3 -3
- package/chunks/{chunk-F6WDTQ3M.js → chunk-BRYHERQ6.js} +5 -5
- package/chunks/{chunk-6ZRFAKXK.js → chunk-C2DR57L6.js} +1 -1
- package/chunks/{chunk-26CXSA6V.js → chunk-CAOT4DYN.js} +2 -2
- package/chunks/{chunk-H6XPXXMH.js → chunk-CQ35AJ4Z.js} +252 -254
- package/chunks/{chunk-F24A2JBM.js → chunk-CUXI3S6E.js} +914 -175
- package/chunks/{chunk-AEL7KN2O.js → chunk-DANYMI4U.js} +2 -2
- package/chunks/{chunk-AAE6SR4Q.js → chunk-DX7V233D.js} +1 -1
- package/chunks/{chunk-PJRW65JO.js → chunk-E74YSVIN.js} +1 -1
- package/chunks/{chunk-OWMAZHIX.js → chunk-EGB2PIYM.js} +1 -1
- package/chunks/{chunk-TRRF5BSP.js → chunk-F4BUGC4Y.js} +1 -1
- package/chunks/{chunk-4MKXUHXY.js → chunk-FGQY4VOZ.js} +5 -5
- package/chunks/{chunk-ZBVS26BY.js → chunk-FPGTNKCP.js} +7 -5
- package/chunks/{chunk-SR7RZ4MS.js → chunk-FTGU6G45.js} +2 -2
- package/chunks/{chunk-IBUGFUXC.js → chunk-G2ZEKO4T.js} +12 -12
- package/chunks/{chunk-NDU63YLI.js → chunk-GN2SCYBA.js} +4 -4
- package/chunks/{chunk-NV3F44FL.js → chunk-GNRFC5UM.js} +2 -2
- package/chunks/{chunk-KKBPOU75.js → chunk-H6BFLALJ.js} +1 -1
- package/chunks/chunk-HHJLM3WQ.js +41 -0
- package/chunks/{chunk-LLCWZQCU.js → chunk-HM7TLULV.js} +3 -3
- package/chunks/{chunk-ECWR5LQR.js → chunk-I76FLAP7.js} +3 -3
- package/chunks/{chunk-Q3AL4JQ3.js → chunk-IAE7LYSB.js} +2 -2
- package/chunks/{chunk-DREZZAZM.js → chunk-IDNVCWXZ.js} +13 -5
- package/chunks/{chunk-YF5MALI4.js → chunk-IPMHLZPY.js} +20 -16
- package/chunks/{chunk-UDXSXLER.js → chunk-IW6RQPQB.js} +14 -4
- package/chunks/{chunk-UBX6NL47.js → chunk-JLT5HCGQ.js} +47 -3
- package/chunks/{chunk-COBO5EBO.js → chunk-JRTJEGSP.js} +1 -1
- package/chunks/{chunk-PBRVUF5B.js → chunk-JW5UEE3V.js} +1 -1
- package/chunks/{chunk-W4RQUHY3.js → chunk-K5IDV3PC.js} +184 -22
- package/chunks/{chunk-O3EU6GMH.js → chunk-KACBT7N7.js} +27 -4
- package/chunks/{chunk-MFDYOYZZ.js → chunk-KCGEAL2C.js} +25 -2
- package/chunks/{chunk-EI3HZX6C.js → chunk-KK3FEHPJ.js} +1 -1
- package/chunks/{chunk-OJUQF2PL.js → chunk-KRRRRU3X.js} +5 -5
- package/chunks/{chunk-J6SZID63.js → chunk-KTWUFHS4.js} +2 -2
- package/chunks/{chunk-E2FPSSKP.js → chunk-KZKEVWJW.js} +57 -13
- package/chunks/{chunk-ZJ4W6SUY.js → chunk-L6PE52MF.js} +3 -3
- package/chunks/{chunk-YGT2AUJ7.js → chunk-LAKFZU36.js} +39 -19
- package/chunks/{chunk-47PEPJO7.js → chunk-LKN5SEHD.js} +3 -3
- package/chunks/{chunk-OQTXYMKW.js → chunk-LSMCI42W.js} +3 -3
- package/chunks/{chunk-ABVRJU3D.js → chunk-LY2SB7GC.js} +7 -7
- package/chunks/{chunk-D27I6YJT.js → chunk-M53FFYQJ.js} +27 -18
- package/chunks/{chunk-YTFDX4PR.js → chunk-M6NDLY2T.js} +1 -1
- package/chunks/{chunk-3P2LV43B.js → chunk-MMEDZKWK.js} +3 -3
- package/chunks/{chunk-VFMASYQA.js → chunk-MS7GNABG.js} +3 -0
- package/chunks/{chunk-6LP743KE.js → chunk-MUTFMB5B.js} +78 -112
- package/chunks/{chunk-URK542T4.js → chunk-NF5J2WFA.js} +15 -2
- package/chunks/{chunk-VSFKIRRW.js → chunk-NH6U7L42.js} +4 -4
- package/chunks/{chunk-DA4HRSBW.js → chunk-NHZF4VCD.js} +1 -1
- package/chunks/{chunk-QG3FFJYU.js → chunk-NJE5NH5B.js} +1 -1
- package/chunks/{chunk-2UUMVNYT.js → chunk-NM33GGOM.js} +3 -3
- package/chunks/{chunk-FOGU3LJX.js → chunk-NW7SPXVG.js} +1 -1
- package/chunks/{chunk-EUNWC2VS.js → chunk-O6SLWH4X.js} +2 -2
- package/chunks/{chunk-EBZ6BJTF.js → chunk-OEVVUUYW.js} +1 -1
- package/chunks/chunk-OMVHZ7E6.js +1280 -0
- package/chunks/{chunk-KZ22NXBY.js → chunk-OT72MGHE.js} +4 -4
- package/chunks/{chunk-DZUO626D.js → chunk-OUCCIS3E.js} +3 -3
- package/chunks/{chunk-OONWZLFK.js → chunk-OYLYERMH.js} +4 -4
- package/chunks/{chunk-P3BJLFSZ.js → chunk-OYQM5XZ4.js} +3 -3
- package/chunks/{chunk-NRLFZWCT.js → chunk-PNU3TILU.js} +3 -3
- package/chunks/{chunk-M6HMMKVG.js → chunk-PSTHNTHF.js} +1 -1
- package/chunks/{chunk-4PYCZH2V.js → chunk-QEWAHAW2.js} +3 -3
- package/chunks/{chunk-QJMOAMXT.js → chunk-RG2S3GYC.js} +8 -8
- package/chunks/{chunk-CTJLZLB5.js → chunk-RQS2BGPI.js} +1 -1
- package/chunks/{chunk-Y4R47ZUH.js → chunk-RTBUTKAX.js} +7 -7
- package/chunks/{chunk-NV65ZUVM.js → chunk-RZZV6GQN.js} +1 -1
- package/chunks/{chunk-UEOKWYGY.js → chunk-SESSAEWC.js} +11 -11
- package/chunks/{chunk-CPG6P4GG.js → chunk-SKRHR6N2.js} +1 -1
- package/chunks/{chunk-WAUGQKUU.js → chunk-SNHBRO4C.js} +9 -5
- package/chunks/{chunk-KID7K6H2.js → chunk-SNPOURNX.js} +6 -6
- package/chunks/{chunk-VWKER4ZH.js → chunk-SQCTJ435.js} +3 -3
- package/chunks/{chunk-Z4JX4NSH.js → chunk-SXJ7JYQA.js} +23 -23
- package/chunks/{chunk-XVHYA33G.js → chunk-TD7JVTIA.js} +4 -4
- package/chunks/{chunk-IRZ2ZH72.js → chunk-TEFHXP7C.js} +4 -4
- package/chunks/{chunk-2FRY5CRX.js → chunk-TNETSI2A.js} +3 -3
- package/chunks/{chunk-IA7TGCN2.js → chunk-TROB4PZY.js} +4 -4
- package/chunks/{chunk-4TRQPFDP.js → chunk-U3O2EO5Y.js} +26 -20
- package/chunks/{chunk-VKJ4KTPJ.js → chunk-U7ROFHSH.js} +1 -1
- package/chunks/{chunk-Q3JQ7OSU.js → chunk-UBC6PMV7.js} +1 -1
- package/chunks/{chunk-W5UC37EE.js → chunk-UFHPAMAV.js} +6 -0
- package/chunks/{chunk-EQL65XGA.js → chunk-UHF5VBKO.js} +47 -21
- package/chunks/{chunk-S6HYI3MF.js → chunk-UQPLUR4A.js} +2 -2
- package/chunks/{chunk-HGCQ5SE7.js → chunk-UXEO7E3V.js} +21 -0
- package/chunks/{chunk-WCG5O7IP.js → chunk-V3NMFQD2.js} +2 -2
- package/chunks/{chunk-EKPKKXY2.js → chunk-V4SJMQVJ.js} +1 -1
- package/chunks/{chunk-ONSZH6VM.js → chunk-VFJVRSRK.js} +2 -2
- package/chunks/{chunk-MZSJ43WV.js → chunk-W5ZFJYUG.js} +13 -0
- package/chunks/{chunk-XCGIMOLN.js → chunk-WCCLLK7X.js} +14 -1
- package/chunks/{chunk-4WL6SY4F.js → chunk-WDSTNDEW.js} +1 -1
- package/chunks/{chunk-KONVMRK7.js → chunk-WFTBYUOR.js} +1 -1
- package/chunks/{chunk-EI3NWELG.js → chunk-WH32GXQS.js} +6233 -4342
- package/chunks/{chunk-MIKXJYZB.js → chunk-WS5TWVT6.js} +305 -291
- package/chunks/{chunk-VJNBRRZG.js → chunk-WZMH7II3.js} +1 -1
- package/chunks/{chunk-67EWJE77.js → chunk-XY7DGTIC.js} +1 -1
- package/chunks/{chunk-HV76SFIA.js → chunk-YI5G32RU.js} +3 -3
- package/chunks/{chunk-OIVKILPI.js → chunk-YMB77M76.js} +18 -0
- package/chunks/{chunk-AQAJJMRR.js → chunk-YPITLFHS.js} +1 -1
- package/chunks/{chunk-WOJZWRAZ.js → chunk-YRLW2MSX.js} +1 -1
- package/chunks/{chunk-ZZCWJWTF.js → chunk-YY23TR4M.js} +31 -11
- package/chunks/{chunk-URKIBIFC.js → chunk-YYI3Z3AO.js} +3 -3
- package/chunks/chunk-Z7B6SRPM.js +32 -0
- package/chunks/{chunk-6Q5ABMTU.js → chunk-ZGONVQ3D.js} +23 -19
- package/chunks/{chunk-GWVUR3QZ.js → chunk-ZM6LZON7.js} +3 -3
- package/chunks/{chunk-XCWO3SMQ.js → chunk-ZPZANKVP.js} +3 -3
- package/chunks/{chunk-OCSFNUU4.js → chunk-ZRD3BUEX.js} +8 -8
- package/chunks/{chunk-PYQADEFD.js → chunk-ZRT36RSF.js} +1 -1
- package/chunks/{chunk-JT7XS4YW.js → chunk-ZZ7RUTJ4.js} +1 -1
- package/chunks/{computer-use-WQFK33Z3.js → computer-use-7BMFU557.js} +42 -41
- package/chunks/{config-utils-ULCSRMWD.js → config-utils-I732W437.js} +6 -6
- package/chunks/{contextCommand-7EOZND7C.js → contextCommand-VJ6UOMM4.js} +44 -43
- package/chunks/{core-runtime-FGMQRM6E.js → core-runtime-PMRKP77C.js} +42 -41
- package/chunks/{create-sub-session-QIDZUOPU.js → create-sub-session-23ULO5PO.js} +2 -2
- package/chunks/{create-sub-session-QM2K5HLZ.js → create-sub-session-5A3MSW22.js} +42 -41
- package/chunks/{cron-create-VONA5JYY.js → cron-create-5WUTNKNF.js} +4 -4
- package/chunks/{cron-delete-5JXSP2MI.js → cron-delete-JEQ27YPS.js} +4 -4
- package/chunks/{cron-list-KE4F2CIR.js → cron-list-IXGCA7UR.js} +4 -4
- package/chunks/{daemon-GWD7BT6E.js → daemon-PXIC4ZDK.js} +186 -7
- package/chunks/daemon-status-provider-33BLPRUA.js +103 -0
- package/chunks/daemon-trust-policy-ZUV26YGP.js +99 -0
- package/chunks/{daemon-trust-policy-monitor-6UKEABN5.js → daemon-trust-policy-monitor-35WRTIMA.js} +49 -48
- package/chunks/{de-LIW4XVLN.js → de-UBEBKG6V.js} +2 -1
- package/chunks/{deferred-core-runtime-67GJXHXS.js → deferred-core-runtime-ZSLQKM7J.js} +42 -41
- package/chunks/{display-image-NQRSIBXM.js → display-image-CAD7RAUM.js} +4 -4
- package/chunks/{dist-6BMOAE3Z.js → dist-362MN6CP.js} +4 -4
- package/chunks/{dist-3NTTUAHT.js → dist-5VDE7U3A.js} +3 -3
- package/chunks/{dist-Z3CS4OVP.js → dist-6RK4U6VU.js} +11 -5
- package/chunks/{dist-B2CGTW6T.js → dist-CCUH2Z4C.js} +3 -3
- package/chunks/{dist-J47AXBZC.js → dist-EZHCZSW6.js} +3 -3
- package/chunks/{dist-EZE3V3Q7.js → dist-JIORWIDV.js} +3 -3
- package/chunks/{dist-EWW3J4HQ.js → dist-M3XMEIP2.js} +3 -3
- package/chunks/{dist-OTUO3AS2.js → dist-NN5ARGTQ.js} +13 -5
- package/chunks/{earlyInputCapture-IWMYR6OB.js → earlyInputCapture-UNMCTGJR.js} +43 -42
- package/chunks/{edit-ZFGROCAF.js → edit-TXVTSXHY.js} +42 -41
- package/chunks/{en-SY5GTIGX.js → en-X6YV7GME.js} +2 -1
- package/chunks/{enter-worktree-TZZZCDM5.js → enter-worktree-7Q3X4PW7.js} +42 -41
- package/chunks/{enterPlanMode-U77BI3R6.js → enterPlanMode-AZBU3ZB6.js} +42 -41
- package/chunks/{environment-HC37DS2I.js → environment-TGFFQISF.js} +45 -44
- package/chunks/{errors-6AG54JPD.js → errors-GVPFT7BA.js} +44 -43
- package/chunks/{exit-worktree-UYYWFPNK.js → exit-worktree-7INKYMWE.js} +42 -41
- package/chunks/exitPlanMode-5CE7CLAE.js +85 -0
- package/chunks/{fast-path-F5FSZ3O7.js → fast-path-7B6F74IR.js} +5 -5
- package/chunks/{fast-path-settings-RPAVBD7P.js → fast-path-settings-LNOFM2YP.js} +2 -2
- package/chunks/{fr-RQFO7U4P.js → fr-VENTC2BS.js} +2 -1
- package/chunks/{gemini-NKQHYM36.js → gemini-4RUYPDKT.js} +92 -91
- package/chunks/{geminiContentGenerator-HCWZOUX3.js → geminiContentGenerator-NLL52POY.js} +6 -6
- package/chunks/{glob-3PDXKBAO.js → glob-DHU3INUK.js} +42 -41
- package/chunks/{goal-tools-SWNB6GP4.js → goal-tools-LQFO4BRY.js} +4 -4
- package/chunks/{grep-5HZKZYVD.js → grep-523W6G52.js} +42 -41
- package/chunks/handleAutoUpdate-PKUQ3OQQ.js +94 -0
- package/chunks/{i18n-Q27KKNDL.js → i18n-HYL2UBJW.js} +43 -42
- package/chunks/{image-gen-2Z2RJ6W7.js → image-gen-NLIDBAKE.js} +10 -10
- package/chunks/initializer-DGH7RAJ7.js +100 -0
- package/chunks/{installationInfo-XXB75T7O.js → installationInfo-FZ4XWV7O.js} +43 -42
- package/chunks/{ja-KOZKHJHZ.js → ja-QHT4EQTO.js} +2 -1
- package/chunks/{keychain-token-storage-TVAMTNP7.js → keychain-token-storage-GU75J2T2.js} +2 -2
- package/chunks/list-RH5HGWRJ.js +103 -0
- package/chunks/{list-agents-Z4WABFDZ.js → list-agents-5PNMK2AM.js} +2 -2
- package/chunks/loadedSettingsAdapter-XMX2JDOU.js +97 -0
- package/chunks/{loggingContentGenerator-6NTFBM7Q.js → loggingContentGenerator-T3J4HZ7U.js} +139 -98
- package/chunks/{loop-wakeup-UZ5RL5Y2.js → loop-wakeup-OV65FEGR.js} +5 -5
- package/chunks/{ls-TVHDGIES.js → ls-7CETV7WV.js} +4 -4
- package/chunks/{lsp-CVN6OQPI.js → lsp-IWTJWFLT.js} +2 -2
- package/chunks/{managed-npm-update-SPHYQUWZ.js → managed-npm-update-E5ZGIGWV.js} +45 -44
- package/chunks/mcp-6LC572CW.js +97 -0
- package/chunks/{monitor-ZBBPAA54.js → monitor-HQUS4RTV.js} +42 -41
- package/chunks/nonInteractiveCli-X7HKTS5Z.js +163 -0
- package/chunks/{notebook-edit-5W3FW7Z2.js → notebook-edit-QPI3LTFM.js} +42 -41
- package/chunks/{openaiContentGenerator-TQANPEVZ.js → openaiContentGenerator-GGS72DVB.js} +29 -29
- package/chunks/{pidfile-EQOBLH4E.js → pidfile-HD3EB6GL.js} +43 -42
- package/chunks/{processUtils-7XQG7EHS.js → processUtils-2WNEPSW4.js} +2 -2
- package/chunks/{pt-U6AOCTMF.js → pt-VL3I5RNY.js} +2 -1
- package/chunks/{qwenContentGenerator-BKCPHHXU.js → qwenContentGenerator-WJYPELF3.js} +48 -48
- package/chunks/{qwenOAuth2-BJ6PQKE6.js → qwenOAuth2-RSMEBZU4.js} +9 -9
- package/chunks/read-file-URU5ALY3.js +32 -0
- package/chunks/{read-mcp-resource-PZ4ZF6YL.js → read-mcp-resource-THCSZHXO.js} +2 -2
- package/chunks/{read-package-up-TCM6I7S2.js → read-package-up-K6RKTL5D.js} +1 -1
- package/chunks/{record-artifact-P4HFMS7X.js → record-artifact-76YYQA5F.js} +3 -3
- package/chunks/{resumeHistoryUtils-6N6XGJJW.js → resumeHistoryUtils-XMC3CR2U.js} +49 -48
- package/chunks/ripGrep-6NYCUBVW.js +85 -0
- package/chunks/{ru-CMX4UMYP.js → ru-4RCKL4PY.js} +2 -1
- package/chunks/{run-qwen-serve-BCKBCAMX.js → run-qwen-serve-H4IXCJDQ.js} +165 -65
- package/chunks/{runtime-E2437YKL.js → runtime-EJHNZR7H.js} +55 -54
- package/chunks/{scheduler-K3D5Z655.js → scheduler-VVORKEEZ.js} +44 -43
- package/chunks/{sdk-exporters-http-XVTZQRCE.js → sdk-exporters-http-JYKTSCMG.js} +11 -7
- package/chunks/{sdk-impl-7W7AKCS4.js → sdk-impl-ROR54N3H.js} +13 -10
- package/chunks/{send-message-CAMSLG2L.js → send-message-P5SLP57G.js} +6 -6
- package/chunks/serve-3ULKH2KQ.js +107 -0
- package/chunks/{server-UD6INW7J.js → server-J52IQLRJ.js} +949 -303
- package/chunks/{session-GR4ZEVW4.js → session-MNWSMCC2.js} +118 -98
- package/chunks/{settings-5O24D3OJ.js → settings-WFCKUQZO.js} +48 -47
- package/chunks/{shell-UTLWLG5G.js → shell-H5DZN76B.js} +42 -41
- package/chunks/{skill-QQAZL4VO.js → skill-STSDBOIL.js} +19 -19
- package/chunks/{skill-settings-P3YHJVBZ.js → skill-settings-LTJAR2LV.js} +48 -47
- package/chunks/spawnChannel-XL27KTLE.js +98 -0
- package/chunks/{standalone-update-QP742MGP.js → standalone-update-3FUDL2R6.js} +44 -43
- package/chunks/{startInteractiveUI-YCS6AEPN.js → startInteractiveUI-5BFJCCWU.js} +596 -335
- package/chunks/{syntheticOutput-PEBJQYJV.js → syntheticOutput-SEW4NA47.js} +3 -3
- package/chunks/{task-create-5NWCQSJF.js → task-create-247EAVF7.js} +10 -10
- package/chunks/{task-list-53265TRZ.js → task-list-ZJN4QHLK.js} +5 -5
- package/chunks/{task-stop-FPCOIRYX.js → task-stop-MAYQJ42I.js} +2 -2
- package/chunks/{task-update-5HN577LS.js → task-update-CG4FALQF.js} +10 -10
- package/chunks/{team-create-WFH7OCDQ.js → team-create-FC2EYGE7.js} +44 -43
- package/chunks/{team-delete-MMQB4OSC.js → team-delete-3XVRPQBP.js} +5 -5
- package/chunks/{team-plan-approval-EGTT53MV.js → team-plan-approval-X673CRIZ.js} +42 -41
- package/chunks/{terminal-image-renderer-BWRESAQ7.js → terminal-image-renderer-MRNJ77H7.js} +44 -43
- package/chunks/theme-manager-6UMSB7DJ.js +89 -0
- package/chunks/{todoWrite-JGV6VLOX.js → todoWrite-IE2YTCK7.js} +4 -4
- package/chunks/{tool-search-TI5PTIBF.js → tool-search-7Z3PPA5O.js} +19 -19
- package/chunks/total-session-admission-NU4KV76R.js +99 -0
- package/chunks/{trustedFolders-4KYHA4IG.js → trustedFolders-SCUSHKHS.js} +43 -42
- package/chunks/{update-relaunch-WB6LGIF2.js → update-relaunch-M6BNKY4W.js} +5 -5
- package/chunks/{updateCheck-LOS5GYFC.js → updateCheck-QMZZ53S6.js} +48 -47
- package/chunks/{useAutoAcceptIndicator-MHAPY52L.js → useAutoAcceptIndicator-GAFG5PFE.js} +52 -51
- package/chunks/{validateNonInterActiveAuth-QV22HNQU.js → validateNonInterActiveAuth-V44BOAD2.js} +87 -86
- package/chunks/{version-DALWZHKQ.js → version-A4J2RQXD.js} +2 -2
- package/chunks/{web-fetch-JMJVMYFE.js → web-fetch-43TWEBWB.js} +19 -19
- package/chunks/{web-search-DNDUIPU5.js → web-search-CS3Q6JBI.js} +11 -11
- package/chunks/{workflow-JGNN64PM.js → workflow-ETQXJUPR.js} +115 -49
- package/chunks/workspace-providers-status-Y4FPKLHN.js +100 -0
- package/chunks/{workspace-registration-store-LRJG7QA4.js → workspace-registration-store-JASCK5RS.js} +1 -1
- package/chunks/{workspace-registry-KVXIFM36.js → workspace-registry-MU3VIM2D.js} +49 -48
- package/chunks/{workspace-service-PO4AAKKT.js → workspace-service-MHVHRNDX.js} +54 -53
- package/chunks/workspace-skills-status-QVQMNHGO.js +100 -0
- package/chunks/{workspace-trust-reconciler-DOZPCVHG.js → workspace-trust-reconciler-ABXDCISO.js} +56 -55
- package/chunks/write-file-YL7EPQRJ.js +87 -0
- package/chunks/{zh-AGL2FVBI.js → zh-LMSTK4WD.js} +2 -1
- package/chunks/{zh-TW-KI66MHQY.js → zh-TW-SQ4HTSCW.js} +2 -1
- package/chunks/{zoom-image-CNC77ZMA.js → zoom-image-ZQV6O2KE.js} +15 -15
- package/cli.js +13 -13
- package/locales/ca.js +1 -0
- package/locales/de.js +1 -0
- package/locales/en.js +1 -0
- package/locales/fr.js +1 -0
- package/locales/ja.js +1 -0
- package/locales/pt.js +1 -0
- package/locales/ru.js +1 -0
- package/locales/zh-TW.js +1 -0
- package/locales/zh.js +1 -0
- package/package.json +4 -4
- package/web-shell/assets/{arc-CDk0d60K.js → arc-BDKBUdHd.js} +1 -1
- package/web-shell/assets/{architectureDiagram-3BPJPVTR-h-W3I2lP.js → architectureDiagram-3BPJPVTR-DgMi5iOf.js} +1 -1
- package/web-shell/assets/{blockDiagram-GPEHLZMM-D1pvSmZg.js → blockDiagram-GPEHLZMM-DOyxD2BK.js} +1 -1
- package/web-shell/assets/{c4Diagram-AAUBKEIU-ByAm5ZNf.js → c4Diagram-AAUBKEIU-CmXzCE_n.js} +1 -1
- package/web-shell/assets/channel-BCff03Ag.js +1 -0
- package/web-shell/assets/{chunk-2J33WTMH-VrGPPOGV.js → chunk-2J33WTMH-Dr13N7PT.js} +1 -1
- package/web-shell/assets/{chunk-4BX2VUAB-B7hTowgG.js → chunk-4BX2VUAB-CIFcKNCP.js} +1 -1
- package/web-shell/assets/{chunk-55IACEB6-j1Fq8DpE.js → chunk-55IACEB6-B8jmrVPK.js} +1 -1
- package/web-shell/assets/{chunk-727SXJPM-UjABYpF2.js → chunk-727SXJPM-CQc0wjze.js} +1 -1
- package/web-shell/assets/{chunk-AQP2D5EJ-D4uBItrs.js → chunk-AQP2D5EJ-CGdZxT9s.js} +1 -1
- package/web-shell/assets/{chunk-FMBD7UC4-DeFbKlb8.js → chunk-FMBD7UC4-4iCBhCLJ.js} +1 -1
- package/web-shell/assets/{chunk-ND2GUHAM-rQJ8TIgT.js → chunk-ND2GUHAM-B0mMzZcM.js} +1 -1
- package/web-shell/assets/{chunk-QZHKN3VN-DAGcRxvq.js → chunk-QZHKN3VN-6CURQrGl.js} +1 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-DnwxH0ri.js +1 -0
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-DnwxH0ri.js +1 -0
- package/web-shell/assets/{cose-bilkent-S5V4N54A-MaE7MJSt.js → cose-bilkent-S5V4N54A-L6Fo1GN1.js} +1 -1
- package/web-shell/assets/{dagre-BM42HDAG-DzijYGSb.js → dagre-BM42HDAG-BTsGDeLA.js} +1 -1
- package/web-shell/assets/{diagram-2AECGRRQ-WdbG7WnX.js → diagram-2AECGRRQ-B4AXYZGR.js} +1 -1
- package/web-shell/assets/{diagram-5GNKFQAL-NYutsBnw.js → diagram-5GNKFQAL-C2yM5aNc.js} +1 -1
- package/web-shell/assets/{diagram-KO2AKTUF-Dqg0eBY0.js → diagram-KO2AKTUF-CrGLZmRK.js} +1 -1
- package/web-shell/assets/{diagram-LMA3HP47-C7vRP2Lb.js → diagram-LMA3HP47-rycHl4fv.js} +1 -1
- package/web-shell/assets/{diagram-OG6HWLK6-B2sEPpPt.js → diagram-OG6HWLK6-MQj80AQu.js} +1 -1
- package/web-shell/assets/{erDiagram-TEJ5UH35-a4zIbzm8.js → erDiagram-TEJ5UH35-DCgH-D0D.js} +1 -1
- package/web-shell/assets/{flowDiagram-I6XJVG4X-BK9y89ya.js → flowDiagram-I6XJVG4X-B0gnwCnt.js} +1 -1
- package/web-shell/assets/{ganttDiagram-6RSMTGT7-wUQTSNvV.js → ganttDiagram-6RSMTGT7-CB0OxXVE.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-PVQCEYII-Dnzt4SAi.js → gitGraphDiagram-PVQCEYII-xLxucse9.js} +1 -1
- package/web-shell/assets/{index-BA3wUcKL.js → index-BFFbq0E-.js} +1 -1
- package/web-shell/assets/index-D7XXR9S-.js +1789 -0
- package/web-shell/assets/index-Dk5RwPL9.css +5 -0
- package/web-shell/assets/{infoDiagram-5YYISTIA-DcaoToij.js → infoDiagram-5YYISTIA-7FCqN4qa.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-DzduqhP2.js → ishikawaDiagram-YF4QCWOH-BGyKlnik.js} +1 -1
- package/web-shell/assets/{journeyDiagram-JHISSGLW-BvviZR_O.js → journeyDiagram-JHISSGLW-CmgSXMLF.js} +1 -1
- package/web-shell/assets/{kanban-definition-UN3LZRKU-Efm2JxY3.js → kanban-definition-UN3LZRKU-CjT2mF6A.js} +1 -1
- package/web-shell/assets/{linear-DtY3IbOs.js → linear-CiTDGfCW.js} +1 -1
- package/web-shell/assets/{mermaid.core-PzpFqoMe.js → mermaid.core-_QnqxPRF.js} +5 -5
- package/web-shell/assets/{mindmap-definition-RKZ34NQL-BLlTkHS0.js → mindmap-definition-RKZ34NQL-B1On14ZB.js} +1 -1
- package/web-shell/assets/{pieDiagram-4H26LBE5-D-mKF-jE.js → pieDiagram-4H26LBE5-x1Pf1OG2.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-W4KKPZXB-DYCzslGm.js → quadrantDiagram-W4KKPZXB-ZawmK1Q9.js} +1 -1
- package/web-shell/assets/{requirementDiagram-4Y6WPE33-Dfpxlk7R.js → requirementDiagram-4Y6WPE33-krIMX0c8.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-5OEKKPKP-D5cRaaxh.js → sankeyDiagram-5OEKKPKP-aMJyxtx_.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-3UESZ5HK-s04DReiS.js → sequenceDiagram-3UESZ5HK-C530-Kqz.js} +1 -1
- package/web-shell/assets/{stateDiagram-AJRCARHV-01UNFgnb.js → stateDiagram-AJRCARHV-DObd9dT_.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-Bttf9Ae9.js +1 -0
- package/web-shell/assets/{timeline-definition-PNZ67QCA-DX8_wZBC.js → timeline-definition-PNZ67QCA-D9LnwQ1O.js} +1 -1
- package/web-shell/assets/{vennDiagram-CIIHVFJN-BK0FlBme.js → vennDiagram-CIIHVFJN-B_MT_v6Y.js} +1 -1
- package/web-shell/assets/{wardley-L42UT6IY-DkPc9UlD.js → wardley-L42UT6IY-DHKPz5Hu.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-YWT4CUSO-DNKkpDAo.js → wardleyDiagram-YWT4CUSO-BoyKaItA.js} +1 -1
- package/web-shell/assets/{xychartDiagram-2RQKCTM6-CiPwg8QG.js → xychartDiagram-2RQKCTM6--xBJT7Kg.js} +1 -1
- package/web-shell/index.html +2 -2
- package/chunks/agent-headless-HYEHZFH6.js +0 -86
- package/chunks/channel-settings-store-OXYG5S5X.js +0 -101
- package/chunks/chunk-I5VM3SKY.js +0 -451
- package/chunks/chunk-PDPFQ2FO.js +0 -156
- package/chunks/daemon-status-provider-L3J6GKCT.js +0 -102
- package/chunks/daemon-trust-policy-4PHPY23S.js +0 -98
- package/chunks/exitPlanMode-RWJR2KGB.js +0 -84
- package/chunks/handleAutoUpdate-NHFSGYTF.js +0 -93
- package/chunks/initializer-Y5DJLT43.js +0 -99
- package/chunks/list-YHNQ32CS.js +0 -102
- package/chunks/loadedSettingsAdapter-GHUQK7H4.js +0 -96
- package/chunks/mcp-EA3KO6FS.js +0 -96
- package/chunks/nonInteractiveCli-NNOR56HU.js +0 -162
- package/chunks/read-file-KKTXGIZD.js +0 -32
- package/chunks/ripGrep-SJVAAYDV.js +0 -84
- package/chunks/serve-IH4XR5IL.js +0 -106
- package/chunks/spawnChannel-UAQMH6Y6.js +0 -94
- package/chunks/theme-manager-ZNDGAHJN.js +0 -88
- package/chunks/total-session-admission-66UDSOHO.js +0 -98
- package/chunks/workspace-providers-status-K22B3Z6B.js +0 -99
- package/chunks/workspace-skills-status-DDYCBVSH.js +0 -99
- package/chunks/write-file-TT6MWIKC.js +0 -86
- package/web-shell/assets/channel-DPFUV4oi.js +0 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-CLm0hVvw.js +0 -1
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CLm0hVvw.js +0 -1
- package/web-shell/assets/index-BjC3yjjL.css +0 -5
- package/web-shell/assets/index-QzFq6w7o.js +0 -1775
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-DXb5olqv.js +0 -1
|
@@ -13,17 +13,17 @@ import {
|
|
|
13
13
|
matchMcpServerByRef,
|
|
14
14
|
parseExtensionRef,
|
|
15
15
|
parseMcpServerRef
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-GN2SCYBA.js";
|
|
17
17
|
import {
|
|
18
18
|
getAvailableCommands,
|
|
19
19
|
handleSlashCommand,
|
|
20
20
|
insertAfterFunctionResponses,
|
|
21
21
|
isSlashCommand,
|
|
22
22
|
normalizePartList
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-WS5TWVT6.js";
|
|
24
24
|
import {
|
|
25
25
|
recomputeMcpGating
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-FGQY4VOZ.js";
|
|
27
27
|
import {
|
|
28
28
|
SessionIdConflictError,
|
|
29
29
|
appEvents,
|
|
@@ -31,43 +31,47 @@ import {
|
|
|
31
31
|
cleanupReviewWorktreeLeases,
|
|
32
32
|
loadCliConfig,
|
|
33
33
|
normalizeDisabledToolList
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-6KXHEN6M.js";
|
|
35
35
|
import {
|
|
36
36
|
getCommandSubcommandNames
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-NJE5NH5B.js";
|
|
38
38
|
import {
|
|
39
39
|
getEffectiveSupportedModes
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-4IBNVBGJ.js";
|
|
41
41
|
import "./chunk-NYX53SV4.js";
|
|
42
|
-
import "./chunk-
|
|
42
|
+
import "./chunk-GNRFC5UM.js";
|
|
43
43
|
import {
|
|
44
44
|
collectContextData,
|
|
45
45
|
formatContextUsageText
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-BRYHERQ6.js";
|
|
47
47
|
import "./chunk-4WGODMVR.js";
|
|
48
48
|
import {
|
|
49
49
|
startNonInteractiveOpenAILogHousekeeping
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-OT72MGHE.js";
|
|
51
51
|
import "./chunk-KW7NOTN6.js";
|
|
52
|
-
import "./chunk-
|
|
53
|
-
import "./chunk-
|
|
54
|
-
import
|
|
52
|
+
import "./chunk-RQS2BGPI.js";
|
|
53
|
+
import "./chunk-TEFHXP7C.js";
|
|
54
|
+
import {
|
|
55
|
+
isGoalStatusKind
|
|
56
|
+
} from "./chunk-EKTCKZV5.js";
|
|
57
|
+
import "./chunk-YYI3Z3AO.js";
|
|
55
58
|
import "./chunk-YAF2MQZ6.js";
|
|
56
59
|
import {
|
|
57
60
|
computeCpuPercent
|
|
58
61
|
} from "./chunk-LBOVL47Y.js";
|
|
59
|
-
import "./chunk-
|
|
62
|
+
import "./chunk-IPMHLZPY.js";
|
|
60
63
|
import "./chunk-6H67XLET.js";
|
|
61
64
|
import {
|
|
62
65
|
beginAcpBootstrapConfigProfiling,
|
|
63
66
|
buildAndFreezeAcpStartupProfile,
|
|
64
67
|
endAcpBootstrapConfigProfiling,
|
|
65
68
|
markAcpStartup
|
|
66
|
-
} from "./chunk-
|
|
67
|
-
import "./chunk-
|
|
69
|
+
} from "./chunk-ZZ7RUTJ4.js";
|
|
70
|
+
import "./chunk-3XLWKV4S.js";
|
|
68
71
|
import {
|
|
69
72
|
GENERATION_MAX_PROMPT_BYTES,
|
|
70
73
|
GENERATION_TIMEOUT_MS,
|
|
74
|
+
HistoryReplayLimitError,
|
|
71
75
|
MAX_REMEMBER_CONTENT_BYTES,
|
|
72
76
|
REDACTED_MCP_SECRET,
|
|
73
77
|
collectHistoryReplayUpdates,
|
|
@@ -86,25 +90,21 @@ import {
|
|
|
86
90
|
shouldSuppressRememberErrorDetails,
|
|
87
91
|
workspaceMemoryFailureCode,
|
|
88
92
|
workspaceMemoryFailureDiagnostics
|
|
89
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-MUTFMB5B.js";
|
|
90
94
|
import {
|
|
95
|
+
BaseEmitter,
|
|
91
96
|
HistoryReplayer,
|
|
92
|
-
MessageEmitter,
|
|
93
97
|
PlanEmitter,
|
|
94
98
|
ToolCallEmitter,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
import "./chunk-
|
|
101
|
-
import "./chunk-ZRBMO3C7.js";
|
|
99
|
+
createTranscriptMessageUpdate,
|
|
100
|
+
createTranscriptUsageUpdate,
|
|
101
|
+
hasFullSessionContext
|
|
102
|
+
} from "./chunk-4NV6L4GZ.js";
|
|
103
|
+
import "./chunk-EGB2PIYM.js";
|
|
104
|
+
import "./chunk-4IWFPTAH.js";
|
|
102
105
|
import "./chunk-4NFY2S7N.js";
|
|
103
106
|
import "./chunk-2MIN6GRR.js";
|
|
104
107
|
import "./chunk-QHTIBUWB.js";
|
|
105
|
-
import {
|
|
106
|
-
isTerminalGoalStatusKind
|
|
107
|
-
} from "./chunk-EKTCKZV5.js";
|
|
108
108
|
import "./chunk-3Z43GZUQ.js";
|
|
109
109
|
import {
|
|
110
110
|
buildToolWriteOriginMeta
|
|
@@ -113,25 +113,25 @@ import {
|
|
|
113
113
|
normalizeSessionIdForLookup,
|
|
114
114
|
parseCallerSuppliedSessionId
|
|
115
115
|
} from "./chunk-TQOF5KBL.js";
|
|
116
|
-
import "./chunk-
|
|
116
|
+
import "./chunk-UXEO7E3V.js";
|
|
117
117
|
import {
|
|
118
118
|
PERMISSION_RULE_TYPES,
|
|
119
119
|
PermissionRulesValidationError,
|
|
120
120
|
buildPermissionSettings,
|
|
121
121
|
normalizePermissionRules,
|
|
122
122
|
readPermissionRuleSet
|
|
123
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-4QC6SUVN.js";
|
|
124
124
|
import {
|
|
125
125
|
MAX_AUDIO_BYTES,
|
|
126
126
|
sanitizeVoiceErrorMessage,
|
|
127
127
|
transcribeVoiceAudio
|
|
128
|
-
} from "./chunk-
|
|
128
|
+
} from "./chunk-HM7TLULV.js";
|
|
129
129
|
import {
|
|
130
130
|
readVoiceModel
|
|
131
|
-
} from "./chunk-
|
|
132
|
-
import "./chunk-
|
|
131
|
+
} from "./chunk-OEVVUUYW.js";
|
|
132
|
+
import "./chunk-5KZNWF2M.js";
|
|
133
133
|
import "./chunk-NTTBXH7U.js";
|
|
134
|
-
import "./chunk-
|
|
134
|
+
import "./chunk-NH6U7L42.js";
|
|
135
135
|
import "./chunk-3SH53ANB.js";
|
|
136
136
|
import {
|
|
137
137
|
ACP_ROUTE_ID_PREFIX,
|
|
@@ -141,32 +141,32 @@ import {
|
|
|
141
141
|
parseAcpModelOption,
|
|
142
142
|
resolveAcpModelOption,
|
|
143
143
|
sanitizeProviderBaseUrl
|
|
144
|
-
} from "./chunk-
|
|
144
|
+
} from "./chunk-7MAHENBD.js";
|
|
145
145
|
import {
|
|
146
146
|
mapSkillConfigToStatus
|
|
147
147
|
} from "./chunk-BGXZBI5B.js";
|
|
148
148
|
import {
|
|
149
149
|
resolveSkillSettings
|
|
150
150
|
} from "./chunk-Z4X5MTRT.js";
|
|
151
|
-
import "./chunk-
|
|
152
|
-
import "./chunk-
|
|
151
|
+
import "./chunk-6YUEAYJ5.js";
|
|
152
|
+
import "./chunk-5XNR53C7.js";
|
|
153
153
|
import "./chunk-57OAHC2Y.js";
|
|
154
|
-
import "./chunk-
|
|
155
|
-
import "./chunk-
|
|
156
|
-
import "./chunk-
|
|
154
|
+
import "./chunk-AXEL55JW.js";
|
|
155
|
+
import "./chunk-XY7DGTIC.js";
|
|
156
|
+
import "./chunk-KZKEVWJW.js";
|
|
157
157
|
import {
|
|
158
158
|
createLoadedSettingsAdapter
|
|
159
|
-
} from "./chunk-
|
|
159
|
+
} from "./chunk-WDSTNDEW.js";
|
|
160
160
|
import {
|
|
161
161
|
SESSION_SOURCE_META_KEY,
|
|
162
162
|
parseSessionSource
|
|
163
|
-
} from "./chunk-
|
|
164
|
-
import "./chunk-
|
|
165
|
-
import "./chunk-
|
|
163
|
+
} from "./chunk-CUXI3S6E.js";
|
|
164
|
+
import "./chunk-W5ZFJYUG.js";
|
|
165
|
+
import "./chunk-WCCLLK7X.js";
|
|
166
166
|
import "./chunk-OCPBI7J5.js";
|
|
167
167
|
import {
|
|
168
168
|
ndJsonStream
|
|
169
|
-
} from "./chunk-
|
|
169
|
+
} from "./chunk-OMVHZ7E6.js";
|
|
170
170
|
import {
|
|
171
171
|
ACP_PREFLIGHT_KINDS,
|
|
172
172
|
IDLE_HOOK_EVENTS,
|
|
@@ -174,8 +174,8 @@ import {
|
|
|
174
174
|
SERVE_STATUS_EXT_METHODS,
|
|
175
175
|
STATUS_SCHEMA_VERSION,
|
|
176
176
|
mapDomainErrorToErrorKind
|
|
177
|
-
} from "./chunk-
|
|
178
|
-
import "./chunk-
|
|
177
|
+
} from "./chunk-NHZF4VCD.js";
|
|
178
|
+
import "./chunk-U7ROFHSH.js";
|
|
179
179
|
import "./chunk-V6WHFGST.js";
|
|
180
180
|
import {
|
|
181
181
|
ACTIVE_WORK_CLOSE_IF_UNHELD_PARAM,
|
|
@@ -188,8 +188,11 @@ import {
|
|
|
188
188
|
CLIENT_MCP_OVER_WS_CONFIG_FLAG,
|
|
189
189
|
DAEMON_CHANNEL_DELIVERY_META_KEY,
|
|
190
190
|
DAEMON_MODEL_PROMPT_META_KEY,
|
|
191
|
+
DAEMON_PROMPT_DISPLAY_TEXT_META_KEY,
|
|
191
192
|
LOAD_REPLAY_BULK_MODE,
|
|
192
193
|
LOAD_REPLAY_HIDE_INHERITED_META_KEY,
|
|
194
|
+
LOAD_REPLAY_MAX_BYTES,
|
|
195
|
+
LOAD_REPLAY_MAX_UPDATES,
|
|
193
196
|
LOAD_REPLAY_META_KEY,
|
|
194
197
|
LOAD_REPLAY_MODE_META_KEY,
|
|
195
198
|
LOAD_REPLAY_PAGE_SIZE_META_KEY,
|
|
@@ -202,7 +205,7 @@ import {
|
|
|
202
205
|
WORKTREE_MCP_DEFER_META_KEY,
|
|
203
206
|
clampActiveWorkIntervalMs,
|
|
204
207
|
isValidTrustedModelPrompt
|
|
205
|
-
} from "./chunk-
|
|
208
|
+
} from "./chunk-UFHPAMAV.js";
|
|
206
209
|
import {
|
|
207
210
|
NOT_CURRENTLY_GENERATING_CANCEL_MESSAGE,
|
|
208
211
|
isNotCurrentlyGeneratingCancelError
|
|
@@ -210,7 +213,7 @@ import {
|
|
|
210
213
|
import "./chunk-6PLDPT2C.js";
|
|
211
214
|
import "./chunk-FYJ7W2PI.js";
|
|
212
215
|
import "./chunk-YP5KH5Y7.js";
|
|
213
|
-
import "./chunk-
|
|
216
|
+
import "./chunk-JW5UEE3V.js";
|
|
214
217
|
import "./chunk-ALMR3E6Q.js";
|
|
215
218
|
import "./chunk-HIBNSEJE.js";
|
|
216
219
|
import "./chunk-M5GB774H.js";
|
|
@@ -221,20 +224,20 @@ import {
|
|
|
221
224
|
PRIVATE_EXTERNAL_TOOL_GUARD_ENV,
|
|
222
225
|
isValidExternalToolGuardDenialReason
|
|
223
226
|
} from "./chunk-BKHCW2BI.js";
|
|
224
|
-
import "./chunk-
|
|
227
|
+
import "./chunk-7JL5YBSA.js";
|
|
225
228
|
import {
|
|
226
229
|
ACP_EVENT_LOOP_STALL_RESTART_MS,
|
|
227
230
|
CHANNEL_PROMPT_META_KEY
|
|
228
|
-
} from "./chunk-
|
|
231
|
+
} from "./chunk-ADJDLEVO.js";
|
|
229
232
|
import {
|
|
230
233
|
AgentSideConnection,
|
|
231
234
|
PROTOCOL_VERSION,
|
|
232
235
|
RequestError
|
|
233
|
-
} from "./chunk-
|
|
236
|
+
} from "./chunk-IW6RQPQB.js";
|
|
234
237
|
import {
|
|
235
238
|
assembleMcpServers,
|
|
236
239
|
loadMcpApprovals
|
|
237
|
-
} from "./chunk-
|
|
240
|
+
} from "./chunk-SNPOURNX.js";
|
|
238
241
|
import {
|
|
239
242
|
getOutputLanguageFilePath,
|
|
240
243
|
getPersistScopeForModelSelection,
|
|
@@ -243,8 +246,8 @@ import {
|
|
|
243
246
|
resolveOutputLanguageOrPreserveAuto,
|
|
244
247
|
updateOutputLanguageFile,
|
|
245
248
|
writeOutputLanguageAndRegisterPath
|
|
246
|
-
} from "./chunk-
|
|
247
|
-
import "./chunk-
|
|
249
|
+
} from "./chunk-LY2SB7GC.js";
|
|
250
|
+
import "./chunk-JLT5HCGQ.js";
|
|
248
251
|
import "./chunk-RKUWKYED.js";
|
|
249
252
|
import "./chunk-GOXKNSDZ.js";
|
|
250
253
|
import {
|
|
@@ -254,7 +257,7 @@ import {
|
|
|
254
257
|
import {
|
|
255
258
|
getCurrentLanguage,
|
|
256
259
|
setLanguageAsync
|
|
257
|
-
} from "./chunk-
|
|
260
|
+
} from "./chunk-SESSAEWC.js";
|
|
258
261
|
import {
|
|
259
262
|
SUPPORTED_LANGUAGES
|
|
260
263
|
} from "./chunk-5EJZE3FP.js";
|
|
@@ -262,18 +265,18 @@ import {
|
|
|
262
265
|
findEnvFiles,
|
|
263
266
|
preResolveHomeEnvOverrides,
|
|
264
267
|
reloadEnvironment
|
|
265
|
-
} from "./chunk-
|
|
268
|
+
} from "./chunk-L6PE52MF.js";
|
|
266
269
|
import {
|
|
267
270
|
ENV_ACP_REPEATED_TOOL_FAILURE_GUARD
|
|
268
|
-
} from "./chunk-
|
|
269
|
-
import "./chunk-
|
|
270
|
-
import "./chunk-
|
|
271
|
-
import "./chunk-
|
|
271
|
+
} from "./chunk-MS7GNABG.js";
|
|
272
|
+
import "./chunk-IAE7LYSB.js";
|
|
273
|
+
import "./chunk-DANYMI4U.js";
|
|
274
|
+
import "./chunk-WZMH7II3.js";
|
|
272
275
|
import {
|
|
273
276
|
isFolderTrustEnabled,
|
|
274
277
|
isWorkspaceTrusted,
|
|
275
278
|
loadTrustedFolders
|
|
276
|
-
} from "./chunk-
|
|
279
|
+
} from "./chunk-ZM6LZON7.js";
|
|
277
280
|
import "./chunk-NPQ5ZKRP.js";
|
|
278
281
|
import "./chunk-MR3PXB6E.js";
|
|
279
282
|
import "./chunk-XFSFZCM5.js";
|
|
@@ -326,7 +329,7 @@ import {
|
|
|
326
329
|
buildPermissionCheckContext,
|
|
327
330
|
buildSessionRecoveryPlanFromApiHistory,
|
|
328
331
|
clampInlineMediaPart,
|
|
329
|
-
|
|
332
|
+
collectSessionTurnState,
|
|
330
333
|
computeUniqueBranchTitle,
|
|
331
334
|
convertToFunctionErrorResponse,
|
|
332
335
|
convertToFunctionResponse,
|
|
@@ -343,7 +346,6 @@ import {
|
|
|
343
346
|
evaluatePlanModeShellPolicy,
|
|
344
347
|
evaluateToolInvocationGuard,
|
|
345
348
|
finalizeToolResponses,
|
|
346
|
-
findBoundaryAtOrBefore,
|
|
347
349
|
findExistingProviderModels,
|
|
348
350
|
findPlanModeEntryBatchBoundaryIndex,
|
|
349
351
|
findProviderById,
|
|
@@ -376,7 +378,6 @@ import {
|
|
|
376
378
|
isDenialFallbackReason,
|
|
377
379
|
isGatedMcpScope,
|
|
378
380
|
isPlanModeBlocked,
|
|
379
|
-
isReplayTurnStartType,
|
|
380
381
|
markDuplicateProviderToolCallResponseSent,
|
|
381
382
|
matchesAnyServerPattern,
|
|
382
383
|
mcpServerRequiresOAuth,
|
|
@@ -384,6 +385,7 @@ import {
|
|
|
384
385
|
normalizeEventPayload,
|
|
385
386
|
normalizeSnapshotPayload,
|
|
386
387
|
persistPermissionOutcome,
|
|
388
|
+
projectGoalStateToLegacy,
|
|
387
389
|
readManyFiles,
|
|
388
390
|
recordAllow,
|
|
389
391
|
recordFallbackApprove,
|
|
@@ -395,8 +397,6 @@ import {
|
|
|
395
397
|
runForkedAgent,
|
|
396
398
|
runManagedAutoMemoryDream,
|
|
397
399
|
runManagedRememberByAgent,
|
|
398
|
-
sessionIdContext,
|
|
399
|
-
setGoalTerminalObserver,
|
|
400
400
|
shouldClassifyAllShellForAutoMode,
|
|
401
401
|
shouldFallback,
|
|
402
402
|
shouldFirePermissionDeniedForAutoMode,
|
|
@@ -404,29 +404,29 @@ import {
|
|
|
404
404
|
shouldHaltOnTurnToolCallCap,
|
|
405
405
|
shouldRunAutoModeForCall,
|
|
406
406
|
subagentGenerator,
|
|
407
|
-
|
|
407
|
+
truncateNotificationLabel,
|
|
408
408
|
updateSetting,
|
|
409
409
|
validatePlanModeShellApproval,
|
|
410
410
|
validatePlanModeShellContext
|
|
411
|
-
} from "./chunk-
|
|
411
|
+
} from "./chunk-WH32GXQS.js";
|
|
412
412
|
import "./chunk-GOFAQQZA.js";
|
|
413
413
|
import "./chunk-5M6IDOMF.js";
|
|
414
414
|
import "./chunk-TWPJO254.js";
|
|
415
415
|
import {
|
|
416
416
|
external_exports
|
|
417
|
-
} from "./chunk-
|
|
418
|
-
import "./chunk-
|
|
419
|
-
import "./chunk-
|
|
420
|
-
import "./chunk-
|
|
421
|
-
import "./chunk-
|
|
417
|
+
} from "./chunk-CQ35AJ4Z.js";
|
|
418
|
+
import "./chunk-NM33GGOM.js";
|
|
419
|
+
import "./chunk-A4BAHMJF.js";
|
|
420
|
+
import "./chunk-ZPZANKVP.js";
|
|
421
|
+
import "./chunk-A6GQUQ7I.js";
|
|
422
422
|
import {
|
|
423
423
|
parsePositiveIntegerEnv
|
|
424
424
|
} from "./chunk-6PVPNMXU.js";
|
|
425
|
-
import "./chunk-
|
|
425
|
+
import "./chunk-F4BUGC4Y.js";
|
|
426
426
|
import "./chunk-IRH27ZC2.js";
|
|
427
427
|
import "./chunk-QHWCP53L.js";
|
|
428
|
-
import "./chunk-
|
|
429
|
-
import "./chunk-
|
|
428
|
+
import "./chunk-AAZWJAPQ.js";
|
|
429
|
+
import "./chunk-7WUMS2UA.js";
|
|
430
430
|
import {
|
|
431
431
|
promptIdContext,
|
|
432
432
|
todoWorkChainContext
|
|
@@ -434,53 +434,60 @@ import {
|
|
|
434
434
|
import "./chunk-T26EAKDL.js";
|
|
435
435
|
import "./chunk-ZPJWUGCS.js";
|
|
436
436
|
import "./chunk-CPBF7KYF.js";
|
|
437
|
-
import "./chunk-
|
|
437
|
+
import "./chunk-KTWUFHS4.js";
|
|
438
438
|
import "./chunk-KRXPRVGL.js";
|
|
439
439
|
import {
|
|
440
440
|
HookEventName,
|
|
441
441
|
createHookOutput
|
|
442
|
-
} from "./chunk-
|
|
443
|
-
import "./chunk-
|
|
444
|
-
import "./chunk-
|
|
442
|
+
} from "./chunk-2ASWIM4A.js";
|
|
443
|
+
import "./chunk-67F2BEYW.js";
|
|
444
|
+
import "./chunk-TNETSI2A.js";
|
|
445
445
|
import {
|
|
446
|
+
GoalPersistenceUnavailableError,
|
|
447
|
+
emptyGoalSnapshot,
|
|
448
|
+
goalTurnContext,
|
|
449
|
+
parseGoalSnapshotV2,
|
|
450
|
+
parseGoalStateCause,
|
|
446
451
|
wrapUserPromptSubmitContext
|
|
447
|
-
} from "./chunk-
|
|
452
|
+
} from "./chunk-B66LYK4B.js";
|
|
448
453
|
import {
|
|
449
454
|
APPROVAL_MODES
|
|
450
|
-
} from "./chunk-
|
|
451
|
-
import "./chunk-
|
|
455
|
+
} from "./chunk-SNHBRO4C.js";
|
|
456
|
+
import "./chunk-OUCCIS3E.js";
|
|
452
457
|
import {
|
|
458
|
+
addDaemonRequestAttribute,
|
|
453
459
|
addToolArgumentsAttributes,
|
|
454
460
|
addToolCallResultAttributes,
|
|
455
461
|
extractDaemonTraceContext,
|
|
456
462
|
registerAcpEventLoopLagGauge,
|
|
457
463
|
startEventLoopLagMonitor,
|
|
458
464
|
withDaemonSpan
|
|
459
|
-
} from "./chunk-
|
|
465
|
+
} from "./chunk-U3O2EO5Y.js";
|
|
460
466
|
import "./chunk-SAH4BD2J.js";
|
|
467
|
+
import "./chunk-66PLFJQ7.js";
|
|
461
468
|
import {
|
|
462
469
|
runWithRuntimeContentGenerator
|
|
463
|
-
} from "./chunk-
|
|
470
|
+
} from "./chunk-SKRHR6N2.js";
|
|
464
471
|
import "./chunk-S6LOFUVP.js";
|
|
465
472
|
import "./chunk-2J3OJGTL.js";
|
|
466
473
|
import {
|
|
467
474
|
FORK_SUBAGENT_TYPE,
|
|
468
475
|
getStartupContextLength,
|
|
469
476
|
isSystemReminderContent
|
|
470
|
-
} from "./chunk-
|
|
477
|
+
} from "./chunk-TROB4PZY.js";
|
|
471
478
|
import "./chunk-K623ENWT.js";
|
|
472
479
|
import "./chunk-AQ37AY7B.js";
|
|
473
|
-
import "./chunk-
|
|
480
|
+
import "./chunk-UHF5VBKO.js";
|
|
474
481
|
import {
|
|
475
482
|
clearCachedCredentialFile,
|
|
476
483
|
qwenOAuth2Events
|
|
477
|
-
} from "./chunk-
|
|
484
|
+
} from "./chunk-MMEDZKWK.js";
|
|
478
485
|
import "./chunk-NAVJD2PQ.js";
|
|
479
|
-
import "./chunk-
|
|
480
|
-
import "./chunk-
|
|
486
|
+
import "./chunk-YI5G32RU.js";
|
|
487
|
+
import "./chunk-QEWAHAW2.js";
|
|
481
488
|
import "./chunk-P3QQPMQA.js";
|
|
482
|
-
import "./chunk-
|
|
483
|
-
import "./chunk-
|
|
489
|
+
import "./chunk-FTGU6G45.js";
|
|
490
|
+
import "./chunk-PSTHNTHF.js";
|
|
484
491
|
import {
|
|
485
492
|
REASONING_EFFORT_TIERS,
|
|
486
493
|
applyReasoningEffort
|
|
@@ -491,7 +498,7 @@ import {
|
|
|
491
498
|
getToolCallPreparations
|
|
492
499
|
} from "./chunk-GLCZKT5V.js";
|
|
493
500
|
import "./chunk-DJ2GSRLV.js";
|
|
494
|
-
import "./chunk-
|
|
501
|
+
import "./chunk-KK3FEHPJ.js";
|
|
495
502
|
import {
|
|
496
503
|
ConversationFinishedEvent,
|
|
497
504
|
DiscoveredMCPTool,
|
|
@@ -502,6 +509,7 @@ import {
|
|
|
502
509
|
PromptSuggestionEvent,
|
|
503
510
|
RepeatedToolFailureGuardEvent,
|
|
504
511
|
UserPromptEvent,
|
|
512
|
+
apiActivityTracker,
|
|
505
513
|
formatFullTurnVisionNotice,
|
|
506
514
|
formatVisionBridgeNotice,
|
|
507
515
|
getAllGeminiMdFilenames,
|
|
@@ -523,17 +531,17 @@ import {
|
|
|
523
531
|
shouldRunVisionBridge,
|
|
524
532
|
splitImageParts,
|
|
525
533
|
uiTelemetryService
|
|
526
|
-
} from "./chunk-
|
|
527
|
-
import "./chunk-
|
|
534
|
+
} from "./chunk-LAKFZU36.js";
|
|
535
|
+
import "./chunk-YRLW2MSX.js";
|
|
528
536
|
import "./chunk-VGC4I5JJ.js";
|
|
529
537
|
import {
|
|
530
538
|
getAutoMemoryRoot,
|
|
531
539
|
getUserAutoMemoryRoot
|
|
532
|
-
} from "./chunk-
|
|
540
|
+
} from "./chunk-6OJDN5ZT.js";
|
|
533
541
|
import {
|
|
534
542
|
runSideQuery
|
|
535
|
-
} from "./chunk-
|
|
536
|
-
import "./chunk-
|
|
543
|
+
} from "./chunk-JRTJEGSP.js";
|
|
544
|
+
import "./chunk-C2DR57L6.js";
|
|
537
545
|
import {
|
|
538
546
|
BaseDeclarativeTool,
|
|
539
547
|
BaseToolInvocation,
|
|
@@ -541,20 +549,20 @@ import {
|
|
|
541
549
|
ToolNames,
|
|
542
550
|
canonicalToolName,
|
|
543
551
|
isShellProgressData
|
|
544
|
-
} from "./chunk-
|
|
552
|
+
} from "./chunk-ZRT36RSF.js";
|
|
545
553
|
import {
|
|
546
554
|
AuthType,
|
|
547
555
|
preloadContentGenerator
|
|
548
|
-
} from "./chunk-
|
|
556
|
+
} from "./chunk-RTBUTKAX.js";
|
|
549
557
|
import "./chunk-F6WFNA7U.js";
|
|
550
558
|
import "./chunk-46UV252V.js";
|
|
551
559
|
import {
|
|
552
560
|
DEFAULT_TOKEN_LIMIT,
|
|
553
561
|
tokenLimit
|
|
554
|
-
} from "./chunk-
|
|
555
|
-
import "./chunk-
|
|
556
|
-
import "./chunk-
|
|
557
|
-
import "./chunk-
|
|
562
|
+
} from "./chunk-FPGTNKCP.js";
|
|
563
|
+
import "./chunk-H6BFLALJ.js";
|
|
564
|
+
import "./chunk-O6SLWH4X.js";
|
|
565
|
+
import "./chunk-NW7SPXVG.js";
|
|
558
566
|
import {
|
|
559
567
|
endToolExecutionSpan,
|
|
560
568
|
endToolSpan,
|
|
@@ -563,21 +571,23 @@ import {
|
|
|
563
571
|
startToolExecutionSpan,
|
|
564
572
|
startToolSpan,
|
|
565
573
|
withInteractionSpan
|
|
566
|
-
} from "./chunk-
|
|
567
|
-
import "./chunk-
|
|
568
|
-
import
|
|
574
|
+
} from "./chunk-7UNST76G.js";
|
|
575
|
+
import "./chunk-HHJLM3WQ.js";
|
|
576
|
+
import {
|
|
577
|
+
sessionIdContext
|
|
578
|
+
} from "./chunk-K5IDV3PC.js";
|
|
569
579
|
import {
|
|
570
580
|
Storage,
|
|
571
581
|
createDebugLogger,
|
|
572
582
|
getErrorMessage,
|
|
573
583
|
getErrorStatus,
|
|
574
584
|
isSubpath
|
|
575
|
-
} from "./chunk-
|
|
585
|
+
} from "./chunk-YMB77M76.js";
|
|
576
586
|
import "./chunk-VOQXFAY5.js";
|
|
577
|
-
import "./chunk-
|
|
587
|
+
import "./chunk-YPITLFHS.js";
|
|
578
588
|
import {
|
|
579
589
|
runExitCleanup
|
|
580
|
-
} from "./chunk-
|
|
590
|
+
} from "./chunk-DX7V233D.js";
|
|
581
591
|
import {
|
|
582
592
|
writeStderrLine,
|
|
583
593
|
writeStderrLineSafe
|
|
@@ -1424,6 +1434,86 @@ function prefixMidTurnUserMessageParts(parts, displayText) {
|
|
|
1424
1434
|
}
|
|
1425
1435
|
__name(prefixMidTurnUserMessageParts, "prefixMidTurnUserMessageParts");
|
|
1426
1436
|
|
|
1437
|
+
// packages/cli/src/ui/utils/restoreGoal.ts
|
|
1438
|
+
init_esbuild_shims();
|
|
1439
|
+
function findGoalToRestore(history) {
|
|
1440
|
+
for (let i = history.length - 1; i >= 0; i--) {
|
|
1441
|
+
const item = history[i];
|
|
1442
|
+
if (item?.type !== "goal_status" /* GOAL_STATUS */) continue;
|
|
1443
|
+
const goal = item;
|
|
1444
|
+
if (goal.kind !== "set" && goal.kind !== "checking") return null;
|
|
1445
|
+
const setAt = goal.setAt ?? findSetAtOfRun(history, i);
|
|
1446
|
+
return {
|
|
1447
|
+
condition: goal.condition,
|
|
1448
|
+
iterations: goal.iterations ?? 0,
|
|
1449
|
+
...setAt !== void 0 ? { setAt } : {}
|
|
1450
|
+
};
|
|
1451
|
+
}
|
|
1452
|
+
return null;
|
|
1453
|
+
}
|
|
1454
|
+
__name(findGoalToRestore, "findGoalToRestore");
|
|
1455
|
+
function findSetAtOfRun(history, startIndex) {
|
|
1456
|
+
const start = history[startIndex];
|
|
1457
|
+
const condition = start?.condition;
|
|
1458
|
+
for (let i = startIndex - 1; i >= 0; i--) {
|
|
1459
|
+
const item = history[i];
|
|
1460
|
+
if (item?.type !== "goal_status" /* GOAL_STATUS */) continue;
|
|
1461
|
+
const goal = item;
|
|
1462
|
+
if (goal.kind !== "set" && goal.kind !== "checking") return void 0;
|
|
1463
|
+
if (goal.condition !== condition) return void 0;
|
|
1464
|
+
if (goal.setAt !== void 0) return goal.setAt;
|
|
1465
|
+
}
|
|
1466
|
+
return void 0;
|
|
1467
|
+
}
|
|
1468
|
+
__name(findSetAtOfRun, "findSetAtOfRun");
|
|
1469
|
+
function finiteNumber(value) {
|
|
1470
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
1471
|
+
}
|
|
1472
|
+
__name(finiteNumber, "finiteNumber");
|
|
1473
|
+
function isTranscriptItemRecord(item) {
|
|
1474
|
+
return typeof item === "object" && item !== null && !Array.isArray(item);
|
|
1475
|
+
}
|
|
1476
|
+
__name(isTranscriptItemRecord, "isTranscriptItemRecord");
|
|
1477
|
+
function parseGoalStatusItem(item) {
|
|
1478
|
+
if (!isTranscriptItemRecord(item)) return null;
|
|
1479
|
+
if (item["type"] !== "goal_status" /* GOAL_STATUS */) return null;
|
|
1480
|
+
const kind = item["kind"];
|
|
1481
|
+
const condition = item["condition"];
|
|
1482
|
+
if (!isGoalStatusKind(kind) || typeof condition !== "string") return null;
|
|
1483
|
+
const iterations = finiteNumber(item["iterations"]);
|
|
1484
|
+
const setAt = finiteNumber(item["setAt"]);
|
|
1485
|
+
const durationMs = finiteNumber(item["durationMs"]);
|
|
1486
|
+
const lastReason = typeof item["lastReason"] === "string" ? item["lastReason"] : void 0;
|
|
1487
|
+
return {
|
|
1488
|
+
type: "goal_status" /* GOAL_STATUS */,
|
|
1489
|
+
kind,
|
|
1490
|
+
condition,
|
|
1491
|
+
...iterations !== void 0 ? { iterations } : {},
|
|
1492
|
+
...setAt !== void 0 ? { setAt } : {},
|
|
1493
|
+
...durationMs !== void 0 ? { durationMs } : {},
|
|
1494
|
+
...lastReason !== void 0 ? { lastReason } : {}
|
|
1495
|
+
};
|
|
1496
|
+
}
|
|
1497
|
+
__name(parseGoalStatusItem, "parseGoalStatusItem");
|
|
1498
|
+
function collectGoalStatusItemsFromRecords(records) {
|
|
1499
|
+
const items = [];
|
|
1500
|
+
for (const record of records) {
|
|
1501
|
+
if (record.type !== "system" || record.subtype !== "slash_command") {
|
|
1502
|
+
continue;
|
|
1503
|
+
}
|
|
1504
|
+
const payload = record.systemPayload;
|
|
1505
|
+
if (payload?.phase !== "result") continue;
|
|
1506
|
+
const raws = payload.outputHistoryItems;
|
|
1507
|
+
if (!Array.isArray(raws)) continue;
|
|
1508
|
+
for (const raw of raws) {
|
|
1509
|
+
const item = parseGoalStatusItem(raw);
|
|
1510
|
+
if (item) items.push(item);
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
return items;
|
|
1514
|
+
}
|
|
1515
|
+
__name(collectGoalStatusItemsFromRecords, "collectGoalStatusItemsFromRecords");
|
|
1516
|
+
|
|
1427
1517
|
// packages/cli/src/acp-integration/session/tool-call-preparation-tracker.ts
|
|
1428
1518
|
init_esbuild_shims();
|
|
1429
1519
|
var ToolCallPreparationTracker = class {
|
|
@@ -1497,6 +1587,261 @@ var ToolCallPreparationTracker = class {
|
|
|
1497
1587
|
}
|
|
1498
1588
|
};
|
|
1499
1589
|
|
|
1590
|
+
// packages/cli/src/acp-integration/session/emitters/MessageEmitter.ts
|
|
1591
|
+
init_esbuild_shims();
|
|
1592
|
+
function buildGoalStatusUpdate(status) {
|
|
1593
|
+
return {
|
|
1594
|
+
sessionUpdate: "agent_message_chunk",
|
|
1595
|
+
content: { type: "text", text: "" },
|
|
1596
|
+
_meta: {
|
|
1597
|
+
goalStatus: status
|
|
1598
|
+
}
|
|
1599
|
+
};
|
|
1600
|
+
}
|
|
1601
|
+
__name(buildGoalStatusUpdate, "buildGoalStatusUpdate");
|
|
1602
|
+
function buildGoalStateUpdate(snapshot, cause, previousGoal = null) {
|
|
1603
|
+
const projection = cause ? projectGoalStateToLegacy({ v: 2, cause, snapshot }, previousGoal) : void 0;
|
|
1604
|
+
const goalStatus = projection ? (() => {
|
|
1605
|
+
const { type: _type, ...status } = projection.goalStatus;
|
|
1606
|
+
return status;
|
|
1607
|
+
})() : void 0;
|
|
1608
|
+
return {
|
|
1609
|
+
sessionUpdate: "agent_message_chunk",
|
|
1610
|
+
content: { type: "text", text: "" },
|
|
1611
|
+
_meta: {
|
|
1612
|
+
goalState: snapshot,
|
|
1613
|
+
...goalStatus ? { goalStatus } : {},
|
|
1614
|
+
...projection?.goalTerminal ? { goalTerminal: projection.goalTerminal } : {}
|
|
1615
|
+
}
|
|
1616
|
+
};
|
|
1617
|
+
}
|
|
1618
|
+
__name(buildGoalStateUpdate, "buildGoalStateUpdate");
|
|
1619
|
+
var MessageEmitter = class extends BaseEmitter {
|
|
1620
|
+
static {
|
|
1621
|
+
__name(this, "MessageEmitter");
|
|
1622
|
+
}
|
|
1623
|
+
/**
|
|
1624
|
+
* Emits a StopHookLoop event when Stop hooks create a loop.
|
|
1625
|
+
* This informs the client that Stop hooks have been executed multiple times.
|
|
1626
|
+
*
|
|
1627
|
+
* @param iterationCount - The current iteration count
|
|
1628
|
+
* @param reasons - Array of reasons from each Stop hook execution
|
|
1629
|
+
* @param stopHookCount - Number of Stop hooks that were executed
|
|
1630
|
+
*/
|
|
1631
|
+
async emitStopHookLoop(iterationCount, reasons, stopHookCount) {
|
|
1632
|
+
const activeGoal = getActiveGoal(this.sessionId);
|
|
1633
|
+
await this.sendUpdate({
|
|
1634
|
+
sessionUpdate: "agent_message_chunk",
|
|
1635
|
+
content: { type: "text", text: "" },
|
|
1636
|
+
_meta: {
|
|
1637
|
+
stopHookLoop: {
|
|
1638
|
+
iterationCount,
|
|
1639
|
+
reasons,
|
|
1640
|
+
stopHookCount,
|
|
1641
|
+
...activeGoal ? {
|
|
1642
|
+
goal: {
|
|
1643
|
+
condition: activeGoal.condition,
|
|
1644
|
+
iterations: activeGoal.iterations,
|
|
1645
|
+
setAt: activeGoal.setAt,
|
|
1646
|
+
lastReason: activeGoal.lastReason
|
|
1647
|
+
}
|
|
1648
|
+
} : {}
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
});
|
|
1652
|
+
}
|
|
1653
|
+
async emitGoalStatus(status, goalState) {
|
|
1654
|
+
const update = buildGoalStatusUpdate(status);
|
|
1655
|
+
if (goalState) {
|
|
1656
|
+
update._meta = { ...update._meta, goalState };
|
|
1657
|
+
}
|
|
1658
|
+
await this.sendUpdate(update);
|
|
1659
|
+
}
|
|
1660
|
+
async emitGoalState(snapshot, cause, previousGoal = null) {
|
|
1661
|
+
await this.sendUpdate(buildGoalStateUpdate(snapshot, cause, previousGoal));
|
|
1662
|
+
}
|
|
1663
|
+
/**
|
|
1664
|
+
* Emits a user message chunk.
|
|
1665
|
+
*
|
|
1666
|
+
* @param text - The user message text content
|
|
1667
|
+
* @param timestamp - Optional server-side timestamp (ISO string or ms) for message ordering
|
|
1668
|
+
*/
|
|
1669
|
+
async emitUserMessage(text, timestamp, options = {}) {
|
|
1670
|
+
await this.sendUpdate(
|
|
1671
|
+
createTranscriptMessageUpdate({
|
|
1672
|
+
role: "user",
|
|
1673
|
+
text,
|
|
1674
|
+
timestamp,
|
|
1675
|
+
...options.source ? { extra: { source: options.source } } : {}
|
|
1676
|
+
})
|
|
1677
|
+
);
|
|
1678
|
+
}
|
|
1679
|
+
/**
|
|
1680
|
+
* Emits an agent thought chunk.
|
|
1681
|
+
*
|
|
1682
|
+
* @param text - The thought text content
|
|
1683
|
+
* @param timestamp - Optional server-side timestamp (ISO string or ms) for message ordering
|
|
1684
|
+
*/
|
|
1685
|
+
async emitAgentThought(text, timestamp, subagentMeta) {
|
|
1686
|
+
await this.sendUpdate(
|
|
1687
|
+
createTranscriptMessageUpdate({
|
|
1688
|
+
role: "assistant",
|
|
1689
|
+
thought: true,
|
|
1690
|
+
text,
|
|
1691
|
+
timestamp,
|
|
1692
|
+
...subagentMeta ? { extra: { ...subagentMeta } } : {}
|
|
1693
|
+
})
|
|
1694
|
+
);
|
|
1695
|
+
}
|
|
1696
|
+
/**
|
|
1697
|
+
* Emits an agent message chunk.
|
|
1698
|
+
*
|
|
1699
|
+
* @param text - The agent message text content
|
|
1700
|
+
* @param timestamp - Optional server-side timestamp (ISO string or ms) for message ordering
|
|
1701
|
+
*/
|
|
1702
|
+
async emitAgentMessage(text, timestamp, subagentMeta) {
|
|
1703
|
+
await this.sendUpdate(
|
|
1704
|
+
createTranscriptMessageUpdate({
|
|
1705
|
+
role: "assistant",
|
|
1706
|
+
text,
|
|
1707
|
+
timestamp,
|
|
1708
|
+
...subagentMeta ? { extra: { ...subagentMeta } } : {}
|
|
1709
|
+
})
|
|
1710
|
+
);
|
|
1711
|
+
}
|
|
1712
|
+
async emitSlashCommandOutput(text, timestamp) {
|
|
1713
|
+
const epochMs = BaseEmitter.toEpochMs(timestamp);
|
|
1714
|
+
await this.sendUpdate({
|
|
1715
|
+
sessionUpdate: "agent_message_chunk",
|
|
1716
|
+
content: { type: "text", text },
|
|
1717
|
+
_meta: {
|
|
1718
|
+
source: "slash_command",
|
|
1719
|
+
...epochMs != null ? { timestamp: epochMs } : {}
|
|
1720
|
+
}
|
|
1721
|
+
});
|
|
1722
|
+
}
|
|
1723
|
+
/**
|
|
1724
|
+
* Emits usage metadata.
|
|
1725
|
+
*/
|
|
1726
|
+
async emitUsageMetadata(usageMetadata, text = "", durationMs, subagentMeta) {
|
|
1727
|
+
const cumulative = this.ctx.cumulativeUsage;
|
|
1728
|
+
if (cumulative) {
|
|
1729
|
+
const addFinite = /* @__PURE__ */ __name((total, value) => typeof value === "number" && Number.isFinite(value) ? total + value : total, "addFinite");
|
|
1730
|
+
cumulative.promptTokens = addFinite(
|
|
1731
|
+
cumulative.promptTokens,
|
|
1732
|
+
usageMetadata.promptTokenCount
|
|
1733
|
+
);
|
|
1734
|
+
cumulative.candidateTokens = addFinite(
|
|
1735
|
+
cumulative.candidateTokens,
|
|
1736
|
+
usageMetadata.candidatesTokenCount
|
|
1737
|
+
);
|
|
1738
|
+
cumulative.cachedTokens = addFinite(
|
|
1739
|
+
cumulative.cachedTokens,
|
|
1740
|
+
usageMetadata.cachedContentTokenCount
|
|
1741
|
+
);
|
|
1742
|
+
cumulative.apiTimeMs = addFinite(cumulative.apiTimeMs, durationMs);
|
|
1743
|
+
}
|
|
1744
|
+
let activityMeta = {};
|
|
1745
|
+
if (typeof durationMs === "number") {
|
|
1746
|
+
const activity = apiActivityTracker.drain();
|
|
1747
|
+
activityMeta = {
|
|
1748
|
+
...activity.errors > 0 ? { apiErrors: activity.errors } : {},
|
|
1749
|
+
...activity.retries > 0 ? { apiRetries: activity.retries } : {}
|
|
1750
|
+
};
|
|
1751
|
+
}
|
|
1752
|
+
await this.sendUpdate(
|
|
1753
|
+
createTranscriptUsageUpdate(usageMetadata, {
|
|
1754
|
+
text,
|
|
1755
|
+
extra: {
|
|
1756
|
+
...typeof durationMs === "number" ? { durationMs } : {},
|
|
1757
|
+
...activityMeta,
|
|
1758
|
+
...subagentMeta
|
|
1759
|
+
}
|
|
1760
|
+
})
|
|
1761
|
+
);
|
|
1762
|
+
if (!Number.isFinite(durationMs) || subagentMeta || !hasFullSessionContext(this.ctx)) {
|
|
1763
|
+
return;
|
|
1764
|
+
}
|
|
1765
|
+
const used = usageMetadata.promptTokenCount ?? usageMetadata.totalTokenCount;
|
|
1766
|
+
const size = this.ctx.config.getContentGeneratorConfig()?.contextWindowSize;
|
|
1767
|
+
if (typeof used !== "number" || !Number.isSafeInteger(used) || used < 0 || typeof size !== "number" || !Number.isSafeInteger(size) || size <= 0) {
|
|
1768
|
+
return;
|
|
1769
|
+
}
|
|
1770
|
+
await this.sendUpdate({
|
|
1771
|
+
sessionUpdate: "usage_update",
|
|
1772
|
+
used,
|
|
1773
|
+
size
|
|
1774
|
+
});
|
|
1775
|
+
}
|
|
1776
|
+
/**
|
|
1777
|
+
* Emits a message chunk based on role and thought flag.
|
|
1778
|
+
* This is the unified method that handles all message types.
|
|
1779
|
+
*
|
|
1780
|
+
* @param text - The message text content
|
|
1781
|
+
* @param role - Whether this is a user or assistant message
|
|
1782
|
+
* @param isThought - Whether this is an assistant thought (only applies to assistant role)
|
|
1783
|
+
* @param timestamp - Optional server-side timestamp (ISO string or ms) for message ordering
|
|
1784
|
+
*/
|
|
1785
|
+
async emitMessage(text, role, isThought = false, timestamp, subagentMeta) {
|
|
1786
|
+
if (role === "user") {
|
|
1787
|
+
return this.emitUserMessage(text, timestamp);
|
|
1788
|
+
}
|
|
1789
|
+
return isThought ? this.emitAgentThought(text, timestamp, subagentMeta) : this.emitAgentMessage(text, timestamp, subagentMeta);
|
|
1790
|
+
}
|
|
1791
|
+
};
|
|
1792
|
+
|
|
1793
|
+
// packages/cli/src/acp-integration/session/recovered-goal-update.ts
|
|
1794
|
+
init_esbuild_shims();
|
|
1795
|
+
async function renderPreparedGoalUpdate(getRuntime, options = {}) {
|
|
1796
|
+
let runtime;
|
|
1797
|
+
try {
|
|
1798
|
+
runtime = await getRuntime();
|
|
1799
|
+
} catch (error) {
|
|
1800
|
+
if (!(error instanceof GoalPersistenceUnavailableError)) throw error;
|
|
1801
|
+
const status = unrestorableGoalStatus(
|
|
1802
|
+
options.replayedRecords,
|
|
1803
|
+
options.bootstrap
|
|
1804
|
+
);
|
|
1805
|
+
return { updates: status ? [buildGoalStatusUpdate(status)] : [] };
|
|
1806
|
+
}
|
|
1807
|
+
const cause = runtime.getRecoveryCause?.();
|
|
1808
|
+
if (!cause) return { updates: [] };
|
|
1809
|
+
const snapshot = runtime.getSnapshot();
|
|
1810
|
+
const publicationKey = goalPublicationKey(snapshot, cause);
|
|
1811
|
+
if (options.hideRuntimeGoal) {
|
|
1812
|
+
return {
|
|
1813
|
+
publicationKey,
|
|
1814
|
+
...snapshot.goal ? {
|
|
1815
|
+
suppressedGoalId: snapshot.goal.goalId
|
|
1816
|
+
} : {},
|
|
1817
|
+
updates: []
|
|
1818
|
+
};
|
|
1819
|
+
}
|
|
1820
|
+
const bootstrapGoal = options.bootstrap?.goalState?.goal;
|
|
1821
|
+
const bootstrapMatchesRuntime = bootstrapGoal != null && snapshot.goal?.goalId === bootstrapGoal.goalId && snapshot.goal?.revision === bootstrapGoal.revision;
|
|
1822
|
+
return {
|
|
1823
|
+
publicationKey,
|
|
1824
|
+
updates: options.bootstrap && bootstrapMatchesRuntime ? [] : [buildGoalStateUpdate(snapshot, cause, options.previousGoal ?? null)]
|
|
1825
|
+
};
|
|
1826
|
+
}
|
|
1827
|
+
__name(renderPreparedGoalUpdate, "renderPreparedGoalUpdate");
|
|
1828
|
+
function unrestorableGoalStatus(replayedRecords, bootstrap) {
|
|
1829
|
+
const active = (replayedRecords?.length ? findGoalToRestore(collectGoalStatusItemsFromRecords(replayedRecords)) : void 0) ?? bootstrap?.goalStatus;
|
|
1830
|
+
if (!active) return void 0;
|
|
1831
|
+
return {
|
|
1832
|
+
kind: "cleared",
|
|
1833
|
+
condition: active.condition,
|
|
1834
|
+
iterations: active.iterations,
|
|
1835
|
+
...active.setAt !== void 0 ? { setAt: active.setAt } : {},
|
|
1836
|
+
lastReason: "Goal not restored: its saved state could not be read, so this session is not driving it."
|
|
1837
|
+
};
|
|
1838
|
+
}
|
|
1839
|
+
__name(unrestorableGoalStatus, "unrestorableGoalStatus");
|
|
1840
|
+
function goalPublicationKey(snapshot, cause) {
|
|
1841
|
+
return cause ? `${cause}:${JSON.stringify(snapshot)}` : void 0;
|
|
1842
|
+
}
|
|
1843
|
+
__name(goalPublicationKey, "goalPublicationKey");
|
|
1844
|
+
|
|
1500
1845
|
// packages/cli/src/acp-integration/session/SubAgentTracker.ts
|
|
1501
1846
|
init_esbuild_shims();
|
|
1502
1847
|
|
|
@@ -2678,6 +3023,7 @@ __name(reduceRepeatedToolFailureGuard, "reduceRepeatedToolFailureGuard");
|
|
|
2678
3023
|
var debugLogger6 = createDebugLogger("SESSION");
|
|
2679
3024
|
var permissionRequestTails = /* @__PURE__ */ new WeakMap();
|
|
2680
3025
|
var USER_CANCEL_ABORT_REASON = "qwen:user-cancel";
|
|
3026
|
+
var NEW_PROMPT_ABORT_REASON = "qwen:new-prompt";
|
|
2681
3027
|
var SESSION_DISPOSE_ABORT_REASON = "qwen:session-dispose";
|
|
2682
3028
|
var DAEMON_RETRY_META_KEY = "qwen.daemon.retry";
|
|
2683
3029
|
var DAEMON_CONTINUE_META_KEY = "qwen.daemon.continueLastTurn";
|
|
@@ -2725,6 +3071,61 @@ function getAbortAwareEndTurnStopReason(signal) {
|
|
|
2725
3071
|
return signal.aborted ? "cancelled" : "end_turn";
|
|
2726
3072
|
}
|
|
2727
3073
|
__name(getAbortAwareEndTurnStopReason, "getAbortAwareEndTurnStopReason");
|
|
3074
|
+
function sameGoalPermit(left, right) {
|
|
3075
|
+
return left?.goalId === right.goalId && left.revision === right.revision && left.turnId === right.turnId;
|
|
3076
|
+
}
|
|
3077
|
+
__name(sameGoalPermit, "sameGoalPermit");
|
|
3078
|
+
function buildGoalContinuationParts(turn) {
|
|
3079
|
+
return [
|
|
3080
|
+
{
|
|
3081
|
+
text: [
|
|
3082
|
+
"Continue working on the active Goal.",
|
|
3083
|
+
"Use get_goal for the authoritative objective and evidence state.",
|
|
3084
|
+
"Follow the objective's requested output format exactly. Do not add progress, status, or completion commentary unless the objective asks for it.",
|
|
3085
|
+
"If completion depends on content delivered in this turn, deliver only that content and call get_goal in the same response before update_goal.",
|
|
3086
|
+
`Runtime continuation context: ${turn.continuationContext}`,
|
|
3087
|
+
...turn.verifierFeedback ? [`Verifier feedback: ${turn.verifierFeedback}`] : []
|
|
3088
|
+
].join("\n")
|
|
3089
|
+
}
|
|
3090
|
+
];
|
|
3091
|
+
}
|
|
3092
|
+
__name(buildGoalContinuationParts, "buildGoalContinuationParts");
|
|
3093
|
+
async function claimGoalTurn(runtime, turnKey, signal) {
|
|
3094
|
+
if (signal.aborted) return void 0;
|
|
3095
|
+
const immediate = runtime.permitForTurn(turnKey) ?? runtime.beginTurn(turnKey);
|
|
3096
|
+
if (immediate || runtime.getSnapshot().goal?.status !== "active") {
|
|
3097
|
+
return immediate;
|
|
3098
|
+
}
|
|
3099
|
+
return new Promise((resolve6, reject) => {
|
|
3100
|
+
let settled = false;
|
|
3101
|
+
let unsubscribe = /* @__PURE__ */ __name(() => {
|
|
3102
|
+
}, "unsubscribe");
|
|
3103
|
+
const finish = /* @__PURE__ */ __name((permit, error) => {
|
|
3104
|
+
if (settled) return;
|
|
3105
|
+
settled = true;
|
|
3106
|
+
unsubscribe();
|
|
3107
|
+
signal.removeEventListener("abort", onAbort);
|
|
3108
|
+
if (error !== void 0) reject(error);
|
|
3109
|
+
else resolve6(permit);
|
|
3110
|
+
}, "finish");
|
|
3111
|
+
const inspect = /* @__PURE__ */ __name(() => {
|
|
3112
|
+
try {
|
|
3113
|
+
const permit = runtime.permitForTurn(turnKey);
|
|
3114
|
+
if (permit || runtime.getSnapshot().goal?.status !== "active") {
|
|
3115
|
+
finish(permit);
|
|
3116
|
+
}
|
|
3117
|
+
} catch (error) {
|
|
3118
|
+
finish(void 0, error);
|
|
3119
|
+
}
|
|
3120
|
+
}, "inspect");
|
|
3121
|
+
const onAbort = /* @__PURE__ */ __name(() => finish(void 0), "onAbort");
|
|
3122
|
+
unsubscribe = runtime.subscribe(inspect);
|
|
3123
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
3124
|
+
if (signal.aborted) onAbort();
|
|
3125
|
+
else inspect();
|
|
3126
|
+
});
|
|
3127
|
+
}
|
|
3128
|
+
__name(claimGoalTurn, "claimGoalTurn");
|
|
2728
3129
|
var DAEMON_INVALID_TOOL_PARAMS_THRESHOLD = 3;
|
|
2729
3130
|
var PERMISSION_CANCEL_SKIP_MESSAGE = "Skipped because a permission request was cancelled before the user answered; user input is required before continuing.";
|
|
2730
3131
|
var LOOP_DETECTED_SKIP_MESSAGE = "Skipped because loop detection stopped the current turn before this tool call could run.";
|
|
@@ -3136,28 +3537,6 @@ function resolveHomeLoopResolverRoots({
|
|
|
3136
3537
|
};
|
|
3137
3538
|
}
|
|
3138
3539
|
__name(resolveHomeLoopResolverRoots, "resolveHomeLoopResolverRoots");
|
|
3139
|
-
function computeInitialTurnFromHistory(records, sessionId) {
|
|
3140
|
-
let maxPromptTurn = 0;
|
|
3141
|
-
let userMessageCount = 0;
|
|
3142
|
-
const promptIdPrefix = `${sessionId}########`;
|
|
3143
|
-
for (const record of records) {
|
|
3144
|
-
if (record.sessionId === sessionId && isUserPromptRecord(record)) {
|
|
3145
|
-
userMessageCount += 1;
|
|
3146
|
-
}
|
|
3147
|
-
for (const promptId of getRecordPromptIds(record)) {
|
|
3148
|
-
if (!promptId.startsWith(promptIdPrefix)) {
|
|
3149
|
-
continue;
|
|
3150
|
-
}
|
|
3151
|
-
const suffix = promptId.slice(promptIdPrefix.length);
|
|
3152
|
-
if (!/^\d+$/.test(suffix)) {
|
|
3153
|
-
continue;
|
|
3154
|
-
}
|
|
3155
|
-
maxPromptTurn = Math.max(maxPromptTurn, Number(suffix));
|
|
3156
|
-
}
|
|
3157
|
-
}
|
|
3158
|
-
return maxPromptTurn > 0 ? maxPromptTurn : userMessageCount;
|
|
3159
|
-
}
|
|
3160
|
-
__name(computeInitialTurnFromHistory, "computeInitialTurnFromHistory");
|
|
3161
3540
|
async function fireSessionPermissionDeniedForAutoMode(config, decision, outcome, toolName, toolParams, callId, signal) {
|
|
3162
3541
|
if (!config.getDisableAllHooks?.() && shouldFirePermissionDeniedForAutoMode(decision, outcome)) {
|
|
3163
3542
|
try {
|
|
@@ -3177,40 +3556,6 @@ async function fireSessionPermissionDeniedForAutoMode(config, decision, outcome,
|
|
|
3177
3556
|
}
|
|
3178
3557
|
}
|
|
3179
3558
|
__name(fireSessionPermissionDeniedForAutoMode, "fireSessionPermissionDeniedForAutoMode");
|
|
3180
|
-
function getRecordPromptIds(record) {
|
|
3181
|
-
const promptIds = [];
|
|
3182
|
-
const recordPromptId = record.promptId;
|
|
3183
|
-
if (typeof recordPromptId === "string") {
|
|
3184
|
-
promptIds.push(recordPromptId);
|
|
3185
|
-
}
|
|
3186
|
-
const telemetryPromptId = readTelemetryPromptId(record.systemPayload);
|
|
3187
|
-
if (telemetryPromptId) {
|
|
3188
|
-
promptIds.push(telemetryPromptId);
|
|
3189
|
-
}
|
|
3190
|
-
return promptIds;
|
|
3191
|
-
}
|
|
3192
|
-
__name(getRecordPromptIds, "getRecordPromptIds");
|
|
3193
|
-
function readTelemetryPromptId(payload) {
|
|
3194
|
-
if (!payload || typeof payload !== "object" || !("uiEvent" in payload)) {
|
|
3195
|
-
return void 0;
|
|
3196
|
-
}
|
|
3197
|
-
const uiEvent = payload.uiEvent;
|
|
3198
|
-
if (!uiEvent || typeof uiEvent !== "object" || !("prompt_id" in uiEvent)) {
|
|
3199
|
-
return void 0;
|
|
3200
|
-
}
|
|
3201
|
-
const promptId = uiEvent.prompt_id;
|
|
3202
|
-
return typeof promptId === "string" ? promptId : void 0;
|
|
3203
|
-
}
|
|
3204
|
-
__name(readTelemetryPromptId, "readTelemetryPromptId");
|
|
3205
|
-
function isUserPromptRecord(record) {
|
|
3206
|
-
if (record.type !== "user" || record.subtype === "realtime_message") {
|
|
3207
|
-
return false;
|
|
3208
|
-
}
|
|
3209
|
-
return record.message?.parts?.some(
|
|
3210
|
-
(part) => typeof part.text === "string" && part.text.trim().length > 0
|
|
3211
|
-
) ?? false;
|
|
3212
|
-
}
|
|
3213
|
-
__name(isUserPromptRecord, "isUserPromptRecord");
|
|
3214
3559
|
var AT_TOKEN_RE = /@([^\s,;!?()[\]{}]+)/g;
|
|
3215
3560
|
function collectExtensionMentionRefs(text, mentions) {
|
|
3216
3561
|
for (const match of text.matchAll(AT_TOKEN_RE)) {
|
|
@@ -3346,11 +3691,9 @@ var Session = class {
|
|
|
3346
3691
|
this.todoStopGuardBackgroundBaseline = this.#captureTodoStopGuardBackgroundBaseline();
|
|
3347
3692
|
this.toolCallEmitter = new ToolCallEmitter(this);
|
|
3348
3693
|
this.planEmitter = new PlanEmitter(this);
|
|
3349
|
-
this.historyReplayer = new HistoryReplayer(this
|
|
3350
|
-
supersedeUnrestorableGoal: true
|
|
3351
|
-
});
|
|
3694
|
+
this.historyReplayer = new HistoryReplayer(this);
|
|
3352
3695
|
this.messageEmitter = new MessageEmitter(this);
|
|
3353
|
-
this
|
|
3696
|
+
this.#bindGoalRuntime();
|
|
3354
3697
|
this.#registerBackgroundNotificationCallbacks();
|
|
3355
3698
|
this.#registerSubSessionSpawner();
|
|
3356
3699
|
this.config.getWorkflowRunRegistry?.().setApprovalRequestCallback(
|
|
@@ -3438,6 +3781,17 @@ var Session = class {
|
|
|
3438
3781
|
persistedBackgroundNotificationTaskIds = /* @__PURE__ */ new Set();
|
|
3439
3782
|
backgroundNotificationAcceptances = /* @__PURE__ */ new Map();
|
|
3440
3783
|
activeAgentNotificationAcceptances = /* @__PURE__ */ new Set();
|
|
3784
|
+
goalQueue = [];
|
|
3785
|
+
goalProcessing = false;
|
|
3786
|
+
activeGoalTurn;
|
|
3787
|
+
goalHostUnbind;
|
|
3788
|
+
goalRuntimeUnsubscribe;
|
|
3789
|
+
lastGoalSnapshot;
|
|
3790
|
+
lastGoalPublicationKey;
|
|
3791
|
+
// Set only when runtime recovery selected a Goal that initial replay hid.
|
|
3792
|
+
// Keep that Goal private through activation and later progress updates.
|
|
3793
|
+
suppressedRecoveredGoalId;
|
|
3794
|
+
goalPublicationTail = Promise.resolve();
|
|
3441
3795
|
// Set true in dispose(). Guards #drainCronQueue and #drainNotificationQueue
|
|
3442
3796
|
// against the race where #drainNotificationQueue's finally block kicks off
|
|
3443
3797
|
// #drainCronQueue after the session has already been disposed (e.g. /clear
|
|
@@ -3483,6 +3837,296 @@ var Session = class {
|
|
|
3483
3837
|
pendingRecoveredAgentsNotice = null;
|
|
3484
3838
|
// Implement SessionContext interface
|
|
3485
3839
|
sessionId;
|
|
3840
|
+
#bindGoalRuntime() {
|
|
3841
|
+
try {
|
|
3842
|
+
const runtime = this.config.getGoalRuntime();
|
|
3843
|
+
this.lastGoalSnapshot = runtime.getSnapshot();
|
|
3844
|
+
this.goalRuntimeUnsubscribe = runtime.subscribe((snapshot, cause) => {
|
|
3845
|
+
const previousGoal = this.lastGoalSnapshot?.goal ?? null;
|
|
3846
|
+
this.lastGoalSnapshot = snapshot;
|
|
3847
|
+
void this.#queueGoalState(snapshot, cause, previousGoal).catch(
|
|
3848
|
+
(error) => debugLogger6.warn(
|
|
3849
|
+
`Failed to emit ACP Goal state: ${error instanceof Error ? error.message : String(error)}`
|
|
3850
|
+
)
|
|
3851
|
+
);
|
|
3852
|
+
});
|
|
3853
|
+
const host = {
|
|
3854
|
+
startGoalTurn: /* @__PURE__ */ __name(async (input) => {
|
|
3855
|
+
if (this.goalQueue.some(
|
|
3856
|
+
({ permit }) => permit.turnId === input.permit.turnId
|
|
3857
|
+
) || this.activeGoalTurn?.permit.turnId === input.permit.turnId) {
|
|
3858
|
+
return;
|
|
3859
|
+
}
|
|
3860
|
+
this.goalQueue.push({
|
|
3861
|
+
permit: { ...input.permit },
|
|
3862
|
+
turnKey: `goal-runtime:${input.permit.turnId}`,
|
|
3863
|
+
controller: new AbortController(),
|
|
3864
|
+
origin: "runtime",
|
|
3865
|
+
continuationContext: input.continuationContext,
|
|
3866
|
+
...input.verifierFeedback ? { verifierFeedback: input.verifierFeedback } : {},
|
|
3867
|
+
modelStarted: false
|
|
3868
|
+
});
|
|
3869
|
+
void this.#drainGoalQueue();
|
|
3870
|
+
}, "startGoalTurn"),
|
|
3871
|
+
preemptGoalTurn: /* @__PURE__ */ __name((reason) => {
|
|
3872
|
+
for (const turn of this.goalQueue.splice(0)) {
|
|
3873
|
+
turn.controller.abort(reason);
|
|
3874
|
+
}
|
|
3875
|
+
this.activeGoalTurn?.controller.abort(reason);
|
|
3876
|
+
}, "preemptGoalTurn")
|
|
3877
|
+
};
|
|
3878
|
+
this.goalHostUnbind = this.config.bindGoalTurnHost(host);
|
|
3879
|
+
} catch (error) {
|
|
3880
|
+
if (!(error instanceof GoalPersistenceUnavailableError)) {
|
|
3881
|
+
throw error;
|
|
3882
|
+
}
|
|
3883
|
+
debugLogger6.debug("Canonical Goal runtime is unavailable for ACP");
|
|
3884
|
+
}
|
|
3885
|
+
}
|
|
3886
|
+
/**
|
|
3887
|
+
* Re-attach this session to the Goal runtime after `/clear`.
|
|
3888
|
+
*
|
|
3889
|
+
* `Config.startNewSession()` disposes the old runtime and builds a fresh
|
|
3890
|
+
* one, so the `subscribe` callback installed by `#bindGoalRuntime` — the
|
|
3891
|
+
* only path that reaches `MessageEmitter.emitGoalState` — would stay
|
|
3892
|
+
* registered on the abandoned instance and the client would never receive
|
|
3893
|
+
* another `_meta.goalState` update. The retained turn host survives the
|
|
3894
|
+
* switch, but the subscription and the publication de-duplication state
|
|
3895
|
+
* belong to the old runtime and have to be rebuilt.
|
|
3896
|
+
*/
|
|
3897
|
+
rebindGoalRuntimeForNewSession() {
|
|
3898
|
+
if (this.disposed || this.closing) return;
|
|
3899
|
+
this.goalRuntimeUnsubscribe?.();
|
|
3900
|
+
this.goalRuntimeUnsubscribe = void 0;
|
|
3901
|
+
this.goalHostUnbind?.();
|
|
3902
|
+
this.goalHostUnbind = void 0;
|
|
3903
|
+
this.lastGoalSnapshot = void 0;
|
|
3904
|
+
this.lastGoalPublicationKey = void 0;
|
|
3905
|
+
this.suppressedRecoveredGoalId = void 0;
|
|
3906
|
+
this.#bindGoalRuntime();
|
|
3907
|
+
}
|
|
3908
|
+
/**
|
|
3909
|
+
* Publish the recovered Goal state once, after history replay.
|
|
3910
|
+
*
|
|
3911
|
+
* Goal recovery runs from the `Config` constructor, long before this
|
|
3912
|
+
* Session exists, so `restore()`'s correction broadcast reaches zero
|
|
3913
|
+
* listeners — and replay streams the pre-migration records, emitting the
|
|
3914
|
+
* legacy `set` card. Clients that derive the live goal from goal cards
|
|
3915
|
+
* (both web-shell and the daemon provider do) are therefore left showing a
|
|
3916
|
+
* goal as running when the migrated goal is `paused` and nothing drives
|
|
3917
|
+
* it; only a second reload self-corrected. Republishing here puts the
|
|
3918
|
+
* authoritative state *after* the replayed card, which is the ordering
|
|
3919
|
+
* that matters. `#publishGoalState` de-duplicates on `(cause, snapshot)`,
|
|
3920
|
+
* so this is a no-op when the subscription already delivered it.
|
|
3921
|
+
*
|
|
3922
|
+
* When recovery failed outright — a malformed or future-schema
|
|
3923
|
+
* `goal_state` record makes `recoverGoalFromRecords` return `unsupported`
|
|
3924
|
+
* — there is no state to publish and no in-session command can correct the
|
|
3925
|
+
* stream, because a degraded `/goal` answers without a cause. That case
|
|
3926
|
+
* gets the same trailing `cleared` card the replay-time
|
|
3927
|
+
* `supersedeUnrestorableGoal` used to emit.
|
|
3928
|
+
*/
|
|
3929
|
+
async publishRecoveredGoalState(replayedRecords) {
|
|
3930
|
+
if (this.disposed || this.closing) return;
|
|
3931
|
+
let runtime;
|
|
3932
|
+
try {
|
|
3933
|
+
runtime = await this.config.getGoalRuntimeReady();
|
|
3934
|
+
} catch (error) {
|
|
3935
|
+
if (!(error instanceof GoalPersistenceUnavailableError)) throw error;
|
|
3936
|
+
await this.#supersedeUnrestorableGoal(replayedRecords);
|
|
3937
|
+
return;
|
|
3938
|
+
}
|
|
3939
|
+
const cause = runtime.getRecoveryCause?.();
|
|
3940
|
+
if (!cause) return;
|
|
3941
|
+
await this.#queueGoalState(runtime.getSnapshot(), cause);
|
|
3942
|
+
}
|
|
3943
|
+
async renderRecoveredGoalUpdates(replayedRecords) {
|
|
3944
|
+
if (this.disposed || this.closing) return [];
|
|
3945
|
+
const rendered = await renderPreparedGoalUpdate(
|
|
3946
|
+
() => this.config.getGoalRuntimeReady(),
|
|
3947
|
+
{
|
|
3948
|
+
...replayedRecords ? { replayedRecords } : {},
|
|
3949
|
+
previousGoal: this.lastGoalSnapshot?.goal ?? null
|
|
3950
|
+
}
|
|
3951
|
+
);
|
|
3952
|
+
if (rendered.publicationKey && rendered.publicationKey === this.lastGoalPublicationKey) {
|
|
3953
|
+
return [];
|
|
3954
|
+
}
|
|
3955
|
+
this.primeRecoveredGoalPublication(rendered.publicationKey);
|
|
3956
|
+
return rendered.updates;
|
|
3957
|
+
}
|
|
3958
|
+
primeRecoveredGoalPublication(publicationKey, suppressedGoalId) {
|
|
3959
|
+
if (publicationKey) this.lastGoalPublicationKey = publicationKey;
|
|
3960
|
+
this.suppressedRecoveredGoalId = suppressedGoalId;
|
|
3961
|
+
}
|
|
3962
|
+
#suppressRecoveredGoalUpdate(snapshot) {
|
|
3963
|
+
const suppressedGoalId = this.suppressedRecoveredGoalId;
|
|
3964
|
+
if (!suppressedGoalId) return false;
|
|
3965
|
+
const goal = snapshot.goal;
|
|
3966
|
+
if (goal?.goalId === suppressedGoalId) return true;
|
|
3967
|
+
if (goal === null) {
|
|
3968
|
+
this.suppressedRecoveredGoalId = void 0;
|
|
3969
|
+
return true;
|
|
3970
|
+
}
|
|
3971
|
+
this.suppressedRecoveredGoalId = void 0;
|
|
3972
|
+
return false;
|
|
3973
|
+
}
|
|
3974
|
+
/**
|
|
3975
|
+
* Emit a trailing `cleared` card for an active legacy goal the runtime
|
|
3976
|
+
* refused to recover.
|
|
3977
|
+
*
|
|
3978
|
+
* Emitted, not recorded: the transcript keeps its `set` card, so a later
|
|
3979
|
+
* resume that can recover the goal still finds it.
|
|
3980
|
+
*/
|
|
3981
|
+
async #supersedeUnrestorableGoal(replayedRecords) {
|
|
3982
|
+
const status = this.#unrestorableGoalStatus(replayedRecords);
|
|
3983
|
+
if (!status) return;
|
|
3984
|
+
await this.messageEmitter.emitGoalStatus(status);
|
|
3985
|
+
}
|
|
3986
|
+
/**
|
|
3987
|
+
* The `cleared` card for an active legacy goal the runtime refused to
|
|
3988
|
+
* recover, or `undefined` when there is nothing to supersede. Shared by the
|
|
3989
|
+
* streaming and rendering recovery paths so they cannot drift.
|
|
3990
|
+
*/
|
|
3991
|
+
#unrestorableGoalStatus(replayedRecords) {
|
|
3992
|
+
if (!replayedRecords?.length) return void 0;
|
|
3993
|
+
const active = findGoalToRestore(
|
|
3994
|
+
collectGoalStatusItemsFromRecords(replayedRecords)
|
|
3995
|
+
);
|
|
3996
|
+
if (!active) return void 0;
|
|
3997
|
+
return {
|
|
3998
|
+
kind: "cleared",
|
|
3999
|
+
condition: active.condition,
|
|
4000
|
+
iterations: active.iterations,
|
|
4001
|
+
...active.setAt !== void 0 ? { setAt: active.setAt } : {},
|
|
4002
|
+
lastReason: "Goal not restored: its saved state could not be read, so this session is not driving it."
|
|
4003
|
+
};
|
|
4004
|
+
}
|
|
4005
|
+
async #publishGoalState(snapshot, cause, previousGoal = this.lastGoalSnapshot?.goal ?? null) {
|
|
4006
|
+
if (this.#suppressRecoveredGoalUpdate(snapshot)) return;
|
|
4007
|
+
const publicationKey = goalPublicationKey(snapshot, cause);
|
|
4008
|
+
if (publicationKey && publicationKey === this.lastGoalPublicationKey) {
|
|
4009
|
+
return;
|
|
4010
|
+
}
|
|
4011
|
+
if (publicationKey) this.lastGoalPublicationKey = publicationKey;
|
|
4012
|
+
await this.messageEmitter.emitGoalState(snapshot, cause, previousGoal);
|
|
4013
|
+
}
|
|
4014
|
+
#queueGoalState(snapshot, cause, previousGoal = this.lastGoalSnapshot?.goal ?? null) {
|
|
4015
|
+
const publication = this.goalPublicationTail.then(
|
|
4016
|
+
() => this.#publishGoalState(snapshot, cause, previousGoal)
|
|
4017
|
+
);
|
|
4018
|
+
this.goalPublicationTail = publication.catch(() => void 0);
|
|
4019
|
+
return publication;
|
|
4020
|
+
}
|
|
4021
|
+
async #drainGoalQueue() {
|
|
4022
|
+
if (this.disposed || this.closing || this.goalProcessing || this.pendingPrompt || this.pendingPromptCompletion || this.cronProcessing || this.cronAbortController || this.notificationProcessing || this.notificationAbortController) {
|
|
4023
|
+
return;
|
|
4024
|
+
}
|
|
4025
|
+
const turn = this.goalQueue.shift();
|
|
4026
|
+
if (!turn) return;
|
|
4027
|
+
this.goalProcessing = true;
|
|
4028
|
+
this.activeGoalTurn = turn;
|
|
4029
|
+
const parts = buildGoalContinuationParts(turn);
|
|
4030
|
+
try {
|
|
4031
|
+
await this.prompt(
|
|
4032
|
+
{
|
|
4033
|
+
sessionId: this.sessionId,
|
|
4034
|
+
prompt: parts.map((part) => ({
|
|
4035
|
+
type: "text",
|
|
4036
|
+
text: part.text ?? ""
|
|
4037
|
+
}))
|
|
4038
|
+
},
|
|
4039
|
+
void 0,
|
|
4040
|
+
void 0,
|
|
4041
|
+
void 0,
|
|
4042
|
+
turn
|
|
4043
|
+
);
|
|
4044
|
+
} catch (error) {
|
|
4045
|
+
await this.#settleGoalTurn(turn, void 0, true);
|
|
4046
|
+
debugLogger6.warn(
|
|
4047
|
+
`ACP Goal turn failed: ${error instanceof Error ? error.message : String(error)}`
|
|
4048
|
+
);
|
|
4049
|
+
} finally {
|
|
4050
|
+
if (this.activeGoalTurn === turn) this.activeGoalTurn = void 0;
|
|
4051
|
+
this.goalProcessing = false;
|
|
4052
|
+
void this.#drainCronQueue();
|
|
4053
|
+
void this.#drainNotificationQueue();
|
|
4054
|
+
void this.#drainGoalQueue();
|
|
4055
|
+
}
|
|
4056
|
+
}
|
|
4057
|
+
async #settleGoalTurn(turn, result, failed) {
|
|
4058
|
+
try {
|
|
4059
|
+
const runtime = await this.config.getGoalRuntimeReady();
|
|
4060
|
+
if (!sameGoalPermit(runtime.permitForTurn(turn.turnKey), turn.permit)) {
|
|
4061
|
+
return;
|
|
4062
|
+
}
|
|
4063
|
+
if (!turn.modelStarted) {
|
|
4064
|
+
if (turn.controller.signal.reason === USER_CANCEL_ABORT_REASON && runtime.getSnapshot().goal?.status === "active") {
|
|
4065
|
+
await runtime.dispatch({
|
|
4066
|
+
action: "pause",
|
|
4067
|
+
expectedGoalId: turn.permit.goalId,
|
|
4068
|
+
expectedRevision: turn.permit.revision
|
|
4069
|
+
});
|
|
4070
|
+
} else {
|
|
4071
|
+
await runtime.releaseTurn(turn.turnKey);
|
|
4072
|
+
}
|
|
4073
|
+
return;
|
|
4074
|
+
}
|
|
4075
|
+
try {
|
|
4076
|
+
await this.config.getChatRecordingService()?.flush();
|
|
4077
|
+
} catch (error) {
|
|
4078
|
+
debugLogger6.warn(
|
|
4079
|
+
`Failed to flush ACP Goal turn: ${error instanceof Error ? error.message : String(error)}`
|
|
4080
|
+
);
|
|
4081
|
+
}
|
|
4082
|
+
const cancelledByUser = result?.stopReason === "cancelled" && turn.controller.signal.reason === USER_CANCEL_ABORT_REASON;
|
|
4083
|
+
const supersededByNewPrompt = turn.controller.signal.reason === NEW_PROMPT_ABORT_REASON;
|
|
4084
|
+
const shouldPause = !supersededByNewPrompt && (failed || result?.stopReason === "max_tokens" || cancelledByUser || turn.controller.signal.reason === SESSION_DISPOSE_ABORT_REASON);
|
|
4085
|
+
try {
|
|
4086
|
+
if (shouldPause && runtime.getSnapshot().goal?.status === "active") {
|
|
4087
|
+
await runtime.dispatch({
|
|
4088
|
+
action: "pause",
|
|
4089
|
+
expectedGoalId: turn.permit.goalId,
|
|
4090
|
+
expectedRevision: turn.permit.revision
|
|
4091
|
+
});
|
|
4092
|
+
return;
|
|
4093
|
+
}
|
|
4094
|
+
await runtime.finishTurn(turn.permit);
|
|
4095
|
+
} catch (error) {
|
|
4096
|
+
debugLogger6.warn(
|
|
4097
|
+
`Failed to record ACP Goal turn settlement: ${error instanceof Error ? error.message : String(error)}`
|
|
4098
|
+
);
|
|
4099
|
+
await runtime.releaseTurn(turn.turnKey);
|
|
4100
|
+
}
|
|
4101
|
+
} catch (error) {
|
|
4102
|
+
debugLogger6.warn(
|
|
4103
|
+
`Failed to settle ACP Goal turn: ${error instanceof Error ? error.message : String(error)}`
|
|
4104
|
+
);
|
|
4105
|
+
}
|
|
4106
|
+
}
|
|
4107
|
+
/**
|
|
4108
|
+
* Stops an autonomous Goal loop when the Stop-hook blocking cap fires.
|
|
4109
|
+
*
|
|
4110
|
+
* `abortGoalForStopHookCap` only knows about the legacy `activeGoalStore`,
|
|
4111
|
+
* which no longer has a writer for daemon sessions, so ACP needs the
|
|
4112
|
+
* canonical runtime acted on directly.
|
|
4113
|
+
*/
|
|
4114
|
+
async #pauseGoalForStopHookCap() {
|
|
4115
|
+
try {
|
|
4116
|
+
const runtime = await this.config.getGoalRuntimeReady();
|
|
4117
|
+
const goal = runtime.getSnapshot().goal;
|
|
4118
|
+
if (goal?.status !== "active") return;
|
|
4119
|
+
await runtime.dispatch({
|
|
4120
|
+
action: "pause",
|
|
4121
|
+
expectedGoalId: goal.goalId,
|
|
4122
|
+
expectedRevision: goal.revision
|
|
4123
|
+
});
|
|
4124
|
+
} catch (error) {
|
|
4125
|
+
debugLogger6.warn(
|
|
4126
|
+
`Failed to pause the Goal after the Stop hook cap: ${error instanceof Error ? error.message : String(error)}`
|
|
4127
|
+
);
|
|
4128
|
+
}
|
|
4129
|
+
}
|
|
3486
4130
|
async #requestWorkflowApproval(runId, approval, rawArgs, approvalSignal) {
|
|
3487
4131
|
const registry = this.config.getWorkflowRunRegistry();
|
|
3488
4132
|
const externalToolCallId = `workflow:${this.sessionId}:${runId}:${approval.approvalId}`;
|
|
@@ -4136,7 +4780,7 @@ var Session = class {
|
|
|
4136
4780
|
}
|
|
4137
4781
|
#hasActiveTurn() {
|
|
4138
4782
|
return Boolean(
|
|
4139
|
-
this.pendingPrompt || this.pendingPromptCompletion || this.cronProcessing || this.cronAbortController || this.cronCompletion || this.notificationProcessing || this.notificationAbortController || this.notificationCompletion
|
|
4783
|
+
this.pendingPrompt || this.pendingPromptCompletion || this.goalProcessing || this.cronProcessing || this.cronAbortController || this.cronCompletion || this.notificationProcessing || this.notificationAbortController || this.notificationCompletion
|
|
4140
4784
|
);
|
|
4141
4785
|
}
|
|
4142
4786
|
beginClose() {
|
|
@@ -4164,6 +4808,7 @@ var Session = class {
|
|
|
4164
4808
|
resolveGate();
|
|
4165
4809
|
if (this.disposed) return;
|
|
4166
4810
|
this.closing = false;
|
|
4811
|
+
void this.#drainGoalQueue();
|
|
4167
4812
|
void this.#drainCronQueue();
|
|
4168
4813
|
void this.#drainNotificationQueue();
|
|
4169
4814
|
};
|
|
@@ -4227,6 +4872,14 @@ var Session = class {
|
|
|
4227
4872
|
this.hardSuspendTodoStopGuard();
|
|
4228
4873
|
this.notificationQueue = [];
|
|
4229
4874
|
this.cronQueue = [];
|
|
4875
|
+
for (const turn of this.goalQueue.splice(0)) {
|
|
4876
|
+
turn.controller.abort(SESSION_DISPOSE_ABORT_REASON);
|
|
4877
|
+
}
|
|
4878
|
+
this.activeGoalTurn?.controller.abort(SESSION_DISPOSE_ABORT_REASON);
|
|
4879
|
+
this.goalHostUnbind?.();
|
|
4880
|
+
this.goalHostUnbind = void 0;
|
|
4881
|
+
this.goalRuntimeUnsubscribe?.();
|
|
4882
|
+
this.goalRuntimeUnsubscribe = void 0;
|
|
4230
4883
|
this.notificationAbortController?.abort();
|
|
4231
4884
|
this.notificationAbortController = null;
|
|
4232
4885
|
this.notificationProcessing = false;
|
|
@@ -4254,7 +4907,6 @@ var Session = class {
|
|
|
4254
4907
|
this.config.setSubSessionSpawner(void 0);
|
|
4255
4908
|
this.config.getWorkflowRunRegistry?.().setApprovalRequestCallback(void 0);
|
|
4256
4909
|
this.workflowApprovalAbortController.abort(SESSION_DISPOSE_ABORT_REASON);
|
|
4257
|
-
clearGoalTerminalObserver(this.sessionId);
|
|
4258
4910
|
}
|
|
4259
4911
|
/**
|
|
4260
4912
|
* Install the message rewrite middleware if configured.
|
|
@@ -4271,64 +4923,30 @@ var Session = class {
|
|
|
4271
4923
|
);
|
|
4272
4924
|
}
|
|
4273
4925
|
}
|
|
4274
|
-
/**
|
|
4275
|
-
* Installs (or replaces) this session's goal-terminal observer.
|
|
4276
|
-
*
|
|
4277
|
-
* Public because it does not stay installed: `registerGoalHook` and
|
|
4278
|
-
* `unregisterGoalHook` both clear the observer table for the session, so any
|
|
4279
|
-
* caller that (re-)registers a goal outside `#processSlashCommandResult` —
|
|
4280
|
-
* notably goal restore on resume — has to put it back. Idempotent.
|
|
4281
|
-
*/
|
|
4282
|
-
installGoalTerminalObserver() {
|
|
4283
|
-
setGoalTerminalObserver(this.sessionId, (event) => {
|
|
4284
|
-
void this.messageEmitter.emitGoalTerminal(event).catch((error) => {
|
|
4285
|
-
debugLogger6.warn(
|
|
4286
|
-
`Failed to emit goal terminal update: ${this.#formatError(error)}`
|
|
4287
|
-
);
|
|
4288
|
-
});
|
|
4289
|
-
recordGoalStatusItem(this.config, goalTerminalEventToHistoryItem(event));
|
|
4290
|
-
});
|
|
4291
|
-
}
|
|
4292
|
-
/**
|
|
4293
|
-
* Emits a goal card and persists it to the transcript. Both `set` and
|
|
4294
|
-
* `cleared` reach the client this way — from `#emitGoalStatusItems` for a
|
|
4295
|
-
* `/goal` prompt, and from the `sessionGoalClear` ext method — so recording
|
|
4296
|
-
* here (rather than at each call site) keeps the transcript in step with the
|
|
4297
|
-
* hook. Replay goes through `messageEmitter.emitGoalStatus` directly and so
|
|
4298
|
-
* does not re-record.
|
|
4299
|
-
*/
|
|
4300
|
-
emitGoalStatus(status) {
|
|
4301
|
-
void this.messageEmitter.emitGoalStatus(status).catch((error) => {
|
|
4302
|
-
debugLogger6.warn(
|
|
4303
|
-
`Failed to emit goal status update: ${this.#formatError(error)}`
|
|
4304
|
-
);
|
|
4305
|
-
});
|
|
4306
|
-
recordGoalStatusItem(this.config, {
|
|
4307
|
-
type: "goal_status" /* GOAL_STATUS */,
|
|
4308
|
-
...status
|
|
4309
|
-
});
|
|
4310
|
-
}
|
|
4311
4926
|
/**
|
|
4312
4927
|
* Replays conversation history to the client using modular components.
|
|
4313
4928
|
* Delegates to HistoryReplayer for consistent event emission.
|
|
4314
4929
|
*/
|
|
4315
4930
|
primeTurnFromHistory(records) {
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
if (typeof backgroundTask?.taskId === "string") {
|
|
4320
|
-
this.persistedBackgroundNotificationTaskIds.add(backgroundTask.taskId);
|
|
4321
|
-
}
|
|
4322
|
-
}
|
|
4323
|
-
this.turn = Math.max(
|
|
4324
|
-
this.turn,
|
|
4325
|
-
computeInitialTurnFromHistory(records, this.config.getSessionId())
|
|
4931
|
+
const turnState = collectSessionTurnState(
|
|
4932
|
+
records,
|
|
4933
|
+
this.config.getSessionId()
|
|
4326
4934
|
);
|
|
4935
|
+
this.primeTurnState(
|
|
4936
|
+
turnState.initialTurn,
|
|
4937
|
+
turnState.backgroundNotificationTaskIds
|
|
4938
|
+
);
|
|
4939
|
+
}
|
|
4940
|
+
primeTurnState(initialTurn, backgroundNotificationTaskIds) {
|
|
4941
|
+
for (const taskId of backgroundNotificationTaskIds) {
|
|
4942
|
+
this.persistedBackgroundNotificationTaskIds.add(taskId);
|
|
4943
|
+
}
|
|
4944
|
+
this.turn = Math.max(this.turn, initialTurn);
|
|
4327
4945
|
}
|
|
4328
|
-
async replayHistory(records, gaps) {
|
|
4946
|
+
async replayHistory(records, gaps, options) {
|
|
4329
4947
|
this.primeTurnFromHistory(records);
|
|
4330
4948
|
try {
|
|
4331
|
-
await this.historyReplayer.replay(records, gaps);
|
|
4949
|
+
await this.historyReplayer.replay(records, gaps, options);
|
|
4332
4950
|
} finally {
|
|
4333
4951
|
this.activeTodoPlanRevision = void 0;
|
|
4334
4952
|
}
|
|
@@ -4446,11 +5064,13 @@ var Session = class {
|
|
|
4446
5064
|
const hadPrompt = !!this.pendingPrompt;
|
|
4447
5065
|
const hadCron = !!this.cronAbortController;
|
|
4448
5066
|
const hadNotification = !!this.notificationAbortController || this.notificationProcessing;
|
|
5067
|
+
const queuedGoalTurns = this.goalQueue.splice(0);
|
|
5068
|
+
const hadQueuedGoalTurn = queuedGoalTurns.length > 0;
|
|
4449
5069
|
if (this.followupAbort) {
|
|
4450
5070
|
this.followupAbort.abort();
|
|
4451
5071
|
this.followupAbort = null;
|
|
4452
5072
|
}
|
|
4453
|
-
if (!hadPrompt && !hadCron && !hadNotification) {
|
|
5073
|
+
if (!hadPrompt && !hadCron && !hadNotification && !hadQueuedGoalTurn) {
|
|
4454
5074
|
throw new Error(NOT_CURRENTLY_GENERATING_CANCEL_MESSAGE);
|
|
4455
5075
|
}
|
|
4456
5076
|
this.todoStopGuard.suspend();
|
|
@@ -4458,6 +5078,9 @@ var Session = class {
|
|
|
4458
5078
|
this.pendingPrompt.abort(USER_CANCEL_ABORT_REASON);
|
|
4459
5079
|
this.pendingPrompt = null;
|
|
4460
5080
|
}
|
|
5081
|
+
for (const turn of queuedGoalTurns) {
|
|
5082
|
+
turn.controller.abort(USER_CANCEL_ABORT_REASON);
|
|
5083
|
+
}
|
|
4461
5084
|
if (this.cronAbortController) {
|
|
4462
5085
|
this.cronAbortController.abort();
|
|
4463
5086
|
this.cronAbortController = null;
|
|
@@ -4470,6 +5093,26 @@ var Session = class {
|
|
|
4470
5093
|
}
|
|
4471
5094
|
this.notificationQueue = [];
|
|
4472
5095
|
this.notificationProcessing = false;
|
|
5096
|
+
const queuedGoalTurn = queuedGoalTurns[0];
|
|
5097
|
+
if (queuedGoalTurn) {
|
|
5098
|
+
try {
|
|
5099
|
+
const runtime = this.config.getGoalRuntime();
|
|
5100
|
+
if (sameGoalPermit(
|
|
5101
|
+
runtime.permitForTurn(queuedGoalTurn.turnKey),
|
|
5102
|
+
queuedGoalTurn.permit
|
|
5103
|
+
) && runtime.getSnapshot().goal?.status === "active") {
|
|
5104
|
+
await runtime.dispatch({
|
|
5105
|
+
action: "pause",
|
|
5106
|
+
expectedGoalId: queuedGoalTurn.permit.goalId,
|
|
5107
|
+
expectedRevision: queuedGoalTurn.permit.revision
|
|
5108
|
+
});
|
|
5109
|
+
}
|
|
5110
|
+
} catch (error) {
|
|
5111
|
+
debugLogger6.warn(
|
|
5112
|
+
`Failed to pause queued ACP Goal turn: ${error instanceof Error ? error.message : String(error)}`
|
|
5113
|
+
);
|
|
5114
|
+
}
|
|
5115
|
+
}
|
|
4473
5116
|
this.#activeWorkChanged();
|
|
4474
5117
|
const scheduler = this.config.isCronEnabled() ? this.config.getCronScheduler() : null;
|
|
4475
5118
|
if (scheduler) {
|
|
@@ -4480,7 +5123,7 @@ var Session = class {
|
|
|
4480
5123
|
}
|
|
4481
5124
|
}
|
|
4482
5125
|
}
|
|
4483
|
-
async prompt(params, invocationContext, admissionCancellation, modelPrompt) {
|
|
5126
|
+
async prompt(params, invocationContext, admissionCancellation, modelPrompt, scheduledGoalTurn) {
|
|
4484
5127
|
if (this.closing) {
|
|
4485
5128
|
throw RequestError.invalidParams(void 0, "Session is closing");
|
|
4486
5129
|
}
|
|
@@ -4507,8 +5150,27 @@ var Session = class {
|
|
|
4507
5150
|
return { stopReason: "cancelled" };
|
|
4508
5151
|
}
|
|
4509
5152
|
const todoStopGuardPreparation = this.#prepareTodoStopGuardForPrompt(params);
|
|
4510
|
-
|
|
4511
|
-
|
|
5153
|
+
let goalTurn = scheduledGoalTurn;
|
|
5154
|
+
let reservedGoalRuntime;
|
|
5155
|
+
let reservedGoalTurnKey;
|
|
5156
|
+
if (!goalTurn) {
|
|
5157
|
+
try {
|
|
5158
|
+
const runtime = this.config.getGoalRuntime();
|
|
5159
|
+
if (runtime.getSnapshot().goal?.status === "active") {
|
|
5160
|
+
reservedGoalRuntime = runtime;
|
|
5161
|
+
reservedGoalTurnKey = `goal-user:${randomUUID()}`;
|
|
5162
|
+
runtime.beginTurn(reservedGoalTurnKey);
|
|
5163
|
+
for (const queued of this.goalQueue.splice(0)) {
|
|
5164
|
+
queued.controller.abort(NEW_PROMPT_ABORT_REASON);
|
|
5165
|
+
await runtime.releaseTurn(queued.turnKey);
|
|
5166
|
+
}
|
|
5167
|
+
}
|
|
5168
|
+
} catch (error) {
|
|
5169
|
+
if (!(error instanceof GoalPersistenceUnavailableError)) throw error;
|
|
5170
|
+
}
|
|
5171
|
+
}
|
|
5172
|
+
this.pendingPrompt?.abort(NEW_PROMPT_ABORT_REASON);
|
|
5173
|
+
const pendingSend = goalTurn?.controller ?? new AbortController();
|
|
4512
5174
|
const cancelPendingSend = /* @__PURE__ */ __name(() => pendingSend.abort(USER_CANCEL_ABORT_REASON), "cancelPendingSend");
|
|
4513
5175
|
if (admissionCancellation) {
|
|
4514
5176
|
admissionCancellation.addEventListener("abort", cancelPendingSend, {
|
|
@@ -4558,7 +5220,46 @@ var Session = class {
|
|
|
4558
5220
|
} catch {
|
|
4559
5221
|
}
|
|
4560
5222
|
}
|
|
5223
|
+
if (reservedGoalRuntime && reservedGoalTurnKey) {
|
|
5224
|
+
try {
|
|
5225
|
+
const permit = await claimGoalTurn(
|
|
5226
|
+
reservedGoalRuntime,
|
|
5227
|
+
reservedGoalTurnKey,
|
|
5228
|
+
pendingSend.signal
|
|
5229
|
+
);
|
|
5230
|
+
if (permit) {
|
|
5231
|
+
const goal = reservedGoalRuntime.getSnapshot().goal;
|
|
5232
|
+
if (goal) {
|
|
5233
|
+
const verifierFeedback = reservedGoalRuntime.getVerifierFeedback(permit);
|
|
5234
|
+
goalTurn = {
|
|
5235
|
+
permit,
|
|
5236
|
+
turnKey: reservedGoalTurnKey,
|
|
5237
|
+
controller: pendingSend,
|
|
5238
|
+
origin: "user",
|
|
5239
|
+
continuationContext: goal.objective,
|
|
5240
|
+
...verifierFeedback ? { verifierFeedback } : {},
|
|
5241
|
+
modelStarted: false
|
|
5242
|
+
};
|
|
5243
|
+
}
|
|
5244
|
+
}
|
|
5245
|
+
} catch (error) {
|
|
5246
|
+
try {
|
|
5247
|
+
await reservedGoalRuntime.releaseTurn(reservedGoalTurnKey);
|
|
5248
|
+
} catch (releaseError) {
|
|
5249
|
+
debugLogger6.warn(
|
|
5250
|
+
`Failed to release Goal reservation after admission failure: ${releaseError instanceof Error ? releaseError.message : String(releaseError)}`
|
|
5251
|
+
);
|
|
5252
|
+
} finally {
|
|
5253
|
+
releasePendingSend();
|
|
5254
|
+
this.todoStopGuard.suspend();
|
|
5255
|
+
}
|
|
5256
|
+
throw error;
|
|
5257
|
+
}
|
|
5258
|
+
}
|
|
4561
5259
|
if (pendingSend.signal.aborted) {
|
|
5260
|
+
if (reservedGoalRuntime && reservedGoalTurnKey) {
|
|
5261
|
+
await reservedGoalRuntime.releaseTurn(reservedGoalTurnKey);
|
|
5262
|
+
}
|
|
4562
5263
|
releasePendingSend();
|
|
4563
5264
|
this.todoStopGuard.suspend();
|
|
4564
5265
|
return { stopReason: "cancelled" };
|
|
@@ -4575,14 +5276,18 @@ var Session = class {
|
|
|
4575
5276
|
this.pendingPromptCompletion = new Promise((resolve6) => {
|
|
4576
5277
|
resolveCompletion = resolve6;
|
|
4577
5278
|
});
|
|
5279
|
+
let promptResult;
|
|
5280
|
+
let promptFailed = false;
|
|
4578
5281
|
try {
|
|
4579
5282
|
const result = await this.#executePrompt(
|
|
4580
5283
|
params,
|
|
4581
5284
|
pendingSend,
|
|
4582
5285
|
channelDeliveryCapture,
|
|
4583
5286
|
invocationContext,
|
|
4584
|
-
modelPrompt
|
|
5287
|
+
modelPrompt,
|
|
5288
|
+
goalTurn
|
|
4585
5289
|
);
|
|
5290
|
+
promptResult = result;
|
|
4586
5291
|
releasePendingSend();
|
|
4587
5292
|
void this.#drainCronQueue();
|
|
4588
5293
|
void this.#drainNotificationQueue();
|
|
@@ -4601,6 +5306,7 @@ var Session = class {
|
|
|
4601
5306
|
}
|
|
4602
5307
|
return result;
|
|
4603
5308
|
} catch (error) {
|
|
5309
|
+
promptFailed = true;
|
|
4604
5310
|
if (error instanceof SessionWriterError) {
|
|
4605
5311
|
throw new RequestError(error.rpcCode, error.message, {
|
|
4606
5312
|
errorKind: error.errorKind
|
|
@@ -4618,9 +5324,15 @@ var Session = class {
|
|
|
4618
5324
|
void this.#drainCronQueue();
|
|
4619
5325
|
void this.#drainNotificationQueue();
|
|
4620
5326
|
}
|
|
5327
|
+
if (goalTurn) {
|
|
5328
|
+
await this.#settleGoalTurn(goalTurn, promptResult, promptFailed);
|
|
5329
|
+
} else if (reservedGoalRuntime && reservedGoalTurnKey) {
|
|
5330
|
+
await reservedGoalRuntime.releaseTurn(reservedGoalTurnKey);
|
|
5331
|
+
}
|
|
4621
5332
|
void this.#startCronSchedulerInRuntime();
|
|
4622
5333
|
resolveCompletion();
|
|
4623
5334
|
this.pendingPromptCompletion = null;
|
|
5335
|
+
void this.#drainGoalQueue();
|
|
4624
5336
|
await this.#consumeLiveEndInstruction();
|
|
4625
5337
|
}
|
|
4626
5338
|
}
|
|
@@ -4742,7 +5454,7 @@ var Session = class {
|
|
|
4742
5454
|
}
|
|
4743
5455
|
})();
|
|
4744
5456
|
}
|
|
4745
|
-
async #executePrompt(params, pendingSend, channelDeliveryCapture, invocationContext, modelPrompt) {
|
|
5457
|
+
async #executePrompt(params, pendingSend, channelDeliveryCapture, invocationContext, modelPrompt, goalTurn) {
|
|
4746
5458
|
const sessionId = this.config.getSessionId();
|
|
4747
5459
|
if (invocationContext !== void 0 && invocationContext.sessionId !== sessionId) {
|
|
4748
5460
|
throw RequestError.invalidParams(
|
|
@@ -4750,7 +5462,7 @@ var Session = class {
|
|
|
4750
5462
|
"Invocation context session does not match the active session"
|
|
4751
5463
|
);
|
|
4752
5464
|
}
|
|
4753
|
-
|
|
5465
|
+
const execute = /* @__PURE__ */ __name(() => runWithInvocationContext(
|
|
4754
5466
|
invocationContext,
|
|
4755
5467
|
() => sessionIdContext.run(
|
|
4756
5468
|
sessionId,
|
|
@@ -4758,12 +5470,14 @@ var Session = class {
|
|
|
4758
5470
|
params,
|
|
4759
5471
|
pendingSend,
|
|
4760
5472
|
channelDeliveryCapture,
|
|
4761
|
-
modelPrompt
|
|
5473
|
+
modelPrompt,
|
|
5474
|
+
goalTurn
|
|
4762
5475
|
)
|
|
4763
5476
|
)
|
|
4764
|
-
);
|
|
5477
|
+
), "execute");
|
|
5478
|
+
return goalTurn ? goalTurnContext.run(goalTurn.permit, execute) : goalTurnContext.exit(execute);
|
|
4765
5479
|
}
|
|
4766
|
-
async #executePromptInner(params, pendingSend, channelDeliveryCapture, modelPrompt) {
|
|
5480
|
+
async #executePromptInner(params, pendingSend, channelDeliveryCapture, modelPrompt, goalTurn) {
|
|
4767
5481
|
return Storage.runWithRuntimeBaseDir(
|
|
4768
5482
|
this.runtimeBaseDir,
|
|
4769
5483
|
this.config.getWorkingDir(),
|
|
@@ -4788,6 +5502,7 @@ var Session = class {
|
|
|
4788
5502
|
},
|
|
4789
5503
|
async () => {
|
|
4790
5504
|
const promptText = params.prompt.filter((block) => block.type === "text").map((block) => block.type === "text" ? block.text : "").join(" ");
|
|
5505
|
+
const promptDisplayText = typeof promptMetadata?.[DAEMON_PROMPT_DISPLAY_TEXT_META_KEY] === "string" ? promptMetadata[DAEMON_PROMPT_DISPLAY_TEXT_META_KEY] : void 0;
|
|
4791
5506
|
const modelPromptBlocks = modelPrompt === void 0 ? params.prompt : [{ type: "text", text: modelPrompt }];
|
|
4792
5507
|
logUserPrompt(
|
|
4793
5508
|
this.config,
|
|
@@ -4803,7 +5518,12 @@ var Session = class {
|
|
|
4803
5518
|
let continuationParts = null;
|
|
4804
5519
|
let strippedOrphanEntries = null;
|
|
4805
5520
|
let orphanPushCountSnapshot = 0;
|
|
4806
|
-
if (
|
|
5521
|
+
if (goalTurn?.origin === "runtime") {
|
|
5522
|
+
this.config.getChatRecordingService()?.recordGoalRuntimeMessage(
|
|
5523
|
+
modelPromptBlocks.filter((block) => block.type === "text").map((block) => ({ text: block.text })),
|
|
5524
|
+
goalTurn.permit
|
|
5525
|
+
);
|
|
5526
|
+
} else if (isContinue) {
|
|
4807
5527
|
const recoveryPlan = buildSessionRecoveryPlanFromApiHistory({
|
|
4808
5528
|
sessionId: this.sessionId,
|
|
4809
5529
|
apiHistory: this.#getCurrentChat().getHistory()
|
|
@@ -4829,11 +5549,22 @@ var Session = class {
|
|
|
4829
5549
|
continuationParts = recoveryPlan.continuation.parts;
|
|
4830
5550
|
}
|
|
4831
5551
|
}
|
|
4832
|
-
if (
|
|
5552
|
+
if (goalTurn?.origin === "runtime") {
|
|
5553
|
+
} else if (isContinue) {
|
|
4833
5554
|
} else if (isRetry) {
|
|
4834
5555
|
this.#getCurrentChat().stripOrphanedUserEntriesFromHistory();
|
|
4835
5556
|
} else {
|
|
4836
|
-
this.config.getChatRecordingService()
|
|
5557
|
+
const recorder = this.config.getChatRecordingService();
|
|
5558
|
+
if (promptDisplayText !== void 0) {
|
|
5559
|
+
recorder?.recordUserMessage(promptText, goalTurn?.permit, {
|
|
5560
|
+
displayText: promptDisplayText,
|
|
5561
|
+
hookContext: ""
|
|
5562
|
+
});
|
|
5563
|
+
} else if (goalTurn) {
|
|
5564
|
+
recorder?.recordUserMessage(promptText, goalTurn.permit);
|
|
5565
|
+
} else {
|
|
5566
|
+
recorder?.recordUserMessage(promptText);
|
|
5567
|
+
}
|
|
4837
5568
|
}
|
|
4838
5569
|
const firstTextBlock = modelPromptBlocks.find(
|
|
4839
5570
|
(block) => block.type === "text"
|
|
@@ -4862,7 +5593,13 @@ var Session = class {
|
|
|
4862
5593
|
inputText,
|
|
4863
5594
|
pendingSend,
|
|
4864
5595
|
this.config,
|
|
4865
|
-
this.settings
|
|
5596
|
+
this.settings,
|
|
5597
|
+
{
|
|
5598
|
+
// `/clear` swaps in a new Goal runtime under this
|
|
5599
|
+
// long-lived Session; without this the goal-state
|
|
5600
|
+
// subscription stays on the disposed instance.
|
|
5601
|
+
startNewSession: /* @__PURE__ */ __name(() => this.rebindGoalRuntimeForNewSession(), "startNewSession")
|
|
5602
|
+
}
|
|
4866
5603
|
);
|
|
4867
5604
|
parts = await this.#processSlashCommandResult(
|
|
4868
5605
|
slashCommandResult,
|
|
@@ -4882,7 +5619,8 @@ var Session = class {
|
|
|
4882
5619
|
}
|
|
4883
5620
|
const hooksEnabled = !this.config.getDisableAllHooks?.();
|
|
4884
5621
|
const messageBus = this.config.getMessageBus?.();
|
|
4885
|
-
|
|
5622
|
+
const isRuntimeContinuation = goalTurn?.origin === "runtime";
|
|
5623
|
+
if (!isContinue && !isRuntimeContinuation && hooksEnabled && messageBus && this.config.hasHooksForEvent?.("UserPromptSubmit")) {
|
|
4886
5624
|
const response = await messageBus.request(
|
|
4887
5625
|
{
|
|
4888
5626
|
type: "hook-execution-request" /* HOOK_EXECUTION_REQUEST */,
|
|
@@ -4996,6 +5734,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
4996
5734
|
);
|
|
4997
5735
|
let channelDeliveryResponseBlock;
|
|
4998
5736
|
try {
|
|
5737
|
+
if (goalTurn) goalTurn.modelStarted = true;
|
|
4999
5738
|
const sendResult = await this.#sendMessageStreamWithAutoCompression(
|
|
5000
5739
|
promptId,
|
|
5001
5740
|
nextMessage?.parts ?? [],
|
|
@@ -5404,11 +6143,13 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
5404
6143
|
"Stop",
|
|
5405
6144
|
stopHookBlockingCap
|
|
5406
6145
|
);
|
|
5407
|
-
abortGoalForStopHookCap(
|
|
6146
|
+
if (!abortGoalForStopHookCap(
|
|
5408
6147
|
this.config,
|
|
5409
6148
|
this.config.getSessionId(),
|
|
5410
6149
|
warning
|
|
5411
|
-
)
|
|
6150
|
+
)) {
|
|
6151
|
+
await this.#pauseGoalForStopHookCap();
|
|
6152
|
+
}
|
|
5412
6153
|
this.todoStopGuard.suspend();
|
|
5413
6154
|
await this.messageEmitter.emitAgentMessage(warning);
|
|
5414
6155
|
debugLogger6.warn(warning);
|
|
@@ -6149,16 +6890,16 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
6149
6890
|
);
|
|
6150
6891
|
return { responseStream: null, stopReason: "cancelled" };
|
|
6151
6892
|
}
|
|
6152
|
-
const
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
);
|
|
6893
|
+
const chat = this.#getCurrentChat();
|
|
6894
|
+
const model = options.getModelOverride?.() ?? options.modelOverride ?? this.config.getModel();
|
|
6895
|
+
const request = {
|
|
6896
|
+
message,
|
|
6897
|
+
config: {
|
|
6898
|
+
abortSignal
|
|
6899
|
+
}
|
|
6900
|
+
};
|
|
6901
|
+
const goalPermit = goalTurnContext.getStore();
|
|
6902
|
+
const responseStream = goalPermit ? await chat.sendMessageStream(model, request, promptId, goalPermit) : await chat.sendMessageStream(model, request, promptId);
|
|
6162
6903
|
return { responseStream };
|
|
6163
6904
|
}
|
|
6164
6905
|
#preserveUnsentMessageHistory(message, preserveFullMessage) {
|
|
@@ -6638,6 +7379,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
6638
7379
|
if (this.closing) return;
|
|
6639
7380
|
if (this.cronProcessing) return;
|
|
6640
7381
|
if (this.pendingPrompt) return;
|
|
7382
|
+
if (this.goalProcessing) return;
|
|
6641
7383
|
if (this.notificationProcessing) return;
|
|
6642
7384
|
if (this.#deferAutomaticQueueDrainUntilTurnsSettle()) return;
|
|
6643
7385
|
if (this.#nextCronQueueIndex() < 0) return;
|
|
@@ -6649,7 +7391,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
6649
7391
|
);
|
|
6650
7392
|
return;
|
|
6651
7393
|
}
|
|
6652
|
-
if (this.disposed || this.closing || this.cronProcessing || this.pendingPrompt || this.notificationProcessing || this.#nextCronQueueIndex() < 0) {
|
|
7394
|
+
if (this.disposed || this.closing || this.cronProcessing || this.pendingPrompt || this.goalProcessing || this.notificationProcessing || this.#nextCronQueueIndex() < 0) {
|
|
6653
7395
|
return;
|
|
6654
7396
|
}
|
|
6655
7397
|
if (this.#deferAutomaticQueueDrainUntilTurnsSettle()) return;
|
|
@@ -6670,6 +7412,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
6670
7412
|
this.cronProcessing = false;
|
|
6671
7413
|
resolveCompletion();
|
|
6672
7414
|
this.cronCompletion = null;
|
|
7415
|
+
void this.#drainGoalQueue();
|
|
6673
7416
|
void this.#drainNotificationQueue();
|
|
6674
7417
|
if (this.config.isCronEnabled()) {
|
|
6675
7418
|
const scheduler = this.config.getCronScheduler();
|
|
@@ -7039,6 +7782,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7039
7782
|
backgroundRegistry.setStatusChangeCallback(this.#statusChangeCallback);
|
|
7040
7783
|
backgroundRegistry.setNotificationCallback(
|
|
7041
7784
|
(displayText, modelText, meta) => {
|
|
7785
|
+
const entry = backgroundRegistry.get(meta.agentId);
|
|
7042
7786
|
this.#enqueueBackgroundNotification({
|
|
7043
7787
|
displayText,
|
|
7044
7788
|
modelText,
|
|
@@ -7047,7 +7791,12 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7047
7791
|
kind: "agent",
|
|
7048
7792
|
continuesTodoStopGuardWorkChain: this.#agentContinuesTodoStopGuardWorkChain(meta.agentId),
|
|
7049
7793
|
toolUseId: meta.toolUseId,
|
|
7050
|
-
todoWorkChainId: meta.todoWorkChainId
|
|
7794
|
+
todoWorkChainId: meta.todoWorkChainId,
|
|
7795
|
+
structured: entry ? {
|
|
7796
|
+
description: truncateNotificationLabel(
|
|
7797
|
+
buildBackgroundEntryLabel(entry)
|
|
7798
|
+
)
|
|
7799
|
+
} : void 0
|
|
7051
7800
|
});
|
|
7052
7801
|
}
|
|
7053
7802
|
);
|
|
@@ -7056,6 +7805,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7056
7805
|
if (meta.status === "running") {
|
|
7057
7806
|
return;
|
|
7058
7807
|
}
|
|
7808
|
+
const entry = monitorRegistry.get(meta.monitorId);
|
|
7059
7809
|
this.#enqueueBackgroundNotification({
|
|
7060
7810
|
displayText,
|
|
7061
7811
|
modelText,
|
|
@@ -7067,11 +7817,17 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7067
7817
|
meta.ownerAgentId
|
|
7068
7818
|
),
|
|
7069
7819
|
toolUseId: meta.toolUseId,
|
|
7070
|
-
todoWorkChainId: meta.todoWorkChainId
|
|
7820
|
+
todoWorkChainId: meta.todoWorkChainId,
|
|
7821
|
+
structured: entry ? {
|
|
7822
|
+
description: truncateNotificationLabel(entry.description),
|
|
7823
|
+
eventCount: meta.eventCount,
|
|
7824
|
+
droppedLines: entry.droppedLines || void 0
|
|
7825
|
+
} : void 0
|
|
7071
7826
|
});
|
|
7072
7827
|
});
|
|
7073
7828
|
const shellRegistry = this.config.getBackgroundShellRegistry();
|
|
7074
7829
|
shellRegistry.setNotificationCallback((displayText, modelText, meta) => {
|
|
7830
|
+
const entry = shellRegistry.get(meta.shellId);
|
|
7075
7831
|
this.#enqueueBackgroundNotification({
|
|
7076
7832
|
displayText,
|
|
7077
7833
|
modelText,
|
|
@@ -7079,7 +7835,8 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7079
7835
|
status: meta.status,
|
|
7080
7836
|
kind: "shell",
|
|
7081
7837
|
continuesTodoStopGuardWorkChain: !this.todoStopGuardBackgroundBaseline.shells.has(meta.shellId),
|
|
7082
|
-
todoWorkChainId: meta.todoWorkChainId
|
|
7838
|
+
todoWorkChainId: meta.todoWorkChainId,
|
|
7839
|
+
structured: entry ? { commandLabel: truncateNotificationLabel(entry.description) } : void 0
|
|
7083
7840
|
});
|
|
7084
7841
|
});
|
|
7085
7842
|
this.config.getChatRecordingService()?.setTitleRecordedCallback((customTitle, titleSource, sessionId) => {
|
|
@@ -7170,7 +7927,8 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7170
7927
|
taskId: item.taskId,
|
|
7171
7928
|
status: item.status,
|
|
7172
7929
|
kind: item.kind,
|
|
7173
|
-
toolUseId: item.toolUseId
|
|
7930
|
+
toolUseId: item.toolUseId,
|
|
7931
|
+
...item.structured
|
|
7174
7932
|
}
|
|
7175
7933
|
);
|
|
7176
7934
|
} catch (error) {
|
|
@@ -7193,7 +7951,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7193
7951
|
if (this.disposed) return;
|
|
7194
7952
|
if (this.closing) return;
|
|
7195
7953
|
if (this.notificationProcessing) return;
|
|
7196
|
-
if (this.pendingPrompt || this.cronProcessing || this.cronAbortController) {
|
|
7954
|
+
if (this.pendingPrompt || this.goalProcessing || this.cronProcessing || this.cronAbortController) {
|
|
7197
7955
|
return;
|
|
7198
7956
|
}
|
|
7199
7957
|
if (this.#deferAutomaticQueueDrainUntilTurnsSettle()) return;
|
|
@@ -7207,7 +7965,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7207
7965
|
);
|
|
7208
7966
|
return;
|
|
7209
7967
|
}
|
|
7210
|
-
if (this.disposed || this.closing || this.notificationProcessing || this.pendingPrompt || this.cronProcessing || this.cronAbortController || this.#nextNotificationQueueIndex() < 0) {
|
|
7968
|
+
if (this.disposed || this.closing || this.notificationProcessing || this.pendingPrompt || this.goalProcessing || this.cronProcessing || this.cronAbortController || this.#nextNotificationQueueIndex() < 0) {
|
|
7211
7969
|
return;
|
|
7212
7970
|
}
|
|
7213
7971
|
if (this.#deferAutomaticQueueDrainUntilTurnsSettle()) return;
|
|
@@ -7218,7 +7976,7 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7218
7976
|
});
|
|
7219
7977
|
try {
|
|
7220
7978
|
while (this.notificationQueue.length > 0) {
|
|
7221
|
-
if (this.pendingPrompt || this.cronProcessing || this.cronAbortController) {
|
|
7979
|
+
if (this.pendingPrompt || this.goalProcessing || this.cronProcessing || this.cronAbortController) {
|
|
7222
7980
|
break;
|
|
7223
7981
|
}
|
|
7224
7982
|
const nextIndex = this.#nextNotificationQueueIndex();
|
|
@@ -7245,8 +8003,9 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7245
8003
|
resolveCompletion();
|
|
7246
8004
|
this.notificationCompletion = null;
|
|
7247
8005
|
this.#activeWorkChanged();
|
|
8006
|
+
void this.#drainGoalQueue();
|
|
7248
8007
|
void this.#drainCronQueue();
|
|
7249
|
-
if (this.notificationQueue.length > 0 && !this.pendingPrompt && !this.cronProcessing && !this.cronAbortController) {
|
|
8008
|
+
if (this.notificationQueue.length > 0 && !this.pendingPrompt && !this.goalProcessing && !this.cronProcessing && !this.cronAbortController) {
|
|
7250
8009
|
void this.#drainNotificationQueue();
|
|
7251
8010
|
}
|
|
7252
8011
|
}
|
|
@@ -7283,7 +8042,8 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7283
8042
|
taskId: item.taskId,
|
|
7284
8043
|
status: item.status,
|
|
7285
8044
|
kind: item.kind,
|
|
7286
|
-
toolUseId: item.toolUseId
|
|
8045
|
+
toolUseId: item.toolUseId,
|
|
8046
|
+
...item.structured
|
|
7287
8047
|
});
|
|
7288
8048
|
}
|
|
7289
8049
|
const notificationReminders = await this.#buildInitialSystemReminders();
|
|
@@ -7499,7 +8259,8 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
7499
8259
|
taskId: item.taskId,
|
|
7500
8260
|
status: item.status,
|
|
7501
8261
|
kind: item.kind,
|
|
7502
|
-
toolUseId: item.toolUseId
|
|
8262
|
+
toolUseId: item.toolUseId,
|
|
8263
|
+
...item.structured
|
|
7503
8264
|
}
|
|
7504
8265
|
}
|
|
7505
8266
|
});
|
|
@@ -9721,30 +10482,6 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
9721
10482
|
}
|
|
9722
10483
|
}
|
|
9723
10484
|
}
|
|
9724
|
-
#emitGoalStatusItems(result) {
|
|
9725
|
-
if (!("outputHistoryItems" in result)) {
|
|
9726
|
-
return;
|
|
9727
|
-
}
|
|
9728
|
-
let hasActiveGoalStatus = false;
|
|
9729
|
-
for (const item of result.outputHistoryItems ?? []) {
|
|
9730
|
-
if (item.type === "goal_status" /* GOAL_STATUS */) {
|
|
9731
|
-
this.emitGoalStatus({
|
|
9732
|
-
kind: item.kind,
|
|
9733
|
-
condition: item.condition,
|
|
9734
|
-
...item.iterations !== void 0 ? { iterations: item.iterations } : {},
|
|
9735
|
-
...item.setAt !== void 0 ? { setAt: item.setAt } : {},
|
|
9736
|
-
...item.durationMs !== void 0 ? { durationMs: item.durationMs } : {},
|
|
9737
|
-
...item.lastReason !== void 0 ? { lastReason: item.lastReason } : {}
|
|
9738
|
-
});
|
|
9739
|
-
if (!isTerminalGoalStatusKind(item.kind)) {
|
|
9740
|
-
hasActiveGoalStatus = true;
|
|
9741
|
-
}
|
|
9742
|
-
}
|
|
9743
|
-
}
|
|
9744
|
-
if (hasActiveGoalStatus) {
|
|
9745
|
-
this.installGoalTerminalObserver();
|
|
9746
|
-
}
|
|
9747
|
-
}
|
|
9748
10485
|
/**
|
|
9749
10486
|
* Processes the result of a slash command execution.
|
|
9750
10487
|
*
|
|
@@ -9762,7 +10499,6 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
9762
10499
|
* @returns Parts to use for the prompt, or null if command was handled without needing model interaction
|
|
9763
10500
|
*/
|
|
9764
10501
|
async #processSlashCommandResult(result, originalPrompt, abortSignal, onFullTurnModel) {
|
|
9765
|
-
this.#emitGoalStatusItems(result);
|
|
9766
10502
|
this.refreshContextFilesOnWrite = result.type === "submit_prompt" && Boolean(result.refreshContextFilesOnWrite);
|
|
9767
10503
|
switch (result.type) {
|
|
9768
10504
|
case "submit_prompt":
|
|
@@ -9813,9 +10549,15 @@ ${this.pendingRecoveredAgentsNotice}
|
|
|
9813
10549
|
throw new Error(unsupportedError);
|
|
9814
10550
|
}
|
|
9815
10551
|
case "goal_control":
|
|
9816
|
-
|
|
9817
|
-
|
|
9818
|
-
|
|
10552
|
+
if (!result.cause) {
|
|
10553
|
+
await this.#queueGoalState(
|
|
10554
|
+
result.response.snapshot,
|
|
10555
|
+
void 0,
|
|
10556
|
+
this.lastGoalSnapshot?.goal ?? null
|
|
10557
|
+
);
|
|
10558
|
+
this.lastGoalSnapshot = result.response.snapshot;
|
|
10559
|
+
}
|
|
10560
|
+
return null;
|
|
9819
10561
|
case "no_command":
|
|
9820
10562
|
return this.#resolvePrompt(originalPrompt, abortSignal, {
|
|
9821
10563
|
promptLast: true,
|
|
@@ -10362,6 +11104,22 @@ var ActiveWorkReporter = class {
|
|
|
10362
11104
|
}
|
|
10363
11105
|
};
|
|
10364
11106
|
|
|
11107
|
+
// packages/cli/src/acp-integration/model-configuration.ts
|
|
11108
|
+
init_esbuild_shims();
|
|
11109
|
+
var MODEL_CONFIGURATIONS = {
|
|
11110
|
+
"qwen3.8-max": {
|
|
11111
|
+
reasoning: {
|
|
11112
|
+
thinking: true,
|
|
11113
|
+
efforts: ["low", "medium", "xhigh"],
|
|
11114
|
+
defaultEffort: "xhigh"
|
|
11115
|
+
}
|
|
11116
|
+
}
|
|
11117
|
+
};
|
|
11118
|
+
function getModelConfiguration(modelId) {
|
|
11119
|
+
return modelId === "qwen3.8-max" ? MODEL_CONFIGURATIONS[modelId] : void 0;
|
|
11120
|
+
}
|
|
11121
|
+
__name(getModelConfiguration, "getModelConfiguration");
|
|
11122
|
+
|
|
10365
11123
|
// packages/cli/src/acp-integration/session/tasksSnapshot.ts
|
|
10366
11124
|
init_esbuild_shims();
|
|
10367
11125
|
function runtimeMs(entry, now) {
|
|
@@ -10499,6 +11257,7 @@ var BTW_CHILD_TIMEOUT_MS = 55e3;
|
|
|
10499
11257
|
var MCP_OAUTH_START_TIMEOUT_MS = 3e4;
|
|
10500
11258
|
var SESSION_DRAIN_TIMEOUT_MS = 3e4;
|
|
10501
11259
|
var ACP_REASONING_EFFORT_DEFAULT = "default";
|
|
11260
|
+
var ACP_REASONING_EFFORT_NONE = "none";
|
|
10502
11261
|
var ACP_REASONING_EFFORT_NAMES = {
|
|
10503
11262
|
low: "Low",
|
|
10504
11263
|
medium: "Medium",
|
|
@@ -10707,29 +11466,185 @@ function parseSessionArtifactBasePayload(payload, expectedSessionId) {
|
|
|
10707
11466
|
if (!isObjectRecord(payload)) {
|
|
10708
11467
|
throw invalidArtifactPersistPayload();
|
|
10709
11468
|
}
|
|
10710
|
-
if (payload["v"] !== SESSION_ARTIFACT_PERSISTENCE_VERSION || payload["sessionId"] !== expectedSessionId || !Number.isSafeInteger(payload["sequence"]) || payload["sequence"] < 0 || typeof payload["recordedAt"] !== "string" || payload["recordedAt"].length === 0) {
|
|
10711
|
-
throw invalidArtifactPersistPayload();
|
|
11469
|
+
if (payload["v"] !== SESSION_ARTIFACT_PERSISTENCE_VERSION || payload["sessionId"] !== expectedSessionId || !Number.isSafeInteger(payload["sequence"]) || payload["sequence"] < 0 || typeof payload["recordedAt"] !== "string" || payload["recordedAt"].length === 0) {
|
|
11470
|
+
throw invalidArtifactPersistPayload();
|
|
11471
|
+
}
|
|
11472
|
+
return payload;
|
|
11473
|
+
}
|
|
11474
|
+
__name(parseSessionArtifactBasePayload, "parseSessionArtifactBasePayload");
|
|
11475
|
+
function invalidArtifactPersistPayload() {
|
|
11476
|
+
return RequestError.invalidParams(
|
|
11477
|
+
void 0,
|
|
11478
|
+
"Invalid or missing artifact persist payload"
|
|
11479
|
+
);
|
|
11480
|
+
}
|
|
11481
|
+
__name(invalidArtifactPersistPayload, "invalidArtifactPersistPayload");
|
|
11482
|
+
function isBulkLoadReplayRequest(params) {
|
|
11483
|
+
const meta = isObjectRecord(params._meta) ? params._meta : void 0;
|
|
11484
|
+
return meta?.[LOAD_REPLAY_MODE_META_KEY] === LOAD_REPLAY_BULK_MODE;
|
|
11485
|
+
}
|
|
11486
|
+
__name(isBulkLoadReplayRequest, "isBulkLoadReplayRequest");
|
|
11487
|
+
function shouldHideInheritedHistory(params) {
|
|
11488
|
+
const meta = isObjectRecord(params._meta) ? params._meta : void 0;
|
|
11489
|
+
return meta?.[LOAD_REPLAY_HIDE_INHERITED_META_KEY] === true;
|
|
11490
|
+
}
|
|
11491
|
+
__name(shouldHideInheritedHistory, "shouldHideInheritedHistory");
|
|
11492
|
+
function loadRestoreOptions(params) {
|
|
11493
|
+
const hideInheritedHistory = shouldHideInheritedHistory(params);
|
|
11494
|
+
if (!isBulkLoadReplayRequest(params)) {
|
|
11495
|
+
return { replay: { kind: "all", hideInheritedHistory } };
|
|
11496
|
+
}
|
|
11497
|
+
const limit = getLoadReplayPageSize(params);
|
|
11498
|
+
return limit === void 0 ? { replay: { kind: "all", hideInheritedHistory } } : { replay: { kind: "recent", limit, hideInheritedHistory } };
|
|
11499
|
+
}
|
|
11500
|
+
__name(loadRestoreOptions, "loadRestoreOptions");
|
|
11501
|
+
var RESUME_RESTORE_OPTIONS = {
|
|
11502
|
+
replay: { kind: "none" }
|
|
11503
|
+
};
|
|
11504
|
+
function mapSessionRestoreRequestError(error, sessionId) {
|
|
11505
|
+
const mappedWriterError = mapSessionWriterRequestError(error);
|
|
11506
|
+
if (mappedWriterError !== error) return mappedWriterError;
|
|
11507
|
+
if (error instanceof SessionTranscriptSnapshotUnavailableError) {
|
|
11508
|
+
return new RequestError(-32010, error.message, {
|
|
11509
|
+
errorKind: "transcript_snapshot_unavailable",
|
|
11510
|
+
sessionId
|
|
11511
|
+
});
|
|
11512
|
+
}
|
|
11513
|
+
if (error instanceof SessionTranscriptTooLargeError) {
|
|
11514
|
+
return new RequestError(-32011, error.message, {
|
|
11515
|
+
errorKind: "transcript_too_large",
|
|
11516
|
+
sessionId,
|
|
11517
|
+
snapshotSize: error.snapshotSize,
|
|
11518
|
+
maxBytes: error.maxBytes
|
|
11519
|
+
});
|
|
11520
|
+
}
|
|
11521
|
+
if (error instanceof SessionTranscriptPageTooLargeError) {
|
|
11522
|
+
addDaemonRequestAttribute(
|
|
11523
|
+
"qwen-code.daemon.session_restore.envelope_limit_reason",
|
|
11524
|
+
"bytes"
|
|
11525
|
+
);
|
|
11526
|
+
return new RequestError(-32012, error.message, {
|
|
11527
|
+
errorKind: "transcript_page_too_large",
|
|
11528
|
+
sessionId,
|
|
11529
|
+
pageBytes: error.pageBytes,
|
|
11530
|
+
maxBytes: error.maxBytes
|
|
11531
|
+
});
|
|
11532
|
+
}
|
|
11533
|
+
if (error instanceof HistoryReplayLimitError) {
|
|
11534
|
+
addDaemonRequestAttribute(
|
|
11535
|
+
"qwen-code.daemon.session_restore.envelope_limit_reason",
|
|
11536
|
+
error.reason
|
|
11537
|
+
);
|
|
11538
|
+
return new RequestError(-32012, error.message, {
|
|
11539
|
+
errorKind: "transcript_page_too_large",
|
|
11540
|
+
sessionId,
|
|
11541
|
+
reason: error.reason,
|
|
11542
|
+
observed: error.observed,
|
|
11543
|
+
limit: error.limit
|
|
11544
|
+
});
|
|
11545
|
+
}
|
|
11546
|
+
return error;
|
|
11547
|
+
}
|
|
11548
|
+
__name(mapSessionRestoreRequestError, "mapSessionRestoreRequestError");
|
|
11549
|
+
function validateLoadReplayEnvelope(sessionId, envelope, enforceLimits) {
|
|
11550
|
+
if (!enforceLimits) return;
|
|
11551
|
+
if (envelope.updates.length > LOAD_REPLAY_MAX_UPDATES) {
|
|
11552
|
+
throw new HistoryReplayLimitError(
|
|
11553
|
+
sessionId,
|
|
11554
|
+
"updates",
|
|
11555
|
+
envelope.updates.length,
|
|
11556
|
+
LOAD_REPLAY_MAX_UPDATES
|
|
11557
|
+
);
|
|
11558
|
+
}
|
|
11559
|
+
const pageBytes = Buffer.byteLength(JSON.stringify(envelope), "utf8");
|
|
11560
|
+
if (pageBytes > LOAD_REPLAY_MAX_BYTES) {
|
|
11561
|
+
throw new HistoryReplayLimitError(
|
|
11562
|
+
sessionId,
|
|
11563
|
+
"bytes",
|
|
11564
|
+
pageBytes,
|
|
11565
|
+
LOAD_REPLAY_MAX_BYTES
|
|
11566
|
+
);
|
|
11567
|
+
}
|
|
11568
|
+
}
|
|
11569
|
+
__name(validateLoadReplayEnvelope, "validateLoadReplayEnvelope");
|
|
11570
|
+
function replayGoalBootstrap(projection) {
|
|
11571
|
+
if (projection && !("runtime" in projection)) {
|
|
11572
|
+
const sourceUuid2 = projection.goalRecoverySourceUuid;
|
|
11573
|
+
if (!sourceUuid2) return void 0;
|
|
11574
|
+
if (projection.replay?.records.some((record) => record.uuid === sourceUuid2)) {
|
|
11575
|
+
return void 0;
|
|
11576
|
+
}
|
|
11577
|
+
const replay = projection.replay?.replay;
|
|
11578
|
+
if (isObjectRecord(replay)) {
|
|
11579
|
+
const bootstrap = HistoryReplayer.v2GoalBootstrap(
|
|
11580
|
+
replay["goalState"],
|
|
11581
|
+
replay["goalCause"]
|
|
11582
|
+
);
|
|
11583
|
+
if (bootstrap) return bootstrap;
|
|
11584
|
+
}
|
|
11585
|
+
const sourceRecord2 = projection.goalRecords?.find(
|
|
11586
|
+
(record) => record.uuid === sourceUuid2
|
|
11587
|
+
);
|
|
11588
|
+
if (sourceRecord2?.subtype === "goal_state") {
|
|
11589
|
+
const payload = isObjectRecord(sourceRecord2.systemPayload) ? sourceRecord2.systemPayload : void 0;
|
|
11590
|
+
return HistoryReplayer.v2GoalBootstrap(
|
|
11591
|
+
payload?.["snapshot"],
|
|
11592
|
+
payload?.["cause"]
|
|
11593
|
+
);
|
|
11594
|
+
}
|
|
11595
|
+
const active2 = findGoalToRestore(
|
|
11596
|
+
collectGoalStatusItemsFromRecords(projection.goalRecords ?? [])
|
|
11597
|
+
);
|
|
11598
|
+
return active2 ? {
|
|
11599
|
+
goalStatus: {
|
|
11600
|
+
kind: active2.iterations > 0 ? "checking" : "set",
|
|
11601
|
+
condition: active2.condition,
|
|
11602
|
+
iterations: active2.iterations,
|
|
11603
|
+
...active2.setAt !== void 0 ? { setAt: active2.setAt } : {}
|
|
11604
|
+
}
|
|
11605
|
+
} : void 0;
|
|
11606
|
+
}
|
|
11607
|
+
const sourceUuid = projection?.replay?.goalRecoverySourceUuid;
|
|
11608
|
+
if (!projection?.replay || !sourceUuid) return void 0;
|
|
11609
|
+
if (projection.replay.records.some((record) => record.uuid === sourceUuid)) {
|
|
11610
|
+
return void 0;
|
|
10712
11611
|
}
|
|
10713
|
-
|
|
10714
|
-
|
|
10715
|
-
|
|
10716
|
-
function invalidArtifactPersistPayload() {
|
|
10717
|
-
return RequestError.invalidParams(
|
|
10718
|
-
void 0,
|
|
10719
|
-
"Invalid or missing artifact persist payload"
|
|
11612
|
+
const goalBootstrapRecords = projection.replay.goalBootstrapRecords ?? [];
|
|
11613
|
+
const sourceRecord = goalBootstrapRecords.find(
|
|
11614
|
+
(record) => record.uuid === sourceUuid
|
|
10720
11615
|
);
|
|
11616
|
+
if (sourceRecord?.subtype === "goal_state") {
|
|
11617
|
+
const payload = isObjectRecord(sourceRecord.systemPayload) ? sourceRecord.systemPayload : void 0;
|
|
11618
|
+
return HistoryReplayer.v2GoalBootstrap(
|
|
11619
|
+
payload?.["snapshot"],
|
|
11620
|
+
payload?.["cause"]
|
|
11621
|
+
);
|
|
11622
|
+
}
|
|
11623
|
+
const active = findGoalToRestore(
|
|
11624
|
+
collectGoalStatusItemsFromRecords(goalBootstrapRecords)
|
|
11625
|
+
);
|
|
11626
|
+
if (!active) return void 0;
|
|
11627
|
+
return {
|
|
11628
|
+
goalStatus: {
|
|
11629
|
+
kind: active.iterations > 0 ? "checking" : "set",
|
|
11630
|
+
condition: active.condition,
|
|
11631
|
+
iterations: active.iterations,
|
|
11632
|
+
...active.setAt !== void 0 ? { setAt: active.setAt } : {}
|
|
11633
|
+
}
|
|
11634
|
+
};
|
|
10721
11635
|
}
|
|
10722
|
-
__name(
|
|
10723
|
-
function
|
|
10724
|
-
const
|
|
10725
|
-
|
|
10726
|
-
|
|
10727
|
-
|
|
10728
|
-
|
|
10729
|
-
|
|
10730
|
-
|
|
11636
|
+
__name(replayGoalBootstrap, "replayGoalBootstrap");
|
|
11637
|
+
function replayInitialGoalState(projection) {
|
|
11638
|
+
const replay = projection?.replay?.replay;
|
|
11639
|
+
if (!isObjectRecord(replay)) return {};
|
|
11640
|
+
const initialGoalState = parseGoalSnapshotV2(replay["goalState"]);
|
|
11641
|
+
const initialGoalCause = parseGoalStateCause(replay["goalCause"]);
|
|
11642
|
+
return {
|
|
11643
|
+
...initialGoalState ? { initialGoalState } : {},
|
|
11644
|
+
...initialGoalCause ? { initialGoalCause } : {}
|
|
11645
|
+
};
|
|
10731
11646
|
}
|
|
10732
|
-
__name(
|
|
11647
|
+
__name(replayInitialGoalState, "replayInitialGoalState");
|
|
10733
11648
|
function selectVisibleHistoryRecords(records, hideInheritedHistory) {
|
|
10734
11649
|
const sourceBoundary = records.findIndex(
|
|
10735
11650
|
(record) => record.type === "system" && record.subtype === "session_source" && isObjectRecord(record.systemPayload) && record.systemPayload["sourceType"] === "side_task"
|
|
@@ -10770,61 +11685,6 @@ function getLoadReplayPageSize(params) {
|
|
|
10770
11685
|
return value;
|
|
10771
11686
|
}
|
|
10772
11687
|
__name(getLoadReplayPageSize, "getLoadReplayPageSize");
|
|
10773
|
-
function isHistoryTurnStart(record) {
|
|
10774
|
-
return isReplayTurnStartType(record.type, record.subtype);
|
|
10775
|
-
}
|
|
10776
|
-
__name(isHistoryTurnStart, "isHistoryTurnStart");
|
|
10777
|
-
function isHistoryPageStart(record) {
|
|
10778
|
-
return record.subtype !== "realtime_message" && (record.type === "assistant" || isHistoryTurnStart(record));
|
|
10779
|
-
}
|
|
10780
|
-
__name(isHistoryPageStart, "isHistoryPageStart");
|
|
10781
|
-
function historyOrphansToolResult(records, start, end) {
|
|
10782
|
-
for (let i = start; i < end; i++) {
|
|
10783
|
-
if (records[i].type !== "tool_result") continue;
|
|
10784
|
-
for (let owner = i - 1; owner >= start; owner--) {
|
|
10785
|
-
if (isHistoryPageStart(records[owner])) return false;
|
|
10786
|
-
}
|
|
10787
|
-
return true;
|
|
10788
|
-
}
|
|
10789
|
-
return false;
|
|
10790
|
-
}
|
|
10791
|
-
__name(historyOrphansToolResult, "historyOrphansToolResult");
|
|
10792
|
-
function selectRecentHistoryRecords(records, pageSize) {
|
|
10793
|
-
if (pageSize === void 0 || records.length <= pageSize) {
|
|
10794
|
-
return { records, hasMore: false };
|
|
10795
|
-
}
|
|
10796
|
-
let start = records.length - pageSize;
|
|
10797
|
-
for (let i = start; i < records.length; i++) {
|
|
10798
|
-
if (isHistoryTurnStart(records[i])) {
|
|
10799
|
-
start = i;
|
|
10800
|
-
break;
|
|
10801
|
-
}
|
|
10802
|
-
}
|
|
10803
|
-
const expansionFloor = Math.max(0, records.length - 2 * pageSize);
|
|
10804
|
-
const aligned = findBoundaryAtOrBefore(
|
|
10805
|
-
records,
|
|
10806
|
-
start,
|
|
10807
|
-
expansionFloor,
|
|
10808
|
-
isHistoryTurnStart
|
|
10809
|
-
);
|
|
10810
|
-
if (isHistoryTurnStart(records[aligned])) {
|
|
10811
|
-
start = aligned;
|
|
10812
|
-
}
|
|
10813
|
-
if (start > 0 && historyOrphansToolResult(records, start, records.length)) {
|
|
10814
|
-
const pairFloor = Math.max(0, start - pageSize);
|
|
10815
|
-
const owner = findBoundaryAtOrBefore(
|
|
10816
|
-
records,
|
|
10817
|
-
start,
|
|
10818
|
-
pairFloor,
|
|
10819
|
-
isHistoryPageStart
|
|
10820
|
-
);
|
|
10821
|
-
if (isHistoryPageStart(records[owner])) {
|
|
10822
|
-
start = owner;
|
|
10823
|
-
}
|
|
10824
|
-
}
|
|
10825
|
-
return { records: records.slice(start), hasMore: start > 0 };
|
|
10826
|
-
}
|
|
10827
|
-
__name(selectRecentHistoryRecords, "selectRecentHistoryRecords");
|
|
10828
11688
|
function createHiddenWorkspaceMemoryConfig(config) {
|
|
10829
11689
|
return new Proxy(config, {
|
|
10830
11690
|
get(target, prop) {
|
|
@@ -13274,11 +14134,6 @@ var QwenAgent = class {
|
|
|
13274
14134
|
cleanupErrors.push(error);
|
|
13275
14135
|
}
|
|
13276
14136
|
}
|
|
13277
|
-
try {
|
|
13278
|
-
unregisterGoalHook(session.getConfig(), sessionId);
|
|
13279
|
-
} catch (error) {
|
|
13280
|
-
cleanupErrors.push(error);
|
|
13281
|
-
}
|
|
13282
14137
|
try {
|
|
13283
14138
|
this.mcpPool?.releaseSession(sessionId);
|
|
13284
14139
|
} catch (error) {
|
|
@@ -13299,7 +14154,7 @@ var QwenAgent = class {
|
|
|
13299
14154
|
);
|
|
13300
14155
|
}
|
|
13301
14156
|
}
|
|
13302
|
-
async withLiveSessionRestore(sessionId, session, operation) {
|
|
14157
|
+
async withLiveSessionRestore(sessionId, session, options, operation) {
|
|
13303
14158
|
await session.assertCanStartTurn();
|
|
13304
14159
|
const config = session.getConfig();
|
|
13305
14160
|
const releaseGate = session.beginClose();
|
|
@@ -13310,12 +14165,12 @@ var QwenAgent = class {
|
|
|
13310
14165
|
"restore"
|
|
13311
14166
|
);
|
|
13312
14167
|
const recorder = config.getChatRecordingService();
|
|
13313
|
-
const
|
|
13314
|
-
const
|
|
13315
|
-
if (!
|
|
13316
|
-
return await operation(config,
|
|
14168
|
+
const readProjection = /* @__PURE__ */ __name(() => config.getSessionService().readLiveRestoreProjection(sessionId, options), "readProjection");
|
|
14169
|
+
const projection = recorder ? await recorder.runWithWriteBarrier(readProjection) : await readProjection();
|
|
14170
|
+
if (!projection) throw new SessionWriterUnavailableError();
|
|
14171
|
+
return await operation(config, projection);
|
|
13317
14172
|
} catch (error) {
|
|
13318
|
-
throw
|
|
14173
|
+
throw mapSessionRestoreRequestError(error, sessionId);
|
|
13319
14174
|
} finally {
|
|
13320
14175
|
releaseGate();
|
|
13321
14176
|
}
|
|
@@ -13342,7 +14197,7 @@ var QwenAgent = class {
|
|
|
13342
14197
|
this.pendingConfigCleanup.delete(cleanupKey);
|
|
13343
14198
|
}
|
|
13344
14199
|
}
|
|
13345
|
-
async cleanupAfterRequestFailure(error, cleanup) {
|
|
14200
|
+
async cleanupAfterRequestFailure(error, cleanup, sessionId) {
|
|
13346
14201
|
try {
|
|
13347
14202
|
await cleanup();
|
|
13348
14203
|
} catch (cleanupError) {
|
|
@@ -13350,7 +14205,7 @@ var QwenAgent = class {
|
|
|
13350
14205
|
`Session cleanup failed while preserving the original request error: ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}`
|
|
13351
14206
|
);
|
|
13352
14207
|
}
|
|
13353
|
-
throw mapSessionWriterRequestError(error);
|
|
14208
|
+
throw sessionId ? mapSessionRestoreRequestError(error, sessionId) : mapSessionWriterRequestError(error);
|
|
13354
14209
|
}
|
|
13355
14210
|
pendingConfigCleanupKey(runtimeBaseDir, sessionId) {
|
|
13356
14211
|
return `${path4.resolve(runtimeBaseDir)}\0${sessionId}`;
|
|
@@ -13550,7 +14405,7 @@ var QwenAgent = class {
|
|
|
13550
14405
|
}
|
|
13551
14406
|
this.clientCapabilities = args.clientCapabilities;
|
|
13552
14407
|
const authMethods = buildAuthMethods();
|
|
13553
|
-
const version = "0.21.
|
|
14408
|
+
const version = "0.21.11-nightly.20260814.45c2e73080";
|
|
13554
14409
|
const response = {
|
|
13555
14410
|
protocolVersion: PROTOCOL_VERSION,
|
|
13556
14411
|
agentInfo: {
|
|
@@ -13751,6 +14606,7 @@ var QwenAgent = class {
|
|
|
13751
14606
|
async loadSessionWithProfiler(params, initialSessionId, profiler) {
|
|
13752
14607
|
let sessionId = initialSessionId;
|
|
13753
14608
|
const sessionSource = getSessionSource(params);
|
|
14609
|
+
const restoreOptions = loadRestoreOptions(params);
|
|
13754
14610
|
const liveSession = this.sessions.get(sessionId);
|
|
13755
14611
|
if (liveSession) {
|
|
13756
14612
|
const settings = profiler.timeSync(
|
|
@@ -13763,35 +14619,43 @@ var QwenAgent = class {
|
|
|
13763
14619
|
return this.withLiveSessionRestore(
|
|
13764
14620
|
sessionId,
|
|
13765
14621
|
liveSession,
|
|
13766
|
-
|
|
14622
|
+
restoreOptions,
|
|
14623
|
+
async (config, projection) => {
|
|
13767
14624
|
const response = profiler.timeSync(
|
|
13768
14625
|
"response_build",
|
|
13769
14626
|
() => ({
|
|
13770
14627
|
modes: this.buildModesData(config),
|
|
13771
14628
|
models: this.buildAvailableModels(config),
|
|
13772
14629
|
configOptions: this.buildConfigOptions(config),
|
|
13773
|
-
...
|
|
14630
|
+
...projection?.artifactSnapshot ? { artifactSnapshot: projection.artifactSnapshot } : {}
|
|
13774
14631
|
})
|
|
13775
14632
|
);
|
|
13776
|
-
const
|
|
13777
|
-
|
|
13778
|
-
records,
|
|
13779
|
-
shouldHideInheritedHistory(params)
|
|
13780
|
-
);
|
|
13781
|
-
if (visibleRecords.length === 0) return response;
|
|
14633
|
+
const replayPage = projection?.replay;
|
|
14634
|
+
if (!replayPage || replayPage.records.length === 0) return response;
|
|
13782
14635
|
const bulkReplay = isBulkLoadReplayRequest(params);
|
|
13783
|
-
const
|
|
13784
|
-
|
|
13785
|
-
|
|
13786
|
-
|
|
13787
|
-
|
|
13788
|
-
|
|
13789
|
-
|
|
13790
|
-
|
|
13791
|
-
|
|
13792
|
-
|
|
13793
|
-
|
|
13794
|
-
|
|
14636
|
+
const replay = await profiler.time(
|
|
14637
|
+
"history_replay",
|
|
14638
|
+
() => collectHistoryReplayUpdates({
|
|
14639
|
+
sessionId,
|
|
14640
|
+
config,
|
|
14641
|
+
records: replayPage.records,
|
|
14642
|
+
gaps: replayPage.gaps,
|
|
14643
|
+
cumulativeUsage: createReplayCumulativeUsage(),
|
|
14644
|
+
replayState: replayPage.replay,
|
|
14645
|
+
goalBootstrap: replayGoalBootstrap(projection),
|
|
14646
|
+
...restoreOptions.replay.kind === "recent" ? {
|
|
14647
|
+
limits: {
|
|
14648
|
+
maxBytes: LOAD_REPLAY_MAX_BYTES,
|
|
14649
|
+
maxUpdates: LOAD_REPLAY_MAX_UPDATES
|
|
14650
|
+
}
|
|
14651
|
+
} : {},
|
|
14652
|
+
logger: debugLogger8
|
|
14653
|
+
})
|
|
14654
|
+
);
|
|
14655
|
+
addDaemonRequestAttribute(
|
|
14656
|
+
"qwen-code.daemon.session_restore.partial_replay",
|
|
14657
|
+
replay.replayError !== void 0
|
|
14658
|
+
);
|
|
13795
14659
|
if (!bulkReplay) {
|
|
13796
14660
|
try {
|
|
13797
14661
|
for (const update of replay.updates) {
|
|
@@ -13805,18 +14669,25 @@ var QwenAgent = class {
|
|
|
13805
14669
|
}
|
|
13806
14670
|
return response;
|
|
13807
14671
|
}
|
|
14672
|
+
const envelope = {
|
|
14673
|
+
v: LOAD_REPLAY_VERSION,
|
|
14674
|
+
updates: replay.updates,
|
|
14675
|
+
...replayPage.anchorRecordId ? { anchorRecordId: replayPage.anchorRecordId } : {},
|
|
14676
|
+
...replay.replayError !== void 0 ? {
|
|
14677
|
+
partial: true,
|
|
14678
|
+
replayError: replay.replayError
|
|
14679
|
+
} : {},
|
|
14680
|
+
...replayPage.hasMore ? { hasMore: true } : {}
|
|
14681
|
+
};
|
|
14682
|
+
validateLoadReplayEnvelope(
|
|
14683
|
+
sessionId,
|
|
14684
|
+
envelope,
|
|
14685
|
+
restoreOptions.replay.kind === "recent"
|
|
14686
|
+
);
|
|
13808
14687
|
return {
|
|
13809
14688
|
...response,
|
|
13810
14689
|
_meta: {
|
|
13811
|
-
[LOAD_REPLAY_META_KEY]:
|
|
13812
|
-
v: LOAD_REPLAY_VERSION,
|
|
13813
|
-
updates: replay.updates,
|
|
13814
|
-
...replay.replayError !== void 0 ? {
|
|
13815
|
-
partial: true,
|
|
13816
|
-
replayError: replay.replayError
|
|
13817
|
-
} : {},
|
|
13818
|
-
...replayPage.hasMore ? { hasMore: true } : {}
|
|
13819
|
-
}
|
|
14690
|
+
[LOAD_REPLAY_META_KEY]: envelope
|
|
13820
14691
|
}
|
|
13821
14692
|
};
|
|
13822
14693
|
}
|
|
@@ -13858,13 +14729,32 @@ var QwenAgent = class {
|
|
|
13858
14729
|
settings,
|
|
13859
14730
|
sessionSource,
|
|
13860
14731
|
sessionId,
|
|
13861
|
-
true
|
|
14732
|
+
true,
|
|
14733
|
+
{},
|
|
14734
|
+
void 0,
|
|
14735
|
+
restoreOptions
|
|
13862
14736
|
)
|
|
13863
14737
|
);
|
|
13864
|
-
const
|
|
14738
|
+
const projection = config.consumeSessionRestoreProjection?.();
|
|
14739
|
+
const suppressRecoveredGoalPresentation = projection?.runtime.goalRecoverySourceUuid !== void 0 && projection.runtime.goalRecoverySourceUuid !== projection.replay?.goalRecoverySourceUuid;
|
|
13865
14740
|
const bulkReplay = isBulkLoadReplayRequest(params);
|
|
13866
|
-
const replayPageSize = bulkReplay ? getLoadReplayPageSize(params) : void 0;
|
|
13867
14741
|
let replayEnvelope;
|
|
14742
|
+
const replayUsage = createReplayCumulativeUsage();
|
|
14743
|
+
let recoveredGoalPublicationKey;
|
|
14744
|
+
let suppressedRecoveredGoalId;
|
|
14745
|
+
let streamGoalUpdates = [];
|
|
14746
|
+
let response;
|
|
14747
|
+
const buildResponse = /* @__PURE__ */ __name(() => profiler.timeSync("response_build", () => ({
|
|
14748
|
+
modes: this.buildModesData(config),
|
|
14749
|
+
models: this.buildAvailableModels(config),
|
|
14750
|
+
configOptions: this.buildConfigOptions(config),
|
|
14751
|
+
...projection?.runtime.artifactSnapshot ? { artifactSnapshot: projection.runtime.artifactSnapshot } : {},
|
|
14752
|
+
...replayEnvelope ? {
|
|
14753
|
+
_meta: {
|
|
14754
|
+
[LOAD_REPLAY_META_KEY]: replayEnvelope
|
|
14755
|
+
}
|
|
14756
|
+
} : {}
|
|
14757
|
+
})), "buildResponse");
|
|
13868
14758
|
try {
|
|
13869
14759
|
await profiler.time("auth", () => this.ensureAuthenticated(config));
|
|
13870
14760
|
profiler.timeSync(
|
|
@@ -13873,91 +14763,165 @@ var QwenAgent = class {
|
|
|
13873
14763
|
);
|
|
13874
14764
|
await profiler.time(
|
|
13875
14765
|
"session_register",
|
|
13876
|
-
() => this.createAndStoreSession(config, settings,
|
|
14766
|
+
() => this.createAndStoreSession(config, settings, void 0, {
|
|
13877
14767
|
enableLiveScreenContext: isCompatibleLiveSessionSource(
|
|
13878
14768
|
sessionSource ?? {}
|
|
13879
14769
|
),
|
|
13880
|
-
|
|
13881
|
-
|
|
13882
|
-
if (bulkReplay) {
|
|
13883
|
-
const
|
|
13884
|
-
|
|
13885
|
-
|
|
13886
|
-
createdSession.primeTurnFromHistory(records);
|
|
13887
|
-
const visibleRecords = selectVisibleHistoryRecords(
|
|
13888
|
-
records,
|
|
13889
|
-
shouldHideInheritedHistory(params)
|
|
13890
|
-
);
|
|
13891
|
-
const replayPage = selectRecentHistoryRecords(
|
|
13892
|
-
visibleRecords,
|
|
13893
|
-
replayPageSize
|
|
13894
|
-
);
|
|
13895
|
-
const replayUsage = createReplayCumulativeUsage();
|
|
13896
|
-
const replay = await collectHistoryReplayUpdates({
|
|
14770
|
+
replayHistory: false,
|
|
14771
|
+
prepareBeforeSessionCreate: /* @__PURE__ */ __name(async () => {
|
|
14772
|
+
if (bulkReplay && projection?.replay) {
|
|
14773
|
+
const replay = await profiler.time(
|
|
14774
|
+
"history_replay",
|
|
14775
|
+
() => collectHistoryReplayUpdates({
|
|
13897
14776
|
sessionId,
|
|
13898
14777
|
config,
|
|
13899
|
-
records:
|
|
13900
|
-
gaps:
|
|
14778
|
+
records: projection.replay.records,
|
|
14779
|
+
gaps: projection.replay.gaps,
|
|
13901
14780
|
cumulativeUsage: replayUsage,
|
|
13902
|
-
|
|
14781
|
+
replayState: projection.replay.replay,
|
|
14782
|
+
goalBootstrap: replayGoalBootstrap(projection),
|
|
14783
|
+
...restoreOptions.replay.kind === "recent" ? {
|
|
14784
|
+
limits: {
|
|
14785
|
+
maxBytes: LOAD_REPLAY_MAX_BYTES,
|
|
14786
|
+
maxUpdates: LOAD_REPLAY_MAX_UPDATES
|
|
14787
|
+
}
|
|
14788
|
+
} : {},
|
|
13903
14789
|
logger: debugLogger8
|
|
13904
|
-
})
|
|
13905
|
-
|
|
13906
|
-
|
|
13907
|
-
|
|
13908
|
-
|
|
13909
|
-
|
|
13910
|
-
|
|
13911
|
-
|
|
13912
|
-
|
|
13913
|
-
|
|
13914
|
-
|
|
13915
|
-
|
|
13916
|
-
|
|
13917
|
-
|
|
13918
|
-
}
|
|
13919
|
-
|
|
13920
|
-
|
|
13921
|
-
|
|
13922
|
-
|
|
13923
|
-
|
|
14790
|
+
})
|
|
14791
|
+
);
|
|
14792
|
+
addDaemonRequestAttribute(
|
|
14793
|
+
"qwen-code.daemon.session_restore.partial_replay",
|
|
14794
|
+
replay.replayError !== void 0
|
|
14795
|
+
);
|
|
14796
|
+
replayEnvelope = {
|
|
14797
|
+
v: LOAD_REPLAY_VERSION,
|
|
14798
|
+
updates: replay.updates,
|
|
14799
|
+
...projection.replay.anchorRecordId ? { anchorRecordId: projection.replay.anchorRecordId } : {},
|
|
14800
|
+
...replay.replayError !== void 0 ? {
|
|
14801
|
+
partial: true,
|
|
14802
|
+
replayError: replay.replayError
|
|
14803
|
+
} : {},
|
|
14804
|
+
...projection.replay.hasMore ? { hasMore: true } : {}
|
|
14805
|
+
};
|
|
14806
|
+
validateLoadReplayEnvelope(
|
|
14807
|
+
sessionId,
|
|
14808
|
+
replayEnvelope,
|
|
14809
|
+
restoreOptions.replay.kind === "recent"
|
|
14810
|
+
);
|
|
14811
|
+
}
|
|
14812
|
+
const goalBootstrap = replayGoalBootstrap(projection);
|
|
14813
|
+
const rendered = await renderPreparedGoalUpdate(
|
|
14814
|
+
() => config.getGoalRuntimePrepared(),
|
|
14815
|
+
{
|
|
14816
|
+
...projection?.replay?.records ? { replayedRecords: projection.replay.records } : {},
|
|
14817
|
+
...suppressRecoveredGoalPresentation ? { hideRuntimeGoal: true } : {},
|
|
14818
|
+
...goalBootstrap ? { bootstrap: goalBootstrap } : {}
|
|
13924
14819
|
}
|
|
14820
|
+
).catch((error) => {
|
|
14821
|
+
if (suppressRecoveredGoalPresentation) throw error;
|
|
14822
|
+
debugLogger8.debug(
|
|
14823
|
+
`Failed to render recovered Goal state: ${error instanceof Error ? error.message : String(error)}`
|
|
14824
|
+
);
|
|
14825
|
+
return {
|
|
14826
|
+
publicationKey: void 0,
|
|
14827
|
+
suppressedGoalId: void 0,
|
|
14828
|
+
updates: []
|
|
14829
|
+
};
|
|
14830
|
+
});
|
|
14831
|
+
recoveredGoalPublicationKey = rendered.publicationKey;
|
|
14832
|
+
suppressedRecoveredGoalId = rendered.suppressedGoalId;
|
|
14833
|
+
if (!bulkReplay) {
|
|
14834
|
+
streamGoalUpdates = rendered.updates;
|
|
14835
|
+
return;
|
|
14836
|
+
}
|
|
14837
|
+
const goalUpdates = rendered.updates;
|
|
14838
|
+
if (goalUpdates.length > 0) {
|
|
13925
14839
|
replayEnvelope ??= {
|
|
13926
14840
|
v: LOAD_REPLAY_VERSION,
|
|
13927
|
-
updates:
|
|
14841
|
+
updates: []
|
|
13928
14842
|
};
|
|
14843
|
+
replayEnvelope.updates.push(...goalUpdates);
|
|
14844
|
+
validateLoadReplayEnvelope(
|
|
14845
|
+
sessionId,
|
|
14846
|
+
replayEnvelope,
|
|
14847
|
+
restoreOptions.replay.kind === "recent"
|
|
14848
|
+
);
|
|
13929
14849
|
}
|
|
13930
|
-
|
|
13931
|
-
|
|
13932
|
-
|
|
13933
|
-
|
|
13934
|
-
|
|
13935
|
-
|
|
14850
|
+
}, "prepareBeforeSessionCreate"),
|
|
14851
|
+
beforeSessionCreate: /* @__PURE__ */ __name(() => {
|
|
14852
|
+
response = buildResponse();
|
|
14853
|
+
}, "beforeSessionCreate"),
|
|
14854
|
+
primeSession: /* @__PURE__ */ __name((createdSession) => {
|
|
14855
|
+
profiler.timeSync("runtime_initialize", () => {
|
|
14856
|
+
if (!projection) return;
|
|
14857
|
+
createdSession.primeTurnState(
|
|
14858
|
+
projection.runtime.initialTurn,
|
|
14859
|
+
projection.runtime.backgroundNotificationTaskIds
|
|
14860
|
+
);
|
|
14861
|
+
copyCumulativeUsage(
|
|
14862
|
+
createdSession.cumulativeUsage,
|
|
14863
|
+
replayUsage
|
|
14864
|
+
);
|
|
14865
|
+
createdSession.primeRecoveredGoalPublication(
|
|
14866
|
+
recoveredGoalPublicationKey,
|
|
14867
|
+
suppressedRecoveredGoalId
|
|
14868
|
+
);
|
|
14869
|
+
});
|
|
14870
|
+
}, "primeSession"),
|
|
14871
|
+
beforeStartPostReplayServices: /* @__PURE__ */ __name(async (createdSession) => {
|
|
14872
|
+
if (!bulkReplay && projection?.replay) {
|
|
14873
|
+
await profiler.time("history_replay", async () => {
|
|
14874
|
+
const goalBootstrap = replayGoalBootstrap(projection);
|
|
14875
|
+
const initialGoalState = replayInitialGoalState(projection);
|
|
14876
|
+
const hasGoalReplayState = goalBootstrap !== void 0 || initialGoalState.initialGoalState !== void 0 || initialGoalState.initialGoalCause !== void 0;
|
|
14877
|
+
if (hasGoalReplayState) {
|
|
14878
|
+
await createdSession.replayHistory(
|
|
14879
|
+
projection.replay.records,
|
|
14880
|
+
projection.replay.gaps,
|
|
14881
|
+
{
|
|
14882
|
+
...goalBootstrap ? { goalBootstrap } : {},
|
|
14883
|
+
...initialGoalState
|
|
14884
|
+
}
|
|
14885
|
+
);
|
|
14886
|
+
} else {
|
|
14887
|
+
await createdSession.replayHistory(
|
|
14888
|
+
projection.replay.records,
|
|
14889
|
+
projection.replay.gaps
|
|
14890
|
+
);
|
|
14891
|
+
}
|
|
14892
|
+
});
|
|
14893
|
+
try {
|
|
14894
|
+
for (const update of streamGoalUpdates) {
|
|
14895
|
+
await createdSession.sendUpdate(update);
|
|
14896
|
+
}
|
|
14897
|
+
} catch (error) {
|
|
14898
|
+
debugLogger8.debug(
|
|
14899
|
+
`Failed to publish recovered Goal state: ${error instanceof Error ? error.message : String(error)}`
|
|
14900
|
+
);
|
|
14901
|
+
}
|
|
14902
|
+
}
|
|
14903
|
+
await profiler.time("post_replay_services", async () => {
|
|
14904
|
+
await this.#restoreWorktreeOnResume(config, createdSession);
|
|
14905
|
+
await this.#restoreBackgroundAgentsOnResume(
|
|
14906
|
+
config,
|
|
14907
|
+
createdSession
|
|
14908
|
+
);
|
|
14909
|
+
});
|
|
13936
14910
|
}, "beforeStartPostReplayServices")
|
|
13937
14911
|
})
|
|
13938
14912
|
);
|
|
13939
14913
|
} catch (error) {
|
|
13940
|
-
return this.cleanupAfterRequestFailure(
|
|
13941
|
-
|
|
13942
|
-
|
|
13943
|
-
|
|
13944
|
-
|
|
14914
|
+
return this.cleanupAfterRequestFailure(
|
|
14915
|
+
error,
|
|
14916
|
+
async () => {
|
|
14917
|
+
if (this.sessions.get(config.getSessionId())?.getConfig() !== config) {
|
|
14918
|
+
await this.cleanupUnstoredConfig(config);
|
|
14919
|
+
}
|
|
14920
|
+
},
|
|
14921
|
+
sessionId
|
|
14922
|
+
);
|
|
13945
14923
|
}
|
|
13946
|
-
return
|
|
13947
|
-
const response = {
|
|
13948
|
-
modes: this.buildModesData(config),
|
|
13949
|
-
models: this.buildAvailableModels(config),
|
|
13950
|
-
configOptions: this.buildConfigOptions(config),
|
|
13951
|
-
...sessionData?.artifactSnapshot ? { artifactSnapshot: sessionData.artifactSnapshot } : {}
|
|
13952
|
-
};
|
|
13953
|
-
if (!replayEnvelope) return response;
|
|
13954
|
-
return {
|
|
13955
|
-
...response,
|
|
13956
|
-
_meta: {
|
|
13957
|
-
[LOAD_REPLAY_META_KEY]: replayEnvelope
|
|
13958
|
-
}
|
|
13959
|
-
};
|
|
13960
|
-
});
|
|
14924
|
+
return response;
|
|
13961
14925
|
} finally {
|
|
13962
14926
|
releaseStartingSessionId();
|
|
13963
14927
|
}
|
|
@@ -13995,13 +14959,14 @@ var QwenAgent = class {
|
|
|
13995
14959
|
return this.withLiveSessionRestore(
|
|
13996
14960
|
sessionId,
|
|
13997
14961
|
liveSession,
|
|
13998
|
-
|
|
14962
|
+
RESUME_RESTORE_OPTIONS,
|
|
14963
|
+
async (config, projection) => profiler.timeSync(
|
|
13999
14964
|
"response_build",
|
|
14000
14965
|
() => ({
|
|
14001
14966
|
modes: this.buildModesData(config),
|
|
14002
14967
|
models: this.buildAvailableModels(config),
|
|
14003
14968
|
configOptions: this.buildConfigOptions(config),
|
|
14004
|
-
...
|
|
14969
|
+
...projection?.artifactSnapshot ? { artifactSnapshot: projection.artifactSnapshot } : {}
|
|
14005
14970
|
})
|
|
14006
14971
|
)
|
|
14007
14972
|
);
|
|
@@ -14038,9 +15003,14 @@ var QwenAgent = class {
|
|
|
14038
15003
|
settings,
|
|
14039
15004
|
sessionSource,
|
|
14040
15005
|
sessionId,
|
|
14041
|
-
true
|
|
15006
|
+
true,
|
|
15007
|
+
{},
|
|
15008
|
+
void 0,
|
|
15009
|
+
RESUME_RESTORE_OPTIONS
|
|
14042
15010
|
)
|
|
14043
15011
|
);
|
|
15012
|
+
const projection = config.consumeSessionRestoreProjection?.();
|
|
15013
|
+
let response;
|
|
14044
15014
|
try {
|
|
14045
15015
|
await profiler.time("auth", () => this.ensureAuthenticated(config));
|
|
14046
15016
|
profiler.timeSync(
|
|
@@ -14049,43 +15019,51 @@ var QwenAgent = class {
|
|
|
14049
15019
|
);
|
|
14050
15020
|
await profiler.time(
|
|
14051
15021
|
"session_register",
|
|
14052
|
-
() => this.createAndStoreSession(
|
|
14053
|
-
|
|
14054
|
-
|
|
14055
|
-
|
|
14056
|
-
|
|
14057
|
-
|
|
14058
|
-
|
|
14059
|
-
|
|
14060
|
-
|
|
14061
|
-
|
|
15022
|
+
() => this.createAndStoreSession(config, settings, void 0, {
|
|
15023
|
+
enableLiveScreenContext: isCompatibleLiveSessionSource(
|
|
15024
|
+
sessionSource ?? {}
|
|
15025
|
+
),
|
|
15026
|
+
replayHistory: false,
|
|
15027
|
+
beforeSessionCreate: /* @__PURE__ */ __name(() => {
|
|
15028
|
+
response = profiler.timeSync("response_build", () => ({
|
|
15029
|
+
modes: this.buildModesData(config),
|
|
15030
|
+
models: this.buildAvailableModels(config),
|
|
15031
|
+
configOptions: this.buildConfigOptions(config),
|
|
15032
|
+
...projection?.runtime.artifactSnapshot ? { artifactSnapshot: projection.runtime.artifactSnapshot } : {}
|
|
15033
|
+
}));
|
|
15034
|
+
}, "beforeSessionCreate"),
|
|
15035
|
+
primeSession: /* @__PURE__ */ __name((createdSession) => {
|
|
15036
|
+
profiler.timeSync("runtime_initialize", () => {
|
|
15037
|
+
if (!projection) return;
|
|
15038
|
+
createdSession.primeTurnState(
|
|
15039
|
+
projection.runtime.initialTurn,
|
|
15040
|
+
projection.runtime.backgroundNotificationTaskIds
|
|
15041
|
+
);
|
|
15042
|
+
});
|
|
15043
|
+
}, "primeSession"),
|
|
15044
|
+
beforeStartPostReplayServices: /* @__PURE__ */ __name(async (createdSession) => {
|
|
15045
|
+
await profiler.time("post_replay_services", async () => {
|
|
14062
15046
|
await this.#restoreWorktreeOnResume(config, createdSession);
|
|
14063
15047
|
await this.#restoreBackgroundAgentsOnResume(
|
|
14064
15048
|
config,
|
|
14065
15049
|
createdSession
|
|
14066
15050
|
);
|
|
14067
|
-
|
|
14068
|
-
|
|
14069
|
-
|
|
14070
|
-
)
|
|
15051
|
+
});
|
|
15052
|
+
}, "beforeStartPostReplayServices")
|
|
15053
|
+
})
|
|
14071
15054
|
);
|
|
14072
15055
|
} catch (error) {
|
|
14073
|
-
return this.cleanupAfterRequestFailure(
|
|
14074
|
-
|
|
14075
|
-
|
|
14076
|
-
|
|
14077
|
-
|
|
15056
|
+
return this.cleanupAfterRequestFailure(
|
|
15057
|
+
error,
|
|
15058
|
+
async () => {
|
|
15059
|
+
if (this.sessions.get(config.getSessionId())?.getConfig() !== config) {
|
|
15060
|
+
await this.cleanupUnstoredConfig(config);
|
|
15061
|
+
}
|
|
15062
|
+
},
|
|
15063
|
+
sessionId
|
|
15064
|
+
);
|
|
14078
15065
|
}
|
|
14079
|
-
|
|
14080
|
-
return profiler.timeSync(
|
|
14081
|
-
"response_build",
|
|
14082
|
-
() => ({
|
|
14083
|
-
modes: this.buildModesData(config),
|
|
14084
|
-
models: this.buildAvailableModels(config),
|
|
14085
|
-
configOptions: this.buildConfigOptions(config),
|
|
14086
|
-
...sessionData?.artifactSnapshot ? { artifactSnapshot: sessionData.artifactSnapshot } : {}
|
|
14087
|
-
})
|
|
14088
|
-
);
|
|
15066
|
+
return response;
|
|
14089
15067
|
} finally {
|
|
14090
15068
|
releaseStartingSessionId();
|
|
14091
15069
|
}
|
|
@@ -14111,48 +15089,6 @@ var QwenAgent = class {
|
|
|
14111
15089
|
await config.loadPausedBackgroundAgents(config.getSessionId());
|
|
14112
15090
|
session.pendingRecoveredAgentsNotice = config.consumePendingRecoveredAgentsNotice();
|
|
14113
15091
|
}
|
|
14114
|
-
/**
|
|
14115
|
-
* Re-registers the `/goal` Stop hook when a resumed transcript ends on an
|
|
14116
|
-
* unsatisfied goal — the daemon counterpart of the TUI's resume restore.
|
|
14117
|
-
* Without this the goal loop silently dies whenever a session is reloaded or
|
|
14118
|
-
* `qwen serve` restarts, even though the transcript still shows it as active.
|
|
14119
|
-
*
|
|
14120
|
-
* The `addItem` bridge that `restoreGoalFromHistory` takes in the TUI is not
|
|
14121
|
-
* used here — the daemon's terminal card goes out over the wire, not into an
|
|
14122
|
-
* Ink history. But restore reaches `unregisterGoalHook` on every path,
|
|
14123
|
-
* including the one where there was nothing to restore, and that clears the
|
|
14124
|
-
* observer the `Session` constructor installed. So it is put back afterwards,
|
|
14125
|
-
* unconditionally: without it a restored goal that later achieves or fails
|
|
14126
|
-
* emits no terminal update and persists no terminal card, and the next reload
|
|
14127
|
-
* revives a goal that already finished.
|
|
14128
|
-
*
|
|
14129
|
-
* Best-effort: a failed restore must not block session load.
|
|
14130
|
-
*/
|
|
14131
|
-
#restoreGoalOnResume(config, session) {
|
|
14132
|
-
try {
|
|
14133
|
-
const records = config.getResumedSessionData()?.conversation.messages;
|
|
14134
|
-
if (!records?.length) return;
|
|
14135
|
-
const restored = restoreGoalFromHistory(
|
|
14136
|
-
collectGoalStatusItemsFromRecords(records),
|
|
14137
|
-
config
|
|
14138
|
-
);
|
|
14139
|
-
if (restored.restored) {
|
|
14140
|
-
debugLogger8.info(
|
|
14141
|
-
`ACP goal restored sessionId=${config.getSessionId()} condition=${restored.condition}`
|
|
14142
|
-
);
|
|
14143
|
-
} else if (restored.blockedBy && restored.blockedBy !== "condition-invalid") {
|
|
14144
|
-
writeStderrLineSafe(
|
|
14145
|
-
`qwen: not restoring the active goal for session ${config.getSessionId()} (${restored.blockedBy}).`
|
|
14146
|
-
);
|
|
14147
|
-
}
|
|
14148
|
-
} catch (error) {
|
|
14149
|
-
writeStderrLineSafe(
|
|
14150
|
-
`qwen: goal restore failed for session ${config.getSessionId()}: ${error}`
|
|
14151
|
-
);
|
|
14152
|
-
} finally {
|
|
14153
|
-
session.installGoalTerminalObserver();
|
|
14154
|
-
}
|
|
14155
|
-
}
|
|
14156
15092
|
async unstable_listSessions(params) {
|
|
14157
15093
|
const cwd = params.cwd || process.cwd();
|
|
14158
15094
|
const numericCursor = parseAcpSessionListCursor(params.cursor);
|
|
@@ -14233,6 +15169,29 @@ var QwenAgent = class {
|
|
|
14233
15169
|
break;
|
|
14234
15170
|
}
|
|
14235
15171
|
case "reasoning_effort": {
|
|
15172
|
+
const modelReasoning = this.getModelReasoningConfiguration(
|
|
15173
|
+
session.getConfig()
|
|
15174
|
+
);
|
|
15175
|
+
if (modelReasoning) {
|
|
15176
|
+
const selected = value === ACP_REASONING_EFFORT_NONE ? ACP_REASONING_EFFORT_NONE : modelReasoning.efforts.find((effort2) => effort2 === value);
|
|
15177
|
+
if (!selected) {
|
|
15178
|
+
throw RequestError.invalidParams(
|
|
15179
|
+
void 0,
|
|
15180
|
+
`Unknown reasoning effort: ${value}. Choose one of: ${ACP_REASONING_EFFORT_NONE}, ${modelReasoning.efforts.join(", ")}`
|
|
15181
|
+
);
|
|
15182
|
+
}
|
|
15183
|
+
const generation = session.getConfig().getContentGeneratorConfig();
|
|
15184
|
+
if (selected === ACP_REASONING_EFFORT_NONE) {
|
|
15185
|
+
generation.reasoning = false;
|
|
15186
|
+
} else {
|
|
15187
|
+
const current = generation.reasoning;
|
|
15188
|
+
generation.reasoning = {
|
|
15189
|
+
...current || {},
|
|
15190
|
+
effort: selected
|
|
15191
|
+
};
|
|
15192
|
+
}
|
|
15193
|
+
break;
|
|
15194
|
+
}
|
|
14236
15195
|
const effort = value === ACP_REASONING_EFFORT_DEFAULT ? void 0 : REASONING_EFFORT_TIERS.find((tier) => tier === value);
|
|
14237
15196
|
if (value !== ACP_REASONING_EFFORT_DEFAULT && effort === void 0) {
|
|
14238
15197
|
throw RequestError.invalidParams(
|
|
@@ -14268,9 +15227,14 @@ var QwenAgent = class {
|
|
|
14268
15227
|
const meta = params._meta && typeof params._meta === "object" ? { ...params._meta } : {};
|
|
14269
15228
|
const suppliedContext = meta[INVOCATION_CONTEXT_META_KEY];
|
|
14270
15229
|
const suppliedModelPrompt = meta[DAEMON_MODEL_PROMPT_META_KEY];
|
|
15230
|
+
const suppliedPromptDisplayText = meta[DAEMON_PROMPT_DISPLAY_TEXT_META_KEY];
|
|
14271
15231
|
delete meta[INVOCATION_CONTEXT_META_KEY];
|
|
14272
15232
|
delete meta[DAEMON_MODEL_PROMPT_META_KEY];
|
|
14273
15233
|
delete meta[PRIVATE_PARENT_CAPABILITY_META_KEY];
|
|
15234
|
+
delete meta[DAEMON_PROMPT_DISPLAY_TEXT_META_KEY];
|
|
15235
|
+
if (this.privateParentState === "trusted" && typeof suppliedPromptDisplayText === "string") {
|
|
15236
|
+
meta[DAEMON_PROMPT_DISPLAY_TEXT_META_KEY] = suppliedPromptDisplayText;
|
|
15237
|
+
}
|
|
14274
15238
|
if (Object.keys(meta).length > 0) {
|
|
14275
15239
|
sanitizedParams._meta = meta;
|
|
14276
15240
|
} else {
|
|
@@ -18390,21 +19354,34 @@ ${outputText}
|
|
|
18390
19354
|
}
|
|
18391
19355
|
const session = this.sessionOrThrow(sessionId);
|
|
18392
19356
|
const config = session.getConfig();
|
|
18393
|
-
|
|
18394
|
-
|
|
18395
|
-
|
|
18396
|
-
|
|
18397
|
-
|
|
18398
|
-
|
|
18399
|
-
|
|
18400
|
-
|
|
19357
|
+
let runtime;
|
|
19358
|
+
try {
|
|
19359
|
+
runtime = await config.getGoalRuntimeReady();
|
|
19360
|
+
} catch (error) {
|
|
19361
|
+
if (!(error instanceof GoalPersistenceUnavailableError)) throw error;
|
|
19362
|
+
debugLogger8.info(
|
|
19363
|
+
`sessionGoalClear sessionId=${sessionId} cleared=false (goal persistence unavailable)`
|
|
19364
|
+
);
|
|
19365
|
+
return {
|
|
19366
|
+
cleared: false,
|
|
19367
|
+
condition: void 0,
|
|
19368
|
+
snapshot: emptyGoalSnapshot()
|
|
19369
|
+
};
|
|
18401
19370
|
}
|
|
19371
|
+
const before = runtime.getSnapshot();
|
|
19372
|
+
const goal = before.goal;
|
|
19373
|
+
const response = goal ? await runtime.dispatch({
|
|
19374
|
+
action: "clear",
|
|
19375
|
+
expectedGoalId: goal.goalId,
|
|
19376
|
+
expectedRevision: goal.revision
|
|
19377
|
+
}) : { snapshot: before };
|
|
18402
19378
|
debugLogger8.info(
|
|
18403
|
-
`sessionGoalClear sessionId=${sessionId} cleared=${!!
|
|
19379
|
+
`sessionGoalClear sessionId=${sessionId} cleared=${!!goal} objective=${goal?.objective ?? "(none)"}`
|
|
18404
19380
|
);
|
|
18405
19381
|
return {
|
|
18406
|
-
cleared: !!
|
|
18407
|
-
condition:
|
|
19382
|
+
cleared: !!goal,
|
|
19383
|
+
condition: goal?.objective,
|
|
19384
|
+
snapshot: response.snapshot
|
|
18408
19385
|
};
|
|
18409
19386
|
}
|
|
18410
19387
|
case SERVE_CONTROL_EXT_METHODS.sessionGoalGet: {
|
|
@@ -18415,16 +19392,22 @@ ${outputText}
|
|
|
18415
19392
|
"Invalid or missing sessionId"
|
|
18416
19393
|
);
|
|
18417
19394
|
}
|
|
18418
|
-
this.sessionOrThrow(sessionId);
|
|
18419
|
-
|
|
19395
|
+
const session = this.sessionOrThrow(sessionId);
|
|
19396
|
+
let snapshot;
|
|
19397
|
+
try {
|
|
19398
|
+
snapshot = (await session.getConfig().getGoalRuntimeReady()).getSnapshot();
|
|
19399
|
+
} catch (error) {
|
|
19400
|
+
if (!(error instanceof GoalPersistenceUnavailableError)) throw error;
|
|
19401
|
+
snapshot = emptyGoalSnapshot();
|
|
19402
|
+
}
|
|
19403
|
+
const activeGoal = snapshot.goal?.status === "active" ? snapshot.goal : null;
|
|
18420
19404
|
return {
|
|
18421
|
-
|
|
18422
|
-
|
|
18423
|
-
|
|
18424
|
-
|
|
18425
|
-
|
|
18426
|
-
|
|
18427
|
-
...active.lastReason !== void 0 ? { lastReason: active.lastReason } : {}
|
|
19405
|
+
snapshot,
|
|
19406
|
+
active: activeGoal ? {
|
|
19407
|
+
condition: activeGoal.objective,
|
|
19408
|
+
iterations: activeGoal.turnCount,
|
|
19409
|
+
setAt: activeGoal.createdAt,
|
|
19410
|
+
...activeGoal.lastReason !== void 0 ? { lastReason: activeGoal.lastReason } : {}
|
|
18428
19411
|
} : null
|
|
18429
19412
|
};
|
|
18430
19413
|
}
|
|
@@ -19412,7 +20395,7 @@ ${outputText}
|
|
|
19412
20395
|
throw error;
|
|
19413
20396
|
}
|
|
19414
20397
|
}
|
|
19415
|
-
async newSessionConfig(cwd, mcpServers, settings, sessionSource, sessionId, resume, initializeOptions = {}, chatRecording) {
|
|
20398
|
+
async newSessionConfig(cwd, mcpServers, settings, sessionSource, sessionId, resume, initializeOptions = {}, chatRecording, restoreOptions) {
|
|
19416
20399
|
try {
|
|
19417
20400
|
this.assertManagedSessionAdmission();
|
|
19418
20401
|
return await this.runWithPinnedRuntimeBaseDir(settings, cwd, async () => {
|
|
@@ -19428,7 +20411,8 @@ ${outputText}
|
|
|
19428
20411
|
sessionId,
|
|
19429
20412
|
resume,
|
|
19430
20413
|
initializeOptions,
|
|
19431
|
-
chatRecording
|
|
20414
|
+
chatRecording,
|
|
20415
|
+
restoreOptions
|
|
19432
20416
|
);
|
|
19433
20417
|
});
|
|
19434
20418
|
} catch (error) {
|
|
@@ -19444,10 +20428,10 @@ ${outputText}
|
|
|
19444
20428
|
errorKind: writerError.errorKind
|
|
19445
20429
|
});
|
|
19446
20430
|
}
|
|
19447
|
-
throw error;
|
|
20431
|
+
throw sessionId && restoreOptions ? mapSessionRestoreRequestError(error, sessionId) : error;
|
|
19448
20432
|
}
|
|
19449
20433
|
}
|
|
19450
|
-
async newSessionConfigInRuntimeContext(cwd, mcpServers, settings, sessionSource, sessionId, resume, initializeOptions = {}, chatRecording) {
|
|
20434
|
+
async newSessionConfigInRuntimeContext(cwd, mcpServers, settings, sessionSource, sessionId, resume, initializeOptions = {}, chatRecording, restoreOptions) {
|
|
19451
20435
|
const sessionMcpServers = {};
|
|
19452
20436
|
for (const server of mcpServers) {
|
|
19453
20437
|
const stdioServer = toStdioServer(server);
|
|
@@ -19545,7 +20529,19 @@ ${outputText}
|
|
|
19545
20529
|
// not process.exit(1) the shared ACP child and every session on its
|
|
19546
20530
|
// channel. newSessionConfig maps the throw to a RequestError.
|
|
19547
20531
|
true,
|
|
19548
|
-
this.managedToolInvocationGuard ? {
|
|
20532
|
+
this.managedToolInvocationGuard || restoreOptions ? {
|
|
20533
|
+
...this.managedToolInvocationGuard ? { toolInvocationGuard: this.managedToolInvocationGuard } : {},
|
|
20534
|
+
...restoreOptions && sessionId ? {
|
|
20535
|
+
sessionRestore: {
|
|
20536
|
+
projectionSource: /* @__PURE__ */ __name((restoreSessionId) => new SessionService(cwd, {
|
|
20537
|
+
runtimeBaseDir: Storage.getRuntimeBaseDir()
|
|
20538
|
+
}).readRestoreProjection(
|
|
20539
|
+
restoreSessionId,
|
|
20540
|
+
restoreOptions
|
|
20541
|
+
), "projectionSource")
|
|
20542
|
+
}
|
|
20543
|
+
} : {}
|
|
20544
|
+
} : void 0
|
|
19549
20545
|
);
|
|
19550
20546
|
if (sessionSource) {
|
|
19551
20547
|
config.setSessionSource(sessionSource.sourceType, sessionSource.sourceId);
|
|
@@ -19682,6 +20678,16 @@ ${outputText}
|
|
|
19682
20678
|
{ errorKind: "session_id_conflict", sessionId }
|
|
19683
20679
|
);
|
|
19684
20680
|
}
|
|
20681
|
+
await options.prepareBeforeSessionCreate?.();
|
|
20682
|
+
this.assertManagedSessionAdmission();
|
|
20683
|
+
if (this.sessions.has(sessionId)) {
|
|
20684
|
+
throw new RequestError(
|
|
20685
|
+
ACP_ERROR_CODES.INVALID_PARAMS,
|
|
20686
|
+
`Session ${sessionId} is already active.`,
|
|
20687
|
+
{ errorKind: "session_id_conflict", sessionId }
|
|
20688
|
+
);
|
|
20689
|
+
}
|
|
20690
|
+
options.beforeSessionCreate?.();
|
|
19685
20691
|
const session = new Session(
|
|
19686
20692
|
sessionId,
|
|
19687
20693
|
config,
|
|
@@ -19689,10 +20695,14 @@ ${outputText}
|
|
|
19689
20695
|
settings,
|
|
19690
20696
|
() => this.activeWorkReporter?.notifyChanged()
|
|
19691
20697
|
);
|
|
19692
|
-
|
|
19693
|
-
this.activeWorkReporter?.notifyChanged();
|
|
19694
|
-
this.initializingConfigs.delete(config);
|
|
20698
|
+
let published = false;
|
|
19695
20699
|
try {
|
|
20700
|
+
options.primeSession?.(session);
|
|
20701
|
+
config.hydrateSessionRestoreFileHistory?.();
|
|
20702
|
+
this.sessions.set(sessionId, session);
|
|
20703
|
+
published = true;
|
|
20704
|
+
this.activeWorkReporter?.notifyChanged();
|
|
20705
|
+
this.initializingConfigs.delete(config);
|
|
19696
20706
|
if (options.enableLiveScreenContext) {
|
|
19697
20707
|
await session.enableLiveScreenContext();
|
|
19698
20708
|
}
|
|
@@ -19707,15 +20717,35 @@ ${outputText}
|
|
|
19707
20717
|
sessionData.conversation.messages,
|
|
19708
20718
|
sessionData.historyGaps
|
|
19709
20719
|
);
|
|
20720
|
+
try {
|
|
20721
|
+
await session.publishRecoveredGoalState(
|
|
20722
|
+
sessionData.conversation.messages
|
|
20723
|
+
);
|
|
20724
|
+
} catch (error) {
|
|
20725
|
+
debugLogger8.debug(
|
|
20726
|
+
`Failed to publish recovered Goal state: ${error instanceof Error ? error.message : String(error)}`
|
|
20727
|
+
);
|
|
20728
|
+
}
|
|
19710
20729
|
}
|
|
19711
20730
|
await options.beforeStartPostReplayServices?.(session);
|
|
19712
20731
|
session.installRewriter();
|
|
20732
|
+
config.finalizeSessionRestore?.();
|
|
19713
20733
|
session.startCronScheduler();
|
|
19714
20734
|
setTimeout(() => {
|
|
19715
20735
|
void session.sendAvailableCommandsUpdate();
|
|
19716
20736
|
}, 0);
|
|
19717
20737
|
return session;
|
|
19718
20738
|
} catch (error) {
|
|
20739
|
+
if (!published) {
|
|
20740
|
+
try {
|
|
20741
|
+
session.dispose();
|
|
20742
|
+
} catch (disposeError) {
|
|
20743
|
+
debugLogger8.warn(
|
|
20744
|
+
`Failed to dispose unpublished session ${sessionId}: ${disposeError instanceof Error ? disposeError.message : String(disposeError)}`
|
|
20745
|
+
);
|
|
20746
|
+
}
|
|
20747
|
+
throw error;
|
|
20748
|
+
}
|
|
19719
20749
|
try {
|
|
19720
20750
|
await this.discardStoredSessionIfCurrent(sessionId, session, {
|
|
19721
20751
|
shutdownConfig: false
|
|
@@ -19807,13 +20837,41 @@ ${outputText}
|
|
|
19807
20837
|
currentValue: currentModelId,
|
|
19808
20838
|
options: configModelOptions
|
|
19809
20839
|
};
|
|
19810
|
-
const
|
|
20840
|
+
const modelReasoning = this.getModelReasoningConfiguration(config);
|
|
20841
|
+
const currentModelEffort = config.getReasoningEffort?.();
|
|
20842
|
+
const reasoningEffortConfigOption = modelReasoning ? {
|
|
20843
|
+
id: "reasoning_effort",
|
|
20844
|
+
name: "Reasoning effort",
|
|
20845
|
+
description: `Thinking and reasoning effort for ${rawCurrentModelId}`,
|
|
20846
|
+
category: "thought_level",
|
|
20847
|
+
type: "select",
|
|
20848
|
+
currentValue: config.getContentGeneratorConfig().reasoning === false ? ACP_REASONING_EFFORT_NONE : modelReasoning.efforts.find(
|
|
20849
|
+
(effort) => effort === currentModelEffort
|
|
20850
|
+
) ?? modelReasoning.defaultEffort,
|
|
20851
|
+
options: [
|
|
20852
|
+
{
|
|
20853
|
+
value: ACP_REASONING_EFFORT_NONE,
|
|
20854
|
+
name: "Thinking off",
|
|
20855
|
+
description: "Disable thinking for this session"
|
|
20856
|
+
},
|
|
20857
|
+
...modelReasoning.efforts.map((effort) => ({
|
|
20858
|
+
value: effort,
|
|
20859
|
+
name: ACP_REASONING_EFFORT_NAMES[effort],
|
|
20860
|
+
description: "Apply this effort to the next request"
|
|
20861
|
+
}))
|
|
20862
|
+
],
|
|
20863
|
+
_meta: {
|
|
20864
|
+
"qwenCode/reasoning": {
|
|
20865
|
+
defaultEffort: modelReasoning.defaultEffort
|
|
20866
|
+
}
|
|
20867
|
+
}
|
|
20868
|
+
} : {
|
|
19811
20869
|
id: "reasoning_effort",
|
|
19812
20870
|
name: "Reasoning effort",
|
|
19813
20871
|
description: "How hard reasoning-capable models should think",
|
|
19814
20872
|
category: "thought_level",
|
|
19815
20873
|
type: "select",
|
|
19816
|
-
currentValue:
|
|
20874
|
+
currentValue: currentModelEffort ?? ACP_REASONING_EFFORT_DEFAULT,
|
|
19817
20875
|
options: [
|
|
19818
20876
|
{
|
|
19819
20877
|
value: ACP_REASONING_EFFORT_DEFAULT,
|
|
@@ -19829,6 +20887,14 @@ ${outputText}
|
|
|
19829
20887
|
};
|
|
19830
20888
|
return [modeConfigOption, modelConfigOption, reasoningEffortConfigOption];
|
|
19831
20889
|
}
|
|
20890
|
+
getModelReasoningConfiguration(config) {
|
|
20891
|
+
if (config.getActiveRuntimeModelSnapshot?.() || config.getReasoningEffortOverride?.() || config.getContentGeneratorConfig().thinkingMandatory === true) {
|
|
20892
|
+
return void 0;
|
|
20893
|
+
}
|
|
20894
|
+
const reasoning = getModelConfiguration(config.getModel())?.reasoning;
|
|
20895
|
+
const currentEffort = config.getReasoningEffort?.();
|
|
20896
|
+
return reasoning?.thinking && (!currentEffort || reasoning.efforts.includes(currentEffort)) ? reasoning : void 0;
|
|
20897
|
+
}
|
|
19832
20898
|
buildSelectableModelOptions(config) {
|
|
19833
20899
|
const currentAuthType = config.getAuthType();
|
|
19834
20900
|
return buildAcpModelOptions(
|