dsh-subagent-default-model 1.3.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +85 -0
- package/README.en.md +28 -25
- package/README.md +30 -23
- package/lib/client.js +228 -31
- package/lib/index.js +77 -60
- package/package.json +13 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,90 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.0.1 (2026-09-25)
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **设置卡的「保存」按钮永久灰着、点不动(P0):命名空间在 `apply` 期只探测一次,落空后永不重探**。`lib/client.js` 原本写作 `subagentScope = forms.get(subagentEntryIdOf(forms))` —— 一次性的 `get()`。但 `configForms` 的 describe mirror 是**异步加载**的(`mirror.ensure()`),`apply` 跑的时候 `view` 往往还不存在;此时 `subagentEntryIdOf` 看不到任何命名空间,只能回落到**声明条目 id** `dsh-subagent-default-model`,而桌面宿主实际服务的是 **`include:dsh-subagent-default-model`**。
|
|
8
|
+
绑定错命名空间后,宿主的 `ConfigFormController.derive()` 找不到对应 `view`,把表单停在 `status: 'unavailable'`(**静默,不报错**),而 `derive()` 只在 mirror 变化时重跑——**而作用域早已被捕获,于是永远停在 unavailable**。卡片的 `saveDisabled` 含 `snap.status !== "ready"`,因此保存按钮**永久禁用**;同时因 `value` 为 undefined,卡片还会退化成「尚未指定默认模型」的空态。
|
|
9
|
+
已改为 0.1.7 的官方范式 **`configForms.whileServed([...], (served) => …)`**:命名空间**进入 mirror 时**才注册贡献,并把宿主实际服务的命名空间集合交给回调,据此解析并绑定;命名空间消失时自动卸载贡献。`subagentEntryIdOf(forms, servedNamespaces)` 现优先使用该集合(它正是判定「该注册了」的依据,mirror 可能仍在折叠中),mirror 快照退居其次。
|
|
10
|
+
这是 `remote.session` 那条的**同类第三次**:**「取一次就捕获」在异步就绪的服务上必然出错**。
|
|
11
|
+
诊断与验证(不依赖 Electron):以宿主 `derive()` 的真实语义构造两类作用域,渲染同一张卡片并触发改动 —— 正确绑定(`ready`)→ `Save disabled = false`(可保存);错误绑定(`unavailable`)→ `Save disabled = true`(永久禁用)。修复前用一次性 `get()` 恰是后者。
|
|
12
|
+
|
|
13
|
+
### Testing
|
|
14
|
+
|
|
15
|
+
- 新增 1 个 **行为级**用例 `cards bind to the namespace the host actually serves when the mirror is late`:mirror 为空时 `apply` 必须**不**绑定任何命名空间、**不**注册卡片;待宿主服务的命名空间出现后,绑定必须落在 `include:<条目 id>` 上并注册两个放置点。
|
|
16
|
+
- 改写 `resolves the served settings namespace instead of assuming the bare id`,使其断言 `whileServed` 契约(含 `servedNamespaces.has` 优先与逐次绑定),而不再固定旧的一次性 `get()` 形状。
|
|
17
|
+
- 两者均**变异验证**过:把实现改回「`apply` 期一次性探测」后立刻变红,还原即全绿。全量 **86 项通过**。
|
|
18
|
+
|
|
19
|
+
## 2.0.0 (2026-09-25)
|
|
20
|
+
|
|
21
|
+
### Breaking
|
|
22
|
+
|
|
23
|
+
- **宿主最低版本提升至 `@deepseek-ai/dsh >= 0.1.7-rc.1`**(peer 区间收窄为 `>=0.1.7-rc.1 <0.2.0`,全部 8 个 `@deepseek-ai/*` peer 一致)。0.1.7 线删除了本插件此前依赖的三处契约:`@deepseek-ai/dsh-settings` 的 `installSettingsSection` / `settingsNamespace` 命名导出、客户端 `settingsScope` 服务与 `settings.plugin.item` 槽位。依据同族插件 `dsh-ldvh` 的同源调研。
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
|
|
27
|
+
- **设置接入迁移到 0.1.7「插件 Config 即设置」模型**:`lib/index.js` 导出 `Config`(字段逐个 `.volatile()`),移除对 `@deepseek-ai/dsh-settings` 的**命名导入**——该导入在 0.1.7 上会导致模块链接期失败、整个宿主插件无法装载,且因 peer 区间「覆盖了该版本」而不会被版本检查拦下(**范围覆盖 ≠ 符号仍存在**)。写入改走 profile patch(经宿主 `configEditor`)。
|
|
28
|
+
- **客户端设置面迁移**:硬注入 `settingsScope`(0.1.7 已删除,会让整个客户端插件永不 apply)改为仅硬注入 `slots` / `locale`,`configForms` 改软注入;设置卡从已删除的 `settings.plugin.item` 迁到 `plugins.bundle.config` 与 `plugins.row.config` 双注册。
|
|
29
|
+
- **设置卡对齐同族范式**:`view: 'page'` 默认展开、`view: 'summary'` 只渲染一行描述,展开/收起按钮补 `aria-label`。
|
|
30
|
+
- **`dsh-client-ui-primitives` 图标族适配**:尺寸数字后缀(`…Outline14`)→ 粗细语义后缀(`…OutlineRegular` / `…Medium`),改为按名探测取第一个可用者并在渲染点兜底——把宿主改名造成的渲染期**硬崩溃**降级为视觉降级。
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
|
|
34
|
+
- **宿主整体装载失败(P0):依赖树指向已被删除的 `/Applications/DSH Desktop.app`**。`plugin/node_modules/@deepseek-ai/` 下的 `schemastery` / `cordis` / `dsh-settings` 三个条目是**指向旧应用包的符号链接**;应用换成 `DSH NEXT.app` 后这些链接全部悬空,`lib/index.js` 第一行的 `import z from "@deepseek-ai/schemastery"` 直接 `ERR_MODULE_NOT_FOUND`。宿主表现为 `dsh-subagent-default-model (dsh-subagent-default-model): failed to import`,插件**一行都没跑**——而 `npm test` 仍全绿。已删除悬空链接并以 `npm install` 重建为真实目录。判据:`find node_modules -maxdepth 3 -type l ! -exec test -e {} \; -print` 必须为空。
|
|
35
|
+
- **devDependency 精确锁定致 `npm install` ERESOLVE**:`@deepseek-ai/dsh-settings` 写死 `0.1.7-rc.1`,而它自身 peer 依赖 `@deepseek-ai/dsh-brand@0.1.7-rc.1`,该包只发布了 `0.1.7-rc.2`,于是干净安装直接失败。这正是本仓 CHANGELOG **1.2.2 已经记过的那条教训**(「此处必须用范围而非精确锁定」)——被 0.1.7 适配时的版本推进重新踩了一次。已改为 `^0.1.7-rc.1`。
|
|
36
|
+
- **旧 `settings.yaml` 配置不会随 0.1.7 迁移过来**:0.1.6 及更早,本插件把配置注册为 `~/.dsh/settings.yaml` 的 `subagent-default-model` 段。0.1.7 起该文件在启动时被**一次性导入并改名**为 `settings.yaml.imported`(改名先于首次写入,所以部分导入永不重试),导入按段名**直接当条目 id** 使用,而本插件的条目 id 是 `dsh-subagent-default-model`——于是该段导入失败,宿主日志留 `section subagent-default-model … was not imported into entry subagent-default-model`,`profile/cordis.patch.yml` 里始终没有本插件的 `config:`。**本机实测命中**:旧值仍在 `.imported` 文件中,需手工搬进 profile patch。README / DEVELOPMENT.md 已改为描述 0.1.7 的真实存储位置并写明该陷阱(原文档仍在教用户编辑 `~/.dsh/settings.yaml`)。
|
|
37
|
+
- **设置保存必然失败(P0)**:`Config` 未声明 `reasoningEffort`,而设置卡的保存路径每次都写入该键。宿主 `@deepseek-ai/dsh-settings` 的 `write()` 对每个写入路径执行 `Config field "…" is not volatile` 门禁,因此**任何一次保存都被拒绝**——不只是改推理强度,而是整张设置卡存不进去,且界面只显示笼统的「保存失败」。已把 `reasoningEffort` 补为声明字段并标记 volatile;`getSection()` 同步读回该键,否则单模型形态配置的推理强度会被静默忽略。
|
|
38
|
+
- **设置卡可能绑定到无人服务的命名空间**:0.1.7 的 `configForms.get()` 对宿主 served-namespace 目录做**精确匹配**,而桌面宿主以 `include:<包名>` 挂载 Loader 条目。绑定错误时 `status: unavailable`、**静默失效不报错**(同 `dsh-ldvh` abb35db、`dsh-connect-workbuddy` 2.0.16 修掉的同一类坑)。现抽为具名 `subagentEntryIdOf(forms)`,按「声明条目 id → `include:<条目 id>` → 包名子串」的顺序匹配,仅在 mirror 未就绪时回落到声明 id。已用真机命名空间 `include:dsh-subagent-default-model` 做端到端绑定验证。
|
|
39
|
+
- **回落常量取的是已退役的 0.1.6 段名**:`SUBAGENT_MODEL_SETTINGS_NS` 原为 `"subagent-default-model"`,那是 0.1.6 及更早 `settings.yaml` 独立设置模型里的段名;0.1.7 起命名空间**就是 Loader 条目 id** `"dsh-subagent-default-model"`。mirror 未就绪时按旧名回落会绑定到无人服务的命名空间。已改为条目 id;`lib/index.js` 中被遗留的同名常量(仅声明、从未使用)一并删除——宿主而非插件拥有「条目 id ↔ 命名空间」的映射,插件不该保留第二份。
|
|
40
|
+
- **图标回退分支无样式**:`IconChevronDown` 探测全缺失时渲染 `.dsm-plugin-card-caret` 字形,但该类**只有使用点、没有 CSS 规则**。已补规则,并加守卫用例禁止「渲染了却无规则」的类再次出现。
|
|
41
|
+
- **设置卡的 Provider / Model 下拉永远为空(P0):`remote.session` 是异步挂载的服务,插件却在 `apply` 时只取一次**。`lib/client.js` 原写法 `var sessionRemote = ctx.get("remote.session")` 把叶服务**捕获**进变量;而该服务由网关的**异步** `remote.$mount()` 注册(`packages/api/gateway/src/client/index.ts`:`remoteServiceKey(ns)` → `remote.<ns>`,挂载点在 `async $mount` 内)。`apply` 跑的时候网关通常还没挂完 → 捕获到 `undefined` → `loadCatalog` 从此恒返回空数组,**而且因为值是捕获的,之后挂载完成也永远不会重取**。表现就是设置卡能打开、两个下拉却没有任何可选项。
|
|
42
|
+
已改为**每次调用时懒探测**(先 `ctx.get("remote.session")`,再退回 `ctx.get("remote")?.session`),晚到的挂载即可被拾取;网关始终缺失时仍降级为空下拉且不抛错。官方同功能卡片(`ui-settings-subagent`)是把 `'remote','remote.session'` 写进 `inject` 让 Cordis 等待;本插件保持软注入(网关缺失不该扣下整张卡),因此改用重探测达到同样效果。
|
|
43
|
+
- **同族坑:`ctx.get()` 不按点号拆分**。Cordis 的 `get(name)` 是整串查表(`this.ctx[symbols.isolate][name]`),`"remote.session"` 之所以成立,是因为网关真的以这个字面量注册了服务(`remote.${namespace}`),不是 `remote` 的嵌套属性访问。所以「带点的服务名」能否解析,只能以**是否有人注册过该整串**为准——按「父对象.子属性」去推断会得到错误结论。
|
|
44
|
+
- **Plugins 详情页整块没有配置区(P0):读取未在 `inject` 声明的服务会抛错,把 `apply` 后半段整段打断**。`lib/client.js` 用 `if (ctx.uiConversation && ctx.uiConversation.events && …)` 这种「守卫写法」读 `ctx.uiConversation`,而它**没有**出现在 `inject` 里。Cordis 对未声明的服务**不返回 `undefined`**,而是抛 `cannot get property "uiConversation" without inject`(Cordis `lib/index.js` 的 service accessor;已用真实 `new Context()` 复现)。因此那个 `&&` 守卫**完全无效**——求值 `ctx.uiConversation` 本身就是抛错点。
|
|
45
|
+
致命之处在于位置:该读取位于 `apply()` **中段**,它一抛,**其后**的 `ctx.inject(["configForms"], …)` 整块——也就是注册设置卡的那段——再也不会执行。于是详情页连配置区外壳都不出现(宿主只在 `ledger.bundles.has(包名)` 时才渲染该区块),且宿主日志只留一行、没有栈。
|
|
46
|
+
已把 `uiConversation` 加进 `inject`(与官方全部 7 个消费者一致:ui-chat / ui-plan / ui-deliverables / ui-open-in-app / ui-settings-account / ui-settings-models / ui-model-selection)。`configForms` 仍走软注入——它本身是可选的,且 `ctx.inject` 正是「等它就绪而不抛错」的 API。
|
|
47
|
+
- **同族坑:`ctx.<service>` 的读取必须声明,`ctx.get()` 才是无声明探测**。前者抛错、后者返回 `undefined`。凡「想可选地用一个服务」只能走 `ctx.get` / `ctx.inject`;写成 `if (ctx.foo && …)` 不但拦不住,还会把 `apply` 打断在最坏的位置。
|
|
48
|
+
- **「当前供应商/模型」上下文行不再出现(P0):0.1.7 适配时把 `uiConversation` 从 `inject` 里误删,导致每次 `apply` 都在读它时抛错**。对照本仓 HEAD 可见演进:适配前是 `["slots","locale","settingsScope","remote","remote.session","uiConversation"]`,适配后只剩 `["slots","locale"]` —— `uiConversation` **不在 0.1.7 的删除清单里**(被删的是 `settingsScope`),属误伤。而本轮 §「未声明服务读取会抛错」已证明:读未声明的服务是**抛错**而非返回 undefined,于是 `apply` 在第 610 行中断,其后两个 `events.register` 与设置卡注册全部不执行——用户可感的正是**「切换模型/当前模型的上下文提示消失」**。已把 `uiConversation` 加回 `inject`。
|
|
49
|
+
- **同族坑:`ConversationEventRegistry.register` 对重复 `kind` 抛错,必须包进 `ctx.effect`**。我们把两个 conversation 定义**裸调**注册且丢弃 disposer(`conversation Definition "<kind>" is already registered`)。Cordis 在替换 fiber 时会再次执行 `apply`,第二次注册即抛错——修复 `inject` 后它仍会中断 `apply` 后半段(含设置卡)。官方全部消费者(`ui-plan`、`ui-deliverables` …)都写作 `ctx.effect(() => ctx.uiConversation.events.register(def), '…')`,让 Cordis 在重挂前先释放。已按该范式包裹两处。
|
|
50
|
+
注意:**多定义 `match` 同一事件是设计允许的**——`assembler.dispatchInput` 会遍历**所有**定义并逐个 `accept`,不是「先到先得」。因此本插件的 `request/header` 定义与官方 `ui-trajectory` 的同名匹配**不冲突**,可见性问题与匹配竞争无关。
|
|
51
|
+
- **客户端半边整体不激活(P0):`apply` 重复执行时命中宿主 locale 重名抛错**。`lib/client.js` 的 `apply` 在函数最开头无条件调用 `ctx.locale.register("settings.subagentModel", …)`,且**丢弃返回值**。宿主 `@deepseek-ai/dsh-client-locale` 对「命名空间已有该语言」是**抛错**(`locale namespace "…" already has locale "…"`),而 Cordis 在 fiber 被替换时会再次执行 `apply`——于是第二次 apply 在注册设置卡**之前**就抛错。宿主表现为 `web boot: 1 entry did not activate` / `dsh-subagent-default-model: failed`,客户端半边**全部贡献**(设置卡、轨迹行、对话行)都不注册,且宿主日志只留一行,没有栈。
|
|
52
|
+
已按同族 `dsh-ldvh` / `dsh-sub-cli` 的范式把登记包进 `ctx.effect(...)` 并**接住两个 disposer**:Cordis 在重挂前会先释放上一次登记,重入即从干净命名空间开始。
|
|
53
|
+
复现与验证方式(不依赖 Electron):以真实 `locale` 语义(重名抛错)+ Cordis 语义(effect 在重挂前释放)构造 stub,连跑三次 `apply` —— 修复前 `#1:OK #2:THREW #3:THREW`,修复后 `#1:OK #2:OK #3:OK`。
|
|
54
|
+
**这一条是被「测试全绿」掩盖的第三个 P0**:原测试的 `locale.register` stub 只做字典合并、从不抛错,所以永远测不出只对第一次 apply 成立的登记。
|
|
55
|
+
|
|
56
|
+
### Notes
|
|
57
|
+
|
|
58
|
+
- **`npm test` 全绿不能证明宿主能装载**:测试与宿主走的是两条不同的模块解析路径(测试从 `plugin/` 解析,宿主从 profile 经软链解析)。本轮三个 P0 里有**三个**在测试全绿的情况下依然让插件完全不可用。宿主编译期的唯一判据是**真正 import 一次**:`cd ~/.dsh/profiles/<profile> && node --input-type=module -e 'import("<包名>")'`。
|
|
59
|
+
- **stub 比被测代码宽松时,测试会给假绿灯**:`locale` 那条 P0 的根因就是 stub 省略了宿主唯一的失败路径(重名抛错)。写 stub 时应**先读宿主实现**再决定放行什么——本次是照 `dsh-client-locale/lib/client.js` 的重名抛错逐字建模后,才复现出来。
|
|
60
|
+
- **客户端半边是否真的激活,要按 `failed` / `pending` 区分**:两者都表现为「插件在 Web 上不见了」,但机制相反——`pending (waiting for service: …)` 是硬注入了一个不存在的服务(apply 因为等不到服务而从未运行);`<id>: failed` 是 apply **跑了但抛错**。查证入口是 `~/Library/Logs/DeepSeek Harness/crash-*-web-boot.log`,它同时给出判据行与 renderer console。
|
|
61
|
+
- **改完 `node_modules` 后,已在运行的宿主进程不会重新 import**:它把失败状态留在内存里,`plugin_manager` 反复 enable/disable 都返回同一个 `failed to import`,且不再写新日志。验证修复必须**重启应用**,而不是重试开关。
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
### Docs
|
|
65
|
+
|
|
66
|
+
- **安装入口改写**:`dsh plugin --profile desktop add <path>` 在新版桌面壳上会被拒绝(`profile "desktop" is managed exclusively by the Electron application`)。DEVELOPMENT.md 改为走 DSH Desktop 内插件管理 / `plugin_manager` 的 `install_bundle`(target = 插件包绝对路径),并补上三条安装后核对(bundle 列表、软链、`listConfigs` 条目 id)。
|
|
67
|
+
- README(中/英,根与包内)配置示例从 `~/.dsh/settings.yaml` 段改为 profile patch 的 `config:` 块,并写明旧文件的一次性导入与段名不匹配陷阱。
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
### Testing
|
|
71
|
+
|
|
72
|
+
- `plugin/test/client-trajectory.test.mjs` 新增 5 个契约用例:服务命名空间必须经 `subagentEntryIdOf` 解析且不得裸调 `get(声明id)`、`include:` 前缀命名空间下必须绑定到宿主实际服务的那一个、回落常量必须是 Loader 条目 id 而非遗留段名、`page` 形态默认展开 / `summary` 形态只渲染一行、全部渲染类都必须有 CSS 规则;另加匹配优先级用例(宿主同时服务 `include:<条目id>` 与遗留段名时,精确匹配必须胜出)。
|
|
73
|
+
- 新增 `plugin/test/dependency-integrity.test.mjs`(3 项)——把本轮两个 P0 变成测试能拦住的回归:① 依赖软链不得悬空(`lstatSync` 是链接但 `existsSync` 为假即失败);② 声明的 runtime dependency 必须在 `node_modules` 里存在;③ devDependency 不得是精确预发布锁定(`^\d.*-` 即失败)。两条守卫都用**变异验证**过:重新造一个悬空链接、把 `dsh-settings` 改回 `0.1.7-rc.1`,各自都被对应用例抓住。
|
|
74
|
+
- 全量 **85 项通过**(原 63 项 + 设置/图标契约 5 项 + 依赖完整性 3 项 + `apply` 重入契约 3 项 + 模型目录契约 3 项 + 服务声明契约 2 项 + 会话行注册契约 2 项 + 其余 4 项);`node integration.mjs`(8 项)与 `node prove.mjs`(1 项)同样通过。
|
|
75
|
+
- 新增 2 个 **会话行注册契约**用例(`plugin/test/client-trajectory.test.mjs`),针对「上下文提示消失」:① 用一个**重复 `kind` 即抛错**的注册表 stub 模拟宿主语义,断言三次 `apply`(中间执行 fiber teardown)都能把两个定义重新登记上去——修复前第二次即抛 `already registered`;② 静态守卫,要求两处 `ctx.uiConversation.events.register` 都必须写成 `ctx.effect(function () { return ctx.uiConversation.events.register(…) })`。
|
|
76
|
+
同样用**变异验证**过:把两处改回裸调后,上述 2 条立刻变红,改回即全绿。
|
|
77
|
+
- 新增 2 个 **服务声明契约**用例(`plugin/test/client-trajectory.test.mjs`),其中一个用**真实 Cordis**(`new Context()` + `root.plugin({ inject })`)跑 `apply`,断言它必须**正常完成**而不是在未声明服务的读取处抛错——这正是「详情页没有配置区」的根因所在。另一个是静态守卫:把客户端源码去掉注释后,凡 `ctx.<service>` 形式的**属性读取**都必须出现在 `inject` 里。
|
|
78
|
+
同样用**变异验证**过:把 `uiConversation` 从 `inject` 拿掉后,上述 3 条(含真实 Cordis 那条)立刻变红,加回即全绿。
|
|
79
|
+
- **跨 realm 断言注意**:客户端工厂由 `new Function` 执行,其数组带的是另一个 realm 的 `Array.prototype`,对两个「内容相同但来源不同」的数组用 `assert.deepEqual` 会误报失败(`actual: []` / `expected: []` 却判不等)。相关用例改用 `assert.equal(arr.length, …)` 比较。
|
|
80
|
+
- 新增 3 个 **模型目录契约**用例(`plugin/test/client-trajectory.test.mjs`):① `remote.session` 在 `apply` **之后**才挂载时,`loadCatalog` 必须重探测并取到目录;② 网关**始终缺失**时降级为空数组且不抛错;③ 守卫 `apply` 不得把 `remote.session` 捕获进变量(防止这个 bug 以任何形式复发)。
|
|
81
|
+
同样用**变异验证**过:把 `loadCatalog` 改回「`apply` 时一次性捕获叶服务」的原始写法后,①③ 立刻变红,改回修复版即全绿。
|
|
82
|
+
- **跨 realm 断言注意**:客户端工厂由 `new Function` 执行,其数组带的是另一个 realm 的 `Array.prototype`,对两个「内容相同但来源不同」的数组用 `assert.deepEqual` 会误报失败(`actual: []` / `expected: []` 却判不等)。这两条用例改用 `assert.equal(arr.length, 0)` 比较。
|
|
83
|
+
- 新增 3 个 **`apply` 重入契约**用例(`plugin/test/client-trajectory.test.mjs`):① 以真实 `locale` 语义(重名抛错)连跑三次 `apply`,每次先释放上一 fiber 的登记,三次都必须干净登记;② 显式记录边界——宿主若**不**先释放就重挂,仍会抛 `already has locale`(所以登记必须留在 `ctx.effect` 内);③ 断言 locale 登记确实被 `ctx.effect` 包住(否则 Cordis 无从释放)。
|
|
84
|
+
这 3 项同时用**变异验证**过:把 `lib/client.js` 改回「无条件登记、丢返回值」的原始写法后,①③ 立刻变红,改回修复版即全绿。
|
|
85
|
+
- P0 已用**宿主门禁的独立复现**验证:对适配前的 5 字段 `Config` 跑宿主 `isVolatilePath`,`reasoningEffort` 判定为 `not volatile` → 写入抛错;补上该字段后 6 个写入路径全部通过。
|
|
86
|
+
- 宿主接缝已逐项在**运行时目录**核对(不是只搜源码):`agent/request-error`(waterfall)、`agent/request`(waterfall)、`agent/disposed`(emit)三者均存在;已删除的 `agent/session-start` 未被本插件引用;`subagents` 服务的 `start` / `startContinuable` 签名与包装点一致。
|
|
87
|
+
|
|
3
88
|
## 1.3.0 (2026-09-22)
|
|
4
89
|
|
|
5
90
|
### Features
|
package/README.en.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
English | [中文](README.md)
|
|
4
4
|
|
|
5
|
-
Pick the default model for subagent delegations in [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness),
|
|
5
|
+
Pick the default model for subagent delegations in [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness), configured through the plugin's own settings card (its Cordis `Config`), stored in the profile's `cordis.patch.yml`.
|
|
6
6
|
|
|
7
7
|
When a subagent is created without an explicit `model`, this plugin injects the configured default — so every `subagent`, `subagent_fork`, and any tool that omits `agentOptions` routes through it. Explicit per-call overrides always win; an absent or incomplete settings section keeps the historical behavior (children inherit the parent route).
|
|
8
8
|
|
|
@@ -82,34 +82,37 @@ Notes:
|
|
|
82
82
|
|
|
83
83
|
## Configuration
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
Use the Web settings card (**Settings → Plugins → dsh-subagent-default-model**).
|
|
86
|
+
|
|
87
|
+
You can also edit the profile patch `~/.dsh/profiles/<profile>/cordis.patch.yml` directly: since DSH 0.1.7 that is where settings live, keyed by this plugin's Loader entry id `dsh-subagent-default-model`:
|
|
86
88
|
|
|
87
89
|
```yaml
|
|
88
|
-
|
|
89
|
-
subagent-default-model
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
strategy: round-robin # round-robin | random
|
|
90
|
+
- id: dsh-subagent-default-model
|
|
91
|
+
name: dsh-subagent-default-model
|
|
92
|
+
config:
|
|
93
|
+
# Single model
|
|
94
|
+
provider: deepseek-official
|
|
95
|
+
model: deepseek-v4-pro
|
|
96
|
+
|
|
97
|
+
# Or multiple models
|
|
98
|
+
provider: deepseek-official
|
|
99
|
+
models:
|
|
100
|
+
- deepseek-v4-pro
|
|
101
|
+
- deepseek-v4-flash
|
|
102
|
+
strategy: round-robin # round-robin | random
|
|
103
|
+
|
|
104
|
+
# Or with per-route reasoning strength
|
|
105
|
+
provider: deepseek-official
|
|
106
|
+
models:
|
|
107
|
+
- model: deepseek-v4-reasoner
|
|
108
|
+
reasoningEffort: high
|
|
109
|
+
- provider: other-provider
|
|
110
|
+
model: gpt-5.6
|
|
111
|
+
reasoningEffort: max
|
|
111
112
|
```
|
|
112
113
|
|
|
114
|
+
> **Upgrading from 0.1.6 or earlier**: the old configuration lived in the `subagent-default-model` section of `~/.dsh/settings.yaml`. 0.1.7 imports that file **once** and renames it to `settings.yaml.imported`, never reading it again. The import uses each section name verbatim as an entry id, while this plugin's entry id is `dsh-subagent-default-model` — so the old section is **not** imported (the host logs `section subagent-default-model … was not imported into entry subagent-default-model`) and the old values survive only in the renamed file. Move them into the `config:` block above by hand.
|
|
115
|
+
|
|
113
116
|
| Field | Type | Default | Description |
|
|
114
117
|
| --- | --- | --- | --- |
|
|
115
118
|
| `provider` | string | — | Provider for string-type model entries. |
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.en.md) | 中文
|
|
4
4
|
|
|
5
|
-
为 [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness) 中的子代理(subagent
|
|
5
|
+
为 [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness) 中的子代理(subagent)派发选择默认模型,可通过插件自己的设置卡片(其 Cordis `Config`)配置,存在 profile 的 `cordis.patch.yml`。
|
|
6
6
|
|
|
7
7
|
当创建子代理时未显式指定 `model`,本插件注入配置的默认模型 —— 因此所有 `subagent`、`subagent_fork` 以及任何省略 `agentOptions` 的工具调用都会经过它。显式传参的覆盖始终生效;配置段缺失或不完整时保持原有行为(子代理继承父会话路由)。
|
|
8
8
|
|
|
@@ -82,31 +82,38 @@ npm install dsh-subagent-default-model
|
|
|
82
82
|
|
|
83
83
|
## 配置
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
优先用 Web 设置卡片(**设置 → 插件 → dsh-subagent-default-model**)。
|
|
86
|
+
|
|
87
|
+
也可以直接编辑 profile 的 patch 文件 `~/.dsh/profiles/<profile>/cordis.patch.yml`:DSH 0.1.7 起设置就存在这里,段名是本插件的 Loader 条目 id `dsh-subagent-default-model`:
|
|
86
88
|
|
|
87
89
|
```yaml
|
|
88
|
-
|
|
89
|
-
subagent-default-model
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
90
|
+
- id: dsh-subagent-default-model
|
|
91
|
+
name: dsh-subagent-default-model
|
|
92
|
+
config:
|
|
93
|
+
# 单模型
|
|
94
|
+
provider: deepseek-official
|
|
95
|
+
model: deepseek-v4-pro
|
|
96
|
+
|
|
97
|
+
# 或多模型
|
|
98
|
+
provider: deepseek-official
|
|
99
|
+
models:
|
|
100
|
+
- deepseek-v4-pro
|
|
101
|
+
- deepseek-v4-flash
|
|
102
|
+
strategy: round-robin # round-robin | random
|
|
103
|
+
|
|
104
|
+
# 带推理强度
|
|
105
|
+
provider: deepseek-official
|
|
106
|
+
models:
|
|
107
|
+
- model: deepseek-v4-reasoner
|
|
108
|
+
reasoningEffort: high
|
|
109
|
+
- provider: other-provider
|
|
110
|
+
model: gpt-5.6
|
|
111
|
+
reasoningEffort: max
|
|
112
|
+
|
|
113
|
+
failoverEnabled: true
|
|
114
|
+
```
|
|
100
115
|
|
|
101
|
-
|
|
102
|
-
subagent-default-model:
|
|
103
|
-
provider: deepseek-official
|
|
104
|
-
models:
|
|
105
|
-
- model: deepseek-v4-reasoner
|
|
106
|
-
reasoningEffort: high
|
|
107
|
-
- provider: other-provider
|
|
108
|
-
model: gpt-5.6
|
|
109
|
-
reasoningEffort: max
|
|
116
|
+
> **从 0.1.6 及更早版本升级**:旧版把配置写在 `~/.dsh/settings.yaml` 的 `subagent-default-model` 段。0.1.7 会在启动时把该文件**一次性导入并改名**为 `settings.yaml.imported`,改名后不再回读。导入按段名直接当条目 id 用,而本插件的条目 id 是 `dsh-subagent-default-model`,因此旧段**不会被导入**(宿主日志留一条 `section subagent-default-model … was not imported into entry subagent-default-model`),旧值只留在改名后的文件里——需要手工搬到上面的 `config:` 里。
|
|
110
117
|
strategy: round-robin # round-robin | random
|
|
111
118
|
```
|
|
112
119
|
|
package/lib/client.js
CHANGED
|
@@ -8,13 +8,22 @@ window.__ModuleLoader__.load({
|
|
|
8
8
|
var React = require("react");
|
|
9
9
|
var primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
10
10
|
var Toast = primitives.Toast;
|
|
11
|
+
// ── 图标族适配(DSH 0.1.7 起重命名)──────────────────────────────────
|
|
12
|
+
// 旧命名以尺寸为后缀(IconChevronDownOutline14),新命名改为粗细语义后缀
|
|
13
|
+
// (IconChevronDownOutlineRegular / …Medium)。按名探测取第一个可用的,
|
|
14
|
+
// 全缺失时由使用点渲染自绘字形——把 undefined 直接交给 React.createElement
|
|
15
|
+
// 会在渲染期抛错。
|
|
16
|
+
var IconChevronDown = primitives.IconChevronDownOutlineRegular
|
|
17
|
+
|| primitives.IconChevronDownOutlineMedium
|
|
18
|
+
|| primitives.IconChevronDownOutline14
|
|
19
|
+
|| null;
|
|
11
20
|
|
|
12
21
|
// ── GitHub 页面(「鼓励一下」链接目标) ──────────────────────────────
|
|
13
22
|
var DSM_GITHUB_URL = "https://github.com/dingminhua/dsh-subagent-default-model";
|
|
14
23
|
|
|
15
24
|
// ── plugin icon (LD brand logo, 64px) ────────────────────────────────
|
|
16
25
|
var DSM_ICON = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAXGUlEQVR4nH1bC7BdVXn+1tr7nHPvzb3JvUloSAQp0JHWoAMttKOCFrWU8irQSbCTQYG21IahnTJUUTsM0FJhZCzCSIcKImOpDkhrhQ5YC7ROB3lUBU3EyCuBFBIIedzcx3ntvTr/a621TwIns3PO3mfvddf/+v7v/9c6DvYKoYBz1cZNYfJpVBcNBm7dcIhj3TBM15VzqAE6XAWEGggVADroOl0byDW+PtRr9E732rl9r2PxOMNsrCogVE7PA0Kge4Lcz5/TGI6v00UaK+h98u4QUA9quIDg4Pe2i2LTsknc++mzZu9cv37VHNaFAveSJICj/9aFUNzrXHXSTwdnznl/Y+X9MaEP1D0A/ToKaUdDASoAK0YVYcLad/G88S6C1aQcOkI2Nj9HylBFBRMYqPUeFp6EDXQfKcIUoud6LQQP59rwrsBEOdhy9KGDK/7j9mUPmBKcCf++Z4YbF6eKLw+6QFioKl/DoYILlXMsHE2KPCCzwlsqoNb3oUw4Kq+2a0k4G4MtXOX3J4HNyulzUkC0eqYI8ZAaQZQSAh9080Qx1m7jHStnL/3B3ctvXbcuFOwBH/p5OG12DA/29leV6wcHeI8hadE1rBldl/6ACs7WMEuz0PIcKawe0Gdzeyf36eTzcOHxVAEpTEQB0QtY0PRZPMYsX+t3tSqBxkteYeHh6qqu6yIsmVhaHHtE7/fu/8fJhzzF/OywunXQR+DJOO9pkLp2NJ64pIXhaOxb/IfmJM29PemSJ+NSzJP1s2dhwmucJ6uaoIYFzVjnkFDhLRTkb2XC03gQTKDrZNjSV1icXwzPv9y99Z5Hw6R/psQnqoniyLBQ1d65IoGiDqZuHwWwzyFzx8xl5RDBZR4uCZc9E8fS+8TdSfHZ2KxAel6VwEIY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ImhcpTpXi2q7UfLeH9fXVqSVsTNiMD+Rh4uraDT2mlpXu8BNaG1etcnN+3T2huPcvWg8dubS6dHJJUfD6bFVXrq5rrw3+tCaXOuGmBENzAzHpu0tvL63uNj8bykdeoCkt8QHL+SqAkRxz60wJcQ9BFh6p7CX8CYEQLtShKocTfmbpRLHs3d1LT7u+9dA99tNZ+yHxBTcNztz0mr9x74I/hnZXhD7F/PCAn6bJz+U0vrPr7K5VJUJZf5/v040NDcG02LGGJVmfOsuxdifg03U9vUZHrPz0fl7p5caGjNkiEmTFUXBooUDbjWGs5TE+Pdyy6vjqijO+MPYACb+efjwdiYsqIewMk+d8tbro1b1uXXehPrYahmn+hZmGgtefqsalNFvU1BpAhM8QXhUlCmgCmihAUnBUQixk6J2eSYqwvM9Iz5sfrApM7LDF7W651oILbef3Tky0Nk2vcfeed0dxp3Nu7h6EYr2sgOL/Aa5OuMdnE5sWAAAAAElFTkSuQmCC";
|
|
17
|
-
var SETTINGS_CSS = ".dsm-model-settings{display:flex;flex-direction:column;gap:14px;margin:0;padding:0}.dsm-model-settings-list{display:flex;flex-direction:column;gap:10px}.dsm-model-settings-route{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) auto;gap:8px;align-items:end;padding:10px;border:1px solid var(--dsw-alias-border-l2,#36373b);border-radius:10px;background:var(--dsw-alias-bg-layer-3,#202126)}.dsm-model-settings-field{display:flex;flex-direction:column;gap:4px;min-width:0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#b8b8b8)}.dsm-model-settings-select{width:100%;max-width:220px;height:32px;padding:0 28px 0 10px;border:1px solid var(--dsw-alias-border-l2,#36373b);border-radius:8px;background:var(--dsw-alias-bg-layer-2,#232529);color:var(--dsw-alias-label-primary,#e6e6e6);font:inherit;font-size:13px;line-height:1.5}.dsm-model-settings-select:focus{outline:2px solid var(--dsw-alias-state-business-primary,#5686fe);outline-offset:1px}.dsm-model-settings-select:disabled{color:var(--dsw-alias-label-tertiary,#999);cursor:default}.dsm-model-settings-remove{height:32px;min-width:32px;border:1px solid var(--dsw-alias-border-l2,#36373b);border-radius:8px;background:transparent;color:var(--dsw-alias-label-secondary,#b8b8b8);cursor:pointer;font-size:16px;line-height:1}.dsm-model-settings-remove:hover{color:var(--dsw-alias-state-error-primary,#ef4444);background:var(--dsw-alias-interactive-bg-hover-danger,rgba(242,90,90,.15))}.dsm-model-settings-options{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.dsm-model-settings-strategy{display:flex;align-items:center;gap:8px;white-space:nowrap;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#b8b8b8)}.dsm-model-settings-strategy .dsm-model-settings-select{max-width:150px}.dsm-model-settings-failover{display:flex;align-items:center;gap:6px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#b8b8b8);cursor:pointer}.dsm-model-settings-failover input[type=checkbox]{cursor:pointer}.dsm-failover-hint{font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary,#999);white-space:nowrap}.dsm-model-settings-footer{border-top:1px solid var(--dsw-alias-border-l2,#36373b);display:flex;align-items:center;justify-content:flex-end;gap:8px;padding:12px 0 4px}.dsm-model-settings-footer-left{display:flex;align-items:center;gap:10px;flex:1;min-width:0}.dsm-model-settings-footer-status{flex:1;min-width:0;color:var(--dsw-alias-label-secondary,#b8b8b8);font-size:12px;line-height:1.5}.dsm-model-settings-footer-error{flex:1;min-width:0;color:var(--dsw-alias-label-error,#ef4444);font-size:12px;line-height:1.5}.dsm-btn{appearance:none;font:inherit;cursor:pointer;border:1px solid transparent;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5}.dsm-btn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#5686fe);outline-offset:1px}.dsm-btn:disabled{opacity:.4;cursor:default}.dsm-btn-outline{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);background:transparent;font-weight:500}.dsm-btn-outline:hover:not(:disabled){color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-dimmed);background:rgba(255,255,255,.04)}.dsm-btn-primary{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3)}.dsm-btn-primary:hover:not(:disabled){opacity:.9}.dsm-model-settings-hint{font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#b8b8b8)}.dsm-plugin-card{border:1px solid var(--dsw-alias-border-l2,#36373b);background:var(--dsw-alias-bg-layer-3,#202126);border-radius:12px;list-style:none;transition:border-color .16s,background .16s}.dsm-plugin-card:hover{border-color:var(--dsw-alias-label-dimmed,#777)}.dsm-plugin-card-open{background:var(--dsw-alias-bg-layer-2,#25262b);border-color:var(--dsw-alias-label-dimmed,#777)}.dsm-plugin-card-header{appearance:none;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:transparent;border:0;border-radius:12px;align-items:center;gap:12px;padding:14px 16px;display:flex}.dsm-plugin-card-header:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#5686fe);outline-offset:-2px}.dsm-plugin-card-head{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}.dsm-plugin-card-title{color:var(--dsw-alias-label-primary,#e6e6e6);font-size:15px;font-weight:600;line-height:1.4}.dsm-plugin-card-description{color:var(--dsw-alias-label-tertiary,#999);font-size:13px;line-height:1.5}.dsm-plugin-card-chevron{color:var(--dsw-alias-label-tertiary,#999);flex:none;display:inline-flex;transition:transform .16s}.dsm-plugin-card-chevron-open{transform:rotate(180deg)}.dsm-plugin-card-body{border-top:1px solid var(--dsw-alias-border-l2,#36373b);margin:0 16px;padding:0 0 8px}.dsm-plugin-card-body .dsm-model-settings{margin:0;padding:12px 0 0;background:transparent;border:0;border-radius:0}.dsm-plugin-card-body .dsm-model-settings-head{display:none}.dsm-plugin-card-icon{width:32px;height:32px;flex:none;border-radius:7px}.dsm-model-settings-cheer{display:inline-flex;align-items:center;gap:4px;flex:none;text-decoration:underline;text-underline-offset:2px;color:var(--dsw-alias-label-tertiary,#999);font-size:13px;line-height:1.5;transition:color .16s}.dsm-model-settings-cheer-star{font-size:12px;line-height:1;display:inline-flex}.dsm-model-settings-cheer:hover{color:var(--dsw-alias-label-primary,#e6e6e6)}.dsm-model-settings-cheer:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#5686fe);outline-offset:2px}.dsm-model-settings-warn{grid-column:1/-1;color:var(--dsw-alias-label-error,#ef4444);font-size:12px;line-height:18px}.dsm-model-settings-warn-list{display:flex;flex-direction:column;gap:4px;color:var(--dsw-alias-label-error,#ef4444);font-size:12px;line-height:18px}";
|
|
26
|
+
var SETTINGS_CSS = ".dsm-model-settings{display:flex;flex-direction:column;gap:14px;margin:0;padding:0}.dsm-model-settings-list{display:flex;flex-direction:column;gap:10px}.dsm-model-settings-route{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) auto;gap:8px;align-items:end;padding:10px;border:1px solid var(--dsw-alias-border-l2,#36373b);border-radius:10px;background:var(--dsw-alias-bg-layer-3,#202126)}.dsm-model-settings-field{display:flex;flex-direction:column;gap:4px;min-width:0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#b8b8b8)}.dsm-model-settings-select{width:100%;max-width:220px;height:32px;padding:0 28px 0 10px;border:1px solid var(--dsw-alias-border-l2,#36373b);border-radius:8px;background:var(--dsw-alias-bg-layer-2,#232529);color:var(--dsw-alias-label-primary,#e6e6e6);font:inherit;font-size:13px;line-height:1.5}.dsm-model-settings-select:focus{outline:2px solid var(--dsw-alias-state-business-primary,#5686fe);outline-offset:1px}.dsm-model-settings-select:disabled{color:var(--dsw-alias-label-tertiary,#999);cursor:default}.dsm-model-settings-remove{height:32px;min-width:32px;border:1px solid var(--dsw-alias-border-l2,#36373b);border-radius:8px;background:transparent;color:var(--dsw-alias-label-secondary,#b8b8b8);cursor:pointer;font-size:16px;line-height:1}.dsm-model-settings-remove:hover{color:var(--dsw-alias-state-error-primary,#ef4444);background:var(--dsw-alias-interactive-bg-hover-danger,rgba(242,90,90,.15))}.dsm-model-settings-options{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.dsm-model-settings-strategy{display:flex;align-items:center;gap:8px;white-space:nowrap;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#b8b8b8)}.dsm-model-settings-strategy .dsm-model-settings-select{max-width:150px}.dsm-model-settings-failover{display:flex;align-items:center;gap:6px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#b8b8b8);cursor:pointer}.dsm-model-settings-failover input[type=checkbox]{cursor:pointer}.dsm-failover-hint{font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary,#999);white-space:nowrap}.dsm-model-settings-footer{border-top:1px solid var(--dsw-alias-border-l2,#36373b);display:flex;align-items:center;justify-content:flex-end;gap:8px;padding:12px 0 4px}.dsm-model-settings-footer-left{display:flex;align-items:center;gap:10px;flex:1;min-width:0}.dsm-model-settings-footer-status{flex:1;min-width:0;color:var(--dsw-alias-label-secondary,#b8b8b8);font-size:12px;line-height:1.5}.dsm-model-settings-footer-error{flex:1;min-width:0;color:var(--dsw-alias-label-error,#ef4444);font-size:12px;line-height:1.5}.dsm-btn{appearance:none;font:inherit;cursor:pointer;border:1px solid transparent;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5}.dsm-btn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#5686fe);outline-offset:1px}.dsm-btn:disabled{opacity:.4;cursor:default}.dsm-btn-outline{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);background:transparent;font-weight:500}.dsm-btn-outline:hover:not(:disabled){color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-dimmed);background:rgba(255,255,255,.04)}.dsm-btn-primary{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3)}.dsm-btn-primary:hover:not(:disabled){opacity:.9}.dsm-model-settings-hint{font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#b8b8b8)}.dsm-plugin-card{border:1px solid var(--dsw-alias-border-l2,#36373b);background:var(--dsw-alias-bg-layer-3,#202126);border-radius:12px;list-style:none;transition:border-color .16s,background .16s}.dsm-plugin-card:hover{border-color:var(--dsw-alias-label-dimmed,#777)}.dsm-plugin-card-open{background:var(--dsw-alias-bg-layer-2,#25262b);border-color:var(--dsw-alias-label-dimmed,#777)}.dsm-plugin-card-header{appearance:none;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:transparent;border:0;border-radius:12px;align-items:center;gap:12px;padding:14px 16px;display:flex}.dsm-plugin-card-header:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#5686fe);outline-offset:-2px}.dsm-plugin-card-head{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}.dsm-plugin-card-title{color:var(--dsw-alias-label-primary,#e6e6e6);font-size:15px;font-weight:600;line-height:1.4}.dsm-plugin-card-description{color:var(--dsw-alias-label-tertiary,#999);font-size:13px;line-height:1.5}.dsm-plugin-card-chevron{color:var(--dsw-alias-label-tertiary,#999);flex:none;display:inline-flex;transition:transform .16s}.dsm-plugin-card-chevron-open{transform:rotate(180deg)}.dsm-plugin-card-caret{color:inherit;font-size:12px;line-height:1;display:inline-flex}.dsm-plugin-card-body{border-top:1px solid var(--dsw-alias-border-l2,#36373b);margin:0 16px;padding:0 0 8px}.dsm-plugin-card-body .dsm-model-settings{margin:0;padding:12px 0 0;background:transparent;border:0;border-radius:0}.dsm-plugin-card-body .dsm-model-settings-head{display:none}.dsm-plugin-card-icon{width:32px;height:32px;flex:none;border-radius:7px}.dsm-model-settings-cheer{display:inline-flex;align-items:center;gap:4px;flex:none;text-decoration:underline;text-underline-offset:2px;color:var(--dsw-alias-label-tertiary,#999);font-size:13px;line-height:1.5;transition:color .16s}.dsm-model-settings-cheer-star{font-size:12px;line-height:1;display:inline-flex}.dsm-model-settings-cheer:hover{color:var(--dsw-alias-label-primary,#e6e6e6)}.dsm-model-settings-cheer:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#5686fe);outline-offset:2px}.dsm-model-settings-warn{grid-column:1/-1;color:var(--dsw-alias-label-error,#ef4444);font-size:12px;line-height:18px}.dsm-model-settings-warn-list{display:flex;flex-direction:column;gap:4px;color:var(--dsw-alias-label-error,#ef4444);font-size:12px;line-height:18px}";
|
|
18
27
|
|
|
19
28
|
if (typeof document !== "undefined") {
|
|
20
29
|
var cssId = "dsh-subagent-default-model/client.css";
|
|
@@ -44,6 +53,8 @@ window.__ModuleLoader__.load({
|
|
|
44
53
|
"row.empty": "尚未指定默认模型,子代理将继承父会话路由。",
|
|
45
54
|
"row.effortDefault": "Default",
|
|
46
55
|
"row.discard": "放弃修改",
|
|
56
|
+
"row.expand": "展开",
|
|
57
|
+
"row.collapse": "收起",
|
|
47
58
|
"row.cheer": "鼓励一下",
|
|
48
59
|
"row.save": "保存",
|
|
49
60
|
"row.saving": "保存中…",
|
|
@@ -75,6 +86,8 @@ window.__ModuleLoader__.load({
|
|
|
75
86
|
"row.effortDefault": "Default",
|
|
76
87
|
"row.empty": "No default model is selected; subagents inherit the parent route.",
|
|
77
88
|
"row.discard": "Discard",
|
|
89
|
+
"row.expand": "Expand",
|
|
90
|
+
"row.collapse": "Collapse",
|
|
78
91
|
"row.cheer": "Star on GitHub",
|
|
79
92
|
"row.save": "Save",
|
|
80
93
|
"row.saving": "Saving…",
|
|
@@ -93,7 +106,56 @@ window.__ModuleLoader__.load({
|
|
|
93
106
|
};
|
|
94
107
|
|
|
95
108
|
// ── helpers ──────────────────────────────────────────────────────────
|
|
96
|
-
|
|
109
|
+
// This plugin's DECLARED Loader entry id = `cordis.patch.yml` `insert.id`.
|
|
110
|
+
// It is the 0.1.7 settings namespace (the plugin's own `Config` is the
|
|
111
|
+
// settings section), and only the fallback here: the Desktop host mounts
|
|
112
|
+
// community bundles as `include:<name>` and `configForms.get()` matches the
|
|
113
|
+
// served-namespace directory EXACTLY. Binding a namespace nothing serves
|
|
114
|
+
// fails silently (`status: unavailable`, no error), so the card would simply
|
|
115
|
+
// never show its values. The real id is resolved by `subagentEntryIdOf()`.
|
|
116
|
+
var SUBAGENT_MODEL_SETTINGS_NS = "dsh-subagent-default-model";
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Resolve the settings namespace the host actually serves for this plugin.
|
|
120
|
+
*
|
|
121
|
+
* Match order: the declared entry id exactly, then a `include:`-prefixed
|
|
122
|
+
* form of it, then the host-served namespace carrying the package name.
|
|
123
|
+
* The legacy section name (`subagent-default-model`, pre-0.1.7
|
|
124
|
+
* `settings.yaml` keying) is deliberately accepted last, so it can only win
|
|
125
|
+
* when it is genuinely the served namespace. Falls back to the declared id
|
|
126
|
+
* while the mirror is not ready.
|
|
127
|
+
*
|
|
128
|
+
* @param {object} forms - the `configForms` client service.
|
|
129
|
+
* @param {Set<string>} [servedNamespaces] - authoritative served-namespace set
|
|
130
|
+
* handed over by `configForms.whileServed(...)`. When present it is preferred
|
|
131
|
+
* over the mirror snapshot, because it is the very set that decided the
|
|
132
|
+
* registration was due — the mirror may still be mid-fold.
|
|
133
|
+
* @returns {string} the namespace to pass to `forms.get()`.
|
|
134
|
+
*/
|
|
135
|
+
function subagentEntryIdOf(forms, servedNamespaces) {
|
|
136
|
+
var pick = function (names) {
|
|
137
|
+
return names.find(function (ns) {
|
|
138
|
+
return ns === SUBAGENT_MODEL_SETTINGS_NS;
|
|
139
|
+
}) ?? names.find(function (ns) {
|
|
140
|
+
return ns === "include:" + SUBAGENT_MODEL_SETTINGS_NS;
|
|
141
|
+
}) ?? names.find(function (ns) {
|
|
142
|
+
return /subagent-default-model/i.test(ns || "");
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
try {
|
|
146
|
+
if (servedNamespaces && typeof servedNamespaces.has === "function") {
|
|
147
|
+
var fromServed = pick(Array.from(servedNamespaces));
|
|
148
|
+
if (typeof fromServed === "string" && fromServed !== "") return fromServed;
|
|
149
|
+
}
|
|
150
|
+
var view = forms.describe().getSnapshot().view;
|
|
151
|
+
var namespaces = ((view && view.namespaces) || []).map(function (entry) {
|
|
152
|
+
return entry && entry.ns;
|
|
153
|
+
});
|
|
154
|
+
var served = pick(namespaces);
|
|
155
|
+
if (typeof served === "string" && served !== "") return served;
|
|
156
|
+
} catch (_e) { /* mirror not ready: the declared id is still the right guess */ }
|
|
157
|
+
return SUBAGENT_MODEL_SETTINGS_NS;
|
|
158
|
+
}
|
|
97
159
|
|
|
98
160
|
function normalizeDefaultModels(value) {
|
|
99
161
|
var result = [];
|
|
@@ -444,7 +506,13 @@ window.__ModuleLoader__.load({
|
|
|
444
506
|
|
|
445
507
|
// ── SubagentModelCard: collapsible card shell (default collapsed) ─────
|
|
446
508
|
function SubagentModelCard(props) {
|
|
447
|
-
|
|
509
|
+
// Family pattern (dsh-ldvh / dsh-connect-workbuddy / dsh-sub-cli): on the
|
|
510
|
+
// Plugins page a card is asked for `view: 'summary'` (a one-line glance)
|
|
511
|
+
// or `view: 'page'` (the form itself). Only the page form should default
|
|
512
|
+
// to open — collapsing a summary keeps the list scannable, while an
|
|
513
|
+
// unopened page form hides the settings the user came for.
|
|
514
|
+
if (props.view === "summary") return props.t("row.desc");
|
|
515
|
+
var openState = React.useState(props.view === "page");
|
|
448
516
|
var open = openState[0];
|
|
449
517
|
var setOpen = openState[1];
|
|
450
518
|
var t = props.t;
|
|
@@ -455,7 +523,7 @@ window.__ModuleLoader__.load({
|
|
|
455
523
|
type: "button",
|
|
456
524
|
className: "dsm-plugin-card-header",
|
|
457
525
|
"aria-expanded": open,
|
|
458
|
-
"aria-label": title,
|
|
526
|
+
"aria-label": t(open ? "row.collapse" : "row.expand") + ": " + title,
|
|
459
527
|
onClick: function () { setOpen(!open); }
|
|
460
528
|
},
|
|
461
529
|
React.createElement("img", { className: "dsm-plugin-card-icon", src: DSM_ICON, alt: "" }),
|
|
@@ -463,7 +531,7 @@ window.__ModuleLoader__.load({
|
|
|
463
531
|
React.createElement("span", { className: "dsm-plugin-card-title" }, title),
|
|
464
532
|
React.createElement("span", { className: "dsm-plugin-card-description" }, description)
|
|
465
533
|
),
|
|
466
|
-
React.createElement("span", { className: "dsm-plugin-card-chevron" + (open ? " dsm-plugin-card-chevron-open" : "") }, React.createElement(
|
|
534
|
+
React.createElement("span", { className: "dsm-plugin-card-chevron" + (open ? " dsm-plugin-card-chevron-open" : "") }, IconChevronDown ? React.createElement(IconChevronDown, { size: 14 }) : React.createElement("span", { className: "dsm-plugin-card-caret" }, "▾"))
|
|
467
535
|
),
|
|
468
536
|
React.createElement("div", { className: "dsm-plugin-card-body", hidden: !open },
|
|
469
537
|
React.createElement(SubagentModelRow, props)
|
|
@@ -472,14 +540,52 @@ window.__ModuleLoader__.load({
|
|
|
472
540
|
}
|
|
473
541
|
|
|
474
542
|
// ── apply: inject settings row ───────────────────────────────────────
|
|
475
|
-
|
|
543
|
+
// `settingsScope` service was REMOVED in DSH 0.1.7 (settings moved to
|
|
544
|
+
// `configForms` + the plugin's own `Config`). Hard-injecting it would keep
|
|
545
|
+
// this whole client plugin from ever applying.
|
|
546
|
+
//
|
|
547
|
+
// `uiConversation` MUST be declared here, not merely read behind a guard:
|
|
548
|
+
// Cordis does not return `undefined` for an undeclared service — reading
|
|
549
|
+
// `ctx.uiConversation` THROWS `cannot get property "uiConversation" without
|
|
550
|
+
// inject`. Because that read sits in the middle of `apply()`, the throw
|
|
551
|
+
// aborted everything AFTER it — including the `ctx.inject(["configForms"])`
|
|
552
|
+
// block that registers the settings card, so the Plugins page showed no
|
|
553
|
+
// configuration section at all. A `if (ctx.foo && …)` guard cannot protect
|
|
554
|
+
// this: evaluating `ctx.foo` is itself the failure.
|
|
555
|
+
//
|
|
556
|
+
// All seven official consumers (ui-chat / ui-plan / ui-deliverables / …)
|
|
557
|
+
// declare it for exactly this reason. Declaring it is safe: the renderer
|
|
558
|
+
// mounts this plugin only once every dependency is available, and
|
|
559
|
+
// `uiConversation` ships in the same client bundle set as `slots`/`locale`,
|
|
560
|
+
// so it cannot be selectively absent while those are present.
|
|
561
|
+
//
|
|
562
|
+
// `configForms` stays soft (via `ctx.inject`) — unlike `uiConversation` it
|
|
563
|
+
// is optional by design, and `ctx.inject` is the API that waits for it
|
|
564
|
+
// without throwing.
|
|
565
|
+
var inject = ["slots", "locale", "uiConversation"];
|
|
476
566
|
|
|
477
567
|
function apply(ctx) {
|
|
478
|
-
// The old `connection.api.llm.models()` seat no longer exists.
|
|
479
|
-
//
|
|
480
|
-
//
|
|
481
|
-
|
|
568
|
+
// The old `connection.api.llm.models()` seat no longer exists. The current
|
|
569
|
+
// model catalog lives on the `remote.session` namespaced service.
|
|
570
|
+
//
|
|
571
|
+
// `remote.session` is mounted ASYNCHRONOUSLY by `remote.$mount()`
|
|
572
|
+
// (`packages/api/gateway/src/client/index.ts`: `remoteServiceKey(ns)` →
|
|
573
|
+
// `remote.<ns>`, mounted from an async `$mount`). Reading it ONCE during
|
|
574
|
+
// `apply` therefore usually captures `undefined` when the gateway has not
|
|
575
|
+
// finished mounting yet — and because the value was captured, the catalog
|
|
576
|
+
// stayed empty for the lifetime of the page. That is what left the
|
|
577
|
+
// Provider/Model dropdowns permanently blank.
|
|
578
|
+
//
|
|
579
|
+
// Resolve it lazily on EVERY call instead, so a late mount is picked up.
|
|
580
|
+
// `remote` is held as the lookup root rather than the leaf so the leaf is
|
|
581
|
+
// re-read per call. The official sibling card declares
|
|
582
|
+
// `inject: ['…','remote','remote.session',…]` to have Cordis wait for it;
|
|
583
|
+
// we stay soft-injected (a missing gateway must not withhold the card)
|
|
584
|
+
// and re-probe instead.
|
|
585
|
+
var remoteRoot = typeof ctx.get === "function" ? ctx.get("remote") : undefined;
|
|
482
586
|
var loadCatalog = function () {
|
|
587
|
+
var sessionRemote = ctx.get ? ctx.get("remote.session") : undefined;
|
|
588
|
+
if (!sessionRemote) sessionRemote = remoteRoot && remoteRoot.session;
|
|
483
589
|
if (!sessionRemote || typeof sessionRemote.modelCatalog !== "function") return Promise.resolve([]);
|
|
484
590
|
return sessionRemote.modelCatalog().then(function (response) {
|
|
485
591
|
if (!response || !response.ok) return [];
|
|
@@ -487,9 +593,27 @@ window.__ModuleLoader__.load({
|
|
|
487
593
|
}).catch(function () { return []; });
|
|
488
594
|
};
|
|
489
595
|
|
|
490
|
-
// Register locale for this component
|
|
491
|
-
|
|
492
|
-
|
|
596
|
+
// Register locale for this component.
|
|
597
|
+
//
|
|
598
|
+
// The host `locale` service THROWS when a namespace already holds a locale
|
|
599
|
+
// (`dsh-client-locale`: `locale namespace "…" already has locale "…"`), and
|
|
600
|
+
// Cordis keeps a fiber's registrations alive while `apply` re-runs for its
|
|
601
|
+
// replacement. Registering unconditionally therefore makes the SECOND
|
|
602
|
+
// apply() of this plugin throw at the top of the function — before either
|
|
603
|
+
// card is registered — so the client half never activates and web boot
|
|
604
|
+
// reports `dsh-subagent-default-model: failed`.
|
|
605
|
+
//
|
|
606
|
+
// `ctx.effect` ties the registration to the current fiber: Cordis disposes
|
|
607
|
+
// it before running the replacement, so a re-apply starts from a clean
|
|
608
|
+
// namespace. Same pattern as `dsh-ldvh`/`dsh-sub-cli`.
|
|
609
|
+
ctx.effect(function () {
|
|
610
|
+
var offZh = ctx.locale.register(SUBAGENT_ROW_LOCALE, "zh", SUBAGENT_ROW_ZH);
|
|
611
|
+
var offEn = ctx.locale.register(SUBAGENT_ROW_LOCALE, "en", SUBAGENT_ROW_EN);
|
|
612
|
+
return function () {
|
|
613
|
+
if (typeof offZh === "function") offZh();
|
|
614
|
+
if (typeof offEn === "function") offEn();
|
|
615
|
+
};
|
|
616
|
+
}, "dsh-subagent-default-model: settings copy");
|
|
493
617
|
|
|
494
618
|
// ── trajectory: surface the subagent model per request ──────────────
|
|
495
619
|
// agent-loop appends a `request/context` frame (provider/model) whenever
|
|
@@ -513,7 +637,7 @@ window.__ModuleLoader__.load({
|
|
|
513
637
|
seq: event.seq,
|
|
514
638
|
time: event.time,
|
|
515
639
|
content: [{ type: "text", text: label }],
|
|
516
|
-
source: { kind: "plugin
|
|
640
|
+
source: { kind: "plugin:dsh-subagent-default-model", form: "notice" }
|
|
517
641
|
};
|
|
518
642
|
},
|
|
519
643
|
update: function (context) { return context.state; },
|
|
@@ -530,7 +654,16 @@ window.__ModuleLoader__.load({
|
|
|
530
654
|
};
|
|
531
655
|
}
|
|
532
656
|
};
|
|
533
|
-
ctx.
|
|
657
|
+
// `ctx.effect` ties the registration to this fiber, so Cordis disposes it
|
|
658
|
+
// before re-running `apply` for a replacement fiber. Registering BARE is
|
|
659
|
+
// wrong here: `ConversationEventRegistry.register` throws
|
|
660
|
+
// `conversation Definition "<kind>" is already registered` on a duplicate
|
|
661
|
+
// kind, so the second apply would abort — taking the settings-card
|
|
662
|
+
// registration below it down with it. Every official consumer wraps this
|
|
663
|
+
// in `ctx.effect` (ui-plan, ui-deliverables, …).
|
|
664
|
+
ctx.effect(function () {
|
|
665
|
+
return ctx.uiConversation.events.register(modelContextDefinition);
|
|
666
|
+
}, "dsh-subagent-default-model: trajectory model row");
|
|
534
667
|
|
|
535
668
|
// ── chat: surface the subagent model in the conversation view ──
|
|
536
669
|
// agent-loop writes a `request/header` frame with a `reason` the first
|
|
@@ -569,7 +702,7 @@ window.__ModuleLoader__.load({
|
|
|
569
702
|
// `summary` is the collapsed row's one-line account (notice form):
|
|
570
703
|
// without it the row only shows the provenance label and hides the
|
|
571
704
|
// model behind expansion.
|
|
572
|
-
source: { kind: "plugin
|
|
705
|
+
source: { kind: "plugin:dsh-subagent-default-model", form: "notice", summary: label },
|
|
573
706
|
provenance: { role: "inject", label: "dsh-subagent-default-model" },
|
|
574
707
|
form: "notice"
|
|
575
708
|
};
|
|
@@ -589,10 +722,19 @@ window.__ModuleLoader__.load({
|
|
|
589
722
|
};
|
|
590
723
|
}
|
|
591
724
|
};
|
|
592
|
-
ctx.
|
|
725
|
+
ctx.effect(function () {
|
|
726
|
+
return ctx.uiConversation.events.register(chatModelDefinition);
|
|
727
|
+
}, "dsh-subagent-default-model: chat model row");
|
|
593
728
|
}
|
|
594
729
|
|
|
595
|
-
|
|
730
|
+
// Resolve the settings scope for this plugin. On DSH 0.1.7+ the settings
|
|
731
|
+
// surface is the plugin's own Loader entry id (`dsh-subagent-default-model`),
|
|
732
|
+
// served by the `configForms` client service (replacing the removed
|
|
733
|
+
// `settingsScope.bind({namespace})`). The namespace the Host actually
|
|
734
|
+
// serves is host-chosen (Desktop mounts it as `include:dsh-subagent-default-model`),
|
|
735
|
+
// so probe the mirror directory and fall back to the declared id rather
|
|
736
|
+
// than guessing — a wrong guess binds to a namespace nothing serves.
|
|
737
|
+
var subagentScope = null;
|
|
596
738
|
var subagentRowInjected = function () {
|
|
597
739
|
return {
|
|
598
740
|
settingsScope: subagentScope,
|
|
@@ -603,20 +745,75 @@ window.__ModuleLoader__.load({
|
|
|
603
745
|
};
|
|
604
746
|
};
|
|
605
747
|
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
748
|
+
// `configForms` is the 0.1.7 client settings surface; soft-inject it so the
|
|
749
|
+
// card simply stays absent when the service is unavailable, instead of
|
|
750
|
+
// blocking the whole client plugin.
|
|
751
|
+
//
|
|
752
|
+
// Register through `whileServed`, NOT a one-shot `forms.get(...)`.
|
|
753
|
+
// The describe mirror loads ASYNCHRONOUSLY (`mirror.ensure()`), so a probe
|
|
754
|
+
// run during `apply` can execute before `view` exists. `subagentEntryIdOf`
|
|
755
|
+
// then sees zero namespaces and falls back to the declared entry id
|
|
756
|
+
// (`dsh-subagent-default-model`) while the Desktop host actually serves
|
|
757
|
+
// `include:dsh-subagent-default-model`. The mismatch makes the host's
|
|
758
|
+
// `ConfigFormController.derive()` park the form at `status: 'unavailable'`
|
|
759
|
+
// — silently, with no error — and `derive()` only re-runs on a mirror
|
|
760
|
+
// change. Because the scope was already captured, the card stayed
|
|
761
|
+
// unavailable FOREVER and its Save button was permanently disabled
|
|
762
|
+
// (`saveDisabled` includes `snap.status !== 'ready'`).
|
|
763
|
+
//
|
|
764
|
+
// `whileServed` re-invokes the registration each time one of the watched
|
|
765
|
+
// namespaces enters the mirror, and hands it the served set — so the
|
|
766
|
+
// namespace is resolved from the authoritative directory at the moment it
|
|
767
|
+
// actually exists. It also disposes the contribution when the namespace
|
|
768
|
+
// goes away. Every official consumer registers this way.
|
|
769
|
+
ctx.inject(["configForms"], function (formsCtx) {
|
|
770
|
+
var forms = formsCtx.configForms;
|
|
771
|
+
|
|
772
|
+
var registerCards = function (namespace) {
|
|
773
|
+
subagentScope = forms.get(namespace);
|
|
774
|
+
var disposers = [];
|
|
775
|
+
var registerCard = function (slotName, key) {
|
|
776
|
+
try {
|
|
777
|
+
disposers.push(ctx.slots.inject(slotName, function () {
|
|
778
|
+
return ctx.slots.register({
|
|
779
|
+
name: slotName,
|
|
780
|
+
key: key,
|
|
781
|
+
locale: SUBAGENT_ROW_LOCALE,
|
|
782
|
+
inject: subagentRowInjected
|
|
783
|
+
}, SubagentModelCard);
|
|
784
|
+
}));
|
|
785
|
+
} catch (error) {
|
|
786
|
+
console.error('[dsh-subagent-default-model] settings card slot "' + slotName + '" failed to register (host provider unaffected):', error);
|
|
787
|
+
}
|
|
788
|
+
};
|
|
789
|
+
// 0.1.7 placement: register under Plugins config surfaces (the old
|
|
790
|
+
// `settings.plugin.item` slot was removed in 0.1.7).
|
|
791
|
+
registerCard("plugins.bundle.config", "dsh-subagent-default-model");
|
|
792
|
+
registerCard("plugins.row.config", "dsh-subagent-default-model#dsh-subagent-default-model");
|
|
793
|
+
return function () {
|
|
794
|
+
while (disposers.length) {
|
|
795
|
+
var off = disposers.pop();
|
|
796
|
+
if (typeof off === "function") off();
|
|
797
|
+
}
|
|
798
|
+
subagentScope = null;
|
|
799
|
+
};
|
|
800
|
+
};
|
|
614
801
|
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
802
|
+
// `whileServed` is the 0.1.7 contract. Fall back to a direct registration
|
|
803
|
+
// only if a host somehow lacks it, so the card still appears.
|
|
804
|
+
if (typeof forms.whileServed === "function") {
|
|
805
|
+
ctx.effect(function () {
|
|
806
|
+
return forms.whileServed(
|
|
807
|
+
[SUBAGENT_MODEL_SETTINGS_NS, "include:" + SUBAGENT_MODEL_SETTINGS_NS],
|
|
808
|
+
function (served) {
|
|
809
|
+
return registerCards(subagentEntryIdOf(forms, served));
|
|
810
|
+
}
|
|
811
|
+
);
|
|
812
|
+
}, "dsh-subagent-default-model: settings cards follow the served namespace");
|
|
813
|
+
} else {
|
|
814
|
+
registerCards(subagentEntryIdOf(forms));
|
|
815
|
+
}
|
|
816
|
+
});
|
|
620
817
|
}
|
|
621
818
|
|
|
622
819
|
// `checkEffortSupport` is exported as a pure test seam (same convention as
|
package/lib/index.js
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
import z from "@deepseek-ai/schemastery";
|
|
2
|
-
import * as dshSettings from "@deepseek-ai/dsh-settings";
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* dsh-subagent-default-model — default model(s) for subagent delegations.
|
|
6
5
|
*
|
|
7
|
-
* Host-plane plugin. It
|
|
8
|
-
*
|
|
6
|
+
* Host-plane plugin. It declares its configurable surface as the plugin's own
|
|
7
|
+
* Cordis `Config` (DSH 0.1.7+ "settings model": a plugin's `Config` IS the
|
|
8
|
+
* settings section). The host projects this `Config` into a settings form keyed
|
|
9
|
+
* by the Loader entry id (`dsh-subagent-default-model`) and writes changes back
|
|
10
|
+
* to the profile patch; volatile fields hot-reload without re-mounting the
|
|
11
|
+
* plugin. This plugin then wraps the host `ctx.subagents` service
|
|
9
12
|
* (`start` / `startContinuable`), so any delegation whose request carries no
|
|
10
13
|
* explicit `agentOptions` (the stock `subagent` / `subagent_fork` tools and
|
|
11
14
|
* every other tool that omits model/provider) creates the child with a
|
|
12
15
|
* configured default model. Explicit per-call overrides (e.g.
|
|
13
|
-
* `subagent_with_model`) always win; an absent or incomplete
|
|
14
|
-
*
|
|
16
|
+
* `subagent_with_model`) always win; an absent or incomplete section keeps the
|
|
17
|
+
* historical behavior: children inherit the parent session route.
|
|
15
18
|
*
|
|
16
19
|
* Multiple models are supported: the `models` list is picked from on every
|
|
17
20
|
* delegation either round-robin (default) or at random (`strategy`), so a
|
|
18
21
|
* batch of parallel subagents spreads across the configured models. The
|
|
19
|
-
* selection is re-evaluated on every call (
|
|
22
|
+
* selection is re-evaluated on every call (live Config reference + live picker
|
|
20
23
|
* state), so configuration changes apply to the very next delegation.
|
|
21
24
|
*
|
|
22
25
|
* The wrap lives on the service, not on any tool, so it covers every
|
|
@@ -38,45 +41,33 @@ import * as dshSettings from "@deepseek-ai/dsh-settings";
|
|
|
38
41
|
*/
|
|
39
42
|
|
|
40
43
|
export const name = "dsh-subagent-default-model";
|
|
41
|
-
// Do not hard-inject `subagents` at the plugin root: DSH
|
|
42
|
-
// service after this row. The settings
|
|
43
|
-
// independently; `apply()` attaches the
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
// Do not hard-inject `subagents` at the plugin root: DSH may mount that
|
|
45
|
+
// service after this row. The settings surface is the declared `Config` (the
|
|
46
|
+
// host projects it independently of any service wave); `apply()` attaches the
|
|
47
|
+
// service wrapper through `ctx.inject()`.
|
|
48
|
+
//
|
|
49
|
+
// There is deliberately no settings-namespace constant here: on 0.1.7 the
|
|
50
|
+
// namespace IS this Loader entry id (`dsh-subagent-default-model`), and the
|
|
51
|
+
// host — not this plugin — owns that mapping. The client resolves the served
|
|
52
|
+
// namespace from the configForms mirror instead of guessing it.
|
|
47
53
|
|
|
48
54
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* DSH 0.1.2-alpha.2 removed the standalone `installSettingsSection` /
|
|
52
|
-
* `settingsNamespace` exports from `@deepseek-ai/dsh-settings` in favor of
|
|
53
|
-
* the `ctx.settings` service seam (`settings.installSection`), and that seam
|
|
54
|
-
* does not exist on older hosts (`settings.register` there, reachable only
|
|
55
|
-
* through the legacy helper). Decide by export presence: a module that still
|
|
56
|
-
* ships the helper (pre-alpha.2 hosts, and DSH Desktop's transitional
|
|
57
|
-
* compatibility patch, where the helper merely delegates to the seam) uses
|
|
58
|
-
* it; otherwise wire the official seam directly. Both paths register the
|
|
59
|
-
* section only once the settings service mounts — the legacy helper itself
|
|
60
|
-
* wraps `ctx.inject(["settings"], …)` — so neither ever blocks the plugin
|
|
61
|
-
* root on service waves.
|
|
55
|
+
* Mark a schema's field as volatile on the DSH lines that support it.
|
|
62
56
|
*
|
|
63
|
-
*
|
|
57
|
+
* `volatile()` exists from schemastery 3.18.4 (the DSH 0.1.7 line, which is the
|
|
58
|
+
* only line whose settings write gate reads the marker). On a host without the
|
|
59
|
+
* method the schema stays byte-identical to the unmarked original (identity
|
|
60
|
+
* no-op), so the plugin still loads — the field simply loses hot-reload
|
|
61
|
+
* semantics rather than breaking the whole plugin at module-eval time.
|
|
64
62
|
*
|
|
65
|
-
* @
|
|
66
|
-
* @
|
|
63
|
+
* @template T
|
|
64
|
+
* @param {object} schema - a schemastery field.
|
|
65
|
+
* @returns {object} the field, marked volatile when supported.
|
|
67
66
|
*/
|
|
68
|
-
export function
|
|
69
|
-
|
|
70
|
-
return (ctx, ns, schema, entry, hooks) => module.installSettingsSection(ctx, ns, schema, entry, hooks);
|
|
71
|
-
}
|
|
72
|
-
return (ctx, ns, schema, entry, hooks) => {
|
|
73
|
-
ctx.inject(["settings"], (settingsCtx) => {
|
|
74
|
-
settingsCtx.settings.installSection(ctx, ns, schema, entry, hooks);
|
|
75
|
-
});
|
|
76
|
-
};
|
|
67
|
+
export function volatileField(schema) {
|
|
68
|
+
return typeof schema?.volatile === "function" ? schema.volatile() : schema;
|
|
77
69
|
}
|
|
78
70
|
|
|
79
|
-
const INSTALL_SETTINGS_SECTION = settingsSectionInstaller(dshSettings);
|
|
80
71
|
/** One model entry: a bare model id (uses the section `provider`) or an explicit `{provider, model}` pair. */
|
|
81
72
|
const MODEL_ENTRY = z.union([
|
|
82
73
|
z.string(),
|
|
@@ -88,13 +79,23 @@ const MODEL_ENTRY = z.union([
|
|
|
88
79
|
]);
|
|
89
80
|
/** Schema of the `subagent-default-model` settings section; an absent section keeps inheriting the parent route. */
|
|
90
81
|
const SUBAGENT_DEFAULT_MODEL_SETTINGS_SCHEMA = z.object({
|
|
91
|
-
provider: z.string(),
|
|
92
|
-
model: z.string(),
|
|
93
|
-
models: z.array(MODEL_ENTRY).default([]),
|
|
94
|
-
strategy: z.union([z.const("round-robin"), z.const("random")]).default("round-robin"),
|
|
95
|
-
failoverEnabled: z.boolean().default(true)
|
|
82
|
+
provider: volatileField(z.string().description("Default provider for subagent runs without an explicit agentOptions")),
|
|
83
|
+
model: volatileField(z.string().description("Default model id; the single-model form, backward compatible")),
|
|
84
|
+
models: volatileField(z.array(MODEL_ENTRY).default([]).description("Multi-model list; picked per strategy on every delegation")),
|
|
85
|
+
strategy: volatileField(z.union([z.const("round-robin"), z.const("random")]).default("round-robin").description("How to pick from `models`")),
|
|
86
|
+
failoverEnabled: volatileField(z.boolean().default(true).description("Retry a subagent request on another pool model after a connection failure")),
|
|
87
|
+
// Must be DECLARED and volatile: the settings write gate rejects every path
|
|
88
|
+
// that is not a declared volatile field (`@deepseek-ai/dsh-settings`
|
|
89
|
+
// `write()` throws `Config field "…" is not volatile`). The client card
|
|
90
|
+
// writes this key as part of EVERY save, so omitting it made every save
|
|
91
|
+
// fail — not just the reasoning-effort field. It also carries the
|
|
92
|
+
// single-model form's effort, which `defaultModel()` reads back.
|
|
93
|
+
reasoningEffort: volatileField(z.string().description("Reasoning effort for the single-model form (`model`)"))
|
|
96
94
|
}).default({});
|
|
97
95
|
|
|
96
|
+
/** The plugin's Cordis Config — on DSH 0.1.7+ this IS the settings section. */
|
|
97
|
+
export const Config = SUBAGENT_DEFAULT_MODEL_SETTINGS_SCHEMA;
|
|
98
|
+
|
|
98
99
|
/** State retained on the raw host service while this plugin fiber is active. */
|
|
99
100
|
const WRAPPED = Symbol.for("dsh-subagent-default-model.wrapped");
|
|
100
101
|
|
|
@@ -128,7 +129,7 @@ function resolveEntry(section, entry) {
|
|
|
128
129
|
|
|
129
130
|
/** Pick the next default model from the live settings section, or undefined to inherit the parent route. */
|
|
130
131
|
function defaultModel(state) {
|
|
131
|
-
const section = state.
|
|
132
|
+
const section = state.getSection?.();
|
|
132
133
|
if (section === void 0 || section === null) return void 0;
|
|
133
134
|
|
|
134
135
|
// Multi-model list wins; pick per strategy.
|
|
@@ -166,7 +167,7 @@ function applyDefaultModel(state, request) {
|
|
|
166
167
|
|
|
167
168
|
/** Read the live failover view: the `models` list as the switch pool and the strategy. */
|
|
168
169
|
function failoverView(state) {
|
|
169
|
-
const section = state.
|
|
170
|
+
const section = state.getSection?.();
|
|
170
171
|
if (section === void 0 || section === null) return void 0;
|
|
171
172
|
if (section.failoverEnabled === false) return void 0;
|
|
172
173
|
const entries = Array.isArray(section.models)
|
|
@@ -351,23 +352,40 @@ function installSubagentWrapper(ctx, state) {
|
|
|
351
352
|
});
|
|
352
353
|
}
|
|
353
354
|
|
|
354
|
-
export function apply(ctx) {
|
|
355
|
+
export function apply(ctx, config) {
|
|
355
356
|
const state = {
|
|
356
|
-
|
|
357
|
-
|
|
357
|
+
rrCursor: 0,
|
|
358
|
+
/**
|
|
359
|
+
* Resolve the live settings section. On DSH 0.1.7+ `config` is the
|
|
360
|
+
* plugin's resolved `Config`; volatile fields arrive as `{ get() }`
|
|
361
|
+
* live references (cosmokit Volatile), so unwrap each before reading.
|
|
362
|
+
* An absent/missing config falls back to the schema default (empty
|
|
363
|
+
* section) — children then inherit the parent route as before.
|
|
364
|
+
*
|
|
365
|
+
* @returns {object|undefined} the current section values.
|
|
366
|
+
*/
|
|
367
|
+
getSection: () => {
|
|
368
|
+
const raw = config === void 0 || config === null ? void 0 : config;
|
|
369
|
+
if (raw === void 0) return void 0;
|
|
370
|
+
const unwrap = (value) => (value !== null && typeof value === "object" && typeof value.get === "function" ? value.get() : value);
|
|
371
|
+
const section = {
|
|
372
|
+
provider: unwrap(raw.provider),
|
|
373
|
+
model: unwrap(raw.model),
|
|
374
|
+
models: unwrap(raw.models),
|
|
375
|
+
strategy: unwrap(raw.strategy),
|
|
376
|
+
failoverEnabled: unwrap(raw.failoverEnabled),
|
|
377
|
+
// Read back too: the single-model form stores its effort here, so
|
|
378
|
+
// dropping the key silently ignored the configured effort.
|
|
379
|
+
reasoningEffort: unwrap(raw.reasoningEffort)
|
|
380
|
+
};
|
|
381
|
+
// Drop any field that resolved to undefined so downstream defaults apply.
|
|
382
|
+
for (const key of Object.keys(section)) {
|
|
383
|
+
if (section[key] === void 0) delete section[key];
|
|
384
|
+
}
|
|
385
|
+
return section;
|
|
386
|
+
}
|
|
358
387
|
};
|
|
359
388
|
|
|
360
|
-
// Register settings independently from the `subagents` service lifecycle.
|
|
361
|
-
// DSH 0.1.2 can mount that service later or in a different service wave; a
|
|
362
|
-
// root-level hard inject would otherwise keep this whole plugin waiting and
|
|
363
|
-
// hide its settings card even though the Client half is already registered.
|
|
364
|
-
INSTALL_SETTINGS_SECTION(ctx, SUBAGENT_DEFAULT_MODEL_SETTINGS_NAMESPACE, SUBAGENT_DEFAULT_MODEL_SETTINGS_SCHEMA, {}, {
|
|
365
|
-
setSource: (current) => {
|
|
366
|
-
state.settingsSource = current;
|
|
367
|
-
},
|
|
368
|
-
onChange: () => {}
|
|
369
|
-
});
|
|
370
|
-
|
|
371
389
|
// Subagent-only failover hooks the agent loop, not the subagents service,
|
|
372
390
|
// so it is installed unconditionally: listeners no-op when the `failover`
|
|
373
391
|
// section is absent/disabled or when the failing agent is the main loop.
|
|
@@ -380,7 +398,6 @@ export function apply(ctx) {
|
|
|
380
398
|
});
|
|
381
399
|
|
|
382
400
|
ctx.effect(() => () => {
|
|
383
|
-
state.settingsSource = void 0;
|
|
384
401
|
state.rrCursor = 0;
|
|
385
402
|
});
|
|
386
403
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-subagent-default-model",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Configure default model routes for DeepSeek Harness subagents, with single-model, round-robin, random, and per-route reasoning-effort options.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deepseek-harness",
|
|
@@ -65,17 +65,17 @@
|
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@deepseek-ai/schemastery": "
|
|
68
|
+
"@deepseek-ai/schemastery": ">=3.18.4 <4.0.0"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"@deepseek-ai/dsh-settings": "
|
|
72
|
-
"@deepseek-ai/dsh-subagent": "
|
|
73
|
-
"@deepseek-ai/dsh-client-connection": "
|
|
74
|
-
"@deepseek-ai/dsh-client-locale": "
|
|
75
|
-
"@deepseek-ai/dsh-client-ui-slots": "
|
|
76
|
-
"@deepseek-ai/dsh-client-ui-primitives": "
|
|
77
|
-
"@deepseek-ai/dsh-client-ui-conversation": "
|
|
78
|
-
"@deepseek-ai/dsh-client-ui-settings": "
|
|
71
|
+
"@deepseek-ai/dsh-settings": ">=0.1.7-rc.1 <0.2.0",
|
|
72
|
+
"@deepseek-ai/dsh-subagent": ">=0.1.7-rc.1 <0.2.0",
|
|
73
|
+
"@deepseek-ai/dsh-client-connection": ">=0.1.7-rc.1 <0.2.0",
|
|
74
|
+
"@deepseek-ai/dsh-client-locale": ">=0.1.7-rc.1 <0.2.0",
|
|
75
|
+
"@deepseek-ai/dsh-client-ui-slots": ">=0.1.7-rc.1 <0.2.0",
|
|
76
|
+
"@deepseek-ai/dsh-client-ui-primitives": ">=0.1.7-rc.1 <0.2.0",
|
|
77
|
+
"@deepseek-ai/dsh-client-ui-conversation": ">=0.1.7-rc.1 <0.2.0",
|
|
78
|
+
"@deepseek-ai/dsh-client-ui-settings": ">=0.1.7-rc.1 <0.2.0"
|
|
79
79
|
},
|
|
80
80
|
"peerDependenciesMeta": {
|
|
81
81
|
"@deepseek-ai/dsh-client-connection": {
|
|
@@ -98,7 +98,8 @@
|
|
|
98
98
|
}
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
|
-
"@deepseek-ai/cordis": "
|
|
102
|
-
"@deepseek-ai/dsh-settings": "^0.1.
|
|
101
|
+
"@deepseek-ai/cordis": "~4.0.4",
|
|
102
|
+
"@deepseek-ai/dsh-settings": "^0.1.7-rc.1",
|
|
103
|
+
"@deepseek-ai/schemastery": "3.18.4"
|
|
103
104
|
}
|
|
104
105
|
}
|