@shadowob/cloud 1.1.6-dev.311
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +509 -0
- package/dist/agent-browser-CERTMCDL.js +117 -0
- package/dist/agent-browser-CIRZRIY4.js +118 -0
- package/dist/agent-pack-LF3O5TR4.js +1236 -0
- package/dist/agent-pack-RQT27V7R.js +1235 -0
- package/dist/airtable-BG2Q75G2.js +82 -0
- package/dist/airtable-JCQXFM5D.js +83 -0
- package/dist/alipay-MZX2XCDB.js +52 -0
- package/dist/alipay-TZQI34RB.js +51 -0
- package/dist/amap-5RQB3VGC.js +45 -0
- package/dist/amap-KPCLZYYL.js +44 -0
- package/dist/atlassian-LGOEWYC7.js +54 -0
- package/dist/atlassian-TVS2A4IU.js +55 -0
- package/dist/baidu-appbuilder-6UMESXHW.js +41 -0
- package/dist/baidu-appbuilder-QRRL3ETM.js +42 -0
- package/dist/baidu-maps-HEPMVP5D.js +44 -0
- package/dist/baidu-maps-HXC4FBVP.js +45 -0
- package/dist/baidu-netdisk-G5Q6B5NH.js +45 -0
- package/dist/baidu-netdisk-RS2K5W2M.js +44 -0
- package/dist/baidu-smartprogram-EWTK5WKK.js +41 -0
- package/dist/baidu-smartprogram-JHD3XWF6.js +40 -0
- package/dist/browserbase-IUIYVYI7.js +67 -0
- package/dist/browserbase-JFO2PCIA.js +68 -0
- package/dist/canva-3YOFL7JS.js +62 -0
- package/dist/canva-FMYN65SM.js +61 -0
- package/dist/chunk-6P2K6QZR.js +529 -0
- package/dist/chunk-7VMRQ7MG.js +90 -0
- package/dist/chunk-AD3JTIU3.js +17 -0
- package/dist/chunk-BF6CV2Y4.js +64 -0
- package/dist/chunk-CTNUKOQE.js +439 -0
- package/dist/chunk-EEFMJYKB.js +97 -0
- package/dist/chunk-EJKFQ35I.js +739 -0
- package/dist/chunk-HUICDC56.js +62 -0
- package/dist/chunk-JUPAE5IA.js +527 -0
- package/dist/chunk-JY2HTT7Q.js +437 -0
- package/dist/chunk-KEPTCLUO.js +121 -0
- package/dist/chunk-KKK5H7YX.js +3622 -0
- package/dist/chunk-POSVEKIY.js +210 -0
- package/dist/chunk-QET4LT4J.js +5769 -0
- package/dist/chunk-QV4XWO3P.js +30 -0
- package/dist/chunk-R52J3PH2.js +120 -0
- package/dist/chunk-R5U7XKVJ.js +16 -0
- package/dist/chunk-RECNVWMT.js +212 -0
- package/dist/chunk-RTPBU5HF.js +92 -0
- package/dist/chunk-SUZ2ATT6.js +5774 -0
- package/dist/chunk-SVMXSIMG.js +98 -0
- package/dist/chunk-TV3CBM7R.js +28 -0
- package/dist/chunk-V2LU736V.js +3495 -0
- package/dist/chunk-ZUYL3W53.js +741 -0
- package/dist/claude-plugin-577TAQVS.js +1463 -0
- package/dist/claude-plugin-L3MXJJ6J.js +1464 -0
- package/dist/cli.js +7021 -0
- package/dist/cloudflare-HBBABPK6.js +114 -0
- package/dist/cloudflare-RDFPKMM5.js +115 -0
- package/dist/cnb-FLP3QX46.js +44 -0
- package/dist/cnb-YAVVEYFB.js +45 -0
- package/dist/console/index.html +12 -0
- package/dist/console/logo.png +0 -0
- package/dist/console/static/css/5079.f9e0918d.css +1 -0
- package/dist/console/static/css/index.7f91f806.css +1 -0
- package/dist/console/static/font/codicon.5b7d6fac.ttf +0 -0
- package/dist/console/static/js/5079.72a51ca2.js +699 -0
- package/dist/console/static/js/5079.72a51ca2.js.LICENSE.txt +35 -0
- package/dist/console/static/js/7426.f8d483ea.js +1 -0
- package/dist/console/static/js/async/1008.4df521b7.js +1 -0
- package/dist/console/static/js/async/102.1d473ec7.js +1 -0
- package/dist/console/static/js/async/1134.3f9fd9e7.js +1 -0
- package/dist/console/static/js/async/1318.4b8e48e7.js +1 -0
- package/dist/console/static/js/async/1360.5606da88.js +7 -0
- package/dist/console/static/js/async/1546.045f484f.js +1 -0
- package/dist/console/static/js/async/1562.187de2a8.js +1 -0
- package/dist/console/static/js/async/168.456d4813.js +1 -0
- package/dist/console/static/js/async/1750.e6dc2664.js +1 -0
- package/dist/console/static/js/async/1994.3fc86066.js +1 -0
- package/dist/console/static/js/async/2348.613ae3d9.js +1 -0
- package/dist/console/static/js/async/2390.1b890b9d.js +1 -0
- package/dist/console/static/js/async/2414.9d040212.js +1 -0
- package/dist/console/static/js/async/2454.4c1784ab.js +1 -0
- package/dist/console/static/js/async/2498.f5f92030.js +1 -0
- package/dist/console/static/js/async/2924.b823cd1a.js +1 -0
- package/dist/console/static/js/async/3062.63fddea6.js +1 -0
- package/dist/console/static/js/async/3078.dd712008.js +1 -0
- package/dist/console/static/js/async/3198.1f307065.js +1 -0
- package/dist/console/static/js/async/3246.3d5a899f.js +1 -0
- package/dist/console/static/js/async/3286.871676eb.js +1 -0
- package/dist/console/static/js/async/342.10bf3b90.js +1 -0
- package/dist/console/static/js/async/3446.9681a4d7.js +1 -0
- package/dist/console/static/js/async/3698.ccfaabec.js +1 -0
- package/dist/console/static/js/async/3790.2a1106a6.js +1 -0
- package/dist/console/static/js/async/4231.b29784d4.js +1 -0
- package/dist/console/static/js/async/4551.515bd41d.js +1 -0
- package/dist/console/static/js/async/4596.40f6e71b.js +1 -0
- package/dist/console/static/js/async/4600.4aaebe6d.js +1 -0
- package/dist/console/static/js/async/4718.1aae022f.js +1 -0
- package/dist/console/static/js/async/4846.a347c020.js +1 -0
- package/dist/console/static/js/async/4860.83dadf89.js +1 -0
- package/dist/console/static/js/async/500.fcfa37cb.js +1 -0
- package/dist/console/static/js/async/5096.b360203d.js +1 -0
- package/dist/console/static/js/async/5222.043274fe.js +1 -0
- package/dist/console/static/js/async/5362.f498001c.js +1 -0
- package/dist/console/static/js/async/54.c94f0755.js +1 -0
- package/dist/console/static/js/async/5478.50dd9ef0.js +2 -0
- package/dist/console/static/js/async/5478.50dd9ef0.js.LICENSE.txt +3 -0
- package/dist/console/static/js/async/5507.a6a1f793.js +1 -0
- package/dist/console/static/js/async/5638.bc6b102d.js +1 -0
- package/dist/console/static/js/async/5722.e0029049.js +1 -0
- package/dist/console/static/js/async/5942.74635c6b.js +1 -0
- package/dist/console/static/js/async/5994.1c5629c1.js +1 -0
- package/dist/console/static/js/async/6054.6bddf720.js +1 -0
- package/dist/console/static/js/async/6118.45e754e5.js +1 -0
- package/dist/console/static/js/async/6127.adcbcbb6.js +1 -0
- package/dist/console/static/js/async/614.3f434c20.js +1 -0
- package/dist/console/static/js/async/6234.ba3b002d.js +1 -0
- package/dist/console/static/js/async/6310.6546a9ba.js +1 -0
- package/dist/console/static/js/async/6378.9f805419.js +1 -0
- package/dist/console/static/js/async/6380.e4433c49.js +1 -0
- package/dist/console/static/js/async/6418.f23bcfda.js +1 -0
- package/dist/console/static/js/async/6428.77c86114.js +1 -0
- package/dist/console/static/js/async/6443.83318a6c.js +1 -0
- package/dist/console/static/js/async/6508.2b445d62.js +3 -0
- package/dist/console/static/js/async/6542.e82a26c8.js +1 -0
- package/dist/console/static/js/async/6544.62111ecb.js +1 -0
- package/dist/console/static/js/async/6612.a0c9fcf4.js +1 -0
- package/dist/console/static/js/async/6740.695aebf0.js +1 -0
- package/dist/console/static/js/async/6822.dbbb32bc.js +1 -0
- package/dist/console/static/js/async/6824.ad3540ab.js +1 -0
- package/dist/console/static/js/async/6930.585dab94.js +1 -0
- package/dist/console/static/js/async/6982.c81b95e6.js +1 -0
- package/dist/console/static/js/async/7046.ab2378c1.js +1 -0
- package/dist/console/static/js/async/7110.a603277f.js +1 -0
- package/dist/console/static/js/async/7142.4a21366f.js +1 -0
- package/dist/console/static/js/async/7348.15cc6148.js +1373 -0
- package/dist/console/static/js/async/7348.15cc6148.js.LICENSE.txt +14 -0
- package/dist/console/static/js/async/7374.b1ac5c44.js +1 -0
- package/dist/console/static/js/async/742.847f17ca.js +1 -0
- package/dist/console/static/js/async/7446.743954d8.js +1 -0
- package/dist/console/static/js/async/7673.59bbbaac.js +1 -0
- package/dist/console/static/js/async/7684.c5760c8c.js +1 -0
- package/dist/console/static/js/async/7714.c30d0f94.js +1 -0
- package/dist/console/static/js/async/8118.36d5a3bf.js +298 -0
- package/dist/console/static/js/async/8145.4bcf043a.js +1 -0
- package/dist/console/static/js/async/8246.408de938.js +1 -0
- package/dist/console/static/js/async/8390.bdae1f7d.js +1 -0
- package/dist/console/static/js/async/8422.fd94dbe1.js +1 -0
- package/dist/console/static/js/async/8434.94a0e2ae.js +1 -0
- package/dist/console/static/js/async/8518.3158de13.js +1 -0
- package/dist/console/static/js/async/8564.fc2eb841.js +1 -0
- package/dist/console/static/js/async/8678.73af4c9b.js +1 -0
- package/dist/console/static/js/async/8694.79747168.js +1 -0
- package/dist/console/static/js/async/8756.1de37b83.js +1 -0
- package/dist/console/static/js/async/8804.7fe6bdf9.js +3 -0
- package/dist/console/static/js/async/8883.e717ee94.js +1 -0
- package/dist/console/static/js/async/8886.fe6e876c.js +1 -0
- package/dist/console/static/js/async/9030.fc1ae402.js +1 -0
- package/dist/console/static/js/async/9094.5598d084.js +1 -0
- package/dist/console/static/js/async/9218.ee7b84b7.js +1 -0
- package/dist/console/static/js/async/94.9b80bc35.js +1 -0
- package/dist/console/static/js/async/9526.92aba34c.js +1 -0
- package/dist/console/static/js/async/9762.f83bc4f3.js +1 -0
- package/dist/console/static/js/async/984.e11c113a.js +1 -0
- package/dist/console/static/js/async/9846.246653cd.js +1 -0
- package/dist/console/static/js/index.4487e1ff.js +1 -0
- package/dist/console/static/js/lib-react.15d7ca9a.js +2 -0
- package/dist/console/static/js/lib-react.15d7ca9a.js.LICENSE.txt +49 -0
- package/dist/coze-C6PMDPBI.js +49 -0
- package/dist/coze-E6VGRNLV.js +48 -0
- package/dist/dashboard.command-J7XOZNXU.js +8 -0
- package/dist/dashboard.command-RV2NHDKW.js +7 -0
- package/dist/dingtalk-JNRNRN7E.js +77 -0
- package/dist/dingtalk-WZGGIAHJ.js +76 -0
- package/dist/douyin-miniprogram-AIJPPIZH.js +41 -0
- package/dist/douyin-miniprogram-HCYZ5NBW.js +42 -0
- package/dist/figma-2YYNSCDX.js +103 -0
- package/dist/figma-RYOBMENP.js +102 -0
- package/dist/firebase-2IJDDBXX.js +112 -0
- package/dist/firebase-OYSY6HPT.js +111 -0
- package/dist/firecrawl-2T3SBUW7.js +66 -0
- package/dist/firecrawl-IYYXLAZM.js +65 -0
- package/dist/flyai-7FJ4TRAG.js +81 -0
- package/dist/flyai-QS5Q6FJR.js +82 -0
- package/dist/gitagent-MWI75OIX.js +725 -0
- package/dist/gitagent-YBMWY7NZ.js +726 -0
- package/dist/gitee-3N7OFOM7.js +53 -0
- package/dist/gitee-KVNK6KLZ.js +54 -0
- package/dist/github-LUEC2LID.js +143 -0
- package/dist/github-XRO5Z3GC.js +142 -0
- package/dist/google-ads-A3QAJI4D.js +88 -0
- package/dist/google-ads-VPKWTX67.js +89 -0
- package/dist/google-analytics-C4UR5ZR2.js +50 -0
- package/dist/google-analytics-XDYZA2B7.js +49 -0
- package/dist/google-workspace-LL3EWVHH.js +320 -0
- package/dist/google-workspace-YX35SHHX.js +321 -0
- package/dist/huawei-xiaoyi-6BSMGJHR.js +40 -0
- package/dist/huawei-xiaoyi-KPWLTSHB.js +41 -0
- package/dist/hubspot-DIUHGEDI.js +45 -0
- package/dist/hubspot-FTIEMNZO.js +44 -0
- package/dist/huggingface-MJCOXA7E.js +116 -0
- package/dist/huggingface-UUXK2RHK.js +117 -0
- package/dist/index.d.ts +3013 -0
- package/dist/index.js +15649 -0
- package/dist/inference-ai-image-generation-CMI6R5T3.js +106 -0
- package/dist/inference-ai-image-generation-PXV6IG4U.js +107 -0
- package/dist/inference-sh-7AZOLEFI.js +94 -0
- package/dist/inference-sh-ABQOD3YF.js +95 -0
- package/dist/init.command-6E24K4H3.js +9 -0
- package/dist/init.command-O4HG4HKR.js +10 -0
- package/dist/klaviyo-6K5YEFNH.js +45 -0
- package/dist/klaviyo-LDPBWBSS.js +44 -0
- package/dist/kuaidi100-HGFM5VK2.js +42 -0
- package/dist/kuaidi100-UHPFCVXP.js +41 -0
- package/dist/lark-6LNA3LUQ.js +103 -0
- package/dist/lark-URVBZNS4.js +102 -0
- package/dist/linear-7QFSFPOD.js +57 -0
- package/dist/linear-T4ORUP7N.js +56 -0
- package/dist/lovart-PDUXRUHJ.js +99 -0
- package/dist/lovart-QO3SK55T.js +100 -0
- package/dist/meta-ads-SCNFI45S.js +42 -0
- package/dist/meta-ads-V6XPZWX3.js +41 -0
- package/dist/miclaw-5CNTW7VV.js +36 -0
- package/dist/miclaw-TPPPS2WN.js +35 -0
- package/dist/model-provider-AVSFJSZP.js +393 -0
- package/dist/model-provider-KFB76XV5.js +392 -0
- package/dist/notion-FZK76MN2.js +69 -0
- package/dist/notion-WFA7KGZZ.js +70 -0
- package/dist/oceanengine-3JZUS3PP.js +43 -0
- package/dist/oceanengine-5BRIJVJE.js +42 -0
- package/dist/opencli-PFXHGCS2.js +81 -0
- package/dist/opencli-VIGRJTGH.js +80 -0
- package/dist/paypal-33UADIPR.js +54 -0
- package/dist/paypal-Z5JYHIWD.js +55 -0
- package/dist/playwright-MG5WHK47.js +58 -0
- package/dist/playwright-SQAQ3DZG.js +59 -0
- package/dist/plugins-HZBWK3WQ.js +120 -0
- package/dist/plugins-I4GD5SZX.js +121 -0
- package/dist/posthog-MU5MAJOQ.js +79 -0
- package/dist/posthog-RJRRKDWB.js +80 -0
- package/dist/salesforce-34FVIJTG.js +82 -0
- package/dist/salesforce-3QZ6OFVO.js +83 -0
- package/dist/sentry-MCIRMACU.js +111 -0
- package/dist/sentry-PIWW46VA.js +110 -0
- package/dist/seo-suite-4SQ3I67Q.js +54 -0
- package/dist/seo-suite-WJXMA3S4.js +55 -0
- package/dist/serve.command-5FMIPQRY.js +10 -0
- package/dist/serve.command-DNE6GPMK.js +9 -0
- package/dist/shadowob-JELOWHWX.js +1068 -0
- package/dist/shadowob-PRSMI5MW.js +1069 -0
- package/dist/sherlock-2PKY2E2Y.js +66 -0
- package/dist/sherlock-C5ZWPPVT.js +67 -0
- package/dist/shopify-GL3NFVGE.js +94 -0
- package/dist/shopify-R4G3UXM6.js +93 -0
- package/dist/skill-discovery-7INAUP4D.js +77 -0
- package/dist/skill-discovery-YPXXV622.js +78 -0
- package/dist/state-7MCZBTR5.js +17 -0
- package/dist/state-FGOFLFBE.js +18 -0
- package/dist/stripe-C22RR4ZS.js +83 -0
- package/dist/stripe-LJNPQ3CQ.js +82 -0
- package/dist/supabase-IRNQ54FJ.js +98 -0
- package/dist/supabase-N4ONFJNQ.js +97 -0
- package/dist/taobao-aipaas-LRR4GMO3.js +45 -0
- package/dist/taobao-aipaas-RVKORSF4.js +46 -0
- package/dist/tapd-3JPVJ7XH.js +46 -0
- package/dist/tapd-TMQRSMFG.js +47 -0
- package/dist/tencent-ads-IGD33LO7.js +42 -0
- package/dist/tencent-ads-UHC6OPBV.js +43 -0
- package/dist/tencent-docs-C3A4J3CJ.js +47 -0
- package/dist/tencent-docs-O2SC4FHL.js +48 -0
- package/dist/tencent-maps-HMMWMNF4.js +37 -0
- package/dist/tencent-maps-OQOKHVW2.js +36 -0
- package/dist/vercel-KOXDDTHX.js +73 -0
- package/dist/vercel-OLNVDWMG.js +74 -0
- package/dist/webflow-FULU5Q2I.js +114 -0
- package/dist/webflow-OMJKZM54.js +115 -0
- package/dist/wechat-miniprogram-skyline-KYCDMQNW.js +74 -0
- package/dist/wechat-miniprogram-skyline-VR4FVIQL.js +75 -0
- package/dist/wechat-pay-BCMAJ6UW.js +50 -0
- package/dist/wechat-pay-YQQKXVUI.js +51 -0
- package/dist/wonda-NGWIORYN.js +81 -0
- package/dist/wonda-RBABXFNM.js +82 -0
- package/dist/wordpress-woocommerce-RDIUTHYT.js +57 -0
- package/dist/wordpress-woocommerce-RNA5HB3N.js +58 -0
- package/dist/wps-DAEFQHDE.js +47 -0
- package/dist/wps-LUWHMZQQ.js +48 -0
- package/dist/yuque-HCHTJWNI.js +72 -0
- package/dist/yuque-KRH5O74J.js +71 -0
- package/images/RUNNERS.md +270 -0
- package/images/cc-connect-runner/entrypoint.mjs +311 -0
- package/images/claude-runner/Dockerfile +88 -0
- package/images/claude-runner/RUNNER.md +222 -0
- package/images/claude-runner/entrypoint.mjs +2 -0
- package/images/codex-runner/Dockerfile +87 -0
- package/images/codex-runner/RUNNER.md +226 -0
- package/images/codex-runner/entrypoint.mjs +2 -0
- package/images/gemini-runner/Dockerfile +87 -0
- package/images/gemini-runner/RUNNER.md +218 -0
- package/images/gemini-runner/entrypoint.mjs +2 -0
- package/images/hermes-runner/Dockerfile +74 -0
- package/images/hermes-runner/RUNNER.md +243 -0
- package/images/hermes-runner/entrypoint.mjs +283 -0
- package/images/openclaw-runner/Dockerfile +212 -0
- package/images/openclaw-runner/RUNNER.md +170 -0
- package/images/openclaw-runner/entrypoint.mjs +1113 -0
- package/images/openclaw-runner/warm-runtime-deps.mjs +95 -0
- package/images/opencode-runner/Dockerfile +87 -0
- package/images/opencode-runner/RUNNER.md +202 -0
- package/images/opencode-runner/entrypoint.mjs +2 -0
- package/package.json +121 -0
- package/templates/agent-marketplace-buddy.template.json +131 -0
- package/templates/ai-werewolf.template.json +92 -0
- package/templates/bmad-method-buddy.template.json +123 -0
- package/templates/brain-fix.template.json +92 -0
- package/templates/claude-ads-buddy.template.json +123 -0
- package/templates/claude-financial-services-buddy.template.json +111 -0
- package/templates/claude-seo-buddy.template.json +123 -0
- package/templates/code-arena.template.json +92 -0
- package/templates/daily-brief.template.json +92 -0
- package/templates/e-wife.template.json +92 -0
- package/templates/everything-claude-code-buddy.template.json +125 -0
- package/templates/financial-freedom.template.json +92 -0
- package/templates/gitstory.template.json +92 -0
- package/templates/google-workspace-buddy.template.json +88 -0
- package/templates/gsd-buddy.template.json +119 -0
- package/templates/gstack-buddy.template.json +143 -0
- package/templates/gstack.template.json +92 -0
- package/templates/little-match-girl.template.json +114 -0
- package/templates/lovart-buddy.template.json +110 -0
- package/templates/marketingskills-buddy.template.json +102 -0
- package/templates/retire-buddy.template.json +92 -0
- package/templates/scientific-skills-buddy.template.json +119 -0
- package/templates/seomachine-buddy.template.json +113 -0
- package/templates/shadow-server-app-demo.template.json +105 -0
- package/templates/slavingia-skills-buddy.template.json +102 -0
- package/templates/superclaude-buddy.template.json +146 -0
- package/templates/superpowers-buddy.template.json +108 -0
- package/templates/world-pulse.template.json +92 -0
|
@@ -0,0 +1,725 @@
|
|
|
1
|
+
import {
|
|
2
|
+
definePlugin
|
|
3
|
+
} from "./chunk-JY2HTT7Q.js";
|
|
4
|
+
import "./chunk-R5U7XKVJ.js";
|
|
5
|
+
|
|
6
|
+
// src/plugins/gitagent/index.ts
|
|
7
|
+
import { existsSync as existsSync2 } from "fs";
|
|
8
|
+
import { resolve } from "path";
|
|
9
|
+
|
|
10
|
+
// src/plugins/gitagent/k8s.ts
|
|
11
|
+
var STANDARD_GITAGENT_FILES = [
|
|
12
|
+
"SOUL.md",
|
|
13
|
+
"RULES.md",
|
|
14
|
+
"AGENTS.md",
|
|
15
|
+
"INSTRUCTIONS.md",
|
|
16
|
+
"agent.yaml",
|
|
17
|
+
"scheduler.yml",
|
|
18
|
+
"scheduler.yaml",
|
|
19
|
+
"skills",
|
|
20
|
+
"tools",
|
|
21
|
+
"hooks",
|
|
22
|
+
"skillflows",
|
|
23
|
+
"memory",
|
|
24
|
+
"knowledge",
|
|
25
|
+
"compliance"
|
|
26
|
+
];
|
|
27
|
+
function buildGitCloneCommand(opts) {
|
|
28
|
+
const { url, ref, depth, agentDir, mountPath, include } = opts;
|
|
29
|
+
const cloneTarget = "/tmp/agent-source";
|
|
30
|
+
const cmds = [];
|
|
31
|
+
cmds.push(`git clone --depth ${depth} --branch "${ref}" "${url}" "${cloneTarget}"`);
|
|
32
|
+
const sourceDir = agentDir ? `${cloneTarget}/${agentDir}` : cloneTarget;
|
|
33
|
+
cmds.push(`mkdir -p "${mountPath}"`);
|
|
34
|
+
if (include && include.length > 0) {
|
|
35
|
+
for (const pattern of include) {
|
|
36
|
+
cmds.push(`cp -r "${sourceDir}/${pattern}" "${mountPath}/" 2>/dev/null || true`);
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
39
|
+
for (const f of STANDARD_GITAGENT_FILES) {
|
|
40
|
+
cmds.push(`cp -r "${sourceDir}/${f}" "${mountPath}/" 2>/dev/null || true`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return ["/bin/sh", "-c", cmds.join(" && ")];
|
|
44
|
+
}
|
|
45
|
+
function parsePollInterval(input) {
|
|
46
|
+
if (input == null) return 0;
|
|
47
|
+
if (typeof input === "number") return Math.max(0, Math.floor(input));
|
|
48
|
+
const m = /^(\d+)\s*(s|m|h)?$/.exec(input.trim());
|
|
49
|
+
if (!m) return 0;
|
|
50
|
+
const n = Number(m[1]);
|
|
51
|
+
const unit = m[2] ?? "s";
|
|
52
|
+
switch (unit) {
|
|
53
|
+
case "h":
|
|
54
|
+
return n * 3600;
|
|
55
|
+
case "m":
|
|
56
|
+
return n * 60;
|
|
57
|
+
default:
|
|
58
|
+
return n;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function buildGitSyncSidecar(opts) {
|
|
62
|
+
const { name, url, ref, depth, agentDir, mountPath, include, intervalSec } = opts;
|
|
63
|
+
if (!intervalSec || intervalSec <= 0) return void 0;
|
|
64
|
+
const cloneTarget = "/tmp/agent-source";
|
|
65
|
+
const filesToCopy = include && include.length > 0 ? include : STANDARD_GITAGENT_FILES;
|
|
66
|
+
const copySnippet = filesToCopy.map(
|
|
67
|
+
(f) => `cp -r "${cloneTarget}/${agentDir ?? "."}/${f}" "${mountPath}/" 2>/dev/null || true`
|
|
68
|
+
).join("; ");
|
|
69
|
+
const script = `
|
|
70
|
+
set -e
|
|
71
|
+
if [ ! -d "${cloneTarget}/.git" ]; then
|
|
72
|
+
git clone --depth ${depth} --branch "${ref}" "${url}" "${cloneTarget}"
|
|
73
|
+
fi
|
|
74
|
+
while true; do
|
|
75
|
+
cd "${cloneTarget}"
|
|
76
|
+
git fetch --depth ${depth} origin "${ref}" 2>&1 || echo "[gitagent-sync] fetch failed, will retry"
|
|
77
|
+
git reset --hard "origin/${ref}" 2>&1 || git reset --hard "${ref}" 2>&1 || true
|
|
78
|
+
mkdir -p "${mountPath}"
|
|
79
|
+
${copySnippet}
|
|
80
|
+
# touch a marker file so readers using chokidar(fs) can debounce on it
|
|
81
|
+
date -u +%FT%TZ > "${mountPath}/.gitagent-synced-at" || true
|
|
82
|
+
sleep ${intervalSec}
|
|
83
|
+
done
|
|
84
|
+
`.trim();
|
|
85
|
+
return {
|
|
86
|
+
name,
|
|
87
|
+
image: "alpine/git:latest",
|
|
88
|
+
imagePullPolicy: "IfNotPresent",
|
|
89
|
+
command: ["/bin/sh", "-c", script],
|
|
90
|
+
volumeMounts: [{ name: "gitagent-src", mountPath }],
|
|
91
|
+
resources: {
|
|
92
|
+
requests: { cpu: "10m", memory: "32Mi" },
|
|
93
|
+
limits: { cpu: "100m", memory: "128Mi" }
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// src/plugins/gitagent/manifest.json
|
|
99
|
+
var manifest_default = {
|
|
100
|
+
id: "gitagent",
|
|
101
|
+
name: "GitAgent",
|
|
102
|
+
description: "Deploy agents from gitagent-standard git repositories. Supports init-container (runtime clone) and build-image (pre-baked) strategies.",
|
|
103
|
+
version: "1.0.0",
|
|
104
|
+
category: "code",
|
|
105
|
+
icon: "git-branch",
|
|
106
|
+
website: "https://gitagent.sh/",
|
|
107
|
+
docs: "https://github.com/open-gitagent/gitagent",
|
|
108
|
+
auth: {
|
|
109
|
+
type: "token",
|
|
110
|
+
fields: [
|
|
111
|
+
{
|
|
112
|
+
key: "GITHUB_TOKEN",
|
|
113
|
+
label: "Git Token (HTTPS)",
|
|
114
|
+
description: "Personal access token for private HTTPS repositories",
|
|
115
|
+
required: false,
|
|
116
|
+
sensitive: true,
|
|
117
|
+
placeholder: "ghp_..."
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
config: {
|
|
122
|
+
type: "object",
|
|
123
|
+
properties: {
|
|
124
|
+
git: {
|
|
125
|
+
type: "object",
|
|
126
|
+
description: "Git repository source",
|
|
127
|
+
properties: {
|
|
128
|
+
url: { type: "string", description: "Repository URL (HTTPS or SSH)" },
|
|
129
|
+
ref: { type: "string", description: "Branch, tag, or commit SHA" },
|
|
130
|
+
dir: { type: "string", description: "Subdirectory within the repo" },
|
|
131
|
+
depth: { type: "number", description: "Shallow clone depth" },
|
|
132
|
+
sshKeySecret: { type: "string", description: "K8s Secret name for SSH key" },
|
|
133
|
+
tokenSecret: {
|
|
134
|
+
type: "string",
|
|
135
|
+
description: "K8s Secret name or env var for HTTPS token"
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
path: { type: "string", description: "Local gitagent directory (dev mode)" },
|
|
140
|
+
poll: {
|
|
141
|
+
type: "string",
|
|
142
|
+
description: "Poll interval for live git-pull sidecar, e.g. '5m', '30s'. Omit to disable."
|
|
143
|
+
},
|
|
144
|
+
strategy: {
|
|
145
|
+
type: "string",
|
|
146
|
+
enum: ["init-container", "build-image"],
|
|
147
|
+
default: "init-container"
|
|
148
|
+
},
|
|
149
|
+
mountPath: { type: "string", default: "/agent" },
|
|
150
|
+
include: { type: "array", items: { type: "string" } },
|
|
151
|
+
imageTag: { type: "string", description: "Docker image tag for build-image strategy" }
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
capabilities: ["config-builder"],
|
|
155
|
+
tags: ["git", "gitagent", "source", "repository", "init-container", "build-image"]
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
// src/plugins/gitagent/reader.ts
|
|
159
|
+
import { existsSync, readdirSync, readFileSync } from "fs";
|
|
160
|
+
import { readdir, readFile as readFileAsync, stat } from "fs/promises";
|
|
161
|
+
import { join } from "path";
|
|
162
|
+
function parseYaml(content) {
|
|
163
|
+
const lines = content.split("\n");
|
|
164
|
+
let pos = 0;
|
|
165
|
+
const at = (i) => lines[i];
|
|
166
|
+
function skipEmptyAndComments() {
|
|
167
|
+
while (pos < lines.length) {
|
|
168
|
+
const line = at(pos);
|
|
169
|
+
const trimmed = line.trim();
|
|
170
|
+
if (trimmed === "" || trimmed.startsWith("#")) {
|
|
171
|
+
pos++;
|
|
172
|
+
} else {
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
function getIndent(line) {
|
|
178
|
+
return line.length - line.trimStart().length;
|
|
179
|
+
}
|
|
180
|
+
function parseValue(raw) {
|
|
181
|
+
const v = raw.trim();
|
|
182
|
+
if (v === "true" || v === "yes") return true;
|
|
183
|
+
if (v === "false" || v === "no") return false;
|
|
184
|
+
if (v === "null" || v === "~" || v === "") return null;
|
|
185
|
+
if (/^-?\d+$/.test(v)) return Number.parseInt(v, 10);
|
|
186
|
+
if (/^-?\d*\.\d+$/.test(v)) return Number.parseFloat(v);
|
|
187
|
+
if (v.startsWith('"') && v.endsWith('"') || v.startsWith("'") && v.endsWith("'")) {
|
|
188
|
+
return v.slice(1, -1);
|
|
189
|
+
}
|
|
190
|
+
if (v.startsWith("[") && v.endsWith("]")) {
|
|
191
|
+
const inner = v.slice(1, -1);
|
|
192
|
+
if (inner.trim() === "") return [];
|
|
193
|
+
return inner.split(",").map((s) => parseValue(s.trim())).filter((s) => s !== null && s !== "");
|
|
194
|
+
}
|
|
195
|
+
return v;
|
|
196
|
+
}
|
|
197
|
+
function parseBlock(minIndent) {
|
|
198
|
+
skipEmptyAndComments();
|
|
199
|
+
if (pos >= lines.length) return null;
|
|
200
|
+
const firstLine = at(pos);
|
|
201
|
+
const firstIndent = getIndent(firstLine);
|
|
202
|
+
if (firstIndent < minIndent) return null;
|
|
203
|
+
const firstTrimmed = firstLine.trim();
|
|
204
|
+
if (firstTrimmed.startsWith("- ") || firstTrimmed === "-") {
|
|
205
|
+
const arr = [];
|
|
206
|
+
while (pos < lines.length) {
|
|
207
|
+
skipEmptyAndComments();
|
|
208
|
+
if (pos >= lines.length) break;
|
|
209
|
+
const line = at(pos);
|
|
210
|
+
const indent = getIndent(line);
|
|
211
|
+
if (indent < minIndent) break;
|
|
212
|
+
const trimmed = line.trim();
|
|
213
|
+
if (!trimmed.startsWith("-")) break;
|
|
214
|
+
const afterDash = trimmed.slice(1).trim();
|
|
215
|
+
pos++;
|
|
216
|
+
if (afterDash === "") {
|
|
217
|
+
arr.push(parseBlock(indent + 2));
|
|
218
|
+
} else if (afterDash.includes(":")) {
|
|
219
|
+
const obj = {};
|
|
220
|
+
const [k, ...rest] = afterDash.split(":");
|
|
221
|
+
const v = rest.join(":").trim();
|
|
222
|
+
if (v !== "") {
|
|
223
|
+
obj[k.trim()] = parseValue(v);
|
|
224
|
+
}
|
|
225
|
+
while (pos < lines.length) {
|
|
226
|
+
skipEmptyAndComments();
|
|
227
|
+
if (pos >= lines.length) break;
|
|
228
|
+
const nextLine = at(pos);
|
|
229
|
+
const nextIndent = getIndent(nextLine);
|
|
230
|
+
if (nextIndent < indent + 2) break;
|
|
231
|
+
const nextTrimmed = nextLine.trim();
|
|
232
|
+
if (!nextTrimmed.includes(":")) break;
|
|
233
|
+
const [nk, ...nrest] = nextTrimmed.split(":");
|
|
234
|
+
const nv = nrest.join(":").trim();
|
|
235
|
+
pos++;
|
|
236
|
+
obj[nk.trim()] = nv !== "" ? parseValue(nv) : parseBlock(nextIndent + 2);
|
|
237
|
+
}
|
|
238
|
+
arr.push(Object.keys(obj).length > 1 ? obj : parseValue(afterDash));
|
|
239
|
+
} else {
|
|
240
|
+
arr.push(parseValue(afterDash));
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return arr;
|
|
244
|
+
}
|
|
245
|
+
if (firstTrimmed.includes(":")) {
|
|
246
|
+
const obj = {};
|
|
247
|
+
while (pos < lines.length) {
|
|
248
|
+
skipEmptyAndComments();
|
|
249
|
+
if (pos >= lines.length) break;
|
|
250
|
+
const line = at(pos);
|
|
251
|
+
const indent = getIndent(line);
|
|
252
|
+
if (indent < minIndent) break;
|
|
253
|
+
const trimmed = line.trim();
|
|
254
|
+
if (trimmed.startsWith("-")) break;
|
|
255
|
+
const colonIdx = trimmed.indexOf(":");
|
|
256
|
+
if (colonIdx < 0) {
|
|
257
|
+
pos++;
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
260
|
+
const key = trimmed.slice(0, colonIdx).trim();
|
|
261
|
+
const afterColon = trimmed.slice(colonIdx + 1).trim();
|
|
262
|
+
pos++;
|
|
263
|
+
if (afterColon === "" || afterColon === "|" || afterColon === ">") {
|
|
264
|
+
if (afterColon === "|" || afterColon === ">") {
|
|
265
|
+
const blockLines = [];
|
|
266
|
+
while (pos < lines.length) {
|
|
267
|
+
const subLine = at(pos);
|
|
268
|
+
const subIndent = getIndent(subLine);
|
|
269
|
+
if (subLine.trim() === "") {
|
|
270
|
+
blockLines.push("");
|
|
271
|
+
pos++;
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
if (subIndent <= indent) break;
|
|
275
|
+
blockLines.push(subLine.slice(indent + 2));
|
|
276
|
+
pos++;
|
|
277
|
+
}
|
|
278
|
+
obj[key] = blockLines.join("\n").trimEnd();
|
|
279
|
+
} else {
|
|
280
|
+
skipEmptyAndComments();
|
|
281
|
+
if (pos < lines.length) {
|
|
282
|
+
const nextLine = at(pos);
|
|
283
|
+
const nextIndent = getIndent(nextLine);
|
|
284
|
+
if (nextIndent > indent) {
|
|
285
|
+
obj[key] = parseBlock(nextIndent);
|
|
286
|
+
} else {
|
|
287
|
+
obj[key] = null;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
} else {
|
|
292
|
+
obj[key] = parseValue(afterColon);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
return obj;
|
|
296
|
+
}
|
|
297
|
+
pos++;
|
|
298
|
+
return parseValue(firstTrimmed);
|
|
299
|
+
}
|
|
300
|
+
return parseBlock(0);
|
|
301
|
+
}
|
|
302
|
+
function safeParseYaml(content, context) {
|
|
303
|
+
try {
|
|
304
|
+
const result = parseYaml(content);
|
|
305
|
+
if (result !== null && typeof result === "object" && !Array.isArray(result)) {
|
|
306
|
+
return result;
|
|
307
|
+
}
|
|
308
|
+
return {};
|
|
309
|
+
} catch (err) {
|
|
310
|
+
process.stderr.write(`[gitagent] YAML parse warning in ${context}: ${String(err)}
|
|
311
|
+
`);
|
|
312
|
+
return {};
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
function readFileSync_(dir, ...parts) {
|
|
316
|
+
const p = join(dir, ...parts);
|
|
317
|
+
if (!existsSync(p)) return null;
|
|
318
|
+
return readFileSync(p, "utf-8");
|
|
319
|
+
}
|
|
320
|
+
function listDirSync(dir, ...parts) {
|
|
321
|
+
const p = join(dir, ...parts);
|
|
322
|
+
if (!existsSync(p)) return [];
|
|
323
|
+
try {
|
|
324
|
+
return readdirSync(p);
|
|
325
|
+
} catch {
|
|
326
|
+
return [];
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
function parseAgentYaml(content) {
|
|
330
|
+
const raw = safeParseYaml(content, "agent.yaml");
|
|
331
|
+
const model = raw.model;
|
|
332
|
+
const compliance = raw.compliance;
|
|
333
|
+
const supervision = compliance?.supervision ?? {};
|
|
334
|
+
const recordkeeping = compliance?.recordkeeping ?? {};
|
|
335
|
+
return {
|
|
336
|
+
name: raw.name ?? "",
|
|
337
|
+
version: raw.version,
|
|
338
|
+
description: raw.description,
|
|
339
|
+
model: model ? {
|
|
340
|
+
preferred: model.preferred ?? "",
|
|
341
|
+
fallbacks: model.fallbacks ?? void 0,
|
|
342
|
+
constraints: model.constraints ? {
|
|
343
|
+
temperature: model.constraints.temperature ?? void 0,
|
|
344
|
+
max_tokens: model.constraints.max_tokens ?? void 0,
|
|
345
|
+
top_p: model.constraints.top_p ?? void 0,
|
|
346
|
+
thinking_level: model.constraints.thinking_level ?? void 0
|
|
347
|
+
} : void 0
|
|
348
|
+
} : void 0,
|
|
349
|
+
skills: raw.skills ?? void 0,
|
|
350
|
+
tools: raw.tools ?? void 0,
|
|
351
|
+
runtime: raw.runtime,
|
|
352
|
+
compliance: compliance ? {
|
|
353
|
+
risk_tier: compliance.risk_tier,
|
|
354
|
+
frameworks: compliance.frameworks ?? void 0,
|
|
355
|
+
supervision: {
|
|
356
|
+
human_in_the_loop: supervision.human_in_the_loop
|
|
357
|
+
},
|
|
358
|
+
recordkeeping: {
|
|
359
|
+
audit_logging: recordkeeping.audit_logging,
|
|
360
|
+
retention_period: recordkeeping.retention_period
|
|
361
|
+
},
|
|
362
|
+
model_risk: compliance.model_risk
|
|
363
|
+
} : void 0,
|
|
364
|
+
dependencies: raw.dependencies,
|
|
365
|
+
agents: raw.agents ?? void 0,
|
|
366
|
+
delegation: raw.delegation,
|
|
367
|
+
exports: raw.exports
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
function parseSoulMd(content) {
|
|
371
|
+
const lines = content.split("\n");
|
|
372
|
+
let name;
|
|
373
|
+
let personality = "";
|
|
374
|
+
for (const line of lines) {
|
|
375
|
+
if (!name && line.startsWith("# ")) {
|
|
376
|
+
name = line.slice(2).trim();
|
|
377
|
+
continue;
|
|
378
|
+
}
|
|
379
|
+
personality += `${line}
|
|
380
|
+
`;
|
|
381
|
+
}
|
|
382
|
+
personality = personality.trim();
|
|
383
|
+
return {
|
|
384
|
+
name,
|
|
385
|
+
personality: personality || void 0
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
function parseRulesMd(content) {
|
|
389
|
+
return content.trim();
|
|
390
|
+
}
|
|
391
|
+
function parseInstructionsMd(content) {
|
|
392
|
+
return content.trim();
|
|
393
|
+
}
|
|
394
|
+
function parseSkillMd(skillId, content) {
|
|
395
|
+
const fmMatch = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
396
|
+
if (!fmMatch) {
|
|
397
|
+
return { id: skillId, content };
|
|
398
|
+
}
|
|
399
|
+
const meta = safeParseYaml(fmMatch[1], `skills/${skillId}/SKILL.md`);
|
|
400
|
+
return {
|
|
401
|
+
id: skillId,
|
|
402
|
+
name: meta.name ?? skillId,
|
|
403
|
+
version: meta.version,
|
|
404
|
+
description: meta.description,
|
|
405
|
+
triggers: meta.triggers ?? void 0,
|
|
406
|
+
content: fmMatch[2].trim()
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
function parseToolYaml(toolId, content) {
|
|
410
|
+
const raw = safeParseYaml(content, `tools/${toolId}.yaml`);
|
|
411
|
+
return {
|
|
412
|
+
id: toolId,
|
|
413
|
+
name: raw.name ?? toolId,
|
|
414
|
+
description: raw.description,
|
|
415
|
+
type: raw.type,
|
|
416
|
+
schema: raw.schema
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
function parseHooksYaml(content) {
|
|
420
|
+
const raw = safeParseYaml(content, "hooks/hooks.yaml");
|
|
421
|
+
const lifecycle = raw.lifecycle;
|
|
422
|
+
const events = raw.events;
|
|
423
|
+
return {
|
|
424
|
+
lifecycle: lifecycle ? {
|
|
425
|
+
on_start: lifecycle.on_start,
|
|
426
|
+
on_stop: lifecycle.on_stop,
|
|
427
|
+
on_error: lifecycle.on_error,
|
|
428
|
+
on_reset: lifecycle.on_reset
|
|
429
|
+
} : void 0,
|
|
430
|
+
events: events?.map((e) => ({
|
|
431
|
+
name: e.name ?? "",
|
|
432
|
+
trigger: e.trigger ?? "",
|
|
433
|
+
skill: e.skill,
|
|
434
|
+
tool: e.tool,
|
|
435
|
+
prompt: e.prompt
|
|
436
|
+
})),
|
|
437
|
+
bootstrap: void 0,
|
|
438
|
+
teardown: void 0
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
function parseSkillFlowYaml(content, filename) {
|
|
442
|
+
const raw = safeParseYaml(content, filename);
|
|
443
|
+
const stepsRaw = raw.steps ?? {};
|
|
444
|
+
const steps = {};
|
|
445
|
+
for (const [stepId, stepRaw] of Object.entries(stepsRaw)) {
|
|
446
|
+
if (!stepRaw || typeof stepRaw !== "object") continue;
|
|
447
|
+
steps[stepId] = {
|
|
448
|
+
skill: stepRaw.skill,
|
|
449
|
+
agent: stepRaw.agent,
|
|
450
|
+
tool: stepRaw.tool,
|
|
451
|
+
dependsOn: stepRaw.depends_on ?? void 0,
|
|
452
|
+
inputs: stepRaw.inputs ?? void 0,
|
|
453
|
+
prompt: stepRaw.prompt,
|
|
454
|
+
conditions: stepRaw.conditions ?? void 0
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
const errorHandling = raw.error_handling;
|
|
458
|
+
return {
|
|
459
|
+
name: raw.name ?? filename,
|
|
460
|
+
description: raw.description,
|
|
461
|
+
triggers: raw.triggers ?? void 0,
|
|
462
|
+
schedule: raw.schedule,
|
|
463
|
+
steps,
|
|
464
|
+
errorHandling: errorHandling ? {
|
|
465
|
+
onFailure: errorHandling.on_failure,
|
|
466
|
+
notifyChannel: errorHandling.notify_channel,
|
|
467
|
+
maxRetries: errorHandling.max_retries
|
|
468
|
+
} : void 0
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
function parseSchedulerYaml(content) {
|
|
472
|
+
const raw = safeParseYaml(content, "scheduler.yml");
|
|
473
|
+
const schedules = raw.schedules;
|
|
474
|
+
return {
|
|
475
|
+
schedules: schedules?.map((s) => ({
|
|
476
|
+
name: s.name ?? "",
|
|
477
|
+
cron: s.cron,
|
|
478
|
+
interval: s.interval,
|
|
479
|
+
skill: s.skill,
|
|
480
|
+
tool: s.tool,
|
|
481
|
+
prompt: s.prompt,
|
|
482
|
+
enabled: s.enabled
|
|
483
|
+
}))
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
function readGitAgentDir(dir) {
|
|
487
|
+
const parsed = {
|
|
488
|
+
skills: [],
|
|
489
|
+
tools: [],
|
|
490
|
+
skillFlows: [],
|
|
491
|
+
dir
|
|
492
|
+
};
|
|
493
|
+
const agentYaml = readFileSync_(dir, "agent.yaml");
|
|
494
|
+
if (agentYaml) parsed.manifest = parseAgentYaml(agentYaml);
|
|
495
|
+
const soulMd = readFileSync_(dir, "SOUL.md");
|
|
496
|
+
if (soulMd) parsed.soul = parseSoulMd(soulMd);
|
|
497
|
+
const rulesMd = readFileSync_(dir, "RULES.md");
|
|
498
|
+
if (rulesMd) parsed.rules = parseRulesMd(rulesMd);
|
|
499
|
+
const instructionsMd = readFileSync_(dir, "INSTRUCTIONS.md");
|
|
500
|
+
if (instructionsMd) parsed.instructions = parseInstructionsMd(instructionsMd);
|
|
501
|
+
const agentsMd = readFileSync_(dir, "AGENTS.md");
|
|
502
|
+
if (agentsMd) parsed.agents = agentsMd.trim();
|
|
503
|
+
for (const skillDir of listDirSync(dir, "skills")) {
|
|
504
|
+
const skillMd = readFileSync_(dir, "skills", skillDir, "SKILL.md");
|
|
505
|
+
if (skillMd) {
|
|
506
|
+
parsed.skills.push(parseSkillMd(skillDir, skillMd));
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
for (const toolFile of listDirSync(dir, "tools")) {
|
|
510
|
+
if (!toolFile.endsWith(".yaml") && !toolFile.endsWith(".yml")) continue;
|
|
511
|
+
const toolContent = readFileSync_(dir, "tools", toolFile);
|
|
512
|
+
if (toolContent) {
|
|
513
|
+
const toolId = toolFile.replace(/\.(ya?ml)$/, "");
|
|
514
|
+
parsed.tools.push(parseToolYaml(toolId, toolContent));
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
const hooksYaml = readFileSync_(dir, "hooks", "hooks.yaml");
|
|
518
|
+
if (hooksYaml) {
|
|
519
|
+
parsed.hooks = parseHooksYaml(hooksYaml);
|
|
520
|
+
parsed.hooks.bootstrap = readFileSync_(dir, "hooks", "bootstrap.md") ?? void 0;
|
|
521
|
+
parsed.hooks.teardown = readFileSync_(dir, "hooks", "teardown.md") ?? void 0;
|
|
522
|
+
} else {
|
|
523
|
+
const bootstrap = readFileSync_(dir, "hooks", "bootstrap.md");
|
|
524
|
+
const teardown = readFileSync_(dir, "hooks", "teardown.md");
|
|
525
|
+
if (bootstrap || teardown) {
|
|
526
|
+
parsed.hooks = { bootstrap: bootstrap ?? void 0, teardown: teardown ?? void 0 };
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
for (const sfFile of listDirSync(dir, "skillflows")) {
|
|
530
|
+
if (!sfFile.endsWith(".yaml") && !sfFile.endsWith(".yml")) continue;
|
|
531
|
+
const sfContent = readFileSync_(dir, "skillflows", sfFile);
|
|
532
|
+
if (sfContent) {
|
|
533
|
+
parsed.skillFlows.push(parseSkillFlowYaml(sfContent, sfFile));
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
const schedulerYml = readFileSync_(dir, "scheduler.yml") ?? readFileSync_(dir, "scheduler.yaml");
|
|
537
|
+
if (schedulerYml) parsed.scheduler = parseSchedulerYaml(schedulerYml);
|
|
538
|
+
const memoryMd = readFileSync_(dir, "memory", "MEMORY.md");
|
|
539
|
+
if (memoryMd) parsed.memoryInstructions = memoryMd.trim();
|
|
540
|
+
return parsed;
|
|
541
|
+
}
|
|
542
|
+
function adaptGitAgentModel(manifest) {
|
|
543
|
+
if (!manifest.model?.preferred) return void 0;
|
|
544
|
+
const m = manifest.model;
|
|
545
|
+
return {
|
|
546
|
+
preferred: m.preferred,
|
|
547
|
+
fallbacks: m.fallbacks,
|
|
548
|
+
constraints: m.constraints ? {
|
|
549
|
+
temperature: m.constraints.temperature,
|
|
550
|
+
maxTokens: m.constraints.max_tokens,
|
|
551
|
+
topP: m.constraints.top_p,
|
|
552
|
+
thinkingLevel: m.constraints.thinking_level
|
|
553
|
+
} : void 0
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
function adaptGitAgentCompliance(manifest) {
|
|
557
|
+
if (!manifest.compliance) return void 0;
|
|
558
|
+
const c = manifest.compliance;
|
|
559
|
+
return {
|
|
560
|
+
riskTier: c.risk_tier,
|
|
561
|
+
frameworks: c.frameworks,
|
|
562
|
+
humanInTheLoop: c.supervision?.human_in_the_loop,
|
|
563
|
+
auditLogging: c.recordkeeping?.audit_logging,
|
|
564
|
+
retentionPeriod: c.recordkeeping?.retention_period
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
function enrichAgentFromGitAgent(agent, parsed) {
|
|
568
|
+
const enriched = { ...agent };
|
|
569
|
+
if (parsed.soul) {
|
|
570
|
+
enriched.identity = {
|
|
571
|
+
name: agent.identity?.name ?? parsed.soul.name,
|
|
572
|
+
description: agent.identity?.description ?? parsed.manifest?.description,
|
|
573
|
+
personality: agent.identity?.personality ?? parsed.soul.personality,
|
|
574
|
+
systemPrompt: agent.identity?.systemPrompt
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
if (!enriched.description && parsed.manifest?.description) {
|
|
578
|
+
enriched.description = parsed.manifest.description;
|
|
579
|
+
}
|
|
580
|
+
if (!enriched.model && parsed.manifest) {
|
|
581
|
+
enriched.model = adaptGitAgentModel(parsed.manifest) ?? enriched.model;
|
|
582
|
+
}
|
|
583
|
+
if (!enriched.compliance && parsed.manifest) {
|
|
584
|
+
enriched.compliance = adaptGitAgentCompliance(parsed.manifest) ?? enriched.compliance;
|
|
585
|
+
}
|
|
586
|
+
if (!enriched.workflows?.length && parsed.skillFlows.length > 0) {
|
|
587
|
+
enriched.workflows = parsed.skillFlows;
|
|
588
|
+
}
|
|
589
|
+
return enriched;
|
|
590
|
+
}
|
|
591
|
+
function buildOpenClawFromGitAgent(parsed, mountPath) {
|
|
592
|
+
const result = {};
|
|
593
|
+
result.agents = {
|
|
594
|
+
defaults: {
|
|
595
|
+
repoRoot: mountPath
|
|
596
|
+
}
|
|
597
|
+
};
|
|
598
|
+
if (parsed.skills.length > 0) {
|
|
599
|
+
result.skills = {
|
|
600
|
+
load: { extraDirs: [join(mountPath, "skills")] },
|
|
601
|
+
entries: Object.fromEntries(
|
|
602
|
+
parsed.skills.map((s) => [
|
|
603
|
+
s.id,
|
|
604
|
+
{
|
|
605
|
+
enabled: true
|
|
606
|
+
}
|
|
607
|
+
])
|
|
608
|
+
)
|
|
609
|
+
};
|
|
610
|
+
}
|
|
611
|
+
if (parsed.scheduler?.schedules?.length) {
|
|
612
|
+
const firstSchedule = parsed.scheduler.schedules[0];
|
|
613
|
+
if (firstSchedule.cron || firstSchedule.interval) {
|
|
614
|
+
if (!result.agents) result.agents = {};
|
|
615
|
+
if (!result.agents.defaults) result.agents.defaults = {};
|
|
616
|
+
result.agents.defaults.heartbeat = {
|
|
617
|
+
every: firstSchedule.interval ?? firstSchedule.cron,
|
|
618
|
+
prompt: firstSchedule.prompt ?? `Run scheduled task: ${firstSchedule.name}`
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
return result;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
// src/plugins/gitagent/index.ts
|
|
626
|
+
var gitagentK8sProvider = {
|
|
627
|
+
buildK8s(agent, _ctx) {
|
|
628
|
+
const src = agent.source;
|
|
629
|
+
if (!src) return void 0;
|
|
630
|
+
const useGitagent = src.gitagent !== false;
|
|
631
|
+
if (!useGitagent) return void 0;
|
|
632
|
+
const git = src.git;
|
|
633
|
+
if (!git?.url) return void 0;
|
|
634
|
+
const mountPath = src.mountPath ?? "/agent";
|
|
635
|
+
const ref = git.ref ?? "main";
|
|
636
|
+
const depth = git.depth ?? 1;
|
|
637
|
+
const include = src.include;
|
|
638
|
+
const poll = src.poll;
|
|
639
|
+
const intervalSec = parsePollInterval(poll);
|
|
640
|
+
const result = {
|
|
641
|
+
initContainers: [
|
|
642
|
+
{
|
|
643
|
+
name: "gitagent-clone",
|
|
644
|
+
image: "alpine/git:latest",
|
|
645
|
+
imagePullPolicy: "IfNotPresent",
|
|
646
|
+
command: buildGitCloneCommand({
|
|
647
|
+
url: git.url,
|
|
648
|
+
ref,
|
|
649
|
+
depth,
|
|
650
|
+
agentDir: git.dir,
|
|
651
|
+
mountPath,
|
|
652
|
+
include
|
|
653
|
+
}),
|
|
654
|
+
volumeMounts: [{ name: "gitagent-src", mountPath }]
|
|
655
|
+
}
|
|
656
|
+
],
|
|
657
|
+
volumes: [{ name: "gitagent-src", spec: { emptyDir: {} } }],
|
|
658
|
+
volumeMounts: [{ name: "gitagent-src", mountPath }],
|
|
659
|
+
envVars: [{ name: "OPENCLAW_AGENT_DIR", value: mountPath }],
|
|
660
|
+
labels: { "gitagent.url": git.url.replace(/[^A-Za-z0-9._-]/g, "_").slice(0, 63) }
|
|
661
|
+
};
|
|
662
|
+
const sidecar = buildGitSyncSidecar({
|
|
663
|
+
name: "gitagent-sync",
|
|
664
|
+
url: git.url,
|
|
665
|
+
ref,
|
|
666
|
+
depth,
|
|
667
|
+
agentDir: git.dir,
|
|
668
|
+
mountPath,
|
|
669
|
+
include,
|
|
670
|
+
intervalSec
|
|
671
|
+
});
|
|
672
|
+
if (sidecar) result.sidecars = [sidecar];
|
|
673
|
+
return result;
|
|
674
|
+
}
|
|
675
|
+
};
|
|
676
|
+
var plugin = definePlugin(manifest_default, (api) => {
|
|
677
|
+
api.onResolveAgent((agent, _config) => {
|
|
678
|
+
const gitagentEntry = agent.use?.find((u) => u.plugin === "gitagent");
|
|
679
|
+
if (!gitagentEntry?.options) return agent;
|
|
680
|
+
let a = agent.source ? agent : { ...agent, source: gitagentEntry.options };
|
|
681
|
+
const localPath = a.source?.path ? resolve(a.source.path) : void 0;
|
|
682
|
+
if (localPath && existsSync2(localPath)) {
|
|
683
|
+
const parsed = readGitAgentDir(localPath);
|
|
684
|
+
a = enrichAgentFromGitAgent(a, parsed);
|
|
685
|
+
}
|
|
686
|
+
return a;
|
|
687
|
+
});
|
|
688
|
+
api.onBuildConfig((context) => {
|
|
689
|
+
const { agent } = context;
|
|
690
|
+
if (!agent.source) return {};
|
|
691
|
+
const mountPath = agent.source.mountPath ?? "/agent";
|
|
692
|
+
const useGitagent = agent.source.gitagent !== false;
|
|
693
|
+
if (!useGitagent) return {};
|
|
694
|
+
const fragment = {
|
|
695
|
+
agents: {
|
|
696
|
+
defaults: {
|
|
697
|
+
repoRoot: mountPath
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
};
|
|
701
|
+
if (agent.source.path) {
|
|
702
|
+
const localPath = resolve(agent.source.path);
|
|
703
|
+
if (existsSync2(localPath)) {
|
|
704
|
+
const parsed = readGitAgentDir(localPath);
|
|
705
|
+
const additions = buildOpenClawFromGitAgent(parsed, mountPath);
|
|
706
|
+
if (additions.skills) {
|
|
707
|
+
fragment.skills = additions.skills;
|
|
708
|
+
}
|
|
709
|
+
if (additions.agents?.defaults?.heartbeat) {
|
|
710
|
+
;
|
|
711
|
+
fragment.agents.defaults = {
|
|
712
|
+
...fragment.agents.defaults,
|
|
713
|
+
heartbeat: additions.agents.defaults.heartbeat
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
return fragment;
|
|
719
|
+
});
|
|
720
|
+
});
|
|
721
|
+
plugin.k8s = gitagentK8sProvider;
|
|
722
|
+
var gitagent_default = plugin;
|
|
723
|
+
export {
|
|
724
|
+
gitagent_default as default
|
|
725
|
+
};
|