@gluztm/dsh-guard 2.4.2 → 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 +26 -28
- package/README.md +28 -25
- package/bin/dsh-guard.mjs +64 -16
- package/lib/client.js +661 -202
- package/lib/governance.mjs +994 -0
- package/lib/index.mjs +201 -27
- package/lib/inspector.mjs +451 -97
- package/package.json +7 -3
package/lib/client.js
CHANGED
|
@@ -14,30 +14,42 @@ window.__ModuleLoader__.load({
|
|
|
14
14
|
|
|
15
15
|
const SIDE_ID = 'dsh-guard'
|
|
16
16
|
const API_BASE = 'api/dsh-guard'
|
|
17
|
-
const STYLE_ID = 'dsh-guard-panel-styles-
|
|
18
|
-
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'
|
|
19
20
|
const REPO_FALLBACK = 'https://github.com/gluztm/DSHGuard'
|
|
20
|
-
const RELEASE_FALLBACK =
|
|
21
|
-
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
|
+
]
|
|
22
33
|
|
|
23
34
|
const COPY = {
|
|
24
35
|
zh: {
|
|
25
36
|
brand: 'DSH 守护伴生',
|
|
26
|
-
subtitle: '
|
|
27
|
-
guideDesc: '
|
|
37
|
+
subtitle: '运行时底座 · 扩展 · 上下文 · 凭据 · 快照',
|
|
38
|
+
guideDesc: '自动识别当前宿主(桌面端 / Web 端),内置依赖自愈、插件/MCP 启停与探活、上下文与 Skills 治理、单向写 .credentials.yaml 与本地快照置顶回滚。',
|
|
28
39
|
versionPill: `v${VERSION}`,
|
|
29
40
|
refresh: '刷新',
|
|
30
41
|
refreshing: '同步中',
|
|
31
42
|
langSwitch: 'EN',
|
|
32
43
|
healthy: '配置健康',
|
|
33
44
|
unhealthy: (n) => `${n} 项待处理`,
|
|
34
|
-
loading: '
|
|
45
|
+
loading: '正在读取当前运行档案、上下文负担、MCP/模型与快照…',
|
|
35
46
|
retry: '重试',
|
|
36
47
|
checkedAt: (t) => `同步于 ${t}`,
|
|
37
48
|
openDesktopBtn: '打开桌面端',
|
|
38
49
|
launchingBtn: '正在拉起…',
|
|
39
50
|
tabOverview: '总览',
|
|
40
|
-
tabPlugins: '
|
|
51
|
+
tabPlugins: '扩展',
|
|
52
|
+
tabContext: '上下文',
|
|
41
53
|
tabCreds: '凭据',
|
|
42
54
|
tabSnapshots: '快照',
|
|
43
55
|
kpiHealth: '配置健康',
|
|
@@ -46,7 +58,7 @@ window.__ModuleLoader__.load({
|
|
|
46
58
|
kpiExt: '插件 / MCP',
|
|
47
59
|
kpiCreds: '密钥 / 提供商',
|
|
48
60
|
kpiSnaps: '配置快照',
|
|
49
|
-
secProfiles: '
|
|
61
|
+
secProfiles: '当前运行档案',
|
|
50
62
|
webTrack: 'Web 端',
|
|
51
63
|
desktopTrack: '桌面端',
|
|
52
64
|
present: '已就绪',
|
|
@@ -58,14 +70,34 @@ window.__ModuleLoader__.load({
|
|
|
58
70
|
brokenLabel: '断链数',
|
|
59
71
|
repairLinksBtn: '一键修复断链',
|
|
60
72
|
repairingBtn: '修复中…',
|
|
61
|
-
allHealthyTitle: '
|
|
62
|
-
allHealthySub: '
|
|
63
|
-
quickSnapWeb: '
|
|
64
|
-
quickGoPlugins: '
|
|
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`,
|
|
65
92
|
warningsTitle: '巡检提示',
|
|
66
93
|
searchPlaceholder: '搜索插件包名、loader ID 或 MCP 服务名…',
|
|
67
|
-
mcpSectionTitle: 'MCP
|
|
94
|
+
mcpSectionTitle: 'MCP 服务管理与探活',
|
|
68
95
|
mcpEmpty: '当前档案尚未配置 MCP 服务。',
|
|
96
|
+
mcpProbeBtn: '探测本地 MCP',
|
|
97
|
+
mcpProbingBtn: '探测中…',
|
|
98
|
+
mcpTimeoutBtn: '超时',
|
|
99
|
+
mcpTimeoutSave: '保存超时',
|
|
100
|
+
mcpTimeoutHint: '单次工具调用超时(5000 - 600000 ms)',
|
|
69
101
|
pluginsSectionTitle: '已安装插件',
|
|
70
102
|
pluginsEmpty: '未匹配到插件条目。',
|
|
71
103
|
badgeCore: '核心保护',
|
|
@@ -75,16 +107,16 @@ window.__ModuleLoader__.load({
|
|
|
75
107
|
badgeAllCount: (shown, total) => `${shown} / ${total}`,
|
|
76
108
|
boundaryPluginsSummary: '能力边界说明:为什么插件全新安装/卸载与强杀锁死进程不在此完成?',
|
|
77
109
|
boundaryPluginsP1: '本插件运行于当前 DSH Node 宿主进程内部:在运行时热删除或重装 node_modules 可能导致已加载模块撕裂锁死;同时为遵循插件最小权限安全红线,本插件不会从远端拉取二进制安装包或托管宿主进程生命周期。',
|
|
78
|
-
boundaryPluginsP2: '在伴生插件内,你可直接安全启停第三方插件与 MCP
|
|
110
|
+
boundaryPluginsP2: '在伴生插件内,你可直接安全启停第三方插件与 MCP 服务、调整 MCP 超时、执行本地只读探活并修复断裂依赖链接;完整增删插件与进程外强启停由独立原生桌面端承担。',
|
|
79
111
|
boundaryCredsSummary: '能力边界说明:为什么不在此回显/导出明文密钥或提供 Windows DPAPI 加密库?',
|
|
80
112
|
boundaryCredsP1: '安全合规要求持有前端请求能力的插件不得反向读取并回显真实 API 密钥。本插件采用「只核验键名 + 单向覆盖写入 .credentials.yaml」机制,所有明文仅从输入框单向落盘(0o600),响应报文绝不返回密钥字符。',
|
|
81
113
|
boundaryCredsP2: '硬件绑定的 Windows DPAPI 凭据保险箱加密以及跨 CC Switch 等工具链批量迁移属于系统原生能力,仅独立的 Windows 原生桌面端具备。',
|
|
82
114
|
boundarySnapsSummary: '能力边界说明:为什么配置快照仅恢复 YAML/JSON 配对文件而不覆盖整包扩展?',
|
|
83
|
-
boundarySnapsP1: '伴生插件可在不干扰宿主运行的前提下,安全完成 cordis.patch.yml、cordis.yml、package.json 与 settings.yaml 的实时 SHA256
|
|
115
|
+
boundarySnapsP1: '伴生插件可在不干扰宿主运行的前提下,安全完成 cordis.patch.yml、cordis.yml、package.json 与 settings.yaml 的实时 SHA256 比对、备份、置顶保护与白名单一键回滚(自动排除 .credentials.yaml)。',
|
|
84
116
|
boundarySnapsP2: '涵盖 node_modules 整包 ZIP 回溯与主程序崩溃后的带外拉起恢复必须脱离宿主进程执行,仅在独立原生桌面端提供。',
|
|
85
|
-
desktopWinLink: `下载 Windows 原生桌面端 v${
|
|
117
|
+
desktopWinLink: `下载 Windows 原生桌面端 v${DESKTOP_VERSION} ↗`,
|
|
86
118
|
desktopReleaseLink: '查看 GitHub Releases ↗',
|
|
87
|
-
desktopNonWinNote: '注:原生桌面端目前仅提供 Windows
|
|
119
|
+
desktopNonWinNote: '注:原生桌面端目前仅提供 Windows 安装包;当前平台的启停开关、上下文治理、单向写密钥与配置回滚已全部内置于伴生插件。',
|
|
88
120
|
providersTitle: '模型提供商 (llm-pi-ai)',
|
|
89
121
|
providersEmpty: '尚未在 cordis.patch.yml 中发现 llm-pi-ai 提供商配置。',
|
|
90
122
|
modelsUnit: '个模型',
|
|
@@ -97,6 +129,7 @@ window.__ModuleLoader__.load({
|
|
|
97
129
|
writeKeyBtn: '写入 .credentials.yaml',
|
|
98
130
|
writingKeyBtn: '写入中…',
|
|
99
131
|
addKeyToggle: '+ 新增自定义环境变量密钥',
|
|
132
|
+
presetSelectPlaceholder: '常用平台预设(可选自动填入键名)…',
|
|
100
133
|
envNameLabel: '环境变量名 (如 DEEPSEEK_API_KEY)',
|
|
101
134
|
credsAuditTitle: '.credentials.yaml 键名状态审计',
|
|
102
135
|
credsAuditSub: '仅展示键名是否存在及保护标记(绝不读取或传输密钥字符)。',
|
|
@@ -104,8 +137,7 @@ window.__ModuleLoader__.load({
|
|
|
104
137
|
credPresent: '已写入',
|
|
105
138
|
credEnvOnly: '仅环境变量',
|
|
106
139
|
credsEmpty: '当前尚未创建 .credentials.yaml 或 refs 下尚无键值。',
|
|
107
|
-
|
|
108
|
-
snapCreateDesktop: '+ 备份桌面端配置',
|
|
140
|
+
snapCreateTargetBtn: '+ 备份当前配置',
|
|
109
141
|
snapCreating: '备份中…',
|
|
110
142
|
snapSourcePlugin: '插件快照',
|
|
111
143
|
snapSourceDesktop: '桌面端快照',
|
|
@@ -114,45 +146,51 @@ window.__ModuleLoader__.load({
|
|
|
114
146
|
snapFilesToggle: (n) => `查看 ${n} 个文件比对明细`,
|
|
115
147
|
snapRestoreBtn: '恢复此配置快照',
|
|
116
148
|
snapRestoring: '恢复中…',
|
|
149
|
+
snapPinBtn: '📌 置顶',
|
|
150
|
+
snapUnpinBtn: '取消置顶',
|
|
151
|
+
snapPinnedBadge: '已置顶保护',
|
|
117
152
|
snapNoFiles: '该快照暂无可比对配置文件',
|
|
118
153
|
snapDesktopOnlyTip: '桌面端全量包产物需在桌面端还原',
|
|
154
|
+
auditSectionSummary: (n) => `变更审计流水(最近 ${n} 条脱敏操作记录)`,
|
|
155
|
+
auditEmpty: '暂无通过伴生插件写入的审计记录。',
|
|
119
156
|
fileSame: '一致',
|
|
120
157
|
fileModified: '与现行配置不同',
|
|
121
158
|
fileMissing: '磁盘已删除',
|
|
122
159
|
fileUnknown: '仅记录',
|
|
123
160
|
snapshotsEmpty: '暂无本地配置快照',
|
|
124
|
-
snapshotsEmptyDesc: '
|
|
161
|
+
snapshotsEmptyDesc: '点击上方备份按钮,或在修改插件/MCP 开关时自动留存一份配置档案。',
|
|
125
162
|
footerNote: `@gluztm/dsh-guard v${VERSION}`,
|
|
126
163
|
footerHome: 'GitHub',
|
|
127
164
|
},
|
|
128
165
|
en: {
|
|
129
166
|
brand: 'DSH Companion',
|
|
130
|
-
subtitle: '
|
|
131
|
-
guideDesc: '
|
|
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.',
|
|
132
169
|
versionPill: `v${VERSION}`,
|
|
133
170
|
refresh: 'Refresh',
|
|
134
171
|
refreshing: 'Syncing',
|
|
135
172
|
langSwitch: '中文',
|
|
136
173
|
healthy: 'Healthy',
|
|
137
|
-
unhealthy: (n) => `${n}
|
|
138
|
-
loading: 'Loading
|
|
174
|
+
unhealthy: (n) => `${n} alert`,
|
|
175
|
+
loading: 'Loading active profile, context load, MCP/providers, and snapshots…',
|
|
139
176
|
retry: 'Retry',
|
|
140
177
|
checkedAt: (t) => `Synced ${t}`,
|
|
141
178
|
openDesktopBtn: 'Open Desktop',
|
|
142
179
|
launchingBtn: 'Launching…',
|
|
143
180
|
tabOverview: 'Overview',
|
|
144
|
-
tabPlugins: '
|
|
145
|
-
|
|
146
|
-
|
|
181
|
+
tabPlugins: 'Ext',
|
|
182
|
+
tabContext: 'Context',
|
|
183
|
+
tabCreds: 'Creds',
|
|
184
|
+
tabSnapshots: 'Snaps',
|
|
147
185
|
kpiHealth: 'Health',
|
|
148
186
|
kpiHealthOk: 'Synced',
|
|
149
187
|
kpiHealthWarn: (n) => `${n} alert`,
|
|
150
188
|
kpiExt: 'Plugins / MCP',
|
|
151
189
|
kpiCreds: 'Keys / Providers',
|
|
152
190
|
kpiSnaps: 'Snapshots',
|
|
153
|
-
secProfiles: 'Profile
|
|
154
|
-
webTrack: 'Web
|
|
155
|
-
desktopTrack: 'Desktop
|
|
191
|
+
secProfiles: 'Active Runtime Profile',
|
|
192
|
+
webTrack: 'Web',
|
|
193
|
+
desktopTrack: 'Desktop',
|
|
156
194
|
present: 'Ready',
|
|
157
195
|
absent: 'Absent',
|
|
158
196
|
depsLabel: 'Deps',
|
|
@@ -162,14 +200,34 @@ window.__ModuleLoader__.load({
|
|
|
162
200
|
brokenLabel: 'Broken Links',
|
|
163
201
|
repairLinksBtn: 'Repair Broken Links',
|
|
164
202
|
repairingBtn: 'Repairing…',
|
|
165
|
-
allHealthyTitle: '
|
|
166
|
-
allHealthySub: 'Dependencies, MCP entries, and Cordis patches look clean. Switch tabs above to
|
|
167
|
-
quickSnapWeb: 'Backup
|
|
168
|
-
quickGoPlugins: 'Manage
|
|
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`,
|
|
169
222
|
warningsTitle: 'Diagnostics',
|
|
170
223
|
searchPlaceholder: 'Filter package name, loader ID, or MCP server…',
|
|
171
|
-
mcpSectionTitle: 'MCP Servers',
|
|
224
|
+
mcpSectionTitle: 'MCP Servers & Local Probe',
|
|
172
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)',
|
|
173
231
|
pluginsSectionTitle: 'Installed Plugins',
|
|
174
232
|
pluginsEmpty: 'No matching plugins.',
|
|
175
233
|
badgeCore: 'Core',
|
|
@@ -179,16 +237,16 @@ window.__ModuleLoader__.load({
|
|
|
179
237
|
badgeAllCount: (shown, total) => `${shown} / ${total}`,
|
|
180
238
|
boundaryPluginsSummary: 'Capability boundary: why fresh package install & force process control live outside this plugin',
|
|
181
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.',
|
|
182
|
-
boundaryPluginsP2: 'Safe plugin & MCP toggling
|
|
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.',
|
|
183
241
|
boundaryCredsSummary: 'Security boundary: why plaintext key readback & Windows DPAPI vault live outside this plugin',
|
|
184
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.',
|
|
185
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.',
|
|
186
244
|
boundarySnapsSummary: 'Runtime boundary: why snapshots restore YAML/JSON configs rather than full node_modules bundles',
|
|
187
|
-
boundarySnapsP1: 'Within the running DSH process, this tab safely computes live SHA256 diffs, creates snapshots, and performs whitelist rollback of cordis.patch.yml, cordis.yml, package.json, and settings.yaml (excluding secrets).',
|
|
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).',
|
|
188
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.',
|
|
189
|
-
desktopWinLink: `Download Windows Desktop v${
|
|
247
|
+
desktopWinLink: `Download Windows Desktop v${DESKTOP_VERSION} ↗`,
|
|
190
248
|
desktopReleaseLink: 'GitHub Releases ↗',
|
|
191
|
-
desktopNonWinNote: 'Note: The native desktop shell is Windows-only;
|
|
249
|
+
desktopNonWinNote: 'Note: The native desktop shell is Windows-only; toggling, context governance, blind-write credentials, and config rollback work natively on this OS.',
|
|
192
250
|
providersTitle: 'Model Providers (llm-pi-ai)',
|
|
193
251
|
providersEmpty: 'No llm-pi-ai provider entries found in cordis.patch.yml.',
|
|
194
252
|
modelsUnit: 'models',
|
|
@@ -201,6 +259,7 @@ window.__ModuleLoader__.load({
|
|
|
201
259
|
writeKeyBtn: 'Save to .credentials.yaml',
|
|
202
260
|
writingKeyBtn: 'Saving…',
|
|
203
261
|
addKeyToggle: '+ Add custom env ref key',
|
|
262
|
+
presetSelectPlaceholder: 'Common platform presets (auto-fill env key)…',
|
|
204
263
|
envNameLabel: 'Env Var Name (e.g. DEEPSEEK_API_KEY)',
|
|
205
264
|
credsAuditTitle: '.credentials.yaml Key Presence Audit',
|
|
206
265
|
credsAuditSub: 'Verifies key readiness and protected OAuth flags without reading secret values.',
|
|
@@ -208,8 +267,7 @@ window.__ModuleLoader__.load({
|
|
|
208
267
|
credPresent: 'Configured',
|
|
209
268
|
credEnvOnly: 'Env Only',
|
|
210
269
|
credsEmpty: 'No .credentials.yaml entries found yet.',
|
|
211
|
-
|
|
212
|
-
snapCreateDesktop: '+ Backup Desktop Config',
|
|
270
|
+
snapCreateTargetBtn: '+ Create Snapshot',
|
|
213
271
|
snapCreating: 'Backing up…',
|
|
214
272
|
snapSourcePlugin: 'Plugin',
|
|
215
273
|
snapSourceDesktop: 'Desktop',
|
|
@@ -218,14 +276,19 @@ window.__ModuleLoader__.load({
|
|
|
218
276
|
snapFilesToggle: (n) => `Inspect ${n} file diff(s)`,
|
|
219
277
|
snapRestoreBtn: 'Restore Config Files',
|
|
220
278
|
snapRestoring: 'Restoring…',
|
|
279
|
+
snapPinBtn: '📌 Pin',
|
|
280
|
+
snapUnpinBtn: 'Unpin',
|
|
281
|
+
snapPinnedBadge: 'Pinned',
|
|
221
282
|
snapNoFiles: 'No comparable config files in this snapshot',
|
|
222
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.',
|
|
223
286
|
fileSame: 'Same',
|
|
224
287
|
fileModified: 'Changed on disk',
|
|
225
288
|
fileMissing: 'Deleted on disk',
|
|
226
289
|
fileUnknown: 'Recorded',
|
|
227
290
|
snapshotsEmpty: 'No configuration snapshots yet',
|
|
228
|
-
snapshotsEmptyDesc: 'Create a manual backup above or toggle
|
|
291
|
+
snapshotsEmptyDesc: 'Create a manual backup above or toggle an extension to automatically preserve a snapshot.',
|
|
229
292
|
footerNote: `@gluztm/dsh-guard v${VERSION}`,
|
|
230
293
|
footerHome: 'GitHub',
|
|
231
294
|
},
|
|
@@ -471,7 +534,7 @@ window.__ModuleLoader__.load({
|
|
|
471
534
|
}
|
|
472
535
|
.dshg-seg {
|
|
473
536
|
display: grid;
|
|
474
|
-
grid-template-columns: repeat(
|
|
537
|
+
grid-template-columns: repeat(5, minmax(0, 1fr));
|
|
475
538
|
gap: 3px;
|
|
476
539
|
padding: 3px;
|
|
477
540
|
border-radius: 10px;
|
|
@@ -479,14 +542,33 @@ window.__ModuleLoader__.load({
|
|
|
479
542
|
border: 1px solid var(--dshg-border);
|
|
480
543
|
}
|
|
481
544
|
.dshg-seg-2 {
|
|
482
|
-
display: inline-
|
|
483
|
-
|
|
545
|
+
display: inline-flex;
|
|
546
|
+
flex-wrap: wrap;
|
|
484
547
|
gap: 3px;
|
|
485
548
|
padding: 2px;
|
|
486
549
|
border-radius: 8px;
|
|
487
550
|
background: var(--dshg-fill-subtle);
|
|
488
551
|
border: 1px solid var(--dshg-border);
|
|
489
552
|
}
|
|
553
|
+
.dshg-seg-2 .dshg-seg-btn {
|
|
554
|
+
padding: 4px 9px;
|
|
555
|
+
}
|
|
556
|
+
.dshg-select {
|
|
557
|
+
height: 29px;
|
|
558
|
+
border-radius: 8px;
|
|
559
|
+
border: 1px solid var(--dshg-border);
|
|
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;
|
|
571
|
+
}
|
|
490
572
|
.dshg-seg-btn {
|
|
491
573
|
appearance: none;
|
|
492
574
|
border: none;
|
|
@@ -811,8 +893,8 @@ window.__ModuleLoader__.load({
|
|
|
811
893
|
const store = {
|
|
812
894
|
lang: 'zh',
|
|
813
895
|
tab: 'overview',
|
|
814
|
-
pluginProfile: 'web',
|
|
815
896
|
search: '',
|
|
897
|
+
skillSearch: '',
|
|
816
898
|
loading: false,
|
|
817
899
|
busyKey: '',
|
|
818
900
|
error: '',
|
|
@@ -825,6 +907,9 @@ window.__ModuleLoader__.load({
|
|
|
825
907
|
newKeyName: '',
|
|
826
908
|
newKeySecret: '',
|
|
827
909
|
expandedSnaps: {},
|
|
910
|
+
mcpProbes: {},
|
|
911
|
+
editMcpId: '',
|
|
912
|
+
draftMcpTimeout: '',
|
|
828
913
|
}
|
|
829
914
|
|
|
830
915
|
const listeners = new Set()
|
|
@@ -854,14 +939,33 @@ window.__ModuleLoader__.load({
|
|
|
854
939
|
return store
|
|
855
940
|
}
|
|
856
941
|
|
|
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
|
+
|
|
857
960
|
async function fetchOverview(force = false) {
|
|
858
961
|
if (store.loading && !force) return
|
|
859
962
|
patch({ loading: true, error: '' })
|
|
860
963
|
try {
|
|
861
964
|
const res = await fetch(`${API_BASE}/overview`, { credentials: 'same-origin' })
|
|
862
|
-
const
|
|
965
|
+
const parsed = await readJsonResponse(res)
|
|
966
|
+
const json = parsed.json
|
|
863
967
|
if (!res.ok || !json || !json.ok) {
|
|
864
|
-
throw new Error((
|
|
968
|
+
throw new Error(buildHttpErrorMessage(res, parsed))
|
|
865
969
|
}
|
|
866
970
|
patch({
|
|
867
971
|
loading: false,
|
|
@@ -885,9 +989,10 @@ window.__ModuleLoader__.load({
|
|
|
885
989
|
headers: { 'content-type': 'application/json' },
|
|
886
990
|
body: JSON.stringify(payload || {}),
|
|
887
991
|
})
|
|
888
|
-
const
|
|
992
|
+
const parsed = await readJsonResponse(res)
|
|
993
|
+
const json = parsed.json
|
|
889
994
|
if (!res.ok || !json || json.ok === false) {
|
|
890
|
-
throw new Error((
|
|
995
|
+
throw new Error(buildHttpErrorMessage(res, parsed))
|
|
891
996
|
}
|
|
892
997
|
const msg = typeof successMsgBuilder === 'function' ? successMsgBuilder(json) : ''
|
|
893
998
|
patch({ busyKey: '', notice: msg || '' })
|
|
@@ -906,6 +1011,37 @@ window.__ModuleLoader__.load({
|
|
|
906
1011
|
await postAction('/open', {}, 'open-desktop', (json) => json.message || '')
|
|
907
1012
|
}
|
|
908
1013
|
|
|
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
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
|
|
909
1045
|
function SvgIcon(props) {
|
|
910
1046
|
const size = props.size || 15
|
|
911
1047
|
return h(
|
|
@@ -1108,19 +1244,27 @@ window.__ModuleLoader__.load({
|
|
|
1108
1244
|
const releaseUrl = (data && data.releaseUrl) || RELEASE_FALLBACK
|
|
1109
1245
|
const repoUrl = (data && data.repoUrl) || REPO_FALLBACK
|
|
1110
1246
|
|
|
1111
|
-
const
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
const
|
|
1115
|
-
|
|
1116
|
-
|
|
1247
|
+
const activeProfile = (data && data.activeProfile) || (health && health.activeProfile) || 'web'
|
|
1248
|
+
const profileLabel = (name) => (name === 'desktop' ? t.desktopTrack : t.webTrack)
|
|
1249
|
+
|
|
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: [],
|
|
1260
|
+
}
|
|
1117
1261
|
const credentials = (health && health.credentials) || { present: false, count: 0, keys: [] }
|
|
1118
1262
|
const providers = Array.isArray(health && health.providers) ? health.providers : []
|
|
1119
1263
|
const issues = Array.isArray(health && health.issues) ? health.issues : []
|
|
1120
1264
|
const healthy = health ? Boolean(health.healthy) : true
|
|
1121
1265
|
|
|
1122
|
-
const activeExtProfile =
|
|
1123
|
-
const extTrack = (health && health.extensions && health.extensions[
|
|
1266
|
+
const activeExtProfile = activeProfile
|
|
1267
|
+
const extTrack = (health && health.extensions && health.extensions[activeProfile]) || {
|
|
1124
1268
|
plugins: [], mcpServers: [],
|
|
1125
1269
|
}
|
|
1126
1270
|
|
|
@@ -1136,9 +1280,43 @@ window.__ModuleLoader__.load({
|
|
|
1136
1280
|
String(p.primaryId || '').toLowerCase().includes(query),
|
|
1137
1281
|
)
|
|
1138
1282
|
|
|
1139
|
-
const totalExtCount = (
|
|
1283
|
+
const totalExtCount = (currentProf.thirdPartyCount || 0) + (currentProf.mcpCount || 0)
|
|
1140
1284
|
const credsSummaryVal = `${credentials.count || 0} / ${providers.length}`
|
|
1141
|
-
const
|
|
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
|
+
)
|
|
1142
1320
|
|
|
1143
1321
|
const renderOverviewTab = () =>
|
|
1144
1322
|
h(
|
|
@@ -1154,51 +1332,29 @@ window.__ModuleLoader__.load({
|
|
|
1154
1332
|
h('span', null, `${t.brokenLabel} (${totalBrokenLinks})`),
|
|
1155
1333
|
h(
|
|
1156
1334
|
'div',
|
|
1157
|
-
{ className: 'dshg-actions' },
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
)
|
|
1175
|
-
: null,
|
|
1176
|
-
deskProfile.brokenLinkCount > 0
|
|
1177
|
-
? h(
|
|
1178
|
-
'button',
|
|
1179
|
-
{
|
|
1180
|
-
type: 'button',
|
|
1181
|
-
className: 'dshg-btn dshg-btn-sm',
|
|
1182
|
-
disabled: Boolean(state.busyKey),
|
|
1183
|
-
onClick: () =>
|
|
1184
|
-
postAction(
|
|
1185
|
-
'/repair-links',
|
|
1186
|
-
{ target: 'desktop' },
|
|
1187
|
-
'repair-desk',
|
|
1188
|
-
(res) => `桌面端断链处理完成:修复 ${res.repairedCount},未解析 ${res.unresolvableCount}`,
|
|
1189
|
-
),
|
|
1190
|
-
},
|
|
1191
|
-
state.busyKey === 'repair-desk' ? t.repairingBtn : `${t.repairLinksBtn} (Desktop)`,
|
|
1192
|
-
)
|
|
1193
|
-
: null,
|
|
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
|
+
),
|
|
1194
1352
|
),
|
|
1195
1353
|
),
|
|
1196
1354
|
h(
|
|
1197
1355
|
'div',
|
|
1198
1356
|
{ className: 'dshg-pills' },
|
|
1199
|
-
...
|
|
1200
|
-
h('span', { key: `${b.name}-${i}`, className: 'dshg-pill' }, b.name),
|
|
1201
|
-
),
|
|
1357
|
+
...brokenLinks.map((b, i) => h('span', { key: `${b.name}-${i}`, className: 'dshg-pill' }, b.name)),
|
|
1202
1358
|
),
|
|
1203
1359
|
)
|
|
1204
1360
|
: null,
|
|
@@ -1209,30 +1365,52 @@ window.__ModuleLoader__.load({
|
|
|
1209
1365
|
h(
|
|
1210
1366
|
'div',
|
|
1211
1367
|
{ className: 'dshg-sec-head' },
|
|
1212
|
-
h('span', null, t.secProfiles),
|
|
1213
|
-
h(
|
|
1368
|
+
h('span', null, `${t.secProfiles} · ${profileLabel(activeProfile)}`),
|
|
1369
|
+
h(
|
|
1370
|
+
'span',
|
|
1371
|
+
{ className: 'dshg-badge', 'data-tone': currentProf.exists ? 'ok' : 'muted' },
|
|
1372
|
+
currentProf.exists ? t.present : t.absent,
|
|
1373
|
+
),
|
|
1214
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' },
|
|
1215
1384
|
h(
|
|
1216
1385
|
'div',
|
|
1217
|
-
{ className: 'dshg-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1386
|
+
{ className: 'dshg-sec-head' },
|
|
1387
|
+
h('span', null, `${t.contextCardTitle} (${profileLabel(activeCtxProfile.profile)})`),
|
|
1388
|
+
h(
|
|
1389
|
+
'span',
|
|
1390
|
+
{ className: 'dshg-badge', 'data-tone': levelTone(activeCtxProfile.level) },
|
|
1391
|
+
`${levelLabel(activeCtxProfile.level)} · ${t.contextTokens(activeCtxProfile.estimatedBaseTokens || 0)}`,
|
|
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' },
|
|
1406
|
+
h(
|
|
1407
|
+
'button',
|
|
1408
|
+
{
|
|
1409
|
+
type: 'button',
|
|
1410
|
+
className: 'dshg-btn dshg-btn-sm',
|
|
1411
|
+
onClick: () => patch({ tab: 'context' }),
|
|
1412
|
+
},
|
|
1413
|
+
t.quickGoContext,
|
|
1236
1414
|
),
|
|
1237
1415
|
),
|
|
1238
1416
|
),
|
|
@@ -1280,7 +1458,7 @@ window.__ModuleLoader__.load({
|
|
|
1280
1458
|
onClick: () =>
|
|
1281
1459
|
postAction(
|
|
1282
1460
|
'/snapshots/create',
|
|
1283
|
-
{ target:
|
|
1461
|
+
{ target: activeProfile, reason: `${activeProfile} 总览快捷备份` },
|
|
1284
1462
|
'quick-snap',
|
|
1285
1463
|
(res) => `已创建快照 ${res.snapshot.id}`,
|
|
1286
1464
|
),
|
|
@@ -1307,30 +1485,6 @@ window.__ModuleLoader__.load({
|
|
|
1307
1485
|
h(
|
|
1308
1486
|
'div',
|
|
1309
1487
|
{ className: 'dshg-toolbar' },
|
|
1310
|
-
h(
|
|
1311
|
-
'div',
|
|
1312
|
-
{ className: 'dshg-seg-2' },
|
|
1313
|
-
h(
|
|
1314
|
-
'button',
|
|
1315
|
-
{
|
|
1316
|
-
type: 'button',
|
|
1317
|
-
className: 'dshg-seg-btn',
|
|
1318
|
-
'data-active': activeExtProfile === 'web' ? 'true' : 'false',
|
|
1319
|
-
onClick: () => patch({ pluginProfile: 'web' }),
|
|
1320
|
-
},
|
|
1321
|
-
t.webTrack,
|
|
1322
|
-
),
|
|
1323
|
-
h(
|
|
1324
|
-
'button',
|
|
1325
|
-
{
|
|
1326
|
-
type: 'button',
|
|
1327
|
-
className: 'dshg-seg-btn',
|
|
1328
|
-
'data-active': activeExtProfile === 'desktop' ? 'true' : 'false',
|
|
1329
|
-
onClick: () => patch({ pluginProfile: 'desktop' }),
|
|
1330
|
-
},
|
|
1331
|
-
t.desktopTrack,
|
|
1332
|
-
),
|
|
1333
|
-
),
|
|
1334
1488
|
h(
|
|
1335
1489
|
'div',
|
|
1336
1490
|
{ className: 'dshg-search-wrap' },
|
|
@@ -1351,15 +1505,34 @@ window.__ModuleLoader__.load({
|
|
|
1351
1505
|
h(
|
|
1352
1506
|
'div',
|
|
1353
1507
|
{ className: 'dshg-sec-head' },
|
|
1354
|
-
h('span', null, t.mcpSectionTitle),
|
|
1355
|
-
h(
|
|
1508
|
+
h('span', null, `${t.mcpSectionTitle} (${filteredMcps.length})`),
|
|
1509
|
+
h(
|
|
1510
|
+
'button',
|
|
1511
|
+
{
|
|
1512
|
+
type: 'button',
|
|
1513
|
+
className: 'dshg-btn dshg-btn-sm',
|
|
1514
|
+
disabled: Boolean(state.busyKey || filteredMcps.length === 0),
|
|
1515
|
+
onClick: () => probeMcpsForProfile(activeExtProfile),
|
|
1516
|
+
},
|
|
1517
|
+
state.busyKey === 'probe-mcp' ? t.mcpProbingBtn : t.mcpProbeBtn,
|
|
1518
|
+
),
|
|
1356
1519
|
),
|
|
1357
1520
|
filteredMcps.length > 0
|
|
1358
1521
|
? h(
|
|
1359
1522
|
'div',
|
|
1360
1523
|
{ className: 'dshg-list' },
|
|
1361
|
-
...filteredMcps.map((m) =>
|
|
1362
|
-
|
|
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
|
|
1534
|
+
|
|
1535
|
+
return h(
|
|
1363
1536
|
'div',
|
|
1364
1537
|
{ key: m.id, className: 'dshg-item' },
|
|
1365
1538
|
h(
|
|
@@ -1373,24 +1546,93 @@ window.__ModuleLoader__.load({
|
|
|
1373
1546
|
{ className: 'dshg-item-title' },
|
|
1374
1547
|
h('span', null, m.serverName),
|
|
1375
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,
|
|
1376
1559
|
),
|
|
1377
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
|
+
}),
|
|
1378
1593
|
),
|
|
1379
|
-
h(ToggleSwitch, {
|
|
1380
|
-
on: m.enabled,
|
|
1381
|
-
busy: state.busyKey === `toggle-${m.id}`,
|
|
1382
|
-
title: m.serverName,
|
|
1383
|
-
onToggle: () =>
|
|
1384
|
-
postAction(
|
|
1385
|
-
'/toggle-entry',
|
|
1386
|
-
{ target: activeExtProfile, id: m.id, disabled: m.enabled },
|
|
1387
|
-
`toggle-${m.id}`,
|
|
1388
|
-
(res) => res.restartHint,
|
|
1389
|
-
),
|
|
1390
|
-
}),
|
|
1391
1594
|
),
|
|
1392
|
-
|
|
1393
|
-
|
|
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
|
+
}),
|
|
1394
1636
|
)
|
|
1395
1637
|
: h('div', { className: 'dshg-sec-sub' }, t.mcpEmpty),
|
|
1396
1638
|
),
|
|
@@ -1461,6 +1703,162 @@ window.__ModuleLoader__.load({
|
|
|
1461
1703
|
}),
|
|
1462
1704
|
)
|
|
1463
1705
|
|
|
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)})`),
|
|
1717
|
+
h(
|
|
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) =>
|
|
1749
|
+
h(
|
|
1750
|
+
'div',
|
|
1751
|
+
{ key: f.id, className: 'dshg-row' },
|
|
1752
|
+
h('span', { className: 'dshg-mono' }, f.label),
|
|
1753
|
+
h(
|
|
1754
|
+
'span',
|
|
1755
|
+
{ className: 'dshg-badge', 'data-tone': f.exists ? 'muted' : 'ok' },
|
|
1756
|
+
f.exists ? t.promptsBytes(f.bytes, f.estTokens) : t.absent,
|
|
1757
|
+
),
|
|
1758
|
+
),
|
|
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(
|
|
1794
|
+
'div',
|
|
1795
|
+
{ key: sk.id, className: 'dshg-item' },
|
|
1796
|
+
h(
|
|
1797
|
+
'div',
|
|
1798
|
+
{ className: 'dshg-item-row' },
|
|
1799
|
+
h(
|
|
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,
|
|
1813
|
+
),
|
|
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
|
+
|
|
1464
1862
|
const renderCredsTab = () =>
|
|
1465
1863
|
h(
|
|
1466
1864
|
'div',
|
|
@@ -1588,6 +1986,21 @@ window.__ModuleLoader__.load({
|
|
|
1588
1986
|
? h(
|
|
1589
1987
|
'div',
|
|
1590
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
|
+
),
|
|
1591
2004
|
h('input', {
|
|
1592
2005
|
type: 'text',
|
|
1593
2006
|
className: 'dshg-input',
|
|
@@ -1693,28 +2106,12 @@ window.__ModuleLoader__.load({
|
|
|
1693
2106
|
onClick: () =>
|
|
1694
2107
|
postAction(
|
|
1695
2108
|
'/snapshots/create',
|
|
1696
|
-
{ target:
|
|
1697
|
-
'snap-
|
|
1698
|
-
(res) =>
|
|
1699
|
-
),
|
|
1700
|
-
},
|
|
1701
|
-
state.busyKey === 'snap-web' ? t.snapCreating : t.snapCreateWeb,
|
|
1702
|
-
),
|
|
1703
|
-
h(
|
|
1704
|
-
'button',
|
|
1705
|
-
{
|
|
1706
|
-
type: 'button',
|
|
1707
|
-
className: 'dshg-btn dshg-btn-sm',
|
|
1708
|
-
disabled: Boolean(state.busyKey),
|
|
1709
|
-
onClick: () =>
|
|
1710
|
-
postAction(
|
|
1711
|
-
'/snapshots/create',
|
|
1712
|
-
{ target: 'desktop', reason: '桌面端手动备份' },
|
|
1713
|
-
'snap-desktop',
|
|
1714
|
-
(res) => `已创建桌面端快照 ${res.snapshot.id}`,
|
|
2109
|
+
{ target: activeProfile, reason: `${activeProfile} 手动备份` },
|
|
2110
|
+
'snap-create',
|
|
2111
|
+
(res) => `已创建快照 ${res.snapshot.id}`,
|
|
1715
2112
|
),
|
|
1716
2113
|
},
|
|
1717
|
-
state.busyKey === 'snap-
|
|
2114
|
+
state.busyKey === 'snap-create' ? t.snapCreating : t.snapCreateTargetBtn,
|
|
1718
2115
|
),
|
|
1719
2116
|
),
|
|
1720
2117
|
|
|
@@ -1733,7 +2130,7 @@ window.__ModuleLoader__.load({
|
|
|
1733
2130
|
{ className: 'dshg-list' },
|
|
1734
2131
|
...snapshots.snapshots.map((s) => {
|
|
1735
2132
|
const expanded = Boolean(state.expandedSnaps[s.id])
|
|
1736
|
-
const trackColor = s.target === 'desktop' ? '#f59e0b' : '#3b82f6'
|
|
2133
|
+
const trackColor = s.target === 'desktop' ? '#f59e0b' : s.target === 'all' ? '#10b981' : '#3b82f6'
|
|
1737
2134
|
const fileStatusLabel = (st) =>
|
|
1738
2135
|
st === 'same' ? t.fileSame : st === 'modified' ? t.fileModified : st === 'missing_now' ? t.fileMissing : t.fileUnknown
|
|
1739
2136
|
const fileTone = (st) =>
|
|
@@ -1754,6 +2151,9 @@ window.__ModuleLoader__.load({
|
|
|
1754
2151
|
h('span', { className: 'dshg-track-dot', style: { background: trackColor } }),
|
|
1755
2152
|
h('span', null, s.reason || s.id),
|
|
1756
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,
|
|
1757
2157
|
),
|
|
1758
2158
|
h('div', { className: 'dshg-mono' }, `${s.target} · ${formatTimeShort(s.createdAt)} · ${s.itemCount} files`),
|
|
1759
2159
|
),
|
|
@@ -1765,18 +2165,40 @@ window.__ModuleLoader__.load({
|
|
|
1765
2165
|
),
|
|
1766
2166
|
h(
|
|
1767
2167
|
'div',
|
|
1768
|
-
{ className: 'dshg-actions', style: { justifyContent: 'space-between', marginTop: 2 } },
|
|
2168
|
+
{ className: 'dshg-actions', style: { justifyContent: 'space-between', marginTop: 2, flexWrap: 'wrap' } },
|
|
1769
2169
|
h(
|
|
1770
|
-
'
|
|
1771
|
-
{
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
2170
|
+
'div',
|
|
2171
|
+
{ className: 'dshg-actions' },
|
|
2172
|
+
h(
|
|
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),
|
|
2183
|
+
),
|
|
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,
|
|
1780
2202
|
),
|
|
1781
2203
|
s.restorableCount > 0
|
|
1782
2204
|
? h(
|
|
@@ -1824,6 +2246,31 @@ window.__ModuleLoader__.load({
|
|
|
1824
2246
|
),
|
|
1825
2247
|
),
|
|
1826
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),
|
|
2268
|
+
),
|
|
2269
|
+
)
|
|
2270
|
+
: h('div', { className: 'dshg-sec-sub' }, t.auditEmpty),
|
|
2271
|
+
),
|
|
2272
|
+
),
|
|
2273
|
+
|
|
1827
2274
|
h(BoundaryDisclosure, {
|
|
1828
2275
|
summary: t.boundarySnapsSummary,
|
|
1829
2276
|
p1: t.boundarySnapsP1,
|
|
@@ -1906,10 +2353,20 @@ window.__ModuleLoader__.load({
|
|
|
1906
2353
|
'div',
|
|
1907
2354
|
{ className: 'dshg-row' },
|
|
1908
2355
|
h(
|
|
1909
|
-
'
|
|
1910
|
-
{ className: 'dshg-
|
|
1911
|
-
h(
|
|
1912
|
-
|
|
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
|
+
),
|
|
1913
2370
|
),
|
|
1914
2371
|
state.checkedAt
|
|
1915
2372
|
? h('span', { style: { fontSize: 11, color: 'var(--dshg-text-3)' } }, t.checkedAt(formatTimeShort(state.checkedAt)))
|
|
@@ -1969,7 +2426,7 @@ window.__ModuleLoader__.load({
|
|
|
1969
2426
|
)
|
|
1970
2427
|
: null,
|
|
1971
2428
|
|
|
1972
|
-
// Segmented
|
|
2429
|
+
// Segmented 5-Tab Bar
|
|
1973
2430
|
data
|
|
1974
2431
|
? h(
|
|
1975
2432
|
'div',
|
|
@@ -1977,6 +2434,7 @@ window.__ModuleLoader__.load({
|
|
|
1977
2434
|
...[
|
|
1978
2435
|
['overview', t.tabOverview],
|
|
1979
2436
|
['plugins', t.tabPlugins],
|
|
2437
|
+
['context', t.tabContext],
|
|
1980
2438
|
['creds', t.tabCreds],
|
|
1981
2439
|
['snapshots', t.tabSnapshots],
|
|
1982
2440
|
].map(([id, label]) =>
|
|
@@ -2010,6 +2468,7 @@ window.__ModuleLoader__.load({
|
|
|
2010
2468
|
|
|
2011
2469
|
data && state.tab === 'overview' ? renderOverviewTab() : null,
|
|
2012
2470
|
data && state.tab === 'plugins' ? renderPluginsTab() : null,
|
|
2471
|
+
data && state.tab === 'context' ? renderContextTab() : null,
|
|
2013
2472
|
data && state.tab === 'creds' ? renderCredsTab() : null,
|
|
2014
2473
|
data && state.tab === 'snapshots' ? renderSnapshotsTab() : null,
|
|
2015
2474
|
|