hermes-dsh-bridge

toolstested: passnpmGPL-3.0-only

Embedded MCP server letting external agents (Hermes, Claude Code, etc.) drive DeepSeek Harness over StreamableHTTP: sync/async task execution, a three-tier file sandbox, a Web-backed approval bridge, session management and search, and path-jailed file tools.

下载量 / Downloads
1,804
依赖体积 / node_modules
21.47 MB
测试时间 / Tested
2026-11-06
DSH 版本 / Version
0.2.2-rc.1

Install

dsh plugin --profile web add hermes-dsh-bridge

Sandbox test results

StageResult
1 install✓
2 list✓
3 mount✓
4 boot—

Four stages run in an isolated sandbox: install (network on) → list → mount → boot (last three with no network).

README

hermes-dsh-bridge

把 DeepSeek Harness(dsh)的 Agent 能力

封装成一个 MCP server,跑在 Harness 内部。任何 MCP 客户端都能通过它驱动 Harness 真正干活。

大脑和手分工:你的主 Agent 负责思考与决策,Harness 负责执行 —— 上下文隔离、可并行、

不吃你主会话的 token。

你的 MCP 客户端(大脑)──HTTP──▶  hermes-dsh-bridge (:8090)
                                      │  ctx.agents.create → mount preset
                                      ▼
                                Harness agent(bash / fs / todo / web… 完整工具集)

![license](./LICENSE)

![node](https://nodejs.org)

![npm](https://www.npmjs.com/package/hermes-dsh-bridge)

![CI](https://github.com/Emilia-awa/hermes-dsh-bridge/actions)

![dsh](https://www.npmjs.com/package/@deepseek-ai/dsh)


它能做什么

25 个工具(enableFsWrite: true 时 26 个),分六类:

分类 · 工具 · 一句话

任务 · agent_run · 同步跑一个任务,直接拿结构化结果

· task_inbox / task_result / task_list / task_cancel · 异步队列:丢进去立刻返回,之后取结果、查队列、中途取消

会话 · session_list / session_log / session_stats / session_search · 列出、读日志、看统计、按关键词跨会话搜

· rename_session / attach_session · 改名、归类到工作区

文件 · fs_read / fs_list / fs_stat · 读文件(带行号/分页)、列目录、查元数据

· fs_write · 写文件(默认关闭,需显式打开)

预设 · preset_list / preset_get / preset_set · 查/切 agent 能力组合(standard / code / minimal…)

权限 · policy_get / set_policy · 查/改会话文件权限档

· approval_list / approval_respond · 审批提权请求(agent 想干危险操作时)

状态 · status_get / config_get · 运行态 / 配置摘要

元 · echo / harness_list_tools · 连通性自检、列出 Harness 自己的工具

完整入参/返回/错误码见 [docs/TOOLS.md](docs/TOOLS.md)。

四个值得单独说的能力

① 异步队列 + 终态自动回调(不用轮询)

task_inbox 把任务丢进队列立刻返回。跑完后可以主动回调你的 webhook(HMAC-SHA256 验签 +

SSRF 防护),而不是让你一直轮询:

{"task": "把 README 的安装章节改好",
 "callback": {"url": "https://your-host/webhook", "replyContext": {"chatId": "123"}}}

更省事的是配一次 callbackPreset,之后派发只传每次都变的那点东西:

{"task": "跑一遍回归测试"}                                        // 什么都不传,自动套预设
{"task": "...", "callback": {"replyContext": {"chatId": "123"}}}  // 只传变的

② 提问挂起拦截(不会白等一夜)

dsh agent 遇到歧义会调 ask_user_question 然后一直等回答。不处理的话任务状态永远是

running、CPU 0%、零产物 —— 肉眼和「正在干活」完全一样,能白等一整夜。

本插件注册应答器接管这类请求:一提问就回调通知你,并写盘等回答,30 分钟无人应答自动报错收尾

(而不是无限挂起)。

③ 会话列表快 20–100 倍

大会话库上旧实现 limit:1 要 13 秒、limit:50 要 31 秒(客户端 20 秒超时 = 永远不返回)。

本版实测 < 1.5 秒,且耗时不再随会话库规模增长。原理见[性能](#性能为什么快)。

④ 权限三档 + 审批转接

会话文件权限跟 Harness 原生 SandboxMode 一一对应,可逐会话切换:

档位 · 语义

read-only · 只读

workspace-write · 工作区可写(默认)

danger-full-access · 完全绕过围栏,仅限可信环境

agent 需要提权时走审批桥(web / builtin / file-push / off 四档),

超时收尾为拒绝,绝不超时放行。


安装

前置:Node ≥ 22.18、dsh ≥ 0.1.2-rc.1、一个已跑过的 Harness profile。

30 秒跑通

PROFILE=<你的 profile 名>          # 例: web

# ① 装插件(dual-package hazard 修复已由 postinstall 自动完成)
cd ~/.dsh/profiles/$PROFILE
npm install hermes-dsh-bridge

# 装完可以核对一下(应显示「已是正确 symlink 23 / 保留本地副本 2」):
node node_modules/hermes-dsh-bridge/scripts/link-host-deps.mjs --dry-run

# ② 在 profile 的 cordis.patch.yml 末尾追加配置
cat >> cordis.patch.yml <<'EOF'
- insert:
    - id: hermes-dsh-bridge
      name: 'hermes-dsh-bridge'
      config:
        http: true
        port: 8090
        host: 127.0.0.1
        provider: <你的 provider id>    # ← 必须是 Harness 里已配好的
        model: <你的 model id>          # ← 同上
EOF

# ③ 重启 + 自检
systemctl restart dsh.service
node node_modules/hermes-dsh-bridge/scripts/doctor.mjs --profile $PROFILE
后面所有 node .../scripts/.mjs 和 python3 .../examples/.py 都从插件目录跑,
例如 cd ~/.dsh/profiles/$PROFILE/node_modules/hermes-dsh-bridge。

看到 结果: 10 项通过, 0 项失败 后,验证真实连通(最便宜的调用是 echo):

cd ~/.dsh/profiles/$PROFILE/node_modules/hermes-dsh-bridge
python3 examples/hermes_dsh_mcp.py list                  # 应列出 25 个工具
python3 examples/hermes_dsh_mcp.py call echo '{"text":"hi"}'
python3 examples/hermes_dsh_mcp.py run '回复:安装成功'    # 真跑一次 agent(会调 LLM)
用 npm 装的话 examples/ 也在包里,路径就是上面这个。

注册到你的 MCP 客户端

{
  "mcpServers": {
    "harness": {
      "type": "streamable-http",
      "url": "http://127.0.0.1:8090/mcp",
      "headers": { "Authorization": "Bearer <你的 authToken;未开启认证则省略>" }
    }
  }
}

仓库自带零依赖 Python 客户端(仅标准库),没现成客户端时可直接用:

python3 examples/hermes_dsh_mcp.py list
python3 examples/hermes_dsh_mcp.py call status_get '{}'
DSH_MCP_URL=http://127.0.0.1:8090/mcp DSH_MCP_TOKEN=xxx python3 examples/hermes_dsh_mcp.py list

其他安装方式

源码构建(要改代码 / 跑未发布提交):

git clone https://github.com/Emilia-awa/hermes-dsh-bridge.git
cd hermes-dsh-bridge
npm install && npm run build     # 产出 lib/index.js
npm test                         # 全套单测(不需要真实 dsh)

rm -rf ~/.dsh/profiles/$PROFILE/node_modules/hermes-dsh-bridge
cp -r . ~/.dsh/profiles/$PROFILE/node_modules/hermes-dsh-bridge
# 然后做上面第 ② 步的 patch 配置并重启(symlink 由 npm install 的 postinstall 自动对齐)

完整配置段(想直接抄一份带全部选项的):

- insert:
    - id: hermes-dsh-bridge
      name: 'hermes-dsh-bridge'
      config:
        http: true
        port: 8090
        host: 127.0.0.1
        # authToken: '<随机长token>'      # 非 loopback 暴露时必须开
        workspaceRoots: ['<你的工作区>']  # 限制 agent 能在哪干活
        enableFsWrite: false              # 需 fs_write 才开
        defaultSandbox: workspace-write   # read-only | workspace-write | danger-full-access
        approvalsBridge: web              # web | builtin | file-push | off
        approvalTimeoutMs: 300000         # 超时按拒绝收尾,绝不放行
        provider: <your-provider-id>      # ⚠️ 必填:你 Harness 里已配置的
        model: <your-model-id>            # ⚠️ 必填:该 provider 下的 model
给 AI agent 的硬性约束:provider / model 一律写成占位符,不要写死某

…(truncated)

Rendered from the README published on npm. Formatted only, not edited.

Versions

Published on npm::8,最后更新 2026-10-06

Links

GitHub · Homepage · npm

Same category