dsh-development
Skill0 starsChanged 36 days agoMITView on GitHub
跨 Agent 通用的 DSH(DeepSeek Harness)插件与工具开发 Skill(标准 SKILL.md 格式): Cordis 插件、profile/bundle 安装、MCP 桥接(dsh-mcp-client)、工具规约、客户端 UI、Conversation Node、LLM 适配器。 在 Cursor / Claude Code / Codex 等 Agent 中开发、安装或调试 DSH 插件, `dsh plugin add`、宿主依赖/版本隔离、cordis.patch.yml、接入外部 MCP server、配置不生效、settings 白名单、升级或卸载后故障时使用。
In this repositoryOne other file it gives its agents.
- docs-official/AGENTS.mdAGENTS.md
The file
Files
DSH Development
任务路由
| 你在做… | 读 |
装/卸/升级插件、--patch 原型、bundle 层序 | references/plugins.md |
| 宿主依赖、DSH 版本对齐、官方/已安装分类、卸载审计 | references/dependencies.md |
| 判断改动要不要重启 | references/restart.md |
| Cordis 概念、Fiber、插件写法、Config | references/cordis.md |
| 架构、ctx 服务、扩展点映射 | references/architecture.md |
| 工具、扩展形态、Conversation Node、LLM 适配器 | references/capabilities.md |
| 接外部 MCP server(官方桥 / 社区插件承载)、选型 | references/mcp.md |
| 设置页、槽位、webServer 路由、logo | references/client-ui.md |
| 官方文档路径、cordis-api、subsystems 索引 | references/docs-index.md |
本机 $DSH_HOME、web profile、参考插件 | references/environment.md |
| 验证清单、已知坑、省 token 技巧 | references/troubleshooting.md |
离线中文副本与路径映射:docs-official/INDEX.md。官方全文克隆:/Users/apple/dev/deepseek-harness/docs/。DSH 已开源:deepseek-ai/deepseek-harness(MIT,基于 Cordis,"Everything is a Plugin")· 文档站。
快速开始
// lib/index.js — 最小工具插件
import type { Context } from '@deepseek-ai/cordis'
import { defineTool } from '@deepseek-ai/dsh-tools'
export const name = 'my-tool'
export const inject = ['tools']
export function apply(ctx: Context) {
ctx.tools.register(defineTool({
name: 'my_tool',
description: 'What this tool does.',
parameters: { arg: { type: 'string', required: true, description: '...' } },
output: { schema: { type: 'string' }, render: (_a, v) => [{ type: 'text', text: v }] },
async execute(args, exec) { return `result: ${args.arg}` },
}))
}注册分两条路(详见 plugins.md):
| 插件类型 | 怎么装 | profile cordis.patch.yml |
bundle(有 dsh.bundle) | dsh plugin --profile web add <path|git|tgz> | 不要 - insert: 同一 id;只 - id: 改 config / disabled |
| 非 bundle | dsh plugin add 或手动 patch | - insert: + config |
工作流:写 apply → 按上表注册 → 按重启规则判断是否重启 → 会话调工具 / curl 路由复验(troubleshooting.md)。
原型阶段:dsh web --patch ./scratch-plugin/cordis.yml,patch 里 name 用绝对路径;验证通过后打包 bundle 再 plugin add。
重启 TL;DR
| 改动 | 生效 |
宿主 lib/index.js(工具/路由/schema) | 重启(web profile 宿主 HMR 关) |
cordis.patch.yml 改已有 id 的 config | 热生效(不重载宿主代码) |
plugin add/remove/update(bundle 成员变) | 重启 |
客户端 lib/client.js | 刷新页面 |
settings.yaml 用户层 | 热生效 |
完整表、curl 验证宿主路由、settings 假成功 → restart.md。
Cordis 五概念(展开见 cordis.md)
| 概念 | 要点 |
| 插件 | apply(ctx);函数 / 对象 / Service 子类 |
| 上下文 | ctx.tools / ctx.llm / ctx.sessions…按 key 取服务 |
| inject | 依赖就绪后才 apply;顺序由依赖图决定 |
| 事件 | emit / bail / waterfall(须 next())/ serial / parallel |
| 可逆注册 | ctx.effect() / ctx.on(),卸载自动清理 |
DSH 版本与文档路由(防 API 腐化)
DSH 处于开发者预览期、持续发版(rc.1 → rc.2 → …),skill 静态参考必然滞后于已安装版本。铁律与机制:
- API 实证协议:任何
ctx.*API 用法,先对照本机已安装源码验证(<DSH安装根>/node_modules/@deepseek-ai/<pkg>/的 README + 源码),或真机探针;skill 文本与安装源码冲突时以源码为准,并回写修正 skill。实测教训:ctx.settings.register在教程里存在、在 rc.1/rc.2 里都不存在,mock 测试测不出,只有真机暴露。 - 快照按版本路由:
references/snapshots/dsh-<version>.md记录各版本的 API 面(服务方法、事件、探针结果)。开工先dsh --version:- 对应快照存在 → 读它,并留意文中标注的探针差异;
- 不存在 →
node tools/api-snapshot.mjs --out references/snapshots/dsh-<version>.md现场生成(自动探测本机 DSH,或--dir指定安装根/容器内安装根)。
- 快照 ≠ 上游原版:宿主侧打过补丁的安装(如 plugin-manager 的
-w)会进快照,标注「本机打过补丁」的行以上游 tarball 复核为准。
高频坑(展开见 troubleshooting.md)
- duplicate loader entry id:bundle 已
plugin add,patch 又insert同一 id → 只保留- id:改 config。 - GitHub 包名 alias:
dependencies键须与 bundle patch 的name:一致;bundles 只列一份。 - 升级后首页 400:
profiles/node_modules仍链旧 dsh →pnpm install+ 查dsh-host-webserver软链。 - 宿主包被插件遮蔽:外部插件 import 的
@deepseek-ai/dsh-*不应放在dependencies;放入peerDependencies,并以相同版本镜像到devDependencies,详见 dependencies.md。 - 官方插件显示为“已安装”:先区分安装目录提供的 optional bundle 与 profile 的直接依赖;不要为安装目录已经提供的官方 bundle 再
pnpm add到 profile。 - 卸载后仍有插件痕迹:同时检查 profile
package.json、lockfile、dsh.profile.bundles、node_modules链接和--dump-config,再重启验证;不要只看pnpm remove的退出码。 ctx.settings.register不存在(真机必炸):rc.1/rc.2 无此 API,照旧文档写宿主半区拒绝激活(mock 测不出);真实接缝 = 插件自有路由 +ctx.settings.update(ctx.fiber.entry?.options.id, patch)+ 可写字段.volatile()(schemastery ≥3.18.4)→ client-ui.md。- hybrid 插件 GUI 安装后不激活:无
dsh.bundle的包经插件管理器只落普通依赖,宿主半区不挂载——package.json必须声明dsh.bundle.patch(plugins.md)。 ERR_PNPM_ADDING_TO_ROOT(装插件):profile 是 pnpm workspace root 而 plugin-manager 不带-w(rc.1/rc.2 均如此)——CLI 加-w或宿主侧打补丁;GitHub spec 走 ssh 报 Host key verification 就 insteadOf 重写 https(troubleshooting.md)。- 设置保存假成功:第三方
settingsScope被白名单拒 → 走插件自有路由 + 宿主ctx.settings.update(entry.options.id, patch)(client-ui.md)。 - curl 200 HTML:未注册路由回退 SPA 首页 → 看
content-type是否为application/json。 agents.create不传setup= 空全局层:meta.agentPreset只写 header 不挂载(创建成功不报错、无 bash/fs/skill);必须setup: (agentCtx) => ctx.agentPresets.mount(agentCtx, id?),验证看会话日志request/header实际工具清单 → architecture.md。
本机环境(摘要)
| 项 | 值 |
| GUI | http://127.0.0.1:3080 |
| 启动 | npx @deepseek-ai/dsh web;dsh --profile <name> 多配置隔离 |
$DSH_HOME | ~/.dsh |
| web profile | ~/.dsh/profiles/web/ |
| 官方克隆 | /Users/apple/dev/deepseek-harness |
完整表、参考插件路径 → environment.md。
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

