@qwen-code/qwen-code 0.23.1-preview.1 → 0.23.1-preview.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled/qc-helper/docs/configuration/settings.md +7 -7
- package/bundled/qc-helper/docs/features/channels/dingtalk.md +26 -0
- package/bundled/qc-helper/docs/features/commands.md +71 -6
- package/bundled/qc-helper/docs/features/skills.md +40 -0
- package/chunks/{MaxSizedBox-5ARLO5PR.js → MaxSizedBox-IYIQ43IZ.js} +26 -27
- package/chunks/{StandaloneSessionPicker-T6B322CB.js → StandaloneSessionPicker-AWB2OHX6.js} +44 -45
- package/chunks/{acp-startup-profiler-6ULXXQMS.js → acp-startup-profiler-BAL4LJTN.js} +2 -2
- package/chunks/{acpAgent-WTDEY5KD.js → acpAgent-ZC57OLS4.js} +148 -96
- package/chunks/{agent-NXPUXEVZ.js → agent-GEBPAEJS.js} +16 -17
- package/chunks/{agent-headless-QQZTWOKO.js → agent-headless-63ZEYAJK.js} +16 -17
- package/chunks/{artifact-tool-DFVVJXL2.js → artifact-tool-P52OKKEF.js} +1 -1
- package/chunks/{askUserQuestion-GF7VQ44M.js → askUserQuestion-3KAYLLMM.js} +2 -2
- package/chunks/{bridge-OHY5OGOZ.js → bridge-MHWO5I5T.js} +30 -31
- package/chunks/{channel-management-service-ZDDG3G5S.js → channel-management-service-NFRZXQFO.js} +4 -4
- package/chunks/{channel-settings-store-7BJAS2SU.js → channel-settings-store-T7PMIHKC.js} +36 -37
- package/chunks/{channel-worker-group-2ISMRENV.js → channel-worker-group-O2BWK5F7.js} +5 -5
- package/chunks/{channel-worker-manager-VSRPVPRH.js → channel-worker-manager-4WP7VJOD.js} +5 -5
- package/chunks/{channel-worker-supervisor-SRJBK72Z.js → channel-worker-supervisor-CCUXD6J5.js} +3 -3
- package/chunks/{chunk-4VZCORNT.js → chunk-22QOQKG4.js} +1 -1
- package/chunks/{chunk-AHBLRVD5.js → chunk-2C3XDBGL.js} +4 -4
- package/chunks/{chunk-WTW36TJ3.js → chunk-2EKVPSIJ.js} +1 -1
- package/chunks/{chunk-ZTAVGFKA.js → chunk-37SOBIA3.js} +1 -1
- package/chunks/{chunk-IXSGOSEG.js → chunk-3RMVM33U.js} +28 -25
- package/chunks/{chunk-H3UDNQLO.js → chunk-4OCYWXKF.js} +1 -1
- package/chunks/{chunk-D6PIMKY3.js → chunk-4VY3ITHR.js} +4 -4
- package/chunks/{chunk-J3O5I5ZD.js → chunk-5FYGZ7E3.js} +3 -3
- package/chunks/{chunk-4JAGXZR3.js → chunk-5V4B3EWA.js} +1 -1
- package/chunks/{chunk-HFTB354P.js → chunk-5Z4FCEPY.js} +60 -6
- package/chunks/{chunk-VDXYYVCD.js → chunk-65GHQ4FX.js} +65 -10
- package/chunks/{chunk-32YDNYXP.js → chunk-6KYWU726.js} +1 -1
- package/chunks/{chunk-4HC4DYKN.js → chunk-6RZX2HIH.js} +1 -1
- package/chunks/{chunk-IFD3BTEA.js → chunk-733KQL63.js} +3 -3
- package/chunks/{chunk-MWHY26G3.js → chunk-75UQFGFE.js} +1 -1
- package/chunks/{chunk-QWZOOIR3.js → chunk-7PMKXGRP.js} +4 -4
- package/chunks/{chunk-KE3Q4JMY.js → chunk-AIMZIXZM.js} +3 -3
- package/chunks/{chunk-G34YLYCS.js → chunk-ANVC5CSK.js} +10 -10
- package/chunks/{chunk-SAZS4IWW.js → chunk-AUJOWIT5.js} +3 -3
- package/chunks/{chunk-Z6WZPXQH.js → chunk-AWDF462I.js} +1 -1
- package/chunks/{chunk-47BZVBTE.js → chunk-AX23QSX3.js} +3 -3
- package/chunks/{chunk-7BZS4ZDV.js → chunk-B5FF3LRF.js} +17 -17
- package/chunks/{chunk-TMWB67LS.js → chunk-BNWIX6BM.js} +2 -2
- package/chunks/{chunk-GZWW2QWR.js → chunk-C4NXRR7T.js} +2 -2
- package/chunks/{chunk-DNPHKA72.js → chunk-C55CR5I4.js} +6 -6
- package/chunks/{chunk-JPEAQJNS.js → chunk-C7M445SS.js} +1 -1
- package/chunks/{chunk-R355CUNQ.js → chunk-CLKE4IY3.js} +1 -77
- package/chunks/{chunk-VUSSAGKI.js → chunk-E4VX6LXB.js} +1 -1
- package/chunks/{chunk-GMNLYQOS.js → chunk-E6TI726I.js} +1 -1
- package/chunks/{chunk-Y3ZKI4RQ.js → chunk-EGRFCIXD.js} +19 -17
- package/chunks/{chunk-D4CU6DKR.js → chunk-EPZWBYQI.js} +5 -5
- package/chunks/{chunk-43NOB5NM.js → chunk-ERMAXPXA.js} +1 -1
- package/chunks/{chunk-KPXRFTT7.js → chunk-FETY36NQ.js} +1 -1
- package/chunks/{chunk-P6LATTDG.js → chunk-FWH4736Q.js} +3 -3
- package/chunks/{chunk-43JNQAHO.js → chunk-FXYNIZPW.js} +2 -2
- package/chunks/{chunk-4VUVBN3Y.js → chunk-G6UUOCUT.js} +87 -0
- package/chunks/{chunk-XY3USGFE.js → chunk-GEV66YGE.js} +1 -1
- package/chunks/{chunk-VEFRT7NX.js → chunk-H3Q3RSKZ.js} +1 -1
- package/chunks/{chunk-BKNY7PDI.js → chunk-HPE4LEWX.js} +1 -1
- package/chunks/{chunk-E4L5BM2B.js → chunk-HWZOOSEB.js} +4 -4
- package/chunks/{chunk-MNEYUNOE.js → chunk-HZS3JRQW.js} +2 -2
- package/chunks/{chunk-2RYWGYB3.js → chunk-I67KJGM6.js} +3 -3
- package/chunks/{chunk-O2GG7H4C.js → chunk-I7UNCY24.js} +2 -2
- package/chunks/{chunk-JLWFGYXU.js → chunk-IGOIYZBG.js} +2 -2
- package/chunks/{chunk-L4R7BCVV.js → chunk-IMWCUWQT.js} +1 -1
- package/chunks/{chunk-QMFOYPGV.js → chunk-J3VZF2AL.js} +2 -2
- package/chunks/{chunk-XOVVCGZX.js → chunk-JOV46WGX.js} +1 -1
- package/chunks/{chunk-LMJQSPWB.js → chunk-KA5HR3G2.js} +1 -1
- package/chunks/{chunk-VY6UVU7G.js → chunk-KAZWXVI3.js} +2 -2
- package/chunks/{chunk-IQN2CCIE.js → chunk-KP5QK3FB.js} +3 -3
- package/chunks/{chunk-2WGJG2KW.js → chunk-KTLT7VCX.js} +4 -4
- package/chunks/{chunk-IKLFS6SC.js → chunk-L36LLVA5.js} +3 -3
- package/chunks/{chunk-MUZCSTOO.js → chunk-LD53HMPV.js} +4 -4
- package/chunks/{chunk-P4RUUG64.js → chunk-LTCI6ZOJ.js} +1 -1
- package/chunks/{chunk-SN5FV4FY.js → chunk-LYHYXJJ3.js} +3 -3
- package/chunks/{chunk-RDKXZ2LS.js → chunk-LYT2OU7D.js} +1 -1
- package/chunks/{chunk-GVVCLL2P.js → chunk-MFCWL4LI.js} +9 -9
- package/chunks/{chunk-RPBMP6BN.js → chunk-MWIO7MF6.js} +3 -0
- package/chunks/{chunk-OECNP26L.js → chunk-N6S3NUYJ.js} +1 -1
- package/chunks/{chunk-NGX4NUNP.js → chunk-O2FEO2CB.js} +131 -6
- package/chunks/{chunk-GXZHYPHZ.js → chunk-OFB36ZBA.js} +4 -1
- package/chunks/{chunk-LDS57224.js → chunk-OWCFKIFQ.js} +1 -1
- package/chunks/{chunk-ZAZ3NFL6.js → chunk-P5Z7VD23.js} +237 -52
- package/chunks/{chunk-5MTARK4Y.js → chunk-PLUAIHZO.js} +4 -4
- package/chunks/{chunk-KK2GZGBK.js → chunk-PMGWY6ZP.js} +10 -10
- package/chunks/{chunk-JRYL3T2O.js → chunk-PQSCGZT2.js} +1 -1
- package/chunks/{chunk-UKKYOIVT.js → chunk-QAZ2MGYT.js} +2 -2
- package/chunks/{chunk-CZACBHAW.js → chunk-QQGAR64U.js} +4 -4
- package/chunks/{chunk-ER273QE6.js → chunk-QW7BUOSI.js} +2 -2
- package/chunks/{chunk-RVNS7NWN.js → chunk-R7TKFIQO.js} +1 -1
- package/chunks/{chunk-GCFZ2LAX.js → chunk-RCUWMVN3.js} +1 -1
- package/chunks/{chunk-CWNC7M73.js → chunk-RD3VPM4E.js} +2 -2
- package/chunks/{chunk-KJJPJYHI.js → chunk-REDVV5NC.js} +7 -7
- package/chunks/{chunk-4IQKBLTQ.js → chunk-RGAQDQ3Z.js} +9 -9
- package/chunks/{chunk-WXC6OAWD.js → chunk-RH344FKI.js} +1 -1
- package/chunks/{chunk-64MQTIX7.js → chunk-RPFJJ33Z.js} +2 -2
- package/chunks/{chunk-LPBQODMR.js → chunk-RQNAO42A.js} +4 -4
- package/chunks/{chunk-LK7S2D6V.js → chunk-RRCNEW2A.js} +4 -4
- package/chunks/{chunk-O45WBTNS.js → chunk-RSU3I6UL.js} +3 -3
- package/chunks/{chunk-AQ5NAGWI.js → chunk-RUMSY4ES.js} +4 -4
- package/chunks/{chunk-QSC5YOEC.js → chunk-SD7Y2PMC.js} +1 -1
- package/chunks/{chunk-SFMCYMVF.js → chunk-SHK2SIR5.js} +4 -4
- package/chunks/{chunk-XUSOYE2I.js → chunk-SHX2HIE7.js} +1 -1
- package/chunks/{chunk-PTFFWTTO.js → chunk-SI6Q52UI.js} +3 -3
- package/chunks/{chunk-JBTZUFR4.js → chunk-T7TP5UQL.js} +6 -6
- package/chunks/{chunk-YCDL2SAS.js → chunk-TDHVOZ65.js} +2 -2
- package/chunks/{chunk-PZV2FASB.js → chunk-TRWQQBVH.js} +1 -1
- package/chunks/{chunk-I72PHOKL.js → chunk-TSLRORQR.js} +93 -95
- package/chunks/{chunk-UEZOXZNI.js → chunk-TXAEXF2B.js} +786 -366
- package/chunks/{chunk-4F2QRVW6.js → chunk-UTVIIA7N.js} +1 -1
- package/chunks/{chunk-WR3SH3EY.js → chunk-VMFPZXRT.js} +131 -60
- package/chunks/{chunk-XHGGYCTA.js → chunk-VYCJITND.js} +1 -1
- package/chunks/{chunk-5YY5MZT6.js → chunk-WFXD5OZH.js} +1 -1
- package/chunks/{chunk-URSCX7S7.js → chunk-WLZRMF3C.js} +2 -2
- package/chunks/{chunk-P5LDR7FI.js → chunk-WQBR7LN5.js} +3 -3
- package/chunks/{chunk-N7VURC4O.js → chunk-WXFCI3O5.js} +2 -2
- package/chunks/{chunk-HJ34U5J4.js → chunk-XNC2TCUO.js} +4 -4
- package/chunks/{chunk-N7EYO2E7.js → chunk-XQ4RDO5B.js} +1 -1
- package/chunks/{chunk-JOPC3FND.js → chunk-XX4MBBFW.js} +5 -5
- package/chunks/{chunk-TDP7UULF.js → chunk-Y3C5COGI.js} +1 -1
- package/chunks/{chunk-54TF2ZIQ.js → chunk-YLFICBYK.js} +3 -3
- package/chunks/{chunk-4MCY33Y2.js → chunk-Z6DDPSGJ.js} +1 -1
- package/chunks/{chunk-WEXA2DNG.js → chunk-Z6KFLEG7.js} +13 -0
- package/chunks/{chunk-PZUOHCWI.js → chunk-ZNI3V2XA.js} +2 -2
- package/chunks/{chunk-6UIACMGH.js → chunk-ZRVFHLLK.js} +1 -1
- package/chunks/{chunk-NAKALAL4.js → chunk-ZT3XUGSU.js} +32 -8
- package/chunks/{config-utils-QXDOTXEQ.js → config-utils-F4CFJ4MW.js} +30 -31
- package/chunks/{contextCommand-RN4KARWC.js → contextCommand-OIIGGOMU.js} +28 -29
- package/chunks/{core-runtime-NAZCOKHB.js → core-runtime-JEHLOGMB.js} +26 -27
- package/chunks/{create-sub-session-BCSM4WKB.js → create-sub-session-MVFBE5RA.js} +35 -30
- package/chunks/{create-sub-session-BQ3SE4TX.js → create-sub-session-TGIX63YU.js} +2 -2
- package/chunks/{cron-create-D6HQ7I7I.js → cron-create-GTPVMJCF.js} +1 -1
- package/chunks/{cron-delete-KK3D2SQV.js → cron-delete-ZBK27Z4K.js} +1 -1
- package/chunks/{cron-list-VBF3IZMF.js → cron-list-KTFKFDKC.js} +1 -1
- package/chunks/{daemon-git-worktree-guard-3K5CAU36.js → daemon-git-worktree-guard-5FTKLJOU.js} +26 -27
- package/chunks/{daemon-status-provider-4X3ZZQTZ.js → daemon-status-provider-P6A5MPMW.js} +35 -36
- package/chunks/{daemon-trust-policy-R45CFUJA.js → daemon-trust-policy-ZJ3NFYUO.js} +32 -33
- package/chunks/{daemon-trust-policy-monitor-DSSFCO3K.js → daemon-trust-policy-monitor-6SDLEW7S.js} +32 -33
- package/chunks/{deferred-core-runtime-UO2M6WYI.js → deferred-core-runtime-DWOXIU5S.js} +26 -27
- package/chunks/{display-image-EVVTBVYE.js → display-image-CTNHJRZC.js} +4 -4
- package/chunks/{dist-PH5RSTEA.js → dist-3H3WODVS.js} +1 -1
- package/chunks/{dist-UVHW2U56.js → dist-AI25RVRA.js} +1 -1
- package/chunks/{dist-AFH3BMZZ.js → dist-I74QLLQS.js} +1 -1
- package/chunks/{dist-SIHF5MU2.js → dist-NXW4DUUX.js} +1 -1
- package/chunks/{dist-MK5PPBRF.js → dist-P6YWBITG.js} +670 -17
- package/chunks/{dist-QUU7TVE3.js → dist-T4PRA5EZ.js} +1 -1
- package/chunks/{dist-SB2XRXZA.js → dist-VCAS67N5.js} +1 -1
- package/chunks/{dist-3T5MDUHP.js → dist-XINEKB5A.js} +1 -1
- package/chunks/{dist-R5Y34V6T.js → dist-YNQU4CKC.js} +2 -2
- package/chunks/{edit-VNBCTRWP.js → edit-WPVXLL3T.js} +16 -17
- package/chunks/{en-JMR535HP.js → en-YJNRUQG4.js} +1 -1
- package/chunks/{enter-worktree-CEVK7MQ2.js → enter-worktree-5A6VW6BN.js} +4 -4
- package/chunks/{enterPlanMode-4KMZMUIA.js → enterPlanMode-JSODW7E2.js} +16 -17
- package/chunks/{environment-S2HYQDON.js → environment-5LLJ3I3W.js} +28 -29
- package/chunks/{errors-DAAN5TL7.js → errors-IQT3YZEP.js} +28 -29
- package/chunks/{exit-worktree-D3YE6MUN.js → exit-worktree-QV7E7KP6.js} +4 -4
- package/chunks/{exitPlanMode-HR36HG3D.js → exitPlanMode-DDVFYNW4.js} +16 -17
- package/chunks/{fast-path-4IWSW3UV.js → fast-path-PAUQQEVU.js} +2 -2
- package/chunks/{glob-IZYB2XH2.js → glob-SQ7CTZ7F.js} +16 -17
- package/chunks/{goal-tools-VGUPKQDJ.js → goal-tools-UWZRCLQB.js} +16 -17
- package/chunks/{grep-OUVLNXG7.js → grep-BLHF2S5D.js} +2 -2
- package/chunks/{handleAutoUpdate-D56FMDTW.js → handleAutoUpdate-RUPZZTSG.js} +29 -30
- package/chunks/{i18n-BKE5WO6T.js → i18n-SF5MPWEB.js} +27 -28
- package/chunks/{image-gen-SHVQ3XID.js → image-gen-Q3RUTVKR.js} +1 -1
- package/chunks/{initializer-MS4SGEHF.js → initializer-CK4WPYZG.js} +32 -33
- package/chunks/{installationInfo-542MGC4S.js → installationInfo-IRPQEYRF.js} +26 -27
- package/chunks/{list-H6XTKUWL.js → list-E3PS3EBJ.js} +35 -36
- package/chunks/{list-agents-ULYBGJXC.js → list-agents-I5TRH3J7.js} +2 -2
- package/chunks/{llm-3NUC4EJY.js → llm-JQKBOYAF.js} +67 -68
- package/chunks/{llm-content-generator-R4NL3OQN.js → llm-content-generator-2QWGBW42.js} +2 -2
- package/chunks/{loadedSettingsAdapter-3XLKYDVT.js → loadedSettingsAdapter-DGXGVYZS.js} +32 -33
- package/chunks/{loggingContentGenerator-ZYSWVNEO.js → loggingContentGenerator-ZYURLJKK.js} +18 -19
- package/chunks/{loop-wakeup-B27BEYRL.js → loop-wakeup-HL6XOWI4.js} +2 -2
- package/chunks/{ls-3IIMMVKF.js → ls-YV7RKLKY.js} +1 -1
- package/chunks/{lsp-VJAT7XKS.js → lsp-NO3AMRZT.js} +1 -1
- package/chunks/{managed-npm-update-L2I53ZAI.js → managed-npm-update-HTHR63EA.js} +26 -27
- package/chunks/{mcp-4PIXQASW.js → mcp-I7G2AEWS.js} +32 -33
- package/chunks/{monitor-O2YQTOZZ.js → monitor-4R76BCRZ.js} +16 -17
- package/chunks/{nonInteractiveCli-LV7CDBA2.js → nonInteractiveCli-24OQ3VP2.js} +64 -65
- package/chunks/{notebook-edit-4RE2ALH4.js → notebook-edit-PPSH7FEX.js} +16 -17
- package/chunks/{openaiContentGenerator-7ND7K5CP.js → openaiContentGenerator-K7V5EO7F.js} +10 -10
- package/chunks/{pidfile-UFTLQ7NP.js → pidfile-TGIUY2GG.js} +26 -27
- package/chunks/{processUtils-3XBB4FYV.js → processUtils-3USXUQWX.js} +2 -2
- package/chunks/{prompt-terminal-ledger-2QASOGMM.js → prompt-terminal-ledger-XHVZRXJI.js} +27 -28
- package/chunks/{qwenContentGenerator-AELTUTH6.js → qwenContentGenerator-MPBOQB64.js} +18 -19
- package/chunks/{read-file-PDWHZPHX.js → read-file-R256LDWQ.js} +4 -4
- package/chunks/{read-mcp-resource-YXJZ75UB.js → read-mcp-resource-D3N75DGF.js} +1 -1
- package/chunks/{record-artifact-WJDOV6XU.js → record-artifact-Q5CRGJTP.js} +2 -2
- package/chunks/{report-findings-Q4UACKWR.js → report-findings-TJ34R7QK.js} +3 -3
- package/chunks/{request-shutdown-2YZ3E3GH.js → request-shutdown-LRKMTBAD.js} +6 -6
- package/chunks/{resumeHistoryUtils-QRXZEEBA.js → resumeHistoryUtils-S43LTFHD.js} +30 -31
- package/chunks/{ripGrep-KSOOLE6H.js → ripGrep-L7HPZ75Y.js} +7 -7
- package/chunks/{run-qwen-serve-RTAREPT6.js → run-qwen-serve-CTFL5R6U.js} +46 -46
- package/chunks/{runtime-ESFSCJRZ.js → runtime-FS5TL6P7.js} +37 -38
- package/chunks/{scheduled-tasks-6ZHRNBH6.js → scheduled-tasks-QXPV3Q35.js} +32 -33
- package/chunks/{scheduler-DQI6KV7T.js → scheduler-EXU5HMVK.js} +28 -29
- package/chunks/{send-message-PQCVSVMN.js → send-message-GQKXGMPI.js} +7 -7
- package/chunks/{serve-FY7ZEW52.js → serve-ITJC7WNN.js} +32 -33
- package/chunks/{server-KNDY6K5F.js → server-6JQY3PTU.js} +66 -67
- package/chunks/{session-MCEPXAZP.js → session-PJDEKXD4.js} +85 -72
- package/chunks/{session-attachments-root-OLNAE6GF.js → session-attachments-root-L37ORSST.js} +26 -27
- package/chunks/{session-pr-refresh-HKJHQQQK.js → session-pr-refresh-WIFD52YL.js} +31 -32
- package/chunks/{settings-VXO4WBMK.js → settings-LO6J5SAZ.js} +31 -32
- package/chunks/{shell-U263OTES.js → shell-ANAFVYGR.js} +16 -17
- package/chunks/{skill-SDODGBKL.js → skill-SHJWKSPH.js} +10 -57
- package/chunks/{skill-settings-YEIA22QJ.js → skill-settings-GX3XHZ5Q.js} +31 -32
- package/chunks/{spawnChannel-4WJZVFPP.js → spawnChannel-WE42VBKM.js} +28 -29
- package/chunks/{standalone-update-ZWVQUO64.js → standalone-update-CWDIKJRP.js} +28 -29
- package/chunks/{start-opentui-ui-BFYCJQRZ.js → start-opentui-ui-BBHGFOTF.js} +70 -71
- package/chunks/{startInteractiveUI-JYAFCMHL.js → startInteractiveUI-FQX7LUYP.js} +172 -110
- package/chunks/{syntheticOutput-AUAJBNXR.js → syntheticOutput-D2P5V6RG.js} +2 -2
- package/chunks/{task-create-LD5ISM3E.js → task-create-PMAFST2T.js} +7 -7
- package/chunks/{task-list-YISJ4RJA.js → task-list-R2HSY2NC.js} +1 -1
- package/chunks/{task-stop-65ZOVATJ.js → task-stop-BFSKRTGV.js} +1 -1
- package/chunks/{task-update-AAN4ZVEY.js → task-update-JYC57USF.js} +7 -7
- package/chunks/{team-create-KU7MABNO.js → team-create-WKTPCH6D.js} +16 -17
- package/chunks/{team-delete-XFRRTJTT.js → team-delete-CBHVBTPB.js} +1 -1
- package/chunks/{team-plan-approval-DPB377A3.js → team-plan-approval-Y23DL7WR.js} +16 -17
- package/chunks/{terminal-image-renderer-WGWRENOF.js → terminal-image-renderer-B646HBDW.js} +28 -29
- package/chunks/{theme-manager-GBUFULSO.js → theme-manager-BNWESY26.js} +26 -27
- package/chunks/{todoWrite-G7NT4IFP.js → todoWrite-5ERKFWAK.js} +3 -5
- package/chunks/{tool-search-6YUXHBPT.js → tool-search-PVQ5O5Y2.js} +9 -9
- package/chunks/{total-session-admission-54R2JQ5L.js → total-session-admission-P5Z43KNW.js} +30 -31
- package/chunks/{trustedFolders-KAJIDJTH.js → trustedFolders-FH2LT2MZ.js} +27 -28
- package/chunks/{update-relaunch-XM4IWBFD.js → update-relaunch-WOWTKJSN.js} +5 -5
- package/chunks/{updateCheck-W6UZFURI.js → updateCheck-3MYFMM35.js} +28 -29
- package/chunks/{useAutoAcceptIndicator-LAWYHY3U.js → useAutoAcceptIndicator-Q7ZRRRKO.js} +33 -34
- package/chunks/{validateNonInterActiveAuth-7WCKHRN2.js → validateNonInterActiveAuth-MYEWJX3G.js} +61 -62
- package/chunks/{version-3ZU43RJ6.js → version-RO2FPO76.js} +1 -1
- package/chunks/{web-fetch-QHI2SQL4.js → web-fetch-QAKY2LUA.js} +4 -4
- package/chunks/{web-search-3KZZKWNY.js → web-search-XA5Z4ZCD.js} +2 -2
- package/chunks/{workflow-HRW7Y2X4.js → workflow-QFIOCMDM.js} +18 -19
- package/chunks/{workspace-providers-status-KTGCWCPC.js → workspace-providers-status-B2UD7RAG.js} +35 -36
- package/chunks/{workspace-registration-store-LHLPPWNE.js → workspace-registration-store-VZLRTI3Q.js} +1 -1
- package/chunks/{workspace-registry-X34MLN52.js → workspace-registry-GYOGG6TM.js} +30 -31
- package/chunks/{workspace-runtime-coordinator-U4PW4P7K.js → workspace-runtime-coordinator-7KRXGQ4V.js} +31 -32
- package/chunks/{workspace-service-KD7BCGYL.js → workspace-service-DJEYGJE4.js} +36 -37
- package/chunks/{workspace-skills-status-YJGO6Y3T.js → workspace-skills-status-MOKNESUC.js} +33 -34
- package/chunks/{workspace-trust-reconciler-EUYHISCH.js → workspace-trust-reconciler-AXOSUTQW.js} +36 -37
- package/chunks/{write-file-EBSB34NJ.js → write-file-QOYVHAKK.js} +18 -19
- package/chunks/{zh-TW-W2GNP2IU.js → zh-TW-N2TBF2F2.js} +1 -1
- package/chunks/{zh-DVFYHRK5.js → zh-VBFCRQBL.js} +1 -1
- package/chunks/{zoom-image-UJ5VKWKP.js → zoom-image-UCCLGFNC.js} +4 -4
- package/cli.js +13 -13
- package/export-transcript-document.js +2 -2
- package/locales/en.js +2 -2
- package/locales/zh-TW.js +2 -2
- package/locales/zh.js +2 -2
- package/package.json +3 -3
- package/web-shell/assets/{abnfDiagram-VCTEODGH-Dur--luQ.js → abnfDiagram-VCTEODGH-CTstZpXw.js} +1 -1
- package/web-shell/assets/{arc-tYLobxFi.js → arc-DKW0mbPo.js} +1 -1
- package/web-shell/assets/{architectureDiagram-5GKGNRK7-IG6aXD03.js → architectureDiagram-5GKGNRK7-DkMpJ42t.js} +1 -1
- package/web-shell/assets/{blockDiagram-NRAW4CY4-C6eBSkfA.js → blockDiagram-NRAW4CY4-7Cp1_4i3.js} +1 -1
- package/web-shell/assets/{c4Diagram-UCG6FXSJ-BrX3HJqB.js → c4Diagram-UCG6FXSJ-BfaoSlBK.js} +1 -1
- package/web-shell/assets/channel-CQx7VSAp.js +1 -0
- package/web-shell/assets/{chunk-2Q5K7J3B-B3fcJ8ee.js → chunk-2Q5K7J3B-_n1qzAio.js} +1 -1
- package/web-shell/assets/{chunk-5VM5RSS4-CeC90yKM.js → chunk-5VM5RSS4-0cira5ZV.js} +1 -1
- package/web-shell/assets/{chunk-F27PBJKO-CW44RVki.js → chunk-F27PBJKO-DseRXSHC.js} +1 -1
- package/web-shell/assets/{chunk-G27WJ6UU-D1PAMukD.js → chunk-G27WJ6UU-BehQWin0.js} +1 -1
- package/web-shell/assets/{chunk-JWPE2WC7-Dt3Y2Fvx.js → chunk-JWPE2WC7-B5ftg1Bb.js} +1 -1
- package/web-shell/assets/{chunk-LCL6LL3I-CZHw2lLI.js → chunk-LCL6LL3I-D7rnbVdk.js} +1 -1
- package/web-shell/assets/{chunk-POPQ4Y6H-ysNAdTGx.js → chunk-POPQ4Y6H-2Bp-Orju.js} +1 -1
- package/web-shell/assets/{chunk-SVP7TREG-BdNXW6YQ.js → chunk-SVP7TREG-CD2goGva.js} +1 -1
- package/web-shell/assets/{chunk-XXDRQBXY-DgqQ9UA8.js → chunk-XXDRQBXY-DzQt-Rji.js} +1 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-C-Uz8hHk.js +1 -0
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-C-Uz8hHk.js +1 -0
- package/web-shell/assets/{cose-bilkent-JH36ORCC-BILImXzJ.js → cose-bilkent-JH36ORCC-C-BZXSUn.js} +1 -1
- package/web-shell/assets/{cynefin-OW5HDTMX-DR88Pund.js → cynefin-OW5HDTMX-BTcvowe1.js} +1 -1
- package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-BYFbfkA6.js → cynefinDiagram-5FMLGOSQ-BoUE6K81.js} +1 -1
- package/web-shell/assets/{dagre-3AP2YEHR-rfpyc6sX.js → dagre-3AP2YEHR-BHxy9xeB.js} +1 -1
- package/web-shell/assets/{diagram-S7CK7UJ4-BJxLmEwH.js → diagram-S7CK7UJ4-DMiJIvDT.js} +1 -1
- package/web-shell/assets/{diagram-UQ7AKVKN-H34xm7k3.js → diagram-UQ7AKVKN-DXV09Aes.js} +1 -1
- package/web-shell/assets/{diagram-VSXAHHWV-HYxhwNLx.js → diagram-VSXAHHWV-CocpRomV.js} +1 -1
- package/web-shell/assets/{diagram-VX7I27RA-BJazso8F.js → diagram-VX7I27RA-DL7nqtb4.js} +1 -1
- package/web-shell/assets/{diagram-Z3DM3KII-Clje1aNy.js → diagram-Z3DM3KII-CPZ2Jux_.js} +1 -1
- package/web-shell/assets/{ebnfDiagram-PWID7BFC-M93YBkFh.js → ebnfDiagram-PWID7BFC-BX-eVNsX.js} +1 -1
- package/web-shell/assets/{erDiagram-SSCWMZ5O-DY8XzSHU.js → erDiagram-SSCWMZ5O-CPy_Ir6y.js} +1 -1
- package/web-shell/assets/{flowDiagram-A5DVABFB-CE6Aylcq.js → flowDiagram-A5DVABFB-eknAOte9.js} +1 -1
- package/web-shell/assets/{ganttDiagram-EL5Y4UJY-DI-5LL22.js → ganttDiagram-EL5Y4UJY-crAxw_t7.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-C7BZWElk.js → gitGraphDiagram-WWUBYQGX-M29pa3Tc.js} +1 -1
- package/web-shell/assets/{index-CVyqwW7y.js → index-B4TLaxWs.js} +474 -474
- package/web-shell/assets/{index-DclFHns9.js → index-C9R-iojE.js} +1 -1
- package/web-shell/assets/index-CCrkEbzz.css +36 -0
- package/web-shell/assets/{infoDiagram-RXCK75RN-CGUSy4Pc.js → infoDiagram-RXCK75RN-XqspXdOU.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-5VMMS53U-B5BVks9q.js → ishikawaDiagram-5VMMS53U-C5KFS-7j.js} +1 -1
- package/web-shell/assets/{journeyDiagram-EYS64GPL-CFh6Tf7h.js → journeyDiagram-EYS64GPL-Cc57LVRo.js} +1 -1
- package/web-shell/assets/{kanban-definition-3QL26DDD-B7TlxP7c.js → kanban-definition-3QL26DDD-C81OG-AI.js} +1 -1
- package/web-shell/assets/{layout-Br_pZq2Q.js → layout-CFVu37BB.js} +1 -1
- package/web-shell/assets/{linear-BVlP6fte.js → linear-ChBxdtWf.js} +1 -1
- package/web-shell/assets/{mermaid.core-TrcYWoiF.js → mermaid.core-CMLfue0w.js} +6 -6
- package/web-shell/assets/{mindmap-definition-FBJOCRG2-BJ4LzqjZ.js → mindmap-definition-FBJOCRG2-DFsvJThp.js} +1 -1
- package/web-shell/assets/{pegDiagram-XKGWAZYB-1b_MxlOl.js → pegDiagram-XKGWAZYB-BzpRzM4F.js} +1 -1
- package/web-shell/assets/{pieDiagram-E7YTZNPT-B8zl0YhY.js → pieDiagram-E7YTZNPT-Cv0Kankl.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-AXDQQJYC-CIZO8ukl.js → quadrantDiagram-AXDQQJYC-Bh2BJ3Ay.js} +1 -1
- package/web-shell/assets/{railroadDiagram-O6MQD6OU-CepHSbCj.js → railroadDiagram-O6MQD6OU-y8rNDdDS.js} +1 -1
- package/web-shell/assets/{requirementDiagram-EFPCY7ZU-BCgxkcSW.js → requirementDiagram-EFPCY7ZU-C0m2DKJ_.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-P5KCCOFB-CE5CcoMM.js → sankeyDiagram-P5KCCOFB-BzdGnSF4.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-DvgHi-d5.js → sequenceDiagram-WJ2MYXX4-DPzAVmzz.js} +1 -1
- package/web-shell/assets/{sizeCapture-X5ZJPWSS-T-fAsCPX.js → sizeCapture-X5ZJPWSS-LcHG28Zh.js} +1 -1
- package/web-shell/assets/{stateDiagram-HBIQ2CUA-DYHaul-5.js → stateDiagram-HBIQ2CUA-C1Bzy3IT.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-LuuL5byY.js +1 -0
- package/web-shell/assets/{swimlanes-XN3QIQJK-Dbz3Qiej.js → swimlanes-XN3QIQJK-Bftk8V64.js} +1 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-COmnNq8s.js +8 -0
- package/web-shell/assets/{timeline-definition-24CTP7MA-9NVRts3N.js → timeline-definition-24CTP7MA-BfXHcN1A.js} +1 -1
- package/web-shell/assets/{vennDiagram-4TSXK5OY-C7cb7vnH.js → vennDiagram-4TSXK5OY-DRSlI9-V.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-VM6X3IG4-CG-8Ddjm.js → wardleyDiagram-VM6X3IG4-CaLmqGau.js} +1 -1
- package/web-shell/assets/{xychartDiagram-S5SC5T6Z-iGeYAcP4.js → xychartDiagram-S5SC5T6Z-8lgUT6e8.js} +1 -1
- package/web-shell/index.html +6 -3
- package/chunks/chunk-FKJM6JKY.js +0 -98
- package/web-shell/assets/channel-uEkvKckd.js +0 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-DuPsnhWS.js +0 -1
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-DuPsnhWS.js +0 -1
- package/web-shell/assets/index-FO7JXPnH.css +0 -36
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-BcYho9a4.js +0 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-D6HsOIgX.js +0 -8
|
@@ -4,12 +4,13 @@ import {
|
|
|
4
4
|
MAX_FRAME_BYTES,
|
|
5
5
|
MAX_SOCKET_PATH_BYTES,
|
|
6
6
|
SOCKET_DIR_NAME,
|
|
7
|
+
flattenPeerLabel,
|
|
7
8
|
isLocalIpcPath,
|
|
8
9
|
parsePeerAuthLine,
|
|
9
10
|
parsePeerFrame,
|
|
10
11
|
probePeerSocketVerdict,
|
|
11
12
|
resolvePeerSocketCandidates
|
|
12
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-5Z4FCEPY.js";
|
|
13
14
|
import {
|
|
14
15
|
scanForSecrets
|
|
15
16
|
} from "./chunk-BUQN5LTI.js";
|
|
@@ -74,7 +75,7 @@ import {
|
|
|
74
75
|
stripToolResultImages,
|
|
75
76
|
toolResultBoundaryArtifact,
|
|
76
77
|
toolResultPartDiagnosticValues
|
|
77
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-TSLRORQR.js";
|
|
78
79
|
import {
|
|
79
80
|
hasVerifiableInode,
|
|
80
81
|
openNoFollow
|
|
@@ -87,7 +88,7 @@ import {
|
|
|
87
88
|
} from "./chunk-FDOGGKAA.js";
|
|
88
89
|
import {
|
|
89
90
|
resolveBundleDir
|
|
90
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-TRWQQBVH.js";
|
|
91
92
|
import {
|
|
92
93
|
glob,
|
|
93
94
|
globSync
|
|
@@ -101,14 +102,14 @@ import {
|
|
|
101
102
|
import {
|
|
102
103
|
getProjectSkillsRoot,
|
|
103
104
|
parse
|
|
104
|
-
} from "./chunk-
|
|
105
|
+
} from "./chunk-CLKE4IY3.js";
|
|
105
106
|
import {
|
|
106
107
|
require_proper_lockfile
|
|
107
108
|
} from "./chunk-MLXTMF7H.js";
|
|
108
109
|
import {
|
|
109
110
|
BUILT_IN_OUTPUT_STYLES,
|
|
110
111
|
getBuiltInOutputStyle
|
|
111
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-OFB36ZBA.js";
|
|
112
113
|
import {
|
|
113
114
|
fetchWithPolicy
|
|
114
115
|
} from "./chunk-UKADFFL2.js";
|
|
@@ -120,7 +121,7 @@ import {
|
|
|
120
121
|
removeMCPStatusChangeListener,
|
|
121
122
|
runSideQuery,
|
|
122
123
|
updateMCPServerStatus
|
|
123
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-WQBR7LN5.js";
|
|
124
125
|
import {
|
|
125
126
|
getInvocationContext
|
|
126
127
|
} from "./chunk-5ETULJLP.js";
|
|
@@ -144,7 +145,8 @@ import {
|
|
|
144
145
|
getUserAutoMemoryRoot
|
|
145
146
|
} from "./chunk-EDIDYZBT.js";
|
|
146
147
|
import {
|
|
147
|
-
atomicWriteFile
|
|
148
|
+
atomicWriteFile,
|
|
149
|
+
atomicWriteJSON
|
|
148
150
|
} from "./chunk-XFFRI3WM.js";
|
|
149
151
|
import {
|
|
150
152
|
isBinary,
|
|
@@ -157,7 +159,7 @@ import {
|
|
|
157
159
|
getStartupContextLength,
|
|
158
160
|
isSystemReminderContent,
|
|
159
161
|
stripSystemReminderBlocks
|
|
160
|
-
} from "./chunk-
|
|
162
|
+
} from "./chunk-4VY3ITHR.js";
|
|
161
163
|
import {
|
|
162
164
|
getQwenIgnoreFileNames,
|
|
163
165
|
require_ignore
|
|
@@ -165,7 +167,7 @@ import {
|
|
|
165
167
|
import {
|
|
166
168
|
ToolNames,
|
|
167
169
|
canonicalToolName
|
|
168
|
-
} from "./chunk-
|
|
170
|
+
} from "./chunk-MWIO7MF6.js";
|
|
169
171
|
import {
|
|
170
172
|
PATH_ARG_KEYS,
|
|
171
173
|
QWEN_DIR,
|
|
@@ -173,6 +175,7 @@ import {
|
|
|
173
175
|
createDebugLogger,
|
|
174
176
|
getErrorMessage,
|
|
175
177
|
isAbortError,
|
|
178
|
+
isNodeError,
|
|
176
179
|
tildeifyPath,
|
|
177
180
|
unescapePath
|
|
178
181
|
} from "./chunk-ZAFYHRVY.js";
|
|
@@ -194,8 +197,8 @@ var require_utils = __commonJS({
|
|
|
194
197
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
195
198
|
exports.normalizePath = exports.isRootDirectory = exports.convertSlashes = exports.cleanPath = void 0;
|
|
196
199
|
var path_1 = __require("path");
|
|
197
|
-
function cleanPath(
|
|
198
|
-
let normalized2 = (0, path_1.normalize)(
|
|
200
|
+
function cleanPath(path21) {
|
|
201
|
+
let normalized2 = (0, path_1.normalize)(path21);
|
|
199
202
|
if (normalized2.length > 1 && normalized2[normalized2.length - 1] === path_1.sep)
|
|
200
203
|
normalized2 = normalized2.substring(0, normalized2.length - 1);
|
|
201
204
|
return normalized2;
|
|
@@ -203,28 +206,28 @@ var require_utils = __commonJS({
|
|
|
203
206
|
__name(cleanPath, "cleanPath");
|
|
204
207
|
exports.cleanPath = cleanPath;
|
|
205
208
|
var SLASHES_REGEX = /[\\/]/g;
|
|
206
|
-
function convertSlashes(
|
|
207
|
-
return
|
|
209
|
+
function convertSlashes(path21, separator) {
|
|
210
|
+
return path21.replace(SLASHES_REGEX, separator);
|
|
208
211
|
}
|
|
209
212
|
__name(convertSlashes, "convertSlashes");
|
|
210
213
|
exports.convertSlashes = convertSlashes;
|
|
211
214
|
var WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i;
|
|
212
|
-
function isRootDirectory(
|
|
213
|
-
return
|
|
215
|
+
function isRootDirectory(path21) {
|
|
216
|
+
return path21 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path21);
|
|
214
217
|
}
|
|
215
218
|
__name(isRootDirectory, "isRootDirectory");
|
|
216
219
|
exports.isRootDirectory = isRootDirectory;
|
|
217
|
-
function normalizePath2(
|
|
220
|
+
function normalizePath2(path21, options) {
|
|
218
221
|
const { resolvePaths, normalizePath: normalizePath3, pathSeparator } = options;
|
|
219
|
-
const pathNeedsCleaning = process.platform === "win32" &&
|
|
222
|
+
const pathNeedsCleaning = process.platform === "win32" && path21.includes("/") || path21.startsWith(".");
|
|
220
223
|
if (resolvePaths)
|
|
221
|
-
|
|
224
|
+
path21 = (0, path_1.resolve)(path21);
|
|
222
225
|
if (normalizePath3 || pathNeedsCleaning)
|
|
223
|
-
|
|
224
|
-
if (
|
|
226
|
+
path21 = cleanPath(path21);
|
|
227
|
+
if (path21 === ".")
|
|
225
228
|
return "";
|
|
226
|
-
const needsSeperator =
|
|
227
|
-
return convertSlashes(needsSeperator ?
|
|
229
|
+
const needsSeperator = path21[path21.length - 1] !== pathSeparator;
|
|
230
|
+
return convertSlashes(needsSeperator ? path21 + pathSeparator : path21, pathSeparator);
|
|
228
231
|
}
|
|
229
232
|
__name(normalizePath2, "normalizePath");
|
|
230
233
|
exports.normalizePath = normalizePath2;
|
|
@@ -299,9 +302,9 @@ var require_push_directory = __commonJS({
|
|
|
299
302
|
paths.push(directoryPath || ".");
|
|
300
303
|
}, "pushDirectory");
|
|
301
304
|
var pushDirectoryFilter = /* @__PURE__ */ __name((directoryPath, paths, filters) => {
|
|
302
|
-
const
|
|
303
|
-
if (filters.every((filter2) => filter2(
|
|
304
|
-
paths.push(
|
|
305
|
+
const path21 = directoryPath || ".";
|
|
306
|
+
if (filters.every((filter2) => filter2(path21, true))) {
|
|
307
|
+
paths.push(path21);
|
|
305
308
|
}
|
|
306
309
|
}, "pushDirectoryFilter");
|
|
307
310
|
var empty = /* @__PURE__ */ __name(() => {
|
|
@@ -412,29 +415,29 @@ var require_resolve_symlink = __commonJS({
|
|
|
412
415
|
exports.build = void 0;
|
|
413
416
|
var fs_1 = __importDefault(__require("fs"));
|
|
414
417
|
var path_1 = __require("path");
|
|
415
|
-
var resolveSymlinksAsync = /* @__PURE__ */ __name(function(
|
|
418
|
+
var resolveSymlinksAsync = /* @__PURE__ */ __name(function(path21, state, callback) {
|
|
416
419
|
const { queue, options: { suppressErrors } } = state;
|
|
417
420
|
queue.enqueue();
|
|
418
|
-
fs_1.default.realpath(
|
|
421
|
+
fs_1.default.realpath(path21, (error, resolvedPath) => {
|
|
419
422
|
if (error)
|
|
420
423
|
return queue.dequeue(suppressErrors ? null : error, state);
|
|
421
424
|
fs_1.default.stat(resolvedPath, (error2, stat5) => {
|
|
422
425
|
if (error2)
|
|
423
426
|
return queue.dequeue(suppressErrors ? null : error2, state);
|
|
424
|
-
if (stat5.isDirectory() && isRecursive(
|
|
427
|
+
if (stat5.isDirectory() && isRecursive(path21, resolvedPath, state))
|
|
425
428
|
return queue.dequeue(null, state);
|
|
426
429
|
callback(stat5, resolvedPath);
|
|
427
430
|
queue.dequeue(null, state);
|
|
428
431
|
});
|
|
429
432
|
});
|
|
430
433
|
}, "resolveSymlinksAsync");
|
|
431
|
-
var resolveSymlinks = /* @__PURE__ */ __name(function(
|
|
434
|
+
var resolveSymlinks = /* @__PURE__ */ __name(function(path21, state, callback) {
|
|
432
435
|
const { queue, options: { suppressErrors } } = state;
|
|
433
436
|
queue.enqueue();
|
|
434
437
|
try {
|
|
435
|
-
const resolvedPath = fs_1.default.realpathSync(
|
|
438
|
+
const resolvedPath = fs_1.default.realpathSync(path21);
|
|
436
439
|
const stat5 = fs_1.default.statSync(resolvedPath);
|
|
437
|
-
if (stat5.isDirectory() && isRecursive(
|
|
440
|
+
if (stat5.isDirectory() && isRecursive(path21, resolvedPath, state))
|
|
438
441
|
return;
|
|
439
442
|
callback(stat5, resolvedPath);
|
|
440
443
|
} catch (e) {
|
|
@@ -449,10 +452,10 @@ var require_resolve_symlink = __commonJS({
|
|
|
449
452
|
}
|
|
450
453
|
__name(build, "build");
|
|
451
454
|
exports.build = build;
|
|
452
|
-
function isRecursive(
|
|
455
|
+
function isRecursive(path21, resolved, state) {
|
|
453
456
|
if (state.options.useRealPaths)
|
|
454
457
|
return isRecursiveUsingRealPaths(resolved, state);
|
|
455
|
-
let parent = (0, path_1.dirname)(
|
|
458
|
+
let parent = (0, path_1.dirname)(path21);
|
|
456
459
|
let depth = 1;
|
|
457
460
|
while (parent !== state.root && depth < 2) {
|
|
458
461
|
const resolvedPath = state.symlinks.get(parent);
|
|
@@ -462,7 +465,7 @@ var require_resolve_symlink = __commonJS({
|
|
|
462
465
|
else
|
|
463
466
|
parent = (0, path_1.dirname)(parent);
|
|
464
467
|
}
|
|
465
|
-
state.symlinks.set(
|
|
468
|
+
state.symlinks.set(path21, resolved);
|
|
466
469
|
return depth > 1;
|
|
467
470
|
}
|
|
468
471
|
__name(isRecursive, "isRecursive");
|
|
@@ -748,21 +751,21 @@ var require_walker = __commonJS({
|
|
|
748
751
|
const filename = this.joinPath(entry.name, directoryPath);
|
|
749
752
|
this.pushFile(filename, files, this.state.counts, filters);
|
|
750
753
|
} else if (entry.isDirectory()) {
|
|
751
|
-
let
|
|
752
|
-
if (exclude && exclude(entry.name,
|
|
754
|
+
let path21 = joinPath.joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
|
|
755
|
+
if (exclude && exclude(entry.name, path21))
|
|
753
756
|
continue;
|
|
754
|
-
this.pushDirectory(
|
|
755
|
-
this.walkDirectory(this.state,
|
|
757
|
+
this.pushDirectory(path21, paths, filters);
|
|
758
|
+
this.walkDirectory(this.state, path21, path21, depth - 1, this.walk);
|
|
756
759
|
} else if (this.resolveSymlink && entry.isSymbolicLink()) {
|
|
757
|
-
let
|
|
758
|
-
this.resolveSymlink(
|
|
760
|
+
let path21 = joinPath.joinPathWithBasePath(entry.name, directoryPath);
|
|
761
|
+
this.resolveSymlink(path21, this.state, (stat5, resolvedPath) => {
|
|
759
762
|
if (stat5.isDirectory()) {
|
|
760
763
|
resolvedPath = (0, utils_1.normalizePath)(resolvedPath, this.state.options);
|
|
761
|
-
if (exclude && exclude(entry.name, useRealPaths ? resolvedPath :
|
|
764
|
+
if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path21 + pathSeparator))
|
|
762
765
|
return;
|
|
763
|
-
this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath :
|
|
766
|
+
this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path21 + pathSeparator, depth - 1, this.walk);
|
|
764
767
|
} else {
|
|
765
|
-
resolvedPath = useRealPaths ? resolvedPath :
|
|
768
|
+
resolvedPath = useRealPaths ? resolvedPath : path21;
|
|
766
769
|
const filename = (0, path_1.basename)(resolvedPath);
|
|
767
770
|
const directoryPath2 = (0, utils_1.normalizePath)((0, path_1.dirname)(resolvedPath), this.state.options);
|
|
768
771
|
resolvedPath = this.joinPath(filename, directoryPath2);
|
|
@@ -787,11 +790,11 @@ var require_async = __commonJS({
|
|
|
787
790
|
exports.callback = exports.promise = void 0;
|
|
788
791
|
var walker_1 = require_walker();
|
|
789
792
|
function promise(root, options) {
|
|
790
|
-
return new Promise((
|
|
793
|
+
return new Promise((resolve7, reject) => {
|
|
791
794
|
callback(root, options, (err, output) => {
|
|
792
795
|
if (err)
|
|
793
796
|
return reject(err);
|
|
794
|
-
|
|
797
|
+
resolve7(output);
|
|
795
798
|
});
|
|
796
799
|
});
|
|
797
800
|
}
|
|
@@ -989,7 +992,7 @@ var require_builder = __commonJS({
|
|
|
989
992
|
isMatch = globFn(patterns, ...options);
|
|
990
993
|
this.globCache[patterns.join("\0")] = isMatch;
|
|
991
994
|
}
|
|
992
|
-
this.options.filters.push((
|
|
995
|
+
this.options.filters.push((path21) => isMatch(path21));
|
|
993
996
|
return this;
|
|
994
997
|
}
|
|
995
998
|
};
|
|
@@ -1069,7 +1072,7 @@ var JsonFormatter = class {
|
|
|
1069
1072
|
// packages/core/src/core/nonInteractiveToolExecutor.ts
|
|
1070
1073
|
init_esbuild_shims();
|
|
1071
1074
|
async function executeToolCall(config, toolCallRequest, abortSignal, options = {}) {
|
|
1072
|
-
return new Promise((
|
|
1075
|
+
return new Promise((resolve7, reject) => {
|
|
1073
1076
|
new CoreToolScheduler({
|
|
1074
1077
|
config,
|
|
1075
1078
|
chatRecordingService: options.recordToolResult === false ? void 0 : config.getChatRecordingService(),
|
|
@@ -1078,7 +1081,7 @@ async function executeToolCall(config, toolCallRequest, abortSignal, options = {
|
|
|
1078
1081
|
if (options.onAllToolCallsComplete) {
|
|
1079
1082
|
await options.onAllToolCallsComplete(completedToolCalls);
|
|
1080
1083
|
}
|
|
1081
|
-
|
|
1084
|
+
resolve7(completedToolCalls[0].response);
|
|
1082
1085
|
}, "onAllToolCallsComplete"),
|
|
1083
1086
|
onToolCallsUpdate: options.onToolCallsUpdate,
|
|
1084
1087
|
onToolResultFullTurnModel: options.onToolResultFullTurnModel,
|
|
@@ -2572,7 +2575,7 @@ var McpTransportPool = class {
|
|
|
2572
2575
|
spawnWait.then(() => {
|
|
2573
2576
|
if (inflightTimer) clearTimeout(inflightTimer);
|
|
2574
2577
|
}),
|
|
2575
|
-
new Promise((
|
|
2578
|
+
new Promise((resolve7) => {
|
|
2576
2579
|
inflightTimer = setTimeout(
|
|
2577
2580
|
() => {
|
|
2578
2581
|
const stuckIds = [...this.spawnInFlight.keys()];
|
|
@@ -2581,7 +2584,7 @@ var McpTransportPool = class {
|
|
|
2581
2584
|
", "
|
|
2582
2585
|
)}. Proceeding with drain.`
|
|
2583
2586
|
);
|
|
2584
|
-
|
|
2587
|
+
resolve7();
|
|
2585
2588
|
},
|
|
2586
2589
|
Math.max(0, deadline - Date.now())
|
|
2587
2590
|
);
|
|
@@ -2607,8 +2610,8 @@ var McpTransportPool = class {
|
|
|
2607
2610
|
Promise.all(shutdownPromises).then(() => {
|
|
2608
2611
|
if (drainTimer) clearTimeout(drainTimer);
|
|
2609
2612
|
}),
|
|
2610
|
-
new Promise((
|
|
2611
|
-
drainTimer = setTimeout(() =>
|
|
2613
|
+
new Promise((resolve7) => {
|
|
2614
|
+
drainTimer = setTimeout(() => resolve7(), remaining);
|
|
2612
2615
|
drainTimer.unref?.();
|
|
2613
2616
|
})
|
|
2614
2617
|
]);
|
|
@@ -4986,7 +4989,30 @@ async function bindAt(requestedPath, options, automaticPath) {
|
|
|
4986
4989
|
}, "arm");
|
|
4987
4990
|
arm();
|
|
4988
4991
|
let authed = options.requiredToken === void 0;
|
|
4989
|
-
let
|
|
4992
|
+
let credential;
|
|
4993
|
+
let controllerToken;
|
|
4994
|
+
let controllerDeadline = null;
|
|
4995
|
+
const armControllerRevalidation = /* @__PURE__ */ __name(() => {
|
|
4996
|
+
if (controllerDeadline) clearTimeout(controllerDeadline);
|
|
4997
|
+
controllerDeadline = setTimeout(() => {
|
|
4998
|
+
controllerDeadline = null;
|
|
4999
|
+
if (refused || credential?.kind !== "controller" || controllerToken === void 0) {
|
|
5000
|
+
return;
|
|
5001
|
+
}
|
|
5002
|
+
const controller = resolveController(options, controllerToken);
|
|
5003
|
+
if (!controller) {
|
|
5004
|
+
debugLogger6.debug(
|
|
5005
|
+
"dropping a controller connection whose grant was revoked"
|
|
5006
|
+
);
|
|
5007
|
+
refused = true;
|
|
5008
|
+
socket.destroy();
|
|
5009
|
+
return;
|
|
5010
|
+
}
|
|
5011
|
+
credential = { kind: "controller", controller };
|
|
5012
|
+
armControllerRevalidation();
|
|
5013
|
+
}, lineDeadlineMs);
|
|
5014
|
+
controllerDeadline.unref();
|
|
5015
|
+
}, "armControllerRevalidation");
|
|
4990
5016
|
let refused = false;
|
|
4991
5017
|
const read2 = createLineReader(
|
|
4992
5018
|
(line) => {
|
|
@@ -4995,10 +5021,14 @@ async function bindAt(requestedPath, options, automaticPath) {
|
|
|
4995
5021
|
arm();
|
|
4996
5022
|
const presented = parsePeerAuthLine(line);
|
|
4997
5023
|
if (presented !== null) {
|
|
4998
|
-
|
|
5024
|
+
credential = authKindOf(options, presented);
|
|
4999
5025
|
}
|
|
5000
|
-
if (
|
|
5026
|
+
if (credential !== void 0) {
|
|
5001
5027
|
authed = true;
|
|
5028
|
+
if (credential.kind === "controller") {
|
|
5029
|
+
controllerToken = presented ?? void 0;
|
|
5030
|
+
armControllerRevalidation();
|
|
5031
|
+
}
|
|
5002
5032
|
return;
|
|
5003
5033
|
}
|
|
5004
5034
|
debugLogger6.debug(
|
|
@@ -5017,7 +5047,7 @@ async function bindAt(requestedPath, options, automaticPath) {
|
|
|
5017
5047
|
}
|
|
5018
5048
|
arm();
|
|
5019
5049
|
try {
|
|
5020
|
-
options.onFrame(frame,
|
|
5050
|
+
options.onFrame(frame, credential?.kind, credential?.controller);
|
|
5021
5051
|
} catch (error) {
|
|
5022
5052
|
debugLogger6.error(`onFrame threw: ${describe(error)}`);
|
|
5023
5053
|
}
|
|
@@ -5039,6 +5069,8 @@ async function bindAt(requestedPath, options, automaticPath) {
|
|
|
5039
5069
|
socket.on("close", () => {
|
|
5040
5070
|
if (deadline) clearTimeout(deadline);
|
|
5041
5071
|
deadline = null;
|
|
5072
|
+
if (controllerDeadline) clearTimeout(controllerDeadline);
|
|
5073
|
+
controllerDeadline = null;
|
|
5042
5074
|
connections.delete(socket);
|
|
5043
5075
|
});
|
|
5044
5076
|
});
|
|
@@ -5046,11 +5078,11 @@ async function bindAt(requestedPath, options, automaticPath) {
|
|
|
5046
5078
|
server.on("error", (error) => {
|
|
5047
5079
|
debugLogger6.error(`peer inbox server error: ${describe(error)}`);
|
|
5048
5080
|
});
|
|
5049
|
-
const listenAt = /* @__PURE__ */ __name((target) => new Promise((
|
|
5081
|
+
const listenAt = /* @__PURE__ */ __name((target) => new Promise((resolve7, reject) => {
|
|
5050
5082
|
server.once("error", reject);
|
|
5051
5083
|
server.listen(target, () => {
|
|
5052
5084
|
server.removeListener("error", reject);
|
|
5053
|
-
|
|
5085
|
+
resolve7();
|
|
5054
5086
|
});
|
|
5055
5087
|
}), "listenAt");
|
|
5056
5088
|
try {
|
|
@@ -5110,7 +5142,7 @@ async function bindAt(requestedPath, options, automaticPath) {
|
|
|
5110
5142
|
closed = true;
|
|
5111
5143
|
for (const socket of connections) socket.destroy();
|
|
5112
5144
|
connections.clear();
|
|
5113
|
-
await new Promise((
|
|
5145
|
+
await new Promise((resolve7) => server.close(() => resolve7()));
|
|
5114
5146
|
try {
|
|
5115
5147
|
await fs.unlink(socketPath);
|
|
5116
5148
|
} catch {
|
|
@@ -5130,11 +5162,26 @@ __name(tokenMatches, "tokenMatches");
|
|
|
5130
5162
|
function authKindOf(options, presented) {
|
|
5131
5163
|
const peer = options.requiredToken !== void 0 && tokenMatches(options.requiredToken, presented);
|
|
5132
5164
|
const child = options.childToken !== void 0 && tokenMatches(options.childToken, presented);
|
|
5133
|
-
|
|
5134
|
-
if (
|
|
5165
|
+
const controller = resolveController(options, presented);
|
|
5166
|
+
if (peer) return { kind: "peer" };
|
|
5167
|
+
if (child) return { kind: "child" };
|
|
5168
|
+
if (controller) return { kind: "controller", controller };
|
|
5135
5169
|
return void 0;
|
|
5136
5170
|
}
|
|
5137
5171
|
__name(authKindOf, "authKindOf");
|
|
5172
|
+
function resolveController(options, presented) {
|
|
5173
|
+
try {
|
|
5174
|
+
return options.resolveController?.(presented);
|
|
5175
|
+
} catch (error) {
|
|
5176
|
+
debugLogger6.debug(
|
|
5177
|
+
`controller resolver threw (treating the token as unknown): ${describe(
|
|
5178
|
+
error
|
|
5179
|
+
)}`
|
|
5180
|
+
);
|
|
5181
|
+
return void 0;
|
|
5182
|
+
}
|
|
5183
|
+
}
|
|
5184
|
+
__name(resolveController, "resolveController");
|
|
5138
5185
|
function describe(error) {
|
|
5139
5186
|
return error instanceof Error ? `${error.name}: ${error.message}` : String(error);
|
|
5140
5187
|
}
|
|
@@ -6580,9 +6627,9 @@ function encodeInsightProgressMessage(stage, progress, detail) {
|
|
|
6580
6627
|
return JSON.stringify(payload);
|
|
6581
6628
|
}
|
|
6582
6629
|
__name(encodeInsightProgressMessage, "encodeInsightProgressMessage");
|
|
6583
|
-
function encodeInsightReadyMessage(
|
|
6630
|
+
function encodeInsightReadyMessage(path21) {
|
|
6584
6631
|
const payload = {
|
|
6585
|
-
insight_ready: { path:
|
|
6632
|
+
insight_ready: { path: path21 }
|
|
6586
6633
|
};
|
|
6587
6634
|
return JSON.stringify(payload);
|
|
6588
6635
|
}
|
|
@@ -6958,9 +7005,9 @@ var Logger = class {
|
|
|
6958
7005
|
);
|
|
6959
7006
|
return;
|
|
6960
7007
|
}
|
|
6961
|
-
const
|
|
7008
|
+
const path21 = this._checkpointPath(tag);
|
|
6962
7009
|
try {
|
|
6963
|
-
await atomicWriteFile(
|
|
7010
|
+
await atomicWriteFile(path21, JSON.stringify(conversation, null, 2), {
|
|
6964
7011
|
encoding: "utf-8"
|
|
6965
7012
|
});
|
|
6966
7013
|
} catch (error) {
|
|
@@ -6974,13 +7021,13 @@ var Logger = class {
|
|
|
6974
7021
|
);
|
|
6975
7022
|
return [];
|
|
6976
7023
|
}
|
|
6977
|
-
const
|
|
7024
|
+
const path21 = await this._getCheckpointPath(tag);
|
|
6978
7025
|
try {
|
|
6979
|
-
const fileContent = await fs3.readFile(
|
|
7026
|
+
const fileContent = await fs3.readFile(path21, "utf-8");
|
|
6980
7027
|
const parsedContent = JSON.parse(fileContent);
|
|
6981
7028
|
if (!Array.isArray(parsedContent)) {
|
|
6982
7029
|
this.debugLogger.warn(
|
|
6983
|
-
`Checkpoint file at ${
|
|
7030
|
+
`Checkpoint file at ${path21} is not a valid JSON array. Returning empty checkpoint.`
|
|
6984
7031
|
);
|
|
6985
7032
|
return [];
|
|
6986
7033
|
}
|
|
@@ -6991,7 +7038,7 @@ var Logger = class {
|
|
|
6991
7038
|
return [];
|
|
6992
7039
|
}
|
|
6993
7040
|
this.debugLogger.error(
|
|
6994
|
-
`Failed to read or parse checkpoint file ${
|
|
7041
|
+
`Failed to read or parse checkpoint file ${path21}:`,
|
|
6995
7042
|
error
|
|
6996
7043
|
);
|
|
6997
7044
|
return [];
|
|
@@ -7465,7 +7512,7 @@ var ClientMcpRegistrar = class {
|
|
|
7465
7512
|
}
|
|
7466
7513
|
return Promise.resolve(ack);
|
|
7467
7514
|
}
|
|
7468
|
-
return new Promise((
|
|
7515
|
+
return new Promise((resolve7, reject) => {
|
|
7469
7516
|
const timer = setTimeout(() => {
|
|
7470
7517
|
this.pending.delete(id);
|
|
7471
7518
|
reject(
|
|
@@ -7475,7 +7522,7 @@ var ClientMcpRegistrar = class {
|
|
|
7475
7522
|
);
|
|
7476
7523
|
}, this.messageTimeoutMs);
|
|
7477
7524
|
timer.unref?.();
|
|
7478
|
-
this.pending.set(id, { resolve:
|
|
7525
|
+
this.pending.set(id, { resolve: resolve7, reject, timer, server: serverName });
|
|
7479
7526
|
let sendResult;
|
|
7480
7527
|
try {
|
|
7481
7528
|
sendResult = this.sendFrame({
|
|
@@ -7720,12 +7767,377 @@ ${body}`;
|
|
|
7720
7767
|
}
|
|
7721
7768
|
};
|
|
7722
7769
|
|
|
7770
|
+
// packages/core/src/ipc/peer-controllers.ts
|
|
7771
|
+
init_esbuild_shims();
|
|
7772
|
+
var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
7773
|
+
import { createHash as createHash3, randomBytes as randomBytes2, timingSafeEqual as timingSafeEqual2 } from "node:crypto";
|
|
7774
|
+
import * as fsSync2 from "node:fs";
|
|
7775
|
+
import * as fs5 from "node:fs/promises";
|
|
7776
|
+
import * as path7 from "node:path";
|
|
7777
|
+
var debugLogger11 = createDebugLogger("PEER_CONTROLLERS");
|
|
7778
|
+
var PEER_CONTROLLER_SCHEMA_VERSION = 1;
|
|
7779
|
+
var CONTROLLER_TOKEN_PREFIX = "qpc_";
|
|
7780
|
+
var CONTROLLER_TOKEN_BYTES = 32;
|
|
7781
|
+
var MAX_PRESENTED_TOKEN_CHARS = 256;
|
|
7782
|
+
var MAX_CONTROLLER_LABEL_CHARS = 40;
|
|
7783
|
+
var MAX_CONTROLLERS = 32;
|
|
7784
|
+
var MAX_REGISTRY_BYTES = 64 * 1024;
|
|
7785
|
+
var REGISTRY_FILE_MODE = 384;
|
|
7786
|
+
var REGISTRY_DIRECTORY_MODE = 448;
|
|
7787
|
+
var LOCK_OPTIONS = {
|
|
7788
|
+
realpath: false,
|
|
7789
|
+
stale: 5e3,
|
|
7790
|
+
retries: {
|
|
7791
|
+
retries: 10,
|
|
7792
|
+
minTimeout: 5,
|
|
7793
|
+
maxTimeout: 100,
|
|
7794
|
+
factor: 2,
|
|
7795
|
+
randomize: true
|
|
7796
|
+
},
|
|
7797
|
+
onCompromised: /* @__PURE__ */ __name((error) => {
|
|
7798
|
+
debugLogger11.debug(
|
|
7799
|
+
`controller registry lock compromised: ${describe2(error)}`
|
|
7800
|
+
);
|
|
7801
|
+
}, "onCompromised")
|
|
7802
|
+
};
|
|
7803
|
+
var CONTROLLER_ID_RE = /^c_[0-9a-f]{8}$/;
|
|
7804
|
+
var TOKEN_HASH_RE = /^[0-9a-f]{64}$/;
|
|
7805
|
+
var PeerControllerError = class extends Error {
|
|
7806
|
+
constructor(message, code) {
|
|
7807
|
+
super(message);
|
|
7808
|
+
this.code = code;
|
|
7809
|
+
this.name = "PeerControllerError";
|
|
7810
|
+
}
|
|
7811
|
+
static {
|
|
7812
|
+
__name(this, "PeerControllerError");
|
|
7813
|
+
}
|
|
7814
|
+
};
|
|
7815
|
+
var defaultRegistryPath;
|
|
7816
|
+
function getPeerControllerRegistryPath() {
|
|
7817
|
+
defaultRegistryPath ??= path7.resolve(
|
|
7818
|
+
Storage.getGlobalQwenDir(),
|
|
7819
|
+
"peer-controllers.json"
|
|
7820
|
+
);
|
|
7821
|
+
return defaultRegistryPath;
|
|
7822
|
+
}
|
|
7823
|
+
__name(getPeerControllerRegistryPath, "getPeerControllerRegistryPath");
|
|
7824
|
+
function hashControllerToken(token) {
|
|
7825
|
+
return createHash3("sha256").update(token, "utf8").digest("hex");
|
|
7826
|
+
}
|
|
7827
|
+
__name(hashControllerToken, "hashControllerToken");
|
|
7828
|
+
function mintControllerToken() {
|
|
7829
|
+
return CONTROLLER_TOKEN_PREFIX + randomBytes2(CONTROLLER_TOKEN_BYTES).toString("hex");
|
|
7830
|
+
}
|
|
7831
|
+
__name(mintControllerToken, "mintControllerToken");
|
|
7832
|
+
function emptyRegistry() {
|
|
7833
|
+
return { schemaVersion: PEER_CONTROLLER_SCHEMA_VERSION, controllers: [] };
|
|
7834
|
+
}
|
|
7835
|
+
__name(emptyRegistry, "emptyRegistry");
|
|
7836
|
+
function describe2(error) {
|
|
7837
|
+
return error instanceof Error ? `${error.name}: ${error.message}` : String(error);
|
|
7838
|
+
}
|
|
7839
|
+
__name(describe2, "describe");
|
|
7840
|
+
function isRecord(value) {
|
|
7841
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7842
|
+
}
|
|
7843
|
+
__name(isRecord, "isRecord");
|
|
7844
|
+
function toValidRecord(value) {
|
|
7845
|
+
if (!isRecord(value)) return null;
|
|
7846
|
+
const { id, label, tokenHash, createdAt } = value;
|
|
7847
|
+
if (typeof id !== "string" || !CONTROLLER_ID_RE.test(id)) return null;
|
|
7848
|
+
if (typeof tokenHash !== "string" || !TOKEN_HASH_RE.test(tokenHash)) {
|
|
7849
|
+
return null;
|
|
7850
|
+
}
|
|
7851
|
+
if (typeof label !== "string") return null;
|
|
7852
|
+
const flattened = flattenPeerLabel(label);
|
|
7853
|
+
if (flattened.length === 0 || flattened.length > MAX_CONTROLLER_LABEL_CHARS) {
|
|
7854
|
+
return null;
|
|
7855
|
+
}
|
|
7856
|
+
if (typeof createdAt !== "number" || !Number.isFinite(createdAt)) return null;
|
|
7857
|
+
return { id, label: flattened, tokenHash, createdAt };
|
|
7858
|
+
}
|
|
7859
|
+
__name(toValidRecord, "toValidRecord");
|
|
7860
|
+
function readPeerControllerRegistrySync(filePath = getPeerControllerRegistryPath()) {
|
|
7861
|
+
let raw;
|
|
7862
|
+
try {
|
|
7863
|
+
const stats = fsSync2.lstatSync(filePath);
|
|
7864
|
+
if (!stats.isFile()) {
|
|
7865
|
+
debugLogger11.debug(
|
|
7866
|
+
`ignoring the controller registry at ${filePath}: not a regular file`
|
|
7867
|
+
);
|
|
7868
|
+
return emptyRegistry();
|
|
7869
|
+
}
|
|
7870
|
+
if (stats.size > MAX_REGISTRY_BYTES) {
|
|
7871
|
+
debugLogger11.debug(
|
|
7872
|
+
`ignoring the controller registry at ${filePath}: ${stats.size} bytes exceeds the ${MAX_REGISTRY_BYTES}-byte cap`
|
|
7873
|
+
);
|
|
7874
|
+
return emptyRegistry();
|
|
7875
|
+
}
|
|
7876
|
+
raw = fsSync2.readFileSync(filePath, "utf8");
|
|
7877
|
+
} catch (error) {
|
|
7878
|
+
if (!isNodeError(error) || error.code !== "ENOENT") {
|
|
7879
|
+
debugLogger11.debug(
|
|
7880
|
+
`could not read the controller registry at ${filePath}: ${describe2(error)}`
|
|
7881
|
+
);
|
|
7882
|
+
}
|
|
7883
|
+
return emptyRegistry();
|
|
7884
|
+
}
|
|
7885
|
+
let parsed;
|
|
7886
|
+
try {
|
|
7887
|
+
parsed = JSON.parse(raw);
|
|
7888
|
+
} catch (error) {
|
|
7889
|
+
debugLogger11.debug(
|
|
7890
|
+
`the controller registry at ${filePath} is not JSON: ${describe2(error)}`
|
|
7891
|
+
);
|
|
7892
|
+
return emptyRegistry();
|
|
7893
|
+
}
|
|
7894
|
+
if (!isRecord(parsed)) return emptyRegistry();
|
|
7895
|
+
if (parsed["schemaVersion"] !== PEER_CONTROLLER_SCHEMA_VERSION) {
|
|
7896
|
+
debugLogger11.debug(
|
|
7897
|
+
`ignoring the controller registry at ${filePath}: unsupported schemaVersion ${String(
|
|
7898
|
+
parsed["schemaVersion"]
|
|
7899
|
+
)}`
|
|
7900
|
+
);
|
|
7901
|
+
return emptyRegistry();
|
|
7902
|
+
}
|
|
7903
|
+
const controllers = parsed["controllers"];
|
|
7904
|
+
if (!Array.isArray(controllers)) return emptyRegistry();
|
|
7905
|
+
const valid = [];
|
|
7906
|
+
for (const entry of controllers) {
|
|
7907
|
+
const record = toValidRecord(entry);
|
|
7908
|
+
if (record === null) {
|
|
7909
|
+
debugLogger11.debug(
|
|
7910
|
+
`skipping a malformed entry in the controller registry at ${filePath}`
|
|
7911
|
+
);
|
|
7912
|
+
continue;
|
|
7913
|
+
}
|
|
7914
|
+
valid.push(record);
|
|
7915
|
+
}
|
|
7916
|
+
return { schemaVersion: PEER_CONTROLLER_SCHEMA_VERSION, controllers: valid };
|
|
7917
|
+
}
|
|
7918
|
+
__name(readPeerControllerRegistrySync, "readPeerControllerRegistrySync");
|
|
7919
|
+
function matchControllerToken(registry, presented) {
|
|
7920
|
+
if (!isPresentableControllerToken(presented)) return void 0;
|
|
7921
|
+
const presentedHash = Buffer.from(hashControllerToken(presented), "hex");
|
|
7922
|
+
let matched;
|
|
7923
|
+
for (const record of registry.controllers) {
|
|
7924
|
+
const candidate = Buffer.from(record.tokenHash, "hex");
|
|
7925
|
+
if (candidate.length === presentedHash.length && timingSafeEqual2(candidate, presentedHash)) {
|
|
7926
|
+
matched = { id: record.id, label: record.label };
|
|
7927
|
+
}
|
|
7928
|
+
}
|
|
7929
|
+
return matched;
|
|
7930
|
+
}
|
|
7931
|
+
__name(matchControllerToken, "matchControllerToken");
|
|
7932
|
+
function isPresentableControllerToken(presented) {
|
|
7933
|
+
return presented.length <= MAX_PRESENTED_TOKEN_CHARS && presented.startsWith(CONTROLLER_TOKEN_PREFIX);
|
|
7934
|
+
}
|
|
7935
|
+
__name(isPresentableControllerToken, "isPresentableControllerToken");
|
|
7936
|
+
function resolveControllerToken(presented, filePath) {
|
|
7937
|
+
if (!isPresentableControllerToken(presented)) return void 0;
|
|
7938
|
+
return matchControllerToken(
|
|
7939
|
+
readPeerControllerRegistrySync(filePath),
|
|
7940
|
+
presented
|
|
7941
|
+
);
|
|
7942
|
+
}
|
|
7943
|
+
__name(resolveControllerToken, "resolveControllerToken");
|
|
7944
|
+
async function assertWritablePath(filePath) {
|
|
7945
|
+
try {
|
|
7946
|
+
const stats = await fs5.lstat(filePath);
|
|
7947
|
+
if (!stats.isFile()) {
|
|
7948
|
+
throw new PeerControllerError(
|
|
7949
|
+
`${filePath} is not a regular file; move it aside first.`,
|
|
7950
|
+
"unsafe-path"
|
|
7951
|
+
);
|
|
7952
|
+
}
|
|
7953
|
+
} catch (error) {
|
|
7954
|
+
if (error instanceof PeerControllerError) throw error;
|
|
7955
|
+
if (isNodeError(error) && error.code === "ENOENT") return;
|
|
7956
|
+
throw error;
|
|
7957
|
+
}
|
|
7958
|
+
}
|
|
7959
|
+
__name(assertWritablePath, "assertWritablePath");
|
|
7960
|
+
async function writeRegistry(filePath, registry) {
|
|
7961
|
+
await assertWritablePath(filePath);
|
|
7962
|
+
await atomicWriteJSON(filePath, registry, {
|
|
7963
|
+
mode: REGISTRY_FILE_MODE,
|
|
7964
|
+
// The file holds credentials-in-effect: an over-permissive copy
|
|
7965
|
+
// restored from a backup must be healed, not preserved.
|
|
7966
|
+
forceMode: true,
|
|
7967
|
+
noFollow: true
|
|
7968
|
+
});
|
|
7969
|
+
}
|
|
7970
|
+
__name(writeRegistry, "writeRegistry");
|
|
7971
|
+
function invalidRegistry(filePath, reason, readOnly = false) {
|
|
7972
|
+
return new PeerControllerError(
|
|
7973
|
+
readOnly ? `Cannot read ${filePath}: ${reason}. Repair it, or move it aside to revoke every grant.` : `Refusing to modify ${filePath}: ${reason}. Move it aside or repair it first.`,
|
|
7974
|
+
"invalid-registry"
|
|
7975
|
+
);
|
|
7976
|
+
}
|
|
7977
|
+
__name(invalidRegistry, "invalidRegistry");
|
|
7978
|
+
function readPeerControllerRegistryStrictSync(filePath, options = {}) {
|
|
7979
|
+
let raw;
|
|
7980
|
+
try {
|
|
7981
|
+
const stats = fsSync2.lstatSync(filePath);
|
|
7982
|
+
if (!stats.isFile()) {
|
|
7983
|
+
if (stats.isSymbolicLink()) {
|
|
7984
|
+
throw new PeerControllerError(
|
|
7985
|
+
`${filePath} is not a regular file; move it aside first.`,
|
|
7986
|
+
"unsafe-path"
|
|
7987
|
+
);
|
|
7988
|
+
}
|
|
7989
|
+
throw invalidRegistry(
|
|
7990
|
+
filePath,
|
|
7991
|
+
"it is not a regular file",
|
|
7992
|
+
options.readOnly
|
|
7993
|
+
);
|
|
7994
|
+
}
|
|
7995
|
+
if (stats.size > MAX_REGISTRY_BYTES) {
|
|
7996
|
+
throw invalidRegistry(
|
|
7997
|
+
filePath,
|
|
7998
|
+
`it exceeds the ${MAX_REGISTRY_BYTES}-byte limit`,
|
|
7999
|
+
options.readOnly
|
|
8000
|
+
);
|
|
8001
|
+
}
|
|
8002
|
+
raw = fsSync2.readFileSync(filePath, "utf8");
|
|
8003
|
+
} catch (error) {
|
|
8004
|
+
if (isNodeError(error) && error.code === "ENOENT") return emptyRegistry();
|
|
8005
|
+
throw error;
|
|
8006
|
+
}
|
|
8007
|
+
let parsed;
|
|
8008
|
+
try {
|
|
8009
|
+
parsed = JSON.parse(raw);
|
|
8010
|
+
} catch {
|
|
8011
|
+
throw invalidRegistry(filePath, "it is not valid JSON", options.readOnly);
|
|
8012
|
+
}
|
|
8013
|
+
if (!isRecord(parsed) || parsed["schemaVersion"] !== PEER_CONTROLLER_SCHEMA_VERSION || !Array.isArray(parsed["controllers"])) {
|
|
8014
|
+
throw invalidRegistry(
|
|
8015
|
+
filePath,
|
|
8016
|
+
"it has an unsupported shape or version",
|
|
8017
|
+
options.readOnly
|
|
8018
|
+
);
|
|
8019
|
+
}
|
|
8020
|
+
const controllers = [];
|
|
8021
|
+
for (const entry of parsed["controllers"]) {
|
|
8022
|
+
const record = toValidRecord(entry);
|
|
8023
|
+
if (record === null) {
|
|
8024
|
+
if (options.skipMalformedEntries) continue;
|
|
8025
|
+
throw invalidRegistry(
|
|
8026
|
+
filePath,
|
|
8027
|
+
"it contains a malformed controller",
|
|
8028
|
+
options.readOnly
|
|
8029
|
+
);
|
|
8030
|
+
}
|
|
8031
|
+
controllers.push(record);
|
|
8032
|
+
}
|
|
8033
|
+
return { schemaVersion: PEER_CONTROLLER_SCHEMA_VERSION, controllers };
|
|
8034
|
+
}
|
|
8035
|
+
__name(readPeerControllerRegistryStrictSync, "readPeerControllerRegistryStrictSync");
|
|
8036
|
+
async function withRegistryLock(filePath, mutate) {
|
|
8037
|
+
const directory = path7.dirname(filePath);
|
|
8038
|
+
await fs5.mkdir(directory, {
|
|
8039
|
+
recursive: true,
|
|
8040
|
+
mode: REGISTRY_DIRECTORY_MODE
|
|
8041
|
+
});
|
|
8042
|
+
const lockPath = path7.join(
|
|
8043
|
+
await fs5.realpath(directory),
|
|
8044
|
+
path7.basename(filePath)
|
|
8045
|
+
);
|
|
8046
|
+
const release = await import_proper_lockfile.default.lock(lockPath, LOCK_OPTIONS);
|
|
8047
|
+
try {
|
|
8048
|
+
return await mutate();
|
|
8049
|
+
} finally {
|
|
8050
|
+
try {
|
|
8051
|
+
await release();
|
|
8052
|
+
} catch {
|
|
8053
|
+
}
|
|
8054
|
+
}
|
|
8055
|
+
}
|
|
8056
|
+
__name(withRegistryLock, "withRegistryLock");
|
|
8057
|
+
async function listPeerControllers(filePath = getPeerControllerRegistryPath()) {
|
|
8058
|
+
return readPeerControllerRegistryStrictSync(filePath, {
|
|
8059
|
+
skipMalformedEntries: true,
|
|
8060
|
+
readOnly: true
|
|
8061
|
+
}).controllers;
|
|
8062
|
+
}
|
|
8063
|
+
__name(listPeerControllers, "listPeerControllers");
|
|
8064
|
+
async function addPeerController(label, filePath = getPeerControllerRegistryPath()) {
|
|
8065
|
+
const flattened = flattenPeerLabel(label);
|
|
8066
|
+
if (flattened.length === 0) {
|
|
8067
|
+
throw new PeerControllerError(
|
|
8068
|
+
"A controller needs a label: something you will recognize when you come to revoke it.",
|
|
8069
|
+
"invalid-label"
|
|
8070
|
+
);
|
|
8071
|
+
}
|
|
8072
|
+
if (flattened.length > MAX_CONTROLLER_LABEL_CHARS) {
|
|
8073
|
+
throw new PeerControllerError(
|
|
8074
|
+
`A controller label may be at most ${MAX_CONTROLLER_LABEL_CHARS} characters.`,
|
|
8075
|
+
"invalid-label"
|
|
8076
|
+
);
|
|
8077
|
+
}
|
|
8078
|
+
return withRegistryLock(filePath, async () => {
|
|
8079
|
+
const registry = readPeerControllerRegistryStrictSync(filePath);
|
|
8080
|
+
if (registry.controllers.some(
|
|
8081
|
+
(record2) => record2.label.toLowerCase() === flattened.toLowerCase()
|
|
8082
|
+
)) {
|
|
8083
|
+
throw new PeerControllerError(
|
|
8084
|
+
`A controller called "${flattened}" already exists. Labels are how you tell them apart when revoking, so pick another.`,
|
|
8085
|
+
"duplicate-label"
|
|
8086
|
+
);
|
|
8087
|
+
}
|
|
8088
|
+
if (registry.controllers.length >= MAX_CONTROLLERS) {
|
|
8089
|
+
throw new PeerControllerError(
|
|
8090
|
+
`This Qwen home already holds ${MAX_CONTROLLERS} controllers. Revoke one before adding another.`,
|
|
8091
|
+
"too-many"
|
|
8092
|
+
);
|
|
8093
|
+
}
|
|
8094
|
+
const token = mintControllerToken();
|
|
8095
|
+
const taken = new Set(registry.controllers.map((record2) => record2.id));
|
|
8096
|
+
let id = `c_${randomBytes2(4).toString("hex")}`;
|
|
8097
|
+
while (taken.has(id)) {
|
|
8098
|
+
id = `c_${randomBytes2(4).toString("hex")}`;
|
|
8099
|
+
}
|
|
8100
|
+
const record = {
|
|
8101
|
+
id,
|
|
8102
|
+
label: flattened,
|
|
8103
|
+
tokenHash: hashControllerToken(token),
|
|
8104
|
+
createdAt: Date.now()
|
|
8105
|
+
};
|
|
8106
|
+
await writeRegistry(filePath, {
|
|
8107
|
+
schemaVersion: PEER_CONTROLLER_SCHEMA_VERSION,
|
|
8108
|
+
controllers: [...registry.controllers, record]
|
|
8109
|
+
});
|
|
8110
|
+
return { record, token };
|
|
8111
|
+
});
|
|
8112
|
+
}
|
|
8113
|
+
__name(addPeerController, "addPeerController");
|
|
8114
|
+
async function removePeerController(id, filePath = getPeerControllerRegistryPath()) {
|
|
8115
|
+
return withRegistryLock(filePath, async () => {
|
|
8116
|
+
const registry = readPeerControllerRegistryStrictSync(filePath, {
|
|
8117
|
+
skipMalformedEntries: true
|
|
8118
|
+
});
|
|
8119
|
+
const needle = id.trim().toLowerCase();
|
|
8120
|
+
const removed = registry.controllers.find(
|
|
8121
|
+
(record) => record.id.toLowerCase() === needle
|
|
8122
|
+
);
|
|
8123
|
+
if (!removed) return null;
|
|
8124
|
+
await writeRegistry(filePath, {
|
|
8125
|
+
schemaVersion: PEER_CONTROLLER_SCHEMA_VERSION,
|
|
8126
|
+
controllers: registry.controllers.filter(
|
|
8127
|
+
(record) => record.tokenHash !== removed.tokenHash
|
|
8128
|
+
)
|
|
8129
|
+
});
|
|
8130
|
+
return removed;
|
|
8131
|
+
});
|
|
8132
|
+
}
|
|
8133
|
+
__name(removePeerController, "removePeerController");
|
|
8134
|
+
|
|
7723
8135
|
// packages/core/src/utils/conversation-branches.ts
|
|
7724
8136
|
init_esbuild_shims();
|
|
7725
8137
|
|
|
7726
8138
|
// packages/core/src/services/toolUseSummary.ts
|
|
7727
8139
|
init_esbuild_shims();
|
|
7728
|
-
var
|
|
8140
|
+
var debugLogger12 = createDebugLogger("TOOL_USE_SUMMARY");
|
|
7729
8141
|
var TOOL_USE_SUMMARY_SYSTEM_PROMPT = `Write a short summary label describing what these tool calls accomplished. It appears as a single-line row in a mobile app and truncates around 30 characters, so think git-commit-subject, not sentence.
|
|
7730
8142
|
|
|
7731
8143
|
Keep the verb in past tense and the most distinctive noun. Drop articles, connectors, and long location context first.
|
|
@@ -7746,7 +8158,7 @@ async function generateToolUseSummary(params) {
|
|
|
7746
8158
|
}
|
|
7747
8159
|
const model = config.getFastModel();
|
|
7748
8160
|
if (!model) {
|
|
7749
|
-
|
|
8161
|
+
debugLogger12.debug("No fast model configured \u2014 skipping summary generation");
|
|
7750
8162
|
return null;
|
|
7751
8163
|
}
|
|
7752
8164
|
if (signal.aborted) {
|
|
@@ -7769,7 +8181,7 @@ ${toolSummaries}
|
|
|
7769
8181
|
|
|
7770
8182
|
Label:`;
|
|
7771
8183
|
if (!config.getLlmClient()) {
|
|
7772
|
-
|
|
8184
|
+
debugLogger12.debug("No gemini client available \u2014 skipping");
|
|
7773
8185
|
return null;
|
|
7774
8186
|
}
|
|
7775
8187
|
const result = await runSideQuery(config, {
|
|
@@ -7788,19 +8200,19 @@ Label:`;
|
|
|
7788
8200
|
});
|
|
7789
8201
|
if (signal.aborted) return null;
|
|
7790
8202
|
if (!result.text) {
|
|
7791
|
-
|
|
8203
|
+
debugLogger12.debug("Summary generation returned empty result");
|
|
7792
8204
|
return null;
|
|
7793
8205
|
}
|
|
7794
8206
|
const cleaned = cleanSummary(result.text);
|
|
7795
8207
|
if (!cleaned) {
|
|
7796
|
-
|
|
8208
|
+
debugLogger12.debug(`Summary cleaned to empty: raw="${result.text}"`);
|
|
7797
8209
|
return null;
|
|
7798
8210
|
}
|
|
7799
|
-
|
|
8211
|
+
debugLogger12.debug(`Summary generated: "${cleaned}"`);
|
|
7800
8212
|
return cleaned;
|
|
7801
8213
|
} catch (err) {
|
|
7802
8214
|
if (signal.aborted) return null;
|
|
7803
|
-
|
|
8215
|
+
debugLogger12.warn(
|
|
7804
8216
|
`Summary generation failed: ${err instanceof Error ? err.message : String(err)}`
|
|
7805
8217
|
);
|
|
7806
8218
|
return null;
|
|
@@ -7874,7 +8286,7 @@ __name(cleanSummary, "cleanSummary");
|
|
|
7874
8286
|
|
|
7875
8287
|
// packages/core/src/services/usage-dashboard-service.ts
|
|
7876
8288
|
init_esbuild_shims();
|
|
7877
|
-
var
|
|
8289
|
+
var debugLogger13 = createDebugLogger("USAGE_DASHBOARD");
|
|
7878
8290
|
var DEFAULT_HEATMAP_DAYS = 183;
|
|
7879
8291
|
var MAX_DAILY_DAYS = 92;
|
|
7880
8292
|
var MS_PER_DAY = 24 * 60 * 60 * 1e3;
|
|
@@ -7999,7 +8411,7 @@ function buildUsageDashboard(records, options = {}) {
|
|
|
7999
8411
|
);
|
|
8000
8412
|
const daily = buildDaily(records, dailyStart, now);
|
|
8001
8413
|
const heatmap = buildHeatmap(records, now - heatmapDays * MS_PER_DAY, now);
|
|
8002
|
-
|
|
8414
|
+
debugLogger13.debug(
|
|
8003
8415
|
`built dashboard range=${range} records=${records.length} models=${models.length} skills=${skills.length} dailyPoints=${daily.length}`
|
|
8004
8416
|
);
|
|
8005
8417
|
return {
|
|
@@ -8021,16 +8433,16 @@ __name(loadUsageDashboard, "loadUsageDashboard");
|
|
|
8021
8433
|
|
|
8022
8434
|
// packages/core/src/memory/channel-memory-document.ts
|
|
8023
8435
|
init_esbuild_shims();
|
|
8024
|
-
import { createHash as
|
|
8436
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
8025
8437
|
var CHANNEL_MEMORY_DOCUMENT_VERSION = 1;
|
|
8026
8438
|
var MAX_CHANNEL_MEMORY_ENTRIES = 500;
|
|
8027
8439
|
var MAX_CHANNEL_MEMORY_ENTRIES_PER_REQUEST = 10;
|
|
8028
8440
|
var MAX_CHANNEL_MEMORY_ENTRY_CODE_POINTS = 2e3;
|
|
8029
8441
|
var CHANNEL_MEMORY_ID_RE = /^m-[a-f0-9]{12}$/u;
|
|
8030
|
-
function
|
|
8442
|
+
function isRecord2(value) {
|
|
8031
8443
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8032
8444
|
}
|
|
8033
|
-
__name(
|
|
8445
|
+
__name(isRecord2, "isRecord");
|
|
8034
8446
|
function invalidDocument(message = "Invalid channel memory document") {
|
|
8035
8447
|
return new Error(message);
|
|
8036
8448
|
}
|
|
@@ -8043,7 +8455,7 @@ function validateKeys(value, allowedKeys, message) {
|
|
|
8043
8455
|
}
|
|
8044
8456
|
__name(validateKeys, "validateKeys");
|
|
8045
8457
|
function validateEntry(value) {
|
|
8046
|
-
if (!
|
|
8458
|
+
if (!isRecord2(value)) {
|
|
8047
8459
|
throw invalidDocument("Invalid channel memory entry");
|
|
8048
8460
|
}
|
|
8049
8461
|
validateKeys(
|
|
@@ -8068,7 +8480,7 @@ function validateEntry(value) {
|
|
|
8068
8480
|
}
|
|
8069
8481
|
__name(validateEntry, "validateEntry");
|
|
8070
8482
|
function parseDocumentValue(value) {
|
|
8071
|
-
if (!
|
|
8483
|
+
if (!isRecord2(value)) {
|
|
8072
8484
|
throw invalidDocument();
|
|
8073
8485
|
}
|
|
8074
8486
|
validateKeys(value, ["version", "migration", "entries"]);
|
|
@@ -8095,7 +8507,7 @@ function parseDocumentValue(value) {
|
|
|
8095
8507
|
});
|
|
8096
8508
|
let migration;
|
|
8097
8509
|
if ("migration" in value) {
|
|
8098
|
-
if (!
|
|
8510
|
+
if (!isRecord2(value["migration"]) || typeof value["migration"]["legacySha256"] !== "string" || !/^[a-f0-9]{64}$/u.test(value["migration"]["legacySha256"])) {
|
|
8099
8511
|
throw invalidDocument();
|
|
8100
8512
|
}
|
|
8101
8513
|
validateKeys(value["migration"], ["legacySha256"]);
|
|
@@ -8281,7 +8693,7 @@ function parseLegacyChannelMemory(raw) {
|
|
|
8281
8693
|
continue;
|
|
8282
8694
|
}
|
|
8283
8695
|
normalizedTexts.add(normalizedText);
|
|
8284
|
-
const digest =
|
|
8696
|
+
const digest = createHash4("sha256").update(`${normalizedText}\0${sourceLineIndex}`).digest("hex");
|
|
8285
8697
|
const id = `m-${digest.slice(0, 12)}`;
|
|
8286
8698
|
if (ids.has(id)) {
|
|
8287
8699
|
throw new Error("Channel memory legacy ID collision");
|
|
@@ -8295,7 +8707,7 @@ function parseLegacyChannelMemory(raw) {
|
|
|
8295
8707
|
return {
|
|
8296
8708
|
version: 1,
|
|
8297
8709
|
migration: {
|
|
8298
|
-
legacySha256:
|
|
8710
|
+
legacySha256: createHash4("sha256").update(raw).digest("hex")
|
|
8299
8711
|
},
|
|
8300
8712
|
entries
|
|
8301
8713
|
};
|
|
@@ -8328,16 +8740,16 @@ __name(serializeChannelMemoryDocument, "serializeChannelMemoryDocument");
|
|
|
8328
8740
|
|
|
8329
8741
|
// packages/core/src/memory/channel-memory.ts
|
|
8330
8742
|
init_esbuild_shims();
|
|
8331
|
-
var
|
|
8332
|
-
import { createHash as
|
|
8333
|
-
import * as
|
|
8334
|
-
import * as
|
|
8743
|
+
var import_proper_lockfile2 = __toESM(require_proper_lockfile(), 1);
|
|
8744
|
+
import { createHash as createHash5, randomBytes as randomBytes3 } from "node:crypto";
|
|
8745
|
+
import * as fs6 from "node:fs/promises";
|
|
8746
|
+
import * as path8 from "node:path";
|
|
8335
8747
|
var CHANNEL_MEMORY_FILE_NAME = "CHANNEL.json";
|
|
8336
8748
|
var LEGACY_CHANNEL_MEMORY_FILE_NAME = "CHANNEL.md";
|
|
8337
8749
|
var MAX_CHANNEL_MEMORY_BYTES = 1024 * 1024;
|
|
8338
|
-
var
|
|
8750
|
+
var debugLogger14 = createDebugLogger("CHANNEL_MEMORY");
|
|
8339
8751
|
var pendingMutations = /* @__PURE__ */ new Map();
|
|
8340
|
-
var
|
|
8752
|
+
var LOCK_OPTIONS2 = {
|
|
8341
8753
|
realpath: false,
|
|
8342
8754
|
retries: {
|
|
8343
8755
|
retries: 12,
|
|
@@ -8348,7 +8760,7 @@ var LOCK_OPTIONS = {
|
|
|
8348
8760
|
},
|
|
8349
8761
|
stale: 5e3,
|
|
8350
8762
|
onCompromised: /* @__PURE__ */ __name((err) => {
|
|
8351
|
-
|
|
8763
|
+
debugLogger14.warn("channel memory lock compromised:", err);
|
|
8352
8764
|
}, "onCompromised")
|
|
8353
8765
|
};
|
|
8354
8766
|
function isMissingFile(error) {
|
|
@@ -8371,27 +8783,27 @@ async function releaseLock(release) {
|
|
|
8371
8783
|
__name(releaseLock, "releaseLock");
|
|
8372
8784
|
async function cleanupLegacyAfterCommit(legacyPath, expectedBytes) {
|
|
8373
8785
|
try {
|
|
8374
|
-
const currentBytes = await
|
|
8786
|
+
const currentBytes = await fs6.readFile(legacyPath);
|
|
8375
8787
|
if (legacyHash(currentBytes) !== legacyHash(expectedBytes) || !currentBytes.equals(expectedBytes)) {
|
|
8376
8788
|
return;
|
|
8377
8789
|
}
|
|
8378
|
-
await
|
|
8790
|
+
await fs6.unlink(legacyPath);
|
|
8379
8791
|
} catch {
|
|
8380
8792
|
}
|
|
8381
8793
|
}
|
|
8382
8794
|
__name(cleanupLegacyAfterCommit, "cleanupLegacyAfterCommit");
|
|
8383
8795
|
function safeChannelName(channelName) {
|
|
8384
8796
|
const slug = channelName.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 20) || "_";
|
|
8385
|
-
const hash =
|
|
8797
|
+
const hash = createHash5("sha256").update(channelName).digest("hex").slice(0, 16);
|
|
8386
8798
|
return `${slug}-${hash}`;
|
|
8387
8799
|
}
|
|
8388
8800
|
__name(safeChannelName, "safeChannelName");
|
|
8389
8801
|
function hashedThreadPath(target) {
|
|
8390
|
-
return
|
|
8802
|
+
return createHash5("sha256").update(target.chatId).update("\0").update(target.threadId ?? "").digest("hex").slice(0, 32);
|
|
8391
8803
|
}
|
|
8392
8804
|
__name(hashedThreadPath, "hashedThreadPath");
|
|
8393
8805
|
function getChannelMemoryDirectory(target) {
|
|
8394
|
-
return
|
|
8806
|
+
return path8.join(
|
|
8395
8807
|
Storage.getGlobalQwenDir(),
|
|
8396
8808
|
"channels",
|
|
8397
8809
|
"memory",
|
|
@@ -8401,11 +8813,11 @@ function getChannelMemoryDirectory(target) {
|
|
|
8401
8813
|
}
|
|
8402
8814
|
__name(getChannelMemoryDirectory, "getChannelMemoryDirectory");
|
|
8403
8815
|
function getChannelMemoryFilePath(target) {
|
|
8404
|
-
return
|
|
8816
|
+
return path8.join(getChannelMemoryDirectory(target), CHANNEL_MEMORY_FILE_NAME);
|
|
8405
8817
|
}
|
|
8406
8818
|
__name(getChannelMemoryFilePath, "getChannelMemoryFilePath");
|
|
8407
8819
|
function getLegacyChannelMemoryFilePath(target) {
|
|
8408
|
-
return
|
|
8820
|
+
return path8.join(
|
|
8409
8821
|
getChannelMemoryDirectory(target),
|
|
8410
8822
|
LEGACY_CHANNEL_MEMORY_FILE_NAME
|
|
8411
8823
|
);
|
|
@@ -8415,8 +8827,8 @@ async function serializeMutation(directory, task) {
|
|
|
8415
8827
|
const previous = pendingMutations.get(directory) ?? Promise.resolve();
|
|
8416
8828
|
let resolveCurrent = /* @__PURE__ */ __name(() => {
|
|
8417
8829
|
}, "resolveCurrent");
|
|
8418
|
-
const current = new Promise((
|
|
8419
|
-
resolveCurrent =
|
|
8830
|
+
const current = new Promise((resolve7) => {
|
|
8831
|
+
resolveCurrent = resolve7;
|
|
8420
8832
|
});
|
|
8421
8833
|
const queued = previous.then(
|
|
8422
8834
|
() => current,
|
|
@@ -8437,7 +8849,7 @@ async function serializeMutation(directory, task) {
|
|
|
8437
8849
|
__name(serializeMutation, "serializeMutation");
|
|
8438
8850
|
async function readFileIfExists(filePath) {
|
|
8439
8851
|
try {
|
|
8440
|
-
return await
|
|
8852
|
+
return await fs6.readFile(filePath);
|
|
8441
8853
|
} catch (error) {
|
|
8442
8854
|
if (isMissingFile(error)) {
|
|
8443
8855
|
return void 0;
|
|
@@ -8447,12 +8859,12 @@ async function readFileIfExists(filePath) {
|
|
|
8447
8859
|
}
|
|
8448
8860
|
__name(readFileIfExists, "readFileIfExists");
|
|
8449
8861
|
function legacyHash(legacyBytes) {
|
|
8450
|
-
return
|
|
8862
|
+
return createHash5("sha256").update(legacyBytes).digest("hex");
|
|
8451
8863
|
}
|
|
8452
8864
|
__name(legacyHash, "legacyHash");
|
|
8453
8865
|
async function lockLegacyIfExists(legacyPath) {
|
|
8454
8866
|
try {
|
|
8455
|
-
return await
|
|
8867
|
+
return await import_proper_lockfile2.default.lock(legacyPath, LOCK_OPTIONS2);
|
|
8456
8868
|
} catch (error) {
|
|
8457
8869
|
if (isMissingFile(error)) {
|
|
8458
8870
|
return void 0;
|
|
@@ -8500,21 +8912,21 @@ async function loadChannelMemory(target) {
|
|
|
8500
8912
|
}
|
|
8501
8913
|
__name(loadChannelMemory, "loadChannelMemory");
|
|
8502
8914
|
async function writeChannelMemory(filePath, serialized) {
|
|
8503
|
-
const tempPath = `${filePath}.${process.pid}.${
|
|
8915
|
+
const tempPath = `${filePath}.${process.pid}.${randomBytes3(6).toString("hex")}.tmp`;
|
|
8504
8916
|
let committed = false;
|
|
8505
8917
|
try {
|
|
8506
|
-
const handle = await
|
|
8918
|
+
const handle = await fs6.open(tempPath, "wx", 384);
|
|
8507
8919
|
try {
|
|
8508
8920
|
await handle.writeFile(serialized, "utf8");
|
|
8509
8921
|
await handle.sync();
|
|
8510
8922
|
} finally {
|
|
8511
8923
|
await handle.close();
|
|
8512
8924
|
}
|
|
8513
|
-
await
|
|
8925
|
+
await fs6.rename(tempPath, filePath);
|
|
8514
8926
|
committed = true;
|
|
8515
8927
|
} finally {
|
|
8516
8928
|
if (!committed) {
|
|
8517
|
-
await
|
|
8929
|
+
await fs6.unlink(tempPath).catch((error) => {
|
|
8518
8930
|
if (!isMissingFile(error)) {
|
|
8519
8931
|
throw error;
|
|
8520
8932
|
}
|
|
@@ -8525,14 +8937,14 @@ async function writeChannelMemory(filePath, serialized) {
|
|
|
8525
8937
|
__name(writeChannelMemory, "writeChannelMemory");
|
|
8526
8938
|
async function mutateChannelMemory(target, apply) {
|
|
8527
8939
|
const filePath = getChannelMemoryFilePath(target);
|
|
8528
|
-
const directory =
|
|
8940
|
+
const directory = path8.dirname(filePath);
|
|
8529
8941
|
const legacyPath = getLegacyChannelMemoryFilePath(target);
|
|
8530
8942
|
return serializeMutation(directory, async () => {
|
|
8531
|
-
await
|
|
8532
|
-
const lockPath =
|
|
8533
|
-
const lockHandle = await
|
|
8943
|
+
await fs6.mkdir(directory, { recursive: true });
|
|
8944
|
+
const lockPath = path8.join(directory, ".channel-memory.lock");
|
|
8945
|
+
const lockHandle = await fs6.open(lockPath, "a", 384);
|
|
8534
8946
|
await lockHandle.close();
|
|
8535
|
-
const release = await
|
|
8947
|
+
const release = await import_proper_lockfile2.default.lock(lockPath, LOCK_OPTIONS2);
|
|
8536
8948
|
let releaseLegacy;
|
|
8537
8949
|
try {
|
|
8538
8950
|
releaseLegacy = await lockLegacyIfExists(legacyPath);
|
|
@@ -8569,7 +8981,7 @@ async function listChannelMemoryEntries(target) {
|
|
|
8569
8981
|
__name(listChannelMemoryEntries, "listChannelMemoryEntries");
|
|
8570
8982
|
async function getFileRevision(filePath) {
|
|
8571
8983
|
try {
|
|
8572
|
-
const stats = await
|
|
8984
|
+
const stats = await fs6.stat(filePath, { bigint: true });
|
|
8573
8985
|
return [
|
|
8574
8986
|
stats.dev,
|
|
8575
8987
|
stats.ino,
|
|
@@ -8590,7 +9002,7 @@ async function getChannelMemoryRevision(target) {
|
|
|
8590
9002
|
getFileRevision(getChannelMemoryFilePath(target)),
|
|
8591
9003
|
getFileRevision(getLegacyChannelMemoryFilePath(target))
|
|
8592
9004
|
]);
|
|
8593
|
-
return
|
|
9005
|
+
return createHash5("sha256").update(canonical).update("\0").update(legacy).digest("hex");
|
|
8594
9006
|
}
|
|
8595
9007
|
__name(getChannelMemoryRevision, "getChannelMemoryRevision");
|
|
8596
9008
|
async function addChannelMemoryEntries(target, texts, createdBy) {
|
|
@@ -8622,7 +9034,7 @@ async function addChannelMemoryEntries(target, texts, createdBy) {
|
|
|
8622
9034
|
}
|
|
8623
9035
|
let randomHex;
|
|
8624
9036
|
do {
|
|
8625
|
-
randomHex =
|
|
9037
|
+
randomHex = randomBytes3(6).toString("hex");
|
|
8626
9038
|
} while (ids.has(`m-${randomHex}`));
|
|
8627
9039
|
const entry = createChannelMemoryEntry({
|
|
8628
9040
|
text,
|
|
@@ -8909,8 +9321,8 @@ __name(buildLearnVideoSkillRequest, "buildLearnVideoSkillRequest");
|
|
|
8909
9321
|
|
|
8910
9322
|
// packages/core/src/memory/writeContextFile.ts
|
|
8911
9323
|
init_esbuild_shims();
|
|
8912
|
-
import { promises as
|
|
8913
|
-
import * as
|
|
9324
|
+
import { promises as fs7 } from "node:fs";
|
|
9325
|
+
import * as path9 from "node:path";
|
|
8914
9326
|
var fileLocks = /* @__PURE__ */ new Map();
|
|
8915
9327
|
var FILE_LOCK_TIMEOUT_MS = 3e4;
|
|
8916
9328
|
function getFileLock(filePath) {
|
|
@@ -8938,7 +9350,7 @@ var WorkspaceMemoryWriteTimeoutError = class extends Error {
|
|
|
8938
9350
|
}
|
|
8939
9351
|
};
|
|
8940
9352
|
async function writeWorkspaceContextFile(options) {
|
|
8941
|
-
if (!
|
|
9353
|
+
if (!path9.isAbsolute(options.projectRoot)) {
|
|
8942
9354
|
throw new Error(
|
|
8943
9355
|
`writeWorkspaceContextFile: projectRoot must be absolute, got "${options.projectRoot}"`
|
|
8944
9356
|
);
|
|
@@ -8964,10 +9376,10 @@ async function runWrite(filePath, options) {
|
|
|
8964
9376
|
return { filePath, bytesWritten: 0, changed: false };
|
|
8965
9377
|
}
|
|
8966
9378
|
options.assertCanCommit?.();
|
|
8967
|
-
await
|
|
9379
|
+
await fs7.mkdir(path9.dirname(filePath), { recursive: true });
|
|
8968
9380
|
if (options.mode === "replace") {
|
|
8969
9381
|
options.assertCanCommit?.();
|
|
8970
|
-
await
|
|
9382
|
+
await fs7.writeFile(filePath, options.content, {
|
|
8971
9383
|
encoding: "utf8",
|
|
8972
9384
|
mode: 420
|
|
8973
9385
|
});
|
|
@@ -8979,7 +9391,7 @@ async function runWrite(filePath, options) {
|
|
|
8979
9391
|
}
|
|
8980
9392
|
const next = await composeAppendedContent(filePath, options.content);
|
|
8981
9393
|
options.assertCanCommit?.();
|
|
8982
|
-
await
|
|
9394
|
+
await fs7.writeFile(filePath, next, { encoding: "utf8", mode: 420 });
|
|
8983
9395
|
return {
|
|
8984
9396
|
filePath,
|
|
8985
9397
|
bytesWritten: Buffer.byteLength(next, "utf8"),
|
|
@@ -8990,9 +9402,9 @@ __name(runWrite, "runWrite");
|
|
|
8990
9402
|
function resolveContextFilePath(scope, projectRoot) {
|
|
8991
9403
|
const filename = getCurrentMemoryFilename();
|
|
8992
9404
|
if (scope === "workspace") {
|
|
8993
|
-
return
|
|
9405
|
+
return path9.join(projectRoot, filename);
|
|
8994
9406
|
}
|
|
8995
|
-
return
|
|
9407
|
+
return path9.join(Storage.getGlobalQwenDir(), filename);
|
|
8996
9408
|
}
|
|
8997
9409
|
__name(resolveContextFilePath, "resolveContextFilePath");
|
|
8998
9410
|
var MAX_EXISTING_FILE_BYTES = 16 * 1024 * 1024;
|
|
@@ -9016,7 +9428,7 @@ var WorkspaceMemoryFileTooLargeError = class extends Error {
|
|
|
9016
9428
|
async function composeAppendedContent(filePath, newContent) {
|
|
9017
9429
|
let existing = "";
|
|
9018
9430
|
try {
|
|
9019
|
-
const stat5 = await
|
|
9431
|
+
const stat5 = await fs7.stat(filePath);
|
|
9020
9432
|
if (stat5.size > MAX_EXISTING_FILE_BYTES) {
|
|
9021
9433
|
throw new WorkspaceMemoryFileTooLargeError(
|
|
9022
9434
|
filePath,
|
|
@@ -9024,7 +9436,7 @@ async function composeAppendedContent(filePath, newContent) {
|
|
|
9024
9436
|
MAX_EXISTING_FILE_BYTES
|
|
9025
9437
|
);
|
|
9026
9438
|
}
|
|
9027
|
-
existing = await
|
|
9439
|
+
existing = await fs7.readFile(filePath, "utf8");
|
|
9028
9440
|
} catch (err) {
|
|
9029
9441
|
if (err instanceof WorkspaceMemoryFileTooLargeError) throw err;
|
|
9030
9442
|
if (!isEnoent(err)) throw err;
|
|
@@ -9103,8 +9515,8 @@ __name(trimNewlines, "trimNewlines");
|
|
|
9103
9515
|
init_esbuild_shims();
|
|
9104
9516
|
import * as child_process from "node:child_process";
|
|
9105
9517
|
import * as process2 from "node:process";
|
|
9106
|
-
import * as
|
|
9107
|
-
import * as
|
|
9518
|
+
import * as path10 from "node:path";
|
|
9519
|
+
import * as fs8 from "node:fs";
|
|
9108
9520
|
import * as os2 from "node:os";
|
|
9109
9521
|
function getVsCodeCommand(platform2 = process2.platform) {
|
|
9110
9522
|
return platform2 === "win32" ? "code.cmd" : "code";
|
|
@@ -9132,23 +9544,23 @@ async function findVsCodeCommand(platform2 = process2.platform) {
|
|
|
9132
9544
|
if (platform2 === "darwin") {
|
|
9133
9545
|
locations.push(
|
|
9134
9546
|
"/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code",
|
|
9135
|
-
|
|
9547
|
+
path10.join(homeDir, "Library/Application Support/Code/bin/code")
|
|
9136
9548
|
);
|
|
9137
9549
|
} else if (platform2 === "linux") {
|
|
9138
9550
|
locations.push(
|
|
9139
9551
|
"/usr/share/code/bin/code",
|
|
9140
9552
|
"/snap/bin/code",
|
|
9141
|
-
|
|
9553
|
+
path10.join(homeDir, ".local/share/code/bin/code")
|
|
9142
9554
|
);
|
|
9143
9555
|
} else if (platform2 === "win32") {
|
|
9144
9556
|
locations.push(
|
|
9145
|
-
|
|
9557
|
+
path10.join(
|
|
9146
9558
|
process2.env["ProgramFiles"] || "C:\\Program Files",
|
|
9147
9559
|
"Microsoft VS Code",
|
|
9148
9560
|
"bin",
|
|
9149
9561
|
"code.cmd"
|
|
9150
9562
|
),
|
|
9151
|
-
|
|
9563
|
+
path10.join(
|
|
9152
9564
|
homeDir,
|
|
9153
9565
|
"AppData",
|
|
9154
9566
|
"Local",
|
|
@@ -9160,7 +9572,7 @@ async function findVsCodeCommand(platform2 = process2.platform) {
|
|
|
9160
9572
|
);
|
|
9161
9573
|
}
|
|
9162
9574
|
for (const location of locations) {
|
|
9163
|
-
if (
|
|
9575
|
+
if (fs8.existsSync(location)) {
|
|
9164
9576
|
return location;
|
|
9165
9577
|
}
|
|
9166
9578
|
}
|
|
@@ -9285,7 +9697,7 @@ var CODE_ACTION_KIND_LABELS = {
|
|
|
9285
9697
|
|
|
9286
9698
|
// packages/core/src/lsp/configHash.ts
|
|
9287
9699
|
init_esbuild_shims();
|
|
9288
|
-
import { createHash as
|
|
9700
|
+
import { createHash as createHash6 } from "node:crypto";
|
|
9289
9701
|
function sortJsonValue(value) {
|
|
9290
9702
|
if (Array.isArray(value)) {
|
|
9291
9703
|
return value.map(sortJsonValue);
|
|
@@ -9321,16 +9733,16 @@ function lspServerConfigHash(config) {
|
|
|
9321
9733
|
socket: config.socket
|
|
9322
9734
|
};
|
|
9323
9735
|
const stableConfig = sortJsonValue(hashInput);
|
|
9324
|
-
return
|
|
9736
|
+
return createHash6("sha256").update(JSON.stringify(stableConfig)).digest("hex");
|
|
9325
9737
|
}
|
|
9326
9738
|
__name(lspServerConfigHash, "lspServerConfigHash");
|
|
9327
9739
|
|
|
9328
9740
|
// packages/core/src/lsp/LspConfigLoader.ts
|
|
9329
9741
|
init_esbuild_shims();
|
|
9330
|
-
import * as
|
|
9331
|
-
import * as
|
|
9742
|
+
import * as fs9 from "node:fs";
|
|
9743
|
+
import * as path11 from "path";
|
|
9332
9744
|
import { pathToFileURL } from "url";
|
|
9333
|
-
var
|
|
9745
|
+
var debugLogger15 = createDebugLogger("LSP");
|
|
9334
9746
|
var MAX_TCP_PORT = 65535;
|
|
9335
9747
|
var LspConfigLoader = class {
|
|
9336
9748
|
constructor(workspaceRoot) {
|
|
@@ -9344,25 +9756,25 @@ var LspConfigLoader = class {
|
|
|
9344
9756
|
* Supports basic format: { "language": { "command": "...", "extensionToLanguage": {...} } }
|
|
9345
9757
|
*/
|
|
9346
9758
|
async loadUserConfigs() {
|
|
9347
|
-
const lspConfigPath =
|
|
9348
|
-
if (!
|
|
9759
|
+
const lspConfigPath = path11.join(this.workspaceRoot, ".lsp.json");
|
|
9760
|
+
if (!fs9.existsSync(lspConfigPath)) {
|
|
9349
9761
|
return [];
|
|
9350
9762
|
}
|
|
9351
9763
|
try {
|
|
9352
|
-
const configContent =
|
|
9764
|
+
const configContent = fs9.readFileSync(lspConfigPath, "utf-8");
|
|
9353
9765
|
const data = JSON.parse(configContent);
|
|
9354
9766
|
return this.parseConfigSource(data, lspConfigPath, {
|
|
9355
9767
|
forceTrustRequired: true
|
|
9356
9768
|
});
|
|
9357
9769
|
} catch (error) {
|
|
9358
|
-
|
|
9770
|
+
debugLogger15.warn("Failed to load user .lsp.json config:", error);
|
|
9359
9771
|
return [];
|
|
9360
9772
|
}
|
|
9361
9773
|
}
|
|
9362
9774
|
async loadUserConfigsStrict() {
|
|
9363
|
-
const lspConfigPath =
|
|
9775
|
+
const lspConfigPath = path11.join(this.workspaceRoot, ".lsp.json");
|
|
9364
9776
|
try {
|
|
9365
|
-
const configContent =
|
|
9777
|
+
const configContent = fs9.readFileSync(lspConfigPath, "utf-8");
|
|
9366
9778
|
const data = JSON.parse(configContent);
|
|
9367
9779
|
return this.parseUserConfigSourceStrict(data, lspConfigPath);
|
|
9368
9780
|
} catch (error) {
|
|
@@ -9391,14 +9803,14 @@ var LspConfigLoader = class {
|
|
|
9391
9803
|
extension.path,
|
|
9392
9804
|
lspServers
|
|
9393
9805
|
);
|
|
9394
|
-
if (!
|
|
9395
|
-
|
|
9806
|
+
if (!fs9.existsSync(configPath)) {
|
|
9807
|
+
debugLogger15.warn(
|
|
9396
9808
|
`LSP config not found for ${originBase}: ${configPath}`
|
|
9397
9809
|
);
|
|
9398
9810
|
continue;
|
|
9399
9811
|
}
|
|
9400
9812
|
try {
|
|
9401
|
-
const configContent =
|
|
9813
|
+
const configContent = fs9.readFileSync(configPath, "utf-8");
|
|
9402
9814
|
const data = JSON.parse(configContent);
|
|
9403
9815
|
const hydrated = this.hydrateExtensionLspConfig(data, extension.path);
|
|
9404
9816
|
configs.push(
|
|
@@ -9408,7 +9820,7 @@ var LspConfigLoader = class {
|
|
|
9408
9820
|
)
|
|
9409
9821
|
);
|
|
9410
9822
|
} catch (error) {
|
|
9411
|
-
|
|
9823
|
+
debugLogger15.warn(
|
|
9412
9824
|
`Failed to load extension LSP config from ${configPath}:`,
|
|
9413
9825
|
error
|
|
9414
9826
|
);
|
|
@@ -9422,7 +9834,7 @@ var LspConfigLoader = class {
|
|
|
9422
9834
|
...this.parseConfigSource(hydrated, `${originBase} (lspServers)`)
|
|
9423
9835
|
);
|
|
9424
9836
|
} else {
|
|
9425
|
-
|
|
9837
|
+
debugLogger15.warn(
|
|
9426
9838
|
`LSP config for ${originBase} must be an object or a JSON file path.`
|
|
9427
9839
|
);
|
|
9428
9840
|
}
|
|
@@ -9528,15 +9940,15 @@ var LspConfigLoader = class {
|
|
|
9528
9940
|
return { ok: true, configs };
|
|
9529
9941
|
}
|
|
9530
9942
|
resolveExtensionConfigPath(extensionPath, configPath) {
|
|
9531
|
-
return
|
|
9943
|
+
return path11.isAbsolute(configPath) ? path11.resolve(configPath) : path11.resolve(extensionPath, configPath);
|
|
9532
9944
|
}
|
|
9533
9945
|
hydrateExtensionLspConfig(source, extensionPath) {
|
|
9534
9946
|
return recursivelyHydrateStrings(source, {
|
|
9535
9947
|
extensionPath,
|
|
9536
9948
|
CLAUDE_PLUGIN_ROOT: extensionPath,
|
|
9537
9949
|
workspacePath: this.workspaceRoot,
|
|
9538
|
-
"/":
|
|
9539
|
-
pathSeparator:
|
|
9950
|
+
"/": path11.sep,
|
|
9951
|
+
pathSeparator: path11.sep
|
|
9540
9952
|
});
|
|
9541
9953
|
}
|
|
9542
9954
|
buildServerConfig(name, languages, spec, origin, options = {}) {
|
|
@@ -9560,13 +9972,13 @@ var LspConfigLoader = class {
|
|
|
9560
9972
|
const trustRequired = options.forceTrustRequired ? true : typeof spec["trustRequired"] === "boolean" ? spec["trustRequired"] : true;
|
|
9561
9973
|
const socket = this.normalizeSocketOptions(spec);
|
|
9562
9974
|
if (transport === "stdio" && !command) {
|
|
9563
|
-
|
|
9975
|
+
debugLogger15.warn(
|
|
9564
9976
|
`LSP config error in ${origin}: ${name} missing command`
|
|
9565
9977
|
);
|
|
9566
9978
|
return null;
|
|
9567
9979
|
}
|
|
9568
9980
|
if (transport !== "stdio" && !socket) {
|
|
9569
|
-
|
|
9981
|
+
debugLogger15.warn(
|
|
9570
9982
|
`LSP config error in ${origin}: ${name} missing socket info`
|
|
9571
9983
|
);
|
|
9572
9984
|
return null;
|
|
@@ -9703,12 +10115,12 @@ var LspConfigLoader = class {
|
|
|
9703
10115
|
if (typeof value !== "string" || value.trim() === "") {
|
|
9704
10116
|
return this.workspaceRoot;
|
|
9705
10117
|
}
|
|
9706
|
-
const resolved =
|
|
9707
|
-
const root =
|
|
9708
|
-
if (resolved === root || resolved.startsWith(root +
|
|
10118
|
+
const resolved = path11.isAbsolute(value) ? path11.resolve(value) : path11.resolve(this.workspaceRoot, value);
|
|
10119
|
+
const root = path11.resolve(this.workspaceRoot);
|
|
10120
|
+
if (resolved === root || resolved.startsWith(root + path11.sep)) {
|
|
9709
10121
|
return resolved;
|
|
9710
10122
|
}
|
|
9711
|
-
|
|
10123
|
+
debugLogger15.warn(
|
|
9712
10124
|
`LSP workspaceFolder must be within ${this.workspaceRoot}; using workspace root instead.`
|
|
9713
10125
|
);
|
|
9714
10126
|
return this.workspaceRoot;
|
|
@@ -9720,7 +10132,7 @@ init_esbuild_shims();
|
|
|
9720
10132
|
import * as cp from "node:child_process";
|
|
9721
10133
|
import * as net2 from "node:net";
|
|
9722
10134
|
import { StringDecoder } from "node:string_decoder";
|
|
9723
|
-
var
|
|
10135
|
+
var debugLogger16 = createDebugLogger("LSP");
|
|
9724
10136
|
var MAX_STDERR_TAIL_BYTES = 8192;
|
|
9725
10137
|
function trimTail(value, maxBytes) {
|
|
9726
10138
|
const buffer = Buffer.from(value, "utf8");
|
|
@@ -9785,7 +10197,7 @@ var JsonRpcConnection = class {
|
|
|
9785
10197
|
try {
|
|
9786
10198
|
this.disposer?.();
|
|
9787
10199
|
} catch (error) {
|
|
9788
|
-
|
|
10200
|
+
debugLogger16.warn("LSP disposer failed:", error);
|
|
9789
10201
|
}
|
|
9790
10202
|
}
|
|
9791
10203
|
sendRequest(method, params) {
|
|
@@ -9799,12 +10211,12 @@ var JsonRpcConnection = class {
|
|
|
9799
10211
|
method,
|
|
9800
10212
|
params
|
|
9801
10213
|
};
|
|
9802
|
-
const requestPromise = new Promise((
|
|
10214
|
+
const requestPromise = new Promise((resolve7, reject) => {
|
|
9803
10215
|
const timer = setTimeout(() => {
|
|
9804
10216
|
this.pendingRequests.delete(id);
|
|
9805
10217
|
reject(new Error(`LSP request timeout: ${method}`));
|
|
9806
10218
|
}, DEFAULT_LSP_REQUEST_TIMEOUT_MS);
|
|
9807
|
-
this.pendingRequests.set(id, { resolve:
|
|
10219
|
+
this.pendingRequests.set(id, { resolve: resolve7, reject, timer });
|
|
9808
10220
|
});
|
|
9809
10221
|
this.writeMessage(payload);
|
|
9810
10222
|
return requestPromise;
|
|
@@ -9912,7 +10324,7 @@ var JsonRpcConnection = class {
|
|
|
9912
10324
|
try {
|
|
9913
10325
|
this.writer(header + json);
|
|
9914
10326
|
} catch (error) {
|
|
9915
|
-
|
|
10327
|
+
debugLogger16.warn("LSP write failed:", error);
|
|
9916
10328
|
this.end();
|
|
9917
10329
|
}
|
|
9918
10330
|
}
|
|
@@ -9932,7 +10344,7 @@ var LspConnectionFactory = class _LspConnectionFactory {
|
|
|
9932
10344
|
* 创建基于 stdio 的 LSP 连接
|
|
9933
10345
|
*/
|
|
9934
10346
|
static async createStdioConnection(command, args, options, timeoutMs = 1e4) {
|
|
9935
|
-
return new Promise((
|
|
10347
|
+
return new Promise((resolve7, reject) => {
|
|
9936
10348
|
const spawnOptions = {
|
|
9937
10349
|
stdio: "pipe",
|
|
9938
10350
|
...options
|
|
@@ -9971,14 +10383,14 @@ var LspConnectionFactory = class _LspConnectionFactory {
|
|
|
9971
10383
|
);
|
|
9972
10384
|
});
|
|
9973
10385
|
processInstance.stderr?.on("error", (err) => {
|
|
9974
|
-
|
|
10386
|
+
debugLogger16.warn(`LSP stderr stream error for ${command}:`, err);
|
|
9975
10387
|
});
|
|
9976
10388
|
const connection = new JsonRpcConnection(
|
|
9977
10389
|
(payload) => processInstance.stdin?.write(payload),
|
|
9978
10390
|
() => processInstance.stdin?.end()
|
|
9979
10391
|
);
|
|
9980
10392
|
processInstance.stdin.on("error", (err) => {
|
|
9981
|
-
|
|
10393
|
+
debugLogger16.warn(`LSP stdin stream error for ${command}:`, err);
|
|
9982
10394
|
connection.end();
|
|
9983
10395
|
});
|
|
9984
10396
|
connection.listen(processInstance.stdout);
|
|
@@ -9991,7 +10403,7 @@ var LspConnectionFactory = class _LspConnectionFactory {
|
|
|
9991
10403
|
recordProcessExit(code, signal);
|
|
9992
10404
|
connection.end();
|
|
9993
10405
|
});
|
|
9994
|
-
|
|
10406
|
+
resolve7({
|
|
9995
10407
|
connection,
|
|
9996
10408
|
process: processInstance,
|
|
9997
10409
|
processDiagnostics
|
|
@@ -10012,7 +10424,7 @@ var LspConnectionFactory = class _LspConnectionFactory {
|
|
|
10012
10424
|
* 创建基于 socket 的 LSP 连接(支持 TCP 或 unix socket)
|
|
10013
10425
|
*/
|
|
10014
10426
|
static async createSocketConnection(options, timeoutMs = 1e4) {
|
|
10015
|
-
return new Promise((
|
|
10427
|
+
return new Promise((resolve7, reject) => {
|
|
10016
10428
|
let socketOptions;
|
|
10017
10429
|
if (options.path) {
|
|
10018
10430
|
socketOptions = { path: options.path };
|
|
@@ -10046,7 +10458,7 @@ var LspConnectionFactory = class _LspConnectionFactory {
|
|
|
10046
10458
|
connection.listen(socket);
|
|
10047
10459
|
socket.once("close", () => connection.end());
|
|
10048
10460
|
socket.once("error", () => connection.end());
|
|
10049
|
-
|
|
10461
|
+
resolve7({
|
|
10050
10462
|
connection,
|
|
10051
10463
|
socket
|
|
10052
10464
|
});
|
|
@@ -10061,7 +10473,7 @@ var LspConnectionFactory = class _LspConnectionFactory {
|
|
|
10061
10473
|
try {
|
|
10062
10474
|
await lspConnection.connection.shutdown();
|
|
10063
10475
|
} catch (e) {
|
|
10064
|
-
|
|
10476
|
+
debugLogger16.warn("LSP shutdown failed:", e);
|
|
10065
10477
|
} finally {
|
|
10066
10478
|
lspConnection.connection.end();
|
|
10067
10479
|
}
|
|
@@ -10736,10 +11148,10 @@ ${value}
|
|
|
10736
11148
|
// packages/core/src/lsp/LspServerManager.ts
|
|
10737
11149
|
init_esbuild_shims();
|
|
10738
11150
|
import { spawn as spawn2 } from "node:child_process";
|
|
10739
|
-
import * as
|
|
10740
|
-
import * as
|
|
11151
|
+
import * as fs10 from "node:fs";
|
|
11152
|
+
import * as path12 from "path";
|
|
10741
11153
|
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
10742
|
-
var
|
|
11154
|
+
var debugLogger17 = createDebugLogger("LSP");
|
|
10743
11155
|
var SECURITY_SENSITIVE_ENV_KEYS = /* @__PURE__ */ new Set([
|
|
10744
11156
|
"DYLD_INSERT_LIBRARIES",
|
|
10745
11157
|
"DYLD_LIBRARY_PATH",
|
|
@@ -10776,7 +11188,7 @@ var LspServerManager = class {
|
|
|
10776
11188
|
});
|
|
10777
11189
|
this.serverConfigHashes.set(config.name, lspServerConfigHash(config));
|
|
10778
11190
|
}
|
|
10779
|
-
|
|
11191
|
+
debugLogger17.info(
|
|
10780
11192
|
`Prepared ${configs.length} LSP server config(s): ${formatServerNames(
|
|
10781
11193
|
configs.map((config) => config.name)
|
|
10782
11194
|
)}`
|
|
@@ -10785,7 +11197,7 @@ var LspServerManager = class {
|
|
|
10785
11197
|
/** Drops all prepared handles without attempting process shutdown. */
|
|
10786
11198
|
clearServerHandles() {
|
|
10787
11199
|
if (this.serverHandles.size > 0) {
|
|
10788
|
-
|
|
11200
|
+
debugLogger17.info(
|
|
10789
11201
|
`Clearing ${this.serverHandles.size} LSP server handle(s): ${formatServerNames(
|
|
10790
11202
|
Array.from(this.serverHandles.keys())
|
|
10791
11203
|
)}`
|
|
@@ -10846,7 +11258,7 @@ var LspServerManager = class {
|
|
|
10846
11258
|
* before their handles are deleted or replaced.
|
|
10847
11259
|
*/
|
|
10848
11260
|
async doReconcileServerConfigs(configs) {
|
|
10849
|
-
|
|
11261
|
+
debugLogger17.info(
|
|
10850
11262
|
`Reconciling LSP server configs: desired=${formatServerNames(
|
|
10851
11263
|
configs.map((config) => config.name)
|
|
10852
11264
|
)}`
|
|
@@ -10918,7 +11330,7 @@ var LspServerManager = class {
|
|
|
10918
11330
|
result.added.push(name);
|
|
10919
11331
|
}
|
|
10920
11332
|
}
|
|
10921
|
-
|
|
11333
|
+
debugLogger17.info(
|
|
10922
11334
|
`LSP reconcile result: added=${formatServerNames(
|
|
10923
11335
|
result.added
|
|
10924
11336
|
)}, removed=${formatServerNames(
|
|
@@ -10953,7 +11365,7 @@ var LspServerManager = class {
|
|
|
10953
11365
|
const uri = pathToFileURL2(tsFile).toString();
|
|
10954
11366
|
const languageId = tsFile.endsWith(".tsx") ? "typescriptreact" : tsFile.endsWith(".jsx") ? "javascriptreact" : tsFile.endsWith(".js") ? "javascript" : "typescript";
|
|
10955
11367
|
try {
|
|
10956
|
-
const text =
|
|
11368
|
+
const text = fs10.readFileSync(tsFile, "utf-8");
|
|
10957
11369
|
handle.connection.send({
|
|
10958
11370
|
jsonrpc: "2.0",
|
|
10959
11371
|
method: "textDocument/didOpen",
|
|
@@ -10967,12 +11379,12 @@ var LspServerManager = class {
|
|
|
10967
11379
|
}
|
|
10968
11380
|
});
|
|
10969
11381
|
await new Promise(
|
|
10970
|
-
(
|
|
11382
|
+
(resolve7) => setTimeout(resolve7, DEFAULT_LSP_WARMUP_DELAY_MS)
|
|
10971
11383
|
);
|
|
10972
11384
|
handle.warmedUp = true;
|
|
10973
11385
|
return uri;
|
|
10974
11386
|
} catch (error) {
|
|
10975
|
-
|
|
11387
|
+
debugLogger17.warn("TypeScript server warm-up failed:", error);
|
|
10976
11388
|
return void 0;
|
|
10977
11389
|
}
|
|
10978
11390
|
}
|
|
@@ -11019,7 +11431,7 @@ var LspServerManager = class {
|
|
|
11019
11431
|
async doStartServer(name, handle) {
|
|
11020
11432
|
const workspaceTrusted = this.config.isTrustedFolder();
|
|
11021
11433
|
if ((this.requireTrustedWorkspace || handle.config.trustRequired) && !workspaceTrusted) {
|
|
11022
|
-
|
|
11434
|
+
debugLogger17.warn(
|
|
11023
11435
|
`LSP server ${name} requires trusted workspace, skipping startup`
|
|
11024
11436
|
);
|
|
11025
11437
|
handle.status = "FAILED";
|
|
@@ -11032,7 +11444,7 @@ var LspServerManager = class {
|
|
|
11032
11444
|
workspaceTrusted
|
|
11033
11445
|
);
|
|
11034
11446
|
if (!trusted) {
|
|
11035
|
-
|
|
11447
|
+
debugLogger17.warn(
|
|
11036
11448
|
`Workspace trust check failed, not starting LSP server ${name}`
|
|
11037
11449
|
);
|
|
11038
11450
|
handle.status = "FAILED";
|
|
@@ -11042,7 +11454,7 @@ var LspServerManager = class {
|
|
|
11042
11454
|
if (handle.config.command) {
|
|
11043
11455
|
const commandCwd = handle.config.workspaceFolder ?? this.workspaceRoot;
|
|
11044
11456
|
if (!this.isPathSafe(handle.config.command, this.workspaceRoot, commandCwd)) {
|
|
11045
|
-
|
|
11457
|
+
debugLogger17.warn(
|
|
11046
11458
|
`LSP server ${name} command path is unsafe: ${handle.config.command}`
|
|
11047
11459
|
);
|
|
11048
11460
|
handle.status = "FAILED";
|
|
@@ -11054,7 +11466,7 @@ var LspServerManager = class {
|
|
|
11054
11466
|
handle.config.env,
|
|
11055
11467
|
commandCwd
|
|
11056
11468
|
)) {
|
|
11057
|
-
|
|
11469
|
+
debugLogger17.warn(
|
|
11058
11470
|
`LSP server ${name} command not found: ${handle.config.command}`
|
|
11059
11471
|
);
|
|
11060
11472
|
handle.status = "FAILED";
|
|
@@ -11069,7 +11481,7 @@ var LspServerManager = class {
|
|
|
11069
11481
|
handle.processDiagnostics = void 0;
|
|
11070
11482
|
handle.warmedUp = false;
|
|
11071
11483
|
handle.status = "IN_PROGRESS";
|
|
11072
|
-
|
|
11484
|
+
debugLogger17.info(
|
|
11073
11485
|
`Starting LSP server ${name}: command=${handle.config.command ?? "<none>"}, transport=${handle.config.transport}, languages=${formatServerNames(
|
|
11074
11486
|
handle.config.languages
|
|
11075
11487
|
)}`
|
|
@@ -11094,7 +11506,7 @@ var LspServerManager = class {
|
|
|
11094
11506
|
}
|
|
11095
11507
|
handle.status = "READY";
|
|
11096
11508
|
this.attachRestartHandler(name, handle);
|
|
11097
|
-
|
|
11509
|
+
debugLogger17.info(`LSP server ${name} started successfully`);
|
|
11098
11510
|
} catch (error) {
|
|
11099
11511
|
handle.status = "FAILED";
|
|
11100
11512
|
handle.error = error;
|
|
@@ -11108,21 +11520,21 @@ var LspServerManager = class {
|
|
|
11108
11520
|
}
|
|
11109
11521
|
await this.releaseServerResources(name, handle, false);
|
|
11110
11522
|
if (handle.processDiagnostics) {
|
|
11111
|
-
|
|
11523
|
+
debugLogger17.error(
|
|
11112
11524
|
`LSP server ${name} process diagnostics:`,
|
|
11113
11525
|
handle.processDiagnostics
|
|
11114
11526
|
);
|
|
11115
11527
|
}
|
|
11116
11528
|
handle.connection = void 0;
|
|
11117
11529
|
handle.process = void 0;
|
|
11118
|
-
|
|
11530
|
+
debugLogger17.error(`LSP server ${name} failed to start:`, error);
|
|
11119
11531
|
}
|
|
11120
11532
|
}
|
|
11121
11533
|
/**
|
|
11122
11534
|
* Stops a server and resets runtime-only handle state.
|
|
11123
11535
|
*/
|
|
11124
11536
|
async stopServer(name, handle) {
|
|
11125
|
-
|
|
11537
|
+
debugLogger17.info(`Stopping LSP server ${name}`);
|
|
11126
11538
|
handle.stopRequested = true;
|
|
11127
11539
|
handle.startupAbortController?.abort();
|
|
11128
11540
|
if (handle.startingPromise) {
|
|
@@ -11135,7 +11547,7 @@ var LspServerManager = class {
|
|
|
11135
11547
|
handle.status = "NOT_STARTED";
|
|
11136
11548
|
handle.warmedUp = false;
|
|
11137
11549
|
handle.restartAttempts = 0;
|
|
11138
|
-
|
|
11550
|
+
debugLogger17.info(`LSP server ${name} stopped`);
|
|
11139
11551
|
}
|
|
11140
11552
|
async abortAndWaitForStartup(handle) {
|
|
11141
11553
|
if (!handle.startingPromise) {
|
|
@@ -11159,14 +11571,14 @@ var LspServerManager = class {
|
|
|
11159
11571
|
handle.connection.end();
|
|
11160
11572
|
}
|
|
11161
11573
|
} catch (error) {
|
|
11162
|
-
|
|
11574
|
+
debugLogger17.error(`Error closing LSP server ${name}:`, error);
|
|
11163
11575
|
}
|
|
11164
11576
|
}
|
|
11165
11577
|
if (handle.process && handle.process.exitCode === null) {
|
|
11166
11578
|
try {
|
|
11167
11579
|
handle.process.kill();
|
|
11168
11580
|
} catch (error) {
|
|
11169
|
-
|
|
11581
|
+
debugLogger17.warn(`Error killing LSP server ${name} process:`, error);
|
|
11170
11582
|
}
|
|
11171
11583
|
}
|
|
11172
11584
|
}
|
|
@@ -11186,8 +11598,8 @@ var LspServerManager = class {
|
|
|
11186
11598
|
try {
|
|
11187
11599
|
await Promise.race([
|
|
11188
11600
|
shutdownPromise,
|
|
11189
|
-
new Promise((
|
|
11190
|
-
timerId = setTimeout(
|
|
11601
|
+
new Promise((resolve7) => {
|
|
11602
|
+
timerId = setTimeout(resolve7, timeout);
|
|
11191
11603
|
if (typeof timerId === "object" && timerId !== null && "unref" in timerId) {
|
|
11192
11604
|
timerId.unref();
|
|
11193
11605
|
}
|
|
@@ -11212,7 +11624,7 @@ var LspServerManager = class {
|
|
|
11212
11624
|
}
|
|
11213
11625
|
handle.processExitedUnexpectedly = true;
|
|
11214
11626
|
if (!handle.config.restartOnCrash) {
|
|
11215
|
-
|
|
11627
|
+
debugLogger17.warn(
|
|
11216
11628
|
`LSP server ${name} exited but restartOnCrash is disabled`
|
|
11217
11629
|
);
|
|
11218
11630
|
handle.status = "FAILED";
|
|
@@ -11221,7 +11633,7 @@ var LspServerManager = class {
|
|
|
11221
11633
|
}
|
|
11222
11634
|
const maxRestarts = handle.config.maxRestarts ?? DEFAULT_LSP_MAX_RESTARTS;
|
|
11223
11635
|
if (maxRestarts <= 0) {
|
|
11224
|
-
|
|
11636
|
+
debugLogger17.warn(
|
|
11225
11637
|
`LSP server ${name} exited but maxRestarts is ${maxRestarts}`
|
|
11226
11638
|
);
|
|
11227
11639
|
handle.status = "FAILED";
|
|
@@ -11230,7 +11642,7 @@ var LspServerManager = class {
|
|
|
11230
11642
|
}
|
|
11231
11643
|
const attempts = handle.restartAttempts ?? 0;
|
|
11232
11644
|
if (attempts >= maxRestarts) {
|
|
11233
|
-
|
|
11645
|
+
debugLogger17.warn(
|
|
11234
11646
|
`LSP server ${name} reached max restart attempts (${maxRestarts}), stopping restarts`
|
|
11235
11647
|
);
|
|
11236
11648
|
handle.status = "FAILED";
|
|
@@ -11238,7 +11650,7 @@ var LspServerManager = class {
|
|
|
11238
11650
|
return;
|
|
11239
11651
|
}
|
|
11240
11652
|
handle.restartAttempts = attempts + 1;
|
|
11241
|
-
|
|
11653
|
+
debugLogger17.warn(
|
|
11242
11654
|
`LSP server ${name} exited (code ${code ?? "unknown"}), restarting (${handle.restartAttempts}/${maxRestarts})`
|
|
11243
11655
|
);
|
|
11244
11656
|
this.enqueueCrashRestart(name, handle);
|
|
@@ -11286,7 +11698,7 @@ var LspServerManager = class {
|
|
|
11286
11698
|
const next = this.reconcileQueue.then(restart, restart);
|
|
11287
11699
|
this.reconcileQueue = next.catch(() => void 0);
|
|
11288
11700
|
void next.catch((error) => {
|
|
11289
|
-
|
|
11701
|
+
debugLogger17.warn(`LSP server ${name} crash restart failed:`, error);
|
|
11290
11702
|
});
|
|
11291
11703
|
}
|
|
11292
11704
|
resetHandle(handle) {
|
|
@@ -11294,14 +11706,14 @@ var LspServerManager = class {
|
|
|
11294
11706
|
try {
|
|
11295
11707
|
handle.connection.end();
|
|
11296
11708
|
} catch (error) {
|
|
11297
|
-
|
|
11709
|
+
debugLogger17.warn("Error closing LSP connection during reset:", error);
|
|
11298
11710
|
}
|
|
11299
11711
|
}
|
|
11300
11712
|
if (handle.process && handle.process.exitCode === null) {
|
|
11301
11713
|
try {
|
|
11302
11714
|
handle.process.kill();
|
|
11303
11715
|
} catch (error) {
|
|
11304
|
-
|
|
11716
|
+
debugLogger17.warn("Error killing LSP process during reset:", error);
|
|
11305
11717
|
}
|
|
11306
11718
|
}
|
|
11307
11719
|
handle.connection = void 0;
|
|
@@ -11320,7 +11732,7 @@ var LspServerManager = class {
|
|
|
11320
11732
|
const filteredEnv = {};
|
|
11321
11733
|
for (const [key, value] of Object.entries(env2)) {
|
|
11322
11734
|
if (SECURITY_SENSITIVE_ENV_KEYS.has(key.toUpperCase())) {
|
|
11323
|
-
|
|
11735
|
+
debugLogger17.warn(
|
|
11324
11736
|
`Ignoring security-sensitive LSP server env override: ${key}`
|
|
11325
11737
|
);
|
|
11326
11738
|
continue;
|
|
@@ -11346,7 +11758,7 @@ var LspServerManager = class {
|
|
|
11346
11758
|
for (const [key, value] of Object.entries(env2)) {
|
|
11347
11759
|
const normalizedKey = key.toUpperCase();
|
|
11348
11760
|
if (normalizedKey === "PATH" || SECURITY_SENSITIVE_ENV_KEYS.has(normalizedKey)) {
|
|
11349
|
-
|
|
11761
|
+
debugLogger17.warn(
|
|
11350
11762
|
`Ignoring security-sensitive LSP command probe env override: ${key}`
|
|
11351
11763
|
);
|
|
11352
11764
|
continue;
|
|
@@ -11390,11 +11802,11 @@ var LspServerManager = class {
|
|
|
11390
11802
|
}
|
|
11391
11803
|
async delayWithAbort(delayMs, signal) {
|
|
11392
11804
|
if (!signal) {
|
|
11393
|
-
await new Promise((
|
|
11805
|
+
await new Promise((resolve7) => setTimeout(resolve7, delayMs));
|
|
11394
11806
|
return;
|
|
11395
11807
|
}
|
|
11396
11808
|
this.throwIfStartupAborted(signal);
|
|
11397
|
-
await new Promise((
|
|
11809
|
+
await new Promise((resolve7, reject) => {
|
|
11398
11810
|
const onAbort = /* @__PURE__ */ __name(() => {
|
|
11399
11811
|
clearTimeout(timerId);
|
|
11400
11812
|
signal.removeEventListener("abort", onAbort);
|
|
@@ -11402,7 +11814,7 @@ var LspServerManager = class {
|
|
|
11402
11814
|
}, "onAbort");
|
|
11403
11815
|
const timerId = setTimeout(() => {
|
|
11404
11816
|
signal.removeEventListener("abort", onAbort);
|
|
11405
|
-
|
|
11817
|
+
resolve7();
|
|
11406
11818
|
}, delayMs);
|
|
11407
11819
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
11408
11820
|
});
|
|
@@ -11571,7 +11983,7 @@ var LspServerManager = class {
|
|
|
11571
11983
|
*/
|
|
11572
11984
|
async waitForSocketProcessSpawn(process3, signal) {
|
|
11573
11985
|
this.throwIfStartupAborted(signal);
|
|
11574
|
-
await new Promise((
|
|
11986
|
+
await new Promise((resolve7, reject) => {
|
|
11575
11987
|
let settled = false;
|
|
11576
11988
|
const cleanup = /* @__PURE__ */ __name(() => {
|
|
11577
11989
|
process3.off("spawn", onSpawn);
|
|
@@ -11586,7 +11998,7 @@ var LspServerManager = class {
|
|
|
11586
11998
|
cleanup();
|
|
11587
11999
|
complete();
|
|
11588
12000
|
}, "settle");
|
|
11589
|
-
const onSpawn = /* @__PURE__ */ __name(() => settle(
|
|
12001
|
+
const onSpawn = /* @__PURE__ */ __name(() => settle(resolve7), "onSpawn");
|
|
11590
12002
|
const onError = /* @__PURE__ */ __name((error) => settle(
|
|
11591
12003
|
() => reject(new Error(`Failed to spawn LSP server: ${error.message}`))
|
|
11592
12004
|
), "onError");
|
|
@@ -11595,7 +12007,7 @@ var LspServerManager = class {
|
|
|
11595
12007
|
try {
|
|
11596
12008
|
process3.kill();
|
|
11597
12009
|
} catch (error) {
|
|
11598
|
-
|
|
12010
|
+
debugLogger17.warn(
|
|
11599
12011
|
"Error killing aborted LSP socket process:",
|
|
11600
12012
|
error
|
|
11601
12013
|
);
|
|
@@ -11640,7 +12052,7 @@ var LspServerManager = class {
|
|
|
11640
12052
|
async initializeLspServer(connection, config) {
|
|
11641
12053
|
const workspaceFolderPath = config.workspaceFolder ?? this.workspaceRoot;
|
|
11642
12054
|
const workspaceFolder = {
|
|
11643
|
-
name:
|
|
12055
|
+
name: path12.basename(workspaceFolderPath) || workspaceFolderPath,
|
|
11644
12056
|
uri: config.rootUri
|
|
11645
12057
|
};
|
|
11646
12058
|
const initializeParams = {
|
|
@@ -11702,7 +12114,7 @@ var LspServerManager = class {
|
|
|
11702
12114
|
* @returns true if the command can be spawned, false if not found
|
|
11703
12115
|
*/
|
|
11704
12116
|
async commandExists(command, env2, cwd) {
|
|
11705
|
-
return new Promise((
|
|
12117
|
+
return new Promise((resolve7) => {
|
|
11706
12118
|
let settled = false;
|
|
11707
12119
|
const settle = /* @__PURE__ */ __name((value) => {
|
|
11708
12120
|
if (settled) {
|
|
@@ -11710,7 +12122,7 @@ var LspServerManager = class {
|
|
|
11710
12122
|
}
|
|
11711
12123
|
settled = true;
|
|
11712
12124
|
clearTimeout(timerId);
|
|
11713
|
-
|
|
12125
|
+
resolve7(value);
|
|
11714
12126
|
}, "settle");
|
|
11715
12127
|
const child = spawn2(command, ["--version"], {
|
|
11716
12128
|
stdio: ["ignore", "ignore", "ignore"],
|
|
@@ -11745,16 +12157,16 @@ var LspServerManager = class {
|
|
|
11745
12157
|
* - Relative paths that escape the workspace (e.g. "../../bin/evil")
|
|
11746
12158
|
*/
|
|
11747
12159
|
isPathSafe(command, workspacePath, cwd) {
|
|
11748
|
-
if (!command.includes(
|
|
12160
|
+
if (!command.includes(path12.sep) && !command.includes("/")) {
|
|
11749
12161
|
return true;
|
|
11750
12162
|
}
|
|
11751
|
-
if (
|
|
12163
|
+
if (path12.isAbsolute(command)) {
|
|
11752
12164
|
return true;
|
|
11753
12165
|
}
|
|
11754
|
-
const resolvedWorkspacePath =
|
|
11755
|
-
const basePath = cwd ?
|
|
11756
|
-
const resolvedPath =
|
|
11757
|
-
return resolvedPath.startsWith(resolvedWorkspacePath +
|
|
12166
|
+
const resolvedWorkspacePath = path12.resolve(workspacePath);
|
|
12167
|
+
const basePath = cwd ? path12.resolve(cwd) : resolvedWorkspacePath;
|
|
12168
|
+
const resolvedPath = path12.resolve(basePath, command);
|
|
12169
|
+
return resolvedPath.startsWith(resolvedWorkspacePath + path12.sep) || resolvedPath === resolvedWorkspacePath;
|
|
11758
12170
|
}
|
|
11759
12171
|
/**
|
|
11760
12172
|
* Check whether the workspace trust level allows starting an LSP server.
|
|
@@ -11768,12 +12180,12 @@ var LspServerManager = class {
|
|
|
11768
12180
|
return true;
|
|
11769
12181
|
}
|
|
11770
12182
|
if (this.requireTrustedWorkspace || serverConfig.trustRequired) {
|
|
11771
|
-
|
|
12183
|
+
debugLogger17.warn(
|
|
11772
12184
|
`Workspace not trusted, skipping LSP server ${serverName} (${serverConfig.command ?? serverConfig.transport})`
|
|
11773
12185
|
);
|
|
11774
12186
|
return false;
|
|
11775
12187
|
}
|
|
11776
|
-
|
|
12188
|
+
debugLogger17.info(
|
|
11777
12189
|
`Untrusted workspace, but LSP server ${serverName} has trustRequired=false, attempting cautious startup`
|
|
11778
12190
|
);
|
|
11779
12191
|
return true;
|
|
@@ -12014,11 +12426,11 @@ var NativeLspClient = class {
|
|
|
12014
12426
|
|
|
12015
12427
|
// packages/core/src/lsp/NativeLspService.ts
|
|
12016
12428
|
init_esbuild_shims();
|
|
12017
|
-
import * as
|
|
12429
|
+
import * as path13 from "path";
|
|
12018
12430
|
import { fileURLToPath, pathToFileURL as pathToFileURL3 } from "url";
|
|
12019
|
-
import * as
|
|
12431
|
+
import * as fs11 from "node:fs";
|
|
12020
12432
|
import { promises as fsp } from "node:fs";
|
|
12021
|
-
var
|
|
12433
|
+
var debugLogger18 = createDebugLogger("LSP");
|
|
12022
12434
|
var LANGUAGE_ID_TO_EXTENSIONS = {
|
|
12023
12435
|
typescript: ["ts", "tsx"],
|
|
12024
12436
|
typescriptreact: ["tsx"],
|
|
@@ -12076,7 +12488,7 @@ var NativeLspService = class {
|
|
|
12076
12488
|
const workspaceTrusted = this.config.isTrustedFolder();
|
|
12077
12489
|
this.serverManager.clearServerHandles();
|
|
12078
12490
|
if (this.requireTrustedWorkspace && !workspaceTrusted) {
|
|
12079
|
-
|
|
12491
|
+
debugLogger18.warn(
|
|
12080
12492
|
"Workspace is not trusted, skipping LSP server discovery"
|
|
12081
12493
|
);
|
|
12082
12494
|
return;
|
|
@@ -12094,7 +12506,7 @@ var NativeLspService = class {
|
|
|
12094
12506
|
serverConfigs,
|
|
12095
12507
|
workspaceTrusted
|
|
12096
12508
|
);
|
|
12097
|
-
|
|
12509
|
+
debugLogger18.info(
|
|
12098
12510
|
`Discovered ${admitted.length} LSP server config(s): ${formatServerNames2(
|
|
12099
12511
|
admitted.map((config) => config.name)
|
|
12100
12512
|
)}, skipped=${formatServerNames2(skipped.map((server) => server.name))}`
|
|
@@ -12129,7 +12541,7 @@ var NativeLspService = class {
|
|
|
12129
12541
|
async doReinitialize(signal) {
|
|
12130
12542
|
this.throwIfReinitializeAborted(signal);
|
|
12131
12543
|
const workspaceTrusted = this.config.isTrustedFolder();
|
|
12132
|
-
|
|
12544
|
+
debugLogger18.info(
|
|
12133
12545
|
`Reinitializing LSP servers: workspaceRoot=${this.workspaceRoot}, trusted=${workspaceTrusted}`
|
|
12134
12546
|
);
|
|
12135
12547
|
if (this.requireTrustedWorkspace && !workspaceTrusted) {
|
|
@@ -12148,7 +12560,7 @@ var NativeLspService = class {
|
|
|
12148
12560
|
},
|
|
12149
12561
|
skipped: []
|
|
12150
12562
|
};
|
|
12151
|
-
|
|
12563
|
+
debugLogger18.info(
|
|
12152
12564
|
`LSP reinitialize result: added=<none>, removed=${formatServerNames2(
|
|
12153
12565
|
removed
|
|
12154
12566
|
)}, restarted=<none>, unchanged=<none>, failed=<none>, skipped=<none>`
|
|
@@ -12190,7 +12602,7 @@ var NativeLspService = class {
|
|
|
12190
12602
|
signal
|
|
12191
12603
|
);
|
|
12192
12604
|
this.throwIfReinitializeAborted(signal);
|
|
12193
|
-
|
|
12605
|
+
debugLogger18.info(
|
|
12194
12606
|
`LSP reinitialize result: added=${formatServerNames2(
|
|
12195
12607
|
reconcile.added
|
|
12196
12608
|
)}, removed=${formatServerNames2(
|
|
@@ -12210,7 +12622,7 @@ var NativeLspService = class {
|
|
|
12210
12622
|
const skipped = [];
|
|
12211
12623
|
for (const config of configs) {
|
|
12212
12624
|
if (!workspaceTrusted && config.trustRequired) {
|
|
12213
|
-
|
|
12625
|
+
debugLogger18.warn(
|
|
12214
12626
|
`LSP server ${config.name} requires trusted workspace, skipping`
|
|
12215
12627
|
);
|
|
12216
12628
|
skipped.push({ name: config.name, reason: "server_trust_required" });
|
|
@@ -12255,7 +12667,7 @@ var NativeLspService = class {
|
|
|
12255
12667
|
try {
|
|
12256
12668
|
openedAny = this.sendDocumentOpen(name, handle, uri) || openedAny;
|
|
12257
12669
|
} catch (error) {
|
|
12258
|
-
|
|
12670
|
+
debugLogger18.warn(
|
|
12259
12671
|
`Failed to replay document ${uri} for LSP server ${name}:`,
|
|
12260
12672
|
error
|
|
12261
12673
|
);
|
|
@@ -12384,14 +12796,14 @@ var NativeLspService = class {
|
|
|
12384
12796
|
try {
|
|
12385
12797
|
filePath = fileURLToPath(uri);
|
|
12386
12798
|
} catch (error) {
|
|
12387
|
-
|
|
12799
|
+
debugLogger18.warn(`Failed to resolve file path for ${uri}:`, error);
|
|
12388
12800
|
return false;
|
|
12389
12801
|
}
|
|
12390
12802
|
let text;
|
|
12391
12803
|
try {
|
|
12392
|
-
text =
|
|
12804
|
+
text = fs11.readFileSync(filePath, "utf-8");
|
|
12393
12805
|
} catch (error) {
|
|
12394
|
-
|
|
12806
|
+
debugLogger18.warn(
|
|
12395
12807
|
`Failed to read file for LSP didOpen: ${filePath}`,
|
|
12396
12808
|
error
|
|
12397
12809
|
);
|
|
@@ -12429,7 +12841,7 @@ var NativeLspService = class {
|
|
|
12429
12841
|
this.openedDocuments.set(serverName, openedForServer);
|
|
12430
12842
|
}
|
|
12431
12843
|
resolveLanguageId(filePath, handle) {
|
|
12432
|
-
const ext =
|
|
12844
|
+
const ext = path13.extname(filePath).slice(1).toLowerCase();
|
|
12433
12845
|
if (ext && handle.config.extensionToLanguage) {
|
|
12434
12846
|
const mapping = handle.config.extensionToLanguage;
|
|
12435
12847
|
return mapping[ext] ?? mapping["." + ext];
|
|
@@ -12557,11 +12969,11 @@ var NativeLspService = class {
|
|
|
12557
12969
|
}
|
|
12558
12970
|
async delay(ms, signal) {
|
|
12559
12971
|
if (!signal) {
|
|
12560
|
-
await new Promise((
|
|
12972
|
+
await new Promise((resolve7) => setTimeout(resolve7, ms));
|
|
12561
12973
|
return;
|
|
12562
12974
|
}
|
|
12563
12975
|
this.throwIfReinitializeAborted(signal);
|
|
12564
|
-
await new Promise((
|
|
12976
|
+
await new Promise((resolve7, reject) => {
|
|
12565
12977
|
const onAbort = /* @__PURE__ */ __name(() => {
|
|
12566
12978
|
clearTimeout(timer);
|
|
12567
12979
|
signal.removeEventListener("abort", onAbort);
|
|
@@ -12569,7 +12981,7 @@ var NativeLspService = class {
|
|
|
12569
12981
|
}, "onAbort");
|
|
12570
12982
|
const timer = setTimeout(() => {
|
|
12571
12983
|
signal.removeEventListener("abort", onAbort);
|
|
12572
|
-
|
|
12984
|
+
resolve7();
|
|
12573
12985
|
}, ms);
|
|
12574
12986
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
12575
12987
|
});
|
|
@@ -12619,7 +13031,7 @@ var NativeLspService = class {
|
|
|
12619
13031
|
}
|
|
12620
13032
|
}
|
|
12621
13033
|
} catch (error) {
|
|
12622
|
-
|
|
13034
|
+
debugLogger18.warn(
|
|
12623
13035
|
`LSP workspace/symbol failed for ${serverName}:`,
|
|
12624
13036
|
error
|
|
12625
13037
|
);
|
|
@@ -12670,7 +13082,7 @@ var NativeLspService = class {
|
|
|
12670
13082
|
return definitions.slice(0, limit);
|
|
12671
13083
|
}
|
|
12672
13084
|
} catch (error) {
|
|
12673
|
-
|
|
13085
|
+
debugLogger18.warn(
|
|
12674
13086
|
`LSP textDocument/definition failed for ${name}:`,
|
|
12675
13087
|
error
|
|
12676
13088
|
);
|
|
@@ -12724,7 +13136,7 @@ var NativeLspService = class {
|
|
|
12724
13136
|
return refs.slice(0, limit);
|
|
12725
13137
|
}
|
|
12726
13138
|
} catch (error) {
|
|
12727
|
-
|
|
13139
|
+
debugLogger18.warn(
|
|
12728
13140
|
`LSP textDocument/references failed for ${name}:`,
|
|
12729
13141
|
error
|
|
12730
13142
|
);
|
|
@@ -12765,7 +13177,7 @@ var NativeLspService = class {
|
|
|
12765
13177
|
return normalized2;
|
|
12766
13178
|
}
|
|
12767
13179
|
} catch (error) {
|
|
12768
|
-
|
|
13180
|
+
debugLogger18.warn(`LSP textDocument/hover failed for ${name}:`, error);
|
|
12769
13181
|
}
|
|
12770
13182
|
}
|
|
12771
13183
|
return null;
|
|
@@ -12825,7 +13237,7 @@ var NativeLspService = class {
|
|
|
12825
13237
|
return symbols.slice(0, limit);
|
|
12826
13238
|
}
|
|
12827
13239
|
} catch (error) {
|
|
12828
|
-
|
|
13240
|
+
debugLogger18.warn(
|
|
12829
13241
|
`LSP textDocument/documentSymbol failed for ${name}:`,
|
|
12830
13242
|
error
|
|
12831
13243
|
);
|
|
@@ -12879,7 +13291,7 @@ var NativeLspService = class {
|
|
|
12879
13291
|
return implementations.slice(0, limit);
|
|
12880
13292
|
}
|
|
12881
13293
|
} catch (error) {
|
|
12882
|
-
|
|
13294
|
+
debugLogger18.warn(
|
|
12883
13295
|
`LSP textDocument/implementation failed for ${name}:`,
|
|
12884
13296
|
error
|
|
12885
13297
|
);
|
|
@@ -12933,7 +13345,7 @@ var NativeLspService = class {
|
|
|
12933
13345
|
return items.slice(0, limit);
|
|
12934
13346
|
}
|
|
12935
13347
|
} catch (error) {
|
|
12936
|
-
|
|
13348
|
+
debugLogger18.warn(
|
|
12937
13349
|
`LSP textDocument/prepareCallHierarchy failed for ${name}:`,
|
|
12938
13350
|
error
|
|
12939
13351
|
);
|
|
@@ -12973,7 +13385,7 @@ var NativeLspService = class {
|
|
|
12973
13385
|
return calls.slice(0, limit);
|
|
12974
13386
|
}
|
|
12975
13387
|
} catch (error) {
|
|
12976
|
-
|
|
13388
|
+
debugLogger18.warn(
|
|
12977
13389
|
`LSP callHierarchy/incomingCalls failed for ${name}:`,
|
|
12978
13390
|
error
|
|
12979
13391
|
);
|
|
@@ -13013,7 +13425,7 @@ var NativeLspService = class {
|
|
|
13013
13425
|
return calls.slice(0, limit);
|
|
13014
13426
|
}
|
|
13015
13427
|
} catch (error) {
|
|
13016
|
-
|
|
13428
|
+
debugLogger18.warn(
|
|
13017
13429
|
`LSP callHierarchy/outgoingCalls failed for ${name}:`,
|
|
13018
13430
|
error
|
|
13019
13431
|
);
|
|
@@ -13053,7 +13465,7 @@ var NativeLspService = class {
|
|
|
13053
13465
|
}
|
|
13054
13466
|
}
|
|
13055
13467
|
} catch (error) {
|
|
13056
|
-
|
|
13468
|
+
debugLogger18.warn(
|
|
13057
13469
|
`LSP textDocument/diagnostic failed for ${name}:`,
|
|
13058
13470
|
error
|
|
13059
13471
|
);
|
|
@@ -13095,7 +13507,7 @@ var NativeLspService = class {
|
|
|
13095
13507
|
}
|
|
13096
13508
|
}
|
|
13097
13509
|
} catch (error) {
|
|
13098
|
-
|
|
13510
|
+
debugLogger18.warn(`LSP workspace/diagnostic failed for ${name}:`, error);
|
|
13099
13511
|
}
|
|
13100
13512
|
if (results.length >= limit) {
|
|
13101
13513
|
break;
|
|
@@ -13145,7 +13557,7 @@ var NativeLspService = class {
|
|
|
13145
13557
|
return actions.slice(0, limit);
|
|
13146
13558
|
}
|
|
13147
13559
|
} catch (error) {
|
|
13148
|
-
|
|
13560
|
+
debugLogger18.warn(
|
|
13149
13561
|
`LSP textDocument/codeAction failed for ${name}:`,
|
|
13150
13562
|
error
|
|
13151
13563
|
);
|
|
@@ -13173,7 +13585,7 @@ var NativeLspService = class {
|
|
|
13173
13585
|
}
|
|
13174
13586
|
return true;
|
|
13175
13587
|
} catch (error) {
|
|
13176
|
-
|
|
13588
|
+
debugLogger18.error("Failed to apply workspace edit:", error);
|
|
13177
13589
|
return false;
|
|
13178
13590
|
}
|
|
13179
13591
|
}
|
|
@@ -13182,8 +13594,8 @@ var NativeLspService = class {
|
|
|
13182
13594
|
*/
|
|
13183
13595
|
async applyTextEdits(uri, edits) {
|
|
13184
13596
|
let filePath = uri.startsWith("file://") ? fileURLToPath(uri) : uri;
|
|
13185
|
-
if (!
|
|
13186
|
-
filePath =
|
|
13597
|
+
if (!path13.isAbsolute(filePath)) {
|
|
13598
|
+
filePath = path13.resolve(this.workspaceRoot, filePath);
|
|
13187
13599
|
}
|
|
13188
13600
|
if (!this.workspaceContext.isPathWithinWorkspace(filePath)) {
|
|
13189
13601
|
throw new Error(`Refusing to apply edits outside workspace: ${filePath}`);
|
|
@@ -13218,7 +13630,7 @@ var NativeLspService = class {
|
|
|
13218
13630
|
lines.splice(startLine, endLine - startLine + 1, ...newLines);
|
|
13219
13631
|
}
|
|
13220
13632
|
try {
|
|
13221
|
-
await fsp.access(filePath,
|
|
13633
|
+
await fsp.access(filePath, fs11.constants.W_OK);
|
|
13222
13634
|
} catch (err) {
|
|
13223
13635
|
if (err?.code !== "ENOENT") {
|
|
13224
13636
|
throw err;
|
|
@@ -13436,7 +13848,7 @@ __name(createFollowupController, "createFollowupController");
|
|
|
13436
13848
|
|
|
13437
13849
|
// packages/core/src/followup/suggestionGenerator.ts
|
|
13438
13850
|
init_esbuild_shims();
|
|
13439
|
-
var
|
|
13851
|
+
var debugLogger19 = createDebugLogger("FOLLOWUP");
|
|
13440
13852
|
var SUGGESTION_PROMPT = `[SUGGESTION MODE: Suggest what the user might naturally type next.]
|
|
13441
13853
|
|
|
13442
13854
|
FIRST: Read the LAST FEW LINES of the assistant's most recent message -- that's where
|
|
@@ -13498,7 +13910,7 @@ async function generatePromptSuggestion(config, conversationHistory, abortSignal
|
|
|
13498
13910
|
const cacheSafe = options?.enableCacheSharing ? getCacheSafeParams(sessionId) : null;
|
|
13499
13911
|
const modelOverride = options?.model;
|
|
13500
13912
|
const cacheSharingState = cacheSafe ? "true" : cacheSafeSessionId ? "session_mismatch" : "false";
|
|
13501
|
-
|
|
13913
|
+
debugLogger19.debug(
|
|
13502
13914
|
`Generating suggestion: cacheSharing=${cacheSharingState}, model=${modelOverride || "(default)"}`
|
|
13503
13915
|
);
|
|
13504
13916
|
const raw = cacheSafe ? await generateViaForkedQuery(
|
|
@@ -13514,23 +13926,23 @@ async function generatePromptSuggestion(config, conversationHistory, abortSignal
|
|
|
13514
13926
|
);
|
|
13515
13927
|
const suggestion = typeof raw === "string" ? raw.trim() : null;
|
|
13516
13928
|
if (!suggestion) {
|
|
13517
|
-
|
|
13929
|
+
debugLogger19.debug("Suggestion generation returned empty result");
|
|
13518
13930
|
return { suggestion: null, filterReason: "empty" };
|
|
13519
13931
|
}
|
|
13520
13932
|
const filterReason = getFilterReason(suggestion);
|
|
13521
13933
|
if (filterReason) {
|
|
13522
|
-
|
|
13934
|
+
debugLogger19.debug(
|
|
13523
13935
|
`Suggestion filtered: reason=${filterReason}, text="${suggestion}"`
|
|
13524
13936
|
);
|
|
13525
13937
|
return { suggestion: null, filterReason };
|
|
13526
13938
|
}
|
|
13527
|
-
|
|
13939
|
+
debugLogger19.debug(`Suggestion accepted: "${suggestion}"`);
|
|
13528
13940
|
return { suggestion };
|
|
13529
13941
|
} catch (error) {
|
|
13530
13942
|
if (abortSignal.aborted) {
|
|
13531
13943
|
return { suggestion: null };
|
|
13532
13944
|
}
|
|
13533
|
-
|
|
13945
|
+
debugLogger19.warn("Suggestion generation failed:", error);
|
|
13534
13946
|
return { suggestion: null, filterReason: "error" };
|
|
13535
13947
|
}
|
|
13536
13948
|
}
|
|
@@ -13682,9 +14094,9 @@ __name(getFilterReason, "getFilterReason");
|
|
|
13682
14094
|
|
|
13683
14095
|
// packages/core/src/followup/overlayFs.ts
|
|
13684
14096
|
init_esbuild_shims();
|
|
13685
|
-
import { mkdir as
|
|
14097
|
+
import { mkdir as mkdir4, copyFile, rm } from "node:fs/promises";
|
|
13686
14098
|
import { existsSync as existsSync3 } from "node:fs";
|
|
13687
|
-
import { join as
|
|
14099
|
+
import { join as join10, dirname as dirname6, relative, isAbsolute as isAbsolute5 } from "node:path";
|
|
13688
14100
|
import { tmpdir } from "node:os";
|
|
13689
14101
|
import { randomUUID } from "node:crypto";
|
|
13690
14102
|
var OverlayFs = class {
|
|
@@ -13692,7 +14104,7 @@ var OverlayFs = class {
|
|
|
13692
14104
|
constructor(realCwd) {
|
|
13693
14105
|
this.realCwd = realCwd;
|
|
13694
14106
|
const id = randomUUID().slice(0, 8);
|
|
13695
|
-
this.overlayDir =
|
|
14107
|
+
this.overlayDir = join10(
|
|
13696
14108
|
tmpdir(),
|
|
13697
14109
|
"qwen-speculation",
|
|
13698
14110
|
String(process.pid),
|
|
@@ -13731,9 +14143,9 @@ var OverlayFs = class {
|
|
|
13731
14143
|
if (this.writtenFiles.has(rel)) {
|
|
13732
14144
|
return this.writtenFiles.get(rel);
|
|
13733
14145
|
}
|
|
13734
|
-
const overlayPath =
|
|
13735
|
-
await
|
|
13736
|
-
const originalPath =
|
|
14146
|
+
const overlayPath = join10(this.overlayDir, rel);
|
|
14147
|
+
await mkdir4(dirname6(overlayPath), { recursive: true });
|
|
14148
|
+
const originalPath = join10(this.realCwd, rel);
|
|
13737
14149
|
if (existsSync3(originalPath)) {
|
|
13738
14150
|
try {
|
|
13739
14151
|
await copyFile(originalPath, overlayPath);
|
|
@@ -13756,9 +14168,9 @@ var OverlayFs = class {
|
|
|
13756
14168
|
async applyToReal() {
|
|
13757
14169
|
const applied = [];
|
|
13758
14170
|
for (const [rel, overlayPath] of this.writtenFiles) {
|
|
13759
|
-
const realPath =
|
|
14171
|
+
const realPath = join10(this.realCwd, rel);
|
|
13760
14172
|
try {
|
|
13761
|
-
await
|
|
14173
|
+
await mkdir4(dirname6(realPath), { recursive: true });
|
|
13762
14174
|
await copyFile(overlayPath, realPath);
|
|
13763
14175
|
applied.push(realPath);
|
|
13764
14176
|
} catch {
|
|
@@ -13780,7 +14192,7 @@ var OverlayFs = class {
|
|
|
13780
14192
|
* Returns null if the path is outside cwd.
|
|
13781
14193
|
*/
|
|
13782
14194
|
toRelative(inputPath) {
|
|
13783
|
-
const abs = isAbsolute5(inputPath) ? inputPath :
|
|
14195
|
+
const abs = isAbsolute5(inputPath) ? inputPath : join10(this.realCwd, inputPath);
|
|
13784
14196
|
const rel = relative(this.realCwd, abs);
|
|
13785
14197
|
if (isAbsolute5(rel) || rel.startsWith("..")) {
|
|
13786
14198
|
return null;
|
|
@@ -13869,7 +14281,7 @@ __name(rewritePathArgs, "rewritePathArgs");
|
|
|
13869
14281
|
|
|
13870
14282
|
// packages/core/src/followup/speculation.ts
|
|
13871
14283
|
init_esbuild_shims();
|
|
13872
|
-
var
|
|
14284
|
+
var debugLogger20 = createDebugLogger("SPECULATION");
|
|
13873
14285
|
var MAX_SPECULATION_TURNS = 20;
|
|
13874
14286
|
var MAX_SPECULATION_MESSAGES = 100;
|
|
13875
14287
|
function observeSpeculationProducer(params) {
|
|
@@ -14117,7 +14529,7 @@ async function runSpeculativeLoop(config, state, cacheSafe, modelOverride) {
|
|
|
14117
14529
|
break;
|
|
14118
14530
|
}
|
|
14119
14531
|
if (!guardDecision.allowed) {
|
|
14120
|
-
|
|
14532
|
+
debugLogger20.debug(
|
|
14121
14533
|
`Speculative guard denial: ${guardDecision.reason}`
|
|
14122
14534
|
);
|
|
14123
14535
|
hitBoundary = true;
|
|
@@ -14355,20 +14767,20 @@ __name(generatePipelinedSuggestion, "generatePipelinedSuggestion");
|
|
|
14355
14767
|
// packages/core/src/utils/filesearch/fileSearch.ts
|
|
14356
14768
|
init_esbuild_shims();
|
|
14357
14769
|
var import_picomatch3 = __toESM(require_picomatch(), 1);
|
|
14358
|
-
import
|
|
14770
|
+
import path17 from "node:path";
|
|
14359
14771
|
|
|
14360
14772
|
// packages/core/src/utils/filesearch/ignore.ts
|
|
14361
14773
|
init_esbuild_shims();
|
|
14362
14774
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
14363
14775
|
var import_picomatch = __toESM(require_picomatch(), 1);
|
|
14364
|
-
import
|
|
14365
|
-
import
|
|
14776
|
+
import fs12 from "node:fs";
|
|
14777
|
+
import path14 from "node:path";
|
|
14366
14778
|
var hasFileExtension = (0, import_picomatch.default)("**/*[*.]*");
|
|
14367
|
-
var
|
|
14779
|
+
var debugLogger21 = createDebugLogger("FILE_SEARCH_IGNORE");
|
|
14368
14780
|
function loadIgnoreRules(options) {
|
|
14369
14781
|
const ignorer = new Ignore();
|
|
14370
14782
|
if (options.useGitignore) {
|
|
14371
|
-
const gitignorePath =
|
|
14783
|
+
const gitignorePath = path14.join(options.projectRoot, ".gitignore");
|
|
14372
14784
|
const gitignoreContent = readIgnoreFile(gitignorePath);
|
|
14373
14785
|
if (gitignoreContent !== void 0) {
|
|
14374
14786
|
ignorer.add(gitignoreContent);
|
|
@@ -14378,7 +14790,7 @@ function loadIgnoreRules(options) {
|
|
|
14378
14790
|
for (const ignoreFileName of getQwenIgnoreFileNames(
|
|
14379
14791
|
options.customIgnoreFiles
|
|
14380
14792
|
)) {
|
|
14381
|
-
const qwenignorePath =
|
|
14793
|
+
const qwenignorePath = path14.join(options.projectRoot, ignoreFileName);
|
|
14382
14794
|
const qwenignoreContent = readIgnoreFile(qwenignorePath);
|
|
14383
14795
|
if (qwenignoreContent !== void 0) {
|
|
14384
14796
|
ignorer.addSource(qwenignoreContent);
|
|
@@ -14399,11 +14811,11 @@ function loadIgnoreRules(options) {
|
|
|
14399
14811
|
__name(loadIgnoreRules, "loadIgnoreRules");
|
|
14400
14812
|
function readIgnoreFile(filePath) {
|
|
14401
14813
|
try {
|
|
14402
|
-
return
|
|
14814
|
+
return fs12.readFileSync(filePath, "utf8");
|
|
14403
14815
|
} catch (_error) {
|
|
14404
14816
|
const error = _error;
|
|
14405
14817
|
if (error.code !== "ENOENT") {
|
|
14406
|
-
|
|
14818
|
+
debugLogger21.warn(`Failed to read ${filePath}: ${error.message}`);
|
|
14407
14819
|
}
|
|
14408
14820
|
return void 0;
|
|
14409
14821
|
}
|
|
@@ -14552,8 +14964,8 @@ __name(hasGlobSyntax, "hasGlobSyntax");
|
|
|
14552
14964
|
// packages/core/src/utils/filesearch/crawler.ts
|
|
14553
14965
|
init_esbuild_shims();
|
|
14554
14966
|
var import_fdir = __toESM(require_dist(), 1);
|
|
14555
|
-
import
|
|
14556
|
-
import
|
|
14967
|
+
import path15 from "node:path";
|
|
14968
|
+
import fs13 from "node:fs";
|
|
14557
14969
|
import { spawn as spawn3 } from "node:child_process";
|
|
14558
14970
|
|
|
14559
14971
|
// packages/core/src/utils/filesearch/crawlCache.ts
|
|
@@ -14638,7 +15050,7 @@ var write = /* @__PURE__ */ __name((key, results, ttlMs) => {
|
|
|
14638
15050
|
|
|
14639
15051
|
// packages/core/src/utils/filesearch/crawler.ts
|
|
14640
15052
|
function toPosixPath(p) {
|
|
14641
|
-
return p.split(
|
|
15053
|
+
return p.split(path15.sep).join(path15.posix.sep);
|
|
14642
15054
|
}
|
|
14643
15055
|
__name(toPosixPath, "toPosixPath");
|
|
14644
15056
|
function normalizeGitPath(p, stripTrailingSlash = false) {
|
|
@@ -14734,7 +15146,7 @@ function redactArgsForLog(args) {
|
|
|
14734
15146
|
if (/^[A-Za-z]:[\\/]/.test(t) || t.startsWith("/") && t.length > 1) {
|
|
14735
15147
|
return "<abs-path>";
|
|
14736
15148
|
}
|
|
14737
|
-
if (t.includes(
|
|
15149
|
+
if (t.includes(path15.sep) && t.length > 32) {
|
|
14738
15150
|
return "<path>";
|
|
14739
15151
|
}
|
|
14740
15152
|
return t;
|
|
@@ -14765,7 +15177,7 @@ function withSafeGitConfig(args) {
|
|
|
14765
15177
|
}
|
|
14766
15178
|
__name(withSafeGitConfig, "withSafeGitConfig");
|
|
14767
15179
|
function canonicalStatePath(p) {
|
|
14768
|
-
return toPosixPath(
|
|
15180
|
+
return toPosixPath(path15.resolve(p));
|
|
14769
15181
|
}
|
|
14770
15182
|
__name(canonicalStatePath, "canonicalStatePath");
|
|
14771
15183
|
function getStateKey(options) {
|
|
@@ -14810,28 +15222,28 @@ function resolveGitDir(crawlDirectory) {
|
|
|
14810
15222
|
}
|
|
14811
15223
|
let current = crawlDirectory;
|
|
14812
15224
|
while (current) {
|
|
14813
|
-
const gitPath =
|
|
15225
|
+
const gitPath = path15.join(current, ".git");
|
|
14814
15226
|
try {
|
|
14815
|
-
const stat5 =
|
|
15227
|
+
const stat5 = fs13.statSync(gitPath);
|
|
14816
15228
|
if (stat5.isDirectory()) {
|
|
14817
15229
|
pathCacheSet(resolveGitDirCache, cacheKey, gitPath);
|
|
14818
15230
|
return gitPath;
|
|
14819
15231
|
}
|
|
14820
15232
|
if (stat5.isFile()) {
|
|
14821
|
-
const contents =
|
|
15233
|
+
const contents = fs13.readFileSync(gitPath, "utf8").trim();
|
|
14822
15234
|
const match = contents.match(/^gitdir:\s*(.+)$/i);
|
|
14823
15235
|
if (!match) {
|
|
14824
15236
|
pathCacheSet(resolveGitDirCache, cacheKey, null);
|
|
14825
15237
|
return null;
|
|
14826
15238
|
}
|
|
14827
15239
|
const resolvedGitDir = match[1].trim();
|
|
14828
|
-
let resolvedAbs =
|
|
15240
|
+
let resolvedAbs = path15.isAbsolute(resolvedGitDir) ? path15.resolve(resolvedGitDir) : path15.resolve(current, resolvedGitDir);
|
|
14829
15241
|
try {
|
|
14830
|
-
resolvedAbs =
|
|
15242
|
+
resolvedAbs = fs13.realpathSync(resolvedAbs);
|
|
14831
15243
|
try {
|
|
14832
|
-
|
|
15244
|
+
fs13.statSync(path15.join(resolvedAbs, "HEAD"));
|
|
14833
15245
|
} catch {
|
|
14834
|
-
|
|
15246
|
+
fs13.statSync(path15.join(resolvedAbs, "index"));
|
|
14835
15247
|
}
|
|
14836
15248
|
} catch {
|
|
14837
15249
|
pathCacheSet(resolveGitDirCache, cacheKey, null);
|
|
@@ -14847,7 +15259,7 @@ function resolveGitDir(crawlDirectory) {
|
|
|
14847
15259
|
return null;
|
|
14848
15260
|
}
|
|
14849
15261
|
}
|
|
14850
|
-
const parent =
|
|
15262
|
+
const parent = path15.dirname(current);
|
|
14851
15263
|
if (parent === current) {
|
|
14852
15264
|
break;
|
|
14853
15265
|
}
|
|
@@ -14863,8 +15275,8 @@ function getGitRootMtime(crawlDirectory) {
|
|
|
14863
15275
|
if (!gitDir) {
|
|
14864
15276
|
return null;
|
|
14865
15277
|
}
|
|
14866
|
-
const indexPath =
|
|
14867
|
-
const indexStat =
|
|
15278
|
+
const indexPath = path15.join(gitDir, "index");
|
|
15279
|
+
const indexStat = fs13.statSync(indexPath);
|
|
14868
15280
|
return indexStat.mtimeMs;
|
|
14869
15281
|
} catch {
|
|
14870
15282
|
}
|
|
@@ -14920,7 +15332,7 @@ function computeLinesFingerprint(lines) {
|
|
|
14920
15332
|
__name(computeLinesFingerprint, "computeLinesFingerprint");
|
|
14921
15333
|
function runCommand(command, args, cwd, timeoutMs = 2e4, options) {
|
|
14922
15334
|
const collectLines = options?.collectLines !== false;
|
|
14923
|
-
return new Promise((
|
|
15335
|
+
return new Promise((resolve7) => {
|
|
14924
15336
|
const lines = [];
|
|
14925
15337
|
let settled = false;
|
|
14926
15338
|
let timedOut = false;
|
|
@@ -14932,7 +15344,7 @@ function runCommand(command, args, cwd, timeoutMs = 2e4, options) {
|
|
|
14932
15344
|
return;
|
|
14933
15345
|
}
|
|
14934
15346
|
settled = true;
|
|
14935
|
-
|
|
15347
|
+
resolve7({ success, lines: resultLines });
|
|
14936
15348
|
}, "finalize");
|
|
14937
15349
|
let stderrBuf = "";
|
|
14938
15350
|
let child;
|
|
@@ -15100,19 +15512,19 @@ function normalizePath(p) {
|
|
|
15100
15512
|
}
|
|
15101
15513
|
__name(normalizePath, "normalizePath");
|
|
15102
15514
|
function getPosixRelative(from, to) {
|
|
15103
|
-
const fromResolved =
|
|
15104
|
-
const toResolved =
|
|
15515
|
+
const fromResolved = path15.resolve(from);
|
|
15516
|
+
const toResolved = path15.resolve(to);
|
|
15105
15517
|
let fromAbs = fromResolved;
|
|
15106
15518
|
let toAbs = toResolved;
|
|
15107
15519
|
try {
|
|
15108
|
-
fromAbs =
|
|
15520
|
+
fromAbs = fs13.realpathSync(fromResolved);
|
|
15109
15521
|
} catch {
|
|
15110
15522
|
}
|
|
15111
15523
|
try {
|
|
15112
|
-
toAbs =
|
|
15524
|
+
toAbs = fs13.realpathSync(toResolved);
|
|
15113
15525
|
} catch {
|
|
15114
15526
|
}
|
|
15115
|
-
const relative2 =
|
|
15527
|
+
const relative2 = path15.relative(fromAbs, toAbs);
|
|
15116
15528
|
const posixRel = toPosixPath(relative2);
|
|
15117
15529
|
return posixRel === "" ? "." : posixRel;
|
|
15118
15530
|
}
|
|
@@ -15121,18 +15533,18 @@ function isValidIgnorePath(relativePath) {
|
|
|
15121
15533
|
if (!relativePath || relativePath === ".") {
|
|
15122
15534
|
return false;
|
|
15123
15535
|
}
|
|
15124
|
-
if (
|
|
15536
|
+
if (path15.posix.isAbsolute(relativePath)) {
|
|
15125
15537
|
return false;
|
|
15126
15538
|
}
|
|
15127
15539
|
return relativePath !== ".." && !relativePath.startsWith("../") && !relativePath.includes("/../");
|
|
15128
15540
|
}
|
|
15129
15541
|
__name(isValidIgnorePath, "isValidIgnorePath");
|
|
15130
15542
|
function toFdirExcludeRelativePath(crawlDirectory, dirPath) {
|
|
15131
|
-
const base =
|
|
15132
|
-
const absoluteCandidate =
|
|
15133
|
-
let rel =
|
|
15543
|
+
const base = path15.resolve(crawlDirectory);
|
|
15544
|
+
const absoluteCandidate = path15.isAbsolute(dirPath) ? dirPath : path15.join(base, dirPath);
|
|
15545
|
+
let rel = path15.relative(base, absoluteCandidate);
|
|
15134
15546
|
rel = toPosixPath(rel);
|
|
15135
|
-
if (!rel || rel.startsWith("..") ||
|
|
15547
|
+
if (!rel || rel.startsWith("..") || path15.posix.isAbsolute(rel)) {
|
|
15136
15548
|
return null;
|
|
15137
15549
|
}
|
|
15138
15550
|
return isValidIgnorePath(rel) ? rel : null;
|
|
@@ -15222,7 +15634,7 @@ __name(isUnderIgnoredDirectory, "isUnderIgnoredDirectory");
|
|
|
15222
15634
|
var YIELD_INTERVAL = 1e3;
|
|
15223
15635
|
async function maybeYield(index) {
|
|
15224
15636
|
if (index > 0 && index % YIELD_INTERVAL === 0) {
|
|
15225
|
-
await new Promise((
|
|
15637
|
+
await new Promise((resolve7) => setImmediate(resolve7));
|
|
15226
15638
|
}
|
|
15227
15639
|
}
|
|
15228
15640
|
__name(maybeYield, "maybeYield");
|
|
@@ -15339,16 +15751,16 @@ function posixPathUnderGitRoot(normalizedFile, relativeToGitRoot, relativeToCraw
|
|
|
15339
15751
|
if (relativeToGitRoot && relativeToGitRoot !== ".") {
|
|
15340
15752
|
const rest = sliceAfterGitPathspecPrefix(nf, normGitRoot);
|
|
15341
15753
|
if (rest !== null) {
|
|
15342
|
-
return
|
|
15754
|
+
return path15.posix.join(normCrawlDir, rest);
|
|
15343
15755
|
}
|
|
15344
15756
|
if (equalsRepoRelativeCaseAware(nf, normGitRoot)) {
|
|
15345
15757
|
const base = nf.replace(/\/+$/, "");
|
|
15346
15758
|
return `${base}/`;
|
|
15347
15759
|
}
|
|
15348
15760
|
const nfFile = nf.replace(/\/+$/, "");
|
|
15349
|
-
return
|
|
15761
|
+
return path15.posix.join(normCrawlDir, nfFile);
|
|
15350
15762
|
}
|
|
15351
|
-
return
|
|
15763
|
+
return path15.posix.join(normCrawlDir, nf.replace(/\/+$/, ""));
|
|
15352
15764
|
}
|
|
15353
15765
|
__name(posixPathUnderGitRoot, "posixPathUnderGitRoot");
|
|
15354
15766
|
async function crawlWithGitLsFiles(stateKey, crawlDirectory, cwd, options, workingTreePrefetch) {
|
|
@@ -15427,7 +15839,7 @@ async function crawlWithGitLsFiles(stateKey, crawlDirectory, cwd, options, worki
|
|
|
15427
15839
|
}
|
|
15428
15840
|
let stat5;
|
|
15429
15841
|
try {
|
|
15430
|
-
stat5 =
|
|
15842
|
+
stat5 = fs13.lstatSync(path15.join(gitRoot, ...normalizedFile.split("/")));
|
|
15431
15843
|
} catch {
|
|
15432
15844
|
return true;
|
|
15433
15845
|
}
|
|
@@ -15529,7 +15941,7 @@ function collectDirectoryRows(options) {
|
|
|
15529
15941
|
const dirFilter = options.ignore.getDirectoryFilter();
|
|
15530
15942
|
const rows = [];
|
|
15531
15943
|
const visit = /* @__PURE__ */ __name((dir, relativePath, depth) => {
|
|
15532
|
-
const cwdRelative = relativePath === "" ? relativeToCrawlDir :
|
|
15944
|
+
const cwdRelative = relativePath === "" ? relativeToCrawlDir : path15.posix.join(relativeToCrawlDir, relativePath);
|
|
15533
15945
|
if (cwdRelative !== ".") {
|
|
15534
15946
|
const row = cwdRelative.endsWith("/") ? cwdRelative : `${cwdRelative}/`;
|
|
15535
15947
|
if (!isValidIgnorePath(row.slice(0, -1)) || dirFilter(row)) {
|
|
@@ -15542,7 +15954,7 @@ function collectDirectoryRows(options) {
|
|
|
15542
15954
|
}
|
|
15543
15955
|
let entries;
|
|
15544
15956
|
try {
|
|
15545
|
-
entries =
|
|
15957
|
+
entries = fs13.readdirSync(dir, { withFileTypes: true });
|
|
15546
15958
|
} catch {
|
|
15547
15959
|
return;
|
|
15548
15960
|
}
|
|
@@ -15550,8 +15962,8 @@ function collectDirectoryRows(options) {
|
|
|
15550
15962
|
if (!entry.isDirectory()) {
|
|
15551
15963
|
continue;
|
|
15552
15964
|
}
|
|
15553
|
-
const childRelative = relativePath ?
|
|
15554
|
-
visit(
|
|
15965
|
+
const childRelative = relativePath ? path15.posix.join(relativePath, entry.name) : entry.name;
|
|
15966
|
+
visit(path15.join(dir, entry.name), childRelative, depth + 1);
|
|
15555
15967
|
}
|
|
15556
15968
|
}, "visit");
|
|
15557
15969
|
visit(options.crawlDirectory, "", 0);
|
|
@@ -15589,7 +16001,7 @@ async function crawlWithRipgrep(stateKey, crawlDirectory, cwd, options) {
|
|
|
15589
16001
|
return false;
|
|
15590
16002
|
}
|
|
15591
16003
|
const normalizedFile = normalizePath(file);
|
|
15592
|
-
const fullPath =
|
|
16004
|
+
const fullPath = path15.posix.join(relativeToCrawlDir, normalizedFile);
|
|
15593
16005
|
if (!shouldIncludeFile(fullPath, dirFilter, fileFilter)) {
|
|
15594
16006
|
return true;
|
|
15595
16007
|
}
|
|
@@ -15648,7 +16060,7 @@ async function crawlWithFdir(options) {
|
|
|
15648
16060
|
return dirFilter(`${relativePath}/`);
|
|
15649
16061
|
}).filter((filePath, isDirectory) => {
|
|
15650
16062
|
if (isDirectory) return true;
|
|
15651
|
-
const cwdRelative =
|
|
16063
|
+
const cwdRelative = path15.posix.join(relativeToCrawlDir, filePath);
|
|
15652
16064
|
if (!isValidIgnorePath(cwdRelative)) {
|
|
15653
16065
|
return false;
|
|
15654
16066
|
}
|
|
@@ -15661,7 +16073,7 @@ async function crawlWithFdir(options) {
|
|
|
15661
16073
|
} catch {
|
|
15662
16074
|
return [];
|
|
15663
16075
|
}
|
|
15664
|
-
const mapped = results.filter((p) => p.length > 0 && p !== ".").map((p) =>
|
|
16076
|
+
const mapped = results.filter((p) => p.length > 0 && p !== ".").map((p) => path15.posix.join(relativeToCrawlDir, p));
|
|
15665
16077
|
if (relativeToCrawlDir !== ".") {
|
|
15666
16078
|
const rootDir = relativeToCrawlDir.endsWith("/") ? relativeToCrawlDir : `${relativeToCrawlDir}/`;
|
|
15667
16079
|
if (!mapped.includes(rootDir)) {
|
|
@@ -15788,8 +16200,8 @@ __name(applyMaxFilesLimit, "applyMaxFilesLimit");
|
|
|
15788
16200
|
|
|
15789
16201
|
// packages/core/src/utils/filesearch/fzfWorkerHandle.ts
|
|
15790
16202
|
init_esbuild_shims();
|
|
15791
|
-
import
|
|
15792
|
-
import
|
|
16203
|
+
import fs14 from "node:fs";
|
|
16204
|
+
import path16 from "node:path";
|
|
15793
16205
|
import { Worker } from "node:worker_threads";
|
|
15794
16206
|
|
|
15795
16207
|
// node_modules/fzf/dist/fzf.es.js
|
|
@@ -16656,7 +17068,7 @@ function basicMatch(query) {
|
|
|
16656
17068
|
__name(basicMatch, "basicMatch");
|
|
16657
17069
|
var isNode = typeof __require !== "undefined" && typeof window === "undefined";
|
|
16658
17070
|
function asyncMatcher(token, len, iter2, onFinish) {
|
|
16659
|
-
return new Promise((
|
|
17071
|
+
return new Promise((resolve7, reject) => {
|
|
16660
17072
|
const INCREMENT = 1e3;
|
|
16661
17073
|
let i = 0, end = Math.min(INCREMENT, len);
|
|
16662
17074
|
const step = /* @__PURE__ */ __name(() => {
|
|
@@ -16669,7 +17081,7 @@ function asyncMatcher(token, len, iter2, onFinish) {
|
|
|
16669
17081
|
end = Math.min(end + INCREMENT, len);
|
|
16670
17082
|
isNode ? setImmediate(step) : setTimeout(step);
|
|
16671
17083
|
} else {
|
|
16672
|
-
|
|
17084
|
+
resolve7(onFinish());
|
|
16673
17085
|
}
|
|
16674
17086
|
}, "step");
|
|
16675
17087
|
step();
|
|
@@ -16841,11 +17253,11 @@ var inProcessTransport = {
|
|
|
16841
17253
|
var resolvedWorkerPath;
|
|
16842
17254
|
function getWorkerScriptPath() {
|
|
16843
17255
|
if (resolvedWorkerPath !== void 0) return resolvedWorkerPath;
|
|
16844
|
-
const candidate =
|
|
17256
|
+
const candidate = path16.join(
|
|
16845
17257
|
resolveBundleDir(import.meta.url),
|
|
16846
17258
|
"fzfWorker.js"
|
|
16847
17259
|
);
|
|
16848
|
-
resolvedWorkerPath =
|
|
17260
|
+
resolvedWorkerPath = fs14.existsSync(candidate) ? candidate : null;
|
|
16849
17261
|
return resolvedWorkerPath;
|
|
16850
17262
|
}
|
|
16851
17263
|
__name(getWorkerScriptPath, "getWorkerScriptPath");
|
|
@@ -16941,12 +17353,12 @@ var workerTransport = {
|
|
|
16941
17353
|
}
|
|
16942
17354
|
await readyPromise;
|
|
16943
17355
|
const reqId = nextReqId++;
|
|
16944
|
-
return new Promise((
|
|
17356
|
+
return new Promise((resolve7, reject) => {
|
|
16945
17357
|
if (readyState === "disposed" || readyState === "failed") {
|
|
16946
17358
|
reject(new Error(`fzf worker not available (${readyState})`));
|
|
16947
17359
|
return;
|
|
16948
17360
|
}
|
|
16949
|
-
pending.set(reqId, { resolve:
|
|
17361
|
+
pending.set(reqId, { resolve: resolve7, reject });
|
|
16950
17362
|
try {
|
|
16951
17363
|
worker.postMessage({ type: "find", reqId, pattern, limit });
|
|
16952
17364
|
} catch (err) {
|
|
@@ -17041,7 +17453,7 @@ async function filter(allPaths, pattern, signal) {
|
|
|
17041
17453
|
const results = [];
|
|
17042
17454
|
for (const [i, p] of allPaths.entries()) {
|
|
17043
17455
|
if (i % 1e3 === 0) {
|
|
17044
|
-
await new Promise((
|
|
17456
|
+
await new Promise((resolve7) => setImmediate(resolve7));
|
|
17045
17457
|
if (signal?.aborted) {
|
|
17046
17458
|
throw new AbortError();
|
|
17047
17459
|
}
|
|
@@ -17120,7 +17532,7 @@ var RecursiveFileSearch = class {
|
|
|
17120
17532
|
const results = [];
|
|
17121
17533
|
for (const [i, candidate] of filteredCandidates.entries()) {
|
|
17122
17534
|
if (i % 1e3 === 0) {
|
|
17123
|
-
await new Promise((
|
|
17535
|
+
await new Promise((resolve7) => setImmediate(resolve7));
|
|
17124
17536
|
if (options.signal?.aborted) {
|
|
17125
17537
|
throw new AbortError();
|
|
17126
17538
|
}
|
|
@@ -17162,9 +17574,9 @@ var DirectoryFileSearch = class {
|
|
|
17162
17574
|
throw new Error("Engine not initialized. Call initialize() first.");
|
|
17163
17575
|
}
|
|
17164
17576
|
pattern = pattern || "*";
|
|
17165
|
-
const dir = pattern.endsWith("/") ? pattern :
|
|
17166
|
-
const crawlDirectory =
|
|
17167
|
-
const listingProjectRoot =
|
|
17577
|
+
const dir = pattern.endsWith("/") ? pattern : path17.dirname(pattern);
|
|
17578
|
+
const crawlDirectory = path17.join(this.options.projectRoot, dir);
|
|
17579
|
+
const listingProjectRoot = path17.resolve(crawlDirectory) === path17.resolve(this.options.projectRoot);
|
|
17168
17580
|
const results = await crawl({
|
|
17169
17581
|
crawlDirectory,
|
|
17170
17582
|
cwd: this.options.projectRoot,
|
|
@@ -17245,13 +17657,13 @@ __name(analyzeToolResultRetention, "analyzeToolResultRetention");
|
|
|
17245
17657
|
|
|
17246
17658
|
// packages/core/src/utils/pathReader.ts
|
|
17247
17659
|
init_esbuild_shims();
|
|
17248
|
-
import { promises as
|
|
17249
|
-
import
|
|
17660
|
+
import { promises as fs15 } from "node:fs";
|
|
17661
|
+
import path18 from "node:path";
|
|
17250
17662
|
async function readPathFromWorkspace(pathStr, config) {
|
|
17251
17663
|
const workspace = config.getWorkspaceContext();
|
|
17252
17664
|
const fileService = config.getFileService();
|
|
17253
17665
|
let absolutePath = null;
|
|
17254
|
-
if (
|
|
17666
|
+
if (path18.isAbsolute(pathStr)) {
|
|
17255
17667
|
if (!workspace.isPathWithinWorkspace(pathStr)) {
|
|
17256
17668
|
throw new Error(
|
|
17257
17669
|
`Absolute path is outside of the allowed workspace: ${pathStr}`
|
|
@@ -17261,9 +17673,9 @@ async function readPathFromWorkspace(pathStr, config) {
|
|
|
17261
17673
|
} else {
|
|
17262
17674
|
const searchDirs = workspace.getDirectories();
|
|
17263
17675
|
for (const dir of searchDirs) {
|
|
17264
|
-
const potentialPath =
|
|
17676
|
+
const potentialPath = path18.resolve(dir, pathStr);
|
|
17265
17677
|
try {
|
|
17266
|
-
await
|
|
17678
|
+
await fs15.access(potentialPath);
|
|
17267
17679
|
absolutePath = potentialPath;
|
|
17268
17680
|
break;
|
|
17269
17681
|
} catch {
|
|
@@ -17273,7 +17685,7 @@ async function readPathFromWorkspace(pathStr, config) {
|
|
|
17273
17685
|
if (!absolutePath) {
|
|
17274
17686
|
throw new Error(`Path not found in workspace: ${pathStr}`);
|
|
17275
17687
|
}
|
|
17276
|
-
const stats = await
|
|
17688
|
+
const stats = await fs15.stat(absolutePath);
|
|
17277
17689
|
if (stats.isDirectory()) {
|
|
17278
17690
|
const allParts = [];
|
|
17279
17691
|
allParts.push({
|
|
@@ -17289,7 +17701,7 @@ async function readPathFromWorkspace(pathStr, config) {
|
|
|
17289
17701
|
absolute: true
|
|
17290
17702
|
});
|
|
17291
17703
|
const relativeFiles = files.map(
|
|
17292
|
-
(p) =>
|
|
17704
|
+
(p) => path18.relative(config.getTargetDir(), p)
|
|
17293
17705
|
);
|
|
17294
17706
|
const filteringOptions = config.getFileFilteringOptions();
|
|
17295
17707
|
const filteredFiles = fileService.filterFiles(relativeFiles, {
|
|
@@ -17297,10 +17709,10 @@ async function readPathFromWorkspace(pathStr, config) {
|
|
|
17297
17709
|
respectQwenIgnore: filteringOptions.respectQwenIgnore
|
|
17298
17710
|
});
|
|
17299
17711
|
const finalFiles = filteredFiles.map(
|
|
17300
|
-
(p) =>
|
|
17712
|
+
(p) => path18.resolve(config.getTargetDir(), p)
|
|
17301
17713
|
);
|
|
17302
17714
|
for (const filePath of finalFiles) {
|
|
17303
|
-
const relativePathForDisplay =
|
|
17715
|
+
const relativePathForDisplay = path18.relative(absolutePath, filePath);
|
|
17304
17716
|
allParts.push({ text: `--- ${relativePathForDisplay} ---
|
|
17305
17717
|
` });
|
|
17306
17718
|
const result = await processSingleFileContent(filePath, config, {
|
|
@@ -17316,7 +17728,7 @@ async function readPathFromWorkspace(pathStr, config) {
|
|
|
17316
17728
|
allParts.push({ text: `--- End of content for directory: ${pathStr} ---` });
|
|
17317
17729
|
return allParts;
|
|
17318
17730
|
} else {
|
|
17319
|
-
const relativePath =
|
|
17731
|
+
const relativePath = path18.relative(config.getTargetDir(), absolutePath);
|
|
17320
17732
|
const singleFileFilteringOptions = config.getFileFilteringOptions();
|
|
17321
17733
|
const filtered = fileService.filterFiles([relativePath], {
|
|
17322
17734
|
respectGitIgnore: singleFileFilteringOptions.respectGitIgnore,
|
|
@@ -17335,16 +17747,16 @@ __name(readPathFromWorkspace, "readPathFromWorkspace");
|
|
|
17335
17747
|
|
|
17336
17748
|
// packages/core/src/utils/projectSummary.ts
|
|
17337
17749
|
init_esbuild_shims();
|
|
17338
|
-
import * as
|
|
17339
|
-
import * as
|
|
17750
|
+
import * as fs16 from "fs/promises";
|
|
17751
|
+
import * as path19 from "path";
|
|
17340
17752
|
var PROJECT_SUMMARY_FILENAME = "PROJECT_SUMMARY.md";
|
|
17341
17753
|
var WELCOME_BACK_STATE_FILENAME = "welcome-back-state.json";
|
|
17342
17754
|
function getProjectSummaryPath() {
|
|
17343
|
-
return
|
|
17755
|
+
return path19.join(process.cwd(), ".qwen", PROJECT_SUMMARY_FILENAME);
|
|
17344
17756
|
}
|
|
17345
17757
|
__name(getProjectSummaryPath, "getProjectSummaryPath");
|
|
17346
17758
|
function getWelcomeBackStatePath() {
|
|
17347
|
-
return
|
|
17759
|
+
return path19.join(process.cwd(), ".qwen", WELCOME_BACK_STATE_FILENAME);
|
|
17348
17760
|
}
|
|
17349
17761
|
__name(getWelcomeBackStatePath, "getWelcomeBackStatePath");
|
|
17350
17762
|
function buildSummaryFingerprint(stat5) {
|
|
@@ -17353,7 +17765,7 @@ function buildSummaryFingerprint(stat5) {
|
|
|
17353
17765
|
__name(buildSummaryFingerprint, "buildSummaryFingerprint");
|
|
17354
17766
|
async function getWelcomeBackState() {
|
|
17355
17767
|
try {
|
|
17356
|
-
const raw = await
|
|
17768
|
+
const raw = await fs16.readFile(getWelcomeBackStatePath(), "utf-8");
|
|
17357
17769
|
const parsed = JSON.parse(raw);
|
|
17358
17770
|
if (parsed.version !== 1 || parsed.lastChoice !== "restart" || typeof parsed.summaryFingerprint !== "string") {
|
|
17359
17771
|
return null;
|
|
@@ -17369,7 +17781,7 @@ async function getWelcomeBackState() {
|
|
|
17369
17781
|
__name(getWelcomeBackState, "getWelcomeBackState");
|
|
17370
17782
|
async function saveWelcomeBackRestartChoice(summaryFingerprint) {
|
|
17371
17783
|
const statePath = getWelcomeBackStatePath();
|
|
17372
|
-
await
|
|
17784
|
+
await fs16.mkdir(path19.dirname(statePath), { recursive: true });
|
|
17373
17785
|
const state = {
|
|
17374
17786
|
version: 1,
|
|
17375
17787
|
lastChoice: "restart",
|
|
@@ -17382,7 +17794,7 @@ async function saveWelcomeBackRestartChoice(summaryFingerprint) {
|
|
|
17382
17794
|
__name(saveWelcomeBackRestartChoice, "saveWelcomeBackRestartChoice");
|
|
17383
17795
|
async function clearWelcomeBackState() {
|
|
17384
17796
|
try {
|
|
17385
|
-
await
|
|
17797
|
+
await fs16.rm(getWelcomeBackStatePath(), { force: true });
|
|
17386
17798
|
} catch {
|
|
17387
17799
|
}
|
|
17388
17800
|
}
|
|
@@ -17390,15 +17802,15 @@ __name(clearWelcomeBackState, "clearWelcomeBackState");
|
|
|
17390
17802
|
async function getProjectSummaryInfo() {
|
|
17391
17803
|
const summaryPath = getProjectSummaryPath();
|
|
17392
17804
|
try {
|
|
17393
|
-
await
|
|
17805
|
+
await fs16.access(summaryPath);
|
|
17394
17806
|
} catch {
|
|
17395
17807
|
return {
|
|
17396
17808
|
hasHistory: false
|
|
17397
17809
|
};
|
|
17398
17810
|
}
|
|
17399
17811
|
try {
|
|
17400
|
-
const summaryStat = await
|
|
17401
|
-
const content = await
|
|
17812
|
+
const summaryStat = await fs16.stat(summaryPath);
|
|
17813
|
+
const content = await fs16.readFile(summaryPath, "utf-8");
|
|
17402
17814
|
const summaryFingerprint = buildSummaryFingerprint(summaryStat);
|
|
17403
17815
|
const timestampMatch = content.match(/\*\*Update time\*\*: (.+)/);
|
|
17404
17816
|
const timestamp = timestampMatch ? timestampMatch[1] : (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -17466,9 +17878,9 @@ __name(getProjectSummaryInfo, "getProjectSummaryInfo");
|
|
|
17466
17878
|
|
|
17467
17879
|
// packages/core/src/tools/readManyFiles.ts
|
|
17468
17880
|
init_esbuild_shims();
|
|
17469
|
-
import * as
|
|
17881
|
+
import * as fs17 from "node:fs";
|
|
17470
17882
|
import * as os3 from "node:os";
|
|
17471
|
-
import * as
|
|
17883
|
+
import * as path20 from "node:path";
|
|
17472
17884
|
var DEFAULT_OUTPUT_HEADER = "\n--- Content from referenced files ---";
|
|
17473
17885
|
var DEFAULT_OUTPUT_TERMINATOR = "\n--- End of content ---";
|
|
17474
17886
|
var SNAPSHOT_MAX_SIZE_BYTES = 100 * 1024 * 1024;
|
|
@@ -17488,7 +17900,7 @@ async function readManyFiles(config, options) {
|
|
|
17488
17900
|
for (const rawPattern of inputPatterns) {
|
|
17489
17901
|
signal?.throwIfAborted();
|
|
17490
17902
|
const normalizedPattern = rawPattern.replace(/\\/g, "/");
|
|
17491
|
-
const fullPath =
|
|
17903
|
+
const fullPath = path20.resolve(projectRoot, normalizedPattern);
|
|
17492
17904
|
const displayPath = displayPaths?.get(fullPath) ?? fullPath;
|
|
17493
17905
|
const validatedIdentity = validatedPathIdentities?.get(fullPath);
|
|
17494
17906
|
if (validatedPathIdentities && !validatedIdentity) continue;
|
|
@@ -17507,7 +17919,7 @@ async function readManyFiles(config, options) {
|
|
|
17507
17919
|
if (validatedIdentity && !await matchesValidatedPathIdentity(fullPath, validatedIdentity)) {
|
|
17508
17920
|
continue;
|
|
17509
17921
|
}
|
|
17510
|
-
const stats =
|
|
17922
|
+
const stats = fs17.existsSync(fullPath) ? fs17.statSync(fullPath) : null;
|
|
17511
17923
|
if (stats?.isDirectory()) {
|
|
17512
17924
|
const { contentParts: dirParts, info } = await readDirectory(
|
|
17513
17925
|
config,
|
|
@@ -17627,9 +18039,9 @@ async function readValidatedTextFileContent(config, filePath, expected, preserve
|
|
|
17627
18039
|
__name(readValidatedTextFileContent, "readValidatedTextFileContent");
|
|
17628
18040
|
async function matchesValidatedPathIdentity(filePath, expected) {
|
|
17629
18041
|
try {
|
|
17630
|
-
const canonicalPath = await
|
|
18042
|
+
const canonicalPath = await fs17.promises.realpath(filePath);
|
|
17631
18043
|
if (canonicalPath !== filePath) return false;
|
|
17632
|
-
const stats = await
|
|
18044
|
+
const stats = await fs17.promises.stat(canonicalPath);
|
|
17633
18045
|
return statsMatchValidatedIdentity(stats, expected);
|
|
17634
18046
|
} catch {
|
|
17635
18047
|
return false;
|
|
@@ -17658,13 +18070,13 @@ async function snapshotValidatedFile(filePath, expected, signal) {
|
|
|
17658
18070
|
if (stats.size > SNAPSHOT_MAX_SIZE_BYTES) {
|
|
17659
18071
|
return void 0;
|
|
17660
18072
|
}
|
|
17661
|
-
snapshotDir = await
|
|
17662
|
-
|
|
18073
|
+
snapshotDir = await fs17.promises.mkdtemp(
|
|
18074
|
+
path20.join(os3.tmpdir(), "qwen-validated-read-")
|
|
17663
18075
|
);
|
|
17664
|
-
const snapshotPath =
|
|
17665
|
-
const target = await
|
|
18076
|
+
const snapshotPath = path20.join(snapshotDir, path20.basename(filePath));
|
|
18077
|
+
const target = await fs17.promises.open(
|
|
17666
18078
|
snapshotPath,
|
|
17667
|
-
|
|
18079
|
+
fs17.constants.O_WRONLY | fs17.constants.O_CREAT | fs17.constants.O_EXCL,
|
|
17668
18080
|
384
|
|
17669
18081
|
);
|
|
17670
18082
|
try {
|
|
@@ -17705,7 +18117,7 @@ async function snapshotValidatedFile(filePath, expected, signal) {
|
|
|
17705
18117
|
result = {
|
|
17706
18118
|
filePath: snapshotPath,
|
|
17707
18119
|
stats,
|
|
17708
|
-
cleanup: /* @__PURE__ */ __name(() =>
|
|
18120
|
+
cleanup: /* @__PURE__ */ __name(() => fs17.promises.rm(snapshotDir, { recursive: true, force: true }), "cleanup")
|
|
17709
18121
|
};
|
|
17710
18122
|
return result;
|
|
17711
18123
|
} finally {
|
|
@@ -17717,7 +18129,7 @@ async function snapshotValidatedFile(filePath, expected, signal) {
|
|
|
17717
18129
|
return void 0;
|
|
17718
18130
|
} finally {
|
|
17719
18131
|
if (snapshotDir && !result) {
|
|
17720
|
-
await
|
|
18132
|
+
await fs17.promises.rm(snapshotDir, { recursive: true, force: true });
|
|
17721
18133
|
}
|
|
17722
18134
|
}
|
|
17723
18135
|
}
|
|
@@ -17906,6 +18318,14 @@ export {
|
|
|
17906
18318
|
IMAGE_CAPABILITY,
|
|
17907
18319
|
generateSessionRecap,
|
|
17908
18320
|
SessionReferenceService,
|
|
18321
|
+
MAX_CONTROLLER_LABEL_CHARS,
|
|
18322
|
+
PeerControllerError,
|
|
18323
|
+
getPeerControllerRegistryPath,
|
|
18324
|
+
readPeerControllerRegistrySync,
|
|
18325
|
+
resolveControllerToken,
|
|
18326
|
+
listPeerControllers,
|
|
18327
|
+
addPeerController,
|
|
18328
|
+
removePeerController,
|
|
17909
18329
|
getLastPeerInboxFailure,
|
|
17910
18330
|
describePeerInboxFailure,
|
|
17911
18331
|
startPeerInbox,
|