Back to home@wenhao4126

dsh-herdr

Expose Herdr workspaces, panes, and coding agents as DeepSeek Harness tools.

Stars
0
Language
TypeScript
Created
Aug 26, 2026
Updated
Aug 26, 2026
GitHub repo

Introduction

dsh-herdr

Herdr 的 workspace、tab、pane 和 coding agent 操作暴露为 DeepSeek Harness(DSH)工具。

安装后可以直接在 DSH 对话中创建 Herdr 工作区和 pane、运行命令、启动 coding agent、等待任务完成并读取结果。

安装

前置条件

  • 已安装 DeepSeek Harness(DSH)。
  • 已安装 herdr,并且 herdr 命令位于运行 DSH 的 PATH 中。
  • Herdr server 正在运行;通常在另一个终端执行 herdr 并保持 TUI 运行。

从 GitHub 安装

dsh plugin --profile web add github:wenhao4126/dsh-herdr

安装完成后重启 DSH,或者重新打开 DSH Web GUI。插件声明了 dsh.bundle.patch,会自动加入 web profile 的 bundle 列表。

固定到某个提交:

dsh plugin --profile web add github:wenhao4126/dsh-herdr#<commit-sha>

从本地目录安装

git clone https://github.com/wenhao4126/dsh-herdr.git
cd dsh-herdr
dsh plugin --profile web add .

仓库已提交编译后的 lib/,普通安装不需要 TypeScript 或 DSH 源码 checkout。

lockfile 供应链策略报错

如果安装时报 ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION,并且错误列出的是 profile 中原本已安装的其他插件,说明 pnpm 正在用新的 minimumReleaseAge 策略追溯检查旧 lockfile,并不代表 dsh-herdr 本身验证失败。

确认现有 DSH profile lockfile 来源可信后,可以只对这次安装信任已有 lockfile:

dsh plugin --profile web add github:wenhao4126/dsh-herdr --trust-lockfile

不要为了安装插件而全局关闭 minimumReleaseAge;如果 lockfile 来源不可信,应先审查或重建 lockfile。

更新与卸载

dsh plugin --profile web update @dsh-external/dsh-herdr-toolkit
dsh plugin --profile web remove @dsh-external/dsh-herdr-toolkit

直接使用

在 DSH 对话中可以输入:

列出 Herdr 当前所有 workspace、tab、pane 和 agent,只执行读取操作。
在 Herdr workspace w1 中创建一个 tab,工作目录为 /home/wen/projects/example,标签为 review,不要切换用户焦点。
把 w1:p1 向右拆分,在新 pane 中启动名为 reviewer 的 Codex agent。让它审查当前 Git diff,等待最多 120 秒,然后读取并总结结果。
在 w1:p2 运行 just test,等待输出中出现 test result,最多等待 2 分钟,然后读取最近 100 行。

工具返回 Herdr CLI 的结构化 JSON。创建结果中的 workspace、tab、pane ID 应作为后续操作的显式目标。

工具

Workspace

工具用途
_dsh_herdr_workspace_list列出 workspaces
_dsh_herdr_workspace_get查询指定 workspace
_dsh_herdr_workspace_create创建 workspace,强制不抢焦点

Tab

工具用途
_dsh_herdr_tab_list列出 tabs,可按 workspace 过滤
_dsh_herdr_tab_get查询指定 tab
_dsh_herdr_tab_create在指定 workspace 创建 tab,强制不抢焦点

Pane

工具用途
_dsh_herdr_pane_list列出 panes,可按 workspace 过滤
_dsh_herdr_pane_get查询指定 pane
_dsh_herdr_pane_read读取 pane 输出
_dsh_herdr_pane_split将指定 pane 向右或向下拆分,强制不抢焦点
_dsh_herdr_pane_run在指定空闲 shell pane 中运行命令并发送 Enter
_dsh_herdr_pane_wait_output等待 pane 中出现文本或正则匹配
_dsh_herdr_pane_send_text向指定 pane 发送原始文本,不发送 Enter

Agent

工具用途
_dsh_herdr_agent_list列出已识别 agents
_dsh_herdr_agent_get查询指定 agent
_dsh_herdr_agent_read读取 agent 输出
_dsh_herdr_agent_start在指定空闲 pane 启动命名 agent
_dsh_herdr_agent_wait等待 agent 到达稳定或指定状态
_dsh_herdr_agent_prompt发送 prompt 并等待稳定状态

支持的 agent kind 取自当前 Herdr CLI,包括 codexclaudeopencodegeminikimiwenocr 等。

安全边界

  • 所有 pane 和 agent 控制操作都要求显式 ID 或唯一 agent 名称。
  • workspace、tab 和 pane 创建始终传入 --no-focus,不会抢走用户焦点。
  • 不暴露 workspace/tab/pane 的 closemoveswapfocus 等破坏性或干扰性操作。
  • 不提供任意 herdr <args> 通用入口,只开放经过审查的命令集合。
  • Node.js 通过 execFile 调用 herdr,参数不会交给本机 shell 解析。
  • _dsh_herdr_pane_run 会在目标终端执行用户或模型提供的 shell 命令;使用前应确认目标 pane 和命令。
  • 插件不会启动或停止 Herdr server。Herdr TUI/server 的生命周期仍由用户管理。

返回值

每个工具返回:

{
  "ok": true,
  "command": "herdr pane split",
  "exitCode": 0,
  "data": {}
}

Herdr CLI 失败会作为结构化结果返回,而不会导致 DSH 工具层崩溃:

{
  "ok": false,
  "command": "herdr workspace list",
  "exitCode": 1,
  "stderr": "...server_not_running..."
}

开发与构建

源码位于 src/index.ts。构建需要完整 DSH 源码 checkout:

DSH_CHECKOUT=/path/to/deepseek-harness bash scripts/build.sh
npm pack

兼容性

当前版本依据 Herdr 的 workspacetabpaneagent CLI 命令实现,并面向 DSH 0.1.0-rc 系列。@deepseek-ai/dsh-tools 由 DSH host 在运行时提供,因此声明为 optional peer。

License

BSD-3-Clause