dsh-rolegroup 0.11.3 → 0.11.7

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 CHANGED
@@ -8,6 +8,95 @@
8
8
 
9
9
  ---
10
10
 
11
+ ## [0.11.7] — 2026-11-13
12
+
13
+ 发布前把文档过了一遍,清掉最后几处"旧世界"残留(都不影响行为)。
14
+
15
+ ### Changed
16
+
17
+ - README 中英的致谢段不再提"JSONC 配置格式"(配置文件层已删);
18
+ - AGENTS 架构地图把 `settings-table.js` 的职责从"section ↔ 文件配置"改为"section ↔ 面板覆盖表";
19
+ - AGENTS 的剪枝说明改为"沿链降级到 `deepseek-account` / `deepseek-official`"(链首已是账号);
20
+ - 删掉测试文件里一段描述已删除测试的孤儿注释(还在讲"整层择一")。
21
+
22
+ ---
23
+
24
+ ## [0.11.6] — 2026-11-13
25
+
26
+ 第一次用 `dsh-browser-playwright-codex` 在真浏览器里点了一遍设置页(隔离 profile,不动用户配置)。
27
+
28
+ ### Fixed
29
+
30
+ - **「推理档位」把"模型不可用"说成"该模型不支持"**:目录里没有该模型(凭据缺失 / provider 未注册)时
31
+ `modelInfo` 存在但 `available === false`,代码却断言它不支持推理档位。现在分两种:`available === false`
32
+ 显示「模型不可用」,只有目录明确声明无档位时才说「该模型不支持推理档位」。
33
+
34
+ ### 验证(浏览器实测,dsh 0.2.2-rc.3 + dsh-browser-playwright-codex 0.8.3)
35
+
36
+ - 官方推荐态:状态行「当前生效:官方推荐(内置表)」、8 行、`保存`/`放弃` 禁用、`恢复官方推荐` 不渲染;
37
+ - 新增角色 → 「未保存」+ 两个按钮可用;带空 provider 保存 → 页内「保存失败:请检查标红字段后重试」,
38
+ **未发起写入**;删除该行 → 标记消失;
39
+ - 改一行后保存 → 状态变「面板自定义(8 行覆盖)」,`恢复官方推荐` 出现;
40
+ - 点「恢复官方推荐」→ 回到官方推荐态,行内容回到出厂值,按钮消失;profile patch 落盘为
41
+ `enabled: true` + `roles: []`;
42
+ - 改一行后点「放弃」→ 值回到生效值,「未保存」消失;
43
+ - 内层滚动生效:头部与状态行固定、列表独立滚动、动作区固定在底部。
44
+
45
+ ---
46
+
47
+ ## [0.11.5] — 2026-11-13
48
+
49
+ dsh 升到 **0.2.2-rc.3**(跨了 `0.2.1-rc.3` → `0.2.2-rc.1` 四个升级目录)。按升级文档逐条核对,只命中
50
+ 两个 subagent 相关变更,都不影响本插件;真机实测也通过。
51
+
52
+ ### Changed
53
+
54
+ - README 中英的"本机实测"版本改为 0.2.2-rc.3(`engines.dsh` 保持 `>=0.2.1-rc.1`)。
55
+ - AGENTS 补充一条坑:dsh 升级后 `link:deps` 若报「已存在且不是软链」,说明本地留着一份旧版 schemastery
56
+ 真实副本(这次是 3.18.5 vs 部署树 3.19.0),两边不一致会让 settings 表单行为异常。删掉重跑即可。
57
+
58
+ ### 验证(0.2.2-rc.3 真机)
59
+
60
+ - 启动报告 8/8 注册,`failed` / `invalid` / `problems` 全空;
61
+ - 委派链路实测:`scout` 子会话 header `agentPreset=rolegroup-scout`、depth 1,正常调用 `glob` + `read`
62
+ 并返回正确结果,`turn/end: completed`;
63
+ - `npm test` 138 passed(含 engines 覆盖断言)。
64
+
65
+ ### 核对过的升级项(均不适用)
66
+
67
+ `subagent-names`(改的是调用参数与 `list_agents` 行格式,我们不消费)、`subagent-explicit-reasoning`
68
+ (要求调用时 provider/model 同时给出;我们把两者写在实例 Config 里,且 `modelSelectionSettings: false`)、
69
+ `model-listing-refresh`(我们没有自建列表缓存)、`context-menu` / `css-anchored-menus`(不使用菜单)。
70
+
71
+ ---
72
+
73
+ ## [0.11.4] — 2026-11-13
74
+
75
+ 发布前的干净环境实测:在隔离 DSH_HOME、没有任何 qwen/kimi 凭据的机器上装 0.11.3,**8 个角色只注册了
76
+ 2 个**,6 个被剪枝。市场审核装的大概率就是这种环境。
77
+
78
+ ### Fixed
79
+
80
+ - **备用链比主路由严格**:主路由「provider 在册、模型不在广告列表」是宽容的(照用 + 警告),但链上的
81
+ 候选会被直接跳过。凭据缺失时模型列表为空,于是整条链不可用 → 角色被剪枝。现在链与主路由同口径:
82
+ 记下第一个"provider 在册、模型未广告"的候选并降级过去(带 `warning: 'model-unadvertised'`)。
83
+ 同一环境修复后 **8/8 注册、6 个标降级到 `deepseek-account/deepseek-flash`**。
84
+ - 剪枝原因、doctor 的修复建议、面板层级说明仍在让用户去改 `rolegroup.jsonc`(v0.11 起已不生效),
85
+ 并复述旧的三层优先级。统统改为指向「设置 → 角色配置」/ 两层模型。
86
+ - README 的目录表还列着已删除的 `config-info.js`、`config-file.js`。
87
+
88
+ ### Changed
89
+
90
+ - 官方推荐态下不再渲染灰着的「恢复官方推荐」——与「补齐」按钮同一条规则:没活干就不显示。
91
+
92
+ ### Added
93
+
94
+ - compose 级断言:干净环境(仅两个 DeepSeek provider、`listModels` 恒空)必须 8/8 在册、`invalid` 为空、
95
+ 恰 6 条带 `primary` 的降级记录。证伪:去掉链宽容 → 「2 !== 8」红。
96
+ - 断言:剪枝原因不得出现 `rolegroup.jsonc` 且必须指向设置面板;自定义态才渲染「恢复官方推荐」。
97
+
98
+ ---
99
+
11
100
  ## [0.11.3] — 2026-11-13
12
101
 
13
102
  README 大扫除。用户逐条指出哪几段该删:中文从 422 行降到 205 行,英文同比。
package/README.en.md CHANGED
@@ -7,7 +7,7 @@ instance, so the tool name is the role name.
7
7
  The role/category binding is inspired by
8
8
  [oh-my-openagent](https://github.com/code-yeongyu/oh-my-openagent) ("omo"); see §9.
9
9
 
10
- > Version **0.11.3** | dsh **≥ 0.2.1-rc.1** (verified on 0.2.1-rc.3) | MIT
10
+ > Version **0.11.7** | dsh **≥ 0.2.1-rc.1** (verified on 0.2.2-rc.3) | MIT
11
11
 
12
12
  ---
13
13
 
@@ -218,15 +218,15 @@ Layout:
218
218
 
219
219
  | Path | Contents |
220
220
  |---|---|
221
- | `lib/` | Host side: `index.js` (composition/recomposition), `roles.js` (role table and merge), `config.js` (settings `Config`), `config-info.js` (config snapshot + read-only route), `doctor.js`, `command.js` |
222
- | `src/client/` | Client sources (`controller.js` / `card.jsx` / `locales.js` / `meta.js` / `config-file.js`); `lib/client.js` is the esbuild artifact and must be rebuilt after edits |
221
+ | `lib/` | Host side: `index.js` (composition/recomposition), `roles.js` (role table and merge), `config.js` (settings `Config`), `settings-table.js` (override table ↔ section), `init.js` (`/rolegroup init` export), `doctor.js`, `command.js` |
222
+ | `src/client/` | Client sources (`controller.js` / `card.jsx` / `locales.js` / `meta.js`); `lib/client.js` is the esbuild artifact and must be rebuilt after edits |
223
223
  | `tests/` | Offline smoke suite (plain Node, no browser) |
224
224
  | `scripts/` | `build-client.mjs` (esbuild bundle; injects the `package.json` version) and `link-deployment-deps.mjs` (environment symlink) |
225
225
  | `locale/` | Plugin metadata: `meta.title` and `meta.description` in `en.json` / `zh.json`, shown by the Plugins page and the Plugin Market |
226
226
 
227
227
  ## 8. Credits
228
228
 
229
- The role (category) to model binding, the JSONC config format, and the rule that role subagents cannot
229
+ The role (category) to model binding, the persona convention, and the rule that role subagents cannot
230
230
  delegate again are inspired by [oh-my-openagent](https://github.com/code-yeongyu/oh-my-openagent) ("omo"). The
231
231
  model pairings are not copied from omo; this plugin's bindings are decided by its own configuration and
232
232
  evaluation.
package/README.md CHANGED
@@ -6,7 +6,7 @@ dsh 的角色化委派插件。先定义角色(名字、绑定模型、persona
6
6
  角色/类别绑定的思路参考了 [oh-my-openagent](https://github.com/code-yeongyu/oh-my-openagent)(omo),
7
7
  详见 §9。
8
8
 
9
- > 版本 **0.11.3** | 要求 dsh **≥ 0.2.1-rc.1**(本机实测 0.2.1-rc.3)| MIT
9
+ > 版本 **0.11.7** | 要求 dsh **≥ 0.2.1-rc.1**(本机实测 0.2.2-rc.3)| MIT
10
10
 
11
11
  ---
12
12
 
@@ -200,15 +200,15 @@ npm run build:client # 改了 src/client/** 或 lib/roles.js 后重建 lib/clie
200
200
 
201
201
  | 路径 | 内容 |
202
202
  |---|---|
203
- | `lib/` | 宿主侧:`index.js`(装配/重组装)、`roles.js`(角色表与合并)、`config.js`(settings `Config`)、`config-info.js`(「配置文件」快照 + 只读路由)、`doctor.js`、`command.js` |
204
- | `src/client/` | 客户端源码(`controller.js` / `card.jsx` / `locales.js` / `meta.js` / `config-file.js`);`lib/client.js` 是 esbuild 产物,改完要重建 |
203
+ | `lib/` | 宿主侧:`index.js`(装配/重组装)、`roles.js`(角色表与合并)、`config.js`(settings `Config`)、`settings-table.js`(覆盖表 ↔ section)、`init.js`(`/rolegroup init` 导出)、`doctor.js`、`command.js` |
204
+ | `src/client/` | 客户端源码(`controller.js` / `card.jsx` / `locales.js` / `meta.js`);`lib/client.js` 是 esbuild 产物,改完要重建 |
205
205
  | `tests/` | 离线 smoke suite(Node 直跑,不需要浏览器) |
206
206
  | `scripts/` | `build-client.mjs`(esbuild 打包,注入 `package.json` 的版本号)、`link-deployment-deps.mjs`(环境软链) |
207
207
  | `locale/` | 插件元数据:`en.json` / `zh.json` 里的 `meta.title` 与 `meta.description`,供插件页与插件市场显示本地化名称和说明 |
208
208
 
209
209
  ## 8. 参考与致谢
210
210
 
211
- 角色(类别)到模型的绑定方式、JSONC 配置格式,以及角色子代理不能再委派这条约束,参考了
211
+ 角色(类别)到模型的绑定方式与 persona 约定,以及角色子代理不能再委派这条约束,参考了
212
212
  [oh-my-openagent](https://github.com/code-yeongyu/oh-my-openagent)(omo)。模型搭配没有照搬 omo 的
213
213
  结论;本插件的绑定按自己的配置和评测决定。
214
214
 
package/lib/client.js CHANGED
@@ -33,7 +33,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
33
33
  var PLUGIN_VERSION, PLUGIN_REPO_URL;
34
34
  var init_meta = __esm({
35
35
  "src/client/meta.js"() {
36
- PLUGIN_VERSION = true ? "0.11.3" : "dev";
36
+ PLUGIN_VERSION = true ? "0.11.7" : "dev";
37
37
  PLUGIN_REPO_URL = "https://github.com/zhouxnsz/dsh-rolegroup";
38
38
  }
39
39
  });
@@ -180,7 +180,18 @@ function RolegroupCard(props) {
180
180
  row.reasoningEffort !== "" && !efforts.some((effort) => effort.id === row.reasoningEffort) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: row.reasoningEffort, children: row.reasoningEffort }) : null
181
181
  ]
182
182
  }
183
- ) : catalogReady && modelInfo !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { value: row.reasoningEffort, disabled: true, placeholder: t("reasoningEffortUnsupported") }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
183
+ ) : catalogReady && modelInfo !== void 0 ? (
184
+ // available === false means the model is missing from the catalog (missing credentials or
185
+ // an unregistered provider); its effort levels are unknown, so do not claim "unsupported".
186
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
187
+ "input",
188
+ {
189
+ value: row.reasoningEffort,
190
+ disabled: true,
191
+ placeholder: modelInfo.available === false ? t("modelUnavailable") : t("reasoningEffortUnsupported")
192
+ }
193
+ )
194
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
184
195
  "input",
185
196
  {
186
197
  value: row.reasoningEffort,
@@ -256,7 +267,7 @@ function RolegroupCard(props) {
256
267
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-rg-actions", children: [
257
268
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "dsh-rg-save", disabled: disabled || !state.dirty, onClick: props.save, children: t("save") }),
258
269
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", disabled: disabled || !state.dirty, onClick: props.discard, children: t("discard") }),
259
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", disabled: disabled || state.mode === "official", onClick: props.restoreOfficial, children: t("restoreOfficial") })
270
+ state.mode === "custom" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", disabled, onClick: props.restoreOfficial, children: t("restoreOfficial") }) : null
260
271
  ] }),
261
272
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dsh-rg-liveHint", children: t("liveHint") })
262
273
  ] })
@@ -530,8 +541,8 @@ var RolegroupCardController = class {
530
541
  }
531
542
  /**
532
543
  * 当前生效行(未被草稿覆盖时的基准)。
533
- * 面板已接管(或面板层已存了行)时用 settings 层的 roles;否则用 host 快照预填的
534
- * jsonc / 内置生效表。这样未接管时页面默认就有内容,而不是一张空表。
544
+ * 面板已接管(或面板层已存了行)时用 settings 层的 roles;否则用内置表
545
+ * (客户端已打包 DEFAULT_ROLES,不请求宿主)。
535
546
  */
536
547
  effectiveRows() {
537
548
  const snapshot = this.scope.getSnapshot();
@@ -708,7 +719,6 @@ var RolegroupCardController = class {
708
719
  if (landed) this.clearDraft();
709
720
  this.publish();
710
721
  }
711
- /** 重置为文件配置:清用户层的 enabled + roles → 真正退出接管,回落 jsonc 链。 */
712
722
  /**
713
723
  * 恢复官方推荐:**零覆盖**接管。
714
724
  *
@@ -910,7 +920,8 @@ var zh = {
910
920
  fieldModel: "\u6A21\u578B",
911
921
  fieldReasoningEffort: "\u63A8\u7406\u6863\u4F4D",
912
922
  reasoningEffortDefault: "\u9ED8\u8BA4",
913
- reasoningEffortUnsupported: "\u8BE5\u6A21\u578B\u4E0D\u652F\u6301",
923
+ reasoningEffortUnsupported: "\u8BE5\u6A21\u578B\u4E0D\u652F\u6301\u63A8\u7406\u6863\u4F4D",
924
+ modelUnavailable: "\u6A21\u578B\u4E0D\u53EF\u7528",
914
925
  fieldPersona: "\u4EBA\u683C\u8BBE\u5B9A",
915
926
  fieldSummary: "\u804C\u8D23\u6458\u8981",
916
927
  github: "GitHub",
@@ -935,7 +946,7 @@ var zh = {
935
946
  layerSummary: "\u914D\u7F6E\u5C42\u7EA7\u8BF4\u660E",
936
947
  // 这里是 UI 文案(React 按**纯文本**渲染,不解析 markdown)——强调只能用「」,
937
948
  // 写 **xxx** 会被原样显示成星号(2026-10-20 真机截图发现)。默认折叠,不占版面。
938
- layerNote: "\u4F18\u5148\u7EA7\uFF1A\u672C\u9762\u677F > \u9879\u76EE rolegroup.jsonc > \u7528\u6237 rolegroup.jsonc > \u5185\u7F6E\u8868\u3002\u4FDD\u5B58\u4F1A\u628A\u5F53\u524D\u751F\u6548\u8868\u6574\u5C42\u5199\u5165\u9762\u677F\u5E76\u63A5\u7BA1\uFF1B\u300C\u91CD\u7F6E\u4E3A\u6587\u4EF6\u914D\u7F6E\u300D\u53EF\u9000\u51FA\u63A5\u7BA1\u3002\u5B8C\u6574\u751F\u6548\u8868\u89C1 /rolegroup doctor\u3002"
949
+ layerNote: "\u4E24\u5C42\uFF1A\u672C\u9762\u677F\u7684\u8986\u76D6 > \u5185\u7F6E\u8868\u3002\u9762\u677F\u6CA1\u6709\u8986\u76D6\u65F6\uFF0C\u751F\u6548\u7684\u5C31\u662F\u5185\u7F6E\u8868\uFF1B\u300C\u6062\u590D\u5B98\u65B9\u63A8\u8350\u300D\u4F1A\u6E05\u7A7A\u6240\u6709\u8986\u76D6\u3002\u5B8C\u6574\u751F\u6548\u8868\u89C1 /rolegroup doctor\u3002"
939
950
  };
940
951
  var en = {
941
952
  title: "Role Routing",
@@ -954,7 +965,8 @@ var en = {
954
965
  fieldModel: "Model",
955
966
  fieldReasoningEffort: "Reasoning effort",
956
967
  reasoningEffortDefault: "Default",
957
- reasoningEffortUnsupported: "Not supported by this model",
968
+ reasoningEffortUnsupported: "This model has no reasoning levels",
969
+ modelUnavailable: "Model unavailable",
958
970
  fieldPersona: "Persona",
959
971
  fieldSummary: "Summary",
960
972
  github: "GitHub",
@@ -977,7 +989,7 @@ var en = {
977
989
  emptyNotTakeover: "No editable roles; add one manually.",
978
990
  emptyTakeover: "No overrides: every role uses the built-in table.",
979
991
  layerSummary: "How the layers work",
980
- layerNote: "Precedence: this panel > project rolegroup.jsonc > user rolegroup.jsonc > built-in table. Saving writes the active table into this panel and takes over the whole layer; Reset to file config exits takeover. See /rolegroup doctor for the effective table."
992
+ layerNote: 'Two layers: panel overrides > built-in table. With no override in the panel, the built-in table applies; "Restore official defaults" clears every override. See /rolegroup doctor for the effective table.'
981
993
  };
982
994
 
983
995
  // src/client/index.js
package/lib/doctor.js CHANGED
@@ -40,7 +40,7 @@ export function startupReportPath(env = process.env, homedir = osHomedir()) {
40
40
  * @property {string | null} time
41
41
  * @property {string | null} configSource
42
42
  * @property {string | null} configError
43
- * @property {number | null} configMtimeMs 生效 jsonc 配置文件的 mtime(加性字段,有限 number 否则 null)。
43
+ * @property {number | null} configMtimeMs 恒为 null(v0.11 起没有配置文件层;字段保留以维持报告仅加性)。
44
44
  * 仅当生效来源**就是那个文件**时非 null;settings 面板接管 / 内置默认表时恒 null
45
45
  * (写入侧 lib/index.js writeReport 已按来源把关——否则会把被整层让位的文件年龄算到面板头上)。
46
46
  * @property {NormalizedEntry[]} registered
@@ -334,7 +334,7 @@ export function auditRoles(report, opts) {
334
334
  } else {
335
335
  modelOk = false
336
336
  issues.push(`模型 "${role.model}" 不在 ${role.provider} 的广告列表(候选:${models.slice(0, 5).join(', ') || '(空)'})`)
337
- hints.push(`检查 rolegroup.jsonc 中 ${role.toolName} 的 model 是否拼写错误,或改用上述候选模型之一`)
337
+ hints.push(`检查「设置 → 角色配置」里 ${role.toolName} 的 model 是否拼写错误,或改用上述候选模型之一`)
338
338
  // AC-25 近似模型名建议(提示级):edit-distance ≤2 或互为前缀 → 追加「是否想用」,
339
339
  // 追加到已有 hint 上,不改变 healthy/unhealthy 计数
340
340
  const similar = similarModels(role.model, models)
@@ -356,12 +356,12 @@ export function auditRoles(report, opts) {
356
356
  const errorSuffix = configurable.error ? `:${configurable.error}` : '' // error 原样带上
357
357
  issues.push(`provider ${name} 路由已声明但未激活${errorSuffix}(在用:${inUse})`)
358
358
  hints.push(configurable.settingsNs
359
- ? `① 到 GUI 设置页「${configurable.settingsNs}」一节补全/启用该 provider(多半是 key 缺失或额度问题),随后重载插件;② 或在 rolegroup.jsonc 把 ${role.toolName} 改用已激活 provider(在用:${inUse})`
360
- : `① 补全/启用 ${role.provider} 的配置(多半是 key 缺失或额度问题),随后重载插件;② 或在 rolegroup.jsonc 把 ${role.toolName} 改用已激活 provider(在用:${inUse})`)
359
+ ? `① 到 GUI 设置页「${configurable.settingsNs}」一节补全/启用该 provider(多半是 key 缺失或额度问题),随后重载插件;② 或在「设置 → 角色配置」把 ${role.toolName} 改用已激活 provider(在用:${inUse})`
360
+ : `① 补全/启用 ${role.provider} 的配置(多半是 key 缺失或额度问题),随后重载插件;② 或在「设置 → 角色配置」把 ${role.toolName} 改用已激活 provider(在用:${inUse})`)
361
361
  } else {
362
362
  issues.push(`provider "${role.provider}" 当前未注册(在用:${inUse})`)
363
363
  // actionable 风格对齐 lib/index.js validateRoutes:带上实际在用的 provider 列表
364
- hints.push(`① 检查 ${role.provider} 适配器的 key/额度;② 或在 rolegroup.jsonc 把 ${role.toolName} 改用已注册 provider(在用:${inUse})`)
364
+ hints.push(`① 检查 ${role.provider} 适配器的 key/额度;② 或在「设置 → 角色配置」把 ${role.toolName} 改用已注册 provider(在用:${inUse})`)
365
365
  }
366
366
  }
367
367
  verdicts.push({
@@ -394,11 +394,11 @@ export function auditRoles(report, opts) {
394
394
  reportIssues.push({
395
395
  category: 'invalid',
396
396
  issue: `${report.invalid.length} 个角色在上次启动剪枝时被移除:${names}`,
397
- hint: '这些角色的 provider 上次启动时未注册;检查对应 provider 配置(key/额度),或在 rolegroup.jsonc 改用可用 provider',
397
+ hint: '这些角色的 provider 上次启动时未注册;检查对应 provider 配置(key/额度),或在「设置 → 角色配置」改用可用 provider',
398
398
  })
399
399
  }
400
400
  if (Array.isArray(report?.problems) && report.problems.length > 0) {
401
- const source = typeof report.configSource === 'string' ? report.configSource : 'rolegroup.jsonc'
401
+ const source = typeof report.configSource === 'string' ? report.configSource : '内置表'
402
402
  reportIssues.push({
403
403
  category: 'problems',
404
404
  issue: `配置有 ${report.problems.length} 处问题:${report.problems.join(';')}`,
@@ -416,7 +416,7 @@ export function auditRoles(report, opts) {
416
416
  toolName,
417
417
  issue: `角色 ${toolName} 未在册(可能被剪枝或配置删除)`,
418
418
  // 措辞避开「修复」二字:提示级 ⚠️ 不该触发既有 AC-15「全绿产物不含 修复」的断言口径
419
- hint: `若是有意从 rolegroup.jsonc 删除可忽略;否则检查 ${toolName} 的 provider 是否可用(被剪枝)或配置被误删,随后重载插件/重启 dsh web`,
419
+ hint: `若是有意移除可忽略;否则检查 ${toolName} 的 provider 是否可用(被剪枝)或配置被误删,随后重载插件/重启 dsh web`,
420
420
  }))
421
421
 
422
422
  const healthy = verdicts.filter((v) => v.providerOk === true && v.modelOk === true && v.issues.length === 0).length
@@ -512,7 +512,7 @@ export function renderDoctorText(state, audit, opts) {
512
512
  const primary = typeof r.primary === 'string' ? r.primary : '(未知)'
513
513
  lines.push(`⚠️ ${r.toolName}:主路由 ${primary} 不可用,已用内置备用档 ${r.provider}/${r.model}`)
514
514
  }
515
- lines.push(' 如需固定路由,请在 rolegroup.jsonc 里改该角色的 provider/model(显式配置不做自动降级)。')
515
+ lines.push(' 如需固定路由,请在「设置 → 角色配置」里改该角色的 provider/model(显式配置不做自动降级)。')
516
516
  }
517
517
 
518
518
  // AC-24 内置角色缺席提示:⚠️ 提示级(同 T4 anomalies 口径,不计入 unhealthy、不出 ❌ 块)
package/lib/index.js CHANGED
@@ -11,10 +11,8 @@
11
11
  // (详见 lib/roles.js 头注);只读改由 persona 软约束 + 会话级 permission preset 承担
12
12
  // - 配置启动时读一次,不热生效(R1);改配置需重载插件/新会话
13
13
  //
14
- // 配置文件查找顺序(第一个命中即停):
15
- // 1. <启动 cwd>/.dsh/rolegroup.jsonc (项目级)
16
- // 2. $DSH_HOME/rolegroup.jsonc (用户级,DSH_HOME 缺省 ~/.dsh)
17
- // 都没有则用内置默认表(lib/roles.js DEFAULT_ROLES)。
14
+ // 配置只有两层(v0.11 起):settings 面板覆盖 + 内置默认表(lib/roles.js DEFAULT_ROLES)。
15
+ // 没有配置文件层——rolegroup.jsonc 不再被读取。
18
16
  //
19
17
  // 启动校验(proposal §4「已知坑」修订版):
20
18
  // 源码审计(L1):modelSelectionSettings:false 时白名单 assertAllowedModelSelection
@@ -163,7 +161,7 @@ function dshHome() {
163
161
  }
164
162
 
165
163
 
166
- /** 解析 persona 的 file:// 外链(相对配置文件目录)。 */
164
+ /** 解析 persona 的 file:// 外链(相对 configSource 目录)。面板层是内联 persona,调用方传 undefined。 */
167
165
  async function resolvePersonaFiles(ctx, roles, configSource) {
168
166
  for (const role of roles) {
169
167
  if (role.personaFile === undefined) continue
@@ -216,7 +214,7 @@ async function validateRoutes(ctx, roles) {
216
214
  invalid.push({
217
215
  role,
218
216
  reason: `没有可用路由:${tried || '(无候选)'}。已注册 provider:${providerIds.join(', ') || '(无)'};`
219
- + '请在 rolegroup.jsonc 里改 provider/model,或给该角色加 fallbackModels',
217
+ + '请在「设置 → 角色配置」里改 provider/model,或给该角色加 fallbackModels',
220
218
  })
221
219
  continue
222
220
  }
@@ -378,7 +376,7 @@ async function apply(ctx, optionsOrConfig) {
378
376
  const writeReport = async (valid, invalid, configSource) => {
379
377
  // 启动报告落盘:cordis logger 在本部署不走 stdout(export 器在 client 侧),
380
378
  // 终端排障/自动化验收以本文件为准(插件状态目录惯例 $DSH_HOME/plugins/<pkg>)。
381
- // configSource 缺省 = 配置文件路径(v0.1 文案不变);settings 重组装时由 compose 传入标注值(D2/T2)。
379
+ // configSource:settings 面板标注值 或 null(= 内置表)。v0.11 起没有配置文件路径这一态。
382
380
  try {
383
381
  const stateDir = join(dshHome(), 'plugins', 'dsh-rolegroup')
384
382
  await mkdir(stateDir, { recursive: true })
package/lib/roles.js CHANGED
@@ -31,7 +31,7 @@ export function readonlyDeprecationProblem(toolName) {
31
31
  export const SUBAGENT_PROVIDER = 'spawn'
32
32
 
33
33
  /**
34
- * 内置默认角色表。字段即 `.dsh/rolegroup.jsonc` 每角色的可覆盖项。
34
+ * 内置默认角色表。字段即面板每行可覆盖的项。
35
35
  * reasoningEffort 缺省省略(让提供方用模型默认档位,避免预检不支持而失败)。
36
36
  */
37
37
  export const DEFAULT_ROLES = {
@@ -153,8 +153,8 @@ function genericPersona(toolName) {
153
153
  }
154
154
 
155
155
  /**
156
- * 合并配置文件与内置默认表,产出最终角色列表。
157
- * @param {object|undefined} fileConfig - 解析后的 rolegroup.jsonc(可为空)
156
+ * 合并面板覆盖与内置默认表,产出最终角色列表。
157
+ * @param {object|undefined} fileConfig - 面板覆盖(sectionToFileConfig 的产物,可为空)
158
158
  * @returns {{ roles: Array<object>, problems: string[] }}
159
159
  * roles 元素:{ toolName, provider, model, reasoningEffort?, persona, summary, custom }
160
160
  * problems:配置级错误(未知字段类型、缺 provider/model、工具名非法、**已废弃字段**等),对应角色被跳过
@@ -276,6 +276,7 @@ export function resolveRoleRoute(role, availability = {}) {
276
276
  }
277
277
  const tried = []
278
278
  let unadvertisedPrimary
279
+ let unadvertisedChain
279
280
  for (const [index, candidate] of candidates.entries()) {
280
281
  const route = `${candidate.provider}/${candidate.model}`
281
282
  if (!providers.has(candidate.provider)) {
@@ -286,7 +287,10 @@ export function resolveRoleRoute(role, availability = {}) {
286
287
  try { models = modelsOf?.(candidate.provider) } catch { models = undefined }
287
288
  if (Array.isArray(models) && !models.includes(candidate.model)) {
288
289
  tried.push({ route, reason: 'model' })
290
+ // 与主路由同等宽容:provider 已注册、只是模型不在广告列表(凭据缺失/列表拉取失败时很常见),
291
+ // 记下第一个候选,链走不通时仍用它降级——否则干净环境里整条链等于不可用,角色会被剪枝。
289
292
  if (index === 0) unadvertisedPrimary = candidate
293
+ else if (unadvertisedChain === undefined) unadvertisedChain = candidate
290
294
  continue
291
295
  }
292
296
  return {
@@ -301,6 +305,19 @@ export function resolveRoleRoute(role, availability = {}) {
301
305
  if (unadvertisedPrimary !== undefined) {
302
306
  return { ok: true, degraded: false, index: 0, primary, warning: 'model-unadvertised', role: { ...role }, tried }
303
307
  }
308
+ // tried 只记「被跳过的候选」,不包含最终降级目标本身——与主路由 unadvertised 分支同口径。
309
+ if (unadvertisedChain !== undefined) {
310
+ const index = candidates.findIndex((c) => c.provider === unadvertisedChain.provider && c.model === unadvertisedChain.model)
311
+ return {
312
+ ok: true,
313
+ degraded: index > 0,
314
+ index,
315
+ primary,
316
+ warning: 'model-unadvertised',
317
+ role: { ...role, provider: unadvertisedChain.provider, model: unadvertisedChain.model },
318
+ tried,
319
+ }
320
+ }
304
321
  return { ok: false, tried }
305
322
  }
306
323
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-rolegroup",
3
- "version": "0.11.3",
3
+ "version": "0.11.7",
4
4
  "description": "角色化委派插件:把「这类活该用哪个模型」固化为角色(名字 + 绑定模型 + persona),按角色名委派 · Role-based delegation: bind each kind of work to a model once and delegate by role name",
5
5
  "icon": "assets/icon.svg",
6
6
  "license": "MIT",
@@ -245,7 +245,13 @@ export function RolegroupCard(props) {
245
245
  : null}
246
246
  </select>
247
247
  ) : catalogReady && modelInfo !== undefined ? (
248
- <input value={row.reasoningEffort} disabled placeholder={t('reasoningEffortUnsupported')} />
248
+ // available === false means the model is missing from the catalog (missing credentials or
249
+ // an unregistered provider); its effort levels are unknown, so do not claim "unsupported".
250
+ <input
251
+ value={row.reasoningEffort}
252
+ disabled
253
+ placeholder={modelInfo.available === false ? t('modelUnavailable') : t('reasoningEffortUnsupported')}
254
+ />
249
255
  ) : (
250
256
  <input
251
257
  value={row.reasoningEffort}
@@ -339,10 +345,13 @@ export function RolegroupCard(props) {
339
345
  {t('discard')}
340
346
  </button>
341
347
  {/* Official defaults = zero-override takeover: no model names are written, so future
342
- built-in default changes are followed automatically. */}
343
- <button type="button" disabled={disabled || state.mode === 'official'} onClick={props.restoreOfficial}>
344
- {t('restoreOfficial')}
345
- </button>
348
+ built-in default changes are followed automatically. Hidden when already official —
349
+ a greyed button with nothing to do reads as broken (same rule as the fill button). */}
350
+ {state.mode === 'custom' ? (
351
+ <button type="button" disabled={disabled} onClick={props.restoreOfficial}>
352
+ {t('restoreOfficial')}
353
+ </button>
354
+ ) : null}
346
355
  </div>
347
356
  <p className="dsh-rg-liveHint">{t('liveHint')}</p>
348
357
  </div>
@@ -169,8 +169,8 @@ export class RolegroupCardController {
169
169
 
170
170
  /**
171
171
  * 当前生效行(未被草稿覆盖时的基准)。
172
- * 面板已接管(或面板层已存了行)时用 settings 层的 roles;否则用 host 快照预填的
173
- * jsonc / 内置生效表。这样未接管时页面默认就有内容,而不是一张空表。
172
+ * 面板已接管(或面板层已存了行)时用 settings 层的 roles;否则用内置表
173
+ * (客户端已打包 DEFAULT_ROLES,不请求宿主)。
174
174
  */
175
175
  effectiveRows() {
176
176
  const snapshot = this.scope.getSnapshot()
@@ -365,7 +365,7 @@ export class RolegroupCardController {
365
365
  this.failed = false
366
366
  this.conflicted = false
367
367
  this.publish()
368
- // 两个 op 一次提交:enabled=true 让 host 知道「面板已接管」(缺省 false = 未接管 → 回落 jsonc);
368
+ // 两个 op 一次提交:enabled=true 让 host 知道「面板已接管」(缺省 false = 未接管 → 回落内置表);
369
369
  // roles 是整表。顺序无关(两个独立路径)。
370
370
  await this.scope.mutate([
371
371
  { op: 'set', path: ['enabled'], value: true },
@@ -379,7 +379,6 @@ export class RolegroupCardController {
379
379
  this.publish()
380
380
  }
381
381
 
382
- /** 重置为文件配置:清用户层的 enabled + roles → 真正退出接管,回落 jsonc 链。 */
383
382
  /**
384
383
  * 恢复官方推荐:**零覆盖**接管。
385
384
  *
@@ -19,7 +19,8 @@ export const zh = {
19
19
  fieldModel: '模型',
20
20
  fieldReasoningEffort: '推理档位',
21
21
  reasoningEffortDefault: '默认',
22
- reasoningEffortUnsupported: '该模型不支持',
22
+ reasoningEffortUnsupported: '该模型不支持推理档位',
23
+ modelUnavailable: '模型不可用',
23
24
  fieldPersona: '人格设定',
24
25
  fieldSummary: '职责摘要',
25
26
  github: 'GitHub',
@@ -44,8 +45,8 @@ export const zh = {
44
45
  layerSummary: '配置层级说明',
45
46
  // 这里是 UI 文案(React 按**纯文本**渲染,不解析 markdown)——强调只能用「」,
46
47
  // 写 **xxx** 会被原样显示成星号(2026-10-20 真机截图发现)。默认折叠,不占版面。
47
- layerNote: '优先级:本面板 > 项目 rolegroup.jsonc > 用户 rolegroup.jsonc > 内置表。'
48
- + '保存会把当前生效表整层写入面板并接管;「重置为文件配置」可退出接管。完整生效表见 /rolegroup doctor。',
48
+ layerNote: '两层:本面板的覆盖 > 内置表。面板没有覆盖时,生效的就是内置表;'
49
+ + '「恢复官方推荐」会清空所有覆盖。完整生效表见 /rolegroup doctor。',
49
50
  }
50
51
 
51
52
  export const en = {
@@ -65,7 +66,8 @@ export const en = {
65
66
  fieldModel: 'Model',
66
67
  fieldReasoningEffort: 'Reasoning effort',
67
68
  reasoningEffortDefault: 'Default',
68
- reasoningEffortUnsupported: 'Not supported by this model',
69
+ reasoningEffortUnsupported: 'This model has no reasoning levels',
70
+ modelUnavailable: 'Model unavailable',
69
71
  fieldPersona: 'Persona',
70
72
  fieldSummary: 'Summary',
71
73
  github: 'GitHub',
@@ -88,9 +90,8 @@ export const en = {
88
90
  emptyNotTakeover: 'No editable roles; add one manually.',
89
91
  emptyTakeover: 'No overrides: every role uses the built-in table.',
90
92
  layerSummary: 'How the layers work',
91
- layerNote: 'Precedence: this panel > project rolegroup.jsonc > user rolegroup.jsonc > built-in table. '
92
- + 'Saving writes the active table into this panel and takes over the whole layer; Reset to file config '
93
- + 'exits takeover. See /rolegroup doctor for the effective table.',
93
+ layerNote: 'Two layers: panel overrides > built-in table. With no override in the panel, the built-in table '
94
+ + 'applies; "Restore official defaults" clears every override. See /rolegroup doctor for the effective table.',
94
95
  }
95
96
 
96
97
  export default { zh, en }