dsh-peer:在 DeepSeek Harness 与 Claude Code / Codex 之间建立双向通道

前言

DeepSeek Harness(DSH)默认只能与自身进程内的子代理协作。当需要把任务交给 Claude Code 或 Codex CLI / Desktop 时,往往只能通过文件来回传递,容易丢失上下文,也难以统一控制模型、推理强度和上下文范围。

dsh-peer 插件让 DSH 与 Claude Code / Codex 在同一对话线程中双向通信,同时支持为对等方指定模型、推理强度(reasoning_effort)和上下文(cwd、系统提示、文件列表等)。

这是什么

这是一个运行在 DSH 主机进程内的插件,用于在 DSH、Claude Code、Codex CLI 和 Codex Desktop 之间建立 peer 桥接。插件内部提供五个面向模型的工具,并驱动对应的 CLI 或应用;同时提供零依赖的 peer CLI 和 cross-harness-peer skill,让 Claude Code 和 Codex 能够调用桥接并继续对话。

维护者:caelricluo。

核心功能

  • 双向通信:DSH ↔ Claude Code / Codex CLI / Codex Desktop,支持实时 DSH 会话。
  • 线程机制:追加式消息日志,支持光标、长轮询、恢复和关闭;会话可跨重启。
  • 明确路由控制:可指定 model、reasoning_effort 和丰富的 context(cwd、system/append prompt、文件、resume id、额外目录)。
  • 零运行时依赖:插件、桥接、存储、适配器、CLI 均仅使用 Node.js 内置模块。
  • 回环绑定:仅绑定 127.0.0.1;令牌位于 ~/.dsh-peer/bridge.json,权限 0600。
  • 测试覆盖:node –test 覆盖存储、HTTP 桥、CLI、适配器和 Cordis 插件生命周期。

安装与启用

从仓库根目录执行:

bash install.sh --profile desktop

安装顺序为:

  1. peer CLI → ~/lib/dsh-peer/ + launcher ~/bin/peer(当 ~/.local/bin 存在时,会创建 ~/.local/bin/peer 符号链接)
  2. cross-harness-peer skill → ~/.claude/skills/ 和 ~/.codex/skills/
  3. 插件包 → dsh plugin –profile add “link:$PWD”

安装完成后退出并重新打开 DSH,启动 Claude Code / Codex 以加载 skill,然后验证:

peer doctor
peer status --json

典型用法

DSH → 另一 harness

peer_ask {
  "harness": "codex-desktop",
  "prompt": "Review lib/bridge.js for auth bypasses. Findings only.",
  "model": "gpt-6-astra",
  "reasoning_effort": "high",
  "context": {
    "cwd": "/path/to/project",
    "files": ["lib/bridge.js"],
    "append_system": "Be terse."
  },
  "timeout_seconds": 600
}

继续同一对话:

peer_ask   { "harness": "codex-desktop", "thread_id": "thr_…", "prompt": "Now fix finding 2." }
peer_send  { "thread_id": "thr_…", "text": "Run the tests." }
peer_wait  { "thread_id": "thr_…", "after": 2, "wait_seconds": 300 }
peer_thread{ "action": "list" }

Claude Code / Codex → DSH

peer ask --to dsh --effort high --cwd "$PWD" --file lib/store.js \
  "Is the retry policy safe? Cite lines."

对话 DSH 会话(需要先获取 session id):

peer status --json
peer ask --to dsh --session session-… --effort low "Reply with exactly OK."

继续对话(使用 thread id):

peer ask --to dsh --json "…" > /tmp/peer.json
peer send --thread thr_… --wait 300 "Now propose the patch."
peer read   --thread thr_… --wait 300

连接已有 Codex Desktop 线程:

peer ask --to codex-desktop --resume 01a16633-… "Continue that plan."

DSH 工具

  • peer_status:显示主机、适配器(可用性/模型/effort)、最近线程。
  • peer_ask:启动线程,返回 thread_id + 回复文本。
  • peer_send:向指定线程追加消息。
  • peer_wait:获取新消息并更新光标。
  • peer_thread:操作线程列表或获取/关闭线程详情。

CLI 参考

peer status [--json]
peer ask    --to <harness> [options] <prompt>|
            --model M  --effort E  --cwd DIR
            --system TEXT|@FILE  --append-system TEXT|@FILE
            --file PATH (repeatable)
            --session S      # dsh only: live DSH session
            --thread T       # continue a dsh-peer thread
            --resume ID      # remote session id (codex-desktop UUID, claude/codex session)
            --wait SECONDS   # 默认 300;0 表示仅发送不等待
peer send   --thread T [--wait SECONDS] <prompt>|
peer read   --thread T [--after N] [--wait SECONDS] [--follow]
peer threads [--json]
peer close  --thread T
peer doctor [--json]
peer help

退出码:

  • 0:成功
  • 1:用法或其他错误
  • 2:桥接不可达
  • 3:未授权
  • 4:远程轮次失败

peer doctor 状态码:

  • 0:健康
  • 2:不可达/不健康
  • 3:缺少或拒绝令牌

模型、effort 和 context 对应关系

Knob CLI DSH tool 说明
harness –to dsh|claude|codex|codex-desktop harness 启动线程时必需
model –model M model 与 harness 相关;可用 peer status –json 查询
reasoning effort –effort E reasoning_effort 取值 low|medium|high|xhigh|max;支持程度因 harness 而异
cwd –cwd DIR context.cwd 对等方的项目根目录
system prompt –system TEXT|@FILE context.system 会替换对等方的系统提示

运行位置与需求

组件 运行位置 需求
dsh-peer 插件 + 桥 DSH 主机进程 DSH Web/Desktop,Node >= 20
线程存储 ~/.dsh-peer/(可覆盖 DSH_PEER_HOME) 可写入的 home 目录
peer CLI 任意 shell(Claude Code / Codex Bash 工具) 纯 node >= 20,无 npm 依赖
cross-harness-peer skill ~/.claude/skills/、~/.codex/skills/ Claude Code 和/或 Codex
Claude Code 适配器 子 claude 进程 claude 可用且已登录
Codex 适配器 子 codex exec 进程 codex 可用且已登录
Codex Desktop 适配器 子 codex app-server(JSON-RPC over stdio) codex 二进制;共享桌面线程存储
DSH 适配器 进程内 DSH 子代理 运行的 DSH 主机

适用场景与注意

  • 适合需要在 DSH 与 Claude Code / Codex 之间保持连续上下文、统一控制模型与推理强度的场景。
  • 插件以当前 DSH 进程权限运行,安装前请检查源码与许可证。

结语

dsh-peer 让 DSH 与 Claude Code / Codex 在同一对话线程中双向通信,并支持对模型、推理强度和上下文的显式控制。更多细节可查看社区目录与 GitHub 仓库。

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

小夜