返回目录
模型与 MCP 插件

dsh-subagent-models

Garybot126/dsh-subagent-models

用于DSH中自由切换子代理使用的模型及强度

Stars
2
Forks
0
Issues
1
更新
14 天前

PROJECT TOPICS

项目标签

INSTALL REFERENCE

安装参考

未验证
dsh plugin --profile web add github:Garybot126/dsh-subagent-models

该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。

PROJECT README

README

dsh-subagent-models

Set the provider, model and reasoning effort that DeepSeek Harness subagents run with — from one entry, the chip beside the composer. The card it opens has two scopes over the same two DSH-style pickers: a searchable, provider-grouped model menu and that model's own effort menu.

为 DeepSeek Harness 的子代理统一指定用哪个模型、思考强度多深:只有一个入口——输入框旁的「子代理」 胶囊;点开的卡片里用「本对话 / 全局默认」两个范围切换,两处都是同一组 DSH 风格的「模型 + 思考强度」 浮层菜单(可搜索、按提供方分组、行内勾选)。

  • Host half: route store + agent/created selection (index.js)
  • Web half: the composer chip + a frame-wide card (client.js)
  • No build step and no settings page. The Web half uses the host's @deepseek-ai/dsh-client-ui-primitives when present (a frozen platform module — nothing to install), with hand-drawn .dsm-* fallbacks on hosts that do not ship it.

Screenshots / 截图

本对话 全局默认
本对话 全局默认

Install / 安装

# npm
dsh plugin --profile <profile> add dsh-subagent-models

# or straight from this repository
dsh plugin --profile <profile> add github:Garybot126/dsh-subagent-models

Then restart dsh once if the plugin row was not hot-loaded.

Where to set it / 在哪里设置

Where What
Composer → 「子代理 …」 chip The only entry. Opens the card
Card → 「本对话」 scope This conversation's override; the model menu's first row is 「跟随全局」
Card → 「全局默认」 scope The profile-wide default for every conversation without an override

The chip's label is the effective route for the conversation (e.g. 子代理 DeepSeek-V4.1-Flash · high), so the composer always says what a delegation will actually use. The card's footer repeats it with its source: 下一次委派将使用 …(来源:本对话 / 全局默认).

The card's two rows are DSH-style cells — click one to open a menu anchored above it. The model menu matches the built-in composer model picker: a search box for catalogs above four models, provider groups with sticky headings, rounded hover rows and an inline check mark on the current choice. The effort menu lists 「模型默认」 plus only the levels that model advertises.

Both menus are driven by the live LLM catalog (ctx.llm): models are grouped by provider, and the effort list is the one that model advertises (resolveModelInfo().reasoning.efforts), so an unsupported level is never offered.

No settings page is registered by this plugin. The built-in 设置 → 插件 → 子智能体 page belongs to dsh itself (recursion depth, concurrency, model whitelist) and is unrelated; see below.

Precedence / 优先级

本对话 override  →  全局默认  →  no route (child inherits the parent session)

When it takes effect / 什么时候生效

  • Applies to the next delegation — no restart, no new conversation.
  • A child that is already running keeps the route it was created with: the selection is written once, at creation, so a changed route affects the next delegation, not a running child.
  • With no route configured, children keep inheriting the parent session's route — exactly the behaviour of not installing the plugin.

How the route is applied / 怎么生效

The delegation tool (subagent) is composed in the agent-plane preset, not in the Profile patch, and it carries its own static agentOptions. A plugin cannot rewrite that composition, so the route is applied to the delegated child itself:

agent/created  →  agent.model.select({ provider, model, reasoningEffort })

DSH ≥ 0.2.2 fixes a step's model selection before the agent/request waterfall runs and now rejects any proposal that changes provider, model or reasoning effort (the error it throws says “… after step preparation fixed …; use agent.model.select() before step preparation”), so that seam is no longer usable for routing. agent.model.select() appends a model/selection event — the projection a step reads its selection from — and agent/created is emitted (and awaited, it is a serial event) after the child is constructed but before its first step prepares. The listener is registered once and only touches a Session whose origin is subagent; a top-level Session is never touched, and the conversation root for the per-conversation scope is found by walking parentSession up until a non-subagent Session is reached. Consequences:

  • works with the official subagent tool, without editing the preset and without adding model-selection parameters to the tool schema;
  • subagent, subagent_fork and Agent Teams members all count as delegated agents (every in-process child is created with origin: "subagent");
  • a route whose provider/model is no longer advertised by a mounted provider is skipped with a [subagent-models] warning — a stale route degrades to "no routing" instead of breaking the child.

Data / 数据

$DSH_HOME/plugin-data/subagent-models.json (falls back to ~/.dsh/plugin-data/), hot-reloaded on mtime, so editing it by hand also works:

{
  "version": 1,
  "global": {
    "default": { "provider": "deepseek-official", "model": "deepseek-flash", "effort": "high" },
    "presets": {}
  },
  "sessions": {
    "<sessionId>": { "default": { "provider": "...", "model": "...", "effort": null }, "presets": {} }
  }
}

global.default: null means no profile default; an absent sessions[sessionId] means the conversation follows it.

Capability disclosure: reads and writes this one JSON file; binds no network port beyond the loopback HTTP prefix /plugin/subagent-models used by the Web UI; never reads conversation content, credentials, or any other file.

Limits / 限制

  • subagent_fork children are overridden too. A fork shares the parent's prefix, so a different model costs its KV cache; clear the route (or keep the preset's own agentOptions) if that matters to you.
  • An effort the chosen model does not support is rejected by the adapter's validation on the child's first request — the plugin never silently downgrades an effort it was told to use.
  • The route is chosen once per child, at creation, and wins over the composition's agentOptions because the recorded selection is read before that fallback; context-window and metering metadata follow the selected route for the child's whole lifetime. Changing the route does not re-route a child that is already running.

Relationship to similar plugins / 与同类插件的关系

Several plugins in the market move subagent routing: dsh-subagent-custom (task-class routing), dsh-subagent-model-picker (a per-session picker), dsh-subagent-default-model (settings.yaml default), dsh-model-settings (a settings panel), dsh-orquestrator (a fixed forced route). This one keeps the surface at one composer chip: two scopes, one pair of DSH-style pickers, and a label that always shows the effective value.

Since dsh 0.2.2 the host also ships its own subagent model-selection policy (an allowlist plus per-call provider / model parameters on the tool). That one permits a selection; this plugin forces one when the child is created.

Verified / 已验证

On dsh 0.2.2-rc.1 (desktop profile):

  • global route opencode-go / deepseek-v4.1-flash / max → a delegated child's model/selection and its first request/header both carried that route, and the child completed its turn;
  • with the route cleared, the child inherited the parent session's route;
  • a route naming an unregistered provider/model is skipped with a [subagent-models] warning instead of being forced (handler-level harness; not exercised end-to-end);
  • GET /plugin/subagent-models/state?sessionId=… → 200 with global, session and the catalog;
  • POST /plugin/subagent-models/route with scope: "session" / "global" → 200 and the JSON file updates on disk;
  • the composer chip and the frame-wide card register as active slot occupants; no settings section is registered by this plugin.

License

MIT © Gary Gai

CLASSIFICATION EVIDENCE

分类依据

项目类型插件
功能分类模型与 MCP
规则置信度中

系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek-harness。