🎁 福利专区全网大模型免费应用 + 新用户福利 + 注册活动入口,低成本玩转 AI

跨端对等桥 caelricluo/dsh-peer

DeepSeek 客户端
caelricluo10 天前有提交已提供中文文档扫描:含敏感能力兼容 / 相关生态

让 DSH 与 Claude Code、Codex 智能体双向对话并控制对端模型

29.9/100
综合分
0
GitHub 星标
—
npm 周下载
—/5
用户评分

数据截至 2026/10/24 · 周下载取自 npm 全网(含 CI / 镜像),非本站安装数;综合分由星标、活跃度与兼容性检查合成。

相关生态插件(非 dsh 原生,按其对应运行时安装)
git clone https://github.com/caelricluo/dsh-peer.git

状态速览

判定依据:实装验证 · 静态安装检查 · 自动扫描 · 仓库维护状态
信任档位:仅索引
是什么
生态应用
桌面端 / Web 外壳,不以 dsh plugin add 安装
装得上吗
本站尚未做安装检查
安全吗
本站尚未对该插件做风险分级
暂未覆盖,不等同于无风险
还在维护吗
活跃:最近一次提交在 10 天前
档位由哪些信号合成

本站实装验证(真实安装 L4 覆盖全站;L5 为运行时冒烟或实机截图,覆盖范围小于 L4) · 验证所用 dsh 版本 · 静态安装检查 · 风险分级 · 仓库维护状态。 下方各区块是它的证据明细。

验证判据与等级说明 →
社区实装还没有人打卡 · 装过的第一个就是你
安全扫描自动 · 静态分析源码
v2.7.0
🔵 扫描:含敏感能力尚无人工评估
展开查看扫描说明与证据 ↓

静态扫描发现插件具备触达本地系统的能力:执行外部命令、读写/删除本地文件、读取剪贴板或密钥类环境变量(至少其一)。这是能力清单,不是危险判定——具体能力项与证据见下方,安装前请自行判断是否需要。

可执行外部命令读写/删除本地文件发起外部网络请求
查看扫描证据(共 17 处,展示前 17 条)
  • 读取本地文件
    lib/index.js:980
    const raw = await readFile(file, 'utf8')
  • 写入本地文件
    lib/index.js:996
    await mkdir(peerHome, { recursive: true, mode: 0o700 })
  • 写入本地文件
    lib/index.js:998
    await writeFile(file, JSON.stringify(record, null, 2) + '\n', { mode: 0o600 })
  • 写入本地文件
    lib/index.js:1000
    await chmod(file, 0o600)
  • 读取本地文件
    lib/index.js:1015
    const raw = await readFile(file, 'utf8')
  • 删除本地文件
    lib/index.js:1017
    if (parsed.token === token) await rm(file, { force: true })
  • 读取本地文件
    lib/cli.js:652
    record = JSON.parse(readFileSync(bridgeFile, 'utf8'))
  • 读取本地文件
    lib/cli.js:874
    return readFileSync(file, 'utf8')
  • 发起网络请求
    lib/adapters/codex-desktop.js:184
    await client.request('thread/resume', { threadId: resumeId, excludeTurns: true }, { timeoutMs: cfg.turnTimeoutMs })
  • 发起网络请求
    lib/adapters/codex-desktop.js:186
    const startedThread = await client.request('thread/start', {
  • 发起网络请求
    lib/adapters/codex-desktop.js:197
    await client.request('thread/name/set', { threadId, name: threadTitle(prompt) }, { timeoutMs: 10000 })
  • 执行外部命令来自配置/变量
    lib/adapters/codex-desktop.js:246
    child = spawn(command, buildCodexDesktopArgs({ extraArgs: cfg.extraArgs }), {
  • 读取本地文件
    lib/adapters/runner.js:183
    await access(filePath, fsConstants.X_OK)
  • 执行外部命令来自配置/变量
    lib/adapters/runner.js:341
    child = spawn(command, args, {
  • 读取本地文件
    lib/adapters/runner.js:500
    const raw = await readFile(target, 'utf8')
  • 读取本地文件
    skills/cross-harness-peer/lib/cli.js:652
    record = JSON.parse(readFileSync(bridgeFile, 'utf8'))
  • 读取本地文件
    skills/cross-harness-peer/lib/cli.js:874
    return readFileSync(file, 'utf8')
扫描于 2026/11/2(0 天前) · 范围 入口闭包 + 发布文件清单 · 来源 GitHub 仓库

静态扫描只反映源码中出现的调用,不构成安全背书;人工评估与自动扫描相互独立、互不覆盖。

依赖的 DSH / Cordis 模块
@deepseek-ai/cordis
给这个插件打分还没有人投票↓
用户评分
还没有人投票,来当第一个

DeepSeek Harness 的跨 harness 对等桥接:DSH <-> Claude Code / Codex CLI / Codex Desktop,可显式控制模型、推理强度和上下文。

README

由 DeepSeek 最新模型翻译生成
dsh-peer — 面向 DeepSeek Harness 的跨 harness 对等桥接 English · 中文 让 DeepSeek Harness(DSH)、Claude Code、OpenAI Codex CLI 和 Codex Desktop 的智能体互相通信,双向都行 —— 还能明确控制对端的模型、推理强度和上下文。 两部分一起发布: 1. DSH 插件 @caelricluo/dsh-peer —— 跑在 DSH 宿主进程里,对外暴露五个面向模型的 peer_ 工具,并驱动 claude / codex / codex app-server 完成出站回合。 2. 技能 cross-harness-peer,外加零依赖的 peer 命令行 —— 教 Claude Code 和 Codex 调用这座桥、向 DSH 提问、继续对话。 每段对话都是一个线程,带一份有序消息日志,双方都能读能写,所以哪一方都可以先开口。 功能 - 双向 —— DSH → Claude Code / Codex CLI / Codex Desktop,以及 Claude Code / Codex → DSH(包括正在运行的 DSH 会话)。 - 线程 —— 只追加的日志,带游标、长轮询等待、恢复和关闭;记录在重启后依然保留。
展开完整文档(README 剩余 1 节)
dsh-peer — 面向 DeepSeek Harness 的跨 harness 对等桥接

English · 中文

让 DeepSeek Harness(DSH)、Claude Code、OpenAI Codex CLI 和 Codex Desktop 的智能体互相通信,双向都行 —— 还能明确控制对端的模型、推理强度和上下文。

两部分一起发布:

1. DSH 插件 @caelricluo/dsh-peer —— 跑在 DSH 宿主进程里,对外暴露五个面向模型的 peer_ 工具,并驱动 claude / codex / codex app-server 完成出站回合。
2. 技能 cross-harness-peer,外加零依赖的 peer 命令行 —— 教 Claude Code 和 Codex 调用这座桥、向 DSH 提问、继续对话。

每段对话都是一个线程,带一份有序消息日志,双方都能读能写,所以哪一方都可以先开口。

功能

- 双向 —— DSH → Claude Code / Codex CLI / Codex Desktop,以及 Claude Code / Codex → DSH(包括正在运行的 DSH 会话)。
- 线程 —— 只追加的日志,带游标、长轮询等待、恢复和关闭;记录在重启后依然保留。
- 明确的路由开关 —— model、reasoning_effort,以及丰富的 context(cwd、system/append 提示词、文件、resume id、额外目录)。
- 零运行时依赖 —— 插件、桥接、存储、适配器和命令行只用 Node 内置模块。
- 回环 + bearer token —— 只绑定 127.0.0.1;token 存放在 ~/.dsh-peer/bridge.json,权限 0600。
- 有测试 —— node --test 测试套件覆盖存储、HTTP 桥接、命令行、适配器,以及 Cordis 插件生命周期。

架构

┌────────────────────────── DSH app (Web or Desktop) ──────────────────────────┐
│ DSH agent session │
│ ├─ tools: peer_status peer_ask peer_send peer_wait peer_thread │
│ └─ dsh-peer plugin │
│ ├─ thread store ~/.dsh-peer/threads/index.json + <id>.jsonl │
│ ├─ loopback bridge http://127.0.0.1:45710 (bearer token, 127.0.0.1) │
│ └─ adapters: claude | codex (exec) | codex-desktop (app-server) │
└───────────────────────────────────┬──────────────────────────────────────────┘
│ HTTP + token, loopback only
┌───────────┴────────────┐
│ peer CLI (plain Node) │
└──────┬───────────┬─────┘
│ │
Claude Code Codex / Codex Desktop
~/.claude/skills ~/.codex/skills

DSH → 外部 harness 不走命令行:插件直接拉起子命令行(claude -p、codex exec 或 codex app-server),提示词从 stdin 送入,shell:false。

各部分跑在哪

| 组件 | 运行位置 | 需要 |
| dsh-peer 插件 + 桥接 | DSH 宿主进程 | DSH Web/Desktop,Node >= 20 |
| 线程存储 | ~/.dsh-peer/(可用 DSH_PEER_HOME 覆盖) | 可写的 home 目录 |
| peer 命令行 | 任意 shell(Claude Code / Codex Bash 工具) | 纯 node >= 20,无 npm 依赖 |
| cross-harness-peer 技能 | ~/.claude/skills、~/.codex/skills | Claude Code 和/或 Codex |
| Claude Code 适配器 | 子进程 claude | claude 可用且已登录 |
| Codex 适配器 | 子进程 codex exec | codex 可用且已登录 |
| Codex Desktop 适配器 | 子进程 codex app-server(基于 stdio 的 JSON-RPC) | 一个 codex 二进制;共用桌面端线程存储 |
| DSH 适配器 | 进程内的 DSH 子智能体 | 它运行所在的 DSH 宿主 |

环境要求

- Node.js >= 20
- DeepSeek Harness(Web 或 Desktop 应用),启动时加载你安装到的配置档
- 可选:claude、codex 和/或 Codex Desktop 应用,如果你想用这些方向

安装

在仓库根目录执行:

bash install.sh --profile desktop # use your booted profile name

它会按顺序安装:

1. peer 命令行 → ~/lib/dsh-peer/ + 启动器 ~/bin/peer (如果 ~/.local/bin 存在,还会建一个 ~/.local/bin/peer 符号链接),
2. cross-harness-peer 技能 → ~/.claude/skills/ 和 ~/.codex/skills/,
3. 插件包 → dsh plugin --profile <name> add "link:$PWD"。

然后退出并重新打开 DSH,启动一次 Claude Code / Codex 让它们加载技能,再验证:

peer doctor
peer status --json

手动步骤、故障排查和卸载:INSTALL.md。

快速上手:DSH → 另一个 harness

peer_ask {
"harness": "codex-desktop", // dsh | claude | codex | codex-desktop
"prompt": "Review lib/bridge.js for auth bypasses. Findings only.",
"model": "gpt-6-astra", // optional, harness-specific
"reasoning_effort": "high", // low | medium | high | xhigh | max
"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 会话对话(消息作为用户轮次投递,回答会返回):

peer status --json # find host.sessions[].id
peer ask --to dsh --session session-… --effort low "Reply with exactly OK."

继续一段对话(用 --json 拿到线程 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 线程对话,传入它的 app-server UUID:

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

DSH 工具

| 工具 | 参数 | 结果 |
| peer_status | – | host、适配器(可用性/模型/推理强度)、最近线程 |
| peer_ask | harness, prompt, model?, reasoning_effort?, context?, thread_id?, timeout_seconds? | 线程 id + 回复文本 |
| peer_send | thread_id, text | 追加的消息 |
| peer_wait | thread_id, after?, wait_seconds? | 新消息 + 游标 |
| peer_thread | action: list \| get \| close, thread_id? | 线程列表,或线程 + 消息 |

命令行参考

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 # default 300; 0 = fire and forget
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 缺少 token 或被拒绝。

模型、推理强度与上下文

| 配置项 | 命令行 | DSH 工具 | 说明 |
| 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;支持情况不一 |
| cwd | --cwd DIR | context.cwd | 对端的项目根目录 |
| system prompt | --system TEXT\|@FILE | context.system | 替换对端的系统提示词 |
| append prompt | --append-system … | context.append_system | 优先于 --system |
| files | --file PATH | context.files | 文件内容会拼接到提示词前面 |
| remote resume | --resume ID | context.resume | 继续某个远端会话 id |
| live DSH session | --session S(dsh) | – | 投递到运行中的 DSH 会话 |
| extra dirs | – | context.add_dirs | Claude Code 的 --add-dir |

建议:非必要不填 model/effort;先读 peer status --json;优先用 --append-system;只传对端需要的最小上下文。

配置

插件配置写在 DSH 配置档补丁里。默认值:

- id: dsh-peer
name: '@caelricluo/dsh-peer'
config:
enabled: true
host: 127.0.0.1 # fixed; anything else is rejected
port: 45710 # 0 = OS-assigned
peerHome: '' # default $DSH_PEER_HOME || ~/.dsh-peer
token: '' # default: reuse or generate in bridge.json
turnTimeoutMs: 600000
maxThreads: 200
guidance: true
adapters:
claude: { command: claude, defaultModel: '', defaultEffort: '', extraArgs: [] }
codex: { command: codex, defaultModel: '', defaultEffort: '', extraArgs: [] }
codex-desktop: { command: codex, originator: 'Codex Desktop', defaultEffort: '' }
dsh: { defaultEffort: 'high', ephemeral: true }

如果 Codex 二进制不在 PATH 上(比如在 /Applications/ChatGPT.app/ 里),把两个 Codex 适配器都指向它:

- id: dsh-peer
name: '@caelricluo/dsh-peer'
config:
adapters:
codex:
command: "/Applications/ChatGPT.app/Contents/Resources/codex-cli/CodexCLI.app/Contents/MacOS/codex"
codex-desktop:
command: "/Applications/ChatGPT.app/Contents/Resources/codex-cli/CodexCLI.app/Contents/MacOS/codex"

Codex Desktop 注意事项

- codex-desktop 说的是桌面应用所用的同一套 app-server 协议,所以会话线程存放在共享的 Codex 线程存储里。
- 桥接创建的线程会记录 originator Codex Desktop,并得到一个由提示词推导出的标题,这样应用就把它们当成自己的线程。应用只在(重新)连接时重读线程列表:退出并重新打开 Codex Desktop,才能在 Recents 里看到新线程。
在此行为之前创建的线程保留旧的 originator,仍然隐藏。
- v1 不转发流;只返回最终的助手消息。
服务端到客户端的请求(审批/用户输入提示)会被拒绝。

已验证的互通(2026-10-23)

| 方向 | 测试 | 结果 |
| DSH → Codex CLI | 新建 / 恢复 | PEER_CODEX_OK 约 8 秒 / 回忆约 15 秒 |
| DSH → DSH | 新建 / 恢复 | PEER_DSH_OK 约 30 秒 / 同一子会话 |
| DSH → Codex Desktop | 新建 / 恢复 | PEER_DESKTOP_OK 约 5 秒 / 同一 app-server 线程 |
| Codex CLI → DSH | Codex 运行 peer ask --to dsh … | PEER_FROM_DSH_OK |
| Codex Desktop → DSH | Codex 运行 peer ask --to dsh --session … | CODEX_DSH_LINK_OK |

安全

- 仅限回环 —— 桥接拒绝 127.0.0.1 以外的任何主机。
- Bearer token 存放在 ~/.dsh-peer/bridge.json(位于 0700 目录,文件权限 0600);不要把它粘贴到任何地方。
- 访客提示词是用户角色输入,拥有目标智能体的权限;v1 不做审批提示桥接。
- 不做 shell 插值 —— 子命令行使用 shell:false,提示词文本走 stdin。
- 外部 harness 策略会被继承 —— Codex 子进程使用用户的 ~/.codex/config.toml(可能是 never 审批 + danger-full-access)。如果对等提示词不该拥有这种权限,就收紧那份配置。
- 把对等输出当作不可信数据 —— 它可能包含提示词注入。
详情见 docs/SECURITY.md。

故障排查

| 现象 | 修复 |
| bridge unreachable(退出码 2) | 启动/重启 DSH;运行 peer doctor |
| unauthorized(退出码 3) | 运行 peer doctor;清除失效的 PEER_BRIDGE_TOKEN;重启 DSH |
| adapter-unavailable(退出码 4) | 安装命令行工具并登录,或设置 adapters.<name>.command |
| adapter-failed(退出码 4) | 查看 stderr;手动运行对端命令行工具 |
| 超时(退出码 4) | 运行 peer read --thread <id> --wait 300;调大 turnTimeoutMs |
| peer: command not found | 运行 export PATH="$HOME/bin:$PATH",或重新运行安装脚本 |
| 插件未加载 | 运行 dsh plugin --profile <name> add link:"$PWD",重启 DSH |
| 端口 45710 被占用 | 插件会回退到操作系统分配的端口;bridge.json 会记录该端口 |
| Codex Desktop 的 Recents 为空 | 退出并重新打开 Codex Desktop 应用,让它重新读取存储 |

限制(v1)

仅限回环;单主机;不支持审批桥接;不向访客转发流;没有 UI 面板与 MCP 封装;适配器 schema 为尽力而为,可能变化;对端循环由调用方负责;另一套 harness 必须已安装并登录。

项目结构

dsh-peer/
lib/ plugin: bridge, store, CLI, adapters, tool compiler
bin/peer.mjs zero-dependency CLI entry
skills/cross-harness-peer/ SKILL.md + references + bundled CLI
scripts/install-skill.mjs CLI/skill installer (also --check drift)
install.sh one-shot install (CLI + skills + DSH profile)
docs/ SECURITY.md, CODEX.md, harness notes
test/ node:test verification suite
CONTRACT.md protocol + implementation contract
README.md INSTALL.md LICENSE

开发

node --test test/.test.mjs # full suite (no network, no real CLIs)
node scripts/install-skill.mjs --check # bundled CLI drift check
bash install.sh --dry-run # preview installs

许可证

MIT —— 见 LICENSE。

概述

让 DeepSeek Harness(DSH)、Claude Code、OpenAI Codex CLI 与 Codex Desktop 中的智能体互相通信,并且可以显式指定对端使用的 模型(model)、推理强度(reasoning effort) 与 上下文(context)。

本仓库包含两部分:

1. DSH 插件 @caelricluo/dsh-peer:运行在 DSH 宿主进程内,提供 5 个模型可调用的 peer_ 工具,并在需要时直接拉起 claude、 codex exec 或 codex app-server。
2. 技能 cross-harness-peer 与零依赖 peer 命令行:让 Claude Code 与 Codex 能调用本桥接、向 DSH 提问,并持续同一段对话。

每一段对话都是一个 thread(线程),消息按顺序追加,双方读写同一份记录,因此任意一方都可以先开口。

功能特性

- 双向通信:DSH → Claude Code / Codex CLI / Codex Desktop; Claude Code / Codex → DSH(包括注入正在运行的 DSH 会话)。
- 线程化:追加式消息日志,支持游标、长轮询等待、续聊与关闭,重启不丢。
- 显式控制:model、reasoning_effort,以及丰富的 context(工作目录、system/append 提示词、文件、resume 会话、额外目录)。
- 零运行时依赖:插件、桥接、存储、适配器与命令行全部只用 Node 内置模块。
- 仅回环 + Bearer Token:只绑定 127.0.0.1, ~/.dsh-peer/bridge.json(权限 0600)。
- 有测试:node --test 覆盖存储、HTTP 桥接、命令行、适配器与 Cordis 插件生命周期。

安装

在仓库根目录执行(desktop 换成你实际启动的配置档名):

bash install.sh --profile desktop

它会依次完成:

1. 安装 peer 命令行到 ~/lib/dsh-peer/,启动器 ~/bin/peer (若存在 ~/.local/bin 还会创建软链接);
2. 把 cross-harness-peer 技能安装到 ~/.claude/skills/ 和 ~/.codex/skills/;
3. 用 dsh plugin --profile <name> add "link:$PWD" 把插件加入 DSH 配置档。

之后退出并重新打开 DSH,启动一次 Claude Code / Codex 让它加载技能,然后验证:

peer doctor
peer status --json

手动安装、卸载与排错见 INSTALL.md。

快速开始:DSH → 其他 harness

peer_ask {
"harness": "codex-desktop", // dsh | claude | codex | codex-desktop
"prompt": "检查 lib/bridge.js 的鉴权问题,只给结论。", "model": "gpt-6-astra", // 可选,因 harness 而异 "reasoning_effort": "high", // low | medium | high | xhigh | max
"context": { "cwd": "/path/to/project", "files": ["lib/bridge.js"] },
"timeout_seconds": 600
}

继续同一段对话:

peer_ask { "harness": "codex-desktop", "thread_id": "thr_…", "prompt": "只修第 2 个问题。" }
peer_send { "thread_id": "thr_…", "text": "跑一下测试。" }
peer_wait { "thread_id": "thr_…", "after": 2, "wait_seconds": 300 }

快速开始:Claude Code / Codex → DSH

安装完成后,在 Claude Code 或 Codex 里让智能体执行:

peer ask --to dsh --effort high --cwd "$PWD" --file lib/store.js \
"重试策略安全吗?请引用行号。"

与正在运行的 DSH 会话对话(消息会作为用户输入注入并等待回复):

peer status --json # 找到 host.sessions[].id peer ask --to dsh --session session-… --effort low "只回复 OK。"

续聊(先用 --json 取 thread id):

peer ask --to dsh --json "…" > /tmp/peer.json peer send --thread thr_… --wait 300 "给出最小补丁。"
peer read --thread thr_… --wait 300

与已有的 Codex Desktop 线程对话,可传它的 app-server UUID:

peer ask --to codex-desktop --resume 01a16633-… "继续那个方案。"

DSH 工具

| 工具 | 参数 | 返回 |
| peer_status | 无 | 宿主信息、适配器可用性/模型/推理强度、最近线程 |
| peer_ask | harness, prompt, model?, reasoning_effort?, context?, thread_id?, timeout_seconds? | 线程 id 与回复文本 |
| peer_send | thread_id, text | 已追加的消息 |
| peer_wait | thread_id, after?, wait_seconds? | 新消息与游标 |
| peer_thread | action: list / get / close, thread_id? | 线程列表或线程详情 |

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 (可重复) --session S # 仅 dsh:注入运行中的 DSH 会话 --thread T # 继续 dsh-peer 线程 --resume ID # 远端会话 id(codex-desktop UUID / claude / codex) --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 token 缺失或被拒。

模型、推理强度与上下文

| 参数 | CLI | DSH 工具 | 说明 |
| harness | --to dsh\|claude\|codex\|codex-desktop | harness | 新建线程时必填 |
| 模型 | --model M | model | 因 harness 而异,用 peer status --json 查询 |
| 推理强度 | --effort E | reasoning_effort | low\|medium\|high\|xhigh\|max,支持度因适配器而异 |
| 工作目录 | --cwd DIR | context.cwd | 对端的项目根目录 |
| 替换 system | --system TEXT\|@FILE | context.system | 替换对端系统提示词 |
| 追加 system | --append-system … | context.append_system | 优先使用这种方式 |
| 文件 | --file PATH | context.files | 文件内容会拼到提示词前 |
| 远端续聊 | --resume ID | context.resume | 继续远端会话 id |
| 运行中的 DSH 会话 | --session S(dsh) | – | 注入正在运行的 DSH 会话 |
| 额外目录 | – | context.add_dirs | Claude Code --add-dir |

建议:非必要不指定模型/推理强度;先看 peer status --json;优先 --append-system;只传对端真正需要的上下文。

配置

插件配置在 DSH profile patch 中,默认值如下:

- id: dsh-peer
name: '@caelricluo/dsh-peer'
config:
enabled: true
host: 127.0.0.1 # 固定值,其他地址会被拒绝 port: 45710 # 0 表示由系统分配
peerHome: '' # 默认 $DSH_PEER_HOME || ~/.dsh-peer
token: '' # 默认复用或生成 bridge.json 中的 token turnTimeoutMs: 600000 maxThreads: 200 guidance: true adapters:
claude: { command: claude, defaultModel: '', defaultEffort: '', extraArgs: [] }
codex: { command: codex, defaultModel: '', defaultEffort: '', extraArgs: [] }
codex-desktop: { command: codex, originator: 'Codex Desktop', defaultEffort: '' }
dsh: { defaultEffort: 'high', ephemeral: true }

若 codex 不在 PATH(例如随 ChatGPT.app 分发),把两个 Codex 适配器指向绝对路径即可:

- id: dsh-peer
name: '@caelricluo/dsh-peer'
config:
adapters:
codex:
command: "/Applications/ChatGPT.app/Contents/Resources/codex-cli/CodexCLI.app/Contents/MacOS/codex"
codex-desktop:
command: "/Applications/ChatGPT.app/Contents/Resources/codex-cli/CodexCLI.app/Contents/MacOS/codex"

Codex Desktop 说明

- codex-desktop 使用与桌面版相同的 app-server 协议,线程存放在共享的 Codex 线程库中。
- 通过桥接创建的线程会记录 originator Codex Desktop,并用提示词首行生成标题,因此桌面版会把它们当作自己的线程。桌面版只在重新连接时刷新列表: 退出并重新打开 Codex Desktop 后即可在 Recents 看到新线程;修复前创建的旧线程仍保持原 originator,不会显示。
- v1 不转发流式输出,只返回最终助手消息;服务端发来的审批/用户输入请求会被拒绝。

已验证的互通(2026-10-23)

| 方向 | 测试 | 结果 |
| DSH → Codex CLI | 新建 / 续聊 | PEER_CODEX_OK 约 8 秒 / 约 15 秒回忆成功 |
| DSH → DSH | 新建 / 续聊 | PEER_DSH_OK 约 30 秒 / 同一子会话 |
| DSH → Codex Desktop | 新建 / 续聊 | PEER_DESKTOP_OK 约 5 秒 / 同一 app-server 线程 |
| Codex CLI → DSH | Codex 执行 peer ask --to dsh … | PEER_FROM_DSH_OK |
| Codex Desktop → DSH | Codex 执行 peer ask --to dsh --session … | CODEX_DSH_LINK_OK |

安全

- 仅回环:桥接拒绝除 127.0.0.1 外的任何地址。
- Bearer Token 位于 ~/.dsh-peer/bridge.json(0600,目录 0700),不要外泄。
- 访客消息以用户输入注入,拥有目标智能体的权限;v1 不做审批桥接。
- 不做 shell 拼接:子进程使用 shell:false,提示词走 stdin。
- 外部 harness 策略会被继承:Codex 子进程使用 ~/.codex/config.toml,可能是 never 审批 + danger-full-access。若不想让对端拥有该权限,请收紧 Codex 自身配置。
- 把对端输出当作不可信数据,可能包含提示词注入。详见 docs/SECURITY.md。

排错

| 现象 | 处理 |
| bridge unreachable(退出码 2) | 启动/重启 DSH;peer doctor |
| unauthorized(退出码 3) | peer doctor;清除过期 PEER_BRIDGE_TOKEN;重启 DSH |
| adapter-unavailable(退出码 4) | 安装/登录对应 CLI,或设置 adapters.<name>.command |
| adapter-failed(退出码 4) | 查看 stderr,手动运行对端 CLI 定位 |
| 超时(退出码 4) | peer read --thread <id> --wait 300;调大 turnTimeoutMs |
| peer: command not found | export PATH="$HOME/bin:$PATH" 或重跑安装器 |
| 插件未加载 | dsh plugin --profile <name> add link:"$PWD" 后重启 DSH |
| 45710 端口被占用 | 插件会自动回退到系统分配端口,bridge.json 会记录真实地址 |
| Codex Desktop Recents 看不到 | 退出并重开 Codex Desktop 以重新读取线程库 |

限制(v1)

仅回环、单机;无审批桥接;不向访客转发流式输出;无 GUI 面板 / MCP 封装;适配器依赖的对端事件格式可能变化,解析失败会回退为原始输出;不要让对端再回调自己形成递归循环;对端 CLI 需自行安装并登录。

目录结构

dsh-peer/
lib/ 插件:桥接、存储、CLI、适配器、工具编译器 bin/peer.mjs 零依赖 CLI 入口 skills/cross-harness-peer/ SKILL.md、参考文档与内置 CLI scripts/install-skill.mjs CLI/技能安装器(--check 检查漂移) install.sh 一键安装(CLI + 技能 + DSH profile) docs/ SECURITY.md、CODEX.md 等 test/ node:test 测试套件 CONTRACT.md 协议与实现契约 README.md INSTALL.md LICENSE

开发

node --test test/.test.mjs # 全量测试(无需网络与真实 CLI)
node scripts/install-skill.mjs --check # 内置 CLI 副本漂移检查
bash install.sh --dry-run # 预览安装动作

许可证

MIT,见 LICENSE。
预览分享卡片长什么样 ↓caelricluo/dsh-peer
分享 · DeepSeek Harness Hub
caelricluo/dsh-peer

让 DSH 与 Claude Code、Codex 智能体双向对话并控制对端模型

回到顶部