@qwen-code/qwen-code 0.23.1-preview.1 → 0.23.1
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/computer-use/SKILL.md +189 -116
- package/bundled/goal-draft/SKILL.md +23 -13
- package/bundled/qc-helper/docs/_meta.ts +1 -0
- package/bundled/qc-helper/docs/configuration/model-providers.md +47 -1
- package/bundled/qc-helper/docs/configuration/settings.md +57 -7
- package/bundled/qc-helper/docs/conversations-recovery.md +102 -0
- package/bundled/qc-helper/docs/features/channels/dingtalk.md +26 -0
- package/bundled/qc-helper/docs/features/channels/overview.md +1 -1
- package/bundled/qc-helper/docs/features/commands.md +71 -6
- package/bundled/qc-helper/docs/features/computer-use.md +9 -7
- package/bundled/qc-helper/docs/features/followup-suggestions.md +2 -2
- package/bundled/qc-helper/docs/features/goals.md +15 -3
- package/bundled/qc-helper/docs/features/skills.md +40 -0
- package/bundled/qc-helper/docs/qwen-serve.md +19 -1
- package/chunks/{MaxSizedBox-5ARLO5PR.js → MaxSizedBox-UDO6Y7RB.js} +35 -36
- package/chunks/{StandaloneSessionPicker-T6B322CB.js → StandaloneSessionPicker-D4CUOO4H.js} +55 -56
- package/chunks/{acp-startup-profiler-6ULXXQMS.js → acp-startup-profiler-KEU6VAYR.js} +2 -2
- package/chunks/{acpAgent-WTDEY5KD.js → acpAgent-KWLJFADK.js} +210 -131
- package/chunks/{agent-NXPUXEVZ.js → agent-GSUPGEOL.js} +24 -25
- package/chunks/{agent-headless-QQZTWOKO.js → agent-headless-HNYCQUJB.js} +24 -25
- package/chunks/{anthropicContentGenerator-6XDHXIII.js → anthropicContentGenerator-I7LQZH26.js} +30 -7
- package/chunks/{artifact-tool-DFVVJXL2.js → artifact-tool-P52OKKEF.js} +1 -1
- package/chunks/{askUserQuestion-GF7VQ44M.js → askUserQuestion-I5W5S3D6.js} +2 -2
- package/chunks/{bridge-OHY5OGOZ.js → bridge-B7CV6RVI.js} +40 -41
- package/chunks/{channel-management-service-ZDDG3G5S.js → channel-management-service-TRTLQTSV.js} +4 -4
- package/chunks/{channel-settings-store-7BJAS2SU.js → channel-settings-store-FW45IRUP.js} +46 -47
- package/chunks/{channel-worker-group-2ISMRENV.js → channel-worker-group-PIYPVCTF.js} +6 -6
- package/chunks/{channel-worker-manager-VSRPVPRH.js → channel-worker-manager-FQHEDTD2.js} +6 -6
- package/chunks/{channel-worker-supervisor-SRJBK72Z.js → channel-worker-supervisor-XJPZZ3VK.js} +3 -3
- package/chunks/{chunk-2WGJG2KW.js → chunk-25CBAK3H.js} +4 -4
- package/chunks/{chunk-XUSOYE2I.js → chunk-27LTEY6D.js} +1 -1
- package/chunks/{chunk-WTW36TJ3.js → chunk-2EKVPSIJ.js} +1 -1
- package/chunks/{chunk-NAKALAL4.js → chunk-2TMJRF46.js} +116 -15
- package/chunks/{chunk-E4L5BM2B.js → chunk-2YS3NU4A.js} +4 -4
- package/chunks/chunk-2Z3T52OC.js +82 -0
- package/chunks/{chunk-ER273QE6.js → chunk-2ZFO5JD7.js} +21 -4
- package/chunks/{chunk-WXC6OAWD.js → chunk-3BTHHXXE.js} +1 -1
- package/chunks/{chunk-GXZHYPHZ.js → chunk-3LPJ776W.js} +5 -2
- package/chunks/{chunk-XY3USGFE.js → chunk-3VDLQUR2.js} +1 -1
- package/chunks/{chunk-LK7S2D6V.js → chunk-3VWPPK5Q.js} +58 -4
- package/chunks/{chunk-IKLFS6SC.js → chunk-3YQMUBTS.js} +3 -3
- package/chunks/{chunk-P4RUUG64.js → chunk-45ROPFQY.js} +1 -1
- package/chunks/{chunk-W4LL5RZO.js → chunk-4ALNJDHL.js} +52 -13
- package/chunks/{chunk-D6PIMKY3.js → chunk-4VY3ITHR.js} +4 -4
- package/chunks/{chunk-H3UDNQLO.js → chunk-5CVY5Q2P.js} +3 -3
- package/chunks/{chunk-6UIACMGH.js → chunk-5DQ4YTIZ.js} +1 -1
- package/chunks/{chunk-P6LATTDG.js → chunk-5IL2BZHW.js} +3 -3
- package/chunks/{chunk-537SQ2AI.js → chunk-5WC2ECUK.js} +104 -16
- package/chunks/{chunk-HFTB354P.js → chunk-5Z4FCEPY.js} +60 -6
- package/chunks/{chunk-3K65MUKD.js → chunk-65I7S4Z3.js} +2 -1
- package/chunks/{chunk-AQ5NAGWI.js → chunk-66JBCTJF.js} +8 -7
- package/chunks/{chunk-54TF2ZIQ.js → chunk-6JXHO7LG.js} +3 -3
- package/chunks/{chunk-YCDL2SAS.js → chunk-6QILGINT.js} +2 -2
- package/chunks/{chunk-P5LDR7FI.js → chunk-6QV7Z74P.js} +3 -3
- package/chunks/{chunk-4HC4DYKN.js → chunk-6RZX2HIH.js} +1 -1
- package/chunks/{chunk-O45WBTNS.js → chunk-6SADVYQQ.js} +3 -3
- package/chunks/{chunk-KE3Q4JMY.js → chunk-6TPVIESH.js} +5 -7
- package/chunks/{chunk-2LD5U7Q3.js → chunk-6YEOCHSE.js} +29 -1
- package/chunks/{chunk-QWZOOIR3.js → chunk-75LBC7SV.js} +69 -12
- package/chunks/{chunk-7BZS4ZDV.js → chunk-7SL55L5H.js} +25 -18
- package/chunks/{chunk-O2GG7H4C.js → chunk-ARYNBBBM.js} +3 -3
- package/chunks/{chunk-CZACBHAW.js → chunk-B3EL44K3.js} +5 -5
- package/chunks/{chunk-VY6UVU7G.js → chunk-CABDNUJ4.js} +2 -2
- package/chunks/{chunk-RVNS7NWN.js → chunk-CALNF3Z3.js} +1 -1
- package/chunks/{chunk-MWHY26G3.js → chunk-CHVU543W.js} +1 -1
- package/chunks/{chunk-GZWW2QWR.js → chunk-CIKL2DQP.js} +2 -2
- package/chunks/{chunk-R355CUNQ.js → chunk-CLKE4IY3.js} +1 -77
- package/chunks/{chunk-MUZCSTOO.js → chunk-CRZBDVP2.js} +5 -4
- package/chunks/{chunk-SFMCYMVF.js → chunk-D6AQNMUA.js} +4 -4
- package/chunks/{chunk-D4CU6DKR.js → chunk-DO5SMV52.js} +10 -8
- package/chunks/{chunk-ZAZ3NFL6.js → chunk-DXQ6Z7AH.js} +315 -63
- package/chunks/{chunk-IXSGOSEG.js → chunk-DZ6D4B3K.js} +28 -25
- package/chunks/{chunk-GMNLYQOS.js → chunk-E6TI726I.js} +1 -1
- package/chunks/{chunk-JBTZUFR4.js → chunk-E7XSUYCZ.js} +6 -6
- package/chunks/{chunk-AHBLRVD5.js → chunk-EEKU6COG.js} +4 -4
- package/chunks/{chunk-47BZVBTE.js → chunk-EHTKOO6W.js} +4 -4
- package/chunks/{chunk-HJ34U5J4.js → chunk-ENZDGHGJ.js} +4 -4
- package/chunks/{chunk-IFD3BTEA.js → chunk-EOET4H7C.js} +3 -3
- package/chunks/{chunk-ZTAVGFKA.js → chunk-ERXNTINK.js} +1 -1
- package/chunks/{chunk-F47DITLZ.js → chunk-FAWTMDX7.js} +14 -0
- package/chunks/{chunk-KPXRFTT7.js → chunk-FETY36NQ.js} +1 -1
- package/chunks/{chunk-5JLQWQK6.js → chunk-FV4DM2M4.js} +2 -2
- package/chunks/{chunk-4F2QRVW6.js → chunk-FW4E4QPG.js} +1 -1
- package/chunks/{chunk-KJJPJYHI.js → chunk-FWRRUITH.js} +8 -8
- package/chunks/{chunk-4VUVBN3Y.js → chunk-G6UUOCUT.js} +87 -0
- package/chunks/{chunk-4JAGXZR3.js → chunk-GM44O6F7.js} +1 -1
- package/chunks/{chunk-4MCY33Y2.js → chunk-GNY7B3CA.js} +1 -1
- package/chunks/{chunk-VEFRT7NX.js → chunk-H3Q3RSKZ.js} +1 -1
- package/chunks/{chunk-43NOB5NM.js → chunk-HIXUUCGY.js} +188 -13
- package/chunks/{chunk-EJNYBDYC.js → chunk-HNLMYDQE.js} +1 -1
- package/chunks/{chunk-JOPC3FND.js → chunk-HUX2DOTF.js} +5 -5
- package/chunks/{chunk-GCFZ2LAX.js → chunk-HZ2HUXX7.js} +2 -2
- package/chunks/{chunk-CWNC7M73.js → chunk-IKG2YVRZ.js} +2 -2
- package/chunks/{chunk-L4R7BCVV.js → chunk-J3TJH52D.js} +1 -1
- package/chunks/{chunk-QMFOYPGV.js → chunk-J3VZF2AL.js} +2 -2
- package/chunks/{chunk-ZJ2LM2SI.js → chunk-JGDRB4FP.js} +104 -33
- package/chunks/{chunk-LMJQSPWB.js → chunk-KA5HR3G2.js} +1 -1
- package/chunks/{chunk-G34YLYCS.js → chunk-L7V52QEZ.js} +10 -10
- package/chunks/{chunk-GVVCLL2P.js → chunk-LNCNUMJ5.js} +451 -396
- package/chunks/{chunk-RDKXZ2LS.js → chunk-LYT2OU7D.js} +1 -1
- package/chunks/{chunk-SAZS4IWW.js → chunk-LZGFVUWZ.js} +3 -3
- package/chunks/{chunk-32YDNYXP.js → chunk-M73KHGNR.js} +13 -66
- package/chunks/{chunk-ADJD4LZF.js → chunk-MA5OUNN6.js} +1 -1
- package/chunks/{chunk-2RYWGYB3.js → chunk-MFYH2VXV.js} +3 -3
- package/chunks/{chunk-RPBMP6BN.js → chunk-MWIO7MF6.js} +3 -0
- package/chunks/{chunk-OECNP26L.js → chunk-N6S3NUYJ.js} +1 -1
- package/chunks/{chunk-5MTARK4Y.js → chunk-N7YQEKGX.js} +6 -6
- package/chunks/{chunk-XOVVCGZX.js → chunk-NB3NDQQK.js} +1 -1
- package/chunks/chunk-NOO4QFXM.js +171 -0
- package/chunks/{chunk-NGX4NUNP.js → chunk-O2FEO2CB.js} +131 -6
- package/chunks/{chunk-XHGGYCTA.js → chunk-O2JBJQCF.js} +1 -1
- package/chunks/{chunk-LPBQODMR.js → chunk-OESZTXTG.js} +4 -4
- package/chunks/{chunk-UKADFFL2.js → chunk-OFVAS4AR.js} +1 -1
- package/chunks/{chunk-TDP7UULF.js → chunk-OPMKGOLD.js} +1 -1
- package/chunks/{chunk-LDS57224.js → chunk-OWCFKIFQ.js} +1 -1
- package/chunks/{chunk-I72PHOKL.js → chunk-PDUMGZ2P.js} +1524 -1382
- package/chunks/{chunk-JRYL3T2O.js → chunk-PQSCGZT2.js} +1 -1
- package/chunks/{chunk-WEXA2DNG.js → chunk-PSPAM24S.js} +14 -0
- package/chunks/{chunk-UKKYOIVT.js → chunk-QAZ2MGYT.js} +2 -2
- package/chunks/{chunk-J3O5I5ZD.js → chunk-QK4K76T6.js} +3 -3
- package/chunks/{chunk-NUQFUXOG.js → chunk-QTNCGZHQ.js} +2 -0
- package/chunks/{chunk-5YY5MZT6.js → chunk-QZOXVQPK.js} +1 -1
- package/chunks/{chunk-QJVZLILI.js → chunk-R7OO56VZ.js} +1 -1
- package/chunks/{chunk-IQN2CCIE.js → chunk-RNYENHN5.js} +398 -55
- package/chunks/{chunk-64MQTIX7.js → chunk-RPFJJ33Z.js} +2 -2
- package/chunks/{chunk-4VZCORNT.js → chunk-RXT4QBDX.js} +1 -1
- package/chunks/{chunk-SN5FV4FY.js → chunk-S6QVI3MV.js} +3 -3
- package/chunks/{chunk-NXWYCSPL.js → chunk-SOA4HKRJ.js} +1 -1
- package/chunks/{chunk-JLWFGYXU.js → chunk-T2IHCZLS.js} +2 -2
- package/chunks/{chunk-DNPHKA72.js → chunk-TGC4264Q.js} +6 -6
- package/chunks/{chunk-PZV2FASB.js → chunk-TRWQQBVH.js} +1 -1
- package/chunks/{chunk-Y3ZKI4RQ.js → chunk-TWAMIEQ2.js} +85 -22
- package/chunks/{chunk-KK2GZGBK.js → chunk-TWWS7XUW.js} +14 -11
- package/chunks/{chunk-4IQKBLTQ.js → chunk-UHUT4IDM.js} +18 -9
- package/chunks/{chunk-BKNY7PDI.js → chunk-USN6VNTO.js} +1 -1
- package/chunks/{chunk-TMWB67LS.js → chunk-UXDVUFKU.js} +3 -3
- package/chunks/{chunk-HY3DXYZK.js → chunk-UYDQYDW2.js} +1 -1
- package/chunks/{chunk-3K456UJF.js → chunk-VF6D6EGV.js} +12 -4
- package/chunks/{chunk-PZUOHCWI.js → chunk-WAASYFPK.js} +2 -2
- package/chunks/{chunk-OHOO527W.js → chunk-WG7BL3FY.js} +52 -2
- package/chunks/{chunk-JPEAQJNS.js → chunk-WJDXKQIO.js} +1 -1
- package/chunks/{chunk-MNEYUNOE.js → chunk-WNISCNTA.js} +40 -2
- package/chunks/{chunk-Z6WZPXQH.js → chunk-WQMUGQ6G.js} +2 -2
- package/chunks/{chunk-N7VURC4O.js → chunk-WXFCI3O5.js} +2 -2
- package/chunks/{chunk-VU7O7CGQ.js → chunk-XDNFODER.js} +1 -1
- package/chunks/{chunk-N7EYO2E7.js → chunk-XQ4RDO5B.js} +1 -1
- package/chunks/{chunk-VDXYYVCD.js → chunk-XVTCSVBK.js} +579 -57
- package/chunks/{chunk-PTFFWTTO.js → chunk-XZ3Z43XL.js} +3 -3
- package/chunks/{chunk-QSC5YOEC.js → chunk-YAC7H4K3.js} +2 -2
- package/chunks/{chunk-43JNQAHO.js → chunk-YCEKI7QX.js} +51 -10
- package/chunks/{chunk-7IKXTGZT.js → chunk-YI2YCNSP.js} +1 -1
- package/chunks/{chunk-VUSSAGKI.js → chunk-YZTGGCEE.js} +10 -2
- package/chunks/{chunk-WR3SH3EY.js → chunk-ZNO5BUAD.js} +149 -66
- package/chunks/{chunk-URSCX7S7.js → chunk-ZPL2TZNA.js} +353 -11
- package/chunks/{chunk-UEZOXZNI.js → chunk-ZU2T5JIS.js} +804 -371
- package/chunks/{config-utils-QXDOTXEQ.js → config-utils-KTDSQ4MU.js} +39 -40
- package/chunks/{contextCommand-RN4KARWC.js → contextCommand-UQ3KRYGK.js} +37 -38
- package/chunks/{core-runtime-NAZCOKHB.js → core-runtime-JR34JAFH.js} +35 -36
- package/chunks/{create-sub-session-BCSM4WKB.js → create-sub-session-RGPJOI4S.js} +45 -40
- 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-LCUELM6E.js → daemon-UI6SQSBV.js} +1 -1
- package/chunks/{daemon-git-worktree-guard-3K5CAU36.js → daemon-git-worktree-guard-H3OA26KQ.js} +35 -36
- package/chunks/{daemon-status-provider-4X3ZZQTZ.js → daemon-status-provider-6WZLKSZU.js} +45 -46
- package/chunks/{daemon-trust-policy-R45CFUJA.js → daemon-trust-policy-3EDP2BYD.js} +42 -43
- package/chunks/{daemon-trust-policy-monitor-DSSFCO3K.js → daemon-trust-policy-monitor-CRHZPK52.js} +42 -43
- package/chunks/{deferred-core-runtime-UO2M6WYI.js → deferred-core-runtime-LO5NTQQ4.js} +35 -36
- package/chunks/{discovery-TUM3ZQ6U.js → discovery-XP4RMDUM.js} +4 -2
- package/chunks/{display-image-EVVTBVYE.js → display-image-CTNHJRZC.js} +4 -4
- package/chunks/{dist-SIHF5MU2.js → dist-24TCWK5H.js} +1 -1
- package/chunks/{dist-AFH3BMZZ.js → dist-5I4HLUTO.js} +1 -1
- package/chunks/{dist-3T5MDUHP.js → dist-FDISN4AK.js} +1 -1
- package/chunks/{dist-SB2XRXZA.js → dist-M4CBX53H.js} +1 -1
- package/chunks/{dist-UVHW2U56.js → dist-NQ2636VT.js} +1 -1
- package/chunks/{dist-PH5RSTEA.js → dist-OR2ZQTXZ.js} +1 -1
- package/chunks/{dist-MK5PPBRF.js → dist-STAGIFNB.js} +1099 -67
- package/chunks/{dist-R5Y34V6T.js → dist-WZTUKIDR.js} +2 -2
- package/chunks/{dist-QUU7TVE3.js → dist-XJ25G6OH.js} +1 -1
- package/chunks/{edit-VNBCTRWP.js → edit-LB7Z7XK5.js} +24 -25
- package/chunks/{en-JMR535HP.js → en-YJNRUQG4.js} +1 -1
- package/chunks/{enter-worktree-CEVK7MQ2.js → enter-worktree-YFTKHXHZ.js} +4 -4
- package/chunks/{enterPlanMode-4KMZMUIA.js → enterPlanMode-P6TVUFIY.js} +24 -25
- package/chunks/{environment-S2HYQDON.js → environment-QATJNNKI.js} +38 -39
- package/chunks/{errors-DAAN5TL7.js → errors-3XJ37PS2.js} +37 -38
- package/chunks/{exit-worktree-D3YE6MUN.js → exit-worktree-NF2XEMES.js} +5 -5
- package/chunks/{exitPlanMode-HR36HG3D.js → exitPlanMode-A3OKL5UO.js} +24 -25
- package/chunks/{fast-path-4IWSW3UV.js → fast-path-DBIT5YQQ.js} +3 -3
- package/chunks/{fast-path-settings-ISEJPRYE.js → fast-path-settings-SATXY3PD.js} +3 -3
- package/chunks/{glob-IZYB2XH2.js → glob-73EDTXUE.js} +24 -25
- package/chunks/{goal-tools-VGUPKQDJ.js → goal-tools-DFI6YMSD.js} +24 -25
- package/chunks/{grep-OUVLNXG7.js → grep-BLHF2S5D.js} +2 -2
- package/chunks/{handleAutoUpdate-D56FMDTW.js → handleAutoUpdate-2FUNJO3B.js} +38 -39
- package/chunks/{i18n-BKE5WO6T.js → i18n-FDIA6KFI.js} +38 -37
- package/chunks/{image-gen-SHVQ3XID.js → image-gen-XP4NNIYG.js} +5 -5
- package/chunks/{initializer-MS4SGEHF.js → initializer-4MJTJOTW.js} +42 -43
- package/chunks/{installationInfo-542MGC4S.js → installationInfo-232RA2OK.js} +35 -36
- package/chunks/{list-H6XTKUWL.js → list-WN6WSGEB.js} +45 -46
- package/chunks/{list-agents-ULYBGJXC.js → list-agents-I5TRH3J7.js} +2 -2
- package/chunks/{llm-3NUC4EJY.js → llm-UDFWQWZA.js} +77 -78
- package/chunks/{llm-content-generator-R4NL3OQN.js → llm-content-generator-VLMZ2A7A.js} +23 -8
- package/chunks/{loadedSettingsAdapter-3XLKYDVT.js → loadedSettingsAdapter-OBQEIXM7.js} +42 -43
- package/chunks/{loggingContentGenerator-ZYSWVNEO.js → loggingContentGenerator-RGVUMUVX.js} +26 -27
- 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-QBAJYCFU.js} +35 -36
- package/chunks/{mcp-4PIXQASW.js → mcp-OTIZZCPY.js} +42 -43
- package/chunks/{monitor-O2YQTOZZ.js → monitor-BV5XF6LL.js} +24 -25
- package/chunks/{nonInteractiveCli-LV7CDBA2.js → nonInteractiveCli-W6MUKDVJ.js} +79 -77
- package/chunks/{notebook-edit-4RE2ALH4.js → notebook-edit-HGBEKGTE.js} +24 -25
- package/chunks/{openaiContentGenerator-7ND7K5CP.js → openaiContentGenerator-NSU3ERBH.js} +15 -15
- package/chunks/{pidfile-UFTLQ7NP.js → pidfile-LE3TU4GE.js} +35 -36
- package/chunks/{processUtils-3XBB4FYV.js → processUtils-YFBGJK67.js} +2 -2
- package/chunks/{prompt-terminal-ledger-2QASOGMM.js → prompt-terminal-ledger-4W4W7DSO.js} +36 -37
- package/chunks/{qwenContentGenerator-AELTUTH6.js → qwenContentGenerator-HTA57WFC.js} +28 -29
- package/chunks/{qwenOAuth2-BS5D2LYV.js → qwenOAuth2-KX6LVYQ3.js} +4 -4
- package/chunks/{read-file-PDWHZPHX.js → read-file-KHPQ2MB6.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-K7RV3QBN.js} +39 -40
- package/chunks/{ripGrep-KSOOLE6H.js → ripGrep-NBBVCMG4.js} +7 -7
- package/chunks/{run-qwen-serve-RTAREPT6.js → run-qwen-serve-A3JBOZCM.js} +58 -60
- package/chunks/{runtime-ESFSCJRZ.js → runtime-7YOU2KJ3.js} +47 -48
- package/chunks/{scheduled-tasks-6ZHRNBH6.js → scheduled-tasks-52LXK7LN.js} +42 -43
- package/chunks/{scheduler-DQI6KV7T.js → scheduler-J44M72VM.js} +37 -38
- package/chunks/{send-message-PQCVSVMN.js → send-message-AWKUDJBH.js} +8 -8
- package/chunks/{serve-FY7ZEW52.js → serve-TRC6XJUB.js} +42 -43
- package/chunks/{server-KNDY6K5F.js → server-YPNTJLX2.js} +1314 -841
- package/chunks/{session-MCEPXAZP.js → session-FMMIBFYX.js} +98 -84
- package/chunks/{session-attachments-root-OLNAE6GF.js → session-attachments-root-LDJMNK7K.js} +35 -36
- package/chunks/{session-pr-refresh-HKJHQQQK.js → session-pr-refresh-NLR4EK2J.js} +41 -42
- package/chunks/{settings-VXO4WBMK.js → settings-A46L577J.js} +41 -42
- package/chunks/{shell-U263OTES.js → shell-Q5LSQPPY.js} +24 -25
- package/chunks/{skill-SDODGBKL.js → skill-75KPJRCM.js} +10 -57
- package/chunks/{skill-settings-YEIA22QJ.js → skill-settings-775YT4YR.js} +41 -42
- package/chunks/{spawnChannel-4WJZVFPP.js → spawnChannel-XY73I5CU.js} +37 -38
- package/chunks/{standalone-update-ZWVQUO64.js → standalone-update-L46XXNQ2.js} +37 -38
- package/chunks/{start-opentui-ui-BFYCJQRZ.js → start-opentui-ui-WLV43247.js} +2007 -1003
- package/chunks/{startInteractiveUI-JYAFCMHL.js → startInteractiveUI-F5DKMLOV.js} +1231 -1528
- 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-2PATB77U.js} +24 -25
- package/chunks/{team-delete-XFRRTJTT.js → team-delete-CBHVBTPB.js} +1 -1
- package/chunks/{team-plan-approval-DPB377A3.js → team-plan-approval-QTANEWOS.js} +24 -25
- package/chunks/{terminal-image-renderer-WGWRENOF.js → terminal-image-renderer-OGULCFNF.js} +37 -38
- package/chunks/{theme-manager-GBUFULSO.js → theme-manager-CNO3QERP.js} +35 -36
- package/chunks/{todoWrite-G7NT4IFP.js → todoWrite-5ERKFWAK.js} +3 -5
- package/chunks/{tool-search-6YUXHBPT.js → tool-search-VXWEOZE7.js} +9 -9
- package/chunks/{total-session-admission-54R2JQ5L.js → total-session-admission-4KAADZPB.js} +41 -42
- package/chunks/{trustedFolders-KAJIDJTH.js → trustedFolders-PPJSOPOT.js} +36 -37
- package/chunks/{update-relaunch-XM4IWBFD.js → update-relaunch-4PT4MW7B.js} +5 -5
- package/chunks/{updateCheck-W6UZFURI.js → updateCheck-WAVFLWNG.js} +37 -38
- package/chunks/{useAutoAcceptIndicator-LAWYHY3U.js → useAutoAcceptIndicator-XNED4NRB.js} +44 -45
- package/chunks/{validateNonInterActiveAuth-7WCKHRN2.js → validateNonInterActiveAuth-J676DUQ2.js} +74 -74
- package/chunks/{version-3ZU43RJ6.js → version-J6SRRQB2.js} +1 -1
- package/chunks/{web-fetch-QHI2SQL4.js → web-fetch-FMZZYX44.js} +7 -7
- package/chunks/{web-search-3KZZKWNY.js → web-search-3G2KXCX5.js} +19 -8
- package/chunks/{workflow-HRW7Y2X4.js → workflow-PPZZICQ7.js} +26 -27
- package/chunks/{workspace-providers-status-KTGCWCPC.js → workspace-providers-status-IIYTAQST.js} +46 -47
- package/chunks/{workspace-registration-store-LHLPPWNE.js → workspace-registration-store-VHCDXAV7.js} +1 -1
- package/chunks/{workspace-registry-X34MLN52.js → workspace-registry-I7VQIPS2.js} +41 -42
- package/chunks/{workspace-runtime-coordinator-U4PW4P7K.js → workspace-runtime-coordinator-DBGNY32G.js} +41 -42
- package/chunks/{workspace-service-KD7BCGYL.js → workspace-service-QSKB2T54.js} +47 -48
- package/chunks/{workspace-skills-status-YJGO6Y3T.js → workspace-skills-status-T7GPT65J.js} +43 -44
- package/chunks/{workspace-trust-reconciler-EUYHISCH.js → workspace-trust-reconciler-2PKRDAU4.js} +48 -49
- package/chunks/{write-file-EBSB34NJ.js → write-file-L76CGFTQ.js} +26 -27
- 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-TDJJY2VZ.js} +4 -4
- package/cli.js +13 -13
- package/export-transcript-document.js +126 -122
- 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-DHc6plZn.js} +1 -1
- package/web-shell/assets/{arc-tYLobxFi.js → arc-BQ9m8TDV.js} +1 -1
- package/web-shell/assets/{architectureDiagram-5GKGNRK7-IG6aXD03.js → architectureDiagram-5GKGNRK7-D5ap3oVB.js} +1 -1
- package/web-shell/assets/{blockDiagram-NRAW4CY4-C6eBSkfA.js → blockDiagram-NRAW4CY4-BIbnyNph.js} +1 -1
- package/web-shell/assets/{c4Diagram-UCG6FXSJ-BrX3HJqB.js → c4Diagram-UCG6FXSJ-BRsdx_iG.js} +1 -1
- package/web-shell/assets/channel-uMMdTrYk.js +1 -0
- package/web-shell/assets/{chunk-2Q5K7J3B-B3fcJ8ee.js → chunk-2Q5K7J3B-3lf1fNlx.js} +1 -1
- package/web-shell/assets/{chunk-5VM5RSS4-CeC90yKM.js → chunk-5VM5RSS4-DP8VNRc4.js} +1 -1
- package/web-shell/assets/{chunk-F27PBJKO-CW44RVki.js → chunk-F27PBJKO-DrohDmZ6.js} +1 -1
- package/web-shell/assets/{chunk-G27WJ6UU-D1PAMukD.js → chunk-G27WJ6UU-UZ2QhSx6.js} +1 -1
- package/web-shell/assets/{chunk-JWPE2WC7-Dt3Y2Fvx.js → chunk-JWPE2WC7-BIMHVcZK.js} +1 -1
- package/web-shell/assets/{chunk-LCL6LL3I-CZHw2lLI.js → chunk-LCL6LL3I-izRxdSDd.js} +1 -1
- package/web-shell/assets/{chunk-POPQ4Y6H-ysNAdTGx.js → chunk-POPQ4Y6H-CXADD4PP.js} +1 -1
- package/web-shell/assets/{chunk-SVP7TREG-BdNXW6YQ.js → chunk-SVP7TREG-B96d8Y_1.js} +1 -1
- package/web-shell/assets/{chunk-XXDRQBXY-DgqQ9UA8.js → chunk-XXDRQBXY-CF2sVQpv.js} +1 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-DcY-26Ig.js +1 -0
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-DcY-26Ig.js +1 -0
- package/web-shell/assets/{cose-bilkent-JH36ORCC-BILImXzJ.js → cose-bilkent-JH36ORCC-CT6tXVAS.js} +1 -1
- package/web-shell/assets/csv-CX7rUNeC.svg +1 -0
- package/web-shell/assets/{cynefin-OW5HDTMX-DR88Pund.js → cynefin-OW5HDTMX-X1NS4vtV.js} +1 -1
- package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-BYFbfkA6.js → cynefinDiagram-5FMLGOSQ-DNsKNOT4.js} +1 -1
- package/web-shell/assets/{dagre-3AP2YEHR-rfpyc6sX.js → dagre-3AP2YEHR-9-AHKqsb.js} +1 -1
- package/web-shell/assets/{diagram-S7CK7UJ4-BJxLmEwH.js → diagram-S7CK7UJ4-Bjgms7j6.js} +1 -1
- package/web-shell/assets/{diagram-UQ7AKVKN-H34xm7k3.js → diagram-UQ7AKVKN-h6bCprbE.js} +1 -1
- package/web-shell/assets/{diagram-VSXAHHWV-HYxhwNLx.js → diagram-VSXAHHWV-4SbQXVLt.js} +1 -1
- package/web-shell/assets/{diagram-VX7I27RA-BJazso8F.js → diagram-VX7I27RA-B5gPCzzB.js} +1 -1
- package/web-shell/assets/{diagram-Z3DM3KII-Clje1aNy.js → diagram-Z3DM3KII-DFJXIA3A.js} +1 -1
- package/web-shell/assets/{ebnfDiagram-PWID7BFC-M93YBkFh.js → ebnfDiagram-PWID7BFC-FwyaU7VY.js} +1 -1
- package/web-shell/assets/{erDiagram-SSCWMZ5O-DY8XzSHU.js → erDiagram-SSCWMZ5O-8vJQh2te.js} +1 -1
- package/web-shell/assets/{flowDiagram-A5DVABFB-CE6Aylcq.js → flowDiagram-A5DVABFB-BzA_1gMN.js} +1 -1
- package/web-shell/assets/{ganttDiagram-EL5Y4UJY-DI-5LL22.js → ganttDiagram-EL5Y4UJY-Co-ABbVX.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-C7BZWElk.js → gitGraphDiagram-WWUBYQGX-DW_FcyrX.js} +1 -1
- package/web-shell/assets/{index-DclFHns9.js → index-BbMXfhNG.js} +1 -1
- package/web-shell/assets/{index-CVyqwW7y.js → index-Bu-rZoJ-.js} +483 -475
- package/web-shell/assets/index-CsPwZ1ut.css +36 -0
- package/web-shell/assets/{infoDiagram-RXCK75RN-CGUSy4Pc.js → infoDiagram-RXCK75RN-BEgfhUFN.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-5VMMS53U-B5BVks9q.js → ishikawaDiagram-5VMMS53U-DCsMxQmc.js} +1 -1
- package/web-shell/assets/{journeyDiagram-EYS64GPL-CFh6Tf7h.js → journeyDiagram-EYS64GPL-DyIEYoHz.js} +1 -1
- package/web-shell/assets/{kanban-definition-3QL26DDD-B7TlxP7c.js → kanban-definition-3QL26DDD-CkxjqCNr.js} +1 -1
- package/web-shell/assets/{layout-Br_pZq2Q.js → layout-BEWc0Al9.js} +1 -1
- package/web-shell/assets/{linear-BVlP6fte.js → linear-CNuNxirL.js} +1 -1
- package/web-shell/assets/{mermaid.core-TrcYWoiF.js → mermaid.core-DZBre674.js} +6 -6
- package/web-shell/assets/{mindmap-definition-FBJOCRG2-BJ4LzqjZ.js → mindmap-definition-FBJOCRG2-CpafFz_F.js} +1 -1
- package/web-shell/assets/{pegDiagram-XKGWAZYB-1b_MxlOl.js → pegDiagram-XKGWAZYB-DfZqk_dq.js} +1 -1
- package/web-shell/assets/{pieDiagram-E7YTZNPT-B8zl0YhY.js → pieDiagram-E7YTZNPT-S0UWXlgC.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-AXDQQJYC-CIZO8ukl.js → quadrantDiagram-AXDQQJYC-dd37_Ohj.js} +1 -1
- package/web-shell/assets/{railroadDiagram-O6MQD6OU-CepHSbCj.js → railroadDiagram-O6MQD6OU-CH8NJZ7u.js} +1 -1
- package/web-shell/assets/{requirementDiagram-EFPCY7ZU-BCgxkcSW.js → requirementDiagram-EFPCY7ZU-CFdqWYih.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-P5KCCOFB-CE5CcoMM.js → sankeyDiagram-P5KCCOFB-CsddcEGD.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-DvgHi-d5.js → sequenceDiagram-WJ2MYXX4-BZ270mGw.js} +1 -1
- package/web-shell/assets/{sizeCapture-X5ZJPWSS-T-fAsCPX.js → sizeCapture-X5ZJPWSS-CGaS4DBV.js} +1 -1
- package/web-shell/assets/{stateDiagram-HBIQ2CUA-DYHaul-5.js → stateDiagram-HBIQ2CUA-COpIzMu6.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-D6qEVAji.js +1 -0
- package/web-shell/assets/{swimlanes-XN3QIQJK-Dbz3Qiej.js → swimlanes-XN3QIQJK-CMF889m3.js} +1 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-mem5Jj4m.js +8 -0
- package/web-shell/assets/{timeline-definition-24CTP7MA-9NVRts3N.js → timeline-definition-24CTP7MA-BelnxYz5.js} +1 -1
- package/web-shell/assets/{vennDiagram-4TSXK5OY-C7cb7vnH.js → vennDiagram-4TSXK5OY-CU-NRqIB.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-VM6X3IG4-CG-8Ddjm.js → wardleyDiagram-VM6X3IG4-CDNKqWh-.js} +1 -1
- package/web-shell/assets/{xychartDiagram-S5SC5T6Z-iGeYAcP4.js → xychartDiagram-S5SC5T6Z-CLqguL5D.js} +1 -1
- package/web-shell/index.html +6 -3
- package/chunks/chunk-3UMWOKJC.js +0 -78
- package/chunks/chunk-FKJM6JKY.js +0 -98
- package/chunks/chunk-IQAFKVXS.js +0 -22
- 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-PDUMGZ2P.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,17 +102,17 @@ 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-3LPJ776W.js";
|
|
112
113
|
import {
|
|
113
114
|
fetchWithPolicy
|
|
114
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-OFVAS4AR.js";
|
|
115
116
|
import {
|
|
116
117
|
COMBINED_PASS_TOLERANCE_FACTOR,
|
|
117
118
|
TOOL_OUTPUT_TRUNCATED_PREFIX,
|
|
@@ -120,7 +121,7 @@ import {
|
|
|
120
121
|
removeMCPStatusChangeListener,
|
|
121
122
|
runSideQuery,
|
|
122
123
|
updateMCPServerStatus
|
|
123
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-6QV7Z74P.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
|
]);
|
|
@@ -3290,6 +3293,7 @@ function specToModelConfig(spec, prefix, baseUrl, envKey) {
|
|
|
3290
3293
|
id: spec.id,
|
|
3291
3294
|
name: prefix ? `[${prefix}] ${spec.id}` : spec.id,
|
|
3292
3295
|
...spec.description ? { description: spec.description } : {},
|
|
3296
|
+
...spec.capabilities ? { capabilities: spec.capabilities } : {},
|
|
3293
3297
|
baseUrl,
|
|
3294
3298
|
envKey,
|
|
3295
3299
|
...spec.supportsImageGeneration ? { supportsImageGeneration: true } : {},
|
|
@@ -3324,11 +3328,16 @@ function buildModelConfigs(config, inputs) {
|
|
|
3324
3328
|
(spec) => specToModelConfig(spec, prefix, inputs.baseUrl, envKey)
|
|
3325
3329
|
);
|
|
3326
3330
|
} else if (config.models && config.modelsEditable) {
|
|
3327
|
-
const specMap = new Map(config.models.map((s) => [s.id, s]));
|
|
3331
|
+
const specMap = new Map(config.models.map((s) => [s.id.toLowerCase(), s]));
|
|
3328
3332
|
models = inputs.modelIds.map((id) => {
|
|
3329
|
-
const spec = specMap.get(id);
|
|
3333
|
+
const spec = specMap.get(id.toLowerCase());
|
|
3330
3334
|
if (spec) {
|
|
3331
|
-
return specToModelConfig(
|
|
3335
|
+
return specToModelConfig(
|
|
3336
|
+
{ ...spec, id },
|
|
3337
|
+
prefix,
|
|
3338
|
+
inputs.baseUrl,
|
|
3339
|
+
envKey
|
|
3340
|
+
);
|
|
3332
3341
|
}
|
|
3333
3342
|
const genConfig = buildAdvancedGenerationConfig(inputs.advancedConfig);
|
|
3334
3343
|
return {
|
|
@@ -3838,7 +3847,14 @@ var deepseekProvider = {
|
|
|
3838
3847
|
{
|
|
3839
3848
|
id: "deepseek-v4-pro",
|
|
3840
3849
|
contextWindowSize: 1e6,
|
|
3841
|
-
|
|
3850
|
+
capabilities: {
|
|
3851
|
+
reasoning: {
|
|
3852
|
+
thinking: true,
|
|
3853
|
+
efforts: ["high", "max"],
|
|
3854
|
+
defaultEffort: "high",
|
|
3855
|
+
disableField: "thinking"
|
|
3856
|
+
}
|
|
3857
|
+
}
|
|
3842
3858
|
},
|
|
3843
3859
|
{ id: "deepseek-v4-flash", contextWindowSize: 1e6 }
|
|
3844
3860
|
],
|
|
@@ -4986,7 +5002,30 @@ async function bindAt(requestedPath, options, automaticPath) {
|
|
|
4986
5002
|
}, "arm");
|
|
4987
5003
|
arm();
|
|
4988
5004
|
let authed = options.requiredToken === void 0;
|
|
4989
|
-
let
|
|
5005
|
+
let credential;
|
|
5006
|
+
let controllerToken;
|
|
5007
|
+
let controllerDeadline = null;
|
|
5008
|
+
const armControllerRevalidation = /* @__PURE__ */ __name(() => {
|
|
5009
|
+
if (controllerDeadline) clearTimeout(controllerDeadline);
|
|
5010
|
+
controllerDeadline = setTimeout(() => {
|
|
5011
|
+
controllerDeadline = null;
|
|
5012
|
+
if (refused || credential?.kind !== "controller" || controllerToken === void 0) {
|
|
5013
|
+
return;
|
|
5014
|
+
}
|
|
5015
|
+
const controller = resolveController(options, controllerToken);
|
|
5016
|
+
if (!controller) {
|
|
5017
|
+
debugLogger6.debug(
|
|
5018
|
+
"dropping a controller connection whose grant was revoked"
|
|
5019
|
+
);
|
|
5020
|
+
refused = true;
|
|
5021
|
+
socket.destroy();
|
|
5022
|
+
return;
|
|
5023
|
+
}
|
|
5024
|
+
credential = { kind: "controller", controller };
|
|
5025
|
+
armControllerRevalidation();
|
|
5026
|
+
}, lineDeadlineMs);
|
|
5027
|
+
controllerDeadline.unref();
|
|
5028
|
+
}, "armControllerRevalidation");
|
|
4990
5029
|
let refused = false;
|
|
4991
5030
|
const read2 = createLineReader(
|
|
4992
5031
|
(line) => {
|
|
@@ -4995,10 +5034,14 @@ async function bindAt(requestedPath, options, automaticPath) {
|
|
|
4995
5034
|
arm();
|
|
4996
5035
|
const presented = parsePeerAuthLine(line);
|
|
4997
5036
|
if (presented !== null) {
|
|
4998
|
-
|
|
5037
|
+
credential = authKindOf(options, presented);
|
|
4999
5038
|
}
|
|
5000
|
-
if (
|
|
5039
|
+
if (credential !== void 0) {
|
|
5001
5040
|
authed = true;
|
|
5041
|
+
if (credential.kind === "controller") {
|
|
5042
|
+
controllerToken = presented ?? void 0;
|
|
5043
|
+
armControllerRevalidation();
|
|
5044
|
+
}
|
|
5002
5045
|
return;
|
|
5003
5046
|
}
|
|
5004
5047
|
debugLogger6.debug(
|
|
@@ -5017,7 +5060,7 @@ async function bindAt(requestedPath, options, automaticPath) {
|
|
|
5017
5060
|
}
|
|
5018
5061
|
arm();
|
|
5019
5062
|
try {
|
|
5020
|
-
options.onFrame(frame,
|
|
5063
|
+
options.onFrame(frame, credential?.kind, credential?.controller);
|
|
5021
5064
|
} catch (error) {
|
|
5022
5065
|
debugLogger6.error(`onFrame threw: ${describe(error)}`);
|
|
5023
5066
|
}
|
|
@@ -5039,6 +5082,8 @@ async function bindAt(requestedPath, options, automaticPath) {
|
|
|
5039
5082
|
socket.on("close", () => {
|
|
5040
5083
|
if (deadline) clearTimeout(deadline);
|
|
5041
5084
|
deadline = null;
|
|
5085
|
+
if (controllerDeadline) clearTimeout(controllerDeadline);
|
|
5086
|
+
controllerDeadline = null;
|
|
5042
5087
|
connections.delete(socket);
|
|
5043
5088
|
});
|
|
5044
5089
|
});
|
|
@@ -5046,11 +5091,11 @@ async function bindAt(requestedPath, options, automaticPath) {
|
|
|
5046
5091
|
server.on("error", (error) => {
|
|
5047
5092
|
debugLogger6.error(`peer inbox server error: ${describe(error)}`);
|
|
5048
5093
|
});
|
|
5049
|
-
const listenAt = /* @__PURE__ */ __name((target) => new Promise((
|
|
5094
|
+
const listenAt = /* @__PURE__ */ __name((target) => new Promise((resolve7, reject) => {
|
|
5050
5095
|
server.once("error", reject);
|
|
5051
5096
|
server.listen(target, () => {
|
|
5052
5097
|
server.removeListener("error", reject);
|
|
5053
|
-
|
|
5098
|
+
resolve7();
|
|
5054
5099
|
});
|
|
5055
5100
|
}), "listenAt");
|
|
5056
5101
|
try {
|
|
@@ -5110,7 +5155,7 @@ async function bindAt(requestedPath, options, automaticPath) {
|
|
|
5110
5155
|
closed = true;
|
|
5111
5156
|
for (const socket of connections) socket.destroy();
|
|
5112
5157
|
connections.clear();
|
|
5113
|
-
await new Promise((
|
|
5158
|
+
await new Promise((resolve7) => server.close(() => resolve7()));
|
|
5114
5159
|
try {
|
|
5115
5160
|
await fs.unlink(socketPath);
|
|
5116
5161
|
} catch {
|
|
@@ -5130,11 +5175,26 @@ __name(tokenMatches, "tokenMatches");
|
|
|
5130
5175
|
function authKindOf(options, presented) {
|
|
5131
5176
|
const peer = options.requiredToken !== void 0 && tokenMatches(options.requiredToken, presented);
|
|
5132
5177
|
const child = options.childToken !== void 0 && tokenMatches(options.childToken, presented);
|
|
5133
|
-
|
|
5134
|
-
if (
|
|
5178
|
+
const controller = resolveController(options, presented);
|
|
5179
|
+
if (peer) return { kind: "peer" };
|
|
5180
|
+
if (child) return { kind: "child" };
|
|
5181
|
+
if (controller) return { kind: "controller", controller };
|
|
5135
5182
|
return void 0;
|
|
5136
5183
|
}
|
|
5137
5184
|
__name(authKindOf, "authKindOf");
|
|
5185
|
+
function resolveController(options, presented) {
|
|
5186
|
+
try {
|
|
5187
|
+
return options.resolveController?.(presented);
|
|
5188
|
+
} catch (error) {
|
|
5189
|
+
debugLogger6.debug(
|
|
5190
|
+
`controller resolver threw (treating the token as unknown): ${describe(
|
|
5191
|
+
error
|
|
5192
|
+
)}`
|
|
5193
|
+
);
|
|
5194
|
+
return void 0;
|
|
5195
|
+
}
|
|
5196
|
+
}
|
|
5197
|
+
__name(resolveController, "resolveController");
|
|
5138
5198
|
function describe(error) {
|
|
5139
5199
|
return error instanceof Error ? `${error.name}: ${error.message}` : String(error);
|
|
5140
5200
|
}
|
|
@@ -6580,9 +6640,9 @@ function encodeInsightProgressMessage(stage, progress, detail) {
|
|
|
6580
6640
|
return JSON.stringify(payload);
|
|
6581
6641
|
}
|
|
6582
6642
|
__name(encodeInsightProgressMessage, "encodeInsightProgressMessage");
|
|
6583
|
-
function encodeInsightReadyMessage(
|
|
6643
|
+
function encodeInsightReadyMessage(path21) {
|
|
6584
6644
|
const payload = {
|
|
6585
|
-
insight_ready: { path:
|
|
6645
|
+
insight_ready: { path: path21 }
|
|
6586
6646
|
};
|
|
6587
6647
|
return JSON.stringify(payload);
|
|
6588
6648
|
}
|
|
@@ -6958,9 +7018,9 @@ var Logger = class {
|
|
|
6958
7018
|
);
|
|
6959
7019
|
return;
|
|
6960
7020
|
}
|
|
6961
|
-
const
|
|
7021
|
+
const path21 = this._checkpointPath(tag);
|
|
6962
7022
|
try {
|
|
6963
|
-
await atomicWriteFile(
|
|
7023
|
+
await atomicWriteFile(path21, JSON.stringify(conversation, null, 2), {
|
|
6964
7024
|
encoding: "utf-8"
|
|
6965
7025
|
});
|
|
6966
7026
|
} catch (error) {
|
|
@@ -6974,13 +7034,13 @@ var Logger = class {
|
|
|
6974
7034
|
);
|
|
6975
7035
|
return [];
|
|
6976
7036
|
}
|
|
6977
|
-
const
|
|
7037
|
+
const path21 = await this._getCheckpointPath(tag);
|
|
6978
7038
|
try {
|
|
6979
|
-
const fileContent = await fs3.readFile(
|
|
7039
|
+
const fileContent = await fs3.readFile(path21, "utf-8");
|
|
6980
7040
|
const parsedContent = JSON.parse(fileContent);
|
|
6981
7041
|
if (!Array.isArray(parsedContent)) {
|
|
6982
7042
|
this.debugLogger.warn(
|
|
6983
|
-
`Checkpoint file at ${
|
|
7043
|
+
`Checkpoint file at ${path21} is not a valid JSON array. Returning empty checkpoint.`
|
|
6984
7044
|
);
|
|
6985
7045
|
return [];
|
|
6986
7046
|
}
|
|
@@ -6991,7 +7051,7 @@ var Logger = class {
|
|
|
6991
7051
|
return [];
|
|
6992
7052
|
}
|
|
6993
7053
|
this.debugLogger.error(
|
|
6994
|
-
`Failed to read or parse checkpoint file ${
|
|
7054
|
+
`Failed to read or parse checkpoint file ${path21}:`,
|
|
6995
7055
|
error
|
|
6996
7056
|
);
|
|
6997
7057
|
return [];
|
|
@@ -7465,7 +7525,7 @@ var ClientMcpRegistrar = class {
|
|
|
7465
7525
|
}
|
|
7466
7526
|
return Promise.resolve(ack);
|
|
7467
7527
|
}
|
|
7468
|
-
return new Promise((
|
|
7528
|
+
return new Promise((resolve7, reject) => {
|
|
7469
7529
|
const timer = setTimeout(() => {
|
|
7470
7530
|
this.pending.delete(id);
|
|
7471
7531
|
reject(
|
|
@@ -7475,7 +7535,7 @@ var ClientMcpRegistrar = class {
|
|
|
7475
7535
|
);
|
|
7476
7536
|
}, this.messageTimeoutMs);
|
|
7477
7537
|
timer.unref?.();
|
|
7478
|
-
this.pending.set(id, { resolve:
|
|
7538
|
+
this.pending.set(id, { resolve: resolve7, reject, timer, server: serverName });
|
|
7479
7539
|
let sendResult;
|
|
7480
7540
|
try {
|
|
7481
7541
|
sendResult = this.sendFrame({
|
|
@@ -7720,12 +7780,377 @@ ${body}`;
|
|
|
7720
7780
|
}
|
|
7721
7781
|
};
|
|
7722
7782
|
|
|
7783
|
+
// packages/core/src/ipc/peer-controllers.ts
|
|
7784
|
+
init_esbuild_shims();
|
|
7785
|
+
var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
7786
|
+
import { createHash as createHash3, randomBytes as randomBytes2, timingSafeEqual as timingSafeEqual2 } from "node:crypto";
|
|
7787
|
+
import * as fsSync2 from "node:fs";
|
|
7788
|
+
import * as fs5 from "node:fs/promises";
|
|
7789
|
+
import * as path7 from "node:path";
|
|
7790
|
+
var debugLogger11 = createDebugLogger("PEER_CONTROLLERS");
|
|
7791
|
+
var PEER_CONTROLLER_SCHEMA_VERSION = 1;
|
|
7792
|
+
var CONTROLLER_TOKEN_PREFIX = "qpc_";
|
|
7793
|
+
var CONTROLLER_TOKEN_BYTES = 32;
|
|
7794
|
+
var MAX_PRESENTED_TOKEN_CHARS = 256;
|
|
7795
|
+
var MAX_CONTROLLER_LABEL_CHARS = 40;
|
|
7796
|
+
var MAX_CONTROLLERS = 32;
|
|
7797
|
+
var MAX_REGISTRY_BYTES = 64 * 1024;
|
|
7798
|
+
var REGISTRY_FILE_MODE = 384;
|
|
7799
|
+
var REGISTRY_DIRECTORY_MODE = 448;
|
|
7800
|
+
var LOCK_OPTIONS = {
|
|
7801
|
+
realpath: false,
|
|
7802
|
+
stale: 5e3,
|
|
7803
|
+
retries: {
|
|
7804
|
+
retries: 10,
|
|
7805
|
+
minTimeout: 5,
|
|
7806
|
+
maxTimeout: 100,
|
|
7807
|
+
factor: 2,
|
|
7808
|
+
randomize: true
|
|
7809
|
+
},
|
|
7810
|
+
onCompromised: /* @__PURE__ */ __name((error) => {
|
|
7811
|
+
debugLogger11.debug(
|
|
7812
|
+
`controller registry lock compromised: ${describe2(error)}`
|
|
7813
|
+
);
|
|
7814
|
+
}, "onCompromised")
|
|
7815
|
+
};
|
|
7816
|
+
var CONTROLLER_ID_RE = /^c_[0-9a-f]{8}$/;
|
|
7817
|
+
var TOKEN_HASH_RE = /^[0-9a-f]{64}$/;
|
|
7818
|
+
var PeerControllerError = class extends Error {
|
|
7819
|
+
constructor(message, code) {
|
|
7820
|
+
super(message);
|
|
7821
|
+
this.code = code;
|
|
7822
|
+
this.name = "PeerControllerError";
|
|
7823
|
+
}
|
|
7824
|
+
static {
|
|
7825
|
+
__name(this, "PeerControllerError");
|
|
7826
|
+
}
|
|
7827
|
+
};
|
|
7828
|
+
var defaultRegistryPath;
|
|
7829
|
+
function getPeerControllerRegistryPath() {
|
|
7830
|
+
defaultRegistryPath ??= path7.resolve(
|
|
7831
|
+
Storage.getGlobalQwenDir(),
|
|
7832
|
+
"peer-controllers.json"
|
|
7833
|
+
);
|
|
7834
|
+
return defaultRegistryPath;
|
|
7835
|
+
}
|
|
7836
|
+
__name(getPeerControllerRegistryPath, "getPeerControllerRegistryPath");
|
|
7837
|
+
function hashControllerToken(token) {
|
|
7838
|
+
return createHash3("sha256").update(token, "utf8").digest("hex");
|
|
7839
|
+
}
|
|
7840
|
+
__name(hashControllerToken, "hashControllerToken");
|
|
7841
|
+
function mintControllerToken() {
|
|
7842
|
+
return CONTROLLER_TOKEN_PREFIX + randomBytes2(CONTROLLER_TOKEN_BYTES).toString("hex");
|
|
7843
|
+
}
|
|
7844
|
+
__name(mintControllerToken, "mintControllerToken");
|
|
7845
|
+
function emptyRegistry() {
|
|
7846
|
+
return { schemaVersion: PEER_CONTROLLER_SCHEMA_VERSION, controllers: [] };
|
|
7847
|
+
}
|
|
7848
|
+
__name(emptyRegistry, "emptyRegistry");
|
|
7849
|
+
function describe2(error) {
|
|
7850
|
+
return error instanceof Error ? `${error.name}: ${error.message}` : String(error);
|
|
7851
|
+
}
|
|
7852
|
+
__name(describe2, "describe");
|
|
7853
|
+
function isRecord(value) {
|
|
7854
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7855
|
+
}
|
|
7856
|
+
__name(isRecord, "isRecord");
|
|
7857
|
+
function toValidRecord(value) {
|
|
7858
|
+
if (!isRecord(value)) return null;
|
|
7859
|
+
const { id, label, tokenHash, createdAt } = value;
|
|
7860
|
+
if (typeof id !== "string" || !CONTROLLER_ID_RE.test(id)) return null;
|
|
7861
|
+
if (typeof tokenHash !== "string" || !TOKEN_HASH_RE.test(tokenHash)) {
|
|
7862
|
+
return null;
|
|
7863
|
+
}
|
|
7864
|
+
if (typeof label !== "string") return null;
|
|
7865
|
+
const flattened = flattenPeerLabel(label);
|
|
7866
|
+
if (flattened.length === 0 || flattened.length > MAX_CONTROLLER_LABEL_CHARS) {
|
|
7867
|
+
return null;
|
|
7868
|
+
}
|
|
7869
|
+
if (typeof createdAt !== "number" || !Number.isFinite(createdAt)) return null;
|
|
7870
|
+
return { id, label: flattened, tokenHash, createdAt };
|
|
7871
|
+
}
|
|
7872
|
+
__name(toValidRecord, "toValidRecord");
|
|
7873
|
+
function readPeerControllerRegistrySync(filePath = getPeerControllerRegistryPath()) {
|
|
7874
|
+
let raw;
|
|
7875
|
+
try {
|
|
7876
|
+
const stats = fsSync2.lstatSync(filePath);
|
|
7877
|
+
if (!stats.isFile()) {
|
|
7878
|
+
debugLogger11.debug(
|
|
7879
|
+
`ignoring the controller registry at ${filePath}: not a regular file`
|
|
7880
|
+
);
|
|
7881
|
+
return emptyRegistry();
|
|
7882
|
+
}
|
|
7883
|
+
if (stats.size > MAX_REGISTRY_BYTES) {
|
|
7884
|
+
debugLogger11.debug(
|
|
7885
|
+
`ignoring the controller registry at ${filePath}: ${stats.size} bytes exceeds the ${MAX_REGISTRY_BYTES}-byte cap`
|
|
7886
|
+
);
|
|
7887
|
+
return emptyRegistry();
|
|
7888
|
+
}
|
|
7889
|
+
raw = fsSync2.readFileSync(filePath, "utf8");
|
|
7890
|
+
} catch (error) {
|
|
7891
|
+
if (!isNodeError(error) || error.code !== "ENOENT") {
|
|
7892
|
+
debugLogger11.debug(
|
|
7893
|
+
`could not read the controller registry at ${filePath}: ${describe2(error)}`
|
|
7894
|
+
);
|
|
7895
|
+
}
|
|
7896
|
+
return emptyRegistry();
|
|
7897
|
+
}
|
|
7898
|
+
let parsed;
|
|
7899
|
+
try {
|
|
7900
|
+
parsed = JSON.parse(raw);
|
|
7901
|
+
} catch (error) {
|
|
7902
|
+
debugLogger11.debug(
|
|
7903
|
+
`the controller registry at ${filePath} is not JSON: ${describe2(error)}`
|
|
7904
|
+
);
|
|
7905
|
+
return emptyRegistry();
|
|
7906
|
+
}
|
|
7907
|
+
if (!isRecord(parsed)) return emptyRegistry();
|
|
7908
|
+
if (parsed["schemaVersion"] !== PEER_CONTROLLER_SCHEMA_VERSION) {
|
|
7909
|
+
debugLogger11.debug(
|
|
7910
|
+
`ignoring the controller registry at ${filePath}: unsupported schemaVersion ${String(
|
|
7911
|
+
parsed["schemaVersion"]
|
|
7912
|
+
)}`
|
|
7913
|
+
);
|
|
7914
|
+
return emptyRegistry();
|
|
7915
|
+
}
|
|
7916
|
+
const controllers = parsed["controllers"];
|
|
7917
|
+
if (!Array.isArray(controllers)) return emptyRegistry();
|
|
7918
|
+
const valid = [];
|
|
7919
|
+
for (const entry of controllers) {
|
|
7920
|
+
const record = toValidRecord(entry);
|
|
7921
|
+
if (record === null) {
|
|
7922
|
+
debugLogger11.debug(
|
|
7923
|
+
`skipping a malformed entry in the controller registry at ${filePath}`
|
|
7924
|
+
);
|
|
7925
|
+
continue;
|
|
7926
|
+
}
|
|
7927
|
+
valid.push(record);
|
|
7928
|
+
}
|
|
7929
|
+
return { schemaVersion: PEER_CONTROLLER_SCHEMA_VERSION, controllers: valid };
|
|
7930
|
+
}
|
|
7931
|
+
__name(readPeerControllerRegistrySync, "readPeerControllerRegistrySync");
|
|
7932
|
+
function matchControllerToken(registry, presented) {
|
|
7933
|
+
if (!isPresentableControllerToken(presented)) return void 0;
|
|
7934
|
+
const presentedHash = Buffer.from(hashControllerToken(presented), "hex");
|
|
7935
|
+
let matched;
|
|
7936
|
+
for (const record of registry.controllers) {
|
|
7937
|
+
const candidate = Buffer.from(record.tokenHash, "hex");
|
|
7938
|
+
if (candidate.length === presentedHash.length && timingSafeEqual2(candidate, presentedHash)) {
|
|
7939
|
+
matched = { id: record.id, label: record.label };
|
|
7940
|
+
}
|
|
7941
|
+
}
|
|
7942
|
+
return matched;
|
|
7943
|
+
}
|
|
7944
|
+
__name(matchControllerToken, "matchControllerToken");
|
|
7945
|
+
function isPresentableControllerToken(presented) {
|
|
7946
|
+
return presented.length <= MAX_PRESENTED_TOKEN_CHARS && presented.startsWith(CONTROLLER_TOKEN_PREFIX);
|
|
7947
|
+
}
|
|
7948
|
+
__name(isPresentableControllerToken, "isPresentableControllerToken");
|
|
7949
|
+
function resolveControllerToken(presented, filePath) {
|
|
7950
|
+
if (!isPresentableControllerToken(presented)) return void 0;
|
|
7951
|
+
return matchControllerToken(
|
|
7952
|
+
readPeerControllerRegistrySync(filePath),
|
|
7953
|
+
presented
|
|
7954
|
+
);
|
|
7955
|
+
}
|
|
7956
|
+
__name(resolveControllerToken, "resolveControllerToken");
|
|
7957
|
+
async function assertWritablePath(filePath) {
|
|
7958
|
+
try {
|
|
7959
|
+
const stats = await fs5.lstat(filePath);
|
|
7960
|
+
if (!stats.isFile()) {
|
|
7961
|
+
throw new PeerControllerError(
|
|
7962
|
+
`${filePath} is not a regular file; move it aside first.`,
|
|
7963
|
+
"unsafe-path"
|
|
7964
|
+
);
|
|
7965
|
+
}
|
|
7966
|
+
} catch (error) {
|
|
7967
|
+
if (error instanceof PeerControllerError) throw error;
|
|
7968
|
+
if (isNodeError(error) && error.code === "ENOENT") return;
|
|
7969
|
+
throw error;
|
|
7970
|
+
}
|
|
7971
|
+
}
|
|
7972
|
+
__name(assertWritablePath, "assertWritablePath");
|
|
7973
|
+
async function writeRegistry(filePath, registry) {
|
|
7974
|
+
await assertWritablePath(filePath);
|
|
7975
|
+
await atomicWriteJSON(filePath, registry, {
|
|
7976
|
+
mode: REGISTRY_FILE_MODE,
|
|
7977
|
+
// The file holds credentials-in-effect: an over-permissive copy
|
|
7978
|
+
// restored from a backup must be healed, not preserved.
|
|
7979
|
+
forceMode: true,
|
|
7980
|
+
noFollow: true
|
|
7981
|
+
});
|
|
7982
|
+
}
|
|
7983
|
+
__name(writeRegistry, "writeRegistry");
|
|
7984
|
+
function invalidRegistry(filePath, reason, readOnly = false) {
|
|
7985
|
+
return new PeerControllerError(
|
|
7986
|
+
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.`,
|
|
7987
|
+
"invalid-registry"
|
|
7988
|
+
);
|
|
7989
|
+
}
|
|
7990
|
+
__name(invalidRegistry, "invalidRegistry");
|
|
7991
|
+
function readPeerControllerRegistryStrictSync(filePath, options = {}) {
|
|
7992
|
+
let raw;
|
|
7993
|
+
try {
|
|
7994
|
+
const stats = fsSync2.lstatSync(filePath);
|
|
7995
|
+
if (!stats.isFile()) {
|
|
7996
|
+
if (stats.isSymbolicLink()) {
|
|
7997
|
+
throw new PeerControllerError(
|
|
7998
|
+
`${filePath} is not a regular file; move it aside first.`,
|
|
7999
|
+
"unsafe-path"
|
|
8000
|
+
);
|
|
8001
|
+
}
|
|
8002
|
+
throw invalidRegistry(
|
|
8003
|
+
filePath,
|
|
8004
|
+
"it is not a regular file",
|
|
8005
|
+
options.readOnly
|
|
8006
|
+
);
|
|
8007
|
+
}
|
|
8008
|
+
if (stats.size > MAX_REGISTRY_BYTES) {
|
|
8009
|
+
throw invalidRegistry(
|
|
8010
|
+
filePath,
|
|
8011
|
+
`it exceeds the ${MAX_REGISTRY_BYTES}-byte limit`,
|
|
8012
|
+
options.readOnly
|
|
8013
|
+
);
|
|
8014
|
+
}
|
|
8015
|
+
raw = fsSync2.readFileSync(filePath, "utf8");
|
|
8016
|
+
} catch (error) {
|
|
8017
|
+
if (isNodeError(error) && error.code === "ENOENT") return emptyRegistry();
|
|
8018
|
+
throw error;
|
|
8019
|
+
}
|
|
8020
|
+
let parsed;
|
|
8021
|
+
try {
|
|
8022
|
+
parsed = JSON.parse(raw);
|
|
8023
|
+
} catch {
|
|
8024
|
+
throw invalidRegistry(filePath, "it is not valid JSON", options.readOnly);
|
|
8025
|
+
}
|
|
8026
|
+
if (!isRecord(parsed) || parsed["schemaVersion"] !== PEER_CONTROLLER_SCHEMA_VERSION || !Array.isArray(parsed["controllers"])) {
|
|
8027
|
+
throw invalidRegistry(
|
|
8028
|
+
filePath,
|
|
8029
|
+
"it has an unsupported shape or version",
|
|
8030
|
+
options.readOnly
|
|
8031
|
+
);
|
|
8032
|
+
}
|
|
8033
|
+
const controllers = [];
|
|
8034
|
+
for (const entry of parsed["controllers"]) {
|
|
8035
|
+
const record = toValidRecord(entry);
|
|
8036
|
+
if (record === null) {
|
|
8037
|
+
if (options.skipMalformedEntries) continue;
|
|
8038
|
+
throw invalidRegistry(
|
|
8039
|
+
filePath,
|
|
8040
|
+
"it contains a malformed controller",
|
|
8041
|
+
options.readOnly
|
|
8042
|
+
);
|
|
8043
|
+
}
|
|
8044
|
+
controllers.push(record);
|
|
8045
|
+
}
|
|
8046
|
+
return { schemaVersion: PEER_CONTROLLER_SCHEMA_VERSION, controllers };
|
|
8047
|
+
}
|
|
8048
|
+
__name(readPeerControllerRegistryStrictSync, "readPeerControllerRegistryStrictSync");
|
|
8049
|
+
async function withRegistryLock(filePath, mutate) {
|
|
8050
|
+
const directory = path7.dirname(filePath);
|
|
8051
|
+
await fs5.mkdir(directory, {
|
|
8052
|
+
recursive: true,
|
|
8053
|
+
mode: REGISTRY_DIRECTORY_MODE
|
|
8054
|
+
});
|
|
8055
|
+
const lockPath = path7.join(
|
|
8056
|
+
await fs5.realpath(directory),
|
|
8057
|
+
path7.basename(filePath)
|
|
8058
|
+
);
|
|
8059
|
+
const release = await import_proper_lockfile.default.lock(lockPath, LOCK_OPTIONS);
|
|
8060
|
+
try {
|
|
8061
|
+
return await mutate();
|
|
8062
|
+
} finally {
|
|
8063
|
+
try {
|
|
8064
|
+
await release();
|
|
8065
|
+
} catch {
|
|
8066
|
+
}
|
|
8067
|
+
}
|
|
8068
|
+
}
|
|
8069
|
+
__name(withRegistryLock, "withRegistryLock");
|
|
8070
|
+
async function listPeerControllers(filePath = getPeerControllerRegistryPath()) {
|
|
8071
|
+
return readPeerControllerRegistryStrictSync(filePath, {
|
|
8072
|
+
skipMalformedEntries: true,
|
|
8073
|
+
readOnly: true
|
|
8074
|
+
}).controllers;
|
|
8075
|
+
}
|
|
8076
|
+
__name(listPeerControllers, "listPeerControllers");
|
|
8077
|
+
async function addPeerController(label, filePath = getPeerControllerRegistryPath()) {
|
|
8078
|
+
const flattened = flattenPeerLabel(label);
|
|
8079
|
+
if (flattened.length === 0) {
|
|
8080
|
+
throw new PeerControllerError(
|
|
8081
|
+
"A controller needs a label: something you will recognize when you come to revoke it.",
|
|
8082
|
+
"invalid-label"
|
|
8083
|
+
);
|
|
8084
|
+
}
|
|
8085
|
+
if (flattened.length > MAX_CONTROLLER_LABEL_CHARS) {
|
|
8086
|
+
throw new PeerControllerError(
|
|
8087
|
+
`A controller label may be at most ${MAX_CONTROLLER_LABEL_CHARS} characters.`,
|
|
8088
|
+
"invalid-label"
|
|
8089
|
+
);
|
|
8090
|
+
}
|
|
8091
|
+
return withRegistryLock(filePath, async () => {
|
|
8092
|
+
const registry = readPeerControllerRegistryStrictSync(filePath);
|
|
8093
|
+
if (registry.controllers.some(
|
|
8094
|
+
(record2) => record2.label.toLowerCase() === flattened.toLowerCase()
|
|
8095
|
+
)) {
|
|
8096
|
+
throw new PeerControllerError(
|
|
8097
|
+
`A controller called "${flattened}" already exists. Labels are how you tell them apart when revoking, so pick another.`,
|
|
8098
|
+
"duplicate-label"
|
|
8099
|
+
);
|
|
8100
|
+
}
|
|
8101
|
+
if (registry.controllers.length >= MAX_CONTROLLERS) {
|
|
8102
|
+
throw new PeerControllerError(
|
|
8103
|
+
`This Qwen home already holds ${MAX_CONTROLLERS} controllers. Revoke one before adding another.`,
|
|
8104
|
+
"too-many"
|
|
8105
|
+
);
|
|
8106
|
+
}
|
|
8107
|
+
const token = mintControllerToken();
|
|
8108
|
+
const taken = new Set(registry.controllers.map((record2) => record2.id));
|
|
8109
|
+
let id = `c_${randomBytes2(4).toString("hex")}`;
|
|
8110
|
+
while (taken.has(id)) {
|
|
8111
|
+
id = `c_${randomBytes2(4).toString("hex")}`;
|
|
8112
|
+
}
|
|
8113
|
+
const record = {
|
|
8114
|
+
id,
|
|
8115
|
+
label: flattened,
|
|
8116
|
+
tokenHash: hashControllerToken(token),
|
|
8117
|
+
createdAt: Date.now()
|
|
8118
|
+
};
|
|
8119
|
+
await writeRegistry(filePath, {
|
|
8120
|
+
schemaVersion: PEER_CONTROLLER_SCHEMA_VERSION,
|
|
8121
|
+
controllers: [...registry.controllers, record]
|
|
8122
|
+
});
|
|
8123
|
+
return { record, token };
|
|
8124
|
+
});
|
|
8125
|
+
}
|
|
8126
|
+
__name(addPeerController, "addPeerController");
|
|
8127
|
+
async function removePeerController(id, filePath = getPeerControllerRegistryPath()) {
|
|
8128
|
+
return withRegistryLock(filePath, async () => {
|
|
8129
|
+
const registry = readPeerControllerRegistryStrictSync(filePath, {
|
|
8130
|
+
skipMalformedEntries: true
|
|
8131
|
+
});
|
|
8132
|
+
const needle = id.trim().toLowerCase();
|
|
8133
|
+
const removed = registry.controllers.find(
|
|
8134
|
+
(record) => record.id.toLowerCase() === needle
|
|
8135
|
+
);
|
|
8136
|
+
if (!removed) return null;
|
|
8137
|
+
await writeRegistry(filePath, {
|
|
8138
|
+
schemaVersion: PEER_CONTROLLER_SCHEMA_VERSION,
|
|
8139
|
+
controllers: registry.controllers.filter(
|
|
8140
|
+
(record) => record.tokenHash !== removed.tokenHash
|
|
8141
|
+
)
|
|
8142
|
+
});
|
|
8143
|
+
return removed;
|
|
8144
|
+
});
|
|
8145
|
+
}
|
|
8146
|
+
__name(removePeerController, "removePeerController");
|
|
8147
|
+
|
|
7723
8148
|
// packages/core/src/utils/conversation-branches.ts
|
|
7724
8149
|
init_esbuild_shims();
|
|
7725
8150
|
|
|
7726
8151
|
// packages/core/src/services/toolUseSummary.ts
|
|
7727
8152
|
init_esbuild_shims();
|
|
7728
|
-
var
|
|
8153
|
+
var debugLogger12 = createDebugLogger("TOOL_USE_SUMMARY");
|
|
7729
8154
|
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
8155
|
|
|
7731
8156
|
Keep the verb in past tense and the most distinctive noun. Drop articles, connectors, and long location context first.
|
|
@@ -7746,7 +8171,7 @@ async function generateToolUseSummary(params) {
|
|
|
7746
8171
|
}
|
|
7747
8172
|
const model = config.getFastModel();
|
|
7748
8173
|
if (!model) {
|
|
7749
|
-
|
|
8174
|
+
debugLogger12.debug("No fast model configured \u2014 skipping summary generation");
|
|
7750
8175
|
return null;
|
|
7751
8176
|
}
|
|
7752
8177
|
if (signal.aborted) {
|
|
@@ -7769,7 +8194,7 @@ ${toolSummaries}
|
|
|
7769
8194
|
|
|
7770
8195
|
Label:`;
|
|
7771
8196
|
if (!config.getLlmClient()) {
|
|
7772
|
-
|
|
8197
|
+
debugLogger12.debug("No gemini client available \u2014 skipping");
|
|
7773
8198
|
return null;
|
|
7774
8199
|
}
|
|
7775
8200
|
const result = await runSideQuery(config, {
|
|
@@ -7788,19 +8213,19 @@ Label:`;
|
|
|
7788
8213
|
});
|
|
7789
8214
|
if (signal.aborted) return null;
|
|
7790
8215
|
if (!result.text) {
|
|
7791
|
-
|
|
8216
|
+
debugLogger12.debug("Summary generation returned empty result");
|
|
7792
8217
|
return null;
|
|
7793
8218
|
}
|
|
7794
8219
|
const cleaned = cleanSummary(result.text);
|
|
7795
8220
|
if (!cleaned) {
|
|
7796
|
-
|
|
8221
|
+
debugLogger12.debug(`Summary cleaned to empty: raw="${result.text}"`);
|
|
7797
8222
|
return null;
|
|
7798
8223
|
}
|
|
7799
|
-
|
|
8224
|
+
debugLogger12.debug(`Summary generated: "${cleaned}"`);
|
|
7800
8225
|
return cleaned;
|
|
7801
8226
|
} catch (err) {
|
|
7802
8227
|
if (signal.aborted) return null;
|
|
7803
|
-
|
|
8228
|
+
debugLogger12.warn(
|
|
7804
8229
|
`Summary generation failed: ${err instanceof Error ? err.message : String(err)}`
|
|
7805
8230
|
);
|
|
7806
8231
|
return null;
|
|
@@ -7874,7 +8299,7 @@ __name(cleanSummary, "cleanSummary");
|
|
|
7874
8299
|
|
|
7875
8300
|
// packages/core/src/services/usage-dashboard-service.ts
|
|
7876
8301
|
init_esbuild_shims();
|
|
7877
|
-
var
|
|
8302
|
+
var debugLogger13 = createDebugLogger("USAGE_DASHBOARD");
|
|
7878
8303
|
var DEFAULT_HEATMAP_DAYS = 183;
|
|
7879
8304
|
var MAX_DAILY_DAYS = 92;
|
|
7880
8305
|
var MS_PER_DAY = 24 * 60 * 60 * 1e3;
|
|
@@ -7999,7 +8424,7 @@ function buildUsageDashboard(records, options = {}) {
|
|
|
7999
8424
|
);
|
|
8000
8425
|
const daily = buildDaily(records, dailyStart, now);
|
|
8001
8426
|
const heatmap = buildHeatmap(records, now - heatmapDays * MS_PER_DAY, now);
|
|
8002
|
-
|
|
8427
|
+
debugLogger13.debug(
|
|
8003
8428
|
`built dashboard range=${range} records=${records.length} models=${models.length} skills=${skills.length} dailyPoints=${daily.length}`
|
|
8004
8429
|
);
|
|
8005
8430
|
return {
|
|
@@ -8021,16 +8446,16 @@ __name(loadUsageDashboard, "loadUsageDashboard");
|
|
|
8021
8446
|
|
|
8022
8447
|
// packages/core/src/memory/channel-memory-document.ts
|
|
8023
8448
|
init_esbuild_shims();
|
|
8024
|
-
import { createHash as
|
|
8449
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
8025
8450
|
var CHANNEL_MEMORY_DOCUMENT_VERSION = 1;
|
|
8026
8451
|
var MAX_CHANNEL_MEMORY_ENTRIES = 500;
|
|
8027
8452
|
var MAX_CHANNEL_MEMORY_ENTRIES_PER_REQUEST = 10;
|
|
8028
8453
|
var MAX_CHANNEL_MEMORY_ENTRY_CODE_POINTS = 2e3;
|
|
8029
8454
|
var CHANNEL_MEMORY_ID_RE = /^m-[a-f0-9]{12}$/u;
|
|
8030
|
-
function
|
|
8455
|
+
function isRecord2(value) {
|
|
8031
8456
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8032
8457
|
}
|
|
8033
|
-
__name(
|
|
8458
|
+
__name(isRecord2, "isRecord");
|
|
8034
8459
|
function invalidDocument(message = "Invalid channel memory document") {
|
|
8035
8460
|
return new Error(message);
|
|
8036
8461
|
}
|
|
@@ -8043,7 +8468,7 @@ function validateKeys(value, allowedKeys, message) {
|
|
|
8043
8468
|
}
|
|
8044
8469
|
__name(validateKeys, "validateKeys");
|
|
8045
8470
|
function validateEntry(value) {
|
|
8046
|
-
if (!
|
|
8471
|
+
if (!isRecord2(value)) {
|
|
8047
8472
|
throw invalidDocument("Invalid channel memory entry");
|
|
8048
8473
|
}
|
|
8049
8474
|
validateKeys(
|
|
@@ -8068,7 +8493,7 @@ function validateEntry(value) {
|
|
|
8068
8493
|
}
|
|
8069
8494
|
__name(validateEntry, "validateEntry");
|
|
8070
8495
|
function parseDocumentValue(value) {
|
|
8071
|
-
if (!
|
|
8496
|
+
if (!isRecord2(value)) {
|
|
8072
8497
|
throw invalidDocument();
|
|
8073
8498
|
}
|
|
8074
8499
|
validateKeys(value, ["version", "migration", "entries"]);
|
|
@@ -8095,7 +8520,7 @@ function parseDocumentValue(value) {
|
|
|
8095
8520
|
});
|
|
8096
8521
|
let migration;
|
|
8097
8522
|
if ("migration" in value) {
|
|
8098
|
-
if (!
|
|
8523
|
+
if (!isRecord2(value["migration"]) || typeof value["migration"]["legacySha256"] !== "string" || !/^[a-f0-9]{64}$/u.test(value["migration"]["legacySha256"])) {
|
|
8099
8524
|
throw invalidDocument();
|
|
8100
8525
|
}
|
|
8101
8526
|
validateKeys(value["migration"], ["legacySha256"]);
|
|
@@ -8281,7 +8706,7 @@ function parseLegacyChannelMemory(raw) {
|
|
|
8281
8706
|
continue;
|
|
8282
8707
|
}
|
|
8283
8708
|
normalizedTexts.add(normalizedText);
|
|
8284
|
-
const digest =
|
|
8709
|
+
const digest = createHash4("sha256").update(`${normalizedText}\0${sourceLineIndex}`).digest("hex");
|
|
8285
8710
|
const id = `m-${digest.slice(0, 12)}`;
|
|
8286
8711
|
if (ids.has(id)) {
|
|
8287
8712
|
throw new Error("Channel memory legacy ID collision");
|
|
@@ -8295,7 +8720,7 @@ function parseLegacyChannelMemory(raw) {
|
|
|
8295
8720
|
return {
|
|
8296
8721
|
version: 1,
|
|
8297
8722
|
migration: {
|
|
8298
|
-
legacySha256:
|
|
8723
|
+
legacySha256: createHash4("sha256").update(raw).digest("hex")
|
|
8299
8724
|
},
|
|
8300
8725
|
entries
|
|
8301
8726
|
};
|
|
@@ -8328,16 +8753,16 @@ __name(serializeChannelMemoryDocument, "serializeChannelMemoryDocument");
|
|
|
8328
8753
|
|
|
8329
8754
|
// packages/core/src/memory/channel-memory.ts
|
|
8330
8755
|
init_esbuild_shims();
|
|
8331
|
-
var
|
|
8332
|
-
import { createHash as
|
|
8333
|
-
import * as
|
|
8334
|
-
import * as
|
|
8756
|
+
var import_proper_lockfile2 = __toESM(require_proper_lockfile(), 1);
|
|
8757
|
+
import { createHash as createHash5, randomBytes as randomBytes3 } from "node:crypto";
|
|
8758
|
+
import * as fs6 from "node:fs/promises";
|
|
8759
|
+
import * as path8 from "node:path";
|
|
8335
8760
|
var CHANNEL_MEMORY_FILE_NAME = "CHANNEL.json";
|
|
8336
8761
|
var LEGACY_CHANNEL_MEMORY_FILE_NAME = "CHANNEL.md";
|
|
8337
8762
|
var MAX_CHANNEL_MEMORY_BYTES = 1024 * 1024;
|
|
8338
|
-
var
|
|
8763
|
+
var debugLogger14 = createDebugLogger("CHANNEL_MEMORY");
|
|
8339
8764
|
var pendingMutations = /* @__PURE__ */ new Map();
|
|
8340
|
-
var
|
|
8765
|
+
var LOCK_OPTIONS2 = {
|
|
8341
8766
|
realpath: false,
|
|
8342
8767
|
retries: {
|
|
8343
8768
|
retries: 12,
|
|
@@ -8348,7 +8773,7 @@ var LOCK_OPTIONS = {
|
|
|
8348
8773
|
},
|
|
8349
8774
|
stale: 5e3,
|
|
8350
8775
|
onCompromised: /* @__PURE__ */ __name((err) => {
|
|
8351
|
-
|
|
8776
|
+
debugLogger14.warn("channel memory lock compromised:", err);
|
|
8352
8777
|
}, "onCompromised")
|
|
8353
8778
|
};
|
|
8354
8779
|
function isMissingFile(error) {
|
|
@@ -8371,27 +8796,27 @@ async function releaseLock(release) {
|
|
|
8371
8796
|
__name(releaseLock, "releaseLock");
|
|
8372
8797
|
async function cleanupLegacyAfterCommit(legacyPath, expectedBytes) {
|
|
8373
8798
|
try {
|
|
8374
|
-
const currentBytes = await
|
|
8799
|
+
const currentBytes = await fs6.readFile(legacyPath);
|
|
8375
8800
|
if (legacyHash(currentBytes) !== legacyHash(expectedBytes) || !currentBytes.equals(expectedBytes)) {
|
|
8376
8801
|
return;
|
|
8377
8802
|
}
|
|
8378
|
-
await
|
|
8803
|
+
await fs6.unlink(legacyPath);
|
|
8379
8804
|
} catch {
|
|
8380
8805
|
}
|
|
8381
8806
|
}
|
|
8382
8807
|
__name(cleanupLegacyAfterCommit, "cleanupLegacyAfterCommit");
|
|
8383
8808
|
function safeChannelName(channelName) {
|
|
8384
8809
|
const slug = channelName.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 20) || "_";
|
|
8385
|
-
const hash =
|
|
8810
|
+
const hash = createHash5("sha256").update(channelName).digest("hex").slice(0, 16);
|
|
8386
8811
|
return `${slug}-${hash}`;
|
|
8387
8812
|
}
|
|
8388
8813
|
__name(safeChannelName, "safeChannelName");
|
|
8389
8814
|
function hashedThreadPath(target) {
|
|
8390
|
-
return
|
|
8815
|
+
return createHash5("sha256").update(target.chatId).update("\0").update(target.threadId ?? "").digest("hex").slice(0, 32);
|
|
8391
8816
|
}
|
|
8392
8817
|
__name(hashedThreadPath, "hashedThreadPath");
|
|
8393
8818
|
function getChannelMemoryDirectory(target) {
|
|
8394
|
-
return
|
|
8819
|
+
return path8.join(
|
|
8395
8820
|
Storage.getGlobalQwenDir(),
|
|
8396
8821
|
"channels",
|
|
8397
8822
|
"memory",
|
|
@@ -8401,11 +8826,11 @@ function getChannelMemoryDirectory(target) {
|
|
|
8401
8826
|
}
|
|
8402
8827
|
__name(getChannelMemoryDirectory, "getChannelMemoryDirectory");
|
|
8403
8828
|
function getChannelMemoryFilePath(target) {
|
|
8404
|
-
return
|
|
8829
|
+
return path8.join(getChannelMemoryDirectory(target), CHANNEL_MEMORY_FILE_NAME);
|
|
8405
8830
|
}
|
|
8406
8831
|
__name(getChannelMemoryFilePath, "getChannelMemoryFilePath");
|
|
8407
8832
|
function getLegacyChannelMemoryFilePath(target) {
|
|
8408
|
-
return
|
|
8833
|
+
return path8.join(
|
|
8409
8834
|
getChannelMemoryDirectory(target),
|
|
8410
8835
|
LEGACY_CHANNEL_MEMORY_FILE_NAME
|
|
8411
8836
|
);
|
|
@@ -8415,8 +8840,8 @@ async function serializeMutation(directory, task) {
|
|
|
8415
8840
|
const previous = pendingMutations.get(directory) ?? Promise.resolve();
|
|
8416
8841
|
let resolveCurrent = /* @__PURE__ */ __name(() => {
|
|
8417
8842
|
}, "resolveCurrent");
|
|
8418
|
-
const current = new Promise((
|
|
8419
|
-
resolveCurrent =
|
|
8843
|
+
const current = new Promise((resolve7) => {
|
|
8844
|
+
resolveCurrent = resolve7;
|
|
8420
8845
|
});
|
|
8421
8846
|
const queued = previous.then(
|
|
8422
8847
|
() => current,
|
|
@@ -8437,7 +8862,7 @@ async function serializeMutation(directory, task) {
|
|
|
8437
8862
|
__name(serializeMutation, "serializeMutation");
|
|
8438
8863
|
async function readFileIfExists(filePath) {
|
|
8439
8864
|
try {
|
|
8440
|
-
return await
|
|
8865
|
+
return await fs6.readFile(filePath);
|
|
8441
8866
|
} catch (error) {
|
|
8442
8867
|
if (isMissingFile(error)) {
|
|
8443
8868
|
return void 0;
|
|
@@ -8447,12 +8872,12 @@ async function readFileIfExists(filePath) {
|
|
|
8447
8872
|
}
|
|
8448
8873
|
__name(readFileIfExists, "readFileIfExists");
|
|
8449
8874
|
function legacyHash(legacyBytes) {
|
|
8450
|
-
return
|
|
8875
|
+
return createHash5("sha256").update(legacyBytes).digest("hex");
|
|
8451
8876
|
}
|
|
8452
8877
|
__name(legacyHash, "legacyHash");
|
|
8453
8878
|
async function lockLegacyIfExists(legacyPath) {
|
|
8454
8879
|
try {
|
|
8455
|
-
return await
|
|
8880
|
+
return await import_proper_lockfile2.default.lock(legacyPath, LOCK_OPTIONS2);
|
|
8456
8881
|
} catch (error) {
|
|
8457
8882
|
if (isMissingFile(error)) {
|
|
8458
8883
|
return void 0;
|
|
@@ -8500,21 +8925,21 @@ async function loadChannelMemory(target) {
|
|
|
8500
8925
|
}
|
|
8501
8926
|
__name(loadChannelMemory, "loadChannelMemory");
|
|
8502
8927
|
async function writeChannelMemory(filePath, serialized) {
|
|
8503
|
-
const tempPath = `${filePath}.${process.pid}.${
|
|
8928
|
+
const tempPath = `${filePath}.${process.pid}.${randomBytes3(6).toString("hex")}.tmp`;
|
|
8504
8929
|
let committed = false;
|
|
8505
8930
|
try {
|
|
8506
|
-
const handle = await
|
|
8931
|
+
const handle = await fs6.open(tempPath, "wx", 384);
|
|
8507
8932
|
try {
|
|
8508
8933
|
await handle.writeFile(serialized, "utf8");
|
|
8509
8934
|
await handle.sync();
|
|
8510
8935
|
} finally {
|
|
8511
8936
|
await handle.close();
|
|
8512
8937
|
}
|
|
8513
|
-
await
|
|
8938
|
+
await fs6.rename(tempPath, filePath);
|
|
8514
8939
|
committed = true;
|
|
8515
8940
|
} finally {
|
|
8516
8941
|
if (!committed) {
|
|
8517
|
-
await
|
|
8942
|
+
await fs6.unlink(tempPath).catch((error) => {
|
|
8518
8943
|
if (!isMissingFile(error)) {
|
|
8519
8944
|
throw error;
|
|
8520
8945
|
}
|
|
@@ -8525,14 +8950,14 @@ async function writeChannelMemory(filePath, serialized) {
|
|
|
8525
8950
|
__name(writeChannelMemory, "writeChannelMemory");
|
|
8526
8951
|
async function mutateChannelMemory(target, apply) {
|
|
8527
8952
|
const filePath = getChannelMemoryFilePath(target);
|
|
8528
|
-
const directory =
|
|
8953
|
+
const directory = path8.dirname(filePath);
|
|
8529
8954
|
const legacyPath = getLegacyChannelMemoryFilePath(target);
|
|
8530
8955
|
return serializeMutation(directory, async () => {
|
|
8531
|
-
await
|
|
8532
|
-
const lockPath =
|
|
8533
|
-
const lockHandle = await
|
|
8956
|
+
await fs6.mkdir(directory, { recursive: true });
|
|
8957
|
+
const lockPath = path8.join(directory, ".channel-memory.lock");
|
|
8958
|
+
const lockHandle = await fs6.open(lockPath, "a", 384);
|
|
8534
8959
|
await lockHandle.close();
|
|
8535
|
-
const release = await
|
|
8960
|
+
const release = await import_proper_lockfile2.default.lock(lockPath, LOCK_OPTIONS2);
|
|
8536
8961
|
let releaseLegacy;
|
|
8537
8962
|
try {
|
|
8538
8963
|
releaseLegacy = await lockLegacyIfExists(legacyPath);
|
|
@@ -8569,7 +8994,7 @@ async function listChannelMemoryEntries(target) {
|
|
|
8569
8994
|
__name(listChannelMemoryEntries, "listChannelMemoryEntries");
|
|
8570
8995
|
async function getFileRevision(filePath) {
|
|
8571
8996
|
try {
|
|
8572
|
-
const stats = await
|
|
8997
|
+
const stats = await fs6.stat(filePath, { bigint: true });
|
|
8573
8998
|
return [
|
|
8574
8999
|
stats.dev,
|
|
8575
9000
|
stats.ino,
|
|
@@ -8590,7 +9015,7 @@ async function getChannelMemoryRevision(target) {
|
|
|
8590
9015
|
getFileRevision(getChannelMemoryFilePath(target)),
|
|
8591
9016
|
getFileRevision(getLegacyChannelMemoryFilePath(target))
|
|
8592
9017
|
]);
|
|
8593
|
-
return
|
|
9018
|
+
return createHash5("sha256").update(canonical).update("\0").update(legacy).digest("hex");
|
|
8594
9019
|
}
|
|
8595
9020
|
__name(getChannelMemoryRevision, "getChannelMemoryRevision");
|
|
8596
9021
|
async function addChannelMemoryEntries(target, texts, createdBy) {
|
|
@@ -8622,7 +9047,7 @@ async function addChannelMemoryEntries(target, texts, createdBy) {
|
|
|
8622
9047
|
}
|
|
8623
9048
|
let randomHex;
|
|
8624
9049
|
do {
|
|
8625
|
-
randomHex =
|
|
9050
|
+
randomHex = randomBytes3(6).toString("hex");
|
|
8626
9051
|
} while (ids.has(`m-${randomHex}`));
|
|
8627
9052
|
const entry = createChannelMemoryEntry({
|
|
8628
9053
|
text,
|
|
@@ -8909,8 +9334,8 @@ __name(buildLearnVideoSkillRequest, "buildLearnVideoSkillRequest");
|
|
|
8909
9334
|
|
|
8910
9335
|
// packages/core/src/memory/writeContextFile.ts
|
|
8911
9336
|
init_esbuild_shims();
|
|
8912
|
-
import { promises as
|
|
8913
|
-
import * as
|
|
9337
|
+
import { promises as fs7 } from "node:fs";
|
|
9338
|
+
import * as path9 from "node:path";
|
|
8914
9339
|
var fileLocks = /* @__PURE__ */ new Map();
|
|
8915
9340
|
var FILE_LOCK_TIMEOUT_MS = 3e4;
|
|
8916
9341
|
function getFileLock(filePath) {
|
|
@@ -8938,7 +9363,7 @@ var WorkspaceMemoryWriteTimeoutError = class extends Error {
|
|
|
8938
9363
|
}
|
|
8939
9364
|
};
|
|
8940
9365
|
async function writeWorkspaceContextFile(options) {
|
|
8941
|
-
if (!
|
|
9366
|
+
if (!path9.isAbsolute(options.projectRoot)) {
|
|
8942
9367
|
throw new Error(
|
|
8943
9368
|
`writeWorkspaceContextFile: projectRoot must be absolute, got "${options.projectRoot}"`
|
|
8944
9369
|
);
|
|
@@ -8964,10 +9389,10 @@ async function runWrite(filePath, options) {
|
|
|
8964
9389
|
return { filePath, bytesWritten: 0, changed: false };
|
|
8965
9390
|
}
|
|
8966
9391
|
options.assertCanCommit?.();
|
|
8967
|
-
await
|
|
9392
|
+
await fs7.mkdir(path9.dirname(filePath), { recursive: true });
|
|
8968
9393
|
if (options.mode === "replace") {
|
|
8969
9394
|
options.assertCanCommit?.();
|
|
8970
|
-
await
|
|
9395
|
+
await fs7.writeFile(filePath, options.content, {
|
|
8971
9396
|
encoding: "utf8",
|
|
8972
9397
|
mode: 420
|
|
8973
9398
|
});
|
|
@@ -8979,7 +9404,7 @@ async function runWrite(filePath, options) {
|
|
|
8979
9404
|
}
|
|
8980
9405
|
const next = await composeAppendedContent(filePath, options.content);
|
|
8981
9406
|
options.assertCanCommit?.();
|
|
8982
|
-
await
|
|
9407
|
+
await fs7.writeFile(filePath, next, { encoding: "utf8", mode: 420 });
|
|
8983
9408
|
return {
|
|
8984
9409
|
filePath,
|
|
8985
9410
|
bytesWritten: Buffer.byteLength(next, "utf8"),
|
|
@@ -8990,9 +9415,9 @@ __name(runWrite, "runWrite");
|
|
|
8990
9415
|
function resolveContextFilePath(scope, projectRoot) {
|
|
8991
9416
|
const filename = getCurrentMemoryFilename();
|
|
8992
9417
|
if (scope === "workspace") {
|
|
8993
|
-
return
|
|
9418
|
+
return path9.join(projectRoot, filename);
|
|
8994
9419
|
}
|
|
8995
|
-
return
|
|
9420
|
+
return path9.join(Storage.getGlobalQwenDir(), filename);
|
|
8996
9421
|
}
|
|
8997
9422
|
__name(resolveContextFilePath, "resolveContextFilePath");
|
|
8998
9423
|
var MAX_EXISTING_FILE_BYTES = 16 * 1024 * 1024;
|
|
@@ -9016,7 +9441,7 @@ var WorkspaceMemoryFileTooLargeError = class extends Error {
|
|
|
9016
9441
|
async function composeAppendedContent(filePath, newContent) {
|
|
9017
9442
|
let existing = "";
|
|
9018
9443
|
try {
|
|
9019
|
-
const stat5 = await
|
|
9444
|
+
const stat5 = await fs7.stat(filePath);
|
|
9020
9445
|
if (stat5.size > MAX_EXISTING_FILE_BYTES) {
|
|
9021
9446
|
throw new WorkspaceMemoryFileTooLargeError(
|
|
9022
9447
|
filePath,
|
|
@@ -9024,7 +9449,7 @@ async function composeAppendedContent(filePath, newContent) {
|
|
|
9024
9449
|
MAX_EXISTING_FILE_BYTES
|
|
9025
9450
|
);
|
|
9026
9451
|
}
|
|
9027
|
-
existing = await
|
|
9452
|
+
existing = await fs7.readFile(filePath, "utf8");
|
|
9028
9453
|
} catch (err) {
|
|
9029
9454
|
if (err instanceof WorkspaceMemoryFileTooLargeError) throw err;
|
|
9030
9455
|
if (!isEnoent(err)) throw err;
|
|
@@ -9103,8 +9528,8 @@ __name(trimNewlines, "trimNewlines");
|
|
|
9103
9528
|
init_esbuild_shims();
|
|
9104
9529
|
import * as child_process from "node:child_process";
|
|
9105
9530
|
import * as process2 from "node:process";
|
|
9106
|
-
import * as
|
|
9107
|
-
import * as
|
|
9531
|
+
import * as path10 from "node:path";
|
|
9532
|
+
import * as fs8 from "node:fs";
|
|
9108
9533
|
import * as os2 from "node:os";
|
|
9109
9534
|
function getVsCodeCommand(platform2 = process2.platform) {
|
|
9110
9535
|
return platform2 === "win32" ? "code.cmd" : "code";
|
|
@@ -9132,23 +9557,23 @@ async function findVsCodeCommand(platform2 = process2.platform) {
|
|
|
9132
9557
|
if (platform2 === "darwin") {
|
|
9133
9558
|
locations.push(
|
|
9134
9559
|
"/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code",
|
|
9135
|
-
|
|
9560
|
+
path10.join(homeDir, "Library/Application Support/Code/bin/code")
|
|
9136
9561
|
);
|
|
9137
9562
|
} else if (platform2 === "linux") {
|
|
9138
9563
|
locations.push(
|
|
9139
9564
|
"/usr/share/code/bin/code",
|
|
9140
9565
|
"/snap/bin/code",
|
|
9141
|
-
|
|
9566
|
+
path10.join(homeDir, ".local/share/code/bin/code")
|
|
9142
9567
|
);
|
|
9143
9568
|
} else if (platform2 === "win32") {
|
|
9144
9569
|
locations.push(
|
|
9145
|
-
|
|
9570
|
+
path10.join(
|
|
9146
9571
|
process2.env["ProgramFiles"] || "C:\\Program Files",
|
|
9147
9572
|
"Microsoft VS Code",
|
|
9148
9573
|
"bin",
|
|
9149
9574
|
"code.cmd"
|
|
9150
9575
|
),
|
|
9151
|
-
|
|
9576
|
+
path10.join(
|
|
9152
9577
|
homeDir,
|
|
9153
9578
|
"AppData",
|
|
9154
9579
|
"Local",
|
|
@@ -9160,7 +9585,7 @@ async function findVsCodeCommand(platform2 = process2.platform) {
|
|
|
9160
9585
|
);
|
|
9161
9586
|
}
|
|
9162
9587
|
for (const location of locations) {
|
|
9163
|
-
if (
|
|
9588
|
+
if (fs8.existsSync(location)) {
|
|
9164
9589
|
return location;
|
|
9165
9590
|
}
|
|
9166
9591
|
}
|
|
@@ -9285,7 +9710,7 @@ var CODE_ACTION_KIND_LABELS = {
|
|
|
9285
9710
|
|
|
9286
9711
|
// packages/core/src/lsp/configHash.ts
|
|
9287
9712
|
init_esbuild_shims();
|
|
9288
|
-
import { createHash as
|
|
9713
|
+
import { createHash as createHash6 } from "node:crypto";
|
|
9289
9714
|
function sortJsonValue(value) {
|
|
9290
9715
|
if (Array.isArray(value)) {
|
|
9291
9716
|
return value.map(sortJsonValue);
|
|
@@ -9321,16 +9746,16 @@ function lspServerConfigHash(config) {
|
|
|
9321
9746
|
socket: config.socket
|
|
9322
9747
|
};
|
|
9323
9748
|
const stableConfig = sortJsonValue(hashInput);
|
|
9324
|
-
return
|
|
9749
|
+
return createHash6("sha256").update(JSON.stringify(stableConfig)).digest("hex");
|
|
9325
9750
|
}
|
|
9326
9751
|
__name(lspServerConfigHash, "lspServerConfigHash");
|
|
9327
9752
|
|
|
9328
9753
|
// packages/core/src/lsp/LspConfigLoader.ts
|
|
9329
9754
|
init_esbuild_shims();
|
|
9330
|
-
import * as
|
|
9331
|
-
import * as
|
|
9755
|
+
import * as fs9 from "node:fs";
|
|
9756
|
+
import * as path11 from "path";
|
|
9332
9757
|
import { pathToFileURL } from "url";
|
|
9333
|
-
var
|
|
9758
|
+
var debugLogger15 = createDebugLogger("LSP");
|
|
9334
9759
|
var MAX_TCP_PORT = 65535;
|
|
9335
9760
|
var LspConfigLoader = class {
|
|
9336
9761
|
constructor(workspaceRoot) {
|
|
@@ -9344,25 +9769,25 @@ var LspConfigLoader = class {
|
|
|
9344
9769
|
* Supports basic format: { "language": { "command": "...", "extensionToLanguage": {...} } }
|
|
9345
9770
|
*/
|
|
9346
9771
|
async loadUserConfigs() {
|
|
9347
|
-
const lspConfigPath =
|
|
9348
|
-
if (!
|
|
9772
|
+
const lspConfigPath = path11.join(this.workspaceRoot, ".lsp.json");
|
|
9773
|
+
if (!fs9.existsSync(lspConfigPath)) {
|
|
9349
9774
|
return [];
|
|
9350
9775
|
}
|
|
9351
9776
|
try {
|
|
9352
|
-
const configContent =
|
|
9777
|
+
const configContent = fs9.readFileSync(lspConfigPath, "utf-8");
|
|
9353
9778
|
const data = JSON.parse(configContent);
|
|
9354
9779
|
return this.parseConfigSource(data, lspConfigPath, {
|
|
9355
9780
|
forceTrustRequired: true
|
|
9356
9781
|
});
|
|
9357
9782
|
} catch (error) {
|
|
9358
|
-
|
|
9783
|
+
debugLogger15.warn("Failed to load user .lsp.json config:", error);
|
|
9359
9784
|
return [];
|
|
9360
9785
|
}
|
|
9361
9786
|
}
|
|
9362
9787
|
async loadUserConfigsStrict() {
|
|
9363
|
-
const lspConfigPath =
|
|
9788
|
+
const lspConfigPath = path11.join(this.workspaceRoot, ".lsp.json");
|
|
9364
9789
|
try {
|
|
9365
|
-
const configContent =
|
|
9790
|
+
const configContent = fs9.readFileSync(lspConfigPath, "utf-8");
|
|
9366
9791
|
const data = JSON.parse(configContent);
|
|
9367
9792
|
return this.parseUserConfigSourceStrict(data, lspConfigPath);
|
|
9368
9793
|
} catch (error) {
|
|
@@ -9391,14 +9816,14 @@ var LspConfigLoader = class {
|
|
|
9391
9816
|
extension.path,
|
|
9392
9817
|
lspServers
|
|
9393
9818
|
);
|
|
9394
|
-
if (!
|
|
9395
|
-
|
|
9819
|
+
if (!fs9.existsSync(configPath)) {
|
|
9820
|
+
debugLogger15.warn(
|
|
9396
9821
|
`LSP config not found for ${originBase}: ${configPath}`
|
|
9397
9822
|
);
|
|
9398
9823
|
continue;
|
|
9399
9824
|
}
|
|
9400
9825
|
try {
|
|
9401
|
-
const configContent =
|
|
9826
|
+
const configContent = fs9.readFileSync(configPath, "utf-8");
|
|
9402
9827
|
const data = JSON.parse(configContent);
|
|
9403
9828
|
const hydrated = this.hydrateExtensionLspConfig(data, extension.path);
|
|
9404
9829
|
configs.push(
|
|
@@ -9408,7 +9833,7 @@ var LspConfigLoader = class {
|
|
|
9408
9833
|
)
|
|
9409
9834
|
);
|
|
9410
9835
|
} catch (error) {
|
|
9411
|
-
|
|
9836
|
+
debugLogger15.warn(
|
|
9412
9837
|
`Failed to load extension LSP config from ${configPath}:`,
|
|
9413
9838
|
error
|
|
9414
9839
|
);
|
|
@@ -9422,7 +9847,7 @@ var LspConfigLoader = class {
|
|
|
9422
9847
|
...this.parseConfigSource(hydrated, `${originBase} (lspServers)`)
|
|
9423
9848
|
);
|
|
9424
9849
|
} else {
|
|
9425
|
-
|
|
9850
|
+
debugLogger15.warn(
|
|
9426
9851
|
`LSP config for ${originBase} must be an object or a JSON file path.`
|
|
9427
9852
|
);
|
|
9428
9853
|
}
|
|
@@ -9528,15 +9953,15 @@ var LspConfigLoader = class {
|
|
|
9528
9953
|
return { ok: true, configs };
|
|
9529
9954
|
}
|
|
9530
9955
|
resolveExtensionConfigPath(extensionPath, configPath) {
|
|
9531
|
-
return
|
|
9956
|
+
return path11.isAbsolute(configPath) ? path11.resolve(configPath) : path11.resolve(extensionPath, configPath);
|
|
9532
9957
|
}
|
|
9533
9958
|
hydrateExtensionLspConfig(source, extensionPath) {
|
|
9534
9959
|
return recursivelyHydrateStrings(source, {
|
|
9535
9960
|
extensionPath,
|
|
9536
9961
|
CLAUDE_PLUGIN_ROOT: extensionPath,
|
|
9537
9962
|
workspacePath: this.workspaceRoot,
|
|
9538
|
-
"/":
|
|
9539
|
-
pathSeparator:
|
|
9963
|
+
"/": path11.sep,
|
|
9964
|
+
pathSeparator: path11.sep
|
|
9540
9965
|
});
|
|
9541
9966
|
}
|
|
9542
9967
|
buildServerConfig(name, languages, spec, origin, options = {}) {
|
|
@@ -9560,13 +9985,13 @@ var LspConfigLoader = class {
|
|
|
9560
9985
|
const trustRequired = options.forceTrustRequired ? true : typeof spec["trustRequired"] === "boolean" ? spec["trustRequired"] : true;
|
|
9561
9986
|
const socket = this.normalizeSocketOptions(spec);
|
|
9562
9987
|
if (transport === "stdio" && !command) {
|
|
9563
|
-
|
|
9988
|
+
debugLogger15.warn(
|
|
9564
9989
|
`LSP config error in ${origin}: ${name} missing command`
|
|
9565
9990
|
);
|
|
9566
9991
|
return null;
|
|
9567
9992
|
}
|
|
9568
9993
|
if (transport !== "stdio" && !socket) {
|
|
9569
|
-
|
|
9994
|
+
debugLogger15.warn(
|
|
9570
9995
|
`LSP config error in ${origin}: ${name} missing socket info`
|
|
9571
9996
|
);
|
|
9572
9997
|
return null;
|
|
@@ -9703,12 +10128,12 @@ var LspConfigLoader = class {
|
|
|
9703
10128
|
if (typeof value !== "string" || value.trim() === "") {
|
|
9704
10129
|
return this.workspaceRoot;
|
|
9705
10130
|
}
|
|
9706
|
-
const resolved =
|
|
9707
|
-
const root =
|
|
9708
|
-
if (resolved === root || resolved.startsWith(root +
|
|
10131
|
+
const resolved = path11.isAbsolute(value) ? path11.resolve(value) : path11.resolve(this.workspaceRoot, value);
|
|
10132
|
+
const root = path11.resolve(this.workspaceRoot);
|
|
10133
|
+
if (resolved === root || resolved.startsWith(root + path11.sep)) {
|
|
9709
10134
|
return resolved;
|
|
9710
10135
|
}
|
|
9711
|
-
|
|
10136
|
+
debugLogger15.warn(
|
|
9712
10137
|
`LSP workspaceFolder must be within ${this.workspaceRoot}; using workspace root instead.`
|
|
9713
10138
|
);
|
|
9714
10139
|
return this.workspaceRoot;
|
|
@@ -9720,7 +10145,7 @@ init_esbuild_shims();
|
|
|
9720
10145
|
import * as cp from "node:child_process";
|
|
9721
10146
|
import * as net2 from "node:net";
|
|
9722
10147
|
import { StringDecoder } from "node:string_decoder";
|
|
9723
|
-
var
|
|
10148
|
+
var debugLogger16 = createDebugLogger("LSP");
|
|
9724
10149
|
var MAX_STDERR_TAIL_BYTES = 8192;
|
|
9725
10150
|
function trimTail(value, maxBytes) {
|
|
9726
10151
|
const buffer = Buffer.from(value, "utf8");
|
|
@@ -9785,7 +10210,7 @@ var JsonRpcConnection = class {
|
|
|
9785
10210
|
try {
|
|
9786
10211
|
this.disposer?.();
|
|
9787
10212
|
} catch (error) {
|
|
9788
|
-
|
|
10213
|
+
debugLogger16.warn("LSP disposer failed:", error);
|
|
9789
10214
|
}
|
|
9790
10215
|
}
|
|
9791
10216
|
sendRequest(method, params) {
|
|
@@ -9799,12 +10224,12 @@ var JsonRpcConnection = class {
|
|
|
9799
10224
|
method,
|
|
9800
10225
|
params
|
|
9801
10226
|
};
|
|
9802
|
-
const requestPromise = new Promise((
|
|
10227
|
+
const requestPromise = new Promise((resolve7, reject) => {
|
|
9803
10228
|
const timer = setTimeout(() => {
|
|
9804
10229
|
this.pendingRequests.delete(id);
|
|
9805
10230
|
reject(new Error(`LSP request timeout: ${method}`));
|
|
9806
10231
|
}, DEFAULT_LSP_REQUEST_TIMEOUT_MS);
|
|
9807
|
-
this.pendingRequests.set(id, { resolve:
|
|
10232
|
+
this.pendingRequests.set(id, { resolve: resolve7, reject, timer });
|
|
9808
10233
|
});
|
|
9809
10234
|
this.writeMessage(payload);
|
|
9810
10235
|
return requestPromise;
|
|
@@ -9912,7 +10337,7 @@ var JsonRpcConnection = class {
|
|
|
9912
10337
|
try {
|
|
9913
10338
|
this.writer(header + json);
|
|
9914
10339
|
} catch (error) {
|
|
9915
|
-
|
|
10340
|
+
debugLogger16.warn("LSP write failed:", error);
|
|
9916
10341
|
this.end();
|
|
9917
10342
|
}
|
|
9918
10343
|
}
|
|
@@ -9932,7 +10357,7 @@ var LspConnectionFactory = class _LspConnectionFactory {
|
|
|
9932
10357
|
* 创建基于 stdio 的 LSP 连接
|
|
9933
10358
|
*/
|
|
9934
10359
|
static async createStdioConnection(command, args, options, timeoutMs = 1e4) {
|
|
9935
|
-
return new Promise((
|
|
10360
|
+
return new Promise((resolve7, reject) => {
|
|
9936
10361
|
const spawnOptions = {
|
|
9937
10362
|
stdio: "pipe",
|
|
9938
10363
|
...options
|
|
@@ -9971,14 +10396,14 @@ var LspConnectionFactory = class _LspConnectionFactory {
|
|
|
9971
10396
|
);
|
|
9972
10397
|
});
|
|
9973
10398
|
processInstance.stderr?.on("error", (err) => {
|
|
9974
|
-
|
|
10399
|
+
debugLogger16.warn(`LSP stderr stream error for ${command}:`, err);
|
|
9975
10400
|
});
|
|
9976
10401
|
const connection = new JsonRpcConnection(
|
|
9977
10402
|
(payload) => processInstance.stdin?.write(payload),
|
|
9978
10403
|
() => processInstance.stdin?.end()
|
|
9979
10404
|
);
|
|
9980
10405
|
processInstance.stdin.on("error", (err) => {
|
|
9981
|
-
|
|
10406
|
+
debugLogger16.warn(`LSP stdin stream error for ${command}:`, err);
|
|
9982
10407
|
connection.end();
|
|
9983
10408
|
});
|
|
9984
10409
|
connection.listen(processInstance.stdout);
|
|
@@ -9991,7 +10416,7 @@ var LspConnectionFactory = class _LspConnectionFactory {
|
|
|
9991
10416
|
recordProcessExit(code, signal);
|
|
9992
10417
|
connection.end();
|
|
9993
10418
|
});
|
|
9994
|
-
|
|
10419
|
+
resolve7({
|
|
9995
10420
|
connection,
|
|
9996
10421
|
process: processInstance,
|
|
9997
10422
|
processDiagnostics
|
|
@@ -10012,7 +10437,7 @@ var LspConnectionFactory = class _LspConnectionFactory {
|
|
|
10012
10437
|
* 创建基于 socket 的 LSP 连接(支持 TCP 或 unix socket)
|
|
10013
10438
|
*/
|
|
10014
10439
|
static async createSocketConnection(options, timeoutMs = 1e4) {
|
|
10015
|
-
return new Promise((
|
|
10440
|
+
return new Promise((resolve7, reject) => {
|
|
10016
10441
|
let socketOptions;
|
|
10017
10442
|
if (options.path) {
|
|
10018
10443
|
socketOptions = { path: options.path };
|
|
@@ -10046,7 +10471,7 @@ var LspConnectionFactory = class _LspConnectionFactory {
|
|
|
10046
10471
|
connection.listen(socket);
|
|
10047
10472
|
socket.once("close", () => connection.end());
|
|
10048
10473
|
socket.once("error", () => connection.end());
|
|
10049
|
-
|
|
10474
|
+
resolve7({
|
|
10050
10475
|
connection,
|
|
10051
10476
|
socket
|
|
10052
10477
|
});
|
|
@@ -10061,7 +10486,7 @@ var LspConnectionFactory = class _LspConnectionFactory {
|
|
|
10061
10486
|
try {
|
|
10062
10487
|
await lspConnection.connection.shutdown();
|
|
10063
10488
|
} catch (e) {
|
|
10064
|
-
|
|
10489
|
+
debugLogger16.warn("LSP shutdown failed:", e);
|
|
10065
10490
|
} finally {
|
|
10066
10491
|
lspConnection.connection.end();
|
|
10067
10492
|
}
|
|
@@ -10736,10 +11161,10 @@ ${value}
|
|
|
10736
11161
|
// packages/core/src/lsp/LspServerManager.ts
|
|
10737
11162
|
init_esbuild_shims();
|
|
10738
11163
|
import { spawn as spawn2 } from "node:child_process";
|
|
10739
|
-
import * as
|
|
10740
|
-
import * as
|
|
11164
|
+
import * as fs10 from "node:fs";
|
|
11165
|
+
import * as path12 from "path";
|
|
10741
11166
|
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
10742
|
-
var
|
|
11167
|
+
var debugLogger17 = createDebugLogger("LSP");
|
|
10743
11168
|
var SECURITY_SENSITIVE_ENV_KEYS = /* @__PURE__ */ new Set([
|
|
10744
11169
|
"DYLD_INSERT_LIBRARIES",
|
|
10745
11170
|
"DYLD_LIBRARY_PATH",
|
|
@@ -10776,7 +11201,7 @@ var LspServerManager = class {
|
|
|
10776
11201
|
});
|
|
10777
11202
|
this.serverConfigHashes.set(config.name, lspServerConfigHash(config));
|
|
10778
11203
|
}
|
|
10779
|
-
|
|
11204
|
+
debugLogger17.info(
|
|
10780
11205
|
`Prepared ${configs.length} LSP server config(s): ${formatServerNames(
|
|
10781
11206
|
configs.map((config) => config.name)
|
|
10782
11207
|
)}`
|
|
@@ -10785,7 +11210,7 @@ var LspServerManager = class {
|
|
|
10785
11210
|
/** Drops all prepared handles without attempting process shutdown. */
|
|
10786
11211
|
clearServerHandles() {
|
|
10787
11212
|
if (this.serverHandles.size > 0) {
|
|
10788
|
-
|
|
11213
|
+
debugLogger17.info(
|
|
10789
11214
|
`Clearing ${this.serverHandles.size} LSP server handle(s): ${formatServerNames(
|
|
10790
11215
|
Array.from(this.serverHandles.keys())
|
|
10791
11216
|
)}`
|
|
@@ -10846,7 +11271,7 @@ var LspServerManager = class {
|
|
|
10846
11271
|
* before their handles are deleted or replaced.
|
|
10847
11272
|
*/
|
|
10848
11273
|
async doReconcileServerConfigs(configs) {
|
|
10849
|
-
|
|
11274
|
+
debugLogger17.info(
|
|
10850
11275
|
`Reconciling LSP server configs: desired=${formatServerNames(
|
|
10851
11276
|
configs.map((config) => config.name)
|
|
10852
11277
|
)}`
|
|
@@ -10918,7 +11343,7 @@ var LspServerManager = class {
|
|
|
10918
11343
|
result.added.push(name);
|
|
10919
11344
|
}
|
|
10920
11345
|
}
|
|
10921
|
-
|
|
11346
|
+
debugLogger17.info(
|
|
10922
11347
|
`LSP reconcile result: added=${formatServerNames(
|
|
10923
11348
|
result.added
|
|
10924
11349
|
)}, removed=${formatServerNames(
|
|
@@ -10953,7 +11378,7 @@ var LspServerManager = class {
|
|
|
10953
11378
|
const uri = pathToFileURL2(tsFile).toString();
|
|
10954
11379
|
const languageId = tsFile.endsWith(".tsx") ? "typescriptreact" : tsFile.endsWith(".jsx") ? "javascriptreact" : tsFile.endsWith(".js") ? "javascript" : "typescript";
|
|
10955
11380
|
try {
|
|
10956
|
-
const text =
|
|
11381
|
+
const text = fs10.readFileSync(tsFile, "utf-8");
|
|
10957
11382
|
handle.connection.send({
|
|
10958
11383
|
jsonrpc: "2.0",
|
|
10959
11384
|
method: "textDocument/didOpen",
|
|
@@ -10967,12 +11392,12 @@ var LspServerManager = class {
|
|
|
10967
11392
|
}
|
|
10968
11393
|
});
|
|
10969
11394
|
await new Promise(
|
|
10970
|
-
(
|
|
11395
|
+
(resolve7) => setTimeout(resolve7, DEFAULT_LSP_WARMUP_DELAY_MS)
|
|
10971
11396
|
);
|
|
10972
11397
|
handle.warmedUp = true;
|
|
10973
11398
|
return uri;
|
|
10974
11399
|
} catch (error) {
|
|
10975
|
-
|
|
11400
|
+
debugLogger17.warn("TypeScript server warm-up failed:", error);
|
|
10976
11401
|
return void 0;
|
|
10977
11402
|
}
|
|
10978
11403
|
}
|
|
@@ -11019,7 +11444,7 @@ var LspServerManager = class {
|
|
|
11019
11444
|
async doStartServer(name, handle) {
|
|
11020
11445
|
const workspaceTrusted = this.config.isTrustedFolder();
|
|
11021
11446
|
if ((this.requireTrustedWorkspace || handle.config.trustRequired) && !workspaceTrusted) {
|
|
11022
|
-
|
|
11447
|
+
debugLogger17.warn(
|
|
11023
11448
|
`LSP server ${name} requires trusted workspace, skipping startup`
|
|
11024
11449
|
);
|
|
11025
11450
|
handle.status = "FAILED";
|
|
@@ -11032,7 +11457,7 @@ var LspServerManager = class {
|
|
|
11032
11457
|
workspaceTrusted
|
|
11033
11458
|
);
|
|
11034
11459
|
if (!trusted) {
|
|
11035
|
-
|
|
11460
|
+
debugLogger17.warn(
|
|
11036
11461
|
`Workspace trust check failed, not starting LSP server ${name}`
|
|
11037
11462
|
);
|
|
11038
11463
|
handle.status = "FAILED";
|
|
@@ -11042,7 +11467,7 @@ var LspServerManager = class {
|
|
|
11042
11467
|
if (handle.config.command) {
|
|
11043
11468
|
const commandCwd = handle.config.workspaceFolder ?? this.workspaceRoot;
|
|
11044
11469
|
if (!this.isPathSafe(handle.config.command, this.workspaceRoot, commandCwd)) {
|
|
11045
|
-
|
|
11470
|
+
debugLogger17.warn(
|
|
11046
11471
|
`LSP server ${name} command path is unsafe: ${handle.config.command}`
|
|
11047
11472
|
);
|
|
11048
11473
|
handle.status = "FAILED";
|
|
@@ -11054,7 +11479,7 @@ var LspServerManager = class {
|
|
|
11054
11479
|
handle.config.env,
|
|
11055
11480
|
commandCwd
|
|
11056
11481
|
)) {
|
|
11057
|
-
|
|
11482
|
+
debugLogger17.warn(
|
|
11058
11483
|
`LSP server ${name} command not found: ${handle.config.command}`
|
|
11059
11484
|
);
|
|
11060
11485
|
handle.status = "FAILED";
|
|
@@ -11069,7 +11494,7 @@ var LspServerManager = class {
|
|
|
11069
11494
|
handle.processDiagnostics = void 0;
|
|
11070
11495
|
handle.warmedUp = false;
|
|
11071
11496
|
handle.status = "IN_PROGRESS";
|
|
11072
|
-
|
|
11497
|
+
debugLogger17.info(
|
|
11073
11498
|
`Starting LSP server ${name}: command=${handle.config.command ?? "<none>"}, transport=${handle.config.transport}, languages=${formatServerNames(
|
|
11074
11499
|
handle.config.languages
|
|
11075
11500
|
)}`
|
|
@@ -11094,7 +11519,7 @@ var LspServerManager = class {
|
|
|
11094
11519
|
}
|
|
11095
11520
|
handle.status = "READY";
|
|
11096
11521
|
this.attachRestartHandler(name, handle);
|
|
11097
|
-
|
|
11522
|
+
debugLogger17.info(`LSP server ${name} started successfully`);
|
|
11098
11523
|
} catch (error) {
|
|
11099
11524
|
handle.status = "FAILED";
|
|
11100
11525
|
handle.error = error;
|
|
@@ -11108,21 +11533,21 @@ var LspServerManager = class {
|
|
|
11108
11533
|
}
|
|
11109
11534
|
await this.releaseServerResources(name, handle, false);
|
|
11110
11535
|
if (handle.processDiagnostics) {
|
|
11111
|
-
|
|
11536
|
+
debugLogger17.error(
|
|
11112
11537
|
`LSP server ${name} process diagnostics:`,
|
|
11113
11538
|
handle.processDiagnostics
|
|
11114
11539
|
);
|
|
11115
11540
|
}
|
|
11116
11541
|
handle.connection = void 0;
|
|
11117
11542
|
handle.process = void 0;
|
|
11118
|
-
|
|
11543
|
+
debugLogger17.error(`LSP server ${name} failed to start:`, error);
|
|
11119
11544
|
}
|
|
11120
11545
|
}
|
|
11121
11546
|
/**
|
|
11122
11547
|
* Stops a server and resets runtime-only handle state.
|
|
11123
11548
|
*/
|
|
11124
11549
|
async stopServer(name, handle) {
|
|
11125
|
-
|
|
11550
|
+
debugLogger17.info(`Stopping LSP server ${name}`);
|
|
11126
11551
|
handle.stopRequested = true;
|
|
11127
11552
|
handle.startupAbortController?.abort();
|
|
11128
11553
|
if (handle.startingPromise) {
|
|
@@ -11135,7 +11560,7 @@ var LspServerManager = class {
|
|
|
11135
11560
|
handle.status = "NOT_STARTED";
|
|
11136
11561
|
handle.warmedUp = false;
|
|
11137
11562
|
handle.restartAttempts = 0;
|
|
11138
|
-
|
|
11563
|
+
debugLogger17.info(`LSP server ${name} stopped`);
|
|
11139
11564
|
}
|
|
11140
11565
|
async abortAndWaitForStartup(handle) {
|
|
11141
11566
|
if (!handle.startingPromise) {
|
|
@@ -11159,14 +11584,14 @@ var LspServerManager = class {
|
|
|
11159
11584
|
handle.connection.end();
|
|
11160
11585
|
}
|
|
11161
11586
|
} catch (error) {
|
|
11162
|
-
|
|
11587
|
+
debugLogger17.error(`Error closing LSP server ${name}:`, error);
|
|
11163
11588
|
}
|
|
11164
11589
|
}
|
|
11165
11590
|
if (handle.process && handle.process.exitCode === null) {
|
|
11166
11591
|
try {
|
|
11167
11592
|
handle.process.kill();
|
|
11168
11593
|
} catch (error) {
|
|
11169
|
-
|
|
11594
|
+
debugLogger17.warn(`Error killing LSP server ${name} process:`, error);
|
|
11170
11595
|
}
|
|
11171
11596
|
}
|
|
11172
11597
|
}
|
|
@@ -11186,8 +11611,8 @@ var LspServerManager = class {
|
|
|
11186
11611
|
try {
|
|
11187
11612
|
await Promise.race([
|
|
11188
11613
|
shutdownPromise,
|
|
11189
|
-
new Promise((
|
|
11190
|
-
timerId = setTimeout(
|
|
11614
|
+
new Promise((resolve7) => {
|
|
11615
|
+
timerId = setTimeout(resolve7, timeout);
|
|
11191
11616
|
if (typeof timerId === "object" && timerId !== null && "unref" in timerId) {
|
|
11192
11617
|
timerId.unref();
|
|
11193
11618
|
}
|
|
@@ -11212,7 +11637,7 @@ var LspServerManager = class {
|
|
|
11212
11637
|
}
|
|
11213
11638
|
handle.processExitedUnexpectedly = true;
|
|
11214
11639
|
if (!handle.config.restartOnCrash) {
|
|
11215
|
-
|
|
11640
|
+
debugLogger17.warn(
|
|
11216
11641
|
`LSP server ${name} exited but restartOnCrash is disabled`
|
|
11217
11642
|
);
|
|
11218
11643
|
handle.status = "FAILED";
|
|
@@ -11221,7 +11646,7 @@ var LspServerManager = class {
|
|
|
11221
11646
|
}
|
|
11222
11647
|
const maxRestarts = handle.config.maxRestarts ?? DEFAULT_LSP_MAX_RESTARTS;
|
|
11223
11648
|
if (maxRestarts <= 0) {
|
|
11224
|
-
|
|
11649
|
+
debugLogger17.warn(
|
|
11225
11650
|
`LSP server ${name} exited but maxRestarts is ${maxRestarts}`
|
|
11226
11651
|
);
|
|
11227
11652
|
handle.status = "FAILED";
|
|
@@ -11230,7 +11655,7 @@ var LspServerManager = class {
|
|
|
11230
11655
|
}
|
|
11231
11656
|
const attempts = handle.restartAttempts ?? 0;
|
|
11232
11657
|
if (attempts >= maxRestarts) {
|
|
11233
|
-
|
|
11658
|
+
debugLogger17.warn(
|
|
11234
11659
|
`LSP server ${name} reached max restart attempts (${maxRestarts}), stopping restarts`
|
|
11235
11660
|
);
|
|
11236
11661
|
handle.status = "FAILED";
|
|
@@ -11238,7 +11663,7 @@ var LspServerManager = class {
|
|
|
11238
11663
|
return;
|
|
11239
11664
|
}
|
|
11240
11665
|
handle.restartAttempts = attempts + 1;
|
|
11241
|
-
|
|
11666
|
+
debugLogger17.warn(
|
|
11242
11667
|
`LSP server ${name} exited (code ${code ?? "unknown"}), restarting (${handle.restartAttempts}/${maxRestarts})`
|
|
11243
11668
|
);
|
|
11244
11669
|
this.enqueueCrashRestart(name, handle);
|
|
@@ -11286,7 +11711,7 @@ var LspServerManager = class {
|
|
|
11286
11711
|
const next = this.reconcileQueue.then(restart, restart);
|
|
11287
11712
|
this.reconcileQueue = next.catch(() => void 0);
|
|
11288
11713
|
void next.catch((error) => {
|
|
11289
|
-
|
|
11714
|
+
debugLogger17.warn(`LSP server ${name} crash restart failed:`, error);
|
|
11290
11715
|
});
|
|
11291
11716
|
}
|
|
11292
11717
|
resetHandle(handle) {
|
|
@@ -11294,14 +11719,14 @@ var LspServerManager = class {
|
|
|
11294
11719
|
try {
|
|
11295
11720
|
handle.connection.end();
|
|
11296
11721
|
} catch (error) {
|
|
11297
|
-
|
|
11722
|
+
debugLogger17.warn("Error closing LSP connection during reset:", error);
|
|
11298
11723
|
}
|
|
11299
11724
|
}
|
|
11300
11725
|
if (handle.process && handle.process.exitCode === null) {
|
|
11301
11726
|
try {
|
|
11302
11727
|
handle.process.kill();
|
|
11303
11728
|
} catch (error) {
|
|
11304
|
-
|
|
11729
|
+
debugLogger17.warn("Error killing LSP process during reset:", error);
|
|
11305
11730
|
}
|
|
11306
11731
|
}
|
|
11307
11732
|
handle.connection = void 0;
|
|
@@ -11320,7 +11745,7 @@ var LspServerManager = class {
|
|
|
11320
11745
|
const filteredEnv = {};
|
|
11321
11746
|
for (const [key, value] of Object.entries(env2)) {
|
|
11322
11747
|
if (SECURITY_SENSITIVE_ENV_KEYS.has(key.toUpperCase())) {
|
|
11323
|
-
|
|
11748
|
+
debugLogger17.warn(
|
|
11324
11749
|
`Ignoring security-sensitive LSP server env override: ${key}`
|
|
11325
11750
|
);
|
|
11326
11751
|
continue;
|
|
@@ -11346,7 +11771,7 @@ var LspServerManager = class {
|
|
|
11346
11771
|
for (const [key, value] of Object.entries(env2)) {
|
|
11347
11772
|
const normalizedKey = key.toUpperCase();
|
|
11348
11773
|
if (normalizedKey === "PATH" || SECURITY_SENSITIVE_ENV_KEYS.has(normalizedKey)) {
|
|
11349
|
-
|
|
11774
|
+
debugLogger17.warn(
|
|
11350
11775
|
`Ignoring security-sensitive LSP command probe env override: ${key}`
|
|
11351
11776
|
);
|
|
11352
11777
|
continue;
|
|
@@ -11390,11 +11815,11 @@ var LspServerManager = class {
|
|
|
11390
11815
|
}
|
|
11391
11816
|
async delayWithAbort(delayMs, signal) {
|
|
11392
11817
|
if (!signal) {
|
|
11393
|
-
await new Promise((
|
|
11818
|
+
await new Promise((resolve7) => setTimeout(resolve7, delayMs));
|
|
11394
11819
|
return;
|
|
11395
11820
|
}
|
|
11396
11821
|
this.throwIfStartupAborted(signal);
|
|
11397
|
-
await new Promise((
|
|
11822
|
+
await new Promise((resolve7, reject) => {
|
|
11398
11823
|
const onAbort = /* @__PURE__ */ __name(() => {
|
|
11399
11824
|
clearTimeout(timerId);
|
|
11400
11825
|
signal.removeEventListener("abort", onAbort);
|
|
@@ -11402,7 +11827,7 @@ var LspServerManager = class {
|
|
|
11402
11827
|
}, "onAbort");
|
|
11403
11828
|
const timerId = setTimeout(() => {
|
|
11404
11829
|
signal.removeEventListener("abort", onAbort);
|
|
11405
|
-
|
|
11830
|
+
resolve7();
|
|
11406
11831
|
}, delayMs);
|
|
11407
11832
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
11408
11833
|
});
|
|
@@ -11571,7 +11996,7 @@ var LspServerManager = class {
|
|
|
11571
11996
|
*/
|
|
11572
11997
|
async waitForSocketProcessSpawn(process3, signal) {
|
|
11573
11998
|
this.throwIfStartupAborted(signal);
|
|
11574
|
-
await new Promise((
|
|
11999
|
+
await new Promise((resolve7, reject) => {
|
|
11575
12000
|
let settled = false;
|
|
11576
12001
|
const cleanup = /* @__PURE__ */ __name(() => {
|
|
11577
12002
|
process3.off("spawn", onSpawn);
|
|
@@ -11586,7 +12011,7 @@ var LspServerManager = class {
|
|
|
11586
12011
|
cleanup();
|
|
11587
12012
|
complete();
|
|
11588
12013
|
}, "settle");
|
|
11589
|
-
const onSpawn = /* @__PURE__ */ __name(() => settle(
|
|
12014
|
+
const onSpawn = /* @__PURE__ */ __name(() => settle(resolve7), "onSpawn");
|
|
11590
12015
|
const onError = /* @__PURE__ */ __name((error) => settle(
|
|
11591
12016
|
() => reject(new Error(`Failed to spawn LSP server: ${error.message}`))
|
|
11592
12017
|
), "onError");
|
|
@@ -11595,7 +12020,7 @@ var LspServerManager = class {
|
|
|
11595
12020
|
try {
|
|
11596
12021
|
process3.kill();
|
|
11597
12022
|
} catch (error) {
|
|
11598
|
-
|
|
12023
|
+
debugLogger17.warn(
|
|
11599
12024
|
"Error killing aborted LSP socket process:",
|
|
11600
12025
|
error
|
|
11601
12026
|
);
|
|
@@ -11640,7 +12065,7 @@ var LspServerManager = class {
|
|
|
11640
12065
|
async initializeLspServer(connection, config) {
|
|
11641
12066
|
const workspaceFolderPath = config.workspaceFolder ?? this.workspaceRoot;
|
|
11642
12067
|
const workspaceFolder = {
|
|
11643
|
-
name:
|
|
12068
|
+
name: path12.basename(workspaceFolderPath) || workspaceFolderPath,
|
|
11644
12069
|
uri: config.rootUri
|
|
11645
12070
|
};
|
|
11646
12071
|
const initializeParams = {
|
|
@@ -11702,7 +12127,7 @@ var LspServerManager = class {
|
|
|
11702
12127
|
* @returns true if the command can be spawned, false if not found
|
|
11703
12128
|
*/
|
|
11704
12129
|
async commandExists(command, env2, cwd) {
|
|
11705
|
-
return new Promise((
|
|
12130
|
+
return new Promise((resolve7) => {
|
|
11706
12131
|
let settled = false;
|
|
11707
12132
|
const settle = /* @__PURE__ */ __name((value) => {
|
|
11708
12133
|
if (settled) {
|
|
@@ -11710,7 +12135,7 @@ var LspServerManager = class {
|
|
|
11710
12135
|
}
|
|
11711
12136
|
settled = true;
|
|
11712
12137
|
clearTimeout(timerId);
|
|
11713
|
-
|
|
12138
|
+
resolve7(value);
|
|
11714
12139
|
}, "settle");
|
|
11715
12140
|
const child = spawn2(command, ["--version"], {
|
|
11716
12141
|
stdio: ["ignore", "ignore", "ignore"],
|
|
@@ -11745,16 +12170,16 @@ var LspServerManager = class {
|
|
|
11745
12170
|
* - Relative paths that escape the workspace (e.g. "../../bin/evil")
|
|
11746
12171
|
*/
|
|
11747
12172
|
isPathSafe(command, workspacePath, cwd) {
|
|
11748
|
-
if (!command.includes(
|
|
12173
|
+
if (!command.includes(path12.sep) && !command.includes("/")) {
|
|
11749
12174
|
return true;
|
|
11750
12175
|
}
|
|
11751
|
-
if (
|
|
12176
|
+
if (path12.isAbsolute(command)) {
|
|
11752
12177
|
return true;
|
|
11753
12178
|
}
|
|
11754
|
-
const resolvedWorkspacePath =
|
|
11755
|
-
const basePath = cwd ?
|
|
11756
|
-
const resolvedPath =
|
|
11757
|
-
return resolvedPath.startsWith(resolvedWorkspacePath +
|
|
12179
|
+
const resolvedWorkspacePath = path12.resolve(workspacePath);
|
|
12180
|
+
const basePath = cwd ? path12.resolve(cwd) : resolvedWorkspacePath;
|
|
12181
|
+
const resolvedPath = path12.resolve(basePath, command);
|
|
12182
|
+
return resolvedPath.startsWith(resolvedWorkspacePath + path12.sep) || resolvedPath === resolvedWorkspacePath;
|
|
11758
12183
|
}
|
|
11759
12184
|
/**
|
|
11760
12185
|
* Check whether the workspace trust level allows starting an LSP server.
|
|
@@ -11768,12 +12193,12 @@ var LspServerManager = class {
|
|
|
11768
12193
|
return true;
|
|
11769
12194
|
}
|
|
11770
12195
|
if (this.requireTrustedWorkspace || serverConfig.trustRequired) {
|
|
11771
|
-
|
|
12196
|
+
debugLogger17.warn(
|
|
11772
12197
|
`Workspace not trusted, skipping LSP server ${serverName} (${serverConfig.command ?? serverConfig.transport})`
|
|
11773
12198
|
);
|
|
11774
12199
|
return false;
|
|
11775
12200
|
}
|
|
11776
|
-
|
|
12201
|
+
debugLogger17.info(
|
|
11777
12202
|
`Untrusted workspace, but LSP server ${serverName} has trustRequired=false, attempting cautious startup`
|
|
11778
12203
|
);
|
|
11779
12204
|
return true;
|
|
@@ -12014,11 +12439,11 @@ var NativeLspClient = class {
|
|
|
12014
12439
|
|
|
12015
12440
|
// packages/core/src/lsp/NativeLspService.ts
|
|
12016
12441
|
init_esbuild_shims();
|
|
12017
|
-
import * as
|
|
12442
|
+
import * as path13 from "path";
|
|
12018
12443
|
import { fileURLToPath, pathToFileURL as pathToFileURL3 } from "url";
|
|
12019
|
-
import * as
|
|
12444
|
+
import * as fs11 from "node:fs";
|
|
12020
12445
|
import { promises as fsp } from "node:fs";
|
|
12021
|
-
var
|
|
12446
|
+
var debugLogger18 = createDebugLogger("LSP");
|
|
12022
12447
|
var LANGUAGE_ID_TO_EXTENSIONS = {
|
|
12023
12448
|
typescript: ["ts", "tsx"],
|
|
12024
12449
|
typescriptreact: ["tsx"],
|
|
@@ -12076,7 +12501,7 @@ var NativeLspService = class {
|
|
|
12076
12501
|
const workspaceTrusted = this.config.isTrustedFolder();
|
|
12077
12502
|
this.serverManager.clearServerHandles();
|
|
12078
12503
|
if (this.requireTrustedWorkspace && !workspaceTrusted) {
|
|
12079
|
-
|
|
12504
|
+
debugLogger18.warn(
|
|
12080
12505
|
"Workspace is not trusted, skipping LSP server discovery"
|
|
12081
12506
|
);
|
|
12082
12507
|
return;
|
|
@@ -12094,7 +12519,7 @@ var NativeLspService = class {
|
|
|
12094
12519
|
serverConfigs,
|
|
12095
12520
|
workspaceTrusted
|
|
12096
12521
|
);
|
|
12097
|
-
|
|
12522
|
+
debugLogger18.info(
|
|
12098
12523
|
`Discovered ${admitted.length} LSP server config(s): ${formatServerNames2(
|
|
12099
12524
|
admitted.map((config) => config.name)
|
|
12100
12525
|
)}, skipped=${formatServerNames2(skipped.map((server) => server.name))}`
|
|
@@ -12129,7 +12554,7 @@ var NativeLspService = class {
|
|
|
12129
12554
|
async doReinitialize(signal) {
|
|
12130
12555
|
this.throwIfReinitializeAborted(signal);
|
|
12131
12556
|
const workspaceTrusted = this.config.isTrustedFolder();
|
|
12132
|
-
|
|
12557
|
+
debugLogger18.info(
|
|
12133
12558
|
`Reinitializing LSP servers: workspaceRoot=${this.workspaceRoot}, trusted=${workspaceTrusted}`
|
|
12134
12559
|
);
|
|
12135
12560
|
if (this.requireTrustedWorkspace && !workspaceTrusted) {
|
|
@@ -12148,7 +12573,7 @@ var NativeLspService = class {
|
|
|
12148
12573
|
},
|
|
12149
12574
|
skipped: []
|
|
12150
12575
|
};
|
|
12151
|
-
|
|
12576
|
+
debugLogger18.info(
|
|
12152
12577
|
`LSP reinitialize result: added=<none>, removed=${formatServerNames2(
|
|
12153
12578
|
removed
|
|
12154
12579
|
)}, restarted=<none>, unchanged=<none>, failed=<none>, skipped=<none>`
|
|
@@ -12190,7 +12615,7 @@ var NativeLspService = class {
|
|
|
12190
12615
|
signal
|
|
12191
12616
|
);
|
|
12192
12617
|
this.throwIfReinitializeAborted(signal);
|
|
12193
|
-
|
|
12618
|
+
debugLogger18.info(
|
|
12194
12619
|
`LSP reinitialize result: added=${formatServerNames2(
|
|
12195
12620
|
reconcile.added
|
|
12196
12621
|
)}, removed=${formatServerNames2(
|
|
@@ -12210,7 +12635,7 @@ var NativeLspService = class {
|
|
|
12210
12635
|
const skipped = [];
|
|
12211
12636
|
for (const config of configs) {
|
|
12212
12637
|
if (!workspaceTrusted && config.trustRequired) {
|
|
12213
|
-
|
|
12638
|
+
debugLogger18.warn(
|
|
12214
12639
|
`LSP server ${config.name} requires trusted workspace, skipping`
|
|
12215
12640
|
);
|
|
12216
12641
|
skipped.push({ name: config.name, reason: "server_trust_required" });
|
|
@@ -12255,7 +12680,7 @@ var NativeLspService = class {
|
|
|
12255
12680
|
try {
|
|
12256
12681
|
openedAny = this.sendDocumentOpen(name, handle, uri) || openedAny;
|
|
12257
12682
|
} catch (error) {
|
|
12258
|
-
|
|
12683
|
+
debugLogger18.warn(
|
|
12259
12684
|
`Failed to replay document ${uri} for LSP server ${name}:`,
|
|
12260
12685
|
error
|
|
12261
12686
|
);
|
|
@@ -12384,14 +12809,14 @@ var NativeLspService = class {
|
|
|
12384
12809
|
try {
|
|
12385
12810
|
filePath = fileURLToPath(uri);
|
|
12386
12811
|
} catch (error) {
|
|
12387
|
-
|
|
12812
|
+
debugLogger18.warn(`Failed to resolve file path for ${uri}:`, error);
|
|
12388
12813
|
return false;
|
|
12389
12814
|
}
|
|
12390
12815
|
let text;
|
|
12391
12816
|
try {
|
|
12392
|
-
text =
|
|
12817
|
+
text = fs11.readFileSync(filePath, "utf-8");
|
|
12393
12818
|
} catch (error) {
|
|
12394
|
-
|
|
12819
|
+
debugLogger18.warn(
|
|
12395
12820
|
`Failed to read file for LSP didOpen: ${filePath}`,
|
|
12396
12821
|
error
|
|
12397
12822
|
);
|
|
@@ -12429,7 +12854,7 @@ var NativeLspService = class {
|
|
|
12429
12854
|
this.openedDocuments.set(serverName, openedForServer);
|
|
12430
12855
|
}
|
|
12431
12856
|
resolveLanguageId(filePath, handle) {
|
|
12432
|
-
const ext =
|
|
12857
|
+
const ext = path13.extname(filePath).slice(1).toLowerCase();
|
|
12433
12858
|
if (ext && handle.config.extensionToLanguage) {
|
|
12434
12859
|
const mapping = handle.config.extensionToLanguage;
|
|
12435
12860
|
return mapping[ext] ?? mapping["." + ext];
|
|
@@ -12557,11 +12982,11 @@ var NativeLspService = class {
|
|
|
12557
12982
|
}
|
|
12558
12983
|
async delay(ms, signal) {
|
|
12559
12984
|
if (!signal) {
|
|
12560
|
-
await new Promise((
|
|
12985
|
+
await new Promise((resolve7) => setTimeout(resolve7, ms));
|
|
12561
12986
|
return;
|
|
12562
12987
|
}
|
|
12563
12988
|
this.throwIfReinitializeAborted(signal);
|
|
12564
|
-
await new Promise((
|
|
12989
|
+
await new Promise((resolve7, reject) => {
|
|
12565
12990
|
const onAbort = /* @__PURE__ */ __name(() => {
|
|
12566
12991
|
clearTimeout(timer);
|
|
12567
12992
|
signal.removeEventListener("abort", onAbort);
|
|
@@ -12569,7 +12994,7 @@ var NativeLspService = class {
|
|
|
12569
12994
|
}, "onAbort");
|
|
12570
12995
|
const timer = setTimeout(() => {
|
|
12571
12996
|
signal.removeEventListener("abort", onAbort);
|
|
12572
|
-
|
|
12997
|
+
resolve7();
|
|
12573
12998
|
}, ms);
|
|
12574
12999
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
12575
13000
|
});
|
|
@@ -12619,7 +13044,7 @@ var NativeLspService = class {
|
|
|
12619
13044
|
}
|
|
12620
13045
|
}
|
|
12621
13046
|
} catch (error) {
|
|
12622
|
-
|
|
13047
|
+
debugLogger18.warn(
|
|
12623
13048
|
`LSP workspace/symbol failed for ${serverName}:`,
|
|
12624
13049
|
error
|
|
12625
13050
|
);
|
|
@@ -12670,7 +13095,7 @@ var NativeLspService = class {
|
|
|
12670
13095
|
return definitions.slice(0, limit);
|
|
12671
13096
|
}
|
|
12672
13097
|
} catch (error) {
|
|
12673
|
-
|
|
13098
|
+
debugLogger18.warn(
|
|
12674
13099
|
`LSP textDocument/definition failed for ${name}:`,
|
|
12675
13100
|
error
|
|
12676
13101
|
);
|
|
@@ -12724,7 +13149,7 @@ var NativeLspService = class {
|
|
|
12724
13149
|
return refs.slice(0, limit);
|
|
12725
13150
|
}
|
|
12726
13151
|
} catch (error) {
|
|
12727
|
-
|
|
13152
|
+
debugLogger18.warn(
|
|
12728
13153
|
`LSP textDocument/references failed for ${name}:`,
|
|
12729
13154
|
error
|
|
12730
13155
|
);
|
|
@@ -12765,7 +13190,7 @@ var NativeLspService = class {
|
|
|
12765
13190
|
return normalized2;
|
|
12766
13191
|
}
|
|
12767
13192
|
} catch (error) {
|
|
12768
|
-
|
|
13193
|
+
debugLogger18.warn(`LSP textDocument/hover failed for ${name}:`, error);
|
|
12769
13194
|
}
|
|
12770
13195
|
}
|
|
12771
13196
|
return null;
|
|
@@ -12825,7 +13250,7 @@ var NativeLspService = class {
|
|
|
12825
13250
|
return symbols.slice(0, limit);
|
|
12826
13251
|
}
|
|
12827
13252
|
} catch (error) {
|
|
12828
|
-
|
|
13253
|
+
debugLogger18.warn(
|
|
12829
13254
|
`LSP textDocument/documentSymbol failed for ${name}:`,
|
|
12830
13255
|
error
|
|
12831
13256
|
);
|
|
@@ -12879,7 +13304,7 @@ var NativeLspService = class {
|
|
|
12879
13304
|
return implementations.slice(0, limit);
|
|
12880
13305
|
}
|
|
12881
13306
|
} catch (error) {
|
|
12882
|
-
|
|
13307
|
+
debugLogger18.warn(
|
|
12883
13308
|
`LSP textDocument/implementation failed for ${name}:`,
|
|
12884
13309
|
error
|
|
12885
13310
|
);
|
|
@@ -12933,7 +13358,7 @@ var NativeLspService = class {
|
|
|
12933
13358
|
return items.slice(0, limit);
|
|
12934
13359
|
}
|
|
12935
13360
|
} catch (error) {
|
|
12936
|
-
|
|
13361
|
+
debugLogger18.warn(
|
|
12937
13362
|
`LSP textDocument/prepareCallHierarchy failed for ${name}:`,
|
|
12938
13363
|
error
|
|
12939
13364
|
);
|
|
@@ -12973,7 +13398,7 @@ var NativeLspService = class {
|
|
|
12973
13398
|
return calls.slice(0, limit);
|
|
12974
13399
|
}
|
|
12975
13400
|
} catch (error) {
|
|
12976
|
-
|
|
13401
|
+
debugLogger18.warn(
|
|
12977
13402
|
`LSP callHierarchy/incomingCalls failed for ${name}:`,
|
|
12978
13403
|
error
|
|
12979
13404
|
);
|
|
@@ -13013,7 +13438,7 @@ var NativeLspService = class {
|
|
|
13013
13438
|
return calls.slice(0, limit);
|
|
13014
13439
|
}
|
|
13015
13440
|
} catch (error) {
|
|
13016
|
-
|
|
13441
|
+
debugLogger18.warn(
|
|
13017
13442
|
`LSP callHierarchy/outgoingCalls failed for ${name}:`,
|
|
13018
13443
|
error
|
|
13019
13444
|
);
|
|
@@ -13053,7 +13478,7 @@ var NativeLspService = class {
|
|
|
13053
13478
|
}
|
|
13054
13479
|
}
|
|
13055
13480
|
} catch (error) {
|
|
13056
|
-
|
|
13481
|
+
debugLogger18.warn(
|
|
13057
13482
|
`LSP textDocument/diagnostic failed for ${name}:`,
|
|
13058
13483
|
error
|
|
13059
13484
|
);
|
|
@@ -13095,7 +13520,7 @@ var NativeLspService = class {
|
|
|
13095
13520
|
}
|
|
13096
13521
|
}
|
|
13097
13522
|
} catch (error) {
|
|
13098
|
-
|
|
13523
|
+
debugLogger18.warn(`LSP workspace/diagnostic failed for ${name}:`, error);
|
|
13099
13524
|
}
|
|
13100
13525
|
if (results.length >= limit) {
|
|
13101
13526
|
break;
|
|
@@ -13145,7 +13570,7 @@ var NativeLspService = class {
|
|
|
13145
13570
|
return actions.slice(0, limit);
|
|
13146
13571
|
}
|
|
13147
13572
|
} catch (error) {
|
|
13148
|
-
|
|
13573
|
+
debugLogger18.warn(
|
|
13149
13574
|
`LSP textDocument/codeAction failed for ${name}:`,
|
|
13150
13575
|
error
|
|
13151
13576
|
);
|
|
@@ -13173,7 +13598,7 @@ var NativeLspService = class {
|
|
|
13173
13598
|
}
|
|
13174
13599
|
return true;
|
|
13175
13600
|
} catch (error) {
|
|
13176
|
-
|
|
13601
|
+
debugLogger18.error("Failed to apply workspace edit:", error);
|
|
13177
13602
|
return false;
|
|
13178
13603
|
}
|
|
13179
13604
|
}
|
|
@@ -13182,8 +13607,8 @@ var NativeLspService = class {
|
|
|
13182
13607
|
*/
|
|
13183
13608
|
async applyTextEdits(uri, edits) {
|
|
13184
13609
|
let filePath = uri.startsWith("file://") ? fileURLToPath(uri) : uri;
|
|
13185
|
-
if (!
|
|
13186
|
-
filePath =
|
|
13610
|
+
if (!path13.isAbsolute(filePath)) {
|
|
13611
|
+
filePath = path13.resolve(this.workspaceRoot, filePath);
|
|
13187
13612
|
}
|
|
13188
13613
|
if (!this.workspaceContext.isPathWithinWorkspace(filePath)) {
|
|
13189
13614
|
throw new Error(`Refusing to apply edits outside workspace: ${filePath}`);
|
|
@@ -13218,7 +13643,7 @@ var NativeLspService = class {
|
|
|
13218
13643
|
lines.splice(startLine, endLine - startLine + 1, ...newLines);
|
|
13219
13644
|
}
|
|
13220
13645
|
try {
|
|
13221
|
-
await fsp.access(filePath,
|
|
13646
|
+
await fsp.access(filePath, fs11.constants.W_OK);
|
|
13222
13647
|
} catch (err) {
|
|
13223
13648
|
if (err?.code !== "ENOENT") {
|
|
13224
13649
|
throw err;
|
|
@@ -13436,7 +13861,7 @@ __name(createFollowupController, "createFollowupController");
|
|
|
13436
13861
|
|
|
13437
13862
|
// packages/core/src/followup/suggestionGenerator.ts
|
|
13438
13863
|
init_esbuild_shims();
|
|
13439
|
-
var
|
|
13864
|
+
var debugLogger19 = createDebugLogger("FOLLOWUP");
|
|
13440
13865
|
var SUGGESTION_PROMPT = `[SUGGESTION MODE: Suggest what the user might naturally type next.]
|
|
13441
13866
|
|
|
13442
13867
|
FIRST: Read the LAST FEW LINES of the assistant's most recent message -- that's where
|
|
@@ -13498,7 +13923,7 @@ async function generatePromptSuggestion(config, conversationHistory, abortSignal
|
|
|
13498
13923
|
const cacheSafe = options?.enableCacheSharing ? getCacheSafeParams(sessionId) : null;
|
|
13499
13924
|
const modelOverride = options?.model;
|
|
13500
13925
|
const cacheSharingState = cacheSafe ? "true" : cacheSafeSessionId ? "session_mismatch" : "false";
|
|
13501
|
-
|
|
13926
|
+
debugLogger19.debug(
|
|
13502
13927
|
`Generating suggestion: cacheSharing=${cacheSharingState}, model=${modelOverride || "(default)"}`
|
|
13503
13928
|
);
|
|
13504
13929
|
const raw = cacheSafe ? await generateViaForkedQuery(
|
|
@@ -13514,23 +13939,23 @@ async function generatePromptSuggestion(config, conversationHistory, abortSignal
|
|
|
13514
13939
|
);
|
|
13515
13940
|
const suggestion = typeof raw === "string" ? raw.trim() : null;
|
|
13516
13941
|
if (!suggestion) {
|
|
13517
|
-
|
|
13942
|
+
debugLogger19.debug("Suggestion generation returned empty result");
|
|
13518
13943
|
return { suggestion: null, filterReason: "empty" };
|
|
13519
13944
|
}
|
|
13520
13945
|
const filterReason = getFilterReason(suggestion);
|
|
13521
13946
|
if (filterReason) {
|
|
13522
|
-
|
|
13947
|
+
debugLogger19.debug(
|
|
13523
13948
|
`Suggestion filtered: reason=${filterReason}, text="${suggestion}"`
|
|
13524
13949
|
);
|
|
13525
13950
|
return { suggestion: null, filterReason };
|
|
13526
13951
|
}
|
|
13527
|
-
|
|
13952
|
+
debugLogger19.debug(`Suggestion accepted: "${suggestion}"`);
|
|
13528
13953
|
return { suggestion };
|
|
13529
13954
|
} catch (error) {
|
|
13530
13955
|
if (abortSignal.aborted) {
|
|
13531
13956
|
return { suggestion: null };
|
|
13532
13957
|
}
|
|
13533
|
-
|
|
13958
|
+
debugLogger19.warn("Suggestion generation failed:", error);
|
|
13534
13959
|
return { suggestion: null, filterReason: "error" };
|
|
13535
13960
|
}
|
|
13536
13961
|
}
|
|
@@ -13682,9 +14107,9 @@ __name(getFilterReason, "getFilterReason");
|
|
|
13682
14107
|
|
|
13683
14108
|
// packages/core/src/followup/overlayFs.ts
|
|
13684
14109
|
init_esbuild_shims();
|
|
13685
|
-
import { mkdir as
|
|
14110
|
+
import { mkdir as mkdir4, copyFile, rm } from "node:fs/promises";
|
|
13686
14111
|
import { existsSync as existsSync3 } from "node:fs";
|
|
13687
|
-
import { join as
|
|
14112
|
+
import { join as join10, dirname as dirname6, relative, isAbsolute as isAbsolute5 } from "node:path";
|
|
13688
14113
|
import { tmpdir } from "node:os";
|
|
13689
14114
|
import { randomUUID } from "node:crypto";
|
|
13690
14115
|
var OverlayFs = class {
|
|
@@ -13692,7 +14117,7 @@ var OverlayFs = class {
|
|
|
13692
14117
|
constructor(realCwd) {
|
|
13693
14118
|
this.realCwd = realCwd;
|
|
13694
14119
|
const id = randomUUID().slice(0, 8);
|
|
13695
|
-
this.overlayDir =
|
|
14120
|
+
this.overlayDir = join10(
|
|
13696
14121
|
tmpdir(),
|
|
13697
14122
|
"qwen-speculation",
|
|
13698
14123
|
String(process.pid),
|
|
@@ -13731,9 +14156,9 @@ var OverlayFs = class {
|
|
|
13731
14156
|
if (this.writtenFiles.has(rel)) {
|
|
13732
14157
|
return this.writtenFiles.get(rel);
|
|
13733
14158
|
}
|
|
13734
|
-
const overlayPath =
|
|
13735
|
-
await
|
|
13736
|
-
const originalPath =
|
|
14159
|
+
const overlayPath = join10(this.overlayDir, rel);
|
|
14160
|
+
await mkdir4(dirname6(overlayPath), { recursive: true });
|
|
14161
|
+
const originalPath = join10(this.realCwd, rel);
|
|
13737
14162
|
if (existsSync3(originalPath)) {
|
|
13738
14163
|
try {
|
|
13739
14164
|
await copyFile(originalPath, overlayPath);
|
|
@@ -13756,9 +14181,9 @@ var OverlayFs = class {
|
|
|
13756
14181
|
async applyToReal() {
|
|
13757
14182
|
const applied = [];
|
|
13758
14183
|
for (const [rel, overlayPath] of this.writtenFiles) {
|
|
13759
|
-
const realPath =
|
|
14184
|
+
const realPath = join10(this.realCwd, rel);
|
|
13760
14185
|
try {
|
|
13761
|
-
await
|
|
14186
|
+
await mkdir4(dirname6(realPath), { recursive: true });
|
|
13762
14187
|
await copyFile(overlayPath, realPath);
|
|
13763
14188
|
applied.push(realPath);
|
|
13764
14189
|
} catch {
|
|
@@ -13780,7 +14205,7 @@ var OverlayFs = class {
|
|
|
13780
14205
|
* Returns null if the path is outside cwd.
|
|
13781
14206
|
*/
|
|
13782
14207
|
toRelative(inputPath) {
|
|
13783
|
-
const abs = isAbsolute5(inputPath) ? inputPath :
|
|
14208
|
+
const abs = isAbsolute5(inputPath) ? inputPath : join10(this.realCwd, inputPath);
|
|
13784
14209
|
const rel = relative(this.realCwd, abs);
|
|
13785
14210
|
if (isAbsolute5(rel) || rel.startsWith("..")) {
|
|
13786
14211
|
return null;
|
|
@@ -13869,7 +14294,7 @@ __name(rewritePathArgs, "rewritePathArgs");
|
|
|
13869
14294
|
|
|
13870
14295
|
// packages/core/src/followup/speculation.ts
|
|
13871
14296
|
init_esbuild_shims();
|
|
13872
|
-
var
|
|
14297
|
+
var debugLogger20 = createDebugLogger("SPECULATION");
|
|
13873
14298
|
var MAX_SPECULATION_TURNS = 20;
|
|
13874
14299
|
var MAX_SPECULATION_MESSAGES = 100;
|
|
13875
14300
|
function observeSpeculationProducer(params) {
|
|
@@ -14117,7 +14542,7 @@ async function runSpeculativeLoop(config, state, cacheSafe, modelOverride) {
|
|
|
14117
14542
|
break;
|
|
14118
14543
|
}
|
|
14119
14544
|
if (!guardDecision.allowed) {
|
|
14120
|
-
|
|
14545
|
+
debugLogger20.debug(
|
|
14121
14546
|
`Speculative guard denial: ${guardDecision.reason}`
|
|
14122
14547
|
);
|
|
14123
14548
|
hitBoundary = true;
|
|
@@ -14355,20 +14780,20 @@ __name(generatePipelinedSuggestion, "generatePipelinedSuggestion");
|
|
|
14355
14780
|
// packages/core/src/utils/filesearch/fileSearch.ts
|
|
14356
14781
|
init_esbuild_shims();
|
|
14357
14782
|
var import_picomatch3 = __toESM(require_picomatch(), 1);
|
|
14358
|
-
import
|
|
14783
|
+
import path17 from "node:path";
|
|
14359
14784
|
|
|
14360
14785
|
// packages/core/src/utils/filesearch/ignore.ts
|
|
14361
14786
|
init_esbuild_shims();
|
|
14362
14787
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
14363
14788
|
var import_picomatch = __toESM(require_picomatch(), 1);
|
|
14364
|
-
import
|
|
14365
|
-
import
|
|
14789
|
+
import fs12 from "node:fs";
|
|
14790
|
+
import path14 from "node:path";
|
|
14366
14791
|
var hasFileExtension = (0, import_picomatch.default)("**/*[*.]*");
|
|
14367
|
-
var
|
|
14792
|
+
var debugLogger21 = createDebugLogger("FILE_SEARCH_IGNORE");
|
|
14368
14793
|
function loadIgnoreRules(options) {
|
|
14369
14794
|
const ignorer = new Ignore();
|
|
14370
14795
|
if (options.useGitignore) {
|
|
14371
|
-
const gitignorePath =
|
|
14796
|
+
const gitignorePath = path14.join(options.projectRoot, ".gitignore");
|
|
14372
14797
|
const gitignoreContent = readIgnoreFile(gitignorePath);
|
|
14373
14798
|
if (gitignoreContent !== void 0) {
|
|
14374
14799
|
ignorer.add(gitignoreContent);
|
|
@@ -14378,7 +14803,7 @@ function loadIgnoreRules(options) {
|
|
|
14378
14803
|
for (const ignoreFileName of getQwenIgnoreFileNames(
|
|
14379
14804
|
options.customIgnoreFiles
|
|
14380
14805
|
)) {
|
|
14381
|
-
const qwenignorePath =
|
|
14806
|
+
const qwenignorePath = path14.join(options.projectRoot, ignoreFileName);
|
|
14382
14807
|
const qwenignoreContent = readIgnoreFile(qwenignorePath);
|
|
14383
14808
|
if (qwenignoreContent !== void 0) {
|
|
14384
14809
|
ignorer.addSource(qwenignoreContent);
|
|
@@ -14399,11 +14824,11 @@ function loadIgnoreRules(options) {
|
|
|
14399
14824
|
__name(loadIgnoreRules, "loadIgnoreRules");
|
|
14400
14825
|
function readIgnoreFile(filePath) {
|
|
14401
14826
|
try {
|
|
14402
|
-
return
|
|
14827
|
+
return fs12.readFileSync(filePath, "utf8");
|
|
14403
14828
|
} catch (_error) {
|
|
14404
14829
|
const error = _error;
|
|
14405
14830
|
if (error.code !== "ENOENT") {
|
|
14406
|
-
|
|
14831
|
+
debugLogger21.warn(`Failed to read ${filePath}: ${error.message}`);
|
|
14407
14832
|
}
|
|
14408
14833
|
return void 0;
|
|
14409
14834
|
}
|
|
@@ -14552,8 +14977,8 @@ __name(hasGlobSyntax, "hasGlobSyntax");
|
|
|
14552
14977
|
// packages/core/src/utils/filesearch/crawler.ts
|
|
14553
14978
|
init_esbuild_shims();
|
|
14554
14979
|
var import_fdir = __toESM(require_dist(), 1);
|
|
14555
|
-
import
|
|
14556
|
-
import
|
|
14980
|
+
import path15 from "node:path";
|
|
14981
|
+
import fs13 from "node:fs";
|
|
14557
14982
|
import { spawn as spawn3 } from "node:child_process";
|
|
14558
14983
|
|
|
14559
14984
|
// packages/core/src/utils/filesearch/crawlCache.ts
|
|
@@ -14638,7 +15063,7 @@ var write = /* @__PURE__ */ __name((key, results, ttlMs) => {
|
|
|
14638
15063
|
|
|
14639
15064
|
// packages/core/src/utils/filesearch/crawler.ts
|
|
14640
15065
|
function toPosixPath(p) {
|
|
14641
|
-
return p.split(
|
|
15066
|
+
return p.split(path15.sep).join(path15.posix.sep);
|
|
14642
15067
|
}
|
|
14643
15068
|
__name(toPosixPath, "toPosixPath");
|
|
14644
15069
|
function normalizeGitPath(p, stripTrailingSlash = false) {
|
|
@@ -14734,7 +15159,7 @@ function redactArgsForLog(args) {
|
|
|
14734
15159
|
if (/^[A-Za-z]:[\\/]/.test(t) || t.startsWith("/") && t.length > 1) {
|
|
14735
15160
|
return "<abs-path>";
|
|
14736
15161
|
}
|
|
14737
|
-
if (t.includes(
|
|
15162
|
+
if (t.includes(path15.sep) && t.length > 32) {
|
|
14738
15163
|
return "<path>";
|
|
14739
15164
|
}
|
|
14740
15165
|
return t;
|
|
@@ -14765,7 +15190,7 @@ function withSafeGitConfig(args) {
|
|
|
14765
15190
|
}
|
|
14766
15191
|
__name(withSafeGitConfig, "withSafeGitConfig");
|
|
14767
15192
|
function canonicalStatePath(p) {
|
|
14768
|
-
return toPosixPath(
|
|
15193
|
+
return toPosixPath(path15.resolve(p));
|
|
14769
15194
|
}
|
|
14770
15195
|
__name(canonicalStatePath, "canonicalStatePath");
|
|
14771
15196
|
function getStateKey(options) {
|
|
@@ -14810,28 +15235,28 @@ function resolveGitDir(crawlDirectory) {
|
|
|
14810
15235
|
}
|
|
14811
15236
|
let current = crawlDirectory;
|
|
14812
15237
|
while (current) {
|
|
14813
|
-
const gitPath =
|
|
15238
|
+
const gitPath = path15.join(current, ".git");
|
|
14814
15239
|
try {
|
|
14815
|
-
const stat5 =
|
|
15240
|
+
const stat5 = fs13.statSync(gitPath);
|
|
14816
15241
|
if (stat5.isDirectory()) {
|
|
14817
15242
|
pathCacheSet(resolveGitDirCache, cacheKey, gitPath);
|
|
14818
15243
|
return gitPath;
|
|
14819
15244
|
}
|
|
14820
15245
|
if (stat5.isFile()) {
|
|
14821
|
-
const contents =
|
|
15246
|
+
const contents = fs13.readFileSync(gitPath, "utf8").trim();
|
|
14822
15247
|
const match = contents.match(/^gitdir:\s*(.+)$/i);
|
|
14823
15248
|
if (!match) {
|
|
14824
15249
|
pathCacheSet(resolveGitDirCache, cacheKey, null);
|
|
14825
15250
|
return null;
|
|
14826
15251
|
}
|
|
14827
15252
|
const resolvedGitDir = match[1].trim();
|
|
14828
|
-
let resolvedAbs =
|
|
15253
|
+
let resolvedAbs = path15.isAbsolute(resolvedGitDir) ? path15.resolve(resolvedGitDir) : path15.resolve(current, resolvedGitDir);
|
|
14829
15254
|
try {
|
|
14830
|
-
resolvedAbs =
|
|
15255
|
+
resolvedAbs = fs13.realpathSync(resolvedAbs);
|
|
14831
15256
|
try {
|
|
14832
|
-
|
|
15257
|
+
fs13.statSync(path15.join(resolvedAbs, "HEAD"));
|
|
14833
15258
|
} catch {
|
|
14834
|
-
|
|
15259
|
+
fs13.statSync(path15.join(resolvedAbs, "index"));
|
|
14835
15260
|
}
|
|
14836
15261
|
} catch {
|
|
14837
15262
|
pathCacheSet(resolveGitDirCache, cacheKey, null);
|
|
@@ -14847,7 +15272,7 @@ function resolveGitDir(crawlDirectory) {
|
|
|
14847
15272
|
return null;
|
|
14848
15273
|
}
|
|
14849
15274
|
}
|
|
14850
|
-
const parent =
|
|
15275
|
+
const parent = path15.dirname(current);
|
|
14851
15276
|
if (parent === current) {
|
|
14852
15277
|
break;
|
|
14853
15278
|
}
|
|
@@ -14863,8 +15288,8 @@ function getGitRootMtime(crawlDirectory) {
|
|
|
14863
15288
|
if (!gitDir) {
|
|
14864
15289
|
return null;
|
|
14865
15290
|
}
|
|
14866
|
-
const indexPath =
|
|
14867
|
-
const indexStat =
|
|
15291
|
+
const indexPath = path15.join(gitDir, "index");
|
|
15292
|
+
const indexStat = fs13.statSync(indexPath);
|
|
14868
15293
|
return indexStat.mtimeMs;
|
|
14869
15294
|
} catch {
|
|
14870
15295
|
}
|
|
@@ -14920,7 +15345,7 @@ function computeLinesFingerprint(lines) {
|
|
|
14920
15345
|
__name(computeLinesFingerprint, "computeLinesFingerprint");
|
|
14921
15346
|
function runCommand(command, args, cwd, timeoutMs = 2e4, options) {
|
|
14922
15347
|
const collectLines = options?.collectLines !== false;
|
|
14923
|
-
return new Promise((
|
|
15348
|
+
return new Promise((resolve7) => {
|
|
14924
15349
|
const lines = [];
|
|
14925
15350
|
let settled = false;
|
|
14926
15351
|
let timedOut = false;
|
|
@@ -14932,7 +15357,7 @@ function runCommand(command, args, cwd, timeoutMs = 2e4, options) {
|
|
|
14932
15357
|
return;
|
|
14933
15358
|
}
|
|
14934
15359
|
settled = true;
|
|
14935
|
-
|
|
15360
|
+
resolve7({ success, lines: resultLines });
|
|
14936
15361
|
}, "finalize");
|
|
14937
15362
|
let stderrBuf = "";
|
|
14938
15363
|
let child;
|
|
@@ -15100,19 +15525,19 @@ function normalizePath(p) {
|
|
|
15100
15525
|
}
|
|
15101
15526
|
__name(normalizePath, "normalizePath");
|
|
15102
15527
|
function getPosixRelative(from, to) {
|
|
15103
|
-
const fromResolved =
|
|
15104
|
-
const toResolved =
|
|
15528
|
+
const fromResolved = path15.resolve(from);
|
|
15529
|
+
const toResolved = path15.resolve(to);
|
|
15105
15530
|
let fromAbs = fromResolved;
|
|
15106
15531
|
let toAbs = toResolved;
|
|
15107
15532
|
try {
|
|
15108
|
-
fromAbs =
|
|
15533
|
+
fromAbs = fs13.realpathSync(fromResolved);
|
|
15109
15534
|
} catch {
|
|
15110
15535
|
}
|
|
15111
15536
|
try {
|
|
15112
|
-
toAbs =
|
|
15537
|
+
toAbs = fs13.realpathSync(toResolved);
|
|
15113
15538
|
} catch {
|
|
15114
15539
|
}
|
|
15115
|
-
const relative2 =
|
|
15540
|
+
const relative2 = path15.relative(fromAbs, toAbs);
|
|
15116
15541
|
const posixRel = toPosixPath(relative2);
|
|
15117
15542
|
return posixRel === "" ? "." : posixRel;
|
|
15118
15543
|
}
|
|
@@ -15121,18 +15546,18 @@ function isValidIgnorePath(relativePath) {
|
|
|
15121
15546
|
if (!relativePath || relativePath === ".") {
|
|
15122
15547
|
return false;
|
|
15123
15548
|
}
|
|
15124
|
-
if (
|
|
15549
|
+
if (path15.posix.isAbsolute(relativePath)) {
|
|
15125
15550
|
return false;
|
|
15126
15551
|
}
|
|
15127
15552
|
return relativePath !== ".." && !relativePath.startsWith("../") && !relativePath.includes("/../");
|
|
15128
15553
|
}
|
|
15129
15554
|
__name(isValidIgnorePath, "isValidIgnorePath");
|
|
15130
15555
|
function toFdirExcludeRelativePath(crawlDirectory, dirPath) {
|
|
15131
|
-
const base =
|
|
15132
|
-
const absoluteCandidate =
|
|
15133
|
-
let rel =
|
|
15556
|
+
const base = path15.resolve(crawlDirectory);
|
|
15557
|
+
const absoluteCandidate = path15.isAbsolute(dirPath) ? dirPath : path15.join(base, dirPath);
|
|
15558
|
+
let rel = path15.relative(base, absoluteCandidate);
|
|
15134
15559
|
rel = toPosixPath(rel);
|
|
15135
|
-
if (!rel || rel.startsWith("..") ||
|
|
15560
|
+
if (!rel || rel.startsWith("..") || path15.posix.isAbsolute(rel)) {
|
|
15136
15561
|
return null;
|
|
15137
15562
|
}
|
|
15138
15563
|
return isValidIgnorePath(rel) ? rel : null;
|
|
@@ -15222,7 +15647,7 @@ __name(isUnderIgnoredDirectory, "isUnderIgnoredDirectory");
|
|
|
15222
15647
|
var YIELD_INTERVAL = 1e3;
|
|
15223
15648
|
async function maybeYield(index) {
|
|
15224
15649
|
if (index > 0 && index % YIELD_INTERVAL === 0) {
|
|
15225
|
-
await new Promise((
|
|
15650
|
+
await new Promise((resolve7) => setImmediate(resolve7));
|
|
15226
15651
|
}
|
|
15227
15652
|
}
|
|
15228
15653
|
__name(maybeYield, "maybeYield");
|
|
@@ -15339,16 +15764,16 @@ function posixPathUnderGitRoot(normalizedFile, relativeToGitRoot, relativeToCraw
|
|
|
15339
15764
|
if (relativeToGitRoot && relativeToGitRoot !== ".") {
|
|
15340
15765
|
const rest = sliceAfterGitPathspecPrefix(nf, normGitRoot);
|
|
15341
15766
|
if (rest !== null) {
|
|
15342
|
-
return
|
|
15767
|
+
return path15.posix.join(normCrawlDir, rest);
|
|
15343
15768
|
}
|
|
15344
15769
|
if (equalsRepoRelativeCaseAware(nf, normGitRoot)) {
|
|
15345
15770
|
const base = nf.replace(/\/+$/, "");
|
|
15346
15771
|
return `${base}/`;
|
|
15347
15772
|
}
|
|
15348
15773
|
const nfFile = nf.replace(/\/+$/, "");
|
|
15349
|
-
return
|
|
15774
|
+
return path15.posix.join(normCrawlDir, nfFile);
|
|
15350
15775
|
}
|
|
15351
|
-
return
|
|
15776
|
+
return path15.posix.join(normCrawlDir, nf.replace(/\/+$/, ""));
|
|
15352
15777
|
}
|
|
15353
15778
|
__name(posixPathUnderGitRoot, "posixPathUnderGitRoot");
|
|
15354
15779
|
async function crawlWithGitLsFiles(stateKey, crawlDirectory, cwd, options, workingTreePrefetch) {
|
|
@@ -15427,7 +15852,7 @@ async function crawlWithGitLsFiles(stateKey, crawlDirectory, cwd, options, worki
|
|
|
15427
15852
|
}
|
|
15428
15853
|
let stat5;
|
|
15429
15854
|
try {
|
|
15430
|
-
stat5 =
|
|
15855
|
+
stat5 = fs13.lstatSync(path15.join(gitRoot, ...normalizedFile.split("/")));
|
|
15431
15856
|
} catch {
|
|
15432
15857
|
return true;
|
|
15433
15858
|
}
|
|
@@ -15529,7 +15954,7 @@ function collectDirectoryRows(options) {
|
|
|
15529
15954
|
const dirFilter = options.ignore.getDirectoryFilter();
|
|
15530
15955
|
const rows = [];
|
|
15531
15956
|
const visit = /* @__PURE__ */ __name((dir, relativePath, depth) => {
|
|
15532
|
-
const cwdRelative = relativePath === "" ? relativeToCrawlDir :
|
|
15957
|
+
const cwdRelative = relativePath === "" ? relativeToCrawlDir : path15.posix.join(relativeToCrawlDir, relativePath);
|
|
15533
15958
|
if (cwdRelative !== ".") {
|
|
15534
15959
|
const row = cwdRelative.endsWith("/") ? cwdRelative : `${cwdRelative}/`;
|
|
15535
15960
|
if (!isValidIgnorePath(row.slice(0, -1)) || dirFilter(row)) {
|
|
@@ -15542,7 +15967,7 @@ function collectDirectoryRows(options) {
|
|
|
15542
15967
|
}
|
|
15543
15968
|
let entries;
|
|
15544
15969
|
try {
|
|
15545
|
-
entries =
|
|
15970
|
+
entries = fs13.readdirSync(dir, { withFileTypes: true });
|
|
15546
15971
|
} catch {
|
|
15547
15972
|
return;
|
|
15548
15973
|
}
|
|
@@ -15550,8 +15975,8 @@ function collectDirectoryRows(options) {
|
|
|
15550
15975
|
if (!entry.isDirectory()) {
|
|
15551
15976
|
continue;
|
|
15552
15977
|
}
|
|
15553
|
-
const childRelative = relativePath ?
|
|
15554
|
-
visit(
|
|
15978
|
+
const childRelative = relativePath ? path15.posix.join(relativePath, entry.name) : entry.name;
|
|
15979
|
+
visit(path15.join(dir, entry.name), childRelative, depth + 1);
|
|
15555
15980
|
}
|
|
15556
15981
|
}, "visit");
|
|
15557
15982
|
visit(options.crawlDirectory, "", 0);
|
|
@@ -15589,7 +16014,7 @@ async function crawlWithRipgrep(stateKey, crawlDirectory, cwd, options) {
|
|
|
15589
16014
|
return false;
|
|
15590
16015
|
}
|
|
15591
16016
|
const normalizedFile = normalizePath(file);
|
|
15592
|
-
const fullPath =
|
|
16017
|
+
const fullPath = path15.posix.join(relativeToCrawlDir, normalizedFile);
|
|
15593
16018
|
if (!shouldIncludeFile(fullPath, dirFilter, fileFilter)) {
|
|
15594
16019
|
return true;
|
|
15595
16020
|
}
|
|
@@ -15648,7 +16073,7 @@ async function crawlWithFdir(options) {
|
|
|
15648
16073
|
return dirFilter(`${relativePath}/`);
|
|
15649
16074
|
}).filter((filePath, isDirectory) => {
|
|
15650
16075
|
if (isDirectory) return true;
|
|
15651
|
-
const cwdRelative =
|
|
16076
|
+
const cwdRelative = path15.posix.join(relativeToCrawlDir, filePath);
|
|
15652
16077
|
if (!isValidIgnorePath(cwdRelative)) {
|
|
15653
16078
|
return false;
|
|
15654
16079
|
}
|
|
@@ -15661,7 +16086,7 @@ async function crawlWithFdir(options) {
|
|
|
15661
16086
|
} catch {
|
|
15662
16087
|
return [];
|
|
15663
16088
|
}
|
|
15664
|
-
const mapped = results.filter((p) => p.length > 0 && p !== ".").map((p) =>
|
|
16089
|
+
const mapped = results.filter((p) => p.length > 0 && p !== ".").map((p) => path15.posix.join(relativeToCrawlDir, p));
|
|
15665
16090
|
if (relativeToCrawlDir !== ".") {
|
|
15666
16091
|
const rootDir = relativeToCrawlDir.endsWith("/") ? relativeToCrawlDir : `${relativeToCrawlDir}/`;
|
|
15667
16092
|
if (!mapped.includes(rootDir)) {
|
|
@@ -15788,8 +16213,8 @@ __name(applyMaxFilesLimit, "applyMaxFilesLimit");
|
|
|
15788
16213
|
|
|
15789
16214
|
// packages/core/src/utils/filesearch/fzfWorkerHandle.ts
|
|
15790
16215
|
init_esbuild_shims();
|
|
15791
|
-
import
|
|
15792
|
-
import
|
|
16216
|
+
import fs14 from "node:fs";
|
|
16217
|
+
import path16 from "node:path";
|
|
15793
16218
|
import { Worker } from "node:worker_threads";
|
|
15794
16219
|
|
|
15795
16220
|
// node_modules/fzf/dist/fzf.es.js
|
|
@@ -16656,7 +17081,7 @@ function basicMatch(query) {
|
|
|
16656
17081
|
__name(basicMatch, "basicMatch");
|
|
16657
17082
|
var isNode = typeof __require !== "undefined" && typeof window === "undefined";
|
|
16658
17083
|
function asyncMatcher(token, len, iter2, onFinish) {
|
|
16659
|
-
return new Promise((
|
|
17084
|
+
return new Promise((resolve7, reject) => {
|
|
16660
17085
|
const INCREMENT = 1e3;
|
|
16661
17086
|
let i = 0, end = Math.min(INCREMENT, len);
|
|
16662
17087
|
const step = /* @__PURE__ */ __name(() => {
|
|
@@ -16669,7 +17094,7 @@ function asyncMatcher(token, len, iter2, onFinish) {
|
|
|
16669
17094
|
end = Math.min(end + INCREMENT, len);
|
|
16670
17095
|
isNode ? setImmediate(step) : setTimeout(step);
|
|
16671
17096
|
} else {
|
|
16672
|
-
|
|
17097
|
+
resolve7(onFinish());
|
|
16673
17098
|
}
|
|
16674
17099
|
}, "step");
|
|
16675
17100
|
step();
|
|
@@ -16841,11 +17266,11 @@ var inProcessTransport = {
|
|
|
16841
17266
|
var resolvedWorkerPath;
|
|
16842
17267
|
function getWorkerScriptPath() {
|
|
16843
17268
|
if (resolvedWorkerPath !== void 0) return resolvedWorkerPath;
|
|
16844
|
-
const candidate =
|
|
17269
|
+
const candidate = path16.join(
|
|
16845
17270
|
resolveBundleDir(import.meta.url),
|
|
16846
17271
|
"fzfWorker.js"
|
|
16847
17272
|
);
|
|
16848
|
-
resolvedWorkerPath =
|
|
17273
|
+
resolvedWorkerPath = fs14.existsSync(candidate) ? candidate : null;
|
|
16849
17274
|
return resolvedWorkerPath;
|
|
16850
17275
|
}
|
|
16851
17276
|
__name(getWorkerScriptPath, "getWorkerScriptPath");
|
|
@@ -16941,12 +17366,12 @@ var workerTransport = {
|
|
|
16941
17366
|
}
|
|
16942
17367
|
await readyPromise;
|
|
16943
17368
|
const reqId = nextReqId++;
|
|
16944
|
-
return new Promise((
|
|
17369
|
+
return new Promise((resolve7, reject) => {
|
|
16945
17370
|
if (readyState === "disposed" || readyState === "failed") {
|
|
16946
17371
|
reject(new Error(`fzf worker not available (${readyState})`));
|
|
16947
17372
|
return;
|
|
16948
17373
|
}
|
|
16949
|
-
pending.set(reqId, { resolve:
|
|
17374
|
+
pending.set(reqId, { resolve: resolve7, reject });
|
|
16950
17375
|
try {
|
|
16951
17376
|
worker.postMessage({ type: "find", reqId, pattern, limit });
|
|
16952
17377
|
} catch (err) {
|
|
@@ -17041,7 +17466,7 @@ async function filter(allPaths, pattern, signal) {
|
|
|
17041
17466
|
const results = [];
|
|
17042
17467
|
for (const [i, p] of allPaths.entries()) {
|
|
17043
17468
|
if (i % 1e3 === 0) {
|
|
17044
|
-
await new Promise((
|
|
17469
|
+
await new Promise((resolve7) => setImmediate(resolve7));
|
|
17045
17470
|
if (signal?.aborted) {
|
|
17046
17471
|
throw new AbortError();
|
|
17047
17472
|
}
|
|
@@ -17120,7 +17545,7 @@ var RecursiveFileSearch = class {
|
|
|
17120
17545
|
const results = [];
|
|
17121
17546
|
for (const [i, candidate] of filteredCandidates.entries()) {
|
|
17122
17547
|
if (i % 1e3 === 0) {
|
|
17123
|
-
await new Promise((
|
|
17548
|
+
await new Promise((resolve7) => setImmediate(resolve7));
|
|
17124
17549
|
if (options.signal?.aborted) {
|
|
17125
17550
|
throw new AbortError();
|
|
17126
17551
|
}
|
|
@@ -17162,9 +17587,9 @@ var DirectoryFileSearch = class {
|
|
|
17162
17587
|
throw new Error("Engine not initialized. Call initialize() first.");
|
|
17163
17588
|
}
|
|
17164
17589
|
pattern = pattern || "*";
|
|
17165
|
-
const dir = pattern.endsWith("/") ? pattern :
|
|
17166
|
-
const crawlDirectory =
|
|
17167
|
-
const listingProjectRoot =
|
|
17590
|
+
const dir = pattern.endsWith("/") ? pattern : path17.dirname(pattern);
|
|
17591
|
+
const crawlDirectory = path17.join(this.options.projectRoot, dir);
|
|
17592
|
+
const listingProjectRoot = path17.resolve(crawlDirectory) === path17.resolve(this.options.projectRoot);
|
|
17168
17593
|
const results = await crawl({
|
|
17169
17594
|
crawlDirectory,
|
|
17170
17595
|
cwd: this.options.projectRoot,
|
|
@@ -17245,13 +17670,13 @@ __name(analyzeToolResultRetention, "analyzeToolResultRetention");
|
|
|
17245
17670
|
|
|
17246
17671
|
// packages/core/src/utils/pathReader.ts
|
|
17247
17672
|
init_esbuild_shims();
|
|
17248
|
-
import { promises as
|
|
17249
|
-
import
|
|
17673
|
+
import { promises as fs15 } from "node:fs";
|
|
17674
|
+
import path18 from "node:path";
|
|
17250
17675
|
async function readPathFromWorkspace(pathStr, config) {
|
|
17251
17676
|
const workspace = config.getWorkspaceContext();
|
|
17252
17677
|
const fileService = config.getFileService();
|
|
17253
17678
|
let absolutePath = null;
|
|
17254
|
-
if (
|
|
17679
|
+
if (path18.isAbsolute(pathStr)) {
|
|
17255
17680
|
if (!workspace.isPathWithinWorkspace(pathStr)) {
|
|
17256
17681
|
throw new Error(
|
|
17257
17682
|
`Absolute path is outside of the allowed workspace: ${pathStr}`
|
|
@@ -17261,9 +17686,9 @@ async function readPathFromWorkspace(pathStr, config) {
|
|
|
17261
17686
|
} else {
|
|
17262
17687
|
const searchDirs = workspace.getDirectories();
|
|
17263
17688
|
for (const dir of searchDirs) {
|
|
17264
|
-
const potentialPath =
|
|
17689
|
+
const potentialPath = path18.resolve(dir, pathStr);
|
|
17265
17690
|
try {
|
|
17266
|
-
await
|
|
17691
|
+
await fs15.access(potentialPath);
|
|
17267
17692
|
absolutePath = potentialPath;
|
|
17268
17693
|
break;
|
|
17269
17694
|
} catch {
|
|
@@ -17273,7 +17698,7 @@ async function readPathFromWorkspace(pathStr, config) {
|
|
|
17273
17698
|
if (!absolutePath) {
|
|
17274
17699
|
throw new Error(`Path not found in workspace: ${pathStr}`);
|
|
17275
17700
|
}
|
|
17276
|
-
const stats = await
|
|
17701
|
+
const stats = await fs15.stat(absolutePath);
|
|
17277
17702
|
if (stats.isDirectory()) {
|
|
17278
17703
|
const allParts = [];
|
|
17279
17704
|
allParts.push({
|
|
@@ -17289,7 +17714,7 @@ async function readPathFromWorkspace(pathStr, config) {
|
|
|
17289
17714
|
absolute: true
|
|
17290
17715
|
});
|
|
17291
17716
|
const relativeFiles = files.map(
|
|
17292
|
-
(p) =>
|
|
17717
|
+
(p) => path18.relative(config.getTargetDir(), p)
|
|
17293
17718
|
);
|
|
17294
17719
|
const filteringOptions = config.getFileFilteringOptions();
|
|
17295
17720
|
const filteredFiles = fileService.filterFiles(relativeFiles, {
|
|
@@ -17297,10 +17722,10 @@ async function readPathFromWorkspace(pathStr, config) {
|
|
|
17297
17722
|
respectQwenIgnore: filteringOptions.respectQwenIgnore
|
|
17298
17723
|
});
|
|
17299
17724
|
const finalFiles = filteredFiles.map(
|
|
17300
|
-
(p) =>
|
|
17725
|
+
(p) => path18.resolve(config.getTargetDir(), p)
|
|
17301
17726
|
);
|
|
17302
17727
|
for (const filePath of finalFiles) {
|
|
17303
|
-
const relativePathForDisplay =
|
|
17728
|
+
const relativePathForDisplay = path18.relative(absolutePath, filePath);
|
|
17304
17729
|
allParts.push({ text: `--- ${relativePathForDisplay} ---
|
|
17305
17730
|
` });
|
|
17306
17731
|
const result = await processSingleFileContent(filePath, config, {
|
|
@@ -17316,7 +17741,7 @@ async function readPathFromWorkspace(pathStr, config) {
|
|
|
17316
17741
|
allParts.push({ text: `--- End of content for directory: ${pathStr} ---` });
|
|
17317
17742
|
return allParts;
|
|
17318
17743
|
} else {
|
|
17319
|
-
const relativePath =
|
|
17744
|
+
const relativePath = path18.relative(config.getTargetDir(), absolutePath);
|
|
17320
17745
|
const singleFileFilteringOptions = config.getFileFilteringOptions();
|
|
17321
17746
|
const filtered = fileService.filterFiles([relativePath], {
|
|
17322
17747
|
respectGitIgnore: singleFileFilteringOptions.respectGitIgnore,
|
|
@@ -17335,16 +17760,16 @@ __name(readPathFromWorkspace, "readPathFromWorkspace");
|
|
|
17335
17760
|
|
|
17336
17761
|
// packages/core/src/utils/projectSummary.ts
|
|
17337
17762
|
init_esbuild_shims();
|
|
17338
|
-
import * as
|
|
17339
|
-
import * as
|
|
17763
|
+
import * as fs16 from "fs/promises";
|
|
17764
|
+
import * as path19 from "path";
|
|
17340
17765
|
var PROJECT_SUMMARY_FILENAME = "PROJECT_SUMMARY.md";
|
|
17341
17766
|
var WELCOME_BACK_STATE_FILENAME = "welcome-back-state.json";
|
|
17342
17767
|
function getProjectSummaryPath() {
|
|
17343
|
-
return
|
|
17768
|
+
return path19.join(process.cwd(), ".qwen", PROJECT_SUMMARY_FILENAME);
|
|
17344
17769
|
}
|
|
17345
17770
|
__name(getProjectSummaryPath, "getProjectSummaryPath");
|
|
17346
17771
|
function getWelcomeBackStatePath() {
|
|
17347
|
-
return
|
|
17772
|
+
return path19.join(process.cwd(), ".qwen", WELCOME_BACK_STATE_FILENAME);
|
|
17348
17773
|
}
|
|
17349
17774
|
__name(getWelcomeBackStatePath, "getWelcomeBackStatePath");
|
|
17350
17775
|
function buildSummaryFingerprint(stat5) {
|
|
@@ -17353,7 +17778,7 @@ function buildSummaryFingerprint(stat5) {
|
|
|
17353
17778
|
__name(buildSummaryFingerprint, "buildSummaryFingerprint");
|
|
17354
17779
|
async function getWelcomeBackState() {
|
|
17355
17780
|
try {
|
|
17356
|
-
const raw = await
|
|
17781
|
+
const raw = await fs16.readFile(getWelcomeBackStatePath(), "utf-8");
|
|
17357
17782
|
const parsed = JSON.parse(raw);
|
|
17358
17783
|
if (parsed.version !== 1 || parsed.lastChoice !== "restart" || typeof parsed.summaryFingerprint !== "string") {
|
|
17359
17784
|
return null;
|
|
@@ -17369,7 +17794,7 @@ async function getWelcomeBackState() {
|
|
|
17369
17794
|
__name(getWelcomeBackState, "getWelcomeBackState");
|
|
17370
17795
|
async function saveWelcomeBackRestartChoice(summaryFingerprint) {
|
|
17371
17796
|
const statePath = getWelcomeBackStatePath();
|
|
17372
|
-
await
|
|
17797
|
+
await fs16.mkdir(path19.dirname(statePath), { recursive: true });
|
|
17373
17798
|
const state = {
|
|
17374
17799
|
version: 1,
|
|
17375
17800
|
lastChoice: "restart",
|
|
@@ -17382,7 +17807,7 @@ async function saveWelcomeBackRestartChoice(summaryFingerprint) {
|
|
|
17382
17807
|
__name(saveWelcomeBackRestartChoice, "saveWelcomeBackRestartChoice");
|
|
17383
17808
|
async function clearWelcomeBackState() {
|
|
17384
17809
|
try {
|
|
17385
|
-
await
|
|
17810
|
+
await fs16.rm(getWelcomeBackStatePath(), { force: true });
|
|
17386
17811
|
} catch {
|
|
17387
17812
|
}
|
|
17388
17813
|
}
|
|
@@ -17390,15 +17815,15 @@ __name(clearWelcomeBackState, "clearWelcomeBackState");
|
|
|
17390
17815
|
async function getProjectSummaryInfo() {
|
|
17391
17816
|
const summaryPath = getProjectSummaryPath();
|
|
17392
17817
|
try {
|
|
17393
|
-
await
|
|
17818
|
+
await fs16.access(summaryPath);
|
|
17394
17819
|
} catch {
|
|
17395
17820
|
return {
|
|
17396
17821
|
hasHistory: false
|
|
17397
17822
|
};
|
|
17398
17823
|
}
|
|
17399
17824
|
try {
|
|
17400
|
-
const summaryStat = await
|
|
17401
|
-
const content = await
|
|
17825
|
+
const summaryStat = await fs16.stat(summaryPath);
|
|
17826
|
+
const content = await fs16.readFile(summaryPath, "utf-8");
|
|
17402
17827
|
const summaryFingerprint = buildSummaryFingerprint(summaryStat);
|
|
17403
17828
|
const timestampMatch = content.match(/\*\*Update time\*\*: (.+)/);
|
|
17404
17829
|
const timestamp = timestampMatch ? timestampMatch[1] : (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -17466,9 +17891,9 @@ __name(getProjectSummaryInfo, "getProjectSummaryInfo");
|
|
|
17466
17891
|
|
|
17467
17892
|
// packages/core/src/tools/readManyFiles.ts
|
|
17468
17893
|
init_esbuild_shims();
|
|
17469
|
-
import * as
|
|
17894
|
+
import * as fs17 from "node:fs";
|
|
17470
17895
|
import * as os3 from "node:os";
|
|
17471
|
-
import * as
|
|
17896
|
+
import * as path20 from "node:path";
|
|
17472
17897
|
var DEFAULT_OUTPUT_HEADER = "\n--- Content from referenced files ---";
|
|
17473
17898
|
var DEFAULT_OUTPUT_TERMINATOR = "\n--- End of content ---";
|
|
17474
17899
|
var SNAPSHOT_MAX_SIZE_BYTES = 100 * 1024 * 1024;
|
|
@@ -17488,7 +17913,7 @@ async function readManyFiles(config, options) {
|
|
|
17488
17913
|
for (const rawPattern of inputPatterns) {
|
|
17489
17914
|
signal?.throwIfAborted();
|
|
17490
17915
|
const normalizedPattern = rawPattern.replace(/\\/g, "/");
|
|
17491
|
-
const fullPath =
|
|
17916
|
+
const fullPath = path20.resolve(projectRoot, normalizedPattern);
|
|
17492
17917
|
const displayPath = displayPaths?.get(fullPath) ?? fullPath;
|
|
17493
17918
|
const validatedIdentity = validatedPathIdentities?.get(fullPath);
|
|
17494
17919
|
if (validatedPathIdentities && !validatedIdentity) continue;
|
|
@@ -17507,7 +17932,7 @@ async function readManyFiles(config, options) {
|
|
|
17507
17932
|
if (validatedIdentity && !await matchesValidatedPathIdentity(fullPath, validatedIdentity)) {
|
|
17508
17933
|
continue;
|
|
17509
17934
|
}
|
|
17510
|
-
const stats =
|
|
17935
|
+
const stats = fs17.existsSync(fullPath) ? fs17.statSync(fullPath) : null;
|
|
17511
17936
|
if (stats?.isDirectory()) {
|
|
17512
17937
|
const { contentParts: dirParts, info } = await readDirectory(
|
|
17513
17938
|
config,
|
|
@@ -17627,9 +18052,9 @@ async function readValidatedTextFileContent(config, filePath, expected, preserve
|
|
|
17627
18052
|
__name(readValidatedTextFileContent, "readValidatedTextFileContent");
|
|
17628
18053
|
async function matchesValidatedPathIdentity(filePath, expected) {
|
|
17629
18054
|
try {
|
|
17630
|
-
const canonicalPath = await
|
|
18055
|
+
const canonicalPath = await fs17.promises.realpath(filePath);
|
|
17631
18056
|
if (canonicalPath !== filePath) return false;
|
|
17632
|
-
const stats = await
|
|
18057
|
+
const stats = await fs17.promises.stat(canonicalPath);
|
|
17633
18058
|
return statsMatchValidatedIdentity(stats, expected);
|
|
17634
18059
|
} catch {
|
|
17635
18060
|
return false;
|
|
@@ -17658,13 +18083,13 @@ async function snapshotValidatedFile(filePath, expected, signal) {
|
|
|
17658
18083
|
if (stats.size > SNAPSHOT_MAX_SIZE_BYTES) {
|
|
17659
18084
|
return void 0;
|
|
17660
18085
|
}
|
|
17661
|
-
snapshotDir = await
|
|
17662
|
-
|
|
18086
|
+
snapshotDir = await fs17.promises.mkdtemp(
|
|
18087
|
+
path20.join(os3.tmpdir(), "qwen-validated-read-")
|
|
17663
18088
|
);
|
|
17664
|
-
const snapshotPath =
|
|
17665
|
-
const target = await
|
|
18089
|
+
const snapshotPath = path20.join(snapshotDir, path20.basename(filePath));
|
|
18090
|
+
const target = await fs17.promises.open(
|
|
17666
18091
|
snapshotPath,
|
|
17667
|
-
|
|
18092
|
+
fs17.constants.O_WRONLY | fs17.constants.O_CREAT | fs17.constants.O_EXCL,
|
|
17668
18093
|
384
|
|
17669
18094
|
);
|
|
17670
18095
|
try {
|
|
@@ -17705,7 +18130,7 @@ async function snapshotValidatedFile(filePath, expected, signal) {
|
|
|
17705
18130
|
result = {
|
|
17706
18131
|
filePath: snapshotPath,
|
|
17707
18132
|
stats,
|
|
17708
|
-
cleanup: /* @__PURE__ */ __name(() =>
|
|
18133
|
+
cleanup: /* @__PURE__ */ __name(() => fs17.promises.rm(snapshotDir, { recursive: true, force: true }), "cleanup")
|
|
17709
18134
|
};
|
|
17710
18135
|
return result;
|
|
17711
18136
|
} finally {
|
|
@@ -17717,7 +18142,7 @@ async function snapshotValidatedFile(filePath, expected, signal) {
|
|
|
17717
18142
|
return void 0;
|
|
17718
18143
|
} finally {
|
|
17719
18144
|
if (snapshotDir && !result) {
|
|
17720
|
-
await
|
|
18145
|
+
await fs17.promises.rm(snapshotDir, { recursive: true, force: true });
|
|
17721
18146
|
}
|
|
17722
18147
|
}
|
|
17723
18148
|
}
|
|
@@ -17906,6 +18331,14 @@ export {
|
|
|
17906
18331
|
IMAGE_CAPABILITY,
|
|
17907
18332
|
generateSessionRecap,
|
|
17908
18333
|
SessionReferenceService,
|
|
18334
|
+
MAX_CONTROLLER_LABEL_CHARS,
|
|
18335
|
+
PeerControllerError,
|
|
18336
|
+
getPeerControllerRegistryPath,
|
|
18337
|
+
readPeerControllerRegistrySync,
|
|
18338
|
+
resolveControllerToken,
|
|
18339
|
+
listPeerControllers,
|
|
18340
|
+
addPeerController,
|
|
18341
|
+
removePeerController,
|
|
17909
18342
|
getLastPeerInboxFailure,
|
|
17910
18343
|
describePeerInboxFailure,
|
|
17911
18344
|
startPeerInbox,
|