zhangjunjesse
dsh-claude-code
No description
- Stars
- 0
- Language
- JavaScript
- Created
- Aug 16, 2026
- Updated
- Aug 16, 2026
Introduction
dsh-claude-code
一个 DeepSeek Harness 工具插件:把自包含的编码子任务委派给本地 Claude Code 订阅执行,结果回传给 DSH。DSH 是 leader,Claude Code 是 worker。
- 走官方 Claude Agent SDK,驱动
claudeCLI,不提取任何 OAuth token,合规使用订阅。 - 内置 claude-code-delegation skill(Leader-Worker 委派 SOP),装好即出现在技能目录。
- 支持 resume 跨轮记忆:把上次返回的
sessionId传回,Claude Code 会记住之前的上下文,适合多轮迭代。
安装(用户侧)
# 方式一(最简单,自动接线):通过 dsh 插件命令安装
dsh plugin --profile web add dsh-claude-code
# 方式二:手动装进 profile
cd ~/.dsh/profiles
npm install dsh-claude-code
# 然后在 ~/.dsh/profiles/<你的profile>/cordis.patch.yml 里加上:
# - insert:
# - id: claude-code
# name: 'dsh-claude-code'
装完重启 dsh。插件自带 cordis.patch.yml(dsh.bundle manifest),dsh plugin add 会用它自动接线。
接线示例(带配置):
- insert:
- id: claude-code
name: 'dsh-claude-code'
config:
model: sonnet # sonnet | opus | haiku | 完整 id
permissionMode: acceptEdits # default | acceptEdits | bypassPermissions | plan | dontAsk
maxTurns: 100
timeoutMs: 600000
# 可选:claude 可执行文件路径(SDK 会自动从 PATH 探测,一般不用配)
# pathToClaudeCodeExecutable: /path/to/claude
配置项
| 字段 | 默认 | 说明 |
|---|---|---|
model | sonnet | Claude 模型别名或完整 id |
permissionMode | acceptEdits | Claude Code 权限模式。acceptEdits 自动放行文件编辑;bypassPermissions 完全免确认(需信任) |
maxTurns | 100 | 每次任务 Claude Code 最多跑多少轮 |
timeoutMs | 600000 | 单次调用的协作超时 |
cwd | DSH cwd | Claude Code 工作目录 |
allowedTools | 未设 | 允许的 Claude Code 内置工具名列表 |
pathToClaudeCodeExecutable | 自动 | claude 可执行文件路径 |
effort | high | 思考强度:low/medium/high/xhigh/max |
maxThinkingTokens | 未设 | 思考 token 预算上限 |
工具参数(模型可见)
| 参数 | 说明 |
|---|---|
task(必填) | 自包含任务描述(目标、文件、约束、验收) |
cwd / model / permissionMode / maxTurns / allowedTools / effort / maxThinkingTokens | 覆盖插件配置 |
resume | 传上次返回的 sessionId,续接那个 Claude Code 会话(记住之前的上下文) |
返回:最终结果文本 + sessionId + token 用量 + 费用 + 用到的工具。
用法示例
// 第一轮
{ "task": "修复 src/parser.ts 里 parse() 对空输入的崩溃,并加一个单元测试", "cwd": "/path/to/repo" }
// → { "ok": true, "output": "…", "sessionId": "abc-123" }
// 第二轮(迭代同一任务,带记忆)
{ "task": "上一步的修复里你漏了边界情况 X,补上并重跑测试", "resume": "abc-123" }
合规说明
- ✅ 走 Claude Code 官方 CLI / Agent SDK,符合 Anthropic 认证与订阅政策。
- ❌ 本插件不是「把 Claude 当 DSH 的裸模型适配器」——那需要提取 Claude Code 的 OAuth token 直连 api.anthropic.com,已被 Anthropic 明令禁止、会导致封号。
开发
npm install --legacy-peer-deps
npm run build # tsc → lib/
npm run typecheck
发布
npm login
npm publish # publishConfig.access 已设 public
发布后建议:GitHub 建仓库并给仓库打 dsh-plugin topic,即可出现在 github.com/topics/dsh-plugin。
注意
- 每次调用约 10 秒起步、按订阅计费(小任务实测约 0.1~0.2 美元),只适合"完整子任务"。
- Claude Code 自己执行工具,DSH 的沙箱/权限不套在它的工具调用上——请把
cwd与permissionMode收敛到信任范围。