dsh-plugin-workspace-capabilities 0.0.0-stage → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client.js ADDED
@@ -0,0 +1,488 @@
1
+ window.__ModuleLoader__.load({
2
+ id: 'dsh-plugin-workspace-capabilities',
3
+ factory: require => {
4
+ const React = require('react'), h = React.createElement;
5
+ /* i18n:start */
6
+ const NS="capabilityDesk";
7
+ const zh={
8
+ " · 当前使用工作区规则": " · 当前使用工作区规则",
9
+ " · 当前继承全局": " · 当前继承全局",
10
+ " 个工具": " 个工具",
11
+ " 条…": " 条…",
12
+ " 规则": " 规则",
13
+ "/home/用户名/项目": "/home/用户名/项目",
14
+ "DSH 原生连接": "DSH 原生连接",
15
+ "Skill 与 MCP": "Skill 与 MCP",
16
+ "使用当前模型重新翻译并更新缓存": "使用当前模型重新翻译并更新缓存",
17
+ "使用默认": "使用默认",
18
+ "保存语言": "保存语言",
19
+ "全局规则将应用到未单独设置的工作区。": "全局规则将应用到未单独设置的工作区。",
20
+ "全局默认": "全局默认",
21
+ "全局:": "全局:",
22
+ "切换到该来源工作区后可设置。": "切换到该来源工作区后可设置。",
23
+ "原生配置/未发现工具": "原生配置/未发现工具",
24
+ "发现列表已刷新。": "发现列表已刷新。",
25
+ "发现过程中的问题 (": "发现过程中的问题 (",
26
+ "可用": "可用",
27
+ "可选读取 CC Switch 共享 Skill 目录,以及 Codex、Claude、Cursor 配置。扫描只读取来源;新能力默认禁用,MCP 首次连接仍需批准。": "可选读取 CC Switch 共享 Skill 目录,以及 Codex、Claude、Cursor 配置。扫描只读取来源;新能力默认禁用,MCP 首次连接仍需批准。",
28
+ "启用": "启用",
29
+ "工作区绝对路径": "工作区绝对路径",
30
+ "工作区:": "工作区:",
31
+ "工具说明 (": "工具说明 (",
32
+ "已保存,当前及后续 Agent 调用即时使用新规则。": "已保存,当前及后续 Agent 调用即时使用新规则。",
33
+ "已处理 {p0} 条,{p1} 条已是目标语言 · {p2}": "已处理 {p0} 条,{p1} 条已是目标语言 · {p2}",
34
+ "已批准的 MCP 默认启用": "已批准的 MCP 默认启用",
35
+ "已是目标语言": "已是目标语言",
36
+ "已禁用": "已禁用",
37
+ "已连接": "已连接",
38
+ "已连接/暂无工具": "已连接/暂无工具",
39
+ "当前范围未发现 MCP。DSH 配置和工作区 .dsh/mcp.json 会自动发现;其他应用需打开上方扫描开关。": "当前范围未发现 MCP。DSH 配置和工作区 .dsh/mcp.json 会自动发现;其他应用需打开上方扫描开关。",
40
+ "当前范围未发现 Skill。这里展示 DeepSeek 已注册的 Skill;其他应用需打开上方扫描开关。": "当前范围未发现 Skill。这里展示 DeepSeek 已注册的 Skill;其他应用需打开上方扫描开关。",
41
+ "待批准": "待批准",
42
+ "所属工作区:": "所属工作区:",
43
+ "扫描其他应用的 Skill / MCP(全局)": "扫描其他应用的 Skill / MCP(全局)",
44
+ "批准配置并启用连接": "批准配置并启用连接",
45
+ "搜索名称、说明或来源路径": "搜索名称、说明或来源路径",
46
+ "搜索能力": "搜索能力",
47
+ "新发现的 Skill 默认启用": "新发现的 Skill 默认启用",
48
+ "日本語": "日本語",
49
+ "显示译文": "显示译文",
50
+ "未连接": "未连接",
51
+ "来源:": "来源:",
52
+ "查看原文": "查看原文",
53
+ "查看译文": "查看译文",
54
+ "正在翻译 ": "正在翻译 ",
55
+ "正在读取能力列表…": "正在读取能力列表…",
56
+ "正在重新翻译 ": "正在重新翻译 ",
57
+ "此配置已批准;修改源配置后需要重新批准。": "此配置已批准;修改源配置后需要重新批准。",
58
+ "没有匹配的能力。": "没有匹配的能力。",
59
+ "添加工作区": "添加工作区",
60
+ "添加已有目录的工作区规则": "添加已有目录的工作区规则",
61
+ "点击后使用当前界面所选模型翻译名称和说明,结果保存在本地缓存。同语默认保留原文,单项按钮可强制翻译。原始标识符和 Agent 调用保持不变。": "点击后使用当前界面所选模型翻译名称和说明,结果保存在本地缓存。同语默认保留原文,单项按钮可强制翻译。原始标识符和 Agent 调用保持不变。",
62
+ "环境变量名称:": "环境变量名称:",
63
+ "禁用": "禁用",
64
+ "简体中文": "简体中文",
65
+ "繁體中文": "繁體中文",
66
+ "继承全局": "继承全局",
67
+ "翻译当前列表": "翻译当前列表",
68
+ "翻译成": "翻译成",
69
+ "翻译模型:": "翻译模型:",
70
+ "翻译目标语言已保存。": "翻译目标语言已保存。",
71
+ "翻译目标语言未保存,请刷新后重试。": "翻译目标语言未保存,请刷新后重试。",
72
+ "翻译说明": "翻译说明",
73
+ "能力类型": "能力类型",
74
+ "规则范围": "规则范围",
75
+ "请先选择模型": "请先选择模型",
76
+ "请求失败": "请求失败",
77
+ "跟随界面语言": "跟随界面语言",
78
+ "这些规则控制 Agent 的 Skill 加载和 MCP 调用;源文件不会被修改。设置已持久保存,服务重启后仍然有效。": "这些规则控制 Agent 的 Skill 加载和 MCP 调用;源文件不会被修改。设置已持久保存,服务重启后仍然有效。",
79
+ "这里的全局与工作区规则仅作用于 DeepSeek Harness。默认只发现 DSH 自身的 Skill 和 MCP;其他应用来源可以单独开启。": "这里的全局与工作区规则仅作用于 DeepSeek Harness。默认只发现 DSH 自身的 Skill 和 MCP;其他应用来源可以单独开启。",
80
+ "连接中": "连接中",
81
+ "连接失败,请检查源配置或重新启用": "连接失败,请检查源配置或重新启用",
82
+ "部分 Skill 目录尚未完成扫描,请重新发现。": "部分 Skill 目录尚未完成扫描,请重新发现。",
83
+ "重新发现": "重新发现",
84
+ "重新翻译": "重新翻译",
85
+ "重新翻译 ": "重新翻译 ",
86
+ "(跟随当前界面)": "(跟随当前界面)",
87
+ "服务配置必须是对象。": "服务配置必须是对象。",
88
+ "源配置中已禁用,请先在源配置中启用。": "源配置中已禁用,请先在源配置中启用。",
89
+ "此版本仅支持 stdio 和 Streamable HTTP。": "此版本仅支持 stdio 和 Streamable HTTP。",
90
+ "args 必须是字符串数组。": "args 必须是字符串数组。",
91
+ "env 必须是字符串字典。": "env 必须是字符串字典。",
92
+ "HTTP 服务地址无效。": "HTTP 服务地址无效。",
93
+ "headers 必须是字符串字典。": "headers 必须是字符串字典。",
94
+ "未发现 command 或 url。": "未发现 command 或 url。",
95
+ "DSH 服务环境中缺少配置引用的环境变量。": "DSH 服务环境中缺少配置引用的环境变量。",
96
+ "文件超过 2 MiB,已跳过。": "文件超过 2 MiB,已跳过。",
97
+ "YAML 解析失败。": "YAML 解析失败。",
98
+ "请求超过 64 KiB。": "请求超过 64 KiB。",
99
+ "请求不是有效的 JSON 对象。": "请求不是有效的 JSON 对象。",
100
+ "工作区必须是绝对路径。": "工作区必须是绝对路径。",
101
+ "工作区目录不存在或不可访问。": "工作区目录不存在或不可访问。",
102
+ "能力类型无效。": "能力类型无效。",
103
+ "未发现此能力,请重新扫描。": "未发现此能力,请重新扫描。",
104
+ "规则必须为启用、禁用或继承。": "规则必须为启用、禁用或继承。",
105
+ "此 MCP 来源于另一工作区,仅能在来源工作区启用。": "此 MCP 来源于另一工作区,仅能在来源工作区启用。",
106
+ "批准连接参数无效。": "批准连接参数无效。",
107
+ "源配置已改变,请重新检查并批准。": "源配置已改变,请重新检查并批准。",
108
+ "发现来源开关无效。": "发现来源开关无效。",
109
+ "请选择工作区。": "请选择工作区。",
110
+ "默认规则无效。": "默认规则无效。",
111
+ "操作无效。": "操作无效。",
112
+ "翻译服务尚未就绪。": "翻译服务尚未就绪。",
113
+ "重新翻译参数无效。": "重新翻译参数无效。",
114
+ "每次请选择 1–12 条说明。": "每次请选择 1–12 条说明。",
115
+ "该能力已不在当前发现范围,请刷新后重试。": "该能力已不在当前发现范围,请刷新后重试。",
116
+ "请求必须使用 application/json。": "请求必须使用 application/json。",
117
+ "设置已在别处更新,请刷新后重试。": "设置已在别处更新,请刷新后重试。",
118
+ "翻译目标语言无效,最多 160 字符。": "翻译目标语言无效,最多 160 字符。",
119
+ "模型返回的翻译格式不完整,请重试。": "模型返回的翻译格式不完整,请重试。",
120
+ "模型未执行强制翻译,请重试。": "模型未执行强制翻译,请重试。",
121
+ "请先在 DeepSeek 界面选择可用的模型。": "请先在 DeepSeek 界面选择可用的模型。",
122
+ "当前界面所选模型的服务尚未就绪。": "当前界面所选模型的服务尚未就绪。",
123
+ "每次最多翻译 12 条能力说明。": "每次最多翻译 12 条能力说明。",
124
+ "另一批翻译正在进行,请稍后重试。": "另一批翻译正在进行,请稍后重试。",
125
+ "模型未完成翻译,请重试或减少翻译条数。": "模型未完成翻译,请重试或减少翻译条数。",
126
+ "模型返回的翻译过长。": "模型返回的翻译过长。",
127
+ "模型未返回有效的翻译 JSON,请重试。": "模型未返回有效的翻译 JSON,请重试。",
128
+ "模型遗漏了部分翻译,请重试。": "模型遗漏了部分翻译,请重试。",
129
+ "请使用受信任的 Harness 页面访问设置。": "请使用受信任的 Harness 页面访问设置。",
130
+ "操作未完成,请刷新后重试。": "操作未完成,请刷新后重试。",
131
+ "操作未完成,请重试。": "操作未完成,请重试。",
132
+ "翻译已取消或超时,请重试。": "翻译已取消或超时,请重试。",
133
+ "当前模型翻译失败,请检查 DeepSeek 的模型连接后重试。": "当前模型翻译失败,请检查 DeepSeek 的模型连接后重试。",
134
+ "策略文件无法读取,Skill 和 MCP 已暂停。请恢复 policy.json 备份后重启服务。": "策略文件无法读取,Skill 和 MCP 已暂停。请恢复 policy.json 备份后重启服务。"
135
+ };
136
+ const en={
137
+ " · 当前使用工作区规则": " · Using workspace rules",
138
+ " · 当前继承全局": " · Inheriting global rules",
139
+ " 个工具": " tools",
140
+ " 条…": " entries…",
141
+ " 规则": " rule",
142
+ "/home/用户名/项目": "/home/user/project",
143
+ "DSH 原生连接": "DSH native connection",
144
+ "Skill 与 MCP": "Skills & MCP",
145
+ "使用当前模型重新翻译并更新缓存": "Regenerate with the current model and update the cache",
146
+ "使用默认": "Use default",
147
+ "保存语言": "Save language",
148
+ "全局规则将应用到未单独设置的工作区。": "Global rules apply to workspaces without an override.",
149
+ "全局默认": "Global default",
150
+ "全局:": "Global: ",
151
+ "切换到该来源工作区后可设置。": "Switch to the source workspace to configure it.",
152
+ "原生配置/未发现工具": "Native configuration / no tools discovered",
153
+ "发现列表已刷新。": "Discovery list refreshed.",
154
+ "发现过程中的问题 (": "Discovery issues (",
155
+ "可用": "Available",
156
+ "可选读取 CC Switch 共享 Skill 目录,以及 Codex、Claude、Cursor 配置。扫描只读取来源;新能力默认禁用,MCP 首次连接仍需批准。": "Optionally read shared CC Switch Skills and Codex, Claude, and Cursor configuration. Scanning only reads sources; new capabilities default to disabled, and the first MCP connection requires approval.",
157
+ "启用": "Enable",
158
+ "工作区绝对路径": "Absolute workspace path",
159
+ "工作区:": "Workspace: ",
160
+ "工具说明 (": "Tool descriptions (",
161
+ "已保存,当前及后续 Agent 调用即时使用新规则。": "Saved. Current and subsequent Agent calls use the new rules immediately.",
162
+ "已处理 {p0} 条,{p1} 条已是目标语言 · {p2}": "Processed {p0} entries; {p1} already in the target language · {p2}",
163
+ "已批准的 MCP 默认启用": "Enable approved MCP by default",
164
+ "已是目标语言": "Already in the target language",
165
+ "已禁用": "Disabled",
166
+ "已连接": "Connected",
167
+ "已连接/暂无工具": "Connected / no tools",
168
+ "当前范围未发现 MCP。DSH 配置和工作区 .dsh/mcp.json 会自动发现;其他应用需打开上方扫描开关。": "No MCP discovered in this scope. DSH configuration and workspace .dsh/mcp.json are discovered automatically; enable the scan option for other applications.",
169
+ "当前范围未发现 Skill。这里展示 DeepSeek 已注册的 Skill;其他应用需打开上方扫描开关。": "No Skills discovered in this scope. This list shows Skills registered with DeepSeek; enable the scan option for other applications.",
170
+ "待批准": "Approval needed",
171
+ "所属工作区:": "Workspace: ",
172
+ "扫描其他应用的 Skill / MCP(全局)": "Scan other applications' Skills / MCP (global)",
173
+ "批准配置并启用连接": "Approve configuration and enable connection",
174
+ "搜索名称、说明或来源路径": "Search names, descriptions, or source paths",
175
+ "搜索能力": "Search capabilities",
176
+ "新发现的 Skill 默认启用": "Enable newly discovered Skills by default",
177
+ "日本語": "Japanese",
178
+ "显示译文": "Show translations",
179
+ "未连接": "Disconnected",
180
+ "来源:": "Source: ",
181
+ "查看原文": "Show original",
182
+ "查看译文": "Show translation",
183
+ "正在翻译 ": "Translating ",
184
+ "正在读取能力列表…": "Loading capabilities…",
185
+ "正在重新翻译 ": "Retranslating ",
186
+ "此配置已批准;修改源配置后需要重新批准。": "Approved. Changes to the source configuration require approval again.",
187
+ "没有匹配的能力。": "No matching capabilities.",
188
+ "添加工作区": "Add workspace",
189
+ "添加已有目录的工作区规则": "Add rules for an existing workspace folder",
190
+ "点击后使用当前界面所选模型翻译名称和说明,结果保存在本地缓存。同语默认保留原文,单项按钮可强制翻译。原始标识符和 Agent 调用保持不变。": "Translate names and descriptions with the selected model and cache results locally. Text already in the target language stays unchanged unless translated individually. Identifiers and Agent calls remain unchanged.",
191
+ "环境变量名称:": "Environment variable names: ",
192
+ "禁用": "Disable",
193
+ "简体中文": "Simplified Chinese",
194
+ "繁體中文": "Traditional Chinese",
195
+ "继承全局": "Inherit global",
196
+ "翻译当前列表": "Translate this list",
197
+ "翻译成": "Translate into",
198
+ "翻译模型:": "Translation model: ",
199
+ "翻译目标语言已保存。": "Translation target saved.",
200
+ "翻译目标语言未保存,请刷新后重试。": "Translation target was not saved. Refresh and try again.",
201
+ "翻译说明": "Translate description",
202
+ "能力类型": "Capability type",
203
+ "规则范围": "Rule scope",
204
+ "请先选择模型": "Select a model first",
205
+ "请求失败": "Request failed",
206
+ "跟随界面语言": "Follow interface language",
207
+ "这些规则控制 Agent 的 Skill 加载和 MCP 调用;源文件不会被修改。设置已持久保存,服务重启后仍然有效。": "These rules control Agent Skill loading and MCP calls without changing source files. Settings persist across service restarts.",
208
+ "这里的全局与工作区规则仅作用于 DeepSeek Harness。默认只发现 DSH 自身的 Skill 和 MCP;其他应用来源可以单独开启。": "Global and workspace rules apply to DeepSeek Harness. DSH's own Skills and MCP are discovered by default; other application sources are optional.",
209
+ "连接中": "Connecting",
210
+ "连接失败,请检查源配置或重新启用": "Connection failed; check the configuration or enable it again",
211
+ "部分 Skill 目录尚未完成扫描,请重新发现。": "Some Skill folders have not finished scanning. Discover again.",
212
+ "重新发现": "Discover again",
213
+ "重新翻译": "Retranslate",
214
+ "重新翻译 ": "Retranslate ",
215
+ "(跟随当前界面)": " (current interface selection)",
216
+ "服务配置必须是对象。": "Server configuration must be an object.",
217
+ "源配置中已禁用,请先在源配置中启用。": "Disabled in the source configuration. Enable it there first.",
218
+ "此版本仅支持 stdio 和 Streamable HTTP。": "This version supports stdio and Streamable HTTP only.",
219
+ "args 必须是字符串数组。": "args must be a string array.",
220
+ "env 必须是字符串字典。": "env must be a string dictionary.",
221
+ "HTTP 服务地址无效。": "Invalid HTTP server URL.",
222
+ "headers 必须是字符串字典。": "headers must be a string dictionary.",
223
+ "未发现 command 或 url。": "No command or URL found.",
224
+ "DSH 服务环境中缺少配置引用的环境变量。": "A referenced environment variable is missing from the DSH service environment.",
225
+ "文件超过 2 MiB,已跳过。": "File exceeds 2 MiB and was skipped.",
226
+ "YAML 解析失败。": "Could not parse YAML.",
227
+ "请求超过 64 KiB。": "Request exceeds 64 KiB.",
228
+ "请求不是有效的 JSON 对象。": "Request is not a valid JSON object.",
229
+ "工作区必须是绝对路径。": "Workspace must be an absolute path.",
230
+ "工作区目录不存在或不可访问。": "Workspace folder is missing or inaccessible.",
231
+ "能力类型无效。": "Invalid capability type.",
232
+ "未发现此能力,请重新扫描。": "Capability was not discovered. Scan again.",
233
+ "规则必须为启用、禁用或继承。": "Rule must be enabled, disabled, or inherited.",
234
+ "此 MCP 来源于另一工作区,仅能在来源工作区启用。": "This MCP belongs to another workspace and can only be enabled there.",
235
+ "批准连接参数无效。": "Invalid connection approval parameters.",
236
+ "源配置已改变,请重新检查并批准。": "Source configuration changed. Review and approve it again.",
237
+ "发现来源开关无效。": "Invalid discovery source option.",
238
+ "请选择工作区。": "Choose a workspace.",
239
+ "默认规则无效。": "Invalid default rule.",
240
+ "操作无效。": "Invalid operation.",
241
+ "翻译服务尚未就绪。": "Translation service is not ready.",
242
+ "重新翻译参数无效。": "Invalid retranslation parameter.",
243
+ "每次请选择 1–12 条说明。": "Select 1–12 descriptions per request.",
244
+ "该能力已不在当前发现范围,请刷新后重试。": "Capability is no longer in this discovery scope. Refresh and try again.",
245
+ "请求必须使用 application/json。": "Requests must use application/json.",
246
+ "设置已在别处更新,请刷新后重试。": "Settings changed elsewhere. Refresh and try again.",
247
+ "翻译目标语言无效,最多 160 字符。": "Invalid translation target; use at most 160 characters.",
248
+ "模型返回的翻译格式不完整,请重试。": "Model returned an incomplete translation. Retry.",
249
+ "模型未执行强制翻译,请重试。": "Model did not perform the forced translation. Retry.",
250
+ "请先在 DeepSeek 界面选择可用的模型。": "Select an available model in the DeepSeek interface first.",
251
+ "当前界面所选模型的服务尚未就绪。": "The selected model's service is not ready.",
252
+ "每次最多翻译 12 条能力说明。": "Translate at most 12 capability descriptions per request.",
253
+ "另一批翻译正在进行,请稍后重试。": "Another translation batch is in progress. Try again later.",
254
+ "模型未完成翻译,请重试或减少翻译条数。": "Model did not finish translating. Retry or reduce the batch size.",
255
+ "模型返回的翻译过长。": "Model translation response is too long.",
256
+ "模型未返回有效的翻译 JSON,请重试。": "Model did not return valid translation JSON. Retry.",
257
+ "模型遗漏了部分翻译,请重试。": "Model omitted some translations. Retry.",
258
+ "请使用受信任的 Harness 页面访问设置。": "Open settings from a trusted Harness page.",
259
+ "操作未完成,请刷新后重试。": "Operation did not complete. Refresh and retry.",
260
+ "操作未完成,请重试。": "Operation did not complete. Retry.",
261
+ "翻译已取消或超时,请重试。": "Translation was cancelled or timed out. Retry.",
262
+ "当前模型翻译失败,请检查 DeepSeek 的模型连接后重试。": "Translation failed. Check the DeepSeek model connection and retry.",
263
+ "策略文件无法读取,Skill 和 MCP 已暂停。请恢复 policy.json 备份后重启服务。": "Policy file is unreadable; Skills and MCP are paused. Restore the policy.json backup and restart."
264
+ };
265
+ let nativeTranslate = null, nativeLocale = null;
266
+ function tr(key, params) { return nativeTranslate ? nativeTranslate(key, params) : params ? key.replace(/\{(\w+)\}/g, (match, name) => name in params ? String(params[name]) : match) : key; }
267
+ function localeId() { const id = nativeLocale?.getSnapshot().active ?? 'zh'; try { return new Intl.Locale(id === 'zh' ? 'zh-CN' : id === 'pt' ? 'pt-BR' : id).toString(); } catch { return 'en'; } }
268
+ const escapePattern = value => [...value].map(c => c === String.fromCharCode(92) || '^$.*+?()[]{}|'.includes(c) ? String.fromCharCode(92) + c : c).join('');
269
+ const messagePatterns = Object.entries(zh).flatMap(([key, value]) => [value, en[key]].filter(text => text && /\{p\d+\}/.test(text)).map(text => ({key, names: [...text.matchAll(/\{(p\d+)\}/g)].map(match => match[1]), pattern: new RegExp('^' + text.split(/\{p\d+\}/).map(escapePattern).join('(.*?)') + '$', 's')})));
270
+ function messageText(value) {
271
+ if (!value) return '';
272
+ if (value.localized) return tr(value.localized.key, value.localized.params);
273
+ const text = typeof value === 'string' ? value : value.message ?? String(value);
274
+ if (Object.hasOwn(zh, text)) return tr(text);
275
+ const reverse = Object.keys(en).find(key => en[key] === text); if (reverse) return tr(reverse);
276
+ const prefix = text.match(/^(?:Error: |[A-Z_]+: )/)?.[0] ?? '', body = text.slice(prefix.length);
277
+ if (Object.hasOwn(zh, body)) return prefix + tr(body);
278
+ for (const row of messagePatterns) { const match = row.pattern.exec(body); if (match) return prefix + tr(row.key, Object.fromEntries(row.names.map((name, i) => [name, match[i + 1]]))); }
279
+ return text;
280
+ }
281
+ function installLocale(ctx) {
282
+ const release = ctx.locale.register(NS, { zh, en }), bound = ctx.locale.bind(NS);
283
+ nativeTranslate = bound; nativeLocale = ctx.locale;
284
+ return () => { if (nativeTranslate === bound) { nativeTranslate = null; nativeLocale = null; } release(); };
285
+ }
286
+ /* i18n:end */
287
+ const BASE = '/workspace-capabilities/v1';
288
+ const css = `
289
+ .wc-page{box-sizing:border-box;width:100%;min-width:0;color:var(--dsw-alias-label-primary);display:flex;flex-direction:column;gap:14px;padding:6px 0;font-size:13px;line-height:1.6}
290
+ .wc-page *{box-sizing:border-box}.wc-page h2{font-size:18px;margin:0}.wc-page p{margin:0}.wc-muted{color:var(--dsw-alias-label-secondary);font-size:12px;overflow-wrap:anywhere}
291
+ .wc-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap;min-width:0}.wc-row>.wc-grow{flex:1;min-width:160px}
292
+ .wc-scope-controls,.wc-language-controls{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end}.wc-scope-controls>.wc-grow,.wc-language-controls>.wc-grow{min-width:0}
293
+ .wc-scope-controls select,.wc-scope-controls>button,.wc-language-controls input,.wc-language-controls>button{height:38px}
294
+ .wc-page button,.wc-page select,.wc-page input{font:inherit;color:inherit;background:var(--dsw-alias-bg-module-platform,#292a2b);border:1px solid var(--dsw-alias-border-l2,#48494b);border-radius:8px;min-height:36px;padding:7px 10px;min-width:0;max-width:100%}
295
+ .wc-page button{cursor:pointer}.wc-page button:disabled,.wc-page select:disabled{opacity:.5;cursor:default}.wc-page :focus-visible{outline:2px solid #8baeff;outline-offset:2px}
296
+ .wc-page label{display:flex;flex-direction:column;gap:6px}.wc-card{border:1px solid var(--dsw-alias-border-l2,#48494b);border-radius:12px;padding:13px;display:flex;flex-direction:column;gap:9px;min-width:0}
297
+ .wc-tabs button[aria-selected=true]{background:color-mix(in srgb,#759ce8 18%,transparent);border-color:#759ce8}.wc-name{font-size:14px;font-weight:600;overflow-wrap:anywhere;min-width:0;flex:1}
298
+ .wc-badge{font-size:11px;border-radius:16px;padding:2px 8px;background:color-mix(in srgb,#888 17%,transparent);white-space:nowrap}.wc-on{color:#85d0a5}.wc-off{color:var(--dsw-alias-label-secondary)}
299
+ .wc-error{color:#ff99a2;white-space:pre-wrap;overflow-wrap:anywhere}.wc-success{color:#85d0a5;font-size:12px}.wc-description{overflow-wrap:anywhere;font-size:12px}.wc-source{font-size:11px;color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}
300
+ .wc-translated{white-space:pre-wrap;overflow-wrap:anywhere}.wc-translated-title{font-size:13px;font-weight:500;color:var(--dsw-alias-label-secondary)}.wc-tools{display:flex;flex-direction:column;gap:10px}.wc-tool{border-top:1px solid var(--dsw-alias-border-l2);padding-top:9px;min-width:0}.wc-progress{font-size:12px;color:#8baeff;overflow-wrap:anywhere}
301
+ .wc-translation-actions{display:flex;align-items:center;justify-content:flex-end;gap:6px;min-width:0;margin-top:2px}.wc-page .wc-translation-actions button{display:inline-flex;align-items:center;justify-content:center;gap:5px;flex:none;min-height:28px;height:28px;padding:3px 7px;font-size:12px;line-height:20px;background:transparent;color:var(--dsw-alias-label-secondary);border-color:transparent}
302
+ .wc-page .wc-translation-actions button:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover,rgba(128,128,128,.14));color:var(--dsw-alias-label-primary)}.wc-page .wc-translation-actions .wc-translate-icon{width:28px;padding:4px}.wc-page .wc-translate-icon[aria-pressed=true]{color:#8baeff;background:color-mix(in srgb,#759ce8 12%,transparent)}.wc-translation-actions svg{display:block;width:18px;height:18px;flex:none}.wc-tool{display:flex;flex-direction:column;gap:7px}
303
+ .wc-primary{background:#4269ae!important;color:#fff!important}.wc-list{display:flex;flex-direction:column;gap:10px}.wc-rule{min-width:124px}.wc-count{font-size:12px}.wc-page details summary{cursor:pointer}.wc-default{display:flex!important;flex-direction:row!important;align-items:center;gap:8px!important}.wc-default input{min-height:0;accent-color:#759ce8}
304
+ @media(max-width:650px){
305
+ .wc-row>.wc-grow{flex-basis:100%;min-width:0}.wc-rule{width:100%}.wc-card{padding:11px}
306
+ [data-shortcut-modal="settings"]:has(.wc-page){flex-direction:column;width:calc(100vw - 24px);max-width:calc(100vw - 24px);height:calc(100dvh - 24px)}
307
+ [data-shortcut-modal="settings"]:has(.wc-page)>nav{width:100%;min-width:0;flex-direction:row;align-items:center;gap:8px;padding:12px 12px 0}
308
+ [data-shortcut-modal="settings"]:has(.wc-page)>nav>:first-child{flex:none;white-space:nowrap;padding:0}
309
+ [data-shortcut-modal="settings"]:has(.wc-page)>nav>:last-child{flex:1;min-width:0;flex-direction:row;overflow-x:auto;overflow-y:hidden;scrollbar-width:thin}
310
+ [data-shortcut-modal="settings"]:has(.wc-page)>nav button{flex:none;height:36px;padding:7px 10px}
311
+ [data-shortcut-modal="settings"]:has(.wc-page)>nav+div{min-height:0}
312
+ [data-shortcut-modal="settings"]:has(.wc-page)>nav+div>:first-child{height:42px;padding:8px 12px 4px}
313
+ [data-shortcut-modal="settings"]:has(.wc-page)>nav+div>:last-child{padding:0 14px 14px}
314
+ }
315
+ `;
316
+ const statusLabels = { get connected(){return tr("已连接");}, get 'connected-no-tools'(){return tr("已连接/暂无工具");}, get connecting(){return tr("连接中");}, get error(){return tr("连接失败,请检查源配置或重新启用");}, get disconnected(){return tr("未连接");}, get native(){return tr("DSH 原生连接");}, get configured(){return tr("原生配置/未发现工具");} };
317
+ async function request(path, value, signal) {
318
+ const response = await fetch(BASE + path, { credentials: 'same-origin', cache: 'no-store', signal, ...(value === undefined ? {} : { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(value) }) });
319
+ const data = await response.json(); if (!response.ok) throw new Error(data.error || tr("请求失败")); return data;
320
+ }
321
+ function CapabilitySettings({ getModelContext, registeredWorkspaces, languageTarget, saveLanguageTarget, uiLocale }) {
322
+ const [workspace, setWorkspace] = React.useState(''), [view, setView] = React.useState(null);
323
+ const [tab, setTab] = React.useState('skills'), [search, setSearch] = React.useState(''), [error, setError] = React.useState('');
324
+ const [busy, setBusy] = React.useState(false), [message, setMessage] = React.useState(''), [path, setPath] = React.useState('');
325
+ const [progress, setProgress] = React.useState(''), [showTranslation, setShowTranslation] = React.useState(() => { try { return localStorage.getItem('dsh-capabilities-show-translations') !== 'false'; } catch { return true; } });
326
+ const translating = React.useRef(null);
327
+ const [targetDraft, setTargetDraft] = React.useState(languageTarget);
328
+ React.useEffect(() => { setTargetDraft(languageTarget); }, [languageTarget]);
329
+ const getTranslationContext = () => ({ ...getModelContext(), targetLanguage: languageTarget, uiLocale });
330
+ const [translationOverrides, setTranslationOverrides] = React.useState({});
331
+ const epoch = React.useRef(0), locked = React.useRef(false), revision = React.useRef(null);
332
+ React.useEffect(() => {
333
+ const current = ++epoch.current; setView(null); setError(''); setBusy(false); locked.current = false; setProgress(''); setTranslationOverrides({});
334
+ async function load() {
335
+ if (locked.current) return;
336
+ try {
337
+ const context = getTranslationContext();
338
+ const params = new URLSearchParams({ workspace, targetLanguage: languageTarget, uiLocale, ...(context.sessionId ? { sessionId: context.sessionId } : {}), ...(context.selection ? { provider: context.selection.provider, model: context.selection.model } : {}) });
339
+ const data = await request('/state?' + params);
340
+ if (epoch.current !== current || locked.current) return;
341
+ revision.current = data.revision; setView(data);
342
+ } catch (cause) { if (epoch.current === current) setError(cause.message); }
343
+ }
344
+ load(); const timer = setInterval(() => { if (!document.hidden) load(); }, 4000);
345
+ return () => { ++epoch.current; clearInterval(timer); translating.current?.abort(); };
346
+ }, [workspace, languageTarget, uiLocale]);
347
+ async function action(value) {
348
+ if (locked.current || !view) return;
349
+ const current = epoch.current; locked.current = true; setBusy(true); setError(''); setMessage('');
350
+ try {
351
+ const data = await request('/action', { workspace, revision: revision.current, ...getTranslationContext(), ...value });
352
+ if (epoch.current === current) { revision.current = data.revision; setView(data); setMessage(value.action === 'refresh' ? tr("发现列表已刷新。") : tr("已保存,当前及后续 Agent 调用即时使用新规则。")); }
353
+ if (value.action === 'workspace') { setPath(''); setWorkspace(data.workspace); }
354
+ } catch (cause) { if (epoch.current === current) setError(cause.message); }
355
+ finally { locked.current = false; setBusy(false); }
356
+ }
357
+ const button = (text, onClick, options = {}) => h('button', { type: 'button', onClick, disabled: busy, ...options }, text);
358
+ const workspaceOptions = new Map((view?.workspaces ?? []).map(item => [item.path, item]));
359
+ // The sidebar's live store wins over older HTTP responses, including polling in flight.
360
+ for (const item of registeredWorkspaces) if (item.title) workspaceOptions.set(item.path, item);
361
+ const items = (view?.[tab] ?? []).filter(item => [item.name, item.description, item.path, item.source, item.workspace, item.translation?.title, item.translation?.description].filter(Boolean).join(' ').toLowerCase().includes(search.toLowerCase()));
362
+ async function translate(keys, { force = false, showAll = false } = {}) {
363
+ if (locked.current || !keys.length) return;
364
+ const current = epoch.current, context = getTranslationContext();
365
+ locked.current = true; setBusy(true); setError(''); setMessage(''); const cancel = new AbortController(); translating.current = cancel;
366
+ try {
367
+ let result, total = 0, skipped = 0;
368
+ for (let offset = 0; offset < keys.length; offset += 12) {
369
+ setProgress((force ? tr("正在重新翻译 ") : tr("正在翻译 ")) + (offset + 1) + '–' + Math.min(offset + 12, keys.length) + ' / ' + keys.length + tr(" 条…"));
370
+ result = await request('/translate', { workspace, ...context, force, keys: keys.slice(offset, offset + 12) }, cancel.signal);
371
+ if (epoch.current !== current) return;
372
+ revision.current = result.view.revision; setView(result.view); total += result.count; skipped += result.skipped ?? 0;
373
+ }
374
+ if (showAll) { setShowTranslation(true); setTranslationOverrides({}); try { localStorage.setItem('dsh-capabilities-show-translations', 'true'); } catch {} }
375
+ else setTranslationOverrides(previous => ({ ...previous, ...Object.fromEntries(keys.map(key => [key, true])) }));
376
+ setMessage(tr("已处理 {p0} 条,{p1} 条已是目标语言 · {p2}", {p0: total, p1: skipped, p2: result.target.label}));
377
+ } catch (cause) { if (epoch.current === current && cause.name !== 'AbortError') setError(cause.message); }
378
+ finally { if (translating.current === cancel) { if (epoch.current === current) { setProgress(''); setBusy(false); } locked.current = false; translating.current = null; } }
379
+ }
380
+ function translationShown(key) { return translationOverrides[key] ?? showTranslation; }
381
+ function translateIcon() {
382
+ return h('svg', { viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 1.7, strokeLinecap: 'round', strokeLinejoin: 'round', 'aria-hidden': true },
383
+ h('path', { d: 'M2 5h12M7 2v3m-3 3 6 6M12 5c-1 4-4 7-8 9m8 8 5-10 5 10m-8-4h6' }));
384
+ }
385
+ function translationActions(item, key) {
386
+ const sameLanguage = item.translation?.status === 'same_language', translated = item.translation && !sameLanguage;
387
+ const shown = !!translated && translationShown(key);
388
+ const label = translated ? (shown ? tr("查看原文") : tr("查看译文")) : tr("翻译说明");
389
+ return h('div', { className: 'wc-translation-actions' },
390
+ sameLanguage && h('span', { className: 'wc-muted' }, tr("已是目标语言")),
391
+ translated && button(tr("重新翻译"), () => translate([key], { force: true }), { disabled: busy || !view.translation.available, 'aria-label': tr("重新翻译 ") + item.name, title: tr("使用当前模型重新翻译并更新缓存") }),
392
+ button(translateIcon(), () => translated ? setTranslationOverrides(previous => ({ ...previous, [key]: !shown })) : translate([key], { force: true }),
393
+ { className: 'wc-translate-icon', disabled: busy || (!translated && !view.translation.available), 'aria-label': label + ' ' + item.name, title: label, 'aria-pressed': shown }));
394
+ }
395
+ function description(item, key) {
396
+ const translated = translationShown(key) && item.translation?.status !== 'same_language' && item.translation;
397
+ return h(React.Fragment, null,
398
+ translated?.title && translated.title !== item.name && h('p', { className: 'wc-translated-title' }, translated.title),
399
+ translated?.description ? h(React.Fragment, null, h('p', { className: 'wc-description wc-translated' }, translated.description),
400
+ h('details', { className: 'wc-source' }, h('summary', null, tr("查看原文")), h('p', { className: 'wc-description' }, item.description))) : item.description && h('p', { className: 'wc-description' }, item.description));
401
+ }
402
+ function renderItem(item) {
403
+ const isMcp = tab === 'mcp', key = isMcp ? item.id : item.name;
404
+ const foreign = isMcp && item.workspace && workspace !== item.workspace;
405
+ const select = h('select', { 'aria-label': item.name + tr(" 规则"), className: 'wc-rule', value: item.rule === null ? 'inherit' : String(item.rule), disabled: busy || !!view.error || !!foreign,
406
+ onChange: event => action({ action: 'rule', kind: tab, key, value: event.target.value === 'inherit' ? null : event.target.value === 'true' }) },
407
+ h('option', { value: 'inherit' }, workspace ? tr("继承全局") : tr("使用默认")), h('option', { value: 'true' }, tr("启用")), h('option', { value: 'false' }, tr("禁用")));
408
+ return h('article', { className: 'wc-card', key, 'data-capability': key },
409
+ h('div', { className: 'wc-row' }, h('strong', { className: 'wc-name' }, item.name),
410
+ h('span', { className: 'wc-badge ' + (item.enabled ? 'wc-on' : 'wc-off') }, item.enabled ? tr("可用") : isMcp && item.requested && !item.approved ? tr("待批准") : tr("已禁用")), select),
411
+ description(item, (isMcp ? 'mcp:' : 'skill:') + key),
412
+ h('p', { className: 'wc-source' }, tr("来源:") + (item.path || item.source) + (!isMcp ? ' · ' + item.provider : '')),
413
+ isMcp && h(React.Fragment, null,
414
+ item.workspace && h('p', { className: 'wc-source' }, tr("所属工作区:") + item.workspace),
415
+ h('p', { className: 'wc-muted' }, item.transport + ' · ' + item.launch),
416
+ h('p', { className: 'wc-muted' }, statusLabels[item.status] + ' · ' + item.tools + tr(" 个工具")),
417
+ item.toolDetails?.length > 0 && h('details', null, h('summary', null, tr("工具说明 (") + item.toolDetails.length + ')'), h('div', { className: 'wc-tools' }, ...item.toolDetails.map(tool => h('div', { className: 'wc-tool', key: tool.name }, h('p', { className: 'wc-name' }, tool.name), description(tool, 'tool:' + tool.name), translationActions(tool, 'tool:' + tool.name))))),
418
+ item.envNames?.length > 0 && h('p', { className: 'wc-source' }, tr("环境变量名称:") + item.envNames.join('、')),
419
+ item.problem && h('p', { className: 'wc-error' }, item.problem),
420
+ foreign && h('p', { className: 'wc-muted' }, tr("切换到该来源工作区后可设置。")),
421
+ !item.native && !item.approved && item.valid && !foreign && button(tr("批准配置并启用连接"), () => action({ action: 'approve', kind: 'mcp', key, value: true, fingerprint: item.fingerprint }), { className: 'wc-primary', disabled: busy || !!view.error }),
422
+ item.approved && !item.native && h('p', { className: 'wc-source' }, tr("此配置已批准;修改源配置后需要重新批准。"))),
423
+ workspace && h('p', { className: 'wc-source' }, tr("全局:") + (item.global ? tr("启用") : tr("禁用")) + (item.rule === null ? tr(" · 当前继承全局") : tr(" · 当前使用工作区规则"))),
424
+ translationActions(item, (isMcp ? 'mcp:' : 'skill:') + key));
425
+ }
426
+ return h('section', { className: 'wc-page' },
427
+ h('h2', null, tr("Skill 与 MCP")),
428
+ h('p', { className: 'wc-muted' }, tr("这里的全局与工作区规则仅作用于 DeepSeek Harness。默认只发现 DSH 自身的 Skill 和 MCP;其他应用来源可以单独开启。")),
429
+ view && h('div', { className: 'wc-card' },
430
+ h('label', { className: 'wc-default' }, h('input', { type: 'checkbox', checked: view.discovery.includeExternal, disabled: busy || !!view.error,
431
+ onChange: event => action({ action: 'discovery', value: event.target.checked }) }), tr("扫描其他应用的 Skill / MCP(全局)")),
432
+ h('p', { className: 'wc-muted' }, tr("可选读取 CC Switch 共享 Skill 目录,以及 Codex、Claude、Cursor 配置。扫描只读取来源;新能力默认禁用,MCP 首次连接仍需批准。"))),
433
+ h('div', { className: 'wc-row wc-scope-controls' }, h('label', { className: 'wc-grow' }, tr("规则范围"), h('select', { 'aria-label': tr("规则范围"), value: workspace, disabled: busy, onChange: event => setWorkspace(event.target.value) },
434
+ h('option', { value: '' }, tr("全局默认")), ...[...workspaceOptions.values()].sort((a, b) => a.path.localeCompare(b.path)).map(item => h('option', { key: item.path, value: item.path }, item.title + ' — ' + item.path)))),
435
+ button(tr("重新发现"), () => action({ action: 'refresh' }), { disabled: busy || !view })),
436
+ h('details', null, h('summary', { className: 'wc-muted' }, tr("添加已有目录的工作区规则")),
437
+ h('div', { className: 'wc-row' }, h('input', { className: 'wc-grow', 'aria-label': tr("工作区绝对路径"), placeholder: tr("/home/用户名/项目"), value: path, onChange: event => setPath(event.target.value) }),
438
+ button(tr("添加工作区"), () => action({ action: 'workspace', workspace: path }), { disabled: busy || !view || !path.startsWith('/') }))),
439
+ error && h('p', { className: 'wc-error', role: 'alert' }, messageText(error)), view?.error && h('p', { className: 'wc-error', role: 'alert' }, messageText(view.error)),
440
+ message && h('p', { className: 'wc-success', role: 'status' }, messageText(message)),
441
+ progress && h('p', { className: 'wc-progress', role: 'status' }, messageText(progress)),
442
+ !view ? h('p', { className: 'wc-muted' }, tr("正在读取能力列表…")) : h(React.Fragment, null,
443
+ h('div', { className: 'wc-row wc-tabs', role: 'tablist', 'aria-label': tr("能力类型") },
444
+ ...[['skills', 'Skills', view.skills.length], ['mcp', 'MCP', view.mcp.length]].map(([value, label, count]) => button(label + ' (' + count + ')', () => setTab(value), { key: value, role: 'tab', 'aria-selected': tab === value }))),
445
+ h('div', { className: 'wc-card' },
446
+ h('form', { className: 'wc-row wc-language-controls', onSubmit: async event => { event.preventDefault(); if (busy) return; setBusy(true); setError(''); try { await saveLanguageTarget(targetDraft); setMessage(tr("翻译目标语言已保存。")); } catch (cause) { setError(cause.message); } finally { setBusy(false); } } },
447
+ h('label', { className: 'wc-grow' }, tr("翻译成"), h('input', { value: targetDraft, maxLength: 160, list: 'wc-language-targets', 'aria-label': tr("翻译成"), placeholder: tr("跟随界面语言"), onChange: event => setTargetDraft(event.target.value), disabled: busy })),
448
+ h('datalist', { id: 'wc-language-targets' }, ...[tr("简体中文"), tr("繁體中文"), 'English', tr("日本語"), 'Español', 'Français', 'Deutsch', 'Русский', 'Português'].map(value => h('option', { key: value, value }))),
449
+ h('button', { type: 'submit', disabled: busy || targetDraft === languageTarget }, tr("保存语言"))),
450
+ h('p', { className: 'wc-muted' }, tr("翻译模型:") + ((getModelContext().selection ?? view.translation.model) ? (getModelContext().selection ?? view.translation.model).model + tr("(跟随当前界面)") : tr("请先选择模型"))),
451
+ h('label', { className: 'wc-default' }, h('input', { type: 'checkbox', checked: showTranslation, onChange: event => { setShowTranslation(event.target.checked); setTranslationOverrides({}); try { localStorage.setItem('dsh-capabilities-show-translations', String(event.target.checked)); } catch {} } }), tr("显示译文")),
452
+ button(tr("翻译当前列表"), () => translate(items.flatMap(item => tab === 'skills' ? ['skill:' + item.name] : ['mcp:' + item.id, ...(item.toolDetails ?? []).map(tool => 'tool:' + tool.name)]), { showAll: true }), { disabled: busy || !view.translation.available || !items.length }),
453
+ h('p', { className: 'wc-muted' }, tr("点击后使用当前界面所选模型翻译名称和说明,结果保存在本地缓存。同语默认保留原文,单项按钮可强制翻译。原始标识符和 Agent 调用保持不变。"))),
454
+ !workspace && h('label', { className: 'wc-default' }, h('input', { type: 'checkbox', checked: view.defaults[tab], disabled: busy || !!view.error,
455
+ onChange: event => action({ action: 'defaults', kind: tab, value: event.target.checked }) }), tab === 'skills' ? tr("新发现的 Skill 默认启用") : tr("已批准的 MCP 默认启用")),
456
+ h('input', { type: 'search', 'aria-label': tr("搜索能力"), placeholder: tr("搜索名称、说明或来源路径"), value: search, onChange: event => setSearch(event.target.value) }),
457
+ h('p', { className: 'wc-muted' }, workspace ? tr("工作区:") + workspace : tr("全局规则将应用到未单独设置的工作区。")),
458
+ h('div', { className: 'wc-list' }, ...items.map(renderItem)),
459
+ !items.length && h('p', { className: 'wc-muted' }, search ? tr("没有匹配的能力。") : tab === 'mcp' ? tr("当前范围未发现 MCP。DSH 配置和工作区 .dsh/mcp.json 会自动发现;其他应用需打开上方扫描开关。") : tr("当前范围未发现 Skill。这里展示 DeepSeek 已注册的 Skill;其他应用需打开上方扫描开关。")),
460
+ view.issues.length > 0 && h('details', null, h('summary', null, tr("发现过程中的问题 (") + view.issues.length + ')'), ...view.issues.map(item => h('p', { className: 'wc-source', key: item.source }, item.source + ':' + item.message))),
461
+ !view.complete && h('p', { className: 'wc-muted' }, tr("部分 Skill 目录尚未完成扫描,请重新发现。")),
462
+ h('p', { className: 'wc-muted' }, tr("这些规则控制 Agent 的 Skill 加载和 MCP 调用;源文件不会被修改。设置已持久保存,服务重启后仍然有效。"))));
463
+ }
464
+ function apply(ctx) {
465
+ ctx.effect(() => installLocale(ctx), 'locale: dictionaries');
466
+ ctx.effect(() => { const style = document.createElement('style'); style.textContent = css; document.head.appendChild(style); return () => style.remove(); }, 'capabilities: styles');
467
+ const languageForm = ctx.configForms.get('workspace-capabilities');
468
+ const subscribeLanguage = listener => languageForm.subscribe(listener), languageSnapshot = () => languageForm.getSnapshot();
469
+ const subscribeLocale = listener => ctx.locale.subscribe(listener), localeSnapshot = () => ctx.locale.getSnapshot();
470
+ const subscribeWorkspaces = listener => ctx.workspaces.list.subscribe(listener);
471
+ const getWorkspaceSnapshot = () => ctx.workspaces.list.getSnapshot();
472
+ function getModelContext() {
473
+ const sessionId = ctx.uiSession.current.getSnapshot()?.key;
474
+ if (!sessionId) return {};
475
+ try { const selection = ctx.modelDirectories.directoryFor(sessionId).store.getSnapshot().current; return { sessionId, ...(selection ? { selection } : {}) }; }
476
+ catch { return { sessionId }; }
477
+ }
478
+ function Page() {
479
+ const snapshot = React.useSyncExternalStore(subscribeWorkspaces, getWorkspaceSnapshot);
480
+ const language = React.useSyncExternalStore(subscribeLanguage, languageSnapshot), locale = React.useSyncExternalStore(subscribeLocale, localeSnapshot);
481
+ const saveLanguageTarget = async value => { if (!await languageForm.set('translationTargetLanguage', value.trim())) throw new Error(tr("翻译目标语言未保存,请刷新后重试。")); };
482
+ return h(CapabilitySettings, { getModelContext, registeredWorkspaces: snapshot.items, languageTarget: language.value?.translationTargetLanguage ?? '', saveLanguageTarget, uiLocale: locale.active });
483
+ }
484
+ ctx.slots.inject('settings.section', () => ctx.slots.register({ name:'settings.section',locale:NS, id: 'workspace-capabilities', order: 20, label: () => tr("Skill 与 MCP") }, Page));
485
+ }
486
+ return { name: 'workspace-capabilities-client', inject: ['slots', 'uiSession', 'modelDirectories', 'workspaces', 'configForms', 'locale'], apply };
487
+ }
488
+ });
@@ -0,0 +1,3 @@
1
+ - insert:
2
+ - id: workspace-capabilities
3
+ name: dsh-plugin-workspace-capabilities