SuperAPI AI 工具集

dsh-plugin

通用与其它

查看项目

更新于 10-16 06:44

技能介绍

用途:为 DSH(DeepSeek Harness)开发 cordis 插件,覆盖脚手架、安装、验证与调试全流程。插件可注册模型可调用的工具、挂接 harness 事件、提供服务、LLM 适配器或设置/UI 界面。不适用于修改 DSH 本身,也不直接编辑 ~/.dsh/profiles/<p>/cordis.yml(应始终为空数组,改 cordis.patch.yml)。

主要能力:新增工具(ctx.tools.register(defineTool(...)))、挂接事件(tools/pre-execute、agent/pre-step、session/event 等)、提供服务(class X extends Service)、LLM 适配器,以及面向用户的 ctx.settings.register 设置卡与 ctx.webServer.register 路由。

使用方式:以脚手架生成 package.json、tsconfig.json、cordis.patch.yml、src/、test/;先 npm install 与 npm run build(安装前 dist/ 必须存在,link: 安装不跑 prepare),再用 verify.mjs 校验,随后执行 $DSH plugin --profile web add -w ./dsh-hello(add 必须带 -w,remove 不需要),最后用 $DSH --profile web --dump-config 确认已组合进树。每次改源码后需重新构建并重启 profile。

限制:插件契约要求 Config 同时是 TS 接口与同名运行时 Schema;inject 中每项均为必需且阻塞;参数为隐式开放对象,显式 object 节点必须写 additionalProperties;必需性用每属性 required: true,无 JSON-Schema 的 required 数组;外部资源才需 ctx.effect 显式清理。devDeps 需锁定 profile 版本(cordis 4.0.1、schemastery 3.18.1、dsh-tools 0.1.1-rc.2)。cordis 4.0.1 不存在 reusable/disposable/using、Service.start()/stop()。其他参考文档、测试与功能验证步骤详见技能内 references 与脚本。更多具体环境路径与版本信息以资料为准。