deepseek-harness-skill-mcp 0.1.0

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/lib/client.js ADDED
@@ -0,0 +1,675 @@
1
+ window.__ModuleLoader__.load({id:"deepseek-harness-skill-mcp",factory:(require)=>{
2
+ var module={exports:{}};var exports=module.exports;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/client/index.jsx
22
+ var index_exports = {};
23
+ __export(index_exports, {
24
+ McpSection: () => McpSection,
25
+ SkillSection: () => SkillSection,
26
+ apply: () => apply,
27
+ inject: () => inject
28
+ });
29
+ module.exports = __toCommonJS(index_exports);
30
+ var import_react = require("react");
31
+
32
+ // src/client/controller.js
33
+ var ExtensionsController = class {
34
+ state = { extensions: [], sources: [], skills: [], revision: "", loading: false, saving: false, error: "", saved: false };
35
+ listeners = /* @__PURE__ */ new Set();
36
+ lifetime = new AbortController();
37
+ generation = 0;
38
+ silentPending = false;
39
+ constructor(call) {
40
+ this.call = call;
41
+ }
42
+ getSnapshot = () => this.state;
43
+ subscribe = (listener) => {
44
+ this.listeners.add(listener);
45
+ return () => this.listeners.delete(listener);
46
+ };
47
+ publish(patch) {
48
+ if (this.lifetime.signal.aborted) return;
49
+ this.state = { ...this.state, ...patch };
50
+ for (const listener of this.listeners) listener();
51
+ }
52
+ async request(endpoint, args = {}, options = {}) {
53
+ if (this.state.saving || this.lifetime.signal.aborted) return false;
54
+ const silent = endpoint === "list" && options.silent === true;
55
+ if (silent && (this.state.loading || this.silentPending)) return false;
56
+ if (silent) this.silentPending = true;
57
+ const generation = ++this.generation;
58
+ const saving = endpoint !== "list";
59
+ if (!silent) this.publish({ loading: !saving, saving, error: "", saved: false });
60
+ try {
61
+ const result = await this.call(endpoint, { ...args, revision: this.state.revision }, this.lifetime.signal);
62
+ if (this.lifetime.signal.aborted || generation !== this.generation) return false;
63
+ if (!result.ok) {
64
+ if (!silent) this.publish({ error: result.error.code === "extensions/conflict" ? "conflict" : "failed", loading: false, saving: false });
65
+ return false;
66
+ }
67
+ this.publish(silent ? result.value : { ...result.value, loading: false, saving: false, saved: saving });
68
+ return true;
69
+ } catch {
70
+ if (!silent && generation === this.generation) this.publish({ error: "failed", loading: false, saving: false });
71
+ return false;
72
+ } finally {
73
+ if (silent) this.silentPending = false;
74
+ }
75
+ }
76
+ dispose() {
77
+ this.lifetime.abort();
78
+ this.listeners.clear();
79
+ }
80
+ };
81
+
82
+ // src/client/locales.js
83
+ var zh = {
84
+ navSkill: "Skill \u7BA1\u7406",
85
+ navMcp: "MCP \u7BA1\u7406",
86
+ skillIntro: "\u914D\u7F6E\u4E00\u4E2A\u6216\u591A\u4E2A Skill \u8DEF\u5F84\uFF1B\u6BCF\u4E2A\u8DEF\u5F84\u4E0B\u53EF\u4EE5\u5305\u542B\u591A\u4E2A\u6280\u80FD\u3002",
87
+ mcpIntro: "\u7BA1\u7406\u5916\u90E8\u5DE5\u5177\u670D\u52A1\u5668\uFF0C\u8BA9\u5B83\u4EEC\u5728\u5F53\u524D\u914D\u7F6E\u4E2D\u53EF\u7528\u3002",
88
+ skills: "Skill \u8DEF\u5F84",
89
+ mcp: "MCP \u670D\u52A1\u5668",
90
+ refresh: "\u5237\u65B0",
91
+ add: "\u6DFB\u52A0\u8DEF\u5F84",
92
+ addMcp: "\u6DFB\u52A0\u670D\u52A1\u5668",
93
+ newSkill: "\u65B0\u5EFA Skill",
94
+ emptySkills: "\u8FD8\u6CA1\u6709\u914D\u7F6E Skill \u8DEF\u5F84",
95
+ emptySkillsHint: "\u6307\u5B9A\u4E00\u4E2A\u672C\u5730 skills \u76EE\u5F55\uFF0C\u76EE\u5F55\u4E0B\u7684\u5404\u4E2A\u5B50\u76EE\u5F55\u5C31\u662F\u6280\u80FD\u3002",
96
+ emptyMcp: "\u8FD8\u6CA1\u6709\u6DFB\u52A0 MCP \u670D\u52A1\u5668",
97
+ emptyMcpHint: "\u901A\u8FC7\u672C\u5730\u547D\u4EE4\u6216 HTTP \u5730\u5740\u8FDE\u63A5\u5916\u90E8\u5DE5\u5177\u3002",
98
+ id: "\u6807\u8BC6",
99
+ directory: "Skill \u8DEF\u5F84",
100
+ group: "\u7528\u6237\u5206\u7EC4\uFF08\u53EF\u9009\uFF09",
101
+ transport: "\u914D\u7F6E\u7C7B\u578B",
102
+ stdio: "stdio",
103
+ http: "HTTP",
104
+ command: "\u547D\u4EE4",
105
+ args: "\u53C2\u6570\uFF08\u6BCF\u884C\u4E00\u4E2A\uFF09",
106
+ cwd: "\u5DE5\u4F5C\u76EE\u5F55\uFF08\u53EF\u9009\uFF09",
107
+ url: "\u670D\u52A1\u5668\u5730\u5740",
108
+ cancel: "\u53D6\u6D88",
109
+ save: "\u6DFB\u52A0",
110
+ create: "\u521B\u5EFA",
111
+ saving: "\u4FDD\u5B58\u4E2D\u2026",
112
+ loading: "\u52A0\u8F7D\u4E2D\u2026",
113
+ enabled: "\u914D\u7F6E\u5DF2\u542F\u7528",
114
+ disabled: "\u5DF2\u7981\u7528",
115
+ enable: "\u542F\u7528",
116
+ disable: "\u7981\u7528",
117
+ saved: "\u66F4\u6539\u5DF2\u4FDD\u5B58\u3002",
118
+ failed: "\u64CD\u4F5C\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u8F93\u5165\u3001\u8FDE\u63A5\u6216\u670D\u52A1\u7AEF\u65E5\u5FD7\u540E\u91CD\u8BD5\u3002",
119
+ conflict: "\u914D\u7F6E\u5DF2\u88AB\u4FEE\u6539\uFF0C\u8BF7\u5237\u65B0\u540E\u91CD\u8BD5\u3002\u672A\u63D0\u4EA4\u7684\u8868\u5355\u5185\u5BB9\u5DF2\u4FDD\u7559\u3002",
120
+ skillFootnote: "\u65B0\u8DEF\u5F84\u9ED8\u8BA4\u7981\u7528\u3002\u542F\u7528\u540E\uFF0CSkill provider \u4F1A\u626B\u63CF\u8BE5\u8DEF\u5F84\u4E0B\u7684\u6240\u6709\u6280\u80FD\u3002\u914D\u7F6E\u53D8\u66F4\u4F1A\u81EA\u52A8\u751F\u6548\u3002",
121
+ mcpFootnote: "\u65B0\u670D\u52A1\u5668\u9ED8\u8BA4\u7981\u7528\u3002\u542F\u7528\u540E\u4F1A\u6267\u884C\u6240\u586B\u547D\u4EE4\u6216\u8FDE\u63A5\u6240\u586B\u5730\u5740\u3002\u914D\u7F6E\u53D8\u66F4\u4F1A\u81EA\u52A8\u751F\u6548\u3002",
122
+ secret: "\u8BF7\u52FF\u586B\u5199\u5BC6\u94A5\u6216\u5E26\u4EE4\u724C\u7684\u5730\u5740\u3002\u6B64\u7248\u672C\u6682\u4E0D\u652F\u6301\u8BA4\u8BC1\u53C2\u6570\u3002",
123
+ tools: "\u5DE5\u5177\u5217\u8868",
124
+ status_available: "\u5DE5\u5177\u53EF\u7528",
125
+ status_waiting: "\u7B49\u5F85\u53D1\u73B0\u5DE5\u5177",
126
+ status_disabled: "\u5DF2\u7981\u7528",
127
+ skillHint: "\u542F\u7528\u540E\u7531 Skill provider \u626B\u63CF\uFF1B\u6BCF\u4E2A\u914D\u7F6E\u9879\u5BF9\u5E94\u4E00\u4E2A\u5305\u542B\u591A\u4E2A\u6280\u80FD\u7684\u76EE\u5F55\u3002",
128
+ stat_all: "\u5168\u90E8\u6280\u80FD",
129
+ stat_automatic: "\u6A21\u578B\u53EF\u7528",
130
+ stat_manual: "\u4EC5\u624B\u52A8",
131
+ stat_invalid: "\u914D\u7F6E\u5F02\u5E38",
132
+ search: "\u641C\u7D22",
133
+ searchPlaceholder: "\u641C\u7D22\u540D\u79F0\u3001\u63CF\u8FF0\u3001\u8DEF\u5F84\u6216\u5206\u7EC4\u2026",
134
+ sourceEmpty: "\u8FD9\u4E2A\u8DEF\u5F84\u4E0B\u8FD8\u6CA1\u6709\u53D1\u73B0 Skill\u3002",
135
+ groupView: "\u5206\u7EC4\u65B9\u5F0F",
136
+ groupByPath: "\u6309\u8DEF\u5F84",
137
+ groupByCustom: "\u6309\u7528\u6237\u5206\u7EC4",
138
+ customGroup: "\u7528\u6237\u5206\u7EC4",
139
+ ungrouped: "\u672A\u5206\u7EC4",
140
+ groupPlaceholder: "\u4F8B\u5982\uFF1A\u5DE5\u4F5C\u3001\u4E2A\u4EBA\u3001\u5F00\u53D1",
141
+ saveGroup: "\u4FDD\u5B58\u5206\u7EC4",
142
+ noDescription: "\u6CA1\u6709\u53EF\u7528\u7684\u63CF\u8FF0",
143
+ details: "\u67E5\u770B\u8BE6\u60C5",
144
+ whenToUse: "\u9002\u7528\u573A\u666F",
145
+ diagnostics: "\u683C\u5F0F\u8BCA\u65AD",
146
+ invocation: "\u8C03\u7528\u6743\u9650",
147
+ modelInvocable: "\u5141\u8BB8\u6A21\u578B\u81EA\u52A8\u9009\u62E9",
148
+ userInvocable: "\u5141\u8BB8\u7528\u6237\u901A\u8FC7 /name \u8C03\u7528",
149
+ invocation_both: "\u81EA\u52A8 + \u624B\u52A8",
150
+ invocation_modelOnly: "\u4EC5\u6A21\u578B",
151
+ invocation_manualOnly: "\u4EC5\u624B\u52A8",
152
+ invocation_none: "\u5B8C\u5168\u7981\u7528",
153
+ format_bundle: "\u76EE\u5F55",
154
+ format_flat: "\u5355\u6587\u4EF6",
155
+ skillStatusInvalid: "\u683C\u5F0F\u5F02\u5E38",
156
+ skillStatusSourceDisabled: "\u6765\u6E90\u5DF2\u7981\u7528",
157
+ skillStatusShadowed: "\u88AB\u540C\u540D\u8986\u76D6",
158
+ resources: "\u8D44\u6E90\u6587\u4EF6",
159
+ noResources: "\u6CA1\u6709\u9644\u52A0\u8D44\u6E90",
160
+ source: "\u4FDD\u5B58\u6765\u6E90",
161
+ skillName: "Skill \u540D\u79F0",
162
+ description: "\u63CF\u8FF0",
163
+ structure: "\u76EE\u5F55\u7ED3\u6784",
164
+ structureMinimal: "\u4EC5 SKILL.md",
165
+ structureStandard: "\u6807\u51C6\u76EE\u5F55\uFF08scripts / references / assets\uFF09",
166
+ "issue_missing-frontmatter": "\u7F3A\u5C11 YAML frontmatter",
167
+ "issue_invalid-yaml": "YAML \u683C\u5F0F\u9519\u8BEF",
168
+ "issue_invalid-frontmatter": "frontmatter \u5FC5\u987B\u662F\u5BF9\u8C61",
169
+ "issue_invalid-name": "name \u5FC5\u987B\u4F7F\u7528 kebab-case",
170
+ "issue_missing-description": "\u7F3A\u5C11 description",
171
+ "issue_invalid-invocation": "\u8C03\u7528\u6743\u9650\u5B57\u6BB5\u4E0D\u662F\u6709\u6548\u5E03\u5C14\u503C",
172
+ issue_unreadable: "\u6587\u4EF6\u65E0\u6CD5\u8BFB\u53D6",
173
+ "issue_source-unreadable": "Skill \u8DEF\u5F84\u65E0\u6CD5\u8BFB\u53D6"
174
+ };
175
+ var en = {
176
+ navSkill: "Skills",
177
+ navMcp: "MCP",
178
+ skillIntro: "Configure one or more Skill paths; each path can contain multiple skills.",
179
+ mcpIntro: "Manage external tool servers for this configuration.",
180
+ skills: "Skill paths",
181
+ mcp: "MCP servers",
182
+ refresh: "Refresh",
183
+ add: "Add path",
184
+ addMcp: "Add server",
185
+ newSkill: "New Skill",
186
+ emptySkills: "No Skill paths configured",
187
+ emptySkillsHint: "Choose a local skills directory whose children contain the individual skills.",
188
+ emptyMcp: "No MCP servers yet",
189
+ emptyMcpHint: "Connect external tools with a local command or HTTP endpoint.",
190
+ id: "Identifier",
191
+ directory: "Skill path",
192
+ group: "User group (optional)",
193
+ transport: "Type",
194
+ stdio: "stdio",
195
+ http: "HTTP",
196
+ command: "Command",
197
+ args: "Arguments (one per line)",
198
+ cwd: "Working directory (optional)",
199
+ url: "Server URL",
200
+ cancel: "Cancel",
201
+ save: "Add",
202
+ create: "Create",
203
+ saving: "Saving\u2026",
204
+ loading: "Loading\u2026",
205
+ enabled: "Configured enabled",
206
+ disabled: "Disabled",
207
+ enable: "Enable",
208
+ disable: "Disable",
209
+ saved: "Changes saved.",
210
+ failed: "Operation failed. Check input, connection or server logs and retry.",
211
+ conflict: "Configuration changed. Refresh and retry; your draft has been retained.",
212
+ skillFootnote: "New paths are disabled. Once enabled, the Skill provider scans every skill below them.",
213
+ mcpFootnote: "New servers are disabled. Enabling one runs its command or connects to its endpoint; changes apply automatically.",
214
+ secret: "Do not enter secrets or token-bearing URLs. Authentication fields are not supported yet.",
215
+ tools: "Tools",
216
+ status_available: "Tools available",
217
+ status_waiting: "Waiting for tools",
218
+ status_disabled: "Disabled",
219
+ skillHint: "The Skill provider scans enabled paths; every configured path contains multiple skills.",
220
+ stat_all: "All skills",
221
+ stat_automatic: "Model enabled",
222
+ stat_manual: "Manual only",
223
+ stat_invalid: "Invalid",
224
+ search: "Search",
225
+ searchPlaceholder: "Search name, description, path or group\u2026",
226
+ sourceEmpty: "No Skills were found in this path.",
227
+ groupView: "Group view",
228
+ groupByPath: "By path",
229
+ groupByCustom: "By user group",
230
+ customGroup: "User group",
231
+ ungrouped: "Ungrouped",
232
+ groupPlaceholder: "For example: Work, Personal, Development",
233
+ saveGroup: "Save group",
234
+ noDescription: "No usable description",
235
+ details: "View details",
236
+ whenToUse: "When to use",
237
+ diagnostics: "Diagnostics",
238
+ invocation: "Invocation",
239
+ modelInvocable: "Allow model selection",
240
+ userInvocable: "Allow user /name invocation",
241
+ invocation_both: "Model + user",
242
+ invocation_modelOnly: "Model only",
243
+ invocation_manualOnly: "Manual only",
244
+ invocation_none: "Fully disabled",
245
+ format_bundle: "Bundle",
246
+ format_flat: "Flat file",
247
+ skillStatusInvalid: "Invalid",
248
+ skillStatusSourceDisabled: "Source disabled",
249
+ skillStatusShadowed: "Shadowed",
250
+ resources: "Resource files",
251
+ noResources: "No additional resources",
252
+ source: "Source",
253
+ skillName: "Skill name",
254
+ description: "Description",
255
+ structure: "Structure",
256
+ structureMinimal: "SKILL.md only",
257
+ structureStandard: "Standard folders (scripts / references / assets)",
258
+ "issue_missing-frontmatter": "Missing YAML frontmatter",
259
+ "issue_invalid-yaml": "Invalid YAML",
260
+ "issue_invalid-frontmatter": "Frontmatter must be an object",
261
+ "issue_invalid-name": "name must use kebab-case",
262
+ "issue_missing-description": "Missing description",
263
+ "issue_invalid-invocation": "Invocation field is not a valid boolean",
264
+ issue_unreadable: "File cannot be read",
265
+ "issue_source-unreadable": "Skill path cannot be read"
266
+ };
267
+
268
+ // src/client/styles.css
269
+ var styles_default = ".dsh-ext{color:var(--dsw-alias-label-primary);max-width:840px;padding:4px 0 28px;font:inherit}\n.dsh-ext-heading,.dsh-ext-card>header{display:flex;justify-content:space-between;align-items:center;gap:16px}\n.dsh-ext h2{font-size:22px;letter-spacing:-.4px;margin:0 0 8px}.dsh-ext h3{font-size:15px;margin:0;display:flex;align-items:center;gap:8px}\n.dsh-ext p,.dsh-ext small{color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:1.6}.dsh-ext-heading p{margin:0}\n.dsh-ext button{font:inherit;font-size:13px;cursor:pointer;border:1px solid var(--dsw-alias-border-l4);border-radius:9px;background:var(--dsw-alias-bg-layer-2);color:inherit;padding:8px 13px;white-space:nowrap}\n.dsh-ext button:hover{background:var(--dsw-alias-bg-layer-3)}.dsh-ext button:disabled{opacity:.5;cursor:default}\n.dsh-ext :is(button,input,select,textarea):focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:3px}\n.dsh-ext-card{border:1px solid var(--dsw-alias-border-l4);border-radius:16px;margin-top:20px;background:var(--dsw-alias-bg-layer-2);overflow:hidden}\n.dsh-ext-card>header{padding:18px 20px;border-bottom:1px solid var(--dsw-alias-border-l4)}.dsh-ext-count{font-size:11px;font-weight:400;color:var(--dsw-alias-label-tertiary)}\n.dsh-ext-empty{padding:32px 20px}.dsh-ext-empty strong{font-size:14px;font-weight:500}.dsh-ext-empty p{margin:6px 0 0}\n.dsh-ext ul{list-style:none;padding:0;margin:0}.dsh-ext li{display:flex;justify-content:space-between;align-items:center;gap:14px;padding:16px 20px;border-bottom:1px solid var(--dsw-alias-border-l4)}.dsh-ext li:last-child{border:0}\n.dsh-ext-details{display:flex;flex-direction:column;gap:5px;min-width:0}.dsh-ext-details strong{font-size:14px}.dsh-ext-details code{font-size:12px;color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}\n.dsh-ext-runtime{display:flex;align-items:center;flex-wrap:wrap;gap:7px;font-size:12px;color:var(--dsw-alias-label-tertiary)}\n.dsh-ext-status{width:7px;height:7px;border-radius:50%;background:#858585;box-shadow:0 0 0 3px color-mix(in srgb,#858585 16%,transparent)}\n.dsh-ext-status-available{background:#38a169;box-shadow:0 0 0 3px color-mix(in srgb,#38a169 18%,transparent)}.dsh-ext-status-waiting{background:#d69e2e;box-shadow:0 0 0 3px color-mix(in srgb,#d69e2e 18%,transparent)}\n.dsh-ext-runtime details{width:100%;margin-top:2px}.dsh-ext-runtime summary{width:max-content;cursor:pointer;color:var(--dsw-alias-label-secondary);user-select:none}.dsh-ext-runtime summary:hover{color:var(--dsw-alias-label-primary)}\n.dsh-ext-runtime .dsh-ext-tools{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}.dsh-ext-runtime .dsh-ext-tools li{display:block;border:0;padding:4px 8px;border-radius:6px;background:var(--dsw-alias-bg-layer-3)}\n.dsh-ext-form{padding:20px;border-top:1px solid var(--dsw-alias-border-l4)}.dsh-ext fieldset{border:0;padding:0;margin:0;display:grid;grid-template-columns:1fr 1fr;gap:16px}.dsh-ext label{display:flex;flex-direction:column;gap:7px;font-size:13px}\n.dsh-ext input,.dsh-ext select,.dsh-ext textarea{box-sizing:border-box;min-width:0;width:100%;font:inherit;color:inherit;background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l4);border-radius:8px;padding:10px}.dsh-ext textarea{resize:vertical}\n.dsh-ext-actions{display:flex;justify-content:flex-end;gap:8px;grid-column:1/-1}.dsh-ext fieldset>p{grid-column:1/-1;margin:0}.dsh-ext-notice{padding:12px 16px;border:1px solid var(--dsw-alias-border-l4);border-radius:10px}.dsh-ext-footnote{padding:0 4px}\n.dsh-ext-heading-actions{display:flex;gap:8px;align-items:center}.dsh-visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}\n.dsh-skill-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-top:20px}.dsh-skill-stats>div{display:flex;flex-direction:column;gap:4px;padding:14px 16px;border:1px solid var(--dsw-alias-border-l4);border-radius:12px;background:var(--dsw-alias-bg-layer-2)}.dsh-skill-stats strong{font-size:20px}.dsh-skill-stats span{font-size:12px;color:var(--dsw-alias-label-tertiary)}\n.dsh-skill-search{margin-top:14px}.dsh-skill-search input{padding-left:13px}.dsh-skill-manager>.dsh-ext-form{margin-top:14px;border:1px solid var(--dsw-alias-border-l4);border-radius:14px;background:var(--dsw-alias-bg-layer-2)}\n.dsh-skill-grouping{display:flex;align-items:center;justify-content:flex-end;gap:6px;margin-top:10px}.dsh-skill-grouping>span{margin-right:4px;font-size:12px;color:var(--dsw-alias-label-tertiary)}.dsh-skill-grouping button{padding:5px 10px}.dsh-skill-grouping button[aria-pressed=true]{border-color:var(--dsw-alias-brand-primary);background:color-mix(in srgb,var(--dsw-alias-brand-primary) 13%,transparent)}\n.dsh-skill-sources{display:flex;flex-direction:column;gap:14px;margin-top:14px}.dsh-skill-source{border:1px solid var(--dsw-alias-border-l4);border-radius:15px;background:var(--dsw-alias-bg-layer-2);overflow:hidden}.dsh-skill-source>header{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:16px 18px;border-bottom:1px solid var(--dsw-alias-border-l4)}\n.dsh-skill-source-title{display:flex;align-items:flex-start;gap:11px;min-width:0}.dsh-skill-source-title>.dsh-ext-status{margin-top:6px;flex:0 0 auto}.dsh-skill-source-title h3{margin-bottom:5px;overflow-wrap:anywhere}.dsh-skill-source-title small{display:block;font-size:11px;color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere}\n.dsh-skill-group-editor{display:flex;align-items:flex-end;gap:8px;padding:10px 18px;border-bottom:1px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-bg-layer-1)}.dsh-skill-group-editor label{flex:1}.dsh-skill-group-editor input{padding:7px 9px}.dsh-skill-group-editor button{padding:7px 10px}\n.dsh-skill-user-group{border:1px solid var(--dsw-alias-border-l4);border-radius:16px;background:var(--dsw-alias-bg-layer-2);overflow:hidden}.dsh-skill-user-group>header{padding:15px 18px;border-bottom:1px solid var(--dsw-alias-border-l4)}.dsh-skill-user-group>div{display:flex;flex-direction:column;gap:10px;padding:10px}.dsh-skill-source-nested{border-radius:11px;background:var(--dsw-alias-bg-layer-1)}\n.dsh-skill-row{display:block!important;padding:15px 18px!important}.dsh-skill-row-main{min-width:0}.dsh-skill-name{display:flex;align-items:center;gap:9px}.dsh-skill-name strong{font-size:14px}.dsh-skill-row-main>p{margin:6px 0 3px}.dsh-skill-row-main>code{font-size:11px;color:var(--dsw-alias-label-tertiary)}\n.dsh-skill-badge{font-size:11px;padding:2px 7px;border-radius:999px;background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-secondary)}.dsh-skill-badge-invalid{color:#e98282}.dsh-skill-badge-shadowed{color:#a98af8}.dsh-ext-status-invalid{background:#e05252;box-shadow:0 0 0 3px color-mix(in srgb,#e05252 18%,transparent)}.dsh-ext-status-shadowed{background:#8b5cf6;box-shadow:0 0 0 3px color-mix(in srgb,#8b5cf6 18%,transparent)}.dsh-ext-status-manual{background:#d69e2e;box-shadow:0 0 0 3px color-mix(in srgb,#d69e2e 18%,transparent)}\n.dsh-skill-row details{margin-top:9px}.dsh-skill-row summary{width:max-content;cursor:pointer;font-size:12px;color:var(--dsw-alias-label-secondary)}.dsh-skill-detail{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-top:12px;padding:14px;border-radius:10px;background:var(--dsw-alias-bg-layer-1)}.dsh-skill-detail>p{grid-column:1/-1;margin:0}.dsh-skill-detail p strong,.dsh-skill-detail>div>strong{display:block;margin-bottom:5px;color:var(--dsw-alias-label-secondary);font-size:12px}\n.dsh-skill-invocation{display:flex;flex-direction:column;gap:7px}.dsh-skill-invocation label,.dsh-skill-create-flags label{display:flex;flex-direction:row;align-items:center;gap:5px}.dsh-ext input[type=checkbox]{width:auto;min-width:auto}.dsh-skill-detail ul,.dsh-skill-detail li{display:block!important;margin:0;padding:0!important;border:0!important}.dsh-skill-resources{display:flex!important;flex-wrap:wrap!important;gap:5px}.dsh-skill-resources li{padding:3px 6px!important;border-radius:5px!important;background:var(--dsw-alias-bg-layer-3)!important}\n.dsh-ext-span{grid-column:1/-1}.dsh-skill-create-flags{display:flex;flex-direction:column;gap:7px;font-size:13px}.dsh-skill-create-flags>span{margin-bottom:1px}.dsh-skill-source>.dsh-ext-notice{margin:12px 18px}.dsh-skill-source>.dsh-ext-empty{padding:18px}\n@media(max-width:600px){.dsh-ext fieldset,.dsh-skill-detail{grid-template-columns:1fr}.dsh-ext-heading{align-items:flex-start;flex-direction:column}.dsh-ext-heading-actions{flex-wrap:wrap}.dsh-ext-card>header{padding:14px}.dsh-ext li{padding:14px}.dsh-skill-stats{grid-template-columns:repeat(2,1fr)}.dsh-skill-grouping{justify-content:flex-start}.dsh-skill-group-editor{align-items:stretch;flex-direction:column}}\n";
270
+
271
+ // src/client/index.jsx
272
+ var import_jsx_runtime = require("react/jsx-runtime");
273
+ var inject = ["slots", "locale", "connection"];
274
+ var namespace = "settings.extension-manager";
275
+ var settingsPollIntervalMs = 3e3;
276
+ function apply(ctx) {
277
+ const controller = new ExtensionsController((endpoint, args, signal) => ctx.connection.rpc.call("/extensions", endpoint, args, signal));
278
+ ctx.effect(() => ctx.locale.register(namespace, { zh, en }));
279
+ ctx.effect(() => () => controller.dispose());
280
+ ctx.effect(() => {
281
+ const style = document.createElement("style");
282
+ style.textContent = styles_default;
283
+ document.head.append(style);
284
+ return () => style.remove();
285
+ });
286
+ ctx.on("connection/reset", () => {
287
+ void controller.request("list");
288
+ });
289
+ const t = ctx.locale.bind(namespace);
290
+ const face = { hooks: { manager: controller }, request: (endpoint, args, options) => controller.request(endpoint, args, options) };
291
+ const section = (id, kind) => ctx.slots.inject("settings.section", () => ctx.slots.register({
292
+ name: "settings.section",
293
+ id,
294
+ order: kind === "skill" ? 16 : 17,
295
+ label: () => t(kind === "skill" ? "navSkill" : "navMcp"),
296
+ locale: namespace,
297
+ inject: () => face
298
+ }, kind === "skill" ? SkillSection : McpSection));
299
+ section("skill-manager", "skill");
300
+ section("mcp-manager", "mcp");
301
+ }
302
+ function SkillSection({ t, useManager, request }) {
303
+ const state = useManager((value) => value);
304
+ const [form, setForm] = (0, import_react.useState)("");
305
+ const [query, setQuery] = (0, import_react.useState)("");
306
+ const [groupBy, setGroupBy] = (0, import_react.useState)("path");
307
+ const busy = state.loading || state.saving;
308
+ const sources = state.sources ?? [];
309
+ const skills = state.skills ?? [];
310
+ const visible = skills.filter((skill) => {
311
+ const source = sources.find((item) => item.id === skill.sourceId);
312
+ return `${skill.name} ${skill.description} ${source?.location ?? ""} ${source?.group ?? ""}`.toLowerCase().includes(query.toLowerCase());
313
+ });
314
+ const counts = {
315
+ all: skills.length,
316
+ automatic: skills.filter((skill) => skill.valid && skill.modelInvocable && skill.sourceEnabled && !skill.shadowed).length,
317
+ manual: skills.filter((skill) => skill.valid && !skill.modelInvocable && skill.userInvocable && skill.sourceEnabled).length,
318
+ invalid: skills.filter((skill) => !skill.valid).length
319
+ };
320
+ useLiveRefresh(request);
321
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "dsh-ext dsh-skill-manager", children: [
322
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { className: "dsh-ext-heading", children: [
323
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
324
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: t("navSkill") }),
325
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("skillIntro") })
326
+ ] }),
327
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-ext-heading-actions", children: [
328
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", disabled: busy || !state.revision, onClick: () => setForm("source"), children: t("add") }),
329
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", disabled: busy || sources.length === 0, onClick: () => setForm("skill"), children: t("newSkill") }),
330
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", disabled: busy, onClick: () => request("list"), children: t("refresh") })
331
+ ] })
332
+ ] }),
333
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageState, { state, t }),
334
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-skill-stats", children: Object.entries(counts).map(([key, value]) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
335
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: value }),
336
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: t(`stat_${key}`) })
337
+ ] }, key)) }),
338
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "dsh-skill-search", children: [
339
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-visually-hidden", children: t("search") }),
340
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "search", value: query, onChange: (event) => setQuery(event.target.value), placeholder: t("searchPlaceholder") })
341
+ ] }),
342
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-skill-grouping", role: "group", "aria-label": t("groupView"), children: [
343
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: t("groupView") }),
344
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", "aria-pressed": groupBy === "path", onClick: () => setGroupBy("path"), children: t("groupByPath") }),
345
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", "aria-pressed": groupBy === "custom", onClick: () => setGroupBy("custom"), children: t("groupByCustom") })
346
+ ] }),
347
+ form === "source" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AddForm, { kind: "skill", t, busy, onCancel: () => setForm(""), onSave: async (args) => {
348
+ if (await request("add-skill", args)) setForm("");
349
+ } }),
350
+ form === "skill" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NewSkillForm, { sources, t, busy, onCancel: () => setForm(""), onSave: async (args) => {
351
+ if (await request("create-skill", args)) setForm("");
352
+ } }),
353
+ sources.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-ext-card dsh-ext-empty", children: [
354
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("emptySkills") }),
355
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("emptySkillsHint") })
356
+ ] }),
357
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-skill-sources", children: groupBy === "path" ? sources.map((source) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SkillPath, { source, skills, visible, query, t, busy, request }, source.id)) : groupSources(sources.filter((source) => !query || visible.some((skill) => skill.sourceId === source.id))).map((group) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "dsh-skill-user-group", children: [
358
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("header", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h3", { children: [
359
+ group.name || t("ungrouped"),
360
+ " ",
361
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-ext-count", children: group.sources.reduce((total, source) => total + skills.filter((skill) => skill.sourceId === source.id).length, 0) })
362
+ ] }) }),
363
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: group.sources.map((source) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SkillPath, { source, skills, visible, query, t, busy, request, nested: true }, source.id)) })
364
+ ] }, group.name)) }),
365
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dsh-ext-footnote", children: t("skillFootnote") })
366
+ ] });
367
+ }
368
+ function groupSources(sources) {
369
+ const groups = /* @__PURE__ */ new Map();
370
+ for (const source of sources) {
371
+ const key = source.group || "";
372
+ if (!groups.has(key)) groups.set(key, []);
373
+ groups.get(key).push(source);
374
+ }
375
+ return [...groups].map(([name, entries]) => ({ name, sources: entries })).sort((a, b) => a.name.localeCompare(b.name));
376
+ }
377
+ function SkillPath({ source, skills, visible, query, t, busy, request, nested = false }) {
378
+ const rows = visible.filter((skill) => skill.sourceId === source.id);
379
+ if (query && rows.length === 0) return null;
380
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: `dsh-skill-source${nested ? " dsh-skill-source-nested" : ""}`, children: [
381
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { children: [
382
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-skill-source-title", children: [
383
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `dsh-ext-status ${source.enabled ? "dsh-ext-status-available" : ""}`, "aria-hidden": "true" }),
384
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
385
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h3", { children: [
386
+ source.location,
387
+ " ",
388
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-ext-count", children: skills.filter((skill) => skill.sourceId === source.id).length })
389
+ ] }),
390
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: source.group ? `${t("customGroup")}: ${source.group}` : t("ungrouped") })
391
+ ] })
392
+ ] }),
393
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
394
+ "button",
395
+ {
396
+ type: "button",
397
+ role: "switch",
398
+ "aria-checked": source.enabled,
399
+ disabled: busy,
400
+ onClick: () => request("enable", { id: source.id, enabled: !source.enabled }),
401
+ children: t(source.enabled ? "disable" : "enable")
402
+ }
403
+ )
404
+ ] }),
405
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GroupEditor, { source, t, busy, request }),
406
+ source.issue && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dsh-ext-notice", children: t(`issue_${source.issue}`) }),
407
+ rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-ext-empty", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("sourceEmpty") }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { children: rows.map((skill) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SkillRow, { skill, t, busy, request }, skill.relativePath)) })
408
+ ] });
409
+ }
410
+ function GroupEditor({ source, t, busy, request }) {
411
+ const [group, setGroup] = (0, import_react.useState)(source.group);
412
+ (0, import_react.useEffect)(() => setGroup(source.group), [source.group]);
413
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { className: "dsh-skill-group-editor", onSubmit: (event) => {
414
+ event.preventDefault();
415
+ void request("set-skill-group", { id: source.id, group });
416
+ }, children: [
417
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
418
+ t("customGroup"),
419
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { value: group, maxLength: 64, disabled: busy, onChange: (event) => setGroup(event.target.value), placeholder: t("groupPlaceholder") })
420
+ ] }),
421
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "submit", disabled: busy || group.trim() === source.group, children: t("saveGroup") })
422
+ ] });
423
+ }
424
+ function McpSection({ t, useManager, request }) {
425
+ const state = useManager((value) => value);
426
+ const [form, setForm] = (0, import_react.useState)(false);
427
+ const busy = state.loading || state.saving;
428
+ const rows = state.extensions.filter((row) => row.kind === "mcp");
429
+ useLiveRefresh(request);
430
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "dsh-ext", children: [
431
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { className: "dsh-ext-heading", children: [
432
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
433
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: t("navMcp") }),
434
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("mcpIntro") })
435
+ ] }),
436
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", disabled: busy, onClick: () => request("list"), children: t("refresh") })
437
+ ] }),
438
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageState, { state, t }),
439
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "dsh-ext-card", children: [
440
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { children: [
441
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h3", { children: [
442
+ t("mcp"),
443
+ " ",
444
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-ext-count", children: rows.length })
445
+ ] }),
446
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", disabled: busy || !state.revision, onClick: () => setForm(true), children: t("addMcp") })
447
+ ] }),
448
+ rows.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-ext-empty", children: [
449
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("emptyMcp") }),
450
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("emptyMcpHint") })
451
+ ] }),
452
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { children: rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { children: [
453
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-ext-details", children: [
454
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: row.id }),
455
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: row.location }),
456
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(McpRuntime, { row, t })
457
+ ] }),
458
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
459
+ "button",
460
+ {
461
+ type: "button",
462
+ role: "switch",
463
+ "aria-checked": row.enabled,
464
+ "aria-label": `${t(row.enabled ? "disable" : "enable")} ${row.id}`,
465
+ disabled: busy,
466
+ onClick: () => request("enable", { id: row.id, enabled: !row.enabled }),
467
+ children: t(row.enabled ? "disable" : "enable")
468
+ }
469
+ )
470
+ ] }, row.id)) }),
471
+ form && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AddForm, { kind: "mcp", t, busy, onCancel: () => setForm(false), onSave: async (args) => {
472
+ if (await request("add-mcp", args)) setForm(false);
473
+ } })
474
+ ] }),
475
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dsh-ext-footnote", children: t("mcpFootnote") })
476
+ ] });
477
+ }
478
+ function useLiveRefresh(request) {
479
+ (0, import_react.useEffect)(() => {
480
+ void request("list");
481
+ let timer;
482
+ const poll = () => {
483
+ if (document.visibilityState === "visible") void request("list", {}, { silent: true });
484
+ timer = window.setTimeout(poll, settingsPollIntervalMs);
485
+ };
486
+ const refreshWhenVisible = () => {
487
+ if (document.visibilityState === "visible") void request("list", {}, { silent: true });
488
+ };
489
+ timer = window.setTimeout(poll, settingsPollIntervalMs);
490
+ document.addEventListener("visibilitychange", refreshWhenVisible);
491
+ return () => {
492
+ window.clearTimeout(timer);
493
+ document.removeEventListener("visibilitychange", refreshWhenVisible);
494
+ };
495
+ }, [request]);
496
+ }
497
+ function PageState({ state, t }) {
498
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
499
+ state.loading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { role: "status", children: t("loading") }),
500
+ state.error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dsh-ext-notice", role: "alert", children: t(state.error) }),
501
+ state.saved && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dsh-ext-notice", role: "status", children: t("saved") })
502
+ ] });
503
+ }
504
+ function SkillRow({ skill, t, busy, request }) {
505
+ const state = !skill.valid ? "invalid" : !skill.sourceEnabled || !skill.modelInvocable && !skill.userInvocable ? "disabled" : skill.shadowed ? "shadowed" : !skill.modelInvocable ? "manual" : "available";
506
+ const invocation = skill.modelInvocable && skill.userInvocable ? "both" : skill.modelInvocable ? "modelOnly" : skill.userInvocable ? "manualOnly" : "none";
507
+ const statusLabel = !skill.valid ? "skillStatusInvalid" : !skill.sourceEnabled ? "skillStatusSourceDisabled" : skill.shadowed ? "skillStatusShadowed" : "";
508
+ const update = (patch) => request("set-skill-invocation", {
509
+ sourceId: skill.sourceId,
510
+ relativePath: skill.relativePath,
511
+ skillRevision: skill.revision,
512
+ modelInvocable: skill.modelInvocable,
513
+ userInvocable: skill.userInvocable,
514
+ ...patch
515
+ });
516
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: "dsh-skill-row", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-skill-row-main", children: [
517
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-skill-name", children: [
518
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `dsh-ext-status dsh-ext-status-${state}`, "aria-hidden": "true" }),
519
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: skill.name }),
520
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-skill-badge", children: t(`format_${skill.format}`) }),
521
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-skill-badge", children: t(`invocation_${invocation}`) }),
522
+ statusLabel && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `dsh-skill-badge dsh-skill-badge-${state}`, children: t(statusLabel) })
523
+ ] }),
524
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: skill.description || t("noDescription") }),
525
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: skill.relativePath }),
526
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", { children: [
527
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("summary", { children: t("details") }),
528
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-skill-detail", children: [
529
+ skill.whenToUse && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [
530
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("whenToUse") }),
531
+ skill.whenToUse
532
+ ] }),
533
+ skill.issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
534
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("diagnostics") }),
535
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { children: skill.issues.map((issue) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: t(`issue_${issue}`) }, issue)) })
536
+ ] }),
537
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-skill-invocation", children: [
538
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("invocation") }),
539
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
540
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "checkbox", checked: skill.modelInvocable, disabled: busy || !skill.valid, onChange: (event) => update({ modelInvocable: event.target.checked }) }),
541
+ " ",
542
+ t("modelInvocable")
543
+ ] }),
544
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
545
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "checkbox", checked: skill.userInvocable, disabled: busy || !skill.valid, onChange: (event) => update({ userInvocable: event.target.checked }) }),
546
+ " ",
547
+ t("userInvocable")
548
+ ] })
549
+ ] }),
550
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
551
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("resources") }),
552
+ skill.resources.length ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "dsh-skill-resources", children: skill.resources.map((path) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: path }) }, path)) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("noResources") })
553
+ ] })
554
+ ] })
555
+ ] })
556
+ ] }) });
557
+ }
558
+ function McpRuntime({ row, t }) {
559
+ const tools = row.tools ?? [];
560
+ const state = !row.enabled ? "disabled" : tools.length ? "available" : "waiting";
561
+ const prefix = `mcp__${row.id}__`;
562
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-ext-runtime", children: [
563
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `dsh-ext-status dsh-ext-status-${state}`, "aria-hidden": "true" }),
564
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-ext-status-label", children: t(`status_${state}`) }),
565
+ tools.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", { children: [
566
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("summary", { children: [
567
+ t("tools"),
568
+ " \xB7 ",
569
+ tools.length
570
+ ] }),
571
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "dsh-ext-tools", children: tools.map((name) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { title: name, children: name.startsWith(prefix) ? name.slice(prefix.length) : name }) }, name)) })
572
+ ] })
573
+ ] });
574
+ }
575
+ function NewSkillForm({ sources, t, busy, onSave, onCancel }) {
576
+ const prefix = (0, import_react.useId)();
577
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("form", { className: "dsh-ext-form dsh-skill-create", onSubmit: (event) => {
578
+ event.preventDefault();
579
+ const data = new FormData(event.currentTarget);
580
+ void onSave({
581
+ sourceId: data.get("sourceId"),
582
+ name: data.get("name"),
583
+ description: data.get("description"),
584
+ whenToUse: data.get("whenToUse"),
585
+ modelInvocable: data.has("modelInvocable"),
586
+ userInvocable: data.has("userInvocable"),
587
+ structure: data.get("structure")
588
+ });
589
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("fieldset", { disabled: busy, children: [
590
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { htmlFor: `${prefix}-sourceId`, children: [
591
+ t("source"),
592
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("select", { id: `${prefix}-sourceId`, name: "sourceId", children: sources.map((source) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: source.id, children: source.id }, source.id)) })
593
+ ] }),
594
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { htmlFor: `${prefix}-name`, children: [
595
+ t("skillName"),
596
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { id: `${prefix}-name`, name: "name", required: true, pattern: "[a-z0-9]+(?:-[a-z0-9]+)*", autoComplete: "off" })
597
+ ] }),
598
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "dsh-ext-span", htmlFor: `${prefix}-description`, children: [
599
+ t("description"),
600
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("textarea", { id: `${prefix}-description`, name: "description", rows: 3, required: true })
601
+ ] }),
602
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "dsh-ext-span", htmlFor: `${prefix}-whenToUse`, children: [
603
+ t("whenToUse"),
604
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("textarea", { id: `${prefix}-whenToUse`, name: "whenToUse", rows: 2 })
605
+ ] }),
606
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { htmlFor: `${prefix}-structure`, children: [
607
+ t("structure"),
608
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { id: `${prefix}-structure`, name: "structure", children: [
609
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "minimal", children: t("structureMinimal") }),
610
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "standard", children: t("structureStandard") })
611
+ ] })
612
+ ] }),
613
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-skill-create-flags", children: [
614
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: t("invocation") }),
615
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
616
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "checkbox", name: "modelInvocable", defaultChecked: true }),
617
+ " ",
618
+ t("modelInvocable")
619
+ ] }),
620
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
621
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "checkbox", name: "userInvocable", defaultChecked: true }),
622
+ " ",
623
+ t("userInvocable")
624
+ ] })
625
+ ] }),
626
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-ext-actions", children: [
627
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: onCancel, children: t("cancel") }),
628
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "submit", children: t(busy ? "saving" : "create") })
629
+ ] })
630
+ ] }) });
631
+ }
632
+ function AddForm({ kind, t, busy, onSave, onCancel }) {
633
+ const prefix = (0, import_react.useId)();
634
+ const [transport, setTransport] = (0, import_react.useState)("stdio");
635
+ const field = (name, required = true, multiline = false) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { htmlFor: `${prefix}-${name}`, children: [
636
+ t(name),
637
+ multiline ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("textarea", { id: `${prefix}-${name}`, name, rows: 3 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { id: `${prefix}-${name}`, name, required, autoComplete: "off", ...name === "id" ? { pattern: "[A-Za-z0-9_\\-]{1,32}", maxLength: 32 } : {} })
638
+ ] });
639
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("form", { className: "dsh-ext-form", onSubmit: (event) => {
640
+ event.preventDefault();
641
+ const data = Object.fromEntries(new FormData(event.currentTarget));
642
+ const args = kind === "skill" ? { directory: data.directory, group: data.group ?? "" } : {
643
+ id: data.id,
644
+ configuration: JSON.stringify(transport === "stdio" ? { transport, command: data.command, args: data.args.split(/\r?\n/).filter(Boolean), cwd: data.cwd } : { transport, url: data.url })
645
+ };
646
+ void onSave(args);
647
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("fieldset", { disabled: busy, children: [
648
+ kind === "skill" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
649
+ field("directory"),
650
+ " ",
651
+ field("group", false)
652
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
653
+ field("id"),
654
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { htmlFor: `${prefix}-transport`, children: [
655
+ t("transport"),
656
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { id: `${prefix}-transport`, value: transport, onChange: (event) => setTransport(event.target.value), children: [
657
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "stdio", children: t("stdio") }),
658
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "streamable-http", children: t("http") })
659
+ ] })
660
+ ] }),
661
+ transport === "stdio" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
662
+ field("command"),
663
+ field("args", false, true),
664
+ field("cwd", false)
665
+ ] }) : field("url"),
666
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("secret") })
667
+ ] }),
668
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-ext-actions", children: [
669
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: onCancel, children: t("cancel") }),
670
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "submit", children: t(busy ? "saving" : "save") })
671
+ ] })
672
+ ] }) });
673
+ }
674
+
675
+ return module.exports;}});