dsh-config-sync-plugin 0.4.13 → 0.4.15

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/README.en.md CHANGED
@@ -257,14 +257,14 @@ Two display fixes on top of 0.3.77:
257
257
 
258
258
  The "Plugin update" card now shows an **npm download URL** line with the actual fallback addresses (domestic mirror `registry.npmmirror.com` + official `registry.npmjs.org`). When the GitHub release download is unreachable (common in mainland China), the update package automatically falls back to npm. It is still verified against the authoritative sha256 in `version.json` — switching source never relaxes verification. The two sources back each other up: the mirror can briefly 404 during its first-sync window, and the official source takes over. The npm tarball is byte-identical to the GitHub release tgz (same sha256).
259
259
 
260
- ### Fix npm fallback download sha256 mismatch (0.4.13)
260
+ ### MCP connector sync fix (0.4.15)
261
261
 
262
- This release fixes the npm fallback download failures introduced in v0.4.12:
262
+ This release fixes the MCP connector sync failures caused by missing group in PowerShell runtime scripts:
263
263
 
264
- - **Root cause**: `version.json` only recorded the GitHub release asset's sha256, but npm tarballs (npmmirror + official registry) are different build artifacts with different hashes. When GitHub release was unreachable and the download fell back to npm, it still used the GitHub sha256 for verification, causing all fallback downloads to fail.
265
- - **Fix**: `version.json` adds an `npmSha256` field recording the npm tarball hash; download logic adds `isNpmRegistryUrl()` and `pickSha256ForUrl()` to automatically pick the correct hash by URL source (GitHub release uses `sha256`, npm registry uses `npmSha256`). GitHub release unreachable cases now correctly fall back to npm and pass verification.
264
+ - **Root cause**: v0.4.14 added the MCP connector sync group, but PowerShell runtime scripts (`dsh-sync-common.ps1`, `capture.ps1`) had hardcoded group lists missing `mcp-connectors`, causing capture/apply to skip the group and fail to sync configs.
265
+ - **Fix**: Added `mcp-connectors` to `$SyncScopeGroups` in `dsh-sync-common.ps1` and the hardcoded group list in `capture.ps1`, aligning with `index.js`'s `collectScopeGroups`.
266
266
 
267
- ### Content-level pending detection: only prompt to push when content actually changed (0.4.12)
267
+ ### Add MCP connector sync support (0.4.14)
268
268
 
269
269
  This release changes the "pending push" rule from a timestamp check to a content-level check, fixing false positives without altering the normal push/pull flow:
270
270
 
package/README.md CHANGED
@@ -277,14 +277,14 @@ pwsh -File runtime\sync.ps1 pull `
277
277
 
278
278
  「插件更新」卡新增一行 **npm 下载路径**,直接显示实际兜底地址(国内镜像 `registry.npmmirror.com` + 官方 `registry.npmjs.org` 两个源)。GitHub release 整段不通时(国内常见),更新包会自动兜底从 npm 下载;仍按 `version.json` 里的权威 sha256 校验,换源不放宽校验。两个源互为备份:镜像首发同步窗口期会短暂 404,官方源随即兜上。实测 npm tarball 与 GitHub release tgz 是同一份产物、sha256 完全一致。
279
279
 
280
- ### 修复 npm 兜底下载 sha256 校验不一致(0.4.13)
280
+ ### MCP 连接器同步修复(0.4.15)
281
281
 
282
- 本版解决 v0.4.12 引入的 npm 兜底下载全部失败问题:
282
+ 本版修复 MCP 连接器同步功能在 PowerShell 运行时脚本中缺失导致的同步失败问题:
283
283
 
284
- - **根因**:`version.json` 只记录 GitHub release asset 的 sha256,但 npm tarball(npmmirror + 官方 registry)打包产物不同,哈希不一致。GitHub release 不通时回退到 npm,仍用 GitHub 的 sha256 校验,导致全部失败。
285
- - **修复**:`version.json` 新增 `npmSha256` 字段记录 npm tarball 哈希;下载逻辑新增 `isNpmRegistryUrl()` 与 `pickSha256ForUrl()`,按 URL 来源自动选对应哈希(GitHub release 用 `sha256`、npm registry 用 `npmSha256`)。GitHub release 不通时可正常走 npm 兜底下载并通过校验。
284
+ - **根因**:v0.4.14 新增了 MCP 连接器同步组,但 PowerShell 运行时脚本(`dsh-sync-common.ps1`、`capture.ps1`)的硬编码组列表未同步添加 `mcp-connectors`,导致捕获/应用时跳过该组,配置无法同步。
285
+ - **修复**:在 `dsh-sync-common.ps1` 的 `$SyncScopeGroups` 和 `capture.ps1` 的硬编码组列表中添加 `mcp-connectors`,与 `index.js` 的 `collectScopeGroups` 保持一致。
286
286
 
287
- ### 待推送判据改为内容级:实际内容变了才提示推送(0.4.12)
287
+ ### 新增 MCP 连接器同步支持(0.4.14)
288
288
 
289
289
  本版把「待推送」从时间戳判据改为内容级判据,只修误报、不改变正常推送/拉取流程:
290
290
 
package/index.js CHANGED
@@ -2792,11 +2792,11 @@ async function downloadPackage({ urls, sha256, npmSha256, version, dshHome }) {
2792
2792
  try { mkdirSync(dir, { recursive: true }) } catch { }
2793
2793
  const file = join(dir, `dsh-config-sync-plugin-${version}.tgz`)
2794
2794
  const errors = []
2795
+ // 两个已知合法 sha256,允许任一匹配即通过(兼容 URL 分类边界、重定向等极端情况)
2796
+ const validSha256 = new Set([String(sha256 || '').toLowerCase(), String(npmSha256 || '').toLowerCase()].filter(Boolean))
2795
2797
  for (const rawUrl of urls) {
2796
2798
  const url = String(rawUrl || '').trim()
2797
2799
  if (!url) continue
2798
- // 根据 URL 来源选择对应的 sha256:npm 源用 npmSha256,GitHub release 用 sha256
2799
- const want = String(pickSha256ForUrl(url, sha256, npmSha256) || '').toLowerCase()
2800
2800
  try {
2801
2801
  const ctrl = typeof AbortController === 'function' ? new AbortController() : null
2802
2802
  const timer = ctrl ? setTimeout(() => { try { ctrl.abort() } catch { } }, 120 * 1000) : null
@@ -2810,7 +2810,8 @@ async function downloadPackage({ urls, sha256, npmSha256, version, dshHome }) {
2810
2810
  const buf = Buffer.from(await res.arrayBuffer())
2811
2811
  if (!buf.length) throw new Error(t('下载到的文件是空的', 'the downloaded file is empty'))
2812
2812
  const hash = createHash('sha256').update(buf).digest('hex')
2813
- if (want && hash !== want) throw new Error(t(`sha256 不一致(拿到 ${hash})`, `sha256 mismatch (got ${hash})`))
2813
+ // 只要命中任一合法 sha256 即通过(兼容 URL 分类/重定向边界情况)
2814
+ if (validSha256.size && !validSha256.has(hash)) throw new Error(t(`sha256 不一致(拿到 ${hash},合法值:${[...validSha256].join('、')})`, `sha256 mismatch (got ${hash}, valid: ${[...validSha256].join(', ')})`))
2814
2815
  writeFileSync(file, buf)
2815
2816
  return { ok: true, file, size: buf.length, sha256: hash, url }
2816
2817
  } catch (error) {
@@ -3378,6 +3379,14 @@ function collectScopeGroups(dshHome, appRoot) {
3378
3379
  descZh: '免付费模型设置、ComfyUI 工作流库、桌宠配置、插件市场状态', descEn: 'Free-model settings, ComfyUI workflows, desktop-pet config, market state',
3379
3380
  items: settingsFiles.map((x) => ({ id: x.id, label: x.id })) })
3380
3381
 
3382
+ // MCP 连接器配置
3383
+ const mcpConnectorFile = join(dshHome, 'storages', 'mcp_connector.json')
3384
+ if (existsSync(mcpConnectorFile)) {
3385
+ groups.push({ id: 'mcp-connectors', titleZh: 'MCP 连接器', titleEn: 'MCP Connectors',
3386
+ descZh: '已连接的 MCP 连接器配置(含 OAuth 授权、API Key 等)', descEn: 'Connected MCP connector configurations (OAuth grants, API keys, etc.)',
3387
+ items: [{ id: 'mcp_connector.json', label: 'mcp_connector.json', excludable: false }] })
3388
+ }
3389
+
3381
3390
  const mnemonDir = appRoot ? join(appRoot, 'mnemon') : ''
3382
3391
  const mnemonCount = mnemonDir && existsSync(mnemonDir) ? countEntries(mnemonDir) : 0
3383
3392
  groups.push({ id: 'mnemon', titleZh: '记忆数据', titleEn: 'Memory data',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-config-sync-plugin",
3
- "version": "0.4.13",
3
+ "version": "0.4.15",
4
4
  "type": "module",
5
5
  "description": "在 DSH 设置里查看 dsh-config 仓库与本机的同步状态,并生成退出后执行的 push/pull 脚本。同步动作本身不在应用内执行。面板与文案跟随客户端语言(中文/English)。",
6
6
  "main": "./index.js",
@@ -16,6 +16,7 @@
16
16
  "README.md",
17
17
  "README.en.md",
18
18
  "LICENSE",
19
+ "package.json",
19
20
  "runtime",
20
21
  "tools"
21
22
  ],
@@ -601,7 +601,7 @@ $Scope = Get-SyncScope $DshHome
601
601
 
602
602
  $ProfileDir = Join-Path $DshHome ("profiles\" + $ProfileName)
603
603
  if (-not $WorkspaceOnly -and -not (Test-Path -LiteralPath $ProfileDir)) { Die "找不到 profile:$ProfileDir" }
604
- foreach ($d in @('profile', 'prompt', 'skills', 'presets', 'local-plugins', 'storages-record', 'settings', 'mnemon', 'plugin-data', 'extra', 'workspace', 'conversations')) {
604
+ foreach ($d in @('profile', 'prompt', 'skills', 'presets', 'local-plugins', 'storages-record', 'settings', 'mnemon', 'plugin-data', 'extra', 'workspace', 'conversations', 'mcp-connectors')) {
605
605
  $p = Join-Path $RepoRoot $d
606
606
  if (-not (Test-Path -LiteralPath $p)) { New-Item -ItemType Directory -Path $p -Force | Out-Null }
607
607
  }
@@ -251,7 +251,7 @@ function Get-AppRootPattern([string]$appRoot) {
251
251
  # 关键修正:排除反斜杠边界,避免吞掉 JSON 里的 \"
252
252
  # (?<![A-Za-z0-9_\]) 排除前置反斜杠;(?![\w-\]) 排除后置反斜杠
253
253
  # [^\s"',;()\[\]\\] 排除路径字符类里的反斜杠
254
- return ('(?i)(?<![A-Za-z0-9_\\])[A-Z]:[\\/]+(?:[^\s"''`,;()\[\]\\]*[\\/]+)?' + [regex]::Escape($leaf) + '(?![\w-\\])(?:[\\/]+)?')
254
+ return ('(?i)(?<![A-Za-z0-9_\\])[A-Z]:[\\/]+(?:[^\s"''`,;()\[\]\\]*[\\/]+)?' + [regex]::Escape($leaf) + '(?![\w-\\])(?:[\\/]+)?')
255
255
  }
256
256
 
257
257
  function Get-AppRootFwd([string]$appRoot) {
@@ -530,7 +530,7 @@ function Resolve-DshAppRoot([string]$explicit) {
530
530
  # 面板「同步内容」卡片的落点:每组一行、组内还能排除单项。文件不存在 = 全勾(老行为不变)。
531
531
  # 纪律:勾选只决定「要不要处理」——跳过就是既不抓也不还原;
532
532
  # 只有 deleteCloud 打开时才顺手删掉仓库里那份副本(默认关闭,删了就不可逆)。
533
- $SyncScopeGroups = @('profile', 'prompt', 'skills', 'presets', 'storages-record', 'settings', 'mnemon', 'local-plugins', 'plugin-data', 'extra', 'workspace', 'conversations')
533
+ $SyncScopeGroups = @('profile', 'prompt', 'skills', 'presets', 'storages-record', 'settings', 'mnemon', 'local-plugins', 'plugin-data', 'extra', 'workspace', 'conversations', 'mcp-connectors')
534
534
 
535
535
  # ---------- 插件数据 / 额外路径(0.3.51 起)----------
536
536
  # 背景:以前的同步范围是白名单(十组固定清单),新装的插件如果自己往 <DshHome>\<插件名>\ 或