Skip to main content
Glama

dsh-gate

dsh-gate 让 Codex 能够通过 MCP 监督长时间运行的 DeepSeek Harness 会话,同时让 DSH Host 和会话本身独立于 MCP 进程。

工作区包含:

  • @dsh-gate/mcp-server:基于 DSH 公共网络客户端和重连控制器的九个 MCP 工具;

  • @dsh-gate/supervisor-tools:DSH 侧的交接(handoff)、工件准入(artifact admission)和失败上报预算(reported-failure budget)工具;

  • 两个窄范围的运维技能、Codex/DSH 示例配置,以及一套确定性的 bootstrap/doctor/Host 工作流。

部署、验证与启动

pnpm bootstrap      # fetch the pinned DSH fork commit, build & link the exact
                    # network client, install the supervisor plugin into an
                    # isolated project-local DSH home (.dsh-state/) — never starts the Host
pnpm run doctor     # verify pin, link, built artifacts, and plugin/profile
pnpm host:start     # start the independent DSH Web Host on http://127.0.0.1:8080
pnpm run doctor --live  # additionally verify the running Host identity/protocol

然后,将 config/codex-mcp.example.toml 复制到对应的 Codex 配置中,并把 <workspace-root> 占位符替换为本检查出(checkout)目录的绝对路径——这是唯一与机器相关的值。服务端可执行文件是 packages/mcp-server/dist/cli.js;如果旧配置仍指向 dist/index.js,请将其更新为 dist/cli.js(库入口不会启动 MCP 服务器)。Codex MCP 配置支持 stdio 服务器,可设置 command、args、environment、startup timeout 和 tool timeout 字段。

完整的运维指南——前置条件、兼容性契约与更新策略、Host 独立性、浏览器可见性、干净的故障恢复,以及官方上游 PR 限制——请阅读 DEPLOYMENT.md。

Related MCP server: Local Codex Bridge

固定的 DSH fork 提交

@dsh-gate/mcp-server 从 @deepseek-ai/dsh-client-connection/network-client 导入,即通用的 network-client 和 reconnect-controller 导出。这些导出不属于任何已发布的 DSH 发行版;它们只来自公共 fork 的某一个提交:

  • fork: https://github.com/yidapan666-creator/deepseek-harness.git

  • commit: 7212c955438c70c9a2d168f67e85a8014b8d4488

提交 SHA 就是兼容性契约——bootstrap 按 SHA 拉取(绝不使用移动的分支),doctor 会拒绝 HEAD 不一致或远程未指向该 fork 的检出;同时拒绝脏检出,且不会进行破坏性恢复。链接本身由现有的 scripts/link-local-dsh.mjs 创建,并被 bootstrap 复用;它只存在本地,任何机器路径都不会被提交到包元数据中。dist/cli.js 会先探测这个接缝,若缺失则输出清晰的诊断信息,而不是原始的模块解析错误。

要更新固定版本:修改 scripts/dsh-gate-lib.mjs 中的 DSH_PINNED_COMMIT,删除 .dsh-state/dsh,然后重新运行 pnpm bootstrap。相关策略以及为什么该 fork 提交不宣称是上游合并,见 DEPLOYMENT.md。

监督节奏

dsh_wait 以五分钟为聚合周期运行:默认大约每 300000 毫秒返回一条观测记录,只有在遇到实质性 supervisor 边界——例如终止状态、审批/提问、检查点、阻塞或升级事项——才会提前返回。普通的事件跳动绝不会导致快速重复的 wait 调用。每个周期观测都会聚合自上次 asOfSeq 以来的进度——活动增量、工具计数、token 增量——外加一份紧凑且有界的 projectActivity 汇总,列出成功编辑/写入所触及的不同项目文件,以及尝试执行的目标验证命令(例如 pnpm verify)。终态观测会携带任务范围内的总量。原始日志、diff 或工具输出永不包含。

排队等待的 prompt 以人类可读的目标开头,并在其后嵌入持久化的任务数据包。这样既不会改变协议校验方式,又能让新增的受监督会话以任务名在 DSH Web 侧边栏中被识别。

长交接的细节

supervisor_handoff.summary 的长度上限为 2048 个字符。当任务需要更长的报告时,将其写成 Markdown 放在会话工作目录下的 .dsh-handoff/<taskId>/ 中(该目录已在 gitignore 中),在 artifacts 中传入相对路径,并从简洁摘要中引用它。当摘要超出长度限制时,握手工具会以完全相同的说明拒绝该摘要,并且自身从不写入握手数据——尤其是不写入 ~/.codex 或任何其它全局目录。工件准入执行严格的边界限制:只接受相对路径,不允许引用,不允许符号链接、硬链接或非常规文件,且必须通过会话工作目录内经校验的句柄计算哈希。

发布状态

源码采用 MIT 许可证,已为在 yidapan666-creator/dsh-gate 公开托管做好准备:DSH 依赖是指定 SHA 的一个公共 fork 提交,工作树中没有任何机器相关的路径或密钥,pnpm verify 在由 bootstrap 管理的链接下通过。以 npm 包形式发布是另一项独立、目前仍处于被阻塞状态的决策:两个包都保留 "private": true,在上游发布 DSH 的通用的 DS 网络客户端接缝之前,一个从零开始的包安装将无法执行构建或运行(fork 的固定 commit 适用于源码部署,不适用于 registry 消费者)。

剩余的上游限制是 npm 发布:两个包会保持私有,直到通用的 @deepseek-ai/dsh-client-connection/network-client 导出在上游被发布。固定提交到 7212c955438c70c9a2d168f67e85a8014b8d4488 的公共 fork 使得今天的源码部署可复现;该 commit 不是上游合并,也不声称是任何合并。

源码安装、构建、测试、打包检查以及协议契约都由本文档所述的验证工作流负责。

关于状态语义请参见 docs/protocol.md,验收流程参见 docs/manual-e2e.md,评估设计参见 docs/benchmark.md,源码与许可来源可追溯性参见 docs/source-provenance.md,历史设计审查参见 docs/source-backed-reuse-review.md。贡献者请参见 CONTRIBUTING.md。 漏洞报告请参见 SECURITY.md。

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables external AI supervisors to oversee and steer native Codex through MCP, including thread and turn management, observation, interruption, approval responses, runtime status, and checkpointing.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables Codex to delegate scoped tasks to a local DeepSeek Harness over MCP — dispatching read-only reviews or authorized workspace writes, steering and monitoring runs to a terminal state, and returning structured evidence such as changed paths, test results, and assistant text. It also supports exact archival of the terminal session by full session ID.
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables Codex to delegate selected tasks to a locally installed DeepSeek Harness through MCP tools for execution, status, planning, and feedback while keeping orchestration local.
      16 npm
      2
      MIT