dsh-plugin-yet-another-subagent:用单一工具切换子代理 Profile

前言

DeepSeek Harness(dsh)把智能体运行时拆成可插拔的能力:模型、工具、会话、沙箱、界面都是插件。官方仓库的说法是「一切皆插件」(Everything is a Plugin),由 Cordis 负责挂载和组合。子代理(subagent)也在这条链路上:父代理把一段自包含任务交给子代理,子代理在自己的上下文里跑完,再把结果交回来。

官方自带的 tool-subagent 走 spawn 路径,面向模型的工具名就是 subagent。它能委派,但默认只有一套行为:模型、人设、工具过滤、后台策略都跟着当前部署走。实际用的时候经常会碰到另一类需求:调研用快模型、改代码用人设更严的模型、某些任务还要收窄工具权限。如果每套策略都做成一个新工具,模型侧的工具表会越来越长,也容易和官方工具重名。

dsh-plugin-yet-another-subagent 走的是另一条路:仍然只暴露一个 subagent 工具,用 profile 参数选配置。社区插件库把它归在「界面增强」,维护者是 HuanLinOTO。本文按目录页、GitHub 仓库和 npm 包交叉核对后的内容来写,不把社区目录写成 DeepSeek / 幻方的官方应用商店。

这是什么

dsh-plugin-yet-another-subagent 是面向 DeepSeek Harness 的社区插件。npm 包名是 @huanlin/dsh-plugin-yet-another-subagent,插件 id 是 yet-another-subagent。仓库 README 的定位是:可配置的子代理 profile 系统,提供单一 subagent 工具 + profile 参数,并带 Web UI 设置、实时进度(工具调用 / token / 活动)、子代理树标签页,以及点击跳转到子会话。

它解决的问题可以概括成三点:

1、模型侧工具面保持扁平。profile 增删只改 profile 枚举,不改工具名集合。
2、每套 profile 可以单独指定模型、人设、工具过滤、递归深度和后台模式。
3、Web 界面能看见子代理在干什么,而不只是等一条最终回复。

package.jsondsh.client.platform 写的是 web,也就是说界面部分挂在 Web UI 上。GitHub 仓库页面当前 11 星(社区目录页仍显示 7 星,以仓库页面为准)。LICENSEpackage.json 声明为 AGPL-3.0;目录页因 GitHub SPDX 识别为 NOASSERTION,安装前应对照仓库许可证原文。

核心功能

按照仓库 README 和 src/index.ts / src/tool-factory.ts 的实现,插件是一个单 bundle、三入口结构:host(.)、invariant(./invariant)、client(./client)。

1、单一 subagent 工具

host 侧注册一个名为 subagent 的工具,用 profile 枚举选择配置。未传 profile 时,源码默认落到内置的 general。工具复用官方 spawn provider,支持前台(foreground)和后台两种跑法;后台策略由当前 profile 的 backgroundMode 决定,可以是 continuable(保留子会话,后续用 send_message 继续派活)或 one-shot(返回 job id,用 job_output / job_kill 收结果或中止)。

cordis.patch.yml 只禁用官方 tool-subagent(spawn 路径,工具名同样是 subagent),保留 tool-subagent-fork(工具名 subagent_fork),避免名称冲突。fork 委派仍然可用。

2、Web UI 设置页

client 侧往设置面板注册 settings.section(id ya-subagent),用来增删改 profile。状态通过 settings seam 写到 $DSH_HOME/settings.yamlya-subagent 命名空间。cordis.patch.yml 里的 profiles 只是首次启动的种子(composition base);之后在设置页改的内容以用户层为准。没有 settings provider 的无头组装会退回内存状态,只保留种子配置,不持久化。

3、实时进度和子代理树

工具调用卡片(tool.call.toolview,key 为 subagent)会展示子代理进度。底层靠两个 session projection:父会话上的 subagentProfile(childId→profileId、callId→childId),子会话上的 yaSubagentProgress(实时 toolcall / token / 活动)。会话视图里还有 subagent-tree 标签页,点卡片可以跳到对应子会话。

4、默认 profile

安装后会带一个内置 general:模型 auto(继承父代理)、人设 inherit、不过滤工具、maxDepth 为 3、backgroundModecontinuablegeneralFixed: true 表示这个内置项按固定种子处理。

安装与启用

社区目录页给出的安装命令如下,在 DeepSeek Harness 终端里运行即可:

dsh plugin add github:HuanLinOTO/dsh-plugin-yet-another-subagent

需要可复现安装时,目录页建议固定 commit 哈希,把下面的 commit 换成具体哈希。仓库 master 在 2026-08-15 的最新提交是 1d2d2d4a93b6226740a0ae1d61ef9d95e4447f67

dsh plugin add github:HuanLinOTO/dsh-plugin-yet-another-subagent#1d2d2d4a93b6226740a0ae1d61ef9d95e4447f67

仓库 README 还给出了按 web profile 从 npm 安装的写法(README 标注为推荐):

dsh plugin --profile web add @huanlin/dsh-plugin-yet-another-subagent

npm 页面当前最新版本是 0.1.2(仓库 package.json 仍写 0.1.1,以 npm 页面为准)。安装完成后按 README 重启 dsh web,浏览器硬刷新(Ctrl+Shift+R)。

插件以当前 dsh 进程的权限运行,安装时可能执行代码。安装前应检查源代码仓库和许可证。

配置与用法

bundle 自带的 patch 大致如下(摘自仓库 cordis.patch.yml):

- id: tool-subagent
  disabled: true

- insert:
    - id: yet-another-subagent
      name: '@huanlin/dsh-plugin-yet-another-subagent'
      config:
        profiles:
          - id: general
            label: General
            model: { kind: 'auto' }
            persona: { kind: 'inherit' }
            toolFilter: { kind: 'none' }
            maxDepth: 3
            builtin: true
        generalFixed: true

日常改 profile 不必手改这份 yaml。打开 Web UI 设置里的 yet-another-subagent 一节即可增删改;外部直接改 $DSH_HOME/settings.yaml 时,host 会通过 scope.watch 热重载并重新注册工具。

README 给出的 profile 字段如下:

字段 说明
id 唯一标识,小写字母 / 数字 / 连字符,1–32 字符
label 显示名
model.kind auto 继承父代理模型;manual 再填 providermodel
persona.kind inherit 跟随部署人设;custom 使用 persona.text
toolFilter.kind none / allow / deny,列表写在 toolFilter.tools
maxDepth 最大递归深度,默认 3
backgroundMode continuableone-shot,在 run_in_background: true 时生效
builtin 是否为内置 profile,仅展示用

模型调用 subagent 时,参数来自 src/tool-factory.ts

  • profile:可选,枚举当前 profile id,省略则用 general
  • description:必填,3–5 个词的任务短标签,用于界面展示
  • prompt:必填,给子代理的完整、自包含任务。子代理看不到父会话上下文
  • run_in_background:可选。true 时按该 profile 的 backgroundMode 走后台

例如先在设置页加一个 idresearch、模型 manual、工具过滤更窄的 profile,再让模型委派时带上 profile: "research"。工具描述里会列出当前可用 profile,模型按任务性质选择即可。

界面侧可以按这个顺序看效果:

1、重启 dsh web 并硬刷新后,设置页应出现 profile 编辑入口。
2、父代理调用 subagent 后,对话里的工具卡片会显示进度;打开 subagent-tree 标签页可以看到子代理树。
3、点击卡片跳转到对应子会话。

适用场景与注意事项

比较适合已经在用 dsh Web UI、并且会把工作拆给子代理的人:同一条主会话里既要调研、又要改代码、还要限制某些子任务能碰哪些工具。它不替代 fork 路径上的 subagent_fork,也不给无头组装提供 Web 进度面板。

使用前有几处边界需要知道:

1、它会禁用官方 spawn 路径的 tool-subagent,接管 subagent 这个工具名。如果当前 profile 还依赖官方那套默认行为,装之前先确认可以替换。
2、client 明确标了 platform: web。无头模式没有 settings provider 时,profile 只存在内存里,重启即丢。
3、README 写明旧会话不兼容:结果文本的 render 格式变更后,旧会话里的卡片可能无法被 parseResult 匹配,因而不可点击;需要 host 重启后的新会话才正常。yaSubagentProgress 的 stateVersion 2(activity 字段等)同样要 host 重启后才生效。
4、仓库 engines 要求 Node.js >=22.0.0
5、仓库里的 AGENTS.md 仍有「每个 profile 注册一个 subagent_<id> 工具」「同时禁用 fork」等旧描述,与当前 README、cordis.patch.ymlsrc/index.ts 不一致。以 README 和源码为准。

插件以当前 dsh 进程权限运行。社区目录是独立站点,和 DeepSeek / 幻方没有官方从属关系;dshfind 也收录了该插件,同样属于社区索引。安装前检查源码、许可证和依赖,重要工作区建议先在一次性 profile 里试装。

小结

dsh-plugin-yet-another-subagent 把「多套子代理策略」收成一个工具上的 profile 参数,并在 Web UI 里补上设置页、实时进度和子代理树。它复用官方 spawn,不碰 subagent_fork。需要多套模型 / 人设 / 工具权限、又不想把工具表拆散的话,可以按目录页命令装一份,看设置页和子代理树是否符合自己的工作流。

目录页:https://deepseek-harness-plugin.com/zh-CN/plugins/dsh-plugin-yet-another-subagent/

GitHub:https://github.com/HuanLinOTO/dsh-plugin-yet-another-subagent

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

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

小夜