dsh-multigameassistant 0.0.0-stage → 2.0.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/LICENSE +661 -0
- package/README.md +13 -2
- package/cordis.patch.yml +260 -0
- package/lib/agent.js +14 -0
- package/lib/analyzer.js +765 -0
- package/lib/chunk-2DZ75ANX.js +7595 -0
- package/lib/chunk-2UFLGPDY.js +43 -0
- package/lib/chunk-5WTH2CYW.js +2720 -0
- package/lib/chunk-7XMNAHZ2.js +7909 -0
- package/lib/chunk-BL6OSR2I.js +17735 -0
- package/lib/chunk-CCAB6XXZ.js +34 -0
- package/lib/chunk-FLQD3DKB.js +1182 -0
- package/lib/chunk-KIAOFNCB.js +2379 -0
- package/lib/chunk-RFCFA5P5.js +11 -0
- package/lib/client.js +41 -0
- package/lib/emulator.js +610 -0
- package/lib/feishu.js +123238 -0
- package/lib/feishu.js.LEGAL.txt +41 -0
- package/lib/game-intel.js +1993 -0
- package/lib/games/arknights/game.yaml +36 -0
- package/lib/games/endfield/game.yaml +25 -0
- package/lib/games/starrail/game.yaml +33 -0
- package/lib/gateway.js +42 -0
- package/lib/guard.js +167 -0
- package/lib/index.js +3 -0
- package/lib/intervene.js +1669 -0
- package/lib/monitor.js +892 -0
- package/lib/notify.js +41 -0
- package/lib/orchestrator.js +1633 -0
- package/lib/packs/maa/adg.script.yaml +102 -0
- package/lib/packs/maaend/adg.script.yaml +90 -0
- package/lib/packs/march7th/adg.script.yaml +100 -0
- package/lib/qqbot.js +748 -0
- package/lib/runner.js +46 -0
- package/lib/scheduler.js +1048 -0
- package/lib/script-registry.js +3493 -0
- package/package.json +70 -4
- package/skills/game-intel.md +32 -0
- package/skills/pipeline-planning.md +44 -0
- package/skills/script-analysis.md +127 -0
- package/skills/web-reading.md +37 -0
- package/web/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
- package/web/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
- package/web/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/web/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/web/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2 +0 -0
- package/web/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2 +0 -0
- package/web/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2 +0 -0
- package/web/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
- package/web/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2 +0 -0
- package/web/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2 +0 -0
- package/web/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
- package/web/assets/index-B8Gy9VoQ.css +1 -0
- package/web/assets/index-DAKeB3Cw.js +235 -0
- package/web/assets/index-DAKeB3Cw.js.map +1 -0
- package/web/assets/noto-sans-sc-100-wght-normal-DrqXJETY.woff2 +0 -0
- package/web/assets/noto-sans-sc-101-wght-normal-c94LAl5p.woff2 +0 -0
- package/web/assets/noto-sans-sc-102-wght-normal-C1RtbCZr.woff2 +0 -0
- package/web/assets/noto-sans-sc-103-wght-normal-DGHo20nu.woff2 +0 -0
- package/web/assets/noto-sans-sc-104-wght-normal-CJT2ioDJ.woff2 +0 -0
- package/web/assets/noto-sans-sc-105-wght-normal-BFoiJwz2.woff2 +0 -0
- package/web/assets/noto-sans-sc-106-wght-normal-D6uUHw3w.woff2 +0 -0
- package/web/assets/noto-sans-sc-107-wght-normal-kFQzJDLH.woff2 +0 -0
- package/web/assets/noto-sans-sc-108-wght-normal-7aXvqIa2.woff2 +0 -0
- package/web/assets/noto-sans-sc-109-wght-normal-CnjNbNmw.woff2 +0 -0
- package/web/assets/noto-sans-sc-110-wght-normal-D2JBr045.woff2 +0 -0
- package/web/assets/noto-sans-sc-111-wght-normal-ClFr5QXM.woff2 +0 -0
- package/web/assets/noto-sans-sc-112-wght-normal-CiZxJMyY.woff2 +0 -0
- package/web/assets/noto-sans-sc-113-wght-normal-OgQXOX6x.woff2 +0 -0
- package/web/assets/noto-sans-sc-114-wght-normal-CRH9SDZu.woff2 +0 -0
- package/web/assets/noto-sans-sc-115-wght-normal-BN__2iBG.woff2 +0 -0
- package/web/assets/noto-sans-sc-116-wght-normal-vdFVzbO2.woff2 +0 -0
- package/web/assets/noto-sans-sc-117-wght-normal-Dsz3vkzU.woff2 +0 -0
- package/web/assets/noto-sans-sc-118-wght-normal-BPEb0gM9.woff2 +0 -0
- package/web/assets/noto-sans-sc-119-wght-normal-BfzSEbFz.woff2 +0 -0
- package/web/assets/noto-sans-sc-21-wght-normal-DIu_1ZBI.woff2 +0 -0
- package/web/assets/noto-sans-sc-22-wght-normal-VXjdYcT-.woff2 +0 -0
- package/web/assets/noto-sans-sc-23-wght-normal-4HrHKhpL.woff2 +0 -0
- package/web/assets/noto-sans-sc-24-wght-normal-B58DWgHS.woff2 +0 -0
- package/web/assets/noto-sans-sc-25-wght-normal-C3Jm6l7O.woff2 +0 -0
- package/web/assets/noto-sans-sc-26-wght-normal-YNOygvr_.woff2 +0 -0
- package/web/assets/noto-sans-sc-27-wght-normal-BP2pEGQH.woff2 +0 -0
- package/web/assets/noto-sans-sc-28-wght-normal-BWPKDbtH.woff2 +0 -0
- package/web/assets/noto-sans-sc-29-wght-normal-45aVmHn_.woff2 +0 -0
- package/web/assets/noto-sans-sc-30-wght-normal-B8_s30jZ.woff2 +0 -0
- package/web/assets/noto-sans-sc-31-wght-normal-DW0t445S.woff2 +0 -0
- package/web/assets/noto-sans-sc-32-wght-normal-ShbWPcei.woff2 +0 -0
- package/web/assets/noto-sans-sc-33-wght-normal-BOTZYTjM.woff2 +0 -0
- package/web/assets/noto-sans-sc-34-wght-normal-BF1rqDSt.woff2 +0 -0
- package/web/assets/noto-sans-sc-35-wght-normal-Bosspiyr.woff2 +0 -0
- package/web/assets/noto-sans-sc-36-wght-normal-CtU9CyKw.woff2 +0 -0
- package/web/assets/noto-sans-sc-37-wght-normal-ghDiyiuv.woff2 +0 -0
- package/web/assets/noto-sans-sc-38-wght-normal-4Nz8k_dt.woff2 +0 -0
- package/web/assets/noto-sans-sc-39-wght-normal-Ddtm1XVC.woff2 +0 -0
- package/web/assets/noto-sans-sc-40-wght-normal-BVn4-kgX.woff2 +0 -0
- package/web/assets/noto-sans-sc-41-wght-normal-CZqajZnl.woff2 +0 -0
- package/web/assets/noto-sans-sc-42-wght-normal-CQ4lY28u.woff2 +0 -0
- package/web/assets/noto-sans-sc-43-wght-normal-psppu0d8.woff2 +0 -0
- package/web/assets/noto-sans-sc-44-wght-normal-cbKJlTUe.woff2 +0 -0
- package/web/assets/noto-sans-sc-45-wght-normal-MKIEVRIC.woff2 +0 -0
- package/web/assets/noto-sans-sc-46-wght-normal-CErGc6Mt.woff2 +0 -0
- package/web/assets/noto-sans-sc-47-wght-normal-C5Kgg1_m.woff2 +0 -0
- package/web/assets/noto-sans-sc-48-wght-normal-DFMjDDY6.woff2 +0 -0
- package/web/assets/noto-sans-sc-49-wght-normal-B7l_3BZr.woff2 +0 -0
- package/web/assets/noto-sans-sc-5-wght-normal-DI846rD9.woff2 +0 -0
- package/web/assets/noto-sans-sc-50-wght-normal-C5KfAmFp.woff2 +0 -0
- package/web/assets/noto-sans-sc-51-wght-normal-C2bq6hC8.woff2 +0 -0
- package/web/assets/noto-sans-sc-52-wght-normal-P18e_Y0j.woff2 +0 -0
- package/web/assets/noto-sans-sc-53-wght-normal-Bgkuo2tF.woff2 +0 -0
- package/web/assets/noto-sans-sc-54-wght-normal-DL5lmlUd.woff2 +0 -0
- package/web/assets/noto-sans-sc-55-wght-normal-BV_Oy6IF.woff2 +0 -0
- package/web/assets/noto-sans-sc-56-wght-normal-B4L7Hj8f.woff2 +0 -0
- package/web/assets/noto-sans-sc-57-wght-normal-DU8YBsDj.woff2 +0 -0
- package/web/assets/noto-sans-sc-58-wght-normal-CE0BKS9u.woff2 +0 -0
- package/web/assets/noto-sans-sc-59-wght-normal-Azv2Ku9_.woff2 +0 -0
- package/web/assets/noto-sans-sc-6-wght-normal-ozUCEY9O.woff2 +0 -0
- package/web/assets/noto-sans-sc-60-wght-normal-C1lngC61.woff2 +0 -0
- package/web/assets/noto-sans-sc-61-wght-normal-BxWkGF5M.woff2 +0 -0
- package/web/assets/noto-sans-sc-62-wght-normal-CXXMAq-5.woff2 +0 -0
- package/web/assets/noto-sans-sc-63-wght-normal-4La5uKvS.woff2 +0 -0
- package/web/assets/noto-sans-sc-64-wght-normal-CbIuD2Eg.woff2 +0 -0
- package/web/assets/noto-sans-sc-65-wght-normal-BGqvKda2.woff2 +0 -0
- package/web/assets/noto-sans-sc-66-wght-normal-BvNozWOY.woff2 +0 -0
- package/web/assets/noto-sans-sc-67-wght-normal-CC-WRBV-.woff2 +0 -0
- package/web/assets/noto-sans-sc-68-wght-normal-c0FjfUaj.woff2 +0 -0
- package/web/assets/noto-sans-sc-69-wght-normal-D596Jjl2.woff2 +0 -0
- package/web/assets/noto-sans-sc-70-wght-normal-ColEcmtJ.woff2 +0 -0
- package/web/assets/noto-sans-sc-71-wght-normal-ChZfXpdg.woff2 +0 -0
- package/web/assets/noto-sans-sc-72-wght-normal-D1VyfEG3.woff2 +0 -0
- package/web/assets/noto-sans-sc-73-wght-normal-DwSJRYPJ.woff2 +0 -0
- package/web/assets/noto-sans-sc-74-wght-normal-Cte7o1QG.woff2 +0 -0
- package/web/assets/noto-sans-sc-75-wght-normal-B0qL41rF.woff2 +0 -0
- package/web/assets/noto-sans-sc-76-wght-normal-BPLMO_2x.woff2 +0 -0
- package/web/assets/noto-sans-sc-77-wght-normal-Dkbi3pye.woff2 +0 -0
- package/web/assets/noto-sans-sc-78-wght-normal-BFUXeSw6.woff2 +0 -0
- package/web/assets/noto-sans-sc-79-wght-normal-DoJG4UTB.woff2 +0 -0
- package/web/assets/noto-sans-sc-80-wght-normal-BEFypWOO.woff2 +0 -0
- package/web/assets/noto-sans-sc-81-wght-normal-ed_TZlfo.woff2 +0 -0
- package/web/assets/noto-sans-sc-82-wght-normal-DcxfR5OJ.woff2 +0 -0
- package/web/assets/noto-sans-sc-83-wght-normal-C9UjAcMM.woff2 +0 -0
- package/web/assets/noto-sans-sc-84-wght-normal-C7NxT478.woff2 +0 -0
- package/web/assets/noto-sans-sc-85-wght-normal-DBcDBu1n.woff2 +0 -0
- package/web/assets/noto-sans-sc-86-wght-normal-CLJIoPpl.woff2 +0 -0
- package/web/assets/noto-sans-sc-87-wght-normal-DYfJ-vGE.woff2 +0 -0
- package/web/assets/noto-sans-sc-88-wght-normal-ClNDOCGW.woff2 +0 -0
- package/web/assets/noto-sans-sc-89-wght-normal-IQU_KQA8.woff2 +0 -0
- package/web/assets/noto-sans-sc-90-wght-normal-BWcrRNoG.woff2 +0 -0
- package/web/assets/noto-sans-sc-91-wght-normal-CGekvDdH.woff2 +0 -0
- package/web/assets/noto-sans-sc-99-wght-normal-Q_IptJM5.woff2 +0 -0
- package/web/assets/noto-sans-sc-cyrillic-wght-normal-CRA5_Pf1.woff2 +0 -0
- package/web/assets/noto-sans-sc-latin-ext-wght-normal-CqPqLCfe.woff2 +0 -0
- package/web/assets/noto-sans-sc-latin-wght-normal-DYAKOyvl.woff2 +0 -0
- package/web/assets/noto-sans-sc-vietnamese-wght-normal-y5SU35Rl.woff2 +0 -0
- package/web/assets/noto-serif-sc-100-600-normal-D0qqf2FH.woff +0 -0
- package/web/assets/noto-serif-sc-100-600-normal-uh_IoJFx.woff2 +0 -0
- package/web/assets/noto-serif-sc-101-600-normal-2GhDPa64.woff +0 -0
- package/web/assets/noto-serif-sc-101-600-normal-Ys4oPPtJ.woff2 +0 -0
- package/web/assets/noto-serif-sc-102-600-normal-BmVzeMTm.woff2 +0 -0
- package/web/assets/noto-serif-sc-102-600-normal-Dv35JvcO.woff +0 -0
- package/web/assets/noto-serif-sc-103-600-normal-DpH6oHB8.woff2 +0 -0
- package/web/assets/noto-serif-sc-103-600-normal-aJy0RLqC.woff +0 -0
- package/web/assets/noto-serif-sc-104-600-normal-3k-EiYVy.woff2 +0 -0
- package/web/assets/noto-serif-sc-104-600-normal-C4fff-fj.woff +0 -0
- package/web/assets/noto-serif-sc-105-600-normal-BNBEItVT.woff +0 -0
- package/web/assets/noto-serif-sc-105-600-normal-CCTiQ5qX.woff2 +0 -0
- package/web/assets/noto-serif-sc-106-600-normal-BJ7RqBay.woff2 +0 -0
- package/web/assets/noto-serif-sc-106-600-normal-D3lg0MkT.woff +0 -0
- package/web/assets/noto-serif-sc-107-600-normal-BwUVN0EW.woff +0 -0
- package/web/assets/noto-serif-sc-107-600-normal-D0j9nGe7.woff2 +0 -0
- package/web/assets/noto-serif-sc-108-600-normal-CwDLTI0X.woff2 +0 -0
- package/web/assets/noto-serif-sc-108-600-normal-njKn1CWj.woff +0 -0
- package/web/assets/noto-serif-sc-109-600-normal-DdK0MDGP.woff2 +0 -0
- package/web/assets/noto-serif-sc-109-600-normal-Dze0SI9v.woff +0 -0
- package/web/assets/noto-serif-sc-110-600-normal-44VGnLkx.woff +0 -0
- package/web/assets/noto-serif-sc-110-600-normal-cKCRFN_s.woff2 +0 -0
- package/web/assets/noto-serif-sc-111-600-normal-5mjL32C9.woff +0 -0
- package/web/assets/noto-serif-sc-111-600-normal-XLxRoWaL.woff2 +0 -0
- package/web/assets/noto-serif-sc-112-600-normal-BXOT4IRd.woff +0 -0
- package/web/assets/noto-serif-sc-112-600-normal-Duud2wIz.woff2 +0 -0
- package/web/assets/noto-serif-sc-113-600-normal-DpX-J6IX.woff +0 -0
- package/web/assets/noto-serif-sc-113-600-normal-YtVfFfTz.woff2 +0 -0
- package/web/assets/noto-serif-sc-114-600-normal-C-hrBGSG.woff2 +0 -0
- package/web/assets/noto-serif-sc-114-600-normal-bVjl41Tf.woff +0 -0
- package/web/assets/noto-serif-sc-115-600-normal-D69YZdgh.woff2 +0 -0
- package/web/assets/noto-serif-sc-115-600-normal-LLF4Lw2Q.woff +0 -0
- package/web/assets/noto-serif-sc-116-600-normal-49kpVL2K.woff2 +0 -0
- package/web/assets/noto-serif-sc-116-600-normal-DEEl2Uj7.woff +0 -0
- package/web/assets/noto-serif-sc-117-600-normal-C8g97LXR.woff2 +0 -0
- package/web/assets/noto-serif-sc-117-600-normal-DrYDeaAJ.woff +0 -0
- package/web/assets/noto-serif-sc-118-600-normal-DwffOh3i.woff2 +0 -0
- package/web/assets/noto-serif-sc-118-600-normal-KajFUu8n.woff +0 -0
- package/web/assets/noto-serif-sc-119-600-normal-B9ePibdf.woff +0 -0
- package/web/assets/noto-serif-sc-119-600-normal-D5qeL6rC.woff2 +0 -0
- package/web/assets/noto-serif-sc-21-600-normal-D_yF_Wxn.woff +0 -0
- package/web/assets/noto-serif-sc-21-600-normal-_PQd8BN_.woff2 +0 -0
- package/web/assets/noto-serif-sc-22-600-normal-BO3-pVoG.woff +0 -0
- package/web/assets/noto-serif-sc-22-600-normal-D5jlEshw.woff2 +0 -0
- package/web/assets/noto-serif-sc-23-600-normal-ng-dV9Hd.woff +0 -0
- package/web/assets/noto-serif-sc-23-600-normal-uiZnJP_P.woff2 +0 -0
- package/web/assets/noto-serif-sc-24-600-normal-5naS3mOj.woff +0 -0
- package/web/assets/noto-serif-sc-24-600-normal-CwutompM.woff2 +0 -0
- package/web/assets/noto-serif-sc-25-600-normal-3IUkC0Iv.woff +0 -0
- package/web/assets/noto-serif-sc-25-600-normal-BrYZKcM-.woff2 +0 -0
- package/web/assets/noto-serif-sc-26-600-normal-CZYxwYX-.woff +0 -0
- package/web/assets/noto-serif-sc-26-600-normal-cWrhG_Uf.woff2 +0 -0
- package/web/assets/noto-serif-sc-27-600-normal-BN2jomxJ.woff +0 -0
- package/web/assets/noto-serif-sc-27-600-normal-DkUFPCZd.woff2 +0 -0
- package/web/assets/noto-serif-sc-28-600-normal-Bs30I99c.woff +0 -0
- package/web/assets/noto-serif-sc-28-600-normal-XaL8GGeQ.woff2 +0 -0
- package/web/assets/noto-serif-sc-29-600-normal-8lGnoht7.woff2 +0 -0
- package/web/assets/noto-serif-sc-29-600-normal-B8qFBPAN.woff +0 -0
- package/web/assets/noto-serif-sc-30-600-normal-3HuH6t7W.woff +0 -0
- package/web/assets/noto-serif-sc-30-600-normal-C9Y_cE8D.woff2 +0 -0
- package/web/assets/noto-serif-sc-31-600-normal-2BmGlKeS.woff2 +0 -0
- package/web/assets/noto-serif-sc-31-600-normal-CgRfoUIG.woff +0 -0
- package/web/assets/noto-serif-sc-32-600-normal-DP-j0Lfs.woff2 +0 -0
- package/web/assets/noto-serif-sc-32-600-normal-cOJA42KT.woff +0 -0
- package/web/assets/noto-serif-sc-33-600-normal-Cv7tiXLq.woff2 +0 -0
- package/web/assets/noto-serif-sc-33-600-normal-DVvQFaBK.woff +0 -0
- package/web/assets/noto-serif-sc-34-600-normal-CMRkVNzB.woff +0 -0
- package/web/assets/noto-serif-sc-34-600-normal-DKigZWC6.woff2 +0 -0
- package/web/assets/noto-serif-sc-35-600-normal-DQYFY9nS.woff2 +0 -0
- package/web/assets/noto-serif-sc-35-600-normal-Djtz0PS3.woff +0 -0
- package/web/assets/noto-serif-sc-36-600-normal-DGK1YyF8.woff +0 -0
- package/web/assets/noto-serif-sc-36-600-normal-Ducnbglz.woff2 +0 -0
- package/web/assets/noto-serif-sc-37-600-normal-DjEfSzt1.woff +0 -0
- package/web/assets/noto-serif-sc-37-600-normal-McTCeQzZ.woff2 +0 -0
- package/web/assets/noto-serif-sc-38-600-normal-CJ3lCqLY.woff2 +0 -0
- package/web/assets/noto-serif-sc-38-600-normal-CznsBx4K.woff +0 -0
- package/web/assets/noto-serif-sc-39-600-normal-D0Q8YpL5.woff2 +0 -0
- package/web/assets/noto-serif-sc-39-600-normal-uuD0bLKt.woff +0 -0
- package/web/assets/noto-serif-sc-40-600-normal-DnIF4UAp.woff +0 -0
- package/web/assets/noto-serif-sc-40-600-normal-fcME6L_n.woff2 +0 -0
- package/web/assets/noto-serif-sc-41-600-normal-CIvlTtvF.woff +0 -0
- package/web/assets/noto-serif-sc-41-600-normal-YeKaF0XT.woff2 +0 -0
- package/web/assets/noto-serif-sc-42-600-normal-B76atbEX.woff +0 -0
- package/web/assets/noto-serif-sc-42-600-normal-DNL8lEL-.woff2 +0 -0
- package/web/assets/noto-serif-sc-43-600-normal-Dr1OslfX.woff +0 -0
- package/web/assets/noto-serif-sc-43-600-normal-fdH3n3TW.woff2 +0 -0
- package/web/assets/noto-serif-sc-44-600-normal-BtuBxRsU.woff +0 -0
- package/web/assets/noto-serif-sc-44-600-normal-DAMFuI24.woff2 +0 -0
- package/web/assets/noto-serif-sc-45-600-normal-BD0I3MMN.woff +0 -0
- package/web/assets/noto-serif-sc-45-600-normal-w-zsCBKj.woff2 +0 -0
- package/web/assets/noto-serif-sc-46-600-normal-BYbgSWBW.woff2 +0 -0
- package/web/assets/noto-serif-sc-46-600-normal-BZT-Z_qL.woff +0 -0
- package/web/assets/noto-serif-sc-47-600-normal-ClX6HxDM.woff +0 -0
- package/web/assets/noto-serif-sc-47-600-normal-Dt6vpqbe.woff2 +0 -0
- package/web/assets/noto-serif-sc-48-600-normal-C95hAT1H.woff +0 -0
- package/web/assets/noto-serif-sc-48-600-normal-Cgzk7A-m.woff2 +0 -0
- package/web/assets/noto-serif-sc-49-600-normal-BXMLxxq6.woff +0 -0
- package/web/assets/noto-serif-sc-49-600-normal-vldr0UIr.woff2 +0 -0
- package/web/assets/noto-serif-sc-5-600-normal-D3i69n09.woff2 +0 -0
- package/web/assets/noto-serif-sc-5-600-normal-DtnVZAMM.woff +0 -0
- package/web/assets/noto-serif-sc-50-600-normal-BXZUtCHC.woff +0 -0
- package/web/assets/noto-serif-sc-50-600-normal-DKHiFV3R.woff2 +0 -0
- package/web/assets/noto-serif-sc-51-600-normal-C-Xhd3d0.woff +0 -0
- package/web/assets/noto-serif-sc-51-600-normal-nHUiYj73.woff2 +0 -0
- package/web/assets/noto-serif-sc-52-600-normal-9RNk20kp.woff2 +0 -0
- package/web/assets/noto-serif-sc-52-600-normal-DtKIeM_6.woff +0 -0
- package/web/assets/noto-serif-sc-53-600-normal-gS-rjJhY.woff2 +0 -0
- package/web/assets/noto-serif-sc-53-600-normal-jQjopl-t.woff +0 -0
- package/web/assets/noto-serif-sc-54-600-normal-BPFDQXfv.woff +0 -0
- package/web/assets/noto-serif-sc-54-600-normal-B_o-8ntD.woff2 +0 -0
- package/web/assets/noto-serif-sc-55-600-normal-BGp_sKT8.woff2 +0 -0
- package/web/assets/noto-serif-sc-55-600-normal-DGske1mT.woff +0 -0
- package/web/assets/noto-serif-sc-56-600-normal-CSYKyWdB.woff +0 -0
- package/web/assets/noto-serif-sc-56-600-normal-DT8nGt-C.woff2 +0 -0
- package/web/assets/noto-serif-sc-57-600-normal-Cgb0wYNl.woff2 +0 -0
- package/web/assets/noto-serif-sc-57-600-normal-rqGE0_mL.woff +0 -0
- package/web/assets/noto-serif-sc-58-600-normal-BqYlXKg9.woff2 +0 -0
- package/web/assets/noto-serif-sc-58-600-normal-CnBT472x.woff +0 -0
- package/web/assets/noto-serif-sc-59-600-normal-C-nXHi1d.woff +0 -0
- package/web/assets/noto-serif-sc-59-600-normal-Cira1fIq.woff2 +0 -0
- package/web/assets/noto-serif-sc-6-600-normal-BD86pU7T.woff2 +0 -0
- package/web/assets/noto-serif-sc-6-600-normal-DA8uaRLK.woff +0 -0
- package/web/assets/noto-serif-sc-60-600-normal-D7VLrwpW.woff2 +0 -0
- package/web/assets/noto-serif-sc-60-600-normal-DcXdliJX.woff +0 -0
- package/web/assets/noto-serif-sc-61-600-normal-BqnnDMe4.woff2 +0 -0
- package/web/assets/noto-serif-sc-61-600-normal-CxDK0kLI.woff +0 -0
- package/web/assets/noto-serif-sc-62-600-normal-BHki2drM.woff +0 -0
- package/web/assets/noto-serif-sc-62-600-normal-jrKoNELA.woff2 +0 -0
- package/web/assets/noto-serif-sc-63-600-normal-Bcn-YilJ.woff +0 -0
- package/web/assets/noto-serif-sc-63-600-normal-DS1bP-c2.woff2 +0 -0
- package/web/assets/noto-serif-sc-64-600-normal-BQ4G_liA.woff2 +0 -0
- package/web/assets/noto-serif-sc-64-600-normal-C1-RvBnL.woff +0 -0
- package/web/assets/noto-serif-sc-65-600-normal-Bd9BN6aw.woff2 +0 -0
- package/web/assets/noto-serif-sc-65-600-normal-s7c8n2f1.woff +0 -0
- package/web/assets/noto-serif-sc-66-600-normal-B7M8u89Z.woff +0 -0
- package/web/assets/noto-serif-sc-66-600-normal-DSrxtfqE.woff2 +0 -0
- package/web/assets/noto-serif-sc-67-600-normal-2GhgZmDb.woff +0 -0
- package/web/assets/noto-serif-sc-67-600-normal-DhJqqc0a.woff2 +0 -0
- package/web/assets/noto-serif-sc-68-600-normal-CD6N2EHW.woff +0 -0
- package/web/assets/noto-serif-sc-68-600-normal-Cu5PSJ9e.woff2 +0 -0
- package/web/assets/noto-serif-sc-69-600-normal-C7k0bY5l.woff +0 -0
- package/web/assets/noto-serif-sc-69-600-normal-rb2BrEVf.woff2 +0 -0
- package/web/assets/noto-serif-sc-70-600-normal-B3KIj-92.woff2 +0 -0
- package/web/assets/noto-serif-sc-70-600-normal-Bxb1A2wb.woff +0 -0
- package/web/assets/noto-serif-sc-71-600-normal-IpCSs6ls.woff2 +0 -0
- package/web/assets/noto-serif-sc-71-600-normal-j4RvFT4c.woff +0 -0
- package/web/assets/noto-serif-sc-72-600-normal-CFJRieib.woff2 +0 -0
- package/web/assets/noto-serif-sc-72-600-normal-DnOS091c.woff +0 -0
- package/web/assets/noto-serif-sc-73-600-normal-CbYPXTWi.woff2 +0 -0
- package/web/assets/noto-serif-sc-73-600-normal-DKp6D5NE.woff +0 -0
- package/web/assets/noto-serif-sc-74-600-normal-BKOA1Wry.woff +0 -0
- package/web/assets/noto-serif-sc-74-600-normal-CB3LHEvz.woff2 +0 -0
- package/web/assets/noto-serif-sc-75-600-normal-DsXXCaJ8.woff2 +0 -0
- package/web/assets/noto-serif-sc-75-600-normal-WzN9JMBq.woff +0 -0
- package/web/assets/noto-serif-sc-76-600-normal-B7AFa0rQ.woff +0 -0
- package/web/assets/noto-serif-sc-76-600-normal-CtcmdgJ2.woff2 +0 -0
- package/web/assets/noto-serif-sc-77-600-normal-DtYSEeO8.woff +0 -0
- package/web/assets/noto-serif-sc-77-600-normal-DttXU36r.woff2 +0 -0
- package/web/assets/noto-serif-sc-78-600-normal-BqkDiVax.woff +0 -0
- package/web/assets/noto-serif-sc-78-600-normal-BusMfsVJ.woff2 +0 -0
- package/web/assets/noto-serif-sc-79-600-normal-BHbanJa9.woff +0 -0
- package/web/assets/noto-serif-sc-79-600-normal-DVfmjx1b.woff2 +0 -0
- package/web/assets/noto-serif-sc-80-600-normal-CDfycluH.woff2 +0 -0
- package/web/assets/noto-serif-sc-80-600-normal-Cdid6_hz.woff +0 -0
- package/web/assets/noto-serif-sc-81-600-normal-Du7JGDyA.woff +0 -0
- package/web/assets/noto-serif-sc-81-600-normal-a7j_jqcg.woff2 +0 -0
- package/web/assets/noto-serif-sc-82-600-normal-DCFrz86S.woff +0 -0
- package/web/assets/noto-serif-sc-82-600-normal-qWSV0sqg.woff2 +0 -0
- package/web/assets/noto-serif-sc-83-600-normal-CLZehAUC.woff +0 -0
- package/web/assets/noto-serif-sc-83-600-normal-CxNt5b9H.woff2 +0 -0
- package/web/assets/noto-serif-sc-84-600-normal-C9alyfXE.woff2 +0 -0
- package/web/assets/noto-serif-sc-84-600-normal-D-7JRKTU.woff +0 -0
- package/web/assets/noto-serif-sc-85-600-normal-Cia0LasY.woff2 +0 -0
- package/web/assets/noto-serif-sc-85-600-normal-DgertXCd.woff +0 -0
- package/web/assets/noto-serif-sc-86-600-normal-5CAU0Sus.woff2 +0 -0
- package/web/assets/noto-serif-sc-86-600-normal-CwWuoxt9.woff +0 -0
- package/web/assets/noto-serif-sc-87-600-normal-CKF4RKik.woff +0 -0
- package/web/assets/noto-serif-sc-87-600-normal-DV5DGk8Y.woff2 +0 -0
- package/web/assets/noto-serif-sc-88-600-normal-BSIsC0p_.woff +0 -0
- package/web/assets/noto-serif-sc-88-600-normal-DkXoJX-V.woff2 +0 -0
- package/web/assets/noto-serif-sc-89-600-normal-BDhAhJVX.woff2 +0 -0
- package/web/assets/noto-serif-sc-89-600-normal-p6jJ4vd9.woff +0 -0
- package/web/assets/noto-serif-sc-90-600-normal-D6PfyWjD.woff +0 -0
- package/web/assets/noto-serif-sc-90-600-normal-DEC_HMBk.woff2 +0 -0
- package/web/assets/noto-serif-sc-91-600-normal-IHzbmDKb.woff2 +0 -0
- package/web/assets/noto-serif-sc-91-600-normal-vLpwZzut.woff +0 -0
- package/web/assets/noto-serif-sc-99-600-normal-BU9QyKIb.woff2 +0 -0
- package/web/assets/noto-serif-sc-99-600-normal-PUDYqOFt.woff +0 -0
- package/web/assets/noto-serif-sc-cyrillic-600-normal-C3MRdUTw.woff2 +0 -0
- package/web/assets/noto-serif-sc-cyrillic-600-normal-DM--ERCl.woff +0 -0
- package/web/assets/noto-serif-sc-latin-600-normal-B99s59ZT.woff2 +0 -0
- package/web/assets/noto-serif-sc-latin-600-normal-DUu-MBTC.woff +0 -0
- package/web/assets/noto-serif-sc-latin-ext-600-normal-CKIGwhVt.woff2 +0 -0
- package/web/assets/noto-serif-sc-latin-ext-600-normal-CThywN6v.woff +0 -0
- package/web/assets/noto-serif-sc-vietnamese-600-normal-BjxuXj--.woff +0 -0
- package/web/assets/noto-serif-sc-vietnamese-600-normal-IATmd2p1.woff2 +0 -0
- package/web/index.html +33 -0
package/lib/analyzer.js
ADDED
|
@@ -0,0 +1,765 @@
|
|
|
1
|
+
import { createRequire as __adgCreateRequire } from 'node:module'; import { dirname as __adgDirname } from 'node:path'; import { fileURLToPath as __adgFileURLToPath } from 'node:url'; const require = __adgCreateRequire(import.meta.url); const __filename = __adgFileURLToPath(import.meta.url); const __dirname = __adgDirname(__filename);
|
|
2
|
+
import {
|
|
3
|
+
probeProject
|
|
4
|
+
} from "./chunk-KIAOFNCB.js";
|
|
5
|
+
import {
|
|
6
|
+
MANIFEST_FILE,
|
|
7
|
+
SKILL_FILE,
|
|
8
|
+
parseManifest,
|
|
9
|
+
require_dist
|
|
10
|
+
} from "./chunk-7XMNAHZ2.js";
|
|
11
|
+
import {
|
|
12
|
+
PACKS_CAPABILITY,
|
|
13
|
+
ScriptId,
|
|
14
|
+
external_exports
|
|
15
|
+
} from "./chunk-BL6OSR2I.js";
|
|
16
|
+
import {
|
|
17
|
+
__toESM
|
|
18
|
+
} from "./chunk-2UFLGPDY.js";
|
|
19
|
+
|
|
20
|
+
// packages/analyzer/lib/index.js
|
|
21
|
+
import { execFile } from "node:child_process";
|
|
22
|
+
import { readFile as readFile4 } from "node:fs/promises";
|
|
23
|
+
import { join as join4 } from "node:path";
|
|
24
|
+
import { TextDecoder } from "node:util";
|
|
25
|
+
import { Service } from "@deepseek-ai/cordis";
|
|
26
|
+
|
|
27
|
+
// packages/analyzer/lib/analyze.js
|
|
28
|
+
import { readdir, readFile as readFile2, stat } from "node:fs/promises";
|
|
29
|
+
import { extname, join as join2, relative } from "node:path";
|
|
30
|
+
|
|
31
|
+
// packages/analyzer/lib/jsonc.js
|
|
32
|
+
function stripJsonc(source) {
|
|
33
|
+
let out = "";
|
|
34
|
+
let i = 0;
|
|
35
|
+
let inString = false;
|
|
36
|
+
while (i < source.length) {
|
|
37
|
+
const c = source[i];
|
|
38
|
+
const next = source[i + 1];
|
|
39
|
+
if (inString) {
|
|
40
|
+
out += c;
|
|
41
|
+
if (c === "\\" && next !== void 0) {
|
|
42
|
+
out += next;
|
|
43
|
+
i += 2;
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (c === '"')
|
|
47
|
+
inString = false;
|
|
48
|
+
i += 1;
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (c === '"') {
|
|
52
|
+
inString = true;
|
|
53
|
+
out += c;
|
|
54
|
+
i += 1;
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (c === "/" && next === "/") {
|
|
58
|
+
while (i < source.length && source[i] !== "\n")
|
|
59
|
+
i += 1;
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
if (c === "/" && next === "*") {
|
|
63
|
+
const end = source.indexOf("*/", i + 2);
|
|
64
|
+
i = end < 0 ? source.length : end + 2;
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
out += c;
|
|
68
|
+
i += 1;
|
|
69
|
+
}
|
|
70
|
+
return removeTrailingCommas(out);
|
|
71
|
+
}
|
|
72
|
+
function removeTrailingCommas(text) {
|
|
73
|
+
let out = "";
|
|
74
|
+
let inString = false;
|
|
75
|
+
for (let i = 0; i < text.length; i++) {
|
|
76
|
+
const c = text[i];
|
|
77
|
+
if (inString) {
|
|
78
|
+
out += c;
|
|
79
|
+
if (c === "\\")
|
|
80
|
+
out += text[++i] ?? "";
|
|
81
|
+
else if (c === '"')
|
|
82
|
+
inString = false;
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (c === '"')
|
|
86
|
+
inString = true;
|
|
87
|
+
if (c === ",") {
|
|
88
|
+
let j = i + 1;
|
|
89
|
+
while (j < text.length && /\s/.test(text[j]))
|
|
90
|
+
j++;
|
|
91
|
+
if (text[j] === "}" || text[j] === "]")
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
out += c;
|
|
95
|
+
}
|
|
96
|
+
return out;
|
|
97
|
+
}
|
|
98
|
+
function parseJsonc(source) {
|
|
99
|
+
return JSON.parse(stripJsonc(source.replace(/^/, "")));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// packages/analyzer/lib/maafw.js
|
|
103
|
+
import { readFile } from "node:fs/promises";
|
|
104
|
+
import { dirname, join } from "node:path";
|
|
105
|
+
async function readInterface(file) {
|
|
106
|
+
const root = dirname(file);
|
|
107
|
+
const problems = [];
|
|
108
|
+
const load = async (path) => {
|
|
109
|
+
try {
|
|
110
|
+
return parseJsonc(await readFile(path, "utf8"));
|
|
111
|
+
} catch (error) {
|
|
112
|
+
problems.push(`${path}: ${error instanceof Error ? error.message : String(error)}`);
|
|
113
|
+
return void 0;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
const main = await load(file);
|
|
117
|
+
if (main === void 0)
|
|
118
|
+
return { controllers: [], tasks: [], problems };
|
|
119
|
+
const rawTasks = [];
|
|
120
|
+
const options = {};
|
|
121
|
+
const collect = (doc) => {
|
|
122
|
+
for (const task of asArray(doc["task"]))
|
|
123
|
+
if (isObject(task))
|
|
124
|
+
rawTasks.push(task);
|
|
125
|
+
if (isObject(doc["option"]))
|
|
126
|
+
Object.assign(options, doc["option"]);
|
|
127
|
+
};
|
|
128
|
+
collect(main);
|
|
129
|
+
for (const rel of asArray(main["import"]).filter((v) => typeof v === "string")) {
|
|
130
|
+
const doc = await load(join(root, rel));
|
|
131
|
+
if (doc !== void 0)
|
|
132
|
+
collect(doc);
|
|
133
|
+
}
|
|
134
|
+
const locale = await localeOf(main, root);
|
|
135
|
+
const text = (value) => {
|
|
136
|
+
if (typeof value !== "string")
|
|
137
|
+
return void 0;
|
|
138
|
+
if (!value.startsWith("$"))
|
|
139
|
+
return value;
|
|
140
|
+
const resolved = locale?.[value.slice(1)];
|
|
141
|
+
return typeof resolved === "string" ? resolved : void 0;
|
|
142
|
+
};
|
|
143
|
+
const controllers = asArray(main["controller"]).filter(isObject).map((c) => {
|
|
144
|
+
const win32 = isObject(c["win32"]) ? c["win32"] : {};
|
|
145
|
+
const label = text(c["label"]);
|
|
146
|
+
return {
|
|
147
|
+
name: String(c["name"] ?? ""),
|
|
148
|
+
type: String(c["type"] ?? ""),
|
|
149
|
+
...label === void 0 ? {} : { label },
|
|
150
|
+
...typeof win32["mouse"] === "string" ? { mouse: win32["mouse"] } : {},
|
|
151
|
+
...typeof win32["keyboard"] === "string" ? { keyboard: win32["keyboard"] } : {}
|
|
152
|
+
};
|
|
153
|
+
});
|
|
154
|
+
const tasks = rawTasks.map((t) => {
|
|
155
|
+
const label = text(t["label"]);
|
|
156
|
+
const description = text(t["description"]);
|
|
157
|
+
return {
|
|
158
|
+
name: String(t["name"] ?? ""),
|
|
159
|
+
...label === void 0 ? {} : { label },
|
|
160
|
+
...description === void 0 ? {} : { description: description.slice(0, 300) },
|
|
161
|
+
...typeof t["entry"] === "string" ? { entry: t["entry"] } : {},
|
|
162
|
+
...Array.isArray(t["controller"]) ? { controllers: t["controller"].map(String) } : {},
|
|
163
|
+
options: asArray(t["option"]).filter((o) => typeof o === "string").map((name) => {
|
|
164
|
+
const spec = options[name] ?? {};
|
|
165
|
+
const optionLabel = text(spec["label"]);
|
|
166
|
+
const cases = asArray(spec["cases"]).filter(isObject).map((c) => String(c["name"] ?? ""));
|
|
167
|
+
return { name, ...optionLabel === void 0 ? {} : { label: optionLabel }, ...typeof spec["type"] === "string" ? { type: spec["type"] } : {}, ...cases.length === 0 ? {} : { cases } };
|
|
168
|
+
})
|
|
169
|
+
};
|
|
170
|
+
});
|
|
171
|
+
return {
|
|
172
|
+
...typeof main["name"] === "string" ? { name: main["name"] } : {},
|
|
173
|
+
...typeof main["version"] === "string" ? { version: main["version"] } : {},
|
|
174
|
+
controllers,
|
|
175
|
+
tasks,
|
|
176
|
+
problems
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
async function localeOf(main, root) {
|
|
180
|
+
const languages = isObject(main["languages"]) ? main["languages"] : {};
|
|
181
|
+
const rel = languages["zh_cn"] ?? languages["zh-CN"] ?? languages["zh_CN"];
|
|
182
|
+
if (typeof rel !== "string")
|
|
183
|
+
return void 0;
|
|
184
|
+
try {
|
|
185
|
+
return flatten(parseJsonc(await readFile(join(root, rel), "utf8")));
|
|
186
|
+
} catch {
|
|
187
|
+
return void 0;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
function flatten(value, prefix = "", out = {}) {
|
|
191
|
+
if (isObject(value)) {
|
|
192
|
+
for (const [k, v] of Object.entries(value)) {
|
|
193
|
+
const key = prefix === "" ? k : `${prefix}.${k}`;
|
|
194
|
+
if (isObject(v))
|
|
195
|
+
flatten(v, key, out);
|
|
196
|
+
out[key] = v;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return out;
|
|
200
|
+
}
|
|
201
|
+
var asArray = (v) => Array.isArray(v) ? v : [];
|
|
202
|
+
var isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
203
|
+
|
|
204
|
+
// packages/analyzer/lib/analyze.js
|
|
205
|
+
var README = /^readme(\.zh(-cn)?|_zh|\.cn)?\.(md|txt)$/i;
|
|
206
|
+
var CONFIG_EXT = /* @__PURE__ */ new Set([".json", ".jsonc", ".yaml", ".yml", ".toml", ".ini", ".cfg", ".conf"]);
|
|
207
|
+
var LOG_EXT = /* @__PURE__ */ new Set([".log", ".txt"]);
|
|
208
|
+
var SKIP = /^(node_modules|\.git|__pycache__|site-packages|lib|libs|runtime|python|3rdparty|res|resource|assets|locales|_internal)$/i;
|
|
209
|
+
var MAX_TREE = 160;
|
|
210
|
+
var MAX_README = 12e3;
|
|
211
|
+
var DOC_EXT = /* @__PURE__ */ new Set([".md", ".markdown", ".txt", ".html", ".htm", ".pdf", ".rst", ".adoc"]);
|
|
212
|
+
var DOC_DIRS = /^(docs?|documents?|documentation|manuals?|help|wiki|guides?|文档|说明|使用说明|帮助|教程)$/i;
|
|
213
|
+
var DOC_NAME = /readme|changelog|changes|release|history|更新|说明|使用|教程|帮助|指南|manual|guide|usage|faq|help|howto|tutorial|wiki/i;
|
|
214
|
+
var MAX_DOCS = 40;
|
|
215
|
+
var MAX_LINKS = 12;
|
|
216
|
+
var DOC_LINK = /^https?:\/\/(?:\S*\b(?:docs?|wiki|readthedocs|gitbook|manual|guide|faq)\b|[^/\s]*\.(?:github|gitee)\.io\b|github\.com\/[\w.-]+\/[\w.-]+\/?$|github\.com\/[\w.-]+\/[\w.-]+\/blob\/\S*\.md$)/i;
|
|
217
|
+
async function analyzeDir(dir) {
|
|
218
|
+
const notes = [];
|
|
219
|
+
const probe = await probeProject(dir);
|
|
220
|
+
const tree = await listTree(dir);
|
|
221
|
+
const top = await readdir(dir).catch(() => []);
|
|
222
|
+
const readmeFile = top.find((n) => /^readme\.zh/i.test(n)) ?? top.find((n) => README.test(n));
|
|
223
|
+
let readme;
|
|
224
|
+
if (readmeFile !== void 0) {
|
|
225
|
+
const text = await readFile2(join2(dir, readmeFile), "utf8").catch(() => "");
|
|
226
|
+
readme = { file: readmeFile, text: text.slice(0, MAX_README), truncated: text.length > MAX_README };
|
|
227
|
+
} else
|
|
228
|
+
notes.push("\u6CA1\u6709 README\uFF1B\u53D1\u5E03\u5305\u91CC\u901A\u5E38\u6CA1\u6709\uFF0C\u53EF\u4EE5\u67E5\u770B\u9879\u76EE\u4E3B\u9875\u6216\u6E90\u7801\u4ED3\u5E93\u7684\u8BF4\u660E");
|
|
229
|
+
const docs = await findDocs(dir);
|
|
230
|
+
if (docs.length === 0 && readme === void 0)
|
|
231
|
+
notes.push("\u76EE\u5F55\u91CC\u6CA1\u6709\u6587\u6863\uFF1A\u5148\u53BB\u9879\u76EE\u4E3B\u9875\u3001GitHub \u4ED3\u5E93\u7684 README / Wiki / \u6587\u6863\u7AD9\u627E\uFF0C\u627E\u4E0D\u5230\u518D\u770B\u4EE3\u7801");
|
|
232
|
+
let iface;
|
|
233
|
+
for (const candidate of ["interface.json", "assets/interface.json"]) {
|
|
234
|
+
if (await isFile(join2(dir, candidate))) {
|
|
235
|
+
iface = { ...await readInterface(join2(dir, candidate)), file: candidate };
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
const configFiles = [];
|
|
240
|
+
const logFiles = [];
|
|
241
|
+
for (const sub of ["", "config", "configs", "setting", "settings", "user", "data"]) {
|
|
242
|
+
const base = join2(dir, sub);
|
|
243
|
+
for (const name of await readdir(base).catch(() => [])) {
|
|
244
|
+
const path = join2(base, name);
|
|
245
|
+
const info = await stat(path).catch(() => void 0);
|
|
246
|
+
if (info === void 0 || !info.isFile())
|
|
247
|
+
continue;
|
|
248
|
+
const rel = relative(dir, path).replace(/\\/g, "/");
|
|
249
|
+
const ext = extname(name).toLowerCase();
|
|
250
|
+
if (CONFIG_EXT.has(ext) && info.size < 2e6 && rel !== "interface.json" && !/(deps|runtimeconfig|package-lock|manifest)\.json$/i.test(name)) {
|
|
251
|
+
let topKeys;
|
|
252
|
+
if (ext === ".json" || ext === ".jsonc") {
|
|
253
|
+
try {
|
|
254
|
+
const value = parseJsonc(await readFile2(path, "utf8"));
|
|
255
|
+
if (value !== null && typeof value === "object" && !Array.isArray(value))
|
|
256
|
+
topKeys = Object.keys(value).slice(0, 30);
|
|
257
|
+
} catch {
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
configFiles.push({ file: rel, size: info.size, ...topKeys === void 0 ? {} : { topKeys } });
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
for (const sub of ["debug", "log", "logs", ""]) {
|
|
265
|
+
const base = join2(dir, sub);
|
|
266
|
+
for (const name of await readdir(base).catch(() => [])) {
|
|
267
|
+
if (!LOG_EXT.has(extname(name).toLowerCase()) || sub === "" && !/log/i.test(name))
|
|
268
|
+
continue;
|
|
269
|
+
const path = join2(base, name);
|
|
270
|
+
const info = await stat(path).catch(() => void 0);
|
|
271
|
+
if (info === void 0 || !info.isFile())
|
|
272
|
+
continue;
|
|
273
|
+
const tail = (await readTail(path, 4096)).split(/\r?\n/).filter(Boolean).slice(-8);
|
|
274
|
+
logFiles.push({ file: relative(dir, path).replace(/\\/g, "/"), size: info.size, tail });
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
if (logFiles.length === 0)
|
|
278
|
+
notes.push("\u8FD8\u6CA1\u6709\u65E5\u5FD7\u6587\u4EF6\uFF1B\u53EF\u80FD\u8981\u5148\u8FD0\u884C\u4E00\u6B21\u811A\u672C\u624D\u4F1A\u751F\u6210\uFF0C\u65E5\u5FD7\u89C4\u5219\u53EF\u4EE5\u5148\u6839\u636E\u6587\u6863\u5199\uFF0C\u8FD0\u884C\u540E\u518D\u6821\u51C6");
|
|
279
|
+
const docLinks = linksIn([readme?.text ?? "", iface === void 0 ? "" : JSON.stringify(iface)].join("\n"));
|
|
280
|
+
const suggestedFamily = iface !== void 0 ? "maafw-pi" : probe.markers.includes("main.py") || probe.markers.includes("pyproject.toml") ? "cli" : configFiles.length > 0 && probe.executables.length > 0 ? "gui-config" : probe.executables.length > 0 ? "generic-process" : "visual";
|
|
281
|
+
return {
|
|
282
|
+
dir,
|
|
283
|
+
probe,
|
|
284
|
+
tree,
|
|
285
|
+
docs,
|
|
286
|
+
docLinks,
|
|
287
|
+
configFiles,
|
|
288
|
+
logFiles,
|
|
289
|
+
suggestedFamily,
|
|
290
|
+
notes,
|
|
291
|
+
...readme === void 0 ? {} : { readme },
|
|
292
|
+
...iface === void 0 ? {} : { interface: iface }
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
async function findDocs(dir) {
|
|
296
|
+
const found = /* @__PURE__ */ new Map();
|
|
297
|
+
const visit = async (rel, depth, inDocs) => {
|
|
298
|
+
for (const entry of await readdir(join2(dir, rel), { withFileTypes: true }).catch(() => [])) {
|
|
299
|
+
if (found.size >= MAX_DOCS * 3)
|
|
300
|
+
return;
|
|
301
|
+
const path = rel === "" ? entry.name : `${rel}/${entry.name}`;
|
|
302
|
+
if (entry.isDirectory()) {
|
|
303
|
+
if (SKIP.test(entry.name) && !DOC_DIRS.test(entry.name))
|
|
304
|
+
continue;
|
|
305
|
+
const docsDir = inDocs || DOC_DIRS.test(entry.name);
|
|
306
|
+
if (depth < (docsDir ? 3 : 1))
|
|
307
|
+
await visit(path, depth + 1, docsDir);
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
if (!entry.isFile() || !DOC_EXT.has(extname(entry.name).toLowerCase()))
|
|
311
|
+
continue;
|
|
312
|
+
if (!inDocs && !DOC_NAME.test(entry.name))
|
|
313
|
+
continue;
|
|
314
|
+
if (/log/i.test(entry.name) && !/changelog/i.test(entry.name))
|
|
315
|
+
continue;
|
|
316
|
+
const info = await stat(join2(dir, path)).catch(() => void 0);
|
|
317
|
+
if (info !== void 0)
|
|
318
|
+
found.set(path, info.size);
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
await visit("", 0, false);
|
|
322
|
+
const weight = (file) => /changelog|changes|release|更新/i.test(file) ? 0 : /readme/i.test(file) ? 1 : 2;
|
|
323
|
+
return [...found].map(([file, size]) => ({ file, size })).sort((a, b) => weight(a.file) - weight(b.file) || b.size - a.size).slice(0, MAX_DOCS);
|
|
324
|
+
}
|
|
325
|
+
function linksIn(text) {
|
|
326
|
+
const links = /* @__PURE__ */ new Set();
|
|
327
|
+
for (const match of text.matchAll(/https?:\/\/[^\s)"'<>\]]+/g)) {
|
|
328
|
+
const url = match[0].replace(/[.,;:!?。,;]+$/, "");
|
|
329
|
+
if (DOC_LINK.test(url) && !/\.(png|jpe?g|gif|svg|webp|zip|7z|exe)(\?|$)/i.test(url) && !/shields\.io|badge/i.test(url))
|
|
330
|
+
links.add(url);
|
|
331
|
+
if (links.size >= MAX_LINKS)
|
|
332
|
+
break;
|
|
333
|
+
}
|
|
334
|
+
return [...links];
|
|
335
|
+
}
|
|
336
|
+
async function listTree(dir) {
|
|
337
|
+
const out = [];
|
|
338
|
+
for (const entry of await readdir(dir, { withFileTypes: true }).catch(() => [])) {
|
|
339
|
+
if (out.length >= MAX_TREE)
|
|
340
|
+
break;
|
|
341
|
+
out.push(entry.isDirectory() ? `${entry.name}/` : entry.name);
|
|
342
|
+
if (!entry.isDirectory() || SKIP.test(entry.name))
|
|
343
|
+
continue;
|
|
344
|
+
for (const inner of (await readdir(join2(dir, entry.name), { withFileTypes: true }).catch(() => [])).slice(0, 25)) {
|
|
345
|
+
if (out.length >= MAX_TREE)
|
|
346
|
+
break;
|
|
347
|
+
out.push(`${entry.name}/${inner.name}${inner.isDirectory() ? "/" : ""}`);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
return out;
|
|
351
|
+
}
|
|
352
|
+
async function readTail(path, bytes) {
|
|
353
|
+
const buffer = await readFile2(path).catch(() => Buffer.alloc(0));
|
|
354
|
+
return buffer.subarray(Math.max(0, buffer.length - bytes)).toString("utf8");
|
|
355
|
+
}
|
|
356
|
+
async function isFile(path) {
|
|
357
|
+
return stat(path).then((s) => s.isFile(), () => false);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// packages/analyzer/lib/drafts.js
|
|
361
|
+
import { cp, mkdir, readdir as readdir2, readFile as readFile3, rename, rm, writeFile } from "node:fs/promises";
|
|
362
|
+
import { join as join3 } from "node:path";
|
|
363
|
+
var DraftStore = class {
|
|
364
|
+
#root;
|
|
365
|
+
#packs;
|
|
366
|
+
#history;
|
|
367
|
+
constructor(dataDir) {
|
|
368
|
+
this.#root = join3(dataDir, "pack-drafts");
|
|
369
|
+
this.#packs = join3(dataDir, "packs");
|
|
370
|
+
this.#history = join3(dataDir, "pack-history");
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Validate and store a draft (replacing an earlier draft for the same pack).
|
|
374
|
+
* @throws PackError naming every problem, so the agent can fix and retry.
|
|
375
|
+
*/
|
|
376
|
+
async propose(meta, manifest, skill) {
|
|
377
|
+
const parsed = parseManifest(manifest, `\u8349\u7A3F ${meta.packId}/${MANIFEST_FILE}`);
|
|
378
|
+
if (parsed.id !== meta.packId)
|
|
379
|
+
throw new Error(`\u811A\u672C\u5305\u7684 id\uFF08${parsed.id}\uFF09\u5FC5\u987B\u7B49\u4E8E pack_id\uFF08${meta.packId}\uFF09`);
|
|
380
|
+
if (!/^---\s*\n[\s\S]*?\bname:\s*\S+[\s\S]*?\bdescription:\s*\S[\s\S]*?\n---/.test(skill)) {
|
|
381
|
+
throw new Error("SKILL.md \u9700\u8981\u4EE5 YAML frontmatter \u5F00\u5934\uFF0C\u81F3\u5C11\u5305\u542B name \u548C description");
|
|
382
|
+
}
|
|
383
|
+
const dir = join3(this.#root, meta.packId);
|
|
384
|
+
await rm(dir, { recursive: true, force: true });
|
|
385
|
+
await mkdir(dir, { recursive: true });
|
|
386
|
+
await writeFile(join3(dir, MANIFEST_FILE), manifest.endsWith("\n") ? manifest : `${manifest}
|
|
387
|
+
`);
|
|
388
|
+
await writeFile(join3(dir, SKILL_FILE), skill.endsWith("\n") ? skill : `${skill}
|
|
389
|
+
`);
|
|
390
|
+
await writeFile(join3(dir, "draft.json"), `${JSON.stringify(meta, null, 2)}
|
|
391
|
+
`);
|
|
392
|
+
return { tasks: parsed.tasks.map((t) => ({ id: t.id, title: t.title })) };
|
|
393
|
+
}
|
|
394
|
+
async list() {
|
|
395
|
+
const out = [];
|
|
396
|
+
for (const id of await readdir2(this.#root).catch(() => [])) {
|
|
397
|
+
const draft = await this.get(id).catch(() => void 0);
|
|
398
|
+
if (draft !== void 0)
|
|
399
|
+
out.push(draft);
|
|
400
|
+
}
|
|
401
|
+
return out.sort((a, b) => b.proposedAt - a.proposedAt);
|
|
402
|
+
}
|
|
403
|
+
async get(packId) {
|
|
404
|
+
const dir = join3(this.#root, packId);
|
|
405
|
+
const meta = JSON.parse(await readFile3(join3(dir, "draft.json"), "utf8"));
|
|
406
|
+
return { ...meta, manifest: await readFile3(join3(dir, MANIFEST_FILE), "utf8"), skill: await readFile3(join3(dir, SKILL_FILE), "utf8").catch(() => "") };
|
|
407
|
+
}
|
|
408
|
+
/** Install the draft as the user's pack. @returns the pack directory. */
|
|
409
|
+
async accept(packId, now = Date.now()) {
|
|
410
|
+
const draft = await this.get(packId);
|
|
411
|
+
parseManifest(draft.manifest);
|
|
412
|
+
const target = join3(this.#packs, packId);
|
|
413
|
+
const previous = await readdir2(target).then(() => true, () => false);
|
|
414
|
+
if (previous) {
|
|
415
|
+
const aside = join3(this.#history, packId, new Date(now).toISOString().replace(/[:.]/g, "-"));
|
|
416
|
+
await mkdir(join3(this.#history, packId), { recursive: true });
|
|
417
|
+
await cp(target, aside, { recursive: true });
|
|
418
|
+
await rm(target, { recursive: true, force: true });
|
|
419
|
+
}
|
|
420
|
+
await mkdir(this.#packs, { recursive: true });
|
|
421
|
+
await rename(join3(this.#root, packId), target);
|
|
422
|
+
await rm(join3(target, "draft.json"), { force: true });
|
|
423
|
+
return { dir: target, meta: draft };
|
|
424
|
+
}
|
|
425
|
+
async reject(packId) {
|
|
426
|
+
await rm(join3(this.#root, packId), { recursive: true, force: true });
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
|
|
430
|
+
// packages/analyzer/lib/skills.js
|
|
431
|
+
var import_yaml = __toESM(require_dist(), 1);
|
|
432
|
+
var SKILL_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
433
|
+
function parseSkill(text, fallbackName) {
|
|
434
|
+
const match = /^?---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/.exec(text);
|
|
435
|
+
if (match === null)
|
|
436
|
+
return void 0;
|
|
437
|
+
let meta;
|
|
438
|
+
try {
|
|
439
|
+
meta = (0, import_yaml.parse)(match[1]) ?? {};
|
|
440
|
+
} catch {
|
|
441
|
+
return void 0;
|
|
442
|
+
}
|
|
443
|
+
const description = typeof meta["description"] === "string" ? meta["description"].trim() : "";
|
|
444
|
+
if (description === "")
|
|
445
|
+
return void 0;
|
|
446
|
+
const raw = typeof meta["name"] === "string" ? meta["name"] : fallbackName;
|
|
447
|
+
const name = toSkillName(raw) ?? toSkillName(fallbackName);
|
|
448
|
+
if (name === void 0)
|
|
449
|
+
return void 0;
|
|
450
|
+
return { name, description, content: match[2].trim() };
|
|
451
|
+
}
|
|
452
|
+
function toSkillName(value) {
|
|
453
|
+
const name = value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
454
|
+
return SKILL_NAME.test(name) ? name : void 0;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
// packages/analyzer/lib/index.js
|
|
458
|
+
var GUIDE = new URL("../skills/script-analysis.md", import.meta.url);
|
|
459
|
+
var AdgAnalyzer = class extends Service {
|
|
460
|
+
static inject = ["adgScripts"];
|
|
461
|
+
drafts;
|
|
462
|
+
constructor(ctx) {
|
|
463
|
+
super(ctx, "adgAnalyzer");
|
|
464
|
+
const log = ctx.logger("adg-analyzer");
|
|
465
|
+
const scripts = ctx.adgScripts;
|
|
466
|
+
const library = scripts.library;
|
|
467
|
+
this.drafts = new DraftStore(library.dataDir);
|
|
468
|
+
const drafts = this.drafts;
|
|
469
|
+
const changed = (packId) => ctx.get("adgGateway")?.broadcast("packs/changed", packId === void 0 ? {} : { packId });
|
|
470
|
+
ctx.inject(["skills", "adgGateway"], (scoped) => {
|
|
471
|
+
let disposers = [];
|
|
472
|
+
const register = async () => {
|
|
473
|
+
await scripts.ready;
|
|
474
|
+
for (const dispose of disposers.splice(0))
|
|
475
|
+
dispose();
|
|
476
|
+
const guide = parseSkill(await readFile4(GUIDE, "utf8"), "script-analysis");
|
|
477
|
+
if (guide !== void 0)
|
|
478
|
+
disposers.push(scoped.adgGateway.generalSkill({ ...guide, source: "bundled" }, () => scoped.skills.register({ ...guide, source: "bundled" })));
|
|
479
|
+
const { scripts: inLibrary } = library.list();
|
|
480
|
+
for (const pack of library.packs()) {
|
|
481
|
+
if (pack.skill === void 0)
|
|
482
|
+
continue;
|
|
483
|
+
const skill = parseSkill(pack.skill, pack.manifest.id);
|
|
484
|
+
if (skill === void 0) {
|
|
485
|
+
log.warn(`pack ${pack.manifest.id}: SKILL.md has no usable frontmatter; not registered as a skill`);
|
|
486
|
+
continue;
|
|
487
|
+
}
|
|
488
|
+
const owner = {
|
|
489
|
+
scripts: [pack.manifest.id, ...inLibrary.filter((s) => s.packId === pack.manifest.id).map((s) => s.id)],
|
|
490
|
+
...pack.manifest.game?.name === void 0 ? {} : { games: [pack.manifest.game.name] }
|
|
491
|
+
};
|
|
492
|
+
try {
|
|
493
|
+
disposers.push(scoped.adgGateway.skillScope.register({ ...skill, source: pack.builtin ? "bundled" : "custom", path: join4(pack.dir, SKILL_FILE), resourceBase: { kind: "directory", path: pack.dir }, owner }));
|
|
494
|
+
} catch (error) {
|
|
495
|
+
log.warn(`pack ${pack.manifest.id}: skill not registered: ${error instanceof Error ? error.message : String(error)}`);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
void register();
|
|
500
|
+
scoped.effect(() => library.onPacksChanged(() => void register()), "adg-analyzer pack skills");
|
|
501
|
+
scoped.effect(() => () => {
|
|
502
|
+
for (const dispose of disposers.splice(0))
|
|
503
|
+
dispose();
|
|
504
|
+
}, "adg-analyzer skills");
|
|
505
|
+
});
|
|
506
|
+
const approve = async (exec, reason) => {
|
|
507
|
+
const approval = ctx.get("approval");
|
|
508
|
+
if (approval === void 0 || exec.agent === void 0)
|
|
509
|
+
throw new Error("\u8FD9\u4E2A\u64CD\u4F5C\u9700\u8981\u7528\u6237\u6279\u51C6\uFF0C\u4F46\u5F53\u524D\u6CA1\u6709\u53EF\u7528\u7684\u5BA1\u6279\u6E20\u9053");
|
|
510
|
+
const outcome = await approval.request({ agent: exec.agent, toolName: exec.name, callId: exec.callId, reason, signal: exec.signal });
|
|
511
|
+
if (outcome !== "allowed-once")
|
|
512
|
+
throw new Error(outcome === "rejected" ? "\u7528\u6237\u62D2\u7EDD\u4E86\u8FD9\u4E2A\u64CD\u4F5C" : `\u6CA1\u6709\u5F97\u5230\u7528\u6237\u6279\u51C6\uFF08${outcome}\uFF09`);
|
|
513
|
+
};
|
|
514
|
+
ctx.inject(["adgGateway"], (gateway) => gateway.adgGateway.agentPart("adg-analyzer tools", (agent) => {
|
|
515
|
+
const registered = [];
|
|
516
|
+
for (const tool of analyzerTools({ library, drafts, approve, ready: scripts.ready, changed }))
|
|
517
|
+
registered.push(agent.tools.register({ ...tool, execute: async (args, exec) => {
|
|
518
|
+
await ctx.get("adgGateway")?.guardTool(exec);
|
|
519
|
+
return tool.execute(args, exec);
|
|
520
|
+
} }));
|
|
521
|
+
return () => {
|
|
522
|
+
for (const dispose of registered)
|
|
523
|
+
dispose();
|
|
524
|
+
};
|
|
525
|
+
}));
|
|
526
|
+
ctx.inject(["adgGateway"], (scoped) => {
|
|
527
|
+
scoped.adgGateway.register({
|
|
528
|
+
id: PACKS_CAPABILITY,
|
|
529
|
+
version: 1,
|
|
530
|
+
methods: {
|
|
531
|
+
"packs/drafts": async (params) => {
|
|
532
|
+
await scripts.ready;
|
|
533
|
+
const p = params;
|
|
534
|
+
const items = (await drafts.list()).filter((d) => p.scriptId === void 0 || d.scriptId === p.scriptId);
|
|
535
|
+
return { items: await Promise.all(items.map((d) => describe(d))) };
|
|
536
|
+
},
|
|
537
|
+
"packs/accept": async (params) => {
|
|
538
|
+
await scripts.ready;
|
|
539
|
+
const { packId } = params;
|
|
540
|
+
const { dir, meta } = await drafts.accept(packId);
|
|
541
|
+
await library.reloadPacks();
|
|
542
|
+
try {
|
|
543
|
+
await library.attachPack(meta.scriptId, packId);
|
|
544
|
+
} catch (error) {
|
|
545
|
+
log.warn(`accepted pack ${packId} but could not attach it to ${meta.scriptId}: ${error instanceof Error ? error.message : String(error)}`);
|
|
546
|
+
}
|
|
547
|
+
changed(packId);
|
|
548
|
+
return { packId, dir };
|
|
549
|
+
},
|
|
550
|
+
"packs/reject": async (params) => {
|
|
551
|
+
const { packId } = params;
|
|
552
|
+
await drafts.reject(packId);
|
|
553
|
+
changed(packId);
|
|
554
|
+
return {};
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
});
|
|
558
|
+
});
|
|
559
|
+
const describe = async (draft) => {
|
|
560
|
+
const current = library.pack(draft.packId);
|
|
561
|
+
let tasks = [];
|
|
562
|
+
try {
|
|
563
|
+
tasks = parseManifest(draft.manifest).tasks.map((t) => ({ id: t.id, title: t.title }));
|
|
564
|
+
} catch {
|
|
565
|
+
}
|
|
566
|
+
const currentManifest = current === void 0 ? void 0 : await readFile4(join4(current.dir, MANIFEST_FILE), "utf8").catch(() => void 0);
|
|
567
|
+
return {
|
|
568
|
+
packId: draft.packId,
|
|
569
|
+
scriptId: draft.scriptId,
|
|
570
|
+
proposedAt: draft.proposedAt,
|
|
571
|
+
summary: draft.summary,
|
|
572
|
+
...draft.docs === void 0 ? {} : { docs: draft.docs.map((d) => ({ ...d })) },
|
|
573
|
+
...draft.noDocs === void 0 ? {} : { noDocs: draft.noDocs },
|
|
574
|
+
manifest: draft.manifest,
|
|
575
|
+
skill: draft.skill,
|
|
576
|
+
tasks,
|
|
577
|
+
...draft.sessionId === void 0 ? {} : { sessionId: draft.sessionId },
|
|
578
|
+
...current === void 0 || currentManifest === void 0 ? {} : { current: { manifest: currentManifest, builtin: current.builtin, ...current.skill === void 0 ? {} : { skill: current.skill } } }
|
|
579
|
+
};
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
function analyzerTools(deps) {
|
|
584
|
+
const json = (value) => JSON.parse(JSON.stringify(value ?? null));
|
|
585
|
+
const parse = (schema, args) => {
|
|
586
|
+
const parsed = schema.safeParse(args);
|
|
587
|
+
if (!parsed.success)
|
|
588
|
+
throw new Error(`\u53C2\u6570\u65E0\u6548\uFF1A${parsed.error.issues.map((i) => `${i.path.join(".") || "(root)"} ${i.message}`).join("; ")}`);
|
|
589
|
+
return parsed.data;
|
|
590
|
+
};
|
|
591
|
+
const tool = (spec) => ({
|
|
592
|
+
name: spec.name,
|
|
593
|
+
description: spec.description,
|
|
594
|
+
parameters: { type: "object", properties: spec.properties, required: spec.required, additionalProperties: false },
|
|
595
|
+
output: { schema: {}, render: (_a, value) => [{ type: "text", text: JSON.stringify(value, null, 1) }] },
|
|
596
|
+
timeoutMs: spec.timeoutMs ?? 12e4,
|
|
597
|
+
isConcurrencySafe: () => spec.kind === "read",
|
|
598
|
+
execute: async (args, exec) => {
|
|
599
|
+
await deps.ready;
|
|
600
|
+
return json(await spec.execute(args, exec));
|
|
601
|
+
},
|
|
602
|
+
presentCall: (args) => ({ card: "generic", title: spec.title(args ?? {}), kind: spec.kind })
|
|
603
|
+
});
|
|
604
|
+
const id = { type: "string", description: "\u811A\u672C\u5E93\u91CC\u7684\u811A\u672C id\u3002" };
|
|
605
|
+
return [
|
|
606
|
+
tool({
|
|
607
|
+
name: "script_analyze",
|
|
608
|
+
description: "\u5206\u6790\u811A\u672C\u5E93\u91CC\u7684\u4E00\u4E2A\u811A\u672C\u76EE\u5F55\uFF08\u53EA\u8BFB\uFF09\uFF1A\u76EE\u5F55\u7ED3\u6784\u3001\u9879\u76EE\u81EA\u5E26\u7684\u6587\u6863\uFF08docs\uFF1AREADME\u3001\u4F7F\u7528\u8BF4\u660E\u3001\u66F4\u65B0\u65E5\u5FD7\u3001\u5E2E\u52A9\uFF09\u548C\u6587\u6863\u7F51\u5740\uFF08docLinks\uFF1A\u4ED3\u5E93\u3001Wiki\u3001\u6587\u6863\u7AD9\uFF09\u3001MaaFramework \u7684 interface.json\u3001\u914D\u7F6E\u6587\u4EF6\u3001\u65E5\u5FD7\u6837\u672C\u3001\u5EFA\u8BAE\u7684\u9002\u914D\u5BB6\u65CF\uFF0C\u4EE5\u53CA\u5B83\u73B0\u6709\u7684\u811A\u672C\u5305\u3002\u5199\u811A\u672C\u5305\u524D\u5148\u8C03\u7528\uFF1B\u6309 script-analysis \u6280\u80FD\u7684\u6B65\u9AA4\u8FDB\u884C\uFF1A\u5148\u8BFB\u6587\u6863\uFF0C\u518D\u770B\u4EE3\u7801\u3002",
|
|
609
|
+
properties: { id },
|
|
610
|
+
required: ["id"],
|
|
611
|
+
kind: "read",
|
|
612
|
+
title: (a) => `\u5206\u6790\u811A\u672C\uFF1A${String(a["id"] ?? "")}`,
|
|
613
|
+
execute: async (args) => {
|
|
614
|
+
const a = parse(external_exports.object({ id: ScriptId }), args);
|
|
615
|
+
const script = deps.library.get(a.id);
|
|
616
|
+
if (script.dir === void 0)
|
|
617
|
+
throw new Error(`${script.name} \u8FD8\u6CA1\u6709\u5B89\u88C5`);
|
|
618
|
+
const report = await analyzeDir(script.dir);
|
|
619
|
+
const pack = deps.library.packOf(a.id);
|
|
620
|
+
const manifest = pack === void 0 ? void 0 : await readFile4(join4(pack.dir, MANIFEST_FILE), "utf8").catch(() => void 0);
|
|
621
|
+
const repo = script.channels.github?.repo;
|
|
622
|
+
const online = [...repo === void 0 ? [] : [`https://github.com/${repo}`, `https://github.com/${repo}/wiki`], ...report.docLinks];
|
|
623
|
+
return {
|
|
624
|
+
script: { id: script.id, name: script.name, source: script.source, family: script.family },
|
|
625
|
+
...report,
|
|
626
|
+
docLinks: [...new Set(online)],
|
|
627
|
+
readFirst: "\u5148\u8BFB\u6587\u6863\uFF08docs \u91CC\u7684\u6587\u4EF6\u3001readme\u3001docLinks \u91CC\u7684\u7F51\u9875\uFF09\uFF0C\u518D\u7ED3\u5408\u4EE3\u7801\u548C\u914D\u7F6E\u6838\u5BF9\u3001\u8865\u5168\uFF1B\u53EA\u6709\u5B8C\u5168\u627E\u4E0D\u5230\u6587\u6863\u65F6\u624D\u76F4\u63A5\u4ECE\u4EE3\u7801\u5206\u6790\u3002",
|
|
628
|
+
currentPack: pack === void 0 ? null : { id: pack.manifest.id, builtin: pack.builtin, manifest, skill: pack.skill }
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
}),
|
|
632
|
+
tool({
|
|
633
|
+
name: "script_help",
|
|
634
|
+
description: "\u8FD0\u884C\u811A\u672C\u7A0B\u5E8F\u7684\u5E2E\u52A9\u53C2\u6570\uFF08\u9ED8\u8BA4 --help\uFF09\uFF0C\u62FF\u5230\u5B83\u81EA\u5DF1\u8BF4\u660E\u7684\u547D\u4EE4\u548C\u4EFB\u52A1\u3002\u6700\u591A\u8FD0\u884C 20 \u79D2\u540E\u7ED3\u675F\u3002\u6CA1\u6709\u5185\u7F6E\u811A\u672C\u5305\u7684\u811A\u672C\u4F1A\u5148\u8BF7\u7528\u6237\u786E\u8BA4\uFF0C\u56E0\u4E3A\u8FD9\u4F1A\u542F\u52A8\u5B83\u7684\u7A0B\u5E8F\u3002",
|
|
635
|
+
properties: {
|
|
636
|
+
id,
|
|
637
|
+
exe: { type: "string", description: "\u8981\u8FD0\u884C\u7684\u7A0B\u5E8F\uFF08\u76F8\u5BF9\u811A\u672C\u76EE\u5F55\uFF09\uFF1B\u7701\u7565\u65F6\u7528\u811A\u672C\u5305\u7684\u542F\u52A8\u7A0B\u5E8F\u6216\u627E\u5230\u7684\u7B2C\u4E00\u4E2A\u53EF\u6267\u884C\u6587\u4EF6\u3002" },
|
|
638
|
+
args: { type: "array", items: { type: "string" }, description: '\u53C2\u6570\uFF0C\u9ED8\u8BA4 ["--help"]\uFF1B\u4E5F\u53EF\u4EE5\u662F ["-h"]\u3001["-l"]\u3001["--list-workflows"]\u3002' }
|
|
639
|
+
},
|
|
640
|
+
required: ["id"],
|
|
641
|
+
kind: "execute",
|
|
642
|
+
timeoutMs: 6e4,
|
|
643
|
+
title: (a) => `\u67E5\u770B\u5E2E\u52A9\uFF1A${String(a["id"] ?? "")} ${Array.isArray(a["args"]) ? a["args"].join(" ") : "--help"}`,
|
|
644
|
+
execute: async (args, exec) => {
|
|
645
|
+
const a = parse(external_exports.object({ id: ScriptId, exe: external_exports.string().min(1).max(300).nullish(), args: external_exports.array(external_exports.string().max(100)).max(8).nullish() }), args);
|
|
646
|
+
const script = deps.library.get(a.id);
|
|
647
|
+
if (script.dir === void 0)
|
|
648
|
+
throw new Error(`${script.name} \u8FD8\u6CA1\u6709\u5B89\u88C5`);
|
|
649
|
+
const pack = deps.library.packOf(a.id);
|
|
650
|
+
const exe = a.exe ?? pack?.manifest.launch?.exe ?? script.probe?.executables[0];
|
|
651
|
+
if (exe === void 0)
|
|
652
|
+
throw new Error("\u6CA1\u6709\u627E\u5230\u53EF\u6267\u884C\u6587\u4EF6\uFF0C\u8BF7\u7528 exe \u53C2\u6570\u6307\u5B9A");
|
|
653
|
+
if (exe.split(/[\\/]/).includes("..") || /^([A-Za-z]:|[\\/])/.test(exe))
|
|
654
|
+
throw new Error("exe \u5FC5\u987B\u662F\u811A\u672C\u76EE\u5F55\u91CC\u7684\u76F8\u5BF9\u8DEF\u5F84");
|
|
655
|
+
const helpArgs = a.args ?? ["--help"];
|
|
656
|
+
if (pack?.builtin !== true)
|
|
657
|
+
await deps.approve(exec, `\u4E3A\u4E86\u5206\u6790 ${script.name}\uFF0C\u8FD0\u884C ${exe} ${helpArgs.join(" ")}\uFF08\u6700\u591A 20 \u79D2\uFF0C\u53EA\u770B\u5B83\u7684\u5E2E\u52A9\u8F93\u51FA\uFF09`);
|
|
658
|
+
return runHelp(join4(script.dir, exe), helpArgs, script.dir);
|
|
659
|
+
}
|
|
660
|
+
}),
|
|
661
|
+
tool({
|
|
662
|
+
name: "script_changelog",
|
|
663
|
+
description: "\u8BFB\u4E00\u4E2A\u811A\u672C\u8FD9\u51E0\u4E2A\u7248\u672C\u7684\u66F4\u65B0\u65E5\u5FD7\uFF1AGitHub \u4E0A\u6BCF\u4E2A\u53D1\u5E03\u7248\u7684\u8BF4\u660E\u3001Mirror\u9171 \u6700\u65B0\u7248\u7684\u8BF4\u660E\uFF0C\u4EE5\u53CA\u811A\u672C\u76EE\u5F55\u91CC\u7684 CHANGELOG / \u66F4\u65B0\u65E5\u5FD7\u6587\u4EF6\u3002\u811A\u672C\u66F4\u65B0\u540E\u68C0\u67E5\u811A\u672C\u5305\u65F6\u5148\u8C03\u7528\uFF1Bfrom \u9ED8\u8BA4\u662F\u811A\u672C\u5305\u5199\u6210\u65F6\u7684\u7248\u672C\uFF0Cto \u9ED8\u8BA4\u662F\u73B0\u5728\u7684\u7248\u672C\u3002",
|
|
664
|
+
properties: {
|
|
665
|
+
id,
|
|
666
|
+
from: { type: "string", description: "\u4ECE\u54EA\u4E2A\u7248\u672C\u4E4B\u540E\uFF08\u4E0D\u542B\uFF09\uFF1B\u7701\u7565\u4E3A\u811A\u672C\u5305\u5199\u6210\u65F6\u7684\u7248\u672C\u3002" },
|
|
667
|
+
to: { type: "string", description: "\u5230\u54EA\u4E2A\u7248\u672C\uFF08\u542B\uFF09\uFF1B\u7701\u7565\u4E3A\u73B0\u5728\u7684\u7248\u672C\u3002" }
|
|
668
|
+
},
|
|
669
|
+
required: ["id"],
|
|
670
|
+
kind: "read",
|
|
671
|
+
title: (a) => `\u8BFB\u66F4\u65B0\u65E5\u5FD7\uFF1A${String(a["id"] ?? "")}`,
|
|
672
|
+
execute: async (args, exec) => {
|
|
673
|
+
const a = parse(external_exports.object({ id: ScriptId, from: external_exports.string().max(60).nullish(), to: external_exports.string().max(60).nullish() }), args);
|
|
674
|
+
return deps.library.changelog(a.id, { from: a.from ?? void 0, to: a.to ?? void 0, signal: exec.signal });
|
|
675
|
+
}
|
|
676
|
+
}),
|
|
677
|
+
tool({
|
|
678
|
+
name: "pack_reviewed",
|
|
679
|
+
description: "\u811A\u672C\u66F4\u65B0\u540E\u68C0\u67E5\u8FC7\u811A\u672C\u5305\u3001\u786E\u8BA4\u4E0D\u7528\u6539\u65F6\u8C03\u7528\uFF1A\u8BB0\u4E0B\u811A\u672C\u5305\u5DF2\u7ECF\u5BF9\u7167\u73B0\u5728\u7684\u7248\u672C\u68C0\u67E5\u8FC7\uFF0C\u4E0D\u518D\u63D0\u9192\u3002\u8981\u6539\u5C31\u7528 pack_propose \u63D0\u4EA4\uFF0C\u7528\u6237\u63A5\u53D7\u540E\u4F1A\u81EA\u52A8\u8BB0\u4E0B\uFF0C\u4E0D\u7528\u8C03\u7528\u8FD9\u4E2A\u3002",
|
|
680
|
+
properties: {
|
|
681
|
+
id,
|
|
682
|
+
reason: { type: "string", description: "\u4E3A\u4EC0\u4E48\u4E0D\u7528\u6539\uFF08\u4F1A\u544A\u8BC9\u7528\u6237\uFF09\uFF0C\u4F8B\u5982\u300C\u8FD9\u51E0\u4E2A\u7248\u672C\u53EA\u4FEE\u4E86\u8BC6\u522B\u95EE\u9898\uFF0C\u4EFB\u52A1\u3001\u914D\u7F6E\u548C\u65E5\u5FD7\u90FD\u6CA1\u53D8\u300D\u3002" }
|
|
683
|
+
},
|
|
684
|
+
required: ["id", "reason"],
|
|
685
|
+
kind: "edit",
|
|
686
|
+
title: (a) => `\u811A\u672C\u5305\u4E0D\u7528\u6539\uFF1A${String(a["id"] ?? "")}`,
|
|
687
|
+
execute: async (args) => {
|
|
688
|
+
const a = parse(external_exports.object({ id: ScriptId, reason: external_exports.string().min(4).max(1e3) }), args);
|
|
689
|
+
const info = await deps.library.packReviewed(a.id);
|
|
690
|
+
return { ok: true, version: info.localVersion?.version ?? info.current, reason: a.reason };
|
|
691
|
+
}
|
|
692
|
+
}),
|
|
693
|
+
tool({
|
|
694
|
+
name: "pack_propose",
|
|
695
|
+
description: "\u63D0\u4EA4\u811A\u672C\u5305\u8349\u7A3F\uFF08adg.script.yaml \u548C SKILL.md\uFF09\u3002\u4F1A\u6309 schema \u6821\u9A8C\uFF0C\u5931\u8D25\u65F6\u8FD4\u56DE\u5177\u4F53\u5B57\u6BB5\u4EE5\u4FBF\u4FEE\u6B63\u540E\u91CD\u65B0\u63D0\u4EA4\uFF1B\u901A\u8FC7\u540E\u4FDD\u5B58\u4E3A\u8349\u7A3F\uFF0C\u7528\u6237\u5728\u300C\u811A\u672C\u300D\u9875\u786E\u8BA4\u540E\u751F\u6548\u3002\u4E0D\u4F1A\u4FEE\u6539\u811A\u672C\u672C\u8EAB\u3002",
|
|
696
|
+
properties: {
|
|
697
|
+
pack_id: { type: "string", description: "\u811A\u672C\u5305 id\uFF08\u4E0E manifest \u91CC\u7684 id \u76F8\u540C\uFF1B\u6539\u8FDB\u5DF2\u6709\u811A\u672C\u5305\u65F6\u7528\u539F id\uFF09\u3002" },
|
|
698
|
+
script_id: { type: "string", description: "\u8FD9\u4E2A\u5305\u63CF\u8FF0\u7684\u811A\u672C\u5E93\u91CC\u7684\u811A\u672C id\u3002" },
|
|
699
|
+
manifest: { type: "string", description: "adg.script.yaml \u7684\u5B8C\u6574\u5185\u5BB9\u3002" },
|
|
700
|
+
skill: { type: "string", description: "SKILL.md \u7684\u5B8C\u6574\u5185\u5BB9\uFF08\u4EE5 name / description frontmatter \u5F00\u5934\uFF09\u3002" },
|
|
701
|
+
summary: { type: "string", description: "\u7ED9\u7528\u6237\u770B\u7684\u4E00\u6BB5\u8BDD\uFF1A\u505A\u4E86\u4EC0\u4E48\u3001\u4F9D\u636E\u662F\u4EC0\u4E48\u3001\u54EA\u4E9B\u8FD8\u5F85\u786E\u8BA4\u3002" },
|
|
702
|
+
docs: {
|
|
703
|
+
type: "array",
|
|
704
|
+
description: "\u5199\u8FD9\u4EFD\u811A\u672C\u5305\u8BFB\u8FC7\u7684\u9879\u76EE\u6587\u6863\uFF08\u5148\u8BFB\u6587\u6863\u518D\u770B\u4EE3\u7801\uFF09\uFF1A\u6BCF\u9879\u5199\u51FA\u5904\uFF08\u811A\u672C\u76EE\u5F55\u91CC\u7684\u76F8\u5BF9\u8DEF\u5F84\u6216\u7F51\u5740\uFF09\u548C\u4ECE\u4E2D\u5F97\u5230\u4E86\u4EC0\u4E48\u3002",
|
|
705
|
+
items: { type: "object", properties: { source: { type: "string" }, used: { type: "string" } }, required: ["source", "used"], additionalProperties: false }
|
|
706
|
+
},
|
|
707
|
+
no_docs: { type: "string", description: "\u786E\u5B9E\u627E\u4E0D\u5230\u4EFB\u4F55\u6587\u6863\uFF08\u76EE\u5F55\u3001\u4ED3\u5E93\u3001Wiki\u3001\u6587\u6863\u7AD9\u90FD\u6CA1\u6709\uFF09\u624D\u586B\uFF1A\u8BF4\u660E\u627E\u8FC7\u54EA\u4E9B\u5730\u65B9\u3002\u586B\u4E86\u5B83 docs \u53EF\u4EE5\u4E3A\u7A7A\u3002" }
|
|
708
|
+
},
|
|
709
|
+
required: ["pack_id", "script_id", "manifest", "skill", "summary", "docs"],
|
|
710
|
+
kind: "edit",
|
|
711
|
+
title: (a) => `\u63D0\u4EA4\u811A\u672C\u5305\u8349\u7A3F\uFF1A${String(a["pack_id"] ?? "")}`,
|
|
712
|
+
execute: async (args, exec) => {
|
|
713
|
+
const a = parse(external_exports.object({
|
|
714
|
+
pack_id: ScriptId,
|
|
715
|
+
script_id: ScriptId,
|
|
716
|
+
manifest: external_exports.string().min(10).max(2e5),
|
|
717
|
+
skill: external_exports.string().min(10).max(2e5),
|
|
718
|
+
summary: external_exports.string().min(1).max(4e3),
|
|
719
|
+
docs: external_exports.array(external_exports.object({ source: external_exports.string().min(1).max(500), used: external_exports.string().min(1).max(1e3) })).max(40).nullish(),
|
|
720
|
+
no_docs: external_exports.string().max(1e3).nullish()
|
|
721
|
+
}), args);
|
|
722
|
+
const docs = a.docs ?? [];
|
|
723
|
+
if (docs.length === 0 && (a.no_docs ?? "").trim().length < 10) {
|
|
724
|
+
throw new Error("\u5148\u8BFB\u9879\u76EE\u7684\u6587\u6863\u518D\u5199\u811A\u672C\u5305\uFF1Adocs \u91CC\u5199\u51FA\u8BFB\u8FC7\u7684\u6587\u6863\uFF08\u51FA\u5904\u548C\u5F97\u5230\u4E86\u4EC0\u4E48\uFF09\uFF1B\u786E\u5B9E\u627E\u4E0D\u5230\u6587\u6863\u65F6\u7528 no_docs \u8BF4\u660E\u627E\u8FC7\u54EA\u4E9B\u5730\u65B9\uFF08\u811A\u672C\u76EE\u5F55\u3001\u4ED3\u5E93 README\u3001Wiki\u3001\u6587\u6863\u7AD9\uFF09");
|
|
725
|
+
}
|
|
726
|
+
deps.library.get(a.script_id);
|
|
727
|
+
const result = await deps.drafts.propose({
|
|
728
|
+
packId: a.pack_id,
|
|
729
|
+
scriptId: a.script_id,
|
|
730
|
+
proposedAt: Date.now(),
|
|
731
|
+
summary: a.summary,
|
|
732
|
+
...docs.length === 0 ? {} : { docs },
|
|
733
|
+
...docs.length > 0 || a.no_docs == null ? {} : { noDocs: a.no_docs.trim() },
|
|
734
|
+
...exec.agent === void 0 ? {} : { sessionId: exec.agent.session.id }
|
|
735
|
+
}, a.manifest, a.skill);
|
|
736
|
+
deps.changed(a.pack_id);
|
|
737
|
+
return { ok: true, pack_id: a.pack_id, tasks: result.tasks, next: "\u8349\u7A3F\u5DF2\u4FDD\u5B58\u3002\u8BF7\u544A\u8BC9\u7528\u6237\u5230\u300C\u811A\u672C\u300D\u9875\u67E5\u770B\u8FD9\u4E2A\u811A\u672C\u7684\u300C\u811A\u672C\u5305\u8349\u7A3F\u300D\u5E76\u786E\u8BA4\u3002" };
|
|
738
|
+
}
|
|
739
|
+
})
|
|
740
|
+
];
|
|
741
|
+
}
|
|
742
|
+
function runHelp(file, args, cwd) {
|
|
743
|
+
return new Promise((resolve) => {
|
|
744
|
+
execFile(file, [...args], { cwd, windowsHide: true, timeout: 2e4, maxBuffer: 4 * 1024 * 1024, encoding: "buffer" }, (error, stdout, stderr) => {
|
|
745
|
+
const raw = Buffer.concat([stdout, stderr]);
|
|
746
|
+
let output = new TextDecoder("utf-8").decode(raw);
|
|
747
|
+
if ((output.match(/�/g)?.length ?? 0) > 5)
|
|
748
|
+
output = new TextDecoder("gbk").decode(raw);
|
|
749
|
+
const timedOut = error?.killed === true;
|
|
750
|
+
const code = error === null ? 0 : typeof error.code === "number" ? error.code : null;
|
|
751
|
+
resolve({ exitCode: code, output: output.slice(0, 12e3), timedOut });
|
|
752
|
+
});
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
var lib_default = AdgAnalyzer;
|
|
756
|
+
export {
|
|
757
|
+
AdgAnalyzer,
|
|
758
|
+
DraftStore,
|
|
759
|
+
analyzeDir,
|
|
760
|
+
lib_default as default,
|
|
761
|
+
parseJsonc,
|
|
762
|
+
parseSkill,
|
|
763
|
+
readInterface,
|
|
764
|
+
stripJsonc
|
|
765
|
+
};
|