@lstions/dsh-skill-mcp-panel 1.11.0 → 1.12.0

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
@@ -11,6 +11,7 @@
11
11
 
12
12
  | 版本 | 日期 | 提交 | 内容 |
13
13
  |---|---|---|---|
14
+ | 1.12.0 | 2026-12-04 | 见下 | MCP「重新注册工具」(`mcp.reregister`):声明行重挂、外层行 fiber 重启,工具数取自真实注册表 |
14
15
  | 1.11.0 | 2026-11-14 | 见下 | 改名 `@lstions/dsh-skill-mcp-panel` 并补齐 npm 发布元数据(license/repository/engines.dsh/publishConfig) |
15
16
  | 1.10.0 | 2026-11-14 | 见下 | MCP 行级操作常显(编辑/删除无需展开)、工具列表限高滚动、修复主面板无法滚动 |
16
17
  | 1.9.2 | 2026-11-14 | 见下 | 修禁用态主按钮在深色主题下前景色被 `.skn_button:disabled` 覆盖(对比度 ≈1.9:1) |
@@ -52,6 +53,28 @@
52
53
 
53
54
  `test/version-check.mjs` 会阻止这件事再次发生:同一个版本号在下方出现两次即测试失败。
54
55
 
56
+ ## [1.12.0] - 2026-12-04
57
+
58
+ ### 新增:MCP「重新注册工具」(`mcp.reregister`)
59
+
60
+ - 每个**启用中**的 MCP 行新增「重新注册工具 / Re-register tools」操作:行级常显,
61
+ `aria-label` 带服务器名,关闭的行不提供(不会借此悄悄连上)。
62
+ - **本插件声明的服务器**:先 dispose 旧实例,再按同一配置重新挂载,工具从真实
63
+ `ctx.tools` 复读;同一 `serverName` 只保留一份注册,旧实例不残留。
64
+ - **外层 composition 层插入的行**(profile `cordis.patch.yml` 等):用该行
65
+ **自己的 fiber** `restart()` 在内存中重建客户端 —— 不重写用户的组合文件、
66
+ 不需要重启宿主;没有可重启 fiber 时如实 `refused` 并提示重启宿主。
67
+ - 结论只用注册表能证明的事实:重连后零工具**不是失败**(服务器可能本来就没有工具),
68
+ detail 写明「N 个工具」或「当前无工具」;失败时带真实原因。
69
+ - 状态提示条现在显示 host 返回的 `detail`(拒绝原因、重连后的真实工具数),
70
+ 不再只有 Applied / Refused 两个词。
71
+ - 门禁:`mcp-live` 用真实 Cordis + 真实 stdio 子进程证明重注册发布的是**新一代**
72
+ 注册(注册表计数器);`mcp-inventory` 覆盖拒绝路径与两条重连路径;
73
+ `ui-page` 覆盖按钮常显与 `mcp.reregister` 提交;`host-http` 覆盖新操作经
74
+ HTTP 路由到 MCP manager。
75
+
76
+ ---
77
+
55
78
  ## [1.11.0] - 2026-11-14
56
79
 
57
80
  ### 发布:改名为 scoped 包并补齐 npm 元数据
package/README.md CHANGED
@@ -53,7 +53,7 @@ duplicate of itself.
53
53
  From the npm registry (the normal flow):
54
54
 
55
55
  ```sh
56
- dsh plugin --profile web add @lstions/dsh-skill-mcp-panel@1.11.0
56
+ dsh plugin --profile web add @lstions/dsh-skill-mcp-panel@1.12.0
57
57
  # then restart the profile
58
58
  ```
59
59
 
@@ -85,7 +85,7 @@ cat ~/.dsh/profiles/web/package.json
85
85
 
86
86
  | Spec | Result |
87
87
  |---|---|
88
- | `@lstions/dsh-skill-mcp-panel@1.11.0` | from the registry — installs and auto-selects the bundle |
88
+ | `@lstions/dsh-skill-mcp-panel@1.12.0` | from the registry — installs and auto-selects the bundle |
89
89
  | `/abs/path` or `file:/abs/path` | local checkout, same behaviour |
90
90
  | `https://github.com/<owner>/<repo>.git` | pnpm clones it; needs credentials/network |
91
91
  | `git@github.com:<owner>/<repo>.git` | **broken in `dsh`** — see below |
@@ -255,8 +255,10 @@ sections:
255
255
  Cordis layer inserted. Each row shows transport, target, the user's note, live
256
256
  phase, tool count and registered tool names (counted from the real tool
257
257
  registry, never inferred from configuration). Servers this plugin declared can be added, edited,
258
- removed and toggled; rows from an outer layer can only be toggled, and a row
259
- the harness itself manages is shown read-only with the reason.
258
+ removed and toggled; rows from an outer layer can be toggled, and a row
259
+ the harness itself manages is shown read-only with the reason. Every enabled
260
+ row — owned or outer — also gets **Re-register tools**, which reconnects it and
261
+ republishes its tools without restarting the host.
260
262
 
261
263
  "Every layer" means **Cordis/DSH composition layers only** — bundle, profile,
262
264
  preset, session plugin. This section is deliberately scoped to the harness: it
@@ -472,6 +474,15 @@ Two honesty requirements, both tested:
472
474
  only the in-memory instance; the persisted config keeps the user's value).
473
475
  - **A tool-less server is not a failed server.** A server that legitimately
474
476
  exposes no tools is reported as connected, not as broken.
477
+ - **Re-registration is a reconnect, not a host restart.** `mcp.reregister` is
478
+ the recovery action for a row that is present but shows zero tools: a
479
+ connection that died, a client that exhausted its retry budget, or a
480
+ generation swap that rolled back. A server this plugin owns is unmounted and
481
+ mounted again; an outer row is restarted through **its own fiber**
482
+ (`fiber.restart()`), which disposes and re-applies the plugin in memory with
483
+ the same config — no composition file is rewritten. A row with no live fiber
484
+ is refused with "restart the host instead", and a disabled row is never
485
+ connected behind the user's back.
475
486
 
476
487
  ## Management HTTP channel
477
488
 
@@ -493,8 +504,8 @@ Every write is fenced:
493
504
  content type without a preflight it will not pass.
494
505
  - **`writeAccess`** may be tightened to `loopback` in configuration.
495
506
 
496
- The MCP operations are `mcp.toggle`, `mcp.add`, `mcp.configure`,
497
- `mcp.preview`, `mcp.import` and `mcp.remove`. `mcp.preview` (inspect without
507
+ The MCP operations are `mcp.toggle`, `mcp.reregister`, `mcp.add`,
508
+ `mcp.configure`, `mcp.preview`, `mcp.import` and `mcp.remove`. `mcp.preview` (inspect without
498
509
  writing) and `mcp.import` answer with **one result per server** in document
499
510
  order; every other kind answers with one result.
500
511
 
@@ -710,7 +721,7 @@ Node.js ≥ 20.13 for `fs.watch(..., { recursive: true })`, plus
710
721
  Releases are semver and every released version has a `vX.Y.Z` git tag pointing at
711
722
  the exact commit; [CHANGELOG.md](CHANGELOG.md) records what changed.
712
723
 
713
- **Referenceable versions start at `1.4.0`; the current version is `1.11.0`.**
724
+ **Referenceable versions start at `1.4.0`; the current version is `1.12.0`.**
714
725
  Before `1.4.0`, this repository published some version numbers twice with
715
726
  different content:
716
727
 
package/lib/client.js CHANGED
@@ -72,6 +72,7 @@ window.__ModuleLoader__.load({
72
72
  ".skn_error{color:var(--dsw-alias-state-error-primary);font-size:13px;line-height:18px;margin:0}" +
73
73
  ".skn_errors{color:var(--dsw-alias-state-error-primary);margin:0;padding-left:18px;font-size:12px;line-height:18px}" +
74
74
  ".skn_notice{border-radius:8px;align-self:flex-start;padding:4px 10px;font-size:13px;line-height:18px;margin:0}" +
75
+ ".skn_noticeDetail{opacity:.85}" +
75
76
  ".skn_filters{align-items:center;gap:8px;flex-wrap:wrap;display:flex}" +
76
77
  ".skn_input{height:32px;font:inherit;font-size:13px;border-radius:8px;padding:0 10px;border:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-primary);min-width:160px}" +
77
78
  ".skn_groups,.skn_rows,.skn_conflicts,.skn_servers{flex-direction:column;gap:2px;margin:0;padding:0;list-style:none;display:flex}" +
@@ -519,6 +520,8 @@ const UI_EN = {
519
520
  "mcp.confirmRemove": "Remove “{name}”?",
520
521
  "mcp.toggle.enable": "Enable “{name}”",
521
522
  "mcp.toggle.disable": "Disable “{name}”",
523
+ "mcp.reregister": "Re-register tools",
524
+ "mcp.reregister.hint": "Reconnect this server and register its tools again, without restarting the host",
522
525
  "mcp.field.serverName": "Name",
523
526
  "mcp.field.transport": "Transport",
524
527
  "mcp.field.command": "Command",
@@ -661,6 +664,8 @@ const UI_ZH = {
661
664
  "mcp.confirmRemove": "确定删除「{name}」?",
662
665
  "mcp.toggle.enable": "启用「{name}」",
663
666
  "mcp.toggle.disable": "关闭「{name}」",
667
+ "mcp.reregister": "重新注册工具",
668
+ "mcp.reregister.hint": "重新连接该服务器并重新注册它的工具,无需重启宿主",
664
669
  "mcp.field.serverName": "名称",
665
670
  "mcp.field.transport": "传输方式",
666
671
  "mcp.field.command": "命令",
@@ -1341,7 +1346,7 @@ const UI_ZH = {
1341
1346
  * a page that "helpfully" showed the real token would be the leak.
1342
1347
  */
1343
1348
  function McpServerRow(props) {
1344
- const { t, server, busy, onToggle, onConfigure, onRemove, writable } = props;
1349
+ const { t, server, busy, onToggle, onConfigure, onRemove, onReregister, writable } = props;
1345
1350
  const [open, setOpen] = react.useState(false);
1346
1351
  const [editing, setEditing] = react.useState(false);
1347
1352
  // The row's config is the full transport config (masked secrets one level
@@ -1399,6 +1404,22 @@ const UI_ZH = {
1399
1404
  react.createElement(
1400
1405
  "div",
1401
1406
  { className: "skn_serverActions" },
1407
+ // Recovery is always reachable: a row whose client gave up retrying has
1408
+ // zero tools but is otherwise indistinguishable from a healthy row here.
1409
+ server.enabled !== false && writable !== false
1410
+ ? react.createElement(
1411
+ "button",
1412
+ {
1413
+ type: "button",
1414
+ className: "skn_button skn_buttonSmall",
1415
+ disabled: busy,
1416
+ title: t("mcp.reregister.hint"),
1417
+ "aria-label": t("mcp.reregister.hint") + ": " + server.serverName,
1418
+ onClick: () => onReregister(server),
1419
+ },
1420
+ t("mcp.reregister"),
1421
+ )
1422
+ : null,
1402
1423
  editable
1403
1424
  ? react.createElement(
1404
1425
  "button",
@@ -1745,6 +1766,13 @@ const UI_ZH = {
1745
1766
  (server) => runOp({ kind: "mcp.remove", serverName: server.serverName }, server.serverName),
1746
1767
  [runOp],
1747
1768
  );
1769
+ // Reconnect + re-register: the recovery action for a row whose tools
1770
+ // vanished (a dead connection, an exhausted retry budget, a rolled-back
1771
+ // generation swap). The host reports exactly what the registry proves.
1772
+ const reregisterServer = react.useCallback(
1773
+ (server) => runOp({ kind: "mcp.reregister", serverName: server.serverName }, server.serverName),
1774
+ [runOp],
1775
+ );
1748
1776
 
1749
1777
  /** 关掉导入表单,并清空这一轮输入的所有内容。 */
1750
1778
  const closeImport = react.useCallback(() => {
@@ -1837,6 +1865,12 @@ const UI_ZH = {
1837
1865
  "p",
1838
1866
  { className: "skn_notice skn_badge-" + notice.tone, role: "status" },
1839
1867
  t(notice.key, notice.params),
1868
+ // The host detail is the only place a refusal reason or the real
1869
+ // tool count after a re-register appears. Dropping it made
1870
+ // "applied" hide a server that came back with zero tools.
1871
+ typeof notice.detail === "string" && notice.detail !== ""
1872
+ ? react.createElement("span", { className: "skn_noticeDetail" }, " — " + notice.detail)
1873
+ : null,
1840
1874
  )
1841
1875
  : null,
1842
1876
 
@@ -2030,6 +2064,7 @@ const UI_ZH = {
2030
2064
  onToggle: toggleServer,
2031
2065
  onConfigure: configureServer,
2032
2066
  onRemove: removeServer,
2067
+ onReregister: reregisterServer,
2033
2068
  writable: state.writable !== false,
2034
2069
  }),
2035
2070
  ),
package/lib/contract.js CHANGED
@@ -117,6 +117,8 @@ export const OP = {
117
117
  CONFIG_UNSET: 'config.unset',
118
118
  /** Enable or disable a mounted MCP server row. */
119
119
  MCP_TOGGLE: 'mcp.toggle',
120
+ /** Reconnect one server and register its tools again, without a host restart. */
121
+ MCP_REREGISTER: 'mcp.reregister',
120
122
  /** Rewrite one server's connection configuration. */
121
123
  MCP_CONFIGURE: 'mcp.configure',
122
124
  /** Declare a new MCP server owned by this plugin. */
package/lib/index.js CHANGED
@@ -732,6 +732,7 @@ function resolveConfig(raw) {
732
732
  /** Operation kinds this module handles itself; everything else MCP owns. */
733
733
  const MCP_KINDS = new Set([
734
734
  OP.MCP_TOGGLE,
735
+ OP.MCP_REREGISTER,
735
736
  OP.MCP_CONFIGURE,
736
737
  OP.MCP_ADD,
737
738
  OP.MCP_PREVIEW,
package/lib/mcp.js CHANGED
@@ -964,6 +964,37 @@ export function createMcpManager(deps = {}) {
964
964
  return out
965
965
  }
966
966
 
967
+ /**
968
+ * The Loader entry whose MCP client config names one server.
969
+ *
970
+ * `entry.fiber` is the plugin fiber the Loader created for that row — the
971
+ * handle an in-memory re-registration restarts. A row the host has not
972
+ * instantiated carries no fiber, and a row from a non-Loader composition
973
+ * has no entry here at all.
974
+ *
975
+ * @param {string} serverName
976
+ * @returns {object|undefined} the Loader entry, when one is addressable.
977
+ */
978
+ async function loaderEntryFor(serverName) {
979
+ const service = loader()
980
+ if (service === undefined || typeof service.entries !== 'function') return undefined
981
+ let iterable
982
+ try {
983
+ iterable = service.entries()
984
+ } catch (error) {
985
+ log(`skill-mcp-panel: could not enumerate loader entries: ${String(error)}`)
986
+ return undefined
987
+ }
988
+ for (const entry of iterable ?? []) {
989
+ const options = entry?.options
990
+ if (options === undefined || options === null) continue
991
+ if (options.group) continue
992
+ if (options.name !== MCP_CLIENT_MODULE) continue
993
+ if (text(options.config?.serverName) === serverName) return entry
994
+ }
995
+ return undefined
996
+ }
997
+
967
998
  /**
968
999
  * Coerce a stored transport onto the contract's enum.
969
1000
  *
@@ -1382,6 +1413,116 @@ export function createMcpManager(deps = {}) {
1382
1413
  return mapChangeResult(OP.MCP_TOGGLE, change, serverName)
1383
1414
  }
1384
1415
 
1416
+ /**
1417
+ * Reconnect one server and register its tools again.
1418
+ *
1419
+ * This is the recovery action for the states the panel can SEE but not fix
1420
+ * any other way: a client whose connection died, whose retry budget was
1421
+ * exhausted, or whose generation swap was rolled back leaves its row in
1422
+ * place with zero tools, and only a reconnect brings the tools back. Two
1423
+ * ownership paths answer honestly:
1424
+ *
1425
+ * - A server THIS plugin declared is unmounted and mounted again through the
1426
+ * client module it owns, then the live registry is read back.
1427
+ * - A Loader row from an outer layer is restarted through its own fiber.
1428
+ * `fiber.restart()` is an in-memory operation: it disposes the plugin and
1429
+ * re-applies it with the SAME config, so no composition file is rewritten
1430
+ * and the reserved serverName is released by the dispose half first.
1431
+ *
1432
+ * A reconnect that ends with zero tools is reported as itself, never as a
1433
+ * failure: a server may legitimately expose none. The status only claims
1434
+ * what the registry proves.
1435
+ *
1436
+ * @param {object} op - an `mcp.reregister` operation.
1437
+ * @returns {Promise<object>} an ApplyResult.
1438
+ */
1439
+ async function reregister(op) {
1440
+ const serverName = text(op?.serverName ?? op?.target)
1441
+ if (serverName === '') return result(OP.MCP_REREGISTER, STATUS.REFUSED, 'serverName is required.', serverName)
1442
+ if (disposed) return result(OP.MCP_REREGISTER, STATUS.REFUSED, 'the MCP manager is shutting down.', serverName)
1443
+
1444
+ const declaration = readDeclaredSafe().find((item) => item.serverName === serverName)
1445
+ if (declaration !== undefined) {
1446
+ if (declaration.enabled === false) {
1447
+ return result(OP.MCP_REREGISTER, STATUS.REFUSED, `"${serverName}" is disabled; enable it before re-registering its tools.`, serverName)
1448
+ }
1449
+ const { config, error } = normalizeConfig(declaration.config, declaration.config)
1450
+ if (config === null) {
1451
+ return result(OP.MCP_REREGISTER, STATUS.REFUSED, `"${serverName}" cannot be re-registered: ${error}.`, serverName)
1452
+ }
1453
+ // One live instance per serverName: the old generation has to close
1454
+ // before the new one can reserve the namespace, exactly as configure.
1455
+ const closed = await disposeMount(serverName)
1456
+ if (closed.error !== null) {
1457
+ return result(
1458
+ OP.MCP_REREGISTER,
1459
+ STATUS.REFUSED,
1460
+ `"${serverName}" was disconnected for the re-registration, but its previous connection did not close cleanly: ${closed.error}`,
1461
+ serverName
1462
+ )
1463
+ }
1464
+ const mounted = await mount(serverName, config)
1465
+ if (!mounted.ok) {
1466
+ return result(
1467
+ OP.MCP_REREGISTER,
1468
+ STATUS.REFUSED,
1469
+ `"${serverName}" was disconnected for the re-registration, but reconnecting failed (${mounted.error}); its tools are not registered.`,
1470
+ serverName
1471
+ )
1472
+ }
1473
+ const count = await awaitTools(serverName)
1474
+ return result(
1475
+ OP.MCP_REREGISTER,
1476
+ STATUS.APPLIED,
1477
+ count > 0
1478
+ ? `"${serverName}" was re-registered; ${count} tool(s) are registered.`
1479
+ : `"${serverName}" was re-registered; it exposes no tools.`,
1480
+ serverName
1481
+ )
1482
+ }
1483
+
1484
+ const loaderRows = await readLoaderRows()
1485
+ const row = loaderRows.rows.find((item) => text(item.config?.serverName) === serverName)
1486
+ if (row === undefined) {
1487
+ return result(OP.MCP_REREGISTER, STATUS.REFUSED, `no MCP server named "${serverName}" is declared or mounted.`, serverName)
1488
+ }
1489
+ if (row.enabled === false) {
1490
+ return result(OP.MCP_REREGISTER, STATUS.REFUSED, `"${serverName}" is disabled; enable it before re-registering its tools.`, serverName)
1491
+ }
1492
+ const entry = await loaderEntryFor(serverName)
1493
+ const fiber = entry?.fiber
1494
+ if (fiber === undefined || fiber === null) {
1495
+ return result(
1496
+ OP.MCP_REREGISTER,
1497
+ STATUS.REFUSED,
1498
+ `"${serverName}" has no live fiber in this host, so its tools cannot be re-registered here; restart the host instead.`,
1499
+ serverName
1500
+ )
1501
+ }
1502
+ if (typeof fiber.restart !== 'function') {
1503
+ return result(
1504
+ OP.MCP_REREGISTER,
1505
+ STATUS.REFUSED,
1506
+ `"${serverName}" exposes no restartable fiber, so its tools cannot be re-registered here; restart the host instead.`,
1507
+ serverName
1508
+ )
1509
+ }
1510
+ try {
1511
+ await fiber.restart()
1512
+ } catch (error) {
1513
+ return result(OP.MCP_REREGISTER, STATUS.REFUSED, `"${serverName}" could not be re-registered: ${describeFailure(error)}`, serverName)
1514
+ }
1515
+ const count = await awaitTools(serverName, 2000)
1516
+ return result(
1517
+ OP.MCP_REREGISTER,
1518
+ STATUS.APPLIED,
1519
+ count > 0
1520
+ ? `"${serverName}" was re-registered; ${count} tool(s) are registered.`
1521
+ : `"${serverName}" was re-registered; it currently exposes no tools (its connection may have failed).`,
1522
+ serverName
1523
+ )
1524
+ }
1525
+
1385
1526
  /**
1386
1527
  * Map a plugin manager `ChangeResult` onto an {@link STATUS}.
1387
1528
  *
@@ -1924,6 +2065,8 @@ export function createMcpManager(deps = {}) {
1924
2065
  switch (kind) {
1925
2066
  case OP.MCP_TOGGLE:
1926
2067
  return await toggle(op)
2068
+ case OP.MCP_REREGISTER:
2069
+ return await reregister(op)
1927
2070
  case OP.MCP_ADD:
1928
2071
  return await add(op)
1929
2072
  case OP.MCP_IMPORT:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lstions/dsh-skill-mcp-panel",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
4
4
  "description": "Recursive, multi-root skill discovery with per-skill switches, duplicate-name reporting and MCP server management for the DeepSeek Harness",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -48,10 +48,6 @@
48
48
  "CHANGELOG.md",
49
49
  "LICENSE"
50
50
  ],
51
- "scripts": {
52
- "test": "node test/all.mjs",
53
- "test:tree": "node test/realtree.mjs"
54
- },
55
51
  "engines": {
56
52
  "node": ">=20.13.0",
57
53
  "dsh": ">=0.1.7-alpha.1 <0.3.0-0"
@@ -79,5 +75,9 @@
79
75
  "publishConfig": {
80
76
  "access": "public",
81
77
  "tag": "latest"
78
+ },
79
+ "scripts": {
80
+ "test": "node test/all.mjs",
81
+ "test:tree": "node test/realtree.mjs"
82
82
  }
83
- }
83
+ }