@xxxyz/dsh-mcp-manager 2.1.1 → 2.1.2

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/lib/client.js CHANGED
@@ -50,7 +50,8 @@ const factory = (require) => {
50
50
  '.mcpm-dialog-actions{display:flex;justify-content:flex-end;gap:8px}' +
51
51
  '.skm-search{font-size:12px;padding:5px 8px;border-radius:6px;border:1px solid rgba(128,128,128,.5);background:transparent;color:inherit;width:100%;box-sizing:border-box}' +
52
52
  '.skm-group-title{font-size:12px;font-weight:600;opacity:.85;margin-top:4px;padding-bottom:2px;border-bottom:1px solid rgba(128,128,128,.25)}' +
53
- '.skm-provider-title{font-size:12px;font-weight:600;cursor:pointer;user-select:none;margin-top:4px;opacity:.9}'
53
+ '.skm-provider-title{font-size:12px;font-weight:600;cursor:pointer;user-select:none;margin-top:4px;opacity:.9}' +
54
+ '.mcpm-version{margin-left:8px;font-size:11px;font-weight:500;opacity:.55;letter-spacing:.3px;vertical-align:middle}'
54
55
 
55
56
  function ensureCss() {
56
57
  if (typeof document === 'undefined') return
@@ -74,6 +75,19 @@ const factory = (require) => {
74
75
  }).then((r) => r.json()).catch((e) => ({ ok: false, error: String((e && e.message) || e) }))
75
76
  }
76
77
 
78
+ // Small version badge shown next to each settings-page title; reads the
79
+ // package version from the host (plugin-version op) so it always matches
80
+ // the installed release.
81
+ function VersionBadge() {
82
+ const [v, setV] = React.useState(null)
83
+ React.useEffect(() => {
84
+ let alive = true
85
+ apiCall('plugin-version', {}).then((r) => { if (alive && r && r.ok) setV(r.version) }).catch(() => {})
86
+ return () => { alive = false }
87
+ }, [])
88
+ return v ? React.createElement('span', { className: 'mcpm-version' }, 'v' + v) : null
89
+ }
90
+
77
91
  module.exports = {
78
92
  name: 'dsh-mcp-manager-client',
79
93
  inject: ['timer'],
@@ -218,7 +232,7 @@ const factory = (require) => {
218
232
  }
219
233
 
220
234
  return React.createElement('div', { className: 'mcpm-wrap' },
221
- React.createElement('h2', null, 'MCP 服务管理'),
235
+ React.createElement('h2', null, 'MCP 服务管理', React.createElement(VersionBadge, null)),
222
236
  React.createElement('div', { className: 'mcpm-sub' },
223
237
  '管理 dsh-mcp-client 服务:写入 项目级(web profile) / 全局(home) 的 cordis.patch.yml,经 HMR 实时生效;重启 DSH 后由 Loader 自动加载。'),
224
238
  restartInfo && React.createElement('div', { className: 'mcpm-msg info' },
@@ -340,7 +354,7 @@ const factory = (require) => {
340
354
  const query = q.trim().toLowerCase()
341
355
  const visible = state.skills.filter((s) => !query || (s.name + ' ' + (s.description || '')).toLowerCase().includes(query))
342
356
  return React.createElement('div', { className: 'mcpm-wrap' },
343
- React.createElement('h2', null, 'Skills 管理'),
357
+ React.createElement('h2', null, 'Skills 管理', React.createElement(VersionBadge, null)),
344
358
  React.createElement('div', { className: 'mcpm-sub' }, '查看与启停 DSH 技能(按层级分组,禁用即时生效,无需重启)'),
345
359
  msg && React.createElement('div', { className: 'mcpm-msg ' + msg.kind }, msg.text),
346
360
  React.createElement('input', { className: 'skm-search', placeholder: '搜索技能名称或描述…', value: q, onChange: (e) => setQ(e.target.value) }),
package/lib/index.js CHANGED
@@ -11,6 +11,7 @@
11
11
  // Build: `tsc -p tsconfig.json` compiles this to lib/index.js (the shipped
12
12
  // artifact — same convention as DSH's own packages, which ship compiled JS).
13
13
  import { defineTool } from '@deepseek-ai/dsh-tools';
14
+ import { createRequire } from 'node:module';
14
15
  export default {
15
16
  name: 'dsh-mcp-manager-host',
16
17
  inject: ['timer', 'fs', 'settings', 'sandboxPolicy', 'webServer', 'tools', 'skills'],
@@ -22,6 +23,13 @@ export default {
22
23
  const tools = ctx.tools;
23
24
  // pluginInventory is optional: probe at use time, degrade to no live info.
24
25
  const pluginInventory = ctx.get('pluginInventory');
26
+ // Package version, surfaced in the Settings pages and the HTTP API. Read
27
+ // from the installed package.json so it always matches the release tag.
28
+ let PKG_VERSION = 'unknown';
29
+ try {
30
+ PKG_VERSION = createRequire(import.meta.url)('../package.json').version || 'unknown';
31
+ }
32
+ catch (e) { /* keep unknown */ }
25
33
  const wait = (ms) => ctx.timeout(ms);
26
34
  const message = (e) => String((e && e.message) || e);
27
35
  let writeChain = Promise.resolve();
@@ -626,6 +634,9 @@ export default {
626
634
  return { ok: true, row };
627
635
  }
628
636
  // ---------- ops ----------
637
+ async function pluginVersion() {
638
+ return { ok: true, version: PKG_VERSION };
639
+ }
629
640
  async function mcpmList() {
630
641
  const p = await ensurePaths();
631
642
  const rows = [];
@@ -948,6 +959,7 @@ export default {
948
959
  return String(text || '').split(/[\s,]+/).map((s) => s.trim()).filter((s) => s !== '');
949
960
  }
950
961
  const handlers = {
962
+ 'plugin-version': pluginVersion,
951
963
  'mcpm-list': mcpmList,
952
964
  'mcpm-add': mcpmAdd,
953
965
  'mcpm-edit': mcpmEdit,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xxxyz/dsh-mcp-manager",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "DSH-standard MCP manager plugin: Settings UI + HTTP API + model-facing mcp_manager_* tools. Install with one command: dsh plugin --profile web add @xxxyz/dsh-mcp-manager@latest",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",