@qwen-code/qwen-code 0.22.3-nightly.20260831.3a0c4c6108 → 0.23.0
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/README.md +30 -0
- package/bundled/computer-use/SKILL.md +116 -180
- package/bundled/goal-draft/SKILL.md +5 -1
- package/bundled/qc-helper/docs/configuration/model-providers.md +4 -0
- package/bundled/qc-helper/docs/configuration/settings.md +53 -50
- package/bundled/qc-helper/docs/features/_meta.ts +1 -0
- package/bundled/qc-helper/docs/features/channels/dingtalk.md +4 -2
- package/bundled/qc-helper/docs/features/channels/dws.md +6 -2
- package/bundled/qc-helper/docs/features/channels/overview.md +1 -0
- package/bundled/qc-helper/docs/features/commands.md +38 -1
- package/bundled/qc-helper/docs/features/computer-use.md +2 -2
- package/bundled/qc-helper/docs/features/goals.md +9 -3
- package/bundled/qc-helper/docs/features/headless.md +16 -1
- package/bundled/qc-helper/docs/features/hooks.md +2 -1
- package/bundled/qc-helper/docs/features/output-styles.md +38 -0
- package/bundled/qc-helper/docs/qwen-serve.md +15 -0
- package/bundled/review/SKILL.md +5 -5
- package/bundled/review/references/posting.md +2 -2
- package/chunks/{MaxSizedBox-IHRTWGSY.js → MaxSizedBox-B3D7545A.js} +41 -45
- package/chunks/{StandaloneSessionPicker-TLVWVTJ7.js → StandaloneSessionPicker-QUMO4LLQ.js} +64 -67
- package/chunks/{acpAgent-7I5LLPP3.js → acpAgent-2GTFCIEP.js} +771 -248
- package/chunks/{agent-4Z4NTJXD.js → agent-XKF5SZWU.js} +26 -30
- package/chunks/{agent-headless-TVUJXQWU.js → agent-headless-OC2IB55D.js} +26 -30
- package/chunks/{anthropicContentGenerator-VSSPG7XV.js → anthropicContentGenerator-L76MR5OR.js} +14 -14
- package/chunks/{artifact-tool-TEYW6I4A.js → artifact-tool-MYCL2QCS.js} +2 -3
- package/chunks/{askUserQuestion-PYNBWV63.js → askUserQuestion-THQZMG44.js} +2 -2
- package/chunks/{bridge-EVURP4NO.js → bridge-IHSBI2YJ.js} +42 -46
- package/chunks/{build-INBK7IXX.js → build-63BIOYWK.js} +1 -1
- package/chunks/{channel-management-service-IDBNYSFW.js → channel-management-service-4MTCEGJB.js} +4 -4
- package/chunks/{channel-settings-store-MZNXRKVI.js → channel-settings-store-BVKWAI2T.js} +50 -54
- package/chunks/{channel-worker-group-ZLP5SJHT.js → channel-worker-group-47F4ISUZ.js} +6 -6
- package/chunks/{channel-worker-manager-FG5377T2.js → channel-worker-manager-I5Y44GYR.js} +50 -9
- package/chunks/{channel-worker-supervisor-HDVE4ADS.js → channel-worker-supervisor-6VCLUXFE.js} +4 -4
- package/chunks/{chunk-3452WXOK.js → chunk-2M3EWQNG.js} +17 -0
- package/chunks/{chunk-HDMKCJHI.js → chunk-32LU3APX.js} +1 -1
- package/chunks/{chunk-BSJOBW4U.js → chunk-37JFWFCD.js} +1 -1
- package/chunks/{chunk-AN3KFCNH.js → chunk-3JQZVCBI.js} +2 -2
- package/chunks/{chunk-RGEV5AUD.js → chunk-3L724BJ5.js} +11 -8
- package/chunks/{chunk-GCUR24KK.js → chunk-47RYEQW5.js} +2 -2
- package/chunks/{chunk-CM4F4JBB.js → chunk-4BGDFKQE.js} +5 -5
- package/chunks/{chunk-ZBDYI7VM.js → chunk-4F7GQGXB.js} +10961 -4033
- package/chunks/{chunk-JMRE4WJQ.js → chunk-4HVH57J3.js} +81 -17
- package/chunks/{chunk-26SIKQIC.js → chunk-4LIFGNI4.js} +1 -1
- package/chunks/{chunk-U5RTYI7D.js → chunk-4M24B5J5.js} +13 -13
- package/chunks/{chunk-7XICSE62.js → chunk-4PSDSCW3.js} +3 -3
- package/chunks/{chunk-AYYKUUKP.js → chunk-4UANMABT.js} +73 -19
- package/chunks/{chunk-GS7XT345.js → chunk-54C6PIGT.js} +3 -3
- package/chunks/{chunk-UKB2TZAO.js → chunk-5EIOJGCR.js} +4 -4
- package/chunks/{chunk-64REQJJ2.js → chunk-5H5S4UY5.js} +3 -3
- package/chunks/chunk-5IENVM7Z.js +35 -0
- package/chunks/{chunk-JOWQD4LO.js → chunk-5Q5RC2WE.js} +1 -1
- package/chunks/{chunk-3NQCZMUB.js → chunk-5RTTI4GE.js} +73 -73
- package/chunks/{chunk-J4Y3QJHF.js → chunk-64QH2UC6.js} +11 -1
- package/chunks/{chunk-I75VKFCJ.js → chunk-65HWLGA7.js} +1 -1
- package/chunks/{chunk-W7KWB6AH.js → chunk-6A2D4QSO.js} +8 -5
- package/chunks/{chunk-OTTNXUT5.js → chunk-7IKXTGZT.js} +1 -1
- package/chunks/{chunk-LYSZVCCD.js → chunk-7JMGTOH7.js} +427 -129
- package/chunks/{chunk-YOFULAHO.js → chunk-7RB56BRJ.js} +3 -3
- package/chunks/{chunk-6VHIWUJP.js → chunk-ADYN7P2Y.js} +2 -2
- package/chunks/{chunk-7DDTI7Q3.js → chunk-AHYTURFB.js} +1 -1
- package/chunks/{chunk-TNMOFNT4.js → chunk-ALUYNJPM.js} +1395 -2079
- package/chunks/{chunk-H2A2GJGL.js → chunk-AZJLY2XZ.js} +5 -5
- package/chunks/{chunk-BE5FGT5Z.js → chunk-BA4WJC4L.js} +1 -1
- package/chunks/{chunk-H5GPPDGY.js → chunk-BFY33IB4.js} +16 -8
- package/chunks/{chunk-RY7DL5IF.js → chunk-BJXCYUGM.js} +1 -1
- package/chunks/{chunk-ND7TQQPE.js → chunk-C2VWOXHS.js} +6 -6
- package/chunks/{chunk-T4RMUTTT.js → chunk-C4TIXFDZ.js} +2 -2
- package/chunks/{chunk-B2RIIK3K.js → chunk-CVX63TFJ.js} +3 -1
- package/chunks/{chunk-SMJYTKTB.js → chunk-DQCKVAF5.js} +1 -1
- package/chunks/{chunk-RLSPPTWH.js → chunk-DSX7KQPM.js} +438 -181
- package/chunks/{chunk-PNIGAVY6.js → chunk-DTVQSSNM.js} +2 -2
- package/chunks/{chunk-67AY5D3M.js → chunk-DYTW3QVG.js} +23 -8
- package/chunks/{chunk-3CZGSTZX.js → chunk-EBDGRBZX.js} +22 -14
- package/chunks/{chunk-DJBQCO2E.js → chunk-EFTPIZIC.js} +412 -3
- package/chunks/{chunk-QE7DTCLX.js → chunk-EIY7SUPZ.js} +1 -1
- package/chunks/{chunk-6OO7QEWV.js → chunk-EVFDRBUM.js} +97 -77
- package/chunks/{chunk-QTMPM6RC.js → chunk-EWRW2WQC.js} +3 -3
- package/chunks/{chunk-IIFL7QDN.js → chunk-F33GFWPR.js} +34 -11
- package/chunks/{chunk-YPISTYEI.js → chunk-F47DITLZ.js} +11 -1
- package/chunks/{chunk-OE5AQVNB.js → chunk-F7NF2IOE.js} +6 -6
- package/chunks/{chunk-RT4QNQ5P.js → chunk-FD5SJOWT.js} +8 -5
- package/chunks/{chunk-ACZ4YRYK.js → chunk-FRICLXCZ.js} +3 -3
- package/chunks/{chunk-IBMUI5EV.js → chunk-FUO5V5KI.js} +11 -4
- package/chunks/{chunk-T3TL6S3B.js → chunk-G5PBOQWI.js} +8 -5
- package/chunks/{chunk-D7D3HSYQ.js → chunk-G7HBEEX7.js} +12 -7
- package/chunks/{chunk-FXUSWLBF.js → chunk-GH2S4GD5.js} +133 -8
- package/chunks/{chunk-XPDKSOVW.js → chunk-GXUTFQXK.js} +42 -44
- package/chunks/{chunk-OSTQZIOY.js → chunk-H43PSPYS.js} +2 -2
- package/chunks/{chunk-UVYKCRJZ.js → chunk-HJBHMANB.js} +11 -13
- package/chunks/{chunk-WLEYH7CD.js → chunk-HRPFBHW7.js} +4 -0
- package/chunks/{chunk-DBTMP3P4.js → chunk-I2TMJPCV.js} +1 -1
- package/chunks/{chunk-EU2B4P3D.js → chunk-I4NRYS6A.js} +4 -4
- package/chunks/{chunk-JPKTAQS3.js → chunk-I5N4EAS6.js} +1 -1
- package/chunks/{chunk-W4BDHLRT.js → chunk-IG4W5SJR.js} +2 -2
- package/chunks/{chunk-BXNKREX7.js → chunk-IPATA3T2.js} +2 -2
- package/chunks/{chunk-NKLP3DCK.js → chunk-IQAFKVXS.js} +1 -1
- package/chunks/{chunk-AYHQZBJ4.js → chunk-IRKQ4YYX.js} +3 -3
- package/chunks/{chunk-J3NNHTV6.js → chunk-J5TTWBZK.js} +6 -0
- package/chunks/{chunk-AVNATYLY.js → chunk-JJKNYRFY.js} +1 -1
- package/chunks/{chunk-ERHAMGAA.js → chunk-JR42V4UY.js} +1 -1
- package/chunks/{chunk-NT7LXVV5.js → chunk-JUARRUMA.js} +362 -1084
- package/chunks/{chunk-OKMDOATP.js → chunk-KEVYJSI4.js} +11 -11
- package/chunks/{chunk-AF3QB6OL.js → chunk-KGV55H53.js} +1 -1
- package/chunks/{chunk-SDCHI64N.js → chunk-KM3XVTMO.js} +10 -4
- package/chunks/{chunk-ERRJA23L.js → chunk-KMU3ZHH4.js} +1 -1
- package/chunks/chunk-KOGW3YWJ.js +2054 -0
- package/chunks/{chunk-6NWPR2EB.js → chunk-L26ONV2Y.js} +5 -5
- package/chunks/chunk-L34XSHIZ.js +28 -0
- package/chunks/{chunk-UXEW7TQS.js → chunk-LB3WQQJK.js} +1 -1
- package/chunks/{chunk-YNG7XAJU.js → chunk-LEPCWS5A.js} +1 -1
- package/chunks/{chunk-XLENZQXH.js → chunk-LHBNR6EU.js} +2 -2
- package/chunks/{chunk-AKNQMSL2.js → chunk-LOBDDFYK.js} +4 -28
- package/chunks/{chunk-L6CUJZDG.js → chunk-LU77UT4D.js} +2 -2
- package/chunks/{chunk-3EGEBDTW.js → chunk-M4KFODIP.js} +1 -1
- package/chunks/{chunk-JLSZT354.js → chunk-M4LBBSVP.js} +2 -0
- package/chunks/{chunk-YOMKOM7E.js → chunk-MP6YZ4RK.js} +6580 -5992
- package/chunks/chunk-N2TNM3QB.js +9 -0
- package/chunks/{chunk-GDXSXL3H.js → chunk-NFIDVZND.js} +1 -1
- package/chunks/{chunk-NT5XIL5H.js → chunk-NQ4L2CMD.js} +51 -6
- package/chunks/{chunk-OQYXJK2V.js → chunk-NRL5CUZT.js} +1 -1
- package/chunks/{chunk-FIWZOMBF.js → chunk-NSUKQ4DN.js} +6 -0
- package/chunks/chunk-NUHOLAQ6.js +59 -0
- package/chunks/{chunk-BBYTY46C.js → chunk-NVVJTUSL.js} +266 -105
- package/chunks/{chunk-CAZADEU7.js → chunk-NXKOVOM5.js} +9 -9
- package/chunks/{chunk-5Q372OFJ.js → chunk-O4KNCAX4.js} +57 -10
- package/chunks/{chunk-GOXKNSDZ.js → chunk-O5CD7T4T.js} +40 -9
- package/chunks/{chunk-XIQ5HQ2F.js → chunk-OBTWL6ZW.js} +1 -1
- package/chunks/{chunk-5MK45KZ3.js → chunk-OHOO527W.js} +1 -1
- package/chunks/{chunk-CETB5XY4.js → chunk-ORFIYTI2.js} +1 -1
- package/chunks/{chunk-7E7UCJHS.js → chunk-OSHQMOBS.js} +18 -17
- package/chunks/{chunk-YDQ4OCDK.js → chunk-OSSTATJF.js} +89 -1
- package/chunks/chunk-P6UIF2OW.js +400 -0
- package/chunks/{chunk-V4HN35IF.js → chunk-PCRBLMIN.js} +16 -2
- package/chunks/{chunk-L2OKAIUK.js → chunk-QI27MKNQ.js} +23 -15
- package/chunks/{chunk-FHPYRXRH.js → chunk-QJGYU5PG.js} +1 -1
- package/chunks/{chunk-IVUWTA2D.js → chunk-QJVZLILI.js} +1 -1
- package/chunks/{chunk-TBJ3SNS3.js → chunk-QKDNS6FU.js} +1 -1
- package/chunks/{chunk-YKADANK6.js → chunk-QQD2GART.js} +10 -3
- package/chunks/{chunk-ED7DD7MV.js → chunk-RAFQIHN2.js} +1 -1
- package/chunks/{chunk-TV7BJ7TX.js → chunk-RJUVTJEZ.js} +1 -1
- package/chunks/{chunk-RVCGAHC7.js → chunk-RM4WT2XB.js} +4 -4
- package/chunks/{chunk-6YXNJXQW.js → chunk-RN3YGDCA.js} +3 -3
- package/chunks/{chunk-SMRDCANI.js → chunk-S6H3ELPG.js} +1 -1
- package/chunks/{chunk-MBZ5ORJB.js → chunk-SI7WDR3U.js} +281 -2
- package/chunks/{chunk-5FGWVPCM.js → chunk-SRF4KTAG.js} +4 -4
- package/chunks/{chunk-LFAR7CPW.js → chunk-STCVJXQB.js} +23 -23
- package/chunks/{chunk-JDIO45X7.js → chunk-SULZPKTA.js} +1 -1
- package/chunks/{chunk-KUDI54QQ.js → chunk-SX2QIMJV.js} +5 -5
- package/chunks/{chunk-VYSZUQGU.js → chunk-TJYRTS4S.js} +2 -2
- package/chunks/{chunk-JOTYTYYW.js → chunk-TMKTOTMQ.js} +3 -3
- package/chunks/{chunk-FPMQT2YY.js → chunk-TQHPVKO6.js} +4 -4
- package/chunks/{chunk-GN422P4J.js → chunk-TSZSGQ3N.js} +1 -1
- package/chunks/{chunk-IXEZHTDR.js → chunk-U4DJ5XB3.js} +292 -38
- package/chunks/{chunk-MZ5A5PQW.js → chunk-UAKRDON5.js} +4 -4
- package/chunks/{chunk-NGKLMNWN.js → chunk-UM2FFKXN.js} +2 -2
- package/chunks/{chunk-5ICKESC3.js → chunk-UPFRILIL.js} +2 -2
- package/chunks/{chunk-RAEEQEC5.js → chunk-UUASLXHW.js} +54 -5
- package/chunks/chunk-V5U2NZNJ.js +29 -0
- package/chunks/{chunk-P5Y23G2L.js → chunk-V7RNNPGC.js} +1 -18
- package/chunks/{chunk-ZYPJ7HVZ.js → chunk-VBWD6C27.js} +1 -1
- package/chunks/{chunk-MJBHSZEJ.js → chunk-VNAYZAFX.js} +3 -3
- package/chunks/chunk-VPSIC437.js +780 -0
- package/chunks/{chunk-AAX236AR.js → chunk-VWTSRH6C.js} +52 -11
- package/chunks/{chunk-PDXYZBBQ.js → chunk-VYIUNFEA.js} +2 -2
- package/chunks/{chunk-BY24DZ4J.js → chunk-WP4AX3XD.js} +5 -7
- package/chunks/{chunk-X7C7KFWA.js → chunk-XLXAZLDR.js} +1 -1
- package/chunks/{chunk-ZQ3FKEWA.js → chunk-YPWZTR7F.js} +3 -3
- package/chunks/{chunk-IXHV5MIC.js → chunk-ZDFQGHZH.js} +1 -1
- package/chunks/chunk-ZJ2LM2SI.js +198 -0
- package/chunks/{chunk-PWR2NQBS.js → chunk-ZKFTS3OV.js} +3 -3
- package/chunks/{chunk-HMJ2P3SV.js → chunk-ZL4HFSL6.js} +91 -29
- package/chunks/{chunk-ID33ZRWH.js → chunk-ZTPGUFQV.js} +28 -6
- package/chunks/chunk-bdqvmfwv-ZTSOWAFE.js +17446 -0
- package/chunks/{config-utils-NNUPVGEC.js → config-utils-LVSYDLHZ.js} +42 -46
- package/chunks/{contextCommand-S3TPCDM5.js → contextCommand-TZD7UAJK.js} +40 -44
- package/chunks/{core-runtime-NASPCSQX.js → core-runtime-B4UKKIAQ.js} +42 -46
- package/chunks/{create-sub-session-36TNCHCP.js → create-sub-session-LUPWEUHR.js} +2 -2
- package/chunks/{create-sub-session-DS4BJLYZ.js → create-sub-session-NJ24B4US.js} +41 -44
- package/chunks/{cron-create-QXHTYUTO.js → cron-create-CRSPET3H.js} +1 -1
- package/chunks/{cron-delete-WV2BM42M.js → cron-delete-DB77SZTU.js} +1 -1
- package/chunks/{cron-list-7KVNBLZ7.js → cron-list-U2JNYWV6.js} +1 -1
- package/chunks/{daemon-UCVUHPJD.js → daemon-RKDGBFLK.js} +385 -19
- package/chunks/{daemon-git-worktree-guard-ATXVQPS3.js → daemon-git-worktree-guard-O2HPOBAB.js} +40 -44
- package/chunks/{daemon-status-provider-UI3GBTMO.js → daemon-status-provider-GRRVCJFW.js} +47 -51
- package/chunks/{daemon-trust-policy-SUCBJ2CA.js → daemon-trust-policy-YJL442BK.js} +46 -50
- package/chunks/{daemon-trust-policy-monitor-3LM5RQNS.js → daemon-trust-policy-monitor-JL7F4Y4Q.js} +46 -50
- package/chunks/{deferred-core-runtime-SCOJLVYG.js → deferred-core-runtime-S32AYVZI.js} +39 -43
- package/chunks/{devtools-JCG4K2NZ.js → devtools-VDRJYPZF.js} +1 -1
- package/chunks/{discovery-X2NV535U.js → discovery-TUM3ZQ6U.js} +2 -2
- package/chunks/{display-image-Z4VBQDEJ.js → display-image-73C7XNRK.js} +3 -3
- package/chunks/{dist-7WDZYMWV.js → dist-62OZ7QXB.js} +2 -2
- package/chunks/{dist-FLJLHASF.js → dist-EDHQIBYD.js} +7 -7
- package/chunks/{dist-S3BKCTWF.js → dist-GT64AAUR.js} +1 -1
- package/chunks/{dist-GPSRNVVP.js → dist-JVXT4VUJ.js} +2 -2
- package/chunks/{dist-LY66XNUL.js → dist-L6URO6CK.js} +3 -3
- package/chunks/{dist-5423MG3D.js → dist-LXFYIJNG.js} +734 -128
- package/chunks/{dist-SDKHGH5O.js → dist-PDGNRVPY.js} +4 -4
- package/chunks/{dist-WAUO5OMN.js → dist-QAF5DO3Y.js} +363 -73
- package/chunks/{dist-WIVVPE7M.js → dist-ZCJLKQSP.js} +1 -1
- package/chunks/{earlyInputCapture-INWJ2STR.js → earlyInputCapture-BBPCIVZG.js} +38 -42
- package/chunks/{edit-B7ZRRGAE.js → edit-SUGXY63Y.js} +26 -30
- package/chunks/{en-E4AYTX6H.js → en-2RATMNX7.js} +2 -0
- package/chunks/{enter-worktree-SPZHEETQ.js → enter-worktree-B6USKSIK.js} +5 -5
- package/chunks/{enterPlanMode-S554IKJ2.js → enterPlanMode-MDX4RVVL.js} +26 -30
- package/chunks/{environment-25ADH4Y6.js → environment-VN6RXDVN.js} +41 -45
- package/chunks/{errors-G2I6LFTW.js → errors-UEY36PIT.js} +40 -44
- package/chunks/{exit-worktree-AWUXAMAM.js → exit-worktree-DLQ73SJH.js} +8 -6
- package/chunks/{exitPlanMode-ZFH4OYPM.js → exitPlanMode-EPHIEDAA.js} +26 -30
- package/chunks/{fast-path-WZHVZ2ER.js → fast-path-Y73R42LV.js} +3 -3
- package/chunks/{fast-path-settings-NILM6QZL.js → fast-path-settings-MFUR3IWK.js} +3 -3
- package/chunks/{glob-UOVDMBUP.js → glob-DMGH7EZN.js} +27 -31
- package/chunks/goal-tools-3RF3PXCL.js +99 -0
- package/chunks/{grep-LHYJ5V2N.js → grep-AJVLCVXC.js} +2 -2
- package/chunks/{handleAutoUpdate-4MZ45DZY.js → handleAutoUpdate-HVWQT2AU.js} +42 -46
- package/chunks/{i18n-KWUEI4DS.js → i18n-5OR7NTRZ.js} +39 -43
- package/chunks/{image-gen-YZDVO5YS.js → image-gen-VOIDOHOB.js} +1 -1
- package/chunks/{initializer-2NBROGMG.js → initializer-JE5RQSOE.js} +46 -50
- package/chunks/{installationInfo-YKUSY3ZB.js → installationInfo-KO3CCSCK.js} +38 -42
- package/chunks/{list-W2WV3COM.js → list-3IORSFIY.js} +49 -53
- package/chunks/{list-agents-PMVMHNY7.js → list-agents-SBMONIUK.js} +3 -3
- package/chunks/{llm-NPPHLIJI.js → llm-K26SUDVK.js} +155 -99
- package/chunks/{llm-content-generator-YK3WN6XW.js → llm-content-generator-TT6EAUD4.js} +5 -6
- package/chunks/{loadedSettingsAdapter-2P7DFWUR.js → loadedSettingsAdapter-KLLFZF3M.js} +46 -50
- package/chunks/{loggingContentGenerator-QYYYGU6V.js → loggingContentGenerator-EYQBA4M4.js} +43 -47
- package/chunks/{loop-wakeup-EBM4F5MZ.js → loop-wakeup-QA6SHCZT.js} +2 -2
- package/chunks/{ls-F6TRX3DD.js → ls-HEJNCEYO.js} +1 -1
- package/chunks/{lsp-QYTOS2FI.js → lsp-WOQKNZP6.js} +1 -1
- package/chunks/{managed-npm-update-UMC4NBWW.js → managed-npm-update-HIJTODQT.js} +38 -42
- package/chunks/{mcp-OFI6XDP2.js → mcp-A2UEHETW.js} +46 -50
- package/chunks/{monitor-QX3BM3JY.js → monitor-DKNZQAB2.js} +28 -32
- package/chunks/{node-QKLNSZMX.js → node-UETAYMMO.js} +3 -3
- package/chunks/{nonInteractiveCli-NVRMD5MN.js → nonInteractiveCli-YA47F2F4.js} +86 -89
- package/chunks/{notebook-edit-AAILDPSV.js → notebook-edit-MGHTRL2D.js} +26 -30
- package/chunks/{openaiContentGenerator-53PB3CMN.js → openaiContentGenerator-ZJIEQ3ZJ.js} +15 -17
- package/chunks/{pidfile-5ACKG2LI.js → pidfile-ETHAZNMY.js} +38 -42
- package/chunks/{processUtils-2BCDO3DZ.js → processUtils-UY3SAJJZ.js} +2 -2
- package/chunks/{prompt-terminal-ledger-3RKW73A2.js → prompt-terminal-ledger-GZ747VYE.js} +39 -43
- package/chunks/{qwenContentGenerator-N4LLWDPH.js → qwenContentGenerator-VI4KATRY.js} +39 -43
- package/chunks/{read-file-DPAKXHYE.js → read-file-P7F4P7LV.js} +6 -8
- package/chunks/{read-mcp-resource-R4NO75DW.js → read-mcp-resource-GLAGB6R7.js} +1 -1
- package/chunks/{record-artifact-2EAYLAL5.js → record-artifact-SWVR7NSU.js} +3 -3
- package/chunks/renderer-selection-M4UN63VJ.js +99 -0
- package/chunks/{report-findings-Y4MSHDS3.js → report-findings-AL5YW3KI.js} +4 -4
- package/chunks/{request-shutdown-DWRMGTMB.js → request-shutdown-5YK4IZ54.js} +5 -5
- package/chunks/{resumeHistoryUtils-3JQORXAK.js → resumeHistoryUtils-DPZKFW24.js} +44 -48
- package/chunks/{ripGrep-AHF5QCI7.js → ripGrep-C7LJKUPZ.js} +9 -11
- package/chunks/{run-qwen-serve-3LKV7KDC.js → run-qwen-serve-OGTEEUR2.js} +132 -81
- package/chunks/{runtime-66F4W3IA.js → runtime-LNBLEMZS.js} +51 -55
- package/chunks/{scheduled-tasks-2NVKS5Q2.js → scheduled-tasks-FLDYZQOF.js} +44 -48
- package/chunks/{scheduler-JNV7T3ZO.js → scheduler-73YXGUGW.js} +40 -44
- package/chunks/{sdk-exporters-grpc-G5IT4XS4.js → sdk-exporters-grpc-MXTVSE3C.js} +2 -2
- package/chunks/{sdk-exporters-http-MFIWD23D.js → sdk-exporters-http-3JO5TJNU.js} +3 -3
- package/chunks/{sdk-impl-2RXJ4Q6X.js → sdk-impl-HZAUUTHJ.js} +5 -5
- package/chunks/{send-message-WPZRCJOB.js → send-message-JC7NJTY6.js} +7 -7
- package/chunks/{serve-GP2UNRP7.js → serve-3UR2H4CV.js} +46 -50
- package/chunks/{server-7W6C3SOW.js → server-AOYZVVOM.js} +1736 -502
- package/chunks/{session-PZLBAQGG.js → session-UAWFNFGI.js} +90 -93
- package/chunks/session-attachments-root-ZCGXQQTR.js +104 -0
- package/chunks/{session-pr-refresh-OIVL3U3Z.js → session-pr-refresh-CT2INROL.js} +131 -65
- package/chunks/{settings-ZOHIQWYK.js → settings-BHRGDASJ.js} +45 -49
- package/chunks/{shell-FWZT6IUR.js → shell-YHOGC7TO.js} +26 -30
- package/chunks/{skill-RTQC2YGA.js → skill-ZGBKNCHQ.js} +71 -49
- package/chunks/{skill-settings-AKMIXFSJ.js → skill-settings-AKSP665O.js} +45 -49
- package/chunks/{spawnChannel-ZP23JL6O.js → spawnChannel-N25MBB6F.js} +40 -44
- package/chunks/{standalone-update-P2Q5H4ZU.js → standalone-update-XGPWJDRN.js} +40 -44
- package/chunks/start-opentui-ui-FZ4USOU7.js +55342 -0
- package/chunks/{startInteractiveUI-NSA6QPQZ.js → startInteractiveUI-E2WQJUOA.js} +2920 -4542
- package/chunks/{syntheticOutput-5URSQLIS.js → syntheticOutput-HJNZSEHN.js} +2 -2
- package/chunks/{task-create-3EXVDG3G.js → task-create-6RSD54S5.js} +7 -7
- package/chunks/{task-list-PIBYNSE7.js → task-list-IQSACPOM.js} +31 -7
- package/chunks/{task-stop-IV3BYWJC.js → task-stop-HE2LRQNW.js} +1 -1
- package/chunks/{task-update-H5BPDS5Y.js → task-update-XAJ2NYOA.js} +7 -7
- package/chunks/{team-create-53T42W37.js → team-create-SOKMYSQU.js} +28 -32
- package/chunks/{team-delete-X3WPELS6.js → team-delete-NGNNKGMG.js} +1 -1
- package/chunks/{team-plan-approval-D45ZC5OE.js → team-plan-approval-U7ZWXYAY.js} +26 -30
- package/chunks/{terminal-image-renderer-FCRUWT6C.js → terminal-image-renderer-KKM4OBLO.js} +40 -44
- package/chunks/{theme-manager-MHNPEDP7.js → theme-manager-GQHF3A7T.js} +38 -42
- package/chunks/{todoWrite-A5IOZZ3P.js → todoWrite-5UTVUXHA.js} +36 -6
- package/chunks/{tool-search-6RPBGGUX.js → tool-search-IAI2RVWT.js} +10 -12
- package/chunks/{total-session-admission-MGV56XDK.js → total-session-admission-G4CGCSTG.js} +43 -47
- package/chunks/{trustedFolders-QJYEFMTU.js → trustedFolders-D2I3FDPB.js} +39 -43
- package/chunks/{update-relaunch-ZDMQX63C.js → update-relaunch-5RWKZAL3.js} +5 -5
- package/chunks/{updateCheck-4QZWCGP6.js → updateCheck-ZXOQDFEI.js} +42 -46
- package/chunks/{useAutoAcceptIndicator-DLIQN256.js → useAutoAcceptIndicator-6EK4QGAH.js} +49 -53
- package/chunks/{validateNonInterActiveAuth-HGTG7AEK.js → validateNonInterActiveAuth-QPFEKATS.js} +82 -86
- package/chunks/{version-CPAZMC4B.js → version-JKNG7YDH.js} +1 -1
- package/chunks/{web-fetch-N4K5M3M4.js → web-fetch-X3AHIIHW.js} +8 -11
- package/chunks/{web-search-4VZKM5SF.js → web-search-K2FMOGS5.js} +6 -7
- package/chunks/{web-shell-static-PW7OEDQO.js → web-shell-static-POZHGGXE.js} +4 -4
- package/chunks/{workflow-2ALQKTHG.js → workflow-TOLPAK5G.js} +38 -38
- package/chunks/{workspace-providers-status-5JM4CB6R.js → workspace-providers-status-PCJK3RC7.js} +50 -54
- package/chunks/{workspace-registration-store-RNMFVCH7.js → workspace-registration-store-KQWVVW4Y.js} +1 -1
- package/chunks/{workspace-registry-6EULAPZC.js → workspace-registry-YNIOB6HJ.js} +43 -47
- package/chunks/{workspace-runtime-coordinator-IRI2DRCJ.js → workspace-runtime-coordinator-WG2RNEN7.js} +43 -47
- package/chunks/{workspace-service-SETHN4WE.js → workspace-service-G4ZNBOFH.js} +51 -55
- package/chunks/{workspace-skills-status-4D4EUEQU.js → workspace-skills-status-FMTPPMWC.js} +47 -51
- package/chunks/{workspace-trust-reconciler-4LR3CDL4.js → workspace-trust-reconciler-IBDFQBQS.js} +53 -57
- package/chunks/wrapper-JH3IFHT2.js +35 -0
- package/chunks/{write-file-45GWPSOI.js → write-file-YTLFY2S5.js} +28 -32
- package/chunks/{zh-2BQ7P6OD.js → zh-25DF7OGK.js} +2 -0
- package/chunks/{zh-TW-UFXRZTXX.js → zh-TW-5EDMZVGK.js} +2 -0
- package/chunks/{zoom-image-K6IQUKRC.js → zoom-image-IFXSN74N.js} +6 -8
- package/cli.js +17 -13
- package/locales/en.js +3 -0
- package/locales/zh-TW.js +3 -0
- package/locales/zh.js +3 -0
- package/package.json +3 -3
- package/web-shell/assets/{abnfDiagram-VCTEODGH-C80OZcPP.js → abnfDiagram-VCTEODGH-Cxf7xE_Z.js} +1 -1
- package/web-shell/assets/{arc-AUqStYgf.js → arc-ESi1eNkE.js} +1 -1
- package/web-shell/assets/{architectureDiagram-5GKGNRK7-CQYOdYla.js → architectureDiagram-5GKGNRK7-D9l7-bDo.js} +1 -1
- package/web-shell/assets/{blockDiagram-NRAW4CY4-lYKlFysy.js → blockDiagram-NRAW4CY4-Bc8DEasw.js} +1 -1
- package/web-shell/assets/{c4Diagram-UCG6FXSJ-BoS23iIp.js → c4Diagram-UCG6FXSJ-Dimb2Hmh.js} +1 -1
- package/web-shell/assets/channel-B7ohGDil.js +1 -0
- package/web-shell/assets/{chunk-2Q5K7J3B-DLLooL1E.js → chunk-2Q5K7J3B-jVDmOpAQ.js} +1 -1
- package/web-shell/assets/{chunk-5VM5RSS4-kPfJxScY.js → chunk-5VM5RSS4-DbG_SwdB.js} +1 -1
- package/web-shell/assets/{chunk-F27PBJKO-CVGFBqkD.js → chunk-F27PBJKO-QEc4cY1v.js} +1 -1
- package/web-shell/assets/{chunk-G27WJ6UU-CnM_kOVV.js → chunk-G27WJ6UU-iJ36lQ3X.js} +1 -1
- package/web-shell/assets/{chunk-JWPE2WC7-Cj-ajOkT.js → chunk-JWPE2WC7-DuArnVtF.js} +1 -1
- package/web-shell/assets/{chunk-LCL6LL3I-8L5c-wFo.js → chunk-LCL6LL3I-DxOf1zwL.js} +1 -1
- package/web-shell/assets/{chunk-POPQ4Y6H-DsXTxpvL.js → chunk-POPQ4Y6H-lVLu9Ild.js} +1 -1
- package/web-shell/assets/{chunk-SVP7TREG-DU5GE1_z.js → chunk-SVP7TREG-C6XYlIer.js} +1 -1
- package/web-shell/assets/{chunk-XXDRQBXY-D2IIWZKt.js → chunk-XXDRQBXY-CiG2j2Ji.js} +1 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-DdFpqpfD.js +1 -0
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-DdFpqpfD.js +1 -0
- package/web-shell/assets/{cose-bilkent-JH36ORCC-CF_txUJr.js → cose-bilkent-JH36ORCC-DGVHMMVm.js} +1 -1
- package/web-shell/assets/{cynefin-OW5HDTMX-DEZ-My-Z.js → cynefin-OW5HDTMX-D6cgpCnH.js} +1 -1
- package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-BV7EKUS6.js → cynefinDiagram-5FMLGOSQ-BKv4Z-UX.js} +1 -1
- package/web-shell/assets/{dagre-3AP2YEHR-JGIX0G4H.js → dagre-3AP2YEHR-B4ABMIG-.js} +1 -1
- package/web-shell/assets/{diagram-S7CK7UJ4-DdUY7q6A.js → diagram-S7CK7UJ4-DgCkp_Lm.js} +1 -1
- package/web-shell/assets/{diagram-UQ7AKVKN-fhzRZ19v.js → diagram-UQ7AKVKN-FG0FNokz.js} +1 -1
- package/web-shell/assets/{diagram-VSXAHHWV-BOgOex6q.js → diagram-VSXAHHWV-JgkP9qg-.js} +1 -1
- package/web-shell/assets/{diagram-VX7I27RA-C0NknIz6.js → diagram-VX7I27RA-ADh2x83l.js} +1 -1
- package/web-shell/assets/{diagram-Z3DM3KII-C__3mUBX.js → diagram-Z3DM3KII-yXqoYF1J.js} +1 -1
- package/web-shell/assets/{ebnfDiagram-PWID7BFC-BvPhqycH.js → ebnfDiagram-PWID7BFC-Duk83Ek_.js} +1 -1
- package/web-shell/assets/{erDiagram-SSCWMZ5O-BqzoNoL9.js → erDiagram-SSCWMZ5O-DMdvxySG.js} +1 -1
- package/web-shell/assets/{flowDiagram-A5DVABFB-CJKOre47.js → flowDiagram-A5DVABFB-DHjVgSji.js} +1 -1
- package/web-shell/assets/{ganttDiagram-EL5Y4UJY-C5xZjrp0.js → ganttDiagram-EL5Y4UJY-DMM9DkCE.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-C0EjwuPK.js → gitGraphDiagram-WWUBYQGX-t_ug9vO8.js} +1 -1
- package/web-shell/assets/index-BGZRqbRo.css +36 -0
- package/web-shell/assets/index-DRri_6_x.js +2067 -0
- package/web-shell/assets/{index-C5M93syE.js → index-zqvnpGHv.js} +1 -1
- package/web-shell/assets/{infoDiagram-RXCK75RN-BUwzsYOs.js → infoDiagram-RXCK75RN-eT1fANNm.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-5VMMS53U-EDJ_DH3V.js → ishikawaDiagram-5VMMS53U-k3evzZNn.js} +1 -1
- package/web-shell/assets/{journeyDiagram-EYS64GPL-BnfcOsS0.js → journeyDiagram-EYS64GPL-CGim3EAi.js} +1 -1
- package/web-shell/assets/{kanban-definition-3QL26DDD-D_ofTVGu.js → kanban-definition-3QL26DDD-WHfJo-22.js} +1 -1
- package/web-shell/assets/{layout-CBuQFdfZ.js → layout-DkqIaFlJ.js} +1 -1
- package/web-shell/assets/{linear-DRIHtmGv.js → linear-Bdkd3mCz.js} +1 -1
- package/web-shell/assets/{mermaid.core-CmR5wZH6.js → mermaid.core-CGw0LkT_.js} +6 -6
- package/web-shell/assets/{mindmap-definition-FBJOCRG2-BV374olC.js → mindmap-definition-FBJOCRG2-C9V4rBvo.js} +1 -1
- package/web-shell/assets/{pegDiagram-XKGWAZYB-Bpy1SplK.js → pegDiagram-XKGWAZYB-CwoI2T5G.js} +1 -1
- package/web-shell/assets/{pieDiagram-E7YTZNPT-CeZx4hR2.js → pieDiagram-E7YTZNPT-DaTmBmPG.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-AXDQQJYC-COYKs14h.js → quadrantDiagram-AXDQQJYC-plh6MyGI.js} +1 -1
- package/web-shell/assets/{railroadDiagram-O6MQD6OU-5g2pOeTs.js → railroadDiagram-O6MQD6OU-D_b-S0iK.js} +1 -1
- package/web-shell/assets/{requirementDiagram-EFPCY7ZU-Yn8uPGtF.js → requirementDiagram-EFPCY7ZU-zUzTN7VE.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-P5KCCOFB-CTayAGq6.js → sankeyDiagram-P5KCCOFB-m6AhoD0l.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-BFWDKzUU.js → sequenceDiagram-WJ2MYXX4-Cwhzsine.js} +1 -1
- package/web-shell/assets/{sizeCapture-X5ZJPWSS-CtErUbj4.js → sizeCapture-X5ZJPWSS-CcZuKIae.js} +1 -1
- package/web-shell/assets/{stateDiagram-HBIQ2CUA-Co3HFzOd.js → stateDiagram-HBIQ2CUA-CFoiJwD_.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V--H8HdEmk.js +1 -0
- package/web-shell/assets/{swimlanes-XN3QIQJK-CDZuxzOj.js → swimlanes-XN3QIQJK-CgS9hcaV.js} +1 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-ShE9OIgf.js +8 -0
- package/web-shell/assets/{timeline-definition-24CTP7MA-UcNHj8At.js → timeline-definition-24CTP7MA-Dzzc05t9.js} +1 -1
- package/web-shell/assets/{vennDiagram-4TSXK5OY-JKR9pVFG.js → vennDiagram-4TSXK5OY-DemK0f7Y.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-VM6X3IG4-C4SU-yIW.js → wardleyDiagram-VM6X3IG4-CquLxtMr.js} +1 -1
- package/web-shell/assets/{xychartDiagram-S5SC5T6Z-D_yoWGZ4.js → xychartDiagram-S5SC5T6Z-BTBKTM5g.js} +1 -1
- package/web-shell/index.html +2 -2
- package/chunks/chunk-4P7PPAHN.js +0 -3097
- package/chunks/chunk-7J6OTNGO.js +0 -424
- package/chunks/chunk-LMMHS3RS.js +0 -135
- package/chunks/chunk-MZYWNU66.js +0 -149
- package/chunks/chunk-T4EFG2P5.js +0 -113
- package/chunks/chunk-XZA32HII.js +0 -19
- package/chunks/goal-tools-7TNK5ZHC.js +0 -411
- package/web-shell/assets/channel-B0ovOJeK.js +0 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-DMll2-6_.js +0 -1
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-DMll2-6_.js +0 -1
- package/web-shell/assets/index-B_IPzA0h.js +0 -2020
- package/web-shell/assets/index-D1OKGQlM.css +0 -36
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-C3gdRjPm.js +0 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-C34TGCPZ.js +0 -8
- /package/chunks/{chunk-FOGQO4FG.js → chunk-JA5CBKRP.js} +0 -0
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
import {
|
|
4
4
|
MAX_FRAME_BYTES,
|
|
5
5
|
isLocalIpcPath,
|
|
6
|
+
parsePeerAuthLine,
|
|
6
7
|
parsePeerFrame,
|
|
7
8
|
resolvePeerSocketPath
|
|
8
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-4UANMABT.js";
|
|
9
10
|
import {
|
|
10
11
|
scanForSecrets
|
|
11
12
|
} from "./chunk-UKYXYWI2.js";
|
|
@@ -62,7 +63,6 @@ import {
|
|
|
62
63
|
recursivelyHydrateStrings,
|
|
63
64
|
repairOrphanedToolUseTurns,
|
|
64
65
|
require_picomatch,
|
|
65
|
-
resolveGitDir,
|
|
66
66
|
runForkedAgent,
|
|
67
67
|
runWithForkedChatModel,
|
|
68
68
|
runWithTimeout,
|
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
stripToolResultImages,
|
|
71
71
|
toolResultBoundaryArtifact,
|
|
72
72
|
toolResultPartDiagnosticValues
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-4F7GQGXB.js";
|
|
74
74
|
import {
|
|
75
75
|
hasVerifiableInode,
|
|
76
76
|
openNoFollow
|
|
@@ -79,22 +79,18 @@ import {
|
|
|
79
79
|
stripAnsi
|
|
80
80
|
} from "./chunk-TWPJO254.js";
|
|
81
81
|
import {
|
|
82
|
-
|
|
83
|
-
} from "./chunk-
|
|
84
|
-
import {
|
|
85
|
-
resolveBundleDir
|
|
86
|
-
} from "./chunk-PDXYZBBQ.js";
|
|
82
|
+
projectUserTranscriptForDisplay
|
|
83
|
+
} from "./chunk-EFTPIZIC.js";
|
|
87
84
|
import {
|
|
88
85
|
glob,
|
|
89
86
|
globSync
|
|
90
87
|
} from "./chunk-QJNDUTOL.js";
|
|
91
88
|
import {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
} from "./chunk-ZHO2CW6D.js";
|
|
89
|
+
getProjectSkillsRoot
|
|
90
|
+
} from "./chunk-H43PSPYS.js";
|
|
95
91
|
import {
|
|
96
|
-
|
|
97
|
-
} from "./chunk-
|
|
92
|
+
resolveBundleDir
|
|
93
|
+
} from "./chunk-VYIUNFEA.js";
|
|
98
94
|
import {
|
|
99
95
|
escapeJsonTagCharacters
|
|
100
96
|
} from "./chunk-CHEIIBT3.js";
|
|
@@ -111,8 +107,9 @@ import {
|
|
|
111
107
|
addMCPStatusChangeListener,
|
|
112
108
|
getInvocationContext,
|
|
113
109
|
removeMCPStatusChangeListener,
|
|
110
|
+
runSideQuery,
|
|
114
111
|
updateMCPServerStatus
|
|
115
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-GH2S4GD5.js";
|
|
116
113
|
import {
|
|
117
114
|
E_TIMEOUT,
|
|
118
115
|
Mutex,
|
|
@@ -126,14 +123,11 @@ import {
|
|
|
126
123
|
getCurrentMemoryFilename,
|
|
127
124
|
isCacheableReadResult,
|
|
128
125
|
processSingleFileContent
|
|
129
|
-
} from "./chunk-
|
|
126
|
+
} from "./chunk-DYTW3QVG.js";
|
|
130
127
|
import {
|
|
131
128
|
getAutoMemoryRoot,
|
|
132
129
|
getUserAutoMemoryRoot
|
|
133
130
|
} from "./chunk-HT5S5TRQ.js";
|
|
134
|
-
import {
|
|
135
|
-
runSideQuery
|
|
136
|
-
} from "./chunk-LMMHS3RS.js";
|
|
137
131
|
import {
|
|
138
132
|
atomicWriteFile
|
|
139
133
|
} from "./chunk-KHP66DFN.js";
|
|
@@ -142,7 +136,7 @@ import {
|
|
|
142
136
|
getStartupContextLength,
|
|
143
137
|
isSystemReminderContent,
|
|
144
138
|
stripSystemReminderBlocks
|
|
145
|
-
} from "./chunk-
|
|
139
|
+
} from "./chunk-G7HBEEX7.js";
|
|
146
140
|
import {
|
|
147
141
|
getQwenIgnoreFileNames,
|
|
148
142
|
require_ignore
|
|
@@ -150,7 +144,7 @@ import {
|
|
|
150
144
|
import {
|
|
151
145
|
ToolNames,
|
|
152
146
|
canonicalToolName
|
|
153
|
-
} from "./chunk-
|
|
147
|
+
} from "./chunk-7JMGTOH7.js";
|
|
154
148
|
import {
|
|
155
149
|
PATH_ARG_KEYS,
|
|
156
150
|
Storage,
|
|
@@ -178,8 +172,8 @@ var require_utils = __commonJS({
|
|
|
178
172
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
179
173
|
exports.normalizePath = exports.isRootDirectory = exports.convertSlashes = exports.cleanPath = void 0;
|
|
180
174
|
var path_1 = __require("path");
|
|
181
|
-
function cleanPath(
|
|
182
|
-
let normalized2 = (0, path_1.normalize)(
|
|
175
|
+
function cleanPath(path19) {
|
|
176
|
+
let normalized2 = (0, path_1.normalize)(path19);
|
|
183
177
|
if (normalized2.length > 1 && normalized2[normalized2.length - 1] === path_1.sep)
|
|
184
178
|
normalized2 = normalized2.substring(0, normalized2.length - 1);
|
|
185
179
|
return normalized2;
|
|
@@ -187,28 +181,28 @@ var require_utils = __commonJS({
|
|
|
187
181
|
__name(cleanPath, "cleanPath");
|
|
188
182
|
exports.cleanPath = cleanPath;
|
|
189
183
|
var SLASHES_REGEX = /[\\/]/g;
|
|
190
|
-
function convertSlashes(
|
|
191
|
-
return
|
|
184
|
+
function convertSlashes(path19, separator) {
|
|
185
|
+
return path19.replace(SLASHES_REGEX, separator);
|
|
192
186
|
}
|
|
193
187
|
__name(convertSlashes, "convertSlashes");
|
|
194
188
|
exports.convertSlashes = convertSlashes;
|
|
195
189
|
var WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i;
|
|
196
|
-
function isRootDirectory(
|
|
197
|
-
return
|
|
190
|
+
function isRootDirectory(path19) {
|
|
191
|
+
return path19 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path19);
|
|
198
192
|
}
|
|
199
193
|
__name(isRootDirectory, "isRootDirectory");
|
|
200
194
|
exports.isRootDirectory = isRootDirectory;
|
|
201
|
-
function normalizePath2(
|
|
195
|
+
function normalizePath2(path19, options) {
|
|
202
196
|
const { resolvePaths, normalizePath: normalizePath3, pathSeparator } = options;
|
|
203
|
-
const pathNeedsCleaning = process.platform === "win32" &&
|
|
197
|
+
const pathNeedsCleaning = process.platform === "win32" && path19.includes("/") || path19.startsWith(".");
|
|
204
198
|
if (resolvePaths)
|
|
205
|
-
|
|
199
|
+
path19 = (0, path_1.resolve)(path19);
|
|
206
200
|
if (normalizePath3 || pathNeedsCleaning)
|
|
207
|
-
|
|
208
|
-
if (
|
|
201
|
+
path19 = cleanPath(path19);
|
|
202
|
+
if (path19 === ".")
|
|
209
203
|
return "";
|
|
210
|
-
const needsSeperator =
|
|
211
|
-
return convertSlashes(needsSeperator ?
|
|
204
|
+
const needsSeperator = path19[path19.length - 1] !== pathSeparator;
|
|
205
|
+
return convertSlashes(needsSeperator ? path19 + pathSeparator : path19, pathSeparator);
|
|
212
206
|
}
|
|
213
207
|
__name(normalizePath2, "normalizePath");
|
|
214
208
|
exports.normalizePath = normalizePath2;
|
|
@@ -283,9 +277,9 @@ var require_push_directory = __commonJS({
|
|
|
283
277
|
paths.push(directoryPath || ".");
|
|
284
278
|
}, "pushDirectory");
|
|
285
279
|
var pushDirectoryFilter = /* @__PURE__ */ __name((directoryPath, paths, filters) => {
|
|
286
|
-
const
|
|
287
|
-
if (filters.every((filter2) => filter2(
|
|
288
|
-
paths.push(
|
|
280
|
+
const path19 = directoryPath || ".";
|
|
281
|
+
if (filters.every((filter2) => filter2(path19, true))) {
|
|
282
|
+
paths.push(path19);
|
|
289
283
|
}
|
|
290
284
|
}, "pushDirectoryFilter");
|
|
291
285
|
var empty = /* @__PURE__ */ __name(() => {
|
|
@@ -396,31 +390,31 @@ var require_resolve_symlink = __commonJS({
|
|
|
396
390
|
exports.build = void 0;
|
|
397
391
|
var fs_1 = __importDefault(__require("fs"));
|
|
398
392
|
var path_1 = __require("path");
|
|
399
|
-
var resolveSymlinksAsync = /* @__PURE__ */ __name(function(
|
|
393
|
+
var resolveSymlinksAsync = /* @__PURE__ */ __name(function(path19, state, callback) {
|
|
400
394
|
const { queue, options: { suppressErrors } } = state;
|
|
401
395
|
queue.enqueue();
|
|
402
|
-
fs_1.default.realpath(
|
|
396
|
+
fs_1.default.realpath(path19, (error, resolvedPath) => {
|
|
403
397
|
if (error)
|
|
404
398
|
return queue.dequeue(suppressErrors ? null : error, state);
|
|
405
|
-
fs_1.default.stat(resolvedPath, (error2,
|
|
399
|
+
fs_1.default.stat(resolvedPath, (error2, stat4) => {
|
|
406
400
|
if (error2)
|
|
407
401
|
return queue.dequeue(suppressErrors ? null : error2, state);
|
|
408
|
-
if (
|
|
402
|
+
if (stat4.isDirectory() && isRecursive(path19, resolvedPath, state))
|
|
409
403
|
return queue.dequeue(null, state);
|
|
410
|
-
callback(
|
|
404
|
+
callback(stat4, resolvedPath);
|
|
411
405
|
queue.dequeue(null, state);
|
|
412
406
|
});
|
|
413
407
|
});
|
|
414
408
|
}, "resolveSymlinksAsync");
|
|
415
|
-
var resolveSymlinks = /* @__PURE__ */ __name(function(
|
|
409
|
+
var resolveSymlinks = /* @__PURE__ */ __name(function(path19, state, callback) {
|
|
416
410
|
const { queue, options: { suppressErrors } } = state;
|
|
417
411
|
queue.enqueue();
|
|
418
412
|
try {
|
|
419
|
-
const resolvedPath = fs_1.default.realpathSync(
|
|
420
|
-
const
|
|
421
|
-
if (
|
|
413
|
+
const resolvedPath = fs_1.default.realpathSync(path19);
|
|
414
|
+
const stat4 = fs_1.default.statSync(resolvedPath);
|
|
415
|
+
if (stat4.isDirectory() && isRecursive(path19, resolvedPath, state))
|
|
422
416
|
return;
|
|
423
|
-
callback(
|
|
417
|
+
callback(stat4, resolvedPath);
|
|
424
418
|
} catch (e) {
|
|
425
419
|
if (!suppressErrors)
|
|
426
420
|
throw e;
|
|
@@ -433,10 +427,10 @@ var require_resolve_symlink = __commonJS({
|
|
|
433
427
|
}
|
|
434
428
|
__name(build, "build");
|
|
435
429
|
exports.build = build;
|
|
436
|
-
function isRecursive(
|
|
430
|
+
function isRecursive(path19, resolved, state) {
|
|
437
431
|
if (state.options.useRealPaths)
|
|
438
432
|
return isRecursiveUsingRealPaths(resolved, state);
|
|
439
|
-
let parent = (0, path_1.dirname)(
|
|
433
|
+
let parent = (0, path_1.dirname)(path19);
|
|
440
434
|
let depth = 1;
|
|
441
435
|
while (parent !== state.root && depth < 2) {
|
|
442
436
|
const resolvedPath = state.symlinks.get(parent);
|
|
@@ -446,7 +440,7 @@ var require_resolve_symlink = __commonJS({
|
|
|
446
440
|
else
|
|
447
441
|
parent = (0, path_1.dirname)(parent);
|
|
448
442
|
}
|
|
449
|
-
state.symlinks.set(
|
|
443
|
+
state.symlinks.set(path19, resolved);
|
|
450
444
|
return depth > 1;
|
|
451
445
|
}
|
|
452
446
|
__name(isRecursive, "isRecursive");
|
|
@@ -732,21 +726,21 @@ var require_walker = __commonJS({
|
|
|
732
726
|
const filename = this.joinPath(entry.name, directoryPath);
|
|
733
727
|
this.pushFile(filename, files, this.state.counts, filters);
|
|
734
728
|
} else if (entry.isDirectory()) {
|
|
735
|
-
let
|
|
736
|
-
if (exclude && exclude(entry.name,
|
|
729
|
+
let path19 = joinPath.joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
|
|
730
|
+
if (exclude && exclude(entry.name, path19))
|
|
737
731
|
continue;
|
|
738
|
-
this.pushDirectory(
|
|
739
|
-
this.walkDirectory(this.state,
|
|
732
|
+
this.pushDirectory(path19, paths, filters);
|
|
733
|
+
this.walkDirectory(this.state, path19, path19, depth - 1, this.walk);
|
|
740
734
|
} else if (this.resolveSymlink && entry.isSymbolicLink()) {
|
|
741
|
-
let
|
|
742
|
-
this.resolveSymlink(
|
|
743
|
-
if (
|
|
735
|
+
let path19 = joinPath.joinPathWithBasePath(entry.name, directoryPath);
|
|
736
|
+
this.resolveSymlink(path19, this.state, (stat4, resolvedPath) => {
|
|
737
|
+
if (stat4.isDirectory()) {
|
|
744
738
|
resolvedPath = (0, utils_1.normalizePath)(resolvedPath, this.state.options);
|
|
745
|
-
if (exclude && exclude(entry.name, useRealPaths ? resolvedPath :
|
|
739
|
+
if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path19 + pathSeparator))
|
|
746
740
|
return;
|
|
747
|
-
this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath :
|
|
741
|
+
this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path19 + pathSeparator, depth - 1, this.walk);
|
|
748
742
|
} else {
|
|
749
|
-
resolvedPath = useRealPaths ? resolvedPath :
|
|
743
|
+
resolvedPath = useRealPaths ? resolvedPath : path19;
|
|
750
744
|
const filename = (0, path_1.basename)(resolvedPath);
|
|
751
745
|
const directoryPath2 = (0, utils_1.normalizePath)((0, path_1.dirname)(resolvedPath), this.state.options);
|
|
752
746
|
resolvedPath = this.joinPath(filename, directoryPath2);
|
|
@@ -771,11 +765,11 @@ var require_async = __commonJS({
|
|
|
771
765
|
exports.callback = exports.promise = void 0;
|
|
772
766
|
var walker_1 = require_walker();
|
|
773
767
|
function promise(root, options) {
|
|
774
|
-
return new Promise((
|
|
768
|
+
return new Promise((resolve5, reject) => {
|
|
775
769
|
callback(root, options, (err, output) => {
|
|
776
770
|
if (err)
|
|
777
771
|
return reject(err);
|
|
778
|
-
|
|
772
|
+
resolve5(output);
|
|
779
773
|
});
|
|
780
774
|
});
|
|
781
775
|
}
|
|
@@ -973,7 +967,7 @@ var require_builder = __commonJS({
|
|
|
973
967
|
isMatch = globFn(patterns, ...options);
|
|
974
968
|
this.globCache[patterns.join("\0")] = isMatch;
|
|
975
969
|
}
|
|
976
|
-
this.options.filters.push((
|
|
970
|
+
this.options.filters.push((path19) => isMatch(path19));
|
|
977
971
|
return this;
|
|
978
972
|
}
|
|
979
973
|
};
|
|
@@ -1053,7 +1047,7 @@ var JsonFormatter = class {
|
|
|
1053
1047
|
// packages/core/src/core/nonInteractiveToolExecutor.ts
|
|
1054
1048
|
init_esbuild_shims();
|
|
1055
1049
|
async function executeToolCall(config, toolCallRequest, abortSignal, options = {}) {
|
|
1056
|
-
return new Promise((
|
|
1050
|
+
return new Promise((resolve5, reject) => {
|
|
1057
1051
|
new CoreToolScheduler({
|
|
1058
1052
|
config,
|
|
1059
1053
|
chatRecordingService: options.recordToolResult === false ? void 0 : config.getChatRecordingService(),
|
|
@@ -1062,7 +1056,7 @@ async function executeToolCall(config, toolCallRequest, abortSignal, options = {
|
|
|
1062
1056
|
if (options.onAllToolCallsComplete) {
|
|
1063
1057
|
await options.onAllToolCallsComplete(completedToolCalls);
|
|
1064
1058
|
}
|
|
1065
|
-
|
|
1059
|
+
resolve5(completedToolCalls[0].response);
|
|
1066
1060
|
}, "onAllToolCallsComplete"),
|
|
1067
1061
|
onToolCallsUpdate: options.onToolCallsUpdate,
|
|
1068
1062
|
onToolResultFullTurnModel: options.onToolResultFullTurnModel,
|
|
@@ -2556,7 +2550,7 @@ var McpTransportPool = class {
|
|
|
2556
2550
|
spawnWait.then(() => {
|
|
2557
2551
|
if (inflightTimer) clearTimeout(inflightTimer);
|
|
2558
2552
|
}),
|
|
2559
|
-
new Promise((
|
|
2553
|
+
new Promise((resolve5) => {
|
|
2560
2554
|
inflightTimer = setTimeout(
|
|
2561
2555
|
() => {
|
|
2562
2556
|
const stuckIds = [...this.spawnInFlight.keys()];
|
|
@@ -2565,7 +2559,7 @@ var McpTransportPool = class {
|
|
|
2565
2559
|
", "
|
|
2566
2560
|
)}. Proceeding with drain.`
|
|
2567
2561
|
);
|
|
2568
|
-
|
|
2562
|
+
resolve5();
|
|
2569
2563
|
},
|
|
2570
2564
|
Math.max(0, deadline - Date.now())
|
|
2571
2565
|
);
|
|
@@ -2591,8 +2585,8 @@ var McpTransportPool = class {
|
|
|
2591
2585
|
Promise.all(shutdownPromises).then(() => {
|
|
2592
2586
|
if (drainTimer) clearTimeout(drainTimer);
|
|
2593
2587
|
}),
|
|
2594
|
-
new Promise((
|
|
2595
|
-
drainTimer = setTimeout(() =>
|
|
2588
|
+
new Promise((resolve5) => {
|
|
2589
|
+
drainTimer = setTimeout(() => resolve5(), remaining);
|
|
2596
2590
|
drainTimer.unref?.();
|
|
2597
2591
|
})
|
|
2598
2592
|
]);
|
|
@@ -5287,12 +5281,12 @@ __name(isWithin, "isWithin");
|
|
|
5287
5281
|
async function readBoundedTaskFile(filePath) {
|
|
5288
5282
|
const handle = await fs.open(filePath, "r");
|
|
5289
5283
|
try {
|
|
5290
|
-
const
|
|
5291
|
-
if (!
|
|
5284
|
+
const stat4 = await handle.stat();
|
|
5285
|
+
if (!stat4.isFile()) {
|
|
5292
5286
|
return null;
|
|
5293
5287
|
}
|
|
5294
5288
|
const cap = LOOP_TASK_FILE_MAX_BYTES + 1;
|
|
5295
|
-
const allocSize = Math.min(cap,
|
|
5289
|
+
const allocSize = Math.min(cap, stat4.size + 1);
|
|
5296
5290
|
const buffer = Buffer.alloc(allocSize);
|
|
5297
5291
|
let total = 0;
|
|
5298
5292
|
while (total < allocSize) {
|
|
@@ -5678,768 +5672,6 @@ ${PACING_SUFFIX[mode]}`,
|
|
|
5678
5672
|
}
|
|
5679
5673
|
};
|
|
5680
5674
|
|
|
5681
|
-
// packages/core/src/utils/github-prs.ts
|
|
5682
|
-
init_esbuild_shims();
|
|
5683
|
-
import { execFile as execFile2 } from "node:child_process";
|
|
5684
|
-
import { promisify as promisify2 } from "node:util";
|
|
5685
|
-
|
|
5686
|
-
// packages/core/src/utils/git-branches.ts
|
|
5687
|
-
init_esbuild_shims();
|
|
5688
|
-
import { execFile } from "node:child_process";
|
|
5689
|
-
import { promisify } from "node:util";
|
|
5690
|
-
|
|
5691
|
-
// packages/core/src/utils/gitDirect.ts
|
|
5692
|
-
init_esbuild_shims();
|
|
5693
|
-
import * as fs2 from "node:fs";
|
|
5694
|
-
import * as fsPromises from "node:fs/promises";
|
|
5695
|
-
import * as path4 from "node:path";
|
|
5696
|
-
var SHORT_SHA_LENGTH = 7;
|
|
5697
|
-
var debug = createDebugLogger("gitDirect");
|
|
5698
|
-
var MAX_REF_COMPONENT_LENGTH = 255;
|
|
5699
|
-
var INVALID_REF_CHARS = /[\x00-\x20\x7f-\x9f\u200b-\u200d\u2028\u2029\u202a-\u202e\u2066-\u2069\ufeff~^:?*[\\]/;
|
|
5700
|
-
function isValidRefName(name) {
|
|
5701
|
-
if (!name || name === "HEAD") return false;
|
|
5702
|
-
if (name.startsWith("/") || name.endsWith("/")) return false;
|
|
5703
|
-
if (name.startsWith(".") || name.endsWith(".")) return false;
|
|
5704
|
-
if (name.endsWith(".lock")) return false;
|
|
5705
|
-
if (name.includes("..") || name.includes("//")) return false;
|
|
5706
|
-
if (name.includes("/.") || name.includes("./") || name.includes(".lock/")) {
|
|
5707
|
-
return false;
|
|
5708
|
-
}
|
|
5709
|
-
if (name.includes("@{")) return false;
|
|
5710
|
-
if (INVALID_REF_CHARS.test(name)) return false;
|
|
5711
|
-
if (name.split("/").some((c) => c.length > MAX_REF_COMPONENT_LENGTH)) {
|
|
5712
|
-
return false;
|
|
5713
|
-
}
|
|
5714
|
-
return true;
|
|
5715
|
-
}
|
|
5716
|
-
__name(isValidRefName, "isValidRefName");
|
|
5717
|
-
function isValidGitSha(value) {
|
|
5718
|
-
return /^[0-9a-f]{40}$/.test(value) || /^[0-9a-f]{64}$/.test(value);
|
|
5719
|
-
}
|
|
5720
|
-
__name(isValidGitSha, "isValidGitSha");
|
|
5721
|
-
var gitDirCache = /* @__PURE__ */ new Map();
|
|
5722
|
-
async function isDir(p) {
|
|
5723
|
-
try {
|
|
5724
|
-
return (await fsPromises.stat(p)).isDirectory();
|
|
5725
|
-
} catch {
|
|
5726
|
-
return false;
|
|
5727
|
-
}
|
|
5728
|
-
}
|
|
5729
|
-
__name(isDir, "isDir");
|
|
5730
|
-
async function hasGitStore(dir) {
|
|
5731
|
-
const [objects, refs] = await Promise.all([
|
|
5732
|
-
isDir(path4.join(dir, "objects")),
|
|
5733
|
-
isDir(path4.join(dir, "refs"))
|
|
5734
|
-
]);
|
|
5735
|
-
return objects && refs;
|
|
5736
|
-
}
|
|
5737
|
-
__name(hasGitStore, "hasGitStore");
|
|
5738
|
-
async function isRealGitDir(gitDir) {
|
|
5739
|
-
if (await hasGitStore(gitDir)) return true;
|
|
5740
|
-
const rel = await readFirstLineNoFollow(path4.join(gitDir, "commondir"));
|
|
5741
|
-
if (!rel) return false;
|
|
5742
|
-
return hasGitStore(path4.resolve(gitDir, rel.trim()));
|
|
5743
|
-
}
|
|
5744
|
-
__name(isRealGitDir, "isRealGitDir");
|
|
5745
|
-
async function resolveTrustedGitDir(cwd) {
|
|
5746
|
-
const gitDir = await resolveGitDir(cwd);
|
|
5747
|
-
if (!gitDir) return null;
|
|
5748
|
-
return await isRealGitDir(gitDir) ? gitDir : null;
|
|
5749
|
-
}
|
|
5750
|
-
__name(resolveTrustedGitDir, "resolveTrustedGitDir");
|
|
5751
|
-
async function getCachedGitDir(cwd) {
|
|
5752
|
-
const key = path4.resolve(cwd);
|
|
5753
|
-
const cached = gitDirCache.get(key);
|
|
5754
|
-
if (cached !== void 0) return cached;
|
|
5755
|
-
const gitDir = await resolveTrustedGitDir(key);
|
|
5756
|
-
if (gitDir !== null) gitDirCache.set(key, gitDir);
|
|
5757
|
-
return gitDir;
|
|
5758
|
-
}
|
|
5759
|
-
__name(getCachedGitDir, "getCachedGitDir");
|
|
5760
|
-
async function readGitHead(gitDir) {
|
|
5761
|
-
const firstLine = await readFirstLineNoFollow(path4.join(gitDir, "HEAD"));
|
|
5762
|
-
if (firstLine === null) return null;
|
|
5763
|
-
const content = firstLine.trim();
|
|
5764
|
-
if (content.startsWith("ref:")) {
|
|
5765
|
-
const ref = content.slice(4).trim();
|
|
5766
|
-
if (!ref.startsWith("refs/heads/")) return null;
|
|
5767
|
-
const name = ref.slice("refs/heads/".length);
|
|
5768
|
-
if (!isValidRefName(name)) return null;
|
|
5769
|
-
return { type: "branch", name };
|
|
5770
|
-
}
|
|
5771
|
-
if (isValidGitSha(content)) {
|
|
5772
|
-
return { type: "detached", name: content };
|
|
5773
|
-
}
|
|
5774
|
-
return null;
|
|
5775
|
-
}
|
|
5776
|
-
__name(readGitHead, "readGitHead");
|
|
5777
|
-
async function resolveBranchName(cwd) {
|
|
5778
|
-
const gitDir = await getCachedGitDir(cwd);
|
|
5779
|
-
if (!gitDir) return void 0;
|
|
5780
|
-
const head = await readGitHead(gitDir);
|
|
5781
|
-
if (!head) return void 0;
|
|
5782
|
-
return head.type === "branch" ? head.name : head.name.slice(0, SHORT_SHA_LENGTH);
|
|
5783
|
-
}
|
|
5784
|
-
__name(resolveBranchName, "resolveBranchName");
|
|
5785
|
-
var repoBranchWatches = /* @__PURE__ */ new Map();
|
|
5786
|
-
async function watchRepoBranch(cwd, onChange) {
|
|
5787
|
-
const gitDir = await getCachedGitDir(cwd);
|
|
5788
|
-
if (!gitDir) return () => {
|
|
5789
|
-
};
|
|
5790
|
-
let entry = repoBranchWatches.get(gitDir);
|
|
5791
|
-
if (!entry) {
|
|
5792
|
-
const logsHeadPath = path4.join(gitDir, "logs", "HEAD");
|
|
5793
|
-
try {
|
|
5794
|
-
await fsPromises.access(logsHeadPath, fs2.constants?.F_OK ?? 0);
|
|
5795
|
-
if ((await fsPromises.lstat(logsHeadPath)).isSymbolicLink()) {
|
|
5796
|
-
return () => {
|
|
5797
|
-
};
|
|
5798
|
-
}
|
|
5799
|
-
} catch {
|
|
5800
|
-
return () => {
|
|
5801
|
-
};
|
|
5802
|
-
}
|
|
5803
|
-
const existing = repoBranchWatches.get(gitDir);
|
|
5804
|
-
if (existing) {
|
|
5805
|
-
entry = existing;
|
|
5806
|
-
} else {
|
|
5807
|
-
let watcher;
|
|
5808
|
-
try {
|
|
5809
|
-
watcher = fs2.watch(logsHeadPath, (eventType) => {
|
|
5810
|
-
if (eventType === "change" || eventType === "rename") {
|
|
5811
|
-
repoBranchWatches.get(gitDir)?.subscribers.forEach((cb) => {
|
|
5812
|
-
try {
|
|
5813
|
-
cb();
|
|
5814
|
-
} catch {
|
|
5815
|
-
}
|
|
5816
|
-
});
|
|
5817
|
-
}
|
|
5818
|
-
});
|
|
5819
|
-
} catch (err) {
|
|
5820
|
-
debug.warn(`failed to watch reflog for ${gitDir}: ${err}`);
|
|
5821
|
-
return () => {
|
|
5822
|
-
};
|
|
5823
|
-
}
|
|
5824
|
-
watcher.on("error", (err) => {
|
|
5825
|
-
debug.warn(
|
|
5826
|
-
`reflog watcher error for ${gitDir}; branch will no longer auto-update: ${err?.message}`
|
|
5827
|
-
);
|
|
5828
|
-
const current = repoBranchWatches.get(gitDir);
|
|
5829
|
-
if (current?.watcher === watcher) {
|
|
5830
|
-
try {
|
|
5831
|
-
watcher.close();
|
|
5832
|
-
} catch {
|
|
5833
|
-
}
|
|
5834
|
-
repoBranchWatches.delete(gitDir);
|
|
5835
|
-
}
|
|
5836
|
-
});
|
|
5837
|
-
entry = { watcher, subscribers: /* @__PURE__ */ new Set() };
|
|
5838
|
-
repoBranchWatches.set(gitDir, entry);
|
|
5839
|
-
}
|
|
5840
|
-
}
|
|
5841
|
-
entry.subscribers.add(onChange);
|
|
5842
|
-
let disposed = false;
|
|
5843
|
-
return () => {
|
|
5844
|
-
if (disposed) return;
|
|
5845
|
-
disposed = true;
|
|
5846
|
-
const e = repoBranchWatches.get(gitDir);
|
|
5847
|
-
if (!e) return;
|
|
5848
|
-
e.subscribers.delete(onChange);
|
|
5849
|
-
if (e.subscribers.size === 0) {
|
|
5850
|
-
e.watcher.close();
|
|
5851
|
-
repoBranchWatches.delete(gitDir);
|
|
5852
|
-
}
|
|
5853
|
-
};
|
|
5854
|
-
}
|
|
5855
|
-
__name(watchRepoBranch, "watchRepoBranch");
|
|
5856
|
-
|
|
5857
|
-
// packages/core/src/utils/git-branches.ts
|
|
5858
|
-
var execFileAsync = promisify(execFile);
|
|
5859
|
-
var GIT_TIMEOUT_MS = 3e4;
|
|
5860
|
-
var MAX_RECENT_BRANCHES = 20;
|
|
5861
|
-
var MAX_REFLOG_ENTRIES = 200;
|
|
5862
|
-
var GIT_ENV_VARS_TO_CLEAR = [
|
|
5863
|
-
"GIT_DIR",
|
|
5864
|
-
"GIT_WORK_TREE",
|
|
5865
|
-
"GIT_COMMON_DIR",
|
|
5866
|
-
"GIT_INDEX_FILE",
|
|
5867
|
-
"GIT_CONFIG_GLOBAL",
|
|
5868
|
-
"GIT_CONFIG_SYSTEM",
|
|
5869
|
-
"GIT_CONFIG_NOSYSTEM",
|
|
5870
|
-
// Repository selectors that an inherited daemon environment could use to
|
|
5871
|
-
// redirect a trusted-workspace git/gh invocation to a different repository
|
|
5872
|
-
// or object database despite the resolved cwd.
|
|
5873
|
-
"GH_REPO",
|
|
5874
|
-
"GIT_CONFIG_COUNT",
|
|
5875
|
-
"GIT_CONFIG_PARAMETERS",
|
|
5876
|
-
"GIT_OBJECT_DIRECTORY",
|
|
5877
|
-
"GIT_ALTERNATE_OBJECT_DIRECTORIES"
|
|
5878
|
-
];
|
|
5879
|
-
var GIT_ENV_PREFIXES_TO_CLEAR = ["GIT_CONFIG_KEY_", "GIT_CONFIG_VALUE_"];
|
|
5880
|
-
function gitEnv(base) {
|
|
5881
|
-
const env2 = { ...base ?? process.env };
|
|
5882
|
-
for (const key of GIT_ENV_VARS_TO_CLEAR) {
|
|
5883
|
-
delete env2[key];
|
|
5884
|
-
}
|
|
5885
|
-
for (const key of Object.keys(env2)) {
|
|
5886
|
-
if (GIT_ENV_PREFIXES_TO_CLEAR.some((prefix) => key.startsWith(prefix))) {
|
|
5887
|
-
delete env2[key];
|
|
5888
|
-
}
|
|
5889
|
-
}
|
|
5890
|
-
env2["LC_ALL"] = "C";
|
|
5891
|
-
env2["LANG"] = "C";
|
|
5892
|
-
return env2;
|
|
5893
|
-
}
|
|
5894
|
-
__name(gitEnv, "gitEnv");
|
|
5895
|
-
function runGit(cwd, args, env2) {
|
|
5896
|
-
return execFileAsync("git", args, {
|
|
5897
|
-
cwd,
|
|
5898
|
-
timeout: GIT_TIMEOUT_MS,
|
|
5899
|
-
maxBuffer: 10 * 1024 * 1024,
|
|
5900
|
-
env: gitEnv(env2)
|
|
5901
|
-
}).then(({ stdout }) => stdout);
|
|
5902
|
-
}
|
|
5903
|
-
__name(runGit, "runGit");
|
|
5904
|
-
var SEPARATOR = "\0";
|
|
5905
|
-
async function fetchGitBranches(cwd, env2) {
|
|
5906
|
-
await runGit(cwd, ["rev-parse", "--git-dir"], env2);
|
|
5907
|
-
const [localRaw, remoteRaw, tagsRaw, headRaw, reflogRaw] = await Promise.all([
|
|
5908
|
-
runGit(
|
|
5909
|
-
cwd,
|
|
5910
|
-
[
|
|
5911
|
-
"for-each-ref",
|
|
5912
|
-
"--format=%(refname:short)%00%(HEAD)%00%(upstream:short)%00%(upstream:track,nobracket)%00%(committerdate:unix)%00%(subject)%00%(symref)",
|
|
5913
|
-
"refs/heads/"
|
|
5914
|
-
],
|
|
5915
|
-
env2
|
|
5916
|
-
).catch(() => ""),
|
|
5917
|
-
runGit(
|
|
5918
|
-
cwd,
|
|
5919
|
-
[
|
|
5920
|
-
"for-each-ref",
|
|
5921
|
-
"--format=%(refname:short)%00%(HEAD)%00%(upstream:short)%00%(upstream:track,nobracket)%00%(committerdate:unix)%00%(subject)%00%(symref)",
|
|
5922
|
-
"refs/remotes/"
|
|
5923
|
-
],
|
|
5924
|
-
env2
|
|
5925
|
-
).catch(() => ""),
|
|
5926
|
-
runGit(
|
|
5927
|
-
cwd,
|
|
5928
|
-
[
|
|
5929
|
-
"for-each-ref",
|
|
5930
|
-
"--format=%(refname:short)%00%(creatordate:unix)%00%(subject)",
|
|
5931
|
-
"--sort=-creatordate",
|
|
5932
|
-
"refs/tags/"
|
|
5933
|
-
],
|
|
5934
|
-
env2
|
|
5935
|
-
).catch(() => ""),
|
|
5936
|
-
runGit(cwd, ["symbolic-ref", "--short", "HEAD"], env2).catch(() => ""),
|
|
5937
|
-
runGit(
|
|
5938
|
-
cwd,
|
|
5939
|
-
["reflog", "show", "--format=%gs", `-${MAX_REFLOG_ENTRIES}`],
|
|
5940
|
-
env2
|
|
5941
|
-
).catch(() => "")
|
|
5942
|
-
]);
|
|
5943
|
-
const local = parseBranchLines(localRaw);
|
|
5944
|
-
const remote = parseBranchLines(remoteRaw);
|
|
5945
|
-
const tags = parseTagLines(tagsRaw);
|
|
5946
|
-
const recent = parseRecentBranches(reflogRaw, headRaw.trim());
|
|
5947
|
-
const headTrimmed = headRaw.trim();
|
|
5948
|
-
const detached = !headTrimmed;
|
|
5949
|
-
return {
|
|
5950
|
-
local,
|
|
5951
|
-
remote,
|
|
5952
|
-
tags,
|
|
5953
|
-
recent,
|
|
5954
|
-
head: headTrimmed || await getDetachedHead(cwd, env2),
|
|
5955
|
-
detached
|
|
5956
|
-
};
|
|
5957
|
-
}
|
|
5958
|
-
__name(fetchGitBranches, "fetchGitBranches");
|
|
5959
|
-
function parseBranchLines(raw) {
|
|
5960
|
-
if (!raw.trim()) return [];
|
|
5961
|
-
return raw.trim().split("\n").filter(Boolean).filter((line) => {
|
|
5962
|
-
const parts = line.split(SEPARATOR);
|
|
5963
|
-
return !(parts[6] ?? "");
|
|
5964
|
-
}).map((line) => {
|
|
5965
|
-
const parts = line.split(SEPARATOR);
|
|
5966
|
-
const name = parts[0] ?? "";
|
|
5967
|
-
const isHead = parts[1] === "*";
|
|
5968
|
-
const upstream = parts[2] || void 0;
|
|
5969
|
-
const track = parts[3] ?? "";
|
|
5970
|
-
const commitDate = parseInt(parts[4] ?? "0", 10) || 0;
|
|
5971
|
-
const commitSubject = parts[5] ?? "";
|
|
5972
|
-
let ahead = 0;
|
|
5973
|
-
let behind = 0;
|
|
5974
|
-
const aheadMatch = /ahead (\d+)/.exec(track);
|
|
5975
|
-
const behindMatch = /behind (\d+)/.exec(track);
|
|
5976
|
-
if (aheadMatch) ahead = parseInt(aheadMatch[1], 10);
|
|
5977
|
-
if (behindMatch) behind = parseInt(behindMatch[1], 10);
|
|
5978
|
-
const upstreamGone = upstream !== void 0 && /\bgone\b/.test(track);
|
|
5979
|
-
return {
|
|
5980
|
-
name,
|
|
5981
|
-
isHead,
|
|
5982
|
-
upstream,
|
|
5983
|
-
...upstreamGone ? { upstreamGone } : {},
|
|
5984
|
-
ahead,
|
|
5985
|
-
behind,
|
|
5986
|
-
commitDate,
|
|
5987
|
-
commitSubject
|
|
5988
|
-
};
|
|
5989
|
-
});
|
|
5990
|
-
}
|
|
5991
|
-
__name(parseBranchLines, "parseBranchLines");
|
|
5992
|
-
function parseTagLines(raw) {
|
|
5993
|
-
if (!raw.trim()) return [];
|
|
5994
|
-
return raw.trim().split("\n").filter(Boolean).map((line) => {
|
|
5995
|
-
const parts = line.split(SEPARATOR);
|
|
5996
|
-
return {
|
|
5997
|
-
name: parts[0] ?? "",
|
|
5998
|
-
date: parseInt(parts[1] ?? "0", 10) || 0,
|
|
5999
|
-
subject: parts[2] ?? ""
|
|
6000
|
-
};
|
|
6001
|
-
});
|
|
6002
|
-
}
|
|
6003
|
-
__name(parseTagLines, "parseTagLines");
|
|
6004
|
-
function parseRecentBranches(reflogRaw, currentHead) {
|
|
6005
|
-
if (!reflogRaw.trim()) return [];
|
|
6006
|
-
const seen = /* @__PURE__ */ new Set();
|
|
6007
|
-
const result = [];
|
|
6008
|
-
for (const line of reflogRaw.trim().split("\n")) {
|
|
6009
|
-
if (!line.startsWith("checkout: moving from ")) continue;
|
|
6010
|
-
const idx = line.indexOf(" to ");
|
|
6011
|
-
if (idx === -1) continue;
|
|
6012
|
-
const branch = line.slice(idx + 4);
|
|
6013
|
-
if (branch && !seen.has(branch) && branch !== currentHead && !/^[0-9a-f]{7,40}$/.test(branch)) {
|
|
6014
|
-
seen.add(branch);
|
|
6015
|
-
result.push(branch);
|
|
6016
|
-
if (result.length >= MAX_RECENT_BRANCHES) break;
|
|
6017
|
-
}
|
|
6018
|
-
}
|
|
6019
|
-
return result;
|
|
6020
|
-
}
|
|
6021
|
-
__name(parseRecentBranches, "parseRecentBranches");
|
|
6022
|
-
async function getDetachedHead(cwd, env2) {
|
|
6023
|
-
try {
|
|
6024
|
-
const sha = await runGit(cwd, ["rev-parse", "--short", "HEAD"], env2);
|
|
6025
|
-
return sha.trim();
|
|
6026
|
-
} catch {
|
|
6027
|
-
return "";
|
|
6028
|
-
}
|
|
6029
|
-
}
|
|
6030
|
-
__name(getDetachedHead, "getDetachedHead");
|
|
6031
|
-
function isValidCheckoutRef(value) {
|
|
6032
|
-
const ref = value.trim();
|
|
6033
|
-
if (!ref || ref.startsWith("-")) return false;
|
|
6034
|
-
if (ref === "HEAD") return true;
|
|
6035
|
-
return isValidRefName(ref) || isValidGitSha(ref);
|
|
6036
|
-
}
|
|
6037
|
-
__name(isValidCheckoutRef, "isValidCheckoutRef");
|
|
6038
|
-
async function gitCheckout(cwd, ref, env2) {
|
|
6039
|
-
if (!isValidCheckoutRef(ref)) {
|
|
6040
|
-
throw new Error(`invalid checkout ref: ${ref}`);
|
|
6041
|
-
}
|
|
6042
|
-
const isRemoteTracking = await runGit(
|
|
6043
|
-
cwd,
|
|
6044
|
-
["show-ref", "--verify", "--quiet", `refs/remotes/${ref}`],
|
|
6045
|
-
env2
|
|
6046
|
-
).then(() => true).catch(() => false);
|
|
6047
|
-
if (isRemoteTracking) {
|
|
6048
|
-
const localName = ref.slice(ref.indexOf("/") + 1);
|
|
6049
|
-
if (!isValidCheckoutRef(localName)) {
|
|
6050
|
-
throw new Error(
|
|
6051
|
-
`invalid local branch name derived from remote ref: ${localName}`
|
|
6052
|
-
);
|
|
6053
|
-
}
|
|
6054
|
-
const hasLocal = await runGit(
|
|
6055
|
-
cwd,
|
|
6056
|
-
["show-ref", "--verify", "--quiet", `refs/heads/${localName}`],
|
|
6057
|
-
env2
|
|
6058
|
-
).then(() => true).catch(() => false);
|
|
6059
|
-
if (hasLocal) {
|
|
6060
|
-
await runGit(cwd, ["checkout", localName, "--"], env2);
|
|
6061
|
-
} else {
|
|
6062
|
-
await runGit(cwd, ["checkout", "--track", ref], env2);
|
|
6063
|
-
}
|
|
6064
|
-
const head = (await runGit(cwd, ["symbolic-ref", "--short", "HEAD"], env2)).trim();
|
|
6065
|
-
return { branch: head, detached: false };
|
|
6066
|
-
}
|
|
6067
|
-
await runGit(cwd, ["checkout", ref, "--"], env2);
|
|
6068
|
-
const headRaw = await runGit(
|
|
6069
|
-
cwd,
|
|
6070
|
-
["symbolic-ref", "--short", "HEAD"],
|
|
6071
|
-
env2
|
|
6072
|
-
).catch(() => "");
|
|
6073
|
-
const trimmed = headRaw.trim();
|
|
6074
|
-
if (trimmed) {
|
|
6075
|
-
return { branch: trimmed, detached: false };
|
|
6076
|
-
}
|
|
6077
|
-
const sha = await runGit(cwd, ["rev-parse", "--short", "HEAD"], env2);
|
|
6078
|
-
return { branch: sha.trim(), detached: true };
|
|
6079
|
-
}
|
|
6080
|
-
__name(gitCheckout, "gitCheckout");
|
|
6081
|
-
async function gitCreateBranch(cwd, name, startPoint, env2) {
|
|
6082
|
-
if (!isValidRefName(name) || name.startsWith("-")) {
|
|
6083
|
-
throw new Error(`invalid branch name: ${name}`);
|
|
6084
|
-
}
|
|
6085
|
-
const args = ["checkout", "-b", name];
|
|
6086
|
-
if (startPoint) {
|
|
6087
|
-
if (!isValidCheckoutRef(startPoint)) {
|
|
6088
|
-
throw new Error(`invalid start point: ${startPoint}`);
|
|
6089
|
-
}
|
|
6090
|
-
args.push(startPoint);
|
|
6091
|
-
}
|
|
6092
|
-
args.push("--");
|
|
6093
|
-
const originalRef = (await runGit(
|
|
6094
|
-
cwd,
|
|
6095
|
-
["symbolic-ref", "--quiet", "--short", "HEAD"],
|
|
6096
|
-
env2
|
|
6097
|
-
).catch(() => "")).trim();
|
|
6098
|
-
const originalCommit = originalRef ? "" : (await runGit(cwd, ["rev-parse", "HEAD"], env2).catch(() => "")).trim();
|
|
6099
|
-
try {
|
|
6100
|
-
await runGit(cwd, args, env2);
|
|
6101
|
-
} catch (err) {
|
|
6102
|
-
const nowOn = (await runGit(
|
|
6103
|
-
cwd,
|
|
6104
|
-
["symbolic-ref", "--quiet", "--short", "HEAD"],
|
|
6105
|
-
env2
|
|
6106
|
-
).catch(() => "")).trim();
|
|
6107
|
-
if (nowOn === name) {
|
|
6108
|
-
if (originalRef) {
|
|
6109
|
-
await runGit(cwd, ["checkout", originalRef, "--"], env2).catch(() => {
|
|
6110
|
-
});
|
|
6111
|
-
} else if (originalCommit) {
|
|
6112
|
-
await runGit(
|
|
6113
|
-
cwd,
|
|
6114
|
-
["checkout", "--detach", originalCommit, "--"],
|
|
6115
|
-
env2
|
|
6116
|
-
).catch(() => {
|
|
6117
|
-
});
|
|
6118
|
-
}
|
|
6119
|
-
await runGit(cwd, ["branch", "-D", name], env2).catch(() => {
|
|
6120
|
-
});
|
|
6121
|
-
}
|
|
6122
|
-
throw err;
|
|
6123
|
-
}
|
|
6124
|
-
return { branch: name, detached: false };
|
|
6125
|
-
}
|
|
6126
|
-
__name(gitCreateBranch, "gitCreateBranch");
|
|
6127
|
-
async function gitPush(cwd, opts, env2) {
|
|
6128
|
-
const args = ["push"];
|
|
6129
|
-
if (opts?.force) args.push("--force-with-lease");
|
|
6130
|
-
if (opts?.setUpstream) {
|
|
6131
|
-
let branch;
|
|
6132
|
-
try {
|
|
6133
|
-
branch = (await runGit(cwd, ["symbolic-ref", "--short", "HEAD"], env2)).trim();
|
|
6134
|
-
} catch {
|
|
6135
|
-
throw new Error(
|
|
6136
|
-
"cannot push with --set-upstream in detached HEAD state; check out a branch first"
|
|
6137
|
-
);
|
|
6138
|
-
}
|
|
6139
|
-
const hasUpstream = await runGit(
|
|
6140
|
-
cwd,
|
|
6141
|
-
["rev-parse", "--abbrev-ref", `${branch}@{u}`],
|
|
6142
|
-
env2
|
|
6143
|
-
).catch(() => "");
|
|
6144
|
-
if (hasUpstream.trim()) {
|
|
6145
|
-
const output2 = await runGit(cwd, args, env2);
|
|
6146
|
-
return { success: true, output: output2.trim() };
|
|
6147
|
-
}
|
|
6148
|
-
let remote = (await runGit(cwd, ["config", `branch.${branch}.pushRemote`], env2).catch(
|
|
6149
|
-
() => ""
|
|
6150
|
-
)).trim();
|
|
6151
|
-
if (!remote) {
|
|
6152
|
-
remote = (await runGit(cwd, ["config", "remote.pushDefault"], env2).catch(() => "")).trim();
|
|
6153
|
-
}
|
|
6154
|
-
if (!remote) {
|
|
6155
|
-
remote = (await runGit(cwd, ["config", `branch.${branch}.remote`], env2).catch(
|
|
6156
|
-
() => ""
|
|
6157
|
-
)).trim();
|
|
6158
|
-
}
|
|
6159
|
-
if (!remote) {
|
|
6160
|
-
const remotes = (await runGit(cwd, ["remote"], env2).catch(() => "")).trim();
|
|
6161
|
-
const remoteList = remotes ? remotes.split("\n") : [];
|
|
6162
|
-
remote = remoteList.length === 1 ? remoteList[0] ?? "origin" : "origin";
|
|
6163
|
-
}
|
|
6164
|
-
args.push("--set-upstream", remote, branch);
|
|
6165
|
-
}
|
|
6166
|
-
const output = await runGit(cwd, args, env2);
|
|
6167
|
-
return { success: true, output: output.trim() };
|
|
6168
|
-
}
|
|
6169
|
-
__name(gitPush, "gitPush");
|
|
6170
|
-
async function gitPull(cwd, opts, env2) {
|
|
6171
|
-
if (opts?.fetchOnly) {
|
|
6172
|
-
const output2 = await runGit(cwd, ["fetch", "--all", "--prune"], env2);
|
|
6173
|
-
return { success: true, output: output2.trim() };
|
|
6174
|
-
}
|
|
6175
|
-
const args = ["pull"];
|
|
6176
|
-
if (opts?.rebase) args.push("--rebase");
|
|
6177
|
-
const output = await runGit(cwd, args, env2);
|
|
6178
|
-
return { success: true, output: output.trim() };
|
|
6179
|
-
}
|
|
6180
|
-
__name(gitPull, "gitPull");
|
|
6181
|
-
async function gitCommit(cwd, message, opts, env2) {
|
|
6182
|
-
let savedIndex = null;
|
|
6183
|
-
if (opts?.all) {
|
|
6184
|
-
const tree = (await runGit(cwd, ["write-tree"], env2).catch(() => "")).trim();
|
|
6185
|
-
if (tree) {
|
|
6186
|
-
savedIndex = tree;
|
|
6187
|
-
} else {
|
|
6188
|
-
const unmerged = (await runGit(cwd, ["ls-files", "--unmerged"], env2)).trim();
|
|
6189
|
-
if (unmerged) {
|
|
6190
|
-
throw new Error(
|
|
6191
|
-
"cannot stage all changes: unresolved merge conflicts in the index"
|
|
6192
|
-
);
|
|
6193
|
-
}
|
|
6194
|
-
throw new Error(
|
|
6195
|
-
"cannot stage all changes: failed to snapshot index (write-tree failed)"
|
|
6196
|
-
);
|
|
6197
|
-
}
|
|
6198
|
-
}
|
|
6199
|
-
try {
|
|
6200
|
-
if (opts?.all) {
|
|
6201
|
-
await runGit(cwd, ["add", "-A"], env2);
|
|
6202
|
-
}
|
|
6203
|
-
await runGit(cwd, ["commit", "-m", message], env2);
|
|
6204
|
-
} catch (err) {
|
|
6205
|
-
if (savedIndex) {
|
|
6206
|
-
await runGit(cwd, ["read-tree", savedIndex], env2).catch((rollbackErr) => {
|
|
6207
|
-
console.error("git index rollback failed:", rollbackErr);
|
|
6208
|
-
});
|
|
6209
|
-
}
|
|
6210
|
-
throw err;
|
|
6211
|
-
}
|
|
6212
|
-
const sha = (await runGit(cwd, ["rev-parse", "--short", "HEAD"], env2)).trim();
|
|
6213
|
-
const subject = (await runGit(cwd, ["log", "-1", "--format=%s"], env2)).trim();
|
|
6214
|
-
return { sha, subject };
|
|
6215
|
-
}
|
|
6216
|
-
__name(gitCommit, "gitCommit");
|
|
6217
|
-
|
|
6218
|
-
// packages/core/src/utils/github-prs.ts
|
|
6219
|
-
var execFileAsync2 = promisify2(execFile2);
|
|
6220
|
-
var GH_TIMEOUT_MS = 1e4;
|
|
6221
|
-
var GH_MAX_BUFFER = 16 * 1024 * 1024;
|
|
6222
|
-
var GH_ERROR_RAW_MAX = 4096;
|
|
6223
|
-
var GITHUB_PR_ERROR_MESSAGE_MAX = 512;
|
|
6224
|
-
var GITHUB_PR_LIST_LIMIT = 30;
|
|
6225
|
-
var GH_PR_LIST_FIELDS = "number,title,url,author,headRefName,isDraft,reviewDecision,statusCheckRollup,updatedAt";
|
|
6226
|
-
var GH_PR_LIST_FIELDS_SLIM = "number,url,headRefName,state";
|
|
6227
|
-
var FAILING_CHECK_RUN_CONCLUSIONS = /* @__PURE__ */ new Set([
|
|
6228
|
-
"FAILURE",
|
|
6229
|
-
"CANCELLED",
|
|
6230
|
-
"TIMED_OUT",
|
|
6231
|
-
"ACTION_REQUIRED",
|
|
6232
|
-
"STARTUP_FAILURE",
|
|
6233
|
-
"STALE"
|
|
6234
|
-
]);
|
|
6235
|
-
var FAILING_STATUS_CONTEXT_STATES = /* @__PURE__ */ new Set(["ERROR", "FAILURE"]);
|
|
6236
|
-
function aggregateChecks(rollup) {
|
|
6237
|
-
if (!Array.isArray(rollup) || rollup.length === 0) return "none";
|
|
6238
|
-
let sawPassing = false;
|
|
6239
|
-
let sawPending = false;
|
|
6240
|
-
for (const entry of rollup) {
|
|
6241
|
-
if (entry.__typename === "StatusContext") {
|
|
6242
|
-
const state = entry.state?.toUpperCase();
|
|
6243
|
-
if (state && FAILING_STATUS_CONTEXT_STATES.has(state)) return "failing";
|
|
6244
|
-
if (state === "SUCCESS") sawPassing = true;
|
|
6245
|
-
else sawPending = true;
|
|
6246
|
-
} else {
|
|
6247
|
-
const conclusion = entry.conclusion?.toUpperCase();
|
|
6248
|
-
if (conclusion) {
|
|
6249
|
-
if (FAILING_CHECK_RUN_CONCLUSIONS.has(conclusion)) return "failing";
|
|
6250
|
-
sawPassing = true;
|
|
6251
|
-
} else {
|
|
6252
|
-
sawPending = true;
|
|
6253
|
-
}
|
|
6254
|
-
}
|
|
6255
|
-
}
|
|
6256
|
-
if (sawPending) return "pending";
|
|
6257
|
-
return sawPassing ? "passing" : "none";
|
|
6258
|
-
}
|
|
6259
|
-
__name(aggregateChecks, "aggregateChecks");
|
|
6260
|
-
function mapReviewDecision(value) {
|
|
6261
|
-
switch (value) {
|
|
6262
|
-
case "APPROVED":
|
|
6263
|
-
return "approved";
|
|
6264
|
-
case "CHANGES_REQUESTED":
|
|
6265
|
-
return "changes_requested";
|
|
6266
|
-
case "REVIEW_REQUIRED":
|
|
6267
|
-
return "review_required";
|
|
6268
|
-
default:
|
|
6269
|
-
return null;
|
|
6270
|
-
}
|
|
6271
|
-
}
|
|
6272
|
-
__name(mapReviewDecision, "mapReviewDecision");
|
|
6273
|
-
function mapEntry(entry) {
|
|
6274
|
-
if (typeof entry.number !== "number") return null;
|
|
6275
|
-
const parsed = Date.parse(entry.updatedAt ?? "");
|
|
6276
|
-
let state;
|
|
6277
|
-
switch (entry.state?.toUpperCase()) {
|
|
6278
|
-
case "MERGED":
|
|
6279
|
-
state = "merged";
|
|
6280
|
-
break;
|
|
6281
|
-
case "CLOSED":
|
|
6282
|
-
state = "closed";
|
|
6283
|
-
break;
|
|
6284
|
-
default:
|
|
6285
|
-
state = entry.isDraft ? "draft" : "open";
|
|
6286
|
-
break;
|
|
6287
|
-
}
|
|
6288
|
-
return {
|
|
6289
|
-
number: entry.number,
|
|
6290
|
-
title: entry.title ?? "",
|
|
6291
|
-
url: entry.url ?? "",
|
|
6292
|
-
author: entry.author?.login ?? "",
|
|
6293
|
-
headRefName: entry.headRefName ?? "",
|
|
6294
|
-
state,
|
|
6295
|
-
reviewDecision: mapReviewDecision(entry.reviewDecision),
|
|
6296
|
-
checks: aggregateChecks(entry.statusCheckRollup),
|
|
6297
|
-
updatedAt: Number.isNaN(parsed) ? 0 : Math.floor(parsed / 1e3)
|
|
6298
|
-
};
|
|
6299
|
-
}
|
|
6300
|
-
__name(mapEntry, "mapEntry");
|
|
6301
|
-
function parseGhPrList(stdout) {
|
|
6302
|
-
const parsed = JSON.parse(stdout);
|
|
6303
|
-
if (!Array.isArray(parsed)) {
|
|
6304
|
-
throw new Error("unexpected gh output: expected a JSON array");
|
|
6305
|
-
}
|
|
6306
|
-
return parsed.map((entry) => mapEntry(entry)).filter((entry) => entry !== null).sort((a, b) => b.updatedAt - a.updatedAt);
|
|
6307
|
-
}
|
|
6308
|
-
__name(parseGhPrList, "parseGhPrList");
|
|
6309
|
-
function runGhPrList(gitRoot, env2, options = {}) {
|
|
6310
|
-
const limit = Math.min(
|
|
6311
|
-
Math.max(options.limit ?? GITHUB_PR_LIST_LIMIT, 1),
|
|
6312
|
-
1e3
|
|
6313
|
-
);
|
|
6314
|
-
return new Promise((resolve6, reject) => {
|
|
6315
|
-
execFile2(
|
|
6316
|
-
"gh",
|
|
6317
|
-
[
|
|
6318
|
-
"pr",
|
|
6319
|
-
"list",
|
|
6320
|
-
"--state",
|
|
6321
|
-
options.state ?? "open",
|
|
6322
|
-
"--limit",
|
|
6323
|
-
String(limit),
|
|
6324
|
-
"--json",
|
|
6325
|
-
options.slim ? GH_PR_LIST_FIELDS_SLIM : GH_PR_LIST_FIELDS
|
|
6326
|
-
],
|
|
6327
|
-
{
|
|
6328
|
-
cwd: gitRoot,
|
|
6329
|
-
timeout: GH_TIMEOUT_MS,
|
|
6330
|
-
maxBuffer: GH_MAX_BUFFER,
|
|
6331
|
-
windowsHide: true,
|
|
6332
|
-
encoding: "utf8",
|
|
6333
|
-
env: gitEnv(env2)
|
|
6334
|
-
},
|
|
6335
|
-
(error, stdout) => {
|
|
6336
|
-
if (error) reject(error);
|
|
6337
|
-
else resolve6(stdout);
|
|
6338
|
-
}
|
|
6339
|
-
);
|
|
6340
|
-
});
|
|
6341
|
-
}
|
|
6342
|
-
__name(runGhPrList, "runGhPrList");
|
|
6343
|
-
function ghErrorMessage(error, commandLabel = "gh pr list", timeoutMs = GH_TIMEOUT_MS) {
|
|
6344
|
-
if (error?.killed === true) {
|
|
6345
|
-
return `${commandLabel} timed out after ${timeoutMs / 1e3}s`;
|
|
6346
|
-
}
|
|
6347
|
-
const stderr = error?.stderr;
|
|
6348
|
-
const raw = typeof stderr === "string" && stderr.trim() ? stderr : error instanceof Error ? error.message : String(error);
|
|
6349
|
-
return raw.replace(/\s+/g, " ").trim().slice(0, GH_ERROR_RAW_MAX);
|
|
6350
|
-
}
|
|
6351
|
-
__name(ghErrorMessage, "ghErrorMessage");
|
|
6352
|
-
async function fetchGitHubPullRequests(cwd, env2, options) {
|
|
6353
|
-
const gitRoot = findGitRoot(cwd);
|
|
6354
|
-
if (!gitRoot) return { kind: "not_a_repo" };
|
|
6355
|
-
let stdout;
|
|
6356
|
-
try {
|
|
6357
|
-
stdout = await runGhPrList(gitRoot, env2, options);
|
|
6358
|
-
} catch (error) {
|
|
6359
|
-
if (error.code === "ENOENT") {
|
|
6360
|
-
return { kind: "cli_unavailable" };
|
|
6361
|
-
}
|
|
6362
|
-
return { kind: "failed", message: ghErrorMessage(error), gitRoot };
|
|
6363
|
-
}
|
|
6364
|
-
try {
|
|
6365
|
-
return { kind: "ok", pullRequests: parseGhPrList(stdout) };
|
|
6366
|
-
} catch (error) {
|
|
6367
|
-
return { kind: "failed", message: ghErrorMessage(error), gitRoot };
|
|
6368
|
-
}
|
|
6369
|
-
}
|
|
6370
|
-
__name(fetchGitHubPullRequests, "fetchGitHubPullRequests");
|
|
6371
|
-
var GH_CREATE_TIMEOUT_MS = 3e4;
|
|
6372
|
-
function runGhPrCreate(gitRoot, opts, env2) {
|
|
6373
|
-
const args = ["pr", "create", "--title", opts.title];
|
|
6374
|
-
args.push("--body", opts.body ?? "");
|
|
6375
|
-
if (opts.base) args.push("--base", opts.base);
|
|
6376
|
-
if (opts.head) args.push("--head", opts.head);
|
|
6377
|
-
return new Promise((resolve6, reject) => {
|
|
6378
|
-
execFile2(
|
|
6379
|
-
"gh",
|
|
6380
|
-
args,
|
|
6381
|
-
{
|
|
6382
|
-
cwd: gitRoot,
|
|
6383
|
-
timeout: GH_CREATE_TIMEOUT_MS,
|
|
6384
|
-
maxBuffer: GH_MAX_BUFFER,
|
|
6385
|
-
windowsHide: true,
|
|
6386
|
-
encoding: "utf8",
|
|
6387
|
-
env: gitEnv(env2)
|
|
6388
|
-
},
|
|
6389
|
-
(error, stdout) => {
|
|
6390
|
-
if (error) reject(error);
|
|
6391
|
-
else resolve6(stdout);
|
|
6392
|
-
}
|
|
6393
|
-
);
|
|
6394
|
-
});
|
|
6395
|
-
}
|
|
6396
|
-
__name(runGhPrCreate, "runGhPrCreate");
|
|
6397
|
-
async function createGitHubPullRequest(cwd, opts, env2) {
|
|
6398
|
-
const gitRoot = findGitRoot(cwd);
|
|
6399
|
-
if (!gitRoot) return { kind: "not_a_repo" };
|
|
6400
|
-
let stdout;
|
|
6401
|
-
try {
|
|
6402
|
-
stdout = await runGhPrCreate(gitRoot, opts, env2);
|
|
6403
|
-
} catch (error) {
|
|
6404
|
-
if (error.code === "ENOENT") {
|
|
6405
|
-
return { kind: "cli_unavailable" };
|
|
6406
|
-
}
|
|
6407
|
-
return {
|
|
6408
|
-
kind: "failed",
|
|
6409
|
-
message: ghErrorMessage(error, "gh pr create", GH_CREATE_TIMEOUT_MS),
|
|
6410
|
-
gitRoot
|
|
6411
|
-
};
|
|
6412
|
-
}
|
|
6413
|
-
const url = stdout.trim();
|
|
6414
|
-
const numberMatch = /\/pull\/(\d+)/.exec(url);
|
|
6415
|
-
const number = numberMatch ? parseInt(numberMatch[1], 10) : null;
|
|
6416
|
-
return { kind: "ok", url, number };
|
|
6417
|
-
}
|
|
6418
|
-
__name(createGitHubPullRequest, "createGitHubPullRequest");
|
|
6419
|
-
async function getDefaultBranch(cwd, env2) {
|
|
6420
|
-
const gitRoot = findGitRoot(cwd);
|
|
6421
|
-
if (!gitRoot) return null;
|
|
6422
|
-
try {
|
|
6423
|
-
const { stdout } = await execFileAsync2(
|
|
6424
|
-
"git",
|
|
6425
|
-
["symbolic-ref", "refs/remotes/origin/HEAD", "--short"],
|
|
6426
|
-
{
|
|
6427
|
-
cwd: gitRoot,
|
|
6428
|
-
timeout: 5e3,
|
|
6429
|
-
encoding: "utf8",
|
|
6430
|
-
windowsHide: true,
|
|
6431
|
-
env: gitEnv(env2)
|
|
6432
|
-
}
|
|
6433
|
-
);
|
|
6434
|
-
const raw = stdout.trim();
|
|
6435
|
-
if (!raw) return null;
|
|
6436
|
-
return raw;
|
|
6437
|
-
} catch {
|
|
6438
|
-
return null;
|
|
6439
|
-
}
|
|
6440
|
-
}
|
|
6441
|
-
__name(getDefaultBranch, "getDefaultBranch");
|
|
6442
|
-
|
|
6443
5675
|
// packages/core/src/utils/subagentGenerator.ts
|
|
6444
5676
|
init_esbuild_shims();
|
|
6445
5677
|
var SYSTEM_PROMPT = `You are an elite AI agent architect specializing in crafting high-performance agent configurations. Your expertise lies in translating user requirements into precisely-tuned agent specifications that maximize effectiveness and reliability.
|
|
@@ -6780,9 +6012,9 @@ function encodeInsightProgressMessage(stage, progress, detail) {
|
|
|
6780
6012
|
return JSON.stringify(payload);
|
|
6781
6013
|
}
|
|
6782
6014
|
__name(encodeInsightProgressMessage, "encodeInsightProgressMessage");
|
|
6783
|
-
function encodeInsightReadyMessage(
|
|
6015
|
+
function encodeInsightReadyMessage(path19) {
|
|
6784
6016
|
const payload = {
|
|
6785
|
-
insight_ready: { path:
|
|
6017
|
+
insight_ready: { path: path19 }
|
|
6786
6018
|
};
|
|
6787
6019
|
return JSON.stringify(payload);
|
|
6788
6020
|
}
|
|
@@ -6797,8 +6029,8 @@ __name(encodeInsightErrorMessage, "encodeInsightErrorMessage");
|
|
|
6797
6029
|
|
|
6798
6030
|
// packages/core/src/core/logger.ts
|
|
6799
6031
|
init_esbuild_shims();
|
|
6800
|
-
import
|
|
6801
|
-
import { promises as
|
|
6032
|
+
import path4 from "node:path";
|
|
6033
|
+
import { promises as fs2 } from "node:fs";
|
|
6802
6034
|
var LOG_FILE_NAME = "logs.json";
|
|
6803
6035
|
function encodeTagName(str) {
|
|
6804
6036
|
return encodeURIComponent(str);
|
|
@@ -6851,7 +6083,7 @@ var Logger = class {
|
|
|
6851
6083
|
throw new Error("Log file path not set during read attempt.");
|
|
6852
6084
|
}
|
|
6853
6085
|
try {
|
|
6854
|
-
const fileContent = await
|
|
6086
|
+
const fileContent = await fs2.readFile(this.logFilePath, "utf-8");
|
|
6855
6087
|
const parsedLogs = JSON.parse(fileContent);
|
|
6856
6088
|
if (!Array.isArray(parsedLogs)) {
|
|
6857
6089
|
this.debugLogger.debug(
|
|
@@ -6887,7 +6119,7 @@ var Logger = class {
|
|
|
6887
6119
|
if (!this.logFilePath) return;
|
|
6888
6120
|
const backupPath = `${this.logFilePath}.${reason}.${Date.now()}.bak`;
|
|
6889
6121
|
try {
|
|
6890
|
-
await
|
|
6122
|
+
await fs2.rename(this.logFilePath, backupPath);
|
|
6891
6123
|
this.debugLogger.debug(`Backed up corrupted log file to ${backupPath}`);
|
|
6892
6124
|
} catch (_backupError) {
|
|
6893
6125
|
}
|
|
@@ -6897,12 +6129,12 @@ var Logger = class {
|
|
|
6897
6129
|
return;
|
|
6898
6130
|
}
|
|
6899
6131
|
this.qwenDir = this.storage.getProjectTempDir();
|
|
6900
|
-
this.logFilePath =
|
|
6132
|
+
this.logFilePath = path4.join(this.qwenDir, LOG_FILE_NAME);
|
|
6901
6133
|
try {
|
|
6902
|
-
await
|
|
6134
|
+
await fs2.mkdir(this.qwenDir, { recursive: true });
|
|
6903
6135
|
let fileExisted = true;
|
|
6904
6136
|
try {
|
|
6905
|
-
await
|
|
6137
|
+
await fs2.access(this.logFilePath);
|
|
6906
6138
|
} catch (_e) {
|
|
6907
6139
|
fileExisted = false;
|
|
6908
6140
|
}
|
|
@@ -7126,12 +6358,12 @@ var Logger = class {
|
|
|
7126
6358
|
throw new Error("Checkpoint file path not set.");
|
|
7127
6359
|
}
|
|
7128
6360
|
const encodedTag = encodeTagName(tag);
|
|
7129
|
-
return
|
|
6361
|
+
return path4.join(this.qwenDir, `checkpoint-${encodedTag}.json`);
|
|
7130
6362
|
}
|
|
7131
6363
|
async _getCheckpointPath(tag) {
|
|
7132
6364
|
const newPath = this._checkpointPath(tag);
|
|
7133
6365
|
try {
|
|
7134
|
-
await
|
|
6366
|
+
await fs2.access(newPath);
|
|
7135
6367
|
return newPath;
|
|
7136
6368
|
} catch (error) {
|
|
7137
6369
|
const nodeError = error;
|
|
@@ -7139,9 +6371,9 @@ var Logger = class {
|
|
|
7139
6371
|
throw error;
|
|
7140
6372
|
}
|
|
7141
6373
|
}
|
|
7142
|
-
const oldPath =
|
|
6374
|
+
const oldPath = path4.join(this.qwenDir, `checkpoint-${tag}.json`);
|
|
7143
6375
|
try {
|
|
7144
|
-
await
|
|
6376
|
+
await fs2.access(oldPath);
|
|
7145
6377
|
return oldPath;
|
|
7146
6378
|
} catch (error) {
|
|
7147
6379
|
const nodeError = error;
|
|
@@ -7158,9 +6390,9 @@ var Logger = class {
|
|
|
7158
6390
|
);
|
|
7159
6391
|
return;
|
|
7160
6392
|
}
|
|
7161
|
-
const
|
|
6393
|
+
const path19 = this._checkpointPath(tag);
|
|
7162
6394
|
try {
|
|
7163
|
-
await atomicWriteFile(
|
|
6395
|
+
await atomicWriteFile(path19, JSON.stringify(conversation, null, 2), {
|
|
7164
6396
|
encoding: "utf-8"
|
|
7165
6397
|
});
|
|
7166
6398
|
} catch (error) {
|
|
@@ -7174,13 +6406,13 @@ var Logger = class {
|
|
|
7174
6406
|
);
|
|
7175
6407
|
return [];
|
|
7176
6408
|
}
|
|
7177
|
-
const
|
|
6409
|
+
const path19 = await this._getCheckpointPath(tag);
|
|
7178
6410
|
try {
|
|
7179
|
-
const fileContent = await
|
|
6411
|
+
const fileContent = await fs2.readFile(path19, "utf-8");
|
|
7180
6412
|
const parsedContent = JSON.parse(fileContent);
|
|
7181
6413
|
if (!Array.isArray(parsedContent)) {
|
|
7182
6414
|
this.debugLogger.warn(
|
|
7183
|
-
`Checkpoint file at ${
|
|
6415
|
+
`Checkpoint file at ${path19} is not a valid JSON array. Returning empty checkpoint.`
|
|
7184
6416
|
);
|
|
7185
6417
|
return [];
|
|
7186
6418
|
}
|
|
@@ -7191,7 +6423,7 @@ var Logger = class {
|
|
|
7191
6423
|
return [];
|
|
7192
6424
|
}
|
|
7193
6425
|
this.debugLogger.error(
|
|
7194
|
-
`Failed to read or parse checkpoint file ${
|
|
6426
|
+
`Failed to read or parse checkpoint file ${path19}:`,
|
|
7195
6427
|
error
|
|
7196
6428
|
);
|
|
7197
6429
|
return [];
|
|
@@ -7207,7 +6439,7 @@ var Logger = class {
|
|
|
7207
6439
|
let deletedSomething = false;
|
|
7208
6440
|
const newPath = this._checkpointPath(tag);
|
|
7209
6441
|
try {
|
|
7210
|
-
await
|
|
6442
|
+
await fs2.unlink(newPath);
|
|
7211
6443
|
deletedSomething = true;
|
|
7212
6444
|
} catch (error) {
|
|
7213
6445
|
const nodeError = error;
|
|
@@ -7219,10 +6451,10 @@ var Logger = class {
|
|
|
7219
6451
|
throw error;
|
|
7220
6452
|
}
|
|
7221
6453
|
}
|
|
7222
|
-
const oldPath =
|
|
6454
|
+
const oldPath = path4.join(this.qwenDir, `checkpoint-${tag}.json`);
|
|
7223
6455
|
if (newPath !== oldPath) {
|
|
7224
6456
|
try {
|
|
7225
|
-
await
|
|
6457
|
+
await fs2.unlink(oldPath);
|
|
7226
6458
|
deletedSomething = true;
|
|
7227
6459
|
} catch (error) {
|
|
7228
6460
|
const nodeError = error;
|
|
@@ -7246,7 +6478,7 @@ var Logger = class {
|
|
|
7246
6478
|
let filePath;
|
|
7247
6479
|
try {
|
|
7248
6480
|
filePath = await this._getCheckpointPath(tag);
|
|
7249
|
-
await
|
|
6481
|
+
await fs2.access(filePath);
|
|
7250
6482
|
return true;
|
|
7251
6483
|
} catch (error) {
|
|
7252
6484
|
const nodeError = error;
|
|
@@ -7369,7 +6601,7 @@ var ClientMcpRegistrar = class {
|
|
|
7369
6601
|
}
|
|
7370
6602
|
return Promise.resolve(ack);
|
|
7371
6603
|
}
|
|
7372
|
-
return new Promise((
|
|
6604
|
+
return new Promise((resolve5, reject) => {
|
|
7373
6605
|
const timer = setTimeout(() => {
|
|
7374
6606
|
this.pending.delete(id);
|
|
7375
6607
|
reject(
|
|
@@ -7379,7 +6611,7 @@ var ClientMcpRegistrar = class {
|
|
|
7379
6611
|
);
|
|
7380
6612
|
}, this.messageTimeoutMs);
|
|
7381
6613
|
timer.unref?.();
|
|
7382
|
-
this.pending.set(id, { resolve:
|
|
6614
|
+
this.pending.set(id, { resolve: resolve5, reject, timer, server: serverName });
|
|
7383
6615
|
let sendResult;
|
|
7384
6616
|
try {
|
|
7385
6617
|
sendResult = this.sendFrame({
|
|
@@ -7591,10 +6823,11 @@ ${body}`;
|
|
|
7591
6823
|
|
|
7592
6824
|
// packages/core/src/ipc/uds-inbox.ts
|
|
7593
6825
|
init_esbuild_shims();
|
|
6826
|
+
import { timingSafeEqual } from "node:crypto";
|
|
7594
6827
|
import * as fsSync from "node:fs";
|
|
7595
|
-
import * as
|
|
6828
|
+
import * as fs3 from "node:fs/promises";
|
|
7596
6829
|
import * as net from "node:net";
|
|
7597
|
-
import * as
|
|
6830
|
+
import * as path5 from "node:path";
|
|
7598
6831
|
var debugLogger9 = createDebugLogger("PEER_IPC");
|
|
7599
6832
|
var SOCKET_DIR_MODE = 448;
|
|
7600
6833
|
var SOCKET_MODE = 384;
|
|
@@ -7625,9 +6858,9 @@ async function startPeerInbox(options) {
|
|
|
7625
6858
|
return null;
|
|
7626
6859
|
}
|
|
7627
6860
|
try {
|
|
7628
|
-
const dir =
|
|
7629
|
-
await
|
|
7630
|
-
const dirStat = await
|
|
6861
|
+
const dir = path5.dirname(socketPath);
|
|
6862
|
+
await fs3.mkdir(dir, { recursive: true, mode: SOCKET_DIR_MODE });
|
|
6863
|
+
const dirStat = await fs3.lstat(dir);
|
|
7631
6864
|
const uid = typeof process.getuid === "function" ? process.getuid() : null;
|
|
7632
6865
|
if (!dirStat.isDirectory()) {
|
|
7633
6866
|
throw new Error(`${dir} is not a directory`);
|
|
@@ -7635,13 +6868,13 @@ async function startPeerInbox(options) {
|
|
|
7635
6868
|
if (uid !== null && dirStat.uid !== uid) {
|
|
7636
6869
|
throw new Error(`${dir} belongs to uid ${dirStat.uid}, not ${uid}`);
|
|
7637
6870
|
}
|
|
7638
|
-
await
|
|
6871
|
+
await fs3.chmod(dir, SOCKET_DIR_MODE);
|
|
7639
6872
|
} catch (error) {
|
|
7640
6873
|
debugLogger9.error(`peer inbox directory unusable: ${describe(error)}`);
|
|
7641
6874
|
return null;
|
|
7642
6875
|
}
|
|
7643
6876
|
try {
|
|
7644
|
-
await
|
|
6877
|
+
await fs3.unlink(socketPath);
|
|
7645
6878
|
} catch {
|
|
7646
6879
|
}
|
|
7647
6880
|
const connections = /* @__PURE__ */ new Set();
|
|
@@ -7653,8 +6886,28 @@ async function startPeerInbox(options) {
|
|
|
7653
6886
|
debugLogger9.debug("dropping an idle peer connection");
|
|
7654
6887
|
socket.destroy();
|
|
7655
6888
|
});
|
|
6889
|
+
let authed = options.requiredToken === void 0;
|
|
6890
|
+
let auth;
|
|
6891
|
+
let refused = false;
|
|
7656
6892
|
const read2 = createLineReader(
|
|
7657
6893
|
(line) => {
|
|
6894
|
+
if (refused) return;
|
|
6895
|
+
if (!authed) {
|
|
6896
|
+
const presented = parsePeerAuthLine(line);
|
|
6897
|
+
if (presented !== null) {
|
|
6898
|
+
auth = authKindOf(options, presented);
|
|
6899
|
+
}
|
|
6900
|
+
if (auth !== void 0) {
|
|
6901
|
+
authed = true;
|
|
6902
|
+
return;
|
|
6903
|
+
}
|
|
6904
|
+
debugLogger9.debug(
|
|
6905
|
+
"dropping a connection whose first line did not authenticate: no valid auth line, or token mismatch"
|
|
6906
|
+
);
|
|
6907
|
+
refused = true;
|
|
6908
|
+
socket.destroy();
|
|
6909
|
+
return;
|
|
6910
|
+
}
|
|
7658
6911
|
const frame = parsePeerFrame(line);
|
|
7659
6912
|
if (frame === null) {
|
|
7660
6913
|
debugLogger9.debug(
|
|
@@ -7663,7 +6916,7 @@ async function startPeerInbox(options) {
|
|
|
7663
6916
|
return;
|
|
7664
6917
|
}
|
|
7665
6918
|
try {
|
|
7666
|
-
options.onFrame(frame);
|
|
6919
|
+
options.onFrame(frame, auth);
|
|
7667
6920
|
} catch (error) {
|
|
7668
6921
|
debugLogger9.error(`onFrame threw: ${describe(error)}`);
|
|
7669
6922
|
}
|
|
@@ -7691,11 +6944,11 @@ async function startPeerInbox(options) {
|
|
|
7691
6944
|
debugLogger9.error(`peer inbox server error: ${describe(error)}`);
|
|
7692
6945
|
});
|
|
7693
6946
|
try {
|
|
7694
|
-
await new Promise((
|
|
6947
|
+
await new Promise((resolve5, reject) => {
|
|
7695
6948
|
server.once("error", reject);
|
|
7696
6949
|
server.listen(socketPath, () => {
|
|
7697
6950
|
server.removeListener("error", reject);
|
|
7698
|
-
|
|
6951
|
+
resolve5();
|
|
7699
6952
|
});
|
|
7700
6953
|
});
|
|
7701
6954
|
} catch (error) {
|
|
@@ -7712,7 +6965,7 @@ async function startPeerInbox(options) {
|
|
|
7712
6965
|
return null;
|
|
7713
6966
|
}
|
|
7714
6967
|
try {
|
|
7715
|
-
await
|
|
6968
|
+
await fs3.chmod(socketPath, SOCKET_MODE);
|
|
7716
6969
|
} catch (error) {
|
|
7717
6970
|
debugLogger9.error(
|
|
7718
6971
|
`peer inbox socket could not be restricted to 0600, refusing to listen: ${describe(error)}`
|
|
@@ -7734,9 +6987,9 @@ async function startPeerInbox(options) {
|
|
|
7734
6987
|
closed = true;
|
|
7735
6988
|
for (const socket of connections) socket.destroy();
|
|
7736
6989
|
connections.clear();
|
|
7737
|
-
await new Promise((
|
|
6990
|
+
await new Promise((resolve5) => server.close(() => resolve5()));
|
|
7738
6991
|
try {
|
|
7739
|
-
await
|
|
6992
|
+
await fs3.unlink(socketPath);
|
|
7740
6993
|
} catch {
|
|
7741
6994
|
}
|
|
7742
6995
|
debugLogger9.debug(`peer inbox closed: ${socketPath}`);
|
|
@@ -7744,6 +6997,20 @@ async function startPeerInbox(options) {
|
|
|
7744
6997
|
};
|
|
7745
6998
|
}
|
|
7746
6999
|
__name(startPeerInbox, "startPeerInbox");
|
|
7000
|
+
function tokenMatches(expected, presented) {
|
|
7001
|
+
const a = Buffer.from(expected);
|
|
7002
|
+
const b = Buffer.from(presented);
|
|
7003
|
+
return a.length === b.length && timingSafeEqual(a, b);
|
|
7004
|
+
}
|
|
7005
|
+
__name(tokenMatches, "tokenMatches");
|
|
7006
|
+
function authKindOf(options, presented) {
|
|
7007
|
+
const peer = options.requiredToken !== void 0 && tokenMatches(options.requiredToken, presented);
|
|
7008
|
+
const child = options.childToken !== void 0 && tokenMatches(options.childToken, presented);
|
|
7009
|
+
if (peer) return "peer";
|
|
7010
|
+
if (child) return "child";
|
|
7011
|
+
return void 0;
|
|
7012
|
+
}
|
|
7013
|
+
__name(authKindOf, "authKindOf");
|
|
7747
7014
|
function describe(error) {
|
|
7748
7015
|
return error instanceof Error ? `${error.name}: ${error.message}` : String(error);
|
|
7749
7016
|
}
|
|
@@ -8359,8 +7626,8 @@ __name(serializeChannelMemoryDocument, "serializeChannelMemoryDocument");
|
|
|
8359
7626
|
init_esbuild_shims();
|
|
8360
7627
|
var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
8361
7628
|
import { createHash as createHash4, randomBytes } from "node:crypto";
|
|
8362
|
-
import * as
|
|
8363
|
-
import * as
|
|
7629
|
+
import * as fs4 from "node:fs/promises";
|
|
7630
|
+
import * as path6 from "node:path";
|
|
8364
7631
|
var CHANNEL_MEMORY_FILE_NAME = "CHANNEL.json";
|
|
8365
7632
|
var LEGACY_CHANNEL_MEMORY_FILE_NAME = "CHANNEL.md";
|
|
8366
7633
|
var MAX_CHANNEL_MEMORY_BYTES = 1024 * 1024;
|
|
@@ -8400,11 +7667,11 @@ async function releaseLock(release) {
|
|
|
8400
7667
|
__name(releaseLock, "releaseLock");
|
|
8401
7668
|
async function cleanupLegacyAfterCommit(legacyPath, expectedBytes) {
|
|
8402
7669
|
try {
|
|
8403
|
-
const currentBytes = await
|
|
7670
|
+
const currentBytes = await fs4.readFile(legacyPath);
|
|
8404
7671
|
if (legacyHash(currentBytes) !== legacyHash(expectedBytes) || !currentBytes.equals(expectedBytes)) {
|
|
8405
7672
|
return;
|
|
8406
7673
|
}
|
|
8407
|
-
await
|
|
7674
|
+
await fs4.unlink(legacyPath);
|
|
8408
7675
|
} catch {
|
|
8409
7676
|
}
|
|
8410
7677
|
}
|
|
@@ -8420,7 +7687,7 @@ function hashedThreadPath(target) {
|
|
|
8420
7687
|
}
|
|
8421
7688
|
__name(hashedThreadPath, "hashedThreadPath");
|
|
8422
7689
|
function getChannelMemoryDirectory(target) {
|
|
8423
|
-
return
|
|
7690
|
+
return path6.join(
|
|
8424
7691
|
Storage.getGlobalQwenDir(),
|
|
8425
7692
|
"channels",
|
|
8426
7693
|
"memory",
|
|
@@ -8430,11 +7697,11 @@ function getChannelMemoryDirectory(target) {
|
|
|
8430
7697
|
}
|
|
8431
7698
|
__name(getChannelMemoryDirectory, "getChannelMemoryDirectory");
|
|
8432
7699
|
function getChannelMemoryFilePath(target) {
|
|
8433
|
-
return
|
|
7700
|
+
return path6.join(getChannelMemoryDirectory(target), CHANNEL_MEMORY_FILE_NAME);
|
|
8434
7701
|
}
|
|
8435
7702
|
__name(getChannelMemoryFilePath, "getChannelMemoryFilePath");
|
|
8436
7703
|
function getLegacyChannelMemoryFilePath(target) {
|
|
8437
|
-
return
|
|
7704
|
+
return path6.join(
|
|
8438
7705
|
getChannelMemoryDirectory(target),
|
|
8439
7706
|
LEGACY_CHANNEL_MEMORY_FILE_NAME
|
|
8440
7707
|
);
|
|
@@ -8444,8 +7711,8 @@ async function serializeMutation(directory, task) {
|
|
|
8444
7711
|
const previous = pendingMutations.get(directory) ?? Promise.resolve();
|
|
8445
7712
|
let resolveCurrent = /* @__PURE__ */ __name(() => {
|
|
8446
7713
|
}, "resolveCurrent");
|
|
8447
|
-
const current = new Promise((
|
|
8448
|
-
resolveCurrent =
|
|
7714
|
+
const current = new Promise((resolve5) => {
|
|
7715
|
+
resolveCurrent = resolve5;
|
|
8449
7716
|
});
|
|
8450
7717
|
const queued = previous.then(
|
|
8451
7718
|
() => current,
|
|
@@ -8466,7 +7733,7 @@ async function serializeMutation(directory, task) {
|
|
|
8466
7733
|
__name(serializeMutation, "serializeMutation");
|
|
8467
7734
|
async function readFileIfExists(filePath) {
|
|
8468
7735
|
try {
|
|
8469
|
-
return await
|
|
7736
|
+
return await fs4.readFile(filePath);
|
|
8470
7737
|
} catch (error) {
|
|
8471
7738
|
if (isMissingFile(error)) {
|
|
8472
7739
|
return void 0;
|
|
@@ -8532,18 +7799,18 @@ async function writeChannelMemory(filePath, serialized) {
|
|
|
8532
7799
|
const tempPath = `${filePath}.${process.pid}.${randomBytes(6).toString("hex")}.tmp`;
|
|
8533
7800
|
let committed = false;
|
|
8534
7801
|
try {
|
|
8535
|
-
const handle = await
|
|
7802
|
+
const handle = await fs4.open(tempPath, "wx", 384);
|
|
8536
7803
|
try {
|
|
8537
7804
|
await handle.writeFile(serialized, "utf8");
|
|
8538
7805
|
await handle.sync();
|
|
8539
7806
|
} finally {
|
|
8540
7807
|
await handle.close();
|
|
8541
7808
|
}
|
|
8542
|
-
await
|
|
7809
|
+
await fs4.rename(tempPath, filePath);
|
|
8543
7810
|
committed = true;
|
|
8544
7811
|
} finally {
|
|
8545
7812
|
if (!committed) {
|
|
8546
|
-
await
|
|
7813
|
+
await fs4.unlink(tempPath).catch((error) => {
|
|
8547
7814
|
if (!isMissingFile(error)) {
|
|
8548
7815
|
throw error;
|
|
8549
7816
|
}
|
|
@@ -8554,12 +7821,12 @@ async function writeChannelMemory(filePath, serialized) {
|
|
|
8554
7821
|
__name(writeChannelMemory, "writeChannelMemory");
|
|
8555
7822
|
async function mutateChannelMemory(target, apply) {
|
|
8556
7823
|
const filePath = getChannelMemoryFilePath(target);
|
|
8557
|
-
const directory =
|
|
7824
|
+
const directory = path6.dirname(filePath);
|
|
8558
7825
|
const legacyPath = getLegacyChannelMemoryFilePath(target);
|
|
8559
7826
|
return serializeMutation(directory, async () => {
|
|
8560
|
-
await
|
|
8561
|
-
const lockPath =
|
|
8562
|
-
const lockHandle = await
|
|
7827
|
+
await fs4.mkdir(directory, { recursive: true });
|
|
7828
|
+
const lockPath = path6.join(directory, ".channel-memory.lock");
|
|
7829
|
+
const lockHandle = await fs4.open(lockPath, "a", 384);
|
|
8563
7830
|
await lockHandle.close();
|
|
8564
7831
|
const release = await import_proper_lockfile.default.lock(lockPath, LOCK_OPTIONS);
|
|
8565
7832
|
let releaseLegacy;
|
|
@@ -8598,7 +7865,7 @@ async function listChannelMemoryEntries(target) {
|
|
|
8598
7865
|
__name(listChannelMemoryEntries, "listChannelMemoryEntries");
|
|
8599
7866
|
async function getFileRevision(filePath) {
|
|
8600
7867
|
try {
|
|
8601
|
-
const stats = await
|
|
7868
|
+
const stats = await fs4.stat(filePath, { bigint: true });
|
|
8602
7869
|
return [
|
|
8603
7870
|
stats.dev,
|
|
8604
7871
|
stats.ino,
|
|
@@ -8938,8 +8205,8 @@ __name(buildLearnVideoSkillRequest, "buildLearnVideoSkillRequest");
|
|
|
8938
8205
|
|
|
8939
8206
|
// packages/core/src/memory/writeContextFile.ts
|
|
8940
8207
|
init_esbuild_shims();
|
|
8941
|
-
import { promises as
|
|
8942
|
-
import * as
|
|
8208
|
+
import { promises as fs5 } from "node:fs";
|
|
8209
|
+
import * as path7 from "node:path";
|
|
8943
8210
|
var fileLocks = /* @__PURE__ */ new Map();
|
|
8944
8211
|
var FILE_LOCK_TIMEOUT_MS = 3e4;
|
|
8945
8212
|
function getFileLock(filePath) {
|
|
@@ -8967,7 +8234,7 @@ var WorkspaceMemoryWriteTimeoutError = class extends Error {
|
|
|
8967
8234
|
}
|
|
8968
8235
|
};
|
|
8969
8236
|
async function writeWorkspaceContextFile(options) {
|
|
8970
|
-
if (!
|
|
8237
|
+
if (!path7.isAbsolute(options.projectRoot)) {
|
|
8971
8238
|
throw new Error(
|
|
8972
8239
|
`writeWorkspaceContextFile: projectRoot must be absolute, got "${options.projectRoot}"`
|
|
8973
8240
|
);
|
|
@@ -8993,10 +8260,10 @@ async function runWrite(filePath, options) {
|
|
|
8993
8260
|
return { filePath, bytesWritten: 0, changed: false };
|
|
8994
8261
|
}
|
|
8995
8262
|
options.assertCanCommit?.();
|
|
8996
|
-
await
|
|
8263
|
+
await fs5.mkdir(path7.dirname(filePath), { recursive: true });
|
|
8997
8264
|
if (options.mode === "replace") {
|
|
8998
8265
|
options.assertCanCommit?.();
|
|
8999
|
-
await
|
|
8266
|
+
await fs5.writeFile(filePath, options.content, {
|
|
9000
8267
|
encoding: "utf8",
|
|
9001
8268
|
mode: 420
|
|
9002
8269
|
});
|
|
@@ -9008,7 +8275,7 @@ async function runWrite(filePath, options) {
|
|
|
9008
8275
|
}
|
|
9009
8276
|
const next = await composeAppendedContent(filePath, options.content);
|
|
9010
8277
|
options.assertCanCommit?.();
|
|
9011
|
-
await
|
|
8278
|
+
await fs5.writeFile(filePath, next, { encoding: "utf8", mode: 420 });
|
|
9012
8279
|
return {
|
|
9013
8280
|
filePath,
|
|
9014
8281
|
bytesWritten: Buffer.byteLength(next, "utf8"),
|
|
@@ -9019,9 +8286,9 @@ __name(runWrite, "runWrite");
|
|
|
9019
8286
|
function resolveContextFilePath(scope, projectRoot) {
|
|
9020
8287
|
const filename = getCurrentMemoryFilename();
|
|
9021
8288
|
if (scope === "workspace") {
|
|
9022
|
-
return
|
|
8289
|
+
return path7.join(projectRoot, filename);
|
|
9023
8290
|
}
|
|
9024
|
-
return
|
|
8291
|
+
return path7.join(Storage.getGlobalQwenDir(), filename);
|
|
9025
8292
|
}
|
|
9026
8293
|
__name(resolveContextFilePath, "resolveContextFilePath");
|
|
9027
8294
|
var MAX_EXISTING_FILE_BYTES = 16 * 1024 * 1024;
|
|
@@ -9045,15 +8312,15 @@ var WorkspaceMemoryFileTooLargeError = class extends Error {
|
|
|
9045
8312
|
async function composeAppendedContent(filePath, newContent) {
|
|
9046
8313
|
let existing = "";
|
|
9047
8314
|
try {
|
|
9048
|
-
const
|
|
9049
|
-
if (
|
|
8315
|
+
const stat4 = await fs5.stat(filePath);
|
|
8316
|
+
if (stat4.size > MAX_EXISTING_FILE_BYTES) {
|
|
9050
8317
|
throw new WorkspaceMemoryFileTooLargeError(
|
|
9051
8318
|
filePath,
|
|
9052
|
-
|
|
8319
|
+
stat4.size,
|
|
9053
8320
|
MAX_EXISTING_FILE_BYTES
|
|
9054
8321
|
);
|
|
9055
8322
|
}
|
|
9056
|
-
existing = await
|
|
8323
|
+
existing = await fs5.readFile(filePath, "utf8");
|
|
9057
8324
|
} catch (err) {
|
|
9058
8325
|
if (err instanceof WorkspaceMemoryFileTooLargeError) throw err;
|
|
9059
8326
|
if (!isEnoent(err)) throw err;
|
|
@@ -9132,8 +8399,8 @@ __name(trimNewlines, "trimNewlines");
|
|
|
9132
8399
|
init_esbuild_shims();
|
|
9133
8400
|
import * as child_process from "node:child_process";
|
|
9134
8401
|
import * as process2 from "node:process";
|
|
9135
|
-
import * as
|
|
9136
|
-
import * as
|
|
8402
|
+
import * as path8 from "node:path";
|
|
8403
|
+
import * as fs6 from "node:fs";
|
|
9137
8404
|
import * as os from "node:os";
|
|
9138
8405
|
function getVsCodeCommand(platform2 = process2.platform) {
|
|
9139
8406
|
return platform2 === "win32" ? "code.cmd" : "code";
|
|
@@ -9161,23 +8428,23 @@ async function findVsCodeCommand(platform2 = process2.platform) {
|
|
|
9161
8428
|
if (platform2 === "darwin") {
|
|
9162
8429
|
locations.push(
|
|
9163
8430
|
"/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code",
|
|
9164
|
-
|
|
8431
|
+
path8.join(homeDir, "Library/Application Support/Code/bin/code")
|
|
9165
8432
|
);
|
|
9166
8433
|
} else if (platform2 === "linux") {
|
|
9167
8434
|
locations.push(
|
|
9168
8435
|
"/usr/share/code/bin/code",
|
|
9169
8436
|
"/snap/bin/code",
|
|
9170
|
-
|
|
8437
|
+
path8.join(homeDir, ".local/share/code/bin/code")
|
|
9171
8438
|
);
|
|
9172
8439
|
} else if (platform2 === "win32") {
|
|
9173
8440
|
locations.push(
|
|
9174
|
-
|
|
8441
|
+
path8.join(
|
|
9175
8442
|
process2.env["ProgramFiles"] || "C:\\Program Files",
|
|
9176
8443
|
"Microsoft VS Code",
|
|
9177
8444
|
"bin",
|
|
9178
8445
|
"code.cmd"
|
|
9179
8446
|
),
|
|
9180
|
-
|
|
8447
|
+
path8.join(
|
|
9181
8448
|
homeDir,
|
|
9182
8449
|
"AppData",
|
|
9183
8450
|
"Local",
|
|
@@ -9189,7 +8456,7 @@ async function findVsCodeCommand(platform2 = process2.platform) {
|
|
|
9189
8456
|
);
|
|
9190
8457
|
}
|
|
9191
8458
|
for (const location of locations) {
|
|
9192
|
-
if (
|
|
8459
|
+
if (fs6.existsSync(location)) {
|
|
9193
8460
|
return location;
|
|
9194
8461
|
}
|
|
9195
8462
|
}
|
|
@@ -9356,8 +8623,8 @@ __name(lspServerConfigHash, "lspServerConfigHash");
|
|
|
9356
8623
|
|
|
9357
8624
|
// packages/core/src/lsp/LspConfigLoader.ts
|
|
9358
8625
|
init_esbuild_shims();
|
|
9359
|
-
import * as
|
|
9360
|
-
import * as
|
|
8626
|
+
import * as fs7 from "node:fs";
|
|
8627
|
+
import * as path9 from "path";
|
|
9361
8628
|
import { pathToFileURL } from "url";
|
|
9362
8629
|
var debugLogger13 = createDebugLogger("LSP");
|
|
9363
8630
|
var MAX_TCP_PORT = 65535;
|
|
@@ -9373,12 +8640,12 @@ var LspConfigLoader = class {
|
|
|
9373
8640
|
* Supports basic format: { "language": { "command": "...", "extensionToLanguage": {...} } }
|
|
9374
8641
|
*/
|
|
9375
8642
|
async loadUserConfigs() {
|
|
9376
|
-
const lspConfigPath =
|
|
9377
|
-
if (!
|
|
8643
|
+
const lspConfigPath = path9.join(this.workspaceRoot, ".lsp.json");
|
|
8644
|
+
if (!fs7.existsSync(lspConfigPath)) {
|
|
9378
8645
|
return [];
|
|
9379
8646
|
}
|
|
9380
8647
|
try {
|
|
9381
|
-
const configContent =
|
|
8648
|
+
const configContent = fs7.readFileSync(lspConfigPath, "utf-8");
|
|
9382
8649
|
const data = JSON.parse(configContent);
|
|
9383
8650
|
return this.parseConfigSource(data, lspConfigPath, {
|
|
9384
8651
|
forceTrustRequired: true
|
|
@@ -9389,9 +8656,9 @@ var LspConfigLoader = class {
|
|
|
9389
8656
|
}
|
|
9390
8657
|
}
|
|
9391
8658
|
async loadUserConfigsStrict() {
|
|
9392
|
-
const lspConfigPath =
|
|
8659
|
+
const lspConfigPath = path9.join(this.workspaceRoot, ".lsp.json");
|
|
9393
8660
|
try {
|
|
9394
|
-
const configContent =
|
|
8661
|
+
const configContent = fs7.readFileSync(lspConfigPath, "utf-8");
|
|
9395
8662
|
const data = JSON.parse(configContent);
|
|
9396
8663
|
return this.parseUserConfigSourceStrict(data, lspConfigPath);
|
|
9397
8664
|
} catch (error) {
|
|
@@ -9420,14 +8687,14 @@ var LspConfigLoader = class {
|
|
|
9420
8687
|
extension.path,
|
|
9421
8688
|
lspServers
|
|
9422
8689
|
);
|
|
9423
|
-
if (!
|
|
8690
|
+
if (!fs7.existsSync(configPath)) {
|
|
9424
8691
|
debugLogger13.warn(
|
|
9425
8692
|
`LSP config not found for ${originBase}: ${configPath}`
|
|
9426
8693
|
);
|
|
9427
8694
|
continue;
|
|
9428
8695
|
}
|
|
9429
8696
|
try {
|
|
9430
|
-
const configContent =
|
|
8697
|
+
const configContent = fs7.readFileSync(configPath, "utf-8");
|
|
9431
8698
|
const data = JSON.parse(configContent);
|
|
9432
8699
|
const hydrated = this.hydrateExtensionLspConfig(data, extension.path);
|
|
9433
8700
|
configs.push(
|
|
@@ -9557,15 +8824,15 @@ var LspConfigLoader = class {
|
|
|
9557
8824
|
return { ok: true, configs };
|
|
9558
8825
|
}
|
|
9559
8826
|
resolveExtensionConfigPath(extensionPath, configPath) {
|
|
9560
|
-
return
|
|
8827
|
+
return path9.isAbsolute(configPath) ? path9.resolve(configPath) : path9.resolve(extensionPath, configPath);
|
|
9561
8828
|
}
|
|
9562
8829
|
hydrateExtensionLspConfig(source, extensionPath) {
|
|
9563
8830
|
return recursivelyHydrateStrings(source, {
|
|
9564
8831
|
extensionPath,
|
|
9565
8832
|
CLAUDE_PLUGIN_ROOT: extensionPath,
|
|
9566
8833
|
workspacePath: this.workspaceRoot,
|
|
9567
|
-
"/":
|
|
9568
|
-
pathSeparator:
|
|
8834
|
+
"/": path9.sep,
|
|
8835
|
+
pathSeparator: path9.sep
|
|
9569
8836
|
});
|
|
9570
8837
|
}
|
|
9571
8838
|
buildServerConfig(name, languages, spec, origin, options = {}) {
|
|
@@ -9732,9 +8999,9 @@ var LspConfigLoader = class {
|
|
|
9732
8999
|
if (typeof value !== "string" || value.trim() === "") {
|
|
9733
9000
|
return this.workspaceRoot;
|
|
9734
9001
|
}
|
|
9735
|
-
const resolved =
|
|
9736
|
-
const root =
|
|
9737
|
-
if (resolved === root || resolved.startsWith(root +
|
|
9002
|
+
const resolved = path9.isAbsolute(value) ? path9.resolve(value) : path9.resolve(this.workspaceRoot, value);
|
|
9003
|
+
const root = path9.resolve(this.workspaceRoot);
|
|
9004
|
+
if (resolved === root || resolved.startsWith(root + path9.sep)) {
|
|
9738
9005
|
return resolved;
|
|
9739
9006
|
}
|
|
9740
9007
|
debugLogger13.warn(
|
|
@@ -9828,12 +9095,12 @@ var JsonRpcConnection = class {
|
|
|
9828
9095
|
method,
|
|
9829
9096
|
params
|
|
9830
9097
|
};
|
|
9831
|
-
const requestPromise = new Promise((
|
|
9098
|
+
const requestPromise = new Promise((resolve5, reject) => {
|
|
9832
9099
|
const timer = setTimeout(() => {
|
|
9833
9100
|
this.pendingRequests.delete(id);
|
|
9834
9101
|
reject(new Error(`LSP request timeout: ${method}`));
|
|
9835
9102
|
}, DEFAULT_LSP_REQUEST_TIMEOUT_MS);
|
|
9836
|
-
this.pendingRequests.set(id, { resolve:
|
|
9103
|
+
this.pendingRequests.set(id, { resolve: resolve5, reject, timer });
|
|
9837
9104
|
});
|
|
9838
9105
|
this.writeMessage(payload);
|
|
9839
9106
|
return requestPromise;
|
|
@@ -9961,7 +9228,7 @@ var LspConnectionFactory = class _LspConnectionFactory {
|
|
|
9961
9228
|
* 创建基于 stdio 的 LSP 连接
|
|
9962
9229
|
*/
|
|
9963
9230
|
static async createStdioConnection(command, args, options, timeoutMs = 1e4) {
|
|
9964
|
-
return new Promise((
|
|
9231
|
+
return new Promise((resolve5, reject) => {
|
|
9965
9232
|
const spawnOptions = {
|
|
9966
9233
|
stdio: "pipe",
|
|
9967
9234
|
...options
|
|
@@ -10020,7 +9287,7 @@ var LspConnectionFactory = class _LspConnectionFactory {
|
|
|
10020
9287
|
recordProcessExit(code, signal);
|
|
10021
9288
|
connection.end();
|
|
10022
9289
|
});
|
|
10023
|
-
|
|
9290
|
+
resolve5({
|
|
10024
9291
|
connection,
|
|
10025
9292
|
process: processInstance,
|
|
10026
9293
|
processDiagnostics
|
|
@@ -10041,7 +9308,7 @@ var LspConnectionFactory = class _LspConnectionFactory {
|
|
|
10041
9308
|
* 创建基于 socket 的 LSP 连接(支持 TCP 或 unix socket)
|
|
10042
9309
|
*/
|
|
10043
9310
|
static async createSocketConnection(options, timeoutMs = 1e4) {
|
|
10044
|
-
return new Promise((
|
|
9311
|
+
return new Promise((resolve5, reject) => {
|
|
10045
9312
|
let socketOptions;
|
|
10046
9313
|
if (options.path) {
|
|
10047
9314
|
socketOptions = { path: options.path };
|
|
@@ -10075,7 +9342,7 @@ var LspConnectionFactory = class _LspConnectionFactory {
|
|
|
10075
9342
|
connection.listen(socket);
|
|
10076
9343
|
socket.once("close", () => connection.end());
|
|
10077
9344
|
socket.once("error", () => connection.end());
|
|
10078
|
-
|
|
9345
|
+
resolve5({
|
|
10079
9346
|
connection,
|
|
10080
9347
|
socket
|
|
10081
9348
|
});
|
|
@@ -10765,8 +10032,8 @@ ${value}
|
|
|
10765
10032
|
// packages/core/src/lsp/LspServerManager.ts
|
|
10766
10033
|
init_esbuild_shims();
|
|
10767
10034
|
import { spawn as spawn2 } from "node:child_process";
|
|
10768
|
-
import * as
|
|
10769
|
-
import * as
|
|
10035
|
+
import * as fs8 from "node:fs";
|
|
10036
|
+
import * as path10 from "path";
|
|
10770
10037
|
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
10771
10038
|
var debugLogger15 = createDebugLogger("LSP");
|
|
10772
10039
|
var SECURITY_SENSITIVE_ENV_KEYS = /* @__PURE__ */ new Set([
|
|
@@ -10982,7 +10249,7 @@ var LspServerManager = class {
|
|
|
10982
10249
|
const uri = pathToFileURL2(tsFile).toString();
|
|
10983
10250
|
const languageId = tsFile.endsWith(".tsx") ? "typescriptreact" : tsFile.endsWith(".jsx") ? "javascriptreact" : tsFile.endsWith(".js") ? "javascript" : "typescript";
|
|
10984
10251
|
try {
|
|
10985
|
-
const text =
|
|
10252
|
+
const text = fs8.readFileSync(tsFile, "utf-8");
|
|
10986
10253
|
handle.connection.send({
|
|
10987
10254
|
jsonrpc: "2.0",
|
|
10988
10255
|
method: "textDocument/didOpen",
|
|
@@ -10996,7 +10263,7 @@ var LspServerManager = class {
|
|
|
10996
10263
|
}
|
|
10997
10264
|
});
|
|
10998
10265
|
await new Promise(
|
|
10999
|
-
(
|
|
10266
|
+
(resolve5) => setTimeout(resolve5, DEFAULT_LSP_WARMUP_DELAY_MS)
|
|
11000
10267
|
);
|
|
11001
10268
|
handle.warmedUp = true;
|
|
11002
10269
|
return uri;
|
|
@@ -11215,8 +10482,8 @@ var LspServerManager = class {
|
|
|
11215
10482
|
try {
|
|
11216
10483
|
await Promise.race([
|
|
11217
10484
|
shutdownPromise,
|
|
11218
|
-
new Promise((
|
|
11219
|
-
timerId = setTimeout(
|
|
10485
|
+
new Promise((resolve5) => {
|
|
10486
|
+
timerId = setTimeout(resolve5, timeout);
|
|
11220
10487
|
if (typeof timerId === "object" && timerId !== null && "unref" in timerId) {
|
|
11221
10488
|
timerId.unref();
|
|
11222
10489
|
}
|
|
@@ -11419,11 +10686,11 @@ var LspServerManager = class {
|
|
|
11419
10686
|
}
|
|
11420
10687
|
async delayWithAbort(delayMs, signal) {
|
|
11421
10688
|
if (!signal) {
|
|
11422
|
-
await new Promise((
|
|
10689
|
+
await new Promise((resolve5) => setTimeout(resolve5, delayMs));
|
|
11423
10690
|
return;
|
|
11424
10691
|
}
|
|
11425
10692
|
this.throwIfStartupAborted(signal);
|
|
11426
|
-
await new Promise((
|
|
10693
|
+
await new Promise((resolve5, reject) => {
|
|
11427
10694
|
const onAbort = /* @__PURE__ */ __name(() => {
|
|
11428
10695
|
clearTimeout(timerId);
|
|
11429
10696
|
signal.removeEventListener("abort", onAbort);
|
|
@@ -11431,7 +10698,7 @@ var LspServerManager = class {
|
|
|
11431
10698
|
}, "onAbort");
|
|
11432
10699
|
const timerId = setTimeout(() => {
|
|
11433
10700
|
signal.removeEventListener("abort", onAbort);
|
|
11434
|
-
|
|
10701
|
+
resolve5();
|
|
11435
10702
|
}, delayMs);
|
|
11436
10703
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
11437
10704
|
});
|
|
@@ -11600,7 +10867,7 @@ var LspServerManager = class {
|
|
|
11600
10867
|
*/
|
|
11601
10868
|
async waitForSocketProcessSpawn(process3, signal) {
|
|
11602
10869
|
this.throwIfStartupAborted(signal);
|
|
11603
|
-
await new Promise((
|
|
10870
|
+
await new Promise((resolve5, reject) => {
|
|
11604
10871
|
let settled = false;
|
|
11605
10872
|
const cleanup = /* @__PURE__ */ __name(() => {
|
|
11606
10873
|
process3.off("spawn", onSpawn);
|
|
@@ -11615,7 +10882,7 @@ var LspServerManager = class {
|
|
|
11615
10882
|
cleanup();
|
|
11616
10883
|
complete();
|
|
11617
10884
|
}, "settle");
|
|
11618
|
-
const onSpawn = /* @__PURE__ */ __name(() => settle(
|
|
10885
|
+
const onSpawn = /* @__PURE__ */ __name(() => settle(resolve5), "onSpawn");
|
|
11619
10886
|
const onError = /* @__PURE__ */ __name((error) => settle(
|
|
11620
10887
|
() => reject(new Error(`Failed to spawn LSP server: ${error.message}`))
|
|
11621
10888
|
), "onError");
|
|
@@ -11669,7 +10936,7 @@ var LspServerManager = class {
|
|
|
11669
10936
|
async initializeLspServer(connection, config) {
|
|
11670
10937
|
const workspaceFolderPath = config.workspaceFolder ?? this.workspaceRoot;
|
|
11671
10938
|
const workspaceFolder = {
|
|
11672
|
-
name:
|
|
10939
|
+
name: path10.basename(workspaceFolderPath) || workspaceFolderPath,
|
|
11673
10940
|
uri: config.rootUri
|
|
11674
10941
|
};
|
|
11675
10942
|
const initializeParams = {
|
|
@@ -11731,7 +10998,7 @@ var LspServerManager = class {
|
|
|
11731
10998
|
* @returns true if the command can be spawned, false if not found
|
|
11732
10999
|
*/
|
|
11733
11000
|
async commandExists(command, env2, cwd) {
|
|
11734
|
-
return new Promise((
|
|
11001
|
+
return new Promise((resolve5) => {
|
|
11735
11002
|
let settled = false;
|
|
11736
11003
|
const settle = /* @__PURE__ */ __name((value) => {
|
|
11737
11004
|
if (settled) {
|
|
@@ -11739,7 +11006,7 @@ var LspServerManager = class {
|
|
|
11739
11006
|
}
|
|
11740
11007
|
settled = true;
|
|
11741
11008
|
clearTimeout(timerId);
|
|
11742
|
-
|
|
11009
|
+
resolve5(value);
|
|
11743
11010
|
}, "settle");
|
|
11744
11011
|
const child = spawn2(command, ["--version"], {
|
|
11745
11012
|
stdio: ["ignore", "ignore", "ignore"],
|
|
@@ -11774,16 +11041,16 @@ var LspServerManager = class {
|
|
|
11774
11041
|
* - Relative paths that escape the workspace (e.g. "../../bin/evil")
|
|
11775
11042
|
*/
|
|
11776
11043
|
isPathSafe(command, workspacePath, cwd) {
|
|
11777
|
-
if (!command.includes(
|
|
11044
|
+
if (!command.includes(path10.sep) && !command.includes("/")) {
|
|
11778
11045
|
return true;
|
|
11779
11046
|
}
|
|
11780
|
-
if (
|
|
11047
|
+
if (path10.isAbsolute(command)) {
|
|
11781
11048
|
return true;
|
|
11782
11049
|
}
|
|
11783
|
-
const resolvedWorkspacePath =
|
|
11784
|
-
const basePath = cwd ?
|
|
11785
|
-
const resolvedPath =
|
|
11786
|
-
return resolvedPath.startsWith(resolvedWorkspacePath +
|
|
11050
|
+
const resolvedWorkspacePath = path10.resolve(workspacePath);
|
|
11051
|
+
const basePath = cwd ? path10.resolve(cwd) : resolvedWorkspacePath;
|
|
11052
|
+
const resolvedPath = path10.resolve(basePath, command);
|
|
11053
|
+
return resolvedPath.startsWith(resolvedWorkspacePath + path10.sep) || resolvedPath === resolvedWorkspacePath;
|
|
11787
11054
|
}
|
|
11788
11055
|
/**
|
|
11789
11056
|
* Check whether the workspace trust level allows starting an LSP server.
|
|
@@ -12043,9 +11310,9 @@ var NativeLspClient = class {
|
|
|
12043
11310
|
|
|
12044
11311
|
// packages/core/src/lsp/NativeLspService.ts
|
|
12045
11312
|
init_esbuild_shims();
|
|
12046
|
-
import * as
|
|
11313
|
+
import * as path11 from "path";
|
|
12047
11314
|
import { fileURLToPath, pathToFileURL as pathToFileURL3 } from "url";
|
|
12048
|
-
import * as
|
|
11315
|
+
import * as fs9 from "node:fs";
|
|
12049
11316
|
import { promises as fsp } from "node:fs";
|
|
12050
11317
|
var debugLogger16 = createDebugLogger("LSP");
|
|
12051
11318
|
var LANGUAGE_ID_TO_EXTENSIONS = {
|
|
@@ -12418,7 +11685,7 @@ var NativeLspService = class {
|
|
|
12418
11685
|
}
|
|
12419
11686
|
let text;
|
|
12420
11687
|
try {
|
|
12421
|
-
text =
|
|
11688
|
+
text = fs9.readFileSync(filePath, "utf-8");
|
|
12422
11689
|
} catch (error) {
|
|
12423
11690
|
debugLogger16.warn(
|
|
12424
11691
|
`Failed to read file for LSP didOpen: ${filePath}`,
|
|
@@ -12458,7 +11725,7 @@ var NativeLspService = class {
|
|
|
12458
11725
|
this.openedDocuments.set(serverName, openedForServer);
|
|
12459
11726
|
}
|
|
12460
11727
|
resolveLanguageId(filePath, handle) {
|
|
12461
|
-
const ext =
|
|
11728
|
+
const ext = path11.extname(filePath).slice(1).toLowerCase();
|
|
12462
11729
|
if (ext && handle.config.extensionToLanguage) {
|
|
12463
11730
|
const mapping = handle.config.extensionToLanguage;
|
|
12464
11731
|
return mapping[ext] ?? mapping["." + ext];
|
|
@@ -12586,11 +11853,11 @@ var NativeLspService = class {
|
|
|
12586
11853
|
}
|
|
12587
11854
|
async delay(ms, signal) {
|
|
12588
11855
|
if (!signal) {
|
|
12589
|
-
await new Promise((
|
|
11856
|
+
await new Promise((resolve5) => setTimeout(resolve5, ms));
|
|
12590
11857
|
return;
|
|
12591
11858
|
}
|
|
12592
11859
|
this.throwIfReinitializeAborted(signal);
|
|
12593
|
-
await new Promise((
|
|
11860
|
+
await new Promise((resolve5, reject) => {
|
|
12594
11861
|
const onAbort = /* @__PURE__ */ __name(() => {
|
|
12595
11862
|
clearTimeout(timer);
|
|
12596
11863
|
signal.removeEventListener("abort", onAbort);
|
|
@@ -12598,7 +11865,7 @@ var NativeLspService = class {
|
|
|
12598
11865
|
}, "onAbort");
|
|
12599
11866
|
const timer = setTimeout(() => {
|
|
12600
11867
|
signal.removeEventListener("abort", onAbort);
|
|
12601
|
-
|
|
11868
|
+
resolve5();
|
|
12602
11869
|
}, ms);
|
|
12603
11870
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
12604
11871
|
});
|
|
@@ -13211,8 +12478,8 @@ var NativeLspService = class {
|
|
|
13211
12478
|
*/
|
|
13212
12479
|
async applyTextEdits(uri, edits) {
|
|
13213
12480
|
let filePath = uri.startsWith("file://") ? fileURLToPath(uri) : uri;
|
|
13214
|
-
if (!
|
|
13215
|
-
filePath =
|
|
12481
|
+
if (!path11.isAbsolute(filePath)) {
|
|
12482
|
+
filePath = path11.resolve(this.workspaceRoot, filePath);
|
|
13216
12483
|
}
|
|
13217
12484
|
if (!this.workspaceContext.isPathWithinWorkspace(filePath)) {
|
|
13218
12485
|
throw new Error(`Refusing to apply edits outside workspace: ${filePath}`);
|
|
@@ -13247,7 +12514,7 @@ var NativeLspService = class {
|
|
|
13247
12514
|
lines.splice(startLine, endLine - startLine + 1, ...newLines);
|
|
13248
12515
|
}
|
|
13249
12516
|
try {
|
|
13250
|
-
await fsp.access(filePath,
|
|
12517
|
+
await fsp.access(filePath, fs9.constants.W_OK);
|
|
13251
12518
|
} catch (err) {
|
|
13252
12519
|
if (err?.code !== "ENOENT") {
|
|
13253
12520
|
throw err;
|
|
@@ -13713,7 +12980,7 @@ __name(getFilterReason, "getFilterReason");
|
|
|
13713
12980
|
init_esbuild_shims();
|
|
13714
12981
|
import { mkdir as mkdir3, copyFile, rm } from "node:fs/promises";
|
|
13715
12982
|
import { existsSync as existsSync3 } from "node:fs";
|
|
13716
|
-
import { join as
|
|
12983
|
+
import { join as join7, dirname as dirname4, relative, isAbsolute as isAbsolute5 } from "node:path";
|
|
13717
12984
|
import { tmpdir } from "node:os";
|
|
13718
12985
|
import { randomUUID } from "node:crypto";
|
|
13719
12986
|
var OverlayFs = class {
|
|
@@ -13721,7 +12988,7 @@ var OverlayFs = class {
|
|
|
13721
12988
|
constructor(realCwd) {
|
|
13722
12989
|
this.realCwd = realCwd;
|
|
13723
12990
|
const id = randomUUID().slice(0, 8);
|
|
13724
|
-
this.overlayDir =
|
|
12991
|
+
this.overlayDir = join7(
|
|
13725
12992
|
tmpdir(),
|
|
13726
12993
|
"qwen-speculation",
|
|
13727
12994
|
String(process.pid),
|
|
@@ -13760,9 +13027,9 @@ var OverlayFs = class {
|
|
|
13760
13027
|
if (this.writtenFiles.has(rel)) {
|
|
13761
13028
|
return this.writtenFiles.get(rel);
|
|
13762
13029
|
}
|
|
13763
|
-
const overlayPath =
|
|
13030
|
+
const overlayPath = join7(this.overlayDir, rel);
|
|
13764
13031
|
await mkdir3(dirname4(overlayPath), { recursive: true });
|
|
13765
|
-
const originalPath =
|
|
13032
|
+
const originalPath = join7(this.realCwd, rel);
|
|
13766
13033
|
if (existsSync3(originalPath)) {
|
|
13767
13034
|
try {
|
|
13768
13035
|
await copyFile(originalPath, overlayPath);
|
|
@@ -13785,7 +13052,7 @@ var OverlayFs = class {
|
|
|
13785
13052
|
async applyToReal() {
|
|
13786
13053
|
const applied = [];
|
|
13787
13054
|
for (const [rel, overlayPath] of this.writtenFiles) {
|
|
13788
|
-
const realPath =
|
|
13055
|
+
const realPath = join7(this.realCwd, rel);
|
|
13789
13056
|
try {
|
|
13790
13057
|
await mkdir3(dirname4(realPath), { recursive: true });
|
|
13791
13058
|
await copyFile(overlayPath, realPath);
|
|
@@ -13809,7 +13076,7 @@ var OverlayFs = class {
|
|
|
13809
13076
|
* Returns null if the path is outside cwd.
|
|
13810
13077
|
*/
|
|
13811
13078
|
toRelative(inputPath) {
|
|
13812
|
-
const abs = isAbsolute5(inputPath) ? inputPath :
|
|
13079
|
+
const abs = isAbsolute5(inputPath) ? inputPath : join7(this.realCwd, inputPath);
|
|
13813
13080
|
const rel = relative(this.realCwd, abs);
|
|
13814
13081
|
if (isAbsolute5(rel) || rel.startsWith("..")) {
|
|
13815
13082
|
return null;
|
|
@@ -14384,20 +13651,20 @@ __name(generatePipelinedSuggestion, "generatePipelinedSuggestion");
|
|
|
14384
13651
|
// packages/core/src/utils/filesearch/fileSearch.ts
|
|
14385
13652
|
init_esbuild_shims();
|
|
14386
13653
|
var import_picomatch3 = __toESM(require_picomatch(), 1);
|
|
14387
|
-
import
|
|
13654
|
+
import path15 from "node:path";
|
|
14388
13655
|
|
|
14389
13656
|
// packages/core/src/utils/filesearch/ignore.ts
|
|
14390
13657
|
init_esbuild_shims();
|
|
14391
13658
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
14392
13659
|
var import_picomatch = __toESM(require_picomatch(), 1);
|
|
14393
|
-
import
|
|
14394
|
-
import
|
|
13660
|
+
import fs10 from "node:fs";
|
|
13661
|
+
import path12 from "node:path";
|
|
14395
13662
|
var hasFileExtension = (0, import_picomatch.default)("**/*[*.]*");
|
|
14396
13663
|
var debugLogger19 = createDebugLogger("FILE_SEARCH_IGNORE");
|
|
14397
13664
|
function loadIgnoreRules(options) {
|
|
14398
13665
|
const ignorer = new Ignore();
|
|
14399
13666
|
if (options.useGitignore) {
|
|
14400
|
-
const gitignorePath =
|
|
13667
|
+
const gitignorePath = path12.join(options.projectRoot, ".gitignore");
|
|
14401
13668
|
const gitignoreContent = readIgnoreFile(gitignorePath);
|
|
14402
13669
|
if (gitignoreContent !== void 0) {
|
|
14403
13670
|
ignorer.add(gitignoreContent);
|
|
@@ -14407,7 +13674,7 @@ function loadIgnoreRules(options) {
|
|
|
14407
13674
|
for (const ignoreFileName of getQwenIgnoreFileNames(
|
|
14408
13675
|
options.customIgnoreFiles
|
|
14409
13676
|
)) {
|
|
14410
|
-
const qwenignorePath =
|
|
13677
|
+
const qwenignorePath = path12.join(options.projectRoot, ignoreFileName);
|
|
14411
13678
|
const qwenignoreContent = readIgnoreFile(qwenignorePath);
|
|
14412
13679
|
if (qwenignoreContent !== void 0) {
|
|
14413
13680
|
ignorer.addSource(qwenignoreContent);
|
|
@@ -14428,7 +13695,7 @@ function loadIgnoreRules(options) {
|
|
|
14428
13695
|
__name(loadIgnoreRules, "loadIgnoreRules");
|
|
14429
13696
|
function readIgnoreFile(filePath) {
|
|
14430
13697
|
try {
|
|
14431
|
-
return
|
|
13698
|
+
return fs10.readFileSync(filePath, "utf8");
|
|
14432
13699
|
} catch (_error) {
|
|
14433
13700
|
const error = _error;
|
|
14434
13701
|
if (error.code !== "ENOENT") {
|
|
@@ -14581,8 +13848,8 @@ __name(hasGlobSyntax, "hasGlobSyntax");
|
|
|
14581
13848
|
// packages/core/src/utils/filesearch/crawler.ts
|
|
14582
13849
|
init_esbuild_shims();
|
|
14583
13850
|
var import_fdir = __toESM(require_dist(), 1);
|
|
14584
|
-
import
|
|
14585
|
-
import
|
|
13851
|
+
import path13 from "node:path";
|
|
13852
|
+
import fs11 from "node:fs";
|
|
14586
13853
|
import { spawn as spawn3 } from "node:child_process";
|
|
14587
13854
|
|
|
14588
13855
|
// packages/core/src/utils/filesearch/crawlCache.ts
|
|
@@ -14667,7 +13934,7 @@ var write = /* @__PURE__ */ __name((key, results, ttlMs) => {
|
|
|
14667
13934
|
|
|
14668
13935
|
// packages/core/src/utils/filesearch/crawler.ts
|
|
14669
13936
|
function toPosixPath(p) {
|
|
14670
|
-
return p.split(
|
|
13937
|
+
return p.split(path13.sep).join(path13.posix.sep);
|
|
14671
13938
|
}
|
|
14672
13939
|
__name(toPosixPath, "toPosixPath");
|
|
14673
13940
|
function normalizeGitPath(p, stripTrailingSlash = false) {
|
|
@@ -14763,7 +14030,7 @@ function redactArgsForLog(args) {
|
|
|
14763
14030
|
if (/^[A-Za-z]:[\\/]/.test(t) || t.startsWith("/") && t.length > 1) {
|
|
14764
14031
|
return "<abs-path>";
|
|
14765
14032
|
}
|
|
14766
|
-
if (t.includes(
|
|
14033
|
+
if (t.includes(path13.sep) && t.length > 32) {
|
|
14767
14034
|
return "<path>";
|
|
14768
14035
|
}
|
|
14769
14036
|
return t;
|
|
@@ -14794,7 +14061,7 @@ function withSafeGitConfig(args) {
|
|
|
14794
14061
|
}
|
|
14795
14062
|
__name(withSafeGitConfig, "withSafeGitConfig");
|
|
14796
14063
|
function canonicalStatePath(p) {
|
|
14797
|
-
return toPosixPath(
|
|
14064
|
+
return toPosixPath(path13.resolve(p));
|
|
14798
14065
|
}
|
|
14799
14066
|
__name(canonicalStatePath, "canonicalStatePath");
|
|
14800
14067
|
function getStateKey(options) {
|
|
@@ -14831,7 +14098,7 @@ function evictChangeStateIfNeeded() {
|
|
|
14831
14098
|
}
|
|
14832
14099
|
}
|
|
14833
14100
|
__name(evictChangeStateIfNeeded, "evictChangeStateIfNeeded");
|
|
14834
|
-
function
|
|
14101
|
+
function resolveGitDir(crawlDirectory) {
|
|
14835
14102
|
const cacheKey = canonicalStatePath(crawlDirectory);
|
|
14836
14103
|
const cached = pathCacheGet(resolveGitDirCache, cacheKey);
|
|
14837
14104
|
if (cached !== void 0) {
|
|
@@ -14839,28 +14106,28 @@ function resolveGitDir2(crawlDirectory) {
|
|
|
14839
14106
|
}
|
|
14840
14107
|
let current = crawlDirectory;
|
|
14841
14108
|
while (current) {
|
|
14842
|
-
const gitPath =
|
|
14109
|
+
const gitPath = path13.join(current, ".git");
|
|
14843
14110
|
try {
|
|
14844
|
-
const
|
|
14845
|
-
if (
|
|
14111
|
+
const stat4 = fs11.statSync(gitPath);
|
|
14112
|
+
if (stat4.isDirectory()) {
|
|
14846
14113
|
pathCacheSet(resolveGitDirCache, cacheKey, gitPath);
|
|
14847
14114
|
return gitPath;
|
|
14848
14115
|
}
|
|
14849
|
-
if (
|
|
14850
|
-
const contents =
|
|
14116
|
+
if (stat4.isFile()) {
|
|
14117
|
+
const contents = fs11.readFileSync(gitPath, "utf8").trim();
|
|
14851
14118
|
const match = contents.match(/^gitdir:\s*(.+)$/i);
|
|
14852
14119
|
if (!match) {
|
|
14853
14120
|
pathCacheSet(resolveGitDirCache, cacheKey, null);
|
|
14854
14121
|
return null;
|
|
14855
14122
|
}
|
|
14856
14123
|
const resolvedGitDir = match[1].trim();
|
|
14857
|
-
let resolvedAbs =
|
|
14124
|
+
let resolvedAbs = path13.isAbsolute(resolvedGitDir) ? path13.resolve(resolvedGitDir) : path13.resolve(current, resolvedGitDir);
|
|
14858
14125
|
try {
|
|
14859
|
-
resolvedAbs =
|
|
14126
|
+
resolvedAbs = fs11.realpathSync(resolvedAbs);
|
|
14860
14127
|
try {
|
|
14861
|
-
|
|
14128
|
+
fs11.statSync(path13.join(resolvedAbs, "HEAD"));
|
|
14862
14129
|
} catch {
|
|
14863
|
-
|
|
14130
|
+
fs11.statSync(path13.join(resolvedAbs, "index"));
|
|
14864
14131
|
}
|
|
14865
14132
|
} catch {
|
|
14866
14133
|
pathCacheSet(resolveGitDirCache, cacheKey, null);
|
|
@@ -14876,7 +14143,7 @@ function resolveGitDir2(crawlDirectory) {
|
|
|
14876
14143
|
return null;
|
|
14877
14144
|
}
|
|
14878
14145
|
}
|
|
14879
|
-
const parent =
|
|
14146
|
+
const parent = path13.dirname(current);
|
|
14880
14147
|
if (parent === current) {
|
|
14881
14148
|
break;
|
|
14882
14149
|
}
|
|
@@ -14885,15 +14152,15 @@ function resolveGitDir2(crawlDirectory) {
|
|
|
14885
14152
|
pathCacheSet(resolveGitDirCache, cacheKey, null);
|
|
14886
14153
|
return null;
|
|
14887
14154
|
}
|
|
14888
|
-
__name(
|
|
14155
|
+
__name(resolveGitDir, "resolveGitDir");
|
|
14889
14156
|
function getGitRootMtime(crawlDirectory) {
|
|
14890
14157
|
try {
|
|
14891
|
-
const gitDir =
|
|
14158
|
+
const gitDir = resolveGitDir(crawlDirectory);
|
|
14892
14159
|
if (!gitDir) {
|
|
14893
14160
|
return null;
|
|
14894
14161
|
}
|
|
14895
|
-
const indexPath =
|
|
14896
|
-
const indexStat =
|
|
14162
|
+
const indexPath = path13.join(gitDir, "index");
|
|
14163
|
+
const indexStat = fs11.statSync(indexPath);
|
|
14897
14164
|
return indexStat.mtimeMs;
|
|
14898
14165
|
} catch {
|
|
14899
14166
|
}
|
|
@@ -14949,7 +14216,7 @@ function computeLinesFingerprint(lines) {
|
|
|
14949
14216
|
__name(computeLinesFingerprint, "computeLinesFingerprint");
|
|
14950
14217
|
function runCommand(command, args, cwd, timeoutMs = 2e4, options) {
|
|
14951
14218
|
const collectLines = options?.collectLines !== false;
|
|
14952
|
-
return new Promise((
|
|
14219
|
+
return new Promise((resolve5) => {
|
|
14953
14220
|
const lines = [];
|
|
14954
14221
|
let settled = false;
|
|
14955
14222
|
let timedOut = false;
|
|
@@ -14961,7 +14228,7 @@ function runCommand(command, args, cwd, timeoutMs = 2e4, options) {
|
|
|
14961
14228
|
return;
|
|
14962
14229
|
}
|
|
14963
14230
|
settled = true;
|
|
14964
|
-
|
|
14231
|
+
resolve5({ success, lines: resultLines });
|
|
14965
14232
|
}, "finalize");
|
|
14966
14233
|
let stderrBuf = "";
|
|
14967
14234
|
let child;
|
|
@@ -15129,19 +14396,19 @@ function normalizePath(p) {
|
|
|
15129
14396
|
}
|
|
15130
14397
|
__name(normalizePath, "normalizePath");
|
|
15131
14398
|
function getPosixRelative(from, to) {
|
|
15132
|
-
const fromResolved =
|
|
15133
|
-
const toResolved =
|
|
14399
|
+
const fromResolved = path13.resolve(from);
|
|
14400
|
+
const toResolved = path13.resolve(to);
|
|
15134
14401
|
let fromAbs = fromResolved;
|
|
15135
14402
|
let toAbs = toResolved;
|
|
15136
14403
|
try {
|
|
15137
|
-
fromAbs =
|
|
14404
|
+
fromAbs = fs11.realpathSync(fromResolved);
|
|
15138
14405
|
} catch {
|
|
15139
14406
|
}
|
|
15140
14407
|
try {
|
|
15141
|
-
toAbs =
|
|
14408
|
+
toAbs = fs11.realpathSync(toResolved);
|
|
15142
14409
|
} catch {
|
|
15143
14410
|
}
|
|
15144
|
-
const relative2 =
|
|
14411
|
+
const relative2 = path13.relative(fromAbs, toAbs);
|
|
15145
14412
|
const posixRel = toPosixPath(relative2);
|
|
15146
14413
|
return posixRel === "" ? "." : posixRel;
|
|
15147
14414
|
}
|
|
@@ -15150,18 +14417,18 @@ function isValidIgnorePath(relativePath) {
|
|
|
15150
14417
|
if (!relativePath || relativePath === ".") {
|
|
15151
14418
|
return false;
|
|
15152
14419
|
}
|
|
15153
|
-
if (
|
|
14420
|
+
if (path13.posix.isAbsolute(relativePath)) {
|
|
15154
14421
|
return false;
|
|
15155
14422
|
}
|
|
15156
14423
|
return relativePath !== ".." && !relativePath.startsWith("../") && !relativePath.includes("/../");
|
|
15157
14424
|
}
|
|
15158
14425
|
__name(isValidIgnorePath, "isValidIgnorePath");
|
|
15159
14426
|
function toFdirExcludeRelativePath(crawlDirectory, dirPath) {
|
|
15160
|
-
const base =
|
|
15161
|
-
const absoluteCandidate =
|
|
15162
|
-
let rel =
|
|
14427
|
+
const base = path13.resolve(crawlDirectory);
|
|
14428
|
+
const absoluteCandidate = path13.isAbsolute(dirPath) ? dirPath : path13.join(base, dirPath);
|
|
14429
|
+
let rel = path13.relative(base, absoluteCandidate);
|
|
15163
14430
|
rel = toPosixPath(rel);
|
|
15164
|
-
if (!rel || rel.startsWith("..") ||
|
|
14431
|
+
if (!rel || rel.startsWith("..") || path13.posix.isAbsolute(rel)) {
|
|
15165
14432
|
return null;
|
|
15166
14433
|
}
|
|
15167
14434
|
return isValidIgnorePath(rel) ? rel : null;
|
|
@@ -15251,11 +14518,11 @@ __name(isUnderIgnoredDirectory, "isUnderIgnoredDirectory");
|
|
|
15251
14518
|
var YIELD_INTERVAL = 1e3;
|
|
15252
14519
|
async function maybeYield(index) {
|
|
15253
14520
|
if (index > 0 && index % YIELD_INTERVAL === 0) {
|
|
15254
|
-
await new Promise((
|
|
14521
|
+
await new Promise((resolve5) => setImmediate(resolve5));
|
|
15255
14522
|
}
|
|
15256
14523
|
}
|
|
15257
14524
|
__name(maybeYield, "maybeYield");
|
|
15258
|
-
async function
|
|
14525
|
+
async function findGitRoot(dir) {
|
|
15259
14526
|
const result = await commandRunner(
|
|
15260
14527
|
"git",
|
|
15261
14528
|
withSafeGitConfig(["rev-parse", "--show-toplevel"]),
|
|
@@ -15266,7 +14533,7 @@ async function findGitRoot2(dir) {
|
|
|
15266
14533
|
if (!result.success || result.lines.length === 0) return null;
|
|
15267
14534
|
return normalizePath(result.lines[0]);
|
|
15268
14535
|
}
|
|
15269
|
-
__name(
|
|
14536
|
+
__name(findGitRoot, "findGitRoot");
|
|
15270
14537
|
function shouldIncludeFile(filePath, dirFilter, fileFilter) {
|
|
15271
14538
|
if (!isValidIgnorePath(filePath)) {
|
|
15272
14539
|
return false;
|
|
@@ -15338,7 +14605,7 @@ async function scanWorkingTreeForChange(state, crawlDirectory, useGitignore) {
|
|
|
15338
14605
|
if (state.gitRootMtimeMs === null && state.untrackedFingerprint === null && state.deletedFingerprint === null) {
|
|
15339
14606
|
return { changed: false };
|
|
15340
14607
|
}
|
|
15341
|
-
const gitRoot = await
|
|
14608
|
+
const gitRoot = await findGitRoot(crawlDirectory);
|
|
15342
14609
|
if (state.untrackedFingerprint === null && state.deletedFingerprint === null) {
|
|
15343
14610
|
return gitRoot ? { changed: true } : { changed: false };
|
|
15344
14611
|
}
|
|
@@ -15368,16 +14635,16 @@ function posixPathUnderGitRoot(normalizedFile, relativeToGitRoot, relativeToCraw
|
|
|
15368
14635
|
if (relativeToGitRoot && relativeToGitRoot !== ".") {
|
|
15369
14636
|
const rest = sliceAfterGitPathspecPrefix(nf, normGitRoot);
|
|
15370
14637
|
if (rest !== null) {
|
|
15371
|
-
return
|
|
14638
|
+
return path13.posix.join(normCrawlDir, rest);
|
|
15372
14639
|
}
|
|
15373
14640
|
if (equalsRepoRelativeCaseAware(nf, normGitRoot)) {
|
|
15374
14641
|
const base = nf.replace(/\/+$/, "");
|
|
15375
14642
|
return `${base}/`;
|
|
15376
14643
|
}
|
|
15377
14644
|
const nfFile = nf.replace(/\/+$/, "");
|
|
15378
|
-
return
|
|
14645
|
+
return path13.posix.join(normCrawlDir, nfFile);
|
|
15379
14646
|
}
|
|
15380
|
-
return
|
|
14647
|
+
return path13.posix.join(normCrawlDir, nf.replace(/\/+$/, ""));
|
|
15381
14648
|
}
|
|
15382
14649
|
__name(posixPathUnderGitRoot, "posixPathUnderGitRoot");
|
|
15383
14650
|
async function crawlWithGitLsFiles(stateKey, crawlDirectory, cwd, options, workingTreePrefetch) {
|
|
@@ -15389,7 +14656,7 @@ async function crawlWithGitLsFiles(stateKey, crawlDirectory, cwd, options, worki
|
|
|
15389
14656
|
untrackedFiles = workingTreePrefetch.untrackedFiles;
|
|
15390
14657
|
deletedFiles = workingTreePrefetch.deletedFiles;
|
|
15391
14658
|
} else {
|
|
15392
|
-
gitRoot = await
|
|
14659
|
+
gitRoot = await findGitRoot(crawlDirectory);
|
|
15393
14660
|
if (!gitRoot) {
|
|
15394
14661
|
return { success: false, files: [], gitRepoListingFailed: false };
|
|
15395
14662
|
}
|
|
@@ -15454,13 +14721,13 @@ async function crawlWithGitLsFiles(stateKey, crawlDirectory, cwd, options, worki
|
|
|
15454
14721
|
if (deletedSet.has(normalizedFile)) {
|
|
15455
14722
|
return true;
|
|
15456
14723
|
}
|
|
15457
|
-
let
|
|
14724
|
+
let stat4;
|
|
15458
14725
|
try {
|
|
15459
|
-
|
|
14726
|
+
stat4 = fs11.lstatSync(path13.join(gitRoot, ...normalizedFile.split("/")));
|
|
15460
14727
|
} catch {
|
|
15461
14728
|
return true;
|
|
15462
14729
|
}
|
|
15463
|
-
if (
|
|
14730
|
+
if (stat4.isDirectory()) {
|
|
15464
14731
|
return true;
|
|
15465
14732
|
}
|
|
15466
14733
|
if (relativeToGitRoot && relativeToGitRoot !== "." && normalizedFile === relativeToGitRoot) {
|
|
@@ -15558,7 +14825,7 @@ function collectDirectoryRows(options) {
|
|
|
15558
14825
|
const dirFilter = options.ignore.getDirectoryFilter();
|
|
15559
14826
|
const rows = [];
|
|
15560
14827
|
const visit = /* @__PURE__ */ __name((dir, relativePath, depth) => {
|
|
15561
|
-
const cwdRelative = relativePath === "" ? relativeToCrawlDir :
|
|
14828
|
+
const cwdRelative = relativePath === "" ? relativeToCrawlDir : path13.posix.join(relativeToCrawlDir, relativePath);
|
|
15562
14829
|
if (cwdRelative !== ".") {
|
|
15563
14830
|
const row = cwdRelative.endsWith("/") ? cwdRelative : `${cwdRelative}/`;
|
|
15564
14831
|
if (!isValidIgnorePath(row.slice(0, -1)) || dirFilter(row)) {
|
|
@@ -15571,7 +14838,7 @@ function collectDirectoryRows(options) {
|
|
|
15571
14838
|
}
|
|
15572
14839
|
let entries;
|
|
15573
14840
|
try {
|
|
15574
|
-
entries =
|
|
14841
|
+
entries = fs11.readdirSync(dir, { withFileTypes: true });
|
|
15575
14842
|
} catch {
|
|
15576
14843
|
return;
|
|
15577
14844
|
}
|
|
@@ -15579,8 +14846,8 @@ function collectDirectoryRows(options) {
|
|
|
15579
14846
|
if (!entry.isDirectory()) {
|
|
15580
14847
|
continue;
|
|
15581
14848
|
}
|
|
15582
|
-
const childRelative = relativePath ?
|
|
15583
|
-
visit(
|
|
14849
|
+
const childRelative = relativePath ? path13.posix.join(relativePath, entry.name) : entry.name;
|
|
14850
|
+
visit(path13.join(dir, entry.name), childRelative, depth + 1);
|
|
15584
14851
|
}
|
|
15585
14852
|
}, "visit");
|
|
15586
14853
|
visit(options.crawlDirectory, "", 0);
|
|
@@ -15618,7 +14885,7 @@ async function crawlWithRipgrep(stateKey, crawlDirectory, cwd, options) {
|
|
|
15618
14885
|
return false;
|
|
15619
14886
|
}
|
|
15620
14887
|
const normalizedFile = normalizePath(file);
|
|
15621
|
-
const fullPath =
|
|
14888
|
+
const fullPath = path13.posix.join(relativeToCrawlDir, normalizedFile);
|
|
15622
14889
|
if (!shouldIncludeFile(fullPath, dirFilter, fileFilter)) {
|
|
15623
14890
|
return true;
|
|
15624
14891
|
}
|
|
@@ -15677,7 +14944,7 @@ async function crawlWithFdir(options) {
|
|
|
15677
14944
|
return dirFilter(`${relativePath}/`);
|
|
15678
14945
|
}).filter((filePath, isDirectory) => {
|
|
15679
14946
|
if (isDirectory) return true;
|
|
15680
|
-
const cwdRelative =
|
|
14947
|
+
const cwdRelative = path13.posix.join(relativeToCrawlDir, filePath);
|
|
15681
14948
|
if (!isValidIgnorePath(cwdRelative)) {
|
|
15682
14949
|
return false;
|
|
15683
14950
|
}
|
|
@@ -15690,7 +14957,7 @@ async function crawlWithFdir(options) {
|
|
|
15690
14957
|
} catch {
|
|
15691
14958
|
return [];
|
|
15692
14959
|
}
|
|
15693
|
-
const mapped = results.filter((p) => p.length > 0 && p !== ".").map((p) =>
|
|
14960
|
+
const mapped = results.filter((p) => p.length > 0 && p !== ".").map((p) => path13.posix.join(relativeToCrawlDir, p));
|
|
15694
14961
|
if (relativeToCrawlDir !== ".") {
|
|
15695
14962
|
const rootDir = relativeToCrawlDir.endsWith("/") ? relativeToCrawlDir : `${relativeToCrawlDir}/`;
|
|
15696
14963
|
if (!mapped.includes(rootDir)) {
|
|
@@ -15817,8 +15084,8 @@ __name(applyMaxFilesLimit, "applyMaxFilesLimit");
|
|
|
15817
15084
|
|
|
15818
15085
|
// packages/core/src/utils/filesearch/fzfWorkerHandle.ts
|
|
15819
15086
|
init_esbuild_shims();
|
|
15820
|
-
import
|
|
15821
|
-
import
|
|
15087
|
+
import fs12 from "node:fs";
|
|
15088
|
+
import path14 from "node:path";
|
|
15822
15089
|
import { Worker } from "node:worker_threads";
|
|
15823
15090
|
|
|
15824
15091
|
// node_modules/fzf/dist/fzf.es.js
|
|
@@ -16685,7 +15952,7 @@ function basicMatch(query) {
|
|
|
16685
15952
|
__name(basicMatch, "basicMatch");
|
|
16686
15953
|
var isNode = typeof __require !== "undefined" && typeof window === "undefined";
|
|
16687
15954
|
function asyncMatcher(token, len, iter2, onFinish) {
|
|
16688
|
-
return new Promise((
|
|
15955
|
+
return new Promise((resolve5, reject) => {
|
|
16689
15956
|
const INCREMENT = 1e3;
|
|
16690
15957
|
let i = 0, end = Math.min(INCREMENT, len);
|
|
16691
15958
|
const step = /* @__PURE__ */ __name(() => {
|
|
@@ -16698,7 +15965,7 @@ function asyncMatcher(token, len, iter2, onFinish) {
|
|
|
16698
15965
|
end = Math.min(end + INCREMENT, len);
|
|
16699
15966
|
isNode ? setImmediate(step) : setTimeout(step);
|
|
16700
15967
|
} else {
|
|
16701
|
-
|
|
15968
|
+
resolve5(onFinish());
|
|
16702
15969
|
}
|
|
16703
15970
|
}, "step");
|
|
16704
15971
|
step();
|
|
@@ -16753,6 +16020,22 @@ var syncDefaultOpts = {
|
|
|
16753
16020
|
...defaultOpts,
|
|
16754
16021
|
match: basicMatch
|
|
16755
16022
|
};
|
|
16023
|
+
var SyncFinder = class extends BaseFinder {
|
|
16024
|
+
static {
|
|
16025
|
+
__name(this, "SyncFinder");
|
|
16026
|
+
}
|
|
16027
|
+
constructor(list, ...optionsTuple) {
|
|
16028
|
+
super(list, ...optionsTuple);
|
|
16029
|
+
this.opts = { ...syncDefaultOpts, ...optionsTuple[0] };
|
|
16030
|
+
}
|
|
16031
|
+
find(query) {
|
|
16032
|
+
if (query.length === 0 || this.items.length === 0)
|
|
16033
|
+
return this.items.slice(0, this.opts.limit).map(createResultItemWithEmptyPos);
|
|
16034
|
+
query = query.normalize();
|
|
16035
|
+
let result = this.opts.match.bind(this)(query);
|
|
16036
|
+
return postProcessResultItems(result, this.opts);
|
|
16037
|
+
}
|
|
16038
|
+
};
|
|
16756
16039
|
var asyncDefaultOpts = {
|
|
16757
16040
|
...defaultOpts,
|
|
16758
16041
|
match: asyncBasicMatch
|
|
@@ -16804,6 +16087,15 @@ function postProcessResultItems(result, opts) {
|
|
|
16804
16087
|
return result;
|
|
16805
16088
|
}
|
|
16806
16089
|
__name(postProcessResultItems, "postProcessResultItems");
|
|
16090
|
+
var Fzf = class {
|
|
16091
|
+
static {
|
|
16092
|
+
__name(this, "Fzf");
|
|
16093
|
+
}
|
|
16094
|
+
constructor(list, ...optionsTuple) {
|
|
16095
|
+
this.finder = new SyncFinder(list, ...optionsTuple);
|
|
16096
|
+
this.find = this.finder.find.bind(this.finder);
|
|
16097
|
+
}
|
|
16098
|
+
};
|
|
16807
16099
|
var AsyncFzf = class {
|
|
16808
16100
|
static {
|
|
16809
16101
|
__name(this, "AsyncFzf");
|
|
@@ -16845,11 +16137,11 @@ var inProcessTransport = {
|
|
|
16845
16137
|
var resolvedWorkerPath;
|
|
16846
16138
|
function getWorkerScriptPath() {
|
|
16847
16139
|
if (resolvedWorkerPath !== void 0) return resolvedWorkerPath;
|
|
16848
|
-
const candidate =
|
|
16140
|
+
const candidate = path14.join(
|
|
16849
16141
|
resolveBundleDir(import.meta.url),
|
|
16850
16142
|
"fzfWorker.js"
|
|
16851
16143
|
);
|
|
16852
|
-
resolvedWorkerPath =
|
|
16144
|
+
resolvedWorkerPath = fs12.existsSync(candidate) ? candidate : null;
|
|
16853
16145
|
return resolvedWorkerPath;
|
|
16854
16146
|
}
|
|
16855
16147
|
__name(getWorkerScriptPath, "getWorkerScriptPath");
|
|
@@ -16945,12 +16237,12 @@ var workerTransport = {
|
|
|
16945
16237
|
}
|
|
16946
16238
|
await readyPromise;
|
|
16947
16239
|
const reqId = nextReqId++;
|
|
16948
|
-
return new Promise((
|
|
16240
|
+
return new Promise((resolve5, reject) => {
|
|
16949
16241
|
if (readyState === "disposed" || readyState === "failed") {
|
|
16950
16242
|
reject(new Error(`fzf worker not available (${readyState})`));
|
|
16951
16243
|
return;
|
|
16952
16244
|
}
|
|
16953
|
-
pending.set(reqId, { resolve:
|
|
16245
|
+
pending.set(reqId, { resolve: resolve5, reject });
|
|
16954
16246
|
try {
|
|
16955
16247
|
worker.postMessage({ type: "find", reqId, pattern, limit });
|
|
16956
16248
|
} catch (err) {
|
|
@@ -17045,7 +16337,7 @@ async function filter(allPaths, pattern, signal) {
|
|
|
17045
16337
|
const results = [];
|
|
17046
16338
|
for (const [i, p] of allPaths.entries()) {
|
|
17047
16339
|
if (i % 1e3 === 0) {
|
|
17048
|
-
await new Promise((
|
|
16340
|
+
await new Promise((resolve5) => setImmediate(resolve5));
|
|
17049
16341
|
if (signal?.aborted) {
|
|
17050
16342
|
throw new AbortError();
|
|
17051
16343
|
}
|
|
@@ -17124,7 +16416,7 @@ var RecursiveFileSearch = class {
|
|
|
17124
16416
|
const results = [];
|
|
17125
16417
|
for (const [i, candidate] of filteredCandidates.entries()) {
|
|
17126
16418
|
if (i % 1e3 === 0) {
|
|
17127
|
-
await new Promise((
|
|
16419
|
+
await new Promise((resolve5) => setImmediate(resolve5));
|
|
17128
16420
|
if (options.signal?.aborted) {
|
|
17129
16421
|
throw new AbortError();
|
|
17130
16422
|
}
|
|
@@ -17166,9 +16458,9 @@ var DirectoryFileSearch = class {
|
|
|
17166
16458
|
throw new Error("Engine not initialized. Call initialize() first.");
|
|
17167
16459
|
}
|
|
17168
16460
|
pattern = pattern || "*";
|
|
17169
|
-
const dir = pattern.endsWith("/") ? pattern :
|
|
17170
|
-
const crawlDirectory =
|
|
17171
|
-
const listingProjectRoot =
|
|
16461
|
+
const dir = pattern.endsWith("/") ? pattern : path15.dirname(pattern);
|
|
16462
|
+
const crawlDirectory = path15.join(this.options.projectRoot, dir);
|
|
16463
|
+
const listingProjectRoot = path15.resolve(crawlDirectory) === path15.resolve(this.options.projectRoot);
|
|
17172
16464
|
const results = await crawl({
|
|
17173
16465
|
crawlDirectory,
|
|
17174
16466
|
cwd: this.options.projectRoot,
|
|
@@ -17249,13 +16541,13 @@ __name(analyzeToolResultRetention, "analyzeToolResultRetention");
|
|
|
17249
16541
|
|
|
17250
16542
|
// packages/core/src/utils/pathReader.ts
|
|
17251
16543
|
init_esbuild_shims();
|
|
17252
|
-
import { promises as
|
|
17253
|
-
import
|
|
16544
|
+
import { promises as fs13 } from "node:fs";
|
|
16545
|
+
import path16 from "node:path";
|
|
17254
16546
|
async function readPathFromWorkspace(pathStr, config) {
|
|
17255
16547
|
const workspace = config.getWorkspaceContext();
|
|
17256
16548
|
const fileService = config.getFileService();
|
|
17257
16549
|
let absolutePath = null;
|
|
17258
|
-
if (
|
|
16550
|
+
if (path16.isAbsolute(pathStr)) {
|
|
17259
16551
|
if (!workspace.isPathWithinWorkspace(pathStr)) {
|
|
17260
16552
|
throw new Error(
|
|
17261
16553
|
`Absolute path is outside of the allowed workspace: ${pathStr}`
|
|
@@ -17265,9 +16557,9 @@ async function readPathFromWorkspace(pathStr, config) {
|
|
|
17265
16557
|
} else {
|
|
17266
16558
|
const searchDirs = workspace.getDirectories();
|
|
17267
16559
|
for (const dir of searchDirs) {
|
|
17268
|
-
const potentialPath =
|
|
16560
|
+
const potentialPath = path16.resolve(dir, pathStr);
|
|
17269
16561
|
try {
|
|
17270
|
-
await
|
|
16562
|
+
await fs13.access(potentialPath);
|
|
17271
16563
|
absolutePath = potentialPath;
|
|
17272
16564
|
break;
|
|
17273
16565
|
} catch {
|
|
@@ -17277,7 +16569,7 @@ async function readPathFromWorkspace(pathStr, config) {
|
|
|
17277
16569
|
if (!absolutePath) {
|
|
17278
16570
|
throw new Error(`Path not found in workspace: ${pathStr}`);
|
|
17279
16571
|
}
|
|
17280
|
-
const stats = await
|
|
16572
|
+
const stats = await fs13.stat(absolutePath);
|
|
17281
16573
|
if (stats.isDirectory()) {
|
|
17282
16574
|
const allParts = [];
|
|
17283
16575
|
allParts.push({
|
|
@@ -17293,7 +16585,7 @@ async function readPathFromWorkspace(pathStr, config) {
|
|
|
17293
16585
|
absolute: true
|
|
17294
16586
|
});
|
|
17295
16587
|
const relativeFiles = files.map(
|
|
17296
|
-
(p) =>
|
|
16588
|
+
(p) => path16.relative(config.getTargetDir(), p)
|
|
17297
16589
|
);
|
|
17298
16590
|
const filteringOptions = config.getFileFilteringOptions();
|
|
17299
16591
|
const filteredFiles = fileService.filterFiles(relativeFiles, {
|
|
@@ -17301,10 +16593,10 @@ async function readPathFromWorkspace(pathStr, config) {
|
|
|
17301
16593
|
respectQwenIgnore: filteringOptions.respectQwenIgnore
|
|
17302
16594
|
});
|
|
17303
16595
|
const finalFiles = filteredFiles.map(
|
|
17304
|
-
(p) =>
|
|
16596
|
+
(p) => path16.resolve(config.getTargetDir(), p)
|
|
17305
16597
|
);
|
|
17306
16598
|
for (const filePath of finalFiles) {
|
|
17307
|
-
const relativePathForDisplay =
|
|
16599
|
+
const relativePathForDisplay = path16.relative(absolutePath, filePath);
|
|
17308
16600
|
allParts.push({ text: `--- ${relativePathForDisplay} ---
|
|
17309
16601
|
` });
|
|
17310
16602
|
const result = await processSingleFileContent(filePath, config, {
|
|
@@ -17320,7 +16612,7 @@ async function readPathFromWorkspace(pathStr, config) {
|
|
|
17320
16612
|
allParts.push({ text: `--- End of content for directory: ${pathStr} ---` });
|
|
17321
16613
|
return allParts;
|
|
17322
16614
|
} else {
|
|
17323
|
-
const relativePath =
|
|
16615
|
+
const relativePath = path16.relative(config.getTargetDir(), absolutePath);
|
|
17324
16616
|
const singleFileFilteringOptions = config.getFileFilteringOptions();
|
|
17325
16617
|
const filtered = fileService.filterFiles([relativePath], {
|
|
17326
16618
|
respectGitIgnore: singleFileFilteringOptions.respectGitIgnore,
|
|
@@ -17339,25 +16631,25 @@ __name(readPathFromWorkspace, "readPathFromWorkspace");
|
|
|
17339
16631
|
|
|
17340
16632
|
// packages/core/src/utils/projectSummary.ts
|
|
17341
16633
|
init_esbuild_shims();
|
|
17342
|
-
import * as
|
|
17343
|
-
import * as
|
|
16634
|
+
import * as fs14 from "fs/promises";
|
|
16635
|
+
import * as path17 from "path";
|
|
17344
16636
|
var PROJECT_SUMMARY_FILENAME = "PROJECT_SUMMARY.md";
|
|
17345
16637
|
var WELCOME_BACK_STATE_FILENAME = "welcome-back-state.json";
|
|
17346
16638
|
function getProjectSummaryPath() {
|
|
17347
|
-
return
|
|
16639
|
+
return path17.join(process.cwd(), ".qwen", PROJECT_SUMMARY_FILENAME);
|
|
17348
16640
|
}
|
|
17349
16641
|
__name(getProjectSummaryPath, "getProjectSummaryPath");
|
|
17350
16642
|
function getWelcomeBackStatePath() {
|
|
17351
|
-
return
|
|
16643
|
+
return path17.join(process.cwd(), ".qwen", WELCOME_BACK_STATE_FILENAME);
|
|
17352
16644
|
}
|
|
17353
16645
|
__name(getWelcomeBackStatePath, "getWelcomeBackStatePath");
|
|
17354
|
-
function buildSummaryFingerprint(
|
|
17355
|
-
return `${
|
|
16646
|
+
function buildSummaryFingerprint(stat4) {
|
|
16647
|
+
return `${stat4.mtimeMs}:${stat4.size}`;
|
|
17356
16648
|
}
|
|
17357
16649
|
__name(buildSummaryFingerprint, "buildSummaryFingerprint");
|
|
17358
16650
|
async function getWelcomeBackState() {
|
|
17359
16651
|
try {
|
|
17360
|
-
const raw = await
|
|
16652
|
+
const raw = await fs14.readFile(getWelcomeBackStatePath(), "utf-8");
|
|
17361
16653
|
const parsed = JSON.parse(raw);
|
|
17362
16654
|
if (parsed.version !== 1 || parsed.lastChoice !== "restart" || typeof parsed.summaryFingerprint !== "string") {
|
|
17363
16655
|
return null;
|
|
@@ -17373,7 +16665,7 @@ async function getWelcomeBackState() {
|
|
|
17373
16665
|
__name(getWelcomeBackState, "getWelcomeBackState");
|
|
17374
16666
|
async function saveWelcomeBackRestartChoice(summaryFingerprint) {
|
|
17375
16667
|
const statePath = getWelcomeBackStatePath();
|
|
17376
|
-
await
|
|
16668
|
+
await fs14.mkdir(path17.dirname(statePath), { recursive: true });
|
|
17377
16669
|
const state = {
|
|
17378
16670
|
version: 1,
|
|
17379
16671
|
lastChoice: "restart",
|
|
@@ -17386,7 +16678,7 @@ async function saveWelcomeBackRestartChoice(summaryFingerprint) {
|
|
|
17386
16678
|
__name(saveWelcomeBackRestartChoice, "saveWelcomeBackRestartChoice");
|
|
17387
16679
|
async function clearWelcomeBackState() {
|
|
17388
16680
|
try {
|
|
17389
|
-
await
|
|
16681
|
+
await fs14.rm(getWelcomeBackStatePath(), { force: true });
|
|
17390
16682
|
} catch {
|
|
17391
16683
|
}
|
|
17392
16684
|
}
|
|
@@ -17394,15 +16686,15 @@ __name(clearWelcomeBackState, "clearWelcomeBackState");
|
|
|
17394
16686
|
async function getProjectSummaryInfo() {
|
|
17395
16687
|
const summaryPath = getProjectSummaryPath();
|
|
17396
16688
|
try {
|
|
17397
|
-
await
|
|
16689
|
+
await fs14.access(summaryPath);
|
|
17398
16690
|
} catch {
|
|
17399
16691
|
return {
|
|
17400
16692
|
hasHistory: false
|
|
17401
16693
|
};
|
|
17402
16694
|
}
|
|
17403
16695
|
try {
|
|
17404
|
-
const summaryStat = await
|
|
17405
|
-
const content = await
|
|
16696
|
+
const summaryStat = await fs14.stat(summaryPath);
|
|
16697
|
+
const content = await fs14.readFile(summaryPath, "utf-8");
|
|
17406
16698
|
const summaryFingerprint = buildSummaryFingerprint(summaryStat);
|
|
17407
16699
|
const timestampMatch = content.match(/\*\*Update time\*\*: (.+)/);
|
|
17408
16700
|
const timestamp = timestampMatch ? timestampMatch[1] : (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -17470,9 +16762,9 @@ __name(getProjectSummaryInfo, "getProjectSummaryInfo");
|
|
|
17470
16762
|
|
|
17471
16763
|
// packages/core/src/tools/readManyFiles.ts
|
|
17472
16764
|
init_esbuild_shims();
|
|
17473
|
-
import * as
|
|
16765
|
+
import * as fs15 from "node:fs";
|
|
17474
16766
|
import * as os2 from "node:os";
|
|
17475
|
-
import * as
|
|
16767
|
+
import * as path18 from "node:path";
|
|
17476
16768
|
var DEFAULT_OUTPUT_HEADER = "\n--- Content from referenced files ---";
|
|
17477
16769
|
var DEFAULT_OUTPUT_TERMINATOR = "\n--- End of content ---";
|
|
17478
16770
|
var SNAPSHOT_MAX_SIZE_BYTES = 100 * 1024 * 1024;
|
|
@@ -17492,7 +16784,7 @@ async function readManyFiles(config, options) {
|
|
|
17492
16784
|
for (const rawPattern of inputPatterns) {
|
|
17493
16785
|
signal?.throwIfAborted();
|
|
17494
16786
|
const normalizedPattern = rawPattern.replace(/\\/g, "/");
|
|
17495
|
-
const fullPath =
|
|
16787
|
+
const fullPath = path18.resolve(projectRoot, normalizedPattern);
|
|
17496
16788
|
const displayPath = displayPaths?.get(fullPath) ?? fullPath;
|
|
17497
16789
|
const validatedIdentity = validatedPathIdentities?.get(fullPath);
|
|
17498
16790
|
if (validatedPathIdentities && !validatedIdentity) continue;
|
|
@@ -17511,7 +16803,7 @@ async function readManyFiles(config, options) {
|
|
|
17511
16803
|
if (validatedIdentity && !await matchesValidatedPathIdentity(fullPath, validatedIdentity)) {
|
|
17512
16804
|
continue;
|
|
17513
16805
|
}
|
|
17514
|
-
const stats =
|
|
16806
|
+
const stats = fs15.existsSync(fullPath) ? fs15.statSync(fullPath) : null;
|
|
17515
16807
|
if (stats?.isDirectory()) {
|
|
17516
16808
|
const { contentParts: dirParts, info } = await readDirectory(
|
|
17517
16809
|
config,
|
|
@@ -17631,9 +16923,9 @@ async function readValidatedTextFileContent(config, filePath, expected, preserve
|
|
|
17631
16923
|
__name(readValidatedTextFileContent, "readValidatedTextFileContent");
|
|
17632
16924
|
async function matchesValidatedPathIdentity(filePath, expected) {
|
|
17633
16925
|
try {
|
|
17634
|
-
const canonicalPath = await
|
|
16926
|
+
const canonicalPath = await fs15.promises.realpath(filePath);
|
|
17635
16927
|
if (canonicalPath !== filePath) return false;
|
|
17636
|
-
const stats = await
|
|
16928
|
+
const stats = await fs15.promises.stat(canonicalPath);
|
|
17637
16929
|
return statsMatchValidatedIdentity(stats, expected);
|
|
17638
16930
|
} catch {
|
|
17639
16931
|
return false;
|
|
@@ -17662,13 +16954,13 @@ async function snapshotValidatedFile(filePath, expected, signal) {
|
|
|
17662
16954
|
if (stats.size > SNAPSHOT_MAX_SIZE_BYTES) {
|
|
17663
16955
|
return void 0;
|
|
17664
16956
|
}
|
|
17665
|
-
snapshotDir = await
|
|
17666
|
-
|
|
16957
|
+
snapshotDir = await fs15.promises.mkdtemp(
|
|
16958
|
+
path18.join(os2.tmpdir(), "qwen-validated-read-")
|
|
17667
16959
|
);
|
|
17668
|
-
const snapshotPath =
|
|
17669
|
-
const target = await
|
|
16960
|
+
const snapshotPath = path18.join(snapshotDir, path18.basename(filePath));
|
|
16961
|
+
const target = await fs15.promises.open(
|
|
17670
16962
|
snapshotPath,
|
|
17671
|
-
|
|
16963
|
+
fs15.constants.O_WRONLY | fs15.constants.O_CREAT | fs15.constants.O_EXCL,
|
|
17672
16964
|
384
|
|
17673
16965
|
);
|
|
17674
16966
|
try {
|
|
@@ -17709,7 +17001,7 @@ async function snapshotValidatedFile(filePath, expected, signal) {
|
|
|
17709
17001
|
result = {
|
|
17710
17002
|
filePath: snapshotPath,
|
|
17711
17003
|
stats,
|
|
17712
|
-
cleanup: /* @__PURE__ */ __name(() =>
|
|
17004
|
+
cleanup: /* @__PURE__ */ __name(() => fs15.promises.rm(snapshotDir, { recursive: true, force: true }), "cleanup")
|
|
17713
17005
|
};
|
|
17714
17006
|
return result;
|
|
17715
17007
|
} finally {
|
|
@@ -17721,7 +17013,7 @@ async function snapshotValidatedFile(filePath, expected, signal) {
|
|
|
17721
17013
|
return void 0;
|
|
17722
17014
|
} finally {
|
|
17723
17015
|
if (snapshotDir && !result) {
|
|
17724
|
-
await
|
|
17016
|
+
await fs15.promises.rm(snapshotDir, { recursive: true, force: true });
|
|
17725
17017
|
}
|
|
17726
17018
|
}
|
|
17727
17019
|
}
|
|
@@ -17943,23 +17235,9 @@ export {
|
|
|
17943
17235
|
acceptSpeculation,
|
|
17944
17236
|
abortSpeculation,
|
|
17945
17237
|
loadIgnoreRules,
|
|
17238
|
+
Fzf,
|
|
17946
17239
|
AsyncFzf,
|
|
17947
17240
|
FileSearchFactory,
|
|
17948
|
-
isValidRefName,
|
|
17949
|
-
resolveBranchName,
|
|
17950
|
-
watchRepoBranch,
|
|
17951
|
-
gitEnv,
|
|
17952
|
-
fetchGitBranches,
|
|
17953
|
-
isValidCheckoutRef,
|
|
17954
|
-
gitCheckout,
|
|
17955
|
-
gitCreateBranch,
|
|
17956
|
-
gitPush,
|
|
17957
|
-
gitPull,
|
|
17958
|
-
gitCommit,
|
|
17959
|
-
GITHUB_PR_ERROR_MESSAGE_MAX,
|
|
17960
|
-
fetchGitHubPullRequests,
|
|
17961
|
-
createGitHubPullRequest,
|
|
17962
|
-
getDefaultBranch,
|
|
17963
17241
|
analyzeToolResultRetention,
|
|
17964
17242
|
readPathFromWorkspace,
|
|
17965
17243
|
getWelcomeBackState,
|