universal-plugin-hub 1.5.0 → 1.5.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/client/client.js +1 -2
- package/package.json +1 -1
- package/src/install.js +161 -46
- package/src/routes.js +1 -1
package/client/client.js
CHANGED
|
@@ -9198,7 +9198,6 @@ window.__ModuleLoader__.load({ id: "universal-plugin-hub", factory: (require) =>
|
|
|
9198
9198
|
SESSION_STORE.browseSortSnapshots[activeSourceId] = { filter, query, sortBy, names: currentSourceInstalledNames };
|
|
9199
9199
|
}, [activeSourceId, filter, query, sortBy, currentSourceInstalledNames]);
|
|
9200
9200
|
const installedNames = useMemo(() => new Set(state.plugins.map((p) => p.name)), [state.plugins]);
|
|
9201
|
-
const totalInstalledCount = state.plugins.length;
|
|
9202
9201
|
const currentSourcePlugins = useMemo(() => (rows && rows[activeSourceId]) || [], [rows, activeSourceId]);
|
|
9203
9202
|
const totalSourcePluginsCount = currentSourcePlugins.length;
|
|
9204
9203
|
|
|
@@ -9610,7 +9609,7 @@ window.__ModuleLoader__.load({ id: "universal-plugin-hub", factory: (require) =>
|
|
|
9610
9609
|
if (!SESSION_STORE.scrollTops) SESSION_STORE.scrollTops = {};
|
|
9611
9610
|
SESSION_STORE.scrollTops[activeSourceId] = 0;
|
|
9612
9611
|
scrollContentToTop();
|
|
9613
|
-
} },
|
|
9612
|
+
} }, "已安装"),
|
|
9614
9613
|
),
|
|
9615
9614
|
),
|
|
9616
9615
|
h("div", { style: { position: "relative" } },
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"title": "Universal Plugin Hub",
|
|
4
4
|
"displayName": "Universal Plugin Hub",
|
|
5
5
|
"description": "在 DSH 中使用 Claude Code、Codex 等软件生态的插件,一站式管理插件、Skills 与 MCP。支持添加 Git 插件源和 marketplace、上传插件和 Skills、添加 MCP 服务器,自动扫描并开关本地 Skills,接入插件提供的子代理、MCP、Hooks 与 LSP。",
|
|
6
|
-
"version": "1.5.
|
|
6
|
+
"version": "1.5.1",
|
|
7
7
|
"engines": {
|
|
8
8
|
"dsh": ">=0.1.5-rc.1"
|
|
9
9
|
},
|
package/src/install.js
CHANGED
|
@@ -22,7 +22,7 @@ import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'
|
|
|
22
22
|
import { ErrorCode } from '@modelcontextprotocol/sdk/types.js'
|
|
23
23
|
import { installedDir, pluginDataDir, compiledHooksPath, readState, writeState, slugify, dshHome, dshSkillsDir, safeRmDir, removeManagedDir, sourceCacheDir, trashRoot, isSameOrInsidePath } from './store.js'
|
|
24
24
|
import { materializePlugin, pullSource } from './market.js'
|
|
25
|
-
import { copyDir, listSkills, listAgents, listPrompts, listConnectors, listHooks, listLspServers, readPluginManifest, readPluginShortDescription, formatDisplayName, invalidateParserCaches, invalidateMarketplaceCache, readMarketplace, connectorTransport, isRemoteTransportName, PLUGIN_RUNTIME_ENV_KEYS, hasUnresolvedVarPlaceholder, isDotRelativePath, expandPluginVars, resolvePluginCommand, resolvePluginCwd, resolvePluginSpecPath, resolveConnectorDisplay, resolvePluginCommandEntries, compileResolvedHooks, MARKETPLACE_COMPONENT_KEYS } from './parser.js'
|
|
25
|
+
import { copyDir, listSkills, listAgents, listPrompts, listConnectors, listHooks, listLspServers, readPluginManifest, readPluginShortDescription, formatDisplayName, invalidateParserCaches, invalidateMarketplaceCache, readMarketplace, connectorTransport, isRemoteTransportName, PLUGIN_RUNTIME_ENV_KEYS, hasUnresolvedVarPlaceholder, isDotRelativePath, expandPluginVars, resolvePluginCommand, resolvePluginCwd, resolvePluginSpecPath, resolveConnectorDisplay, resolvePluginCommandEntries, compileResolvedHooks, mergeManifestWithRow, MARKETPLACE_COMPONENT_KEYS } from './parser.js'
|
|
26
26
|
import { parseAgentDefinition, compileSubagentsHubSkill, cleanupLegacyPresets } from './agents-map.js'
|
|
27
27
|
import { isUploadedSkillTarget } from './skill-uploads.js'
|
|
28
28
|
import { buildPluginIcons } from './icons.js'
|
|
@@ -50,6 +50,50 @@ export function cordisPatchPath() {
|
|
|
50
50
|
return profilePatch
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
/** Sentinel wrapper distinguishing DSH `!!js` YAML expressions from plain objects. */
|
|
54
|
+
class CordisJsExpr {
|
|
55
|
+
constructor(expr) {
|
|
56
|
+
this.expr = expr
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// DSH's Cordis loader (@deepseek-ai/cordis-plugin-include) extends YAML with `!!js` scalar expressions.
|
|
61
|
+
const CORDIS_JS_TAG = yaml.defineScalarTag('tag:yaml.org,2002:js', {
|
|
62
|
+
resolve: (source) => new CordisJsExpr(source),
|
|
63
|
+
identify: (value) => value instanceof CordisJsExpr,
|
|
64
|
+
represent: (value) => value.expr,
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
const CORDIS_LOAD_SCHEMA = yaml.CORE_SCHEMA.withTags(CORDIS_JS_TAG)
|
|
68
|
+
const CORDIS_DUMP_SCHEMA = yaml.DUMP_SCHEMA.withTags(CORDIS_JS_TAG)
|
|
69
|
+
|
|
70
|
+
// js-yaml v4 (used by DSH's loader) rejects unquoted empty `!!js` scalars; force single quotes when empty.
|
|
71
|
+
// js-yaml 5.3 uses a Style object while 5.4+ uses numeric SCALAR_STYLE values.
|
|
72
|
+
function quoteEmptyJsTags(docs) {
|
|
73
|
+
yaml.visit(docs, (node) => {
|
|
74
|
+
if (node.kind === 'scalar' && (node.tag === '!!js' || node.tag === 'tag:yaml.org,2002:js') && node.value === '') {
|
|
75
|
+
if (node.style && typeof node.style === 'object') {
|
|
76
|
+
node.style.singleQuoted = true
|
|
77
|
+
} else {
|
|
78
|
+
node.style = yaml.SCALAR_STYLE.SINGLE_QUOTED
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Extract a concise single-line YAML parse location and reason for UI error toasts. */
|
|
85
|
+
function formatCordisYamlError(error) {
|
|
86
|
+
const reason = typeof error?.reason === 'string' && error.reason.trim()
|
|
87
|
+
? error.reason.trim()
|
|
88
|
+
: String(error?.message || error || '').split(/\r?\n/)[0].trim()
|
|
89
|
+
const mark = error?.mark
|
|
90
|
+
if (mark && Number.isInteger(mark.line) && Number.isInteger(mark.column)) {
|
|
91
|
+
const loc = `第 ${mark.line + 1} 行第 ${mark.column + 1} 列`
|
|
92
|
+
return reason ? `${loc}:${reason}` : loc
|
|
93
|
+
}
|
|
94
|
+
return reason
|
|
95
|
+
}
|
|
96
|
+
|
|
53
97
|
function loadCordisPatch(file) {
|
|
54
98
|
let source
|
|
55
99
|
try {
|
|
@@ -58,14 +102,18 @@ function loadCordisPatch(file) {
|
|
|
58
102
|
if (error.code === 'ENOENT') return []
|
|
59
103
|
throw new Error(`无法读取 ${file},已中止写入以保护现有配置。`, { cause: error })
|
|
60
104
|
}
|
|
105
|
+
// Strip UTF-8 BOM once: Windows Notepad writes one, and js-yaml v5 rejects BOM before comments.
|
|
106
|
+
const text = source.charCodeAt(0) === 0xFEFF ? source.slice(1) : source
|
|
61
107
|
// js-yaml can reject an empty stream. An explicit null value is still a document.
|
|
62
|
-
if (
|
|
108
|
+
if (text.split(/\r\n?|\n/).every((line) => /^[ \t]*(?:#.*)?$/.test(line))) return []
|
|
63
109
|
|
|
64
110
|
let parsed
|
|
65
111
|
try {
|
|
66
|
-
parsed = yaml.load(
|
|
112
|
+
parsed = yaml.load(text, { schema: CORDIS_LOAD_SCHEMA })
|
|
67
113
|
} catch (error) {
|
|
68
|
-
|
|
114
|
+
const detail = formatCordisYamlError(error)
|
|
115
|
+
const suffix = detail ? `(${detail})` : ''
|
|
116
|
+
throw new Error(`无法解析 ${file}${suffix},已中止写入以保护现有配置。请通过 DSH 配置文件手动修改。`, { cause: error })
|
|
69
117
|
}
|
|
70
118
|
if (!Array.isArray(parsed)) {
|
|
71
119
|
throw new Error(`${file} 的顶层必须是数组,已中止写入以保护现有配置。`)
|
|
@@ -86,11 +134,16 @@ function readCordisPatchRaw() {
|
|
|
86
134
|
|
|
87
135
|
function writeCordisPatchRaw(patch) {
|
|
88
136
|
const file = cordisPatchPath()
|
|
89
|
-
// A tolerant read can return [] for a
|
|
137
|
+
// A tolerant read can return [] for a damaged document.
|
|
90
138
|
// Check the on-disk document before any mutation can replace it.
|
|
91
139
|
loadCordisPatch(file)
|
|
92
140
|
mkdirSync(dirname(file), { recursive: true })
|
|
93
|
-
const content = yaml.dump(patch, {
|
|
141
|
+
const content = yaml.dump(patch, {
|
|
142
|
+
schema: CORDIS_DUMP_SCHEMA,
|
|
143
|
+
indent: 2,
|
|
144
|
+
lineWidth: -1,
|
|
145
|
+
transform: quoteEmptyJsTags,
|
|
146
|
+
})
|
|
94
147
|
const seq = (PATCH_TMP_SEQ = (PATCH_TMP_SEQ + 1) & 0xffffff).toString(36)
|
|
95
148
|
const tmp = join(dirname(file), `.cordis.patch.${process.pid}.${Date.now().toString(36)}.${seq}.tmp`)
|
|
96
149
|
try {
|
|
@@ -1254,7 +1307,7 @@ export function unregisterPluginLsp(pluginName) {
|
|
|
1254
1307
|
for (const block of patch) {
|
|
1255
1308
|
if (block && Array.isArray(block.insert)) {
|
|
1256
1309
|
const before = block.insert.length
|
|
1257
|
-
block.insert = block.insert.filter((item) => !(item && item.id && item.id.startsWith(prefix)))
|
|
1310
|
+
block.insert = block.insert.filter((item) => !(item && typeof item.id === 'string' && item.id.startsWith(prefix)))
|
|
1258
1311
|
if (block.insert.length !== before) changed = true
|
|
1259
1312
|
}
|
|
1260
1313
|
}
|
|
@@ -1290,18 +1343,8 @@ export function getHookBridgeId(pluginName) {
|
|
|
1290
1343
|
return `hooks-${slugify(pluginName)}`
|
|
1291
1344
|
}
|
|
1292
1345
|
|
|
1293
|
-
/**
|
|
1294
|
-
|
|
1295
|
-
* `@deepseek-ai/dsh-hooks-claude-code` bridge entry into cordis.patch.yml. The
|
|
1296
|
-
* bridge runs an unmodified Claude Code hooks.json on DSH's interception points
|
|
1297
|
-
* (SessionStart / UserPromptSubmit / PreToolUse / PostToolUse / Stop /
|
|
1298
|
-
* SubagentStart / SubagentStop), with `${CLAUDE_PLUGIN_ROOT}` substituted from
|
|
1299
|
-
* `pluginRoot`. DSH's HMR re-applies the tree within ~1s, no restart needed.
|
|
1300
|
-
*
|
|
1301
|
-
* The bridge and its hook-protocol peer are pre-provisioned by the hub's
|
|
1302
|
-
* `apply()` on DSH startup, so a per-plugin install is a single patch write.
|
|
1303
|
-
*/
|
|
1304
|
-
export async function registerPluginHooks(pluginName) {
|
|
1346
|
+
/** Synchronously compile and register a plugin's hooks inside an active cordis patch batch. */
|
|
1347
|
+
function registerPluginHooksSync(pluginName) {
|
|
1305
1348
|
const target = installedDir(pluginName)
|
|
1306
1349
|
const dataDir = pluginDataDir(pluginName)
|
|
1307
1350
|
const compiled = compileResolvedHooks(target, readPluginManifest(target), dataDir)
|
|
@@ -1333,6 +1376,21 @@ export async function registerPluginHooks(pluginName) {
|
|
|
1333
1376
|
return { ok: true, registered: [outPath] }
|
|
1334
1377
|
}
|
|
1335
1378
|
|
|
1379
|
+
/**
|
|
1380
|
+
* Register an installed plugin's Claude/Codex hooks into DSH by inserting a
|
|
1381
|
+
* `@deepseek-ai/dsh-hooks-claude-code` bridge entry into cordis.patch.yml. The
|
|
1382
|
+
* bridge runs an unmodified Claude Code hooks.json on DSH's interception points
|
|
1383
|
+
* (SessionStart / UserPromptSubmit / PreToolUse / PostToolUse / Stop /
|
|
1384
|
+
* SubagentStart / SubagentStop), with `${CLAUDE_PLUGIN_ROOT}` substituted from
|
|
1385
|
+
* `pluginRoot`. DSH's HMR re-applies the tree within ~1s, no restart needed.
|
|
1386
|
+
*
|
|
1387
|
+
* The bridge and its hook-protocol peer are pre-provisioned by the hub's
|
|
1388
|
+
* `apply()` on DSH startup, so a per-plugin install is a single patch write.
|
|
1389
|
+
*/
|
|
1390
|
+
export async function registerPluginHooks(pluginName) {
|
|
1391
|
+
return registerPluginHooksSync(pluginName)
|
|
1392
|
+
}
|
|
1393
|
+
|
|
1336
1394
|
/** Remove a plugin's hooks bridge entry from cordis.patch.yml. */
|
|
1337
1395
|
export function unregisterPluginHooks(pluginName) {
|
|
1338
1396
|
const patch = readCordisPatch()
|
|
@@ -2435,6 +2493,48 @@ async function installMarketplacePluginUnlocked(options) {
|
|
|
2435
2493
|
return withSourceLock(options.sourceId, () => installMarketplacePluginFromSourceLocked(options))
|
|
2436
2494
|
}
|
|
2437
2495
|
|
|
2496
|
+
/** Return true when at least one declared LSP server passes pre-flight resolution. */
|
|
2497
|
+
function canRegisterAnyLsp(pluginRoot, dataDir, servers) {
|
|
2498
|
+
for (const s of servers) {
|
|
2499
|
+
const resolved = substitutePluginRoot(s || {}, pluginRoot, dataDir)
|
|
2500
|
+
const resolvedCmd = resolvePluginCommand(s?.command, pluginRoot, dataDir)
|
|
2501
|
+
if (!resolvedCmd || typeof resolvedCmd !== 'string' || !resolvedCmd.trim()) continue
|
|
2502
|
+
if (!resolved.extensionToLanguage || typeof resolved.extensionToLanguage !== 'object' || Object.keys(resolved.extensionToLanguage).length === 0) continue
|
|
2503
|
+
if (resolveCommandPath(resolvedCmd, process.env, { cwd: pluginRoot })) return true
|
|
2504
|
+
}
|
|
2505
|
+
return false
|
|
2506
|
+
}
|
|
2507
|
+
|
|
2508
|
+
/** Return true when installing/updating this plugin may mutate cordis.patch.yml. */
|
|
2509
|
+
function installMayWriteCordisPatch(pluginName, dir, row, target, prevConnectors, initialEnabled) {
|
|
2510
|
+
const incomingManifest = mergeManifestWithRow(readPluginManifest(dir), row)
|
|
2511
|
+
const incomingConnectors = listConnectors(dir, incomingManifest)
|
|
2512
|
+
if (prevConnectors.some((name) => !incomingConnectors.some((c) => c.name === name))) return true
|
|
2513
|
+
|
|
2514
|
+
const dataDir = pluginDataDir(pluginName)
|
|
2515
|
+
if (existsSync(target)) {
|
|
2516
|
+
if (listLspServers(target).length > 0 || existsSync(compiledHooksPath(pluginName))) return true
|
|
2517
|
+
if (!initialEnabled && prevConnectors.length > 0) return true
|
|
2518
|
+
}
|
|
2519
|
+
if (!initialEnabled) return false
|
|
2520
|
+
|
|
2521
|
+
if (compileResolvedHooks(dir, incomingManifest, dataDir) !== null) return true
|
|
2522
|
+
return canRegisterAnyLsp(dir, dataDir, listLspServers(dir, incomingManifest))
|
|
2523
|
+
}
|
|
2524
|
+
|
|
2525
|
+
/** Best-effort cleanup of files and registrations written during a failed fresh install. */
|
|
2526
|
+
async function rollbackFreshInstall(pluginName, target) {
|
|
2527
|
+
try { unregisterPluginHooks(pluginName) } catch {}
|
|
2528
|
+
try { unregisterPluginLsp(pluginName) } catch {}
|
|
2529
|
+
const rolledBackConnectors = existsSync(target) ? getPluginConnectors(target) : []
|
|
2530
|
+
for (const c of rolledBackConnectors) {
|
|
2531
|
+
try { unregisterConnector(pluginName, c.name) } catch {}
|
|
2532
|
+
}
|
|
2533
|
+
await removePluginSkillsFromDsh(pluginName, { allowQuarantine: true, preserveOtherEnabled: true }).catch(() => {})
|
|
2534
|
+
try { rmSync(compiledHooksPath(pluginName), { force: true }) } catch {}
|
|
2535
|
+
await removeManagedDirAsync(target, { allowTrash: true }).catch(() => {})
|
|
2536
|
+
}
|
|
2537
|
+
|
|
2438
2538
|
async function installMarketplacePluginFromSourceLocked({ sourceId, pluginName, refresh = false, initialEnabled = true }) {
|
|
2439
2539
|
const state = readState()
|
|
2440
2540
|
const source = state.sources.find((s) => s.id === sourceId)
|
|
@@ -2455,6 +2555,19 @@ async function installMarketplacePluginFromSourceLocked({ sourceId, pluginName,
|
|
|
2455
2555
|
// no longer ships and MCP servers it dropped would otherwise stay visible.
|
|
2456
2556
|
await abortPluginConnectorProbes(pluginName)
|
|
2457
2557
|
const prevConnectors = existsSync(target) ? getPluginConnectors(target).map((c) => c.name) : []
|
|
2558
|
+
if (installMayWriteCordisPatch(pluginName, dir, row, target, prevConnectors, initialEnabled)) {
|
|
2559
|
+
loadCordisPatch(cordisPatchPath())
|
|
2560
|
+
}
|
|
2561
|
+
|
|
2562
|
+
try {
|
|
2563
|
+
return await materializeAndRegisterPlugin({ sourceId, pluginName, row, dir, target, installed, prevConnectors, initialEnabled })
|
|
2564
|
+
} catch (error) {
|
|
2565
|
+
if (!installed) await rollbackFreshInstall(pluginName, target)
|
|
2566
|
+
throw error
|
|
2567
|
+
}
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2570
|
+
async function materializeAndRegisterPlugin({ sourceId, pluginName, row, dir, target, installed, prevConnectors, initialEnabled }) {
|
|
2458
2571
|
if (existsSync(target)) await removePluginSkillsFromDsh(pluginName, { allowQuarantine: true, preserveOtherEnabled: true })
|
|
2459
2572
|
|
|
2460
2573
|
// Idempotent reinstall: clear the previous copy first.
|
|
@@ -2662,9 +2775,6 @@ async function installMarketplacePluginFromSourceLocked({ sourceId, pluginName,
|
|
|
2662
2775
|
|
|
2663
2776
|
// Auto-register and connect any MCP connectors defined in the plugin that do NOT require auth and have valid URLs/commands.
|
|
2664
2777
|
const pluginConnectors = getPluginConnectors(target)
|
|
2665
|
-
for (const name of prevConnectors) {
|
|
2666
|
-
if (!pluginConnectors.some((c) => c.name === name)) unregisterConnector(pluginName, name)
|
|
2667
|
-
}
|
|
2668
2778
|
if (installed) {
|
|
2669
2779
|
// The new copy may ship different tools behind an unchanged command/URL.
|
|
2670
2780
|
const toolsState = readMcpToolsState()
|
|
@@ -2687,29 +2797,34 @@ async function installMarketplacePluginFromSourceLocked({ sourceId, pluginName,
|
|
|
2687
2797
|
|
|
2688
2798
|
const lspServers = listLspServers(target)
|
|
2689
2799
|
const lspErrors = []
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2800
|
+
withCordisPatchBatch(() => {
|
|
2801
|
+
for (const name of prevConnectors) {
|
|
2802
|
+
if (!pluginConnectors.some((c) => c.name === name)) unregisterConnector(pluginName, name)
|
|
2803
|
+
}
|
|
2804
|
+
unregisterPluginLsp(pluginName)
|
|
2805
|
+
if (initialEnabled) {
|
|
2806
|
+
// Auto-register LSP servers declared by the plugin. The host packages
|
|
2807
|
+
// (dsh-lsp / dsh-lsp-stdio / dsh-tool-lsp) were pre-provisioned by the
|
|
2808
|
+
// hub's `apply()` at DSH startup — this step is a single, race-free
|
|
2809
|
+
// patch write. `lspErrors` still surface other failures (the user-installed
|
|
2810
|
+
// language server binary not on PATH, missing extensionToLanguage, etc.).
|
|
2811
|
+
// Drop the previous version's server entries; the loop re-adds the ones this
|
|
2812
|
+
// version still declares, so removed servers stop loading.
|
|
2813
|
+
for (const r of registerPluginLsp(pluginName)) {
|
|
2814
|
+
if (!r.ok && r.error) lspErrors.push(r.error)
|
|
2815
|
+
}
|
|
2816
|
+
|
|
2817
|
+
// Register the plugin's Claude/Codex hooks into DSH via the hooks bridge.
|
|
2818
|
+
// The bridge package was pre-provisioned by the hub's `apply()`; this is a
|
|
2819
|
+
// single patch write.
|
|
2820
|
+
registerPluginHooksSync(pluginName)
|
|
2821
|
+
} else {
|
|
2822
|
+
for (const c of pluginConnectors) {
|
|
2823
|
+
toggleConnector(pluginName, c.name, false)
|
|
2824
|
+
}
|
|
2825
|
+
unregisterPluginHooks(pluginName)
|
|
2710
2826
|
}
|
|
2711
|
-
|
|
2712
|
-
}
|
|
2827
|
+
})
|
|
2713
2828
|
|
|
2714
2829
|
const record = {
|
|
2715
2830
|
id: `${sourceId}/${pluginName}`,
|
|
@@ -2907,8 +3022,8 @@ async function togglePluginUnlocked(pluginName, enabled, epoch, options = {}) {
|
|
|
2907
3022
|
for (const r of registerPluginLsp(pluginName)) {
|
|
2908
3023
|
if (!r.ok && r.error) lspErrors.push(r.error)
|
|
2909
3024
|
}
|
|
3025
|
+
registerPluginHooksSync(pluginName)
|
|
2910
3026
|
})
|
|
2911
|
-
await registerPluginHooks(pluginName)
|
|
2912
3027
|
} catch (err) {
|
|
2913
3028
|
if (rec.enabled === false) await rollbackEnable()
|
|
2914
3029
|
throw err
|
|
@@ -3126,7 +3241,7 @@ function mcpPublicToolName(server, rawName) {
|
|
|
3126
3241
|
/** Public branding only. Connector configuration and tool arguments stay out of this response. */
|
|
3127
3242
|
export function toolCallIconGroups() {
|
|
3128
3243
|
const registrations = readCordisPatch().flatMap(block => block?.insert || [])
|
|
3129
|
-
.filter(entry => entry?.name === '@deepseek-ai/dsh-mcp-client' && /^[A-Za-z0-9_-]{1,32}$/.test(entry.config
|
|
3244
|
+
.filter(entry => entry?.name === '@deepseek-ai/dsh-mcp-client' && typeof entry.config?.serverName === 'string' && /^[A-Za-z0-9_-]{1,32}$/.test(entry.config.serverName))
|
|
3130
3245
|
const byServer = new Map()
|
|
3131
3246
|
for (const entry of registrations) {
|
|
3132
3247
|
const server = entry.config.serverName
|
package/src/routes.js
CHANGED
|
@@ -588,7 +588,7 @@ async function handle(req, res, prefix = API_PREFIX, skills = null, applyProfile
|
|
|
588
588
|
const cfg = item.config || {}
|
|
589
589
|
const ownership = pluginTools?.[`user-mcp::${cfg.serverName}`]
|
|
590
590
|
if (ownership?.pluginConnectorOwned || (ownership?.pluginOAuthOwned && remoteConfigFromEntry(cfg))) continue
|
|
591
|
-
if (cfg.serverName && !state.userMcps.some((x) => x && x.name === cfg.serverName)) {
|
|
591
|
+
if (typeof cfg.serverName === 'string' && cfg.serverName && !state.userMcps.some((x) => x && x.name === cfg.serverName)) {
|
|
592
592
|
state.userMcps.push(userMcpConfig(cfg.serverName, {
|
|
593
593
|
transport: cfg.transport, url: cfg.url, command: cfg.command,
|
|
594
594
|
args: Array.isArray(cfg.args) ? cfg.args : [], cwd: cfg.cwd,
|