@qwen-code/qwen-code 0.19.6 → 0.19.7-nightly.20260708.394c1a289
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled/qc-helper/docs/configuration/model-providers.md +5 -1
- package/bundled/qc-helper/docs/configuration/settings.md +33 -1
- package/bundled/qc-helper/docs/features/channels/_meta.ts +1 -0
- package/bundled/qc-helper/docs/features/channels/overview.md +41 -31
- package/bundled/qc-helper/docs/features/channels/wecom.md +111 -0
- package/bundled/qc-helper/docs/features/code-review.md +16 -6
- package/bundled/qc-helper/docs/features/commands.md +1 -1
- package/bundled/qc-helper/docs/features/hooks.md +6 -0
- package/bundled/qc-helper/docs/features/skills.md +5 -3
- package/bundled/qc-helper/docs/integration-github-action.md +1 -1
- package/bundled/review/DESIGN.md +50 -18
- package/bundled/review/SKILL.md +102 -12
- package/chunks/{MaxSizedBox-SK7CUWZQ.js → MaxSizedBox-XS37LWTD.js} +31 -29
- package/chunks/{StandaloneSessionPicker-G44HGSAP.js → StandaloneSessionPicker-LPALJTKN.js} +44 -41
- package/chunks/{acpAgent-PKCTYWJV.js → acpAgent-4VE3FGJX.js} +769 -366
- package/chunks/{agent-IYMHUXWB.js → agent-CCHERW6L.js} +24 -24
- package/chunks/{agent-headless-L2DAW6I5.js → agent-headless-55N6UBUU.js} +24 -24
- package/chunks/{anthropicContentGenerator-H5ZOEENQ.js → anthropicContentGenerator-AKYPSZIV.js} +7 -7
- package/chunks/{artifact-tool-SLYPWG3C.js → artifact-tool-D233YJFH.js} +27 -8
- package/chunks/{askUserQuestion-OKPTECON.js → askUserQuestion-MKL5ZTMC.js} +2 -2
- package/chunks/{bridge-DF3IJQ5V.js → bridge-U6HXOHE7.js} +34 -32
- package/chunks/{channel-worker-supervisor-JUYQ5Z4R.js → channel-worker-supervisor-CRCVYQIE.js} +1 -1
- package/chunks/{chunk-AVQDCKNF.js → chunk-22MNNNXE.js} +4 -0
- package/chunks/chunk-2DYY5XUZ.js +8223 -0
- package/chunks/chunk-2FHWCKWA.js +262 -0
- package/chunks/{chunk-6BEOH4KK.js → chunk-2NPS2UDH.js} +767 -122
- package/chunks/{chunk-N2IJLN2L.js → chunk-2SWMCXVR.js} +13 -5
- package/chunks/{chunk-OBVBTAX5.js → chunk-2YELHTUE.js} +2 -2
- package/chunks/chunk-332PWN27.js +19 -0
- package/chunks/{chunk-CLQPBI4H.js → chunk-3B26UVCX.js} +132 -26
- package/chunks/{chunk-HCFSKO6K.js → chunk-3QDZDAJG.js} +1 -1
- package/chunks/{chunk-G7OQ3RFJ.js → chunk-42XGFRJS.js} +3 -3
- package/chunks/{chunk-SL2P3JUA.js → chunk-43W4YSO6.js} +1 -12
- package/chunks/{chunk-JA5KWZTJ.js → chunk-44NROQYV.js} +5 -3
- package/chunks/{chunk-BOAWGUY6.js → chunk-4AFOWB47.js} +121 -49
- package/chunks/{chunk-MOUXUCXQ.js → chunk-4KJ2BPIT.js} +1 -1
- package/chunks/{chunk-YTWX5TT2.js → chunk-5FL2K3ZB.js} +1 -1
- package/chunks/{chunk-UNXGEDX2.js → chunk-5OSSOBZC.js} +133 -25
- package/chunks/{chunk-JN2VJ33O.js → chunk-7I4MGFBN.js} +966 -121
- package/chunks/{chunk-T42ACHFI.js → chunk-7LTB54MK.js} +1 -1
- package/chunks/chunk-A2X3KLC3.js +3807 -0
- package/chunks/{chunk-EWALXUAD.js → chunk-AGHU5VRK.js} +8 -0
- package/chunks/{chunk-GLPV75ES.js → chunk-AHNJGLFV.js} +2 -2
- package/chunks/{chunk-IUSKVKH5.js → chunk-AXTPFMRS.js} +1 -1
- package/chunks/{chunk-T22H4V4R.js → chunk-B34OV7K2.js} +1 -1
- package/chunks/{chunk-FZ5NVRVK.js → chunk-B5FOCTEZ.js} +3 -3
- package/chunks/{chunk-3UC7ZC43.js → chunk-B6WUEODT.js} +7 -7
- package/chunks/{chunk-MJKEQSZI.js → chunk-BGL43SJ3.js} +1 -1
- package/chunks/{chunk-OAYOHSGP.js → chunk-BHRU4SDF.js} +4 -4
- package/chunks/{chunk-YPCPZSZB.js → chunk-CCGOFQV3.js} +56 -4
- package/chunks/{chunk-FDY3XOTM.js → chunk-CR5IU2RX.js} +4 -4
- package/chunks/{chunk-LWGLBVWA.js → chunk-CSOTA7KX.js} +1 -1
- package/chunks/{chunk-AGZF43UV.js → chunk-E7HM76PR.js} +7153 -4406
- package/chunks/{chunk-NIOPRZNN.js → chunk-E7KNELIZ.js} +1 -1
- package/chunks/{chunk-YSU33ACT.js → chunk-ELMPRVCB.js} +5 -13
- package/chunks/{chunk-SEZC2725.js → chunk-ER3BKOLB.js} +13 -0
- package/chunks/{chunk-3VJ7MT3N.js → chunk-EXPMGZZV.js} +14 -3
- package/chunks/{chunk-DBF3HTLT.js → chunk-FB2ULV4M.js} +4 -4
- package/chunks/{chunk-RZORUN6X.js → chunk-FEJ2FZ3U.js} +1 -1
- package/chunks/chunk-FK77ILF5.js +2477 -0
- package/chunks/{chunk-DMSNJDWG.js → chunk-FV7425LN.js} +38 -3
- package/chunks/{chunk-ALX6BUYW.js → chunk-G7ZG7CA6.js} +186 -27
- package/chunks/{chunk-2INJBYLJ.js → chunk-GIY6JTTC.js} +6 -6
- package/chunks/{chunk-D5KISTLW.js → chunk-H6EMK6QK.js} +1 -1
- package/chunks/{chunk-KYTQOCDE.js → chunk-HW4N45EE.js} +17 -46
- package/chunks/{chunk-VXGPYF7U.js → chunk-IFEWJXFS.js} +1 -1
- package/chunks/chunk-II73RK2S.js +158 -0
- package/chunks/{chunk-TENOUWY2.js → chunk-IJRL2S3D.js} +3 -3
- package/chunks/{chunk-GQBRGBLS.js → chunk-J43WPR6U.js} +9 -9
- package/chunks/{chunk-SRNPMG7J.js → chunk-JYOWO2F7.js} +16 -10
- package/chunks/{chunk-57NRQM3P.js → chunk-K34DD7FH.js} +2 -2
- package/chunks/{chunk-O2RJARYU.js → chunk-KKWO4IX2.js} +1409 -4088
- package/chunks/{chunk-SOT7OMGL.js → chunk-KT3SI3CQ.js} +2 -2
- package/chunks/{chunk-NUK2PFSU.js → chunk-L7IWK7JY.js} +1 -1
- package/chunks/{chunk-MHQKYQDS.js → chunk-LC4SMGYY.js} +158 -3
- package/chunks/chunk-LGFAYIKX.js +115 -0
- package/chunks/{chunk-MBWLP5OT.js → chunk-LKXDC3AW.js} +162 -40
- package/chunks/{chunk-7Z6UEJA4.js → chunk-ME344634.js} +5 -2
- package/chunks/{chunk-V6NH3CUC.js → chunk-MOQOAH7N.js} +3 -3
- package/chunks/{chunk-FPHA7WIZ.js → chunk-MYZWWRVW.js} +3 -3
- package/chunks/{chunk-YHTNWGRR.js → chunk-MZ7BABX3.js} +1 -1
- package/chunks/chunk-N74BA4VP.js +949 -0
- package/chunks/{chunk-B236XPGF.js → chunk-NQKLOAVJ.js} +29 -2
- package/chunks/{chunk-LXFCHX4X.js → chunk-OU6FPTJZ.js} +312 -25
- package/chunks/{chunk-HTWHAN44.js → chunk-PC4ZXHU2.js} +1 -1
- package/chunks/{chunk-3X76L4UF.js → chunk-PLGONYEL.js} +5 -5
- package/chunks/{chunk-WXUDZHOJ.js → chunk-PVXPDMGP.js} +10 -2
- package/chunks/{chunk-ZO5EA3XJ.js → chunk-QCSLZO6J.js} +1 -1
- package/chunks/{chunk-CEYA7K7C.js → chunk-QHT5USLK.js} +62 -12
- package/chunks/{chunk-NPQWQYU6.js → chunk-QYNNN7BK.js} +1 -1
- package/chunks/{chunk-N4YJQTRL.js → chunk-RFIL6REB.js} +71 -2
- package/chunks/{chunk-KSPVDFE4.js → chunk-SAIILPQ3.js} +0 -3
- package/chunks/{chunk-OIFSBXSP.js → chunk-SJHAUELE.js} +3 -3
- package/chunks/{chunk-BZHLWC6T.js → chunk-SUAKHHK7.js} +2 -2
- package/chunks/{chunk-QOKV6AO4.js → chunk-T2EJHSE3.js} +184 -147
- package/chunks/{chunk-ZI4MGBB5.js → chunk-TBAZMRW3.js} +1 -1
- package/chunks/{chunk-6QVRLKTZ.js → chunk-TBLJNMI7.js} +7 -7
- package/chunks/{chunk-J6ABRKAB.js → chunk-TDGF35EN.js} +2 -2
- package/chunks/chunk-TEYGKLIZ.js +167 -0
- package/chunks/{chunk-TOAUDIS7.js → chunk-TLWA7TPR.js} +6 -2
- package/chunks/chunk-UIDXQNMV.js +13 -0
- package/chunks/{chunk-MX7CTJHR.js → chunk-UZCT5OLN.js} +9 -9
- package/chunks/{chunk-LM3YCCZJ.js → chunk-VEB3NYSO.js} +1 -1
- package/chunks/{chunk-UTL7KABL.js → chunk-VQJ64BIQ.js} +7 -7
- package/chunks/{chunk-C2QKQZEQ.js → chunk-VTCPREC7.js} +3 -3
- package/chunks/{chunk-5ES5YPED.js → chunk-VZ7HY3YU.js} +1 -1
- package/chunks/{chunk-QOMAHFYI.js → chunk-W7EEOR7D.js} +3 -3
- package/chunks/{chunk-NVFJSIAX.js → chunk-WMPVYQ4P.js} +1 -1
- package/chunks/{chunk-V5VTULL5.js → chunk-X265R5C6.js} +3 -3
- package/chunks/{chunk-LKWAVAB5.js → chunk-X2XNQQJI.js} +2 -2
- package/chunks/{chunk-MJKMIQMK.js → chunk-X3YGAX7V.js} +1 -1
- package/chunks/{chunk-5WQF27GW.js → chunk-XQ2GVLNJ.js} +1 -1
- package/chunks/chunk-XUSONNJ4.js +28 -0
- package/chunks/{chunk-DXXNMPJH.js → chunk-YMWIKAEE.js} +460 -93
- package/chunks/{chunk-A34EPIUV.js → chunk-YYU6H66M.js} +18 -15
- package/chunks/{chunk-XH7H6YG4.js → chunk-ZK5EI6NR.js} +4 -107
- package/chunks/{computer-use-5S3NVXRA.js → computer-use-4CTF6WS3.js} +24 -24
- package/chunks/{contextCommand-DPBALZFK.js → contextCommand-Z3XWQCY6.js} +28 -27
- package/chunks/{cron-create-7JYUDTUY.js → cron-create-JSXEIPVS.js} +4 -4
- package/chunks/{cron-delete-YPULQQAK.js → cron-delete-OIFVEPGU.js} +4 -4
- package/chunks/{cron-list-HJIW5MHP.js → cron-list-D4ZX4IOE.js} +11 -7
- package/chunks/{daemon-7XYW4BC3.js → daemon-F3I2RXP6.js} +208 -63
- package/chunks/daemon-status-provider-6A4QCG6Q.js +74 -0
- package/chunks/dist-573HNSVO.js +3217 -0
- package/chunks/{dist-ABQ7VWRR.js → dist-FQ5WRJPL.js} +2 -2
- package/chunks/{dist-JPSVN367.js → dist-IMFFBMAT.js} +6 -3792
- package/chunks/{dist-BV56HW3W.js → dist-OT7G2WNM.js} +250 -1
- package/chunks/{dist-AW5ZYMUI.js → dist-PKFTNUHO.js} +10 -11
- package/chunks/{dist-AAO65DPC.js → dist-YTRKAVUB.js} +1 -1
- package/chunks/{earlyInputCapture-GGPV4IFT.js → earlyInputCapture-7O47HW62.js} +25 -25
- package/chunks/{edit-HJ7ISN4C.js → edit-E32KWLF2.js} +25 -25
- package/chunks/{en-XR3S5VWY.js → en-GA2RMXY5.js} +6 -1
- package/chunks/{enter-worktree-2BQT675D.js → enter-worktree-ZKFFMHUD.js} +24 -24
- package/chunks/{enterPlanMode-SJXHJ3WD.js → enterPlanMode-HLDC6NGX.js} +24 -24
- package/chunks/{errors-EVGER4AZ.js → errors-MTIDDXX7.js} +26 -26
- package/chunks/{exit-worktree-RPDDOSPM.js → exit-worktree-YHY72XA2.js} +24 -24
- package/chunks/{exitPlanMode-BQEROAJ7.js → exitPlanMode-JNXKBZ2C.js} +24 -24
- package/chunks/{fast-path-FX2ICJ2O.js → fast-path-DVAGBROV.js} +5 -2
- package/chunks/{fr-MBMNQSQ6.js → fr-GWNQG4XH.js} +4 -0
- package/chunks/{gemini-EHUXCOUI.js → gemini-2TMHJVRC.js} +444 -256
- package/chunks/{geminiContentGenerator-YDUUKAM2.js → geminiContentGenerator-WCH4GWD3.js} +4 -4
- package/chunks/{glob-3VIGV2DL.js → glob-I6Y4AGKO.js} +52 -28
- package/chunks/{grep-4D3S4NUC.js → grep-3P2J3LU5.js} +24 -24
- package/chunks/handleAutoUpdate-4IVRMRG4.js +65 -0
- package/chunks/{initializer-QZTZSSLW.js → initializer-DVNCPVTC.js} +31 -29
- package/chunks/{ja-HFV5QCHR.js → ja-2HOTA47X.js} +4 -0
- package/chunks/{keychain-token-storage-GPAKRDKQ.js → keychain-token-storage-UJV5XP4Z.js} +2 -2
- package/chunks/{list-WQ24EAMK.js → list-4D6QK2KZ.js} +30 -30
- package/chunks/{loadedSettingsAdapter-XV74KOSR.js → loadedSettingsAdapter-GNGELH6Q.js} +28 -28
- package/chunks/{loop-wakeup-34YK7T7O.js → loop-wakeup-OHWEMFP5.js} +5 -5
- package/chunks/{ls-MPD5OJUX.js → ls-L654WOAT.js} +4 -4
- package/chunks/{lsp-72PWTDW7.js → lsp-M35KE54Y.js} +2 -2
- package/chunks/{mcp-CO3MKM7N.js → mcp-2IL72YJP.js} +28 -28
- package/chunks/{monitor-GB56T65A.js → monitor-BLVCZAVX.js} +32 -27
- package/chunks/nonInteractiveCli-UD3V7UOO.js +116 -0
- package/chunks/{notebook-edit-VMXAAE3R.js → notebook-edit-5TVMWIWY.js} +25 -25
- package/chunks/{openaiContentGenerator-GM77FLII.js → openaiContentGenerator-5LJ5A7YY.js} +12 -12
- package/chunks/{pidfile-HFXSHR64.js → pidfile-AN5JQJ2T.js} +25 -25
- package/chunks/{qwenContentGenerator-QSCXQIKJ.js → qwenContentGenerator-E2JSB4FJ.js} +26 -26
- package/chunks/{qwenOAuth2-LWLA6MQG.js → qwenOAuth2-ZV7YLMND.js} +5 -5
- package/chunks/{read-file-SVH6CGQY.js → read-file-N5DEFUDU.js} +8 -8
- package/chunks/{read-mcp-resource-OWOBJY72.js → read-mcp-resource-CNQHBSJM.js} +2 -2
- package/chunks/{record-artifact-URK3YUDJ.js → record-artifact-PP3LKHTS.js} +2 -2
- package/chunks/{ripGrep-JD5O2FLX.js → ripGrep-BLJHTHKE.js} +24 -24
- package/chunks/{run-qwen-serve-FADLRJUN.js → run-qwen-serve-4JDO64RN.js} +785 -35
- package/chunks/{scheduler-Q65SB7DJ.js → scheduler-FQR4XA7J.js} +24 -24
- package/chunks/{send-message-L7OLQEKH.js → send-message-OA6MV4EU.js} +3 -3
- package/chunks/{serve-6ZXAMQ4M.js → serve-ZOCFC7YM.js} +29 -29
- package/chunks/{server-WKDQA6XR.js → server-GEOYEPYT.js} +2504 -439
- package/chunks/{session-STWOX7RA.js → session-NJCONHGX.js} +66 -61
- package/chunks/{settings-LC4CCWQQ.js → settings-QBGGXANI.js} +27 -27
- package/chunks/{shell-FEG3RLPW.js → shell-2DVPSEKT.js} +24 -24
- package/chunks/{skill-XTXAMDAP.js → skill-HIPXUHV7.js} +24 -12
- package/chunks/{spawnChannel-B6JJPBPV.js → spawnChannel-3JYXY52G.js} +27 -27
- package/chunks/{src-HITDGVRM.js → src-NLEX4CUC.js} +91 -36
- package/chunks/{startInteractiveUI-IT423PW4.js → startInteractiveUI-TYGZIU27.js} +6213 -14273
- package/chunks/{syntheticOutput-J3MLCQAR.js → syntheticOutput-F7LSDCAR.js} +3 -3
- package/chunks/{task-create-ELEBZ7H2.js → task-create-RPFZNB4B.js} +7 -7
- package/chunks/{task-list-IEUZLF3Y.js → task-list-TGGJX7EA.js} +5 -5
- package/chunks/{task-stop-QEZW3UDY.js → task-stop-W7NGTMYQ.js} +2 -2
- package/chunks/{task-update-DW36J5P5.js → task-update-5WUG5MVQ.js} +7 -7
- package/chunks/{team-create-DAG6SNHZ.js → team-create-MGX57SZJ.js} +24 -24
- package/chunks/{team-delete-SVITIMBO.js → team-delete-UHQQ2QQX.js} +5 -5
- package/chunks/{team-plan-approval-DRDY5OPC.js → team-plan-approval-BO2N7J3E.js} +24 -24
- package/chunks/{theme-manager-N67EZC6B.js → theme-manager-WU7LOA64.js} +25 -25
- package/chunks/{todoWrite-SFFQHZYY.js → todoWrite-C4ZAMSR3.js} +4 -4
- package/chunks/{tool-search-CMDJ5HGM.js → tool-search-CLBKVEVK.js} +11 -28
- package/chunks/{trustedFolders-JD4QX6UJ.js → trustedFolders-GAQM2GHB.js} +25 -25
- package/chunks/updateCheck-RIK2YIQE.js +65 -0
- package/chunks/{validateNonInterActiveAuth-ADDCGZ6A.js → validateNonInterActiveAuth-NS3GBIJZ.js} +61 -56
- package/chunks/{version-VAONYVE5.js → version-B3RSLP54.js} +2 -1
- package/chunks/{web-fetch-SXAXJHIO.js → web-fetch-UYGMOHW4.js} +5 -5
- package/chunks/{workflow-DG2BR42M.js → workflow-7APPIGND.js} +25 -25
- package/chunks/{workspace-providers-status-XGW5OZTD.js → workspace-providers-status-SC67GLMY.js} +30 -30
- package/chunks/{workspace-service-GX3GGZLU.js → workspace-service-ZJHF22WA.js} +35 -35
- package/chunks/{workspace-skills-status-LFK5WV2V.js → workspace-skills-status-NJEK6P6Y.js} +29 -29
- package/chunks/{write-file-UR7FXWOU.js → write-file-R6Z3VLRY.js} +25 -25
- package/chunks/{zh-FSVJTXA4.js → zh-7XVVRTDH.js} +6 -1
- package/chunks/{zh-TW-66MG4LWL.js → zh-TW-DPH554OG.js} +6 -1
- package/cli.js +19 -11
- package/locales/en.js +9 -2
- package/locales/fr.js +6 -0
- package/locales/ja.js +6 -0
- package/locales/zh-TW.js +9 -2
- package/locales/zh.js +9 -2
- package/node_modules/@qwen-code/audio-capture/package.json +1 -1
- package/node_modules/@qwen-code/audio-capture/prebuilds/darwin-arm64/@qwen-code+audio-capture.node +0 -0
- package/node_modules/@qwen-code/audio-capture/prebuilds/darwin-x64/@qwen-code+audio-capture.node +0 -0
- package/node_modules/@qwen-code/audio-capture/prebuilds/win32-x64/@qwen-code+audio-capture.node +0 -0
- package/package.json +3 -3
- package/web-shell/assets/{arc-CUpe0ibu.js → arc-C7hjaa7g.js} +1 -1
- package/web-shell/assets/{architectureDiagram-3BPJPVTR-JvyrY_mK.js → architectureDiagram-3BPJPVTR-pm9KtMZY.js} +1 -1
- package/web-shell/assets/{blockDiagram-GPEHLZMM-CK3Y_vom.js → blockDiagram-GPEHLZMM-CApElKsU.js} +1 -1
- package/web-shell/assets/{c4Diagram-AAUBKEIU-DprSnyrf.js → c4Diagram-AAUBKEIU-BeDe0-9N.js} +1 -1
- package/web-shell/assets/channel-BNf1dW-j.js +1 -0
- package/web-shell/assets/{chunk-2J33WTMH-DJtRJPmu.js → chunk-2J33WTMH-DJEkmLdl.js} +1 -1
- package/web-shell/assets/{chunk-4BX2VUAB-ON6Q2-BG.js → chunk-4BX2VUAB-DXX8gdpe.js} +1 -1
- package/web-shell/assets/{chunk-55IACEB6-c60ou5HZ.js → chunk-55IACEB6-DORmk1kQ.js} +1 -1
- package/web-shell/assets/{chunk-727SXJPM-BamtPKxx.js → chunk-727SXJPM-DWmO4mCZ.js} +1 -1
- package/web-shell/assets/{chunk-AQP2D5EJ-CsVgpu-T.js → chunk-AQP2D5EJ-C7LRaYw2.js} +1 -1
- package/web-shell/assets/{chunk-FMBD7UC4-vZrpjAx4.js → chunk-FMBD7UC4-CCdXgyC5.js} +1 -1
- package/web-shell/assets/{chunk-ND2GUHAM-qxyNOd5t.js → chunk-ND2GUHAM-SyL_xvWc.js} +1 -1
- package/web-shell/assets/{chunk-QZHKN3VN-BvTJSM_S.js → chunk-QZHKN3VN-BzOuCKxa.js} +1 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-uOIGlzgi.js +1 -0
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-uOIGlzgi.js +1 -0
- package/web-shell/assets/{cose-bilkent-S5V4N54A-1tXB4pju.js → cose-bilkent-S5V4N54A-BMPWyDKc.js} +1 -1
- package/web-shell/assets/{dagre-BM42HDAG-DglBzme8.js → dagre-BM42HDAG-B_GnPWik.js} +1 -1
- package/web-shell/assets/{diagram-2AECGRRQ-DEJpqsWz.js → diagram-2AECGRRQ-fJqMc3S_.js} +1 -1
- package/web-shell/assets/{diagram-5GNKFQAL-CsQ1NrMG.js → diagram-5GNKFQAL-ximV3O9D.js} +1 -1
- package/web-shell/assets/{diagram-KO2AKTUF-Z-3codAi.js → diagram-KO2AKTUF-2vVyjzqw.js} +1 -1
- package/web-shell/assets/{diagram-LMA3HP47-mBuPTA2i.js → diagram-LMA3HP47-Dckcx1sT.js} +1 -1
- package/web-shell/assets/{diagram-OG6HWLK6-tcA3K3s9.js → diagram-OG6HWLK6-BAVv47ga.js} +1 -1
- package/web-shell/assets/{erDiagram-TEJ5UH35-D9bXFRyZ.js → erDiagram-TEJ5UH35-Bn3nf5J0.js} +1 -1
- package/web-shell/assets/{flowDiagram-I6XJVG4X-Ck0Py04s.js → flowDiagram-I6XJVG4X-BIbGF9JT.js} +1 -1
- package/web-shell/assets/{ganttDiagram-6RSMTGT7-rOevCekE.js → ganttDiagram-6RSMTGT7-CDbhb3AH.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-PVQCEYII-CoPQaLj0.js → gitGraphDiagram-PVQCEYII-CbKG1a_w.js} +1 -1
- package/web-shell/assets/index-CnE2ur2L.js +779 -0
- package/web-shell/assets/index-hSKXrlSE.css +5 -0
- package/web-shell/assets/{infoDiagram-5YYISTIA-a77CUKoI.js → infoDiagram-5YYISTIA-DUFxTy8m.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-DlLgUAO-.js → ishikawaDiagram-YF4QCWOH-D69hrBG8.js} +1 -1
- package/web-shell/assets/{journeyDiagram-JHISSGLW-BXR5kVAZ.js → journeyDiagram-JHISSGLW-DsvEw51Y.js} +1 -1
- package/web-shell/assets/{kanban-definition-UN3LZRKU-h5CoHZg7.js → kanban-definition-UN3LZRKU-lFFjZEYd.js} +1 -1
- package/web-shell/assets/{linear-BkaREbyD.js → linear-Bo5bWzvo.js} +1 -1
- package/web-shell/assets/{mermaid.core-Bkagz0ng.js → mermaid.core-C_HKMJx5.js} +5 -5
- package/web-shell/assets/{mindmap-definition-RKZ34NQL-D7EMKR_5.js → mindmap-definition-RKZ34NQL-DlV-NUTs.js} +1 -1
- package/web-shell/assets/{pieDiagram-4H26LBE5-DAmPOjsL.js → pieDiagram-4H26LBE5-B2e6FH2a.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-W4KKPZXB-e4WFQkQu.js → quadrantDiagram-W4KKPZXB-D75kSk-b.js} +1 -1
- package/web-shell/assets/{requirementDiagram-4Y6WPE33-v1zo7OiV.js → requirementDiagram-4Y6WPE33-CQ6xakhM.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-5OEKKPKP-Bstm4aW_.js → sankeyDiagram-5OEKKPKP-J_XTKrcY.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-3UESZ5HK-DzcZy6xN.js → sequenceDiagram-3UESZ5HK-D7jTcBtf.js} +1 -1
- package/web-shell/assets/{stateDiagram-AJRCARHV-BEJH6YbH.js → stateDiagram-AJRCARHV-CrlM_OT3.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-Bs4TK_84.js +1 -0
- package/web-shell/assets/{timeline-definition-PNZ67QCA-TI1wH-Pm.js → timeline-definition-PNZ67QCA-5oZi76Ef.js} +1 -1
- package/web-shell/assets/{vennDiagram-CIIHVFJN-YaH8VDMS.js → vennDiagram-CIIHVFJN-DO5YptPK.js} +1 -1
- package/web-shell/assets/{wardley-L42UT6IY-B80co7OP.js → wardley-L42UT6IY-4t1eJDvM.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-YWT4CUSO-4fHNDEMl.js → wardleyDiagram-YWT4CUSO-DKZc661S.js} +1 -1
- package/web-shell/assets/{xychartDiagram-2RQKCTM6-DT3q4Z3J.js → xychartDiagram-2RQKCTM6-su9hp08G.js} +1 -1
- package/web-shell/index.html +2 -2
- package/chunks/chunk-L7QPM2YD.js +0 -481
- package/chunks/daemon-status-provider-2EWTHT7Y.js +0 -73
- package/chunks/nonInteractiveCli-HNZRIM5I.js +0 -111
- package/web-shell/assets/channel-BAxQ2-aZ.js +0 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-Cvd_xhZI.js +0 -1
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-Cvd_xhZI.js +0 -1
- package/web-shell/assets/index-Cr7MYW6T.css +0 -5
- package/web-shell/assets/index-DCHPAUp3.js +0 -730
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-BopifCBI.js +0 -1
|
@@ -3,71 +3,79 @@
|
|
|
3
3
|
import {
|
|
4
4
|
classifyApiError,
|
|
5
5
|
prefixMidTurnUserMessageParts
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LKXDC3AW.js";
|
|
7
7
|
import {
|
|
8
8
|
EXTENSION_CONTEXT_BUDGET,
|
|
9
9
|
buildExtensionMentionContext,
|
|
10
|
+
buildMcpServerContextText,
|
|
10
11
|
matchExtensionByRef,
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
matchMcpServerByRef,
|
|
13
|
+
parseExtensionRef,
|
|
14
|
+
parseMcpServerRef
|
|
15
|
+
} from "./chunk-5OSSOBZC.js";
|
|
13
16
|
import {
|
|
14
|
-
HistoryReplayer,
|
|
15
|
-
MessageEmitter,
|
|
16
|
-
PlanEmitter,
|
|
17
|
-
ToolCallEmitter,
|
|
18
17
|
getAvailableCommands,
|
|
19
18
|
handleSlashCommand,
|
|
20
19
|
insertAfterFunctionResponses,
|
|
21
20
|
isSlashCommand,
|
|
22
21
|
normalizePartList
|
|
23
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-KKWO4IX2.js";
|
|
24
23
|
import {
|
|
25
24
|
appEvents,
|
|
26
25
|
buildDisabledSkillNamesProvider,
|
|
27
26
|
loadCliConfig,
|
|
28
27
|
normalizeDisabledToolList
|
|
29
|
-
} from "./chunk-
|
|
30
|
-
import {
|
|
31
|
-
collectContextData,
|
|
32
|
-
formatContextUsageText
|
|
33
|
-
} from "./chunk-UTL7KABL.js";
|
|
28
|
+
} from "./chunk-YMWIKAEE.js";
|
|
34
29
|
import {
|
|
35
30
|
getCommandSubcommandNames
|
|
36
|
-
} from "./chunk-
|
|
37
|
-
import "./chunk-
|
|
31
|
+
} from "./chunk-LC4SMGYY.js";
|
|
32
|
+
import "./chunk-MYZWWRVW.js";
|
|
38
33
|
import {
|
|
39
34
|
getEffectiveSupportedModes
|
|
40
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-J43WPR6U.js";
|
|
36
|
+
import "./chunk-IFEWJXFS.js";
|
|
37
|
+
import "./chunk-ELMPRVCB.js";
|
|
38
|
+
import "./chunk-JZSY4WP3.js";
|
|
39
|
+
import {
|
|
40
|
+
collectContextData,
|
|
41
|
+
formatContextUsageText
|
|
42
|
+
} from "./chunk-VQJ64BIQ.js";
|
|
43
|
+
import "./chunk-UIDXQNMV.js";
|
|
44
|
+
import "./chunk-332PWN27.js";
|
|
45
|
+
import "./chunk-N74BA4VP.js";
|
|
41
46
|
import {
|
|
42
47
|
isTerminalGoalStatusKind
|
|
43
|
-
} from "./chunk-
|
|
44
|
-
import "./chunk-MRO43B25.js";
|
|
45
|
-
import "./chunk-VXGPYF7U.js";
|
|
46
|
-
import "./chunk-YSU33ACT.js";
|
|
48
|
+
} from "./chunk-SAIILPQ3.js";
|
|
47
49
|
import "./chunk-KYMBIKIW.js";
|
|
48
|
-
import "./chunk-
|
|
49
|
-
import "./chunk-
|
|
50
|
-
import "./chunk-
|
|
50
|
+
import "./chunk-PC4ZXHU2.js";
|
|
51
|
+
import "./chunk-MRO43B25.js";
|
|
52
|
+
import "./chunk-PLGONYEL.js";
|
|
51
53
|
import "./chunk-3GONHQOA.js";
|
|
52
|
-
import "./chunk-
|
|
53
|
-
import "./chunk-
|
|
54
|
+
import "./chunk-SJHAUELE.js";
|
|
55
|
+
import "./chunk-TBAZMRW3.js";
|
|
54
56
|
import {
|
|
55
57
|
MAX_REMEMBER_CONTENT_BYTES,
|
|
56
58
|
extractRememberErrorCode,
|
|
57
59
|
formatWorkspaceMemoryForgetSummary,
|
|
58
60
|
isValidServerName
|
|
59
61
|
} from "./chunk-6SHO7WFF.js";
|
|
60
|
-
import
|
|
62
|
+
import {
|
|
63
|
+
HistoryReplayer,
|
|
64
|
+
MessageEmitter,
|
|
65
|
+
PlanEmitter,
|
|
66
|
+
ToolCallEmitter
|
|
67
|
+
} from "./chunk-FK77ILF5.js";
|
|
68
|
+
import "./chunk-ZK5EI6NR.js";
|
|
69
|
+
import "./chunk-LGFAYIKX.js";
|
|
61
70
|
import "./chunk-54YZOP7P.js";
|
|
62
|
-
import "./chunk-
|
|
63
|
-
import "./chunk-OAYOHSGP.js";
|
|
71
|
+
import "./chunk-BHRU4SDF.js";
|
|
64
72
|
import "./chunk-KHDZHZMH.js";
|
|
65
73
|
import {
|
|
66
74
|
formatAcpModelId,
|
|
67
75
|
parseAcpBaseModelId,
|
|
68
76
|
parseAcpModelOption,
|
|
69
77
|
sanitizeProviderBaseUrl
|
|
70
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-KT3SI3CQ.js";
|
|
71
79
|
import {
|
|
72
80
|
mapSkillConfigToStatus
|
|
73
81
|
} from "./chunk-6IAWPIQ6.js";
|
|
@@ -77,48 +85,61 @@ import {
|
|
|
77
85
|
buildPermissionSettings,
|
|
78
86
|
normalizePermissionRules,
|
|
79
87
|
readPermissionRuleSet
|
|
80
|
-
} from "./chunk-
|
|
81
|
-
import "./chunk-
|
|
82
|
-
import "./chunk-
|
|
88
|
+
} from "./chunk-5FL2K3ZB.js";
|
|
89
|
+
import "./chunk-3QDZDAJG.js";
|
|
90
|
+
import "./chunk-E7KNELIZ.js";
|
|
91
|
+
import {
|
|
92
|
+
computeCpuPercent
|
|
93
|
+
} from "./chunk-II73RK2S.js";
|
|
83
94
|
import "./chunk-AHNXYU4O.js";
|
|
84
95
|
import "./chunk-RNBYOUGV.js";
|
|
85
|
-
import "./chunk-
|
|
96
|
+
import "./chunk-2SWMCXVR.js";
|
|
86
97
|
import "./chunk-BJBWRCSK.js";
|
|
87
|
-
import "./chunk-
|
|
88
|
-
import "./chunk-
|
|
98
|
+
import "./chunk-GIY6JTTC.js";
|
|
99
|
+
import "./chunk-2NPS2UDH.js";
|
|
89
100
|
import "./chunk-S6RLAIUR.js";
|
|
90
101
|
import "./chunk-MX2YXRER.js";
|
|
91
|
-
import "./chunk-
|
|
102
|
+
import "./chunk-MZ7BABX3.js";
|
|
92
103
|
import {
|
|
93
104
|
createLoadedSettingsAdapter
|
|
94
|
-
} from "./chunk-
|
|
105
|
+
} from "./chunk-L7IWK7JY.js";
|
|
95
106
|
import {
|
|
96
107
|
OUTPUT_LANGUAGE_AUTO,
|
|
108
|
+
findEnvFiles,
|
|
97
109
|
getOutputLanguageFilePath,
|
|
98
110
|
getPersistScopeForModelSelection,
|
|
111
|
+
getUserSettingsPath,
|
|
99
112
|
isAutoLanguage,
|
|
100
113
|
loadSettings,
|
|
114
|
+
preResolveHomeEnvOverrides,
|
|
101
115
|
reloadEnvironment,
|
|
102
116
|
resolveOutputLanguage,
|
|
103
117
|
updateOutputLanguageFile,
|
|
104
118
|
writeOutputLanguageAndRegisterPath
|
|
105
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-QHT5USLK.js";
|
|
106
120
|
import {
|
|
107
121
|
SUPPORTED_LANGUAGES,
|
|
108
122
|
getCurrentLanguage,
|
|
109
123
|
setLanguageAsync
|
|
110
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-TBLJNMI7.js";
|
|
111
125
|
import "./chunk-TLRYABYP.js";
|
|
112
|
-
import
|
|
126
|
+
import {
|
|
127
|
+
getSystemDefaultsPath,
|
|
128
|
+
getSystemSettingsPath
|
|
129
|
+
} from "./chunk-4RQIB5UZ.js";
|
|
113
130
|
import {
|
|
114
131
|
NOT_CURRENTLY_GENERATING_CANCEL_MESSAGE
|
|
115
|
-
} from "./chunk-
|
|
132
|
+
} from "./chunk-B34OV7K2.js";
|
|
116
133
|
import {
|
|
117
134
|
CLIENT_MCP_OVER_WS_CONFIG_FLAG,
|
|
135
|
+
LOAD_REPLAY_BULK_MODE,
|
|
136
|
+
LOAD_REPLAY_META_KEY,
|
|
137
|
+
LOAD_REPLAY_MODE_META_KEY,
|
|
138
|
+
LOAD_REPLAY_VERSION,
|
|
118
139
|
MID_TURN_QUEUE_DRAIN_METHOD
|
|
119
|
-
} from "./chunk-
|
|
120
|
-
import "./chunk-
|
|
121
|
-
import "./chunk-
|
|
140
|
+
} from "./chunk-AGHU5VRK.js";
|
|
141
|
+
import "./chunk-ER3BKOLB.js";
|
|
142
|
+
import "./chunk-G7ZG7CA6.js";
|
|
122
143
|
import {
|
|
123
144
|
AgentSideConnection,
|
|
124
145
|
PROTOCOL_VERSION,
|
|
@@ -126,7 +147,7 @@ import {
|
|
|
126
147
|
} from "./chunk-VRDMOSQS.js";
|
|
127
148
|
import {
|
|
128
149
|
ndJsonStream
|
|
129
|
-
} from "./chunk-
|
|
150
|
+
} from "./chunk-EXPMGZZV.js";
|
|
130
151
|
import {
|
|
131
152
|
ACP_PREFLIGHT_KINDS,
|
|
132
153
|
IDLE_HOOK_EVENTS,
|
|
@@ -134,14 +155,15 @@ import {
|
|
|
134
155
|
SERVE_STATUS_EXT_METHODS,
|
|
135
156
|
STATUS_SCHEMA_VERSION,
|
|
136
157
|
mapDomainErrorToErrorKind
|
|
137
|
-
} from "./chunk-
|
|
158
|
+
} from "./chunk-ME344634.js";
|
|
138
159
|
import "./chunk-3RW4AZJV.js";
|
|
139
|
-
import "./chunk-
|
|
160
|
+
import "./chunk-XUSONNJ4.js";
|
|
161
|
+
import "./chunk-43W4YSO6.js";
|
|
140
162
|
import {
|
|
141
163
|
isFolderTrustEnabled,
|
|
142
164
|
isWorkspaceTrusted,
|
|
143
165
|
loadTrustedFolders
|
|
144
|
-
} from "./chunk-
|
|
166
|
+
} from "./chunk-MOQOAH7N.js";
|
|
145
167
|
import {
|
|
146
168
|
writeStderrLine
|
|
147
169
|
} from "./chunk-Y6Z2O3WR.js";
|
|
@@ -151,6 +173,7 @@ import {
|
|
|
151
173
|
APPROVAL_MODE_INFO,
|
|
152
174
|
BTW_MAX_INPUT_LENGTH,
|
|
153
175
|
ExtensionManager,
|
|
176
|
+
IMAGE_CAPABILITY,
|
|
154
177
|
InvalidMcpConfigError,
|
|
155
178
|
LoopTickResolver,
|
|
156
179
|
MAX_TRANSCRIPT_MESSAGES,
|
|
@@ -212,6 +235,7 @@ import {
|
|
|
212
235
|
getScopedEnvContents,
|
|
213
236
|
getStartupContextLength,
|
|
214
237
|
hasImageParts,
|
|
238
|
+
ideContextStore,
|
|
215
239
|
injectPermissionRulesIfMissing,
|
|
216
240
|
isApproveOutcome,
|
|
217
241
|
isDenialFallbackReason,
|
|
@@ -245,37 +269,37 @@ import {
|
|
|
245
269
|
subagentGenerator,
|
|
246
270
|
unregisterGoalHook,
|
|
247
271
|
updateSetting
|
|
248
|
-
} from "./chunk-
|
|
272
|
+
} from "./chunk-E7HM76PR.js";
|
|
249
273
|
import "./chunk-5P5XGNYH.js";
|
|
250
274
|
import "./chunk-SKAZWEV5.js";
|
|
251
275
|
import {
|
|
252
276
|
external_exports
|
|
253
277
|
} from "./chunk-K5PGHDBN.js";
|
|
254
|
-
import "./chunk-
|
|
255
|
-
import "./chunk-
|
|
256
|
-
import "./chunk-
|
|
257
|
-
import "./chunk-
|
|
278
|
+
import "./chunk-3B26UVCX.js";
|
|
279
|
+
import "./chunk-W7EEOR7D.js";
|
|
280
|
+
import "./chunk-42XGFRJS.js";
|
|
281
|
+
import "./chunk-X2XNQQJI.js";
|
|
258
282
|
import {
|
|
259
283
|
runSideQuery
|
|
260
|
-
} from "./chunk-
|
|
284
|
+
} from "./chunk-VZ7HY3YU.js";
|
|
261
285
|
import "./chunk-2MPVVENX.js";
|
|
262
286
|
import "./chunk-ZTQ26VBE.js";
|
|
263
|
-
import "./chunk-
|
|
287
|
+
import "./chunk-FV7425LN.js";
|
|
264
288
|
import "./chunk-MLZQVCF3.js";
|
|
265
289
|
import "./chunk-LQ7TMOCE.js";
|
|
266
290
|
import "./chunk-E5A7LHNN.js";
|
|
267
291
|
import {
|
|
268
292
|
APPROVAL_MODES,
|
|
269
293
|
FORK_SUBAGENT_TYPE
|
|
270
|
-
} from "./chunk-
|
|
294
|
+
} from "./chunk-VEB3NYSO.js";
|
|
271
295
|
import "./chunk-GO6LNQXT.js";
|
|
272
|
-
import "./chunk-
|
|
296
|
+
import "./chunk-NQKLOAVJ.js";
|
|
273
297
|
import {
|
|
274
298
|
HookEventName,
|
|
275
299
|
createHookOutput
|
|
276
|
-
} from "./chunk-
|
|
277
|
-
import "./chunk-
|
|
278
|
-
import "./chunk-
|
|
300
|
+
} from "./chunk-WMPVYQ4P.js";
|
|
301
|
+
import "./chunk-TLWA7TPR.js";
|
|
302
|
+
import "./chunk-QYNNN7BK.js";
|
|
279
303
|
import {
|
|
280
304
|
AuthType,
|
|
281
305
|
ConversationFinishedEvent,
|
|
@@ -300,7 +324,7 @@ import {
|
|
|
300
324
|
startToolSpan,
|
|
301
325
|
uiTelemetryService,
|
|
302
326
|
withInteractionSpan
|
|
303
|
-
} from "./chunk-
|
|
327
|
+
} from "./chunk-7I4MGFBN.js";
|
|
304
328
|
import "./chunk-E6US47KI.js";
|
|
305
329
|
import "./chunk-UWCTAVOD.js";
|
|
306
330
|
import "./chunk-OFEVLU4C.js";
|
|
@@ -308,44 +332,44 @@ import "./chunk-OMX7CUOE.js";
|
|
|
308
332
|
import {
|
|
309
333
|
getAutoMemoryRoot,
|
|
310
334
|
getUserAutoMemoryRoot
|
|
311
|
-
} from "./chunk-
|
|
312
|
-
import "./chunk-
|
|
313
|
-
import "./chunk-
|
|
335
|
+
} from "./chunk-4KJ2BPIT.js";
|
|
336
|
+
import "./chunk-SUAKHHK7.js";
|
|
337
|
+
import "./chunk-FEJ2FZ3U.js";
|
|
314
338
|
import {
|
|
315
339
|
ToolConfirmationOutcome,
|
|
316
340
|
ToolNames
|
|
317
|
-
} from "./chunk-
|
|
341
|
+
} from "./chunk-X3YGAX7V.js";
|
|
318
342
|
import {
|
|
319
343
|
clearCachedCredentialFile,
|
|
320
344
|
qwenOAuth2Events
|
|
321
|
-
} from "./chunk-
|
|
322
|
-
import "./chunk-
|
|
345
|
+
} from "./chunk-IJRL2S3D.js";
|
|
346
|
+
import "./chunk-AHNJGLFV.js";
|
|
323
347
|
import "./chunk-22IFUCVR.js";
|
|
324
|
-
import "./chunk-
|
|
348
|
+
import "./chunk-7LTB54MK.js";
|
|
325
349
|
import "./chunk-SIUQ3YYX.js";
|
|
326
350
|
import {
|
|
327
351
|
DEFAULT_TOKEN_LIMIT,
|
|
328
352
|
tokenLimit
|
|
329
|
-
} from "./chunk-
|
|
330
|
-
import "./chunk-
|
|
353
|
+
} from "./chunk-HW4N45EE.js";
|
|
354
|
+
import "./chunk-CCGOFQV3.js";
|
|
331
355
|
import "./chunk-IRJWHZWU.js";
|
|
332
356
|
import "./chunk-SYCJMSIJ.js";
|
|
333
357
|
import "./chunk-55ZMG67I.js";
|
|
334
358
|
import "./chunk-H6BD2ELD.js";
|
|
335
359
|
import "./chunk-5IFG2VC4.js";
|
|
336
360
|
import "./chunk-64WXLC72.js";
|
|
337
|
-
import "./chunk-
|
|
361
|
+
import "./chunk-H6EMK6QK.js";
|
|
338
362
|
import {
|
|
339
363
|
Storage,
|
|
340
364
|
createDebugLogger,
|
|
341
365
|
getErrorMessage,
|
|
342
366
|
getErrorStatus,
|
|
343
367
|
isSubpath
|
|
344
|
-
} from "./chunk-
|
|
345
|
-
import "./chunk-
|
|
368
|
+
} from "./chunk-22MNNNXE.js";
|
|
369
|
+
import "./chunk-BGL43SJ3.js";
|
|
346
370
|
import {
|
|
347
371
|
runExitCleanup
|
|
348
|
-
} from "./chunk-
|
|
372
|
+
} from "./chunk-QCSLZO6J.js";
|
|
349
373
|
import "./chunk-ZERZSAZL.js";
|
|
350
374
|
import "./chunk-QN5NZ3UQ.js";
|
|
351
375
|
import "./chunk-BR4QREVK.js";
|
|
@@ -460,6 +484,23 @@ async function resolveRealPath(value) {
|
|
|
460
484
|
}
|
|
461
485
|
}
|
|
462
486
|
__name(resolveRealPath, "resolveRealPath");
|
|
487
|
+
function toAcpReadTextFileRequest(params, sessionId) {
|
|
488
|
+
const request = {
|
|
489
|
+
path: params.path,
|
|
490
|
+
sessionId
|
|
491
|
+
};
|
|
492
|
+
if (params._meta !== void 0) {
|
|
493
|
+
request._meta = params._meta;
|
|
494
|
+
}
|
|
495
|
+
if (params.limit !== void 0) {
|
|
496
|
+
request.limit = params.limit;
|
|
497
|
+
}
|
|
498
|
+
if (params.line != null) {
|
|
499
|
+
request.line = params.line + 1;
|
|
500
|
+
}
|
|
501
|
+
return request;
|
|
502
|
+
}
|
|
503
|
+
__name(toAcpReadTextFileRequest, "toAcpReadTextFileRequest");
|
|
463
504
|
var AcpFileSystemService = class {
|
|
464
505
|
constructor(connection, sessionId, capabilities, fallback, options = {}) {
|
|
465
506
|
this.connection = connection;
|
|
@@ -477,10 +518,9 @@ var AcpFileSystemService = class {
|
|
|
477
518
|
}
|
|
478
519
|
let response;
|
|
479
520
|
try {
|
|
480
|
-
response = await this.connection.readTextFile(
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
});
|
|
521
|
+
response = await this.connection.readTextFile(
|
|
522
|
+
toAcpReadTextFileRequest(params, this.sessionId)
|
|
523
|
+
);
|
|
484
524
|
} catch (error) {
|
|
485
525
|
const errorCode = getErrorCode(error);
|
|
486
526
|
if (errorCode === RESOURCE_NOT_FOUND_CODE) {
|
|
@@ -572,14 +612,130 @@ var AcpFileSystemService = class {
|
|
|
572
612
|
// packages/cli/src/acp-integration/acpAgent.ts
|
|
573
613
|
import { Readable, Writable } from "node:stream";
|
|
574
614
|
import { pipeline } from "node:stream/promises";
|
|
575
|
-
import * as
|
|
576
|
-
import * as
|
|
615
|
+
import * as fs2 from "node:fs/promises";
|
|
616
|
+
import * as os3 from "node:os";
|
|
617
|
+
import * as path4 from "node:path";
|
|
577
618
|
import { createGunzip } from "node:zlib";
|
|
578
619
|
|
|
579
|
-
// packages/cli/src/
|
|
620
|
+
// packages/cli/src/config/settings-cache.ts
|
|
580
621
|
init_esbuild_shims();
|
|
622
|
+
import * as fs from "node:fs";
|
|
581
623
|
import * as os from "node:os";
|
|
582
624
|
import * as path2 from "node:path";
|
|
625
|
+
var MAX_CACHE_ENTRIES = 64;
|
|
626
|
+
var debugLogger2 = createDebugLogger("SETTINGS_CACHE");
|
|
627
|
+
var cache = /* @__PURE__ */ new Map();
|
|
628
|
+
function statSig(filePath) {
|
|
629
|
+
const st = fs.statSync(filePath, { throwIfNoEntry: false });
|
|
630
|
+
return st ? `${st.mtimeMs}:${st.size}:${st.ino}` : "missing";
|
|
631
|
+
}
|
|
632
|
+
__name(statSig, "statSig");
|
|
633
|
+
function realpathOr(p) {
|
|
634
|
+
try {
|
|
635
|
+
return fs.realpathSync(p);
|
|
636
|
+
} catch {
|
|
637
|
+
return path2.resolve(p);
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
__name(realpathOr, "realpathOr");
|
|
641
|
+
function settingsFileSigs(workspaceDir) {
|
|
642
|
+
const filePaths = [
|
|
643
|
+
getSystemSettingsPath(),
|
|
644
|
+
getSystemDefaultsPath(),
|
|
645
|
+
getUserSettingsPath(),
|
|
646
|
+
new Storage(workspaceDir).getWorkspaceSettingsPath()
|
|
647
|
+
];
|
|
648
|
+
return filePaths.map((filePath) => ({ filePath, sig: statSig(filePath) }));
|
|
649
|
+
}
|
|
650
|
+
__name(settingsFileSigs, "settingsFileSigs");
|
|
651
|
+
function envFileSigs(settings, workspaceDir) {
|
|
652
|
+
return findEnvFiles(settings.merged, workspaceDir).map((filePath) => ({
|
|
653
|
+
filePath,
|
|
654
|
+
sig: statSig(filePath)
|
|
655
|
+
}));
|
|
656
|
+
}
|
|
657
|
+
__name(envFileSigs, "envFileSigs");
|
|
658
|
+
function sameFileSigs(a, b) {
|
|
659
|
+
if (a.length !== b.length) {
|
|
660
|
+
return false;
|
|
661
|
+
}
|
|
662
|
+
return a.every(
|
|
663
|
+
(sig, i) => sig.filePath === b[i].filePath && sig.sig === b[i].sig
|
|
664
|
+
);
|
|
665
|
+
}
|
|
666
|
+
__name(sameFileSigs, "sameFileSigs");
|
|
667
|
+
function isEntryFresh(key, entry) {
|
|
668
|
+
const fp = entry.fingerprint;
|
|
669
|
+
return ideContextStore.get()?.workspaceState?.isTrusted === fp.ideTrust && realpathOr(key) === fp.realCwd && // homeDir guards the corner where nothing else moves: QWEN_HOME set (so
|
|
670
|
+
// settings paths don't follow HOME), no .env files anywhere, and the new
|
|
671
|
+
// home equals the workspace dir — which flips workspaceSettingsActive.
|
|
672
|
+
realpathOr(os.homedir()) === fp.homeDir && sameFileSigs(settingsFileSigs(key), fp.settingsFiles) && sameFileSigs(envFileSigs(entry.settings, key), fp.envFiles);
|
|
673
|
+
}
|
|
674
|
+
__name(isEntryFresh, "isEntryFresh");
|
|
675
|
+
function loadSettingsCached(workspaceDir) {
|
|
676
|
+
preResolveHomeEnvOverrides();
|
|
677
|
+
const key = path2.resolve(workspaceDir);
|
|
678
|
+
const entry = cache.get(key);
|
|
679
|
+
if (entry) {
|
|
680
|
+
let isFresh = false;
|
|
681
|
+
try {
|
|
682
|
+
isFresh = isEntryFresh(key, entry);
|
|
683
|
+
} catch (error) {
|
|
684
|
+
debugLogger2.warn(
|
|
685
|
+
`fingerprint check failed for ${key}; reloading:`,
|
|
686
|
+
error
|
|
687
|
+
);
|
|
688
|
+
}
|
|
689
|
+
if (isFresh) {
|
|
690
|
+
cache.delete(key);
|
|
691
|
+
cache.set(key, entry);
|
|
692
|
+
debugLogger2.debug(`hit ${key}`);
|
|
693
|
+
return entry.settings;
|
|
694
|
+
}
|
|
695
|
+
cache.delete(key);
|
|
696
|
+
}
|
|
697
|
+
debugLogger2.debug(`miss ${key}`);
|
|
698
|
+
let preLoadSigs;
|
|
699
|
+
try {
|
|
700
|
+
preLoadSigs = settingsFileSigs(key);
|
|
701
|
+
} catch (error) {
|
|
702
|
+
debugLogger2.warn(`pre-load signing failed for ${key}; not caching:`, error);
|
|
703
|
+
}
|
|
704
|
+
const settings = loadSettings(key);
|
|
705
|
+
if (preLoadSigs) {
|
|
706
|
+
try {
|
|
707
|
+
cache.set(key, {
|
|
708
|
+
settings,
|
|
709
|
+
fingerprint: {
|
|
710
|
+
settingsFiles: preLoadSigs,
|
|
711
|
+
// .env discovery needs the merged settings (trust), so it can only
|
|
712
|
+
// be signed after the load — see difference (2) in the module doc.
|
|
713
|
+
envFiles: envFileSigs(settings, key),
|
|
714
|
+
ideTrust: ideContextStore.get()?.workspaceState?.isTrusted,
|
|
715
|
+
realCwd: realpathOr(key),
|
|
716
|
+
homeDir: realpathOr(os.homedir())
|
|
717
|
+
}
|
|
718
|
+
});
|
|
719
|
+
if (cache.size > MAX_CACHE_ENTRIES) {
|
|
720
|
+
const oldest = cache.keys().next().value;
|
|
721
|
+
if (oldest !== void 0) {
|
|
722
|
+
cache.delete(oldest);
|
|
723
|
+
debugLogger2.debug(`evicted LRU entry ${oldest}`);
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
} catch (error) {
|
|
727
|
+
cache.delete(key);
|
|
728
|
+
debugLogger2.warn(`caching failed for ${key}; serving uncached:`, error);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
return settings;
|
|
732
|
+
}
|
|
733
|
+
__name(loadSettingsCached, "loadSettingsCached");
|
|
734
|
+
|
|
735
|
+
// packages/cli/src/acp-integration/session/Session.ts
|
|
736
|
+
init_esbuild_shims();
|
|
737
|
+
import * as os2 from "node:os";
|
|
738
|
+
import * as path3 from "node:path";
|
|
583
739
|
|
|
584
740
|
// packages/cli/src/acp-integration/session/SubAgentTracker.ts
|
|
585
741
|
init_esbuild_shims();
|
|
@@ -761,7 +917,7 @@ function toPermissionOptions(confirmation, forceHideAlwaysAllow = false) {
|
|
|
761
917
|
__name(toPermissionOptions, "toPermissionOptions");
|
|
762
918
|
|
|
763
919
|
// packages/cli/src/acp-integration/session/SubAgentTracker.ts
|
|
764
|
-
var
|
|
920
|
+
var debugLogger3 = createDebugLogger("ACP_SUBAGENT_TRACKER");
|
|
765
921
|
var SubAgentTracker = class {
|
|
766
922
|
constructor(ctx, client, parentToolCallId, subagentType, onPermissionCancel) {
|
|
767
923
|
this.ctx = ctx;
|
|
@@ -821,7 +977,7 @@ var SubAgentTracker = class {
|
|
|
821
977
|
try {
|
|
822
978
|
invocation = tool.build(event.args);
|
|
823
979
|
} catch (e) {
|
|
824
|
-
|
|
980
|
+
debugLogger3.warn(`Failed to build subagent tool ${event.name}:`, e);
|
|
825
981
|
}
|
|
826
982
|
}
|
|
827
983
|
this.toolStates.set(event.callId, {
|
|
@@ -900,7 +1056,7 @@ var SubAgentTracker = class {
|
|
|
900
1056
|
this.onPermissionCancel?.();
|
|
901
1057
|
}
|
|
902
1058
|
} catch (error) {
|
|
903
|
-
|
|
1059
|
+
debugLogger3.error(
|
|
904
1060
|
`Permission request failed for subagent tool ${event.name}:`,
|
|
905
1061
|
error
|
|
906
1062
|
);
|
|
@@ -908,7 +1064,7 @@ var SubAgentTracker = class {
|
|
|
908
1064
|
try {
|
|
909
1065
|
await event.respond("cancel" /* Cancel */);
|
|
910
1066
|
} catch (respondError) {
|
|
911
|
-
|
|
1067
|
+
debugLogger3.error(
|
|
912
1068
|
`Failed to cancel subagent tool ${event.name} after permission request failure:`,
|
|
913
1069
|
respondError
|
|
914
1070
|
);
|
|
@@ -1006,8 +1162,8 @@ var TurnBuffer = class {
|
|
|
1006
1162
|
// packages/cli/src/acp-integration/session/rewrite/LlmRewriter.ts
|
|
1007
1163
|
init_esbuild_shims();
|
|
1008
1164
|
import { readFileSync, existsSync } from "node:fs";
|
|
1009
|
-
import { resolve } from "node:path";
|
|
1010
|
-
var
|
|
1165
|
+
import { resolve as resolve2 } from "node:path";
|
|
1166
|
+
var debugLogger4 = createDebugLogger("MESSAGE_REWRITER");
|
|
1011
1167
|
var DEFAULT_REWRITE_PROMPT = `You are an assistant that rewrites raw coding-agent output into concise, user-friendly progress updates.
|
|
1012
1168
|
|
|
1013
1169
|
The agent is a software engineering assistant that reads files, writes code, runs commands, and uses tools. Its raw output mixes internal reasoning with user-facing information. Your job: extract what the user cares about, drop what they don't.
|
|
@@ -1033,14 +1189,14 @@ var LlmRewriter = class {
|
|
|
1033
1189
|
this.rewriteModel = rewriteConfig.model || void 0;
|
|
1034
1190
|
this.contextTurns = rewriteConfig.contextTurns === "all" ? Infinity : rewriteConfig.contextTurns ?? 1;
|
|
1035
1191
|
if (rewriteConfig.promptFile) {
|
|
1036
|
-
const filePath =
|
|
1192
|
+
const filePath = resolve2(rewriteConfig.promptFile);
|
|
1037
1193
|
if (existsSync(filePath)) {
|
|
1038
1194
|
this.prompt = readFileSync(filePath, "utf-8").trim();
|
|
1039
|
-
|
|
1195
|
+
debugLogger4.info(
|
|
1040
1196
|
`Loaded rewrite prompt from file: ${filePath} (${this.prompt.length} chars)`
|
|
1041
1197
|
);
|
|
1042
1198
|
} else {
|
|
1043
|
-
|
|
1199
|
+
debugLogger4.warn(
|
|
1044
1200
|
`Rewrite prompt file not found: ${filePath}, using default`
|
|
1045
1201
|
);
|
|
1046
1202
|
this.prompt = DEFAULT_REWRITE_PROMPT;
|
|
@@ -1077,7 +1233,7 @@ var LlmRewriter = class {
|
|
|
1077
1233
|
const inputText = inputParts.join("\n\n");
|
|
1078
1234
|
if (!inputText.trim()) return null;
|
|
1079
1235
|
if (inputText.length < 10) return null;
|
|
1080
|
-
|
|
1236
|
+
debugLogger4.info(
|
|
1081
1237
|
`[REWRITE INPUT] system_prompt_len=${this.prompt.length} input_len=${inputText.length} context_turns=${this.outputHistory.length}
|
|
1082
1238
|
--- INPUT TEXT ---
|
|
1083
1239
|
${inputText}
|
|
@@ -1106,10 +1262,10 @@ ${inputText}
|
|
|
1106
1262
|
});
|
|
1107
1263
|
const rewritten = result.text;
|
|
1108
1264
|
if (!rewritten || rewritten.length < 5) {
|
|
1109
|
-
|
|
1265
|
+
debugLogger4.info(`[REWRITE OUTPUT] empty or too short, skipping`);
|
|
1110
1266
|
return null;
|
|
1111
1267
|
}
|
|
1112
|
-
|
|
1268
|
+
debugLogger4.info(
|
|
1113
1269
|
`[REWRITE OUTPUT] len=${rewritten.length}
|
|
1114
1270
|
--- OUTPUT ---
|
|
1115
1271
|
${rewritten}
|
|
@@ -1118,7 +1274,7 @@ ${rewritten}
|
|
|
1118
1274
|
this.outputHistory.push(rewritten);
|
|
1119
1275
|
return rewritten;
|
|
1120
1276
|
} catch (error) {
|
|
1121
|
-
|
|
1277
|
+
debugLogger4.warn(
|
|
1122
1278
|
`LLM rewrite failed, skipping: ${error instanceof Error ? error.message : String(error)}`
|
|
1123
1279
|
);
|
|
1124
1280
|
return null;
|
|
@@ -1127,7 +1283,7 @@ ${rewritten}
|
|
|
1127
1283
|
};
|
|
1128
1284
|
|
|
1129
1285
|
// packages/cli/src/acp-integration/session/rewrite/MessageRewriteMiddleware.ts
|
|
1130
|
-
var
|
|
1286
|
+
var debugLogger5 = createDebugLogger("MESSAGE_REWRITE");
|
|
1131
1287
|
var DEFAULT_REWRITE_TIMEOUT_MS = 3e4;
|
|
1132
1288
|
var REWRITE_META_EXCLUDED_KEYS = /* @__PURE__ */ new Set([]);
|
|
1133
1289
|
var MessageRewriteMiddleware = class {
|
|
@@ -1207,10 +1363,10 @@ var MessageRewriteMiddleware = class {
|
|
|
1207
1363
|
try {
|
|
1208
1364
|
const rewritten = await this.rewriter.rewrite(content, rewriteSignal);
|
|
1209
1365
|
if (!rewritten) {
|
|
1210
|
-
|
|
1366
|
+
debugLogger5.info(`Turn ${turnIdx}: no rewrite output`);
|
|
1211
1367
|
return;
|
|
1212
1368
|
}
|
|
1213
|
-
|
|
1369
|
+
debugLogger5.info(
|
|
1214
1370
|
`Turn ${turnIdx}: rewritten ${rewritten.length} chars`
|
|
1215
1371
|
);
|
|
1216
1372
|
await this.sendUpdate({
|
|
@@ -1223,7 +1379,7 @@ var MessageRewriteMiddleware = class {
|
|
|
1223
1379
|
}
|
|
1224
1380
|
});
|
|
1225
1381
|
} catch (error) {
|
|
1226
|
-
|
|
1382
|
+
debugLogger5.warn(
|
|
1227
1383
|
`Turn ${turnIdx}: rewrite failed: ${error instanceof Error ? error.message : String(error)}`
|
|
1228
1384
|
);
|
|
1229
1385
|
}
|
|
@@ -1268,7 +1424,7 @@ function loadRewriteConfig(settings) {
|
|
|
1268
1424
|
__name(loadRewriteConfig, "loadRewriteConfig");
|
|
1269
1425
|
|
|
1270
1426
|
// packages/cli/src/acp-integration/session/Session.ts
|
|
1271
|
-
var
|
|
1427
|
+
var debugLogger6 = createDebugLogger("SESSION");
|
|
1272
1428
|
var USER_CANCEL_ABORT_REASON = "qwen:user-cancel";
|
|
1273
1429
|
var DAEMON_RETRY_META_KEY = "qwen.daemon.retry";
|
|
1274
1430
|
var DAEMON_CONTINUE_META_KEY = "qwen.daemon.continueLastTurn";
|
|
@@ -1279,7 +1435,6 @@ function maskApiKeyForDisplay(apiKey) {
|
|
|
1279
1435
|
return `${trimmed.slice(0, 3)}...${trimmed.slice(-4)}`;
|
|
1280
1436
|
}
|
|
1281
1437
|
__name(maskApiKeyForDisplay, "maskApiKeyForDisplay");
|
|
1282
|
-
var DAEMON_TURN_TOOL_CALL_CAP = 100;
|
|
1283
1438
|
var DAEMON_INVALID_TOOL_PARAMS_THRESHOLD = 3;
|
|
1284
1439
|
var PERMISSION_CANCEL_SKIP_MESSAGE = "Skipped because a permission request was cancelled before the user answered; user input is required before continuing.";
|
|
1285
1440
|
var LOOP_DETECTED_SKIP_MESSAGE = "Skipped because loop detection stopped the current turn before this tool call could run.";
|
|
@@ -1295,7 +1450,7 @@ __name(createDaemonToolLoopState, "createDaemonToolLoopState");
|
|
|
1295
1450
|
function recordDaemonLoopDetected(config, promptId, loopType, message, loopState) {
|
|
1296
1451
|
if (!loopState.loopDetected) {
|
|
1297
1452
|
loopState.loopDetected = true;
|
|
1298
|
-
|
|
1453
|
+
debugLogger6.warn(message);
|
|
1299
1454
|
logLoopDetected(config, new LoopDetectedEvent(loopType, promptId));
|
|
1300
1455
|
}
|
|
1301
1456
|
return true;
|
|
@@ -1305,7 +1460,7 @@ function recordDaemonToolCalls(config, promptId, loopState, count) {
|
|
|
1305
1460
|
if (!loopState || loopState.loopDetected)
|
|
1306
1461
|
return loopState?.loopDetected ?? false;
|
|
1307
1462
|
loopState.totalToolCalls += count;
|
|
1308
|
-
if (loopState.totalToolCalls <=
|
|
1463
|
+
if (loopState.totalToolCalls <= config.getMaxToolCallsPerTurn()) return false;
|
|
1309
1464
|
return recordDaemonLoopDetected(
|
|
1310
1465
|
config,
|
|
1311
1466
|
promptId,
|
|
@@ -1364,7 +1519,7 @@ function isContentBlock(value) {
|
|
|
1364
1519
|
case "resource":
|
|
1365
1520
|
return isEmbeddedResourceResource(value["resource"]);
|
|
1366
1521
|
default:
|
|
1367
|
-
|
|
1522
|
+
debugLogger6.warn(`Unknown ContentBlock type: ${value["type"]}`);
|
|
1368
1523
|
return false;
|
|
1369
1524
|
}
|
|
1370
1525
|
}
|
|
@@ -1403,7 +1558,7 @@ function hasInlineMediaContentBlock(content) {
|
|
|
1403
1558
|
__name(hasInlineMediaContentBlock, "hasInlineMediaContentBlock");
|
|
1404
1559
|
function capMidTurnDrainItems(items, fieldName) {
|
|
1405
1560
|
if (items.length <= MAX_MID_TURN_DRAIN_ITEMS) return items;
|
|
1406
|
-
|
|
1561
|
+
debugLogger6.warn(
|
|
1407
1562
|
`Mid-turn drain response had ${items.length} ${fieldName}; processing first ${MAX_MID_TURN_DRAIN_ITEMS}`
|
|
1408
1563
|
);
|
|
1409
1564
|
return items.slice(0, MAX_MID_TURN_DRAIN_ITEMS);
|
|
@@ -1418,7 +1573,7 @@ function getMidTurnItemDisplayTextForLog(displayText) {
|
|
|
1418
1573
|
__name(getMidTurnItemDisplayTextForLog, "getMidTurnItemDisplayTextForLog");
|
|
1419
1574
|
function getValidMidTurnContentBlocks(content, displayText) {
|
|
1420
1575
|
if (!Array.isArray(content)) {
|
|
1421
|
-
|
|
1576
|
+
debugLogger6.warn(
|
|
1422
1577
|
`Dropped invalid mid-turn item: ${getMidTurnItemDisplayTextForLog(
|
|
1423
1578
|
displayText
|
|
1424
1579
|
)}`
|
|
@@ -1428,7 +1583,7 @@ function getValidMidTurnContentBlocks(content, displayText) {
|
|
|
1428
1583
|
const validBlocks = content.filter(isContentBlock);
|
|
1429
1584
|
const invalidBlockCount = content.length - validBlocks.length;
|
|
1430
1585
|
if (invalidBlockCount > 0) {
|
|
1431
|
-
|
|
1586
|
+
debugLogger6.warn(
|
|
1432
1587
|
`Dropped ${invalidBlockCount} invalid mid-turn content block(s): ${getMidTurnItemDisplayTextForLog(
|
|
1433
1588
|
displayText
|
|
1434
1589
|
)}`
|
|
@@ -1474,7 +1629,7 @@ function parseMidTurnDrainResponse(response) {
|
|
|
1474
1629
|
);
|
|
1475
1630
|
}
|
|
1476
1631
|
if (!Array.isArray(response["messages"])) {
|
|
1477
|
-
|
|
1632
|
+
debugLogger6.warn(
|
|
1478
1633
|
`Mid-turn drain response had no recognized 'items' or 'messages' field; keys: ${Object.keys(
|
|
1479
1634
|
response
|
|
1480
1635
|
).join(", ")}`
|
|
@@ -1499,11 +1654,11 @@ var MidTurnDrainTimeoutError = class extends Error {
|
|
|
1499
1654
|
var MAX_NOTIFICATION_QUEUE = 20;
|
|
1500
1655
|
function resolveHomeLoopResolverRoots({
|
|
1501
1656
|
homeQwenDir = Storage.getGlobalQwenDir(),
|
|
1502
|
-
homeDir =
|
|
1657
|
+
homeDir = os2.homedir(),
|
|
1503
1658
|
qwenHome = process.env["QWEN_HOME"]
|
|
1504
1659
|
} = {}) {
|
|
1505
1660
|
return {
|
|
1506
|
-
homeConfineRoot: (qwenHome ? homeQwenDir : homeDir) ||
|
|
1661
|
+
homeConfineRoot: (qwenHome ? homeQwenDir : homeDir) || path3.dirname(homeQwenDir),
|
|
1507
1662
|
homeQwenDir
|
|
1508
1663
|
};
|
|
1509
1664
|
}
|
|
@@ -1542,7 +1697,7 @@ async function fireSessionPermissionDeniedForAutoMode(config, decision, outcome,
|
|
|
1542
1697
|
callId
|
|
1543
1698
|
);
|
|
1544
1699
|
} catch (hookError) {
|
|
1545
|
-
|
|
1700
|
+
debugLogger6.warn(
|
|
1546
1701
|
`PermissionDenied hook failed for tool ${callId}: ${hookError instanceof Error ? hookError.message : String(hookError)}`
|
|
1547
1702
|
);
|
|
1548
1703
|
}
|
|
@@ -1595,6 +1750,17 @@ function collectExtensionMentionRefs(text, mentions) {
|
|
|
1595
1750
|
}
|
|
1596
1751
|
}
|
|
1597
1752
|
__name(collectExtensionMentionRefs, "collectExtensionMentionRefs");
|
|
1753
|
+
function collectMcpServerMentionRefs(text, mentions) {
|
|
1754
|
+
for (const match of text.matchAll(AT_TOKEN_RE)) {
|
|
1755
|
+
const pathName = match[1];
|
|
1756
|
+
if (!pathName) continue;
|
|
1757
|
+
const ref = parseMcpServerRef(pathName);
|
|
1758
|
+
if (ref) {
|
|
1759
|
+
mentions.set(ref.name.toLowerCase(), ref.name);
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
__name(collectMcpServerMentionRefs, "collectMcpServerMentionRefs");
|
|
1598
1764
|
async function buildAvailableCommandsSnapshot(config, abortSignal = AbortSignal.timeout(1e4), settings) {
|
|
1599
1765
|
const slashCommands = await getAvailableCommands(
|
|
1600
1766
|
config,
|
|
@@ -1651,7 +1817,7 @@ async function buildAvailableCommandsSnapshot(config, abortSignal = AbortSignal.
|
|
|
1651
1817
|
}
|
|
1652
1818
|
}
|
|
1653
1819
|
} catch (error) {
|
|
1654
|
-
|
|
1820
|
+
debugLogger6.error("Error loading available skills:", error);
|
|
1655
1821
|
}
|
|
1656
1822
|
for (const command of visibleSlashCommands) {
|
|
1657
1823
|
if (command.kind !== "skill" /* SKILL */ || !command.skillDetail) {
|
|
@@ -1793,7 +1959,7 @@ var Session = class {
|
|
|
1793
1959
|
*/
|
|
1794
1960
|
startCronScheduler() {
|
|
1795
1961
|
this.#startCronSchedulerIfNeeded().catch((error) => {
|
|
1796
|
-
|
|
1962
|
+
debugLogger6.warn(
|
|
1797
1963
|
`Cron scheduler startup failed [session ${this.sessionId}]: ${error}`
|
|
1798
1964
|
);
|
|
1799
1965
|
});
|
|
@@ -1840,7 +2006,7 @@ var Session = class {
|
|
|
1840
2006
|
installRewriter() {
|
|
1841
2007
|
const rewriteConfig = loadRewriteConfig(this.settings);
|
|
1842
2008
|
if (rewriteConfig?.enabled) {
|
|
1843
|
-
|
|
2009
|
+
debugLogger6.info("Message rewrite middleware enabled");
|
|
1844
2010
|
this.messageRewriter = new MessageRewriteMiddleware(
|
|
1845
2011
|
this.config,
|
|
1846
2012
|
rewriteConfig,
|
|
@@ -1851,7 +2017,7 @@ var Session = class {
|
|
|
1851
2017
|
#installGoalTerminalObserver() {
|
|
1852
2018
|
setGoalTerminalObserver(this.sessionId, (event) => {
|
|
1853
2019
|
void this.messageEmitter.emitGoalTerminal(event).catch((error) => {
|
|
1854
|
-
|
|
2020
|
+
debugLogger6.warn(
|
|
1855
2021
|
`Failed to emit goal terminal update: ${this.#formatError(error)}`
|
|
1856
2022
|
);
|
|
1857
2023
|
});
|
|
@@ -1859,7 +2025,7 @@ var Session = class {
|
|
|
1859
2025
|
}
|
|
1860
2026
|
emitGoalStatus(status) {
|
|
1861
2027
|
void this.messageEmitter.emitGoalStatus(status).catch((error) => {
|
|
1862
|
-
|
|
2028
|
+
debugLogger6.warn(
|
|
1863
2029
|
`Failed to emit goal status update: ${this.#formatError(error)}`
|
|
1864
2030
|
);
|
|
1865
2031
|
});
|
|
@@ -1868,11 +2034,14 @@ var Session = class {
|
|
|
1868
2034
|
* Replays conversation history to the client using modular components.
|
|
1869
2035
|
* Delegates to HistoryReplayer for consistent event emission.
|
|
1870
2036
|
*/
|
|
1871
|
-
|
|
2037
|
+
primeTurnFromHistory(records) {
|
|
1872
2038
|
this.turn = Math.max(
|
|
1873
2039
|
this.turn,
|
|
1874
2040
|
computeInitialTurnFromHistory(records, this.config.getSessionId())
|
|
1875
2041
|
);
|
|
2042
|
+
}
|
|
2043
|
+
async replayHistory(records) {
|
|
2044
|
+
this.primeTurnFromHistory(records);
|
|
1876
2045
|
await this.historyReplayer.replay(records);
|
|
1877
2046
|
}
|
|
1878
2047
|
rewindToTurn(targetTurnIndex, opts) {
|
|
@@ -1920,7 +2089,9 @@ var Session = class {
|
|
|
1920
2089
|
}
|
|
1921
2090
|
getRewindableUserTurnCount() {
|
|
1922
2091
|
const apiHistory = this.captureHistorySnapshot();
|
|
1923
|
-
const startIndex = getStartupContextLength(apiHistory
|
|
2092
|
+
const startIndex = getStartupContextLength(apiHistory, {
|
|
2093
|
+
includeCompressed: true
|
|
2094
|
+
});
|
|
1924
2095
|
let count = 0;
|
|
1925
2096
|
for (let i = startIndex; i < apiHistory.length; i++) {
|
|
1926
2097
|
if (this.#isUserTextContent(apiHistory[i])) {
|
|
@@ -1939,7 +2110,9 @@ var Session = class {
|
|
|
1939
2110
|
this.config.getGeminiClient().getChat().setHistory(structuredClone(history));
|
|
1940
2111
|
}
|
|
1941
2112
|
#computeApiTruncationIndexForUserTurn(apiHistory, targetTurnIndex) {
|
|
1942
|
-
const startIndex = getStartupContextLength(apiHistory
|
|
2113
|
+
const startIndex = getStartupContextLength(apiHistory, {
|
|
2114
|
+
includeCompressed: true
|
|
2115
|
+
});
|
|
1943
2116
|
if (targetTurnIndex === 0) {
|
|
1944
2117
|
return startIndex;
|
|
1945
2118
|
}
|
|
@@ -2045,8 +2218,8 @@ var Session = class {
|
|
|
2045
2218
|
}
|
|
2046
2219
|
this.duplicateProviderToolCallResponseIds.clear();
|
|
2047
2220
|
let resolveCompletion;
|
|
2048
|
-
this.pendingPromptCompletion = new Promise((
|
|
2049
|
-
resolveCompletion =
|
|
2221
|
+
this.pendingPromptCompletion = new Promise((resolve4) => {
|
|
2222
|
+
resolveCompletion = resolve4;
|
|
2050
2223
|
});
|
|
2051
2224
|
try {
|
|
2052
2225
|
const result = await this.#executePrompt(params, pendingSend);
|
|
@@ -2128,7 +2301,7 @@ var Session = class {
|
|
|
2128
2301
|
const fullHistory = chat.getHistory(true);
|
|
2129
2302
|
const lastEntry = fullHistory[fullHistory.length - 1];
|
|
2130
2303
|
if (!lastEntry || lastEntry.role !== "model") {
|
|
2131
|
-
|
|
2304
|
+
debugLogger6.debug(
|
|
2132
2305
|
"Skipping followup suggestion: last history entry is not model"
|
|
2133
2306
|
);
|
|
2134
2307
|
return;
|
|
@@ -2164,9 +2337,9 @@ var Session = class {
|
|
|
2164
2337
|
}
|
|
2165
2338
|
} catch (error) {
|
|
2166
2339
|
if (ac.signal.aborted) {
|
|
2167
|
-
|
|
2340
|
+
debugLogger6.debug("Follow-up suggestion generation aborted");
|
|
2168
2341
|
} else {
|
|
2169
|
-
|
|
2342
|
+
debugLogger6.warn("Follow-up suggestion generation failed", error);
|
|
2170
2343
|
}
|
|
2171
2344
|
} finally {
|
|
2172
2345
|
if (this.followupAbort === ac) {
|
|
@@ -2218,7 +2391,7 @@ var Session = class {
|
|
|
2218
2391
|
this.#getCurrentChat().getHistory()
|
|
2219
2392
|
);
|
|
2220
2393
|
if (detection.kind === "none") {
|
|
2221
|
-
|
|
2394
|
+
debugLogger6.warn(
|
|
2222
2395
|
`[Session] continue ${promptId}: no interrupted turn on re-detection, nothing to continue`
|
|
2223
2396
|
);
|
|
2224
2397
|
logConversationFinishedEvent(
|
|
@@ -2310,10 +2483,10 @@ var Session = class {
|
|
|
2310
2483
|
this.config.getChatRecordingService()?.recordFileHistorySnapshot(latestSnapshot);
|
|
2311
2484
|
}
|
|
2312
2485
|
} catch (e) {
|
|
2313
|
-
|
|
2486
|
+
debugLogger6.error(`FileHistory: recordSnapshot failed: ${e}`);
|
|
2314
2487
|
}
|
|
2315
2488
|
} catch (e) {
|
|
2316
|
-
|
|
2489
|
+
debugLogger6.error(`FileHistory: makeSnapshot failed: ${e}`);
|
|
2317
2490
|
}
|
|
2318
2491
|
const systemReminders = await this.#buildInitialSystemReminders();
|
|
2319
2492
|
if (systemReminders.length > 0) {
|
|
@@ -2386,6 +2559,9 @@ ${this.pendingWorktreeNotice}
|
|
|
2386
2559
|
if (resp.type === "chunk" /* CHUNK */ && resp.value.functionCalls) {
|
|
2387
2560
|
functionCalls.push(...resp.value.functionCalls);
|
|
2388
2561
|
}
|
|
2562
|
+
if (resp.type === "model_fallback" /* MODEL_FALLBACK */) {
|
|
2563
|
+
functionCalls.length = 0;
|
|
2564
|
+
}
|
|
2389
2565
|
}
|
|
2390
2566
|
} catch (error) {
|
|
2391
2567
|
if (strippedOrphanEntries && (this.#getCurrentChat().getUserContentPushCount?.() ?? 0) <= orphanPushCountSnapshot) {
|
|
@@ -2407,7 +2583,7 @@ ${this.pendingWorktreeNotice}
|
|
|
2407
2583
|
const hooksEnabledForStopFailure = !this.config.getDisableAllHooks?.();
|
|
2408
2584
|
if (hooksEnabledForStopFailure && hookSystem && this.config.hasHooksForEvent?.("StopFailure")) {
|
|
2409
2585
|
hookSystem.fireStopFailureEvent(errorType, errorMessage).catch((err) => {
|
|
2410
|
-
|
|
2586
|
+
debugLogger6.warn(`StopFailure hook failed: ${err}`);
|
|
2411
2587
|
});
|
|
2412
2588
|
}
|
|
2413
2589
|
if (errorStatus === 429) {
|
|
@@ -2542,7 +2718,7 @@ ${this.pendingWorktreeNotice}
|
|
|
2542
2718
|
warning
|
|
2543
2719
|
);
|
|
2544
2720
|
await this.messageEmitter.emitAgentMessage(warning);
|
|
2545
|
-
|
|
2721
|
+
debugLogger6.warn(warning);
|
|
2546
2722
|
return { stopReason: "end_turn" };
|
|
2547
2723
|
}
|
|
2548
2724
|
if (stopHookIterationCount > 1) {
|
|
@@ -2602,6 +2778,9 @@ ${this.pendingWorktreeNotice}
|
|
|
2602
2778
|
if (resp.type === "chunk" /* CHUNK */ && resp.value.functionCalls) {
|
|
2603
2779
|
functionCalls.push(...resp.value.functionCalls);
|
|
2604
2780
|
}
|
|
2781
|
+
if (resp.type === "model_fallback" /* MODEL_FALLBACK */) {
|
|
2782
|
+
functionCalls.length = 0;
|
|
2783
|
+
}
|
|
2605
2784
|
}
|
|
2606
2785
|
} catch (error) {
|
|
2607
2786
|
const errorStatus = getErrorStatus(error);
|
|
@@ -2614,7 +2793,7 @@ ${this.pendingWorktreeNotice}
|
|
|
2614
2793
|
const hooksEnabledForStopFailure = !this.config.getDisableAllHooks?.();
|
|
2615
2794
|
if (hooksEnabledForStopFailure && hookSystem && this.config.hasHooksForEvent?.("StopFailure")) {
|
|
2616
2795
|
hookSystem.fireStopFailureEvent(errorType, errorMessage).catch((err) => {
|
|
2617
|
-
|
|
2796
|
+
debugLogger6.warn(`StopFailure hook failed: ${err}`);
|
|
2618
2797
|
});
|
|
2619
2798
|
}
|
|
2620
2799
|
if (errorStatus === 429) {
|
|
@@ -2699,16 +2878,16 @@ ${this.pendingWorktreeNotice}
|
|
|
2699
2878
|
}
|
|
2700
2879
|
} catch (compressionError) {
|
|
2701
2880
|
if (abortSignal.aborted || this.#isAbortError(compressionError)) {
|
|
2702
|
-
|
|
2881
|
+
debugLogger6.debug(`Auto-compression aborted for prompt ${promptId}`);
|
|
2703
2882
|
return { responseStream: null, stopReason: "cancelled" };
|
|
2704
2883
|
}
|
|
2705
|
-
|
|
2884
|
+
debugLogger6.warn(
|
|
2706
2885
|
`Auto-compression failed for prompt ${promptId}; proceeding without compression: ` + this.#formatError(compressionError)
|
|
2707
2886
|
);
|
|
2708
2887
|
}
|
|
2709
2888
|
}
|
|
2710
2889
|
if (abortSignal.aborted) {
|
|
2711
|
-
|
|
2890
|
+
debugLogger6.debug(`Auto-compression aborted for prompt ${promptId}`);
|
|
2712
2891
|
return { responseStream: null, stopReason: "cancelled" };
|
|
2713
2892
|
}
|
|
2714
2893
|
if (!compressionInfo) {
|
|
@@ -2718,7 +2897,7 @@ ${this.pendingWorktreeNotice}
|
|
|
2718
2897
|
if (sessionTokenLimit > 0) {
|
|
2719
2898
|
const lastPromptTokenCount = this.#getPostCompressionTokenCount(compressionInfo);
|
|
2720
2899
|
if (lastPromptTokenCount > sessionTokenLimit) {
|
|
2721
|
-
|
|
2900
|
+
debugLogger6.warn(
|
|
2722
2901
|
`Session token limit exceeded for prompt ${promptId}: ${lastPromptTokenCount} > ${sessionTokenLimit}. Send dropped.`
|
|
2723
2902
|
);
|
|
2724
2903
|
await this.#emitAgentDiagnosticMessageSafely(
|
|
@@ -2735,7 +2914,7 @@ ${this.pendingWorktreeNotice}
|
|
|
2735
2914
|
);
|
|
2736
2915
|
}
|
|
2737
2916
|
if (abortSignal.aborted) {
|
|
2738
|
-
|
|
2917
|
+
debugLogger6.debug(
|
|
2739
2918
|
`Send aborted after compression diagnostic for prompt ${promptId}`
|
|
2740
2919
|
);
|
|
2741
2920
|
return { responseStream: null, stopReason: "cancelled" };
|
|
@@ -2763,7 +2942,7 @@ ${this.pendingWorktreeNotice}
|
|
|
2763
2942
|
) ?? [];
|
|
2764
2943
|
const droppedParts = (message.parts?.length ?? 0) - functionResponseParts.length;
|
|
2765
2944
|
if (droppedParts > 0) {
|
|
2766
|
-
|
|
2945
|
+
debugLogger6.debug(
|
|
2767
2946
|
`Dropping ${droppedParts} non-functionResponse part(s) from unsent ACP message after send was skipped.`
|
|
2768
2947
|
);
|
|
2769
2948
|
}
|
|
@@ -2790,11 +2969,11 @@ ${this.pendingWorktreeNotice}
|
|
|
2790
2969
|
}
|
|
2791
2970
|
async #buildNextMessageAfterToolRun(toolRun, abortSignal) {
|
|
2792
2971
|
if (toolRun.loopDetected) {
|
|
2793
|
-
|
|
2972
|
+
debugLogger6.debug("Stopping ACP turn after daemon loop detection.");
|
|
2794
2973
|
return null;
|
|
2795
2974
|
}
|
|
2796
2975
|
if (toolRun.repeatedDuplicateProviderToolCall) {
|
|
2797
|
-
|
|
2976
|
+
debugLogger6.debug(
|
|
2798
2977
|
"Stopping ACP turn after dropping repeated duplicate provider tool-call response."
|
|
2799
2978
|
);
|
|
2800
2979
|
return null;
|
|
@@ -2872,7 +3051,7 @@ ${this.pendingWorktreeNotice}
|
|
|
2872
3051
|
try {
|
|
2873
3052
|
await this.#emitAgentDiagnosticMessage(text);
|
|
2874
3053
|
} catch (notifyError) {
|
|
2875
|
-
|
|
3054
|
+
debugLogger6.warn(`${failureContext}: ${this.#formatError(notifyError)}`);
|
|
2876
3055
|
}
|
|
2877
3056
|
}
|
|
2878
3057
|
async #emitAgentDiagnosticMessage(text) {
|
|
@@ -2921,7 +3100,7 @@ ${this.pendingWorktreeNotice}
|
|
|
2921
3100
|
if (isPermanentError) {
|
|
2922
3101
|
this.midTurnDrainUnavailable = true;
|
|
2923
3102
|
}
|
|
2924
|
-
|
|
3103
|
+
debugLogger6.warn(
|
|
2925
3104
|
`Mid-turn queue drain ${isPermanentError ? "permanently " : ""}unavailable [session ${this.sessionId}]: ${errorMessage}`
|
|
2926
3105
|
);
|
|
2927
3106
|
return this.#buildMidTurnParts(recovered, abortSignal);
|
|
@@ -2947,9 +3126,9 @@ ${this.pendingWorktreeNotice}
|
|
|
2947
3126
|
});
|
|
2948
3127
|
const expired = Symbol("mid-turn-recovery-expired");
|
|
2949
3128
|
let timer;
|
|
2950
|
-
const deadline = new Promise((
|
|
3129
|
+
const deadline = new Promise((resolve4) => {
|
|
2951
3130
|
timer = setTimeout(
|
|
2952
|
-
() =>
|
|
3131
|
+
() => resolve4(expired),
|
|
2953
3132
|
MID_TURN_QUEUE_RECOVERY_TIMEOUT_MS
|
|
2954
3133
|
);
|
|
2955
3134
|
timer.unref?.();
|
|
@@ -2963,14 +3142,14 @@ ${this.pendingWorktreeNotice}
|
|
|
2963
3142
|
clearTimeout(timer);
|
|
2964
3143
|
}
|
|
2965
3144
|
if (late === expired) {
|
|
2966
|
-
|
|
3145
|
+
debugLogger6.warn(
|
|
2967
3146
|
`[mid-turn] dropped a drain response that arrived after the ${MID_TURN_QUEUE_RECOVERY_TIMEOUT_MS}ms recovery deadline [session ${this.sessionId}]`
|
|
2968
3147
|
);
|
|
2969
3148
|
return;
|
|
2970
3149
|
}
|
|
2971
3150
|
const lateMessages = parseMidTurnDrainResponse(late);
|
|
2972
3151
|
if (lateMessages.length > 0) {
|
|
2973
|
-
|
|
3152
|
+
debugLogger6.debug(
|
|
2974
3153
|
`[mid-turn] recovered ${lateMessages.length} message(s) from a timed-out drain [session ${this.sessionId}]`
|
|
2975
3154
|
);
|
|
2976
3155
|
this.midTurnRecoveredMessages.push(...lateMessages);
|
|
@@ -2996,7 +3175,7 @@ ${this.pendingWorktreeNotice}
|
|
|
2996
3175
|
} catch (messageError) {
|
|
2997
3176
|
if (abortSignal.aborted) return parts;
|
|
2998
3177
|
const errorMessage = this.#formatError(messageError);
|
|
2999
|
-
|
|
3178
|
+
debugLogger6.warn(`Failed to resolve mid-turn message: ${errorMessage}`);
|
|
3000
3179
|
rawParts = [{ text: displayText }];
|
|
3001
3180
|
if (message.kind === "structured" && hasInlineMediaContentBlock(message.content)) {
|
|
3002
3181
|
rawParts.push({ text: MID_TURN_ATTACHMENT_PROCESSING_FAILURE_TEXT });
|
|
@@ -3021,7 +3200,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3021
3200
|
try {
|
|
3022
3201
|
await scheduler.enableDurable(this.sessionId);
|
|
3023
3202
|
} catch (err) {
|
|
3024
|
-
|
|
3203
|
+
debugLogger6.warn(
|
|
3025
3204
|
`Durable cron init failed \u2014 persistent tasks will not fire in this session: ${err}`
|
|
3026
3205
|
);
|
|
3027
3206
|
}
|
|
@@ -3050,8 +3229,8 @@ ${this.pendingWorktreeNotice}
|
|
|
3050
3229
|
if (this.notificationProcessing) return;
|
|
3051
3230
|
this.cronProcessing = true;
|
|
3052
3231
|
let resolveCompletion;
|
|
3053
|
-
this.cronCompletion = new Promise((
|
|
3054
|
-
resolveCompletion =
|
|
3232
|
+
this.cronCompletion = new Promise((resolve4) => {
|
|
3233
|
+
resolveCompletion = resolve4;
|
|
3055
3234
|
});
|
|
3056
3235
|
try {
|
|
3057
3236
|
while (this.cronQueue.length > 0) {
|
|
@@ -3132,7 +3311,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3132
3311
|
loopTick = await resolver.resolve(loopMode, trustedAtResolve);
|
|
3133
3312
|
} catch (resolveErr) {
|
|
3134
3313
|
const code = resolveErr.code ?? "unknown";
|
|
3135
|
-
|
|
3314
|
+
debugLogger6.warn(
|
|
3136
3315
|
`loop.md sentinel resolution failed (mode=${loopMode}, code=${code}) \u2014 check .qwen/loop.md permissions/IO`,
|
|
3137
3316
|
resolveErr
|
|
3138
3317
|
);
|
|
@@ -3155,7 +3334,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3155
3334
|
}
|
|
3156
3335
|
const modelText = loopTick ? loopTick.modelText : prompt;
|
|
3157
3336
|
if (loopTick) {
|
|
3158
|
-
|
|
3337
|
+
debugLogger6.debug(
|
|
3159
3338
|
`loop tick: mode=${loopMode ?? autonomousMode} delivery=${loopTick.full ? "full" : loopTick.transientError ? "transient-error" : loopTick.autonomous ? "autonomous-tick" : loopTick.sourceLabel ? "reminder" : "absent"} source=${loopTick.sourceLabel ?? "none"} autonomous=${loopTick.autonomous ?? false} transient=${loopTick.transientError ?? false}`
|
|
3160
3339
|
);
|
|
3161
3340
|
}
|
|
@@ -3226,6 +3405,9 @@ ${this.pendingWorktreeNotice}
|
|
|
3226
3405
|
if (resp.type === "chunk" /* CHUNK */ && resp.value.functionCalls) {
|
|
3227
3406
|
functionCalls.push(...resp.value.functionCalls);
|
|
3228
3407
|
}
|
|
3408
|
+
if (resp.type === "model_fallback" /* MODEL_FALLBACK */) {
|
|
3409
|
+
functionCalls.length = 0;
|
|
3410
|
+
}
|
|
3229
3411
|
}
|
|
3230
3412
|
if (usageMetadata) {
|
|
3231
3413
|
this.#recordPromptTokenCount(usageMetadata);
|
|
@@ -3263,7 +3445,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3263
3445
|
} catch (error) {
|
|
3264
3446
|
if (ac.signal.aborted) return;
|
|
3265
3447
|
cronHadError = true;
|
|
3266
|
-
|
|
3448
|
+
debugLogger6.error("Error processing cron prompt:", error);
|
|
3267
3449
|
const msg = error instanceof Error ? error.message : String(error);
|
|
3268
3450
|
await this.messageEmitter.emitAgentMessage(
|
|
3269
3451
|
`[${item.source} error] ${msg}`
|
|
@@ -3347,7 +3529,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3347
3529
|
#enqueueBackgroundNotification(item) {
|
|
3348
3530
|
while (this.notificationQueue.length >= MAX_NOTIFICATION_QUEUE) {
|
|
3349
3531
|
const evicted = this.notificationQueue.shift();
|
|
3350
|
-
|
|
3532
|
+
debugLogger6.warn(
|
|
3351
3533
|
`Notification queue overflow: evicting task=${evicted.taskId} kind=${evicted.kind}`
|
|
3352
3534
|
);
|
|
3353
3535
|
}
|
|
@@ -3363,8 +3545,8 @@ ${this.pendingWorktreeNotice}
|
|
|
3363
3545
|
if (this.notificationQueue.length === 0) return;
|
|
3364
3546
|
this.notificationProcessing = true;
|
|
3365
3547
|
let resolveCompletion;
|
|
3366
|
-
this.notificationCompletion = new Promise((
|
|
3367
|
-
resolveCompletion =
|
|
3548
|
+
this.notificationCompletion = new Promise((resolve4) => {
|
|
3549
|
+
resolveCompletion = resolve4;
|
|
3368
3550
|
});
|
|
3369
3551
|
try {
|
|
3370
3552
|
while (this.notificationQueue.length > 0) {
|
|
@@ -3457,6 +3639,9 @@ ${this.pendingWorktreeNotice}
|
|
|
3457
3639
|
if (resp.type === "chunk" /* CHUNK */ && resp.value.functionCalls) {
|
|
3458
3640
|
functionCalls.push(...resp.value.functionCalls);
|
|
3459
3641
|
}
|
|
3642
|
+
if (resp.type === "model_fallback" /* MODEL_FALLBACK */) {
|
|
3643
|
+
functionCalls.length = 0;
|
|
3644
|
+
}
|
|
3460
3645
|
}
|
|
3461
3646
|
if (responseText.length > 0) {
|
|
3462
3647
|
await this.#emitBackgroundNotificationResponse(
|
|
@@ -3509,14 +3694,14 @@ ${this.pendingWorktreeNotice}
|
|
|
3509
3694
|
await this.#emitBackgroundNotificationEndTurn("cancelled");
|
|
3510
3695
|
return;
|
|
3511
3696
|
}
|
|
3512
|
-
|
|
3697
|
+
debugLogger6.error("Error processing background notification:", error);
|
|
3513
3698
|
const msg = error instanceof Error ? error.message : String(error);
|
|
3514
3699
|
try {
|
|
3515
3700
|
await this.messageEmitter.emitAgentMessage(
|
|
3516
3701
|
`[notification error] ${msg}`
|
|
3517
3702
|
);
|
|
3518
3703
|
} catch (emitError) {
|
|
3519
|
-
|
|
3704
|
+
debugLogger6.error(
|
|
3520
3705
|
"Failed to emit background notification error:",
|
|
3521
3706
|
emitError
|
|
3522
3707
|
);
|
|
@@ -3576,7 +3761,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3576
3761
|
source: "background_notification"
|
|
3577
3762
|
});
|
|
3578
3763
|
} catch (error) {
|
|
3579
|
-
|
|
3764
|
+
debugLogger6.debug(
|
|
3580
3765
|
`Background notification end-turn extNotification dropped: ${this.#formatError(error)}`
|
|
3581
3766
|
);
|
|
3582
3767
|
}
|
|
@@ -3600,7 +3785,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3600
3785
|
};
|
|
3601
3786
|
await this.sendUpdate(update);
|
|
3602
3787
|
} catch (error) {
|
|
3603
|
-
|
|
3788
|
+
debugLogger6.error("Error sending available commands update:", error);
|
|
3604
3789
|
}
|
|
3605
3790
|
}
|
|
3606
3791
|
/**
|
|
@@ -3635,7 +3820,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3635
3820
|
sessionId: this.sessionId,
|
|
3636
3821
|
currentModeId: params.modeId
|
|
3637
3822
|
}).catch((error) => {
|
|
3638
|
-
|
|
3823
|
+
debugLogger6.debug("mode-update extNotification failed", error);
|
|
3639
3824
|
});
|
|
3640
3825
|
}
|
|
3641
3826
|
/**
|
|
@@ -3669,7 +3854,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3669
3854
|
sessionId: this.sessionId,
|
|
3670
3855
|
currentModelId: effectiveModelId
|
|
3671
3856
|
}).catch((error) => {
|
|
3672
|
-
|
|
3857
|
+
debugLogger6.debug("model-update extNotification failed", error);
|
|
3673
3858
|
});
|
|
3674
3859
|
if (options.persistDefault ?? true) {
|
|
3675
3860
|
const persistScope = getPersistScopeForModelSelection(this.settings);
|
|
@@ -3722,7 +3907,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3722
3907
|
currentModeId: newModeId,
|
|
3723
3908
|
legacyFrameSent: true
|
|
3724
3909
|
}).catch((error) => {
|
|
3725
|
-
|
|
3910
|
+
debugLogger6.debug("mode-update extNotification failed", error);
|
|
3726
3911
|
});
|
|
3727
3912
|
}
|
|
3728
3913
|
/**
|
|
@@ -3767,7 +3952,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3767
3952
|
}
|
|
3768
3953
|
await this.toolCallEmitter.emitError(callId, toolName, error);
|
|
3769
3954
|
} catch (recordError) {
|
|
3770
|
-
|
|
3955
|
+
debugLogger6.error("Failed to record skipped tool call:", recordError);
|
|
3771
3956
|
}
|
|
3772
3957
|
return part;
|
|
3773
3958
|
}, "recordSkippedToolCall");
|
|
@@ -3799,7 +3984,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3799
3984
|
);
|
|
3800
3985
|
if (repeatedDuplicateCall) {
|
|
3801
3986
|
const providerCallId = getProviderToolCallId(repeatedDuplicateCall) ?? repeatedDuplicateCall.id;
|
|
3802
|
-
|
|
3987
|
+
debugLogger6.debug(
|
|
3803
3988
|
`[Session.runToolCalls] Dropping batch after repeated duplicate provider tool-call id: ${providerCallId} (tool: ${repeatedDuplicateCall.name ?? "unknown_tool"})`
|
|
3804
3989
|
);
|
|
3805
3990
|
return {
|
|
@@ -3815,7 +4000,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3815
4000
|
this.duplicateProviderToolCallResponseIds
|
|
3816
4001
|
);
|
|
3817
4002
|
const response = createDuplicateProviderToolCallResponse(request);
|
|
3818
|
-
|
|
4003
|
+
debugLogger6.debug(
|
|
3819
4004
|
`[Session.runToolCalls] Suppressing duplicate provider tool-call id: ${providerCallId} (tool: ${request.name})`
|
|
3820
4005
|
);
|
|
3821
4006
|
batches.push({ kind: "duplicate", request, response });
|
|
@@ -4320,7 +4505,7 @@ ${this.pendingWorktreeNotice}
|
|
|
4320
4505
|
forceAutoReviewForAllow
|
|
4321
4506
|
);
|
|
4322
4507
|
if (finalPermission === "allow" && forceAutoReviewForAllow) {
|
|
4323
|
-
|
|
4508
|
+
debugLogger6.info(
|
|
4324
4509
|
`Auto mode: L4 allow overridden by protected-write guard for ${toolName}`
|
|
4325
4510
|
);
|
|
4326
4511
|
}
|
|
@@ -4363,7 +4548,7 @@ ${this.pendingWorktreeNotice}
|
|
|
4363
4548
|
autoModeAllowed = true;
|
|
4364
4549
|
break;
|
|
4365
4550
|
case "blocked":
|
|
4366
|
-
|
|
4551
|
+
debugLogger6.warn(
|
|
4367
4552
|
`Auto mode blocked (${outcome.reason}): tool=${toolName}, ` + formatDenialStateLog(denialState)
|
|
4368
4553
|
);
|
|
4369
4554
|
return earlyErrorResponse(
|
|
@@ -4375,7 +4560,7 @@ ${this.pendingWorktreeNotice}
|
|
|
4375
4560
|
outcome.reason
|
|
4376
4561
|
);
|
|
4377
4562
|
if (wasAutoModeDenialFallback) {
|
|
4378
|
-
|
|
4563
|
+
debugLogger6.warn(
|
|
4379
4564
|
`Auto mode fallback to manual approval (${outcome.reason}): ` + formatDenialStateLog(denialState)
|
|
4380
4565
|
);
|
|
4381
4566
|
}
|
|
@@ -4393,12 +4578,12 @@ ${this.pendingWorktreeNotice}
|
|
|
4393
4578
|
const before = this.config.getAutoModeDenialState();
|
|
4394
4579
|
const after = recordFallbackApprove(before);
|
|
4395
4580
|
if (after === before) {
|
|
4396
|
-
|
|
4581
|
+
debugLogger6.warn(
|
|
4397
4582
|
`Auto mode denial counters already clear after fallback approval: ` + formatDenialStateLog(before)
|
|
4398
4583
|
);
|
|
4399
4584
|
return;
|
|
4400
4585
|
}
|
|
4401
|
-
|
|
4586
|
+
debugLogger6.warn(
|
|
4402
4587
|
`Auto mode denial counters reset after fallback approval: ${formatDenialStateLog(before)} -> ${formatDenialStateLog(after)}`
|
|
4403
4588
|
);
|
|
4404
4589
|
this.config.setAutoModeDenialState(after);
|
|
@@ -4504,7 +4689,7 @@ ${this.pendingWorktreeNotice}
|
|
|
4504
4689
|
);
|
|
4505
4690
|
outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
4506
4691
|
} catch (error) {
|
|
4507
|
-
|
|
4692
|
+
debugLogger6.error(
|
|
4508
4693
|
`Permission request failed for tool ${toolName}:`,
|
|
4509
4694
|
error
|
|
4510
4695
|
);
|
|
@@ -4513,7 +4698,7 @@ ${this.pendingWorktreeNotice}
|
|
|
4513
4698
|
"cancel" /* Cancel */
|
|
4514
4699
|
);
|
|
4515
4700
|
} catch (confirmError) {
|
|
4516
|
-
|
|
4701
|
+
debugLogger6.error(
|
|
4517
4702
|
`Failed to cancel tool ${toolName} after permission request failure:`,
|
|
4518
4703
|
confirmError
|
|
4519
4704
|
);
|
|
@@ -4538,7 +4723,7 @@ ${this.pendingWorktreeNotice}
|
|
|
4538
4723
|
if (outcome !== "cancel" /* Cancel */) {
|
|
4539
4724
|
throw error;
|
|
4540
4725
|
}
|
|
4541
|
-
|
|
4726
|
+
debugLogger6.error(
|
|
4542
4727
|
`Failed to confirm cancellation for tool ${toolName}:`,
|
|
4543
4728
|
error
|
|
4544
4729
|
);
|
|
@@ -4608,7 +4793,7 @@ ${this.pendingWorktreeNotice}
|
|
|
4608
4793
|
return earlyErrorResponse(new Error(blockReason), toolName);
|
|
4609
4794
|
}
|
|
4610
4795
|
if (preHookResult.additionalContext) {
|
|
4611
|
-
|
|
4796
|
+
debugLogger6.debug(
|
|
4612
4797
|
`PreToolUse hook additional context for ${toolName}: ${preHookResult.additionalContext}`
|
|
4613
4798
|
);
|
|
4614
4799
|
}
|
|
@@ -4672,7 +4857,7 @@ ${this.pendingWorktreeNotice}
|
|
|
4672
4857
|
);
|
|
4673
4858
|
if (postHookResult.shouldStop) {
|
|
4674
4859
|
const stopMessage = postHookResult.stopReason || "Execution stopped by PostToolUse hook";
|
|
4675
|
-
|
|
4860
|
+
debugLogger6.info(
|
|
4676
4861
|
`PostToolUse hook requested stop for ${toolName}: ${stopMessage}`
|
|
4677
4862
|
);
|
|
4678
4863
|
return earlyErrorResponse(new Error(stopMessage), toolName);
|
|
@@ -4701,7 +4886,7 @@ ${this.pendingWorktreeNotice}
|
|
|
4701
4886
|
callId
|
|
4702
4887
|
);
|
|
4703
4888
|
if (failureHookResult.additionalContext) {
|
|
4704
|
-
|
|
4889
|
+
debugLogger6.debug(
|
|
4705
4890
|
`PostToolUseFailure hook additional context for ${toolName}: ${failureHookResult.additionalContext}`
|
|
4706
4891
|
);
|
|
4707
4892
|
}
|
|
@@ -4783,7 +4968,7 @@ ${this.pendingWorktreeNotice}
|
|
|
4783
4968
|
callId
|
|
4784
4969
|
);
|
|
4785
4970
|
if (failureHookResult.additionalContext) {
|
|
4786
|
-
|
|
4971
|
+
debugLogger6.debug(
|
|
4787
4972
|
`PostToolUseFailure hook additional context for ${toolName}: ${failureHookResult.additionalContext}`
|
|
4788
4973
|
);
|
|
4789
4974
|
}
|
|
@@ -4934,6 +5119,7 @@ ${this.pendingWorktreeNotice}
|
|
|
4934
5119
|
const FILE_URI_SCHEME = "file://";
|
|
4935
5120
|
const embeddedContext = [];
|
|
4936
5121
|
const extensionMentions = /* @__PURE__ */ new Map();
|
|
5122
|
+
const mcpServerMentions = /* @__PURE__ */ new Map();
|
|
4937
5123
|
const preserveUnsupportedImageForBridge = shouldRunVisionBridge(
|
|
4938
5124
|
this.config
|
|
4939
5125
|
);
|
|
@@ -4941,6 +5127,7 @@ ${this.pendingWorktreeNotice}
|
|
|
4941
5127
|
switch (part.type) {
|
|
4942
5128
|
case "text":
|
|
4943
5129
|
collectExtensionMentionRefs(part.text, extensionMentions);
|
|
5130
|
+
collectMcpServerMentionRefs(part.text, mcpServerMentions);
|
|
4944
5131
|
return { text: part.text };
|
|
4945
5132
|
case "image":
|
|
4946
5133
|
if (preserveUnsupportedImageForBridge) {
|
|
@@ -4992,12 +5179,13 @@ ${this.pendingWorktreeNotice}
|
|
|
4992
5179
|
extensionMentions,
|
|
4993
5180
|
abortSignal
|
|
4994
5181
|
);
|
|
4995
|
-
|
|
5182
|
+
const mcpServerParts = this.#resolveMcpServerMentionParts(mcpServerMentions);
|
|
5183
|
+
if (atPathCommandParts.length === 0 && embeddedContext.length === 0 && extensionParts.length === 0 && mcpServerParts.length === 0) {
|
|
4996
5184
|
return this.#applyVisionBridgeIfNeeded(parts, abortSignal);
|
|
4997
5185
|
}
|
|
4998
5186
|
if (atPathCommandParts.length === 0 && embeddedContext.length === 0) {
|
|
4999
5187
|
return this.#applyVisionBridgeIfNeeded(
|
|
5000
|
-
[...parts, ...extensionParts],
|
|
5188
|
+
[...parts, ...extensionParts, ...mcpServerParts],
|
|
5001
5189
|
abortSignal
|
|
5002
5190
|
);
|
|
5003
5191
|
}
|
|
@@ -5027,6 +5215,7 @@ ${this.pendingWorktreeNotice}
|
|
|
5027
5215
|
const contentParts = Array.isArray(readResult.contentParts) ? readResult.contentParts : [readResult.contentParts];
|
|
5028
5216
|
processedQueryParts.push({ text: initialQueryText });
|
|
5029
5217
|
processedQueryParts.push(...extensionParts);
|
|
5218
|
+
processedQueryParts.push(...mcpServerParts);
|
|
5030
5219
|
for (const part of contentParts) {
|
|
5031
5220
|
if (typeof part === "string") {
|
|
5032
5221
|
processedQueryParts.push({ text: part });
|
|
@@ -5039,6 +5228,7 @@ ${this.pendingWorktreeNotice}
|
|
|
5039
5228
|
} else {
|
|
5040
5229
|
processedQueryParts.push({ text: initialQueryText.trim() });
|
|
5041
5230
|
processedQueryParts.push(...extensionParts);
|
|
5231
|
+
processedQueryParts.push(...mcpServerParts);
|
|
5042
5232
|
}
|
|
5043
5233
|
for (const contextPart of embeddedContext) {
|
|
5044
5234
|
if ("text" in contextPart && contextPart.text) {
|
|
@@ -5067,19 +5257,19 @@ ${contextPart.text}`
|
|
|
5067
5257
|
}
|
|
5068
5258
|
let bridgeResult;
|
|
5069
5259
|
try {
|
|
5070
|
-
|
|
5260
|
+
debugLogger6.debug("vision bridge: gate matched, running conversion");
|
|
5071
5261
|
bridgeResult = await runVisionBridge({
|
|
5072
5262
|
config: this.config,
|
|
5073
5263
|
parts,
|
|
5074
5264
|
signal: abortSignal
|
|
5075
5265
|
});
|
|
5076
5266
|
} catch (error) {
|
|
5077
|
-
|
|
5267
|
+
debugLogger6.debug(
|
|
5078
5268
|
`vision bridge: failed before replacement; falling back to text-only parts error=${String(error instanceof Error ? error.message : error)}`
|
|
5079
5269
|
);
|
|
5080
5270
|
return splitImageParts(parts).nonImageParts;
|
|
5081
5271
|
}
|
|
5082
|
-
|
|
5272
|
+
debugLogger6.debug(
|
|
5083
5273
|
`vision bridge: status=${bridgeResult.status} applied=${bridgeResult.applied} model=${bridgeResult.modelId ?? "(none)"}${bridgeResult.error ? ` error=${bridgeResult.error}` : ""}`
|
|
5084
5274
|
);
|
|
5085
5275
|
if (bridgeResult.status !== "skipped" || bridgeResult.egressOccurred) {
|
|
@@ -5088,13 +5278,13 @@ ${contextPart.text}`
|
|
|
5088
5278
|
this.#formatVisionBridgeNotice(bridgeResult)
|
|
5089
5279
|
);
|
|
5090
5280
|
} catch (error) {
|
|
5091
|
-
|
|
5281
|
+
debugLogger6.debug(
|
|
5092
5282
|
`vision bridge: failed to emit notice; continuing with bridge result error=${String(error instanceof Error ? error.message : error)}`
|
|
5093
5283
|
);
|
|
5094
5284
|
}
|
|
5095
5285
|
}
|
|
5096
5286
|
if (abortSignal.aborted) {
|
|
5097
|
-
|
|
5287
|
+
debugLogger6.debug("vision bridge: turn aborted after bridge returned");
|
|
5098
5288
|
return splitImageParts(parts).nonImageParts;
|
|
5099
5289
|
}
|
|
5100
5290
|
if (bridgeResult.applied && bridgeResult.parts != null) {
|
|
@@ -5143,9 +5333,28 @@ ${contextPart.text}`
|
|
|
5143
5333
|
}
|
|
5144
5334
|
return extensionParts;
|
|
5145
5335
|
}
|
|
5336
|
+
#resolveMcpServerMentionParts(mcpServerMentions) {
|
|
5337
|
+
if (mcpServerMentions.size === 0) return [];
|
|
5338
|
+
const servers = this.config.getMcpServers?.() ?? {};
|
|
5339
|
+
if (Object.keys(servers).length === 0) return [];
|
|
5340
|
+
const parts = [];
|
|
5341
|
+
for (const name of mcpServerMentions.values()) {
|
|
5342
|
+
const matched = matchMcpServerByRef(name, servers);
|
|
5343
|
+
if (!matched) {
|
|
5344
|
+
this.debug(
|
|
5345
|
+
`MCP server "${name}" not found among configured MCP servers. Available: ${Object.keys(servers).join(", ") || "(none)"}`
|
|
5346
|
+
);
|
|
5347
|
+
continue;
|
|
5348
|
+
}
|
|
5349
|
+
parts.push({
|
|
5350
|
+
text: buildMcpServerContextText(this.config, matched.serverName)
|
|
5351
|
+
});
|
|
5352
|
+
}
|
|
5353
|
+
return parts;
|
|
5354
|
+
}
|
|
5146
5355
|
debug(msg) {
|
|
5147
5356
|
if (this.config.getDebugMode()) {
|
|
5148
|
-
|
|
5357
|
+
debugLogger6.warn(msg);
|
|
5149
5358
|
}
|
|
5150
5359
|
}
|
|
5151
5360
|
async emitHookArtifactsNotification(args) {
|
|
@@ -5185,7 +5394,7 @@ ${contextPart.text}`
|
|
|
5185
5394
|
}
|
|
5186
5395
|
);
|
|
5187
5396
|
}).catch((err) => {
|
|
5188
|
-
|
|
5397
|
+
debugLogger6.debug(
|
|
5189
5398
|
`ACP terminalSequence notification dropped (session=${this.sessionId}): ${err instanceof Error ? err.message : String(err)}`
|
|
5190
5399
|
);
|
|
5191
5400
|
});
|
|
@@ -5301,9 +5510,101 @@ function runWithAcpRuntimeOutputDir(settings, cwd, fn) {
|
|
|
5301
5510
|
__name(runWithAcpRuntimeOutputDir, "runWithAcpRuntimeOutputDir");
|
|
5302
5511
|
|
|
5303
5512
|
// packages/cli/src/acp-integration/acpAgent.ts
|
|
5304
|
-
var
|
|
5513
|
+
var debugLogger7 = createDebugLogger("ACP_AGENT");
|
|
5514
|
+
var QWEN_ACP_LOCAL_READ_ROOTS_ENV = "QWEN_ACP_LOCAL_READ_ROOTS";
|
|
5515
|
+
var POSIX_TMP_LOCAL_READ_ROOT = "/tmp";
|
|
5305
5516
|
var BTW_CHILD_TIMEOUT_MS = 55e3;
|
|
5306
5517
|
var WORKSPACE_MEMORY_REMEMBER_CHILD_TIMEOUT_MS = 295e3;
|
|
5518
|
+
function parseAcpLocalReadRootsEnv(raw = process.env[QWEN_ACP_LOCAL_READ_ROOTS_ENV]) {
|
|
5519
|
+
if (!raw) return [];
|
|
5520
|
+
return raw.split(path4.delimiter).map((entry) => entry.trim()).filter((entry) => entry.length > 0 && path4.isAbsolute(entry));
|
|
5521
|
+
}
|
|
5522
|
+
__name(parseAcpLocalReadRootsEnv, "parseAcpLocalReadRootsEnv");
|
|
5523
|
+
function defaultAcpOnlyLocalReadRoots() {
|
|
5524
|
+
return process.platform === "win32" ? [] : [POSIX_TMP_LOCAL_READ_ROOT];
|
|
5525
|
+
}
|
|
5526
|
+
__name(defaultAcpOnlyLocalReadRoots, "defaultAcpOnlyLocalReadRoots");
|
|
5527
|
+
function buildAcpLocalReadRoots(config) {
|
|
5528
|
+
return [
|
|
5529
|
+
// SYNC: The first group mirrors ReadFileTool's default allowed local roots,
|
|
5530
|
+
// including auto-memory roots. The ACP-only additions below expand only
|
|
5531
|
+
// local read fallback, not read_file's default permission.
|
|
5532
|
+
config.storage.getProjectTempDir(),
|
|
5533
|
+
path4.join(config.storage.getProjectDir(), "subagents"),
|
|
5534
|
+
Storage.getGlobalTempDir(),
|
|
5535
|
+
getAutoMemoryRoot(config.getTargetDir()),
|
|
5536
|
+
getUserAutoMemoryRoot(),
|
|
5537
|
+
...config.storage.getUserSkillsDirs(),
|
|
5538
|
+
Storage.getUserExtensionsDir(),
|
|
5539
|
+
...defaultAcpOnlyLocalReadRoots(),
|
|
5540
|
+
...parseAcpLocalReadRootsEnv()
|
|
5541
|
+
];
|
|
5542
|
+
}
|
|
5543
|
+
__name(buildAcpLocalReadRoots, "buildAcpLocalReadRoots");
|
|
5544
|
+
function isObjectRecord(value) {
|
|
5545
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5546
|
+
}
|
|
5547
|
+
__name(isObjectRecord, "isObjectRecord");
|
|
5548
|
+
function isBulkLoadReplayRequest(params) {
|
|
5549
|
+
const meta = isObjectRecord(params._meta) ? params._meta : void 0;
|
|
5550
|
+
return meta?.[LOAD_REPLAY_MODE_META_KEY] === LOAD_REPLAY_BULK_MODE;
|
|
5551
|
+
}
|
|
5552
|
+
__name(isBulkLoadReplayRequest, "isBulkLoadReplayRequest");
|
|
5553
|
+
function createReplayCumulativeUsage() {
|
|
5554
|
+
return {
|
|
5555
|
+
promptTokens: 0,
|
|
5556
|
+
cachedTokens: 0,
|
|
5557
|
+
candidateTokens: 0,
|
|
5558
|
+
apiTimeMs: 0
|
|
5559
|
+
};
|
|
5560
|
+
}
|
|
5561
|
+
__name(createReplayCumulativeUsage, "createReplayCumulativeUsage");
|
|
5562
|
+
function copyCumulativeUsage(target, source) {
|
|
5563
|
+
target.promptTokens = source.promptTokens;
|
|
5564
|
+
target.cachedTokens = source.cachedTokens;
|
|
5565
|
+
target.candidateTokens = source.candidateTokens;
|
|
5566
|
+
target.apiTimeMs = source.apiTimeMs;
|
|
5567
|
+
}
|
|
5568
|
+
__name(copyCumulativeUsage, "copyCumulativeUsage");
|
|
5569
|
+
async function collectHistoryReplayUpdates({
|
|
5570
|
+
sessionId,
|
|
5571
|
+
config,
|
|
5572
|
+
records,
|
|
5573
|
+
cumulativeUsage
|
|
5574
|
+
}) {
|
|
5575
|
+
const updates = [];
|
|
5576
|
+
const replayContext = {
|
|
5577
|
+
sessionId,
|
|
5578
|
+
config,
|
|
5579
|
+
sendUpdate: /* @__PURE__ */ __name(async (update) => {
|
|
5580
|
+
updates.push(update);
|
|
5581
|
+
}, "sendUpdate"),
|
|
5582
|
+
cumulativeUsage
|
|
5583
|
+
};
|
|
5584
|
+
try {
|
|
5585
|
+
await new HistoryReplayer(replayContext).replay(records);
|
|
5586
|
+
} catch (error) {
|
|
5587
|
+
const replayError = error instanceof Error ? error.message : String(error);
|
|
5588
|
+
debugLogger7.warn(
|
|
5589
|
+
"[historyReplay] History replay failed for session %s (partial updates: %d):",
|
|
5590
|
+
sessionId,
|
|
5591
|
+
updates.length,
|
|
5592
|
+
error
|
|
5593
|
+
);
|
|
5594
|
+
return { updates, replayError };
|
|
5595
|
+
}
|
|
5596
|
+
return { updates };
|
|
5597
|
+
}
|
|
5598
|
+
__name(collectHistoryReplayUpdates, "collectHistoryReplayUpdates");
|
|
5599
|
+
function liftSessionUpdateTimestamps(updates) {
|
|
5600
|
+
return updates.map((update) => {
|
|
5601
|
+
const record = update;
|
|
5602
|
+
const meta = record["_meta"];
|
|
5603
|
+
const timestamp = isObjectRecord(meta) ? meta["timestamp"] : void 0;
|
|
5604
|
+
return typeof timestamp === "number" || typeof timestamp === "string" ? { ...record, timestamp } : update;
|
|
5605
|
+
});
|
|
5606
|
+
}
|
|
5607
|
+
__name(liftSessionUpdateTimestamps, "liftSessionUpdateTimestamps");
|
|
5307
5608
|
function createHiddenWorkspaceMemoryConfig(config) {
|
|
5308
5609
|
return new Proxy(config, {
|
|
5309
5610
|
get(target, prop) {
|
|
@@ -5441,7 +5742,7 @@ function readRequiredString(value, fieldName) {
|
|
|
5441
5742
|
}
|
|
5442
5743
|
__name(readRequiredString, "readRequiredString");
|
|
5443
5744
|
function validateSkillSlug(slug) {
|
|
5444
|
-
if (!slug || slug === "." || slug === ".." || slug.includes("/") || slug.includes(
|
|
5745
|
+
if (!slug || slug === "." || slug === ".." || slug.includes("/") || slug.includes(path4.sep) || !/^[a-zA-Z0-9._-]+$/.test(slug)) {
|
|
5445
5746
|
throw RequestError.invalidParams(void 0, "Invalid skill.slug");
|
|
5446
5747
|
}
|
|
5447
5748
|
}
|
|
@@ -5910,7 +6211,7 @@ async function downloadGitHubSkillDirectoryFromApi(githubUrl, directoryPath, rel
|
|
|
5910
6211
|
const name = readRequiredString(record["name"], "github.name");
|
|
5911
6212
|
const itemPath = readRequiredString(record["path"], "github.path");
|
|
5912
6213
|
const type = readRequiredString(record["type"], "github.type");
|
|
5913
|
-
const relativePath = relativeRoot ?
|
|
6214
|
+
const relativePath = relativeRoot ? path4.posix.join(relativeRoot, name) : name;
|
|
5914
6215
|
if (type === "dir") {
|
|
5915
6216
|
files.push(
|
|
5916
6217
|
...await downloadGitHubSkillDirectoryFromApi(
|
|
@@ -5957,7 +6258,7 @@ async function downloadGitHubSkillDirectory(githubUrl, directoryPath) {
|
|
|
5957
6258
|
githubUrl,
|
|
5958
6259
|
directoryPath
|
|
5959
6260
|
).catch((error) => {
|
|
5960
|
-
|
|
6261
|
+
debugLogger7.warn(
|
|
5961
6262
|
"GitHub API directory listing failed, falling back to archive download:",
|
|
5962
6263
|
error
|
|
5963
6264
|
);
|
|
@@ -5970,10 +6271,10 @@ __name(downloadGitHubSkillDirectory, "downloadGitHubSkillDirectory");
|
|
|
5970
6271
|
async function downloadSkill(sourceUrl) {
|
|
5971
6272
|
assertAllowedSkillSourceUrl(sourceUrl);
|
|
5972
6273
|
const githubUrl = parseGitHubBlobSkillUrl(sourceUrl);
|
|
5973
|
-
if (!githubUrl ||
|
|
6274
|
+
if (!githubUrl || path4.posix.basename(githubUrl.filePath) !== "SKILL.md") {
|
|
5974
6275
|
return downloadSingleSkillFile(sourceUrl);
|
|
5975
6276
|
}
|
|
5976
|
-
const skillDirectory =
|
|
6277
|
+
const skillDirectory = path4.posix.dirname(githubUrl.filePath);
|
|
5977
6278
|
const files = await downloadGitHubSkillDirectory(githubUrl, skillDirectory);
|
|
5978
6279
|
const skillFile = files.find((file) => file.relativePath === "SKILL.md");
|
|
5979
6280
|
if (!skillFile) {
|
|
@@ -5989,9 +6290,9 @@ async function downloadSkill(sourceUrl) {
|
|
|
5989
6290
|
}
|
|
5990
6291
|
__name(downloadSkill, "downloadSkill");
|
|
5991
6292
|
function resolveSkillInstallPath(skillDir, relativePath) {
|
|
5992
|
-
const root =
|
|
5993
|
-
const target =
|
|
5994
|
-
if (target !== root && !target.startsWith(root +
|
|
6293
|
+
const root = path4.resolve(skillDir);
|
|
6294
|
+
const target = path4.resolve(skillDir, relativePath);
|
|
6295
|
+
if (target !== root && !target.startsWith(root + path4.sep)) {
|
|
5995
6296
|
throw RequestError.invalidParams(
|
|
5996
6297
|
void 0,
|
|
5997
6298
|
`Invalid skill file path: ${relativePath}`
|
|
@@ -6001,9 +6302,9 @@ function resolveSkillInstallPath(skillDir, relativePath) {
|
|
|
6001
6302
|
}
|
|
6002
6303
|
__name(resolveSkillInstallPath, "resolveSkillInstallPath");
|
|
6003
6304
|
function resolveManagedSkillDir(skillsBaseDir, slug) {
|
|
6004
|
-
const root =
|
|
6005
|
-
const skillDir =
|
|
6006
|
-
if (!skillDir.startsWith(root +
|
|
6305
|
+
const root = path4.resolve(skillsBaseDir);
|
|
6306
|
+
const skillDir = path4.resolve(skillsBaseDir, slug);
|
|
6307
|
+
if (!skillDir.startsWith(root + path4.sep)) {
|
|
6007
6308
|
throw RequestError.invalidParams(void 0, "Invalid skill.slug");
|
|
6008
6309
|
}
|
|
6009
6310
|
return skillDir;
|
|
@@ -6559,7 +6860,7 @@ function readMcpServers(source, scope) {
|
|
|
6559
6860
|
const server = toMcpServerConfig(value);
|
|
6560
6861
|
return server ? { name, scope, server: redactMcpServerSecrets(server) } : void 0;
|
|
6561
6862
|
} catch (error) {
|
|
6562
|
-
|
|
6863
|
+
debugLogger7.warn(
|
|
6563
6864
|
`Skipping malformed MCP server config [${scope}:${name}]:`,
|
|
6564
6865
|
error
|
|
6565
6866
|
);
|
|
@@ -6655,7 +6956,7 @@ function readHooks(source, scope, extensionName) {
|
|
|
6655
6956
|
extensionName
|
|
6656
6957
|
});
|
|
6657
6958
|
} catch (error) {
|
|
6658
|
-
|
|
6959
|
+
debugLogger7.warn(
|
|
6659
6960
|
`Skipping malformed hook entry [${scope}:${event}:${index}]:`,
|
|
6660
6961
|
error
|
|
6661
6962
|
);
|
|
@@ -6680,14 +6981,14 @@ function readScopeSettings(settings, scope) {
|
|
|
6680
6981
|
__name(readScopeSettings, "readScopeSettings");
|
|
6681
6982
|
async function resolvePreferredMemoryFile(dir, fallbackFilename) {
|
|
6682
6983
|
for (const filename of getAllGeminiMdFilenames()) {
|
|
6683
|
-
const filePath =
|
|
6984
|
+
const filePath = path4.join(dir, filename);
|
|
6684
6985
|
try {
|
|
6685
|
-
await
|
|
6986
|
+
await fs2.access(filePath);
|
|
6686
6987
|
return filePath;
|
|
6687
6988
|
} catch {
|
|
6688
6989
|
}
|
|
6689
6990
|
}
|
|
6690
|
-
return
|
|
6991
|
+
return path4.join(dir, fallbackFilename);
|
|
6691
6992
|
}
|
|
6692
6993
|
__name(resolvePreferredMemoryFile, "resolvePreferredMemoryFile");
|
|
6693
6994
|
async function resolveQwenMemoryPaths(params) {
|
|
@@ -6708,7 +7009,7 @@ async function resolveQwenMemoryPaths(params) {
|
|
|
6708
7009
|
};
|
|
6709
7010
|
}
|
|
6710
7011
|
__name(resolveQwenMemoryPaths, "resolveQwenMemoryPaths");
|
|
6711
|
-
async function deliverClientMcpMessage(connection, serverName, message) {
|
|
7012
|
+
async function deliverClientMcpMessage(connection, serverName, message, sessionId) {
|
|
6712
7013
|
if (!connection) {
|
|
6713
7014
|
throw new Error(
|
|
6714
7015
|
`client MCP server '${serverName}' has no ACP connection yet`
|
|
@@ -6716,7 +7017,11 @@ async function deliverClientMcpMessage(connection, serverName, message) {
|
|
|
6716
7017
|
}
|
|
6717
7018
|
const response = await connection.extMethod(
|
|
6718
7019
|
SERVE_CONTROL_EXT_METHODS.clientMcpMessage,
|
|
6719
|
-
{
|
|
7020
|
+
{
|
|
7021
|
+
server: serverName,
|
|
7022
|
+
payload: message,
|
|
7023
|
+
...sessionId ? { sessionId } : {}
|
|
7024
|
+
}
|
|
6720
7025
|
);
|
|
6721
7026
|
const payload = response["payload"];
|
|
6722
7027
|
if (payload === void 0 || payload === null) {
|
|
@@ -6769,7 +7074,7 @@ async function runAcpAgent(config, settings, argv) {
|
|
|
6769
7074
|
try {
|
|
6770
7075
|
await agentInstance.shutdownMcpPool(8e3);
|
|
6771
7076
|
} catch (err) {
|
|
6772
|
-
|
|
7077
|
+
debugLogger7.error(`[ACP] MCP pool drain (${label}) error:`, err);
|
|
6773
7078
|
}
|
|
6774
7079
|
}, "drainPoolBeforeExit");
|
|
6775
7080
|
let shuttingDown = false;
|
|
@@ -6796,7 +7101,7 @@ async function runAcpAgent(config, settings, argv) {
|
|
|
6796
7101
|
try {
|
|
6797
7102
|
await hookSystem.fireSessionEndEvent(reason);
|
|
6798
7103
|
} catch (err) {
|
|
6799
|
-
|
|
7104
|
+
debugLogger7.warn(
|
|
6800
7105
|
`SessionEnd hook failed: ${err instanceof Error ? err.message : String(err)}`
|
|
6801
7106
|
);
|
|
6802
7107
|
}
|
|
@@ -6805,7 +7110,7 @@ async function runAcpAgent(config, settings, argv) {
|
|
|
6805
7110
|
const shutdownHandler = /* @__PURE__ */ __name(async () => {
|
|
6806
7111
|
if (shuttingDown) return;
|
|
6807
7112
|
shuttingDown = true;
|
|
6808
|
-
|
|
7113
|
+
debugLogger7.debug("[ACP] Shutdown signal received, closing streams");
|
|
6809
7114
|
try {
|
|
6810
7115
|
await fireSessionEndOnce("other" /* Other */);
|
|
6811
7116
|
agentInstance?.disposeSessions();
|
|
@@ -6819,12 +7124,12 @@ async function runAcpAgent(config, settings, argv) {
|
|
|
6819
7124
|
}
|
|
6820
7125
|
await drainPoolBeforeExit("signal");
|
|
6821
7126
|
} catch (err) {
|
|
6822
|
-
|
|
7127
|
+
debugLogger7.error("[ACP] Shutdown error:", err);
|
|
6823
7128
|
} finally {
|
|
6824
7129
|
eventLoopMonitor.dispose();
|
|
6825
7130
|
}
|
|
6826
7131
|
runExitCleanup().catch((err) => {
|
|
6827
|
-
|
|
7132
|
+
debugLogger7.error("[ACP] Cleanup error:", err);
|
|
6828
7133
|
}).finally(() => {
|
|
6829
7134
|
process.exit(0);
|
|
6830
7135
|
});
|
|
@@ -6988,6 +7293,20 @@ var QwenAgent = class {
|
|
|
6988
7293
|
}
|
|
6989
7294
|
sessions = /* @__PURE__ */ new Map();
|
|
6990
7295
|
clientCapabilities;
|
|
7296
|
+
// CPU-usage delta baseline for the daemon's `workspaceResource` extMethod
|
|
7297
|
+
// (Daemon Status child-resource chart). The daemon polls this at a fixed
|
|
7298
|
+
// cadence, so successive calls form a clean delta window independent of tool
|
|
7299
|
+
// activity. Init is guarded — `process.cpuUsage()` can throw in restricted
|
|
7300
|
+
// containers.
|
|
7301
|
+
childCpuCoreCount = os3.availableParallelism?.() ?? os3.cpus().length ?? 1;
|
|
7302
|
+
prevChildCpu = (() => {
|
|
7303
|
+
try {
|
|
7304
|
+
return process.cpuUsage();
|
|
7305
|
+
} catch {
|
|
7306
|
+
return null;
|
|
7307
|
+
}
|
|
7308
|
+
})();
|
|
7309
|
+
prevChildCpuAt = Date.now();
|
|
6991
7310
|
/**
|
|
6992
7311
|
* Workspace-shared MCP transport pool. Eagerly constructed; lazy
|
|
6993
7312
|
* w.r.t. actual MCP work — spawns nothing until `pool.acquire`.
|
|
@@ -7015,12 +7334,12 @@ var QwenAgent = class {
|
|
|
7015
7334
|
try {
|
|
7016
7335
|
const result = await this.mcpPool.drainAll({ force: true, timeoutMs });
|
|
7017
7336
|
if (result.forced > 0 || result.errors.length > 0) {
|
|
7018
|
-
|
|
7337
|
+
debugLogger7.warn(
|
|
7019
7338
|
`MCP pool drain: ${result.drained} clean, ${result.forced} timed out, ${result.errors.length} errors`
|
|
7020
7339
|
);
|
|
7021
7340
|
}
|
|
7022
7341
|
} catch (err) {
|
|
7023
|
-
|
|
7342
|
+
debugLogger7.error(
|
|
7024
7343
|
`MCP pool drainAll failed: ${err instanceof Error ? err.message : String(err)}`
|
|
7025
7344
|
);
|
|
7026
7345
|
}
|
|
@@ -7037,7 +7356,7 @@ var QwenAgent = class {
|
|
|
7037
7356
|
await session.getConfig().getChatRecordingService()?.flush();
|
|
7038
7357
|
return void 0;
|
|
7039
7358
|
} catch (err) {
|
|
7040
|
-
|
|
7359
|
+
debugLogger7.debug(
|
|
7041
7360
|
`Session ${sessionId} chat recording flush during close failed: ${err instanceof Error ? err.message : String(err)}`
|
|
7042
7361
|
);
|
|
7043
7362
|
return err;
|
|
@@ -7052,7 +7371,7 @@ var QwenAgent = class {
|
|
|
7052
7371
|
try {
|
|
7053
7372
|
await session.cancelPendingPrompt();
|
|
7054
7373
|
} catch (err) {
|
|
7055
|
-
|
|
7374
|
+
debugLogger7.debug(
|
|
7056
7375
|
`Session ${sessionId} cancel during close failed: ${err instanceof Error ? err.message : String(err)}`
|
|
7057
7376
|
);
|
|
7058
7377
|
}
|
|
@@ -7063,7 +7382,7 @@ var QwenAgent = class {
|
|
|
7063
7382
|
try {
|
|
7064
7383
|
await session.getConfig().getToolRegistry()?.stop();
|
|
7065
7384
|
} catch (err) {
|
|
7066
|
-
|
|
7385
|
+
debugLogger7.debug(
|
|
7067
7386
|
`Session ${sessionId} tool registry stop during close failed: ${err instanceof Error ? err.message : String(err)}`
|
|
7068
7387
|
);
|
|
7069
7388
|
}
|
|
@@ -7072,6 +7391,37 @@ var QwenAgent = class {
|
|
|
7072
7391
|
uiTelemetryService.removeSession(sessionId);
|
|
7073
7392
|
this.sessions.delete(sessionId);
|
|
7074
7393
|
}
|
|
7394
|
+
discardStoredSessionIfCurrent(sessionId, session) {
|
|
7395
|
+
if (this.sessions.get(sessionId) !== session) {
|
|
7396
|
+
return;
|
|
7397
|
+
}
|
|
7398
|
+
const logCleanupFailure = /* @__PURE__ */ __name((action, err) => {
|
|
7399
|
+
debugLogger7.debug(
|
|
7400
|
+
`Session ${sessionId} ${action} during failed restore cleanup failed: ${err instanceof Error ? err.message : String(err)}`
|
|
7401
|
+
);
|
|
7402
|
+
}, "logCleanupFailure");
|
|
7403
|
+
try {
|
|
7404
|
+
session.dispose();
|
|
7405
|
+
} catch (err) {
|
|
7406
|
+
logCleanupFailure("dispose", err);
|
|
7407
|
+
}
|
|
7408
|
+
try {
|
|
7409
|
+
unregisterGoalHook(session.getConfig(), sessionId);
|
|
7410
|
+
} catch (err) {
|
|
7411
|
+
logCleanupFailure("goal hook unregister", err);
|
|
7412
|
+
}
|
|
7413
|
+
try {
|
|
7414
|
+
this.mcpPool?.releaseSession(sessionId);
|
|
7415
|
+
} catch (err) {
|
|
7416
|
+
logCleanupFailure("MCP pool release", err);
|
|
7417
|
+
}
|
|
7418
|
+
try {
|
|
7419
|
+
uiTelemetryService.removeSession(sessionId);
|
|
7420
|
+
} catch (err) {
|
|
7421
|
+
logCleanupFailure("telemetry removal", err);
|
|
7422
|
+
}
|
|
7423
|
+
this.sessions.delete(sessionId);
|
|
7424
|
+
}
|
|
7075
7425
|
disposeSessions() {
|
|
7076
7426
|
for (const session of this.sessions.values()) {
|
|
7077
7427
|
session.dispose();
|
|
@@ -7097,7 +7447,7 @@ var QwenAgent = class {
|
|
|
7097
7447
|
scope: "workspace",
|
|
7098
7448
|
...event
|
|
7099
7449
|
}).catch((err) => {
|
|
7100
|
-
|
|
7450
|
+
debugLogger7.debug(
|
|
7101
7451
|
`MCP workspace budget event delivery to session ${sid} failed (kind=${event.kind}): ${err instanceof Error ? err.message : String(err)}`
|
|
7102
7452
|
);
|
|
7103
7453
|
});
|
|
@@ -7106,7 +7456,7 @@ var QwenAgent = class {
|
|
|
7106
7456
|
async initialize(args) {
|
|
7107
7457
|
this.clientCapabilities = args.clientCapabilities;
|
|
7108
7458
|
const authMethods = buildAuthMethods();
|
|
7109
|
-
const version = "0.19.
|
|
7459
|
+
const version = "0.19.7-nightly.20260708.394c1a289";
|
|
7110
7460
|
return {
|
|
7111
7461
|
protocolVersion: PROTOCOL_VERSION,
|
|
7112
7462
|
agentInfo: {
|
|
@@ -7129,6 +7479,9 @@ var QwenAgent = class {
|
|
|
7129
7479
|
mcpCapabilities: {
|
|
7130
7480
|
sse: true,
|
|
7131
7481
|
http: true
|
|
7482
|
+
},
|
|
7483
|
+
_meta: {
|
|
7484
|
+
imageCapability: IMAGE_CAPABILITY
|
|
7132
7485
|
}
|
|
7133
7486
|
}
|
|
7134
7487
|
};
|
|
@@ -7163,10 +7516,12 @@ var QwenAgent = class {
|
|
|
7163
7516
|
cwd,
|
|
7164
7517
|
mcpServers
|
|
7165
7518
|
}) {
|
|
7166
|
-
const
|
|
7519
|
+
const settings = loadSettingsCached(cwd);
|
|
7520
|
+
this.settings = settings;
|
|
7521
|
+
const config = await this.newSessionConfig(cwd, mcpServers, settings);
|
|
7167
7522
|
await this.ensureAuthenticated(config);
|
|
7168
7523
|
this.setupFileSystem(config);
|
|
7169
|
-
const session = await this.createAndStoreSession(config);
|
|
7524
|
+
const session = await this.createAndStoreSession(config, settings);
|
|
7170
7525
|
const availableModels = this.buildAvailableModels(config);
|
|
7171
7526
|
const modesData = this.buildModesData(config);
|
|
7172
7527
|
const configOptions = this.buildConfigOptions(config);
|
|
@@ -7178,8 +7533,9 @@ var QwenAgent = class {
|
|
|
7178
7533
|
};
|
|
7179
7534
|
}
|
|
7180
7535
|
async loadSession(params) {
|
|
7536
|
+
const settings = loadSettingsCached(params.cwd);
|
|
7181
7537
|
const exists = await runWithAcpRuntimeOutputDir(
|
|
7182
|
-
|
|
7538
|
+
settings,
|
|
7183
7539
|
params.cwd,
|
|
7184
7540
|
async () => {
|
|
7185
7541
|
const sessionService = new SessionService(params.cwd);
|
|
@@ -7189,6 +7545,7 @@ var QwenAgent = class {
|
|
|
7189
7545
|
if (!exists) {
|
|
7190
7546
|
throw RequestError.resourceNotFound(`session:${params.sessionId}`);
|
|
7191
7547
|
}
|
|
7548
|
+
this.settings = settings;
|
|
7192
7549
|
const config = await this.newSessionConfig(
|
|
7193
7550
|
params.cwd,
|
|
7194
7551
|
// `LoadSessionRequest.mcpServers` is required in today's ACP
|
|
@@ -7196,26 +7553,79 @@ var QwenAgent = class {
|
|
|
7196
7553
|
// future loosening — `newSessionConfig` iterates the list, so
|
|
7197
7554
|
// a `null`/`undefined` would otherwise throw `TypeError`.
|
|
7198
7555
|
params.mcpServers ?? [],
|
|
7556
|
+
settings,
|
|
7199
7557
|
params.sessionId,
|
|
7200
7558
|
true
|
|
7201
7559
|
);
|
|
7202
7560
|
await this.ensureAuthenticated(config);
|
|
7203
7561
|
this.setupFileSystem(config);
|
|
7204
7562
|
const sessionData = config.getResumedSessionData();
|
|
7205
|
-
const
|
|
7563
|
+
const bulkReplay = isBulkLoadReplayRequest(params);
|
|
7564
|
+
const session = await this.createAndStoreSession(
|
|
7565
|
+
config,
|
|
7566
|
+
settings,
|
|
7567
|
+
sessionData,
|
|
7568
|
+
bulkReplay ? { replayHistory: false, startPostReplayServices: false } : {}
|
|
7569
|
+
);
|
|
7570
|
+
let replayEnvelope;
|
|
7571
|
+
if (bulkReplay) {
|
|
7572
|
+
try {
|
|
7573
|
+
const records = sessionData?.conversation.messages;
|
|
7574
|
+
let replayUpdates = [];
|
|
7575
|
+
if (records) {
|
|
7576
|
+
session.primeTurnFromHistory(records);
|
|
7577
|
+
const replayUsage = createReplayCumulativeUsage();
|
|
7578
|
+
const replay = await collectHistoryReplayUpdates({
|
|
7579
|
+
sessionId: params.sessionId,
|
|
7580
|
+
config,
|
|
7581
|
+
records,
|
|
7582
|
+
cumulativeUsage: replayUsage
|
|
7583
|
+
});
|
|
7584
|
+
replayUpdates = liftSessionUpdateTimestamps(replay.updates);
|
|
7585
|
+
copyCumulativeUsage(session.cumulativeUsage, replayUsage);
|
|
7586
|
+
if (replay.replayError !== void 0) {
|
|
7587
|
+
replayEnvelope = {
|
|
7588
|
+
v: LOAD_REPLAY_VERSION,
|
|
7589
|
+
updates: replayUpdates,
|
|
7590
|
+
partial: true,
|
|
7591
|
+
replayError: replay.replayError
|
|
7592
|
+
};
|
|
7593
|
+
}
|
|
7594
|
+
}
|
|
7595
|
+
replayEnvelope ??= {
|
|
7596
|
+
v: LOAD_REPLAY_VERSION,
|
|
7597
|
+
updates: replayUpdates
|
|
7598
|
+
};
|
|
7599
|
+
session.installRewriter();
|
|
7600
|
+
session.startCronScheduler();
|
|
7601
|
+
} catch (err) {
|
|
7602
|
+
this.discardStoredSessionIfCurrent(params.sessionId, session);
|
|
7603
|
+
throw err;
|
|
7604
|
+
}
|
|
7605
|
+
}
|
|
7206
7606
|
await this.#restoreWorktreeOnResume(config, session);
|
|
7207
7607
|
const modesData = this.buildModesData(config);
|
|
7208
7608
|
const availableModels = this.buildAvailableModels(config);
|
|
7209
7609
|
const configOptions = this.buildConfigOptions(config);
|
|
7210
|
-
|
|
7610
|
+
const response = {
|
|
7211
7611
|
modes: modesData,
|
|
7212
7612
|
models: availableModels,
|
|
7213
7613
|
configOptions
|
|
7214
7614
|
};
|
|
7615
|
+
if (!replayEnvelope) {
|
|
7616
|
+
return response;
|
|
7617
|
+
}
|
|
7618
|
+
return {
|
|
7619
|
+
...response,
|
|
7620
|
+
_meta: {
|
|
7621
|
+
[LOAD_REPLAY_META_KEY]: replayEnvelope
|
|
7622
|
+
}
|
|
7623
|
+
};
|
|
7215
7624
|
}
|
|
7216
7625
|
async unstable_resumeSession(params) {
|
|
7626
|
+
const settings = loadSettingsCached(params.cwd);
|
|
7217
7627
|
const exists = await runWithAcpRuntimeOutputDir(
|
|
7218
|
-
|
|
7628
|
+
settings,
|
|
7219
7629
|
params.cwd,
|
|
7220
7630
|
async () => {
|
|
7221
7631
|
const sessionService = new SessionService(params.cwd);
|
|
@@ -7225,9 +7635,11 @@ var QwenAgent = class {
|
|
|
7225
7635
|
if (!exists) {
|
|
7226
7636
|
throw RequestError.resourceNotFound(`session:${params.sessionId}`);
|
|
7227
7637
|
}
|
|
7638
|
+
this.settings = settings;
|
|
7228
7639
|
const config = await this.newSessionConfig(
|
|
7229
7640
|
params.cwd,
|
|
7230
7641
|
params.mcpServers ?? [],
|
|
7642
|
+
settings,
|
|
7231
7643
|
params.sessionId,
|
|
7232
7644
|
true
|
|
7233
7645
|
);
|
|
@@ -7235,6 +7647,7 @@ var QwenAgent = class {
|
|
|
7235
7647
|
this.setupFileSystem(config);
|
|
7236
7648
|
const session = await this.createAndStoreSession(
|
|
7237
7649
|
config,
|
|
7650
|
+
settings,
|
|
7238
7651
|
config.getResumedSessionData(),
|
|
7239
7652
|
{ replayHistory: false }
|
|
7240
7653
|
);
|
|
@@ -7262,7 +7675,7 @@ var QwenAgent = class {
|
|
|
7262
7675
|
session.pendingWorktreeNotice = restored.contextMessage;
|
|
7263
7676
|
}
|
|
7264
7677
|
} catch (error) {
|
|
7265
|
-
|
|
7678
|
+
debugLogger7.warn(`ACP worktree restore failed: ${error}`);
|
|
7266
7679
|
}
|
|
7267
7680
|
}
|
|
7268
7681
|
async unstable_listSessions(params) {
|
|
@@ -7383,7 +7796,7 @@ var QwenAgent = class {
|
|
|
7383
7796
|
await extensionManager.refreshCache();
|
|
7384
7797
|
extensions = extensionManager.getLoadedExtensions();
|
|
7385
7798
|
} catch (error) {
|
|
7386
|
-
|
|
7799
|
+
debugLogger7.warn(
|
|
7387
7800
|
"Extension loading failed, continuing without extensions:",
|
|
7388
7801
|
error
|
|
7389
7802
|
);
|
|
@@ -7509,7 +7922,7 @@ var QwenAgent = class {
|
|
|
7509
7922
|
pm.addPersistentRule(rule, ruleType);
|
|
7510
7923
|
}
|
|
7511
7924
|
} catch (error) {
|
|
7512
|
-
|
|
7925
|
+
debugLogger7.warn(
|
|
7513
7926
|
`Failed to sync permission rules to a live session: ${error instanceof Error ? error.message : String(error)}`
|
|
7514
7927
|
);
|
|
7515
7928
|
}
|
|
@@ -8089,9 +8502,10 @@ var QwenAgent = class {
|
|
|
8089
8502
|
return { kind, locality: "acp", ...spec };
|
|
8090
8503
|
}
|
|
8091
8504
|
/**
|
|
8092
|
-
* Pure auth preflight check.
|
|
8093
|
-
* configured auth method
|
|
8094
|
-
*
|
|
8505
|
+
* Pure auth preflight check. First looks up the well-known env var keys
|
|
8506
|
+
* for the configured auth method, then falls back to the API key already
|
|
8507
|
+
* resolved into the generation config (which folds settings.security.auth.apiKey,
|
|
8508
|
+
* provider envKey from settings.env, and CLI flags into a single value).
|
|
8095
8509
|
*
|
|
8096
8510
|
* Deliberately does NOT call `validateAuthMethod` from `cli/config/auth.ts`:
|
|
8097
8511
|
* that helper has side effects (reloads `.env` from disk via
|
|
@@ -8116,14 +8530,22 @@ var QwenAgent = class {
|
|
|
8116
8530
|
const presentVar = apiKeyVars.find(
|
|
8117
8531
|
(name) => Boolean(process.env[name])
|
|
8118
8532
|
);
|
|
8119
|
-
|
|
8533
|
+
let hasToken = Boolean(presentVar);
|
|
8534
|
+
if (!hasToken && !AUTH_PREFLIGHT_WAIVED_AUTH_TYPES.has(String(authType))) {
|
|
8535
|
+
const resolvedApiKey = config.getModelsConfig().getGenerationConfig()?.apiKey;
|
|
8536
|
+
if (resolvedApiKey) {
|
|
8537
|
+
hasToken = true;
|
|
8538
|
+
}
|
|
8539
|
+
}
|
|
8120
8540
|
if (apiKeyVars.length === 0) {
|
|
8121
8541
|
return this.acpCell("auth", {
|
|
8122
|
-
status: "unknown",
|
|
8123
|
-
|
|
8542
|
+
status: hasToken ? "ok" : "unknown",
|
|
8543
|
+
...hasToken ? {} : {
|
|
8544
|
+
hint: "Auth credentials for this provider are not env-keyed; full validation runs at session start."
|
|
8545
|
+
},
|
|
8124
8546
|
detail: {
|
|
8125
8547
|
source: String(authType),
|
|
8126
|
-
hasToken: "unknown",
|
|
8548
|
+
hasToken: hasToken || "unknown",
|
|
8127
8549
|
envVarCandidates: []
|
|
8128
8550
|
}
|
|
8129
8551
|
});
|
|
@@ -8774,9 +9196,9 @@ var QwenAgent = class {
|
|
|
8774
9196
|
);
|
|
8775
9197
|
}
|
|
8776
9198
|
const download = await downloadSkill(request.sourceUrl);
|
|
8777
|
-
const skillsBaseDir =
|
|
9199
|
+
const skillsBaseDir = path4.join(Storage.getGlobalQwenDir(), "skills");
|
|
8778
9200
|
const skillDir = resolveManagedSkillDir(skillsBaseDir, request.slug);
|
|
8779
|
-
const skillFile =
|
|
9201
|
+
const skillFile = path4.join(skillDir, "SKILL.md");
|
|
8780
9202
|
const parsed = skillManager.parseSkillContent(
|
|
8781
9203
|
download.skillContent,
|
|
8782
9204
|
skillFile,
|
|
@@ -8790,19 +9212,19 @@ var QwenAgent = class {
|
|
|
8790
9212
|
}
|
|
8791
9213
|
const stagingDir = `${skillDir}.installing-${process.pid}-${Date.now()}`;
|
|
8792
9214
|
try {
|
|
8793
|
-
await
|
|
9215
|
+
await fs2.rm(stagingDir, { recursive: true, force: true });
|
|
8794
9216
|
for (const file of download.files) {
|
|
8795
9217
|
const targetPath = resolveSkillInstallPath(
|
|
8796
9218
|
stagingDir,
|
|
8797
9219
|
file.relativePath
|
|
8798
9220
|
);
|
|
8799
|
-
await
|
|
8800
|
-
await
|
|
9221
|
+
await fs2.mkdir(path4.dirname(targetPath), { recursive: true });
|
|
9222
|
+
await fs2.writeFile(targetPath, file.content);
|
|
8801
9223
|
}
|
|
8802
|
-
await
|
|
8803
|
-
await
|
|
9224
|
+
await fs2.rm(skillDir, { recursive: true, force: true });
|
|
9225
|
+
await fs2.rename(stagingDir, skillDir);
|
|
8804
9226
|
} catch (error) {
|
|
8805
|
-
await
|
|
9227
|
+
await fs2.rm(stagingDir, { recursive: true, force: true }).catch(() => {
|
|
8806
9228
|
});
|
|
8807
9229
|
throw error;
|
|
8808
9230
|
}
|
|
@@ -8835,17 +9257,17 @@ var QwenAgent = class {
|
|
|
8835
9257
|
`Skill name "${parsed.name}" does not match requested slug "${request.slug}"`
|
|
8836
9258
|
);
|
|
8837
9259
|
}
|
|
8838
|
-
const resolvedSkillDir =
|
|
8839
|
-
const resolvedSkillFile =
|
|
8840
|
-
const globalDir =
|
|
8841
|
-
const isDedicatedSkillDir = resolvedSkillFile ===
|
|
8842
|
-
if (!isDedicatedSkillDir || resolvedSkillDir ===
|
|
9260
|
+
const resolvedSkillDir = path4.resolve(skillDir);
|
|
9261
|
+
const resolvedSkillFile = path4.resolve(skillFile);
|
|
9262
|
+
const globalDir = path4.resolve(Storage.getGlobalQwenDir());
|
|
9263
|
+
const isDedicatedSkillDir = resolvedSkillFile === path4.join(resolvedSkillDir, "SKILL.md");
|
|
9264
|
+
if (!isDedicatedSkillDir || resolvedSkillDir === path4.parse(resolvedSkillDir).root || resolvedSkillDir === globalDir) {
|
|
8843
9265
|
throw RequestError.invalidParams(
|
|
8844
9266
|
void 0,
|
|
8845
9267
|
`Refusing to delete unexpected skill directory: ${skillDir}`
|
|
8846
9268
|
);
|
|
8847
9269
|
}
|
|
8848
|
-
await
|
|
9270
|
+
await fs2.rm(skillDir, { recursive: true, force: true });
|
|
8849
9271
|
await skillManager.refreshCache();
|
|
8850
9272
|
return {
|
|
8851
9273
|
slug: request.slug,
|
|
@@ -8855,11 +9277,11 @@ var QwenAgent = class {
|
|
|
8855
9277
|
async readManagedSkillFile(slug, scope, skillManager, cwd) {
|
|
8856
9278
|
if (scope === "global") {
|
|
8857
9279
|
const qwenSkillDir = resolveManagedSkillDir(
|
|
8858
|
-
|
|
9280
|
+
path4.join(Storage.getGlobalQwenDir(), "skills"),
|
|
8859
9281
|
slug
|
|
8860
9282
|
);
|
|
8861
|
-
const qwenSkillFile =
|
|
8862
|
-
const qwenContent = await
|
|
9283
|
+
const qwenSkillFile = path4.join(qwenSkillDir, "SKILL.md");
|
|
9284
|
+
const qwenContent = await fs2.readFile(qwenSkillFile, "utf8").catch(() => void 0);
|
|
8863
9285
|
if (qwenContent !== void 0) {
|
|
8864
9286
|
return {
|
|
8865
9287
|
skillDir: qwenSkillDir,
|
|
@@ -8887,34 +9309,34 @@ var QwenAgent = class {
|
|
|
8887
9309
|
`${scope === "project" ? "Project" : "Global"} skill not found: ${slug}`
|
|
8888
9310
|
);
|
|
8889
9311
|
}
|
|
8890
|
-
const content = await
|
|
9312
|
+
const content = await fs2.readFile(skillFile, "utf8").catch(() => {
|
|
8891
9313
|
throw RequestError.invalidParams(
|
|
8892
9314
|
void 0,
|
|
8893
9315
|
`${scope === "project" ? "Project" : "Global"} skill not found: ${slug}`
|
|
8894
9316
|
);
|
|
8895
9317
|
});
|
|
8896
9318
|
return {
|
|
8897
|
-
skillDir:
|
|
9319
|
+
skillDir: path4.dirname(skillFile),
|
|
8898
9320
|
skillFile,
|
|
8899
9321
|
content
|
|
8900
9322
|
};
|
|
8901
9323
|
}
|
|
8902
9324
|
async findProjectSkillFileFromCwd(slug, cwd, skillManager) {
|
|
8903
|
-
const projectRoot =
|
|
9325
|
+
const projectRoot = path4.resolve(cwd);
|
|
8904
9326
|
for (const configDir of PROJECT_SKILL_DIRS) {
|
|
8905
|
-
const baseDir =
|
|
9327
|
+
const baseDir = path4.join(projectRoot, configDir, SKILLS_DIR);
|
|
8906
9328
|
const skills = await skillManager.loadSkillsFromDir(baseDir, "project");
|
|
8907
9329
|
const skill = skills.find((candidate) => candidate.name === slug);
|
|
8908
9330
|
const skillFile = skill?.filePath;
|
|
8909
9331
|
if (!skillFile) continue;
|
|
8910
|
-
const content = await
|
|
9332
|
+
const content = await fs2.readFile(skillFile, "utf8").catch(() => {
|
|
8911
9333
|
throw RequestError.invalidParams(
|
|
8912
9334
|
void 0,
|
|
8913
9335
|
`Project skill not found: ${slug}`
|
|
8914
9336
|
);
|
|
8915
9337
|
});
|
|
8916
9338
|
return {
|
|
8917
|
-
skillDir:
|
|
9339
|
+
skillDir: path4.dirname(skillFile),
|
|
8918
9340
|
skillFile,
|
|
8919
9341
|
content
|
|
8920
9342
|
};
|
|
@@ -8945,13 +9367,13 @@ var QwenAgent = class {
|
|
|
8945
9367
|
}
|
|
8946
9368
|
const nextContent = setSkillFrontmatterEnabled(content, request.enabled);
|
|
8947
9369
|
skillManager.parseSkillContent(nextContent, skillFile, level);
|
|
8948
|
-
if (
|
|
9370
|
+
if (path4.basename(skillFile) !== "SKILL.md") {
|
|
8949
9371
|
throw RequestError.invalidParams(
|
|
8950
9372
|
void 0,
|
|
8951
9373
|
`Refusing to write to unexpected skill file: ${skillFile}`
|
|
8952
9374
|
);
|
|
8953
9375
|
}
|
|
8954
|
-
await
|
|
9376
|
+
await fs2.writeFile(skillFile, nextContent, "utf8");
|
|
8955
9377
|
await skillManager.refreshCache();
|
|
8956
9378
|
return {
|
|
8957
9379
|
slug: request.slug,
|
|
@@ -9106,6 +9528,33 @@ var QwenAgent = class {
|
|
|
9106
9528
|
return await this.buildAcpPreflightCells(
|
|
9107
9529
|
this.config
|
|
9108
9530
|
);
|
|
9531
|
+
case SERVE_STATUS_EXT_METHODS.workspaceResource: {
|
|
9532
|
+
const now = Date.now();
|
|
9533
|
+
let cpu = null;
|
|
9534
|
+
try {
|
|
9535
|
+
cpu = process.cpuUsage();
|
|
9536
|
+
} catch {
|
|
9537
|
+
}
|
|
9538
|
+
const cpuPercent = computeCpuPercent(
|
|
9539
|
+
this.prevChildCpu,
|
|
9540
|
+
cpu,
|
|
9541
|
+
now - this.prevChildCpuAt,
|
|
9542
|
+
this.childCpuCoreCount
|
|
9543
|
+
);
|
|
9544
|
+
if (cpu) {
|
|
9545
|
+
this.prevChildCpu = cpu;
|
|
9546
|
+
this.prevChildCpuAt = now;
|
|
9547
|
+
}
|
|
9548
|
+
let rssBytes = 0;
|
|
9549
|
+
try {
|
|
9550
|
+
rssBytes = process.memoryUsage().rss;
|
|
9551
|
+
} catch {
|
|
9552
|
+
}
|
|
9553
|
+
return {
|
|
9554
|
+
rssBytes,
|
|
9555
|
+
cpuPercent
|
|
9556
|
+
};
|
|
9557
|
+
}
|
|
9109
9558
|
case SERVE_STATUS_EXT_METHODS.sessionContext: {
|
|
9110
9559
|
const sessionId = params["sessionId"];
|
|
9111
9560
|
if (typeof sessionId !== "string" || sessionId.length === 0) {
|
|
@@ -9761,7 +10210,7 @@ var QwenAgent = class {
|
|
|
9761
10210
|
"Invalid or missing sessionId"
|
|
9762
10211
|
);
|
|
9763
10212
|
}
|
|
9764
|
-
if (typeof targetPath !== "string" || targetPath.length === 0 || !
|
|
10213
|
+
if (typeof targetPath !== "string" || targetPath.length === 0 || !path4.isAbsolute(targetPath) || targetPath.includes("\0")) {
|
|
9765
10214
|
throw RequestError.invalidParams(
|
|
9766
10215
|
void 0,
|
|
9767
10216
|
"Invalid or missing path (must be an absolute path)"
|
|
@@ -9776,7 +10225,7 @@ var QwenAgent = class {
|
|
|
9776
10225
|
}
|
|
9777
10226
|
let stats;
|
|
9778
10227
|
try {
|
|
9779
|
-
stats = await
|
|
10228
|
+
stats = await fs2.stat(targetPath);
|
|
9780
10229
|
} catch {
|
|
9781
10230
|
throw new RequestError(-32002, `Directory not found: ${targetPath}`, {
|
|
9782
10231
|
errorKind: "directory_not_found",
|
|
@@ -9789,7 +10238,7 @@ var QwenAgent = class {
|
|
|
9789
10238
|
path: targetPath
|
|
9790
10239
|
});
|
|
9791
10240
|
}
|
|
9792
|
-
const canonicalPath = await
|
|
10241
|
+
const canonicalPath = await fs2.realpath(targetPath);
|
|
9793
10242
|
const previousCwd = config.getTargetDir();
|
|
9794
10243
|
if (canonicalPath === previousCwd) {
|
|
9795
10244
|
return { previousCwd, newCwd: canonicalPath, warnings: [] };
|
|
@@ -9879,7 +10328,7 @@ var QwenAgent = class {
|
|
|
9879
10328
|
try {
|
|
9880
10329
|
await setLanguageAsync(language);
|
|
9881
10330
|
} catch (err) {
|
|
9882
|
-
|
|
10331
|
+
debugLogger7.warn("setLanguageAsync failed:", err);
|
|
9883
10332
|
throw new RequestError(
|
|
9884
10333
|
-32603,
|
|
9885
10334
|
`Failed to switch UI language: ${err instanceof Error ? err.message : String(err)}`
|
|
@@ -9893,7 +10342,7 @@ var QwenAgent = class {
|
|
|
9893
10342
|
language
|
|
9894
10343
|
);
|
|
9895
10344
|
} catch (err) {
|
|
9896
|
-
|
|
10345
|
+
debugLogger7.warn("Failed to persist UI language setting:", err);
|
|
9897
10346
|
}
|
|
9898
10347
|
let outputLanguage = null;
|
|
9899
10348
|
let refreshed = false;
|
|
@@ -9908,7 +10357,7 @@ var QwenAgent = class {
|
|
|
9908
10357
|
);
|
|
9909
10358
|
fileWriteOk = true;
|
|
9910
10359
|
} catch (err) {
|
|
9911
|
-
|
|
10360
|
+
debugLogger7.warn("Failed to write output-language.md:", err);
|
|
9912
10361
|
}
|
|
9913
10362
|
if (fileWriteOk) {
|
|
9914
10363
|
try {
|
|
@@ -9918,7 +10367,7 @@ var QwenAgent = class {
|
|
|
9918
10367
|
settingValue
|
|
9919
10368
|
);
|
|
9920
10369
|
} catch (err) {
|
|
9921
|
-
|
|
10370
|
+
debugLogger7.warn(
|
|
9922
10371
|
"Failed to persist output language setting:",
|
|
9923
10372
|
err
|
|
9924
10373
|
);
|
|
@@ -9938,7 +10387,7 @@ var QwenAgent = class {
|
|
|
9938
10387
|
writeOutputLanguageAndRegisterPath(settingValue, cfg);
|
|
9939
10388
|
}
|
|
9940
10389
|
} catch (err) {
|
|
9941
|
-
|
|
10390
|
+
debugLogger7.warn(
|
|
9942
10391
|
`Failed to write output-language.md for session ${s.getId()} (path=${sessionPath ?? "global-default"}):`,
|
|
9943
10392
|
err
|
|
9944
10393
|
);
|
|
@@ -9951,7 +10400,7 @@ var QwenAgent = class {
|
|
|
9951
10400
|
(r) => r.status === "rejected"
|
|
9952
10401
|
).length;
|
|
9953
10402
|
if (failedCount > 0) {
|
|
9954
|
-
|
|
10403
|
+
debugLogger7.warn(
|
|
9955
10404
|
`Language refresh failed for ${failedCount}/${results.length} session(s)`
|
|
9956
10405
|
);
|
|
9957
10406
|
}
|
|
@@ -9969,14 +10418,14 @@ var QwenAgent = class {
|
|
|
9969
10418
|
"Invalid or missing sessionId"
|
|
9970
10419
|
);
|
|
9971
10420
|
}
|
|
9972
|
-
|
|
10421
|
+
debugLogger7.debug(`recap ext-method received for session=${sessionId}`);
|
|
9973
10422
|
const session = this.sessionOrThrow(sessionId);
|
|
9974
10423
|
const config = session.getConfig();
|
|
9975
10424
|
const recap = await generateSessionRecap(
|
|
9976
10425
|
config,
|
|
9977
10426
|
new AbortController().signal
|
|
9978
10427
|
);
|
|
9979
|
-
|
|
10428
|
+
debugLogger7.debug(
|
|
9980
10429
|
`recap ext-method completed for session=${sessionId} result=${recap ? `len=${recap.length}` : "null"}`
|
|
9981
10430
|
);
|
|
9982
10431
|
return { sessionId, recap };
|
|
@@ -10000,7 +10449,7 @@ var QwenAgent = class {
|
|
|
10000
10449
|
const config = session.getConfig();
|
|
10001
10450
|
const cacheSafeParams = buildBtwCacheSafeParams(config);
|
|
10002
10451
|
if (!cacheSafeParams) {
|
|
10003
|
-
|
|
10452
|
+
debugLogger7.debug(`btw: no cacheSafeParams for session=${sessionId}`);
|
|
10004
10453
|
return { sessionId, answer: null };
|
|
10005
10454
|
}
|
|
10006
10455
|
const childSignal = AbortSignal.timeout(BTW_CHILD_TIMEOUT_MS);
|
|
@@ -10048,7 +10497,7 @@ var QwenAgent = class {
|
|
|
10048
10497
|
try {
|
|
10049
10498
|
hasHistory = (config.getGeminiClient().getHistoryShallow() ?? []).length > 0;
|
|
10050
10499
|
} catch (error) {
|
|
10051
|
-
|
|
10500
|
+
debugLogger7.debug("Failed to read history before /fork:", error);
|
|
10052
10501
|
}
|
|
10053
10502
|
if (!hasHistory) {
|
|
10054
10503
|
throw RequestError.invalidParams(
|
|
@@ -10090,7 +10539,7 @@ var QwenAgent = class {
|
|
|
10090
10539
|
]
|
|
10091
10540
|
});
|
|
10092
10541
|
} catch (error) {
|
|
10093
|
-
|
|
10542
|
+
debugLogger7.debug("Failed to record fork event in history:", error);
|
|
10094
10543
|
}
|
|
10095
10544
|
return { sessionId, description, launched: true };
|
|
10096
10545
|
}
|
|
@@ -10153,7 +10602,7 @@ ${outputText}
|
|
|
10153
10602
|
'taskKind must be "agent", "shell", or "monitor"'
|
|
10154
10603
|
);
|
|
10155
10604
|
}
|
|
10156
|
-
|
|
10605
|
+
debugLogger7.info(
|
|
10157
10606
|
`sessionTaskCancel requested sessionId=${sessionId} taskId=${taskId} taskKind=${taskKind}`
|
|
10158
10607
|
);
|
|
10159
10608
|
const session = this.sessionOrThrow(sessionId);
|
|
@@ -10163,7 +10612,7 @@ ${outputText}
|
|
|
10163
10612
|
const task = config.getBackgroundTaskRegistry().get(taskId);
|
|
10164
10613
|
if (!task || task.status !== "running" && task.status !== "paused") {
|
|
10165
10614
|
const reason = task ? "not_running" : "not_found";
|
|
10166
|
-
|
|
10615
|
+
debugLogger7.info(
|
|
10167
10616
|
`sessionTaskCancel skipped sessionId=${sessionId} taskId=${taskId} taskKind=${taskKind} reason=${reason} status=${task?.status ?? "missing"}`
|
|
10168
10617
|
);
|
|
10169
10618
|
return { cancelled: false, reason, status: task?.status };
|
|
@@ -10173,7 +10622,7 @@ ${outputText}
|
|
|
10173
10622
|
} else {
|
|
10174
10623
|
config.getBackgroundTaskRegistry().cancel(taskId);
|
|
10175
10624
|
}
|
|
10176
|
-
|
|
10625
|
+
debugLogger7.info(
|
|
10177
10626
|
`sessionTaskCancel completed sessionId=${sessionId} taskId=${taskId} taskKind=${taskKind} status=${task.status}`
|
|
10178
10627
|
);
|
|
10179
10628
|
return { cancelled: true, status: task.status };
|
|
@@ -10182,13 +10631,13 @@ ${outputText}
|
|
|
10182
10631
|
const task = config.getBackgroundShellRegistry().get(taskId);
|
|
10183
10632
|
if (!task || task.status !== "running") {
|
|
10184
10633
|
const reason = task ? "not_running" : "not_found";
|
|
10185
|
-
|
|
10634
|
+
debugLogger7.info(
|
|
10186
10635
|
`sessionTaskCancel skipped sessionId=${sessionId} taskId=${taskId} taskKind=${taskKind} reason=${reason} status=${task?.status ?? "missing"}`
|
|
10187
10636
|
);
|
|
10188
10637
|
return { cancelled: false, reason, status: task?.status };
|
|
10189
10638
|
}
|
|
10190
10639
|
config.getBackgroundShellRegistry().requestCancel(taskId);
|
|
10191
|
-
|
|
10640
|
+
debugLogger7.info(
|
|
10192
10641
|
`sessionTaskCancel completed sessionId=${sessionId} taskId=${taskId} taskKind=${taskKind} status=${task.status}`
|
|
10193
10642
|
);
|
|
10194
10643
|
return { cancelled: true, status: task.status };
|
|
@@ -10197,13 +10646,13 @@ ${outputText}
|
|
|
10197
10646
|
const task = config.getMonitorRegistry().get(taskId);
|
|
10198
10647
|
if (!task || task.status !== "running") {
|
|
10199
10648
|
const reason = task ? "not_running" : "not_found";
|
|
10200
|
-
|
|
10649
|
+
debugLogger7.info(
|
|
10201
10650
|
`sessionTaskCancel skipped sessionId=${sessionId} taskId=${taskId} taskKind=${taskKind} reason=${reason} status=${task?.status ?? "missing"}`
|
|
10202
10651
|
);
|
|
10203
10652
|
return { cancelled: false, reason, status: task?.status };
|
|
10204
10653
|
}
|
|
10205
10654
|
config.getMonitorRegistry().cancel(taskId);
|
|
10206
|
-
|
|
10655
|
+
debugLogger7.info(
|
|
10207
10656
|
`sessionTaskCancel completed sessionId=${sessionId} taskId=${taskId} taskKind=${taskKind} status=${task.status}`
|
|
10208
10657
|
);
|
|
10209
10658
|
return { cancelled: true, status: task.status };
|
|
@@ -10233,7 +10682,7 @@ ${outputText}
|
|
|
10233
10682
|
durationMs: Date.now() - cleared.setAt
|
|
10234
10683
|
});
|
|
10235
10684
|
}
|
|
10236
|
-
|
|
10685
|
+
debugLogger7.info(
|
|
10237
10686
|
`sessionGoalClear sessionId=${sessionId} cleared=${!!cleared} condition=${cleared?.condition ?? "(none)"}`
|
|
10238
10687
|
);
|
|
10239
10688
|
return {
|
|
@@ -10251,7 +10700,7 @@ ${outputText}
|
|
|
10251
10700
|
}
|
|
10252
10701
|
const session = this.sessionOrThrow(sessionId);
|
|
10253
10702
|
const result = await session.continueLastTurn();
|
|
10254
|
-
|
|
10703
|
+
debugLogger7.info(
|
|
10255
10704
|
`sessionContinue sessionId=${sessionId} accepted=${result.accepted} interruption=${result.interruption}`
|
|
10256
10705
|
);
|
|
10257
10706
|
return result;
|
|
@@ -10327,7 +10776,7 @@ ${outputText}
|
|
|
10327
10776
|
originatorClientId
|
|
10328
10777
|
);
|
|
10329
10778
|
} catch (sessionErr) {
|
|
10330
|
-
|
|
10779
|
+
debugLogger7.warn(
|
|
10331
10780
|
`workspaceMcpRuntimeAdd: failed to add runtime MCP server '${name}' to active session ${session.getConfig().getSessionId()}: ${sessionErr instanceof Error ? sessionErr.message : String(sessionErr)}`
|
|
10332
10781
|
);
|
|
10333
10782
|
}
|
|
@@ -10400,7 +10849,7 @@ ${outputText}
|
|
|
10400
10849
|
originatorClientId
|
|
10401
10850
|
);
|
|
10402
10851
|
} catch (sessionErr) {
|
|
10403
|
-
|
|
10852
|
+
debugLogger7.warn(
|
|
10404
10853
|
`workspaceMcpRuntimeRemove: failed to remove runtime MCP server '${name}' from active session ${session.getConfig().getSessionId()}: ${sessionErr instanceof Error ? sessionErr.message : String(sessionErr)}`
|
|
10405
10854
|
);
|
|
10406
10855
|
}
|
|
@@ -10416,7 +10865,7 @@ ${outputText}
|
|
|
10416
10865
|
try {
|
|
10417
10866
|
await extensionManager.refreshTools();
|
|
10418
10867
|
} catch (err) {
|
|
10419
|
-
|
|
10868
|
+
debugLogger7.warn(
|
|
10420
10869
|
`Extension tool refresh failed for session ${sessionId}: ${err instanceof Error ? err.message : String(err)}`
|
|
10421
10870
|
);
|
|
10422
10871
|
}
|
|
@@ -10564,7 +11013,7 @@ ${outputText}
|
|
|
10564
11013
|
filesFailed = fileResult.filesFailed;
|
|
10565
11014
|
} catch (err) {
|
|
10566
11015
|
const reason = err instanceof Error ? err.message : String(err);
|
|
10567
|
-
|
|
11016
|
+
debugLogger7.error(
|
|
10568
11017
|
`[ACP] File-history rewind failed for session=${sessionId} promptId=${promptId}: ${reason}`
|
|
10569
11018
|
);
|
|
10570
11019
|
filesFailed = [`file-history-rewind: ${reason}`];
|
|
@@ -10597,51 +11046,19 @@ ${outputText}
|
|
|
10597
11046
|
if (!sessionData?.conversation) {
|
|
10598
11047
|
return { updates: [] };
|
|
10599
11048
|
}
|
|
10600
|
-
const
|
|
10601
|
-
const replayContext = {
|
|
11049
|
+
const replay = await collectHistoryReplayUpdates({
|
|
10602
11050
|
sessionId,
|
|
10603
11051
|
config: this.config,
|
|
10604
|
-
|
|
10605
|
-
|
|
10606
|
-
}, "sendUpdate"),
|
|
10607
|
-
// Fresh accumulator for this replay: MessageEmitter advances it from
|
|
10608
|
-
// replayed usage metadata (tokens only — no per-turn durations) and
|
|
10609
|
-
// PlanEmitter snapshots it onto each todo update, so resumed sessions
|
|
10610
|
-
// recover per-task token spend (API time stays live-only).
|
|
10611
|
-
cumulativeUsage: {
|
|
10612
|
-
promptTokens: 0,
|
|
10613
|
-
cachedTokens: 0,
|
|
10614
|
-
candidateTokens: 0,
|
|
10615
|
-
apiTimeMs: 0
|
|
10616
|
-
}
|
|
10617
|
-
};
|
|
10618
|
-
let replayError;
|
|
10619
|
-
try {
|
|
10620
|
-
await new HistoryReplayer(replayContext).replay(
|
|
10621
|
-
sessionData.conversation.messages
|
|
10622
|
-
);
|
|
10623
|
-
} catch (error) {
|
|
10624
|
-
replayError = error instanceof Error ? error.message : String(error);
|
|
10625
|
-
debugLogger6.warn(
|
|
10626
|
-
"[loadUpdates] History replay failed for session %s (partial updates: %d):",
|
|
10627
|
-
sessionId,
|
|
10628
|
-
updates.length,
|
|
10629
|
-
error
|
|
10630
|
-
);
|
|
10631
|
-
}
|
|
10632
|
-
const updatesWithTopLevelTimestamps = updates.map((update) => {
|
|
10633
|
-
const record = update;
|
|
10634
|
-
const meta = record["_meta"];
|
|
10635
|
-
const timestamp = meta && typeof meta === "object" && !Array.isArray(meta) ? meta["timestamp"] : void 0;
|
|
10636
|
-
return typeof timestamp === "number" || typeof timestamp === "string" ? { ...record, timestamp } : record;
|
|
11052
|
+
records: sessionData.conversation.messages,
|
|
11053
|
+
cumulativeUsage: createReplayCumulativeUsage()
|
|
10637
11054
|
});
|
|
10638
11055
|
return {
|
|
10639
|
-
updates:
|
|
11056
|
+
updates: liftSessionUpdateTimestamps(replay.updates),
|
|
10640
11057
|
startTime: sessionData.conversation.startTime,
|
|
10641
11058
|
lastUpdated: sessionData.conversation.lastUpdated,
|
|
10642
11059
|
// Signal to the client that replay aborted partway so it doesn't
|
|
10643
11060
|
// render a truncated replay as the full conversation.
|
|
10644
|
-
...replayError !== void 0 ? { partial: true, replayError } : {}
|
|
11061
|
+
...replay.replayError !== void 0 ? { partial: true, replayError: replay.replayError } : {}
|
|
10645
11062
|
};
|
|
10646
11063
|
}
|
|
10647
11064
|
case "restoreSessionHistory": {
|
|
@@ -10982,7 +11399,7 @@ ${outputText}
|
|
|
10982
11399
|
newMerged.providerProtocol ?? {}
|
|
10983
11400
|
);
|
|
10984
11401
|
} catch (err) {
|
|
10985
|
-
|
|
11402
|
+
debugLogger7.warn(
|
|
10986
11403
|
`reload: reloadModelProvidersConfig failed for session ${id}: ${err}`
|
|
10987
11404
|
);
|
|
10988
11405
|
}
|
|
@@ -10992,7 +11409,7 @@ ${outputText}
|
|
|
10992
11409
|
try {
|
|
10993
11410
|
await config.switchModel(authType, newModelName);
|
|
10994
11411
|
} catch (err) {
|
|
10995
|
-
|
|
11412
|
+
debugLogger7.warn(
|
|
10996
11413
|
`reload: switchModel failed for session ${id}: ${err}`
|
|
10997
11414
|
);
|
|
10998
11415
|
}
|
|
@@ -11000,7 +11417,7 @@ ${outputText}
|
|
|
11000
11417
|
try {
|
|
11001
11418
|
await config.refreshAuth(authType);
|
|
11002
11419
|
} catch (err) {
|
|
11003
|
-
|
|
11420
|
+
debugLogger7.warn(
|
|
11004
11421
|
`reload: refreshAuth failed for session ${id}: ${err}`
|
|
11005
11422
|
);
|
|
11006
11423
|
}
|
|
@@ -11015,7 +11432,7 @@ ${outputText}
|
|
|
11015
11432
|
try {
|
|
11016
11433
|
config.setApprovalMode(newMode);
|
|
11017
11434
|
} catch (err) {
|
|
11018
|
-
|
|
11435
|
+
debugLogger7.warn(
|
|
11019
11436
|
`reload: setApprovalMode failed for session ${id}: ${err}`
|
|
11020
11437
|
);
|
|
11021
11438
|
}
|
|
@@ -11024,14 +11441,14 @@ ${outputText}
|
|
|
11024
11441
|
try {
|
|
11025
11442
|
await config.refreshHierarchicalMemory();
|
|
11026
11443
|
} catch (err) {
|
|
11027
|
-
|
|
11444
|
+
debugLogger7.warn(
|
|
11028
11445
|
`reload: refreshHierarchicalMemory failed for session ${id}: ${err}`
|
|
11029
11446
|
);
|
|
11030
11447
|
}
|
|
11031
11448
|
try {
|
|
11032
11449
|
await config.getGeminiClient()?.refreshSystemInstruction();
|
|
11033
11450
|
} catch (err) {
|
|
11034
|
-
|
|
11451
|
+
debugLogger7.warn(
|
|
11035
11452
|
`reload: refreshSystemInstruction failed for session ${id}: ${err}`
|
|
11036
11453
|
);
|
|
11037
11454
|
}
|
|
@@ -11041,7 +11458,7 @@ ${outputText}
|
|
|
11041
11458
|
for (let i = 0; i < results.length; i++) {
|
|
11042
11459
|
if (results[i].status === "rejected") {
|
|
11043
11460
|
const reason = results[i].reason;
|
|
11044
|
-
|
|
11461
|
+
debugLogger7.warn(
|
|
11045
11462
|
`Session ${sessions[i][0]} reload failed: ${reason}`
|
|
11046
11463
|
);
|
|
11047
11464
|
skipped.push(sessions[i][0]);
|
|
@@ -11071,11 +11488,10 @@ ${outputText}
|
|
|
11071
11488
|
* servers in this session share one callback — the `serverName` argument
|
|
11072
11489
|
* routes to the right client-hosted server in the parent.
|
|
11073
11490
|
*/
|
|
11074
|
-
buildClientMcpSender() {
|
|
11075
|
-
return (serverName, message) => deliverClientMcpMessage(this.connection, serverName, message);
|
|
11491
|
+
buildClientMcpSender(sessionId) {
|
|
11492
|
+
return (serverName, message) => deliverClientMcpMessage(this.connection, serverName, message, sessionId);
|
|
11076
11493
|
}
|
|
11077
|
-
async newSessionConfig(cwd, mcpServers, sessionId, resume) {
|
|
11078
|
-
this.settings = loadSettings(cwd);
|
|
11494
|
+
async newSessionConfig(cwd, mcpServers, settings, sessionId, resume) {
|
|
11079
11495
|
const sessionMcpServers = {};
|
|
11080
11496
|
for (const server of mcpServers) {
|
|
11081
11497
|
const stdioServer = toStdioServer(server);
|
|
@@ -11127,14 +11543,14 @@ ${outputText}
|
|
|
11127
11543
|
continue;
|
|
11128
11544
|
}
|
|
11129
11545
|
}
|
|
11130
|
-
const
|
|
11546
|
+
const mergedSettings = settings.merged;
|
|
11131
11547
|
const argvForSession = {
|
|
11132
11548
|
...this.argv,
|
|
11133
11549
|
...resume ? { resume: sessionId } : { sessionId },
|
|
11134
11550
|
continue: false
|
|
11135
11551
|
};
|
|
11136
11552
|
const config = await loadCliConfig(
|
|
11137
|
-
|
|
11553
|
+
mergedSettings,
|
|
11138
11554
|
argvForSession,
|
|
11139
11555
|
cwd,
|
|
11140
11556
|
// ACP sessions do not provide an extension override. Passing [] is a
|
|
@@ -11143,16 +11559,16 @@ ${outputText}
|
|
|
11143
11559
|
void 0,
|
|
11144
11560
|
// Pass separated hooks for proper source attribution
|
|
11145
11561
|
{
|
|
11146
|
-
userHooks:
|
|
11147
|
-
projectHooks:
|
|
11562
|
+
userHooks: settings.getUserHooks(),
|
|
11563
|
+
projectHooks: settings.getProjectHooks()
|
|
11148
11564
|
},
|
|
11149
|
-
// CRITICAL: close over `
|
|
11150
|
-
// over the
|
|
11151
|
-
// setValue` replaces `_merged`, so a closure over the
|
|
11152
|
-
// never see workspace toggles applied during the
|
|
11153
|
-
// sessions otherwise leak persisted disabled skills
|
|
11154
|
-
// <available_skills> at cold start.
|
|
11155
|
-
buildDisabledSkillNamesProvider(
|
|
11565
|
+
// CRITICAL: close over the per-request `settings` (LoadedSettings
|
|
11566
|
+
// instance), NOT over the `mergedSettings` snapshot built above.
|
|
11567
|
+
// `LoadedSettings.setValue` replaces `_merged`, so a closure over the
|
|
11568
|
+
// snapshot would never see workspace toggles applied during the
|
|
11569
|
+
// session. ACP/Zed sessions otherwise leak persisted disabled skills
|
|
11570
|
+
// into the first <available_skills> at cold start.
|
|
11571
|
+
buildDisabledSkillNamesProvider(settings),
|
|
11156
11572
|
sessionMcpServers
|
|
11157
11573
|
);
|
|
11158
11574
|
if (typeof config.enableFileCheckpointing === "function") {
|
|
@@ -11179,7 +11595,7 @@ ${outputText}
|
|
|
11179
11595
|
sessionId: sid,
|
|
11180
11596
|
...event
|
|
11181
11597
|
}).catch((err) => {
|
|
11182
|
-
|
|
11598
|
+
debugLogger7.debug(
|
|
11183
11599
|
`MCP budget extNotification dropped (session=${sid}, kind=${event.kind}): ${err instanceof Error ? err.message : String(err)}`
|
|
11184
11600
|
);
|
|
11185
11601
|
});
|
|
@@ -11191,7 +11607,7 @@ ${outputText}
|
|
|
11191
11607
|
// client-hosted (extension) MCP server added at runtime reaches the
|
|
11192
11608
|
// daemon WS. Servers that aren't client-hosted never use this callback
|
|
11193
11609
|
// (the daemon only adds SDK-type runtime servers for client MCP).
|
|
11194
|
-
sendSdkMcpMessage: this.buildClientMcpSender()
|
|
11610
|
+
sendSdkMcpMessage: this.buildClientMcpSender(wiredSessionId)
|
|
11195
11611
|
});
|
|
11196
11612
|
void this.surfaceMcpFailuresWhenReady(config);
|
|
11197
11613
|
return config;
|
|
@@ -11200,7 +11616,7 @@ ${outputText}
|
|
|
11200
11616
|
try {
|
|
11201
11617
|
await config.waitForMcpReady();
|
|
11202
11618
|
} catch (err) {
|
|
11203
|
-
|
|
11619
|
+
debugLogger7.error(
|
|
11204
11620
|
`MCP discovery readiness failed: ${err instanceof Error ? err.message : String(err)}`
|
|
11205
11621
|
);
|
|
11206
11622
|
return;
|
|
@@ -11224,7 +11640,7 @@ ${outputText}
|
|
|
11224
11640
|
try {
|
|
11225
11641
|
await config.refreshAuth(selectedType, true);
|
|
11226
11642
|
} catch (e) {
|
|
11227
|
-
|
|
11643
|
+
debugLogger7.error(`Authentication failed: ${e}`);
|
|
11228
11644
|
throw RequestError.authRequired(
|
|
11229
11645
|
{
|
|
11230
11646
|
authMethods: pickAuthMethodsForAuthRequired(selectedType)
|
|
@@ -11241,22 +11657,12 @@ ${outputText}
|
|
|
11241
11657
|
this.clientCapabilities.fs,
|
|
11242
11658
|
config.getFileSystemService(),
|
|
11243
11659
|
{
|
|
11244
|
-
|
|
11245
|
-
// auto-memory roots, so ACP-local read fallback follows the same policy.
|
|
11246
|
-
localReadRoots: [
|
|
11247
|
-
config.storage.getProjectTempDir(),
|
|
11248
|
-
path3.join(config.storage.getProjectDir(), "subagents"),
|
|
11249
|
-
Storage.getGlobalTempDir(),
|
|
11250
|
-
getAutoMemoryRoot(config.getTargetDir()),
|
|
11251
|
-
getUserAutoMemoryRoot(),
|
|
11252
|
-
...config.storage.getUserSkillsDirs(),
|
|
11253
|
-
Storage.getUserExtensionsDir()
|
|
11254
|
-
]
|
|
11660
|
+
localReadRoots: buildAcpLocalReadRoots(config)
|
|
11255
11661
|
}
|
|
11256
11662
|
);
|
|
11257
11663
|
config.setFileSystemService(acpFileSystemService);
|
|
11258
11664
|
}
|
|
11259
|
-
async createAndStoreSession(config, sessionData, options = {}) {
|
|
11665
|
+
async createAndStoreSession(config, settings, sessionData, options = {}) {
|
|
11260
11666
|
const sessionId = config.getSessionId();
|
|
11261
11667
|
const geminiClient = config.getGeminiClient();
|
|
11262
11668
|
const needsInitialize = !geminiClient.isInitialized();
|
|
@@ -11264,12 +11670,7 @@ ${outputText}
|
|
|
11264
11670
|
await geminiClient.initialize();
|
|
11265
11671
|
}
|
|
11266
11672
|
this.sessions.get(sessionId)?.dispose();
|
|
11267
|
-
const session = new Session(
|
|
11268
|
-
sessionId,
|
|
11269
|
-
config,
|
|
11270
|
-
this.connection,
|
|
11271
|
-
this.settings
|
|
11272
|
-
);
|
|
11673
|
+
const session = new Session(sessionId, config, this.connection, settings);
|
|
11273
11674
|
this.sessions.set(sessionId, session);
|
|
11274
11675
|
setTimeout(async () => {
|
|
11275
11676
|
await session.sendAvailableCommandsUpdate();
|
|
@@ -11283,8 +11684,10 @@ ${outputText}
|
|
|
11283
11684
|
if (options.replayHistory !== false && sessionData?.conversation.messages) {
|
|
11284
11685
|
await session.replayHistory(sessionData.conversation.messages);
|
|
11285
11686
|
}
|
|
11286
|
-
|
|
11287
|
-
|
|
11687
|
+
if (options.startPostReplayServices !== false) {
|
|
11688
|
+
session.installRewriter();
|
|
11689
|
+
session.startCronScheduler();
|
|
11690
|
+
}
|
|
11288
11691
|
return session;
|
|
11289
11692
|
}
|
|
11290
11693
|
buildAvailableModels(config) {
|