@gluztm/dsh-guard 2.4.1 → 2.4.4
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 +38 -58
- package/README.md +41 -60
- package/bin/dsh-guard.mjs +160 -47
- package/lib/client.js +1942 -1103
- package/lib/governance.mjs +994 -0
- package/lib/index.mjs +396 -53
- package/lib/inspector.mjs +1820 -429
- package/package.json +7 -3
- package/screenshots.json +1 -1
package/lib/client.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Client half of @gluztm/dsh-guard — Cross-platform
|
|
3
|
-
*
|
|
2
|
+
* Client half of @gluztm/dsh-guard — Cross-platform DSH profile manager,
|
|
3
|
+
* plugin/MCP switchboard, one-way .credentials.yaml writer, llm-pi-ai inspector,
|
|
4
|
+
* and local config snapshot & diff rollback panel for DeepSeek Harness.
|
|
4
5
|
*
|
|
5
|
-
* Strictly zero-secret-leak: never reads,
|
|
6
|
-
* Uses only React.createElement, useState, useEffect, and Component
|
|
6
|
+
* Strictly zero-secret-leak: never reads, displays, or transmits plaintext secret values.
|
|
7
|
+
* Uses only React.createElement, useState, useEffect, and Component for universal ModuleLoader compatibility.
|
|
7
8
|
*/
|
|
8
9
|
window.__ModuleLoader__.load({
|
|
9
10
|
id: '@gluztm/dsh-guard',
|
|
@@ -13,247 +14,338 @@ window.__ModuleLoader__.load({
|
|
|
13
14
|
|
|
14
15
|
const SIDE_ID = 'dsh-guard'
|
|
15
16
|
const API_BASE = 'api/dsh-guard'
|
|
16
|
-
const STYLE_ID = 'dsh-guard-panel-styles-
|
|
17
|
-
const VERSION = '2.4.
|
|
17
|
+
const STYLE_ID = 'dsh-guard-panel-styles-v244'
|
|
18
|
+
const VERSION = '2.4.4'
|
|
19
|
+
const DESKTOP_VERSION = '2.4.3'
|
|
18
20
|
const REPO_FALLBACK = 'https://github.com/gluztm/DSHGuard'
|
|
19
|
-
const RELEASE_FALLBACK =
|
|
20
|
-
const INSTALLER_FALLBACK =
|
|
21
|
+
const RELEASE_FALLBACK = `https://github.com/gluztm/DSHGuard/releases/tag/${DESKTOP_VERSION}`
|
|
22
|
+
const INSTALLER_FALLBACK = `https://github.com/gluztm/DSHGuard/releases/download/${DESKTOP_VERSION}/DSHGuard-Setup-${DESKTOP_VERSION}.exe`
|
|
23
|
+
|
|
24
|
+
const ENV_KEY_PRESETS = [
|
|
25
|
+
{ id: 'deepseek', label: 'DeepSeek 官方', envKey: 'DEEPSEEK_API_KEY' },
|
|
26
|
+
{ id: 'openai', label: 'OpenAI / 通用中继', envKey: 'OPENAI_API_KEY' },
|
|
27
|
+
{ id: 'anthropic', label: 'Anthropic Claude', envKey: 'ANTHROPIC_API_KEY' },
|
|
28
|
+
{ id: 'gemini', label: 'Google Gemini', envKey: 'GEMINI_API_KEY' },
|
|
29
|
+
{ id: 'openrouter', label: 'OpenRouter', envKey: 'OPENROUTER_API_KEY' },
|
|
30
|
+
{ id: 'siliconflow', label: '硅基流动 SiliconFlow', envKey: 'SILICONFLOW_API_KEY' },
|
|
31
|
+
{ id: 'stepfun', label: '阶跃星辰 StepFun', envKey: 'STEPFUN_API_KEY' },
|
|
32
|
+
]
|
|
21
33
|
|
|
22
34
|
const COPY = {
|
|
23
35
|
zh: {
|
|
24
|
-
brand: 'DSH
|
|
25
|
-
subtitle: '
|
|
36
|
+
brand: 'DSH 守护伴生',
|
|
37
|
+
subtitle: '运行时底座 · 扩展 · 上下文 · 凭据 · 快照',
|
|
38
|
+
guideDesc: '自动识别当前宿主(桌面端 / Web 端),内置依赖自愈、插件/MCP 启停与探活、上下文与 Skills 治理、单向写 .credentials.yaml 与本地快照置顶回滚。',
|
|
26
39
|
versionPill: `v${VERSION}`,
|
|
27
|
-
refresh: '
|
|
28
|
-
refreshing: '
|
|
40
|
+
refresh: '刷新',
|
|
41
|
+
refreshing: '同步中',
|
|
29
42
|
langSwitch: 'EN',
|
|
30
|
-
healthy: '
|
|
31
|
-
unhealthy: (n) =>
|
|
32
|
-
loading: '
|
|
43
|
+
healthy: '配置健康',
|
|
44
|
+
unhealthy: (n) => `${n} 项待处理`,
|
|
45
|
+
loading: '正在读取当前运行档案、上下文负担、MCP/模型与快照…',
|
|
33
46
|
retry: '重试',
|
|
34
|
-
checkedAt: (t) =>
|
|
47
|
+
checkedAt: (t) => `同步于 ${t}`,
|
|
48
|
+
openDesktopBtn: '打开桌面端',
|
|
49
|
+
launchingBtn: '正在拉起…',
|
|
35
50
|
tabOverview: '总览',
|
|
51
|
+
tabPlugins: '扩展',
|
|
52
|
+
tabContext: '上下文',
|
|
36
53
|
tabCreds: '凭据',
|
|
37
54
|
tabSnapshots: '快照',
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
55
|
+
kpiHealth: '配置健康',
|
|
56
|
+
kpiHealthOk: '一致',
|
|
57
|
+
kpiHealthWarn: (n) => `${n} 项`,
|
|
58
|
+
kpiExt: '插件 / MCP',
|
|
59
|
+
kpiCreds: '密钥 / 提供商',
|
|
60
|
+
kpiSnaps: '配置快照',
|
|
61
|
+
secProfiles: '当前运行档案',
|
|
62
|
+
webTrack: 'Web 端',
|
|
63
|
+
desktopTrack: '桌面端',
|
|
64
|
+
present: '已就绪',
|
|
65
|
+
absent: '未初始化',
|
|
66
|
+
depsLabel: '总依赖',
|
|
67
|
+
thirdPartyLabel: '第三方',
|
|
68
|
+
mcpLabel: 'MCP 服务',
|
|
69
|
+
disabledLabel: '已禁用',
|
|
70
|
+
brokenLabel: '断链数',
|
|
71
|
+
repairLinksBtn: '一键修复断链',
|
|
72
|
+
repairingBtn: '修复中…',
|
|
73
|
+
allHealthyTitle: '当前运行档案结构健康且无断裂软链接',
|
|
74
|
+
allHealthySub: '当前端的插件依赖、MCP 补丁与环境配置均已对齐,可在上方切换标签管理扩展/探活、上下文与 Skills、单向写密钥或配置快照。',
|
|
75
|
+
quickSnapWeb: '备份当前配置',
|
|
76
|
+
quickGoPlugins: '管理扩展开关',
|
|
77
|
+
quickGoContext: '查看上下文与 Skills',
|
|
78
|
+
contextCardTitle: '开机上下文负担画像',
|
|
79
|
+
contextTokens: (n) => `~${n} tokens 基线`,
|
|
80
|
+
contextLevelLight: '轻量',
|
|
81
|
+
contextLevelModerate: '适中',
|
|
82
|
+
contextLevelHeavy: '较重',
|
|
83
|
+
contextStatsLine: (plug, mcp, sk) => `启用第三方 ${plug} · MCP ${mcp} · 模型可见技能 ${sk}`,
|
|
84
|
+
contextPromptsTitle: '常驻提示词与配置注入体积',
|
|
85
|
+
contextSkillsTitle: 'Skills 可见性治理',
|
|
86
|
+
contextSkillSearch: '搜索技能名称、来源或说明…',
|
|
87
|
+
contextSkillsEmpty: '未匹配到技能文件。',
|
|
88
|
+
skillReadOnly: '插件只读',
|
|
89
|
+
skillModelVis: '模型可见',
|
|
90
|
+
skillCmdVis: '命令可见',
|
|
91
|
+
promptsBytes: (b, tk) => `${b} B · ~${tk} tok`,
|
|
92
|
+
warningsTitle: '巡检提示',
|
|
93
|
+
searchPlaceholder: '搜索插件包名、loader ID 或 MCP 服务名…',
|
|
94
|
+
mcpSectionTitle: 'MCP 服务管理与探活',
|
|
95
|
+
mcpEmpty: '当前档案尚未配置 MCP 服务。',
|
|
96
|
+
mcpProbeBtn: '探测本地 MCP',
|
|
97
|
+
mcpProbingBtn: '探测中…',
|
|
98
|
+
mcpTimeoutBtn: '超时',
|
|
99
|
+
mcpTimeoutSave: '保存超时',
|
|
100
|
+
mcpTimeoutHint: '单次工具调用超时(5000 - 600000 ms)',
|
|
101
|
+
pluginsSectionTitle: '已安装插件',
|
|
102
|
+
pluginsEmpty: '未匹配到插件条目。',
|
|
103
|
+
badgeCore: '核心保护',
|
|
104
|
+
badgeSelf: '当前伴生',
|
|
105
|
+
badgeEnabled: '已启用',
|
|
106
|
+
badgeDisabled: '已禁用',
|
|
107
|
+
badgeAllCount: (shown, total) => `${shown} / ${total}`,
|
|
108
|
+
boundaryPluginsSummary: '能力边界说明:为什么插件全新安装/卸载与强杀锁死进程不在此完成?',
|
|
109
|
+
boundaryPluginsP1: '本插件运行于当前 DSH Node 宿主进程内部:在运行时热删除或重装 node_modules 可能导致已加载模块撕裂锁死;同时为遵循插件最小权限安全红线,本插件不会从远端拉取二进制安装包或托管宿主进程生命周期。',
|
|
110
|
+
boundaryPluginsP2: '在伴生插件内,你可直接安全启停第三方插件与 MCP 服务、调整 MCP 超时、执行本地只读探活并修复断裂依赖链接;完整增删插件与进程外强启停由独立原生桌面端承担。',
|
|
111
|
+
boundaryCredsSummary: '能力边界说明:为什么不在此回显/导出明文密钥或提供 Windows DPAPI 加密库?',
|
|
112
|
+
boundaryCredsP1: '安全合规要求持有前端请求能力的插件不得反向读取并回显真实 API 密钥。本插件采用「只核验键名 + 单向覆盖写入 .credentials.yaml」机制,所有明文仅从输入框单向落盘(0o600),响应报文绝不返回密钥字符。',
|
|
113
|
+
boundaryCredsP2: '硬件绑定的 Windows DPAPI 凭据保险箱加密以及跨 CC Switch 等工具链批量迁移属于系统原生能力,仅独立的 Windows 原生桌面端具备。',
|
|
114
|
+
boundarySnapsSummary: '能力边界说明:为什么配置快照仅恢复 YAML/JSON 配对文件而不覆盖整包扩展?',
|
|
115
|
+
boundarySnapsP1: '伴生插件可在不干扰宿主运行的前提下,安全完成 cordis.patch.yml、cordis.yml、package.json 与 settings.yaml 的实时 SHA256 比对、备份、置顶保护与白名单一键回滚(自动排除 .credentials.yaml)。',
|
|
116
|
+
boundarySnapsP2: '涵盖 node_modules 整包 ZIP 回溯与主程序崩溃后的带外拉起恢复必须脱离宿主进程执行,仅在独立原生桌面端提供。',
|
|
117
|
+
desktopWinLink: `下载 Windows 原生桌面端 v${DESKTOP_VERSION} ↗`,
|
|
118
|
+
desktopReleaseLink: '查看 GitHub Releases ↗',
|
|
119
|
+
desktopNonWinNote: '注:原生桌面端目前仅提供 Windows 安装包;当前平台的启停开关、上下文治理、单向写密钥与配置回滚已全部内置于伴生插件。',
|
|
120
|
+
providersTitle: '模型提供商 (llm-pi-ai)',
|
|
121
|
+
providersEmpty: '尚未在 cordis.patch.yml 中发现 llm-pi-ai 提供商配置。',
|
|
122
|
+
modelsUnit: '个模型',
|
|
123
|
+
keyReady: '密钥就绪',
|
|
124
|
+
keyMissing: '缺密钥',
|
|
125
|
+
setKeyBtn: '设置密钥',
|
|
126
|
+
updateKeyBtn: '更新密钥',
|
|
127
|
+
cancelBtn: '取消',
|
|
128
|
+
keyPlaceholder: '输入 API Key(单向盲写,保存后立即清空,绝不回显)',
|
|
129
|
+
writeKeyBtn: '写入 .credentials.yaml',
|
|
130
|
+
writingKeyBtn: '写入中…',
|
|
131
|
+
addKeyToggle: '+ 新增自定义环境变量密钥',
|
|
132
|
+
presetSelectPlaceholder: '常用平台预设(可选自动填入键名)…',
|
|
133
|
+
envNameLabel: '环境变量名 (如 DEEPSEEK_API_KEY)',
|
|
134
|
+
credsAuditTitle: '.credentials.yaml 键名状态审计',
|
|
135
|
+
credsAuditSub: '仅展示键名是否存在及保护标记(绝不读取或传输密钥字符)。',
|
|
136
|
+
credProtected: '受保护 OAuth',
|
|
137
|
+
credPresent: '已写入',
|
|
138
|
+
credEnvOnly: '仅环境变量',
|
|
139
|
+
credsEmpty: '当前尚未创建 .credentials.yaml 或 refs 下尚无键值。',
|
|
140
|
+
snapCreateTargetBtn: '+ 备份当前配置',
|
|
141
|
+
snapCreating: '备份中…',
|
|
142
|
+
snapSourcePlugin: '插件快照',
|
|
143
|
+
snapSourceDesktop: '桌面端快照',
|
|
144
|
+
snapSame: '与磁盘一致',
|
|
145
|
+
snapDiff: (n) => `${n} 处已变更`,
|
|
146
|
+
snapFilesToggle: (n) => `查看 ${n} 个文件比对明细`,
|
|
147
|
+
snapRestoreBtn: '恢复此配置快照',
|
|
148
|
+
snapRestoring: '恢复中…',
|
|
149
|
+
snapPinBtn: '📌 置顶',
|
|
150
|
+
snapUnpinBtn: '取消置顶',
|
|
151
|
+
snapPinnedBadge: '已置顶保护',
|
|
152
|
+
snapNoFiles: '该快照暂无可比对配置文件',
|
|
153
|
+
snapDesktopOnlyTip: '桌面端全量包产物需在桌面端还原',
|
|
154
|
+
auditSectionSummary: (n) => `变更审计流水(最近 ${n} 条脱敏操作记录)`,
|
|
155
|
+
auditEmpty: '暂无通过伴生插件写入的审计记录。',
|
|
156
|
+
fileSame: '一致',
|
|
157
|
+
fileModified: '与现行配置不同',
|
|
158
|
+
fileMissing: '磁盘已删除',
|
|
159
|
+
fileUnknown: '仅记录',
|
|
160
|
+
snapshotsEmpty: '暂无本地配置快照',
|
|
161
|
+
snapshotsEmptyDesc: '点击上方备份按钮,或在修改插件/MCP 开关时自动留存一份配置档案。',
|
|
162
|
+
footerNote: `@gluztm/dsh-guard v${VERSION}`,
|
|
163
|
+
footerHome: 'GitHub',
|
|
106
164
|
},
|
|
107
165
|
en: {
|
|
108
|
-
brand: '
|
|
109
|
-
subtitle: '
|
|
166
|
+
brand: 'DSH Companion',
|
|
167
|
+
subtitle: 'Runtime Control · Ext · Context · Creds · Snapshots',
|
|
168
|
+
guideDesc: 'Auto-detects active host (Desktop / Web): symlink repair, plugin & MCP toggles/probe, context & Skills visibility, one-way .credentials.yaml writes, and pinned YAML snapshots.',
|
|
110
169
|
versionPill: `v${VERSION}`,
|
|
111
170
|
refresh: 'Refresh',
|
|
112
|
-
refreshing: '
|
|
113
|
-
langSwitch: '
|
|
114
|
-
healthy: '
|
|
115
|
-
unhealthy: (n) => `${n}
|
|
116
|
-
loading: '
|
|
171
|
+
refreshing: 'Syncing',
|
|
172
|
+
langSwitch: '中文',
|
|
173
|
+
healthy: 'Healthy',
|
|
174
|
+
unhealthy: (n) => `${n} alert`,
|
|
175
|
+
loading: 'Loading active profile, context load, MCP/providers, and snapshots…',
|
|
117
176
|
retry: 'Retry',
|
|
118
|
-
checkedAt: (t) => `
|
|
177
|
+
checkedAt: (t) => `Synced ${t}`,
|
|
178
|
+
openDesktopBtn: 'Open Desktop',
|
|
179
|
+
launchingBtn: 'Launching…',
|
|
119
180
|
tabOverview: 'Overview',
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
feat1Sub: 'Auto /v1 & /v1beta endpoints',
|
|
133
|
-
feat2Title: 'CC Switch & Multi-Source Import',
|
|
134
|
-
feat2Sub: 'Drop configs or read local agents',
|
|
135
|
-
feat3Title: 'Safe Batch Plugin Updates',
|
|
136
|
-
feat3Sub: '10,700+ catalog, zero cross-track',
|
|
137
|
-
feat4Title: 'Out-of-Band Recovery & Rollback',
|
|
138
|
-
feat4Sub: 'Restore broken startups externally',
|
|
139
|
-
btnDownloadExe: 'Direct Download Windows Installer (.exe)',
|
|
140
|
-
btnViewRepo: 'Homepage & Visual Tour',
|
|
141
|
-
btnRedetect: 'Installed? Re-detect',
|
|
142
|
-
supervisorTitleWinReady: 'DSHGuard Desktop Console',
|
|
143
|
-
supervisorBadgeReady: 'Desktop Console Ready',
|
|
144
|
-
supervisorDescWinReady: 'Connected to your local DSHGuard executable for visual model configuration, CC Switch import, and snapshot rollback.',
|
|
145
|
-
btnOpenGuard: 'Open DSHGuard Desktop Console',
|
|
146
|
-
btnOpeningGuard: 'Launching…',
|
|
147
|
-
supervisorTitleOther: 'Cross-Platform Read-Only Mode',
|
|
148
|
-
supervisorDescOther: (plat) => `Running on ${plat} with full dual-track auditing, masked key checks, and /guard commands. Full out-of-band GUI tools run on Windows.`,
|
|
149
|
-
btnViewReleases: 'View Windows Releases',
|
|
150
|
-
profilesTitle: 'Web / Desktop Profile Alignment',
|
|
151
|
-
webTrack: 'Web Engine',
|
|
181
|
+
tabPlugins: 'Ext',
|
|
182
|
+
tabContext: 'Context',
|
|
183
|
+
tabCreds: 'Creds',
|
|
184
|
+
tabSnapshots: 'Snaps',
|
|
185
|
+
kpiHealth: 'Health',
|
|
186
|
+
kpiHealthOk: 'Synced',
|
|
187
|
+
kpiHealthWarn: (n) => `${n} alert`,
|
|
188
|
+
kpiExt: 'Plugins / MCP',
|
|
189
|
+
kpiCreds: 'Keys / Providers',
|
|
190
|
+
kpiSnaps: 'Snapshots',
|
|
191
|
+
secProfiles: 'Active Runtime Profile',
|
|
192
|
+
webTrack: 'Web',
|
|
152
193
|
desktopTrack: 'Desktop',
|
|
153
|
-
|
|
154
|
-
|
|
194
|
+
present: 'Ready',
|
|
195
|
+
absent: 'Absent',
|
|
155
196
|
depsLabel: 'Deps',
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
197
|
+
thirdPartyLabel: '3rd-party',
|
|
198
|
+
mcpLabel: 'MCP',
|
|
199
|
+
disabledLabel: 'Disabled',
|
|
200
|
+
brokenLabel: 'Broken Links',
|
|
201
|
+
repairLinksBtn: 'Repair Broken Links',
|
|
202
|
+
repairingBtn: 'Repairing…',
|
|
203
|
+
allHealthyTitle: 'Active profile is healthy with no broken links',
|
|
204
|
+
allHealthySub: 'Dependencies, MCP entries, and Cordis patches look clean. Switch tabs above to manage extensions, context/Skills, blind-write credentials, or snapshots.',
|
|
205
|
+
quickSnapWeb: 'Backup Config',
|
|
206
|
+
quickGoPlugins: 'Manage Extensions',
|
|
207
|
+
quickGoContext: 'Context & Skills',
|
|
208
|
+
contextCardTitle: 'Startup Context Footprint',
|
|
209
|
+
contextTokens: (n) => `~${n} tokens baseline`,
|
|
210
|
+
contextLevelLight: 'Light',
|
|
211
|
+
contextLevelModerate: 'Moderate',
|
|
212
|
+
contextLevelHeavy: 'Heavy',
|
|
213
|
+
contextStatsLine: (plug, mcp, sk) => `${plug} 3rd-party · ${mcp} MCP · ${sk} model-visible skills`,
|
|
214
|
+
contextPromptsTitle: 'Permanent Prompt & Config Sizes',
|
|
215
|
+
contextSkillsTitle: 'Skills Visibility Governance',
|
|
216
|
+
contextSkillSearch: 'Filter skill name, source, or summary…',
|
|
217
|
+
contextSkillsEmpty: 'No matching skills found.',
|
|
218
|
+
skillReadOnly: 'Plugin (RO)',
|
|
219
|
+
skillModelVis: 'Model',
|
|
220
|
+
skillCmdVis: 'Command',
|
|
221
|
+
promptsBytes: (b, tk) => `${b} B · ~${tk} tok`,
|
|
222
|
+
warningsTitle: 'Diagnostics',
|
|
223
|
+
searchPlaceholder: 'Filter package name, loader ID, or MCP server…',
|
|
224
|
+
mcpSectionTitle: 'MCP Servers & Local Probe',
|
|
225
|
+
mcpEmpty: 'No MCP entries configured in this profile.',
|
|
226
|
+
mcpProbeBtn: 'Probe Local MCPs',
|
|
227
|
+
mcpProbingBtn: 'Probing…',
|
|
228
|
+
mcpTimeoutBtn: 'Timeout',
|
|
229
|
+
mcpTimeoutSave: 'Save ms',
|
|
230
|
+
mcpTimeoutHint: 'Tool call timeout in ms (5000 - 600000)',
|
|
231
|
+
pluginsSectionTitle: 'Installed Plugins',
|
|
232
|
+
pluginsEmpty: 'No matching plugins.',
|
|
233
|
+
badgeCore: 'Core',
|
|
234
|
+
badgeSelf: 'Self',
|
|
235
|
+
badgeEnabled: 'On',
|
|
236
|
+
badgeDisabled: 'Off',
|
|
237
|
+
badgeAllCount: (shown, total) => `${shown} / ${total}`,
|
|
238
|
+
boundaryPluginsSummary: 'Capability boundary: why fresh package install & force process control live outside this plugin',
|
|
239
|
+
boundaryPluginsP1: 'This plugin shares the live DSH Node process: mutating node_modules via npm install at runtime can lock or tear active modules, and companion plugins intentionally lack remote binary execution and host watchdog rights.',
|
|
240
|
+
boundaryPluginsP2: 'Safe plugin & MCP toggling, local loopback/stdio MCP probing, timeout tuning, and symlink repair work right here; full package install/uninstall and process supervision belong to the native desktop supervisor.',
|
|
241
|
+
boundaryCredsSummary: 'Security boundary: why plaintext key readback & Windows DPAPI vault live outside this plugin',
|
|
242
|
+
boundaryCredsP1: 'By security policy, Web UI plugins must never reverse-read and display plaintext secrets. This tab enforces strict one-way blind-write directly into .credentials.yaml refs: while showing only key presence.',
|
|
243
|
+
boundaryCredsP2: 'Hardware-backed Windows DPAPI encryption vaults and CC Switch cross-tool migrations rely on native Windows security APIs unavailable inside a cross-platform DSH plugin.',
|
|
244
|
+
boundarySnapsSummary: 'Runtime boundary: why snapshots restore YAML/JSON configs rather than full node_modules bundles',
|
|
245
|
+
boundarySnapsP1: 'Within the running DSH process, this tab safely computes live SHA256 diffs, creates/pins snapshots, and performs whitelist rollback of cordis.patch.yml, cordis.yml, package.json, and settings.yaml (excluding secrets).',
|
|
246
|
+
boundarySnapsP2: 'Full extension bundle ZIP replacement and out-of-band crash recovery require shutting down or restarting the DSH process from an external native binary.',
|
|
247
|
+
desktopWinLink: `Download Windows Desktop v${DESKTOP_VERSION} ↗`,
|
|
248
|
+
desktopReleaseLink: 'GitHub Releases ↗',
|
|
249
|
+
desktopNonWinNote: 'Note: The native desktop shell is Windows-only; toggling, context governance, blind-write credentials, and config rollback work natively on this OS.',
|
|
250
|
+
providersTitle: 'Model Providers (llm-pi-ai)',
|
|
251
|
+
providersEmpty: 'No llm-pi-ai provider entries found in cordis.patch.yml.',
|
|
252
|
+
modelsUnit: 'models',
|
|
253
|
+
keyReady: 'Key Ready',
|
|
254
|
+
keyMissing: 'Missing Key',
|
|
255
|
+
setKeyBtn: 'Set Key',
|
|
256
|
+
updateKeyBtn: 'Update Key',
|
|
257
|
+
cancelBtn: 'Cancel',
|
|
258
|
+
keyPlaceholder: 'Paste API key (one-way write only; cleared & never echoed)',
|
|
259
|
+
writeKeyBtn: 'Save to .credentials.yaml',
|
|
260
|
+
writingKeyBtn: 'Saving…',
|
|
261
|
+
addKeyToggle: '+ Add custom env ref key',
|
|
262
|
+
presetSelectPlaceholder: 'Common platform presets (auto-fill env key)…',
|
|
263
|
+
envNameLabel: 'Env Var Name (e.g. DEEPSEEK_API_KEY)',
|
|
264
|
+
credsAuditTitle: '.credentials.yaml Key Presence Audit',
|
|
265
|
+
credsAuditSub: 'Verifies key readiness and protected OAuth flags without reading secret values.',
|
|
266
|
+
credProtected: 'Protected OAuth',
|
|
267
|
+
credPresent: 'Configured',
|
|
268
|
+
credEnvOnly: 'Env Only',
|
|
269
|
+
credsEmpty: 'No .credentials.yaml entries found yet.',
|
|
270
|
+
snapCreateTargetBtn: '+ Create Snapshot',
|
|
271
|
+
snapCreating: 'Backing up…',
|
|
272
|
+
snapSourcePlugin: 'Plugin',
|
|
273
|
+
snapSourceDesktop: 'Desktop',
|
|
274
|
+
snapSame: 'Matches Disk',
|
|
275
|
+
snapDiff: (n) => `${n} modified`,
|
|
276
|
+
snapFilesToggle: (n) => `Inspect ${n} file diff(s)`,
|
|
277
|
+
snapRestoreBtn: 'Restore Config Files',
|
|
278
|
+
snapRestoring: 'Restoring…',
|
|
279
|
+
snapPinBtn: '📌 Pin',
|
|
280
|
+
snapUnpinBtn: 'Unpin',
|
|
281
|
+
snapPinnedBadge: 'Pinned',
|
|
282
|
+
snapNoFiles: 'No comparable config files in this snapshot',
|
|
283
|
+
snapDesktopOnlyTip: 'Desktop binary archives require the native desktop app',
|
|
284
|
+
auditSectionSummary: (n) => `Mutation Audit Log (latest ${n} redacted events)`,
|
|
285
|
+
auditEmpty: 'No mutation events logged yet.',
|
|
286
|
+
fileSame: 'Same',
|
|
287
|
+
fileModified: 'Changed on disk',
|
|
288
|
+
fileMissing: 'Deleted on disk',
|
|
289
|
+
fileUnknown: 'Recorded',
|
|
290
|
+
snapshotsEmpty: 'No configuration snapshots yet',
|
|
291
|
+
snapshotsEmptyDesc: 'Create a manual backup above or toggle an extension to automatically preserve a snapshot.',
|
|
292
|
+
footerNote: `@gluztm/dsh-guard v${VERSION}`,
|
|
187
293
|
footerHome: 'GitHub',
|
|
188
|
-
errorRecover: 'Panel recovered by ErrorBoundary',
|
|
189
|
-
guideDesc: 'Dual-track health · Masked key readiness · Snapshots · DSHGuard Desktop bridge',
|
|
190
294
|
},
|
|
191
295
|
}
|
|
192
296
|
|
|
193
297
|
const CSS = `
|
|
194
|
-
@keyframes dshg-spin {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
--dshg-
|
|
204
|
-
--dshg-
|
|
205
|
-
--dshg-
|
|
206
|
-
--dshg-
|
|
207
|
-
--dshg-
|
|
208
|
-
--dshg-
|
|
209
|
-
--dshg-
|
|
210
|
-
--dshg-
|
|
211
|
-
--dshg-
|
|
212
|
-
--dshg-
|
|
213
|
-
--dshg-accent-soft: rgba(37, 99, 235, 0.10);
|
|
214
|
-
--dshg-accent-border: rgba(59, 130, 246, 0.34);
|
|
215
|
-
--dshg-ok: #16a34a;
|
|
216
|
-
--dshg-ok-soft: rgba(34, 197, 94, 0.12);
|
|
217
|
-
--dshg-ok-border: rgba(34, 197, 94, 0.32);
|
|
218
|
-
--dshg-warn: #d97706;
|
|
298
|
+
@keyframes dshg-spin { to { transform: rotate(360deg); } }
|
|
299
|
+
@keyframes dshg-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
|
|
300
|
+
|
|
301
|
+
.dshg-wrap {
|
|
302
|
+
--dshg-bg: var(--dsw-alias-bg-container, transparent);
|
|
303
|
+
--dshg-card: var(--dsw-alias-card-fill, var(--dsw-alias-bg-elevated, rgba(127, 127, 127, 0.06)));
|
|
304
|
+
--dshg-card-hover: var(--dsw-alias-card-fill-hover, var(--dsw-alias-fill-secondary, rgba(127, 127, 127, 0.1)));
|
|
305
|
+
--dshg-fill: var(--dsw-alias-fill-l1, var(--dsw-alias-fill-tertiary, rgba(127, 127, 127, 0.12)));
|
|
306
|
+
--dshg-fill-subtle: var(--dsw-alias-bg-layer-2, var(--dsw-alias-fill-quaternary, rgba(127, 127, 127, 0.04)));
|
|
307
|
+
--dshg-border: var(--dsw-alias-border-l1, var(--dsw-alias-border-secondary, rgba(127, 127, 127, 0.18)));
|
|
308
|
+
--dshg-border-strong: var(--dsw-alias-border-l2, var(--dsw-alias-border-primary, rgba(127, 127, 127, 0.32)));
|
|
309
|
+
--dshg-text: var(--dsw-alias-label-primary, var(--dsw-alias-text-primary, inherit));
|
|
310
|
+
--dshg-text-2: var(--dsw-alias-label-secondary, var(--dsw-alias-text-secondary, rgba(127, 127, 127, 0.92)));
|
|
311
|
+
--dshg-text-3: var(--dsw-alias-label-tertiary, var(--dsw-alias-text-tertiary, rgba(127, 127, 127, 0.7)));
|
|
312
|
+
--dshg-accent: var(--dsw-alias-brand-primary, var(--dsw-alias-color-primary, #2563eb));
|
|
313
|
+
--dshg-accent-soft: rgba(59, 130, 246, 0.11);
|
|
314
|
+
--dshg-accent-border: rgba(59, 130, 246, 0.28);
|
|
315
|
+
--dshg-ok-soft: rgba(16, 185, 129, 0.12);
|
|
316
|
+
--dshg-ok-border: rgba(16, 185, 129, 0.28);
|
|
219
317
|
--dshg-warn-soft: rgba(245, 158, 11, 0.12);
|
|
220
|
-
--dshg-warn-border: rgba(245, 158, 11, 0.
|
|
221
|
-
background: transparent;
|
|
222
|
-
color: var(--dshg-text);
|
|
223
|
-
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
|
|
318
|
+
--dshg-warn-border: rgba(245, 158, 11, 0.3);
|
|
224
319
|
display: flex;
|
|
225
320
|
flex-direction: column;
|
|
226
|
-
gap:
|
|
227
|
-
padding: 12px;
|
|
321
|
+
gap: 11px;
|
|
228
322
|
height: 100%;
|
|
323
|
+
min-height: 0;
|
|
324
|
+
padding: 12px 14px 16px;
|
|
229
325
|
box-sizing: border-box;
|
|
230
326
|
overflow-y: auto;
|
|
231
|
-
|
|
327
|
+
background: var(--dshg-bg);
|
|
328
|
+
color: var(--dshg-text);
|
|
329
|
+
font-family: inherit;
|
|
330
|
+
font-size: 13px;
|
|
232
331
|
line-height: 1.45;
|
|
233
332
|
}
|
|
234
|
-
.dshg-
|
|
235
|
-
max-width:
|
|
333
|
+
.dshg-wrap[data-variant="main"] {
|
|
334
|
+
max-width: 960px;
|
|
236
335
|
margin: 0 auto;
|
|
237
|
-
padding:
|
|
336
|
+
padding: 22px 26px 32px;
|
|
238
337
|
}
|
|
239
|
-
.dshg-
|
|
240
|
-
border: 1px solid var(--dshg-border);
|
|
241
|
-
background: var(--dshg-card);
|
|
242
|
-
border-radius: 12px;
|
|
243
|
-
padding: 11px 12px;
|
|
338
|
+
.dshg-tab-body {
|
|
244
339
|
display: flex;
|
|
245
340
|
flex-direction: column;
|
|
246
|
-
gap:
|
|
247
|
-
}
|
|
248
|
-
.dshg-card-spotlight {
|
|
249
|
-
border: 1px solid var(--dshg-accent-border);
|
|
250
|
-
background: var(--dshg-accent-soft);
|
|
341
|
+
gap: 10px;
|
|
251
342
|
}
|
|
252
343
|
.dshg-header {
|
|
253
344
|
display: flex;
|
|
254
345
|
align-items: center;
|
|
255
346
|
justify-content: space-between;
|
|
256
|
-
gap:
|
|
347
|
+
gap: 10px;
|
|
348
|
+
flex-wrap: wrap;
|
|
257
349
|
}
|
|
258
350
|
.dshg-brand {
|
|
259
351
|
display: flex;
|
|
@@ -261,62 +353,69 @@ window.__ModuleLoader__.load({
|
|
|
261
353
|
gap: 9px;
|
|
262
354
|
min-width: 0;
|
|
263
355
|
}
|
|
264
|
-
.dshg-logo
|
|
265
|
-
width:
|
|
266
|
-
height:
|
|
356
|
+
.dshg-logo {
|
|
357
|
+
width: 30px;
|
|
358
|
+
height: 30px;
|
|
267
359
|
border-radius: 9px;
|
|
268
|
-
display:
|
|
360
|
+
display: flex;
|
|
269
361
|
align-items: center;
|
|
270
362
|
justify-content: center;
|
|
271
|
-
background: var(--dshg-accent
|
|
272
|
-
|
|
273
|
-
color: var(--dshg-accent);
|
|
363
|
+
background: linear-gradient(135deg, var(--dshg-accent), #6366f1);
|
|
364
|
+
color: #ffffff;
|
|
274
365
|
flex-shrink: 0;
|
|
366
|
+
box-shadow: 0 2px 7px rgba(59, 130, 246, 0.24);
|
|
367
|
+
}
|
|
368
|
+
.dshg-title-box {
|
|
369
|
+
display: flex;
|
|
370
|
+
flex-direction: column;
|
|
371
|
+
min-width: 0;
|
|
275
372
|
}
|
|
276
373
|
.dshg-title-row {
|
|
277
374
|
display: flex;
|
|
278
375
|
align-items: center;
|
|
279
376
|
gap: 6px;
|
|
280
|
-
flex-wrap: wrap;
|
|
281
377
|
}
|
|
282
378
|
.dshg-title {
|
|
283
|
-
font-size:
|
|
284
|
-
font-weight:
|
|
285
|
-
line-height: 1.2;
|
|
379
|
+
font-size: 14px;
|
|
380
|
+
font-weight: 650;
|
|
286
381
|
letter-spacing: -0.01em;
|
|
382
|
+
white-space: nowrap;
|
|
287
383
|
}
|
|
288
384
|
.dshg-ver {
|
|
289
|
-
font-
|
|
290
|
-
font-size: 11px;
|
|
385
|
+
font-size: 10.5px;
|
|
291
386
|
font-weight: 500;
|
|
292
387
|
padding: 1px 6px;
|
|
293
388
|
border-radius: 99px;
|
|
294
|
-
border: 1px solid var(--dshg-border);
|
|
295
389
|
background: var(--dshg-fill);
|
|
296
390
|
color: var(--dshg-text-2);
|
|
391
|
+
border: 1px solid var(--dshg-border);
|
|
297
392
|
}
|
|
298
393
|
.dshg-sub {
|
|
299
394
|
font-size: 11px;
|
|
300
|
-
color: var(--dshg-text-
|
|
301
|
-
|
|
395
|
+
color: var(--dshg-text-3);
|
|
396
|
+
white-space: nowrap;
|
|
397
|
+
overflow: hidden;
|
|
398
|
+
text-overflow: ellipsis;
|
|
302
399
|
}
|
|
303
400
|
.dshg-actions {
|
|
304
401
|
display: flex;
|
|
305
402
|
align-items: center;
|
|
306
|
-
gap:
|
|
403
|
+
gap: 6px;
|
|
307
404
|
flex-shrink: 0;
|
|
308
405
|
}
|
|
309
406
|
.dshg-btn {
|
|
407
|
+
appearance: none;
|
|
310
408
|
display: inline-flex;
|
|
311
409
|
align-items: center;
|
|
312
410
|
justify-content: center;
|
|
313
|
-
gap:
|
|
411
|
+
gap: 5px;
|
|
314
412
|
height: 28px;
|
|
315
413
|
padding: 0 10px;
|
|
316
414
|
border-radius: 8px;
|
|
317
415
|
border: 1px solid var(--dshg-border);
|
|
318
416
|
background: var(--dshg-card);
|
|
319
417
|
color: var(--dshg-text);
|
|
418
|
+
font-family: inherit;
|
|
320
419
|
font-size: 11.5px;
|
|
321
420
|
font-weight: 500;
|
|
322
421
|
cursor: pointer;
|
|
@@ -330,7 +429,7 @@ window.__ModuleLoader__.load({
|
|
|
330
429
|
border-color: var(--dshg-border-strong);
|
|
331
430
|
}
|
|
332
431
|
.dshg-btn:disabled {
|
|
333
|
-
opacity: 0.
|
|
432
|
+
opacity: 0.52;
|
|
334
433
|
cursor: default;
|
|
335
434
|
}
|
|
336
435
|
.dshg-btn-icon {
|
|
@@ -341,27 +440,18 @@ window.__ModuleLoader__.load({
|
|
|
341
440
|
background: var(--dshg-accent);
|
|
342
441
|
border-color: transparent;
|
|
343
442
|
color: #ffffff;
|
|
344
|
-
height: 34px;
|
|
345
|
-
padding: 0 14px;
|
|
346
|
-
font-size: 12.5px;
|
|
347
443
|
font-weight: 600;
|
|
348
|
-
width: 100%;
|
|
349
|
-
border-radius: 9px;
|
|
350
444
|
}
|
|
351
445
|
.dshg-btn-primary:hover:not(:disabled) {
|
|
352
446
|
background: var(--dshg-accent);
|
|
353
447
|
border-color: transparent;
|
|
354
448
|
opacity: 0.92;
|
|
355
449
|
}
|
|
356
|
-
.dshg-btn-
|
|
357
|
-
|
|
358
|
-
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
359
|
-
gap: 6px;
|
|
360
|
-
}
|
|
361
|
-
.dshg-btn-row .dshg-btn {
|
|
362
|
-
width: 100%;
|
|
450
|
+
.dshg-btn-sm {
|
|
451
|
+
height: 24px;
|
|
363
452
|
padding: 0 8px;
|
|
364
453
|
font-size: 11px;
|
|
454
|
+
border-radius: 6px;
|
|
365
455
|
}
|
|
366
456
|
.dshg-spin {
|
|
367
457
|
animation: dshg-spin 0.9s linear infinite;
|
|
@@ -406,20 +496,23 @@ window.__ModuleLoader__.load({
|
|
|
406
496
|
}
|
|
407
497
|
.dshg-kpi-strip {
|
|
408
498
|
display: grid;
|
|
409
|
-
grid-template-columns: repeat(
|
|
499
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
410
500
|
gap: 6px;
|
|
411
501
|
}
|
|
502
|
+
.dshg-wrap[data-variant="main"] .dshg-kpi-strip {
|
|
503
|
+
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
504
|
+
}
|
|
412
505
|
.dshg-kpi {
|
|
413
506
|
border: 1px solid var(--dshg-border);
|
|
414
507
|
background: var(--dshg-card);
|
|
415
508
|
border-radius: 10px;
|
|
416
|
-
padding: 8px
|
|
509
|
+
padding: 8px 10px;
|
|
417
510
|
display: flex;
|
|
418
511
|
flex-direction: column;
|
|
419
512
|
gap: 2px;
|
|
420
513
|
text-align: left;
|
|
421
514
|
cursor: pointer;
|
|
422
|
-
color:
|
|
515
|
+
color: inherit;
|
|
423
516
|
transition: border-color 0.15s ease, background 0.15s ease;
|
|
424
517
|
}
|
|
425
518
|
.dshg-kpi:hover {
|
|
@@ -432,59 +525,80 @@ window.__ModuleLoader__.load({
|
|
|
432
525
|
}
|
|
433
526
|
.dshg-kpi-label {
|
|
434
527
|
font-size: 11px;
|
|
435
|
-
color: var(--dshg-text-
|
|
528
|
+
color: var(--dshg-text-3);
|
|
436
529
|
}
|
|
437
530
|
.dshg-kpi-val {
|
|
438
|
-
font-size:
|
|
439
|
-
font-weight:
|
|
440
|
-
|
|
441
|
-
line-height: 1.25;
|
|
442
|
-
}
|
|
443
|
-
.dshg-kpi-sub {
|
|
444
|
-
font-size: 11px;
|
|
445
|
-
color: var(--dshg-text-3);
|
|
446
|
-
white-space: nowrap;
|
|
447
|
-
overflow: hidden;
|
|
448
|
-
text-overflow: ellipsis;
|
|
531
|
+
font-size: 14.5px;
|
|
532
|
+
font-weight: 650;
|
|
533
|
+
letter-spacing: -0.02em;
|
|
449
534
|
}
|
|
450
535
|
.dshg-seg {
|
|
451
536
|
display: grid;
|
|
452
|
-
grid-template-columns: repeat(
|
|
453
|
-
gap:
|
|
537
|
+
grid-template-columns: repeat(5, minmax(0, 1fr));
|
|
538
|
+
gap: 3px;
|
|
454
539
|
padding: 3px;
|
|
455
540
|
border-radius: 10px;
|
|
541
|
+
background: var(--dshg-fill-subtle);
|
|
542
|
+
border: 1px solid var(--dshg-border);
|
|
543
|
+
}
|
|
544
|
+
.dshg-seg-2 {
|
|
545
|
+
display: inline-flex;
|
|
546
|
+
flex-wrap: wrap;
|
|
547
|
+
gap: 3px;
|
|
548
|
+
padding: 2px;
|
|
549
|
+
border-radius: 8px;
|
|
550
|
+
background: var(--dshg-fill-subtle);
|
|
551
|
+
border: 1px solid var(--dshg-border);
|
|
552
|
+
}
|
|
553
|
+
.dshg-seg-2 .dshg-seg-btn {
|
|
554
|
+
padding: 4px 9px;
|
|
555
|
+
}
|
|
556
|
+
.dshg-select {
|
|
557
|
+
height: 29px;
|
|
558
|
+
border-radius: 8px;
|
|
456
559
|
border: 1px solid var(--dshg-border);
|
|
457
560
|
background: var(--dshg-fill-subtle);
|
|
561
|
+
color: var(--dshg-text);
|
|
562
|
+
font-family: inherit;
|
|
563
|
+
font-size: 11.5px;
|
|
564
|
+
padding: 0 8px;
|
|
565
|
+
outline: none;
|
|
566
|
+
cursor: pointer;
|
|
567
|
+
}
|
|
568
|
+
.dshg-select option {
|
|
569
|
+
background: #1c2230;
|
|
570
|
+
color: #f3f4f6;
|
|
458
571
|
}
|
|
459
572
|
.dshg-seg-btn {
|
|
460
|
-
|
|
461
|
-
border:
|
|
462
|
-
border-radius: 7px;
|
|
573
|
+
appearance: none;
|
|
574
|
+
border: none;
|
|
463
575
|
background: transparent;
|
|
464
576
|
color: var(--dshg-text-2);
|
|
577
|
+
font-family: inherit;
|
|
465
578
|
font-size: 11.5px;
|
|
466
579
|
font-weight: 500;
|
|
580
|
+
padding: 5px 4px;
|
|
581
|
+
border-radius: 7px;
|
|
467
582
|
cursor: pointer;
|
|
468
583
|
display: inline-flex;
|
|
469
584
|
align-items: center;
|
|
470
585
|
justify-content: center;
|
|
471
|
-
gap:
|
|
472
|
-
transition: background 0.15s ease, color 0.15s ease
|
|
473
|
-
}
|
|
474
|
-
.dshg-seg-btn:hover {
|
|
475
|
-
color: var(--dshg-text);
|
|
586
|
+
gap: 4px;
|
|
587
|
+
transition: background 0.15s ease, color 0.15s ease;
|
|
476
588
|
}
|
|
477
589
|
.dshg-seg-btn[data-active="true"] {
|
|
478
|
-
background: var(--dshg-card);
|
|
479
|
-
border-color: var(--dshg-border);
|
|
590
|
+
background: var(--dshg-card-hover);
|
|
480
591
|
color: var(--dshg-text);
|
|
481
592
|
font-weight: 600;
|
|
482
593
|
}
|
|
483
|
-
.dshg-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
border-radius:
|
|
487
|
-
|
|
594
|
+
.dshg-card {
|
|
595
|
+
border: 1px solid var(--dshg-border);
|
|
596
|
+
background: var(--dshg-card);
|
|
597
|
+
border-radius: 11px;
|
|
598
|
+
padding: 11px 12px;
|
|
599
|
+
display: flex;
|
|
600
|
+
flex-direction: column;
|
|
601
|
+
gap: 9px;
|
|
488
602
|
}
|
|
489
603
|
.dshg-sec-head {
|
|
490
604
|
display: flex;
|
|
@@ -500,39 +614,9 @@ window.__ModuleLoader__.load({
|
|
|
500
614
|
color: var(--dshg-text-2);
|
|
501
615
|
line-height: 1.45;
|
|
502
616
|
}
|
|
503
|
-
.dshg-feat-grid {
|
|
504
|
-
display: grid;
|
|
505
|
-
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
506
|
-
gap: 6px;
|
|
507
|
-
}
|
|
508
|
-
.dshg-feat-item {
|
|
509
|
-
border: 1px solid var(--dshg-border);
|
|
510
|
-
background: var(--dshg-card);
|
|
511
|
-
border-radius: 9px;
|
|
512
|
-
padding: 8px 9px;
|
|
513
|
-
display: flex;
|
|
514
|
-
align-items: flex-start;
|
|
515
|
-
gap: 7px;
|
|
516
|
-
}
|
|
517
|
-
.dshg-feat-ico {
|
|
518
|
-
color: var(--dshg-accent);
|
|
519
|
-
flex-shrink: 0;
|
|
520
|
-
margin-top: 1px;
|
|
521
|
-
}
|
|
522
|
-
.dshg-feat-t {
|
|
523
|
-
font-size: 11.5px;
|
|
524
|
-
font-weight: 600;
|
|
525
|
-
line-height: 1.25;
|
|
526
|
-
}
|
|
527
|
-
.dshg-feat-s {
|
|
528
|
-
font-size: 11px;
|
|
529
|
-
color: var(--dshg-text-2);
|
|
530
|
-
margin-top: 2px;
|
|
531
|
-
line-height: 1.3;
|
|
532
|
-
}
|
|
533
617
|
.dshg-profile-grid {
|
|
534
618
|
display: grid;
|
|
535
|
-
grid-template-columns: repeat(auto-fit, minmax(
|
|
619
|
+
grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
|
|
536
620
|
gap: 7px;
|
|
537
621
|
}
|
|
538
622
|
.dshg-subcard {
|
|
@@ -541,7 +625,7 @@ window.__ModuleLoader__.load({
|
|
|
541
625
|
padding: 9px 10px;
|
|
542
626
|
display: flex;
|
|
543
627
|
flex-direction: column;
|
|
544
|
-
gap:
|
|
628
|
+
gap: 5px;
|
|
545
629
|
background: var(--dshg-fill-subtle);
|
|
546
630
|
}
|
|
547
631
|
.dshg-row {
|
|
@@ -551,140 +635,228 @@ window.__ModuleLoader__.load({
|
|
|
551
635
|
gap: 6px;
|
|
552
636
|
font-size: 11.5px;
|
|
553
637
|
}
|
|
554
|
-
.dshg-
|
|
638
|
+
.dshg-toolbar {
|
|
555
639
|
display: flex;
|
|
640
|
+
align-items: center;
|
|
641
|
+
justify-content: space-between;
|
|
642
|
+
gap: 8px;
|
|
556
643
|
flex-wrap: wrap;
|
|
557
|
-
gap: 5px;
|
|
558
644
|
}
|
|
559
|
-
.dshg-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
border-radius: 6px;
|
|
564
|
-
border: 1px solid var(--dshg-border);
|
|
565
|
-
background: var(--dshg-fill);
|
|
566
|
-
color: var(--dshg-text);
|
|
567
|
-
word-break: break-all;
|
|
645
|
+
.dshg-search-wrap {
|
|
646
|
+
position: relative;
|
|
647
|
+
flex: 1 1 160px;
|
|
648
|
+
min-width: 140px;
|
|
568
649
|
}
|
|
569
|
-
.dshg-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
650
|
+
.dshg-search-ico {
|
|
651
|
+
position: absolute;
|
|
652
|
+
left: 9px;
|
|
653
|
+
top: 50%;
|
|
654
|
+
transform: translateY(-50%);
|
|
655
|
+
color: var(--dshg-text-3);
|
|
656
|
+
pointer-events: none;
|
|
573
657
|
}
|
|
574
|
-
.dshg-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
658
|
+
.dshg-input {
|
|
659
|
+
width: 100%;
|
|
660
|
+
height: 29px;
|
|
661
|
+
box-sizing: border-box;
|
|
662
|
+
border-radius: 8px;
|
|
663
|
+
border: 1px solid var(--dshg-border);
|
|
664
|
+
background: var(--dshg-fill-subtle);
|
|
665
|
+
color: var(--dshg-text);
|
|
666
|
+
font-family: inherit;
|
|
667
|
+
font-size: 11.5px;
|
|
668
|
+
padding: 0 9px;
|
|
669
|
+
outline: none;
|
|
670
|
+
transition: border-color 0.15s ease, background 0.15s ease;
|
|
578
671
|
}
|
|
579
|
-
.dshg-
|
|
580
|
-
|
|
581
|
-
border-radius: 99px;
|
|
582
|
-
background: var(--dshg-fill);
|
|
583
|
-
overflow: hidden;
|
|
672
|
+
.dshg-input.with-ico {
|
|
673
|
+
padding-left: 28px;
|
|
584
674
|
}
|
|
585
|
-
.dshg-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
background: #22c55e;
|
|
589
|
-
transition: width 0.25s ease;
|
|
675
|
+
.dshg-input:focus {
|
|
676
|
+
border-color: var(--dshg-accent);
|
|
677
|
+
background: var(--dshg-card);
|
|
590
678
|
}
|
|
591
|
-
.dshg-
|
|
679
|
+
.dshg-list {
|
|
592
680
|
display: flex;
|
|
593
681
|
flex-direction: column;
|
|
594
682
|
gap: 6px;
|
|
595
683
|
}
|
|
596
|
-
.dshg-
|
|
684
|
+
.dshg-item {
|
|
597
685
|
border: 1px solid var(--dshg-border);
|
|
598
686
|
background: var(--dshg-fill-subtle);
|
|
599
687
|
border-radius: 9px;
|
|
600
|
-
padding:
|
|
688
|
+
padding: 8px 10px;
|
|
689
|
+
display: flex;
|
|
690
|
+
flex-direction: column;
|
|
691
|
+
gap: 6px;
|
|
692
|
+
}
|
|
693
|
+
.dshg-item-row {
|
|
601
694
|
display: flex;
|
|
602
695
|
align-items: center;
|
|
603
696
|
justify-content: space-between;
|
|
604
697
|
gap: 8px;
|
|
605
698
|
}
|
|
606
|
-
.dshg-
|
|
607
|
-
|
|
699
|
+
.dshg-item-main {
|
|
700
|
+
min-width: 0;
|
|
701
|
+
flex: 1;
|
|
702
|
+
display: flex;
|
|
703
|
+
flex-direction: column;
|
|
704
|
+
gap: 2px;
|
|
705
|
+
}
|
|
706
|
+
.dshg-item-title {
|
|
707
|
+
display: flex;
|
|
608
708
|
align-items: center;
|
|
609
709
|
gap: 6px;
|
|
710
|
+
flex-wrap: wrap;
|
|
711
|
+
font-size: 12px;
|
|
712
|
+
font-weight: 600;
|
|
713
|
+
word-break: break-word;
|
|
714
|
+
}
|
|
715
|
+
.dshg-mono {
|
|
610
716
|
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
611
|
-
font-size:
|
|
612
|
-
font-weight: 500;
|
|
613
|
-
min-width: 0;
|
|
717
|
+
font-size: 11px;
|
|
614
718
|
word-break: break-all;
|
|
719
|
+
color: var(--dshg-text-2);
|
|
615
720
|
}
|
|
616
|
-
.dshg-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
721
|
+
.dshg-switch {
|
|
722
|
+
position: relative;
|
|
723
|
+
width: 34px;
|
|
724
|
+
height: 19px;
|
|
725
|
+
border-radius: 99px;
|
|
726
|
+
border: 1px solid var(--dshg-border-strong);
|
|
727
|
+
background: var(--dshg-fill);
|
|
728
|
+
cursor: pointer;
|
|
729
|
+
padding: 0;
|
|
730
|
+
flex-shrink: 0;
|
|
731
|
+
transition: background 0.16s ease, border-color 0.16s ease;
|
|
620
732
|
}
|
|
621
|
-
.dshg-
|
|
622
|
-
|
|
623
|
-
border-
|
|
624
|
-
|
|
733
|
+
.dshg-switch[data-on="true"] {
|
|
734
|
+
background: #10b981;
|
|
735
|
+
border-color: #10b981;
|
|
736
|
+
}
|
|
737
|
+
.dshg-switch:disabled {
|
|
738
|
+
opacity: 0.45;
|
|
739
|
+
cursor: default;
|
|
740
|
+
}
|
|
741
|
+
.dshg-switch-thumb {
|
|
742
|
+
position: absolute;
|
|
743
|
+
top: 2px;
|
|
744
|
+
left: 2px;
|
|
745
|
+
width: 13px;
|
|
746
|
+
height: 13px;
|
|
747
|
+
border-radius: 50%;
|
|
748
|
+
background: #ffffff;
|
|
749
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
|
|
750
|
+
transition: transform 0.16s ease;
|
|
751
|
+
}
|
|
752
|
+
.dshg-switch[data-on="true"] .dshg-switch-thumb {
|
|
753
|
+
transform: translateX(15px);
|
|
754
|
+
}
|
|
755
|
+
.dshg-drawer {
|
|
756
|
+
border-top: 1px solid var(--dshg-border);
|
|
757
|
+
padding-top: 8px;
|
|
625
758
|
display: flex;
|
|
626
759
|
flex-direction: column;
|
|
627
|
-
gap:
|
|
628
|
-
background: var(--dshg-fill-subtle);
|
|
760
|
+
gap: 6px;
|
|
629
761
|
}
|
|
630
|
-
.dshg-
|
|
762
|
+
.dshg-drawer-row {
|
|
631
763
|
display: flex;
|
|
632
|
-
align-items: center;
|
|
633
|
-
justify-content: space-between;
|
|
634
764
|
gap: 6px;
|
|
635
|
-
}
|
|
636
|
-
.dshg-snap-title {
|
|
637
|
-
display: inline-flex;
|
|
638
765
|
align-items: center;
|
|
639
|
-
gap: 6px;
|
|
640
|
-
font-size: 12px;
|
|
641
|
-
font-weight: 500;
|
|
642
|
-
min-width: 0;
|
|
643
766
|
}
|
|
644
|
-
.dshg-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
flex-shrink: 0;
|
|
767
|
+
.dshg-pills {
|
|
768
|
+
display: flex;
|
|
769
|
+
flex-wrap: wrap;
|
|
770
|
+
gap: 4px;
|
|
649
771
|
}
|
|
650
|
-
.dshg-
|
|
772
|
+
.dshg-pill {
|
|
651
773
|
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
652
|
-
font-size:
|
|
653
|
-
|
|
774
|
+
font-size: 10.5px;
|
|
775
|
+
padding: 1.5px 6px;
|
|
776
|
+
border-radius: 5px;
|
|
777
|
+
border: 1px solid var(--dshg-border);
|
|
778
|
+
background: var(--dshg-fill);
|
|
654
779
|
color: var(--dshg-text-2);
|
|
780
|
+
word-break: break-all;
|
|
655
781
|
}
|
|
656
|
-
.dshg-
|
|
782
|
+
.dshg-boundary {
|
|
657
783
|
border: 1px solid var(--dshg-border);
|
|
658
|
-
border-radius:
|
|
784
|
+
border-radius: 10px;
|
|
659
785
|
background: var(--dshg-fill-subtle);
|
|
660
|
-
|
|
661
|
-
|
|
786
|
+
overflow: hidden;
|
|
787
|
+
}
|
|
788
|
+
.dshg-boundary > summary {
|
|
789
|
+
list-style: none;
|
|
790
|
+
cursor: pointer;
|
|
791
|
+
padding: 8px 11px;
|
|
662
792
|
font-size: 11px;
|
|
793
|
+
font-weight: 500;
|
|
663
794
|
color: var(--dshg-text-2);
|
|
664
|
-
word-break: break-all;
|
|
665
|
-
}
|
|
666
|
-
.dshg-empty {
|
|
667
|
-
border: 1px dashed var(--dshg-border-strong);
|
|
668
|
-
border-radius: 10px;
|
|
669
|
-
padding: 16px 12px;
|
|
670
795
|
display: flex;
|
|
671
|
-
flex-direction: column;
|
|
672
796
|
align-items: center;
|
|
673
|
-
|
|
674
|
-
gap:
|
|
675
|
-
|
|
797
|
+
justify-content: space-between;
|
|
798
|
+
gap: 8px;
|
|
799
|
+
user-select: none;
|
|
676
800
|
}
|
|
677
|
-
.dshg-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
border: 1px solid var(--dshg-
|
|
682
|
-
background: var(--dshg-accent-soft);
|
|
801
|
+
.dshg-boundary > summary::-webkit-details-marker {
|
|
802
|
+
display: none;
|
|
803
|
+
}
|
|
804
|
+
.dshg-boundary[open] > summary {
|
|
805
|
+
border-bottom: 1px solid var(--dshg-border);
|
|
683
806
|
color: var(--dshg-text);
|
|
684
807
|
}
|
|
685
|
-
.dshg-
|
|
686
|
-
padding:
|
|
687
|
-
|
|
808
|
+
.dshg-boundary-body {
|
|
809
|
+
padding: 9px 11px;
|
|
810
|
+
display: flex;
|
|
811
|
+
flex-direction: column;
|
|
812
|
+
gap: 6px;
|
|
813
|
+
font-size: 11px;
|
|
814
|
+
line-height: 1.5;
|
|
815
|
+
color: var(--dshg-text-2);
|
|
816
|
+
}
|
|
817
|
+
.dshg-boundary-links {
|
|
818
|
+
display: flex;
|
|
819
|
+
flex-wrap: wrap;
|
|
820
|
+
gap: 8px;
|
|
821
|
+
margin-top: 2px;
|
|
822
|
+
}
|
|
823
|
+
.dshg-boundary-links a {
|
|
824
|
+
font-size: 11px;
|
|
825
|
+
color: var(--dshg-accent);
|
|
826
|
+
text-decoration: none;
|
|
827
|
+
font-weight: 500;
|
|
828
|
+
}
|
|
829
|
+
.dshg-boundary-links a:hover {
|
|
830
|
+
text-decoration: underline;
|
|
831
|
+
}
|
|
832
|
+
.dshg-track-dot {
|
|
833
|
+
width: 7px;
|
|
834
|
+
height: 7px;
|
|
835
|
+
border-radius: 50%;
|
|
836
|
+
flex-shrink: 0;
|
|
837
|
+
}
|
|
838
|
+
.dshg-empty {
|
|
839
|
+
border: 1px dashed var(--dshg-border-strong);
|
|
840
|
+
border-radius: 10px;
|
|
841
|
+
padding: 15px 12px;
|
|
842
|
+
display: flex;
|
|
843
|
+
flex-direction: column;
|
|
844
|
+
align-items: center;
|
|
845
|
+
text-align: center;
|
|
846
|
+
gap: 6px;
|
|
847
|
+
color: var(--dshg-text-2);
|
|
848
|
+
}
|
|
849
|
+
.dshg-notice {
|
|
850
|
+
padding: 8px 10px;
|
|
851
|
+
border-radius: 9px;
|
|
852
|
+
font-size: 11.5px;
|
|
853
|
+
border: 1px solid var(--dshg-accent-border);
|
|
854
|
+
background: var(--dshg-accent-soft);
|
|
855
|
+
color: var(--dshg-text);
|
|
856
|
+
}
|
|
857
|
+
.dshg-error {
|
|
858
|
+
padding: 8px 10px;
|
|
859
|
+
border-radius: 9px;
|
|
688
860
|
font-size: 11.5px;
|
|
689
861
|
border: 1px solid rgba(239, 68, 68, 0.4);
|
|
690
862
|
background: rgba(239, 68, 68, 0.11);
|
|
@@ -721,12 +893,23 @@ window.__ModuleLoader__.load({
|
|
|
721
893
|
const store = {
|
|
722
894
|
lang: 'zh',
|
|
723
895
|
tab: 'overview',
|
|
896
|
+
search: '',
|
|
897
|
+
skillSearch: '',
|
|
724
898
|
loading: false,
|
|
725
|
-
|
|
899
|
+
busyKey: '',
|
|
726
900
|
error: '',
|
|
727
901
|
notice: '',
|
|
728
902
|
data: null,
|
|
729
903
|
checkedAt: 0,
|
|
904
|
+
editProviderKey: '',
|
|
905
|
+
draftSecret: '',
|
|
906
|
+
showAddKey: false,
|
|
907
|
+
newKeyName: '',
|
|
908
|
+
newKeySecret: '',
|
|
909
|
+
expandedSnaps: {},
|
|
910
|
+
mcpProbes: {},
|
|
911
|
+
editMcpId: '',
|
|
912
|
+
draftMcpTimeout: '',
|
|
730
913
|
}
|
|
731
914
|
|
|
732
915
|
const listeners = new Set()
|
|
@@ -736,7 +919,7 @@ window.__ModuleLoader__.load({
|
|
|
736
919
|
try {
|
|
737
920
|
listener()
|
|
738
921
|
} catch {
|
|
739
|
-
// Ignore subscriber errors
|
|
922
|
+
// Ignore unmounted subscriber errors cleanly.
|
|
740
923
|
}
|
|
741
924
|
}
|
|
742
925
|
}
|
|
@@ -747,82 +930,120 @@ window.__ModuleLoader__.load({
|
|
|
747
930
|
}
|
|
748
931
|
|
|
749
932
|
function useStore() {
|
|
750
|
-
const [,
|
|
933
|
+
const [, setTick] = React.useState(0)
|
|
751
934
|
React.useEffect(() => {
|
|
752
|
-
const
|
|
753
|
-
listeners.add(
|
|
754
|
-
return () => listeners.delete(
|
|
935
|
+
const listener = () => setTick((v) => v + 1)
|
|
936
|
+
listeners.add(listener)
|
|
937
|
+
return () => listeners.delete(listener)
|
|
755
938
|
}, [])
|
|
756
939
|
return store
|
|
757
940
|
}
|
|
758
941
|
|
|
759
|
-
async function
|
|
760
|
-
|
|
942
|
+
async function readJsonResponse(res) {
|
|
943
|
+
const text = await res.text()
|
|
944
|
+
if (!text) return { json: null, rawText: '' }
|
|
945
|
+
try {
|
|
946
|
+
return { json: JSON.parse(text), rawText: text }
|
|
947
|
+
} catch {
|
|
948
|
+
return { json: null, rawText: text }
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
function buildHttpErrorMessage(res, parsed) {
|
|
953
|
+
if (parsed && parsed.json && (parsed.json.error || parsed.json.message)) {
|
|
954
|
+
return String(parsed.json.error || parsed.json.message)
|
|
955
|
+
}
|
|
956
|
+
const snippet = parsed && parsed.rawText ? String(parsed.rawText).trim().slice(0, 120) : ''
|
|
957
|
+
return snippet ? `HTTP ${res.status}: ${snippet}` : `HTTP ${res.status}`
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
async function fetchOverview(force = false) {
|
|
961
|
+
if (store.loading && !force) return
|
|
761
962
|
patch({ loading: true, error: '' })
|
|
762
963
|
try {
|
|
763
|
-
const res = await fetch(`${API_BASE}/overview`, {
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
const json = await res.json()
|
|
769
|
-
if (!res.ok || !json || json.ok === false) {
|
|
770
|
-
throw new Error((json && json.error) || `HTTP ${res.status}`)
|
|
964
|
+
const res = await fetch(`${API_BASE}/overview`, { credentials: 'same-origin' })
|
|
965
|
+
const parsed = await readJsonResponse(res)
|
|
966
|
+
const json = parsed.json
|
|
967
|
+
if (!res.ok || !json || !json.ok) {
|
|
968
|
+
throw new Error(buildHttpErrorMessage(res, parsed))
|
|
771
969
|
}
|
|
772
970
|
patch({
|
|
971
|
+
loading: false,
|
|
773
972
|
data: json,
|
|
774
973
|
checkedAt: json.checkedAt || Date.now(),
|
|
775
|
-
error: '',
|
|
776
974
|
})
|
|
777
975
|
} catch (err) {
|
|
778
|
-
patch({
|
|
779
|
-
|
|
780
|
-
|
|
976
|
+
patch({
|
|
977
|
+
loading: false,
|
|
978
|
+
error: err && err.message ? String(err.message) : 'Failed to load companion state',
|
|
979
|
+
})
|
|
781
980
|
}
|
|
782
981
|
}
|
|
783
982
|
|
|
784
|
-
async function
|
|
785
|
-
|
|
786
|
-
patch({ launching: true, notice: '', error: '' })
|
|
983
|
+
async function postAction(endpoint, payload, busyId, successMsgBuilder) {
|
|
984
|
+
patch({ busyKey: busyId, error: '', notice: '' })
|
|
787
985
|
try {
|
|
788
|
-
const res = await fetch(`${API_BASE}
|
|
986
|
+
const res = await fetch(`${API_BASE}${endpoint}`, {
|
|
789
987
|
method: 'POST',
|
|
790
|
-
cache: 'no-store',
|
|
791
988
|
credentials: 'same-origin',
|
|
792
|
-
headers: {
|
|
989
|
+
headers: { 'content-type': 'application/json' },
|
|
990
|
+
body: JSON.stringify(payload || {}),
|
|
793
991
|
})
|
|
794
|
-
const
|
|
992
|
+
const parsed = await readJsonResponse(res)
|
|
993
|
+
const json = parsed.json
|
|
795
994
|
if (!res.ok || !json || json.ok === false) {
|
|
796
|
-
throw new Error((
|
|
995
|
+
throw new Error(buildHttpErrorMessage(res, parsed))
|
|
797
996
|
}
|
|
798
|
-
|
|
997
|
+
const msg = typeof successMsgBuilder === 'function' ? successMsgBuilder(json) : ''
|
|
998
|
+
patch({ busyKey: '', notice: msg || '' })
|
|
999
|
+
await fetchOverview(true)
|
|
1000
|
+
return json
|
|
799
1001
|
} catch (err) {
|
|
800
|
-
patch({
|
|
801
|
-
|
|
802
|
-
|
|
1002
|
+
patch({
|
|
1003
|
+
busyKey: '',
|
|
1004
|
+
error: err && err.message ? String(err.message) : 'Action failed',
|
|
1005
|
+
})
|
|
1006
|
+
return null
|
|
803
1007
|
}
|
|
804
1008
|
}
|
|
805
1009
|
|
|
806
|
-
function
|
|
807
|
-
|
|
808
|
-
const d = new Date(value)
|
|
809
|
-
if (Number.isNaN(d.getTime())) return String(value)
|
|
810
|
-
const p = (n) => String(n).padStart(2, '0')
|
|
811
|
-
return `${d.getMonth() + 1}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`
|
|
1010
|
+
async function launchGuardDesktop() {
|
|
1011
|
+
await postAction('/open', {}, 'open-desktop', (json) => json.message || '')
|
|
812
1012
|
}
|
|
813
1013
|
|
|
814
|
-
function
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
1014
|
+
async function probeMcpsForProfile(targetProfile) {
|
|
1015
|
+
patch({ busyKey: 'probe-mcp', error: '', notice: '' })
|
|
1016
|
+
try {
|
|
1017
|
+
const res = await fetch(`${API_BASE}/mcp/probe`, {
|
|
1018
|
+
method: 'POST',
|
|
1019
|
+
credentials: 'same-origin',
|
|
1020
|
+
headers: { 'content-type': 'application/json' },
|
|
1021
|
+
body: JSON.stringify(targetProfile ? { target: targetProfile } : {}),
|
|
1022
|
+
})
|
|
1023
|
+
const parsed = await readJsonResponse(res)
|
|
1024
|
+
const json = parsed.json
|
|
1025
|
+
if (!res.ok || !json || json.ok === false) {
|
|
1026
|
+
throw new Error(buildHttpErrorMessage(res, parsed))
|
|
1027
|
+
}
|
|
1028
|
+
const nextMap = { ...store.mcpProbes }
|
|
1029
|
+
for (const r of json.results || []) {
|
|
1030
|
+
nextMap[`${r.profile}:${r.id}`] = r
|
|
1031
|
+
}
|
|
1032
|
+
patch({
|
|
1033
|
+
busyKey: '',
|
|
1034
|
+
mcpProbes: nextMap,
|
|
1035
|
+
notice: `MCP 探活完成:启用 ${json.activeCount || 0} 台 · 异常 ${json.unhealthyCount || 0} 台`,
|
|
1036
|
+
})
|
|
1037
|
+
} catch (err) {
|
|
1038
|
+
patch({
|
|
1039
|
+
busyKey: '',
|
|
1040
|
+
error: err && err.message ? String(err.message) : 'MCP probe failed',
|
|
1041
|
+
})
|
|
1042
|
+
}
|
|
820
1043
|
}
|
|
821
1044
|
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
const size = props && typeof props.size === 'number' && props.size > 0 ? props.size : 17
|
|
825
|
-
const active = Boolean(props && props.active)
|
|
1045
|
+
function SvgIcon(props) {
|
|
1046
|
+
const size = props.size || 15
|
|
826
1047
|
return h(
|
|
827
1048
|
'svg',
|
|
828
1049
|
{
|
|
@@ -831,113 +1052,79 @@ window.__ModuleLoader__.load({
|
|
|
831
1052
|
viewBox: '0 0 24 24',
|
|
832
1053
|
fill: 'none',
|
|
833
1054
|
stroke: 'currentColor',
|
|
834
|
-
strokeWidth:
|
|
1055
|
+
strokeWidth: 2,
|
|
835
1056
|
strokeLinecap: 'round',
|
|
836
1057
|
strokeLinejoin: 'round',
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
style: { display: 'block', flexShrink: 0 },
|
|
1058
|
+
className: props.className || undefined,
|
|
1059
|
+
'aria-hidden': 'true',
|
|
840
1060
|
},
|
|
841
|
-
|
|
842
|
-
h('path', { d: 'M8.5 13c.8-2 2.5-3 4.3-2.6 1.5.3 2.5 1.3 3.2 2.2.8-.6 1.4-1.3 1.7-2.2' }),
|
|
843
|
-
h('circle', { cx: '11', cy: '12.6', r: '0.65', fill: 'currentColor' }),
|
|
1061
|
+
props.children,
|
|
844
1062
|
)
|
|
845
1063
|
}
|
|
846
1064
|
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
h('path', { d: 'M12 3l9 4.5-9 4.5-9-4.5 9-4.5z' }),
|
|
911
|
-
h('path', { d: 'M3 12l9 4.5 9-4.5' }),
|
|
912
|
-
h('path', { d: 'M3 16.5l9 4.5 9-4.5' }),
|
|
913
|
-
)
|
|
914
|
-
case 'shield':
|
|
915
|
-
return h(
|
|
916
|
-
'svg',
|
|
917
|
-
common,
|
|
918
|
-
h('path', { d: 'M12 3l7.5 3v6c0 4.5-3.2 8.2-7.5 9.5C7.7 20.2 4.5 16.5 4.5 12V6L12 3z' }),
|
|
919
|
-
h('path', { d: 'M9 12l2 2 4-4' }),
|
|
920
|
-
)
|
|
921
|
-
case 'clock':
|
|
922
|
-
return h(
|
|
923
|
-
'svg',
|
|
924
|
-
common,
|
|
925
|
-
h('circle', { cx: 12, cy: 12, r: 9 }),
|
|
926
|
-
h('path', { d: 'M12 7v5l3 2' }),
|
|
927
|
-
)
|
|
928
|
-
case 'check':
|
|
929
|
-
return h('svg', common, h('path', { d: 'M5 12l5 5 9-9' }))
|
|
930
|
-
case 'alert':
|
|
931
|
-
return h(
|
|
932
|
-
'svg',
|
|
933
|
-
common,
|
|
934
|
-
h('path', { d: 'M12 9v4' }),
|
|
935
|
-
h('path', { d: 'M10.4 4.3L3.1 17a1.8 1.8 0 0 0 1.6 2.7h14.6a1.8 1.8 0 0 0 1.6-2.7L13.6 4.3a1.8 1.8 0 0 0-3.2 0z' }),
|
|
936
|
-
h('circle', { cx: 12, cy: 16.3, r: 0.6, fill: 'currentColor' }),
|
|
937
|
-
)
|
|
938
|
-
default:
|
|
939
|
-
return null
|
|
940
|
-
}
|
|
1065
|
+
function GuardIcon(props) {
|
|
1066
|
+
return h(
|
|
1067
|
+
SvgIcon,
|
|
1068
|
+
props,
|
|
1069
|
+
h('path', { d: 'M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z' }),
|
|
1070
|
+
h('path', { d: 'm9 12 2 2 4-4' }),
|
|
1071
|
+
)
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
function RefreshIcon(props) {
|
|
1075
|
+
return h(
|
|
1076
|
+
SvgIcon,
|
|
1077
|
+
props,
|
|
1078
|
+
h('path', { d: 'M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8' }),
|
|
1079
|
+
h('path', { d: 'M3 3v5h5' }),
|
|
1080
|
+
h('path', { d: 'M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16' }),
|
|
1081
|
+
h('path', { d: 'M16 16h5v5' }),
|
|
1082
|
+
)
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
function SearchIcon(props) {
|
|
1086
|
+
return h(
|
|
1087
|
+
SvgIcon,
|
|
1088
|
+
props,
|
|
1089
|
+
h('circle', { cx: 11, cy: 11, r: 7 }),
|
|
1090
|
+
h('path', { d: 'm20 20-3.5-3.5' }),
|
|
1091
|
+
)
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
function ChevronIcon(props) {
|
|
1095
|
+
return h(
|
|
1096
|
+
SvgIcon,
|
|
1097
|
+
{ size: props.size || 13 },
|
|
1098
|
+
h('path', { d: 'm6 9 6 6 6-6' }),
|
|
1099
|
+
)
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
function ExternalIcon(props) {
|
|
1103
|
+
return h(
|
|
1104
|
+
SvgIcon,
|
|
1105
|
+
props,
|
|
1106
|
+
h('path', { d: 'M15 3h6v6' }),
|
|
1107
|
+
h('path', { d: 'M10 14 21 3' }),
|
|
1108
|
+
h('path', { d: 'M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6' }),
|
|
1109
|
+
)
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
function CheckCircleIcon(props) {
|
|
1113
|
+
return h(
|
|
1114
|
+
SvgIcon,
|
|
1115
|
+
props,
|
|
1116
|
+
h('circle', { cx: 12, cy: 12, r: 9 }),
|
|
1117
|
+
h('path', { d: 'm9 12 2 2 4-4' }),
|
|
1118
|
+
)
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
function LockIcon(props) {
|
|
1122
|
+
return h(
|
|
1123
|
+
SvgIcon,
|
|
1124
|
+
props,
|
|
1125
|
+
h('rect', { x: 4, y: 11, width: 16, height: 10, rx: 2 }),
|
|
1126
|
+
h('path', { d: 'M7 11V7a5 5 0 0 1 10 0v4' }),
|
|
1127
|
+
)
|
|
941
1128
|
}
|
|
942
1129
|
|
|
943
1130
|
class GuardErrorBoundary extends React.Component {
|
|
@@ -950,30 +1137,13 @@ window.__ModuleLoader__.load({
|
|
|
950
1137
|
}
|
|
951
1138
|
render() {
|
|
952
1139
|
if (this.state.error) {
|
|
953
|
-
const t = COPY[store.lang] || COPY.zh
|
|
954
1140
|
return h(
|
|
955
1141
|
'div',
|
|
956
|
-
{ className: 'dshg-
|
|
1142
|
+
{ className: 'dshg-wrap' },
|
|
957
1143
|
h(
|
|
958
1144
|
'div',
|
|
959
|
-
{ className: 'dshg-
|
|
960
|
-
|
|
961
|
-
h(
|
|
962
|
-
'div',
|
|
963
|
-
{ style: { fontSize: 11.5, color: 'var(--dshg-text-2)' } },
|
|
964
|
-
String((this.state.error && this.state.error.message) || this.state.error),
|
|
965
|
-
),
|
|
966
|
-
h(
|
|
967
|
-
'button',
|
|
968
|
-
{
|
|
969
|
-
className: 'dshg-btn',
|
|
970
|
-
onClick: () => {
|
|
971
|
-
this.setState({ error: null })
|
|
972
|
-
void fetchOverview()
|
|
973
|
-
},
|
|
974
|
-
},
|
|
975
|
-
t.retry,
|
|
976
|
-
),
|
|
1145
|
+
{ className: 'dshg-error' },
|
|
1146
|
+
`DSH Companion Error: ${String(this.state.error.message || this.state.error)}`,
|
|
977
1147
|
),
|
|
978
1148
|
)
|
|
979
1149
|
}
|
|
@@ -981,667 +1151,1336 @@ window.__ModuleLoader__.load({
|
|
|
981
1151
|
}
|
|
982
1152
|
}
|
|
983
1153
|
|
|
984
|
-
function
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
)
|
|
1154
|
+
function formatTimeShort(value) {
|
|
1155
|
+
if (!value) return '--'
|
|
1156
|
+
try {
|
|
1157
|
+
const d = typeof value === 'number' ? new Date(value) : new Date(String(value))
|
|
1158
|
+
if (Number.isNaN(d.getTime())) return String(value).slice(0, 16)
|
|
1159
|
+
const now = new Date()
|
|
1160
|
+
const sameDay =
|
|
1161
|
+
d.getFullYear() === now.getFullYear() &&
|
|
1162
|
+
d.getMonth() === now.getMonth() &&
|
|
1163
|
+
d.getDate() === now.getDate()
|
|
1164
|
+
const hh = String(d.getHours()).padStart(2, '0')
|
|
1165
|
+
const mm = String(d.getMinutes()).padStart(2, '0')
|
|
1166
|
+
if (sameDay) return `${hh}:${mm}`
|
|
1167
|
+
return `${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')} ${hh}:${mm}`
|
|
1168
|
+
} catch {
|
|
1169
|
+
return String(value).slice(0, 16)
|
|
1000
1170
|
}
|
|
1171
|
+
}
|
|
1001
1172
|
|
|
1002
|
-
|
|
1003
|
-
const
|
|
1004
|
-
? t.patchMissing
|
|
1005
|
-
: patchInfo.syntaxOk
|
|
1006
|
-
? t.patchOk(patchInfo.disabledCount || 0)
|
|
1007
|
-
: t.patchErr(patchInfo.error || 'YAML')
|
|
1008
|
-
const patchTone = patchInfo.exists && !patchInfo.syntaxOk ? 'warn' : 'ok'
|
|
1009
|
-
|
|
1173
|
+
function BoundaryDisclosure(props) {
|
|
1174
|
+
const { summary, p1, p2, isWin, installerUrl, releaseUrl, t } = props
|
|
1010
1175
|
return h(
|
|
1011
|
-
'
|
|
1012
|
-
{ className: 'dshg-
|
|
1176
|
+
'details',
|
|
1177
|
+
{ className: 'dshg-boundary' },
|
|
1013
1178
|
h(
|
|
1014
|
-
'
|
|
1015
|
-
|
|
1016
|
-
h('span',
|
|
1017
|
-
h(
|
|
1018
|
-
'span',
|
|
1019
|
-
{ style: { fontSize: 11, color: 'var(--dshg-text-2)', fontVariantNumeric: 'tabular-nums', whiteSpace: 'nowrap' } },
|
|
1020
|
-
`${profile.bundlesCount} ${t.bundlesLabel} · ${profile.dependenciesCount} ${t.depsLabel}`,
|
|
1021
|
-
),
|
|
1179
|
+
'summary',
|
|
1180
|
+
null,
|
|
1181
|
+
h('span', null, summary),
|
|
1182
|
+
h(ChevronIcon, { size: 13 }),
|
|
1022
1183
|
),
|
|
1023
1184
|
h(
|
|
1024
1185
|
'div',
|
|
1025
|
-
{ className: 'dshg-
|
|
1026
|
-
h(
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
? h('div', { style: { fontSize: 11, color: '#f59e0b' } }, t.pkgErr)
|
|
1031
|
-
: null,
|
|
1032
|
-
Array.isArray(profile.missingInDeps) && profile.missingInDeps.length > 0
|
|
1033
|
-
? h(
|
|
1034
|
-
'div',
|
|
1035
|
-
{ className: 'dshg-pills' },
|
|
1036
|
-
h('span', { style: { fontSize: 11, color: '#f59e0b' } }, `${t.missingInDeps}:`),
|
|
1037
|
-
...profile.missingInDeps.map((pkg) => h('span', { key: pkg, className: 'dshg-pill', 'data-tone': 'warn' }, pkg)),
|
|
1038
|
-
)
|
|
1039
|
-
: null,
|
|
1040
|
-
Array.isArray(profile.unregisteredDeps) && profile.unregisteredDeps.length > 0
|
|
1041
|
-
? h(
|
|
1042
|
-
'div',
|
|
1043
|
-
{ className: 'dshg-pills' },
|
|
1044
|
-
h('span', { style: { fontSize: 11, color: '#f59e0b' } }, `${t.unregisteredDeps}:`),
|
|
1045
|
-
...profile.unregisteredDeps.map((pkg) => h('span', { key: pkg, className: 'dshg-pill', 'data-tone': 'warn' }, pkg)),
|
|
1046
|
-
)
|
|
1047
|
-
: null,
|
|
1048
|
-
)
|
|
1049
|
-
}
|
|
1050
|
-
|
|
1051
|
-
function SupervisorCard({ platform, guard, installerUrl, releaseUrl, repoUrl, launching, t }) {
|
|
1052
|
-
const isWin = platform === 'win32'
|
|
1053
|
-
if (isWin && guard.installed) {
|
|
1054
|
-
return h(
|
|
1055
|
-
'div',
|
|
1056
|
-
{ className: 'dshg-card dshg-card-spotlight' },
|
|
1057
|
-
h(
|
|
1058
|
-
'div',
|
|
1059
|
-
{ className: 'dshg-sec-head' },
|
|
1060
|
-
h(
|
|
1061
|
-
'span',
|
|
1062
|
-
{ style: { display: 'inline-flex', alignItems: 'center', gap: 6 } },
|
|
1063
|
-
h(GuardIcon, { size: 15, active: true }),
|
|
1064
|
-
t.supervisorTitleWinReady,
|
|
1065
|
-
),
|
|
1066
|
-
h(
|
|
1067
|
-
'span',
|
|
1068
|
-
{ className: 'dshg-badge', 'data-tone': 'ok' },
|
|
1069
|
-
h('span', { className: 'dshg-dot' }),
|
|
1070
|
-
t.supervisorBadgeReady,
|
|
1071
|
-
),
|
|
1072
|
-
),
|
|
1073
|
-
h('div', { className: 'dshg-sec-sub' }, t.supervisorDescWinReady),
|
|
1074
|
-
h('div', { className: 'dshg-path-box' }, guard.exePath || 'DSHGuard.exe'),
|
|
1075
|
-
h(
|
|
1076
|
-
'button',
|
|
1077
|
-
{
|
|
1078
|
-
className: 'dshg-btn dshg-btn-primary',
|
|
1079
|
-
disabled: launching,
|
|
1080
|
-
onClick: () => void launchDesktopGuard(),
|
|
1081
|
-
},
|
|
1082
|
-
h(SvgIcon, { name: 'window', size: 15 }),
|
|
1083
|
-
launching ? t.btnOpeningGuard : t.btnOpenGuard,
|
|
1084
|
-
),
|
|
1085
|
-
)
|
|
1086
|
-
}
|
|
1087
|
-
|
|
1088
|
-
if (isWin) {
|
|
1089
|
-
const feats = [
|
|
1090
|
-
{ icon: 'bolt', title: t.feat1Title, sub: t.feat1Sub },
|
|
1091
|
-
{ icon: 'key', title: t.feat2Title, sub: t.feat2Sub },
|
|
1092
|
-
{ icon: 'layers', title: t.feat3Title, sub: t.feat3Sub },
|
|
1093
|
-
{ icon: 'shield', title: t.feat4Title, sub: t.feat4Sub },
|
|
1094
|
-
]
|
|
1095
|
-
return h(
|
|
1096
|
-
'div',
|
|
1097
|
-
{ className: 'dshg-card dshg-card-spotlight' },
|
|
1098
|
-
h(
|
|
1099
|
-
'div',
|
|
1100
|
-
{ className: 'dshg-sec-head' },
|
|
1101
|
-
h(
|
|
1102
|
-
'span',
|
|
1103
|
-
{ style: { display: 'inline-flex', alignItems: 'center', gap: 6 } },
|
|
1104
|
-
h(GuardIcon, { size: 15, active: true }),
|
|
1105
|
-
t.supervisorTitleWinMissing,
|
|
1106
|
-
),
|
|
1107
|
-
h('span', { className: 'dshg-badge', 'data-tone': 'blue' }, t.supervisorBadgeWin),
|
|
1108
|
-
),
|
|
1109
|
-
h('div', { className: 'dshg-sec-sub' }, t.supervisorDescWinMissing),
|
|
1110
|
-
h(
|
|
1111
|
-
'div',
|
|
1112
|
-
{ className: 'dshg-feat-grid' },
|
|
1113
|
-
...feats.map((f) =>
|
|
1114
|
-
h(
|
|
1186
|
+
{ className: 'dshg-boundary-body' },
|
|
1187
|
+
h('div', null, p1),
|
|
1188
|
+
h('div', null, p2),
|
|
1189
|
+
isWin
|
|
1190
|
+
? h(
|
|
1115
1191
|
'div',
|
|
1116
|
-
{
|
|
1117
|
-
h('div', { className: 'dshg-feat-ico' }, h(SvgIcon, { name: f.icon, size: 14 })),
|
|
1192
|
+
{ className: 'dshg-boundary-links' },
|
|
1118
1193
|
h(
|
|
1119
|
-
'
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
h('div', { className: 'dshg-feat-s' }, f.sub),
|
|
1194
|
+
'a',
|
|
1195
|
+
{ href: installerUrl, target: '_blank', rel: 'noopener noreferrer' },
|
|
1196
|
+
t.desktopWinLink,
|
|
1123
1197
|
),
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
},
|
|
1135
|
-
h(SvgIcon, { name: 'download', size: 15 }),
|
|
1136
|
-
t.btnDownloadExe,
|
|
1137
|
-
),
|
|
1138
|
-
h(
|
|
1139
|
-
'div',
|
|
1140
|
-
{ className: 'dshg-btn-row' },
|
|
1141
|
-
h(
|
|
1142
|
-
'a',
|
|
1143
|
-
{
|
|
1144
|
-
className: 'dshg-btn',
|
|
1145
|
-
href: repoUrl,
|
|
1146
|
-
target: '_blank',
|
|
1147
|
-
rel: 'noopener noreferrer',
|
|
1148
|
-
},
|
|
1149
|
-
h(SvgIcon, { name: 'external', size: 12 }),
|
|
1150
|
-
t.btnViewRepo,
|
|
1151
|
-
),
|
|
1152
|
-
h(
|
|
1153
|
-
'button',
|
|
1154
|
-
{
|
|
1155
|
-
className: 'dshg-btn',
|
|
1156
|
-
onClick: () => void fetchOverview(),
|
|
1157
|
-
},
|
|
1158
|
-
h(SvgIcon, { name: 'refresh', size: 12 }),
|
|
1159
|
-
t.btnRedetect,
|
|
1160
|
-
),
|
|
1161
|
-
),
|
|
1162
|
-
)
|
|
1163
|
-
}
|
|
1198
|
+
h(
|
|
1199
|
+
'a',
|
|
1200
|
+
{ href: releaseUrl, target: '_blank', rel: 'noopener noreferrer' },
|
|
1201
|
+
t.desktopReleaseLink,
|
|
1202
|
+
),
|
|
1203
|
+
)
|
|
1204
|
+
: h('div', { style: { opacity: 0.85 } }, t.desktopNonWinNote),
|
|
1205
|
+
),
|
|
1206
|
+
)
|
|
1207
|
+
}
|
|
1164
1208
|
|
|
1209
|
+
function ToggleSwitch(props) {
|
|
1210
|
+
const { on, disabled, busy, onToggle, title } = props
|
|
1165
1211
|
return h(
|
|
1166
|
-
'
|
|
1167
|
-
{
|
|
1168
|
-
|
|
1169
|
-
'
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
),
|
|
1179
|
-
h('div', { className: 'dshg-sec-sub' }, t.supervisorDescOther(platform || 'POSIX')),
|
|
1180
|
-
h(
|
|
1181
|
-
'div',
|
|
1182
|
-
{ className: 'dshg-btn-row' },
|
|
1183
|
-
h(
|
|
1184
|
-
'a',
|
|
1185
|
-
{
|
|
1186
|
-
className: 'dshg-btn',
|
|
1187
|
-
href: repoUrl,
|
|
1188
|
-
target: '_blank',
|
|
1189
|
-
rel: 'noopener noreferrer',
|
|
1190
|
-
},
|
|
1191
|
-
h(SvgIcon, { name: 'external', size: 12 }),
|
|
1192
|
-
t.btnViewRepo,
|
|
1193
|
-
),
|
|
1194
|
-
h(
|
|
1195
|
-
'a',
|
|
1196
|
-
{
|
|
1197
|
-
className: 'dshg-btn',
|
|
1198
|
-
href: releaseUrl,
|
|
1199
|
-
target: '_blank',
|
|
1200
|
-
rel: 'noopener noreferrer',
|
|
1201
|
-
},
|
|
1202
|
-
h(SvgIcon, { name: 'download', size: 12 }),
|
|
1203
|
-
t.btnViewReleases,
|
|
1204
|
-
),
|
|
1205
|
-
),
|
|
1212
|
+
'button',
|
|
1213
|
+
{
|
|
1214
|
+
type: 'button',
|
|
1215
|
+
role: 'switch',
|
|
1216
|
+
'aria-checked': Boolean(on),
|
|
1217
|
+
'aria-label': title,
|
|
1218
|
+
className: 'dshg-switch',
|
|
1219
|
+
'data-on': Boolean(on) ? 'true' : 'false',
|
|
1220
|
+
disabled: Boolean(disabled || busy),
|
|
1221
|
+
onClick: onToggle,
|
|
1222
|
+
},
|
|
1223
|
+
h('span', { className: 'dshg-switch-thumb' }),
|
|
1206
1224
|
)
|
|
1207
1225
|
}
|
|
1208
1226
|
|
|
1209
|
-
function GuardPanelInner(
|
|
1210
|
-
|
|
1211
|
-
const
|
|
1227
|
+
function GuardPanelInner(props) {
|
|
1228
|
+
ensureStyles()
|
|
1229
|
+
const state = useStore()
|
|
1230
|
+
const t = COPY[state.lang] || COPY.zh
|
|
1212
1231
|
|
|
1213
1232
|
React.useEffect(() => {
|
|
1214
|
-
ensureStyles()
|
|
1215
1233
|
if (!store.data && !store.loading) {
|
|
1216
|
-
|
|
1234
|
+
fetchOverview(false)
|
|
1217
1235
|
}
|
|
1218
1236
|
}, [])
|
|
1219
1237
|
|
|
1220
|
-
const data =
|
|
1221
|
-
const health = data && data.health
|
|
1222
|
-
const snapshots = data && data.snapshots
|
|
1223
|
-
const
|
|
1224
|
-
const
|
|
1225
|
-
const
|
|
1226
|
-
const
|
|
1227
|
-
const repoUrl = (data && data.repoUrl) ||
|
|
1228
|
-
const creds = (health && health.credentials) || {}
|
|
1229
|
-
const refKeys = Array.isArray(creds.referencedKeys) ? creds.referencedKeys : []
|
|
1230
|
-
const snapList = snapshots && Array.isArray(snapshots.snapshots) ? snapshots.snapshots : []
|
|
1231
|
-
const profiles = health && Array.isArray(health.profiles) ? health.profiles : []
|
|
1232
|
-
|
|
1233
|
-
const webProfile = profiles.find((p) => p.target === 'web')
|
|
1234
|
-
const deskProfile = profiles.find((p) => p.target === 'desktop')
|
|
1235
|
-
const kpiProfilesText = profiles.length
|
|
1236
|
-
? `${webProfile && webProfile.exists ? webProfile.bundlesCount : 0} · ${deskProfile && deskProfile.exists ? deskProfile.bundlesCount : 0}`
|
|
1237
|
-
: '—'
|
|
1238
|
-
const refReadyCount = refKeys.filter((r) => r.ready).length
|
|
1239
|
-
const kpiCredsReady = refKeys.length > 0 ? refReadyCount : (creds.nonEmptyKeysCount || 0)
|
|
1240
|
-
const kpiCredsTotal = refKeys.length > 0 ? refKeys.length : (creds.totalKeysCount || 0)
|
|
1241
|
-
const kpiCredsText = health ? (creds.fileExists ? `${kpiCredsReady}/${kpiCredsTotal}` : '0/0') : '—'
|
|
1242
|
-
const kpiSnapsText = snapshots ? String(snapshots.total || 0) : '—'
|
|
1243
|
-
|
|
1244
|
-
const hasProfileIssues = Boolean(health && Array.isArray(health.issues) && health.issues.length > 0)
|
|
1245
|
-
const hasMissingCreds = Boolean(
|
|
1246
|
-
!creds.fileExists || (Array.isArray(creds.missingReferencedKeys) && creds.missingReferencedKeys.length > 0),
|
|
1247
|
-
)
|
|
1238
|
+
const data = state.data
|
|
1239
|
+
const health = (data && data.health) || null
|
|
1240
|
+
const snapshots = (data && data.snapshots) || (health && health.snapshots) || { total: 0, snapshots: [] }
|
|
1241
|
+
const guard = (health && health.guard) || { installed: false }
|
|
1242
|
+
const isWin = ((data && data.platform) || (health && health.platform) || '') === 'win32'
|
|
1243
|
+
const installerUrl = (data && data.installerUrl) || INSTALLER_FALLBACK
|
|
1244
|
+
const releaseUrl = (data && data.releaseUrl) || RELEASE_FALLBACK
|
|
1245
|
+
const repoUrl = (data && data.repoUrl) || REPO_FALLBACK
|
|
1248
1246
|
|
|
1249
|
-
const
|
|
1247
|
+
const activeProfile = (data && data.activeProfile) || (health && health.activeProfile) || 'web'
|
|
1248
|
+
const profileLabel = (name) => (name === 'desktop' ? t.desktopTrack : t.webTrack)
|
|
1250
1249
|
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
snap.launching ? t.btnOpeningGuard : openLabel,
|
|
1262
|
-
)
|
|
1263
|
-
}
|
|
1264
|
-
if (platform === 'win32') {
|
|
1265
|
-
return h(
|
|
1266
|
-
'a',
|
|
1267
|
-
{
|
|
1268
|
-
className: 'dshg-btn dshg-btn-primary',
|
|
1269
|
-
href: installerUrl,
|
|
1270
|
-
target: '_blank',
|
|
1271
|
-
rel: 'noopener noreferrer',
|
|
1272
|
-
},
|
|
1273
|
-
h(SvgIcon, { name: 'download', size: 14 }),
|
|
1274
|
-
downloadLabel,
|
|
1275
|
-
)
|
|
1250
|
+
const currentProf =
|
|
1251
|
+
(health && health.profiles && health.profiles[activeProfile]) ||
|
|
1252
|
+
(health && health.profile) || {
|
|
1253
|
+
exists: false,
|
|
1254
|
+
totalDependencies: 0,
|
|
1255
|
+
thirdPartyCount: 0,
|
|
1256
|
+
mcpCount: 0,
|
|
1257
|
+
disabledEntryCount: 0,
|
|
1258
|
+
brokenLinkCount: 0,
|
|
1259
|
+
brokenLinks: [],
|
|
1276
1260
|
}
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
h(SvgIcon, { name: 'external', size: 13 }),
|
|
1286
|
-
t.btnViewRepo,
|
|
1287
|
-
)
|
|
1261
|
+
const credentials = (health && health.credentials) || { present: false, count: 0, keys: [] }
|
|
1262
|
+
const providers = Array.isArray(health && health.providers) ? health.providers : []
|
|
1263
|
+
const issues = Array.isArray(health && health.issues) ? health.issues : []
|
|
1264
|
+
const healthy = health ? Boolean(health.healthy) : true
|
|
1265
|
+
|
|
1266
|
+
const activeExtProfile = activeProfile
|
|
1267
|
+
const extTrack = (health && health.extensions && health.extensions[activeProfile]) || {
|
|
1268
|
+
plugins: [], mcpServers: [],
|
|
1288
1269
|
}
|
|
1289
1270
|
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1271
|
+
const query = state.search.trim().toLowerCase()
|
|
1272
|
+
const filteredMcps = extTrack.mcpServers.filter((m) =>
|
|
1273
|
+
!query ||
|
|
1274
|
+
String(m.serverName || '').toLowerCase().includes(query) ||
|
|
1275
|
+
String(m.id || '').toLowerCase().includes(query),
|
|
1276
|
+
)
|
|
1277
|
+
const filteredPlugins = extTrack.plugins.filter((p) =>
|
|
1278
|
+
!query ||
|
|
1279
|
+
String(p.name || '').toLowerCase().includes(query) ||
|
|
1280
|
+
String(p.primaryId || '').toLowerCase().includes(query),
|
|
1281
|
+
)
|
|
1293
1282
|
|
|
1294
|
-
|
|
1283
|
+
const totalExtCount = (currentProf.thirdPartyCount || 0) + (currentProf.mcpCount || 0)
|
|
1284
|
+
const credsSummaryVal = `${credentials.count || 0} / ${providers.length}`
|
|
1285
|
+
const brokenLinks = Array.isArray(currentProf.brokenLinks) ? currentProf.brokenLinks : []
|
|
1286
|
+
const totalBrokenLinks = currentProf.brokenLinkCount || brokenLinks.length || 0
|
|
1287
|
+
|
|
1288
|
+
const contextAudit = (health && health.contextAudit) || {
|
|
1289
|
+
profiles: [],
|
|
1290
|
+
skills: { total: 0, writableCount: 0, modelVisibleCount: 0, userInvocableCount: 0, skills: [] },
|
|
1291
|
+
recommendations: [],
|
|
1292
|
+
}
|
|
1293
|
+
const ctxProfiles = Array.isArray(contextAudit.profiles) ? contextAudit.profiles : []
|
|
1294
|
+
const activeCtxProfile =
|
|
1295
|
+
ctxProfiles.find((p) => p.profile === activeProfile) ||
|
|
1296
|
+
ctxProfiles[0] || {
|
|
1297
|
+
profile: activeProfile,
|
|
1298
|
+
level: 'light',
|
|
1299
|
+
estimatedBaseTokens: 0,
|
|
1300
|
+
enabledPlugins: 0,
|
|
1301
|
+
totalThirdPartyPlugins: 0,
|
|
1302
|
+
enabledMcps: 0,
|
|
1303
|
+
totalMcps: 0,
|
|
1304
|
+
modelVisibleSkills: 0,
|
|
1305
|
+
prompts: { files: [], alwaysInjectedBytes: 0, alwaysInjectedTokens: 0 },
|
|
1306
|
+
}
|
|
1307
|
+
const levelLabel = (lv) =>
|
|
1308
|
+
lv === 'heavy' ? t.contextLevelHeavy : lv === 'moderate' ? t.contextLevelModerate : t.contextLevelLight
|
|
1309
|
+
const levelTone = (lv) => (lv === 'heavy' ? 'warn' : lv === 'moderate' ? 'blue' : 'ok')
|
|
1310
|
+
const auditLog = Array.isArray(health && health.auditLog) ? health.auditLog : []
|
|
1311
|
+
|
|
1312
|
+
const skillQuery = state.skillSearch.trim().toLowerCase()
|
|
1313
|
+
const allSkills = Array.isArray(contextAudit.skills && contextAudit.skills.skills) ? contextAudit.skills.skills : []
|
|
1314
|
+
const filteredSkills = allSkills.filter((sk) =>
|
|
1315
|
+
!skillQuery ||
|
|
1316
|
+
String(sk.name || '').toLowerCase().includes(skillQuery) ||
|
|
1317
|
+
String(sk.sourceLabel || '').toLowerCase().includes(skillQuery) ||
|
|
1318
|
+
String(sk.description || '').toLowerCase().includes(skillQuery),
|
|
1319
|
+
)
|
|
1320
|
+
|
|
1321
|
+
const renderOverviewTab = () =>
|
|
1295
1322
|
h(
|
|
1296
1323
|
'div',
|
|
1297
|
-
{ className: 'dshg-
|
|
1324
|
+
{ className: 'dshg-tab-body' },
|
|
1325
|
+
totalBrokenLinks > 0
|
|
1326
|
+
? h(
|
|
1327
|
+
'div',
|
|
1328
|
+
{ className: 'dshg-card', style: { borderColor: 'var(--dshg-warn-border)' } },
|
|
1329
|
+
h(
|
|
1330
|
+
'div',
|
|
1331
|
+
{ className: 'dshg-sec-head' },
|
|
1332
|
+
h('span', null, `${t.brokenLabel} (${totalBrokenLinks})`),
|
|
1333
|
+
h(
|
|
1334
|
+
'div',
|
|
1335
|
+
{ className: 'dshg-actions', style: { flexWrap: 'wrap' } },
|
|
1336
|
+
h(
|
|
1337
|
+
'button',
|
|
1338
|
+
{
|
|
1339
|
+
type: 'button',
|
|
1340
|
+
className: 'dshg-btn dshg-btn-primary dshg-btn-sm',
|
|
1341
|
+
disabled: Boolean(state.busyKey),
|
|
1342
|
+
onClick: () =>
|
|
1343
|
+
postAction(
|
|
1344
|
+
'/repair-links',
|
|
1345
|
+
{ target: activeProfile },
|
|
1346
|
+
`repair-${activeProfile}`,
|
|
1347
|
+
(res) => (res && res.message) || `${profileLabel(activeProfile)} 断链处理完成:修复 ${res.repairedCount},未解析 ${res.unresolvableCount}`,
|
|
1348
|
+
),
|
|
1349
|
+
},
|
|
1350
|
+
state.busyKey === `repair-${activeProfile}` ? t.repairingBtn : `${t.repairLinksBtn} (${profileLabel(activeProfile)})`,
|
|
1351
|
+
),
|
|
1352
|
+
),
|
|
1353
|
+
),
|
|
1354
|
+
h(
|
|
1355
|
+
'div',
|
|
1356
|
+
{ className: 'dshg-pills' },
|
|
1357
|
+
...brokenLinks.map((b, i) => h('span', { key: `${b.name}-${i}`, className: 'dshg-pill' }, b.name)),
|
|
1358
|
+
),
|
|
1359
|
+
)
|
|
1360
|
+
: null,
|
|
1361
|
+
|
|
1298
1362
|
h(
|
|
1299
1363
|
'div',
|
|
1300
|
-
{ className: 'dshg-
|
|
1364
|
+
{ className: 'dshg-card' },
|
|
1301
1365
|
h(
|
|
1302
1366
|
'div',
|
|
1303
|
-
{ className: 'dshg-
|
|
1304
|
-
h('
|
|
1367
|
+
{ className: 'dshg-sec-head' },
|
|
1368
|
+
h('span', null, `${t.secProfiles} · ${profileLabel(activeProfile)}`),
|
|
1305
1369
|
h(
|
|
1306
|
-
'
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
'div',
|
|
1310
|
-
{ className: 'dshg-title-row' },
|
|
1311
|
-
h('span', { className: 'dshg-title' }, t.brand),
|
|
1312
|
-
h('span', { className: 'dshg-ver' }, t.versionPill),
|
|
1313
|
-
),
|
|
1314
|
-
h('div', { className: 'dshg-sub' }, t.subtitle),
|
|
1370
|
+
'span',
|
|
1371
|
+
{ className: 'dshg-badge', 'data-tone': currentProf.exists ? 'ok' : 'muted' },
|
|
1372
|
+
currentProf.exists ? t.present : t.absent,
|
|
1315
1373
|
),
|
|
1316
1374
|
),
|
|
1375
|
+
h('div', { className: 'dshg-row' }, h('span', { style: { color: 'var(--dshg-text-3)' } }, t.depsLabel), h('span', { className: 'dshg-mono' }, String(currentProf.totalDependencies || 0))),
|
|
1376
|
+
h('div', { className: 'dshg-row' }, h('span', { style: { color: 'var(--dshg-text-3)' } }, t.thirdPartyLabel), h('span', { className: 'dshg-mono' }, String(currentProf.thirdPartyCount || 0))),
|
|
1377
|
+
h('div', { className: 'dshg-row' }, h('span', { style: { color: 'var(--dshg-text-3)' } }, t.mcpLabel), h('span', { className: 'dshg-mono' }, String(currentProf.mcpCount || 0))),
|
|
1378
|
+
h('div', { className: 'dshg-row' }, h('span', { style: { color: 'var(--dshg-text-3)' } }, t.disabledLabel), h('span', { className: 'dshg-mono' }, String(currentProf.disabledEntryCount || 0))),
|
|
1379
|
+
),
|
|
1380
|
+
|
|
1381
|
+
h(
|
|
1382
|
+
'div',
|
|
1383
|
+
{ className: 'dshg-card' },
|
|
1317
1384
|
h(
|
|
1318
1385
|
'div',
|
|
1319
|
-
{ className: 'dshg-
|
|
1386
|
+
{ className: 'dshg-sec-head' },
|
|
1387
|
+
h('span', null, `${t.contextCardTitle} (${profileLabel(activeCtxProfile.profile)})`),
|
|
1320
1388
|
h(
|
|
1321
|
-
'
|
|
1322
|
-
{
|
|
1323
|
-
|
|
1324
|
-
disabled: snap.loading,
|
|
1325
|
-
title: t.refresh,
|
|
1326
|
-
'aria-label': t.refresh,
|
|
1327
|
-
onClick: () => void fetchOverview(),
|
|
1328
|
-
},
|
|
1329
|
-
h(SvgIcon, { name: 'refresh', size: 14, className: snap.loading ? 'dshg-spin' : '' }),
|
|
1389
|
+
'span',
|
|
1390
|
+
{ className: 'dshg-badge', 'data-tone': levelTone(activeCtxProfile.level) },
|
|
1391
|
+
`${levelLabel(activeCtxProfile.level)} · ${t.contextTokens(activeCtxProfile.estimatedBaseTokens || 0)}`,
|
|
1330
1392
|
),
|
|
1393
|
+
),
|
|
1394
|
+
h(
|
|
1395
|
+
'div',
|
|
1396
|
+
{ className: 'dshg-sec-sub' },
|
|
1397
|
+
t.contextStatsLine(
|
|
1398
|
+
activeCtxProfile.enabledPlugins || 0,
|
|
1399
|
+
activeCtxProfile.enabledMcps || 0,
|
|
1400
|
+
activeCtxProfile.modelVisibleSkills || 0,
|
|
1401
|
+
),
|
|
1402
|
+
),
|
|
1403
|
+
h(
|
|
1404
|
+
'div',
|
|
1405
|
+
{ className: 'dshg-actions' },
|
|
1331
1406
|
h(
|
|
1332
1407
|
'button',
|
|
1333
1408
|
{
|
|
1334
|
-
|
|
1335
|
-
|
|
1409
|
+
type: 'button',
|
|
1410
|
+
className: 'dshg-btn dshg-btn-sm',
|
|
1411
|
+
onClick: () => patch({ tab: 'context' }),
|
|
1336
1412
|
},
|
|
1337
|
-
t.
|
|
1413
|
+
t.quickGoContext,
|
|
1338
1414
|
),
|
|
1339
1415
|
),
|
|
1340
1416
|
),
|
|
1341
|
-
|
|
1417
|
+
|
|
1418
|
+
issues.length > 0
|
|
1342
1419
|
? h(
|
|
1343
1420
|
'div',
|
|
1344
|
-
{ className: 'dshg-
|
|
1421
|
+
{ className: 'dshg-card' },
|
|
1422
|
+
h('div', { className: 'dshg-sec-head' }, h('span', null, t.warningsTitle)),
|
|
1345
1423
|
h(
|
|
1346
|
-
'
|
|
1347
|
-
{ className: 'dshg-
|
|
1348
|
-
|
|
1349
|
-
|
|
1424
|
+
'div',
|
|
1425
|
+
{ className: 'dshg-list' },
|
|
1426
|
+
...issues.map((msg, idx) =>
|
|
1427
|
+
h('div', { key: idx, className: 'dshg-item', style: { fontSize: 11.5 } }, msg),
|
|
1428
|
+
),
|
|
1350
1429
|
),
|
|
1351
|
-
snap.checkedAt
|
|
1352
|
-
? h(
|
|
1353
|
-
'span',
|
|
1354
|
-
{ style: { fontSize: 11, color: 'var(--dshg-text-3)', fontVariantNumeric: 'tabular-nums' } },
|
|
1355
|
-
t.checkedAt(formatClockOnly(snap.checkedAt)),
|
|
1356
|
-
)
|
|
1357
|
-
: null,
|
|
1358
1430
|
)
|
|
1359
|
-
:
|
|
1360
|
-
|
|
1431
|
+
: h(
|
|
1432
|
+
'div',
|
|
1433
|
+
{ className: 'dshg-card' },
|
|
1434
|
+
h(
|
|
1435
|
+
'div',
|
|
1436
|
+
{ className: 'dshg-item-row' },
|
|
1437
|
+
h(
|
|
1438
|
+
'div',
|
|
1439
|
+
{ className: 'dshg-item-main' },
|
|
1440
|
+
h(
|
|
1441
|
+
'div',
|
|
1442
|
+
{ className: 'dshg-item-title' },
|
|
1443
|
+
h(CheckCircleIcon, { size: 14, className: undefined }),
|
|
1444
|
+
h('span', null, t.allHealthyTitle),
|
|
1445
|
+
),
|
|
1446
|
+
h('div', { className: 'dshg-sec-sub' }, t.allHealthySub),
|
|
1447
|
+
),
|
|
1448
|
+
),
|
|
1449
|
+
h(
|
|
1450
|
+
'div',
|
|
1451
|
+
{ className: 'dshg-actions', style: { flexWrap: 'wrap' } },
|
|
1452
|
+
h(
|
|
1453
|
+
'button',
|
|
1454
|
+
{
|
|
1455
|
+
type: 'button',
|
|
1456
|
+
className: 'dshg-btn dshg-btn-primary dshg-btn-sm',
|
|
1457
|
+
disabled: Boolean(state.busyKey),
|
|
1458
|
+
onClick: () =>
|
|
1459
|
+
postAction(
|
|
1460
|
+
'/snapshots/create',
|
|
1461
|
+
{ target: activeProfile, reason: `${activeProfile} 总览快捷备份` },
|
|
1462
|
+
'quick-snap',
|
|
1463
|
+
(res) => `已创建快照 ${res.snapshot.id}`,
|
|
1464
|
+
),
|
|
1465
|
+
},
|
|
1466
|
+
state.busyKey === 'quick-snap' ? t.snapCreating : t.quickSnapWeb,
|
|
1467
|
+
),
|
|
1468
|
+
h(
|
|
1469
|
+
'button',
|
|
1470
|
+
{
|
|
1471
|
+
type: 'button',
|
|
1472
|
+
className: 'dshg-btn dshg-btn-sm',
|
|
1473
|
+
onClick: () => patch({ tab: 'plugins' }),
|
|
1474
|
+
},
|
|
1475
|
+
t.quickGoPlugins,
|
|
1476
|
+
),
|
|
1477
|
+
),
|
|
1478
|
+
),
|
|
1479
|
+
)
|
|
1361
1480
|
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1481
|
+
const renderPluginsTab = () =>
|
|
1482
|
+
h(
|
|
1483
|
+
'div',
|
|
1484
|
+
{ className: 'dshg-tab-body' },
|
|
1485
|
+
h(
|
|
1486
|
+
'div',
|
|
1487
|
+
{ className: 'dshg-toolbar' },
|
|
1488
|
+
h(
|
|
1365
1489
|
'div',
|
|
1366
|
-
{ className: 'dshg-
|
|
1367
|
-
h(
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
},
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
),
|
|
1378
|
-
h(
|
|
1379
|
-
'button',
|
|
1380
|
-
{
|
|
1381
|
-
className: 'dshg-kpi',
|
|
1382
|
-
'data-active': snap.tab === 'creds' ? 'true' : 'false',
|
|
1383
|
-
onClick: () => patch({ tab: 'creds' }),
|
|
1384
|
-
},
|
|
1385
|
-
h('span', { className: 'dshg-kpi-label' }, t.kpiCredsLabel),
|
|
1386
|
-
h('span', { className: 'dshg-kpi-val' }, kpiCredsText),
|
|
1387
|
-
h('span', { className: 'dshg-kpi-sub' }, t.kpiCredsSub),
|
|
1388
|
-
),
|
|
1389
|
-
h(
|
|
1390
|
-
'button',
|
|
1391
|
-
{
|
|
1392
|
-
className: 'dshg-kpi',
|
|
1393
|
-
'data-active': snap.tab === 'snapshots' ? 'true' : 'false',
|
|
1394
|
-
onClick: () => patch({ tab: 'snapshots' }),
|
|
1395
|
-
},
|
|
1396
|
-
h('span', { className: 'dshg-kpi-label' }, t.kpiSnapsLabel),
|
|
1397
|
-
h('span', { className: 'dshg-kpi-val' }, kpiSnapsText),
|
|
1398
|
-
h('span', { className: 'dshg-kpi-sub' }, t.kpiSnapsSub),
|
|
1399
|
-
),
|
|
1400
|
-
)
|
|
1401
|
-
: null,
|
|
1490
|
+
{ className: 'dshg-search-wrap' },
|
|
1491
|
+
h('span', { className: 'dshg-search-ico' }, h(SearchIcon, { size: 13 })),
|
|
1492
|
+
h('input', {
|
|
1493
|
+
type: 'search',
|
|
1494
|
+
className: 'dshg-input with-ico',
|
|
1495
|
+
value: state.search,
|
|
1496
|
+
placeholder: t.searchPlaceholder,
|
|
1497
|
+
onChange: (e) => patch({ search: e.target.value }),
|
|
1498
|
+
}),
|
|
1499
|
+
),
|
|
1500
|
+
),
|
|
1402
1501
|
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1502
|
+
h(
|
|
1503
|
+
'div',
|
|
1504
|
+
{ className: 'dshg-card' },
|
|
1505
|
+
h(
|
|
1406
1506
|
'div',
|
|
1407
|
-
{ className: 'dshg-
|
|
1408
|
-
h(
|
|
1409
|
-
'button',
|
|
1410
|
-
{
|
|
1411
|
-
className: 'dshg-seg-btn',
|
|
1412
|
-
role: 'tab',
|
|
1413
|
-
'aria-selected': snap.tab === 'overview',
|
|
1414
|
-
'data-active': snap.tab === 'overview' ? 'true' : 'false',
|
|
1415
|
-
onClick: () => patch({ tab: 'overview' }),
|
|
1416
|
-
},
|
|
1417
|
-
t.tabOverview,
|
|
1418
|
-
hasProfileIssues ? h('span', { className: 'dshg-seg-dot' }) : null,
|
|
1419
|
-
),
|
|
1420
|
-
h(
|
|
1421
|
-
'button',
|
|
1422
|
-
{
|
|
1423
|
-
className: 'dshg-seg-btn',
|
|
1424
|
-
role: 'tab',
|
|
1425
|
-
'aria-selected': snap.tab === 'creds',
|
|
1426
|
-
'data-active': snap.tab === 'creds' ? 'true' : 'false',
|
|
1427
|
-
onClick: () => patch({ tab: 'creds' }),
|
|
1428
|
-
},
|
|
1429
|
-
t.tabCreds,
|
|
1430
|
-
hasMissingCreds ? h('span', { className: 'dshg-seg-dot' }) : null,
|
|
1431
|
-
),
|
|
1507
|
+
{ className: 'dshg-sec-head' },
|
|
1508
|
+
h('span', null, `${t.mcpSectionTitle} (${filteredMcps.length})`),
|
|
1432
1509
|
h(
|
|
1433
1510
|
'button',
|
|
1434
1511
|
{
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
onClick: () => patch({ tab: 'snapshots' }),
|
|
1512
|
+
type: 'button',
|
|
1513
|
+
className: 'dshg-btn dshg-btn-sm',
|
|
1514
|
+
disabled: Boolean(state.busyKey || filteredMcps.length === 0),
|
|
1515
|
+
onClick: () => probeMcpsForProfile(activeExtProfile),
|
|
1440
1516
|
},
|
|
1441
|
-
t.
|
|
1517
|
+
state.busyKey === 'probe-mcp' ? t.mcpProbingBtn : t.mcpProbeBtn,
|
|
1442
1518
|
),
|
|
1443
|
-
)
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1519
|
+
),
|
|
1520
|
+
filteredMcps.length > 0
|
|
1521
|
+
? h(
|
|
1522
|
+
'div',
|
|
1523
|
+
{ className: 'dshg-list' },
|
|
1524
|
+
...filteredMcps.map((m) => {
|
|
1525
|
+
const probe = state.mcpProbes[`${activeExtProfile}:${m.id}`] || null
|
|
1526
|
+
const probeTone = probe
|
|
1527
|
+
? probe.status === 'disabled' || probe.status === 'remote_skipped'
|
|
1528
|
+
? 'muted'
|
|
1529
|
+
: probe.healthy
|
|
1530
|
+
? 'ok'
|
|
1531
|
+
: 'warn'
|
|
1532
|
+
: null
|
|
1533
|
+
const editingTimeout = state.editMcpId === m.id
|
|
1452
1534
|
|
|
1453
|
-
|
|
1454
|
-
data && snap.tab === 'overview'
|
|
1455
|
-
? [
|
|
1456
|
-
h(SupervisorCard, {
|
|
1457
|
-
key: 'supervisor',
|
|
1458
|
-
platform,
|
|
1459
|
-
guard,
|
|
1460
|
-
installerUrl,
|
|
1461
|
-
releaseUrl,
|
|
1462
|
-
repoUrl,
|
|
1463
|
-
launching: snap.launching,
|
|
1464
|
-
t,
|
|
1465
|
-
}),
|
|
1466
|
-
health && profiles.length > 0
|
|
1467
|
-
? h(
|
|
1468
|
-
'div',
|
|
1469
|
-
{ key: 'profiles', className: 'dshg-card' },
|
|
1470
|
-
h('div', { className: 'dshg-sec-head' }, h('span', null, t.profilesTitle)),
|
|
1471
|
-
h(
|
|
1535
|
+
return h(
|
|
1472
1536
|
'div',
|
|
1473
|
-
{ className: 'dshg-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1537
|
+
{ key: m.id, className: 'dshg-item' },
|
|
1538
|
+
h(
|
|
1539
|
+
'div',
|
|
1540
|
+
{ className: 'dshg-item-row' },
|
|
1541
|
+
h(
|
|
1542
|
+
'div',
|
|
1543
|
+
{ className: 'dshg-item-main' },
|
|
1544
|
+
h(
|
|
1545
|
+
'div',
|
|
1546
|
+
{ className: 'dshg-item-title' },
|
|
1547
|
+
h('span', null, m.serverName),
|
|
1548
|
+
h('span', { className: 'dshg-pill' }, m.transport),
|
|
1549
|
+
h('span', { className: 'dshg-pill' }, `${m.toolCallTimeoutMs || 60000}ms`),
|
|
1550
|
+
probe
|
|
1551
|
+
? h(
|
|
1552
|
+
'span',
|
|
1553
|
+
{ className: 'dshg-badge', 'data-tone': probeTone, title: probe.detail },
|
|
1554
|
+
probe.status === 'reachable'
|
|
1555
|
+
? `${probe.latencyMs}ms OK`
|
|
1556
|
+
: probe.status,
|
|
1557
|
+
)
|
|
1558
|
+
: null,
|
|
1559
|
+
),
|
|
1560
|
+
h('div', { className: 'dshg-mono' }, m.command || m.url || m.id),
|
|
1561
|
+
probe && !probe.healthy
|
|
1562
|
+
? h('div', { style: { fontSize: 10.5, color: '#d97706' } }, probe.detail)
|
|
1563
|
+
: null,
|
|
1564
|
+
),
|
|
1565
|
+
h(
|
|
1566
|
+
'div',
|
|
1567
|
+
{ className: 'dshg-actions' },
|
|
1568
|
+
h(
|
|
1569
|
+
'button',
|
|
1570
|
+
{
|
|
1571
|
+
type: 'button',
|
|
1572
|
+
className: 'dshg-btn dshg-btn-sm',
|
|
1573
|
+
onClick: () =>
|
|
1574
|
+
patch({
|
|
1575
|
+
editMcpId: editingTimeout ? '' : m.id,
|
|
1576
|
+
draftMcpTimeout: String(m.toolCallTimeoutMs || 60000),
|
|
1577
|
+
}),
|
|
1578
|
+
},
|
|
1579
|
+
editingTimeout ? t.cancelBtn : t.mcpTimeoutBtn,
|
|
1580
|
+
),
|
|
1581
|
+
h(ToggleSwitch, {
|
|
1582
|
+
on: m.enabled,
|
|
1583
|
+
busy: state.busyKey === `toggle-${m.id}`,
|
|
1584
|
+
title: m.serverName,
|
|
1585
|
+
onToggle: () =>
|
|
1586
|
+
postAction(
|
|
1587
|
+
'/toggle-entry',
|
|
1588
|
+
{ target: activeExtProfile, id: m.id, disabled: m.enabled },
|
|
1589
|
+
`toggle-${m.id}`,
|
|
1590
|
+
(res) => res.restartHint,
|
|
1591
|
+
),
|
|
1592
|
+
}),
|
|
1593
|
+
),
|
|
1594
|
+
),
|
|
1595
|
+
editingTimeout
|
|
1596
|
+
? h(
|
|
1597
|
+
'div',
|
|
1598
|
+
{ className: 'dshg-drawer' },
|
|
1599
|
+
h('div', { className: 'dshg-sec-sub' }, t.mcpTimeoutHint),
|
|
1600
|
+
h(
|
|
1601
|
+
'div',
|
|
1602
|
+
{ className: 'dshg-drawer-row' },
|
|
1603
|
+
h('input', {
|
|
1604
|
+
type: 'number',
|
|
1605
|
+
min: 5000,
|
|
1606
|
+
max: 600000,
|
|
1607
|
+
step: 5000,
|
|
1608
|
+
className: 'dshg-input',
|
|
1609
|
+
value: state.draftMcpTimeout,
|
|
1610
|
+
onChange: (e) => patch({ draftMcpTimeout: e.target.value }),
|
|
1611
|
+
}),
|
|
1612
|
+
h(
|
|
1613
|
+
'button',
|
|
1614
|
+
{
|
|
1615
|
+
type: 'button',
|
|
1616
|
+
className: 'dshg-btn dshg-btn-primary dshg-btn-sm',
|
|
1617
|
+
disabled: Boolean(state.busyKey),
|
|
1618
|
+
onClick: async () => {
|
|
1619
|
+
const ms = Number(state.draftMcpTimeout)
|
|
1620
|
+
const res = await postAction(
|
|
1621
|
+
'/mcp/timeout',
|
|
1622
|
+
{ target: activeExtProfile, id: m.id, timeoutMs: ms },
|
|
1623
|
+
`timeout-${m.id}`,
|
|
1624
|
+
(r) => `已将 ${m.serverName} 超时设为 ${r.toolCallTimeoutMs}ms(已留存快照)`,
|
|
1625
|
+
)
|
|
1626
|
+
if (res && res.ok) patch({ editMcpId: '' })
|
|
1627
|
+
},
|
|
1628
|
+
},
|
|
1629
|
+
t.mcpTimeoutSave,
|
|
1630
|
+
),
|
|
1631
|
+
),
|
|
1632
|
+
)
|
|
1633
|
+
: null,
|
|
1634
|
+
)
|
|
1635
|
+
}),
|
|
1636
|
+
)
|
|
1637
|
+
: h('div', { className: 'dshg-sec-sub' }, t.mcpEmpty),
|
|
1638
|
+
),
|
|
1639
|
+
|
|
1640
|
+
h(
|
|
1641
|
+
'div',
|
|
1642
|
+
{ className: 'dshg-card' },
|
|
1643
|
+
h(
|
|
1644
|
+
'div',
|
|
1645
|
+
{ className: 'dshg-sec-head' },
|
|
1646
|
+
h('span', null, t.pluginsSectionTitle),
|
|
1647
|
+
h('span', { className: 'dshg-badge', 'data-tone': 'muted' }, t.badgeAllCount(filteredPlugins.length, extTrack.plugins.length)),
|
|
1648
|
+
),
|
|
1649
|
+
filteredPlugins.length > 0
|
|
1650
|
+
? h(
|
|
1651
|
+
'div',
|
|
1652
|
+
{ className: 'dshg-list' },
|
|
1653
|
+
...filteredPlugins.map((p) =>
|
|
1482
1654
|
h(
|
|
1483
1655
|
'div',
|
|
1484
|
-
{ className: 'dshg-
|
|
1485
|
-
h(
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1656
|
+
{ key: p.name, className: 'dshg-item' },
|
|
1657
|
+
h(
|
|
1658
|
+
'div',
|
|
1659
|
+
{ className: 'dshg-item-row' },
|
|
1660
|
+
h(
|
|
1661
|
+
'div',
|
|
1662
|
+
{ className: 'dshg-item-main' },
|
|
1663
|
+
h(
|
|
1664
|
+
'div',
|
|
1665
|
+
{ className: 'dshg-item-title' },
|
|
1666
|
+
h('span', null, p.name),
|
|
1667
|
+
p.isSelf
|
|
1668
|
+
? h('span', { className: 'dshg-badge', 'data-tone': 'blue' }, t.badgeSelf)
|
|
1669
|
+
: p.isCore
|
|
1670
|
+
? h('span', { className: 'dshg-badge', 'data-tone': 'muted' }, t.badgeCore)
|
|
1671
|
+
: h('span', { className: 'dshg-badge', 'data-tone': p.enabled ? 'ok' : 'warn' }, p.enabled ? t.badgeEnabled : t.badgeDisabled),
|
|
1672
|
+
),
|
|
1673
|
+
h('div', { className: 'dshg-mono' }, `${p.primaryId}${p.version ? ` · v${p.version}` : ''}`),
|
|
1674
|
+
),
|
|
1675
|
+
h(ToggleSwitch, {
|
|
1676
|
+
on: p.enabled,
|
|
1677
|
+
disabled: !p.canToggle,
|
|
1678
|
+
busy: state.busyKey === `toggle-${p.primaryId}`,
|
|
1679
|
+
title: p.name,
|
|
1680
|
+
onToggle: () =>
|
|
1681
|
+
postAction(
|
|
1682
|
+
'/toggle-entry',
|
|
1683
|
+
{ target: activeExtProfile, id: p.primaryId, disabled: p.enabled },
|
|
1684
|
+
`toggle-${p.primaryId}`,
|
|
1685
|
+
(res) => res.restartHint,
|
|
1686
|
+
),
|
|
1687
|
+
}),
|
|
1688
|
+
),
|
|
1489
1689
|
),
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1690
|
+
),
|
|
1691
|
+
)
|
|
1692
|
+
: h('div', { className: 'dshg-sec-sub' }, t.pluginsEmpty),
|
|
1693
|
+
),
|
|
1694
|
+
|
|
1695
|
+
h(BoundaryDisclosure, {
|
|
1696
|
+
summary: t.boundaryPluginsSummary,
|
|
1697
|
+
p1: t.boundaryPluginsP1,
|
|
1698
|
+
p2: t.boundaryPluginsP2,
|
|
1699
|
+
isWin,
|
|
1700
|
+
installerUrl,
|
|
1701
|
+
releaseUrl,
|
|
1702
|
+
t,
|
|
1703
|
+
}),
|
|
1704
|
+
)
|
|
1497
1705
|
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1706
|
+
const renderContextTab = () =>
|
|
1707
|
+
h(
|
|
1708
|
+
'div',
|
|
1709
|
+
{ className: 'dshg-tab-body' },
|
|
1710
|
+
h(
|
|
1711
|
+
'div',
|
|
1712
|
+
{ className: 'dshg-card' },
|
|
1713
|
+
h(
|
|
1714
|
+
'div',
|
|
1715
|
+
{ className: 'dshg-sec-head' },
|
|
1716
|
+
h('span', null, `${t.contextCardTitle} (${profileLabel(activeCtxProfile.profile)})`),
|
|
1501
1717
|
h(
|
|
1502
|
-
'
|
|
1503
|
-
{
|
|
1718
|
+
'span',
|
|
1719
|
+
{ className: 'dshg-badge', 'data-tone': levelTone(activeCtxProfile.level) },
|
|
1720
|
+
`${levelLabel(activeCtxProfile.level)} · ${t.contextTokens(activeCtxProfile.estimatedBaseTokens || 0)}`,
|
|
1721
|
+
),
|
|
1722
|
+
),
|
|
1723
|
+
h(
|
|
1724
|
+
'div',
|
|
1725
|
+
{ className: 'dshg-sec-sub' },
|
|
1726
|
+
t.contextStatsLine(
|
|
1727
|
+
activeCtxProfile.enabledPlugins || 0,
|
|
1728
|
+
activeCtxProfile.enabledMcps || 0,
|
|
1729
|
+
activeCtxProfile.modelVisibleSkills || 0,
|
|
1730
|
+
),
|
|
1731
|
+
),
|
|
1732
|
+
h(
|
|
1733
|
+
'div',
|
|
1734
|
+
{ className: 'dshg-list' },
|
|
1735
|
+
...(contextAudit.recommendations || []).map((rec, idx) =>
|
|
1736
|
+
h('div', { key: idx, className: 'dshg-item', style: { fontSize: 11 } }, rec),
|
|
1737
|
+
),
|
|
1738
|
+
),
|
|
1739
|
+
),
|
|
1740
|
+
|
|
1741
|
+
h(
|
|
1742
|
+
'div',
|
|
1743
|
+
{ className: 'dshg-card' },
|
|
1744
|
+
h('div', { className: 'dshg-sec-head' }, h('span', null, t.contextPromptsTitle)),
|
|
1745
|
+
h(
|
|
1746
|
+
'div',
|
|
1747
|
+
{ className: 'dshg-list' },
|
|
1748
|
+
...((activeCtxProfile.prompts && activeCtxProfile.prompts.files) || []).map((f) =>
|
|
1504
1749
|
h(
|
|
1505
1750
|
'div',
|
|
1506
|
-
{ className: 'dshg-
|
|
1507
|
-
h('span', {
|
|
1751
|
+
{ key: f.id, className: 'dshg-row' },
|
|
1752
|
+
h('span', { className: 'dshg-mono' }, f.label),
|
|
1508
1753
|
h(
|
|
1509
1754
|
'span',
|
|
1510
|
-
{ className: 'dshg-badge', 'data-tone':
|
|
1511
|
-
|
|
1512
|
-
? t.credReadyBadge(kpiCredsReady, kpiCredsTotal)
|
|
1513
|
-
: t.credMissingFile,
|
|
1755
|
+
{ className: 'dshg-badge', 'data-tone': f.exists ? 'muted' : 'ok' },
|
|
1756
|
+
f.exists ? t.promptsBytes(f.bytes, f.estTokens) : t.absent,
|
|
1514
1757
|
),
|
|
1515
1758
|
),
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1759
|
+
),
|
|
1760
|
+
),
|
|
1761
|
+
),
|
|
1762
|
+
|
|
1763
|
+
h(
|
|
1764
|
+
'div',
|
|
1765
|
+
{ className: 'dshg-card' },
|
|
1766
|
+
h(
|
|
1767
|
+
'div',
|
|
1768
|
+
{ className: 'dshg-sec-head' },
|
|
1769
|
+
h('span', null, t.contextSkillsTitle),
|
|
1770
|
+
h(
|
|
1771
|
+
'span',
|
|
1772
|
+
{ className: 'dshg-badge', 'data-tone': 'blue' },
|
|
1773
|
+
t.badgeAllCount(contextAudit.skills?.modelVisibleCount || 0, contextAudit.skills?.total || 0),
|
|
1774
|
+
),
|
|
1775
|
+
),
|
|
1776
|
+
h(
|
|
1777
|
+
'div',
|
|
1778
|
+
{ className: 'dshg-search-wrap' },
|
|
1779
|
+
h('span', { className: 'dshg-search-ico' }, h(SearchIcon, { size: 13 })),
|
|
1780
|
+
h('input', {
|
|
1781
|
+
type: 'search',
|
|
1782
|
+
className: 'dshg-input with-ico',
|
|
1783
|
+
value: state.skillSearch,
|
|
1784
|
+
placeholder: t.contextSkillSearch,
|
|
1785
|
+
onChange: (e) => patch({ skillSearch: e.target.value }),
|
|
1786
|
+
}),
|
|
1787
|
+
),
|
|
1788
|
+
filteredSkills.length > 0
|
|
1789
|
+
? h(
|
|
1790
|
+
'div',
|
|
1791
|
+
{ className: 'dshg-list' },
|
|
1792
|
+
...filteredSkills.map((sk) =>
|
|
1793
|
+
h(
|
|
1519
1794
|
'div',
|
|
1520
|
-
{ className: 'dshg-
|
|
1795
|
+
{ key: sk.id, className: 'dshg-item' },
|
|
1521
1796
|
h(
|
|
1522
1797
|
'div',
|
|
1523
|
-
{ className: 'dshg-row'
|
|
1798
|
+
{ className: 'dshg-item-row' },
|
|
1524
1799
|
h(
|
|
1525
|
-
'
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
:
|
|
1800
|
+
'div',
|
|
1801
|
+
{ className: 'dshg-item-main' },
|
|
1802
|
+
h(
|
|
1803
|
+
'div',
|
|
1804
|
+
{ className: 'dshg-item-title' },
|
|
1805
|
+
h('span', null, sk.name),
|
|
1806
|
+
h('span', { className: 'dshg-pill' }, sk.sourceLabel),
|
|
1807
|
+
h('span', { className: 'dshg-pill' }, `~${sk.estTokens} tok`),
|
|
1808
|
+
!sk.writable
|
|
1809
|
+
? h('span', { className: 'dshg-badge', 'data-tone': 'muted' }, t.skillReadOnly)
|
|
1810
|
+
: null,
|
|
1811
|
+
),
|
|
1812
|
+
sk.description ? h('div', { className: 'dshg-sec-sub' }, sk.description) : null,
|
|
1530
1813
|
),
|
|
1531
|
-
h('span', { style: { fontVariantNumeric: 'tabular-nums' } }, `${credRatioPct}%`),
|
|
1532
1814
|
),
|
|
1815
|
+
sk.writable
|
|
1816
|
+
? h(
|
|
1817
|
+
'div',
|
|
1818
|
+
{ className: 'dshg-actions', style: { justifyContent: 'space-between', marginTop: 2 } },
|
|
1819
|
+
h(
|
|
1820
|
+
'div',
|
|
1821
|
+
{ className: 'dshg-actions' },
|
|
1822
|
+
h('span', { className: 'dshg-sec-sub' }, t.skillModelVis),
|
|
1823
|
+
h(ToggleSwitch, {
|
|
1824
|
+
on: sk.modelVisible,
|
|
1825
|
+
busy: state.busyKey === `skill-${sk.id}`,
|
|
1826
|
+
title: `${sk.name} model visibility`,
|
|
1827
|
+
onToggle: () =>
|
|
1828
|
+
postAction(
|
|
1829
|
+
'/skills/toggle',
|
|
1830
|
+
{ skillId: sk.id, modelVisible: !sk.modelVisible, fingerprint: sk.fingerprint },
|
|
1831
|
+
`skill-${sk.id}`,
|
|
1832
|
+
() => `${sk.name} 模型可见性已更新`,
|
|
1833
|
+
),
|
|
1834
|
+
}),
|
|
1835
|
+
),
|
|
1836
|
+
h(
|
|
1837
|
+
'div',
|
|
1838
|
+
{ className: 'dshg-actions' },
|
|
1839
|
+
h('span', { className: 'dshg-sec-sub' }, t.skillCmdVis),
|
|
1840
|
+
h(ToggleSwitch, {
|
|
1841
|
+
on: sk.userInvocable,
|
|
1842
|
+
busy: state.busyKey === `skill-${sk.id}`,
|
|
1843
|
+
title: `${sk.name} command visibility`,
|
|
1844
|
+
onToggle: () =>
|
|
1845
|
+
postAction(
|
|
1846
|
+
'/skills/toggle',
|
|
1847
|
+
{ skillId: sk.id, userInvocable: !sk.userInvocable, fingerprint: sk.fingerprint },
|
|
1848
|
+
`skill-${sk.id}`,
|
|
1849
|
+
() => `${sk.name} 命令可见性已更新`,
|
|
1850
|
+
),
|
|
1851
|
+
}),
|
|
1852
|
+
),
|
|
1853
|
+
)
|
|
1854
|
+
: null,
|
|
1855
|
+
),
|
|
1856
|
+
),
|
|
1857
|
+
)
|
|
1858
|
+
: h('div', { className: 'dshg-sec-sub' }, t.contextSkillsEmpty),
|
|
1859
|
+
),
|
|
1860
|
+
)
|
|
1861
|
+
|
|
1862
|
+
const renderCredsTab = () =>
|
|
1863
|
+
h(
|
|
1864
|
+
'div',
|
|
1865
|
+
{ className: 'dshg-tab-body' },
|
|
1866
|
+
h(
|
|
1867
|
+
'div',
|
|
1868
|
+
{ className: 'dshg-card' },
|
|
1869
|
+
h(
|
|
1870
|
+
'div',
|
|
1871
|
+
{ className: 'dshg-sec-head' },
|
|
1872
|
+
h('span', null, t.providersTitle),
|
|
1873
|
+
h('span', { className: 'dshg-badge', 'data-tone': 'blue' }, String(providers.length)),
|
|
1874
|
+
),
|
|
1875
|
+
providers.length > 0
|
|
1876
|
+
? h(
|
|
1877
|
+
'div',
|
|
1878
|
+
{ className: 'dshg-list' },
|
|
1879
|
+
...providers.map((prov) => {
|
|
1880
|
+
const editingThis = Boolean(prov.apiKeyEnv && state.editProviderKey === prov.id)
|
|
1881
|
+
return h(
|
|
1882
|
+
'div',
|
|
1883
|
+
{ key: prov.id, className: 'dshg-item' },
|
|
1533
1884
|
h(
|
|
1534
1885
|
'div',
|
|
1535
|
-
{ className: 'dshg-
|
|
1536
|
-
h('div', { className: 'dshg-progress-fill', style: { width: `${credRatioPct}%` } }),
|
|
1537
|
-
),
|
|
1538
|
-
)
|
|
1539
|
-
: null,
|
|
1540
|
-
refKeys.length > 0
|
|
1541
|
-
? h(
|
|
1542
|
-
'div',
|
|
1543
|
-
{ className: 'dshg-cred-list' },
|
|
1544
|
-
...refKeys.map((item) =>
|
|
1886
|
+
{ className: 'dshg-item-row' },
|
|
1545
1887
|
h(
|
|
1546
1888
|
'div',
|
|
1547
|
-
{
|
|
1889
|
+
{ className: 'dshg-item-main' },
|
|
1548
1890
|
h(
|
|
1549
|
-
'
|
|
1550
|
-
{ className: 'dshg-
|
|
1551
|
-
h(
|
|
1552
|
-
|
|
1891
|
+
'div',
|
|
1892
|
+
{ className: 'dshg-item-title' },
|
|
1893
|
+
h('span', null, prov.displayName),
|
|
1894
|
+
h('span', { className: 'dshg-pill' }, prov.api),
|
|
1895
|
+
h('span', { className: 'dshg-pill' }, `${prov.models.length} ${t.modelsUnit}`),
|
|
1553
1896
|
),
|
|
1897
|
+
prov.baseURL ? h('div', { className: 'dshg-mono' }, prov.baseURL) : null,
|
|
1554
1898
|
h(
|
|
1555
|
-
'
|
|
1556
|
-
{ className: 'dshg-
|
|
1557
|
-
|
|
1558
|
-
|
|
1899
|
+
'div',
|
|
1900
|
+
{ className: 'dshg-pills', style: { marginTop: 2 } },
|
|
1901
|
+
...(prov.profiles || []).map((pf) => h('span', { key: pf, className: 'dshg-pill' }, pf)),
|
|
1902
|
+
prov.apiKeyEnv
|
|
1903
|
+
? h('span', { className: 'dshg-badge', 'data-tone': prov.keyConfigured ? 'ok' : 'warn' }, `${prov.apiKeyEnv} · ${prov.keyConfigured ? t.keyReady : t.keyMissing}`)
|
|
1904
|
+
: null,
|
|
1559
1905
|
),
|
|
1560
1906
|
),
|
|
1907
|
+
prov.apiKeyEnv
|
|
1908
|
+
? h(
|
|
1909
|
+
'button',
|
|
1910
|
+
{
|
|
1911
|
+
type: 'button',
|
|
1912
|
+
className: 'dshg-btn dshg-btn-sm',
|
|
1913
|
+
onClick: () =>
|
|
1914
|
+
patch({
|
|
1915
|
+
editProviderKey: editingThis ? '' : prov.id,
|
|
1916
|
+
draftSecret: '',
|
|
1917
|
+
}),
|
|
1918
|
+
},
|
|
1919
|
+
editingThis ? t.cancelBtn : prov.keyConfigured ? t.updateKeyBtn : t.setKeyBtn,
|
|
1920
|
+
)
|
|
1921
|
+
: null,
|
|
1561
1922
|
),
|
|
1923
|
+
editingThis
|
|
1924
|
+
? h(
|
|
1925
|
+
'div',
|
|
1926
|
+
{ className: 'dshg-drawer' },
|
|
1927
|
+
h(
|
|
1928
|
+
'div',
|
|
1929
|
+
{ className: 'dshg-drawer-row' },
|
|
1930
|
+
h('input', {
|
|
1931
|
+
type: 'password',
|
|
1932
|
+
className: 'dshg-input',
|
|
1933
|
+
autoComplete: 'new-password',
|
|
1934
|
+
value: state.draftSecret,
|
|
1935
|
+
placeholder: t.keyPlaceholder,
|
|
1936
|
+
onChange: (e) => patch({ draftSecret: e.target.value }),
|
|
1937
|
+
}),
|
|
1938
|
+
h(
|
|
1939
|
+
'button',
|
|
1940
|
+
{
|
|
1941
|
+
type: 'button',
|
|
1942
|
+
className: 'dshg-btn dshg-btn-primary dshg-btn-sm',
|
|
1943
|
+
disabled: Boolean(state.busyKey || !state.draftSecret.trim()),
|
|
1944
|
+
onClick: async () => {
|
|
1945
|
+
const secret = state.draftSecret
|
|
1946
|
+
patch({ draftSecret: '' })
|
|
1947
|
+
const res = await postAction(
|
|
1948
|
+
'/credential-key',
|
|
1949
|
+
{ key: prov.apiKeyEnv, value: secret },
|
|
1950
|
+
`write-${prov.apiKeyEnv}`,
|
|
1951
|
+
(r) => `已将 ${r.key} 单向写入 .credentials.yaml(绝不回显)`,
|
|
1952
|
+
)
|
|
1953
|
+
if (res && res.ok) patch({ editProviderKey: '' })
|
|
1954
|
+
},
|
|
1955
|
+
},
|
|
1956
|
+
state.busyKey === `write-${prov.apiKeyEnv}` ? t.writingKeyBtn : t.writeKeyBtn,
|
|
1957
|
+
),
|
|
1958
|
+
),
|
|
1959
|
+
)
|
|
1960
|
+
: null,
|
|
1562
1961
|
)
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
h(
|
|
1566
|
-
|
|
1567
|
-
{ key: 'cred-upsell', className: 'dshg-card dshg-card-spotlight' },
|
|
1568
|
-
h('div', { className: 'dshg-sec-head' }, h('span', null, t.credUpsellTitle)),
|
|
1569
|
-
h('div', { className: 'dshg-sec-sub' }, t.credUpsellDesc),
|
|
1570
|
-
renderDesktopCta(t.credUpsellOpen, t.credUpsellDownload),
|
|
1571
|
-
),
|
|
1572
|
-
]
|
|
1573
|
-
: null,
|
|
1962
|
+
}),
|
|
1963
|
+
)
|
|
1964
|
+
: h('div', { className: 'dshg-sec-sub' }, t.providersEmpty),
|
|
1965
|
+
),
|
|
1574
1966
|
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1967
|
+
h(
|
|
1968
|
+
'div',
|
|
1969
|
+
{ className: 'dshg-card' },
|
|
1970
|
+
h(
|
|
1578
1971
|
'div',
|
|
1579
|
-
{ className: 'dshg-
|
|
1972
|
+
{ className: 'dshg-sec-head' },
|
|
1973
|
+
h('span', null, t.credsAuditTitle),
|
|
1580
1974
|
h(
|
|
1581
|
-
'
|
|
1582
|
-
{
|
|
1583
|
-
|
|
1584
|
-
|
|
1975
|
+
'button',
|
|
1976
|
+
{
|
|
1977
|
+
type: 'button',
|
|
1978
|
+
className: 'dshg-btn dshg-btn-sm',
|
|
1979
|
+
onClick: () => patch({ showAddKey: !state.showAddKey, newKeySecret: '' }),
|
|
1980
|
+
},
|
|
1981
|
+
state.showAddKey ? t.cancelBtn : t.addKeyToggle,
|
|
1585
1982
|
),
|
|
1586
|
-
|
|
1587
|
-
|
|
1983
|
+
),
|
|
1984
|
+
h('div', { className: 'dshg-sec-sub' }, t.credsAuditSub),
|
|
1985
|
+
state.showAddKey
|
|
1986
|
+
? h(
|
|
1987
|
+
'div',
|
|
1988
|
+
{ className: 'dshg-drawer', style: { borderTop: 'none', paddingTop: 0 } },
|
|
1989
|
+
h(
|
|
1990
|
+
'select',
|
|
1991
|
+
{
|
|
1992
|
+
className: 'dshg-select',
|
|
1993
|
+
value: '',
|
|
1994
|
+
onChange: (e) => {
|
|
1995
|
+
const val = e.target.value
|
|
1996
|
+
if (val) patch({ newKeyName: val })
|
|
1997
|
+
},
|
|
1998
|
+
},
|
|
1999
|
+
h('option', { value: '' }, t.presetSelectPlaceholder),
|
|
2000
|
+
...ENV_KEY_PRESETS.map((pr) =>
|
|
2001
|
+
h('option', { key: pr.id, value: pr.envKey }, `${pr.label} (${pr.envKey})`),
|
|
2002
|
+
),
|
|
2003
|
+
),
|
|
2004
|
+
h('input', {
|
|
2005
|
+
type: 'text',
|
|
2006
|
+
className: 'dshg-input',
|
|
2007
|
+
value: state.newKeyName,
|
|
2008
|
+
placeholder: t.envNameLabel,
|
|
2009
|
+
onChange: (e) => patch({ newKeyName: e.target.value }),
|
|
2010
|
+
}),
|
|
2011
|
+
h(
|
|
2012
|
+
'div',
|
|
2013
|
+
{ className: 'dshg-drawer-row' },
|
|
2014
|
+
h('input', {
|
|
2015
|
+
type: 'password',
|
|
2016
|
+
className: 'dshg-input',
|
|
2017
|
+
autoComplete: 'new-password',
|
|
2018
|
+
value: state.newKeySecret,
|
|
2019
|
+
placeholder: t.keyPlaceholder,
|
|
2020
|
+
onChange: (e) => patch({ newKeySecret: e.target.value }),
|
|
2021
|
+
}),
|
|
2022
|
+
h(
|
|
2023
|
+
'button',
|
|
2024
|
+
{
|
|
2025
|
+
type: 'button',
|
|
2026
|
+
className: 'dshg-btn dshg-btn-primary dshg-btn-sm',
|
|
2027
|
+
disabled: Boolean(state.busyKey || !state.newKeyName.trim() || !state.newKeySecret.trim()),
|
|
2028
|
+
onClick: async () => {
|
|
2029
|
+
const keyName = state.newKeyName.trim()
|
|
2030
|
+
const secret = state.newKeySecret
|
|
2031
|
+
patch({ newKeySecret: '' })
|
|
2032
|
+
const res = await postAction(
|
|
2033
|
+
'/credential-key',
|
|
2034
|
+
{ key: keyName, value: secret },
|
|
2035
|
+
'write-custom-key',
|
|
2036
|
+
(r) => `已将 ${r.key} 单向写入 .credentials.yaml(绝不回显)`,
|
|
2037
|
+
)
|
|
2038
|
+
if (res && res.ok) patch({ newKeyName: '', showAddKey: false })
|
|
2039
|
+
},
|
|
2040
|
+
},
|
|
2041
|
+
state.busyKey === 'write-custom-key' ? t.writingKeyBtn : t.writeKeyBtn,
|
|
2042
|
+
),
|
|
2043
|
+
),
|
|
2044
|
+
)
|
|
2045
|
+
: null,
|
|
2046
|
+
credentials.keys && credentials.keys.length > 0
|
|
2047
|
+
? h(
|
|
2048
|
+
'div',
|
|
2049
|
+
{ className: 'dshg-list' },
|
|
2050
|
+
...credentials.keys.map((k) =>
|
|
1588
2051
|
h(
|
|
1589
2052
|
'div',
|
|
1590
|
-
{ key:
|
|
1591
|
-
|
|
2053
|
+
{ key: k.key, className: 'dshg-item', style: { padding: '6px 9px' } },
|
|
2054
|
+
h(
|
|
2055
|
+
'div',
|
|
2056
|
+
{ className: 'dshg-item-row' },
|
|
2057
|
+
h(
|
|
2058
|
+
'span',
|
|
2059
|
+
{
|
|
2060
|
+
className: 'dshg-mono',
|
|
2061
|
+
style: {
|
|
2062
|
+
color: 'var(--dshg-text)',
|
|
2063
|
+
fontWeight: 500,
|
|
2064
|
+
display: 'inline-flex',
|
|
2065
|
+
alignItems: 'center',
|
|
2066
|
+
gap: 5,
|
|
2067
|
+
},
|
|
2068
|
+
},
|
|
2069
|
+
k.protected ? h(LockIcon, { size: 12 }) : null,
|
|
2070
|
+
k.key,
|
|
2071
|
+
),
|
|
2072
|
+
k.protected
|
|
2073
|
+
? h('span', { className: 'dshg-badge', 'data-tone': 'muted' }, t.credProtected)
|
|
2074
|
+
: h('span', { className: 'dshg-badge', 'data-tone': k.present ? 'ok' : 'blue' }, k.present ? t.credPresent : t.credEnvOnly),
|
|
2075
|
+
),
|
|
2076
|
+
),
|
|
2077
|
+
),
|
|
2078
|
+
)
|
|
2079
|
+
: h('div', { className: 'dshg-sec-sub' }, t.credsEmpty),
|
|
2080
|
+
),
|
|
2081
|
+
|
|
2082
|
+
h(BoundaryDisclosure, {
|
|
2083
|
+
summary: t.boundaryCredsSummary,
|
|
2084
|
+
p1: t.boundaryCredsP1,
|
|
2085
|
+
p2: t.boundaryCredsP2,
|
|
2086
|
+
isWin,
|
|
2087
|
+
installerUrl,
|
|
2088
|
+
releaseUrl,
|
|
2089
|
+
t,
|
|
2090
|
+
}),
|
|
2091
|
+
)
|
|
2092
|
+
|
|
2093
|
+
const renderSnapshotsTab = () =>
|
|
2094
|
+
h(
|
|
2095
|
+
'div',
|
|
2096
|
+
{ className: 'dshg-tab-body' },
|
|
2097
|
+
h(
|
|
2098
|
+
'div',
|
|
2099
|
+
{ className: 'dshg-toolbar' },
|
|
2100
|
+
h(
|
|
2101
|
+
'button',
|
|
2102
|
+
{
|
|
2103
|
+
type: 'button',
|
|
2104
|
+
className: 'dshg-btn dshg-btn-primary dshg-btn-sm',
|
|
2105
|
+
disabled: Boolean(state.busyKey),
|
|
2106
|
+
onClick: () =>
|
|
2107
|
+
postAction(
|
|
2108
|
+
'/snapshots/create',
|
|
2109
|
+
{ target: activeProfile, reason: `${activeProfile} 手动备份` },
|
|
2110
|
+
'snap-create',
|
|
2111
|
+
(res) => `已创建快照 ${res.snapshot.id}`,
|
|
2112
|
+
),
|
|
2113
|
+
},
|
|
2114
|
+
state.busyKey === 'snap-create' ? t.snapCreating : t.snapCreateTargetBtn,
|
|
2115
|
+
),
|
|
2116
|
+
),
|
|
2117
|
+
|
|
2118
|
+
h(
|
|
2119
|
+
'div',
|
|
2120
|
+
{ className: 'dshg-card' },
|
|
2121
|
+
h(
|
|
2122
|
+
'div',
|
|
2123
|
+
{ className: 'dshg-sec-head' },
|
|
2124
|
+
h('span', null, t.kpiSnaps),
|
|
2125
|
+
h('span', { className: 'dshg-badge', 'data-tone': 'muted' }, String(snapshots.total || 0)),
|
|
2126
|
+
),
|
|
2127
|
+
snapshots.snapshots && snapshots.snapshots.length > 0
|
|
2128
|
+
? h(
|
|
2129
|
+
'div',
|
|
2130
|
+
{ className: 'dshg-list' },
|
|
2131
|
+
...snapshots.snapshots.map((s) => {
|
|
2132
|
+
const expanded = Boolean(state.expandedSnaps[s.id])
|
|
2133
|
+
const trackColor = s.target === 'desktop' ? '#f59e0b' : s.target === 'all' ? '#10b981' : '#3b82f6'
|
|
2134
|
+
const fileStatusLabel = (st) =>
|
|
2135
|
+
st === 'same' ? t.fileSame : st === 'modified' ? t.fileModified : st === 'missing_now' ? t.fileMissing : t.fileUnknown
|
|
2136
|
+
const fileTone = (st) =>
|
|
2137
|
+
st === 'same' ? 'ok' : st === 'modified' || st === 'missing_now' ? 'warn' : 'muted'
|
|
2138
|
+
|
|
2139
|
+
return h(
|
|
2140
|
+
'div',
|
|
2141
|
+
{ key: s.id, className: 'dshg-item' },
|
|
2142
|
+
h(
|
|
2143
|
+
'div',
|
|
2144
|
+
{ className: 'dshg-item-row' },
|
|
1592
2145
|
h(
|
|
1593
2146
|
'div',
|
|
1594
|
-
{
|
|
2147
|
+
{ className: 'dshg-item-main' },
|
|
1595
2148
|
h(
|
|
1596
2149
|
'div',
|
|
1597
|
-
{ className: 'dshg-
|
|
1598
|
-
h(
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
}),
|
|
1605
|
-
s.reason || t.snapNoReason,
|
|
1606
|
-
),
|
|
1607
|
-
h(
|
|
1608
|
-
'span',
|
|
1609
|
-
{ className: 'dshg-badge', 'data-tone': s.target === 'desktop' ? 'ok' : 'blue' },
|
|
1610
|
-
s.target === 'desktop' ? t.desktopTrack : t.webTrack,
|
|
1611
|
-
),
|
|
2150
|
+
{ className: 'dshg-item-title' },
|
|
2151
|
+
h('span', { className: 'dshg-track-dot', style: { background: trackColor } }),
|
|
2152
|
+
h('span', null, s.reason || s.id),
|
|
2153
|
+
h('span', { className: 'dshg-pill' }, s.source === 'desktop' ? t.snapSourceDesktop : t.snapSourcePlugin),
|
|
2154
|
+
s.pinned
|
|
2155
|
+
? h('span', { className: 'dshg-badge', 'data-tone': 'blue' }, s.pinLabel || t.snapPinnedBadge)
|
|
2156
|
+
: null,
|
|
1612
2157
|
),
|
|
2158
|
+
h('div', { className: 'dshg-mono' }, `${s.target} · ${formatTimeShort(s.createdAt)} · ${s.itemCount} files`),
|
|
2159
|
+
),
|
|
2160
|
+
h(
|
|
2161
|
+
'span',
|
|
2162
|
+
{ className: 'dshg-badge', 'data-tone': s.changedCount > 0 ? 'warn' : 'ok' },
|
|
2163
|
+
s.changedCount > 0 ? t.snapDiff(s.changedCount) : t.snapSame,
|
|
2164
|
+
),
|
|
2165
|
+
),
|
|
2166
|
+
h(
|
|
2167
|
+
'div',
|
|
2168
|
+
{ className: 'dshg-actions', style: { justifyContent: 'space-between', marginTop: 2, flexWrap: 'wrap' } },
|
|
2169
|
+
h(
|
|
2170
|
+
'div',
|
|
2171
|
+
{ className: 'dshg-actions' },
|
|
1613
2172
|
h(
|
|
1614
|
-
'
|
|
1615
|
-
{
|
|
1616
|
-
|
|
1617
|
-
|
|
2173
|
+
'button',
|
|
2174
|
+
{
|
|
2175
|
+
type: 'button',
|
|
2176
|
+
className: 'dshg-btn dshg-btn-sm',
|
|
2177
|
+
onClick: () =>
|
|
2178
|
+
patch({
|
|
2179
|
+
expandedSnaps: { ...state.expandedSnaps, [s.id]: !expanded },
|
|
2180
|
+
}),
|
|
2181
|
+
},
|
|
2182
|
+
t.snapFilesToggle((s.files || []).length),
|
|
1618
2183
|
),
|
|
1619
|
-
|
|
2184
|
+
s.source !== 'desktop'
|
|
2185
|
+
? h(
|
|
2186
|
+
'button',
|
|
2187
|
+
{
|
|
2188
|
+
type: 'button',
|
|
2189
|
+
className: 'dshg-btn dshg-btn-sm',
|
|
2190
|
+
disabled: Boolean(state.busyKey),
|
|
2191
|
+
onClick: () =>
|
|
2192
|
+
postAction(
|
|
2193
|
+
'/snapshots/pin',
|
|
2194
|
+
{ snapshotId: s.id, pinned: !s.pinned, pinLabel: s.pinned ? '' : '基线置顶' },
|
|
2195
|
+
`pin-${s.id}`,
|
|
2196
|
+
(r) => (r.pinned ? '已置顶保护此快照' : '已取消快照置顶'),
|
|
2197
|
+
),
|
|
2198
|
+
},
|
|
2199
|
+
s.pinned ? t.snapUnpinBtn : t.snapPinBtn,
|
|
2200
|
+
)
|
|
2201
|
+
: null,
|
|
1620
2202
|
),
|
|
2203
|
+
s.restorableCount > 0
|
|
2204
|
+
? h(
|
|
2205
|
+
'button',
|
|
2206
|
+
{
|
|
2207
|
+
type: 'button',
|
|
2208
|
+
className: 'dshg-btn dshg-btn-primary dshg-btn-sm',
|
|
2209
|
+
disabled: Boolean(state.busyKey),
|
|
2210
|
+
onClick: () =>
|
|
2211
|
+
postAction(
|
|
2212
|
+
'/snapshots/restore-config',
|
|
2213
|
+
{ snapshotId: s.id },
|
|
2214
|
+
`restore-${s.id}`,
|
|
2215
|
+
(res) => `已恢复 ${res.restoredFiles.length} 个配置文件(恢复前已自动备份 ${res.preRestoreId})`,
|
|
2216
|
+
),
|
|
2217
|
+
},
|
|
2218
|
+
state.busyKey === `restore-${s.id}` ? t.snapRestoring : t.snapRestoreBtn,
|
|
2219
|
+
)
|
|
2220
|
+
: h('span', { className: 'dshg-sec-sub' }, t.snapDesktopOnlyTip),
|
|
1621
2221
|
),
|
|
2222
|
+
expanded
|
|
2223
|
+
? h(
|
|
2224
|
+
'div',
|
|
2225
|
+
{ className: 'dshg-drawer' },
|
|
2226
|
+
s.files && s.files.length > 0
|
|
2227
|
+
? s.files.map((f) =>
|
|
2228
|
+
h(
|
|
2229
|
+
'div',
|
|
2230
|
+
{ key: f.relPath || f.name, className: 'dshg-row' },
|
|
2231
|
+
h('span', { className: 'dshg-mono' }, f.relPath || f.name),
|
|
2232
|
+
h('span', { className: 'dshg-badge', 'data-tone': fileTone(f.status) }, fileStatusLabel(f.status)),
|
|
2233
|
+
),
|
|
2234
|
+
)
|
|
2235
|
+
: h('div', { className: 'dshg-sec-sub' }, t.snapNoFiles),
|
|
2236
|
+
)
|
|
2237
|
+
: null,
|
|
2238
|
+
)
|
|
2239
|
+
}),
|
|
2240
|
+
)
|
|
2241
|
+
: h(
|
|
2242
|
+
'div',
|
|
2243
|
+
{ className: 'dshg-empty' },
|
|
2244
|
+
h('div', { style: { fontWeight: 600, fontSize: 12 } }, t.snapshotsEmpty),
|
|
2245
|
+
h('div', { style: { fontSize: 11, lineHeight: 1.5 } }, t.snapshotsEmptyDesc),
|
|
2246
|
+
),
|
|
2247
|
+
),
|
|
2248
|
+
|
|
2249
|
+
h(
|
|
2250
|
+
'details',
|
|
2251
|
+
{ className: 'dshg-boundary' },
|
|
2252
|
+
h(
|
|
2253
|
+
'summary',
|
|
2254
|
+
null,
|
|
2255
|
+
h('span', null, t.auditSectionSummary(auditLog.length)),
|
|
2256
|
+
h(ChevronIcon, { size: 13 }),
|
|
2257
|
+
),
|
|
2258
|
+
h(
|
|
2259
|
+
'div',
|
|
2260
|
+
{ className: 'dshg-boundary-body' },
|
|
2261
|
+
auditLog.length > 0
|
|
2262
|
+
? auditLog.map((entry, idx) =>
|
|
2263
|
+
h(
|
|
2264
|
+
'div',
|
|
2265
|
+
{ key: `${entry.ts}-${idx}`, className: 'dshg-row' },
|
|
2266
|
+
h('span', { className: 'dshg-mono' }, `[${formatTimeShort(entry.ts)}] ${entry.action} · ${entry.target}`),
|
|
2267
|
+
h('span', { style: { fontSize: 10.5 } }, entry.summary),
|
|
1622
2268
|
),
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
2269
|
+
)
|
|
2270
|
+
: h('div', { className: 'dshg-sec-sub' }, t.auditEmpty),
|
|
2271
|
+
),
|
|
2272
|
+
),
|
|
2273
|
+
|
|
2274
|
+
h(BoundaryDisclosure, {
|
|
2275
|
+
summary: t.boundarySnapsSummary,
|
|
2276
|
+
p1: t.boundarySnapsP1,
|
|
2277
|
+
p2: t.boundarySnapsP2,
|
|
2278
|
+
isWin,
|
|
2279
|
+
installerUrl,
|
|
2280
|
+
releaseUrl,
|
|
2281
|
+
t,
|
|
2282
|
+
}),
|
|
2283
|
+
)
|
|
2284
|
+
|
|
2285
|
+
return h(
|
|
2286
|
+
'div',
|
|
2287
|
+
{ className: 'dshg-wrap', 'data-variant': (props && props.variant) || 'dock' },
|
|
2288
|
+
// Clean Header (zero install-nudge CTA when EXE is missing)
|
|
2289
|
+
h(
|
|
2290
|
+
'div',
|
|
2291
|
+
{ className: 'dshg-header' },
|
|
2292
|
+
h(
|
|
2293
|
+
'div',
|
|
2294
|
+
{ className: 'dshg-brand' },
|
|
2295
|
+
h('div', { className: 'dshg-logo' }, h(GuardIcon, { size: 16 })),
|
|
2296
|
+
h(
|
|
2297
|
+
'div',
|
|
2298
|
+
{ className: 'dshg-title-box' },
|
|
2299
|
+
h(
|
|
2300
|
+
'div',
|
|
2301
|
+
{ className: 'dshg-title-row' },
|
|
2302
|
+
h('span', { className: 'dshg-title' }, t.brand),
|
|
2303
|
+
h('span', { className: 'dshg-ver' }, t.versionPill),
|
|
2304
|
+
),
|
|
2305
|
+
h('div', { className: 'dshg-sub' }, t.subtitle),
|
|
2306
|
+
),
|
|
2307
|
+
),
|
|
2308
|
+
h(
|
|
2309
|
+
'div',
|
|
2310
|
+
{ className: 'dshg-actions' },
|
|
2311
|
+
guard.installed
|
|
2312
|
+
? h(
|
|
2313
|
+
'button',
|
|
2314
|
+
{
|
|
2315
|
+
type: 'button',
|
|
2316
|
+
className: 'dshg-btn',
|
|
2317
|
+
disabled: Boolean(state.busyKey),
|
|
2318
|
+
onClick: launchGuardDesktop,
|
|
2319
|
+
},
|
|
2320
|
+
h(ExternalIcon, { size: 12 }),
|
|
2321
|
+
h('span', null, state.busyKey === 'open-desktop' ? t.launchingBtn : t.openDesktopBtn),
|
|
2322
|
+
)
|
|
2323
|
+
: null,
|
|
2324
|
+
h(
|
|
2325
|
+
'button',
|
|
2326
|
+
{
|
|
2327
|
+
type: 'button',
|
|
2328
|
+
className: 'dshg-btn dshg-btn-icon',
|
|
2329
|
+
title: t.refresh,
|
|
2330
|
+
disabled: state.loading,
|
|
2331
|
+
onClick: () => fetchOverview(true),
|
|
2332
|
+
},
|
|
2333
|
+
h(RefreshIcon, { size: 13, className: state.loading ? 'dshg-spin' : undefined }),
|
|
2334
|
+
),
|
|
2335
|
+
h(
|
|
2336
|
+
'button',
|
|
2337
|
+
{
|
|
2338
|
+
type: 'button',
|
|
2339
|
+
className: 'dshg-btn',
|
|
2340
|
+
onClick: () => patch({ lang: state.lang === 'zh' ? 'en' : 'zh' }),
|
|
2341
|
+
},
|
|
2342
|
+
t.langSwitch,
|
|
2343
|
+
),
|
|
2344
|
+
),
|
|
2345
|
+
),
|
|
2346
|
+
|
|
2347
|
+
state.error ? h('div', { className: 'dshg-error' }, state.error) : null,
|
|
2348
|
+
state.notice ? h('div', { className: 'dshg-notice' }, state.notice) : null,
|
|
2349
|
+
|
|
2350
|
+
// Status row
|
|
2351
|
+
data
|
|
2352
|
+
? h(
|
|
2353
|
+
'div',
|
|
2354
|
+
{ className: 'dshg-row' },
|
|
2355
|
+
h(
|
|
2356
|
+
'div',
|
|
2357
|
+
{ className: 'dshg-actions', style: { gap: 6 } },
|
|
2358
|
+
h(
|
|
2359
|
+
'span',
|
|
2360
|
+
{ className: 'dshg-badge', 'data-tone': 'blue' },
|
|
2361
|
+
h('span', { className: 'dshg-dot' }),
|
|
2362
|
+
profileLabel(activeProfile),
|
|
2363
|
+
),
|
|
2364
|
+
h(
|
|
2365
|
+
'span',
|
|
2366
|
+
{ className: 'dshg-badge', 'data-tone': healthy ? 'ok' : 'warn' },
|
|
2367
|
+
h('span', { className: 'dshg-dot' }),
|
|
2368
|
+
healthy ? t.healthy : t.unhealthy(issues.length),
|
|
2369
|
+
),
|
|
2370
|
+
),
|
|
2371
|
+
state.checkedAt
|
|
2372
|
+
? h('span', { style: { fontSize: 11, color: 'var(--dshg-text-3)' } }, t.checkedAt(formatTimeShort(state.checkedAt)))
|
|
2373
|
+
: null,
|
|
1633
2374
|
)
|
|
1634
2375
|
: null,
|
|
1635
2376
|
|
|
1636
|
-
//
|
|
2377
|
+
// Interactive 4-KPI Strip
|
|
2378
|
+
data
|
|
2379
|
+
? h(
|
|
2380
|
+
'div',
|
|
2381
|
+
{ className: 'dshg-kpi-strip' },
|
|
2382
|
+
h(
|
|
2383
|
+
'button',
|
|
2384
|
+
{
|
|
2385
|
+
type: 'button',
|
|
2386
|
+
className: 'dshg-kpi',
|
|
2387
|
+
'data-active': state.tab === 'overview' ? 'true' : 'false',
|
|
2388
|
+
onClick: () => patch({ tab: 'overview' }),
|
|
2389
|
+
},
|
|
2390
|
+
h('span', { className: 'dshg-kpi-label' }, t.kpiHealth),
|
|
2391
|
+
h('span', { className: 'dshg-kpi-val' }, healthy ? t.kpiHealthOk : t.kpiHealthWarn(issues.length)),
|
|
2392
|
+
),
|
|
2393
|
+
h(
|
|
2394
|
+
'button',
|
|
2395
|
+
{
|
|
2396
|
+
type: 'button',
|
|
2397
|
+
className: 'dshg-kpi',
|
|
2398
|
+
'data-active': state.tab === 'plugins' ? 'true' : 'false',
|
|
2399
|
+
onClick: () => patch({ tab: 'plugins' }),
|
|
2400
|
+
},
|
|
2401
|
+
h('span', { className: 'dshg-kpi-label' }, t.kpiExt),
|
|
2402
|
+
h('span', { className: 'dshg-kpi-val' }, String(totalExtCount)),
|
|
2403
|
+
),
|
|
2404
|
+
h(
|
|
2405
|
+
'button',
|
|
2406
|
+
{
|
|
2407
|
+
type: 'button',
|
|
2408
|
+
className: 'dshg-kpi',
|
|
2409
|
+
'data-active': state.tab === 'creds' ? 'true' : 'false',
|
|
2410
|
+
onClick: () => patch({ tab: 'creds' }),
|
|
2411
|
+
},
|
|
2412
|
+
h('span', { className: 'dshg-kpi-label' }, t.kpiCreds),
|
|
2413
|
+
h('span', { className: 'dshg-kpi-val' }, credsSummaryVal),
|
|
2414
|
+
),
|
|
2415
|
+
h(
|
|
2416
|
+
'button',
|
|
2417
|
+
{
|
|
2418
|
+
type: 'button',
|
|
2419
|
+
className: 'dshg-kpi',
|
|
2420
|
+
'data-active': state.tab === 'snapshots' ? 'true' : 'false',
|
|
2421
|
+
onClick: () => patch({ tab: 'snapshots' }),
|
|
2422
|
+
},
|
|
2423
|
+
h('span', { className: 'dshg-kpi-label' }, t.kpiSnaps),
|
|
2424
|
+
h('span', { className: 'dshg-kpi-val' }, String(snapshots.total || 0)),
|
|
2425
|
+
),
|
|
2426
|
+
)
|
|
2427
|
+
: null,
|
|
2428
|
+
|
|
2429
|
+
// Segmented 5-Tab Bar
|
|
2430
|
+
data
|
|
2431
|
+
? h(
|
|
2432
|
+
'div',
|
|
2433
|
+
{ className: 'dshg-seg' },
|
|
2434
|
+
...[
|
|
2435
|
+
['overview', t.tabOverview],
|
|
2436
|
+
['plugins', t.tabPlugins],
|
|
2437
|
+
['context', t.tabContext],
|
|
2438
|
+
['creds', t.tabCreds],
|
|
2439
|
+
['snapshots', t.tabSnapshots],
|
|
2440
|
+
].map(([id, label]) =>
|
|
2441
|
+
h(
|
|
2442
|
+
'button',
|
|
2443
|
+
{
|
|
2444
|
+
key: id,
|
|
2445
|
+
type: 'button',
|
|
2446
|
+
className: 'dshg-seg-btn',
|
|
2447
|
+
'data-active': state.tab === id ? 'true' : 'false',
|
|
2448
|
+
onClick: () => patch({ tab: id }),
|
|
2449
|
+
},
|
|
2450
|
+
label,
|
|
2451
|
+
),
|
|
2452
|
+
),
|
|
2453
|
+
)
|
|
2454
|
+
: null,
|
|
2455
|
+
|
|
2456
|
+
!data && state.loading
|
|
2457
|
+
? h('div', { className: 'dshg-card', style: { fontSize: 12, color: 'var(--dshg-text-2)' } }, t.loading)
|
|
2458
|
+
: null,
|
|
2459
|
+
|
|
2460
|
+
!data && !state.loading && state.error
|
|
2461
|
+
? h(
|
|
2462
|
+
'div',
|
|
2463
|
+
{ className: 'dshg-empty' },
|
|
2464
|
+
h('div', { style: { fontSize: 12 } }, state.error),
|
|
2465
|
+
h('button', { type: 'button', className: 'dshg-btn', onClick: () => fetchOverview(true) }, t.retry),
|
|
2466
|
+
)
|
|
2467
|
+
: null,
|
|
2468
|
+
|
|
2469
|
+
data && state.tab === 'overview' ? renderOverviewTab() : null,
|
|
2470
|
+
data && state.tab === 'plugins' ? renderPluginsTab() : null,
|
|
2471
|
+
data && state.tab === 'context' ? renderContextTab() : null,
|
|
2472
|
+
data && state.tab === 'creds' ? renderCredsTab() : null,
|
|
2473
|
+
data && state.tab === 'snapshots' ? renderSnapshotsTab() : null,
|
|
2474
|
+
|
|
1637
2475
|
h(
|
|
1638
2476
|
'div',
|
|
1639
2477
|
{ className: 'dshg-footer' },
|
|
1640
2478
|
h('span', null, t.footerNote),
|
|
1641
2479
|
h(
|
|
1642
|
-
'
|
|
1643
|
-
{
|
|
1644
|
-
|
|
2480
|
+
'div',
|
|
2481
|
+
{ style: { display: 'flex', gap: 10 } },
|
|
2482
|
+
h('a', { href: releaseUrl, target: '_blank', rel: 'noopener noreferrer' }, 'Releases'),
|
|
2483
|
+
h('a', { href: repoUrl, target: '_blank', rel: 'noopener noreferrer' }, t.footerHome),
|
|
1645
2484
|
),
|
|
1646
2485
|
),
|
|
1647
2486
|
)
|