@qwen-code/qwen-code 0.21.13 → 0.21.14-nightly.20260822.7a4566cb3b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled/qc-helper/docs/configuration/settings.md +15 -7
- package/bundled/qc-helper/docs/extension/introduction.md +2 -0
- package/bundled/qc-helper/docs/features/_meta.ts +1 -0
- package/bundled/qc-helper/docs/features/channels/dingtalk.md +1 -1
- package/bundled/qc-helper/docs/features/code-review.md +25 -3
- package/bundled/qc-helper/docs/features/commands.md +120 -8
- package/bundled/qc-helper/docs/features/markdown-rendering.md +6 -0
- package/bundled/qc-helper/docs/features/sub-agents.md +3 -3
- package/bundled/qc-helper/docs/features/terminal-images.md +50 -0
- package/bundled/qc-helper/docs/qwen-serve-deploy-local.md +1 -1
- package/bundled/qc-helper/docs/qwen-serve.md +21 -4
- package/bundled/review/SKILL.md +113 -62
- package/chunks/MaxSizedBox-NCWYES5B.js +98 -0
- package/chunks/{StandaloneSessionPicker-KEGXNUG6.js → StandaloneSessionPicker-A4V4F64Y.js} +80 -79
- package/chunks/{acp-startup-profiler-NMDXYGDN.js → acp-startup-profiler-DDVSJKJK.js} +2 -2
- package/chunks/{acpAgent-XPES32S7.js → acpAgent-YYRH7HTQ.js} +1094 -278
- package/chunks/{agent-DPTOZFEM.js → agent-NEM254CJ.js} +52 -51
- package/chunks/agent-headless-AVFYIRPV.js +88 -0
- package/chunks/{anthropicContentGenerator-G7BVXTKN.js → anthropicContentGenerator-IWFTSBSV.js} +25 -25
- package/chunks/{artifact-tool-GEXTOPVO.js → artifact-tool-SBXMTVCB.js} +3 -3
- package/chunks/{askUserQuestion-B33XRSB7.js → askUserQuestion-KEQJRFD6.js} +3 -3
- package/chunks/{bridge-YNQBAA4Z.js → bridge-2CGOUO25.js} +59 -57
- package/chunks/{ca-4CQ6MYNQ.js → ca-SLZJD6QH.js} +8 -0
- package/chunks/{channel-management-service-GWY2GAIC.js → channel-management-service-FUJ2EFTF.js} +1 -1
- package/chunks/channel-settings-store-AZKNHHDC.js +103 -0
- package/chunks/{channel-worker-group-7LXCMZ77.js → channel-worker-group-CTE54QL6.js} +8 -7
- package/chunks/{channel-worker-manager-RYEME4ZZ.js → channel-worker-manager-4EHTD3T4.js} +8 -7
- package/chunks/{channel-worker-supervisor-OEVWBHGT.js → channel-worker-supervisor-F6I6WSWW.js} +6 -5
- package/chunks/{chunk-KD5BOPLP.js → chunk-2G4QF4VI.js} +125 -31
- package/chunks/{chunk-BHILXOC3.js → chunk-2MTIAN5Z.js} +3 -3
- package/chunks/{chunk-A4QRWUDE.js → chunk-2NWPB6T4.js} +6 -6
- package/chunks/{chunk-KV27IEHM.js → chunk-2TRNCJK4.js} +1 -1
- package/chunks/{chunk-EL5SXY3T.js → chunk-32CHFLGV.js} +198 -23
- package/chunks/{chunk-5CVO7YES.js → chunk-36OF5PRW.js} +1 -1
- package/chunks/{chunk-X26JYGTD.js → chunk-37BZSWEV.js} +1 -1
- package/chunks/{chunk-WFSTRPRO.js → chunk-3CLIDIVQ.js} +3 -3
- package/chunks/{chunk-A267JX7H.js → chunk-3HWN4E7N.js} +18 -18
- package/chunks/{chunk-ZYYTZUI2.js → chunk-3LYGXZ2H.js} +3 -3
- package/chunks/chunk-3SIGAHUX.js +3969 -0
- package/chunks/{chunk-BVJS5BSP.js → chunk-3XD4PT3B.js} +1 -1
- package/chunks/{chunk-6QFDQMQX.js → chunk-3ZFJUBTP.js} +1 -1
- package/chunks/{chunk-HUTNYWBG.js → chunk-45UD2TU4.js} +19 -11
- package/chunks/{chunk-4W5U2TUT.js → chunk-4F5WV4RF.js} +4 -4
- package/chunks/{chunk-I3G5JWBV.js → chunk-4GP3MNQ2.js} +2695 -1524
- package/chunks/{chunk-V26NVGAU.js → chunk-4MIDDJLJ.js} +8 -3
- package/chunks/{chunk-TS6625XH.js → chunk-5MK45KZ3.js} +9 -5
- package/chunks/{chunk-V57QC6WW.js → chunk-5OTMZVPL.js} +11 -9
- package/chunks/{chunk-MC4TLKEI.js → chunk-5PHLBWBL.js} +3 -3
- package/chunks/chunk-64LXOKG4.js +367 -0
- package/chunks/{chunk-6HY6IF3Z.js → chunk-6NFAEG54.js} +22 -2
- package/chunks/{chunk-TIGA2IVL.js → chunk-6NJIPX6W.js} +10 -298
- package/chunks/{chunk-MRMJCLIY.js → chunk-6RB2S4QP.js} +3 -3
- package/chunks/chunk-6S2OXVJT.js +369 -0
- package/chunks/{chunk-O4D7SPJN.js → chunk-6U46RZ25.js} +3 -3
- package/chunks/{chunk-JOOFMXGF.js → chunk-6UDHEIUT.js} +6 -6
- package/chunks/{chunk-VOQXFAY5.js → chunk-74TONY4F.js} +286 -0
- package/chunks/{chunk-LJQAUZMR.js → chunk-7CPJMZVJ.js} +1627 -180
- package/chunks/{chunk-T3CHYWJZ.js → chunk-7E7UCJHS.js} +100 -4
- package/chunks/{chunk-YZHRN3CF.js → chunk-7IV52LTO.js} +2 -2
- package/chunks/{chunk-4PKCUT7F.js → chunk-7JDGSJQH.js} +7 -7
- package/chunks/{chunk-GO7STP6N.js → chunk-7VITNOH6.js} +4 -4
- package/chunks/{chunk-CU6GJD55.js → chunk-7WLFSDLG.js} +1 -1
- package/chunks/{chunk-4WKAA4KS.js → chunk-A4N4FTMH.js} +1 -11
- package/chunks/{chunk-BUQDLC2G.js → chunk-A5F2YNO6.js} +3 -3
- package/chunks/{chunk-OY5RNSV4.js → chunk-AGCLK4G7.js} +3 -3
- package/chunks/{chunk-IA2K2HJE.js → chunk-AP3B7LKD.js} +2 -2
- package/chunks/{chunk-Y3YCSWG5.js → chunk-AZF6SME3.js} +2 -2
- package/chunks/{chunk-QFJ5JHQR.js → chunk-C72BXMJ5.js} +1 -1
- package/chunks/chunk-CETB5XY4.js +3654 -0
- package/chunks/{chunk-AA2BEKV3.js → chunk-CTAP6PO3.js} +3 -3
- package/chunks/{chunk-MS7GNABG.js → chunk-CXJHQVEK.js} +8 -0
- package/chunks/{chunk-QF2NHSPB.js → chunk-D534POS2.js} +274 -225
- package/chunks/{chunk-UKMR3CKV.js → chunk-D7QQ6RUB.js} +24 -9
- package/chunks/{chunk-DXIBNLBZ.js → chunk-DB2OKNTU.js} +2 -2
- package/chunks/{chunk-DGZEMW5R.js → chunk-DJEHYM4H.js} +3 -3
- package/chunks/{chunk-O565M6A4.js → chunk-DRVS6K7A.js} +260 -16
- package/chunks/{chunk-U3VNBPUO.js → chunk-DV4375RD.js} +5 -5
- package/chunks/{chunk-OXCMMLED.js → chunk-E63A23D7.js} +3 -3
- package/chunks/{chunk-4NFY2S7N.js → chunk-E7REAOTN.js} +15 -0
- package/chunks/{chunk-6ORZ2EDC.js → chunk-EW2IQ3ID.js} +3 -3
- package/chunks/{chunk-DGK6P3BQ.js → chunk-EXVK5R7X.js} +13 -13
- package/chunks/{chunk-NWNEANAT.js → chunk-FOGQO4FG.js} +953 -660
- package/chunks/{chunk-3U3VAL47.js → chunk-FV6PXZRO.js} +1 -1
- package/chunks/{chunk-76J3IJ3M.js → chunk-FX5TGHDE.js} +8 -8
- package/chunks/{chunk-QIH2HAEN.js → chunk-GXG4PYQB.js} +1 -1
- package/chunks/{chunk-FDGGZIYW.js → chunk-HDKCKCYO.js} +3 -3
- package/chunks/{chunk-RIAABG2K.js → chunk-HERHU33B.js} +2 -2
- package/chunks/{chunk-ZYBBISBY.js → chunk-HETN3NE2.js} +18 -15
- package/chunks/{chunk-XIT3GURH.js → chunk-HGBACZGD.js} +3 -3
- package/chunks/{chunk-UZPM4XHR.js → chunk-HGH7DXNI.js} +29 -8
- package/chunks/{chunk-CHHABXPE.js → chunk-HIK2OF33.js} +1 -1
- package/chunks/{chunk-FC4KQFCS.js → chunk-HMJ2P3SV.js} +1 -1
- package/chunks/chunk-HRVMTN37.js +26 -0
- package/chunks/{chunk-PQ36L4F5.js → chunk-HZZGYJIP.js} +1 -1
- package/chunks/{chunk-PT4I7NBA.js → chunk-I432KXWD.js} +1 -1
- package/chunks/{chunk-3EZLLVDF.js → chunk-IBJ5S45N.js} +3 -3
- package/chunks/{chunk-A4MFR4C5.js → chunk-IO257NUD.js} +3 -5
- package/chunks/{chunk-MIPFDQAF.js → chunk-ISJMN3ML.js} +1 -1
- package/chunks/chunk-IWOWEENB.js +9169 -0
- package/chunks/{chunk-XHRY7BXD.js → chunk-J6SIP2IT.js} +4 -4
- package/chunks/{chunk-OD2WU5QY.js → chunk-J7JQXYVL.js} +1 -1
- package/chunks/{chunk-NEFOOD54.js → chunk-J7VPB2HF.js} +4 -4
- package/chunks/{chunk-P7MPQI75.js → chunk-JGUBDRBC.js} +2 -2
- package/chunks/{chunk-SXCOEJO4.js → chunk-JOLJTKIG.js} +1 -1
- package/chunks/{chunk-NTTBXH7U.js → chunk-JS73NNWF.js} +8 -0
- package/chunks/{chunk-QRCNA3SR.js → chunk-JXLPQTMW.js} +50 -70
- package/chunks/{chunk-NNHNLJ2X.js → chunk-K2MSGB3W.js} +317 -72
- package/chunks/{chunk-KBXKR5R2.js → chunk-K52PZNU4.js} +1 -1
- package/chunks/{chunk-OOQUVWIG.js → chunk-K5OIW3I7.js} +4 -4
- package/chunks/{chunk-SOORFWKY.js → chunk-KSPRQSB4.js} +1 -1
- package/chunks/{chunk-WSH6GRKG.js → chunk-KVGR4MCF.js} +3 -3
- package/chunks/{chunk-6YKYPVDV.js → chunk-LC5M7YVE.js} +4 -4
- package/chunks/{chunk-M6NDLY2T.js → chunk-LD5VIJ7S.js} +1 -1
- package/chunks/{chunk-OMLJNPBE.js → chunk-LDGWX737.js} +84 -4
- package/chunks/{chunk-FAAUPSY2.js → chunk-LI4YHTQK.js} +1 -1
- package/chunks/{chunk-CXAOG665.js → chunk-LIKIJAUH.js} +2 -2
- package/chunks/chunk-LJZSMWOH.js +18 -0
- package/chunks/{chunk-BKPPWD33.js → chunk-M2IL2RTA.js} +22 -2
- package/chunks/{chunk-N5YPT6PH.js → chunk-MHOY756Q.js} +25 -13
- package/chunks/{chunk-YP5KH5Y7.js → chunk-ND7NOI4P.js} +1 -1
- package/chunks/{chunk-AW4TRXOC.js → chunk-NP2LV67M.js} +1 -1
- package/chunks/{chunk-GGDBMYGZ.js → chunk-NQB52P65.js} +5 -5
- package/chunks/{chunk-E3DYKPYZ.js → chunk-NUGZAFR2.js} +3 -3
- package/chunks/{chunk-GMIEIY3Y.js → chunk-O5BDEWBC.js} +3 -3
- package/chunks/{chunk-GDXET5XU.js → chunk-O5Z7EB6Y.js} +3 -3
- package/chunks/{chunk-5EYKMUUY.js → chunk-OTXXOZKW.js} +1 -1
- package/chunks/{chunk-M732YJPW.js → chunk-PALTIYXB.js} +6 -6
- package/chunks/{chunk-7UXUJ5T3.js → chunk-PLECQWDB.js} +1 -1
- package/chunks/{chunk-MLPXSYXR.js → chunk-PMIKPGDF.js} +66 -32
- package/chunks/{chunk-IWPYVAO2.js → chunk-PSQJ24ZZ.js} +3 -3
- package/chunks/{chunk-CPHEPGAO.js → chunk-PZRUV52H.js} +2 -2
- package/chunks/{chunk-PP4FUZNV.js → chunk-Q7RPLE33.js} +2 -2
- package/chunks/{chunk-S5DWMTHO.js → chunk-QQUVPMMZ.js} +2 -0
- package/chunks/{chunk-JUEPY766.js → chunk-RNGTMHKN.js} +3 -3
- package/chunks/{chunk-TUGSVUJB.js → chunk-ROV6B34L.js} +6 -6
- package/chunks/{chunk-RVOJ2FBP.js → chunk-RPJOOK6N.js} +1576 -10633
- package/chunks/{chunk-AXN7UPYQ.js → chunk-RQJJZQOH.js} +2 -2
- package/chunks/{chunk-AFSG32D5.js → chunk-RRRCWDFO.js} +1 -1
- package/chunks/{chunk-2M55OBEB.js → chunk-S3G6YFQC.js} +1 -1
- package/chunks/{chunk-4S5337WV.js → chunk-SVU5KGR7.js} +6527 -3314
- package/chunks/chunk-TBVSALA3.js +1109 -0
- package/chunks/{chunk-QUGAUQGJ.js → chunk-TBWQLLFO.js} +2 -0
- package/chunks/{chunk-AS5IN4GK.js → chunk-THK3QUU6.js} +5 -5
- package/chunks/{chunk-JNDY2MDR.js → chunk-TLDZKNZP.js} +1 -1
- package/chunks/{chunk-ZZO74WKW.js → chunk-TNAIZBPQ.js} +115 -28
- package/chunks/{chunk-3Z43GZUQ.js → chunk-TXASDT2M.js} +1 -1
- package/chunks/{chunk-CZBYX5MY.js → chunk-U53XZHAE.js} +1 -1
- package/chunks/{chunk-HIBNSEJE.js → chunk-UDG5EZJI.js} +0 -2
- package/chunks/{chunk-QNQAPSN2.js → chunk-URN2JIAQ.js} +4 -1
- package/chunks/{chunk-EZ5RP345.js → chunk-UYQTX2P6.js} +44 -13
- package/chunks/{chunk-BZ263IKX.js → chunk-UZPYR3EV.js} +1 -1
- package/chunks/{chunk-YZOSNW4R.js → chunk-VFACN2CE.js} +1 -1
- package/chunks/{chunk-RWDNJBWN.js → chunk-VLRBJ24J.js} +2 -2
- package/chunks/{chunk-NHDR76JX.js → chunk-VMJL7RH6.js} +4 -4
- package/chunks/{chunk-E23IPNGS.js → chunk-VOTDAZR7.js} +35 -6
- package/chunks/{chunk-XLLKYULU.js → chunk-VSNPOSDN.js} +2 -2
- package/chunks/{chunk-25EYDK42.js → chunk-VUMLT7E5.js} +2 -2
- package/chunks/{chunk-H4A72DE5.js → chunk-W4CRPSC5.js} +1 -1
- package/chunks/{chunk-NM5V5OVW.js → chunk-WJJYJVQE.js} +3 -3
- package/chunks/{chunk-ROIYNTHJ.js → chunk-WRT324N6.js} +3 -3
- package/chunks/chunk-WZAD4ZNJ.js +59 -0
- package/chunks/{chunk-SG7ZP5PG.js → chunk-WZDM44SB.js} +4 -4
- package/chunks/{chunk-JE7KQ2UP.js → chunk-XIQ5HQ2F.js} +469 -77
- package/chunks/{chunk-QV5YN5YD.js → chunk-XJOHLP2A.js} +5 -5
- package/chunks/{chunk-XUJNK7Y6.js → chunk-XL5K4SVK.js} +1 -1
- package/chunks/{chunk-CKSJECTU.js → chunk-XZJKSETB.js} +9 -5
- package/chunks/{chunk-YEYY7TEP.js → chunk-Y2FEAXLP.js} +7 -7
- package/chunks/{chunk-2B2BF7P7.js → chunk-YDJRMQU4.js} +3 -3
- package/chunks/{chunk-46UV252V.js → chunk-YHC2EYYG.js} +35 -38
- package/chunks/{chunk-OVZPVYZB.js → chunk-YMVFIYHV.js} +96 -18
- package/chunks/{chunk-WGHHA7ZH.js → chunk-Z3JMO2CH.js} +1 -1
- package/chunks/{chunk-MA2HEDVP.js → chunk-ZRYQMWEP.js} +3 -3
- package/chunks/{chunk-IGGGG5CX.js → chunk-ZTAT23TL.js} +15948 -10201
- package/chunks/{computer-use-77C5FHMW.js → computer-use-H2T7IFYX.js} +55 -54
- package/chunks/{config-utils-IVHRSXWI.js → config-utils-3DY73VIJ.js} +2 -2
- package/chunks/contextCommand-5AAZFFFV.js +94 -0
- package/chunks/{core-runtime-7VMIKUTG.js → core-runtime-JWFNKO2S.js} +57 -55
- package/chunks/{create-sub-session-2L5MQRN4.js → create-sub-session-33HIYIJE.js} +58 -56
- package/chunks/{create-sub-session-KRQULJE6.js → create-sub-session-XBCVGNFU.js} +6 -4
- package/chunks/{cron-create-H7UEPDSN.js → cron-create-IKA56DAF.js} +5 -5
- package/chunks/{cron-delete-6SZK7YFM.js → cron-delete-K5Q62EGH.js} +5 -5
- package/chunks/{cron-list-H25JIHEZ.js → cron-list-QBFGAMP7.js} +5 -5
- package/chunks/{daemon-2KTG7ZBN.js → daemon-NNCQ3HWT.js} +806 -147
- package/chunks/{daemon-git-worktree-guard-DXYIMWFT.js → daemon-git-worktree-guard-6233JAPJ.js} +54 -53
- package/chunks/daemon-status-provider-3EI2KALQ.js +104 -0
- package/chunks/daemon-trust-policy-QWWU7CON.js +100 -0
- package/chunks/{daemon-trust-policy-monitor-RYYGCQ3J.js → daemon-trust-policy-monitor-FH7GBAKN.js} +60 -59
- package/chunks/{de-UBEBKG6V.js → de-AH4LGCF5.js} +8 -0
- package/chunks/{deferred-core-runtime-3SGXFXEQ.js → deferred-core-runtime-EDUZQRME.js} +52 -51
- package/chunks/{discovery-ORA5J7YP.js → discovery-X2NV535U.js} +1 -1
- package/chunks/{display-image-ON3EYFRD.js → display-image-OEJMJV3S.js} +5 -5
- package/chunks/{dist-YEPL4RAW.js → dist-5EV2G6MC.js} +2 -3
- package/chunks/{dist-MAQXAQ2Y.js → dist-EQ3Q5XHX.js} +45337 -32756
- package/chunks/{dist-WJ4BHIEW.js → dist-ESS34DHC.js} +72 -0
- package/chunks/{dist-JWMKPWT5.js → dist-EUOUPUFO.js} +3 -4
- package/chunks/{dist-IYYN3RUT.js → dist-UOFRXJT6.js} +2798 -1250
- package/chunks/{earlyInputCapture-KJMLFVQV.js → earlyInputCapture-VSP42LUR.js} +53 -52
- package/chunks/{edit-I4LQFAEC.js → edit-ZTLO5ASX.js} +60 -58
- package/chunks/{en-X6YV7GME.js → en-MD3GP5YL.js} +8 -0
- package/chunks/{enter-worktree-YNPOJSRH.js → enter-worktree-TMTPDS2S.js} +55 -54
- package/chunks/{enterPlanMode-XCPK62ER.js → enterPlanMode-UBAXFMYI.js} +55 -54
- package/chunks/{environment-S7CTIHMX.js → environment-C2CZN7CB.js} +55 -54
- package/chunks/{errors-7HB2AIDS.js → errors-ZUNFQINF.js} +54 -53
- package/chunks/{exit-worktree-AIIY7SR6.js → exit-worktree-572NWEPJ.js} +55 -54
- package/chunks/exitPlanMode-QTIXFGZT.js +86 -0
- package/chunks/{fast-path-NDJV3ZFJ.js → fast-path-CEEVHQL3.js} +3 -3
- package/chunks/{fast-path-settings-LNOFM2YP.js → fast-path-settings-WHX3J3ZI.js} +2 -2
- package/chunks/{fr-VENTC2BS.js → fr-ZEML2JWS.js} +8 -0
- package/chunks/{gemini-RSUFP5OE.js → gemini-I2YR6GMS.js} +114 -112
- package/chunks/{geminiContentGenerator-SQ5XBPZ7.js → geminiContentGenerator-GQWNDZQF.js} +7 -7
- package/chunks/getMachineId-bsd-FBOAYNSY.js +48 -0
- package/chunks/{getMachineId-bsd-FG7IUY6U.js → getMachineId-bsd-YH7RURBZ.js} +4 -4
- package/chunks/{getMachineId-darwin-GLCJI2RA.js → getMachineId-darwin-H6USQYNI.js} +4 -4
- package/chunks/getMachineId-darwin-RNJLJUXY.js +47 -0
- package/chunks/{getMachineId-linux-O6OPPAKO.js → getMachineId-linux-HF2N63ET.js} +3 -3
- package/chunks/getMachineId-linux-UEVRAIAB.js +41 -0
- package/chunks/getMachineId-unsupported-FWXYJ7HW.js +31 -0
- package/chunks/{getMachineId-unsupported-S6CKYVGC.js → getMachineId-unsupported-NYA5DXRB.js} +3 -3
- package/chunks/getMachineId-win-LRVGMHLW.js +50 -0
- package/chunks/{getMachineId-win-X5SRNEH7.js → getMachineId-win-SMEGY2DW.js} +4 -4
- package/chunks/{glob-J4RUJAHX.js → glob-XFBL2RVT.js} +58 -57
- package/chunks/{goal-tools-VHTNVOKK.js → goal-tools-TLJCE7YZ.js} +6 -6
- package/chunks/{grep-VJWPLFOT.js → grep-U675LEXE.js} +55 -54
- package/chunks/handleAutoUpdate-R6RUCIA2.js +97 -0
- package/chunks/{i18n-RM5YOICI.js → i18n-SJCZDZ4C.js} +53 -52
- package/chunks/{image-gen-EXECB5XM.js → image-gen-6VY7CA7C.js} +14 -14
- package/chunks/initializer-CRDZXJOG.js +101 -0
- package/chunks/installationInfo-EW3NEJDZ.js +95 -0
- package/chunks/{ja-QHT4EQTO.js → ja-UM5B2HMD.js} +8 -0
- package/chunks/{keychain-token-storage-3XFJ5ZB2.js → keychain-token-storage-MTFTAESK.js} +3 -3
- package/chunks/list-TZEMTXDH.js +104 -0
- package/chunks/{list-agents-OSVDFI6S.js → list-agents-43XUEXJV.js} +6 -6
- package/chunks/loadedSettingsAdapter-47DG424L.js +98 -0
- package/chunks/{loggingContentGenerator-WF4ZOJEZ.js → loggingContentGenerator-77C6O5VW.js} +31 -29
- package/chunks/{loop-wakeup-WQS6JYAG.js → loop-wakeup-E54KDUXC.js} +6 -6
- package/chunks/{ls-D3HUFHDP.js → ls-CGL2UC3H.js} +7 -7
- package/chunks/{lsp-3QDDJTCS.js → lsp-5IKUO5DX.js} +3 -3
- package/chunks/{managed-npm-update-E7IW6N7V.js → managed-npm-update-AJ5GZRUA.js} +53 -52
- package/chunks/mcp-AQK656Y4.js +98 -0
- package/chunks/{monitor-EE2UYMGE.js → monitor-UDZXKYT3.js} +55 -54
- package/chunks/nonInteractiveCli-6NC3NLZM.js +166 -0
- package/chunks/{notebook-edit-NTDY4QDU.js → notebook-edit-G6WZI2YT.js} +59 -57
- package/chunks/{openaiContentGenerator-YNFVJMRJ.js → openaiContentGenerator-IHVHP3VB.js} +32 -32
- package/chunks/{pidfile-4XSFLYBZ.js → pidfile-EBKS2HBK.js} +53 -52
- package/chunks/{processUtils-WDA2MJFD.js → processUtils-B7M35ZLR.js} +2 -2
- package/chunks/prompt-terminal-ledger-5JYOPOII.js +93 -0
- package/chunks/{pt-VL3I5RNY.js → pt-5BMJ3XYH.js} +8 -0
- package/chunks/{qwenContentGenerator-434M7QKY.js → qwenContentGenerator-WCJPPTED.js} +59 -58
- package/chunks/{qwenOAuth2-GMYZOO6A.js → qwenOAuth2-S2CLBSEZ.js} +10 -10
- package/chunks/read-file-WFM53FTW.js +33 -0
- package/chunks/{read-mcp-resource-XD54ZQMC.js → read-mcp-resource-XYES2B42.js} +3 -3
- package/chunks/{record-artifact-SEYFJEJF.js → record-artifact-W3IBTGL7.js} +10 -6
- package/chunks/{resumeHistoryUtils-EVG3WYK2.js → resumeHistoryUtils-CK4ZC6YO.js} +59 -58
- package/chunks/ripGrep-B3PBLEQ3.js +86 -0
- package/chunks/{ru-4RCKL4PY.js → ru-6GL66ORV.js} +8 -0
- package/chunks/{run-qwen-serve-3QSGRXAN.js → run-qwen-serve-DC5RXI6N.js} +537 -185
- package/chunks/{runtime-5MLLZ7DC.js → runtime-UVEETF54.js} +63 -62
- package/chunks/{scheduler-RPBJ63CH.js → scheduler-MWT3UMVN.js} +54 -53
- package/chunks/{sdk-exporters-grpc-54L4LS5L.js → sdk-exporters-grpc-6J5CKOMO.js} +194 -75
- package/chunks/{sdk-exporters-http-XUVP63H6.js → sdk-exporters-http-Q3YZ4752.js} +40 -45
- package/chunks/{sdk-impl-YXUEN2Z2.js → sdk-impl-BOMCAN2Z.js} +7211 -5454
- package/chunks/{send-message-VZENRWRH.js → send-message-J4VT46OI.js} +8 -8
- package/chunks/{serve-HS3XLPXU.js → serve-AKM75GTE.js} +60 -61
- package/chunks/{server-TC4A7AAZ.js → server-KU7XIDVT.js} +2221 -399
- package/chunks/{session-UBOFXVMN.js → session-DKVYIRWN.js} +108 -105
- package/chunks/{settings-D5644OM5.js → settings-NS3PXZDP.js} +63 -62
- package/chunks/{shell-3PZULQQV.js → shell-UXCNM2OK.js} +52 -51
- package/chunks/{skill-PEVVXQ3L.js → skill-KV7YCCTM.js} +30 -28
- package/chunks/{skill-settings-J65JKKES.js → skill-settings-EXW7ESWJ.js} +59 -58
- package/chunks/{spawnChannel-IYGXRHSQ.js → spawnChannel-FCP44P4V.js} +55 -54
- package/chunks/{standalone-update-IFM53PE7.js → standalone-update-RGW3B2DX.js} +55 -54
- package/chunks/{startInteractiveUI-3AVH7L6H.js → startInteractiveUI-UZMF2BIJ.js} +615 -392
- package/chunks/{syntheticOutput-7GWFIDXT.js → syntheticOutput-JAXMIMZP.js} +4 -4
- package/chunks/{task-create-FCBDX7UH.js → task-create-I2H322E4.js} +12 -12
- package/chunks/{task-list-YIYIUFUA.js → task-list-3OLIWFTQ.js} +21 -7
- package/chunks/{task-stop-X37KYTKB.js → task-stop-JAUY6MSY.js} +3 -3
- package/chunks/{task-update-MYPFVOVM.js → task-update-B3XO4CPI.js} +87 -16
- package/chunks/{team-create-ZAIA7KAV.js → team-create-77XY3KAE.js} +56 -56
- package/chunks/{team-delete-6UMU4XLS.js → team-delete-Q7GE7RRI.js} +6 -6
- package/chunks/{team-plan-approval-UNIUS7OD.js → team-plan-approval-TAQANDQG.js} +55 -54
- package/chunks/{terminal-image-renderer-G343P2RV.js → terminal-image-renderer-V4LIF5NS.js} +54 -53
- package/chunks/theme-manager-KKBAJ574.js +90 -0
- package/chunks/{todoWrite-U2R4NVF4.js → todoWrite-FJJTY2TI.js} +7 -7
- package/chunks/{tool-search-5R2OE4C7.js → tool-search-GZJYRK4I.js} +25 -24
- package/chunks/{total-session-admission-4KBHMQQ2.js → total-session-admission-NIBNWXHE.js} +59 -57
- package/chunks/{trustedFolders-LK6T4XC7.js → trustedFolders-7GEI2NYC.js} +53 -52
- package/chunks/{undici-PYHBDDPN.js → undici-S7WJSKGJ.js} +962 -391
- package/chunks/{update-relaunch-UBKROIC6.js → update-relaunch-OA3OEBMD.js} +5 -5
- package/chunks/{updateCheck-W4Y2GFSD.js → updateCheck-QVHQEVIY.js} +56 -55
- package/chunks/{useAutoAcceptIndicator-C7BEICBF.js → useAutoAcceptIndicator-WZ27J7NY.js} +64 -63
- package/chunks/{validateNonInterActiveAuth-LTEI2TB6.js → validateNonInterActiveAuth-OXJA2JWG.js} +99 -96
- package/chunks/{version-G5A5DGVS.js → version-KJO64WD7.js} +1 -1
- package/chunks/{web-fetch-RTEQTR5Z.js → web-fetch-CC5INI2R.js} +25 -23
- package/chunks/{web-search-5OXHEZPV.js → web-search-MOAUAN6N.js} +18 -18
- package/chunks/{web-shell-static-O73YPVVC.js → web-shell-static-3NUTRHAH.js} +4 -5
- package/chunks/{workflow-ISQJHPG2.js → workflow-BN2ZEJMK.js} +366 -105
- package/chunks/workspace-providers-status-R5QTZFK3.js +101 -0
- package/chunks/{workspace-registration-store-CYNY6IP6.js → workspace-registration-store-WMSLM36M.js} +1 -1
- package/chunks/{workspace-registry-34GTUUHB.js → workspace-registry-J3RUCXH6.js} +59 -57
- package/chunks/{workspace-service-XCDQLE2Y.js → workspace-service-JJZFPKM4.js} +66 -65
- package/chunks/workspace-skills-status-DRIOZRIA.js +101 -0
- package/chunks/{workspace-trust-reconciler-AYGXC7A3.js → workspace-trust-reconciler-YAYSN6CX.js} +69 -67
- package/chunks/write-file-7HXHFFOY.js +88 -0
- package/chunks/{zh-TW-SQ4HTSCW.js → zh-TW-LVLBK4KF.js} +8 -0
- package/chunks/{zh-LMSTK4WD.js → zh-UBMWS2BJ.js} +8 -0
- package/chunks/{zoom-image-4BFYJ3HG.js → zoom-image-EFMQMU4G.js} +24 -22
- package/cli.js +15 -15
- package/locales/ca.js +13 -0
- package/locales/de.js +12 -0
- package/locales/en.js +11 -0
- package/locales/fr.js +13 -0
- package/locales/ja.js +13 -0
- package/locales/pt.js +12 -0
- package/locales/ru.js +12 -0
- package/locales/zh-TW.js +11 -0
- package/locales/zh.js +11 -0
- package/package.json +3 -3
- package/web-shell/assets/{arc-CgOpDKvm.js → arc-BCP1f-bN.js} +1 -1
- package/web-shell/assets/{architectureDiagram-3BPJPVTR-0Ag_m34F.js → architectureDiagram-3BPJPVTR-D-6ajMay.js} +1 -1
- package/web-shell/assets/{blockDiagram-GPEHLZMM-IwTwFau0.js → blockDiagram-GPEHLZMM-CcLlnVnf.js} +1 -1
- package/web-shell/assets/{c4Diagram-AAUBKEIU-DLa5GUv8.js → c4Diagram-AAUBKEIU-C_Sp9UwQ.js} +1 -1
- package/web-shell/assets/channel-BcImYzbA.js +1 -0
- package/web-shell/assets/{chunk-2J33WTMH-DcYP-WFG.js → chunk-2J33WTMH-CG0ngvo9.js} +1 -1
- package/web-shell/assets/{chunk-4BX2VUAB-C8MVPMiQ.js → chunk-4BX2VUAB-D43LsVdk.js} +1 -1
- package/web-shell/assets/{chunk-55IACEB6-BUi4Yfv3.js → chunk-55IACEB6-BqNIn5rz.js} +1 -1
- package/web-shell/assets/{chunk-727SXJPM-Cy3Su2YY.js → chunk-727SXJPM-BSHmO08Y.js} +1 -1
- package/web-shell/assets/{chunk-AQP2D5EJ-Dp8Teqv6.js → chunk-AQP2D5EJ-CMUbr5tQ.js} +1 -1
- package/web-shell/assets/{chunk-FMBD7UC4-BDTDM-4j.js → chunk-FMBD7UC4-Cm6JflnZ.js} +1 -1
- package/web-shell/assets/{chunk-ND2GUHAM-7HfDt0r2.js → chunk-ND2GUHAM-CBR39YQZ.js} +1 -1
- package/web-shell/assets/{chunk-QZHKN3VN-BIBU0uCF.js → chunk-QZHKN3VN-CWnqaLb-.js} +1 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-OWx0rDRW.js +1 -0
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-OWx0rDRW.js +1 -0
- package/web-shell/assets/{cose-bilkent-S5V4N54A-DRLdcg9p.js → cose-bilkent-S5V4N54A-DJlTdnfD.js} +1 -1
- package/web-shell/assets/{dagre-BM42HDAG-DCCgDwqW.js → dagre-BM42HDAG-1AFN1uVc.js} +1 -1
- package/web-shell/assets/{diagram-2AECGRRQ-CsBTBmk3.js → diagram-2AECGRRQ-gC0GGNSW.js} +1 -1
- package/web-shell/assets/{diagram-5GNKFQAL-C9qjH8Lt.js → diagram-5GNKFQAL-CPmRPT1s.js} +1 -1
- package/web-shell/assets/{diagram-KO2AKTUF-Brjs_lj2.js → diagram-KO2AKTUF-atigp6Hr.js} +1 -1
- package/web-shell/assets/{diagram-LMA3HP47-DtiWCl_F.js → diagram-LMA3HP47-BJnJFSRQ.js} +1 -1
- package/web-shell/assets/{diagram-OG6HWLK6-DmfKLkBT.js → diagram-OG6HWLK6-CyvJ4fG2.js} +1 -1
- package/web-shell/assets/{erDiagram-TEJ5UH35-Bve_4deH.js → erDiagram-TEJ5UH35-CZac_jT6.js} +1 -1
- package/web-shell/assets/{flowDiagram-I6XJVG4X-C2_kXCcV.js → flowDiagram-I6XJVG4X-pd-LQxWB.js} +1 -1
- package/web-shell/assets/{ganttDiagram-6RSMTGT7-BSBIjiTF.js → ganttDiagram-6RSMTGT7-CvB1at7l.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-PVQCEYII-CyebwI55.js → gitGraphDiagram-PVQCEYII-B5Y6nkil.js} +1 -1
- package/web-shell/assets/index-Bg3DAn8Z.js +1788 -0
- package/web-shell/assets/{index-d0yfnV1M.js → index-Bj3ZSUHL.js} +1 -1
- package/web-shell/assets/index-mp32EO88.css +5 -0
- package/web-shell/assets/{infoDiagram-5YYISTIA-CSDGnWxU.js → infoDiagram-5YYISTIA-BdyWvU4P.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-BK4jU13p.js → ishikawaDiagram-YF4QCWOH-CaHbUdvN.js} +1 -1
- package/web-shell/assets/{journeyDiagram-JHISSGLW-D_W6j-oF.js → journeyDiagram-JHISSGLW-DR9F3FpG.js} +1 -1
- package/web-shell/assets/{kanban-definition-UN3LZRKU-C7xf-SdC.js → kanban-definition-UN3LZRKU-BoEUbkw2.js} +1 -1
- package/web-shell/assets/{linear-DQmzxpxd.js → linear-DUbfzV4T.js} +1 -1
- package/web-shell/assets/{mermaid.core-9P7AGOLG.js → mermaid.core-CLLkPcpD.js} +5 -5
- package/web-shell/assets/{mindmap-definition-RKZ34NQL-DgcgMyPk.js → mindmap-definition-RKZ34NQL-FuKI3Stt.js} +1 -1
- package/web-shell/assets/{pieDiagram-4H26LBE5-3wWGb9eG.js → pieDiagram-4H26LBE5-CVAHL7l5.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-W4KKPZXB-BeCXnQw9.js → quadrantDiagram-W4KKPZXB-BkGi5fRj.js} +1 -1
- package/web-shell/assets/{requirementDiagram-4Y6WPE33-Bi1UOHDz.js → requirementDiagram-4Y6WPE33-B5ghV8-K.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-5OEKKPKP-lrLUjjbb.js → sankeyDiagram-5OEKKPKP-CKFbVhkQ.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-3UESZ5HK-BFuqKz6Q.js → sequenceDiagram-3UESZ5HK-C5P9ujPd.js} +1 -1
- package/web-shell/assets/{stateDiagram-AJRCARHV-8DemQLhu.js → stateDiagram-AJRCARHV-CsDn-Rez.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-DpGKD1ez.js +1 -0
- package/web-shell/assets/{timeline-definition-PNZ67QCA-uzEuVQXg.js → timeline-definition-PNZ67QCA-B6oLBkTr.js} +1 -1
- package/web-shell/assets/{vennDiagram-CIIHVFJN-BQTeZ_-o.js → vennDiagram-CIIHVFJN-DvtBkYwp.js} +1 -1
- package/web-shell/assets/{wardley-L42UT6IY-B6yM5Im7.js → wardley-L42UT6IY-D2UwTX16.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-YWT4CUSO-ChM8bmgn.js → wardleyDiagram-YWT4CUSO-FnnfCxYI.js} +1 -1
- package/web-shell/assets/{xychartDiagram-2RQKCTM6-oNG6HyB1.js → xychartDiagram-2RQKCTM6-C1SaMQ7d.js} +1 -1
- package/web-shell/index.html +2 -2
- package/chunks/MaxSizedBox-UQALOVVT.js +0 -97
- package/chunks/agent-headless-GJCQMURW.js +0 -87
- package/chunks/channel-settings-store-WNWYFHG7.js +0 -102
- package/chunks/chunk-AZQ3DT76.js +0 -10017
- package/chunks/chunk-CR3C7WXL.js +0 -113
- package/chunks/chunk-K5IDV3PC.js +0 -519
- package/chunks/chunk-MPHPFVKK.js +0 -48
- package/chunks/chunk-RLKC46YT.js +0 -3582
- package/chunks/chunk-UPDOZBWO.js +0 -358
- package/chunks/contextCommand-PJ77GBWL.js +0 -93
- package/chunks/daemon-status-provider-ZDOYJCU6.js +0 -102
- package/chunks/daemon-trust-policy-E67OYUK2.js +0 -99
- package/chunks/exitPlanMode-R4JY7V2O.js +0 -85
- package/chunks/handleAutoUpdate-POCX2MNB.js +0 -94
- package/chunks/initializer-Z2AFGBNR.js +0 -100
- package/chunks/installationInfo-4I5FXNMH.js +0 -92
- package/chunks/list-ZMBFIGZA.js +0 -103
- package/chunks/loadedSettingsAdapter-T6TV4YJ7.js +0 -97
- package/chunks/mcp-6UNYX4HG.js +0 -97
- package/chunks/nonInteractiveCli-WAY237O4.js +0 -163
- package/chunks/read-file-TAFBKMNI.js +0 -32
- package/chunks/ripGrep-WOEK2PXS.js +0 -85
- package/chunks/theme-manager-Z3RIT7DB.js +0 -89
- package/chunks/undici-3FJYTMOF.js +0 -25914
- package/chunks/workspace-providers-status-2ZPZPUPZ.js +0 -100
- package/chunks/workspace-skills-status-RS4O7AIJ.js +0 -100
- package/chunks/write-file-EWXKVVXF.js +0 -87
- package/web-shell/assets/channel-BrGVBa2L.js +0 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-B5TUzJzI.js +0 -1
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-B5TUzJzI.js +0 -1
- package/web-shell/assets/index-CIDsgxTe.js +0 -1792
- package/web-shell/assets/index-DiQnWi_E.css +0 -5
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-DhM5ixYd.js +0 -1
- package/chunks/{dist-BROOP2EG.js → dist-LZO24N3E.js} +1 -1
|
@@ -0,0 +1,1109 @@
|
|
|
1
|
+
// Force strict mode and setup for ESM
|
|
2
|
+
"use strict";
|
|
3
|
+
import {
|
|
4
|
+
isWithinRoot
|
|
5
|
+
} from "./chunk-IWOWEENB.js";
|
|
6
|
+
import {
|
|
7
|
+
BaseDeclarativeTool,
|
|
8
|
+
BaseToolInvocation,
|
|
9
|
+
ToolDisplayNames,
|
|
10
|
+
ToolNames
|
|
11
|
+
} from "./chunk-6NFAEG54.js";
|
|
12
|
+
import {
|
|
13
|
+
isNodeError
|
|
14
|
+
} from "./chunk-A5F2YNO6.js";
|
|
15
|
+
import {
|
|
16
|
+
init_esbuild_shims
|
|
17
|
+
} from "./chunk-5O2XNYP6.js";
|
|
18
|
+
import {
|
|
19
|
+
__name
|
|
20
|
+
} from "./chunk-J2S4EL5Y.js";
|
|
21
|
+
|
|
22
|
+
// packages/core/src/tools/record-artifact.ts
|
|
23
|
+
init_esbuild_shims();
|
|
24
|
+
import { lstatSync, readlinkSync, realpathSync } from "node:fs";
|
|
25
|
+
import fs2 from "node:fs/promises";
|
|
26
|
+
import path3 from "node:path";
|
|
27
|
+
|
|
28
|
+
// packages/core/src/utils/workspace-artifact-directory.ts
|
|
29
|
+
init_esbuild_shims();
|
|
30
|
+
import { promises as fs } from "node:fs";
|
|
31
|
+
import path from "node:path";
|
|
32
|
+
var MAX_DIRECTORY_ARTIFACT_FILES = 100;
|
|
33
|
+
var MAX_DIRECTORY_ARTIFACT_DEPTH = 4;
|
|
34
|
+
var SKIP_DIRECTORY_ARTIFACT_NAMES = /* @__PURE__ */ new Set([
|
|
35
|
+
"node_modules",
|
|
36
|
+
".git",
|
|
37
|
+
"__pycache__",
|
|
38
|
+
"dist",
|
|
39
|
+
".qwen"
|
|
40
|
+
]);
|
|
41
|
+
var OFFICE_DOCUMENT_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
42
|
+
".doc",
|
|
43
|
+
".docx",
|
|
44
|
+
".docm",
|
|
45
|
+
".dotx",
|
|
46
|
+
".xls",
|
|
47
|
+
".xlsx",
|
|
48
|
+
".xlsm",
|
|
49
|
+
".xlsb",
|
|
50
|
+
".ppt",
|
|
51
|
+
".pptx",
|
|
52
|
+
".pptm",
|
|
53
|
+
".odt",
|
|
54
|
+
".ods",
|
|
55
|
+
".odp"
|
|
56
|
+
]);
|
|
57
|
+
function isOfficeDocumentExtension(ext) {
|
|
58
|
+
return OFFICE_DOCUMENT_EXTENSIONS.has(ext);
|
|
59
|
+
}
|
|
60
|
+
__name(isOfficeDocumentExtension, "isOfficeDocumentExtension");
|
|
61
|
+
function shouldSkipDirectoryArtifactName(name) {
|
|
62
|
+
return name.startsWith(".") || name.startsWith("~$") || SKIP_DIRECTORY_ARTIFACT_NAMES.has(name);
|
|
63
|
+
}
|
|
64
|
+
__name(shouldSkipDirectoryArtifactName, "shouldSkipDirectoryArtifactName");
|
|
65
|
+
var WORKTREE_ARTIFACT_PREFIX_RE = /^\.qwen\/worktrees\/[^/]+\//;
|
|
66
|
+
function stripWorktreeArtifactPrefix(workspacePath) {
|
|
67
|
+
return workspacePath.replace(WORKTREE_ARTIFACT_PREFIX_RE, "");
|
|
68
|
+
}
|
|
69
|
+
__name(stripWorktreeArtifactPrefix, "stripWorktreeArtifactPrefix");
|
|
70
|
+
function pathHasSkippedDirectoryComponent(workspacePath) {
|
|
71
|
+
return stripWorktreeArtifactPrefix(workspacePath).split("/").filter(Boolean).some((segment) => shouldSkipDirectoryArtifactName(segment));
|
|
72
|
+
}
|
|
73
|
+
__name(pathHasSkippedDirectoryComponent, "pathHasSkippedDirectoryComponent");
|
|
74
|
+
async function collectRecordableWorkspaceFiles(absoluteDir, relativeDir, realWorkspace, isRecordable) {
|
|
75
|
+
const files = [];
|
|
76
|
+
const walked = await walkRecordableWorkspaceFiles(
|
|
77
|
+
absoluteDir,
|
|
78
|
+
relativeDir,
|
|
79
|
+
realWorkspace,
|
|
80
|
+
files,
|
|
81
|
+
0,
|
|
82
|
+
isRecordable
|
|
83
|
+
);
|
|
84
|
+
return { files, ...walked };
|
|
85
|
+
}
|
|
86
|
+
__name(collectRecordableWorkspaceFiles, "collectRecordableWorkspaceFiles");
|
|
87
|
+
async function walkRecordableWorkspaceFiles(absoluteDir, relativeDir, realWorkspace, files, depth, isRecordable) {
|
|
88
|
+
if (files.length >= MAX_DIRECTORY_ARTIFACT_FILES) {
|
|
89
|
+
return {
|
|
90
|
+
truncated: true,
|
|
91
|
+
depthLimited: false,
|
|
92
|
+
unreadable: false,
|
|
93
|
+
skippedUnrecordable: 0
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
if (depth > MAX_DIRECTORY_ARTIFACT_DEPTH) {
|
|
97
|
+
return {
|
|
98
|
+
truncated: false,
|
|
99
|
+
depthLimited: await hasRecordableDescendant(
|
|
100
|
+
absoluteDir,
|
|
101
|
+
relativeDir,
|
|
102
|
+
8,
|
|
103
|
+
isRecordable
|
|
104
|
+
),
|
|
105
|
+
unreadable: false,
|
|
106
|
+
skippedUnrecordable: 0
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
let entries;
|
|
110
|
+
try {
|
|
111
|
+
entries = await fs.readdir(absoluteDir, { withFileTypes: true });
|
|
112
|
+
} catch (error) {
|
|
113
|
+
if (depth === 0) {
|
|
114
|
+
throw error;
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
truncated: false,
|
|
118
|
+
depthLimited: false,
|
|
119
|
+
unreadable: true,
|
|
120
|
+
skippedUnrecordable: 0
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
entries.sort(
|
|
124
|
+
(left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0
|
|
125
|
+
);
|
|
126
|
+
let truncated = false;
|
|
127
|
+
let depthLimited = false;
|
|
128
|
+
let unreadable = false;
|
|
129
|
+
let skippedUnrecordable = 0;
|
|
130
|
+
for (const entry of entries) {
|
|
131
|
+
if (files.length >= MAX_DIRECTORY_ARTIFACT_FILES) {
|
|
132
|
+
return { truncated: true, depthLimited, unreadable, skippedUnrecordable };
|
|
133
|
+
}
|
|
134
|
+
if (entry.isSymbolicLink()) {
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
const relativePath = relativeDir ? `${relativeDir}/${entry.name}` : entry.name;
|
|
138
|
+
const absolutePath = path.join(absoluteDir, entry.name);
|
|
139
|
+
const relativeToWorkspace = path.relative(realWorkspace, absolutePath);
|
|
140
|
+
if (!relativeToWorkspace || isOutsidePath(relativeToWorkspace)) {
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
if (entry.isDirectory()) {
|
|
144
|
+
if (shouldSkipDirectoryArtifactName(entry.name)) {
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
const nested = await walkRecordableWorkspaceFiles(
|
|
148
|
+
absolutePath,
|
|
149
|
+
relativePath,
|
|
150
|
+
realWorkspace,
|
|
151
|
+
files,
|
|
152
|
+
depth + 1,
|
|
153
|
+
isRecordable
|
|
154
|
+
);
|
|
155
|
+
truncated ||= nested.truncated;
|
|
156
|
+
depthLimited ||= nested.depthLimited;
|
|
157
|
+
unreadable ||= nested.unreadable;
|
|
158
|
+
skippedUnrecordable += nested.skippedUnrecordable;
|
|
159
|
+
if (truncated && files.length >= MAX_DIRECTORY_ARTIFACT_FILES) {
|
|
160
|
+
return {
|
|
161
|
+
truncated: true,
|
|
162
|
+
depthLimited,
|
|
163
|
+
unreadable,
|
|
164
|
+
skippedUnrecordable
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
if (entry.isFile()) {
|
|
170
|
+
if (entry.name.startsWith(".") || entry.name.startsWith("~$")) {
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
if (isRecordable && !isRecordable(relativePath)) {
|
|
174
|
+
skippedUnrecordable++;
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
files.push(relativePath);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return { truncated, depthLimited, unreadable, skippedUnrecordable };
|
|
181
|
+
}
|
|
182
|
+
__name(walkRecordableWorkspaceFiles, "walkRecordableWorkspaceFiles");
|
|
183
|
+
async function hasRecordableDescendant(absoluteDir, relativeDir, remainingDepth, isRecordable) {
|
|
184
|
+
if (remainingDepth < 0) {
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
let entries;
|
|
188
|
+
try {
|
|
189
|
+
entries = await fs.readdir(absoluteDir, { withFileTypes: true });
|
|
190
|
+
} catch {
|
|
191
|
+
return true;
|
|
192
|
+
}
|
|
193
|
+
for (const entry of entries) {
|
|
194
|
+
if (entry.isSymbolicLink()) {
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
const relativePath = relativeDir ? `${relativeDir}/${entry.name}` : entry.name;
|
|
198
|
+
if (entry.isFile() && !entry.name.startsWith(".") && !entry.name.startsWith("~$")) {
|
|
199
|
+
if (!isRecordable || isRecordable(relativePath)) {
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
if (entry.isDirectory() && !shouldSkipDirectoryArtifactName(entry.name)) {
|
|
205
|
+
try {
|
|
206
|
+
if (await hasRecordableDescendant(
|
|
207
|
+
path.join(absoluteDir, entry.name),
|
|
208
|
+
relativePath,
|
|
209
|
+
remainingDepth - 1,
|
|
210
|
+
isRecordable
|
|
211
|
+
)) {
|
|
212
|
+
return true;
|
|
213
|
+
}
|
|
214
|
+
} catch {
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
__name(hasRecordableDescendant, "hasRecordableDescendant");
|
|
222
|
+
function isOutsidePath(relative) {
|
|
223
|
+
return relative === ".." || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative);
|
|
224
|
+
}
|
|
225
|
+
__name(isOutsidePath, "isOutsidePath");
|
|
226
|
+
|
|
227
|
+
// packages/core/src/utils/workspace-artifact-path.ts
|
|
228
|
+
init_esbuild_shims();
|
|
229
|
+
import path2 from "node:path";
|
|
230
|
+
var WORKTREE_DIR_RE = /^(.*)[\\/]\.qwen[\\/]worktrees[\\/][^\\/]+$/;
|
|
231
|
+
function resolveBoundWorkspaceRoot(targetDir) {
|
|
232
|
+
const resolved = path2.resolve(targetDir);
|
|
233
|
+
const match = resolved.match(WORKTREE_DIR_RE);
|
|
234
|
+
if (!match) {
|
|
235
|
+
return resolved;
|
|
236
|
+
}
|
|
237
|
+
const base = match[1];
|
|
238
|
+
if (!base) {
|
|
239
|
+
return path2.parse(resolved).root;
|
|
240
|
+
}
|
|
241
|
+
if (/^[A-Za-z]:$/.test(base)) {
|
|
242
|
+
return `${base}${path2.sep}`;
|
|
243
|
+
}
|
|
244
|
+
return base;
|
|
245
|
+
}
|
|
246
|
+
__name(resolveBoundWorkspaceRoot, "resolveBoundWorkspaceRoot");
|
|
247
|
+
function toCanonicalWorkspaceArtifactPath(absoluteFilePath, targetDir) {
|
|
248
|
+
const baseDir = resolveBoundWorkspaceRoot(targetDir);
|
|
249
|
+
const relativePath = path2.relative(baseDir, path2.resolve(absoluteFilePath));
|
|
250
|
+
if (!relativePath || relativePath === ".." || relativePath.startsWith(`..${path2.sep}`) || path2.isAbsolute(relativePath)) {
|
|
251
|
+
return null;
|
|
252
|
+
}
|
|
253
|
+
return relativePath.split(path2.sep).join("/");
|
|
254
|
+
}
|
|
255
|
+
__name(toCanonicalWorkspaceArtifactPath, "toCanonicalWorkspaceArtifactPath");
|
|
256
|
+
|
|
257
|
+
// packages/core/src/tools/record-artifact.ts
|
|
258
|
+
var DESCRIPTION = `Registers a session artifact so clients can show it in an artifacts panel. Use it after creating a useful file, URL, image, report, notebook, or other intermediate result that the user may want to open later, unless the producing tool already returned artifact metadata. For example, write_file automatically records HTML, image, PDF, notebook, CSV, and office documents it writes inside the workspace, so do not call record_artifact again for the same workspacePath; still call it for other formats such as Markdown, JSON, and plain text, and for files produced outside write_file. When the session creates a remote resource, such as a pull request, issue, or comment submitted via gh, record its URL with kind "link" and the url locator so the user can reopen it later.
|
|
259
|
+
|
|
260
|
+
Provide exactly one locator: workspacePath, managedId, or url. Do not use the old "path" field. Use the Artifact tool, not record_artifact, for published interactive HTML artifacts.
|
|
261
|
+
|
|
262
|
+
For workspace files, workspacePath must be relative to the current execution directory (for example "report.csv" or "reports/summary.html") or an absolute path inside the bound workspace. Do not add workspace folder prefixes such as "w/agent/", and do not use ".." to walk up from a worktree. This tool resolves the path and verifies it stays inside the workspace. A regular file is stored as one workspace-root-relative canonical workspacePath. A directory is never stored as an artifact; each recordable file inside it is recorded separately. Word, Excel, PowerPoint, and other office documents use kind "document". A successful file result includes status=available, the canonical workspacePath, and resolvedPath. A successful directory result lists the expanded files instead of "Recorded artifact". If verification fails, the tool returns an error \u2014 do not tell the user the artifact can be opened or downloaded.`;
|
|
263
|
+
var ARTIFACT_TITLE_MAX_LENGTH = 200;
|
|
264
|
+
var ARTIFACT_WORKSPACE_PATH_MAX_LENGTH = 500;
|
|
265
|
+
var WORKSPACE_PATH_HINT = '"workspacePath" must be relative to the current execution directory (for example "report.csv") or an absolute path inside the workspace. Do not add workspace folder prefixes such as "w/agent/".';
|
|
266
|
+
var RecordArtifactInvocation = class extends BaseToolInvocation {
|
|
267
|
+
constructor(params, config) {
|
|
268
|
+
super(params);
|
|
269
|
+
this.config = config;
|
|
270
|
+
}
|
|
271
|
+
static {
|
|
272
|
+
__name(this, "RecordArtifactInvocation");
|
|
273
|
+
}
|
|
274
|
+
getDescription() {
|
|
275
|
+
return `Recording artifact ${this.params.title}`;
|
|
276
|
+
}
|
|
277
|
+
async execute(_signal) {
|
|
278
|
+
const workspacePathInput = trimOptional(this.params.workspacePath);
|
|
279
|
+
if (workspacePathInput) {
|
|
280
|
+
const locator = await resolveWorkspaceArtifactLocator(
|
|
281
|
+
workspacePathInput,
|
|
282
|
+
this.config
|
|
283
|
+
);
|
|
284
|
+
if (!locator.ok) {
|
|
285
|
+
return {
|
|
286
|
+
llmContent: locator.message,
|
|
287
|
+
returnDisplay: locator.message,
|
|
288
|
+
error: {
|
|
289
|
+
message: locator.message,
|
|
290
|
+
type: locator.type
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
if (locator.isDirectory) {
|
|
295
|
+
return this.expandDirectoryLocator(locator);
|
|
296
|
+
}
|
|
297
|
+
const artifact2 = {
|
|
298
|
+
title: this.params.title.trim(),
|
|
299
|
+
kind: this.params.kind,
|
|
300
|
+
storage: "workspace",
|
|
301
|
+
description: trimOptional(this.params.description),
|
|
302
|
+
workspacePath: locator.workspacePath,
|
|
303
|
+
mimeType: trimOptional(this.params.mimeType),
|
|
304
|
+
sizeBytes: this.params.sizeBytes ?? locator.sizeBytes,
|
|
305
|
+
metadata: this.params.metadata
|
|
306
|
+
};
|
|
307
|
+
return {
|
|
308
|
+
llmContent: formatWorkspaceSuccess(artifact2.title, locator),
|
|
309
|
+
returnDisplay: formatWorkspaceSuccess(artifact2.title, locator),
|
|
310
|
+
artifacts: [artifact2]
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
const artifact = {
|
|
314
|
+
title: this.params.title.trim(),
|
|
315
|
+
kind: this.params.kind,
|
|
316
|
+
storage: this.params.storage ?? inferStorage(this.params),
|
|
317
|
+
description: trimOptional(this.params.description),
|
|
318
|
+
managedId: trimOptional(this.params.managedId),
|
|
319
|
+
url: trimOptional(this.params.url),
|
|
320
|
+
mimeType: trimOptional(this.params.mimeType),
|
|
321
|
+
sizeBytes: this.params.sizeBytes,
|
|
322
|
+
metadata: this.params.metadata
|
|
323
|
+
};
|
|
324
|
+
return {
|
|
325
|
+
llmContent: `Recorded artifact "${artifact.title}".`,
|
|
326
|
+
returnDisplay: `Recorded artifact **${artifact.title}**.`,
|
|
327
|
+
artifacts: [artifact]
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
async expandDirectoryLocator(locator) {
|
|
331
|
+
if (pathHasSkippedDirectoryComponent(locator.workspacePath)) {
|
|
332
|
+
const message2 = [
|
|
333
|
+
`Failed to record artifact: "${locator.workspacePath}" is a skipped directory and cannot be recorded.`,
|
|
334
|
+
WORKSPACE_PATH_HINT
|
|
335
|
+
].join("\n");
|
|
336
|
+
return {
|
|
337
|
+
llmContent: message2,
|
|
338
|
+
returnDisplay: message2,
|
|
339
|
+
error: {
|
|
340
|
+
message: message2,
|
|
341
|
+
type: "target_is_directory" /* TARGET_IS_DIRECTORY */
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
let collected;
|
|
346
|
+
try {
|
|
347
|
+
collected = await collectRecordableWorkspaceFiles(
|
|
348
|
+
locator.resolvedPath,
|
|
349
|
+
locator.workspacePath,
|
|
350
|
+
locator.workspaceRoot,
|
|
351
|
+
(workspacePath) => isRecordableDerivedChild(
|
|
352
|
+
path3.posix.basename(workspacePath),
|
|
353
|
+
workspacePath
|
|
354
|
+
)
|
|
355
|
+
);
|
|
356
|
+
} catch (error) {
|
|
357
|
+
const failure = pathInspectFailure(
|
|
358
|
+
error,
|
|
359
|
+
locator.resolvedPath,
|
|
360
|
+
locator.workspacePath,
|
|
361
|
+
`Failed to record artifact: could not inspect "${locator.workspacePath}" (${error instanceof Error ? error.message : String(error)}).`
|
|
362
|
+
);
|
|
363
|
+
return {
|
|
364
|
+
llmContent: failure.message,
|
|
365
|
+
returnDisplay: failure.message,
|
|
366
|
+
error: {
|
|
367
|
+
message: failure.message,
|
|
368
|
+
type: failure.type
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
if (collected.files.length === 0) {
|
|
373
|
+
const message2 = [
|
|
374
|
+
collected.depthLimited ? `Failed to record artifact: "${locator.workspacePath}" is a directory whose recordable files are deeper than ${MAX_DIRECTORY_ARTIFACT_DEPTH} levels.` : `Failed to record artifact: "${locator.workspacePath}" is a directory with no recordable files.`,
|
|
375
|
+
WORKSPACE_PATH_HINT
|
|
376
|
+
].join("\n");
|
|
377
|
+
return {
|
|
378
|
+
llmContent: message2,
|
|
379
|
+
returnDisplay: message2,
|
|
380
|
+
error: {
|
|
381
|
+
message: message2,
|
|
382
|
+
type: "target_is_directory" /* TARGET_IS_DIRECTORY */
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
if (metadataExceedsBudget(this.params.metadata)) {
|
|
387
|
+
const message2 = "Failed to record artifact: metadata is too large to expand a directory.";
|
|
388
|
+
return {
|
|
389
|
+
llmContent: message2,
|
|
390
|
+
returnDisplay: message2,
|
|
391
|
+
error: {
|
|
392
|
+
message: message2,
|
|
393
|
+
type: "invalid_tool_params" /* INVALID_TOOL_PARAMS */
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
const parentTitle = this.params.title.trim();
|
|
398
|
+
const parentDescription = trimOptional(this.params.description);
|
|
399
|
+
const artifacts = [];
|
|
400
|
+
for (const workspacePath of collected.files) {
|
|
401
|
+
const title = path3.posix.basename(workspacePath).trim();
|
|
402
|
+
const description = parentDescription || (parentTitle && parentTitle !== title ? parentTitle : void 0);
|
|
403
|
+
artifacts.push({
|
|
404
|
+
title,
|
|
405
|
+
storage: "workspace",
|
|
406
|
+
workspacePath,
|
|
407
|
+
metadata: {
|
|
408
|
+
...this.params.metadata,
|
|
409
|
+
expandedFromDirectory: true
|
|
410
|
+
},
|
|
411
|
+
...description ? { description } : {}
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
const message = formatDirectoryExpansion(locator, {
|
|
415
|
+
...collected,
|
|
416
|
+
files: artifacts.map((artifact) => artifact.workspacePath)
|
|
417
|
+
});
|
|
418
|
+
return {
|
|
419
|
+
llmContent: message,
|
|
420
|
+
returnDisplay: message,
|
|
421
|
+
artifacts
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
};
|
|
425
|
+
var RecordArtifactTool = class _RecordArtifactTool extends BaseDeclarativeTool {
|
|
426
|
+
constructor(config) {
|
|
427
|
+
super(
|
|
428
|
+
_RecordArtifactTool.Name,
|
|
429
|
+
ToolDisplayNames.RECORD_ARTIFACT,
|
|
430
|
+
DESCRIPTION,
|
|
431
|
+
"other" /* Other */,
|
|
432
|
+
{
|
|
433
|
+
type: "object",
|
|
434
|
+
additionalProperties: false,
|
|
435
|
+
properties: {
|
|
436
|
+
title: {
|
|
437
|
+
type: "string",
|
|
438
|
+
description: "Concise title shown in the client artifact list."
|
|
439
|
+
},
|
|
440
|
+
kind: {
|
|
441
|
+
type: "string",
|
|
442
|
+
enum: [
|
|
443
|
+
"file",
|
|
444
|
+
"link",
|
|
445
|
+
"html",
|
|
446
|
+
"image",
|
|
447
|
+
"video",
|
|
448
|
+
"audio",
|
|
449
|
+
"pdf",
|
|
450
|
+
"notebook",
|
|
451
|
+
"document",
|
|
452
|
+
"other"
|
|
453
|
+
],
|
|
454
|
+
description: "Best-effort artifact type for client rendering."
|
|
455
|
+
},
|
|
456
|
+
storage: {
|
|
457
|
+
type: "string",
|
|
458
|
+
enum: ["workspace", "external_url", "managed"],
|
|
459
|
+
description: "Storage class. Omit it to infer from the provided locator."
|
|
460
|
+
},
|
|
461
|
+
description: {
|
|
462
|
+
type: "string",
|
|
463
|
+
description: "Optional short description for the user."
|
|
464
|
+
},
|
|
465
|
+
workspacePath: {
|
|
466
|
+
type: "string",
|
|
467
|
+
description: "Path relative to the current execution directory, or an absolute path inside the bound workspace. The tool verifies a regular file, or expands a directory into one artifact per recordable file."
|
|
468
|
+
},
|
|
469
|
+
managedId: {
|
|
470
|
+
type: "string",
|
|
471
|
+
description: "Opaque identifier for a resource managed by an extension or tool."
|
|
472
|
+
},
|
|
473
|
+
url: {
|
|
474
|
+
type: "string",
|
|
475
|
+
description: "HTTP or HTTPS URL that the user can open for details."
|
|
476
|
+
},
|
|
477
|
+
mimeType: {
|
|
478
|
+
type: "string",
|
|
479
|
+
description: "Optional MIME type."
|
|
480
|
+
},
|
|
481
|
+
sizeBytes: {
|
|
482
|
+
type: "integer",
|
|
483
|
+
minimum: 0,
|
|
484
|
+
description: "Optional size in bytes."
|
|
485
|
+
},
|
|
486
|
+
metadata: {
|
|
487
|
+
type: "object",
|
|
488
|
+
additionalProperties: {
|
|
489
|
+
anyOf: [
|
|
490
|
+
{ type: "string" },
|
|
491
|
+
{ type: "number" },
|
|
492
|
+
{ type: "boolean" },
|
|
493
|
+
{ type: "null" }
|
|
494
|
+
]
|
|
495
|
+
},
|
|
496
|
+
description: "Small primitive metadata bag for client-specific display hints."
|
|
497
|
+
}
|
|
498
|
+
},
|
|
499
|
+
required: ["title"]
|
|
500
|
+
},
|
|
501
|
+
true,
|
|
502
|
+
false,
|
|
503
|
+
true,
|
|
504
|
+
false,
|
|
505
|
+
"artifact url link file image report notebook dashboard"
|
|
506
|
+
);
|
|
507
|
+
this.config = config;
|
|
508
|
+
}
|
|
509
|
+
static {
|
|
510
|
+
__name(this, "RecordArtifactTool");
|
|
511
|
+
}
|
|
512
|
+
static Name = ToolNames.RECORD_ARTIFACT;
|
|
513
|
+
validateToolParams(params) {
|
|
514
|
+
if (hasLegacyPathField(params)) {
|
|
515
|
+
return '"path" is not supported; use "workspacePath" for a file in the current execution directory (relative to that directory, or an absolute path inside the workspace). Example: "report.csv".';
|
|
516
|
+
}
|
|
517
|
+
return super.validateToolParams(params);
|
|
518
|
+
}
|
|
519
|
+
validateToolParamValues(params) {
|
|
520
|
+
params.title = (params.title ?? "").trim();
|
|
521
|
+
const titleError = validateString(
|
|
522
|
+
params.title,
|
|
523
|
+
"title",
|
|
524
|
+
ARTIFACT_TITLE_MAX_LENGTH,
|
|
525
|
+
true
|
|
526
|
+
);
|
|
527
|
+
if (titleError) {
|
|
528
|
+
return titleError;
|
|
529
|
+
}
|
|
530
|
+
const descriptionError = validateString(
|
|
531
|
+
params.description,
|
|
532
|
+
"description",
|
|
533
|
+
1e3,
|
|
534
|
+
false
|
|
535
|
+
);
|
|
536
|
+
if (descriptionError) {
|
|
537
|
+
return descriptionError;
|
|
538
|
+
}
|
|
539
|
+
const mimeTypeError = validateString(
|
|
540
|
+
params.mimeType,
|
|
541
|
+
"mimeType",
|
|
542
|
+
120,
|
|
543
|
+
false
|
|
544
|
+
);
|
|
545
|
+
if (mimeTypeError) {
|
|
546
|
+
return mimeTypeError;
|
|
547
|
+
}
|
|
548
|
+
if (params.kind && !isArtifactKind(params.kind)) {
|
|
549
|
+
return '"kind" must be a supported artifact kind';
|
|
550
|
+
}
|
|
551
|
+
if (params.storage && params.storage !== "workspace" && params.storage !== "external_url" && params.storage !== "managed") {
|
|
552
|
+
return '"storage" must be workspace, external_url, or managed';
|
|
553
|
+
}
|
|
554
|
+
const locators = [
|
|
555
|
+
trimOptional(params.workspacePath),
|
|
556
|
+
trimOptional(params.managedId),
|
|
557
|
+
trimOptional(params.url)
|
|
558
|
+
].filter(Boolean);
|
|
559
|
+
if (locators.length !== 1) {
|
|
560
|
+
return 'Provide exactly one of "workspacePath", "managedId", or "url"';
|
|
561
|
+
}
|
|
562
|
+
const inferredStorage = inferStorage(params);
|
|
563
|
+
if (params.storage && params.storage !== inferredStorage) {
|
|
564
|
+
return `"storage" must be "${inferredStorage}" for the provided locator`;
|
|
565
|
+
}
|
|
566
|
+
if (params.workspacePath) {
|
|
567
|
+
const workspacePathError = validateWorkspacePath(
|
|
568
|
+
params.workspacePath,
|
|
569
|
+
this.config.getTargetDir()
|
|
570
|
+
);
|
|
571
|
+
if (workspacePathError) {
|
|
572
|
+
return workspacePathError;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
if (params.managedId) {
|
|
576
|
+
const managedIdError = validateManagedId(params.managedId);
|
|
577
|
+
if (managedIdError) {
|
|
578
|
+
return managedIdError;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
if (params.url) {
|
|
582
|
+
try {
|
|
583
|
+
const parsed = new URL(params.url);
|
|
584
|
+
if (parsed.username || parsed.password) {
|
|
585
|
+
return '"url" must not include credentials';
|
|
586
|
+
}
|
|
587
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
588
|
+
return '"url" must use http or https';
|
|
589
|
+
}
|
|
590
|
+
} catch {
|
|
591
|
+
return '"url" must be a valid URL';
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
if (params.sizeBytes !== void 0 && (!Number.isSafeInteger(params.sizeBytes) || params.sizeBytes < 0)) {
|
|
595
|
+
return '"sizeBytes" must be a non-negative safe integer';
|
|
596
|
+
}
|
|
597
|
+
const metadataError = validateMetadata(params.metadata);
|
|
598
|
+
if (metadataError) {
|
|
599
|
+
return metadataError;
|
|
600
|
+
}
|
|
601
|
+
return null;
|
|
602
|
+
}
|
|
603
|
+
createInvocation(params) {
|
|
604
|
+
return new RecordArtifactInvocation(params, this.config);
|
|
605
|
+
}
|
|
606
|
+
};
|
|
607
|
+
function inferStorage(params) {
|
|
608
|
+
if (trimOptional(params.workspacePath)) {
|
|
609
|
+
return "workspace";
|
|
610
|
+
}
|
|
611
|
+
if (trimOptional(params.managedId)) {
|
|
612
|
+
return "managed";
|
|
613
|
+
}
|
|
614
|
+
return "external_url";
|
|
615
|
+
}
|
|
616
|
+
__name(inferStorage, "inferStorage");
|
|
617
|
+
function trimOptional(value) {
|
|
618
|
+
const trimmed = value?.trim();
|
|
619
|
+
return trimmed ? trimmed : void 0;
|
|
620
|
+
}
|
|
621
|
+
__name(trimOptional, "trimOptional");
|
|
622
|
+
function validateString(value, field, maxLength, required) {
|
|
623
|
+
const trimmed = value?.trim();
|
|
624
|
+
if (!trimmed) {
|
|
625
|
+
return required ? `Missing or empty "${field}"` : null;
|
|
626
|
+
}
|
|
627
|
+
if (trimmed.length > maxLength) {
|
|
628
|
+
return `"${field}" exceeds ${maxLength} characters`;
|
|
629
|
+
}
|
|
630
|
+
if (hasControlCharacter(trimmed, field === "description")) {
|
|
631
|
+
return `"${field}" contains control characters`;
|
|
632
|
+
}
|
|
633
|
+
if (isDisplayField(field) && hasUnsafeDisplayPayload(trimmed)) {
|
|
634
|
+
return `"${field}" contains unsafe markup`;
|
|
635
|
+
}
|
|
636
|
+
return null;
|
|
637
|
+
}
|
|
638
|
+
__name(validateString, "validateString");
|
|
639
|
+
function validateManagedId(value) {
|
|
640
|
+
const trimmed = value.trim();
|
|
641
|
+
const stringError = validateString(trimmed, "managedId", 200, true);
|
|
642
|
+
if (stringError) {
|
|
643
|
+
return stringError;
|
|
644
|
+
}
|
|
645
|
+
if (trimmed.includes("/") || trimmed.includes("\\") || trimmed.includes("..") || path3.isAbsolute(trimmed) || path3.win32.isAbsolute(trimmed)) {
|
|
646
|
+
return '"managedId" must be an opaque managed resource id';
|
|
647
|
+
}
|
|
648
|
+
return null;
|
|
649
|
+
}
|
|
650
|
+
__name(validateManagedId, "validateManagedId");
|
|
651
|
+
function isDisplayField(field) {
|
|
652
|
+
return field === "title" || field === "description" || field === "mimeType" || field === "workspacePath" || field === "managedId";
|
|
653
|
+
}
|
|
654
|
+
__name(isDisplayField, "isDisplayField");
|
|
655
|
+
function hasControlCharacter(value, allowLineWhitespace = false) {
|
|
656
|
+
for (let i = 0; i < value.length; i++) {
|
|
657
|
+
const code = value.charCodeAt(i);
|
|
658
|
+
if (allowLineWhitespace && (code === 9 || code === 10 || code === 13)) {
|
|
659
|
+
continue;
|
|
660
|
+
}
|
|
661
|
+
if (code <= 31 || code === 127 || code >= 8203 && code <= 8207 || code === 8232 || code === 8233 || code >= 8234 && code <= 8238 || code >= 8294 && code <= 8297 || code === 65279) {
|
|
662
|
+
return true;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
return false;
|
|
666
|
+
}
|
|
667
|
+
__name(hasControlCharacter, "hasControlCharacter");
|
|
668
|
+
function hasUnsafeDisplayPayload(value) {
|
|
669
|
+
return /<\s*\/?[a-z!]|&(?:#[0-9]+|#x[0-9a-f]+|[a-z][a-z0-9]+);|javascript\s*:|data\s*:\s*(?:text\/(?:html|javascript)|application\/javascript|image\/svg\+xml)/i.test(
|
|
670
|
+
value
|
|
671
|
+
) || /(?:^|[\s"'`<])on[a-z][a-z0-9-]*\s*=/i.test(value);
|
|
672
|
+
}
|
|
673
|
+
__name(hasUnsafeDisplayPayload, "hasUnsafeDisplayPayload");
|
|
674
|
+
function validateWorkspacePath(value, cwd) {
|
|
675
|
+
const trimmed = value.trim();
|
|
676
|
+
if (!trimmed) {
|
|
677
|
+
return 'Missing or empty "workspacePath"';
|
|
678
|
+
}
|
|
679
|
+
if (hasControlCharacter(trimmed) || hasUnsafeDisplayPayload(trimmed)) {
|
|
680
|
+
return hasControlCharacter(trimmed) ? '"workspacePath" contains control characters' : '"workspacePath" contains unsafe markup';
|
|
681
|
+
}
|
|
682
|
+
if (isRedirectorRoutedPath(trimmed) || isForeignWindowsAbsolute(trimmed)) {
|
|
683
|
+
return WORKSPACE_PATH_HINT;
|
|
684
|
+
}
|
|
685
|
+
if (isAbsoluteWorkspaceInput(trimmed)) {
|
|
686
|
+
if (trimmed.length > 4096) {
|
|
687
|
+
return '"workspacePath" exceeds 4096 characters';
|
|
688
|
+
}
|
|
689
|
+
const root = resolveBoundWorkspaceRoot(
|
|
690
|
+
tryResolveForContainment(path3.resolve(cwd)) ?? path3.resolve(cwd)
|
|
691
|
+
);
|
|
692
|
+
const comparable = tryResolveForContainment(path3.resolve(trimmed));
|
|
693
|
+
if (comparable && !isWithinRoot(comparable, root)) {
|
|
694
|
+
return '"workspacePath" must stay inside the workspace';
|
|
695
|
+
}
|
|
696
|
+
return null;
|
|
697
|
+
}
|
|
698
|
+
if (trimmed.length > ARTIFACT_WORKSPACE_PATH_MAX_LENGTH) {
|
|
699
|
+
return `"workspacePath" exceeds ${ARTIFACT_WORKSPACE_PATH_MAX_LENGTH} characters`;
|
|
700
|
+
}
|
|
701
|
+
const portableNormalized = path3.posix.normalize(trimmed.replace(/\\/g, "/"));
|
|
702
|
+
if (portableNormalized === ".." || portableNormalized.startsWith("../") || path3.posix.isAbsolute(portableNormalized)) {
|
|
703
|
+
return '"workspacePath" must stay inside the current execution directory';
|
|
704
|
+
}
|
|
705
|
+
return null;
|
|
706
|
+
}
|
|
707
|
+
__name(validateWorkspacePath, "validateWorkspacePath");
|
|
708
|
+
function validateMetadata(metadata) {
|
|
709
|
+
if (metadata === void 0) {
|
|
710
|
+
return null;
|
|
711
|
+
}
|
|
712
|
+
if (typeof metadata !== "object" || metadata === null || Array.isArray(metadata)) {
|
|
713
|
+
return '"metadata" must be an object';
|
|
714
|
+
}
|
|
715
|
+
for (const [key, value] of Object.entries(metadata)) {
|
|
716
|
+
if (!key) {
|
|
717
|
+
return '"metadata" keys must not be empty';
|
|
718
|
+
}
|
|
719
|
+
if (key.length > 120) {
|
|
720
|
+
return '"metadata" keys must be 120 characters or fewer';
|
|
721
|
+
}
|
|
722
|
+
if (hasControlCharacter(key) || hasUnsafeDisplayPayload(key)) {
|
|
723
|
+
return '"metadata" keys contain unsafe content';
|
|
724
|
+
}
|
|
725
|
+
if (value !== null && typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
|
|
726
|
+
return '"metadata" values must be primitive';
|
|
727
|
+
}
|
|
728
|
+
if (typeof value === "number" && !Number.isFinite(value)) {
|
|
729
|
+
return '"metadata" numbers must be finite';
|
|
730
|
+
}
|
|
731
|
+
if (typeof value === "string" && (hasControlCharacter(value) || hasUnsafeDisplayPayload(value))) {
|
|
732
|
+
return '"metadata" string values contain unsafe content';
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
if (Buffer.byteLength(JSON.stringify(metadata), "utf8") > 4096) {
|
|
736
|
+
return '"metadata" must be 4096 bytes or fewer';
|
|
737
|
+
}
|
|
738
|
+
return null;
|
|
739
|
+
}
|
|
740
|
+
__name(validateMetadata, "validateMetadata");
|
|
741
|
+
function isArtifactKind(kind) {
|
|
742
|
+
return kind === "file" || kind === "link" || kind === "html" || kind === "image" || kind === "video" || kind === "audio" || kind === "pdf" || kind === "notebook" || kind === "document" || kind === "other";
|
|
743
|
+
}
|
|
744
|
+
__name(isArtifactKind, "isArtifactKind");
|
|
745
|
+
function hasLegacyPathField(params) {
|
|
746
|
+
const raw = params;
|
|
747
|
+
return Object.prototype.hasOwnProperty.call(raw, "path") && raw.path != null && raw.path !== "";
|
|
748
|
+
}
|
|
749
|
+
__name(hasLegacyPathField, "hasLegacyPathField");
|
|
750
|
+
function isRedirectorRoutedPath(value) {
|
|
751
|
+
const slashes = value.replace(/\//g, "\\").replace(/^\\\?\?\\/, "\\\\?\\");
|
|
752
|
+
if (/\\Device\\Mup\\/i.test(slashes)) {
|
|
753
|
+
return true;
|
|
754
|
+
}
|
|
755
|
+
const posixDoubleSlash = process.platform !== "win32" && !value.includes("\\") && /^\/\//.test(value);
|
|
756
|
+
if (!posixDoubleSlash && (/^\\\\[^\\?]+(?:\\|$)/.test(slashes) || /^\\\\\?\\[Uu][Nn][Cc]\\/.test(slashes))) {
|
|
757
|
+
return true;
|
|
758
|
+
}
|
|
759
|
+
return /^\\\\\?\\/.test(slashes) && !/^\\\\\?\\[A-Za-z]:\\/.test(slashes);
|
|
760
|
+
}
|
|
761
|
+
__name(isRedirectorRoutedPath, "isRedirectorRoutedPath");
|
|
762
|
+
function isForeignWindowsAbsolute(value) {
|
|
763
|
+
if (process.platform === "win32") {
|
|
764
|
+
return false;
|
|
765
|
+
}
|
|
766
|
+
return /^[A-Za-z]:/.test(value) || value.startsWith("\\");
|
|
767
|
+
}
|
|
768
|
+
__name(isForeignWindowsAbsolute, "isForeignWindowsAbsolute");
|
|
769
|
+
function isAbsoluteWorkspaceInput(value) {
|
|
770
|
+
return path3.isAbsolute(value) || process.platform === "win32" && path3.win32.isAbsolute(value);
|
|
771
|
+
}
|
|
772
|
+
__name(isAbsoluteWorkspaceInput, "isAbsoluteWorkspaceInput");
|
|
773
|
+
function formatWorkspaceSuccess(title, locator) {
|
|
774
|
+
return [
|
|
775
|
+
`Recorded artifact "${title}".`,
|
|
776
|
+
"status: available",
|
|
777
|
+
`workspacePath: ${locator.workspacePath}`,
|
|
778
|
+
`resolvedPath: ${locator.resolvedPath}`
|
|
779
|
+
].join("\n");
|
|
780
|
+
}
|
|
781
|
+
__name(formatWorkspaceSuccess, "formatWorkspaceSuccess");
|
|
782
|
+
function formatDirectoryExpansion(locator, collected) {
|
|
783
|
+
const lines = [
|
|
784
|
+
`Expanded directory "${locator.workspacePath}" into ${collected.files.length} artifacts.`,
|
|
785
|
+
"status: available",
|
|
786
|
+
`workspacePath: ${locator.workspacePath}`,
|
|
787
|
+
`resolvedPath: ${locator.resolvedPath}`,
|
|
788
|
+
"files:",
|
|
789
|
+
...collected.files.map((file) => `- ${file}`)
|
|
790
|
+
];
|
|
791
|
+
if (collected.truncated) {
|
|
792
|
+
lines.push(`Recorded the first ${collected.files.length} files.`);
|
|
793
|
+
}
|
|
794
|
+
if (collected.depthLimited) {
|
|
795
|
+
lines.push(
|
|
796
|
+
`Skipped files deeper than ${MAX_DIRECTORY_ARTIFACT_DEPTH} directory levels.`
|
|
797
|
+
);
|
|
798
|
+
}
|
|
799
|
+
if (collected.unreadable) {
|
|
800
|
+
lines.push("Skipped subdirectories that could not be read.");
|
|
801
|
+
}
|
|
802
|
+
if ((collected.skippedUnrecordable ?? 0) > 0) {
|
|
803
|
+
lines.push(
|
|
804
|
+
`Skipped ${collected.skippedUnrecordable} files whose names cannot be recorded as artifact titles.`
|
|
805
|
+
);
|
|
806
|
+
}
|
|
807
|
+
return lines.join("\n");
|
|
808
|
+
}
|
|
809
|
+
__name(formatDirectoryExpansion, "formatDirectoryExpansion");
|
|
810
|
+
function metadataExceedsBudget(metadata) {
|
|
811
|
+
const withMarker = { ...metadata, expandedFromDirectory: true };
|
|
812
|
+
return Buffer.byteLength(JSON.stringify(withMarker), "utf8") > 4096;
|
|
813
|
+
}
|
|
814
|
+
__name(metadataExceedsBudget, "metadataExceedsBudget");
|
|
815
|
+
function isRecordableDerivedChild(title, workspacePath) {
|
|
816
|
+
const trimmedTitle = title.trim();
|
|
817
|
+
const trimmedPath = workspacePath.trim();
|
|
818
|
+
if (title !== trimmedTitle || workspacePath !== trimmedPath) {
|
|
819
|
+
return false;
|
|
820
|
+
}
|
|
821
|
+
return trimmedTitle.length > 0 && trimmedTitle.length <= ARTIFACT_TITLE_MAX_LENGTH && trimmedPath.length <= ARTIFACT_WORKSPACE_PATH_MAX_LENGTH && !hasControlCharacter(trimmedTitle) && !hasUnsafeDisplayPayload(trimmedTitle) && !hasControlCharacter(trimmedPath) && !hasUnsafeDisplayPayload(trimmedPath);
|
|
822
|
+
}
|
|
823
|
+
__name(isRecordableDerivedChild, "isRecordableDerivedChild");
|
|
824
|
+
function locatorFailure(type, message) {
|
|
825
|
+
return { ok: false, type, message };
|
|
826
|
+
}
|
|
827
|
+
__name(locatorFailure, "locatorFailure");
|
|
828
|
+
async function resolveExistingDir(dir) {
|
|
829
|
+
const resolved = path3.resolve(dir);
|
|
830
|
+
try {
|
|
831
|
+
return await fs2.realpath(resolved);
|
|
832
|
+
} catch {
|
|
833
|
+
return resolved;
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
__name(resolveExistingDir, "resolveExistingDir");
|
|
837
|
+
function tryResolveForContainment(absolutePath) {
|
|
838
|
+
const resolved = path3.resolve(absolutePath);
|
|
839
|
+
if (pathHasRedirectorHop(resolved)) {
|
|
840
|
+
return void 0;
|
|
841
|
+
}
|
|
842
|
+
try {
|
|
843
|
+
return realpathSync(resolved);
|
|
844
|
+
} catch {
|
|
845
|
+
try {
|
|
846
|
+
const parent = path3.dirname(resolved);
|
|
847
|
+
if (pathHasRedirectorHop(parent)) {
|
|
848
|
+
return void 0;
|
|
849
|
+
}
|
|
850
|
+
return path3.join(realpathSync(parent), path3.basename(resolved));
|
|
851
|
+
} catch {
|
|
852
|
+
return void 0;
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
__name(tryResolveForContainment, "tryResolveForContainment");
|
|
857
|
+
var REDIRECTOR_HOP_LIMIT = 8;
|
|
858
|
+
function pathHasRedirectorHop(absolutePath) {
|
|
859
|
+
if (isRedirectorRoutedPath(absolutePath)) {
|
|
860
|
+
return true;
|
|
861
|
+
}
|
|
862
|
+
const resolved = path3.resolve(absolutePath);
|
|
863
|
+
const root = path3.parse(resolved).root;
|
|
864
|
+
const relative = path3.relative(root, resolved);
|
|
865
|
+
if (!relative || relative.startsWith("..")) {
|
|
866
|
+
return symlinkChainHitsRedirector(resolved);
|
|
867
|
+
}
|
|
868
|
+
let acc = root;
|
|
869
|
+
for (const segment of relative.split(path3.sep).filter(Boolean)) {
|
|
870
|
+
acc = path3.join(acc, segment);
|
|
871
|
+
if (isRedirectorRoutedPath(acc) || symlinkChainHitsRedirector(acc)) {
|
|
872
|
+
return true;
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
return false;
|
|
876
|
+
}
|
|
877
|
+
__name(pathHasRedirectorHop, "pathHasRedirectorHop");
|
|
878
|
+
function symlinkChainHitsRedirector(absolutePath) {
|
|
879
|
+
let current = absolutePath;
|
|
880
|
+
for (let hop = 0; hop < REDIRECTOR_HOP_LIMIT; hop++) {
|
|
881
|
+
let lst;
|
|
882
|
+
try {
|
|
883
|
+
lst = lstatSync(current);
|
|
884
|
+
} catch {
|
|
885
|
+
return false;
|
|
886
|
+
}
|
|
887
|
+
if (!lst.isSymbolicLink()) {
|
|
888
|
+
return false;
|
|
889
|
+
}
|
|
890
|
+
let target;
|
|
891
|
+
try {
|
|
892
|
+
target = readlinkSync(current);
|
|
893
|
+
} catch {
|
|
894
|
+
return false;
|
|
895
|
+
}
|
|
896
|
+
if (isRedirectorRoutedPath(target)) {
|
|
897
|
+
return true;
|
|
898
|
+
}
|
|
899
|
+
const next = path3.isAbsolute(target) ? target : path3.resolve(path3.dirname(current), target);
|
|
900
|
+
if (isRedirectorRoutedPath(next)) {
|
|
901
|
+
return true;
|
|
902
|
+
}
|
|
903
|
+
current = next;
|
|
904
|
+
}
|
|
905
|
+
return false;
|
|
906
|
+
}
|
|
907
|
+
__name(symlinkChainHitsRedirector, "symlinkChainHitsRedirector");
|
|
908
|
+
async function resolveWorkspaceArtifactLocator(rawPath, config) {
|
|
909
|
+
const cwd = await resolveExistingDir(config.getTargetDir());
|
|
910
|
+
const root = await resolveExistingDir(resolveBoundWorkspaceRoot(cwd));
|
|
911
|
+
const first = workspacePathCandidate(rawPath, cwd, root, true);
|
|
912
|
+
if (!first.ok) {
|
|
913
|
+
return first;
|
|
914
|
+
}
|
|
915
|
+
const inspected = await inspectWorkspaceCandidate(
|
|
916
|
+
first.path,
|
|
917
|
+
rawPath,
|
|
918
|
+
cwd,
|
|
919
|
+
root
|
|
920
|
+
);
|
|
921
|
+
if (inspected.ok || inspected.type !== "file_not_found" /* FILE_NOT_FOUND */ || process.platform === "win32" || !rawPath.includes("\\")) {
|
|
922
|
+
return inspected;
|
|
923
|
+
}
|
|
924
|
+
const fallback = workspacePathCandidate(rawPath, cwd, root, false);
|
|
925
|
+
if (!fallback.ok || fallback.path === first.path) {
|
|
926
|
+
return inspected;
|
|
927
|
+
}
|
|
928
|
+
return inspectWorkspaceCandidate(fallback.path, rawPath, cwd, root);
|
|
929
|
+
}
|
|
930
|
+
__name(resolveWorkspaceArtifactLocator, "resolveWorkspaceArtifactLocator");
|
|
931
|
+
function workspacePathCandidate(locator, cwd, root, preservePosixBackslash) {
|
|
932
|
+
if (isRedirectorRoutedPath(locator) || isForeignWindowsAbsolute(locator)) {
|
|
933
|
+
return locatorFailure(
|
|
934
|
+
"invalid_tool_params" /* INVALID_TOOL_PARAMS */,
|
|
935
|
+
WORKSPACE_PATH_HINT
|
|
936
|
+
);
|
|
937
|
+
}
|
|
938
|
+
if (isAbsoluteWorkspaceInput(locator)) {
|
|
939
|
+
const absolute = path3.resolve(locator);
|
|
940
|
+
const comparable = tryResolveForContainment(absolute);
|
|
941
|
+
if (comparable && !isWithinRoot(comparable, root)) {
|
|
942
|
+
return locatorFailure(
|
|
943
|
+
"path_not_in_workspace" /* PATH_NOT_IN_WORKSPACE */,
|
|
944
|
+
`Failed to record artifact: "${locator}" is outside the workspace.
|
|
945
|
+
${WORKSPACE_PATH_HINT}`
|
|
946
|
+
);
|
|
947
|
+
}
|
|
948
|
+
return { ok: true, path: absolute };
|
|
949
|
+
}
|
|
950
|
+
const relative = preservePosixBackslash && process.platform !== "win32" ? locator : locator.replace(/\\/g, "/");
|
|
951
|
+
return { ok: true, path: path3.resolve(cwd, relative) };
|
|
952
|
+
}
|
|
953
|
+
__name(workspacePathCandidate, "workspacePathCandidate");
|
|
954
|
+
async function inspectWorkspaceCandidate(candidate, rawPath, cwd, root) {
|
|
955
|
+
if (pathHasRedirectorHop(candidate)) {
|
|
956
|
+
return locatorFailure(
|
|
957
|
+
"path_not_in_workspace" /* PATH_NOT_IN_WORKSPACE */,
|
|
958
|
+
`Failed to record artifact: "${rawPath}" resolves outside the workspace.
|
|
959
|
+
${WORKSPACE_PATH_HINT}`
|
|
960
|
+
);
|
|
961
|
+
}
|
|
962
|
+
try {
|
|
963
|
+
await fs2.lstat(candidate);
|
|
964
|
+
} catch (error) {
|
|
965
|
+
return pathInspectFailure(
|
|
966
|
+
error,
|
|
967
|
+
candidate,
|
|
968
|
+
rawPath,
|
|
969
|
+
`Failed to record artifact: could not inspect "${candidate}" (${error instanceof Error ? error.message : String(error)}).`
|
|
970
|
+
);
|
|
971
|
+
}
|
|
972
|
+
let resolved;
|
|
973
|
+
try {
|
|
974
|
+
resolved = await fs2.realpath(candidate);
|
|
975
|
+
} catch (error) {
|
|
976
|
+
return pathInspectFailure(
|
|
977
|
+
error,
|
|
978
|
+
candidate,
|
|
979
|
+
rawPath,
|
|
980
|
+
`Failed to record artifact: could not resolve "${rawPath}" (${error instanceof Error ? error.message : String(error)}).`
|
|
981
|
+
);
|
|
982
|
+
}
|
|
983
|
+
if (!isWithinRoot(resolved, root)) {
|
|
984
|
+
return locatorFailure(
|
|
985
|
+
"path_not_in_workspace" /* PATH_NOT_IN_WORKSPACE */,
|
|
986
|
+
`Failed to record artifact: "${rawPath}" resolves outside the workspace.
|
|
987
|
+
${WORKSPACE_PATH_HINT}`
|
|
988
|
+
);
|
|
989
|
+
}
|
|
990
|
+
let st;
|
|
991
|
+
try {
|
|
992
|
+
st = await fs2.stat(resolved);
|
|
993
|
+
} catch (error) {
|
|
994
|
+
return pathInspectFailure(
|
|
995
|
+
error,
|
|
996
|
+
resolved,
|
|
997
|
+
rawPath,
|
|
998
|
+
`Failed to record artifact: ${error instanceof Error ? error.message : String(error)}`
|
|
999
|
+
);
|
|
1000
|
+
}
|
|
1001
|
+
if (!st.isFile() && !st.isDirectory()) {
|
|
1002
|
+
return locatorFailure(
|
|
1003
|
+
"target_not_regular_file" /* TARGET_NOT_REGULAR_FILE */,
|
|
1004
|
+
`Failed to record artifact: "${resolved}" is not a regular file.
|
|
1005
|
+
${WORKSPACE_PATH_HINT}`
|
|
1006
|
+
);
|
|
1007
|
+
}
|
|
1008
|
+
if (st.isDirectory() && path3.resolve(resolved) === path3.resolve(cwd)) {
|
|
1009
|
+
return locatorFailure(
|
|
1010
|
+
"target_is_directory" /* TARGET_IS_DIRECTORY */,
|
|
1011
|
+
`Failed to record artifact: "${rawPath}" is the workspace root, which cannot be recorded as a directory artifact.`
|
|
1012
|
+
);
|
|
1013
|
+
}
|
|
1014
|
+
const workspacePath = toCanonicalWorkspaceArtifactPath(resolved, cwd);
|
|
1015
|
+
if (!workspacePath) {
|
|
1016
|
+
if (st.isDirectory()) {
|
|
1017
|
+
return locatorFailure(
|
|
1018
|
+
"target_is_directory" /* TARGET_IS_DIRECTORY */,
|
|
1019
|
+
`Failed to record artifact: "${rawPath}" is the workspace root, which cannot be recorded as a directory artifact.`
|
|
1020
|
+
);
|
|
1021
|
+
}
|
|
1022
|
+
return locatorFailure(
|
|
1023
|
+
"path_not_in_workspace" /* PATH_NOT_IN_WORKSPACE */,
|
|
1024
|
+
`Failed to record artifact: "${rawPath}" could not be converted to a workspace-root-relative path.
|
|
1025
|
+
${WORKSPACE_PATH_HINT}`
|
|
1026
|
+
);
|
|
1027
|
+
}
|
|
1028
|
+
const canonicalError = validateString(
|
|
1029
|
+
workspacePath,
|
|
1030
|
+
"workspacePath",
|
|
1031
|
+
ARTIFACT_WORKSPACE_PATH_MAX_LENGTH,
|
|
1032
|
+
true
|
|
1033
|
+
);
|
|
1034
|
+
if (canonicalError) {
|
|
1035
|
+
return locatorFailure(
|
|
1036
|
+
"invalid_tool_params" /* INVALID_TOOL_PARAMS */,
|
|
1037
|
+
canonicalError.includes("exceeds") ? `Failed to record artifact: the stored workspace-root-relative path "${workspacePath}" exceeds ${ARTIFACT_WORKSPACE_PATH_MAX_LENGTH} characters.` : canonicalError
|
|
1038
|
+
);
|
|
1039
|
+
}
|
|
1040
|
+
return {
|
|
1041
|
+
ok: true,
|
|
1042
|
+
workspacePath,
|
|
1043
|
+
resolvedPath: resolved,
|
|
1044
|
+
workspaceRoot: root,
|
|
1045
|
+
sizeBytes: st.isDirectory() ? 0 : st.size,
|
|
1046
|
+
...st.isDirectory() ? { isDirectory: true } : {}
|
|
1047
|
+
};
|
|
1048
|
+
}
|
|
1049
|
+
__name(inspectWorkspaceCandidate, "inspectWorkspaceCandidate");
|
|
1050
|
+
function classifyPathError(error) {
|
|
1051
|
+
if (!isNodeError(error)) {
|
|
1052
|
+
return "execution_failed" /* EXECUTION_FAILED */;
|
|
1053
|
+
}
|
|
1054
|
+
if (error.code === "ENOENT" || error.code === "ENOTDIR") {
|
|
1055
|
+
return "file_not_found" /* FILE_NOT_FOUND */;
|
|
1056
|
+
}
|
|
1057
|
+
if (error.code === "EACCES" || error.code === "EPERM") {
|
|
1058
|
+
return "permission_denied" /* PERMISSION_DENIED */;
|
|
1059
|
+
}
|
|
1060
|
+
return "execution_failed" /* EXECUTION_FAILED */;
|
|
1061
|
+
}
|
|
1062
|
+
__name(classifyPathError, "classifyPathError");
|
|
1063
|
+
function pathInspectFailure(error, candidate, rawPath, fallbackMessage) {
|
|
1064
|
+
const type = classifyPathError(error);
|
|
1065
|
+
if (type === "file_not_found" /* FILE_NOT_FOUND */) {
|
|
1066
|
+
return locatorFailure(
|
|
1067
|
+
type,
|
|
1068
|
+
[
|
|
1069
|
+
`Failed to record artifact: file not found at "${candidate}".`,
|
|
1070
|
+
WORKSPACE_PATH_HINT
|
|
1071
|
+
].join("\n")
|
|
1072
|
+
);
|
|
1073
|
+
}
|
|
1074
|
+
if (type === "permission_denied" /* PERMISSION_DENIED */) {
|
|
1075
|
+
return locatorFailure(
|
|
1076
|
+
type,
|
|
1077
|
+
`Failed to record artifact: permission denied for "${rawPath}".
|
|
1078
|
+
${WORKSPACE_PATH_HINT}`
|
|
1079
|
+
);
|
|
1080
|
+
}
|
|
1081
|
+
return locatorFailure(type, fallbackMessage);
|
|
1082
|
+
}
|
|
1083
|
+
__name(pathInspectFailure, "pathInspectFailure");
|
|
1084
|
+
|
|
1085
|
+
export {
|
|
1086
|
+
MAX_DIRECTORY_ARTIFACT_FILES,
|
|
1087
|
+
MAX_DIRECTORY_ARTIFACT_DEPTH,
|
|
1088
|
+
OFFICE_DOCUMENT_EXTENSIONS,
|
|
1089
|
+
isOfficeDocumentExtension,
|
|
1090
|
+
pathHasSkippedDirectoryComponent,
|
|
1091
|
+
collectRecordableWorkspaceFiles,
|
|
1092
|
+
toCanonicalWorkspaceArtifactPath,
|
|
1093
|
+
ARTIFACT_TITLE_MAX_LENGTH,
|
|
1094
|
+
ARTIFACT_WORKSPACE_PATH_MAX_LENGTH,
|
|
1095
|
+
RecordArtifactTool,
|
|
1096
|
+
hasControlCharacter,
|
|
1097
|
+
hasUnsafeDisplayPayload,
|
|
1098
|
+
isRecordableDerivedChild
|
|
1099
|
+
};
|
|
1100
|
+
/**
|
|
1101
|
+
* @license
|
|
1102
|
+
* Copyright 2026 Qwen Team
|
|
1103
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
1104
|
+
*/
|
|
1105
|
+
/**
|
|
1106
|
+
* @license
|
|
1107
|
+
* Copyright 2025 Google LLC
|
|
1108
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
1109
|
+
*/
|