@civilization/deepseek-harness-skill-mcp 0.1.3

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,739 @@
1
+ window.__ModuleLoader__.load({id:"@civilization/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
+ transport: "\u914D\u7F6E\u7C7B\u578B",
101
+ stdio: "stdio",
102
+ http: "HTTP",
103
+ command: "\u547D\u4EE4",
104
+ args: "\u53C2\u6570\uFF08\u6BCF\u884C\u4E00\u4E2A\uFF09",
105
+ cwd: "\u5DE5\u4F5C\u76EE\u5F55\uFF08\u53EF\u9009\uFF09",
106
+ url: "\u670D\u52A1\u5668\u5730\u5740",
107
+ cancel: "\u53D6\u6D88",
108
+ save: "\u6DFB\u52A0",
109
+ create: "\u521B\u5EFA",
110
+ saving: "\u4FDD\u5B58\u4E2D\u2026",
111
+ loading: "\u52A0\u8F7D\u4E2D\u2026",
112
+ enabled: "\u914D\u7F6E\u5DF2\u542F\u7528",
113
+ disabled: "\u5DF2\u7981\u7528",
114
+ enable: "\u542F\u7528",
115
+ disable: "\u7981\u7528",
116
+ saved: "\u66F4\u6539\u5DF2\u4FDD\u5B58\u3002",
117
+ failed: "\u64CD\u4F5C\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u8F93\u5165\u3001\u8FDE\u63A5\u6216\u670D\u52A1\u7AEF\u65E5\u5FD7\u540E\u91CD\u8BD5\u3002",
118
+ 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",
119
+ 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",
120
+ 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",
121
+ 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",
122
+ tools: "\u5DE5\u5177\u5217\u8868",
123
+ status_available: "\u5DE5\u5177\u53EF\u7528",
124
+ status_waiting: "\u7B49\u5F85\u53D1\u73B0\u5DE5\u5177",
125
+ status_disabled: "\u5DF2\u7981\u7528",
126
+ 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",
127
+ stat_all: "\u5168\u90E8\u6280\u80FD",
128
+ stat_automatic: "\u6A21\u578B\u53EF\u7528",
129
+ stat_manual: "\u4EC5\u624B\u52A8",
130
+ stat_invalid: "\u914D\u7F6E\u5F02\u5E38",
131
+ search: "\u641C\u7D22",
132
+ searchPlaceholder: "\u641C\u7D22\u540D\u79F0\u3001\u63CF\u8FF0\u3001\u8DEF\u5F84\u6216\u5206\u7EC4\u2026",
133
+ skillSources: "\u6765\u6E90\u8DEF\u5F84",
134
+ skillLibrary: "\u6280\u80FD\u5217\u8868",
135
+ showingCount: "\u663E\u793A {visible} / {all}",
136
+ filterSource: "\u6765\u6E90",
137
+ filterAllSources: "\u5168\u90E8\u6765\u6E90",
138
+ filterGroup: "\u5206\u7EC4",
139
+ filterAllGroups: "\u5168\u90E8\u5206\u7EC4",
140
+ filterStatus: "\u72B6\u6001",
141
+ filterAllStatuses: "\u5168\u90E8\u72B6\u6001",
142
+ noFilterResults: "\u6CA1\u6709\u5339\u914D\u7684 Skill",
143
+ noFilterResultsHint: "\u5C1D\u8BD5\u8C03\u6574\u641C\u7D22\u8BCD\u6216\u7B5B\u9009\u6761\u4EF6\u3002",
144
+ customGroup: "\u7528\u6237\u5206\u7EC4",
145
+ ungrouped: "\u672A\u5206\u7EC4",
146
+ groupPlaceholder: "\u4F8B\u5982\uFF1A\u5DE5\u4F5C\u3001\u4E2A\u4EBA\u3001\u5F00\u53D1",
147
+ saveGroup: "\u4FDD\u5B58\u5206\u7EC4",
148
+ noDescription: "\u6CA1\u6709\u53EF\u7528\u7684\u63CF\u8FF0",
149
+ details: "\u67E5\u770B\u8BE6\u60C5",
150
+ whenToUse: "\u9002\u7528\u573A\u666F",
151
+ diagnostics: "\u683C\u5F0F\u8BCA\u65AD",
152
+ invocation: "\u8C03\u7528\u6743\u9650",
153
+ modelInvocable: "\u5141\u8BB8\u6A21\u578B\u81EA\u52A8\u9009\u62E9",
154
+ userInvocable: "\u5141\u8BB8\u7528\u6237\u901A\u8FC7 /name \u8C03\u7528",
155
+ invocation_both: "\u81EA\u52A8 + \u624B\u52A8",
156
+ invocation_modelOnly: "\u4EC5\u6A21\u578B",
157
+ invocation_manualOnly: "\u4EC5\u624B\u52A8",
158
+ invocation_none: "\u5B8C\u5168\u7981\u7528",
159
+ format_bundle: "\u76EE\u5F55",
160
+ format_flat: "\u5355\u6587\u4EF6",
161
+ skillStatusInvalid: "\u683C\u5F0F\u5F02\u5E38",
162
+ skillStatusSourceDisabled: "\u6765\u6E90\u5DF2\u7981\u7528",
163
+ skillStatusShadowed: "\u88AB\u540C\u540D\u8986\u76D6",
164
+ resources: "\u8D44\u6E90\u6587\u4EF6",
165
+ noResources: "\u6CA1\u6709\u9644\u52A0\u8D44\u6E90",
166
+ source: "\u4FDD\u5B58\u6765\u6E90",
167
+ skillName: "Skill \u540D\u79F0",
168
+ description: "\u63CF\u8FF0",
169
+ structure: "\u76EE\u5F55\u7ED3\u6784",
170
+ structureMinimal: "\u4EC5 SKILL.md",
171
+ structureStandard: "\u6807\u51C6\u76EE\u5F55\uFF08scripts / references / assets\uFF09",
172
+ "issue_missing-frontmatter": "\u7F3A\u5C11 YAML frontmatter",
173
+ "issue_invalid-yaml": "YAML \u683C\u5F0F\u9519\u8BEF",
174
+ "issue_invalid-frontmatter": "frontmatter \u5FC5\u987B\u662F\u5BF9\u8C61",
175
+ "issue_invalid-name": "name \u5FC5\u987B\u4F7F\u7528 kebab-case",
176
+ "issue_missing-description": "\u7F3A\u5C11 description",
177
+ "issue_invalid-invocation": "\u8C03\u7528\u6743\u9650\u5B57\u6BB5\u4E0D\u662F\u6709\u6548\u5E03\u5C14\u503C",
178
+ issue_unreadable: "\u6587\u4EF6\u65E0\u6CD5\u8BFB\u53D6",
179
+ "issue_source-unreadable": "Skill \u8DEF\u5F84\u65E0\u6CD5\u8BFB\u53D6"
180
+ };
181
+ var en = {
182
+ navSkill: "Skills",
183
+ navMcp: "MCP",
184
+ skillIntro: "Configure one or more Skill paths; each path can contain multiple skills.",
185
+ mcpIntro: "Manage external tool servers for this configuration.",
186
+ skills: "Skill paths",
187
+ mcp: "MCP servers",
188
+ refresh: "Refresh",
189
+ add: "Add path",
190
+ addMcp: "Add server",
191
+ newSkill: "New Skill",
192
+ emptySkills: "No Skill paths configured",
193
+ emptySkillsHint: "Choose a local skills directory whose children contain the individual skills.",
194
+ emptyMcp: "No MCP servers yet",
195
+ emptyMcpHint: "Connect external tools with a local command or HTTP endpoint.",
196
+ id: "Identifier",
197
+ directory: "Skill path",
198
+ transport: "Type",
199
+ stdio: "stdio",
200
+ http: "HTTP",
201
+ command: "Command",
202
+ args: "Arguments (one per line)",
203
+ cwd: "Working directory (optional)",
204
+ url: "Server URL",
205
+ cancel: "Cancel",
206
+ save: "Add",
207
+ create: "Create",
208
+ saving: "Saving\u2026",
209
+ loading: "Loading\u2026",
210
+ enabled: "Configured enabled",
211
+ disabled: "Disabled",
212
+ enable: "Enable",
213
+ disable: "Disable",
214
+ saved: "Changes saved.",
215
+ failed: "Operation failed. Check input, connection or server logs and retry.",
216
+ conflict: "Configuration changed. Refresh and retry; your draft has been retained.",
217
+ skillFootnote: "New paths are disabled. Once enabled, the Skill provider scans every skill below them.",
218
+ mcpFootnote: "New servers are disabled. Enabling one runs its command or connects to its endpoint; changes apply automatically.",
219
+ secret: "Do not enter secrets or token-bearing URLs. Authentication fields are not supported yet.",
220
+ tools: "Tools",
221
+ status_available: "Tools available",
222
+ status_waiting: "Waiting for tools",
223
+ status_disabled: "Disabled",
224
+ skillHint: "The Skill provider scans enabled paths; every configured path contains multiple skills.",
225
+ stat_all: "All skills",
226
+ stat_automatic: "Model enabled",
227
+ stat_manual: "Manual only",
228
+ stat_invalid: "Invalid",
229
+ search: "Search",
230
+ searchPlaceholder: "Search name, description, path or group\u2026",
231
+ skillSources: "Source paths",
232
+ skillLibrary: "Skill library",
233
+ showingCount: "Showing {visible} / {all}",
234
+ filterSource: "Source",
235
+ filterAllSources: "All sources",
236
+ filterGroup: "Group",
237
+ filterAllGroups: "All groups",
238
+ filterStatus: "Status",
239
+ filterAllStatuses: "All statuses",
240
+ noFilterResults: "No matching Skills",
241
+ noFilterResultsHint: "Try another search or filter.",
242
+ customGroup: "User group",
243
+ ungrouped: "Ungrouped",
244
+ groupPlaceholder: "For example: Work, Personal, Development",
245
+ saveGroup: "Save group",
246
+ noDescription: "No usable description",
247
+ details: "View details",
248
+ whenToUse: "When to use",
249
+ diagnostics: "Diagnostics",
250
+ invocation: "Invocation",
251
+ modelInvocable: "Allow model selection",
252
+ userInvocable: "Allow user /name invocation",
253
+ invocation_both: "Model + user",
254
+ invocation_modelOnly: "Model only",
255
+ invocation_manualOnly: "Manual only",
256
+ invocation_none: "Fully disabled",
257
+ format_bundle: "Bundle",
258
+ format_flat: "Flat file",
259
+ skillStatusInvalid: "Invalid",
260
+ skillStatusSourceDisabled: "Source disabled",
261
+ skillStatusShadowed: "Shadowed",
262
+ resources: "Resource files",
263
+ noResources: "No additional resources",
264
+ source: "Source",
265
+ skillName: "Skill name",
266
+ description: "Description",
267
+ structure: "Structure",
268
+ structureMinimal: "SKILL.md only",
269
+ structureStandard: "Standard folders (scripts / references / assets)",
270
+ "issue_missing-frontmatter": "Missing YAML frontmatter",
271
+ "issue_invalid-yaml": "Invalid YAML",
272
+ "issue_invalid-frontmatter": "Frontmatter must be an object",
273
+ "issue_invalid-name": "name must use kebab-case",
274
+ "issue_missing-description": "Missing description",
275
+ "issue_invalid-invocation": "Invocation field is not a valid boolean",
276
+ issue_unreadable: "File cannot be read",
277
+ "issue_source-unreadable": "Skill path cannot be read"
278
+ };
279
+
280
+ // src/client/styles.css
281
+ 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-filters{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-top:10px}.dsh-skill-filters label{gap:5px;font-size:11px;color:var(--dsw-alias-label-tertiary)}.dsh-skill-filters select{padding:8px 10px;color:var(--dsw-alias-label-primary)}\n.dsh-skill-source-manager{margin-top:14px}.dsh-skill-source-manager>summary{cursor:pointer;padding:14px 18px;font-size:14px;font-weight:600;user-select:none}.dsh-skill-source-manager[open]>summary{border-bottom:1px solid var(--dsw-alias-border-l4)}\n.dsh-skill-source-manager li{padding:11px 18px}.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>div{display:flex;min-width:0;flex-direction:column;gap:3px}.dsh-skill-source-title code{font-size:11px;color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere}.dsh-skill-source-title small{font-size:11px;color:#e98282}\n.dsh-skill-library{margin-top:14px}.dsh-skill-group-editor{display:flex;align-items:flex-end;gap:8px}.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-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-group{color:var(--dsw-alias-brand-primary);background:color-mix(in srgb,var(--dsw-alias-brand-primary) 12%,transparent)}.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,.dsh-skill-filters{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-group-editor{align-items:stretch;flex-direction:column}}\n";
282
+
283
+ // src/client/index.jsx
284
+ var import_jsx_runtime = require("react/jsx-runtime");
285
+ var inject = ["slots", "locale", "connection"];
286
+ var namespace = "settings.extension-manager";
287
+ var settingsPollIntervalMs = 3e3;
288
+ function apply(ctx) {
289
+ const controller = new ExtensionsController((endpoint, args, signal) => ctx.connection.rpc.call("/extensions", endpoint, args, signal));
290
+ ctx.effect(() => ctx.locale.register(namespace, { zh, en }));
291
+ ctx.effect(() => () => controller.dispose());
292
+ ctx.effect(() => {
293
+ const style = document.createElement("style");
294
+ style.textContent = styles_default;
295
+ document.head.append(style);
296
+ return () => style.remove();
297
+ });
298
+ ctx.on("connection/reset", () => {
299
+ void controller.request("list");
300
+ });
301
+ const t = ctx.locale.bind(namespace);
302
+ const face = { hooks: { manager: controller }, request: (endpoint, args, options) => controller.request(endpoint, args, options) };
303
+ const section = (id, kind) => ctx.slots.inject("settings.section", () => ctx.slots.register({
304
+ name: "settings.section",
305
+ id,
306
+ order: kind === "skill" ? 16 : 17,
307
+ label: () => t(kind === "skill" ? "navSkill" : "navMcp"),
308
+ locale: namespace,
309
+ inject: () => face
310
+ }, kind === "skill" ? SkillSection : McpSection));
311
+ section("skill-manager", "skill");
312
+ section("mcp-manager", "mcp");
313
+ }
314
+ function SkillSection({ t, useManager, request }) {
315
+ const state = useManager((value) => value);
316
+ const [form, setForm] = (0, import_react.useState)("");
317
+ const [query, setQuery] = (0, import_react.useState)("");
318
+ const [sourceFilter, setSourceFilter] = (0, import_react.useState)("all");
319
+ const [groupFilter, setGroupFilter] = (0, import_react.useState)("all");
320
+ const [statusFilter, setStatusFilter] = (0, import_react.useState)("all");
321
+ const busy = state.loading || state.saving;
322
+ const sources = state.sources ?? [];
323
+ const skills = state.skills ?? [];
324
+ const groups = [...new Set(skills.map((skill) => skill.group).filter(Boolean))].sort((a, b) => a.localeCompare(b));
325
+ const visible = skills.filter((skill) => {
326
+ const source = sources.find((item) => item.id === skill.sourceId);
327
+ const matchesQuery = `${skill.name} ${skill.description} ${source?.location ?? ""} ${skill.group ?? ""}`.toLowerCase().includes(query.toLowerCase());
328
+ return matchesQuery && (sourceFilter === "all" || skill.sourceId === sourceFilter) && (groupFilter === "all" || (groupFilter === "ungrouped" ? !skill.group : skill.group === groupFilter)) && (statusFilter === "all" || skillState(skill) === statusFilter);
329
+ });
330
+ const counts = {
331
+ all: skills.length,
332
+ automatic: skills.filter((skill) => skill.valid && skill.modelInvocable && skill.sourceEnabled && !skill.shadowed).length,
333
+ manual: skills.filter((skill) => skill.valid && !skill.modelInvocable && skill.userInvocable && skill.sourceEnabled).length,
334
+ invalid: skills.filter((skill) => !skill.valid).length
335
+ };
336
+ useLiveRefresh(request);
337
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "dsh-ext dsh-skill-manager", children: [
338
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { className: "dsh-ext-heading", children: [
339
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
340
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: t("navSkill") }),
341
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("skillIntro") })
342
+ ] }),
343
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-ext-heading-actions", children: [
344
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", disabled: busy || !state.revision, onClick: () => setForm("source"), children: t("add") }),
345
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", disabled: busy || sources.length === 0, onClick: () => setForm("skill"), children: t("newSkill") }),
346
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", disabled: busy, onClick: () => request("list"), children: t("refresh") })
347
+ ] })
348
+ ] }),
349
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageState, { state, t }),
350
+ /* @__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: [
351
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: value }),
352
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: t(`stat_${key}`) })
353
+ ] }, key)) }),
354
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "dsh-skill-search", children: [
355
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-visually-hidden", children: t("search") }),
356
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "search", value: query, onChange: (event) => setQuery(event.target.value), placeholder: t("searchPlaceholder") })
357
+ ] }),
358
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-skill-filters", children: [
359
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
360
+ t("filterSource"),
361
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { value: sourceFilter, onChange: (event) => setSourceFilter(event.target.value), children: [
362
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "all", children: t("filterAllSources") }),
363
+ sources.map((source) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: source.id, children: source.id }, source.id))
364
+ ] })
365
+ ] }),
366
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
367
+ t("filterGroup"),
368
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { value: groupFilter, onChange: (event) => setGroupFilter(event.target.value), children: [
369
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "all", children: t("filterAllGroups") }),
370
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "ungrouped", children: t("ungrouped") }),
371
+ groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: group, children: group }, group))
372
+ ] })
373
+ ] }),
374
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
375
+ t("filterStatus"),
376
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { value: statusFilter, onChange: (event) => setStatusFilter(event.target.value), children: [
377
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "all", children: t("filterAllStatuses") }),
378
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "available", children: t("stat_automatic") }),
379
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "manual", children: t("stat_manual") }),
380
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "disabled", children: t("disabled") }),
381
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "invalid", children: t("stat_invalid") }),
382
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "shadowed", children: t("skillStatusShadowed") })
383
+ ] })
384
+ ] })
385
+ ] }),
386
+ form === "source" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AddForm, { kind: "skill", t, busy, onCancel: () => setForm(""), onSave: async (args) => {
387
+ if (await request("add-skill", args)) setForm("");
388
+ } }),
389
+ form === "skill" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NewSkillForm, { sources, t, busy, onCancel: () => setForm(""), onSave: async (args) => {
390
+ if (await request("create-skill", args)) setForm("");
391
+ } }),
392
+ sources.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-ext-card dsh-ext-empty", children: [
393
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("emptySkills") }),
394
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("emptySkillsHint") })
395
+ ] }),
396
+ sources.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SkillSources, { sources, skills, t, busy, request }),
397
+ sources.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "dsh-ext-card dsh-skill-library", children: [
398
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("header", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h3", { children: [
399
+ t("skillLibrary"),
400
+ " ",
401
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-ext-count", children: t("showingCount").replace("{visible}", visible.length).replace("{all}", skills.length) })
402
+ ] }) }),
403
+ visible.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-ext-empty", children: [
404
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("noFilterResults") }),
405
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("noFilterResultsHint") })
406
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { children: visible.map((skill) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
407
+ SkillRow,
408
+ {
409
+ skill,
410
+ source: sources.find((item) => item.id === skill.sourceId),
411
+ groups,
412
+ t,
413
+ busy,
414
+ request
415
+ },
416
+ `${skill.sourceId}:${skill.relativePath}`
417
+ )) })
418
+ ] }),
419
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dsh-ext-footnote", children: t("skillFootnote") })
420
+ ] });
421
+ }
422
+ function SkillSources({ sources, skills, t, busy, request }) {
423
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", { className: "dsh-ext-card dsh-skill-source-manager", children: [
424
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("summary", { children: [
425
+ t("skillSources"),
426
+ " ",
427
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-ext-count", children: sources.length })
428
+ ] }),
429
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { children: sources.map((source) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { children: [
430
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-skill-source-title", children: [
431
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `dsh-ext-status ${source.enabled ? "dsh-ext-status-available" : ""}`, "aria-hidden": "true" }),
432
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
433
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("strong", { children: [
434
+ source.id,
435
+ " ",
436
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-ext-count", children: skills.filter((skill) => skill.sourceId === source.id).length })
437
+ ] }),
438
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: source.location }),
439
+ source.issue && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: t(`issue_${source.issue}`) })
440
+ ] })
441
+ ] }),
442
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
443
+ "button",
444
+ {
445
+ type: "button",
446
+ role: "switch",
447
+ "aria-checked": source.enabled,
448
+ disabled: busy,
449
+ onClick: () => request("enable", { id: source.id, enabled: !source.enabled }),
450
+ children: t(source.enabled ? "disable" : "enable")
451
+ }
452
+ )
453
+ ] }, source.id)) })
454
+ ] });
455
+ }
456
+ function McpSection({ t, useManager, request }) {
457
+ const state = useManager((value) => value);
458
+ const [form, setForm] = (0, import_react.useState)(false);
459
+ const busy = state.loading || state.saving;
460
+ const rows = state.extensions.filter((row) => row.kind === "mcp");
461
+ useLiveRefresh(request);
462
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "dsh-ext", children: [
463
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { className: "dsh-ext-heading", children: [
464
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
465
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: t("navMcp") }),
466
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("mcpIntro") })
467
+ ] }),
468
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", disabled: busy, onClick: () => request("list"), children: t("refresh") })
469
+ ] }),
470
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageState, { state, t }),
471
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "dsh-ext-card", children: [
472
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { children: [
473
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h3", { children: [
474
+ t("mcp"),
475
+ " ",
476
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-ext-count", children: rows.length })
477
+ ] }),
478
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", disabled: busy || !state.revision, onClick: () => setForm(true), children: t("addMcp") })
479
+ ] }),
480
+ rows.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-ext-empty", children: [
481
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("emptyMcp") }),
482
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("emptyMcpHint") })
483
+ ] }),
484
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { children: rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { children: [
485
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-ext-details", children: [
486
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: row.id }),
487
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: row.location }),
488
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(McpRuntime, { row, t })
489
+ ] }),
490
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
491
+ "button",
492
+ {
493
+ type: "button",
494
+ role: "switch",
495
+ "aria-checked": row.enabled,
496
+ "aria-label": `${t(row.enabled ? "disable" : "enable")} ${row.id}`,
497
+ disabled: busy,
498
+ onClick: () => request("enable", { id: row.id, enabled: !row.enabled }),
499
+ children: t(row.enabled ? "disable" : "enable")
500
+ }
501
+ )
502
+ ] }, row.id)) }),
503
+ form && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AddForm, { kind: "mcp", t, busy, onCancel: () => setForm(false), onSave: async (args) => {
504
+ if (await request("add-mcp", args)) setForm(false);
505
+ } })
506
+ ] }),
507
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dsh-ext-footnote", children: t("mcpFootnote") })
508
+ ] });
509
+ }
510
+ function useLiveRefresh(request) {
511
+ (0, import_react.useEffect)(() => {
512
+ void request("list");
513
+ let timer;
514
+ const poll = () => {
515
+ if (document.visibilityState === "visible") void request("list", {}, { silent: true });
516
+ timer = window.setTimeout(poll, settingsPollIntervalMs);
517
+ };
518
+ const refreshWhenVisible = () => {
519
+ if (document.visibilityState === "visible") void request("list", {}, { silent: true });
520
+ };
521
+ timer = window.setTimeout(poll, settingsPollIntervalMs);
522
+ document.addEventListener("visibilitychange", refreshWhenVisible);
523
+ return () => {
524
+ window.clearTimeout(timer);
525
+ document.removeEventListener("visibilitychange", refreshWhenVisible);
526
+ };
527
+ }, [request]);
528
+ }
529
+ function PageState({ state, t }) {
530
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
531
+ state.loading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { role: "status", children: t("loading") }),
532
+ state.error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dsh-ext-notice", role: "alert", children: t(state.error) }),
533
+ state.saved && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dsh-ext-notice", role: "status", children: t("saved") })
534
+ ] });
535
+ }
536
+ function skillState(skill) {
537
+ return !skill.valid ? "invalid" : !skill.sourceEnabled || !skill.modelInvocable && !skill.userInvocable ? "disabled" : skill.shadowed ? "shadowed" : !skill.modelInvocable ? "manual" : "available";
538
+ }
539
+ function SkillRow({ skill, source, groups, t, busy, request }) {
540
+ const state = skillState(skill);
541
+ const invocation = skill.modelInvocable && skill.userInvocable ? "both" : skill.modelInvocable ? "modelOnly" : skill.userInvocable ? "manualOnly" : "none";
542
+ const statusLabel = !skill.valid ? "skillStatusInvalid" : !skill.sourceEnabled ? "skillStatusSourceDisabled" : skill.shadowed ? "skillStatusShadowed" : "";
543
+ const update = (patch) => request("set-skill-invocation", {
544
+ sourceId: skill.sourceId,
545
+ relativePath: skill.relativePath,
546
+ skillRevision: skill.revision,
547
+ modelInvocable: skill.modelInvocable,
548
+ userInvocable: skill.userInvocable,
549
+ ...patch
550
+ });
551
+ 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: [
552
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-skill-name", children: [
553
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `dsh-ext-status dsh-ext-status-${state}`, "aria-hidden": "true" }),
554
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: skill.name }),
555
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-skill-badge", children: t(`format_${skill.format}`) }),
556
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-skill-badge", children: t(`invocation_${invocation}`) }),
557
+ skill.group && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-skill-badge dsh-skill-badge-group", children: skill.group }),
558
+ statusLabel && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `dsh-skill-badge dsh-skill-badge-${state}`, children: t(statusLabel) })
559
+ ] }),
560
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: skill.description || t("noDescription") }),
561
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("code", { children: [
562
+ source?.id,
563
+ " \xB7 ",
564
+ skill.relativePath
565
+ ] }),
566
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", { children: [
567
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("summary", { children: t("details") }),
568
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-skill-detail", children: [
569
+ skill.whenToUse && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [
570
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("whenToUse") }),
571
+ skill.whenToUse
572
+ ] }),
573
+ skill.issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
574
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("diagnostics") }),
575
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { children: skill.issues.map((issue) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: t(`issue_${issue}`) }, issue)) })
576
+ ] }),
577
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-skill-invocation", children: [
578
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("invocation") }),
579
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
580
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "checkbox", checked: skill.modelInvocable, disabled: busy || !skill.valid, onChange: (event) => update({ modelInvocable: event.target.checked }) }),
581
+ " ",
582
+ t("modelInvocable")
583
+ ] }),
584
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
585
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "checkbox", checked: skill.userInvocable, disabled: busy || !skill.valid, onChange: (event) => update({ userInvocable: event.target.checked }) }),
586
+ " ",
587
+ t("userInvocable")
588
+ ] })
589
+ ] }),
590
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SkillGroupEditor, { skill, groups, t, busy, request }),
591
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
592
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("resources") }),
593
+ 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") })
594
+ ] })
595
+ ] })
596
+ ] })
597
+ ] }) });
598
+ }
599
+ function SkillGroupEditor({ skill, groups, t, busy, request }) {
600
+ const currentGroup = skill.group ?? "";
601
+ const [group, setGroup] = (0, import_react.useState)(currentGroup);
602
+ const suggestions = (0, import_react.useId)();
603
+ (0, import_react.useEffect)(() => setGroup(currentGroup), [currentGroup]);
604
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { className: "dsh-skill-group-editor", onSubmit: (event) => {
605
+ event.preventDefault();
606
+ void request("set-skill-group", { sourceId: skill.sourceId, relativePath: skill.relativePath, skillRevision: skill.revision, group });
607
+ }, children: [
608
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
609
+ t("customGroup"),
610
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
611
+ "input",
612
+ {
613
+ list: suggestions,
614
+ value: group,
615
+ maxLength: 64,
616
+ disabled: busy || !skill.valid,
617
+ onChange: (event) => setGroup(event.target.value),
618
+ placeholder: t("groupPlaceholder")
619
+ }
620
+ )
621
+ ] }),
622
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("datalist", { id: suggestions, children: groups.map((name) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: name }, name)) }),
623
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "submit", disabled: busy || !skill.valid || group.trim() === currentGroup, children: t("saveGroup") })
624
+ ] });
625
+ }
626
+ function McpRuntime({ row, t }) {
627
+ const tools = row.tools ?? [];
628
+ const state = !row.enabled ? "disabled" : tools.length ? "available" : "waiting";
629
+ const prefix = `mcp__${row.id}__`;
630
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-ext-runtime", children: [
631
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `dsh-ext-status dsh-ext-status-${state}`, "aria-hidden": "true" }),
632
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-ext-status-label", children: t(`status_${state}`) }),
633
+ tools.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", { children: [
634
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("summary", { children: [
635
+ t("tools"),
636
+ " \xB7 ",
637
+ tools.length
638
+ ] }),
639
+ /* @__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)) })
640
+ ] })
641
+ ] });
642
+ }
643
+ function NewSkillForm({ sources, t, busy, onSave, onCancel }) {
644
+ const prefix = (0, import_react.useId)();
645
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("form", { className: "dsh-ext-form dsh-skill-create", onSubmit: (event) => {
646
+ event.preventDefault();
647
+ const data = new FormData(event.currentTarget);
648
+ void onSave({
649
+ sourceId: data.get("sourceId"),
650
+ name: data.get("name"),
651
+ description: data.get("description"),
652
+ whenToUse: data.get("whenToUse"),
653
+ modelInvocable: data.has("modelInvocable"),
654
+ userInvocable: data.has("userInvocable"),
655
+ structure: data.get("structure")
656
+ });
657
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("fieldset", { disabled: busy, children: [
658
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { htmlFor: `${prefix}-sourceId`, children: [
659
+ t("source"),
660
+ /* @__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)) })
661
+ ] }),
662
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { htmlFor: `${prefix}-name`, children: [
663
+ t("skillName"),
664
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { id: `${prefix}-name`, name: "name", required: true, pattern: "[a-z0-9]+(?:-[a-z0-9]+)*", autoComplete: "off" })
665
+ ] }),
666
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "dsh-ext-span", htmlFor: `${prefix}-description`, children: [
667
+ t("description"),
668
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("textarea", { id: `${prefix}-description`, name: "description", rows: 3, required: true })
669
+ ] }),
670
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "dsh-ext-span", htmlFor: `${prefix}-whenToUse`, children: [
671
+ t("whenToUse"),
672
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("textarea", { id: `${prefix}-whenToUse`, name: "whenToUse", rows: 2 })
673
+ ] }),
674
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { htmlFor: `${prefix}-structure`, children: [
675
+ t("structure"),
676
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { id: `${prefix}-structure`, name: "structure", children: [
677
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "minimal", children: t("structureMinimal") }),
678
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "standard", children: t("structureStandard") })
679
+ ] })
680
+ ] }),
681
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-skill-create-flags", children: [
682
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: t("invocation") }),
683
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
684
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "checkbox", name: "modelInvocable", defaultChecked: true }),
685
+ " ",
686
+ t("modelInvocable")
687
+ ] }),
688
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
689
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "checkbox", name: "userInvocable", defaultChecked: true }),
690
+ " ",
691
+ t("userInvocable")
692
+ ] })
693
+ ] }),
694
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-ext-actions", children: [
695
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: onCancel, children: t("cancel") }),
696
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "submit", children: t(busy ? "saving" : "create") })
697
+ ] })
698
+ ] }) });
699
+ }
700
+ function AddForm({ kind, t, busy, onSave, onCancel }) {
701
+ const prefix = (0, import_react.useId)();
702
+ const [transport, setTransport] = (0, import_react.useState)("stdio");
703
+ const field = (name, required = true, multiline = false) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { htmlFor: `${prefix}-${name}`, children: [
704
+ t(name),
705
+ 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 } : {} })
706
+ ] });
707
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("form", { className: "dsh-ext-form", onSubmit: (event) => {
708
+ event.preventDefault();
709
+ const data = Object.fromEntries(new FormData(event.currentTarget));
710
+ const args = kind === "skill" ? { directory: data.directory } : {
711
+ id: data.id,
712
+ configuration: JSON.stringify(transport === "stdio" ? { transport, command: data.command, args: data.args.split(/\r?\n/).filter(Boolean), cwd: data.cwd } : { transport, url: data.url })
713
+ };
714
+ void onSave(args);
715
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("fieldset", { disabled: busy, children: [
716
+ kind === "skill" ? field("directory") : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
717
+ field("id"),
718
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { htmlFor: `${prefix}-transport`, children: [
719
+ t("transport"),
720
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { id: `${prefix}-transport`, value: transport, onChange: (event) => setTransport(event.target.value), children: [
721
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "stdio", children: t("stdio") }),
722
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "streamable-http", children: t("http") })
723
+ ] })
724
+ ] }),
725
+ transport === "stdio" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
726
+ field("command"),
727
+ field("args", false, true),
728
+ field("cwd", false)
729
+ ] }) : field("url"),
730
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("secret") })
731
+ ] }),
732
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-ext-actions", children: [
733
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: onCancel, children: t("cancel") }),
734
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "submit", children: t(busy ? "saving" : "save") })
735
+ ] })
736
+ ] }) });
737
+ }
738
+
739
+ return module.exports;}});