@qwen-code/qwen-code 0.19.5 → 0.19.6-nightly.20260705.015ee4248
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/dataviz/SKILL.md +50 -0
- package/bundled/dataviz/references/anti-patterns.md +12 -0
- package/bundled/dataviz/references/choosing-a-form.md +16 -0
- package/bundled/dataviz/references/palette.md +57 -0
- package/bundled/dataviz/scripts/validate_palette.js +328 -0
- package/bundled/loop/SKILL.md +1 -1
- package/bundled/qc-helper/docs/configuration/settings.md +14 -8
- package/bundled/qc-helper/docs/features/headless.md +2 -2
- package/bundled/qc-helper/docs/features/scheduled-tasks.md +4 -2
- package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +1 -1
- package/bundled/review/DESIGN.md +23 -0
- package/bundled/review/SKILL.md +65 -8
- package/chunks/{MaxSizedBox-5JV77KRA.js → MaxSizedBox-PRXTXIGC.js} +31 -30
- package/chunks/{StandaloneSessionPicker-MGUGB6PH.js → StandaloneSessionPicker-PV7BSC5D.js} +42 -41
- package/chunks/{acpAgent-4F36XM3X.js → acpAgent-F34HNAM3.js} +939 -424
- package/chunks/{agent-IWBUZI6A.js → agent-XSQDKLST.js} +26 -25
- package/chunks/{agent-headless-JUTICAYO.js → agent-headless-B63XCKWX.js} +26 -25
- package/chunks/{anthropicContentGenerator-WL3LJOUB.js → anthropicContentGenerator-INXXI4PW.js} +7 -7
- package/chunks/{artifact-tool-W76WC2JX.js → artifact-tool-H2TNPNP5.js} +16 -3
- package/chunks/{askUserQuestion-J3P6TH3V.js → askUserQuestion-MKL5ZTMC.js} +2 -2
- package/chunks/{bridge-DHZHQ4UV.js → bridge-NCZDJBRF.js} +34 -32
- package/chunks/{channel-worker-supervisor-EVPAYNZ5.js → channel-worker-supervisor-JUYQ5Z4R.js} +5 -5
- package/chunks/{chunk-AVQDCKNF.js → chunk-22MNNNXE.js} +4 -0
- package/chunks/chunk-3RW4AZJV.js +5063 -0
- package/chunks/chunk-3VJ7MT3N.js +111 -0
- package/chunks/{chunk-JKGCBO3O.js → chunk-3VRMGS3A.js} +4 -4
- package/chunks/{chunk-TN6RT6EJ.js → chunk-3WOJO5EJ.js} +16 -4
- package/chunks/{chunk-G7OQ3RFJ.js → chunk-42XGFRJS.js} +3 -3
- package/chunks/{chunk-MOUXUCXQ.js → chunk-4KJ2BPIT.js} +1 -1
- package/chunks/{chunk-PPFWEV7G.js → chunk-4RQIB5UZ.js} +62 -62
- package/chunks/{chunk-JJ6B3ZD3.js → chunk-544UZQBD.js} +3 -3
- package/chunks/{chunk-B236XPGF.js → chunk-5UDYETKK.js} +1 -1
- package/chunks/{chunk-7DMQRPC7.js → chunk-6BEOH4KK.js} +1 -1
- package/chunks/{chunk-CXBG27SF.js → chunk-6IAWPIQ6.js} +3 -2
- package/chunks/{chunk-MDBNFHIO.js → chunk-6MDY7FX3.js} +5 -5
- package/chunks/{chunk-RM3PGSGL.js → chunk-6SHO7WFF.js} +15 -2
- package/chunks/{chunk-YCU7QV7Q.js → chunk-73WGF3NW.js} +34 -1
- package/chunks/{chunk-T42ACHFI.js → chunk-7LTB54MK.js} +1 -1
- package/chunks/{chunk-SJVPSHXU.js → chunk-7U6J224Z.js} +132 -25
- package/chunks/{chunk-CSPSJU5R.js → chunk-7WLJPMWU.js} +17 -17
- package/chunks/{chunk-R6RI2HIC.js → chunk-ACD5DFUY.js} +41 -14
- package/chunks/{chunk-EWALXUAD.js → chunk-AGHU5VRK.js} +8 -0
- package/chunks/{chunk-GLPV75ES.js → chunk-AHNJGLFV.js} +2 -2
- package/chunks/{chunk-DRS2HTNT.js → chunk-AOAFX4PL.js} +5 -5
- package/chunks/{chunk-QHYITL6P.js → chunk-CK7IUFOB.js} +63 -22
- package/chunks/{chunk-RSBQS6M4.js → chunk-CODWJXQA.js} +1 -1
- package/chunks/{chunk-LWGLBVWA.js → chunk-CSOTA7KX.js} +1 -1
- package/chunks/{chunk-UJT42DB6.js → chunk-DFH4T5IQ.js} +6 -6
- package/chunks/{chunk-DX3TKXNT.js → chunk-DJACOX4C.js} +2 -2
- package/chunks/{chunk-KKQWC6WS.js → chunk-DNV4FSN5.js} +1 -1
- package/chunks/{chunk-YPCPZSZB.js → chunk-DT3B47QP.js} +1 -1
- package/chunks/{chunk-NIOPRZNN.js → chunk-E7KNELIZ.js} +1 -1
- package/chunks/{chunk-DG573EOO.js → chunk-FEJ2FZ3U.js} +1 -1
- package/chunks/{chunk-M5ITDKSM.js → chunk-FHGQFG2K.js} +1 -1
- package/chunks/{chunk-HISPEX42.js → chunk-FSXFNDTI.js} +7 -7
- package/chunks/{chunk-LHMZCIKL.js → chunk-FUW7YGJU.js} +3 -1
- package/chunks/{chunk-Y4UQT3PM.js → chunk-FV5SBNNC.js} +1 -1
- package/chunks/{chunk-YTFBURQD.js → chunk-GB6HDZIK.js} +10 -2
- package/chunks/{chunk-D5KISTLW.js → chunk-H6EMK6QK.js} +1 -1
- package/chunks/{chunk-2Z43HUXT.js → chunk-HLKG6CZN.js} +3 -2
- package/chunks/{chunk-VXGPYF7U.js → chunk-IFEWJXFS.js} +1 -1
- package/chunks/{chunk-TENOUWY2.js → chunk-IJRL2S3D.js} +3 -3
- package/chunks/{chunk-OQHLUA2Y.js → chunk-IL6ZEDZ2.js} +4 -4
- package/chunks/{chunk-2CAII5HD.js → chunk-J7XUJALJ.js} +1 -1
- package/chunks/chunk-JFFOH2XO.js +2472 -0
- package/chunks/{chunk-NNEJEBCF.js → chunk-K3FZXSTO.js} +95 -107
- package/chunks/{chunk-NDY7OENU.js → chunk-KB4ICCA5.js} +3 -3
- package/chunks/{chunk-MNOXKSM2.js → chunk-LFFF2SPV.js} +3 -3
- package/chunks/{chunk-J3ERRYYI.js → chunk-LTMDKOZC.js} +2 -2
- package/chunks/{chunk-R3UWLLRQ.js → chunk-M7AGQP5D.js} +1 -1
- package/chunks/{chunk-CBJE2PLG.js → chunk-MLB5AB2I.js} +4 -4
- package/chunks/{chunk-YHTNWGRR.js → chunk-MZ7BABX3.js} +1 -1
- package/chunks/{chunk-SJBIFVD2.js → chunk-NFE3DQ4R.js} +7 -3
- package/chunks/{chunk-BC4R5C5R.js → chunk-NLD2WKE3.js} +55 -12
- package/chunks/{chunk-ALX6BUYW.js → chunk-NUGPZXAZ.js} +35 -1
- package/chunks/{chunk-NSSVORTQ.js → chunk-NYKWPUAE.js} +17 -13
- package/chunks/{chunk-K4I4STSL.js → chunk-OGEJMKN5.js} +2 -2
- package/chunks/{chunk-HTWHAN44.js → chunk-PC4ZXHU2.js} +1 -1
- package/chunks/{chunk-2YH27UNF.js → chunk-QLBBV7C6.js} +1 -1
- package/chunks/chunk-QT7XKZT7.js +293 -0
- package/chunks/{chunk-NPQWQYU6.js → chunk-QYNNN7BK.js} +1 -1
- package/chunks/chunk-R4N3OALZ.js +5631 -0
- package/chunks/{chunk-G4M7FPNY.js → chunk-RB5GAQR6.js} +2 -2
- package/chunks/{chunk-SBMHB6N5.js → chunk-RPHMD5UC.js} +15 -15
- package/chunks/{chunk-CHY5C5T4.js → chunk-SJ2CTIYH.js} +185 -88
- package/chunks/chunk-SLQXGMYY.js +949 -0
- package/chunks/{chunk-BZHLWC6T.js → chunk-SUAKHHK7.js} +2 -2
- package/chunks/{chunk-IMAMNLY6.js → chunk-SWV4CVYG.js} +158 -3
- package/chunks/{chunk-XKSCTXPK.js → chunk-TDGF35EN.js} +4 -3
- package/chunks/{chunk-TOAUDIS7.js → chunk-TLWA7TPR.js} +6 -2
- package/chunks/{chunk-WALEWZ44.js → chunk-UVHL5TCO.js} +1 -1
- package/chunks/{chunk-ZISMVA6U.js → chunk-VDMM5LVR.js} +1566 -37
- package/chunks/{chunk-BPFJQGY7.js → chunk-VEB3NYSO.js} +164 -5
- package/chunks/{chunk-L7OJ3ZO3.js → chunk-VZ7HY3YU.js} +1 -1
- package/chunks/{chunk-6KPZJJ6U.js → chunk-W4I6PLEG.js} +131 -38
- package/chunks/{chunk-QOMAHFYI.js → chunk-W7EEOR7D.js} +3 -3
- package/chunks/{chunk-6QVQZAW6.js → chunk-WKP5QZOP.js} +1 -1
- package/chunks/{chunk-YXK4GPYO.js → chunk-WMPVYQ4P.js} +30 -1
- package/chunks/{chunk-DM4E337C.js → chunk-WNTS5A2R.js} +5 -5
- package/chunks/{chunk-6QTCOQX7.js → chunk-WOG7QWIT.js} +3086 -2635
- package/chunks/{chunk-UY2TCIZS.js → chunk-X265R5C6.js} +3 -3
- package/chunks/{chunk-LKWAVAB5.js → chunk-X2XNQQJI.js} +2 -2
- package/chunks/{chunk-MTNTVOJR.js → chunk-X3YGAX7V.js} +6 -3
- package/chunks/{chunk-EROWZQN7.js → chunk-XD3OLPII.js} +6 -6
- package/chunks/{chunk-RNGAT2Y2.js → chunk-YYL6HROQ.js} +1 -1
- package/chunks/{chunk-XKZXGIRM.js → chunk-YZ2LNTHO.js} +2 -2
- package/chunks/{chunk-Z7XNVNPM.js → chunk-YZ5ANQMR.js} +3 -3
- package/chunks/{chunk-4MCC4XHH.js → chunk-Z7EYROOJ.js} +3568 -5508
- package/chunks/{chunk-5B2WNM6V.js → chunk-ZI4MGBB5.js} +1 -1
- package/chunks/{chunk-WZ724G6K.js → chunk-ZPGE42V7.js} +6 -6
- package/chunks/{computer-use-ON3JQUHW.js → computer-use-5I2UHVNY.js} +26 -25
- package/chunks/{contextCommand-OGCG7W6N.js → contextCommand-3NWY7AJG.js} +28 -27
- package/chunks/{cron-create-6YTCOX6P.js → cron-create-O6ZHD3JN.js} +22 -7
- package/chunks/{cron-delete-E3NIFSUK.js → cron-delete-BFD5B2XX.js} +4 -4
- package/chunks/{cron-list-Q64MNQNE.js → cron-list-KI6FV4KN.js} +4 -4
- package/chunks/{daemon-EEB2RYOL.js → daemon-DRUMLVFP.js} +140 -0
- package/chunks/daemon-status-provider-A2DK3ZTO.js +74 -0
- package/chunks/{dist-AP5V4WYU.js → dist-AAO65DPC.js} +2 -2
- package/chunks/{dist-X4ZDE726.js → dist-ABQ7VWRR.js} +3 -3
- package/chunks/{dist-SNXOUPYS.js → dist-AW5ZYMUI.js} +2 -2
- package/chunks/{dist-Z57Q4YF5.js → dist-DN6M6TJ5.js} +525 -95
- package/chunks/{dist-IZP2VV4C.js → dist-JPSVN367.js} +2 -2
- package/chunks/{earlyInputCapture-DAFHSGVW.js → earlyInputCapture-5TMSSPQ5.js} +27 -26
- package/chunks/{edit-3QFNCSZH.js → edit-V4ITLSUD.js} +27 -26
- package/chunks/{en-M4EBUBNU.js → en-AXARKOWO.js} +2 -0
- package/chunks/{enter-worktree-62EQQMLD.js → enter-worktree-7ULPRMTJ.js} +26 -25
- package/chunks/{enterPlanMode-VUQSE4EG.js → enterPlanMode-YSHMLHJZ.js} +26 -25
- package/chunks/{errors-PW75PZXE.js → errors-TCUTD7NF.js} +28 -27
- package/chunks/{exit-worktree-VVNH7OVY.js → exit-worktree-JZDCKR6A.js} +26 -25
- package/chunks/{exitPlanMode-RUYRCYZW.js → exitPlanMode-GOQBN6SG.js} +26 -25
- package/chunks/{fast-path-TFRJRTTR.js → fast-path-F2HGAKO2.js} +3 -3
- package/chunks/{fast-path-settings-UQLRFDQP.js → fast-path-settings-RCRXH2JG.js} +2 -2
- package/chunks/{gemini-XW7ZDUVR.js → gemini-3M7ECKNW.js} +86 -80
- package/chunks/{geminiContentGenerator-MZDVHVZH.js → geminiContentGenerator-5EG3QEJM.js} +4 -4
- package/chunks/{glob-WAY2PUWA.js → glob-2DBDTLR4.js} +54 -29
- package/chunks/{grep-W6CBKSYC.js → grep-R27DLGWT.js} +26 -25
- package/chunks/{initializer-HK2XE6P2.js → initializer-OXB6BJZU.js} +32 -31
- package/chunks/{keychain-token-storage-GPAKRDKQ.js → keychain-token-storage-UJV5XP4Z.js} +2 -2
- package/chunks/{list-RVLIIKKL.js → list-HLCOEOSF.js} +33 -32
- package/chunks/{loadedSettingsAdapter-C63OUYZC.js → loadedSettingsAdapter-JHTVH3YO.js} +31 -30
- package/chunks/{loop-wakeup-G2EHBRGR.js → loop-wakeup-CUVIY2JY.js} +5 -5
- package/chunks/{ls-IDHUVSAG.js → ls-L654WOAT.js} +4 -4
- package/chunks/{lsp-FSRYXGFT.js → lsp-M35KE54Y.js} +2 -2
- package/chunks/mcp-2JWEFAIN.js +67 -0
- package/chunks/{monitor-FOG36ABM.js → monitor-5QKFZFDX.js} +26 -25
- package/chunks/nonInteractiveCli-W5W5PIHI.js +112 -0
- package/chunks/{notebook-edit-GC6NXRCX.js → notebook-edit-XAFBWORI.js} +27 -26
- package/chunks/{openaiContentGenerator-EXR3ZL3Z.js → openaiContentGenerator-NULJROYV.js} +13 -12
- package/chunks/{pidfile-FNZM2DDH.js → pidfile-3LT7PZSW.js} +27 -26
- package/chunks/{qwenContentGenerator-A7B6J4U7.js → qwenContentGenerator-KLSURVNH.js} +28 -27
- package/chunks/{qwenOAuth2-LWLA6MQG.js → qwenOAuth2-ZV7YLMND.js} +5 -5
- package/chunks/{read-file-6JL4ULMY.js → read-file-HDAM3RHJ.js} +8 -8
- package/chunks/{read-mcp-resource-PIJF24RO.js → read-mcp-resource-CNQHBSJM.js} +2 -2
- package/chunks/record-artifact-PP3LKHTS.js +343 -0
- package/chunks/{ripGrep-DIUGLJE5.js → ripGrep-W36NLR7M.js} +26 -25
- package/chunks/{run-qwen-serve-CME3AKM4.js → run-qwen-serve-IMI2CQB5.js} +72 -28
- package/chunks/{scheduler-L7F6GDDT.js → scheduler-I5NKE5UJ.js} +26 -25
- package/chunks/{send-message-33PYFMCT.js → send-message-OA6MV4EU.js} +3 -3
- package/chunks/{serve-SRCBOJGP.js → serve-JMHMOYBO.js} +33 -32
- package/chunks/{server-QSQ45QFR.js → server-QIYIN34N.js} +1358 -492
- package/chunks/{session-5DG6NXHZ.js → session-BLL6HB35.js} +68 -65
- package/chunks/{settings-3EEQI4MN.js → settings-ABECXCTY.js} +30 -29
- package/chunks/{shell-B7FNYF5S.js → shell-A2TQI3U4.js} +26 -25
- package/chunks/{skill-AAOGHD5O.js → skill-4GTWZZWR.js} +10 -10
- package/chunks/{spawnChannel-3CBN3ZLK.js → spawnChannel-DFUVGP53.js} +30 -29
- package/chunks/{src-T5A7P7FS.js → src-ZORBMUM7.js} +77 -43
- package/chunks/{startInteractiveUI-2FGEQ6AS.js → startInteractiveUI-FH5MVXUE.js} +449 -175
- package/chunks/{syntheticOutput-YOSWIHDJ.js → syntheticOutput-F7LSDCAR.js} +3 -3
- package/chunks/{task-create-NHS2NGB3.js → task-create-RPFZNB4B.js} +7 -7
- package/chunks/{task-list-5UIB564R.js → task-list-TGGJX7EA.js} +5 -5
- package/chunks/{task-stop-HGXZ2VZ3.js → task-stop-W7NGTMYQ.js} +2 -2
- package/chunks/{task-update-IYYWUILG.js → task-update-5WUG5MVQ.js} +7 -7
- package/chunks/{team-create-KDF6W6PV.js → team-create-F76QOR6H.js} +26 -25
- package/chunks/{team-delete-FEKJCU4P.js → team-delete-UHQQ2QQX.js} +5 -5
- package/chunks/{team-plan-approval-PSFKQX7M.js → team-plan-approval-OKM7YZC2.js} +26 -25
- package/chunks/{theme-manager-5XOA2AO7.js → theme-manager-6R7EVWHW.js} +27 -26
- package/chunks/{todoWrite-TKMVZ2HT.js → todoWrite-C4ZAMSR3.js} +4 -4
- package/chunks/{tool-search-LFRILZXC.js → tool-search-UWXDKI7D.js} +9 -9
- package/chunks/{trustedFolders-7HQY6T6X.js → trustedFolders-DHASVVUP.js} +27 -26
- package/chunks/{validateNonInterActiveAuth-UC27B7BA.js → validateNonInterActiveAuth-56J7MOOP.js} +62 -59
- package/chunks/version-NE2I4PBN.js +10 -0
- package/chunks/{web-fetch-J4PIW36Q.js → web-fetch-UYGMOHW4.js} +5 -5
- package/chunks/{workflow-KUTESS6L.js → workflow-HGF3URV3.js} +35 -27
- package/chunks/{workspace-providers-status-LJT5AQDS.js → workspace-providers-status-KXB2OZFQ.js} +33 -32
- package/chunks/{workspace-service-YOBYVDXH.js → workspace-service-NSTI55BC.js} +39 -38
- package/chunks/workspace-skills-status-X5S6JGQZ.js +69 -0
- package/chunks/{write-file-FJYBZUHP.js → write-file-HVKT5VTX.js} +27 -26
- package/chunks/yargs-B64EYTCF.js +10 -0
- package/chunks/{zh-SLZNSSZB.js → zh-RS3HZHFH.js} +2 -0
- package/chunks/{zh-TW-P53C2SL5.js → zh-TW-L5GRQ4S4.js} +2 -0
- package/cli-entry.js +81 -8
- package/cli.js +348 -55
- package/locales/en.js +2 -0
- package/locales/zh-TW.js +2 -0
- package/locales/zh.js +2 -0
- 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-D_rAuMDd.js → arc-Csx4m4N0.js} +1 -1
- package/web-shell/assets/{architectureDiagram-3BPJPVTR-DUCzbHVo.js → architectureDiagram-3BPJPVTR-BEa0vCM7.js} +1 -1
- package/web-shell/assets/{blockDiagram-GPEHLZMM-BEEBt1LL.js → blockDiagram-GPEHLZMM-BPzbKnn3.js} +1 -1
- package/web-shell/assets/{c4Diagram-AAUBKEIU-5ZJ_DeFL.js → c4Diagram-AAUBKEIU-B8YO71yP.js} +1 -1
- package/web-shell/assets/channel-QU1XUuVe.js +1 -0
- package/web-shell/assets/{chunk-2J33WTMH-Cfw7EiLn.js → chunk-2J33WTMH-32XhwSHt.js} +1 -1
- package/web-shell/assets/{chunk-4BX2VUAB-FGuZNCZY.js → chunk-4BX2VUAB-Bmoyo6PS.js} +1 -1
- package/web-shell/assets/{chunk-55IACEB6-CaBwYPBF.js → chunk-55IACEB6-TwH6PFhs.js} +1 -1
- package/web-shell/assets/{chunk-727SXJPM-BlR04OFz.js → chunk-727SXJPM-RI_IVUtZ.js} +1 -1
- package/web-shell/assets/{chunk-AQP2D5EJ-D3_mYJH5.js → chunk-AQP2D5EJ-DH6GIAZD.js} +1 -1
- package/web-shell/assets/{chunk-FMBD7UC4-7D4q4SbB.js → chunk-FMBD7UC4-DeD3k3D5.js} +1 -1
- package/web-shell/assets/{chunk-ND2GUHAM-BjX_Iwmr.js → chunk-ND2GUHAM-BLPb8nv3.js} +1 -1
- package/web-shell/assets/{chunk-QZHKN3VN-C3Hz_ZQh.js → chunk-QZHKN3VN-PZpyglW1.js} +1 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-fv1EWO-L.js +1 -0
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-fv1EWO-L.js +1 -0
- package/web-shell/assets/{cose-bilkent-S5V4N54A-Ax4UycaT.js → cose-bilkent-S5V4N54A-Jsd0yKfz.js} +1 -1
- package/web-shell/assets/{dagre-BM42HDAG-C6hmPtGt.js → dagre-BM42HDAG-B-zADciZ.js} +1 -1
- package/web-shell/assets/{diagram-2AECGRRQ-tXZnxjmw.js → diagram-2AECGRRQ-Cn6GDxoo.js} +1 -1
- package/web-shell/assets/{diagram-5GNKFQAL-99dwIzQG.js → diagram-5GNKFQAL-udLgyJxO.js} +1 -1
- package/web-shell/assets/{diagram-KO2AKTUF-Bqhn0-2s.js → diagram-KO2AKTUF-EcLpfzy3.js} +1 -1
- package/web-shell/assets/{diagram-LMA3HP47-DzThVSvo.js → diagram-LMA3HP47-D-YFbYsJ.js} +1 -1
- package/web-shell/assets/{diagram-OG6HWLK6-DPE8vjln.js → diagram-OG6HWLK6-C8oRUATa.js} +1 -1
- package/web-shell/assets/{erDiagram-TEJ5UH35-KzUKgQCV.js → erDiagram-TEJ5UH35-DPH5nStc.js} +1 -1
- package/web-shell/assets/{flowDiagram-I6XJVG4X-DBN-DXw5.js → flowDiagram-I6XJVG4X-CSOTwkAt.js} +1 -1
- package/web-shell/assets/{ganttDiagram-6RSMTGT7-DuBsP9u8.js → ganttDiagram-6RSMTGT7-D0L988t0.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-PVQCEYII-BjWHMyKR.js → gitGraphDiagram-PVQCEYII-B9Oo7gxS.js} +1 -1
- package/web-shell/assets/index-BYZZL5N7.css +5 -0
- package/web-shell/assets/index-C_oTyz0s.js +753 -0
- package/web-shell/assets/{infoDiagram-5YYISTIA-BVux0vP6.js → infoDiagram-5YYISTIA-Ddj4YN2P.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-2qzw7f--.js → ishikawaDiagram-YF4QCWOH-CBjafcl7.js} +1 -1
- package/web-shell/assets/{journeyDiagram-JHISSGLW-Dnl65sxL.js → journeyDiagram-JHISSGLW-Bn3XD99u.js} +1 -1
- package/web-shell/assets/{kanban-definition-UN3LZRKU-BElSQYtY.js → kanban-definition-UN3LZRKU-D7PBPJmE.js} +1 -1
- package/web-shell/assets/{linear-BjoycSSY.js → linear-Bmfo22rZ.js} +1 -1
- package/web-shell/assets/{mermaid.core-xe6bvMRz.js → mermaid.core-xRkAI-EI.js} +5 -5
- package/web-shell/assets/{mindmap-definition-RKZ34NQL-D8DQgI4U.js → mindmap-definition-RKZ34NQL-B30zRinm.js} +1 -1
- package/web-shell/assets/{pieDiagram-4H26LBE5-Dwh7Gp7c.js → pieDiagram-4H26LBE5-DblnKR9Z.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-W4KKPZXB-BXKNBln2.js → quadrantDiagram-W4KKPZXB-COkHFKjF.js} +1 -1
- package/web-shell/assets/{requirementDiagram-4Y6WPE33-BzaC3cIA.js → requirementDiagram-4Y6WPE33-DDU3MMyn.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-5OEKKPKP-DP2t7eZk.js → sankeyDiagram-5OEKKPKP-Dt4lqEYv.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-3UESZ5HK-XlFiWEYv.js → sequenceDiagram-3UESZ5HK-BRzby5gN.js} +1 -1
- package/web-shell/assets/{stateDiagram-AJRCARHV-CupgUMJO.js → stateDiagram-AJRCARHV-CylzByc3.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-BKWZIKkM.js +1 -0
- package/web-shell/assets/{timeline-definition-PNZ67QCA-DstuGywa.js → timeline-definition-PNZ67QCA-BSzaNx6w.js} +1 -1
- package/web-shell/assets/{vennDiagram-CIIHVFJN-CnbNp6zu.js → vennDiagram-CIIHVFJN-BbzeKzCo.js} +1 -1
- package/web-shell/assets/{wardley-L42UT6IY-DnvoHq6R.js → wardley-L42UT6IY-BRJwCgE_.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-YWT4CUSO-Cz0xHEWB.js → wardleyDiagram-YWT4CUSO-BmAs0mJ-.js} +1 -1
- package/web-shell/assets/{xychartDiagram-2RQKCTM6-p36gfo88.js → xychartDiagram-2RQKCTM6-DqywSqVW.js} +1 -1
- package/web-shell/index.html +2 -2
- package/bundled/loop/SKILL.test.ts +0 -119
- package/bundled/loop/autonomous-loop.test.ts +0 -59
- package/bundled/loop/loop-task-file.test.ts +0 -1064
- package/bundled/loop/loop-tick-resolver.test.ts +0 -906
- package/chunks/chunk-EJ7BN3EN.js +0 -11396
- package/chunks/chunk-L7QPM2YD.js +0 -481
- package/chunks/daemon-status-provider-P72STMLB.js +0 -72
- package/chunks/nonInteractiveCli-6BYQSJTB.js +0 -109
- package/chunks/workspace-skills-status-ONEPXJV6.js +0 -62
- package/web-shell/assets/channel-B5ynH0q8.js +0 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-CK3ibywp.js +0 -1
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CK3ibywp.js +0 -1
- package/web-shell/assets/index-9qfvU0_r.css +0 -5
- package/web-shell/assets/index-CWzDaQT5.js +0 -717
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-By3E4QwN.js +0 -1
- package/chunks/{chunk-UFC57OYT.js → chunk-VRDMOSQS.js} +54 -54
|
@@ -3,148 +3,169 @@
|
|
|
3
3
|
import {
|
|
4
4
|
classifyApiError,
|
|
5
5
|
prefixMidTurnUserMessageParts
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-W4I6PLEG.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-7U6J224Z.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-Z7EYROOJ.js";
|
|
24
23
|
import {
|
|
25
24
|
appEvents,
|
|
26
25
|
buildDisabledSkillNamesProvider,
|
|
27
26
|
loadCliConfig,
|
|
28
27
|
normalizeDisabledToolList
|
|
29
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-R4N3OALZ.js";
|
|
29
|
+
import {
|
|
30
|
+
collectContextData,
|
|
31
|
+
formatContextUsageText
|
|
32
|
+
} from "./chunk-ZPGE42V7.js";
|
|
30
33
|
import {
|
|
31
34
|
getCommandSubcommandNames
|
|
32
|
-
} from "./chunk-
|
|
33
|
-
import "./chunk-
|
|
35
|
+
} from "./chunk-SWV4CVYG.js";
|
|
36
|
+
import "./chunk-KB4ICCA5.js";
|
|
34
37
|
import {
|
|
35
38
|
getEffectiveSupportedModes
|
|
36
|
-
} from "./chunk-
|
|
37
|
-
import "./chunk-JZSY4WP3.js";
|
|
38
|
-
import {
|
|
39
|
-
collectContextData,
|
|
40
|
-
formatContextUsageText
|
|
41
|
-
} from "./chunk-WZ724G6K.js";
|
|
39
|
+
} from "./chunk-DFH4T5IQ.js";
|
|
42
40
|
import {
|
|
43
41
|
isTerminalGoalStatusKind
|
|
44
42
|
} from "./chunk-KSPVDFE4.js";
|
|
45
43
|
import "./chunk-MRO43B25.js";
|
|
46
|
-
import "./chunk-
|
|
47
|
-
import "./chunk-
|
|
48
|
-
import "./chunk-XKZXGIRM.js";
|
|
44
|
+
import "./chunk-IFEWJXFS.js";
|
|
45
|
+
import "./chunk-YZ2LNTHO.js";
|
|
49
46
|
import "./chunk-KYMBIKIW.js";
|
|
50
|
-
import "./chunk-
|
|
47
|
+
import "./chunk-PC4ZXHU2.js";
|
|
48
|
+
import "./chunk-JZSY4WP3.js";
|
|
49
|
+
import "./chunk-AOAFX4PL.js";
|
|
50
|
+
import "./chunk-3GONHQOA.js";
|
|
51
|
+
import "./chunk-544UZQBD.js";
|
|
52
|
+
import "./chunk-ZI4MGBB5.js";
|
|
51
53
|
import {
|
|
52
54
|
MAX_REMEMBER_CONTENT_BYTES,
|
|
53
55
|
extractRememberErrorCode,
|
|
56
|
+
formatWorkspaceMemoryForgetSummary,
|
|
54
57
|
isValidServerName
|
|
55
|
-
} from "./chunk-
|
|
56
|
-
import
|
|
58
|
+
} from "./chunk-6SHO7WFF.js";
|
|
59
|
+
import {
|
|
60
|
+
HistoryReplayer,
|
|
61
|
+
MessageEmitter,
|
|
62
|
+
PlanEmitter,
|
|
63
|
+
ToolCallEmitter
|
|
64
|
+
} from "./chunk-JFFOH2XO.js";
|
|
57
65
|
import "./chunk-54YZOP7P.js";
|
|
58
|
-
import "./chunk-
|
|
66
|
+
import "./chunk-J7XUJALJ.js";
|
|
67
|
+
import "./chunk-3VRMGS3A.js";
|
|
68
|
+
import "./chunk-KHDZHZMH.js";
|
|
69
|
+
import {
|
|
70
|
+
formatAcpModelId,
|
|
71
|
+
parseAcpBaseModelId,
|
|
72
|
+
parseAcpModelOption,
|
|
73
|
+
sanitizeProviderBaseUrl
|
|
74
|
+
} from "./chunk-OGEJMKN5.js";
|
|
75
|
+
import {
|
|
76
|
+
mapSkillConfigToStatus
|
|
77
|
+
} from "./chunk-6IAWPIQ6.js";
|
|
59
78
|
import {
|
|
60
79
|
PERMISSION_RULE_TYPES,
|
|
61
80
|
PermissionRulesValidationError,
|
|
62
81
|
buildPermissionSettings,
|
|
63
82
|
normalizePermissionRules,
|
|
64
83
|
readPermissionRuleSet
|
|
65
|
-
} from "./chunk-
|
|
66
|
-
import "./chunk-
|
|
67
|
-
import "./chunk-
|
|
84
|
+
} from "./chunk-WKP5QZOP.js";
|
|
85
|
+
import "./chunk-FV5SBNNC.js";
|
|
86
|
+
import "./chunk-E7KNELIZ.js";
|
|
68
87
|
import "./chunk-AHNXYU4O.js";
|
|
69
88
|
import "./chunk-RNBYOUGV.js";
|
|
70
|
-
import "./chunk-
|
|
89
|
+
import "./chunk-FSXFNDTI.js";
|
|
71
90
|
import "./chunk-BJBWRCSK.js";
|
|
72
|
-
import "./chunk-
|
|
73
|
-
import "./chunk-
|
|
74
|
-
import "./chunk-
|
|
75
|
-
import "./chunk-
|
|
91
|
+
import "./chunk-SLQXGMYY.js";
|
|
92
|
+
import "./chunk-6BEOH4KK.js";
|
|
93
|
+
import "./chunk-S6RLAIUR.js";
|
|
94
|
+
import "./chunk-MX2YXRER.js";
|
|
95
|
+
import "./chunk-MZ7BABX3.js";
|
|
76
96
|
import {
|
|
77
97
|
createLoadedSettingsAdapter
|
|
78
|
-
} from "./chunk-
|
|
79
|
-
import "./chunk-JKGCBO3O.js";
|
|
80
|
-
import "./chunk-KHDZHZMH.js";
|
|
81
|
-
import "./chunk-RSBQS6M4.js";
|
|
82
|
-
import {
|
|
83
|
-
NOT_CURRENTLY_GENERATING_CANCEL_MESSAGE
|
|
84
|
-
} from "./chunk-T22H4V4R.js";
|
|
85
|
-
import {
|
|
86
|
-
CLIENT_MCP_OVER_WS_CONFIG_FLAG,
|
|
87
|
-
MID_TURN_QUEUE_DRAIN_METHOD
|
|
88
|
-
} from "./chunk-EWALXUAD.js";
|
|
89
|
-
import "./chunk-SEZC2725.js";
|
|
90
|
-
import "./chunk-ALX6BUYW.js";
|
|
91
|
-
import {
|
|
92
|
-
formatAcpModelId,
|
|
93
|
-
parseAcpBaseModelId,
|
|
94
|
-
parseAcpModelOption,
|
|
95
|
-
sanitizeProviderBaseUrl
|
|
96
|
-
} from "./chunk-K4I4STSL.js";
|
|
97
|
-
import {
|
|
98
|
-
mapSkillConfigToStatus
|
|
99
|
-
} from "./chunk-CXBG27SF.js";
|
|
100
|
-
import {
|
|
101
|
-
ACP_PREFLIGHT_KINDS,
|
|
102
|
-
IDLE_HOOK_EVENTS,
|
|
103
|
-
SERVE_CONTROL_EXT_METHODS,
|
|
104
|
-
SERVE_STATUS_EXT_METHODS,
|
|
105
|
-
STATUS_SCHEMA_VERSION,
|
|
106
|
-
mapDomainErrorToErrorKind
|
|
107
|
-
} from "./chunk-LHMZCIKL.js";
|
|
98
|
+
} from "./chunk-M7AGQP5D.js";
|
|
108
99
|
import {
|
|
109
100
|
OUTPUT_LANGUAGE_AUTO,
|
|
101
|
+
findEnvFiles,
|
|
110
102
|
getOutputLanguageFilePath,
|
|
111
103
|
getPersistScopeForModelSelection,
|
|
104
|
+
getUserSettingsPath,
|
|
112
105
|
isAutoLanguage,
|
|
113
106
|
loadSettings,
|
|
107
|
+
preResolveHomeEnvOverrides,
|
|
114
108
|
reloadEnvironment,
|
|
115
109
|
resolveOutputLanguage,
|
|
116
110
|
updateOutputLanguageFile,
|
|
117
111
|
writeOutputLanguageAndRegisterPath
|
|
118
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-NLD2WKE3.js";
|
|
119
113
|
import {
|
|
120
114
|
SUPPORTED_LANGUAGES,
|
|
121
115
|
getCurrentLanguage,
|
|
122
116
|
setLanguageAsync
|
|
123
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-WNTS5A2R.js";
|
|
124
118
|
import "./chunk-TLRYABYP.js";
|
|
125
|
-
import
|
|
126
|
-
|
|
127
|
-
|
|
119
|
+
import {
|
|
120
|
+
getSystemDefaultsPath,
|
|
121
|
+
getSystemSettingsPath
|
|
122
|
+
} from "./chunk-4RQIB5UZ.js";
|
|
123
|
+
import {
|
|
124
|
+
NOT_CURRENTLY_GENERATING_CANCEL_MESSAGE
|
|
125
|
+
} from "./chunk-T22H4V4R.js";
|
|
126
|
+
import {
|
|
127
|
+
CLIENT_MCP_OVER_WS_CONFIG_FLAG,
|
|
128
|
+
LOAD_REPLAY_BULK_MODE,
|
|
129
|
+
LOAD_REPLAY_META_KEY,
|
|
130
|
+
LOAD_REPLAY_MODE_META_KEY,
|
|
131
|
+
LOAD_REPLAY_VERSION,
|
|
132
|
+
MID_TURN_QUEUE_DRAIN_METHOD
|
|
133
|
+
} from "./chunk-AGHU5VRK.js";
|
|
134
|
+
import "./chunk-SEZC2725.js";
|
|
135
|
+
import "./chunk-NUGPZXAZ.js";
|
|
128
136
|
import {
|
|
129
137
|
AgentSideConnection,
|
|
130
138
|
PROTOCOL_VERSION,
|
|
131
|
-
RequestError
|
|
139
|
+
RequestError
|
|
140
|
+
} from "./chunk-VRDMOSQS.js";
|
|
141
|
+
import {
|
|
132
142
|
ndJsonStream
|
|
133
|
-
} from "./chunk-
|
|
134
|
-
import
|
|
143
|
+
} from "./chunk-3VJ7MT3N.js";
|
|
144
|
+
import {
|
|
145
|
+
ACP_PREFLIGHT_KINDS,
|
|
146
|
+
IDLE_HOOK_EVENTS,
|
|
147
|
+
SERVE_CONTROL_EXT_METHODS,
|
|
148
|
+
SERVE_STATUS_EXT_METHODS,
|
|
149
|
+
STATUS_SCHEMA_VERSION,
|
|
150
|
+
mapDomainErrorToErrorKind
|
|
151
|
+
} from "./chunk-FUW7YGJU.js";
|
|
152
|
+
import "./chunk-3RW4AZJV.js";
|
|
153
|
+
import "./chunk-CODWJXQA.js";
|
|
135
154
|
import {
|
|
136
155
|
isFolderTrustEnabled,
|
|
137
156
|
isWorkspaceTrusted,
|
|
138
157
|
loadTrustedFolders
|
|
139
|
-
} from "./chunk-
|
|
140
|
-
import
|
|
158
|
+
} from "./chunk-YZ5ANQMR.js";
|
|
159
|
+
import {
|
|
160
|
+
writeStderrLine
|
|
161
|
+
} from "./chunk-Y6Z2O3WR.js";
|
|
141
162
|
import "./chunk-QYUE6W3T.js";
|
|
142
163
|
import {
|
|
143
164
|
ALL_PROVIDERS,
|
|
144
165
|
APPROVAL_MODE_INFO,
|
|
145
166
|
BTW_MAX_INPUT_LENGTH,
|
|
146
167
|
ExtensionManager,
|
|
147
|
-
|
|
168
|
+
IMAGE_CAPABILITY,
|
|
148
169
|
InvalidMcpConfigError,
|
|
149
170
|
LoopTickResolver,
|
|
150
171
|
MAX_TRANSCRIPT_MESSAGES,
|
|
@@ -206,6 +227,7 @@ import {
|
|
|
206
227
|
getScopedEnvContents,
|
|
207
228
|
getStartupContextLength,
|
|
208
229
|
hasImageParts,
|
|
230
|
+
ideContextStore,
|
|
209
231
|
injectPermissionRulesIfMissing,
|
|
210
232
|
isApproveOutcome,
|
|
211
233
|
isDenialFallbackReason,
|
|
@@ -224,6 +246,7 @@ import {
|
|
|
224
246
|
resolveBaseUrl,
|
|
225
247
|
restoreWorktreeContext,
|
|
226
248
|
runForkedAgent,
|
|
249
|
+
runManagedAutoMemoryDream,
|
|
227
250
|
runManagedRememberByAgent,
|
|
228
251
|
runVisionBridge,
|
|
229
252
|
sessionIdContext,
|
|
@@ -238,36 +261,38 @@ import {
|
|
|
238
261
|
subagentGenerator,
|
|
239
262
|
unregisterGoalHook,
|
|
240
263
|
updateSetting
|
|
241
|
-
} from "./chunk-
|
|
264
|
+
} from "./chunk-WOG7QWIT.js";
|
|
242
265
|
import "./chunk-5P5XGNYH.js";
|
|
266
|
+
import "./chunk-SKAZWEV5.js";
|
|
243
267
|
import {
|
|
244
268
|
external_exports
|
|
245
269
|
} from "./chunk-K5PGHDBN.js";
|
|
246
|
-
import "./chunk-
|
|
247
|
-
import "./chunk-
|
|
248
|
-
import "./chunk-
|
|
249
|
-
import "./chunk-
|
|
270
|
+
import "./chunk-ACD5DFUY.js";
|
|
271
|
+
import "./chunk-W7EEOR7D.js";
|
|
272
|
+
import "./chunk-42XGFRJS.js";
|
|
273
|
+
import "./chunk-X2XNQQJI.js";
|
|
250
274
|
import {
|
|
251
275
|
runSideQuery
|
|
252
|
-
} from "./chunk-
|
|
253
|
-
import "./chunk-R6RI2HIC.js";
|
|
276
|
+
} from "./chunk-VZ7HY3YU.js";
|
|
254
277
|
import "./chunk-2MPVVENX.js";
|
|
255
278
|
import "./chunk-ZTQ26VBE.js";
|
|
256
|
-
import "./chunk-
|
|
279
|
+
import "./chunk-NFE3DQ4R.js";
|
|
257
280
|
import "./chunk-MLZQVCF3.js";
|
|
258
281
|
import "./chunk-LQ7TMOCE.js";
|
|
259
282
|
import "./chunk-E5A7LHNN.js";
|
|
260
283
|
import {
|
|
261
|
-
APPROVAL_MODES
|
|
262
|
-
|
|
284
|
+
APPROVAL_MODES,
|
|
285
|
+
FORK_SUBAGENT_TYPE
|
|
286
|
+
} from "./chunk-VEB3NYSO.js";
|
|
263
287
|
import "./chunk-GO6LNQXT.js";
|
|
264
|
-
import "./chunk-
|
|
288
|
+
import "./chunk-5UDYETKK.js";
|
|
265
289
|
import {
|
|
266
290
|
HookEventName,
|
|
267
291
|
createHookOutput
|
|
268
|
-
} from "./chunk-
|
|
269
|
-
import "./chunk-
|
|
270
|
-
import "./chunk-
|
|
292
|
+
} from "./chunk-WMPVYQ4P.js";
|
|
293
|
+
import "./chunk-TLWA7TPR.js";
|
|
294
|
+
import "./chunk-QYNNN7BK.js";
|
|
295
|
+
import "./chunk-QT7XKZT7.js";
|
|
271
296
|
import {
|
|
272
297
|
AuthType,
|
|
273
298
|
ConversationFinishedEvent,
|
|
@@ -285,12 +310,14 @@ import {
|
|
|
285
310
|
logPromptSuggestion,
|
|
286
311
|
logToolCall,
|
|
287
312
|
logUserPrompt,
|
|
313
|
+
registerAcpEventLoopLagGauge,
|
|
288
314
|
runInToolSpanContext,
|
|
315
|
+
startEventLoopLagMonitor,
|
|
289
316
|
startToolExecutionSpan,
|
|
290
317
|
startToolSpan,
|
|
291
318
|
uiTelemetryService,
|
|
292
319
|
withInteractionSpan
|
|
293
|
-
} from "./chunk-
|
|
320
|
+
} from "./chunk-SJ2CTIYH.js";
|
|
294
321
|
import "./chunk-E6US47KI.js";
|
|
295
322
|
import "./chunk-UWCTAVOD.js";
|
|
296
323
|
import "./chunk-OFEVLU4C.js";
|
|
@@ -298,44 +325,44 @@ import "./chunk-OMX7CUOE.js";
|
|
|
298
325
|
import {
|
|
299
326
|
getAutoMemoryRoot,
|
|
300
327
|
getUserAutoMemoryRoot
|
|
301
|
-
} from "./chunk-
|
|
302
|
-
import "./chunk-
|
|
303
|
-
import "./chunk-
|
|
328
|
+
} from "./chunk-4KJ2BPIT.js";
|
|
329
|
+
import "./chunk-SUAKHHK7.js";
|
|
330
|
+
import "./chunk-FEJ2FZ3U.js";
|
|
304
331
|
import {
|
|
305
332
|
ToolConfirmationOutcome,
|
|
306
333
|
ToolNames
|
|
307
|
-
} from "./chunk-
|
|
334
|
+
} from "./chunk-X3YGAX7V.js";
|
|
308
335
|
import {
|
|
309
336
|
clearCachedCredentialFile,
|
|
310
337
|
qwenOAuth2Events
|
|
311
|
-
} from "./chunk-
|
|
312
|
-
import "./chunk-
|
|
338
|
+
} from "./chunk-IJRL2S3D.js";
|
|
339
|
+
import "./chunk-AHNJGLFV.js";
|
|
313
340
|
import "./chunk-22IFUCVR.js";
|
|
314
|
-
import "./chunk-
|
|
341
|
+
import "./chunk-7LTB54MK.js";
|
|
315
342
|
import "./chunk-SIUQ3YYX.js";
|
|
316
343
|
import {
|
|
317
344
|
DEFAULT_TOKEN_LIMIT,
|
|
318
345
|
tokenLimit
|
|
319
|
-
} from "./chunk-
|
|
320
|
-
import "./chunk-
|
|
346
|
+
} from "./chunk-GB6HDZIK.js";
|
|
347
|
+
import "./chunk-DT3B47QP.js";
|
|
321
348
|
import "./chunk-IRJWHZWU.js";
|
|
322
349
|
import "./chunk-SYCJMSIJ.js";
|
|
323
350
|
import "./chunk-55ZMG67I.js";
|
|
324
351
|
import "./chunk-H6BD2ELD.js";
|
|
325
352
|
import "./chunk-5IFG2VC4.js";
|
|
326
353
|
import "./chunk-64WXLC72.js";
|
|
327
|
-
import "./chunk-
|
|
354
|
+
import "./chunk-H6EMK6QK.js";
|
|
328
355
|
import {
|
|
329
356
|
Storage,
|
|
330
357
|
createDebugLogger,
|
|
331
358
|
getErrorMessage,
|
|
332
359
|
getErrorStatus,
|
|
333
360
|
isSubpath
|
|
334
|
-
} from "./chunk-
|
|
335
|
-
import "./chunk-
|
|
361
|
+
} from "./chunk-22MNNNXE.js";
|
|
362
|
+
import "./chunk-FHGQFG2K.js";
|
|
336
363
|
import {
|
|
337
364
|
runExitCleanup
|
|
338
|
-
} from "./chunk-
|
|
365
|
+
} from "./chunk-QLBBV7C6.js";
|
|
339
366
|
import "./chunk-ZERZSAZL.js";
|
|
340
367
|
import "./chunk-QN5NZ3UQ.js";
|
|
341
368
|
import "./chunk-BR4QREVK.js";
|
|
@@ -562,14 +589,129 @@ var AcpFileSystemService = class {
|
|
|
562
589
|
// packages/cli/src/acp-integration/acpAgent.ts
|
|
563
590
|
import { Readable, Writable } from "node:stream";
|
|
564
591
|
import { pipeline } from "node:stream/promises";
|
|
565
|
-
import * as
|
|
566
|
-
import * as
|
|
592
|
+
import * as fs2 from "node:fs/promises";
|
|
593
|
+
import * as path4 from "node:path";
|
|
567
594
|
import { createGunzip } from "node:zlib";
|
|
568
595
|
|
|
569
|
-
// packages/cli/src/
|
|
596
|
+
// packages/cli/src/config/settings-cache.ts
|
|
570
597
|
init_esbuild_shims();
|
|
598
|
+
import * as fs from "node:fs";
|
|
571
599
|
import * as os from "node:os";
|
|
572
600
|
import * as path2 from "node:path";
|
|
601
|
+
var MAX_CACHE_ENTRIES = 64;
|
|
602
|
+
var debugLogger2 = createDebugLogger("SETTINGS_CACHE");
|
|
603
|
+
var cache = /* @__PURE__ */ new Map();
|
|
604
|
+
function statSig(filePath) {
|
|
605
|
+
const st = fs.statSync(filePath, { throwIfNoEntry: false });
|
|
606
|
+
return st ? `${st.mtimeMs}:${st.size}:${st.ino}` : "missing";
|
|
607
|
+
}
|
|
608
|
+
__name(statSig, "statSig");
|
|
609
|
+
function realpathOr(p) {
|
|
610
|
+
try {
|
|
611
|
+
return fs.realpathSync(p);
|
|
612
|
+
} catch {
|
|
613
|
+
return path2.resolve(p);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
__name(realpathOr, "realpathOr");
|
|
617
|
+
function settingsFileSigs(workspaceDir) {
|
|
618
|
+
const filePaths = [
|
|
619
|
+
getSystemSettingsPath(),
|
|
620
|
+
getSystemDefaultsPath(),
|
|
621
|
+
getUserSettingsPath(),
|
|
622
|
+
new Storage(workspaceDir).getWorkspaceSettingsPath()
|
|
623
|
+
];
|
|
624
|
+
return filePaths.map((filePath) => ({ filePath, sig: statSig(filePath) }));
|
|
625
|
+
}
|
|
626
|
+
__name(settingsFileSigs, "settingsFileSigs");
|
|
627
|
+
function envFileSigs(settings, workspaceDir) {
|
|
628
|
+
return findEnvFiles(settings.merged, workspaceDir).map((filePath) => ({
|
|
629
|
+
filePath,
|
|
630
|
+
sig: statSig(filePath)
|
|
631
|
+
}));
|
|
632
|
+
}
|
|
633
|
+
__name(envFileSigs, "envFileSigs");
|
|
634
|
+
function sameFileSigs(a, b) {
|
|
635
|
+
if (a.length !== b.length) {
|
|
636
|
+
return false;
|
|
637
|
+
}
|
|
638
|
+
return a.every(
|
|
639
|
+
(sig, i) => sig.filePath === b[i].filePath && sig.sig === b[i].sig
|
|
640
|
+
);
|
|
641
|
+
}
|
|
642
|
+
__name(sameFileSigs, "sameFileSigs");
|
|
643
|
+
function isEntryFresh(key, entry) {
|
|
644
|
+
const fp = entry.fingerprint;
|
|
645
|
+
return ideContextStore.get()?.workspaceState?.isTrusted === fp.ideTrust && realpathOr(key) === fp.realCwd && // homeDir guards the corner where nothing else moves: QWEN_HOME set (so
|
|
646
|
+
// settings paths don't follow HOME), no .env files anywhere, and the new
|
|
647
|
+
// home equals the workspace dir — which flips workspaceSettingsActive.
|
|
648
|
+
realpathOr(os.homedir()) === fp.homeDir && sameFileSigs(settingsFileSigs(key), fp.settingsFiles) && sameFileSigs(envFileSigs(entry.settings, key), fp.envFiles);
|
|
649
|
+
}
|
|
650
|
+
__name(isEntryFresh, "isEntryFresh");
|
|
651
|
+
function loadSettingsCached(workspaceDir) {
|
|
652
|
+
preResolveHomeEnvOverrides();
|
|
653
|
+
const key = path2.resolve(workspaceDir);
|
|
654
|
+
const entry = cache.get(key);
|
|
655
|
+
if (entry) {
|
|
656
|
+
let isFresh = false;
|
|
657
|
+
try {
|
|
658
|
+
isFresh = isEntryFresh(key, entry);
|
|
659
|
+
} catch (error) {
|
|
660
|
+
debugLogger2.warn(
|
|
661
|
+
`fingerprint check failed for ${key}; reloading:`,
|
|
662
|
+
error
|
|
663
|
+
);
|
|
664
|
+
}
|
|
665
|
+
if (isFresh) {
|
|
666
|
+
cache.delete(key);
|
|
667
|
+
cache.set(key, entry);
|
|
668
|
+
debugLogger2.debug(`hit ${key}`);
|
|
669
|
+
return entry.settings;
|
|
670
|
+
}
|
|
671
|
+
cache.delete(key);
|
|
672
|
+
}
|
|
673
|
+
debugLogger2.debug(`miss ${key}`);
|
|
674
|
+
let preLoadSigs;
|
|
675
|
+
try {
|
|
676
|
+
preLoadSigs = settingsFileSigs(key);
|
|
677
|
+
} catch (error) {
|
|
678
|
+
debugLogger2.warn(`pre-load signing failed for ${key}; not caching:`, error);
|
|
679
|
+
}
|
|
680
|
+
const settings = loadSettings(key);
|
|
681
|
+
if (preLoadSigs) {
|
|
682
|
+
try {
|
|
683
|
+
cache.set(key, {
|
|
684
|
+
settings,
|
|
685
|
+
fingerprint: {
|
|
686
|
+
settingsFiles: preLoadSigs,
|
|
687
|
+
// .env discovery needs the merged settings (trust), so it can only
|
|
688
|
+
// be signed after the load — see difference (2) in the module doc.
|
|
689
|
+
envFiles: envFileSigs(settings, key),
|
|
690
|
+
ideTrust: ideContextStore.get()?.workspaceState?.isTrusted,
|
|
691
|
+
realCwd: realpathOr(key),
|
|
692
|
+
homeDir: realpathOr(os.homedir())
|
|
693
|
+
}
|
|
694
|
+
});
|
|
695
|
+
if (cache.size > MAX_CACHE_ENTRIES) {
|
|
696
|
+
const oldest = cache.keys().next().value;
|
|
697
|
+
if (oldest !== void 0) {
|
|
698
|
+
cache.delete(oldest);
|
|
699
|
+
debugLogger2.debug(`evicted LRU entry ${oldest}`);
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
} catch (error) {
|
|
703
|
+
cache.delete(key);
|
|
704
|
+
debugLogger2.warn(`caching failed for ${key}; serving uncached:`, error);
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
return settings;
|
|
708
|
+
}
|
|
709
|
+
__name(loadSettingsCached, "loadSettingsCached");
|
|
710
|
+
|
|
711
|
+
// packages/cli/src/acp-integration/session/Session.ts
|
|
712
|
+
init_esbuild_shims();
|
|
713
|
+
import * as os2 from "node:os";
|
|
714
|
+
import * as path3 from "node:path";
|
|
573
715
|
|
|
574
716
|
// packages/cli/src/acp-integration/session/SubAgentTracker.ts
|
|
575
717
|
init_esbuild_shims();
|
|
@@ -751,7 +893,7 @@ function toPermissionOptions(confirmation, forceHideAlwaysAllow = false) {
|
|
|
751
893
|
__name(toPermissionOptions, "toPermissionOptions");
|
|
752
894
|
|
|
753
895
|
// packages/cli/src/acp-integration/session/SubAgentTracker.ts
|
|
754
|
-
var
|
|
896
|
+
var debugLogger3 = createDebugLogger("ACP_SUBAGENT_TRACKER");
|
|
755
897
|
var SubAgentTracker = class {
|
|
756
898
|
constructor(ctx, client, parentToolCallId, subagentType, onPermissionCancel) {
|
|
757
899
|
this.ctx = ctx;
|
|
@@ -811,7 +953,7 @@ var SubAgentTracker = class {
|
|
|
811
953
|
try {
|
|
812
954
|
invocation = tool.build(event.args);
|
|
813
955
|
} catch (e) {
|
|
814
|
-
|
|
956
|
+
debugLogger3.warn(`Failed to build subagent tool ${event.name}:`, e);
|
|
815
957
|
}
|
|
816
958
|
}
|
|
817
959
|
this.toolStates.set(event.callId, {
|
|
@@ -890,7 +1032,7 @@ var SubAgentTracker = class {
|
|
|
890
1032
|
this.onPermissionCancel?.();
|
|
891
1033
|
}
|
|
892
1034
|
} catch (error) {
|
|
893
|
-
|
|
1035
|
+
debugLogger3.error(
|
|
894
1036
|
`Permission request failed for subagent tool ${event.name}:`,
|
|
895
1037
|
error
|
|
896
1038
|
);
|
|
@@ -898,7 +1040,7 @@ var SubAgentTracker = class {
|
|
|
898
1040
|
try {
|
|
899
1041
|
await event.respond("cancel" /* Cancel */);
|
|
900
1042
|
} catch (respondError) {
|
|
901
|
-
|
|
1043
|
+
debugLogger3.error(
|
|
902
1044
|
`Failed to cancel subagent tool ${event.name} after permission request failure:`,
|
|
903
1045
|
respondError
|
|
904
1046
|
);
|
|
@@ -996,8 +1138,8 @@ var TurnBuffer = class {
|
|
|
996
1138
|
// packages/cli/src/acp-integration/session/rewrite/LlmRewriter.ts
|
|
997
1139
|
init_esbuild_shims();
|
|
998
1140
|
import { readFileSync, existsSync } from "node:fs";
|
|
999
|
-
import { resolve } from "node:path";
|
|
1000
|
-
var
|
|
1141
|
+
import { resolve as resolve2 } from "node:path";
|
|
1142
|
+
var debugLogger4 = createDebugLogger("MESSAGE_REWRITER");
|
|
1001
1143
|
var DEFAULT_REWRITE_PROMPT = `You are an assistant that rewrites raw coding-agent output into concise, user-friendly progress updates.
|
|
1002
1144
|
|
|
1003
1145
|
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.
|
|
@@ -1023,14 +1165,14 @@ var LlmRewriter = class {
|
|
|
1023
1165
|
this.rewriteModel = rewriteConfig.model || void 0;
|
|
1024
1166
|
this.contextTurns = rewriteConfig.contextTurns === "all" ? Infinity : rewriteConfig.contextTurns ?? 1;
|
|
1025
1167
|
if (rewriteConfig.promptFile) {
|
|
1026
|
-
const filePath =
|
|
1168
|
+
const filePath = resolve2(rewriteConfig.promptFile);
|
|
1027
1169
|
if (existsSync(filePath)) {
|
|
1028
1170
|
this.prompt = readFileSync(filePath, "utf-8").trim();
|
|
1029
|
-
|
|
1171
|
+
debugLogger4.info(
|
|
1030
1172
|
`Loaded rewrite prompt from file: ${filePath} (${this.prompt.length} chars)`
|
|
1031
1173
|
);
|
|
1032
1174
|
} else {
|
|
1033
|
-
|
|
1175
|
+
debugLogger4.warn(
|
|
1034
1176
|
`Rewrite prompt file not found: ${filePath}, using default`
|
|
1035
1177
|
);
|
|
1036
1178
|
this.prompt = DEFAULT_REWRITE_PROMPT;
|
|
@@ -1067,7 +1209,7 @@ var LlmRewriter = class {
|
|
|
1067
1209
|
const inputText = inputParts.join("\n\n");
|
|
1068
1210
|
if (!inputText.trim()) return null;
|
|
1069
1211
|
if (inputText.length < 10) return null;
|
|
1070
|
-
|
|
1212
|
+
debugLogger4.info(
|
|
1071
1213
|
`[REWRITE INPUT] system_prompt_len=${this.prompt.length} input_len=${inputText.length} context_turns=${this.outputHistory.length}
|
|
1072
1214
|
--- INPUT TEXT ---
|
|
1073
1215
|
${inputText}
|
|
@@ -1096,10 +1238,10 @@ ${inputText}
|
|
|
1096
1238
|
});
|
|
1097
1239
|
const rewritten = result.text;
|
|
1098
1240
|
if (!rewritten || rewritten.length < 5) {
|
|
1099
|
-
|
|
1241
|
+
debugLogger4.info(`[REWRITE OUTPUT] empty or too short, skipping`);
|
|
1100
1242
|
return null;
|
|
1101
1243
|
}
|
|
1102
|
-
|
|
1244
|
+
debugLogger4.info(
|
|
1103
1245
|
`[REWRITE OUTPUT] len=${rewritten.length}
|
|
1104
1246
|
--- OUTPUT ---
|
|
1105
1247
|
${rewritten}
|
|
@@ -1108,7 +1250,7 @@ ${rewritten}
|
|
|
1108
1250
|
this.outputHistory.push(rewritten);
|
|
1109
1251
|
return rewritten;
|
|
1110
1252
|
} catch (error) {
|
|
1111
|
-
|
|
1253
|
+
debugLogger4.warn(
|
|
1112
1254
|
`LLM rewrite failed, skipping: ${error instanceof Error ? error.message : String(error)}`
|
|
1113
1255
|
);
|
|
1114
1256
|
return null;
|
|
@@ -1117,7 +1259,7 @@ ${rewritten}
|
|
|
1117
1259
|
};
|
|
1118
1260
|
|
|
1119
1261
|
// packages/cli/src/acp-integration/session/rewrite/MessageRewriteMiddleware.ts
|
|
1120
|
-
var
|
|
1262
|
+
var debugLogger5 = createDebugLogger("MESSAGE_REWRITE");
|
|
1121
1263
|
var DEFAULT_REWRITE_TIMEOUT_MS = 3e4;
|
|
1122
1264
|
var REWRITE_META_EXCLUDED_KEYS = /* @__PURE__ */ new Set([]);
|
|
1123
1265
|
var MessageRewriteMiddleware = class {
|
|
@@ -1197,10 +1339,10 @@ var MessageRewriteMiddleware = class {
|
|
|
1197
1339
|
try {
|
|
1198
1340
|
const rewritten = await this.rewriter.rewrite(content, rewriteSignal);
|
|
1199
1341
|
if (!rewritten) {
|
|
1200
|
-
|
|
1342
|
+
debugLogger5.info(`Turn ${turnIdx}: no rewrite output`);
|
|
1201
1343
|
return;
|
|
1202
1344
|
}
|
|
1203
|
-
|
|
1345
|
+
debugLogger5.info(
|
|
1204
1346
|
`Turn ${turnIdx}: rewritten ${rewritten.length} chars`
|
|
1205
1347
|
);
|
|
1206
1348
|
await this.sendUpdate({
|
|
@@ -1213,7 +1355,7 @@ var MessageRewriteMiddleware = class {
|
|
|
1213
1355
|
}
|
|
1214
1356
|
});
|
|
1215
1357
|
} catch (error) {
|
|
1216
|
-
|
|
1358
|
+
debugLogger5.warn(
|
|
1217
1359
|
`Turn ${turnIdx}: rewrite failed: ${error instanceof Error ? error.message : String(error)}`
|
|
1218
1360
|
);
|
|
1219
1361
|
}
|
|
@@ -1258,7 +1400,7 @@ function loadRewriteConfig(settings) {
|
|
|
1258
1400
|
__name(loadRewriteConfig, "loadRewriteConfig");
|
|
1259
1401
|
|
|
1260
1402
|
// packages/cli/src/acp-integration/session/Session.ts
|
|
1261
|
-
var
|
|
1403
|
+
var debugLogger6 = createDebugLogger("SESSION");
|
|
1262
1404
|
var USER_CANCEL_ABORT_REASON = "qwen:user-cancel";
|
|
1263
1405
|
var DAEMON_RETRY_META_KEY = "qwen.daemon.retry";
|
|
1264
1406
|
var DAEMON_CONTINUE_META_KEY = "qwen.daemon.continueLastTurn";
|
|
@@ -1269,7 +1411,6 @@ function maskApiKeyForDisplay(apiKey) {
|
|
|
1269
1411
|
return `${trimmed.slice(0, 3)}...${trimmed.slice(-4)}`;
|
|
1270
1412
|
}
|
|
1271
1413
|
__name(maskApiKeyForDisplay, "maskApiKeyForDisplay");
|
|
1272
|
-
var DAEMON_TURN_TOOL_CALL_CAP = 100;
|
|
1273
1414
|
var DAEMON_INVALID_TOOL_PARAMS_THRESHOLD = 3;
|
|
1274
1415
|
var PERMISSION_CANCEL_SKIP_MESSAGE = "Skipped because a permission request was cancelled before the user answered; user input is required before continuing.";
|
|
1275
1416
|
var LOOP_DETECTED_SKIP_MESSAGE = "Skipped because loop detection stopped the current turn before this tool call could run.";
|
|
@@ -1285,7 +1426,7 @@ __name(createDaemonToolLoopState, "createDaemonToolLoopState");
|
|
|
1285
1426
|
function recordDaemonLoopDetected(config, promptId, loopType, message, loopState) {
|
|
1286
1427
|
if (!loopState.loopDetected) {
|
|
1287
1428
|
loopState.loopDetected = true;
|
|
1288
|
-
|
|
1429
|
+
debugLogger6.warn(message);
|
|
1289
1430
|
logLoopDetected(config, new LoopDetectedEvent(loopType, promptId));
|
|
1290
1431
|
}
|
|
1291
1432
|
return true;
|
|
@@ -1295,7 +1436,7 @@ function recordDaemonToolCalls(config, promptId, loopState, count) {
|
|
|
1295
1436
|
if (!loopState || loopState.loopDetected)
|
|
1296
1437
|
return loopState?.loopDetected ?? false;
|
|
1297
1438
|
loopState.totalToolCalls += count;
|
|
1298
|
-
if (loopState.totalToolCalls <=
|
|
1439
|
+
if (loopState.totalToolCalls <= config.getMaxToolCallsPerTurn()) return false;
|
|
1299
1440
|
return recordDaemonLoopDetected(
|
|
1300
1441
|
config,
|
|
1301
1442
|
promptId,
|
|
@@ -1354,7 +1495,7 @@ function isContentBlock(value) {
|
|
|
1354
1495
|
case "resource":
|
|
1355
1496
|
return isEmbeddedResourceResource(value["resource"]);
|
|
1356
1497
|
default:
|
|
1357
|
-
|
|
1498
|
+
debugLogger6.warn(`Unknown ContentBlock type: ${value["type"]}`);
|
|
1358
1499
|
return false;
|
|
1359
1500
|
}
|
|
1360
1501
|
}
|
|
@@ -1393,7 +1534,7 @@ function hasInlineMediaContentBlock(content) {
|
|
|
1393
1534
|
__name(hasInlineMediaContentBlock, "hasInlineMediaContentBlock");
|
|
1394
1535
|
function capMidTurnDrainItems(items, fieldName) {
|
|
1395
1536
|
if (items.length <= MAX_MID_TURN_DRAIN_ITEMS) return items;
|
|
1396
|
-
|
|
1537
|
+
debugLogger6.warn(
|
|
1397
1538
|
`Mid-turn drain response had ${items.length} ${fieldName}; processing first ${MAX_MID_TURN_DRAIN_ITEMS}`
|
|
1398
1539
|
);
|
|
1399
1540
|
return items.slice(0, MAX_MID_TURN_DRAIN_ITEMS);
|
|
@@ -1408,7 +1549,7 @@ function getMidTurnItemDisplayTextForLog(displayText) {
|
|
|
1408
1549
|
__name(getMidTurnItemDisplayTextForLog, "getMidTurnItemDisplayTextForLog");
|
|
1409
1550
|
function getValidMidTurnContentBlocks(content, displayText) {
|
|
1410
1551
|
if (!Array.isArray(content)) {
|
|
1411
|
-
|
|
1552
|
+
debugLogger6.warn(
|
|
1412
1553
|
`Dropped invalid mid-turn item: ${getMidTurnItemDisplayTextForLog(
|
|
1413
1554
|
displayText
|
|
1414
1555
|
)}`
|
|
@@ -1418,7 +1559,7 @@ function getValidMidTurnContentBlocks(content, displayText) {
|
|
|
1418
1559
|
const validBlocks = content.filter(isContentBlock);
|
|
1419
1560
|
const invalidBlockCount = content.length - validBlocks.length;
|
|
1420
1561
|
if (invalidBlockCount > 0) {
|
|
1421
|
-
|
|
1562
|
+
debugLogger6.warn(
|
|
1422
1563
|
`Dropped ${invalidBlockCount} invalid mid-turn content block(s): ${getMidTurnItemDisplayTextForLog(
|
|
1423
1564
|
displayText
|
|
1424
1565
|
)}`
|
|
@@ -1464,7 +1605,7 @@ function parseMidTurnDrainResponse(response) {
|
|
|
1464
1605
|
);
|
|
1465
1606
|
}
|
|
1466
1607
|
if (!Array.isArray(response["messages"])) {
|
|
1467
|
-
|
|
1608
|
+
debugLogger6.warn(
|
|
1468
1609
|
`Mid-turn drain response had no recognized 'items' or 'messages' field; keys: ${Object.keys(
|
|
1469
1610
|
response
|
|
1470
1611
|
).join(", ")}`
|
|
@@ -1489,11 +1630,11 @@ var MidTurnDrainTimeoutError = class extends Error {
|
|
|
1489
1630
|
var MAX_NOTIFICATION_QUEUE = 20;
|
|
1490
1631
|
function resolveHomeLoopResolverRoots({
|
|
1491
1632
|
homeQwenDir = Storage.getGlobalQwenDir(),
|
|
1492
|
-
homeDir =
|
|
1633
|
+
homeDir = os2.homedir(),
|
|
1493
1634
|
qwenHome = process.env["QWEN_HOME"]
|
|
1494
1635
|
} = {}) {
|
|
1495
1636
|
return {
|
|
1496
|
-
homeConfineRoot: (qwenHome ? homeQwenDir : homeDir) ||
|
|
1637
|
+
homeConfineRoot: (qwenHome ? homeQwenDir : homeDir) || path3.dirname(homeQwenDir),
|
|
1497
1638
|
homeQwenDir
|
|
1498
1639
|
};
|
|
1499
1640
|
}
|
|
@@ -1532,7 +1673,7 @@ async function fireSessionPermissionDeniedForAutoMode(config, decision, outcome,
|
|
|
1532
1673
|
callId
|
|
1533
1674
|
);
|
|
1534
1675
|
} catch (hookError) {
|
|
1535
|
-
|
|
1676
|
+
debugLogger6.warn(
|
|
1536
1677
|
`PermissionDenied hook failed for tool ${callId}: ${hookError instanceof Error ? hookError.message : String(hookError)}`
|
|
1537
1678
|
);
|
|
1538
1679
|
}
|
|
@@ -1585,6 +1726,17 @@ function collectExtensionMentionRefs(text, mentions) {
|
|
|
1585
1726
|
}
|
|
1586
1727
|
}
|
|
1587
1728
|
__name(collectExtensionMentionRefs, "collectExtensionMentionRefs");
|
|
1729
|
+
function collectMcpServerMentionRefs(text, mentions) {
|
|
1730
|
+
for (const match of text.matchAll(AT_TOKEN_RE)) {
|
|
1731
|
+
const pathName = match[1];
|
|
1732
|
+
if (!pathName) continue;
|
|
1733
|
+
const ref = parseMcpServerRef(pathName);
|
|
1734
|
+
if (ref) {
|
|
1735
|
+
mentions.set(ref.name.toLowerCase(), ref.name);
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
__name(collectMcpServerMentionRefs, "collectMcpServerMentionRefs");
|
|
1588
1740
|
async function buildAvailableCommandsSnapshot(config, abortSignal = AbortSignal.timeout(1e4), settings) {
|
|
1589
1741
|
const slashCommands = await getAvailableCommands(
|
|
1590
1742
|
config,
|
|
@@ -1592,33 +1744,42 @@ async function buildAvailableCommandsSnapshot(config, abortSignal = AbortSignal.
|
|
|
1592
1744
|
"acp",
|
|
1593
1745
|
settings
|
|
1594
1746
|
);
|
|
1595
|
-
const
|
|
1596
|
-
|
|
1597
|
-
return
|
|
1598
|
-
|
|
1599
|
-
description: cmd.description,
|
|
1600
|
-
input: acceptsInput ? { hint: cmd.argumentHint ?? "" } : null,
|
|
1601
|
-
_meta: {
|
|
1602
|
-
argumentHint: cmd.argumentHint,
|
|
1603
|
-
source: cmd.source,
|
|
1604
|
-
sourceLabel: cmd.sourceLabel,
|
|
1605
|
-
supportedModes: getEffectiveSupportedModes(cmd),
|
|
1606
|
-
subcommands: getCommandSubcommandNames(cmd),
|
|
1607
|
-
modelInvocable: cmd.modelInvocable === true,
|
|
1608
|
-
// Carry aliases so a channel consumer (which only sees the wire snapshot,
|
|
1609
|
-
// not the command registry) can recognize an aliased command and avoid
|
|
1610
|
-
// tagging it. _meta is ACP's extension point; omitted when there are none
|
|
1611
|
-
// so command entries without aliases stay byte-identical on the wire.
|
|
1612
|
-
...cmd.altNames && cmd.altNames.length > 0 ? { altNames: cmd.altNames } : {}
|
|
1613
|
-
}
|
|
1614
|
-
};
|
|
1747
|
+
const disabledSkillNames = config.getDisabledSkillNames();
|
|
1748
|
+
const visibleSlashCommands = slashCommands.filter((cmd) => {
|
|
1749
|
+
if (cmd.kind !== "skill" /* SKILL */ || !cmd.skillDetail) return true;
|
|
1750
|
+
return !disabledSkillNames.has(cmd.skillDetail.name.toLowerCase());
|
|
1615
1751
|
});
|
|
1752
|
+
const availableCommands = visibleSlashCommands.map(
|
|
1753
|
+
(cmd) => {
|
|
1754
|
+
const acceptsInput = cmd.acceptsInput ?? (cmd.kind !== "built-in" /* BUILT_IN */ || cmd.completion != null || cmd.argumentHint != null || cmd.subCommands != null && cmd.subCommands.length > 0);
|
|
1755
|
+
return {
|
|
1756
|
+
name: cmd.name,
|
|
1757
|
+
description: cmd.description,
|
|
1758
|
+
input: acceptsInput ? { hint: cmd.argumentHint ?? "" } : null,
|
|
1759
|
+
_meta: {
|
|
1760
|
+
argumentHint: cmd.argumentHint,
|
|
1761
|
+
source: cmd.source,
|
|
1762
|
+
sourceLabel: cmd.sourceLabel,
|
|
1763
|
+
supportedModes: getEffectiveSupportedModes(cmd),
|
|
1764
|
+
subcommands: getCommandSubcommandNames(cmd),
|
|
1765
|
+
modelInvocable: cmd.modelInvocable === true,
|
|
1766
|
+
// Carry aliases so a channel consumer (which only sees the wire snapshot,
|
|
1767
|
+
// not the command registry) can recognize an aliased command and avoid
|
|
1768
|
+
// tagging it. _meta is ACP's extension point; omitted when there are none
|
|
1769
|
+
// so command entries without aliases stay byte-identical on the wire.
|
|
1770
|
+
...cmd.altNames && cmd.altNames.length > 0 ? { altNames: cmd.altNames } : {}
|
|
1771
|
+
}
|
|
1772
|
+
};
|
|
1773
|
+
}
|
|
1774
|
+
);
|
|
1616
1775
|
let availableSkills;
|
|
1617
1776
|
const skillDetailsByName = /* @__PURE__ */ new Map();
|
|
1618
1777
|
try {
|
|
1619
1778
|
const skillManager = config.getSkillManager();
|
|
1620
1779
|
if (skillManager) {
|
|
1621
|
-
const skills = await skillManager.listSkills()
|
|
1780
|
+
const skills = (await skillManager.listSkills()).filter(
|
|
1781
|
+
(skill) => !disabledSkillNames.has(skill.name.toLowerCase())
|
|
1782
|
+
);
|
|
1622
1783
|
availableSkills = skills.map((skill) => skill.name);
|
|
1623
1784
|
for (const skill of skills) {
|
|
1624
1785
|
skillDetailsByName.set(skill.name, {
|
|
@@ -1632,9 +1793,9 @@ async function buildAvailableCommandsSnapshot(config, abortSignal = AbortSignal.
|
|
|
1632
1793
|
}
|
|
1633
1794
|
}
|
|
1634
1795
|
} catch (error) {
|
|
1635
|
-
|
|
1796
|
+
debugLogger6.error("Error loading available skills:", error);
|
|
1636
1797
|
}
|
|
1637
|
-
for (const command of
|
|
1798
|
+
for (const command of visibleSlashCommands) {
|
|
1638
1799
|
if (command.kind !== "skill" /* SKILL */ || !command.skillDetail) {
|
|
1639
1800
|
continue;
|
|
1640
1801
|
}
|
|
@@ -1774,7 +1935,7 @@ var Session = class {
|
|
|
1774
1935
|
*/
|
|
1775
1936
|
startCronScheduler() {
|
|
1776
1937
|
this.#startCronSchedulerIfNeeded().catch((error) => {
|
|
1777
|
-
|
|
1938
|
+
debugLogger6.warn(
|
|
1778
1939
|
`Cron scheduler startup failed [session ${this.sessionId}]: ${error}`
|
|
1779
1940
|
);
|
|
1780
1941
|
});
|
|
@@ -1821,7 +1982,7 @@ var Session = class {
|
|
|
1821
1982
|
installRewriter() {
|
|
1822
1983
|
const rewriteConfig = loadRewriteConfig(this.settings);
|
|
1823
1984
|
if (rewriteConfig?.enabled) {
|
|
1824
|
-
|
|
1985
|
+
debugLogger6.info("Message rewrite middleware enabled");
|
|
1825
1986
|
this.messageRewriter = new MessageRewriteMiddleware(
|
|
1826
1987
|
this.config,
|
|
1827
1988
|
rewriteConfig,
|
|
@@ -1832,7 +1993,7 @@ var Session = class {
|
|
|
1832
1993
|
#installGoalTerminalObserver() {
|
|
1833
1994
|
setGoalTerminalObserver(this.sessionId, (event) => {
|
|
1834
1995
|
void this.messageEmitter.emitGoalTerminal(event).catch((error) => {
|
|
1835
|
-
|
|
1996
|
+
debugLogger6.warn(
|
|
1836
1997
|
`Failed to emit goal terminal update: ${this.#formatError(error)}`
|
|
1837
1998
|
);
|
|
1838
1999
|
});
|
|
@@ -1840,7 +2001,7 @@ var Session = class {
|
|
|
1840
2001
|
}
|
|
1841
2002
|
emitGoalStatus(status) {
|
|
1842
2003
|
void this.messageEmitter.emitGoalStatus(status).catch((error) => {
|
|
1843
|
-
|
|
2004
|
+
debugLogger6.warn(
|
|
1844
2005
|
`Failed to emit goal status update: ${this.#formatError(error)}`
|
|
1845
2006
|
);
|
|
1846
2007
|
});
|
|
@@ -1849,11 +2010,14 @@ var Session = class {
|
|
|
1849
2010
|
* Replays conversation history to the client using modular components.
|
|
1850
2011
|
* Delegates to HistoryReplayer for consistent event emission.
|
|
1851
2012
|
*/
|
|
1852
|
-
|
|
2013
|
+
primeTurnFromHistory(records) {
|
|
1853
2014
|
this.turn = Math.max(
|
|
1854
2015
|
this.turn,
|
|
1855
2016
|
computeInitialTurnFromHistory(records, this.config.getSessionId())
|
|
1856
2017
|
);
|
|
2018
|
+
}
|
|
2019
|
+
async replayHistory(records) {
|
|
2020
|
+
this.primeTurnFromHistory(records);
|
|
1857
2021
|
await this.historyReplayer.replay(records);
|
|
1858
2022
|
}
|
|
1859
2023
|
rewindToTurn(targetTurnIndex, opts) {
|
|
@@ -2026,8 +2190,8 @@ var Session = class {
|
|
|
2026
2190
|
}
|
|
2027
2191
|
this.duplicateProviderToolCallResponseIds.clear();
|
|
2028
2192
|
let resolveCompletion;
|
|
2029
|
-
this.pendingPromptCompletion = new Promise((
|
|
2030
|
-
resolveCompletion =
|
|
2193
|
+
this.pendingPromptCompletion = new Promise((resolve4) => {
|
|
2194
|
+
resolveCompletion = resolve4;
|
|
2031
2195
|
});
|
|
2032
2196
|
try {
|
|
2033
2197
|
const result = await this.#executePrompt(params, pendingSend);
|
|
@@ -2109,7 +2273,7 @@ var Session = class {
|
|
|
2109
2273
|
const fullHistory = chat.getHistory(true);
|
|
2110
2274
|
const lastEntry = fullHistory[fullHistory.length - 1];
|
|
2111
2275
|
if (!lastEntry || lastEntry.role !== "model") {
|
|
2112
|
-
|
|
2276
|
+
debugLogger6.debug(
|
|
2113
2277
|
"Skipping followup suggestion: last history entry is not model"
|
|
2114
2278
|
);
|
|
2115
2279
|
return;
|
|
@@ -2145,9 +2309,9 @@ var Session = class {
|
|
|
2145
2309
|
}
|
|
2146
2310
|
} catch (error) {
|
|
2147
2311
|
if (ac.signal.aborted) {
|
|
2148
|
-
|
|
2312
|
+
debugLogger6.debug("Follow-up suggestion generation aborted");
|
|
2149
2313
|
} else {
|
|
2150
|
-
|
|
2314
|
+
debugLogger6.warn("Follow-up suggestion generation failed", error);
|
|
2151
2315
|
}
|
|
2152
2316
|
} finally {
|
|
2153
2317
|
if (this.followupAbort === ac) {
|
|
@@ -2199,7 +2363,7 @@ var Session = class {
|
|
|
2199
2363
|
this.#getCurrentChat().getHistory()
|
|
2200
2364
|
);
|
|
2201
2365
|
if (detection.kind === "none") {
|
|
2202
|
-
|
|
2366
|
+
debugLogger6.warn(
|
|
2203
2367
|
`[Session] continue ${promptId}: no interrupted turn on re-detection, nothing to continue`
|
|
2204
2368
|
);
|
|
2205
2369
|
logConversationFinishedEvent(
|
|
@@ -2291,10 +2455,10 @@ var Session = class {
|
|
|
2291
2455
|
this.config.getChatRecordingService()?.recordFileHistorySnapshot(latestSnapshot);
|
|
2292
2456
|
}
|
|
2293
2457
|
} catch (e) {
|
|
2294
|
-
|
|
2458
|
+
debugLogger6.error(`FileHistory: recordSnapshot failed: ${e}`);
|
|
2295
2459
|
}
|
|
2296
2460
|
} catch (e) {
|
|
2297
|
-
|
|
2461
|
+
debugLogger6.error(`FileHistory: makeSnapshot failed: ${e}`);
|
|
2298
2462
|
}
|
|
2299
2463
|
const systemReminders = await this.#buildInitialSystemReminders();
|
|
2300
2464
|
if (systemReminders.length > 0) {
|
|
@@ -2388,7 +2552,7 @@ ${this.pendingWorktreeNotice}
|
|
|
2388
2552
|
const hooksEnabledForStopFailure = !this.config.getDisableAllHooks?.();
|
|
2389
2553
|
if (hooksEnabledForStopFailure && hookSystem && this.config.hasHooksForEvent?.("StopFailure")) {
|
|
2390
2554
|
hookSystem.fireStopFailureEvent(errorType, errorMessage).catch((err) => {
|
|
2391
|
-
|
|
2555
|
+
debugLogger6.warn(`StopFailure hook failed: ${err}`);
|
|
2392
2556
|
});
|
|
2393
2557
|
}
|
|
2394
2558
|
if (errorStatus === 429) {
|
|
@@ -2523,7 +2687,7 @@ ${this.pendingWorktreeNotice}
|
|
|
2523
2687
|
warning
|
|
2524
2688
|
);
|
|
2525
2689
|
await this.messageEmitter.emitAgentMessage(warning);
|
|
2526
|
-
|
|
2690
|
+
debugLogger6.warn(warning);
|
|
2527
2691
|
return { stopReason: "end_turn" };
|
|
2528
2692
|
}
|
|
2529
2693
|
if (stopHookIterationCount > 1) {
|
|
@@ -2595,7 +2759,7 @@ ${this.pendingWorktreeNotice}
|
|
|
2595
2759
|
const hooksEnabledForStopFailure = !this.config.getDisableAllHooks?.();
|
|
2596
2760
|
if (hooksEnabledForStopFailure && hookSystem && this.config.hasHooksForEvent?.("StopFailure")) {
|
|
2597
2761
|
hookSystem.fireStopFailureEvent(errorType, errorMessage).catch((err) => {
|
|
2598
|
-
|
|
2762
|
+
debugLogger6.warn(`StopFailure hook failed: ${err}`);
|
|
2599
2763
|
});
|
|
2600
2764
|
}
|
|
2601
2765
|
if (errorStatus === 429) {
|
|
@@ -2680,16 +2844,16 @@ ${this.pendingWorktreeNotice}
|
|
|
2680
2844
|
}
|
|
2681
2845
|
} catch (compressionError) {
|
|
2682
2846
|
if (abortSignal.aborted || this.#isAbortError(compressionError)) {
|
|
2683
|
-
|
|
2847
|
+
debugLogger6.debug(`Auto-compression aborted for prompt ${promptId}`);
|
|
2684
2848
|
return { responseStream: null, stopReason: "cancelled" };
|
|
2685
2849
|
}
|
|
2686
|
-
|
|
2850
|
+
debugLogger6.warn(
|
|
2687
2851
|
`Auto-compression failed for prompt ${promptId}; proceeding without compression: ` + this.#formatError(compressionError)
|
|
2688
2852
|
);
|
|
2689
2853
|
}
|
|
2690
2854
|
}
|
|
2691
2855
|
if (abortSignal.aborted) {
|
|
2692
|
-
|
|
2856
|
+
debugLogger6.debug(`Auto-compression aborted for prompt ${promptId}`);
|
|
2693
2857
|
return { responseStream: null, stopReason: "cancelled" };
|
|
2694
2858
|
}
|
|
2695
2859
|
if (!compressionInfo) {
|
|
@@ -2699,7 +2863,7 @@ ${this.pendingWorktreeNotice}
|
|
|
2699
2863
|
if (sessionTokenLimit > 0) {
|
|
2700
2864
|
const lastPromptTokenCount = this.#getPostCompressionTokenCount(compressionInfo);
|
|
2701
2865
|
if (lastPromptTokenCount > sessionTokenLimit) {
|
|
2702
|
-
|
|
2866
|
+
debugLogger6.warn(
|
|
2703
2867
|
`Session token limit exceeded for prompt ${promptId}: ${lastPromptTokenCount} > ${sessionTokenLimit}. Send dropped.`
|
|
2704
2868
|
);
|
|
2705
2869
|
await this.#emitAgentDiagnosticMessageSafely(
|
|
@@ -2716,7 +2880,7 @@ ${this.pendingWorktreeNotice}
|
|
|
2716
2880
|
);
|
|
2717
2881
|
}
|
|
2718
2882
|
if (abortSignal.aborted) {
|
|
2719
|
-
|
|
2883
|
+
debugLogger6.debug(
|
|
2720
2884
|
`Send aborted after compression diagnostic for prompt ${promptId}`
|
|
2721
2885
|
);
|
|
2722
2886
|
return { responseStream: null, stopReason: "cancelled" };
|
|
@@ -2744,7 +2908,7 @@ ${this.pendingWorktreeNotice}
|
|
|
2744
2908
|
) ?? [];
|
|
2745
2909
|
const droppedParts = (message.parts?.length ?? 0) - functionResponseParts.length;
|
|
2746
2910
|
if (droppedParts > 0) {
|
|
2747
|
-
|
|
2911
|
+
debugLogger6.debug(
|
|
2748
2912
|
`Dropping ${droppedParts} non-functionResponse part(s) from unsent ACP message after send was skipped.`
|
|
2749
2913
|
);
|
|
2750
2914
|
}
|
|
@@ -2771,11 +2935,11 @@ ${this.pendingWorktreeNotice}
|
|
|
2771
2935
|
}
|
|
2772
2936
|
async #buildNextMessageAfterToolRun(toolRun, abortSignal) {
|
|
2773
2937
|
if (toolRun.loopDetected) {
|
|
2774
|
-
|
|
2938
|
+
debugLogger6.debug("Stopping ACP turn after daemon loop detection.");
|
|
2775
2939
|
return null;
|
|
2776
2940
|
}
|
|
2777
2941
|
if (toolRun.repeatedDuplicateProviderToolCall) {
|
|
2778
|
-
|
|
2942
|
+
debugLogger6.debug(
|
|
2779
2943
|
"Stopping ACP turn after dropping repeated duplicate provider tool-call response."
|
|
2780
2944
|
);
|
|
2781
2945
|
return null;
|
|
@@ -2853,7 +3017,7 @@ ${this.pendingWorktreeNotice}
|
|
|
2853
3017
|
try {
|
|
2854
3018
|
await this.#emitAgentDiagnosticMessage(text);
|
|
2855
3019
|
} catch (notifyError) {
|
|
2856
|
-
|
|
3020
|
+
debugLogger6.warn(`${failureContext}: ${this.#formatError(notifyError)}`);
|
|
2857
3021
|
}
|
|
2858
3022
|
}
|
|
2859
3023
|
async #emitAgentDiagnosticMessage(text) {
|
|
@@ -2902,7 +3066,7 @@ ${this.pendingWorktreeNotice}
|
|
|
2902
3066
|
if (isPermanentError) {
|
|
2903
3067
|
this.midTurnDrainUnavailable = true;
|
|
2904
3068
|
}
|
|
2905
|
-
|
|
3069
|
+
debugLogger6.warn(
|
|
2906
3070
|
`Mid-turn queue drain ${isPermanentError ? "permanently " : ""}unavailable [session ${this.sessionId}]: ${errorMessage}`
|
|
2907
3071
|
);
|
|
2908
3072
|
return this.#buildMidTurnParts(recovered, abortSignal);
|
|
@@ -2928,9 +3092,9 @@ ${this.pendingWorktreeNotice}
|
|
|
2928
3092
|
});
|
|
2929
3093
|
const expired = Symbol("mid-turn-recovery-expired");
|
|
2930
3094
|
let timer;
|
|
2931
|
-
const deadline = new Promise((
|
|
3095
|
+
const deadline = new Promise((resolve4) => {
|
|
2932
3096
|
timer = setTimeout(
|
|
2933
|
-
() =>
|
|
3097
|
+
() => resolve4(expired),
|
|
2934
3098
|
MID_TURN_QUEUE_RECOVERY_TIMEOUT_MS
|
|
2935
3099
|
);
|
|
2936
3100
|
timer.unref?.();
|
|
@@ -2944,14 +3108,14 @@ ${this.pendingWorktreeNotice}
|
|
|
2944
3108
|
clearTimeout(timer);
|
|
2945
3109
|
}
|
|
2946
3110
|
if (late === expired) {
|
|
2947
|
-
|
|
3111
|
+
debugLogger6.warn(
|
|
2948
3112
|
`[mid-turn] dropped a drain response that arrived after the ${MID_TURN_QUEUE_RECOVERY_TIMEOUT_MS}ms recovery deadline [session ${this.sessionId}]`
|
|
2949
3113
|
);
|
|
2950
3114
|
return;
|
|
2951
3115
|
}
|
|
2952
3116
|
const lateMessages = parseMidTurnDrainResponse(late);
|
|
2953
3117
|
if (lateMessages.length > 0) {
|
|
2954
|
-
|
|
3118
|
+
debugLogger6.debug(
|
|
2955
3119
|
`[mid-turn] recovered ${lateMessages.length} message(s) from a timed-out drain [session ${this.sessionId}]`
|
|
2956
3120
|
);
|
|
2957
3121
|
this.midTurnRecoveredMessages.push(...lateMessages);
|
|
@@ -2977,7 +3141,7 @@ ${this.pendingWorktreeNotice}
|
|
|
2977
3141
|
} catch (messageError) {
|
|
2978
3142
|
if (abortSignal.aborted) return parts;
|
|
2979
3143
|
const errorMessage = this.#formatError(messageError);
|
|
2980
|
-
|
|
3144
|
+
debugLogger6.warn(`Failed to resolve mid-turn message: ${errorMessage}`);
|
|
2981
3145
|
rawParts = [{ text: displayText }];
|
|
2982
3146
|
if (message.kind === "structured" && hasInlineMediaContentBlock(message.content)) {
|
|
2983
3147
|
rawParts.push({ text: MID_TURN_ATTACHMENT_PROCESSING_FAILURE_TEXT });
|
|
@@ -3002,7 +3166,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3002
3166
|
try {
|
|
3003
3167
|
await scheduler.enableDurable(this.sessionId);
|
|
3004
3168
|
} catch (err) {
|
|
3005
|
-
|
|
3169
|
+
debugLogger6.warn(
|
|
3006
3170
|
`Durable cron init failed \u2014 persistent tasks will not fire in this session: ${err}`
|
|
3007
3171
|
);
|
|
3008
3172
|
}
|
|
@@ -3031,8 +3195,8 @@ ${this.pendingWorktreeNotice}
|
|
|
3031
3195
|
if (this.notificationProcessing) return;
|
|
3032
3196
|
this.cronProcessing = true;
|
|
3033
3197
|
let resolveCompletion;
|
|
3034
|
-
this.cronCompletion = new Promise((
|
|
3035
|
-
resolveCompletion =
|
|
3198
|
+
this.cronCompletion = new Promise((resolve4) => {
|
|
3199
|
+
resolveCompletion = resolve4;
|
|
3036
3200
|
});
|
|
3037
3201
|
try {
|
|
3038
3202
|
while (this.cronQueue.length > 0) {
|
|
@@ -3113,7 +3277,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3113
3277
|
loopTick = await resolver.resolve(loopMode, trustedAtResolve);
|
|
3114
3278
|
} catch (resolveErr) {
|
|
3115
3279
|
const code = resolveErr.code ?? "unknown";
|
|
3116
|
-
|
|
3280
|
+
debugLogger6.warn(
|
|
3117
3281
|
`loop.md sentinel resolution failed (mode=${loopMode}, code=${code}) \u2014 check .qwen/loop.md permissions/IO`,
|
|
3118
3282
|
resolveErr
|
|
3119
3283
|
);
|
|
@@ -3136,7 +3300,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3136
3300
|
}
|
|
3137
3301
|
const modelText = loopTick ? loopTick.modelText : prompt;
|
|
3138
3302
|
if (loopTick) {
|
|
3139
|
-
|
|
3303
|
+
debugLogger6.debug(
|
|
3140
3304
|
`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}`
|
|
3141
3305
|
);
|
|
3142
3306
|
}
|
|
@@ -3244,7 +3408,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3244
3408
|
} catch (error) {
|
|
3245
3409
|
if (ac.signal.aborted) return;
|
|
3246
3410
|
cronHadError = true;
|
|
3247
|
-
|
|
3411
|
+
debugLogger6.error("Error processing cron prompt:", error);
|
|
3248
3412
|
const msg = error instanceof Error ? error.message : String(error);
|
|
3249
3413
|
await this.messageEmitter.emitAgentMessage(
|
|
3250
3414
|
`[${item.source} error] ${msg}`
|
|
@@ -3328,7 +3492,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3328
3492
|
#enqueueBackgroundNotification(item) {
|
|
3329
3493
|
while (this.notificationQueue.length >= MAX_NOTIFICATION_QUEUE) {
|
|
3330
3494
|
const evicted = this.notificationQueue.shift();
|
|
3331
|
-
|
|
3495
|
+
debugLogger6.warn(
|
|
3332
3496
|
`Notification queue overflow: evicting task=${evicted.taskId} kind=${evicted.kind}`
|
|
3333
3497
|
);
|
|
3334
3498
|
}
|
|
@@ -3344,8 +3508,8 @@ ${this.pendingWorktreeNotice}
|
|
|
3344
3508
|
if (this.notificationQueue.length === 0) return;
|
|
3345
3509
|
this.notificationProcessing = true;
|
|
3346
3510
|
let resolveCompletion;
|
|
3347
|
-
this.notificationCompletion = new Promise((
|
|
3348
|
-
resolveCompletion =
|
|
3511
|
+
this.notificationCompletion = new Promise((resolve4) => {
|
|
3512
|
+
resolveCompletion = resolve4;
|
|
3349
3513
|
});
|
|
3350
3514
|
try {
|
|
3351
3515
|
while (this.notificationQueue.length > 0) {
|
|
@@ -3490,14 +3654,14 @@ ${this.pendingWorktreeNotice}
|
|
|
3490
3654
|
await this.#emitBackgroundNotificationEndTurn("cancelled");
|
|
3491
3655
|
return;
|
|
3492
3656
|
}
|
|
3493
|
-
|
|
3657
|
+
debugLogger6.error("Error processing background notification:", error);
|
|
3494
3658
|
const msg = error instanceof Error ? error.message : String(error);
|
|
3495
3659
|
try {
|
|
3496
3660
|
await this.messageEmitter.emitAgentMessage(
|
|
3497
3661
|
`[notification error] ${msg}`
|
|
3498
3662
|
);
|
|
3499
3663
|
} catch (emitError) {
|
|
3500
|
-
|
|
3664
|
+
debugLogger6.error(
|
|
3501
3665
|
"Failed to emit background notification error:",
|
|
3502
3666
|
emitError
|
|
3503
3667
|
);
|
|
@@ -3557,7 +3721,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3557
3721
|
source: "background_notification"
|
|
3558
3722
|
});
|
|
3559
3723
|
} catch (error) {
|
|
3560
|
-
|
|
3724
|
+
debugLogger6.debug(
|
|
3561
3725
|
`Background notification end-turn extNotification dropped: ${this.#formatError(error)}`
|
|
3562
3726
|
);
|
|
3563
3727
|
}
|
|
@@ -3581,7 +3745,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3581
3745
|
};
|
|
3582
3746
|
await this.sendUpdate(update);
|
|
3583
3747
|
} catch (error) {
|
|
3584
|
-
|
|
3748
|
+
debugLogger6.error("Error sending available commands update:", error);
|
|
3585
3749
|
}
|
|
3586
3750
|
}
|
|
3587
3751
|
/**
|
|
@@ -3616,7 +3780,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3616
3780
|
sessionId: this.sessionId,
|
|
3617
3781
|
currentModeId: params.modeId
|
|
3618
3782
|
}).catch((error) => {
|
|
3619
|
-
|
|
3783
|
+
debugLogger6.debug("mode-update extNotification failed", error);
|
|
3620
3784
|
});
|
|
3621
3785
|
}
|
|
3622
3786
|
/**
|
|
@@ -3650,7 +3814,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3650
3814
|
sessionId: this.sessionId,
|
|
3651
3815
|
currentModelId: effectiveModelId
|
|
3652
3816
|
}).catch((error) => {
|
|
3653
|
-
|
|
3817
|
+
debugLogger6.debug("model-update extNotification failed", error);
|
|
3654
3818
|
});
|
|
3655
3819
|
if (options.persistDefault ?? true) {
|
|
3656
3820
|
const persistScope = getPersistScopeForModelSelection(this.settings);
|
|
@@ -3703,7 +3867,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3703
3867
|
currentModeId: newModeId,
|
|
3704
3868
|
legacyFrameSent: true
|
|
3705
3869
|
}).catch((error) => {
|
|
3706
|
-
|
|
3870
|
+
debugLogger6.debug("mode-update extNotification failed", error);
|
|
3707
3871
|
});
|
|
3708
3872
|
}
|
|
3709
3873
|
/**
|
|
@@ -3748,7 +3912,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3748
3912
|
}
|
|
3749
3913
|
await this.toolCallEmitter.emitError(callId, toolName, error);
|
|
3750
3914
|
} catch (recordError) {
|
|
3751
|
-
|
|
3915
|
+
debugLogger6.error("Failed to record skipped tool call:", recordError);
|
|
3752
3916
|
}
|
|
3753
3917
|
return part;
|
|
3754
3918
|
}, "recordSkippedToolCall");
|
|
@@ -3780,7 +3944,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3780
3944
|
);
|
|
3781
3945
|
if (repeatedDuplicateCall) {
|
|
3782
3946
|
const providerCallId = getProviderToolCallId(repeatedDuplicateCall) ?? repeatedDuplicateCall.id;
|
|
3783
|
-
|
|
3947
|
+
debugLogger6.debug(
|
|
3784
3948
|
`[Session.runToolCalls] Dropping batch after repeated duplicate provider tool-call id: ${providerCallId} (tool: ${repeatedDuplicateCall.name ?? "unknown_tool"})`
|
|
3785
3949
|
);
|
|
3786
3950
|
return {
|
|
@@ -3796,7 +3960,7 @@ ${this.pendingWorktreeNotice}
|
|
|
3796
3960
|
this.duplicateProviderToolCallResponseIds
|
|
3797
3961
|
);
|
|
3798
3962
|
const response = createDuplicateProviderToolCallResponse(request);
|
|
3799
|
-
|
|
3963
|
+
debugLogger6.debug(
|
|
3800
3964
|
`[Session.runToolCalls] Suppressing duplicate provider tool-call id: ${providerCallId} (tool: ${request.name})`
|
|
3801
3965
|
);
|
|
3802
3966
|
batches.push({ kind: "duplicate", request, response });
|
|
@@ -4301,7 +4465,7 @@ ${this.pendingWorktreeNotice}
|
|
|
4301
4465
|
forceAutoReviewForAllow
|
|
4302
4466
|
);
|
|
4303
4467
|
if (finalPermission === "allow" && forceAutoReviewForAllow) {
|
|
4304
|
-
|
|
4468
|
+
debugLogger6.info(
|
|
4305
4469
|
`Auto mode: L4 allow overridden by protected-write guard for ${toolName}`
|
|
4306
4470
|
);
|
|
4307
4471
|
}
|
|
@@ -4344,7 +4508,7 @@ ${this.pendingWorktreeNotice}
|
|
|
4344
4508
|
autoModeAllowed = true;
|
|
4345
4509
|
break;
|
|
4346
4510
|
case "blocked":
|
|
4347
|
-
|
|
4511
|
+
debugLogger6.warn(
|
|
4348
4512
|
`Auto mode blocked (${outcome.reason}): tool=${toolName}, ` + formatDenialStateLog(denialState)
|
|
4349
4513
|
);
|
|
4350
4514
|
return earlyErrorResponse(
|
|
@@ -4356,7 +4520,7 @@ ${this.pendingWorktreeNotice}
|
|
|
4356
4520
|
outcome.reason
|
|
4357
4521
|
);
|
|
4358
4522
|
if (wasAutoModeDenialFallback) {
|
|
4359
|
-
|
|
4523
|
+
debugLogger6.warn(
|
|
4360
4524
|
`Auto mode fallback to manual approval (${outcome.reason}): ` + formatDenialStateLog(denialState)
|
|
4361
4525
|
);
|
|
4362
4526
|
}
|
|
@@ -4374,12 +4538,12 @@ ${this.pendingWorktreeNotice}
|
|
|
4374
4538
|
const before = this.config.getAutoModeDenialState();
|
|
4375
4539
|
const after = recordFallbackApprove(before);
|
|
4376
4540
|
if (after === before) {
|
|
4377
|
-
|
|
4541
|
+
debugLogger6.warn(
|
|
4378
4542
|
`Auto mode denial counters already clear after fallback approval: ` + formatDenialStateLog(before)
|
|
4379
4543
|
);
|
|
4380
4544
|
return;
|
|
4381
4545
|
}
|
|
4382
|
-
|
|
4546
|
+
debugLogger6.warn(
|
|
4383
4547
|
`Auto mode denial counters reset after fallback approval: ${formatDenialStateLog(before)} -> ${formatDenialStateLog(after)}`
|
|
4384
4548
|
);
|
|
4385
4549
|
this.config.setAutoModeDenialState(after);
|
|
@@ -4485,7 +4649,7 @@ ${this.pendingWorktreeNotice}
|
|
|
4485
4649
|
);
|
|
4486
4650
|
outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
4487
4651
|
} catch (error) {
|
|
4488
|
-
|
|
4652
|
+
debugLogger6.error(
|
|
4489
4653
|
`Permission request failed for tool ${toolName}:`,
|
|
4490
4654
|
error
|
|
4491
4655
|
);
|
|
@@ -4494,7 +4658,7 @@ ${this.pendingWorktreeNotice}
|
|
|
4494
4658
|
"cancel" /* Cancel */
|
|
4495
4659
|
);
|
|
4496
4660
|
} catch (confirmError) {
|
|
4497
|
-
|
|
4661
|
+
debugLogger6.error(
|
|
4498
4662
|
`Failed to cancel tool ${toolName} after permission request failure:`,
|
|
4499
4663
|
confirmError
|
|
4500
4664
|
);
|
|
@@ -4519,7 +4683,7 @@ ${this.pendingWorktreeNotice}
|
|
|
4519
4683
|
if (outcome !== "cancel" /* Cancel */) {
|
|
4520
4684
|
throw error;
|
|
4521
4685
|
}
|
|
4522
|
-
|
|
4686
|
+
debugLogger6.error(
|
|
4523
4687
|
`Failed to confirm cancellation for tool ${toolName}:`,
|
|
4524
4688
|
error
|
|
4525
4689
|
);
|
|
@@ -4589,7 +4753,7 @@ ${this.pendingWorktreeNotice}
|
|
|
4589
4753
|
return earlyErrorResponse(new Error(blockReason), toolName);
|
|
4590
4754
|
}
|
|
4591
4755
|
if (preHookResult.additionalContext) {
|
|
4592
|
-
|
|
4756
|
+
debugLogger6.debug(
|
|
4593
4757
|
`PreToolUse hook additional context for ${toolName}: ${preHookResult.additionalContext}`
|
|
4594
4758
|
);
|
|
4595
4759
|
}
|
|
@@ -4635,6 +4799,7 @@ ${this.pendingWorktreeNotice}
|
|
|
4635
4799
|
const aborted = activeToolAbortSignal.aborted;
|
|
4636
4800
|
const status = aborted ? "cancelled" : toolResult.error ? "error" : "success";
|
|
4637
4801
|
const succeeded = status === "success";
|
|
4802
|
+
const responseError = toolResult.error ? new Error(toolResult.error.message) : aborted ? new Error("Tool execution was cancelled") : void 0;
|
|
4638
4803
|
if (hooksEnabledForTool && messageBusForTool && !toolResult.error && !aborted && !nestedPermissionCancelled) {
|
|
4639
4804
|
const toolResponse = {
|
|
4640
4805
|
llmContent: toolResult.llmContent,
|
|
@@ -4652,7 +4817,7 @@ ${this.pendingWorktreeNotice}
|
|
|
4652
4817
|
);
|
|
4653
4818
|
if (postHookResult.shouldStop) {
|
|
4654
4819
|
const stopMessage = postHookResult.stopReason || "Execution stopped by PostToolUse hook";
|
|
4655
|
-
|
|
4820
|
+
debugLogger6.info(
|
|
4656
4821
|
`PostToolUse hook requested stop for ${toolName}: ${stopMessage}`
|
|
4657
4822
|
);
|
|
4658
4823
|
return earlyErrorResponse(new Error(stopMessage), toolName);
|
|
@@ -4661,6 +4826,12 @@ ${this.pendingWorktreeNotice}
|
|
|
4661
4826
|
const contextPart = { text: postHookResult.additionalContext };
|
|
4662
4827
|
responseParts.push(contextPart);
|
|
4663
4828
|
}
|
|
4829
|
+
await this.emitHookArtifactsNotification({
|
|
4830
|
+
hookEventName: "PostToolUse",
|
|
4831
|
+
toolName,
|
|
4832
|
+
toolCallId: callId,
|
|
4833
|
+
artifacts: postHookResult.artifacts
|
|
4834
|
+
});
|
|
4664
4835
|
} else if (hooksEnabledForTool && messageBusForTool && (toolResult.error || aborted)) {
|
|
4665
4836
|
const isInterrupt = aborted;
|
|
4666
4837
|
const failureHookResult = await firePostToolUseFailureHook(
|
|
@@ -4675,10 +4846,16 @@ ${this.pendingWorktreeNotice}
|
|
|
4675
4846
|
callId
|
|
4676
4847
|
);
|
|
4677
4848
|
if (failureHookResult.additionalContext) {
|
|
4678
|
-
|
|
4849
|
+
debugLogger6.debug(
|
|
4679
4850
|
`PostToolUseFailure hook additional context for ${toolName}: ${failureHookResult.additionalContext}`
|
|
4680
4851
|
);
|
|
4681
4852
|
}
|
|
4853
|
+
await this.emitHookArtifactsNotification({
|
|
4854
|
+
hookEventName: "PostToolUseFailure",
|
|
4855
|
+
toolName,
|
|
4856
|
+
toolCallId: callId,
|
|
4857
|
+
artifacts: failureHookResult.artifacts
|
|
4858
|
+
});
|
|
4682
4859
|
}
|
|
4683
4860
|
if (isTodoWriteTool) {
|
|
4684
4861
|
const todos = this.planEmitter.extractTodos(
|
|
@@ -4689,15 +4866,15 @@ ${this.pendingWorktreeNotice}
|
|
|
4689
4866
|
await this.planEmitter.emitPlan(todos ?? []);
|
|
4690
4867
|
}
|
|
4691
4868
|
} else {
|
|
4692
|
-
const error = toolResult.error ? new Error(toolResult.error.message) : aborted ? new Error("Tool execution was cancelled") : void 0;
|
|
4693
4869
|
await this.toolCallEmitter.emitResult({
|
|
4694
4870
|
callId,
|
|
4695
4871
|
toolName,
|
|
4696
4872
|
args,
|
|
4697
4873
|
message: responseParts,
|
|
4698
4874
|
resultDisplay: toolResult.returnDisplay,
|
|
4699
|
-
error,
|
|
4700
|
-
success: succeeded
|
|
4875
|
+
error: responseError,
|
|
4876
|
+
success: succeeded,
|
|
4877
|
+
artifacts: toolResult.artifacts
|
|
4701
4878
|
});
|
|
4702
4879
|
}
|
|
4703
4880
|
const durationMs = Date.now() - startTime;
|
|
@@ -4751,10 +4928,16 @@ ${this.pendingWorktreeNotice}
|
|
|
4751
4928
|
callId
|
|
4752
4929
|
);
|
|
4753
4930
|
if (failureHookResult.additionalContext) {
|
|
4754
|
-
|
|
4931
|
+
debugLogger6.debug(
|
|
4755
4932
|
`PostToolUseFailure hook additional context for ${toolName}: ${failureHookResult.additionalContext}`
|
|
4756
4933
|
);
|
|
4757
4934
|
}
|
|
4935
|
+
await this.emitHookArtifactsNotification({
|
|
4936
|
+
hookEventName: "PostToolUseFailure",
|
|
4937
|
+
toolName,
|
|
4938
|
+
toolCallId: callId,
|
|
4939
|
+
artifacts: failureHookResult.artifacts
|
|
4940
|
+
});
|
|
4758
4941
|
}
|
|
4759
4942
|
await this.toolCallEmitter.emitError(callId, toolName, error);
|
|
4760
4943
|
const errorParts = [
|
|
@@ -4782,8 +4965,9 @@ ${this.pendingWorktreeNotice}
|
|
|
4782
4965
|
toolName,
|
|
4783
4966
|
error
|
|
4784
4967
|
);
|
|
4968
|
+
const responseParts = errorResponse(error);
|
|
4785
4969
|
return {
|
|
4786
|
-
parts:
|
|
4970
|
+
parts: responseParts,
|
|
4787
4971
|
stopAfterPermissionCancel: nestedPermissionCancelled,
|
|
4788
4972
|
loopDetected
|
|
4789
4973
|
};
|
|
@@ -4895,6 +5079,7 @@ ${this.pendingWorktreeNotice}
|
|
|
4895
5079
|
const FILE_URI_SCHEME = "file://";
|
|
4896
5080
|
const embeddedContext = [];
|
|
4897
5081
|
const extensionMentions = /* @__PURE__ */ new Map();
|
|
5082
|
+
const mcpServerMentions = /* @__PURE__ */ new Map();
|
|
4898
5083
|
const preserveUnsupportedImageForBridge = shouldRunVisionBridge(
|
|
4899
5084
|
this.config
|
|
4900
5085
|
);
|
|
@@ -4902,6 +5087,7 @@ ${this.pendingWorktreeNotice}
|
|
|
4902
5087
|
switch (part.type) {
|
|
4903
5088
|
case "text":
|
|
4904
5089
|
collectExtensionMentionRefs(part.text, extensionMentions);
|
|
5090
|
+
collectMcpServerMentionRefs(part.text, mcpServerMentions);
|
|
4905
5091
|
return { text: part.text };
|
|
4906
5092
|
case "image":
|
|
4907
5093
|
if (preserveUnsupportedImageForBridge) {
|
|
@@ -4953,12 +5139,13 @@ ${this.pendingWorktreeNotice}
|
|
|
4953
5139
|
extensionMentions,
|
|
4954
5140
|
abortSignal
|
|
4955
5141
|
);
|
|
4956
|
-
|
|
5142
|
+
const mcpServerParts = this.#resolveMcpServerMentionParts(mcpServerMentions);
|
|
5143
|
+
if (atPathCommandParts.length === 0 && embeddedContext.length === 0 && extensionParts.length === 0 && mcpServerParts.length === 0) {
|
|
4957
5144
|
return this.#applyVisionBridgeIfNeeded(parts, abortSignal);
|
|
4958
5145
|
}
|
|
4959
5146
|
if (atPathCommandParts.length === 0 && embeddedContext.length === 0) {
|
|
4960
5147
|
return this.#applyVisionBridgeIfNeeded(
|
|
4961
|
-
[...parts, ...extensionParts],
|
|
5148
|
+
[...parts, ...extensionParts, ...mcpServerParts],
|
|
4962
5149
|
abortSignal
|
|
4963
5150
|
);
|
|
4964
5151
|
}
|
|
@@ -4988,6 +5175,7 @@ ${this.pendingWorktreeNotice}
|
|
|
4988
5175
|
const contentParts = Array.isArray(readResult.contentParts) ? readResult.contentParts : [readResult.contentParts];
|
|
4989
5176
|
processedQueryParts.push({ text: initialQueryText });
|
|
4990
5177
|
processedQueryParts.push(...extensionParts);
|
|
5178
|
+
processedQueryParts.push(...mcpServerParts);
|
|
4991
5179
|
for (const part of contentParts) {
|
|
4992
5180
|
if (typeof part === "string") {
|
|
4993
5181
|
processedQueryParts.push({ text: part });
|
|
@@ -5000,6 +5188,7 @@ ${this.pendingWorktreeNotice}
|
|
|
5000
5188
|
} else {
|
|
5001
5189
|
processedQueryParts.push({ text: initialQueryText.trim() });
|
|
5002
5190
|
processedQueryParts.push(...extensionParts);
|
|
5191
|
+
processedQueryParts.push(...mcpServerParts);
|
|
5003
5192
|
}
|
|
5004
5193
|
for (const contextPart of embeddedContext) {
|
|
5005
5194
|
if ("text" in contextPart && contextPart.text) {
|
|
@@ -5028,19 +5217,19 @@ ${contextPart.text}`
|
|
|
5028
5217
|
}
|
|
5029
5218
|
let bridgeResult;
|
|
5030
5219
|
try {
|
|
5031
|
-
|
|
5220
|
+
debugLogger6.debug("vision bridge: gate matched, running conversion");
|
|
5032
5221
|
bridgeResult = await runVisionBridge({
|
|
5033
5222
|
config: this.config,
|
|
5034
5223
|
parts,
|
|
5035
5224
|
signal: abortSignal
|
|
5036
5225
|
});
|
|
5037
5226
|
} catch (error) {
|
|
5038
|
-
|
|
5227
|
+
debugLogger6.debug(
|
|
5039
5228
|
`vision bridge: failed before replacement; falling back to text-only parts error=${String(error instanceof Error ? error.message : error)}`
|
|
5040
5229
|
);
|
|
5041
5230
|
return splitImageParts(parts).nonImageParts;
|
|
5042
5231
|
}
|
|
5043
|
-
|
|
5232
|
+
debugLogger6.debug(
|
|
5044
5233
|
`vision bridge: status=${bridgeResult.status} applied=${bridgeResult.applied} model=${bridgeResult.modelId ?? "(none)"}${bridgeResult.error ? ` error=${bridgeResult.error}` : ""}`
|
|
5045
5234
|
);
|
|
5046
5235
|
if (bridgeResult.status !== "skipped" || bridgeResult.egressOccurred) {
|
|
@@ -5049,13 +5238,13 @@ ${contextPart.text}`
|
|
|
5049
5238
|
this.#formatVisionBridgeNotice(bridgeResult)
|
|
5050
5239
|
);
|
|
5051
5240
|
} catch (error) {
|
|
5052
|
-
|
|
5241
|
+
debugLogger6.debug(
|
|
5053
5242
|
`vision bridge: failed to emit notice; continuing with bridge result error=${String(error instanceof Error ? error.message : error)}`
|
|
5054
5243
|
);
|
|
5055
5244
|
}
|
|
5056
5245
|
}
|
|
5057
5246
|
if (abortSignal.aborted) {
|
|
5058
|
-
|
|
5247
|
+
debugLogger6.debug("vision bridge: turn aborted after bridge returned");
|
|
5059
5248
|
return splitImageParts(parts).nonImageParts;
|
|
5060
5249
|
}
|
|
5061
5250
|
if (bridgeResult.applied && bridgeResult.parts != null) {
|
|
@@ -5104,9 +5293,48 @@ ${contextPart.text}`
|
|
|
5104
5293
|
}
|
|
5105
5294
|
return extensionParts;
|
|
5106
5295
|
}
|
|
5296
|
+
#resolveMcpServerMentionParts(mcpServerMentions) {
|
|
5297
|
+
if (mcpServerMentions.size === 0) return [];
|
|
5298
|
+
const servers = this.config.getMcpServers?.() ?? {};
|
|
5299
|
+
if (Object.keys(servers).length === 0) return [];
|
|
5300
|
+
const parts = [];
|
|
5301
|
+
for (const name of mcpServerMentions.values()) {
|
|
5302
|
+
const matched = matchMcpServerByRef(name, servers);
|
|
5303
|
+
if (!matched) {
|
|
5304
|
+
this.debug(
|
|
5305
|
+
`MCP server "${name}" not found among configured MCP servers. Available: ${Object.keys(servers).join(", ") || "(none)"}`
|
|
5306
|
+
);
|
|
5307
|
+
continue;
|
|
5308
|
+
}
|
|
5309
|
+
parts.push({
|
|
5310
|
+
text: buildMcpServerContextText(this.config, matched.serverName)
|
|
5311
|
+
});
|
|
5312
|
+
}
|
|
5313
|
+
return parts;
|
|
5314
|
+
}
|
|
5107
5315
|
debug(msg) {
|
|
5108
5316
|
if (this.config.getDebugMode()) {
|
|
5109
|
-
|
|
5317
|
+
debugLogger6.warn(msg);
|
|
5318
|
+
}
|
|
5319
|
+
}
|
|
5320
|
+
async emitHookArtifactsNotification(args) {
|
|
5321
|
+
if (!args.artifacts || args.artifacts.length === 0) {
|
|
5322
|
+
return;
|
|
5323
|
+
}
|
|
5324
|
+
try {
|
|
5325
|
+
await this.client.extNotification("qwen/notify/session/artifact-event", {
|
|
5326
|
+
v: 1,
|
|
5327
|
+
sessionId: this.sessionId,
|
|
5328
|
+
source: "hook",
|
|
5329
|
+
hookEventName: args.hookEventName,
|
|
5330
|
+
toolName: args.toolName,
|
|
5331
|
+
toolCallId: args.toolCallId,
|
|
5332
|
+
artifacts: args.artifacts
|
|
5333
|
+
});
|
|
5334
|
+
} catch (error) {
|
|
5335
|
+
writeStderrLine(
|
|
5336
|
+
`Hook artifact notification dropped for ${args.toolName ?? args.hookEventName}: ${error instanceof Error ? error.message : String(error)}`
|
|
5337
|
+
);
|
|
5110
5338
|
}
|
|
5111
5339
|
}
|
|
5112
5340
|
/**
|
|
@@ -5126,7 +5354,7 @@ ${contextPart.text}`
|
|
|
5126
5354
|
}
|
|
5127
5355
|
);
|
|
5128
5356
|
}).catch((err) => {
|
|
5129
|
-
|
|
5357
|
+
debugLogger6.debug(
|
|
5130
5358
|
`ACP terminalSequence notification dropped (session=${this.sessionId}): ${err instanceof Error ? err.message : String(err)}`
|
|
5131
5359
|
);
|
|
5132
5360
|
});
|
|
@@ -5156,6 +5384,11 @@ function serializeAgentTask(entry, now) {
|
|
|
5156
5384
|
...optionalField("endTime", entry.endTime),
|
|
5157
5385
|
...optionalField("subagentType", entry.subagentType),
|
|
5158
5386
|
isBackgrounded: entry.isBackgrounded,
|
|
5387
|
+
// Nested-agent lineage for client-side tree rendering. AgentTask uses
|
|
5388
|
+
// `null` parentAgentId for top-level launches — normalize to absent.
|
|
5389
|
+
...optionalField("parentAgentId", entry.parentAgentId ?? void 0),
|
|
5390
|
+
...optionalField("parentName", entry.parentName),
|
|
5391
|
+
...optionalField("depth", entry.depth),
|
|
5159
5392
|
...optionalField("error", entry.error),
|
|
5160
5393
|
...optionalField("resumeBlockedReason", entry.resumeBlockedReason),
|
|
5161
5394
|
...optionalField("stats", entry.stats),
|
|
@@ -5237,9 +5470,88 @@ function runWithAcpRuntimeOutputDir(settings, cwd, fn) {
|
|
|
5237
5470
|
__name(runWithAcpRuntimeOutputDir, "runWithAcpRuntimeOutputDir");
|
|
5238
5471
|
|
|
5239
5472
|
// packages/cli/src/acp-integration/acpAgent.ts
|
|
5240
|
-
var
|
|
5473
|
+
var debugLogger7 = createDebugLogger("ACP_AGENT");
|
|
5241
5474
|
var BTW_CHILD_TIMEOUT_MS = 55e3;
|
|
5242
5475
|
var WORKSPACE_MEMORY_REMEMBER_CHILD_TIMEOUT_MS = 295e3;
|
|
5476
|
+
function isObjectRecord(value) {
|
|
5477
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5478
|
+
}
|
|
5479
|
+
__name(isObjectRecord, "isObjectRecord");
|
|
5480
|
+
function isBulkLoadReplayRequest(params) {
|
|
5481
|
+
const meta = isObjectRecord(params._meta) ? params._meta : void 0;
|
|
5482
|
+
return meta?.[LOAD_REPLAY_MODE_META_KEY] === LOAD_REPLAY_BULK_MODE;
|
|
5483
|
+
}
|
|
5484
|
+
__name(isBulkLoadReplayRequest, "isBulkLoadReplayRequest");
|
|
5485
|
+
function createReplayCumulativeUsage() {
|
|
5486
|
+
return {
|
|
5487
|
+
promptTokens: 0,
|
|
5488
|
+
cachedTokens: 0,
|
|
5489
|
+
candidateTokens: 0,
|
|
5490
|
+
apiTimeMs: 0
|
|
5491
|
+
};
|
|
5492
|
+
}
|
|
5493
|
+
__name(createReplayCumulativeUsage, "createReplayCumulativeUsage");
|
|
5494
|
+
function copyCumulativeUsage(target, source) {
|
|
5495
|
+
target.promptTokens = source.promptTokens;
|
|
5496
|
+
target.cachedTokens = source.cachedTokens;
|
|
5497
|
+
target.candidateTokens = source.candidateTokens;
|
|
5498
|
+
target.apiTimeMs = source.apiTimeMs;
|
|
5499
|
+
}
|
|
5500
|
+
__name(copyCumulativeUsage, "copyCumulativeUsage");
|
|
5501
|
+
async function collectHistoryReplayUpdates({
|
|
5502
|
+
sessionId,
|
|
5503
|
+
config,
|
|
5504
|
+
records,
|
|
5505
|
+
cumulativeUsage
|
|
5506
|
+
}) {
|
|
5507
|
+
const updates = [];
|
|
5508
|
+
const replayContext = {
|
|
5509
|
+
sessionId,
|
|
5510
|
+
config,
|
|
5511
|
+
sendUpdate: /* @__PURE__ */ __name(async (update) => {
|
|
5512
|
+
updates.push(update);
|
|
5513
|
+
}, "sendUpdate"),
|
|
5514
|
+
cumulativeUsage
|
|
5515
|
+
};
|
|
5516
|
+
try {
|
|
5517
|
+
await new HistoryReplayer(replayContext).replay(records);
|
|
5518
|
+
} catch (error) {
|
|
5519
|
+
const replayError = error instanceof Error ? error.message : String(error);
|
|
5520
|
+
debugLogger7.warn(
|
|
5521
|
+
"[historyReplay] History replay failed for session %s (partial updates: %d):",
|
|
5522
|
+
sessionId,
|
|
5523
|
+
updates.length,
|
|
5524
|
+
error
|
|
5525
|
+
);
|
|
5526
|
+
return { updates, replayError };
|
|
5527
|
+
}
|
|
5528
|
+
return { updates };
|
|
5529
|
+
}
|
|
5530
|
+
__name(collectHistoryReplayUpdates, "collectHistoryReplayUpdates");
|
|
5531
|
+
function liftSessionUpdateTimestamps(updates) {
|
|
5532
|
+
return updates.map((update) => {
|
|
5533
|
+
const record = update;
|
|
5534
|
+
const meta = record["_meta"];
|
|
5535
|
+
const timestamp = isObjectRecord(meta) ? meta["timestamp"] : void 0;
|
|
5536
|
+
return typeof timestamp === "number" || typeof timestamp === "string" ? { ...record, timestamp } : update;
|
|
5537
|
+
});
|
|
5538
|
+
}
|
|
5539
|
+
__name(liftSessionUpdateTimestamps, "liftSessionUpdateTimestamps");
|
|
5540
|
+
function createHiddenWorkspaceMemoryConfig(config) {
|
|
5541
|
+
return new Proxy(config, {
|
|
5542
|
+
get(target, prop) {
|
|
5543
|
+
if (prop === "getChatRecordingService") {
|
|
5544
|
+
return () => void 0;
|
|
5545
|
+
}
|
|
5546
|
+
if (prop === "getTranscriptPath") {
|
|
5547
|
+
return () => "";
|
|
5548
|
+
}
|
|
5549
|
+
const value = Reflect.get(target, prop, target);
|
|
5550
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
5551
|
+
}
|
|
5552
|
+
});
|
|
5553
|
+
}
|
|
5554
|
+
__name(createHiddenWorkspaceMemoryConfig, "createHiddenWorkspaceMemoryConfig");
|
|
5243
5555
|
function collapseForkDirective(directive, maxLength) {
|
|
5244
5556
|
const oneLine = directive.replace(/\s+/g, " ").trim();
|
|
5245
5557
|
return oneLine.length > maxLength ? `${oneLine.slice(0, maxLength - 3)}\u2026` : oneLine;
|
|
@@ -5362,7 +5674,7 @@ function readRequiredString(value, fieldName) {
|
|
|
5362
5674
|
}
|
|
5363
5675
|
__name(readRequiredString, "readRequiredString");
|
|
5364
5676
|
function validateSkillSlug(slug) {
|
|
5365
|
-
if (!slug || slug === "." || slug === ".." || slug.includes("/") || slug.includes(
|
|
5677
|
+
if (!slug || slug === "." || slug === ".." || slug.includes("/") || slug.includes(path4.sep) || !/^[a-zA-Z0-9._-]+$/.test(slug)) {
|
|
5366
5678
|
throw RequestError.invalidParams(void 0, "Invalid skill.slug");
|
|
5367
5679
|
}
|
|
5368
5680
|
}
|
|
@@ -5831,7 +6143,7 @@ async function downloadGitHubSkillDirectoryFromApi(githubUrl, directoryPath, rel
|
|
|
5831
6143
|
const name = readRequiredString(record["name"], "github.name");
|
|
5832
6144
|
const itemPath = readRequiredString(record["path"], "github.path");
|
|
5833
6145
|
const type = readRequiredString(record["type"], "github.type");
|
|
5834
|
-
const relativePath = relativeRoot ?
|
|
6146
|
+
const relativePath = relativeRoot ? path4.posix.join(relativeRoot, name) : name;
|
|
5835
6147
|
if (type === "dir") {
|
|
5836
6148
|
files.push(
|
|
5837
6149
|
...await downloadGitHubSkillDirectoryFromApi(
|
|
@@ -5878,7 +6190,7 @@ async function downloadGitHubSkillDirectory(githubUrl, directoryPath) {
|
|
|
5878
6190
|
githubUrl,
|
|
5879
6191
|
directoryPath
|
|
5880
6192
|
).catch((error) => {
|
|
5881
|
-
|
|
6193
|
+
debugLogger7.warn(
|
|
5882
6194
|
"GitHub API directory listing failed, falling back to archive download:",
|
|
5883
6195
|
error
|
|
5884
6196
|
);
|
|
@@ -5891,10 +6203,10 @@ __name(downloadGitHubSkillDirectory, "downloadGitHubSkillDirectory");
|
|
|
5891
6203
|
async function downloadSkill(sourceUrl) {
|
|
5892
6204
|
assertAllowedSkillSourceUrl(sourceUrl);
|
|
5893
6205
|
const githubUrl = parseGitHubBlobSkillUrl(sourceUrl);
|
|
5894
|
-
if (!githubUrl ||
|
|
6206
|
+
if (!githubUrl || path4.posix.basename(githubUrl.filePath) !== "SKILL.md") {
|
|
5895
6207
|
return downloadSingleSkillFile(sourceUrl);
|
|
5896
6208
|
}
|
|
5897
|
-
const skillDirectory =
|
|
6209
|
+
const skillDirectory = path4.posix.dirname(githubUrl.filePath);
|
|
5898
6210
|
const files = await downloadGitHubSkillDirectory(githubUrl, skillDirectory);
|
|
5899
6211
|
const skillFile = files.find((file) => file.relativePath === "SKILL.md");
|
|
5900
6212
|
if (!skillFile) {
|
|
@@ -5910,9 +6222,9 @@ async function downloadSkill(sourceUrl) {
|
|
|
5910
6222
|
}
|
|
5911
6223
|
__name(downloadSkill, "downloadSkill");
|
|
5912
6224
|
function resolveSkillInstallPath(skillDir, relativePath) {
|
|
5913
|
-
const root =
|
|
5914
|
-
const target =
|
|
5915
|
-
if (target !== root && !target.startsWith(root +
|
|
6225
|
+
const root = path4.resolve(skillDir);
|
|
6226
|
+
const target = path4.resolve(skillDir, relativePath);
|
|
6227
|
+
if (target !== root && !target.startsWith(root + path4.sep)) {
|
|
5916
6228
|
throw RequestError.invalidParams(
|
|
5917
6229
|
void 0,
|
|
5918
6230
|
`Invalid skill file path: ${relativePath}`
|
|
@@ -5922,9 +6234,9 @@ function resolveSkillInstallPath(skillDir, relativePath) {
|
|
|
5922
6234
|
}
|
|
5923
6235
|
__name(resolveSkillInstallPath, "resolveSkillInstallPath");
|
|
5924
6236
|
function resolveManagedSkillDir(skillsBaseDir, slug) {
|
|
5925
|
-
const root =
|
|
5926
|
-
const skillDir =
|
|
5927
|
-
if (!skillDir.startsWith(root +
|
|
6237
|
+
const root = path4.resolve(skillsBaseDir);
|
|
6238
|
+
const skillDir = path4.resolve(skillsBaseDir, slug);
|
|
6239
|
+
if (!skillDir.startsWith(root + path4.sep)) {
|
|
5928
6240
|
throw RequestError.invalidParams(void 0, "Invalid skill.slug");
|
|
5929
6241
|
}
|
|
5930
6242
|
return skillDir;
|
|
@@ -6480,7 +6792,7 @@ function readMcpServers(source, scope) {
|
|
|
6480
6792
|
const server = toMcpServerConfig(value);
|
|
6481
6793
|
return server ? { name, scope, server: redactMcpServerSecrets(server) } : void 0;
|
|
6482
6794
|
} catch (error) {
|
|
6483
|
-
|
|
6795
|
+
debugLogger7.warn(
|
|
6484
6796
|
`Skipping malformed MCP server config [${scope}:${name}]:`,
|
|
6485
6797
|
error
|
|
6486
6798
|
);
|
|
@@ -6576,7 +6888,7 @@ function readHooks(source, scope, extensionName) {
|
|
|
6576
6888
|
extensionName
|
|
6577
6889
|
});
|
|
6578
6890
|
} catch (error) {
|
|
6579
|
-
|
|
6891
|
+
debugLogger7.warn(
|
|
6580
6892
|
`Skipping malformed hook entry [${scope}:${event}:${index}]:`,
|
|
6581
6893
|
error
|
|
6582
6894
|
);
|
|
@@ -6601,14 +6913,14 @@ function readScopeSettings(settings, scope) {
|
|
|
6601
6913
|
__name(readScopeSettings, "readScopeSettings");
|
|
6602
6914
|
async function resolvePreferredMemoryFile(dir, fallbackFilename) {
|
|
6603
6915
|
for (const filename of getAllGeminiMdFilenames()) {
|
|
6604
|
-
const filePath =
|
|
6916
|
+
const filePath = path4.join(dir, filename);
|
|
6605
6917
|
try {
|
|
6606
|
-
await
|
|
6918
|
+
await fs2.access(filePath);
|
|
6607
6919
|
return filePath;
|
|
6608
6920
|
} catch {
|
|
6609
6921
|
}
|
|
6610
6922
|
}
|
|
6611
|
-
return
|
|
6923
|
+
return path4.join(dir, fallbackFilename);
|
|
6612
6924
|
}
|
|
6613
6925
|
__name(resolvePreferredMemoryFile, "resolvePreferredMemoryFile");
|
|
6614
6926
|
async function resolveQwenMemoryPaths(params) {
|
|
@@ -6661,24 +6973,36 @@ async function runAcpAgent(config, settings, argv) {
|
|
|
6661
6973
|
// client-hosted MCP server (#5626) round-trips over the parent WS.
|
|
6662
6974
|
sendSdkMcpMessage: bootstrapClientMcpSender
|
|
6663
6975
|
});
|
|
6664
|
-
const
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
const stream = ndJsonStream(stdout, stdin);
|
|
6976
|
+
const eventLoopMonitor = startEventLoopLagMonitor({
|
|
6977
|
+
onNewMaxStall: /* @__PURE__ */ __name((maxMs) => {
|
|
6978
|
+
console.error(`[perf] acp agent event loop stall: max=${maxMs}ms`);
|
|
6979
|
+
}, "onNewMaxStall")
|
|
6980
|
+
});
|
|
6670
6981
|
let agentInstance;
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6982
|
+
let connection;
|
|
6983
|
+
try {
|
|
6984
|
+
const stdout = Writable.toWeb(process.stdout);
|
|
6985
|
+
const stdin = Readable.toWeb(process.stdin);
|
|
6986
|
+
console.log = console.error;
|
|
6987
|
+
console.info = console.error;
|
|
6988
|
+
console.debug = console.error;
|
|
6989
|
+
const stream = ndJsonStream(stdout, stdin);
|
|
6990
|
+
connection = new AgentSideConnection((conn) => {
|
|
6991
|
+
acpConnection = conn;
|
|
6992
|
+
agentInstance = new QwenAgent(config, settings, argv, conn);
|
|
6993
|
+
return agentInstance;
|
|
6994
|
+
}, stream);
|
|
6995
|
+
} catch (err) {
|
|
6996
|
+
eventLoopMonitor.dispose();
|
|
6997
|
+
throw err;
|
|
6998
|
+
}
|
|
6999
|
+
registerAcpEventLoopLagGauge(() => eventLoopMonitor.snapshot());
|
|
6676
7000
|
const drainPoolBeforeExit = /* @__PURE__ */ __name(async (label) => {
|
|
6677
7001
|
if (!agentInstance) return;
|
|
6678
7002
|
try {
|
|
6679
7003
|
await agentInstance.shutdownMcpPool(8e3);
|
|
6680
7004
|
} catch (err) {
|
|
6681
|
-
|
|
7005
|
+
debugLogger7.error(`[ACP] MCP pool drain (${label}) error:`, err);
|
|
6682
7006
|
}
|
|
6683
7007
|
}, "drainPoolBeforeExit");
|
|
6684
7008
|
let shuttingDown = false;
|
|
@@ -6705,7 +7029,7 @@ async function runAcpAgent(config, settings, argv) {
|
|
|
6705
7029
|
try {
|
|
6706
7030
|
await hookSystem.fireSessionEndEvent(reason);
|
|
6707
7031
|
} catch (err) {
|
|
6708
|
-
|
|
7032
|
+
debugLogger7.warn(
|
|
6709
7033
|
`SessionEnd hook failed: ${err instanceof Error ? err.message : String(err)}`
|
|
6710
7034
|
);
|
|
6711
7035
|
}
|
|
@@ -6714,32 +7038,42 @@ async function runAcpAgent(config, settings, argv) {
|
|
|
6714
7038
|
const shutdownHandler = /* @__PURE__ */ __name(async () => {
|
|
6715
7039
|
if (shuttingDown) return;
|
|
6716
7040
|
shuttingDown = true;
|
|
6717
|
-
|
|
6718
|
-
await fireSessionEndOnce("other" /* Other */);
|
|
6719
|
-
agentInstance?.disposeSessions();
|
|
7041
|
+
debugLogger7.debug("[ACP] Shutdown signal received, closing streams");
|
|
6720
7042
|
try {
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
|
|
7043
|
+
await fireSessionEndOnce("other" /* Other */);
|
|
7044
|
+
agentInstance?.disposeSessions();
|
|
7045
|
+
try {
|
|
7046
|
+
process.stdin.destroy();
|
|
7047
|
+
} catch {
|
|
7048
|
+
}
|
|
7049
|
+
try {
|
|
7050
|
+
process.stdout.destroy();
|
|
7051
|
+
} catch {
|
|
7052
|
+
}
|
|
7053
|
+
await drainPoolBeforeExit("signal");
|
|
7054
|
+
} catch (err) {
|
|
7055
|
+
debugLogger7.error("[ACP] Shutdown error:", err);
|
|
7056
|
+
} finally {
|
|
7057
|
+
eventLoopMonitor.dispose();
|
|
6727
7058
|
}
|
|
6728
|
-
await drainPoolBeforeExit("signal");
|
|
6729
7059
|
runExitCleanup().catch((err) => {
|
|
6730
|
-
|
|
7060
|
+
debugLogger7.error("[ACP] Cleanup error:", err);
|
|
6731
7061
|
}).finally(() => {
|
|
6732
7062
|
process.exit(0);
|
|
6733
7063
|
});
|
|
6734
7064
|
}, "shutdownHandler");
|
|
6735
7065
|
process.on("SIGTERM", shutdownHandler);
|
|
6736
7066
|
process.on("SIGINT", shutdownHandler);
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
7067
|
+
try {
|
|
7068
|
+
await connection.closed;
|
|
7069
|
+
await fireSessionEndOnce("prompt_input_exit" /* PromptInputExit */);
|
|
7070
|
+
await drainPoolBeforeExit("ide_close");
|
|
7071
|
+
agentInstance?.disposeSessions();
|
|
7072
|
+
} finally {
|
|
7073
|
+
process.off("SIGTERM", shutdownHandler);
|
|
7074
|
+
process.off("SIGINT", shutdownHandler);
|
|
7075
|
+
eventLoopMonitor.dispose();
|
|
7076
|
+
}
|
|
6743
7077
|
}
|
|
6744
7078
|
__name(runAcpAgent, "runAcpAgent");
|
|
6745
7079
|
function toStdioServer(server) {
|
|
@@ -6914,12 +7248,12 @@ var QwenAgent = class {
|
|
|
6914
7248
|
try {
|
|
6915
7249
|
const result = await this.mcpPool.drainAll({ force: true, timeoutMs });
|
|
6916
7250
|
if (result.forced > 0 || result.errors.length > 0) {
|
|
6917
|
-
|
|
7251
|
+
debugLogger7.warn(
|
|
6918
7252
|
`MCP pool drain: ${result.drained} clean, ${result.forced} timed out, ${result.errors.length} errors`
|
|
6919
7253
|
);
|
|
6920
7254
|
}
|
|
6921
7255
|
} catch (err) {
|
|
6922
|
-
|
|
7256
|
+
debugLogger7.error(
|
|
6923
7257
|
`MCP pool drainAll failed: ${err instanceof Error ? err.message : String(err)}`
|
|
6924
7258
|
);
|
|
6925
7259
|
}
|
|
@@ -6936,7 +7270,7 @@ var QwenAgent = class {
|
|
|
6936
7270
|
await session.getConfig().getChatRecordingService()?.flush();
|
|
6937
7271
|
return void 0;
|
|
6938
7272
|
} catch (err) {
|
|
6939
|
-
|
|
7273
|
+
debugLogger7.debug(
|
|
6940
7274
|
`Session ${sessionId} chat recording flush during close failed: ${err instanceof Error ? err.message : String(err)}`
|
|
6941
7275
|
);
|
|
6942
7276
|
return err;
|
|
@@ -6951,7 +7285,7 @@ var QwenAgent = class {
|
|
|
6951
7285
|
try {
|
|
6952
7286
|
await session.cancelPendingPrompt();
|
|
6953
7287
|
} catch (err) {
|
|
6954
|
-
|
|
7288
|
+
debugLogger7.debug(
|
|
6955
7289
|
`Session ${sessionId} cancel during close failed: ${err instanceof Error ? err.message : String(err)}`
|
|
6956
7290
|
);
|
|
6957
7291
|
}
|
|
@@ -6962,7 +7296,7 @@ var QwenAgent = class {
|
|
|
6962
7296
|
try {
|
|
6963
7297
|
await session.getConfig().getToolRegistry()?.stop();
|
|
6964
7298
|
} catch (err) {
|
|
6965
|
-
|
|
7299
|
+
debugLogger7.debug(
|
|
6966
7300
|
`Session ${sessionId} tool registry stop during close failed: ${err instanceof Error ? err.message : String(err)}`
|
|
6967
7301
|
);
|
|
6968
7302
|
}
|
|
@@ -6971,6 +7305,37 @@ var QwenAgent = class {
|
|
|
6971
7305
|
uiTelemetryService.removeSession(sessionId);
|
|
6972
7306
|
this.sessions.delete(sessionId);
|
|
6973
7307
|
}
|
|
7308
|
+
discardStoredSessionIfCurrent(sessionId, session) {
|
|
7309
|
+
if (this.sessions.get(sessionId) !== session) {
|
|
7310
|
+
return;
|
|
7311
|
+
}
|
|
7312
|
+
const logCleanupFailure = /* @__PURE__ */ __name((action, err) => {
|
|
7313
|
+
debugLogger7.debug(
|
|
7314
|
+
`Session ${sessionId} ${action} during failed restore cleanup failed: ${err instanceof Error ? err.message : String(err)}`
|
|
7315
|
+
);
|
|
7316
|
+
}, "logCleanupFailure");
|
|
7317
|
+
try {
|
|
7318
|
+
session.dispose();
|
|
7319
|
+
} catch (err) {
|
|
7320
|
+
logCleanupFailure("dispose", err);
|
|
7321
|
+
}
|
|
7322
|
+
try {
|
|
7323
|
+
unregisterGoalHook(session.getConfig(), sessionId);
|
|
7324
|
+
} catch (err) {
|
|
7325
|
+
logCleanupFailure("goal hook unregister", err);
|
|
7326
|
+
}
|
|
7327
|
+
try {
|
|
7328
|
+
this.mcpPool?.releaseSession(sessionId);
|
|
7329
|
+
} catch (err) {
|
|
7330
|
+
logCleanupFailure("MCP pool release", err);
|
|
7331
|
+
}
|
|
7332
|
+
try {
|
|
7333
|
+
uiTelemetryService.removeSession(sessionId);
|
|
7334
|
+
} catch (err) {
|
|
7335
|
+
logCleanupFailure("telemetry removal", err);
|
|
7336
|
+
}
|
|
7337
|
+
this.sessions.delete(sessionId);
|
|
7338
|
+
}
|
|
6974
7339
|
disposeSessions() {
|
|
6975
7340
|
for (const session of this.sessions.values()) {
|
|
6976
7341
|
session.dispose();
|
|
@@ -6996,7 +7361,7 @@ var QwenAgent = class {
|
|
|
6996
7361
|
scope: "workspace",
|
|
6997
7362
|
...event
|
|
6998
7363
|
}).catch((err) => {
|
|
6999
|
-
|
|
7364
|
+
debugLogger7.debug(
|
|
7000
7365
|
`MCP workspace budget event delivery to session ${sid} failed (kind=${event.kind}): ${err instanceof Error ? err.message : String(err)}`
|
|
7001
7366
|
);
|
|
7002
7367
|
});
|
|
@@ -7005,7 +7370,7 @@ var QwenAgent = class {
|
|
|
7005
7370
|
async initialize(args) {
|
|
7006
7371
|
this.clientCapabilities = args.clientCapabilities;
|
|
7007
7372
|
const authMethods = buildAuthMethods();
|
|
7008
|
-
const version = "0.19.
|
|
7373
|
+
const version = "0.19.6-nightly.20260705.015ee4248";
|
|
7009
7374
|
return {
|
|
7010
7375
|
protocolVersion: PROTOCOL_VERSION,
|
|
7011
7376
|
agentInfo: {
|
|
@@ -7028,6 +7393,9 @@ var QwenAgent = class {
|
|
|
7028
7393
|
mcpCapabilities: {
|
|
7029
7394
|
sse: true,
|
|
7030
7395
|
http: true
|
|
7396
|
+
},
|
|
7397
|
+
_meta: {
|
|
7398
|
+
imageCapability: IMAGE_CAPABILITY
|
|
7031
7399
|
}
|
|
7032
7400
|
}
|
|
7033
7401
|
};
|
|
@@ -7062,10 +7430,12 @@ var QwenAgent = class {
|
|
|
7062
7430
|
cwd,
|
|
7063
7431
|
mcpServers
|
|
7064
7432
|
}) {
|
|
7065
|
-
const
|
|
7433
|
+
const settings = loadSettingsCached(cwd);
|
|
7434
|
+
this.settings = settings;
|
|
7435
|
+
const config = await this.newSessionConfig(cwd, mcpServers, settings);
|
|
7066
7436
|
await this.ensureAuthenticated(config);
|
|
7067
7437
|
this.setupFileSystem(config);
|
|
7068
|
-
const session = await this.createAndStoreSession(config);
|
|
7438
|
+
const session = await this.createAndStoreSession(config, settings);
|
|
7069
7439
|
const availableModels = this.buildAvailableModels(config);
|
|
7070
7440
|
const modesData = this.buildModesData(config);
|
|
7071
7441
|
const configOptions = this.buildConfigOptions(config);
|
|
@@ -7077,8 +7447,9 @@ var QwenAgent = class {
|
|
|
7077
7447
|
};
|
|
7078
7448
|
}
|
|
7079
7449
|
async loadSession(params) {
|
|
7450
|
+
const settings = loadSettingsCached(params.cwd);
|
|
7080
7451
|
const exists = await runWithAcpRuntimeOutputDir(
|
|
7081
|
-
|
|
7452
|
+
settings,
|
|
7082
7453
|
params.cwd,
|
|
7083
7454
|
async () => {
|
|
7084
7455
|
const sessionService = new SessionService(params.cwd);
|
|
@@ -7088,6 +7459,7 @@ var QwenAgent = class {
|
|
|
7088
7459
|
if (!exists) {
|
|
7089
7460
|
throw RequestError.resourceNotFound(`session:${params.sessionId}`);
|
|
7090
7461
|
}
|
|
7462
|
+
this.settings = settings;
|
|
7091
7463
|
const config = await this.newSessionConfig(
|
|
7092
7464
|
params.cwd,
|
|
7093
7465
|
// `LoadSessionRequest.mcpServers` is required in today's ACP
|
|
@@ -7095,26 +7467,79 @@ var QwenAgent = class {
|
|
|
7095
7467
|
// future loosening — `newSessionConfig` iterates the list, so
|
|
7096
7468
|
// a `null`/`undefined` would otherwise throw `TypeError`.
|
|
7097
7469
|
params.mcpServers ?? [],
|
|
7470
|
+
settings,
|
|
7098
7471
|
params.sessionId,
|
|
7099
7472
|
true
|
|
7100
7473
|
);
|
|
7101
7474
|
await this.ensureAuthenticated(config);
|
|
7102
7475
|
this.setupFileSystem(config);
|
|
7103
7476
|
const sessionData = config.getResumedSessionData();
|
|
7104
|
-
const
|
|
7477
|
+
const bulkReplay = isBulkLoadReplayRequest(params);
|
|
7478
|
+
const session = await this.createAndStoreSession(
|
|
7479
|
+
config,
|
|
7480
|
+
settings,
|
|
7481
|
+
sessionData,
|
|
7482
|
+
bulkReplay ? { replayHistory: false, startPostReplayServices: false } : {}
|
|
7483
|
+
);
|
|
7484
|
+
let replayEnvelope;
|
|
7485
|
+
if (bulkReplay) {
|
|
7486
|
+
try {
|
|
7487
|
+
const records = sessionData?.conversation.messages;
|
|
7488
|
+
let replayUpdates = [];
|
|
7489
|
+
if (records) {
|
|
7490
|
+
session.primeTurnFromHistory(records);
|
|
7491
|
+
const replayUsage = createReplayCumulativeUsage();
|
|
7492
|
+
const replay = await collectHistoryReplayUpdates({
|
|
7493
|
+
sessionId: params.sessionId,
|
|
7494
|
+
config,
|
|
7495
|
+
records,
|
|
7496
|
+
cumulativeUsage: replayUsage
|
|
7497
|
+
});
|
|
7498
|
+
replayUpdates = liftSessionUpdateTimestamps(replay.updates);
|
|
7499
|
+
copyCumulativeUsage(session.cumulativeUsage, replayUsage);
|
|
7500
|
+
if (replay.replayError !== void 0) {
|
|
7501
|
+
replayEnvelope = {
|
|
7502
|
+
v: LOAD_REPLAY_VERSION,
|
|
7503
|
+
updates: replayUpdates,
|
|
7504
|
+
partial: true,
|
|
7505
|
+
replayError: replay.replayError
|
|
7506
|
+
};
|
|
7507
|
+
}
|
|
7508
|
+
}
|
|
7509
|
+
replayEnvelope ??= {
|
|
7510
|
+
v: LOAD_REPLAY_VERSION,
|
|
7511
|
+
updates: replayUpdates
|
|
7512
|
+
};
|
|
7513
|
+
session.installRewriter();
|
|
7514
|
+
session.startCronScheduler();
|
|
7515
|
+
} catch (err) {
|
|
7516
|
+
this.discardStoredSessionIfCurrent(params.sessionId, session);
|
|
7517
|
+
throw err;
|
|
7518
|
+
}
|
|
7519
|
+
}
|
|
7105
7520
|
await this.#restoreWorktreeOnResume(config, session);
|
|
7106
7521
|
const modesData = this.buildModesData(config);
|
|
7107
7522
|
const availableModels = this.buildAvailableModels(config);
|
|
7108
7523
|
const configOptions = this.buildConfigOptions(config);
|
|
7109
|
-
|
|
7524
|
+
const response = {
|
|
7110
7525
|
modes: modesData,
|
|
7111
7526
|
models: availableModels,
|
|
7112
7527
|
configOptions
|
|
7113
7528
|
};
|
|
7529
|
+
if (!replayEnvelope) {
|
|
7530
|
+
return response;
|
|
7531
|
+
}
|
|
7532
|
+
return {
|
|
7533
|
+
...response,
|
|
7534
|
+
_meta: {
|
|
7535
|
+
[LOAD_REPLAY_META_KEY]: replayEnvelope
|
|
7536
|
+
}
|
|
7537
|
+
};
|
|
7114
7538
|
}
|
|
7115
7539
|
async unstable_resumeSession(params) {
|
|
7540
|
+
const settings = loadSettingsCached(params.cwd);
|
|
7116
7541
|
const exists = await runWithAcpRuntimeOutputDir(
|
|
7117
|
-
|
|
7542
|
+
settings,
|
|
7118
7543
|
params.cwd,
|
|
7119
7544
|
async () => {
|
|
7120
7545
|
const sessionService = new SessionService(params.cwd);
|
|
@@ -7124,9 +7549,11 @@ var QwenAgent = class {
|
|
|
7124
7549
|
if (!exists) {
|
|
7125
7550
|
throw RequestError.resourceNotFound(`session:${params.sessionId}`);
|
|
7126
7551
|
}
|
|
7552
|
+
this.settings = settings;
|
|
7127
7553
|
const config = await this.newSessionConfig(
|
|
7128
7554
|
params.cwd,
|
|
7129
7555
|
params.mcpServers ?? [],
|
|
7556
|
+
settings,
|
|
7130
7557
|
params.sessionId,
|
|
7131
7558
|
true
|
|
7132
7559
|
);
|
|
@@ -7134,6 +7561,7 @@ var QwenAgent = class {
|
|
|
7134
7561
|
this.setupFileSystem(config);
|
|
7135
7562
|
const session = await this.createAndStoreSession(
|
|
7136
7563
|
config,
|
|
7564
|
+
settings,
|
|
7137
7565
|
config.getResumedSessionData(),
|
|
7138
7566
|
{ replayHistory: false }
|
|
7139
7567
|
);
|
|
@@ -7161,7 +7589,7 @@ var QwenAgent = class {
|
|
|
7161
7589
|
session.pendingWorktreeNotice = restored.contextMessage;
|
|
7162
7590
|
}
|
|
7163
7591
|
} catch (error) {
|
|
7164
|
-
|
|
7592
|
+
debugLogger7.warn(`ACP worktree restore failed: ${error}`);
|
|
7165
7593
|
}
|
|
7166
7594
|
}
|
|
7167
7595
|
async unstable_listSessions(params) {
|
|
@@ -7282,7 +7710,7 @@ var QwenAgent = class {
|
|
|
7282
7710
|
await extensionManager.refreshCache();
|
|
7283
7711
|
extensions = extensionManager.getLoadedExtensions();
|
|
7284
7712
|
} catch (error) {
|
|
7285
|
-
|
|
7713
|
+
debugLogger7.warn(
|
|
7286
7714
|
"Extension loading failed, continuing without extensions:",
|
|
7287
7715
|
error
|
|
7288
7716
|
);
|
|
@@ -7408,7 +7836,7 @@ var QwenAgent = class {
|
|
|
7408
7836
|
pm.addPersistentRule(rule, ruleType);
|
|
7409
7837
|
}
|
|
7410
7838
|
} catch (error) {
|
|
7411
|
-
|
|
7839
|
+
debugLogger7.warn(
|
|
7412
7840
|
`Failed to sync permission rules to a live session: ${error instanceof Error ? error.message : String(error)}`
|
|
7413
7841
|
);
|
|
7414
7842
|
}
|
|
@@ -7878,12 +8306,13 @@ var QwenAgent = class {
|
|
|
7878
8306
|
};
|
|
7879
8307
|
}
|
|
7880
8308
|
try {
|
|
8309
|
+
const disabled = config.getDisabledSkillNames();
|
|
7881
8310
|
const skills = await skillManager.listSkills();
|
|
7882
8311
|
return {
|
|
7883
8312
|
v: STATUS_SCHEMA_VERSION,
|
|
7884
8313
|
workspaceCwd: this.workspaceCwd(config),
|
|
7885
8314
|
initialized: true,
|
|
7886
|
-
skills: skills.map(mapSkillConfigToStatus)
|
|
8315
|
+
skills: skills.map((skill) => mapSkillConfigToStatus(skill, disabled))
|
|
7887
8316
|
};
|
|
7888
8317
|
} catch (error) {
|
|
7889
8318
|
return {
|
|
@@ -7987,9 +8416,10 @@ var QwenAgent = class {
|
|
|
7987
8416
|
return { kind, locality: "acp", ...spec };
|
|
7988
8417
|
}
|
|
7989
8418
|
/**
|
|
7990
|
-
* Pure auth preflight check.
|
|
7991
|
-
* configured auth method
|
|
7992
|
-
*
|
|
8419
|
+
* Pure auth preflight check. First looks up the well-known env var keys
|
|
8420
|
+
* for the configured auth method, then falls back to the API key already
|
|
8421
|
+
* resolved into the generation config (which folds settings.security.auth.apiKey,
|
|
8422
|
+
* provider envKey from settings.env, and CLI flags into a single value).
|
|
7993
8423
|
*
|
|
7994
8424
|
* Deliberately does NOT call `validateAuthMethod` from `cli/config/auth.ts`:
|
|
7995
8425
|
* that helper has side effects (reloads `.env` from disk via
|
|
@@ -8014,14 +8444,22 @@ var QwenAgent = class {
|
|
|
8014
8444
|
const presentVar = apiKeyVars.find(
|
|
8015
8445
|
(name) => Boolean(process.env[name])
|
|
8016
8446
|
);
|
|
8017
|
-
|
|
8447
|
+
let hasToken = Boolean(presentVar);
|
|
8448
|
+
if (!hasToken && !AUTH_PREFLIGHT_WAIVED_AUTH_TYPES.has(String(authType))) {
|
|
8449
|
+
const resolvedApiKey = config.getModelsConfig().getGenerationConfig()?.apiKey;
|
|
8450
|
+
if (resolvedApiKey) {
|
|
8451
|
+
hasToken = true;
|
|
8452
|
+
}
|
|
8453
|
+
}
|
|
8018
8454
|
if (apiKeyVars.length === 0) {
|
|
8019
8455
|
return this.acpCell("auth", {
|
|
8020
|
-
status: "unknown",
|
|
8021
|
-
|
|
8456
|
+
status: hasToken ? "ok" : "unknown",
|
|
8457
|
+
...hasToken ? {} : {
|
|
8458
|
+
hint: "Auth credentials for this provider are not env-keyed; full validation runs at session start."
|
|
8459
|
+
},
|
|
8022
8460
|
detail: {
|
|
8023
8461
|
source: String(authType),
|
|
8024
|
-
hasToken: "unknown",
|
|
8462
|
+
hasToken: hasToken || "unknown",
|
|
8025
8463
|
envVarCandidates: []
|
|
8026
8464
|
}
|
|
8027
8465
|
});
|
|
@@ -8672,9 +9110,9 @@ var QwenAgent = class {
|
|
|
8672
9110
|
);
|
|
8673
9111
|
}
|
|
8674
9112
|
const download = await downloadSkill(request.sourceUrl);
|
|
8675
|
-
const skillsBaseDir =
|
|
9113
|
+
const skillsBaseDir = path4.join(Storage.getGlobalQwenDir(), "skills");
|
|
8676
9114
|
const skillDir = resolveManagedSkillDir(skillsBaseDir, request.slug);
|
|
8677
|
-
const skillFile =
|
|
9115
|
+
const skillFile = path4.join(skillDir, "SKILL.md");
|
|
8678
9116
|
const parsed = skillManager.parseSkillContent(
|
|
8679
9117
|
download.skillContent,
|
|
8680
9118
|
skillFile,
|
|
@@ -8688,19 +9126,19 @@ var QwenAgent = class {
|
|
|
8688
9126
|
}
|
|
8689
9127
|
const stagingDir = `${skillDir}.installing-${process.pid}-${Date.now()}`;
|
|
8690
9128
|
try {
|
|
8691
|
-
await
|
|
9129
|
+
await fs2.rm(stagingDir, { recursive: true, force: true });
|
|
8692
9130
|
for (const file of download.files) {
|
|
8693
9131
|
const targetPath = resolveSkillInstallPath(
|
|
8694
9132
|
stagingDir,
|
|
8695
9133
|
file.relativePath
|
|
8696
9134
|
);
|
|
8697
|
-
await
|
|
8698
|
-
await
|
|
9135
|
+
await fs2.mkdir(path4.dirname(targetPath), { recursive: true });
|
|
9136
|
+
await fs2.writeFile(targetPath, file.content);
|
|
8699
9137
|
}
|
|
8700
|
-
await
|
|
8701
|
-
await
|
|
9138
|
+
await fs2.rm(skillDir, { recursive: true, force: true });
|
|
9139
|
+
await fs2.rename(stagingDir, skillDir);
|
|
8702
9140
|
} catch (error) {
|
|
8703
|
-
await
|
|
9141
|
+
await fs2.rm(stagingDir, { recursive: true, force: true }).catch(() => {
|
|
8704
9142
|
});
|
|
8705
9143
|
throw error;
|
|
8706
9144
|
}
|
|
@@ -8733,17 +9171,17 @@ var QwenAgent = class {
|
|
|
8733
9171
|
`Skill name "${parsed.name}" does not match requested slug "${request.slug}"`
|
|
8734
9172
|
);
|
|
8735
9173
|
}
|
|
8736
|
-
const resolvedSkillDir =
|
|
8737
|
-
const resolvedSkillFile =
|
|
8738
|
-
const globalDir =
|
|
8739
|
-
const isDedicatedSkillDir = resolvedSkillFile ===
|
|
8740
|
-
if (!isDedicatedSkillDir || resolvedSkillDir ===
|
|
9174
|
+
const resolvedSkillDir = path4.resolve(skillDir);
|
|
9175
|
+
const resolvedSkillFile = path4.resolve(skillFile);
|
|
9176
|
+
const globalDir = path4.resolve(Storage.getGlobalQwenDir());
|
|
9177
|
+
const isDedicatedSkillDir = resolvedSkillFile === path4.join(resolvedSkillDir, "SKILL.md");
|
|
9178
|
+
if (!isDedicatedSkillDir || resolvedSkillDir === path4.parse(resolvedSkillDir).root || resolvedSkillDir === globalDir) {
|
|
8741
9179
|
throw RequestError.invalidParams(
|
|
8742
9180
|
void 0,
|
|
8743
9181
|
`Refusing to delete unexpected skill directory: ${skillDir}`
|
|
8744
9182
|
);
|
|
8745
9183
|
}
|
|
8746
|
-
await
|
|
9184
|
+
await fs2.rm(skillDir, { recursive: true, force: true });
|
|
8747
9185
|
await skillManager.refreshCache();
|
|
8748
9186
|
return {
|
|
8749
9187
|
slug: request.slug,
|
|
@@ -8753,11 +9191,11 @@ var QwenAgent = class {
|
|
|
8753
9191
|
async readManagedSkillFile(slug, scope, skillManager, cwd) {
|
|
8754
9192
|
if (scope === "global") {
|
|
8755
9193
|
const qwenSkillDir = resolveManagedSkillDir(
|
|
8756
|
-
|
|
9194
|
+
path4.join(Storage.getGlobalQwenDir(), "skills"),
|
|
8757
9195
|
slug
|
|
8758
9196
|
);
|
|
8759
|
-
const qwenSkillFile =
|
|
8760
|
-
const qwenContent = await
|
|
9197
|
+
const qwenSkillFile = path4.join(qwenSkillDir, "SKILL.md");
|
|
9198
|
+
const qwenContent = await fs2.readFile(qwenSkillFile, "utf8").catch(() => void 0);
|
|
8761
9199
|
if (qwenContent !== void 0) {
|
|
8762
9200
|
return {
|
|
8763
9201
|
skillDir: qwenSkillDir,
|
|
@@ -8785,34 +9223,34 @@ var QwenAgent = class {
|
|
|
8785
9223
|
`${scope === "project" ? "Project" : "Global"} skill not found: ${slug}`
|
|
8786
9224
|
);
|
|
8787
9225
|
}
|
|
8788
|
-
const content = await
|
|
9226
|
+
const content = await fs2.readFile(skillFile, "utf8").catch(() => {
|
|
8789
9227
|
throw RequestError.invalidParams(
|
|
8790
9228
|
void 0,
|
|
8791
9229
|
`${scope === "project" ? "Project" : "Global"} skill not found: ${slug}`
|
|
8792
9230
|
);
|
|
8793
9231
|
});
|
|
8794
9232
|
return {
|
|
8795
|
-
skillDir:
|
|
9233
|
+
skillDir: path4.dirname(skillFile),
|
|
8796
9234
|
skillFile,
|
|
8797
9235
|
content
|
|
8798
9236
|
};
|
|
8799
9237
|
}
|
|
8800
9238
|
async findProjectSkillFileFromCwd(slug, cwd, skillManager) {
|
|
8801
|
-
const projectRoot =
|
|
9239
|
+
const projectRoot = path4.resolve(cwd);
|
|
8802
9240
|
for (const configDir of PROJECT_SKILL_DIRS) {
|
|
8803
|
-
const baseDir =
|
|
9241
|
+
const baseDir = path4.join(projectRoot, configDir, SKILLS_DIR);
|
|
8804
9242
|
const skills = await skillManager.loadSkillsFromDir(baseDir, "project");
|
|
8805
9243
|
const skill = skills.find((candidate) => candidate.name === slug);
|
|
8806
9244
|
const skillFile = skill?.filePath;
|
|
8807
9245
|
if (!skillFile) continue;
|
|
8808
|
-
const content = await
|
|
9246
|
+
const content = await fs2.readFile(skillFile, "utf8").catch(() => {
|
|
8809
9247
|
throw RequestError.invalidParams(
|
|
8810
9248
|
void 0,
|
|
8811
9249
|
`Project skill not found: ${slug}`
|
|
8812
9250
|
);
|
|
8813
9251
|
});
|
|
8814
9252
|
return {
|
|
8815
|
-
skillDir:
|
|
9253
|
+
skillDir: path4.dirname(skillFile),
|
|
8816
9254
|
skillFile,
|
|
8817
9255
|
content
|
|
8818
9256
|
};
|
|
@@ -8843,13 +9281,13 @@ var QwenAgent = class {
|
|
|
8843
9281
|
}
|
|
8844
9282
|
const nextContent = setSkillFrontmatterEnabled(content, request.enabled);
|
|
8845
9283
|
skillManager.parseSkillContent(nextContent, skillFile, level);
|
|
8846
|
-
if (
|
|
9284
|
+
if (path4.basename(skillFile) !== "SKILL.md") {
|
|
8847
9285
|
throw RequestError.invalidParams(
|
|
8848
9286
|
void 0,
|
|
8849
9287
|
`Refusing to write to unexpected skill file: ${skillFile}`
|
|
8850
9288
|
);
|
|
8851
9289
|
}
|
|
8852
|
-
await
|
|
9290
|
+
await fs2.writeFile(skillFile, nextContent, "utf8");
|
|
8853
9291
|
await skillManager.refreshCache();
|
|
8854
9292
|
return {
|
|
8855
9293
|
slug: request.slug,
|
|
@@ -9193,6 +9631,119 @@ var QwenAgent = class {
|
|
|
9193
9631
|
);
|
|
9194
9632
|
}
|
|
9195
9633
|
}
|
|
9634
|
+
case SERVE_CONTROL_EXT_METHODS.workspaceMemoryForget: {
|
|
9635
|
+
const query = params["query"];
|
|
9636
|
+
if (typeof query !== "string" || !query.trim()) {
|
|
9637
|
+
throw RequestError.invalidParams(
|
|
9638
|
+
void 0,
|
|
9639
|
+
"Invalid or missing query"
|
|
9640
|
+
);
|
|
9641
|
+
}
|
|
9642
|
+
const trimmedQuery = query.trim();
|
|
9643
|
+
if (Buffer.byteLength(trimmedQuery, "utf8") > MAX_REMEMBER_CONTENT_BYTES) {
|
|
9644
|
+
throw RequestError.invalidParams(
|
|
9645
|
+
void 0,
|
|
9646
|
+
"Query exceeds maximum size"
|
|
9647
|
+
);
|
|
9648
|
+
}
|
|
9649
|
+
if (!this.config.isManagedMemoryAvailable()) {
|
|
9650
|
+
throw new RequestError(
|
|
9651
|
+
-32009,
|
|
9652
|
+
"Managed memory is unavailable for this daemon workspace",
|
|
9653
|
+
{ errorKind: "managed_memory_unavailable" }
|
|
9654
|
+
);
|
|
9655
|
+
}
|
|
9656
|
+
const childSignal = AbortSignal.timeout(
|
|
9657
|
+
WORKSPACE_MEMORY_REMEMBER_CHILD_TIMEOUT_MS
|
|
9658
|
+
);
|
|
9659
|
+
try {
|
|
9660
|
+
const projectRoot = this.config.getProjectRoot();
|
|
9661
|
+
const hiddenConfig = createHiddenWorkspaceMemoryConfig(this.config);
|
|
9662
|
+
const result = await this.config.getMemoryManager().forget(projectRoot, trimmedQuery, {
|
|
9663
|
+
config: hiddenConfig,
|
|
9664
|
+
abortSignal: childSignal
|
|
9665
|
+
});
|
|
9666
|
+
return {
|
|
9667
|
+
summary: result.systemMessage ?? formatWorkspaceMemoryForgetSummary(result.removedEntries.length),
|
|
9668
|
+
removedEntries: result.removedEntries,
|
|
9669
|
+
touchedTopics: result.touchedTopics
|
|
9670
|
+
};
|
|
9671
|
+
} catch (err) {
|
|
9672
|
+
if (err instanceof RequestError) {
|
|
9673
|
+
throw err;
|
|
9674
|
+
}
|
|
9675
|
+
if (childSignal.aborted) {
|
|
9676
|
+
throw new RequestError(
|
|
9677
|
+
-32099,
|
|
9678
|
+
"Workspace memory forget timed out",
|
|
9679
|
+
{
|
|
9680
|
+
errorKind: "forget_timeout"
|
|
9681
|
+
}
|
|
9682
|
+
);
|
|
9683
|
+
}
|
|
9684
|
+
const code = extractRememberErrorCode(err, "forget_failed");
|
|
9685
|
+
if (code === "managed_memory_unavailable") {
|
|
9686
|
+
throw new RequestError(
|
|
9687
|
+
-32009,
|
|
9688
|
+
"Managed memory is unavailable for this daemon workspace",
|
|
9689
|
+
{ errorKind: "managed_memory_unavailable" }
|
|
9690
|
+
);
|
|
9691
|
+
}
|
|
9692
|
+
throw new RequestError(-32099, "Workspace memory forget failed", {
|
|
9693
|
+
errorKind: code
|
|
9694
|
+
});
|
|
9695
|
+
}
|
|
9696
|
+
}
|
|
9697
|
+
case SERVE_CONTROL_EXT_METHODS.workspaceMemoryDream: {
|
|
9698
|
+
if (!this.config.isManagedMemoryAvailable()) {
|
|
9699
|
+
throw new RequestError(
|
|
9700
|
+
-32009,
|
|
9701
|
+
"Managed memory is unavailable for this daemon workspace",
|
|
9702
|
+
{ errorKind: "managed_memory_unavailable" }
|
|
9703
|
+
);
|
|
9704
|
+
}
|
|
9705
|
+
const childSignal = AbortSignal.timeout(
|
|
9706
|
+
WORKSPACE_MEMORY_REMEMBER_CHILD_TIMEOUT_MS
|
|
9707
|
+
);
|
|
9708
|
+
try {
|
|
9709
|
+
const result = await runManagedAutoMemoryDream(
|
|
9710
|
+
this.config.getProjectRoot(),
|
|
9711
|
+
/* @__PURE__ */ new Date(),
|
|
9712
|
+
createHiddenWorkspaceMemoryConfig(this.config),
|
|
9713
|
+
childSignal,
|
|
9714
|
+
{
|
|
9715
|
+
trigger: "manual",
|
|
9716
|
+
recordMetadata: true,
|
|
9717
|
+
suppressChatRecording: true
|
|
9718
|
+
}
|
|
9719
|
+
);
|
|
9720
|
+
return {
|
|
9721
|
+
summary: result.systemMessage,
|
|
9722
|
+
touchedTopics: result.touchedTopics,
|
|
9723
|
+
dedupedEntries: result.dedupedEntries
|
|
9724
|
+
};
|
|
9725
|
+
} catch (err) {
|
|
9726
|
+
if (err instanceof RequestError) {
|
|
9727
|
+
throw err;
|
|
9728
|
+
}
|
|
9729
|
+
if (childSignal.aborted) {
|
|
9730
|
+
throw new RequestError(-32099, "Workspace memory dream timed out", {
|
|
9731
|
+
errorKind: "dream_timeout"
|
|
9732
|
+
});
|
|
9733
|
+
}
|
|
9734
|
+
const code = extractRememberErrorCode(err, "dream_failed");
|
|
9735
|
+
if (code === "managed_memory_unavailable") {
|
|
9736
|
+
throw new RequestError(
|
|
9737
|
+
-32009,
|
|
9738
|
+
"Managed memory is unavailable for this daemon workspace",
|
|
9739
|
+
{ errorKind: "managed_memory_unavailable" }
|
|
9740
|
+
);
|
|
9741
|
+
}
|
|
9742
|
+
throw new RequestError(-32099, "Workspace memory dream failed", {
|
|
9743
|
+
errorKind: code
|
|
9744
|
+
});
|
|
9745
|
+
}
|
|
9746
|
+
}
|
|
9196
9747
|
case SERVE_CONTROL_EXT_METHODS.workspaceMcpRestart: {
|
|
9197
9748
|
const serverName = params["serverName"];
|
|
9198
9749
|
if (typeof serverName !== "string" || serverName.length === 0) {
|
|
@@ -9546,7 +10097,7 @@ var QwenAgent = class {
|
|
|
9546
10097
|
"Invalid or missing sessionId"
|
|
9547
10098
|
);
|
|
9548
10099
|
}
|
|
9549
|
-
if (typeof targetPath !== "string" || targetPath.length === 0 || !
|
|
10100
|
+
if (typeof targetPath !== "string" || targetPath.length === 0 || !path4.isAbsolute(targetPath) || targetPath.includes("\0")) {
|
|
9550
10101
|
throw RequestError.invalidParams(
|
|
9551
10102
|
void 0,
|
|
9552
10103
|
"Invalid or missing path (must be an absolute path)"
|
|
@@ -9561,7 +10112,7 @@ var QwenAgent = class {
|
|
|
9561
10112
|
}
|
|
9562
10113
|
let stats;
|
|
9563
10114
|
try {
|
|
9564
|
-
stats = await
|
|
10115
|
+
stats = await fs2.stat(targetPath);
|
|
9565
10116
|
} catch {
|
|
9566
10117
|
throw new RequestError(-32002, `Directory not found: ${targetPath}`, {
|
|
9567
10118
|
errorKind: "directory_not_found",
|
|
@@ -9574,7 +10125,7 @@ var QwenAgent = class {
|
|
|
9574
10125
|
path: targetPath
|
|
9575
10126
|
});
|
|
9576
10127
|
}
|
|
9577
|
-
const canonicalPath = await
|
|
10128
|
+
const canonicalPath = await fs2.realpath(targetPath);
|
|
9578
10129
|
const previousCwd = config.getTargetDir();
|
|
9579
10130
|
if (canonicalPath === previousCwd) {
|
|
9580
10131
|
return { previousCwd, newCwd: canonicalPath, warnings: [] };
|
|
@@ -9664,7 +10215,7 @@ var QwenAgent = class {
|
|
|
9664
10215
|
try {
|
|
9665
10216
|
await setLanguageAsync(language);
|
|
9666
10217
|
} catch (err) {
|
|
9667
|
-
|
|
10218
|
+
debugLogger7.warn("setLanguageAsync failed:", err);
|
|
9668
10219
|
throw new RequestError(
|
|
9669
10220
|
-32603,
|
|
9670
10221
|
`Failed to switch UI language: ${err instanceof Error ? err.message : String(err)}`
|
|
@@ -9678,7 +10229,7 @@ var QwenAgent = class {
|
|
|
9678
10229
|
language
|
|
9679
10230
|
);
|
|
9680
10231
|
} catch (err) {
|
|
9681
|
-
|
|
10232
|
+
debugLogger7.warn("Failed to persist UI language setting:", err);
|
|
9682
10233
|
}
|
|
9683
10234
|
let outputLanguage = null;
|
|
9684
10235
|
let refreshed = false;
|
|
@@ -9693,7 +10244,7 @@ var QwenAgent = class {
|
|
|
9693
10244
|
);
|
|
9694
10245
|
fileWriteOk = true;
|
|
9695
10246
|
} catch (err) {
|
|
9696
|
-
|
|
10247
|
+
debugLogger7.warn("Failed to write output-language.md:", err);
|
|
9697
10248
|
}
|
|
9698
10249
|
if (fileWriteOk) {
|
|
9699
10250
|
try {
|
|
@@ -9703,7 +10254,7 @@ var QwenAgent = class {
|
|
|
9703
10254
|
settingValue
|
|
9704
10255
|
);
|
|
9705
10256
|
} catch (err) {
|
|
9706
|
-
|
|
10257
|
+
debugLogger7.warn(
|
|
9707
10258
|
"Failed to persist output language setting:",
|
|
9708
10259
|
err
|
|
9709
10260
|
);
|
|
@@ -9723,7 +10274,7 @@ var QwenAgent = class {
|
|
|
9723
10274
|
writeOutputLanguageAndRegisterPath(settingValue, cfg);
|
|
9724
10275
|
}
|
|
9725
10276
|
} catch (err) {
|
|
9726
|
-
|
|
10277
|
+
debugLogger7.warn(
|
|
9727
10278
|
`Failed to write output-language.md for session ${s.getId()} (path=${sessionPath ?? "global-default"}):`,
|
|
9728
10279
|
err
|
|
9729
10280
|
);
|
|
@@ -9736,7 +10287,7 @@ var QwenAgent = class {
|
|
|
9736
10287
|
(r) => r.status === "rejected"
|
|
9737
10288
|
).length;
|
|
9738
10289
|
if (failedCount > 0) {
|
|
9739
|
-
|
|
10290
|
+
debugLogger7.warn(
|
|
9740
10291
|
`Language refresh failed for ${failedCount}/${results.length} session(s)`
|
|
9741
10292
|
);
|
|
9742
10293
|
}
|
|
@@ -9754,14 +10305,14 @@ var QwenAgent = class {
|
|
|
9754
10305
|
"Invalid or missing sessionId"
|
|
9755
10306
|
);
|
|
9756
10307
|
}
|
|
9757
|
-
|
|
10308
|
+
debugLogger7.debug(`recap ext-method received for session=${sessionId}`);
|
|
9758
10309
|
const session = this.sessionOrThrow(sessionId);
|
|
9759
10310
|
const config = session.getConfig();
|
|
9760
10311
|
const recap = await generateSessionRecap(
|
|
9761
10312
|
config,
|
|
9762
10313
|
new AbortController().signal
|
|
9763
10314
|
);
|
|
9764
|
-
|
|
10315
|
+
debugLogger7.debug(
|
|
9765
10316
|
`recap ext-method completed for session=${sessionId} result=${recap ? `len=${recap.length}` : "null"}`
|
|
9766
10317
|
);
|
|
9767
10318
|
return { sessionId, recap };
|
|
@@ -9785,7 +10336,7 @@ var QwenAgent = class {
|
|
|
9785
10336
|
const config = session.getConfig();
|
|
9786
10337
|
const cacheSafeParams = buildBtwCacheSafeParams(config);
|
|
9787
10338
|
if (!cacheSafeParams) {
|
|
9788
|
-
|
|
10339
|
+
debugLogger7.debug(`btw: no cacheSafeParams for session=${sessionId}`);
|
|
9789
10340
|
return { sessionId, answer: null };
|
|
9790
10341
|
}
|
|
9791
10342
|
const childSignal = AbortSignal.timeout(BTW_CHILD_TIMEOUT_MS);
|
|
@@ -9833,7 +10384,7 @@ var QwenAgent = class {
|
|
|
9833
10384
|
try {
|
|
9834
10385
|
hasHistory = (config.getGeminiClient().getHistoryShallow() ?? []).length > 0;
|
|
9835
10386
|
} catch (error) {
|
|
9836
|
-
|
|
10387
|
+
debugLogger7.debug("Failed to read history before /fork:", error);
|
|
9837
10388
|
}
|
|
9838
10389
|
if (!hasHistory) {
|
|
9839
10390
|
throw RequestError.invalidParams(
|
|
@@ -9875,7 +10426,7 @@ var QwenAgent = class {
|
|
|
9875
10426
|
]
|
|
9876
10427
|
});
|
|
9877
10428
|
} catch (error) {
|
|
9878
|
-
|
|
10429
|
+
debugLogger7.debug("Failed to record fork event in history:", error);
|
|
9879
10430
|
}
|
|
9880
10431
|
return { sessionId, description, launched: true };
|
|
9881
10432
|
}
|
|
@@ -9938,7 +10489,7 @@ ${outputText}
|
|
|
9938
10489
|
'taskKind must be "agent", "shell", or "monitor"'
|
|
9939
10490
|
);
|
|
9940
10491
|
}
|
|
9941
|
-
|
|
10492
|
+
debugLogger7.info(
|
|
9942
10493
|
`sessionTaskCancel requested sessionId=${sessionId} taskId=${taskId} taskKind=${taskKind}`
|
|
9943
10494
|
);
|
|
9944
10495
|
const session = this.sessionOrThrow(sessionId);
|
|
@@ -9948,7 +10499,7 @@ ${outputText}
|
|
|
9948
10499
|
const task = config.getBackgroundTaskRegistry().get(taskId);
|
|
9949
10500
|
if (!task || task.status !== "running" && task.status !== "paused") {
|
|
9950
10501
|
const reason = task ? "not_running" : "not_found";
|
|
9951
|
-
|
|
10502
|
+
debugLogger7.info(
|
|
9952
10503
|
`sessionTaskCancel skipped sessionId=${sessionId} taskId=${taskId} taskKind=${taskKind} reason=${reason} status=${task?.status ?? "missing"}`
|
|
9953
10504
|
);
|
|
9954
10505
|
return { cancelled: false, reason, status: task?.status };
|
|
@@ -9958,7 +10509,7 @@ ${outputText}
|
|
|
9958
10509
|
} else {
|
|
9959
10510
|
config.getBackgroundTaskRegistry().cancel(taskId);
|
|
9960
10511
|
}
|
|
9961
|
-
|
|
10512
|
+
debugLogger7.info(
|
|
9962
10513
|
`sessionTaskCancel completed sessionId=${sessionId} taskId=${taskId} taskKind=${taskKind} status=${task.status}`
|
|
9963
10514
|
);
|
|
9964
10515
|
return { cancelled: true, status: task.status };
|
|
@@ -9967,13 +10518,13 @@ ${outputText}
|
|
|
9967
10518
|
const task = config.getBackgroundShellRegistry().get(taskId);
|
|
9968
10519
|
if (!task || task.status !== "running") {
|
|
9969
10520
|
const reason = task ? "not_running" : "not_found";
|
|
9970
|
-
|
|
10521
|
+
debugLogger7.info(
|
|
9971
10522
|
`sessionTaskCancel skipped sessionId=${sessionId} taskId=${taskId} taskKind=${taskKind} reason=${reason} status=${task?.status ?? "missing"}`
|
|
9972
10523
|
);
|
|
9973
10524
|
return { cancelled: false, reason, status: task?.status };
|
|
9974
10525
|
}
|
|
9975
10526
|
config.getBackgroundShellRegistry().requestCancel(taskId);
|
|
9976
|
-
|
|
10527
|
+
debugLogger7.info(
|
|
9977
10528
|
`sessionTaskCancel completed sessionId=${sessionId} taskId=${taskId} taskKind=${taskKind} status=${task.status}`
|
|
9978
10529
|
);
|
|
9979
10530
|
return { cancelled: true, status: task.status };
|
|
@@ -9982,13 +10533,13 @@ ${outputText}
|
|
|
9982
10533
|
const task = config.getMonitorRegistry().get(taskId);
|
|
9983
10534
|
if (!task || task.status !== "running") {
|
|
9984
10535
|
const reason = task ? "not_running" : "not_found";
|
|
9985
|
-
|
|
10536
|
+
debugLogger7.info(
|
|
9986
10537
|
`sessionTaskCancel skipped sessionId=${sessionId} taskId=${taskId} taskKind=${taskKind} reason=${reason} status=${task?.status ?? "missing"}`
|
|
9987
10538
|
);
|
|
9988
10539
|
return { cancelled: false, reason, status: task?.status };
|
|
9989
10540
|
}
|
|
9990
10541
|
config.getMonitorRegistry().cancel(taskId);
|
|
9991
|
-
|
|
10542
|
+
debugLogger7.info(
|
|
9992
10543
|
`sessionTaskCancel completed sessionId=${sessionId} taskId=${taskId} taskKind=${taskKind} status=${task.status}`
|
|
9993
10544
|
);
|
|
9994
10545
|
return { cancelled: true, status: task.status };
|
|
@@ -10018,7 +10569,7 @@ ${outputText}
|
|
|
10018
10569
|
durationMs: Date.now() - cleared.setAt
|
|
10019
10570
|
});
|
|
10020
10571
|
}
|
|
10021
|
-
|
|
10572
|
+
debugLogger7.info(
|
|
10022
10573
|
`sessionGoalClear sessionId=${sessionId} cleared=${!!cleared} condition=${cleared?.condition ?? "(none)"}`
|
|
10023
10574
|
);
|
|
10024
10575
|
return {
|
|
@@ -10036,7 +10587,7 @@ ${outputText}
|
|
|
10036
10587
|
}
|
|
10037
10588
|
const session = this.sessionOrThrow(sessionId);
|
|
10038
10589
|
const result = await session.continueLastTurn();
|
|
10039
|
-
|
|
10590
|
+
debugLogger7.info(
|
|
10040
10591
|
`sessionContinue sessionId=${sessionId} accepted=${result.accepted} interruption=${result.interruption}`
|
|
10041
10592
|
);
|
|
10042
10593
|
return result;
|
|
@@ -10112,7 +10663,7 @@ ${outputText}
|
|
|
10112
10663
|
originatorClientId
|
|
10113
10664
|
);
|
|
10114
10665
|
} catch (sessionErr) {
|
|
10115
|
-
|
|
10666
|
+
debugLogger7.warn(
|
|
10116
10667
|
`workspaceMcpRuntimeAdd: failed to add runtime MCP server '${name}' to active session ${session.getConfig().getSessionId()}: ${sessionErr instanceof Error ? sessionErr.message : String(sessionErr)}`
|
|
10117
10668
|
);
|
|
10118
10669
|
}
|
|
@@ -10185,7 +10736,7 @@ ${outputText}
|
|
|
10185
10736
|
originatorClientId
|
|
10186
10737
|
);
|
|
10187
10738
|
} catch (sessionErr) {
|
|
10188
|
-
|
|
10739
|
+
debugLogger7.warn(
|
|
10189
10740
|
`workspaceMcpRuntimeRemove: failed to remove runtime MCP server '${name}' from active session ${session.getConfig().getSessionId()}: ${sessionErr instanceof Error ? sessionErr.message : String(sessionErr)}`
|
|
10190
10741
|
);
|
|
10191
10742
|
}
|
|
@@ -10201,7 +10752,7 @@ ${outputText}
|
|
|
10201
10752
|
try {
|
|
10202
10753
|
await extensionManager.refreshTools();
|
|
10203
10754
|
} catch (err) {
|
|
10204
|
-
|
|
10755
|
+
debugLogger7.warn(
|
|
10205
10756
|
`Extension tool refresh failed for session ${sessionId}: ${err instanceof Error ? err.message : String(err)}`
|
|
10206
10757
|
);
|
|
10207
10758
|
}
|
|
@@ -10349,7 +10900,7 @@ ${outputText}
|
|
|
10349
10900
|
filesFailed = fileResult.filesFailed;
|
|
10350
10901
|
} catch (err) {
|
|
10351
10902
|
const reason = err instanceof Error ? err.message : String(err);
|
|
10352
|
-
|
|
10903
|
+
debugLogger7.error(
|
|
10353
10904
|
`[ACP] File-history rewind failed for session=${sessionId} promptId=${promptId}: ${reason}`
|
|
10354
10905
|
);
|
|
10355
10906
|
filesFailed = [`file-history-rewind: ${reason}`];
|
|
@@ -10382,51 +10933,19 @@ ${outputText}
|
|
|
10382
10933
|
if (!sessionData?.conversation) {
|
|
10383
10934
|
return { updates: [] };
|
|
10384
10935
|
}
|
|
10385
|
-
const
|
|
10386
|
-
const replayContext = {
|
|
10936
|
+
const replay = await collectHistoryReplayUpdates({
|
|
10387
10937
|
sessionId,
|
|
10388
10938
|
config: this.config,
|
|
10389
|
-
|
|
10390
|
-
|
|
10391
|
-
}, "sendUpdate"),
|
|
10392
|
-
// Fresh accumulator for this replay: MessageEmitter advances it from
|
|
10393
|
-
// replayed usage metadata (tokens only — no per-turn durations) and
|
|
10394
|
-
// PlanEmitter snapshots it onto each todo update, so resumed sessions
|
|
10395
|
-
// recover per-task token spend (API time stays live-only).
|
|
10396
|
-
cumulativeUsage: {
|
|
10397
|
-
promptTokens: 0,
|
|
10398
|
-
cachedTokens: 0,
|
|
10399
|
-
candidateTokens: 0,
|
|
10400
|
-
apiTimeMs: 0
|
|
10401
|
-
}
|
|
10402
|
-
};
|
|
10403
|
-
let replayError;
|
|
10404
|
-
try {
|
|
10405
|
-
await new HistoryReplayer(replayContext).replay(
|
|
10406
|
-
sessionData.conversation.messages
|
|
10407
|
-
);
|
|
10408
|
-
} catch (error) {
|
|
10409
|
-
replayError = error instanceof Error ? error.message : String(error);
|
|
10410
|
-
debugLogger6.warn(
|
|
10411
|
-
"[loadUpdates] History replay failed for session %s (partial updates: %d):",
|
|
10412
|
-
sessionId,
|
|
10413
|
-
updates.length,
|
|
10414
|
-
error
|
|
10415
|
-
);
|
|
10416
|
-
}
|
|
10417
|
-
const updatesWithTopLevelTimestamps = updates.map((update) => {
|
|
10418
|
-
const record = update;
|
|
10419
|
-
const meta = record["_meta"];
|
|
10420
|
-
const timestamp = meta && typeof meta === "object" && !Array.isArray(meta) ? meta["timestamp"] : void 0;
|
|
10421
|
-
return typeof timestamp === "number" || typeof timestamp === "string" ? { ...record, timestamp } : record;
|
|
10939
|
+
records: sessionData.conversation.messages,
|
|
10940
|
+
cumulativeUsage: createReplayCumulativeUsage()
|
|
10422
10941
|
});
|
|
10423
10942
|
return {
|
|
10424
|
-
updates:
|
|
10943
|
+
updates: liftSessionUpdateTimestamps(replay.updates),
|
|
10425
10944
|
startTime: sessionData.conversation.startTime,
|
|
10426
10945
|
lastUpdated: sessionData.conversation.lastUpdated,
|
|
10427
10946
|
// Signal to the client that replay aborted partway so it doesn't
|
|
10428
10947
|
// render a truncated replay as the full conversation.
|
|
10429
|
-
...replayError !== void 0 ? { partial: true, replayError } : {}
|
|
10948
|
+
...replay.replayError !== void 0 ? { partial: true, replayError: replay.replayError } : {}
|
|
10430
10949
|
};
|
|
10431
10950
|
}
|
|
10432
10951
|
case "restoreSessionHistory": {
|
|
@@ -10767,7 +11286,7 @@ ${outputText}
|
|
|
10767
11286
|
newMerged.providerProtocol ?? {}
|
|
10768
11287
|
);
|
|
10769
11288
|
} catch (err) {
|
|
10770
|
-
|
|
11289
|
+
debugLogger7.warn(
|
|
10771
11290
|
`reload: reloadModelProvidersConfig failed for session ${id}: ${err}`
|
|
10772
11291
|
);
|
|
10773
11292
|
}
|
|
@@ -10777,7 +11296,7 @@ ${outputText}
|
|
|
10777
11296
|
try {
|
|
10778
11297
|
await config.switchModel(authType, newModelName);
|
|
10779
11298
|
} catch (err) {
|
|
10780
|
-
|
|
11299
|
+
debugLogger7.warn(
|
|
10781
11300
|
`reload: switchModel failed for session ${id}: ${err}`
|
|
10782
11301
|
);
|
|
10783
11302
|
}
|
|
@@ -10785,7 +11304,7 @@ ${outputText}
|
|
|
10785
11304
|
try {
|
|
10786
11305
|
await config.refreshAuth(authType);
|
|
10787
11306
|
} catch (err) {
|
|
10788
|
-
|
|
11307
|
+
debugLogger7.warn(
|
|
10789
11308
|
`reload: refreshAuth failed for session ${id}: ${err}`
|
|
10790
11309
|
);
|
|
10791
11310
|
}
|
|
@@ -10800,7 +11319,7 @@ ${outputText}
|
|
|
10800
11319
|
try {
|
|
10801
11320
|
config.setApprovalMode(newMode);
|
|
10802
11321
|
} catch (err) {
|
|
10803
|
-
|
|
11322
|
+
debugLogger7.warn(
|
|
10804
11323
|
`reload: setApprovalMode failed for session ${id}: ${err}`
|
|
10805
11324
|
);
|
|
10806
11325
|
}
|
|
@@ -10809,14 +11328,14 @@ ${outputText}
|
|
|
10809
11328
|
try {
|
|
10810
11329
|
await config.refreshHierarchicalMemory();
|
|
10811
11330
|
} catch (err) {
|
|
10812
|
-
|
|
11331
|
+
debugLogger7.warn(
|
|
10813
11332
|
`reload: refreshHierarchicalMemory failed for session ${id}: ${err}`
|
|
10814
11333
|
);
|
|
10815
11334
|
}
|
|
10816
11335
|
try {
|
|
10817
11336
|
await config.getGeminiClient()?.refreshSystemInstruction();
|
|
10818
11337
|
} catch (err) {
|
|
10819
|
-
|
|
11338
|
+
debugLogger7.warn(
|
|
10820
11339
|
`reload: refreshSystemInstruction failed for session ${id}: ${err}`
|
|
10821
11340
|
);
|
|
10822
11341
|
}
|
|
@@ -10826,7 +11345,7 @@ ${outputText}
|
|
|
10826
11345
|
for (let i = 0; i < results.length; i++) {
|
|
10827
11346
|
if (results[i].status === "rejected") {
|
|
10828
11347
|
const reason = results[i].reason;
|
|
10829
|
-
|
|
11348
|
+
debugLogger7.warn(
|
|
10830
11349
|
`Session ${sessions[i][0]} reload failed: ${reason}`
|
|
10831
11350
|
);
|
|
10832
11351
|
skipped.push(sessions[i][0]);
|
|
@@ -10859,8 +11378,7 @@ ${outputText}
|
|
|
10859
11378
|
buildClientMcpSender() {
|
|
10860
11379
|
return (serverName, message) => deliverClientMcpMessage(this.connection, serverName, message);
|
|
10861
11380
|
}
|
|
10862
|
-
async newSessionConfig(cwd, mcpServers, sessionId, resume) {
|
|
10863
|
-
this.settings = loadSettings(cwd);
|
|
11381
|
+
async newSessionConfig(cwd, mcpServers, settings, sessionId, resume) {
|
|
10864
11382
|
const sessionMcpServers = {};
|
|
10865
11383
|
for (const server of mcpServers) {
|
|
10866
11384
|
const stdioServer = toStdioServer(server);
|
|
@@ -10912,14 +11430,14 @@ ${outputText}
|
|
|
10912
11430
|
continue;
|
|
10913
11431
|
}
|
|
10914
11432
|
}
|
|
10915
|
-
const
|
|
11433
|
+
const mergedSettings = settings.merged;
|
|
10916
11434
|
const argvForSession = {
|
|
10917
11435
|
...this.argv,
|
|
10918
11436
|
...resume ? { resume: sessionId } : { sessionId },
|
|
10919
11437
|
continue: false
|
|
10920
11438
|
};
|
|
10921
11439
|
const config = await loadCliConfig(
|
|
10922
|
-
|
|
11440
|
+
mergedSettings,
|
|
10923
11441
|
argvForSession,
|
|
10924
11442
|
cwd,
|
|
10925
11443
|
// ACP sessions do not provide an extension override. Passing [] is a
|
|
@@ -10928,16 +11446,16 @@ ${outputText}
|
|
|
10928
11446
|
void 0,
|
|
10929
11447
|
// Pass separated hooks for proper source attribution
|
|
10930
11448
|
{
|
|
10931
|
-
userHooks:
|
|
10932
|
-
projectHooks:
|
|
11449
|
+
userHooks: settings.getUserHooks(),
|
|
11450
|
+
projectHooks: settings.getProjectHooks()
|
|
10933
11451
|
},
|
|
10934
|
-
// CRITICAL: close over `
|
|
10935
|
-
// over the
|
|
10936
|
-
// setValue` replaces `_merged`, so a closure over the
|
|
10937
|
-
// never see workspace toggles applied during the
|
|
10938
|
-
// sessions otherwise leak persisted disabled skills
|
|
10939
|
-
// <available_skills> at cold start.
|
|
10940
|
-
buildDisabledSkillNamesProvider(
|
|
11452
|
+
// CRITICAL: close over the per-request `settings` (LoadedSettings
|
|
11453
|
+
// instance), NOT over the `mergedSettings` snapshot built above.
|
|
11454
|
+
// `LoadedSettings.setValue` replaces `_merged`, so a closure over the
|
|
11455
|
+
// snapshot would never see workspace toggles applied during the
|
|
11456
|
+
// session. ACP/Zed sessions otherwise leak persisted disabled skills
|
|
11457
|
+
// into the first <available_skills> at cold start.
|
|
11458
|
+
buildDisabledSkillNamesProvider(settings),
|
|
10941
11459
|
sessionMcpServers
|
|
10942
11460
|
);
|
|
10943
11461
|
if (typeof config.enableFileCheckpointing === "function") {
|
|
@@ -10964,7 +11482,7 @@ ${outputText}
|
|
|
10964
11482
|
sessionId: sid,
|
|
10965
11483
|
...event
|
|
10966
11484
|
}).catch((err) => {
|
|
10967
|
-
|
|
11485
|
+
debugLogger7.debug(
|
|
10968
11486
|
`MCP budget extNotification dropped (session=${sid}, kind=${event.kind}): ${err instanceof Error ? err.message : String(err)}`
|
|
10969
11487
|
);
|
|
10970
11488
|
});
|
|
@@ -10985,7 +11503,7 @@ ${outputText}
|
|
|
10985
11503
|
try {
|
|
10986
11504
|
await config.waitForMcpReady();
|
|
10987
11505
|
} catch (err) {
|
|
10988
|
-
|
|
11506
|
+
debugLogger7.error(
|
|
10989
11507
|
`MCP discovery readiness failed: ${err instanceof Error ? err.message : String(err)}`
|
|
10990
11508
|
);
|
|
10991
11509
|
return;
|
|
@@ -11009,7 +11527,7 @@ ${outputText}
|
|
|
11009
11527
|
try {
|
|
11010
11528
|
await config.refreshAuth(selectedType, true);
|
|
11011
11529
|
} catch (e) {
|
|
11012
|
-
|
|
11530
|
+
debugLogger7.error(`Authentication failed: ${e}`);
|
|
11013
11531
|
throw RequestError.authRequired(
|
|
11014
11532
|
{
|
|
11015
11533
|
authMethods: pickAuthMethodsForAuthRequired(selectedType)
|
|
@@ -11030,7 +11548,7 @@ ${outputText}
|
|
|
11030
11548
|
// auto-memory roots, so ACP-local read fallback follows the same policy.
|
|
11031
11549
|
localReadRoots: [
|
|
11032
11550
|
config.storage.getProjectTempDir(),
|
|
11033
|
-
|
|
11551
|
+
path4.join(config.storage.getProjectDir(), "subagents"),
|
|
11034
11552
|
Storage.getGlobalTempDir(),
|
|
11035
11553
|
getAutoMemoryRoot(config.getTargetDir()),
|
|
11036
11554
|
getUserAutoMemoryRoot(),
|
|
@@ -11041,7 +11559,7 @@ ${outputText}
|
|
|
11041
11559
|
);
|
|
11042
11560
|
config.setFileSystemService(acpFileSystemService);
|
|
11043
11561
|
}
|
|
11044
|
-
async createAndStoreSession(config, sessionData, options = {}) {
|
|
11562
|
+
async createAndStoreSession(config, settings, sessionData, options = {}) {
|
|
11045
11563
|
const sessionId = config.getSessionId();
|
|
11046
11564
|
const geminiClient = config.getGeminiClient();
|
|
11047
11565
|
const needsInitialize = !geminiClient.isInitialized();
|
|
@@ -11049,12 +11567,7 @@ ${outputText}
|
|
|
11049
11567
|
await geminiClient.initialize();
|
|
11050
11568
|
}
|
|
11051
11569
|
this.sessions.get(sessionId)?.dispose();
|
|
11052
|
-
const session = new Session(
|
|
11053
|
-
sessionId,
|
|
11054
|
-
config,
|
|
11055
|
-
this.connection,
|
|
11056
|
-
this.settings
|
|
11057
|
-
);
|
|
11570
|
+
const session = new Session(sessionId, config, this.connection, settings);
|
|
11058
11571
|
this.sessions.set(sessionId, session);
|
|
11059
11572
|
setTimeout(async () => {
|
|
11060
11573
|
await session.sendAvailableCommandsUpdate();
|
|
@@ -11068,8 +11581,10 @@ ${outputText}
|
|
|
11068
11581
|
if (options.replayHistory !== false && sessionData?.conversation.messages) {
|
|
11069
11582
|
await session.replayHistory(sessionData.conversation.messages);
|
|
11070
11583
|
}
|
|
11071
|
-
|
|
11072
|
-
|
|
11584
|
+
if (options.startPostReplayServices !== false) {
|
|
11585
|
+
session.installRewriter();
|
|
11586
|
+
session.startCronScheduler();
|
|
11587
|
+
}
|
|
11073
11588
|
return session;
|
|
11074
11589
|
}
|
|
11075
11590
|
buildAvailableModels(config) {
|