dsh-mcp-connector 0.2.113 → 0.2.115

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.
Files changed (50) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.en.md +12 -12
  3. package/README.md +11 -11
  4. package/docs/PLUGIN-UPDATE.md +16 -4
  5. package/docs/SESSION-TOOL-INJECTION.md +13 -7
  6. package/docs/STDIO-SUPPORT.md +2 -2
  7. package/docs/USER-GUIDE.md +14 -4
  8. package/docs/screenshots/01-market-overview.jpg +0 -0
  9. package/docs/screenshots/02-connector-detail.jpg +0 -0
  10. package/docs/screenshots/03-tool-discovery.jpg +0 -0
  11. package/docs/screenshots/04-json-import.jpg +0 -0
  12. package/docs/screenshots/05-unified-tool-search.png +0 -0
  13. package/docs/screenshots/06-tool-parameters.png +0 -0
  14. package/docs/screenshots/07-connection-diagnostics.png +0 -0
  15. package/docs/screenshots/08-ten-recommendations.jpg +0 -0
  16. package/docs/screenshots/README.md +1 -1
  17. package/docs/screenshots/assets.json +30 -30
  18. package/docs/screenshots/en/01-market-overview.jpg +0 -0
  19. package/docs/screenshots/en/02-connector-detail.jpg +0 -0
  20. package/docs/screenshots/en/03-tool-discovery.jpg +0 -0
  21. package/docs/screenshots/en/04-json-import.jpg +0 -0
  22. package/docs/screenshots/en/05-unified-tool-search.png +0 -0
  23. package/docs/screenshots/en/06-tool-parameters.png +0 -0
  24. package/docs/screenshots/en/07-connection-diagnostics.png +0 -0
  25. package/docs/screenshots/en/08-ten-recommendations.jpg +0 -0
  26. package/docs/screenshots/en/assets.json +30 -30
  27. package/docs/screenshots/en/demo.gif +0 -0
  28. package/docs/tutorials/FIRST-SUCCESS-SCENARIOS.md +1 -1
  29. package/lib/catalog.js +2 -2
  30. package/lib/client.js +224 -43
  31. package/lib/connection-editor.js +1 -1
  32. package/lib/connectors/json-connector.js +2 -2
  33. package/lib/connectors/manual-connector.js +2 -2
  34. package/lib/custom-oauth.js +2 -2
  35. package/lib/i18n/locales/en/client.js +16 -0
  36. package/lib/i18n/locales/en/tools.js +1 -1
  37. package/lib/i18n/locales/en/upgrade.js +1 -1
  38. package/lib/index.js +11 -5
  39. package/lib/legacy-sse-bridge.js +46 -0
  40. package/lib/legacy-sse.js +174 -0
  41. package/lib/mcp-http.js +5 -1
  42. package/lib/mcp-provision.js +12 -0
  43. package/lib/mcp-validation.js +4 -0
  44. package/lib/probe.js +30 -21
  45. package/lib/schema.js +8 -8
  46. package/lib/shareable-connection-template.js +6 -4
  47. package/lib/tools.js +1 -1
  48. package/lib/version-status.js +2 -0
  49. package/package.json +2 -2
  50. package/ui/index.html +1 -1
@@ -2,9 +2,9 @@
2
2
  "schemaVersion": 1,
3
3
  "capture": {
4
4
  "locale": "en",
5
- "capturedOn": "2026-11-18",
6
- "sourceVersion": "0.2.113",
7
- "sourceFingerprint": "a815e3bdcd6ecdd753ce911467e5b6e48b8df8e2a5c7d7a7e4f6505184b16373",
5
+ "capturedOn": "2026-11-19",
6
+ "sourceVersion": "0.2.115",
7
+ "sourceFingerprint": "e59bccf7afa9c5fde7b87e2f68c8eda78e02037bda47c01758b70b43633ba3ba",
8
8
  "browserViewport": {
9
9
  "width": 1280,
10
10
  "height": 720
@@ -17,63 +17,63 @@
17
17
  "screenshots": [
18
18
  {
19
19
  "path": "docs/screenshots/en/01-market-overview.jpg",
20
- "sha256": "3c1fa1f4d1f5abee2209bfecc56585c5f422282b73ed0e915d758c9bd2438585",
20
+ "sha256": "bd49377f91e3ec28d30c21ff0037a7ac44ab39ef26ce673cf762294302fc4298",
21
21
  "width": 1280,
22
22
  "height": 720,
23
- "capturedOn": "2026-11-18",
24
- "sourceVersion": "0.2.113"
23
+ "capturedOn": "2026-11-19",
24
+ "sourceVersion": "0.2.115"
25
25
  },
26
26
  {
27
27
  "path": "docs/screenshots/en/02-connector-detail.jpg",
28
- "sha256": "3662d80f940c0b9fe5600637cdc61c2a9d9d3f98d3e662c76d94939084f652ed",
28
+ "sha256": "7bee0ed0a01c59b6bec9733349b0a01a329db5610c8433931a5121d41b59403a",
29
29
  "width": 1280,
30
30
  "height": 720,
31
- "capturedOn": "2026-11-18",
32
- "sourceVersion": "0.2.113"
31
+ "capturedOn": "2026-11-19",
32
+ "sourceVersion": "0.2.115"
33
33
  },
34
34
  {
35
35
  "path": "docs/screenshots/en/03-tool-discovery.jpg",
36
- "sha256": "ad5e025720bbb0cdd20fb0224c3f26e8a7d1291be35a5deaa72f47f9cb41b9a6",
36
+ "sha256": "1ab517e2fae693a448b841f8534d59e44db3d1c68c6642e8fb5d02c84a7848a0",
37
37
  "width": 1280,
38
38
  "height": 720,
39
- "capturedOn": "2026-11-18",
40
- "sourceVersion": "0.2.113"
39
+ "capturedOn": "2026-11-19",
40
+ "sourceVersion": "0.2.115"
41
41
  },
42
42
  {
43
43
  "path": "docs/screenshots/en/04-json-import.jpg",
44
- "sha256": "b1a9c876ed3a19c22203c8ba8660523a973d6ff34248313794618af834a95ba8",
44
+ "sha256": "ed78625cac603bc5bbb6b7f23f1ac5526a7639faeb540bb0b696f8d0c5cf684c",
45
45
  "width": 1280,
46
46
  "height": 720,
47
- "capturedOn": "2026-11-18",
48
- "sourceVersion": "0.2.113"
47
+ "capturedOn": "2026-11-19",
48
+ "sourceVersion": "0.2.115"
49
49
  },
50
50
  {
51
51
  "path": "docs/screenshots/en/05-unified-tool-search.png",
52
- "sha256": "d8b5e30e8c6075ba7410cb5b518968715a685a69357a547575501fba0ecf4405",
52
+ "sha256": "fbec6ec1daef84f4074823186d0c8f02f5beff567349e4f237c379ad7f9112dc",
53
53
  "width": 1280,
54
54
  "height": 720,
55
- "capturedOn": "2026-11-18",
56
- "sourceVersion": "0.2.113"
55
+ "capturedOn": "2026-11-19",
56
+ "sourceVersion": "0.2.115"
57
57
  },
58
58
  {
59
59
  "path": "docs/screenshots/en/06-tool-parameters.png",
60
- "sha256": "97f9afd6cf1bde2ec92d6c7ec83a5139e6ec89f280666ab60e473606c939de8a",
60
+ "sha256": "cebd97cd53ee1b67b79e19eeae8111dacdc90a27fef0400770f8e7084e4fd23d",
61
61
  "width": 1280,
62
62
  "height": 720,
63
- "capturedOn": "2026-11-18",
64
- "sourceVersion": "0.2.113"
63
+ "capturedOn": "2026-11-19",
64
+ "sourceVersion": "0.2.115"
65
65
  },
66
66
  {
67
67
  "path": "docs/screenshots/en/07-connection-diagnostics.png",
68
- "sha256": "08a3a101d3817e54eb7d56b70e53f7d27febc25ba64826785efdc11e74c16fde",
68
+ "sha256": "9acda276dfb24fa337db482dcb21b84ca49370530b6d8c6d06a657373dc5eec7",
69
69
  "width": 1280,
70
70
  "height": 720,
71
- "capturedOn": "2026-11-18",
72
- "sourceVersion": "0.2.113"
71
+ "capturedOn": "2026-11-19",
72
+ "sourceVersion": "0.2.115"
73
73
  },
74
74
  {
75
75
  "path": "docs/screenshots/en/08-ten-recommendations.jpg",
76
- "sha256": "45d61e4f8b9ab3a2a1922b5bba6646fd142e02f6612a65f7d3e17a52b80ed23c",
76
+ "sha256": "18eb233bab59bf6f2dad9546855e1fb698f1c6b392a17f7ee6c73de14733c38d",
77
77
  "width": 1280,
78
78
  "height": 1400,
79
79
  "browserViewport": {
@@ -81,17 +81,17 @@
81
81
  "height": 1400
82
82
  },
83
83
  "panelHeight": 1280,
84
- "capturedOn": "2026-11-18",
85
- "sourceVersion": "0.2.113"
84
+ "capturedOn": "2026-11-19",
85
+ "sourceVersion": "0.2.115"
86
86
  }
87
87
  ],
88
88
  "demo": {
89
89
  "path": "docs/screenshots/en/demo.gif",
90
- "sha256": "f8663a8b789df97fe039878c37a5461e7188e5209e18932f07686244f399ac73",
90
+ "sha256": "10bf5b87214c2686f8a6b21687fd9534c7b9abba260de5d1db358a7ebda2c7e1",
91
91
  "width": 960,
92
92
  "height": 540,
93
- "capturedOn": "2026-11-18",
94
- "sourceVersion": "0.2.113",
93
+ "capturedOn": "2026-11-19",
94
+ "sourceVersion": "0.2.115",
95
95
  "durationSeconds": 36
96
96
  }
97
97
  }
Binary file
@@ -8,7 +8,7 @@
8
8
 
9
9
  | 项目 | 验收要求 |
10
10
  |---|---|
11
- | 前提 | <!-- generated:version -->正式 `dsh-mcp-connector@0.2.113`<!-- /generated:version -->;当前 Workspace;企查查 OAuth 可用;测试账号具有目标企业数据权限 |
11
+ | 前提 | <!-- generated:version -->正式 `dsh-mcp-connector@0.2.115`<!-- /generated:version -->;当前 Workspace;企查查 OAuth 可用;测试账号具有目标企业数据权限 |
12
12
  | 权限/管理员 | 账号权限、组织授权和可见字段由服务商控制;企业组织可能需要管理员开通,当前文档不能替代审批 |
13
13
  | 费用 | 可能受套餐、次数或字段权限影响;MCP连接器无法确认本次费用,调用前在服务商侧核对 |
14
14
  | 运行/数据去向 | 远程 MCP Server;企业名称、查询参数和调用结果经 DSH Host 发送到/返回自 `agent.qcc.com` |
package/lib/catalog.js CHANGED
@@ -63,7 +63,7 @@ export function bundledTemplateReferences() {
63
63
  export function auditDescriptor(descriptor, { t = tZh } = {}) {
64
64
  const oauthHttpResources = new Set(
65
65
  descriptor.servers
66
- .filter((server) => server.transport === 'streamable-http')
66
+ .filter((server) => ['streamable-http', 'sse'].includes(server.transport))
67
67
  .map((server) => server.oauthResource ?? server.url),
68
68
  );
69
69
  const credentialFields = descriptor.auth.credentialFields ?? [];
@@ -149,7 +149,7 @@ export function auditDescriptor(descriptor, { t = tZh } = {}) {
149
149
  throw new Error(t('connector "{id}" 的 OAuth 授权至少需要一个 HTTP resource', { id: descriptor.id }));
150
150
  }
151
151
  if (['bearer', 'api-key'].includes(descriptor.auth.mode)) {
152
- const httpServers = descriptor.servers.filter((server) => server.transport === 'streamable-http');
152
+ const httpServers = descriptor.servers.filter((server) => ['streamable-http', 'sse'].includes(server.transport));
153
153
  if (httpServers.length > 0 && credentialFields[0]) referencedCredentials.add(credentialFields[0].key);
154
154
  for (const field of credentialFields) {
155
155
  if (field.required && !referencedCredentials.has(field.key)) {
package/lib/client.js CHANGED
@@ -91,6 +91,18 @@ window.__ModuleLoader__.load({
91
91
  "重试更新": "Retry update",
92
92
  "检测到异常版本,正在自动回滚…": "An unexpected version was detected. Rolling back automatically…",
93
93
  "查看更新方式": "See update options",
94
+ "当前版本 v{current},发现新版本 v{target}": "Current version v{current}, new version v{target}",
95
+ "暂时无法确认 MCP 连接器是否有新版本。": "Could not check whether a new MCP Connector version is available.",
96
+ "重新检查失败,显示上次发现的版本。": "The check failed. Showing the previously found version.",
97
+ "重新检查": "Check again",
98
+ "查看手动升级命令": "View manual upgrade command",
99
+ "前往更新": "Go to update",
100
+
101
+ "npm 尚未确认此版本,暂时无法提供升级命令。": "An upgrade command will be available once npm confirms this version.",
102
+ "从插件页更新": "Update from the plugin page",
103
+ "请打开侧栏“插件” → “已安装” → dsh-mcp-connector,查看当前可用的更新。": "Open Plugins in the sidebar, select Installed, and choose dsh-mcp-connector to see available updates.",
104
+ "未能打开插件详情页。": "Could not open the plugin details page. ",
105
+ "请打开侧栏“插件” → “已安装” → dsh-mcp-connector,然后点击“更新到 v{version}”。": "Open Plugins in the sidebar, select Installed, choose dsh-mcp-connector, then click Update to v{version}.",
94
106
  "已回滚": "Rolled back",
95
107
  "已阻止异常版本并回滚": "Blocked the unexpected version and rolled back",
96
108
  "已安装 v{version}": "Installed v{version}",
@@ -109,6 +121,10 @@ window.__ModuleLoader__.load({
109
121
  "正在准备更新…": "Preparing the update…",
110
122
  "由 {provider} 安全更新到 v{version}": "Update safely to v{version} via {provider}",
111
123
  "更新服务": "the update service",
124
+ "更新到 v{version}": "Update to v{version}",
125
+ "使用 Web 启动时的终端": "Use the terminal where you started the Web app",
126
+ "查看升级方式": "View upgrade methods",
127
+ "收起升级方式": "Hide upgrade methods",
112
128
  "一键更新到 v{version}": "Update to v{version}",
113
129
  "v{version} 已安装,重启后生效": "v{version} is installed and takes effect after a restart",
114
130
  "已复制": "Copied",
@@ -437,6 +453,30 @@ window.__ModuleLoader__.load({
437
453
  min-width: 0;
438
454
  flex: 1 1 360px;
439
455
  }
456
+ .mcpConnectorUpdateGroup, .mcpConnectorUpdateFallback {
457
+ display: inline-flex;
458
+ align-items: center;
459
+ gap: 8px;
460
+ max-width: 100%;
461
+ min-width: 0;
462
+ }
463
+ .mcpConnectorUpdateGroup .mcpConnectorVersion { overflow-wrap: anywhere; min-width: 0; }
464
+ .mcpConnectorUpdateGroup > button { flex-shrink: 0; }
465
+ .mcpConnectorUpdateFallback {
466
+ align-items: flex-start;
467
+ flex-direction: column;
468
+ align-self: stretch;
469
+ max-height: 35%;
470
+ overflow: auto;
471
+ margin: 8px 16px;
472
+ padding: 8px 12px;
473
+ border-inline-start: 3px solid #a5a8e8;
474
+ background: rgba(120, 120, 155, 0.08);
475
+ font-size: 13px;
476
+ }
477
+ .mcpConnectorUpdateFallback .mcpConnectorManualUpdate { flex: initial; }
478
+ .mcpConnectorUpdateButton.mcpConnectorUpdatePrimary { color: white; background: #5143ce; border-color: #5143ce; }
479
+ .mcpConnectorUpdateLink { font: inherit; color: inherit; background: none; border: 0; text-decoration: underline; cursor: pointer; }
440
480
  .mcpConnectorUpdateHint {
441
481
  flex-basis: 100%;
442
482
  font-size: 12px;
@@ -1662,6 +1702,8 @@ window.__ModuleLoader__.load({
1662
1702
  actions,
1663
1703
  presentation = "modal",
1664
1704
  closePanel = null,
1705
+ getUpdateNavigation,
1706
+ sidebarUpdateMemory,
1665
1707
  startPromptSession: launchPromptSession,
1666
1708
  workspaceContext = () => null,
1667
1709
  workspaceOptions = () => [],
@@ -1677,7 +1719,7 @@ window.__ModuleLoader__.load({
1677
1719
  const [versionStatus, setVersionStatus] = (0, react.useState)(null);
1678
1720
  const [updateProviderState, setUpdateProviderState] = (0, react.useState)("checking");
1679
1721
  const [updateProviderSelection, setUpdateProviderSelection] = (0, react.useState)(null);
1680
- const [providerUpdateCheck, setProviderUpdateCheck] = (0, react.useState)(null);
1722
+ const [providerUpdateCheck, setProviderUpdateCheck] = (0, react.useState)(sidebarUpdateMemory?.offer ?? null);
1681
1723
  const [expectedUpdateVersion, setExpectedUpdateVersion] = (0, react.useState)(null);
1682
1724
  const [updateOperation, setUpdateOperation] = (0, react.useState)(null);
1683
1725
  const [updateError, setUpdateError] = (0, react.useState)(null);
@@ -1690,20 +1732,35 @@ window.__ModuleLoader__.load({
1690
1732
  const [versionCheckBusy, setVersionCheckBusy] = (0, react.useState)(false);
1691
1733
  const [versionCheckFailed, setVersionCheckFailed] = (0, react.useState)(false);
1692
1734
  const [manualProfileChoice, setManualProfileChoice] = (0, react.useState)(null);
1735
+ const [otherMethodsOpen, setOtherMethodsOpen] = (0, react.useState)(false);
1736
+ const [showNavigationHint, setShowNavigationHint] = (0, react.useState)(false);
1693
1737
  const frameRef = (0, react.useRef)(null);
1694
1738
  const closeRef = (0, react.useRef)(null);
1695
1739
  const profileInfo = clientProfileInfo(versionStatus);
1696
- const manualProfileContext = JSON.stringify([open, versionStatus?.latestVersion, profileInfo]);
1740
+ const desktopUpdate = window.dshDesktop?.protocolVersion === 1
1741
+ && ["win32", "darwin"].includes(document.documentElement?.dataset?.platform);
1742
+ const webUpdate = !window.dshDesktop;
1743
+ const compactHeader = desktopUpdate || webUpdate;
1744
+ const npmTarget = versionStatus?.latestVersion;
1745
+ const providerTarget = desktopUpdate && providerUpdateCheck?.updateAvailable
1746
+ ? parseClientVersion(providerUpdateCheck.latestVersion)?.normalized : null;
1747
+ const providerAhead = providerTarget && (!versionStatus?.updateAvailable || compareClientVersions(providerTarget, npmTarget) > 0);
1748
+ const targetVersion = webUpdate && providerUpdateCheck?.updateAvailable
1749
+ ? providerUpdateCheck.latestVersion
1750
+ : providerAhead ? providerTarget : npmTarget;
1751
+ // The native page rechecks its own offer. Only copy a CLI target confirmed by npm.
1752
+ const manualTarget = desktopUpdate && (providerAhead || versionCheckFailed || !versionStatus?.updateAvailable) ? null : npmTarget;
1753
+ const manualProfileContext = JSON.stringify([open, targetVersion, profileInfo]);
1697
1754
  const needsManualProfileChoice = ["unavailable", "read-error", "invalid-value"].includes(profileInfo.status);
1698
1755
  const selectedProfile = manualProfileChoice?.context === manualProfileContext ? manualProfileChoice.name : null;
1699
1756
  const commandProfile = profileInfo.status === "ready" ? profileInfo.detectedName
1700
1757
  : needsManualProfileChoice ? selectedProfile : null;
1701
- const manualCommandKey = JSON.stringify([manualProfileContext, selectedProfile]);
1758
+ const manualCommandKey = JSON.stringify([manualProfileContext, selectedProfile, manualTarget]);
1702
1759
  const manualCommandRef = (0, react.useRef)(null);
1703
1760
  if (manualCommandRef.current?.key !== manualCommandKey) {
1704
1761
  manualCommandRef.current = {
1705
1762
  key: manualCommandKey,
1706
- command: open ? manualUpgradeCommand(versionStatus?.latestVersion, commandProfile) : null
1763
+ command: open ? manualUpgradeCommand(manualTarget, commandProfile) : null
1707
1764
  };
1708
1765
  }
1709
1766
  const manualCommandState = manualCommandRef.current;
@@ -1766,7 +1823,12 @@ window.__ModuleLoader__.load({
1766
1823
  setVersionCheckBusy(true);
1767
1824
  fetchVersionStatus(force).then((status) => {
1768
1825
  if (disposed) return;
1769
- setVersionStatus(status);
1826
+ setVersionStatus(previous => {
1827
+ if (status.sources?.npm?.ok || status.lastConfirmedUpdateVersion
1828
+ || previous?.installedVersion !== status.installedVersion) return status;
1829
+ const lastTarget = previous?.updateAvailable ? previous.latestVersion : previous?.lastConfirmedUpdateVersion;
1830
+ return lastTarget ? { ...status, lastConfirmedUpdateVersion: lastTarget } : status;
1831
+ });
1770
1832
  setVersionCheckBusy(status.checking === true);
1771
1833
  setVersionCheckFailed(!status.checking && status.sources?.npm?.ok !== true ? "npm" : false);
1772
1834
  if (status.checking) {
@@ -1797,7 +1859,12 @@ window.__ModuleLoader__.load({
1797
1859
  }, [open, versionCheckRequest]);
1798
1860
  (0, react.useEffect)(() => {
1799
1861
  setManualProfileChoice(null);
1862
+ setOtherMethodsOpen(false);
1800
1863
  }, [manualProfileContext]);
1864
+ (0, react.useEffect)(() => {
1865
+ // All versions use the same bundle details page. Retry navigation on the next visit.
1866
+ setShowNavigationHint(false);
1867
+ }, [open]);
1801
1868
  (0, react.useEffect)(() => {
1802
1869
  setManualCommandCopied(false);
1803
1870
  setManualCommandVisible(false);
@@ -1826,6 +1893,16 @@ window.__ModuleLoader__.load({
1826
1893
  });
1827
1894
  return () => { disposed = true; };
1828
1895
  }, [open, versionCheckRequest]);
1896
+ (0, react.useEffect)(() => {
1897
+ if (!sidebarUpdateMemory || updateProviderState === "checking") return;
1898
+ sidebarUpdateMemory.offer = updateProviderState === "ready" && providerUpdateCheck?.updateAvailable && !updateStarting && !updateOperation
1899
+ ? {
1900
+ updateAvailable: true,
1901
+ installedVersion: versionStatus?.installedVersion ?? providerUpdateCheck.installedVersion,
1902
+ latestVersion: providerUpdateCheck.latestVersion
1903
+ }
1904
+ : null;
1905
+ }, [sidebarUpdateMemory, updateProviderState, providerUpdateCheck, versionStatus?.installedVersion, updateStarting, updateOperation]);
1829
1906
  (0, react.useEffect)(() => {
1830
1907
  const operationId = updateOperation?.operationId;
1831
1908
  const provider = updateProviderSelection?.provider;
@@ -1965,16 +2042,28 @@ window.__ModuleLoader__.load({
1965
2042
  setUpdateError(error instanceof Error ? error.message : String(error));
1966
2043
  });
1967
2044
  };
2045
+ const activationPendingVersion = pendingActivationVersion(versionStatus, providerUpdateCheck);
2046
+ const hasOffer = versionStatus?.updateAvailable || providerUpdateCheck?.updateAvailable;
2047
+ // Keep a previously offered Web action in place while the provider revalidates it.
2048
+ const refreshingWebOffer = webUpdate && updateProviderState === "checking" && providerUpdateCheck?.updateAvailable === true;
2049
+ const previousTarget = versionStatus?.lastConfirmedUpdateVersion;
2050
+ const badgeTarget = compactHeader && !activationPendingVersion && !updateOperation
2051
+ ? parseClientVersion(hasOffer ? targetVersion : previousTarget)?.normalized : null;
2052
+ const checking = versionCheckBusy || (!versionStatus && !versionCheckFailed)
2053
+ || (webUpdate && updateProviderState === "checking");
2054
+ const invalidOffer = hasOffer && !parseClientVersion(targetVersion);
2055
+ const showCheckError = (versionCheckFailed || invalidOffer) && !checking && !activationPendingVersion
2056
+ && !providerUpdateCheck?.updateAvailable && !updateOperation;
2057
+ const drawerId = "mcp-connector-upgrade-details-" + presentation;
1968
2058
  const renderUpdateControls = () => {
1969
- const activationPendingVersion = updateProviderState === "ready"
1970
- ? pendingActivationVersion(versionStatus, providerUpdateCheck)
1971
- : null;
1972
2059
  if (!versionStatus?.updateAvailable
2060
+ && !(desktopUpdate && badgeTarget)
2061
+ && !refreshingWebOffer
1973
2062
  && !(updateProviderState === "ready" && providerUpdateCheck?.updateAvailable === true)
1974
2063
  && activationPendingVersion === null
1975
- && updateOperation === null && updateError === null) return null;
2064
+ && updateOperation === null && updateError === null) return {};
1976
2065
  if (updateRunning) {
1977
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2066
+ return { action: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1978
2067
  className: "mcpConnectorUpdateControls",
1979
2068
  children: [
1980
2069
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
@@ -1990,11 +2079,11 @@ window.__ModuleLoader__.load({
1990
2079
  children: t("暂时无法读取进度,正在重试")
1991
2080
  })
1992
2081
  ]
1993
- });
2082
+ }) };
1994
2083
  }
1995
2084
  if (updateOperation?.state === "failed") {
1996
2085
  const force = ["RELEASE_TOO_FRESH", "VERSION_UNCHANGED"].includes(updateOperation.failure?.code);
1997
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2086
+ return { action: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1998
2087
  className: "mcpConnectorUpdateControls",
1999
2088
  children: [
2000
2089
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -2022,14 +2111,14 @@ window.__ModuleLoader__.load({
2022
2111
  children: t("查看更新方式")
2023
2112
  })
2024
2113
  ]
2025
- });
2114
+ }) };
2026
2115
  }
2027
2116
  if (["succeeded", "rolled-back"].includes(updateOperation?.state)) {
2028
2117
  const rolledBack = updateOperation.state === "rolled-back";
2029
2118
  const restartRequired = updateOperation.outcome?.restartRequired === true;
2030
2119
  const refreshRequired = updateOperation.outcome?.refreshRequired === true;
2031
2120
  const rollbackFailed = updateOperation.outcome?.rollback?.state === "failed";
2032
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2121
+ return { action: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2033
2122
  className: "mcpConnectorUpdateControls",
2034
2123
  children: [
2035
2124
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -2046,7 +2135,7 @@ window.__ModuleLoader__.load({
2046
2135
  }),
2047
2136
  restartRequired && updateProviderSelection?.capabilities?.restart?.supported === true && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2048
2137
  type: "button",
2049
- className: "mcpConnectorUpdateButton",
2138
+ className: compactHeader ? "mcpConnectorUpdateButton mcpConnectorUpdatePrimary" : "mcpConnectorUpdateButton",
2050
2139
  disabled: restarting,
2051
2140
  onClick: restartHost,
2052
2141
  children: restarting ? t("正在重启…") : t("立即重启")
@@ -2070,10 +2159,10 @@ window.__ModuleLoader__.load({
2070
2159
  children: rollbackRunning ? t("正在回滚…") : rollbackFailed ? t("重试回滚") : t("回滚")
2071
2160
  })
2072
2161
  ]
2073
- });
2162
+ }) };
2074
2163
  }
2075
2164
  if (updateError !== null) {
2076
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2165
+ return { action: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2077
2166
  className: "mcpConnectorUpdateControls",
2078
2167
  children: [
2079
2168
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -2089,31 +2178,34 @@ window.__ModuleLoader__.load({
2089
2178
  children: t("查看更新方式")
2090
2179
  })
2091
2180
  ]
2092
- });
2181
+ }) };
2093
2182
  }
2094
- if (updateProviderState === "checking") {
2095
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2183
+ if (!desktopUpdate && updateProviderState === "checking" && !refreshingWebOffer && !activationPendingVersion) {
2184
+ if (webUpdate) return {};
2185
+ return { action: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2096
2186
  type: "button",
2097
2187
  className: "mcpConnectorUpdateButton",
2098
2188
  disabled: true,
2099
2189
  children: t("正在准备更新…")
2100
- });
2190
+ }) };
2101
2191
  }
2102
- if (updateProviderState === "ready" && providerUpdateCheck?.updateAvailable === true) {
2103
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2192
+ if (refreshingWebOffer || (!desktopUpdate && updateProviderState === "ready" && providerUpdateCheck?.updateAvailable === true)) {
2193
+ return { action: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2104
2194
  type: "button",
2105
- className: "mcpConnectorUpdateButton",
2195
+ className: webUpdate ? "mcpConnectorUpdateButton mcpConnectorUpdatePrimary" : "mcpConnectorUpdateButton",
2196
+ disabled: refreshingWebOffer,
2106
2197
  title: t("由 {provider} 安全更新到 v{version}", {
2107
2198
  provider: updateProviderSelection?.provider?.label ?? t("更新服务"),
2108
2199
  version: providerUpdateCheck.latestVersion
2109
2200
  }),
2110
2201
  onClick: () => startUpdate(false),
2111
- children: t("一键更新到 v{version}", { version: providerUpdateCheck.latestVersion })
2112
- });
2202
+ children: webUpdate ? t("更新到 v{version}", { version: providerUpdateCheck.latestVersion })
2203
+ : t("一键更新到 v{version}", { version: providerUpdateCheck.latestVersion })
2204
+ }) };
2113
2205
  }
2114
2206
  if (activationPendingVersion !== null) {
2115
2207
  const canRestart = updateProviderSelection?.capabilities?.restart?.supported === true;
2116
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2208
+ return { action: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2117
2209
  className: "mcpConnectorUpdateControls",
2118
2210
  children: [
2119
2211
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -2126,7 +2218,7 @@ window.__ModuleLoader__.load({
2126
2218
  canRestart
2127
2219
  ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2128
2220
  type: "button",
2129
- className: "mcpConnectorUpdateButton",
2221
+ className: compactHeader ? "mcpConnectorUpdateButton mcpConnectorUpdatePrimary" : "mcpConnectorUpdateButton",
2130
2222
  disabled: restarting,
2131
2223
  onClick: restartHost,
2132
2224
  children: restarting ? t("正在重启…") : t("立即重启")
@@ -2139,12 +2231,13 @@ window.__ModuleLoader__.load({
2139
2231
  : t("请重启 DSH")
2140
2232
  })
2141
2233
  ]
2142
- });
2234
+ }) };
2143
2235
  }
2144
2236
  const command = manualCommandState.command;
2145
- const validTarget = parseClientVersion(versionStatus?.latestVersion) !== null;
2237
+ const parsedTarget = parseClientVersion(desktopUpdate ? badgeTarget : targetVersion);
2238
+ const validTarget = parseClientVersion(manualTarget) !== null;
2146
2239
  const showDiagnosis = !validTarget || profileInfo.status !== "ready";
2147
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2240
+ const manualControls = (0, react_jsx_runtime.jsxs)("div", {
2148
2241
  className: "mcpConnectorManualUpdate",
2149
2242
  children: [
2150
2243
  validTarget && profileInfo.status !== "ready" && profileInfo.detectedName !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -2153,7 +2246,9 @@ window.__ModuleLoader__.load({
2153
2246
  }),
2154
2247
  showDiagnosis && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2155
2248
  className: "mcpConnectorUpdateHint",
2156
- children: validTarget ? profileFailureLabel(profileInfo) : t("未取得有效的目标版本,请点击“检查更新”后重试")
2249
+ children: validTarget ? profileFailureLabel(profileInfo) : desktopUpdate
2250
+ ? t("npm 尚未确认此版本,暂时无法提供升级命令。")
2251
+ : t("未取得有效的目标版本,请点击“检查更新”后重试")
2157
2252
  }),
2158
2253
  validTarget && needsManualProfileChoice && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
2159
2254
  className: "mcpConnectorProfileChoice",
@@ -2216,7 +2311,83 @@ window.__ModuleLoader__.load({
2216
2311
  })
2217
2312
  ]
2218
2313
  });
2314
+ if (compactHeader && parsedTarget === null) return {};
2315
+ if (!compactHeader) return { action: manualControls };
2316
+ if (webUpdate) {
2317
+ return {
2318
+ action: (0, react_jsx_runtime.jsx)("button", {
2319
+ type: "button", className: "mcpConnectorUpdateLink",
2320
+ "aria-expanded": otherMethodsOpen, "aria-controls": drawerId,
2321
+ onClick: () => setOtherMethodsOpen(value => !value),
2322
+ children: otherMethodsOpen ? t("收起升级方式") : t("查看升级方式")
2323
+ }),
2324
+ drawer: otherMethodsOpen && (0, react_jsx_runtime.jsxs)("section", {
2325
+ id: drawerId, className: "mcpConnectorUpdateFallback", "aria-label": t("查看升级方式"),
2326
+ children: [(0, react_jsx_runtime.jsx)("span", { children: t("使用 Web 启动时的终端") }), manualControls]
2327
+ })
2328
+ };
2329
+ }
2330
+ const navigation = getUpdateNavigation?.();
2331
+ if (navigation && !showNavigationHint) {
2332
+ return { action: (0, react_jsx_runtime.jsx)("button", {
2333
+ type: "button",
2334
+ className: "mcpConnectorUpdateButton mcpConnectorUpdatePrimary",
2335
+ onClick: async () => {
2336
+ try {
2337
+ await getUpdateNavigation().openBundle(PLUGIN_PACKAGE_NAME);
2338
+ } catch {
2339
+ setShowNavigationHint(true);
2340
+ return;
2341
+ }
2342
+ if (presentation !== "panel") actions.close();
2343
+ },
2344
+ children: t("前往更新")
2345
+ }) };
2346
+ }
2347
+ return { drawer: (0, react_jsx_runtime.jsxs)("section", {
2348
+ className: "mcpConnectorUpdateFallback", "aria-label": t("从插件页更新"),
2349
+ children: [
2350
+ (0, react_jsx_runtime.jsx)("span", {
2351
+ role: "status",
2352
+ children: (showNavigationHint ? t("未能打开插件详情页。") : "") + (versionCheckFailed && !providerTarget
2353
+ ? t("请打开侧栏“插件” → “已安装” → dsh-mcp-connector,查看当前可用的更新。")
2354
+ : t("请打开侧栏“插件” → “已安装” → dsh-mcp-connector,然后点击“更新到 v{version}”。", { version: parsedTarget.normalized }))
2355
+ }),
2356
+ (0, react_jsx_runtime.jsx)("button", {
2357
+ type: "button", className: "mcpConnectorUpdateLink",
2358
+ "aria-expanded": otherMethodsOpen, "aria-controls": drawerId,
2359
+ onClick: () => setOtherMethodsOpen(value => !value),
2360
+ children: t("查看手动升级命令")
2361
+ }),
2362
+ otherMethodsOpen && (0, react_jsx_runtime.jsx)("div", { id: drawerId, children: manualControls })
2363
+ ]
2364
+ }) };
2219
2365
  };
2366
+ const { action: updateAction, drawer: updateDrawer } = renderUpdateControls();
2367
+ const runningVersion = versionStatus?.installedVersion ?? providerUpdateCheck?.installedVersion;
2368
+ const versionLabel = badgeTarget && runningVersion
2369
+ ? t("当前版本 v{current},发现新版本 v{target}", { current: runningVersion, target: badgeTarget })
2370
+ : runningVersion ? t("当前版本 v{version}", { version: runningVersion }) : t("正在检查插件版本");
2371
+ const versionBadge = (0, react_jsx_runtime.jsx)("span", {
2372
+ className: "mcpConnectorVersion", title: versionLabel, "aria-label": versionLabel,
2373
+ children: badgeTarget && runningVersion ? `v${runningVersion} → v${badgeTarget}`
2374
+ : runningVersion ? `v${runningVersion}` : "v…"
2375
+ });
2376
+ const checkFeedback = checking && !activationPendingVersion && !updateOperation
2377
+ ? (0, react_jsx_runtime.jsx)("span", { role: "status", children: t("正在检查更新…") })
2378
+ : showCheckError && (0, react_jsx_runtime.jsxs)("div", {
2379
+ className: "mcpConnectorUpdateControls",
2380
+ children: [
2381
+ (0, react_jsx_runtime.jsx)("span", {
2382
+ role: "status", title: typeof versionCheckFailed === "string" && versionCheckFailed !== "npm" ? versionCheckFailed : undefined,
2383
+ children: badgeTarget ? t("重新检查失败,显示上次发现的版本。") : t("暂时无法确认 MCP 连接器是否有新版本。")
2384
+ }),
2385
+ (0, react_jsx_runtime.jsx)("button", {
2386
+ type: "button", className: "mcpConnectorUpdateLink",
2387
+ onClick: () => setVersionCheckRequest(value => value + 1), children: t("重新检查")
2388
+ })
2389
+ ]
2390
+ });
2220
2391
  // `iframeLocale` 可以是取值函数:语言服务晚于 apply() 就绪时,
2221
2392
  // 这里每次渲染都能读到最新语言,而不是注册时的快照。
2222
2393
  const src = marketIframeSrc(typeof iframeLocale === "function" ? iframeLocale() : iframeLocale);
@@ -2271,15 +2442,12 @@ window.__ModuleLoader__.load({
2271
2442
  })
2272
2443
  }),
2273
2444
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { id: titleId, className: "mcpConnectorMarketTitle", style: { fontSize: 18, fontWeight: 600 }, children: t("MCP连接器") }),
2274
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2275
- className: "mcpConnectorVersion",
2276
- title: versionStatus === null
2277
- ? t("正在检查插件版本")
2278
- : t("当前版本 v{version}", { version: versionStatus.installedVersion }),
2279
- children: versionStatus === null ? "v…" : `v${versionStatus.installedVersion}`
2280
- }),
2281
- renderUpdateControls(),
2282
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2445
+ compactHeader ? (0, react_jsx_runtime.jsxs)("div", {
2446
+ className: "mcpConnectorUpdateGroup",
2447
+ children: [versionBadge, updateAction]
2448
+ }) : versionBadge,
2449
+ !compactHeader && updateAction,
2450
+ compactHeader ? checkFeedback : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2283
2451
  type: "button",
2284
2452
  className: "mcpConnectorUpdateButton",
2285
2453
  disabled: versionCheckBusy || updateRunning,
@@ -2289,12 +2457,12 @@ window.__ModuleLoader__.load({
2289
2457
  onClick: () => setVersionCheckRequest((value) => value + 1),
2290
2458
  children: versionCheckBusy ? t("正在检查更新…") : t("检查更新")
2291
2459
  }),
2292
- versionCheckFailed && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2460
+ !compactHeader && versionCheckFailed && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2293
2461
  className: "mcpConnectorUpdateStatus",
2294
2462
  "data-tone": "error",
2295
2463
  children: typeof versionCheckFailed === "string" && versionCheckFailed !== "npm" ? versionCheckFailed : t("暂时无法确认 npm 最新版本,请重试")
2296
2464
  }),
2297
- versionStatus?.releasePending && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2465
+ versionStatus?.releasePending && (!compactHeader || (!badgeTarget && !activationPendingVersion && !updateOperation)) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2298
2466
  className: "mcpConnectorVersion",
2299
2467
  title: t("GitHub Release 已发布,等待 npm 同步后即可更新"),
2300
2468
  children: t("v{version} 正在同步", { version: versionStatus.release.version })
@@ -2320,6 +2488,7 @@ window.__ModuleLoader__.load({
2320
2488
  })
2321
2489
  ]
2322
2490
  }),
2491
+ updateDrawer,
2323
2492
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("iframe", {
2324
2493
  ref: frameRef,
2325
2494
  src,
@@ -2460,6 +2629,14 @@ window.__ModuleLoader__.load({
2460
2629
  */
2461
2630
  function marketRuntimeProps(ctx) {
2462
2631
  return {
2632
+ getUpdateNavigation: () => {
2633
+ try {
2634
+ const navigation = ctx.get?.("pluginNavigation");
2635
+ return typeof navigation?.openBundle === "function" ? navigation : null;
2636
+ } catch {
2637
+ return null;
2638
+ }
2639
+ },
2463
2640
  startPromptSession: (promptText) => startPromptSession(ctx, promptText),
2464
2641
  workspaceContext: () => currentWorkspaceContext(ctx),
2465
2642
  workspaceOptions: () => availableWorkspaceContexts(ctx),
@@ -2472,6 +2649,9 @@ window.__ModuleLoader__.load({
2472
2649
  * DSH 0.1.x footer/Portal 兼容适配器。席位可以延迟声明,因此状态不依赖 DOM 探测。
2473
2650
  */
2474
2651
  function installSidebarSlots(ctx, marketView) {
2652
+ // The host unmounts main on exit. Remember display data for the next Web
2653
+ // mount; only a fresh provider selection can enable the update button.
2654
+ const sidebarUpdateMemory = window.dshDesktop ? null : { offer: null };
2475
2655
  let mainReady = false;
2476
2656
  let panelListReady = false;
2477
2657
  let footerReady = false;
@@ -2550,6 +2730,7 @@ window.__ModuleLoader__.load({
2550
2730
  store: marketView,
2551
2731
  inject: () => ({
2552
2732
  ...marketRuntimeProps(ctx),
2733
+ sidebarUpdateMemory,
2553
2734
  presentation: "panel",
2554
2735
  closePanel: () => layout()?.selectPanel?.(null)
2555
2736
  })
@@ -53,7 +53,7 @@ export function editableConnectionConfiguration(record, { t = tZh } = {}) {
53
53
  const item = {
54
54
  name: record.name,
55
55
  serverName: record.serverName,
56
- transport: record.transport === 'stdio' ? 'stdio' : 'streamable-http',
56
+ transport: record.transport ?? 'streamable-http',
57
57
  };
58
58
 
59
59
  if (record.transport === 'stdio') {