@linxin666/dsh-client-ui-community-plugins 0.2.9 → 0.3.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 DELETED
@@ -1,2023 +0,0 @@
1
- window.__ModuleLoader__.load({
2
- id: "@linxin666/dsh-client-ui-community-plugins",
3
- factory: (require) => {
4
- var module = { exports: {} };
5
- var exports = module.exports;
6
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
- let react = require("react");
8
- let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
9
- let react_jsx_runtime = require("react/jsx-runtime");
10
- let _deepseek_ai_dsh_client_runtime_client = require("@deepseek-ai/dsh-client-runtime/client");
11
- //#region \0dsh-css:packages/dsh-community-plugins/src/client/settings-card.module.css.mjs
12
- const css$1 = ".hX6Abq_card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);border-radius:12px;list-style:none;transition:border-color .16s,background .16s}.hX6Abq_card:hover{border-color:var(--dsw-alias-label-dimmed)}.hX6Abq_cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed)}.hX6Abq_header{appearance:none;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:12px;align-items:center;gap:12px;padding:14px 16px;display:flex}.hX6Abq_header:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}.hX6Abq_headerStatic{border-radius:12px;align-items:center;gap:12px;width:100%;padding:14px 16px;display:flex}.hX6Abq_headText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}.hX6Abq_name{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:1.4}.hX6Abq_description{color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:1.5}.hX6Abq_pending{white-space:nowrap;background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-label-secondary);border-radius:999px;flex:none;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}.hX6Abq_chevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .16s}.hX6Abq_chevronOpen{transform:rotate(180deg)}.hX6Abq_body{border-top:1px solid var(--dsw-alias-border-l2);margin:0 16px;padding-bottom:8px}.hX6Abq_readOnly{color:var(--dsw-alias-label-tertiary);margin:12px 0 0;font-size:12px;line-height:1.5}.hX6Abq_notExposed{color:var(--dsw-alias-state-warn-primary);margin:12px 0 0;font-size:12px;line-height:1.5}.hX6Abq_footer{border-top:1px solid var(--dsw-alias-border-l2);justify-content:flex-end;align-items:center;gap:8px;padding:12px 0 4px;display:flex}.hX6Abq_failed{min-width:0;color:var(--dsw-alias-label-error);text-overflow:ellipsis;white-space:nowrap;flex:1;margin:0;font-size:12px;line-height:1.5;overflow:hidden}.hX6Abq_discard,.hX6Abq_save{appearance:none;font:inherit;cursor:pointer;border:1px solid #0000;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5}.hX6Abq_discard{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);background:0 0}.hX6Abq_discard:hover:not(:disabled){color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-dimmed)}.hX6Abq_save{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3)}.hX6Abq_discard:disabled,.hX6Abq_save:disabled{opacity:.4;cursor:default}.hX6Abq_discard:focus-visible,.hX6Abq_save:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}.hX6Abq_field{flex-direction:column;gap:6px;padding:12px 0;display:flex}.hX6Abq_field+.hX6Abq_field{border-top:1px solid var(--dsw-alias-border-l2)}.hX6Abq_head{align-items:center;gap:8px;display:flex}.hX6Abq_label{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:13px;font-weight:500;line-height:1.5}.hX6Abq_badges{align-items:center;gap:8px;display:inline-flex}.hX6Abq_badge{white-space:nowrap;background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-label-secondary);border-radius:999px;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}.hX6Abq_reset{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;padding:0;font-size:12px;line-height:1.5}.hX6Abq_reset:hover:not(:disabled){color:var(--dsw-alias-label-primary)}.hX6Abq_reset:disabled{cursor:default}.hX6Abq_reset:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px;outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}.hX6Abq_input,.hX6Abq_select{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);height:34px;font:inherit;color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 12px;font-size:13px;line-height:1.5}.hX6Abq_input:focus-visible,.hX6Abq_select:focus-visible{border-color:var(--dsw-alias-brand-primary);outline:none}.hX6Abq_input:disabled,.hX6Abq_select:disabled{color:var(--dsw-alias-label-tertiary);cursor:default}.hX6Abq_inputInvalid{border:1px solid var(--dsw-alias-label-error);background:var(--dsw-alias-bg-layer-3);height:34px;font:inherit;color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 12px;font-size:13px;line-height:1.5}.hX6Abq_inputInvalid:focus-visible{outline:2px solid var(--dsw-alias-label-error);outline-offset:1px;border-color:var(--dsw-alias-label-error)}.hX6Abq_selectWrap{position:relative}.hX6Abq_selectButton{appearance:none;text-align:left;cursor:pointer;justify-content:space-between;align-items:center;gap:8px;width:100%;display:flex}.hX6Abq_selectLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.hX6Abq_selectChevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .16s}.hX6Abq_selectChevronOpen{transform:rotate(180deg)}.hX6Abq_selectPopup{z-index:40;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);max-height:240px;box-shadow:0 8px 24px var(--dsw-alias-bg-mask-2);opacity:0;border-radius:8px;flex-direction:column;padding:4px;transition:opacity .1s,transform .1s;display:flex;position:absolute;top:calc(100% + 4px);left:0;right:0;overflow-y:auto;transform:translateY(-4px)}.hX6Abq_selectPopupOpen{opacity:1;transform:none}.hX6Abq_selectPopupClose{opacity:0;pointer-events:none;transform:translateY(-4px)}.hX6Abq_selectOption{color:var(--dsw-alias-label-primary);cursor:pointer;white-space:nowrap;text-overflow:ellipsis;border-radius:6px;flex-shrink:0;padding:6px 10px;font-size:13px;line-height:1.5;overflow:hidden}.hX6Abq_selectOption:hover,.hX6Abq_selectOptionActive{background:var(--dsw-alias-interactive-bg-hover)}.hX6Abq_selectOptionSelected{color:var(--dsw-alias-brand-primary);background:color-mix(in srgb, var(--dsw-alias-brand-primary-new-colorprimary-new-color) 10%, transparent);font-weight:500}.hX6Abq_invalid{color:var(--dsw-alias-label-error);margin:0;font-size:12px;line-height:1.5}.hX6Abq_hint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:1.5}@media (prefers-reduced-motion:reduce){.hX6Abq_card,.hX6Abq_header,.hX6Abq_chevron,.hX6Abq_chevronOpen,.hX6Abq_discard,.hX6Abq_save,.hX6Abq_selectChevron,.hX6Abq_selectChevronOpen,.hX6Abq_selectPopup{transition:none}}";
13
- const tagId$1 = "@linxin666/dsh-client-ui-community-plugins/settings-card.module.css";
14
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$1) + "]") === null) {
15
- const tag = document.createElement("style");
16
- tag.dataset.plugin = "@linxin666/dsh-client-ui-community-plugins";
17
- tag.dataset.pluginCss = tagId$1;
18
- tag.textContent = css$1;
19
- document.head.appendChild(tag);
20
- }
21
- var settings_card_module_css_default = {
22
- "badge": "hX6Abq_badge",
23
- "badges": "hX6Abq_badges",
24
- "body": "hX6Abq_body",
25
- "card": "hX6Abq_card",
26
- "cardOpen": "hX6Abq_cardOpen",
27
- "chevron": "hX6Abq_chevron",
28
- "chevronOpen": "hX6Abq_chevronOpen",
29
- "description": "hX6Abq_description",
30
- "discard": "hX6Abq_discard",
31
- "failed": "hX6Abq_failed",
32
- "field": "hX6Abq_field",
33
- "footer": "hX6Abq_footer",
34
- "head": "hX6Abq_head",
35
- "headText": "hX6Abq_headText",
36
- "header": "hX6Abq_header",
37
- "headerStatic": "hX6Abq_headerStatic",
38
- "hint": "hX6Abq_hint",
39
- "input": "hX6Abq_input",
40
- "inputInvalid": "hX6Abq_inputInvalid",
41
- "invalid": "hX6Abq_invalid",
42
- "label": "hX6Abq_label",
43
- "name": "hX6Abq_name",
44
- "notExposed": "hX6Abq_notExposed",
45
- "pending": "hX6Abq_pending",
46
- "readOnly": "hX6Abq_readOnly",
47
- "reset": "hX6Abq_reset",
48
- "save": "hX6Abq_save",
49
- "select": "hX6Abq_select",
50
- "selectButton": "hX6Abq_selectButton",
51
- "selectChevron": "hX6Abq_selectChevron",
52
- "selectChevronOpen": "hX6Abq_selectChevronOpen",
53
- "selectLabel": "hX6Abq_selectLabel",
54
- "selectOption": "hX6Abq_selectOption",
55
- "selectOptionActive": "hX6Abq_selectOptionActive",
56
- "selectOptionSelected": "hX6Abq_selectOptionSelected",
57
- "selectPopup": "hX6Abq_selectPopup",
58
- "selectPopupClose": "hX6Abq_selectPopupClose",
59
- "selectPopupOpen": "hX6Abq_selectPopupOpen",
60
- "selectWrap": "hX6Abq_selectWrap"
61
- };
62
- //#endregion
63
- //#region src/client/PluginSettingsCard.tsx
64
- /**
65
- * Family-shared chrome for plugin settings cards: a disclosure header naming
66
- * the plugin and what its settings govern, the controls inside, and the save
67
- * that writes them. Renders nothing while the namespace is unavailable — a
68
- * deployment that does not compose the owning plugin should show no trace of
69
- * it. Inlined into each consumer's client bundle; mirrors the official
70
- * ui-plugin-config PluginCard in a self-contained slice.
71
- */
72
- /**
73
- * Render one plugin settings card.
74
- * @param props - the plugin's copy keys, its form state, and its controls.
75
- * @returns the card, or nothing while the namespace is still loading.
76
- */
77
- function PluginSettingsCard(props) {
78
- const [open, setOpen] = (0, react.useState)(props.defaultOpen ?? true);
79
- const { state, alwaysOpen } = props;
80
- if (!state.available) return null;
81
- const title = props.t(props.titleKey);
82
- const description = props.t(props.descriptionKey);
83
- const blocked = !state.dirty || state.invalid || state.saving;
84
- const expanded = alwaysOpen === true || open;
85
- const cardClass = expanded ? `${settings_card_module_css_default.cardOpen} ${settings_card_module_css_default.card}` : settings_card_module_css_default.card;
86
- const header = alwaysOpen === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
87
- className: settings_card_module_css_default.headerStatic,
88
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
89
- className: settings_card_module_css_default.headText,
90
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
91
- className: settings_card_module_css_default.name,
92
- title,
93
- children: title
94
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
95
- className: settings_card_module_css_default.description,
96
- title: description,
97
- children: description
98
- })]
99
- }), state.dirty ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
100
- className: settings_card_module_css_default.pending,
101
- title: props.t("settings.unsaved"),
102
- children: props.t("settings.unsaved")
103
- }) : null]
104
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
105
- type: "button",
106
- className: settings_card_module_css_default.header,
107
- "aria-expanded": open,
108
- "aria-label": `${props.t(open ? "settings.collapse" : "settings.expand")}: ${title}`,
109
- onClick: () => {
110
- setOpen(!open);
111
- },
112
- children: [
113
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
114
- className: settings_card_module_css_default.headText,
115
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
116
- className: settings_card_module_css_default.name,
117
- title,
118
- children: title
119
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
120
- className: settings_card_module_css_default.description,
121
- title: description,
122
- children: description
123
- })]
124
- }),
125
- state.dirty ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
126
- className: settings_card_module_css_default.pending,
127
- title: props.t("settings.unsaved"),
128
- children: props.t("settings.unsaved")
129
- }) : null,
130
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
131
- width: "14",
132
- height: "14",
133
- viewBox: "0 0 14 14",
134
- fill: "none",
135
- xmlns: "http://www.w3.org/2000/svg",
136
- className: open ? `${settings_card_module_css_default.chevron} ${settings_card_module_css_default.chevronOpen}` : settings_card_module_css_default.chevron,
137
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
138
- d: "M11.8486 5.5L11.4238 5.92383L8.69727 8.65137C8.44157 8.90706 8.21562 9.13382 8.01172 9.29785C7.79912 9.46883 7.55595 9.61756 7.25 9.66602C7.08435 9.69222 6.91565 9.69222 6.75 9.66602C6.44405 9.61756 6.20088 9.46883 5.98828 9.29785C5.78438 9.13382 5.55843 8.90706 5.30273 8.65137L2.57617 5.92383L2.15137 5.5L3 4.65137L3.42383 5.07617L6.15137 7.80273C6.42595 8.07732 6.59876 8.24849 6.74023 8.3623C6.87291 8.46904 6.92272 8.47813 6.9375 8.48047C6.97895 8.48703 7.02105 8.48703 7.0625 8.48047C7.07728 8.47813 7.12709 8.46904 7.25977 8.3623C7.40124 8.24849 7.57405 8.07732 7.84863 7.80273L10.5762 5.07617L11 4.65137L11.8486 5.5Z",
139
- fill: "currentColor"
140
- })
141
- })
142
- ]
143
- });
144
- if (!state.exposed) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
145
- className: cardClass,
146
- children: [header, expanded ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
147
- className: settings_card_module_css_default.body,
148
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
149
- className: settings_card_module_css_default.notExposed,
150
- role: "status",
151
- children: props.t("settings.notExposed")
152
- })
153
- }) : null]
154
- });
155
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
156
- className: cardClass,
157
- children: [header, expanded ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
158
- className: settings_card_module_css_default.body,
159
- children: [
160
- !state.writable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
161
- className: settings_card_module_css_default.readOnly,
162
- role: "status",
163
- children: props.t("settings.readOnly")
164
- }) : null,
165
- props.children,
166
- props.hideFooter === true ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
167
- className: settings_card_module_css_default.footer,
168
- children: [
169
- state.failed ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
170
- className: settings_card_module_css_default.failed,
171
- role: "status",
172
- children: [props.t("settings.saveFailed"), state.failedReason ? " - " + state.failedReason : ""]
173
- }) : null,
174
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
175
- type: "button",
176
- className: settings_card_module_css_default.discard,
177
- disabled: !state.dirty || state.saving,
178
- onClick: props.onDiscard,
179
- children: props.t("settings.discard")
180
- }),
181
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
182
- type: "button",
183
- className: settings_card_module_css_default.save,
184
- disabled: blocked,
185
- onClick: props.onSave,
186
- children: props.t(!state.saving ? "settings.save" : "settings.saving")
187
- })
188
- ]
189
- })
190
- ]
191
- }) : null]
192
- });
193
- }
194
- const NON_SKIN_BODY_MARKERS = /* @__PURE__ */ new Set(["dshSkinCenter", "dshSidebarCollapsed"]);
195
- function isSkinActive() {
196
- return Object.keys(document.body.dataset).some((key) => key.startsWith("dsh") && !NON_SKIN_BODY_MARKERS.has(key));
197
- }
198
- const SELECT_CLOSE_MS = 100;
199
- /**
200
- * The shared dual-mode select control. While an appearance skin is active it
201
- * renders the legacy native `<select>` untouched, so element-level skin
202
- * selectors keep working; under the default appearance it renders a
203
- * self-drawn `role="listbox"` popup whose open/close is transition-animated.
204
- * Staged cards reach it through BooleanField/ChoiceField; immediate-apply
205
- * editors (the side-card prefs) bind it directly through onEdit.
206
- * 双模式下拉框:皮肤激活时用原生 select,默认外观用自绘动画弹层。
207
- */
208
- function SelectField(props) {
209
- const { id, options, value } = props;
210
- const [open, setOpen] = (0, react.useState)(false);
211
- const [closing, setClosing] = (0, react.useState)(false);
212
- const [phase, setPhase] = (0, react.useState)("initial");
213
- const [activeIndex, setActiveIndex] = (0, react.useState)(0);
214
- const closeTimer = (0, react.useRef)(void 0);
215
- const wrapRef = (0, react.useRef)(null);
216
- const popupRef = (0, react.useRef)(null);
217
- const currentIndex = () => {
218
- const index = options.findIndex((option) => option.value === value);
219
- return index >= 0 ? index : 0;
220
- };
221
- const close = (0, react.useCallback)(() => {
222
- if (closeTimer.current !== void 0) clearTimeout(closeTimer.current);
223
- setClosing(true);
224
- closeTimer.current = setTimeout(() => {
225
- setClosing(false);
226
- setOpen(false);
227
- }, SELECT_CLOSE_MS);
228
- }, []);
229
- const openPopup = () => {
230
- if (closeTimer.current !== void 0) clearTimeout(closeTimer.current);
231
- setActiveIndex(currentIndex());
232
- setPhase("initial");
233
- setClosing(false);
234
- setOpen(true);
235
- };
236
- const commit = (index) => {
237
- const option = options[index];
238
- if (option) props.onEdit(option.value);
239
- close();
240
- };
241
- const onTriggerClick = () => {
242
- if (props.disabled) return;
243
- if (open && !closing) close();
244
- else openPopup();
245
- };
246
- const onKeyDown = (event) => {
247
- if (props.disabled) return;
248
- const count = options.length;
249
- switch (event.key) {
250
- case "ArrowDown":
251
- case "ArrowUp":
252
- case "Enter":
253
- case " ":
254
- event.preventDefault();
255
- if (!open) openPopup();
256
- else if (!closing) if (event.key === "ArrowDown") setActiveIndex((index) => (index + 1) % count);
257
- else if (event.key === "ArrowUp") setActiveIndex((index) => (index - 1 + count) % count);
258
- else commit(activeIndex);
259
- break;
260
- case "Escape":
261
- if (open) {
262
- event.preventDefault();
263
- event.stopPropagation();
264
- close();
265
- }
266
- break;
267
- case "Tab":
268
- if (open) close();
269
- break;
270
- }
271
- };
272
- (0, react.useEffect)(() => () => {
273
- if (closeTimer.current !== void 0) clearTimeout(closeTimer.current);
274
- }, []);
275
- (0, react.useLayoutEffect)(() => {
276
- if (open && !closing && phase === "initial") {
277
- popupRef.current?.offsetHeight;
278
- setPhase("open");
279
- }
280
- }, [
281
- open,
282
- closing,
283
- phase
284
- ]);
285
- (0, react.useEffect)(() => {
286
- if (!open) return;
287
- const onPointerDown = (event) => {
288
- const target = event.target;
289
- if (target instanceof Node && !wrapRef.current?.contains(target)) close();
290
- };
291
- document.addEventListener("pointerdown", onPointerDown);
292
- return () => document.removeEventListener("pointerdown", onPointerDown);
293
- }, [open, close]);
294
- (0, react.useEffect)(() => {
295
- if (props.disabled && open) close();
296
- }, [
297
- props.disabled,
298
- open,
299
- close
300
- ]);
301
- if (isSkinActive()) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
302
- id,
303
- className: settings_card_module_css_default.select,
304
- value,
305
- disabled: props.disabled,
306
- onChange: (event) => {
307
- props.onEdit(event.target.value);
308
- },
309
- children: options.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
310
- value: option.value,
311
- children: option.label
312
- }, option.value))
313
- });
314
- const label = options.find((option) => option.value === value)?.label ?? "";
315
- const popupClass = closing ? `${settings_card_module_css_default.selectPopup} ${settings_card_module_css_default.selectPopupClose}` : phase === "open" ? `${settings_card_module_css_default.selectPopup} ${settings_card_module_css_default.selectPopupOpen}` : settings_card_module_css_default.selectPopup;
316
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
317
- className: settings_card_module_css_default.selectWrap,
318
- ref: wrapRef,
319
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
320
- type: "button",
321
- id,
322
- className: `${settings_card_module_css_default.select} ${settings_card_module_css_default.selectButton}`,
323
- disabled: props.disabled,
324
- "aria-haspopup": "listbox",
325
- "aria-expanded": open,
326
- "aria-activedescendant": open ? `${id}-o${activeIndex}` : void 0,
327
- "aria-invalid": props.invalid || void 0,
328
- onClick: onTriggerClick,
329
- onKeyDown,
330
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
331
- className: settings_card_module_css_default.selectLabel,
332
- children: label
333
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
334
- width: "14",
335
- height: "14",
336
- viewBox: "0 0 14 14",
337
- fill: "none",
338
- xmlns: "http://www.w3.org/2000/svg",
339
- className: open ? `${settings_card_module_css_default.selectChevron} ${settings_card_module_css_default.selectChevronOpen}` : settings_card_module_css_default.selectChevron,
340
- "aria-hidden": "true",
341
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
342
- d: "M11.8486 5.5L11.4238 5.92383L8.69727 8.65137C8.44157 8.90706 8.21562 9.13382 8.01172 9.29785C7.79912 9.46883 7.55595 9.61756 7.25 9.66602C7.08435 9.69222 6.91565 9.69222 6.75 9.66602C6.44405 9.61756 6.20088 9.46883 5.98828 9.29785C5.78438 9.13382 5.55843 8.90706 5.30273 8.65137L2.57617 5.92383L2.15137 5.5L3 4.65137L3.42383 5.07617L6.15137 7.80273C6.42595 8.07732 6.59876 8.24849 6.74023 8.3623C6.87291 8.46904 6.92272 8.47813 6.9375 8.48047C6.97895 8.48703 7.02105 8.48703 7.0625 8.48047C7.07728 8.47813 7.12709 8.46904 7.25977 8.3623C7.40124 8.24849 7.57405 8.07732 7.84863 7.80273L10.5762 5.07617L11 4.65137L11.8486 5.5Z",
343
- fill: "currentColor"
344
- })
345
- })]
346
- }), open ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
347
- className: popupClass,
348
- role: "listbox",
349
- ref: popupRef,
350
- children: options.map((option, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
351
- id: `${id}-o${index}`,
352
- role: "option",
353
- "aria-selected": option.value === value,
354
- className: `${settings_card_module_css_default.selectOption}${option.value === value ? ` ${settings_card_module_css_default.selectOptionSelected}` : ""}${index === activeIndex && !closing ? ` ${settings_card_module_css_default.selectOptionActive}` : ""}`,
355
- onClick: () => {
356
- commit(index);
357
- },
358
- children: option.label
359
- }, option.value))
360
- }) : null]
361
- });
362
- }
363
- /** A staged boolean field: 继承 / 开 / 关. */
364
- function BooleanField(props) {
365
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
366
- className: settings_card_module_css_default.field,
367
- children: [
368
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
369
- className: settings_card_module_css_default.head,
370
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
371
- className: settings_card_module_css_default.label,
372
- htmlFor: props.id,
373
- children: props.label
374
- }), props.overridden ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
375
- className: settings_card_module_css_default.badges,
376
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
377
- className: settings_card_module_css_default.badge,
378
- children: props.overriddenLabel
379
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
380
- type: "button",
381
- className: settings_card_module_css_default.reset,
382
- disabled: props.disabled,
383
- onClick: props.onReset,
384
- children: props.resetLabel
385
- })]
386
- }) : null]
387
- }),
388
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectField, {
389
- id: props.id,
390
- options: [
391
- {
392
- value: "",
393
- label: props.inheritLabel
394
- },
395
- {
396
- value: "true",
397
- label: props.onLabel
398
- },
399
- {
400
- value: "false",
401
- label: props.offLabel
402
- }
403
- ],
404
- value: props.text,
405
- disabled: props.disabled,
406
- invalid: props.invalid,
407
- onEdit: props.onEdit
408
- }),
409
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
410
- className: settings_card_module_css_default.hint,
411
- children: props.hint
412
- })
413
- ]
414
- });
415
- }
416
- //#endregion
417
- //#region src/client/settings-form.ts
418
- /** A boolean field, edited through true/false draft text. */
419
- function booleanField(field) {
420
- return {
421
- field,
422
- format: (value) => typeof value === "boolean" ? String(value) : "",
423
- parse: (text) => {
424
- const trimmed = text.trim();
425
- if (trimmed === "") return { kind: "clear" };
426
- if (trimmed === "true") return {
427
- kind: "set",
428
- value: true
429
- };
430
- if (trimmed === "false") return {
431
- kind: "set",
432
- value: false
433
- };
434
- }
435
- };
436
- }
437
- /**
438
- * Stages one card's edits over one settings namespace and writes them on save.
439
- *
440
- * The Host is the only authority on whether a value was accepted — its
441
- * validators own the constraints no schema can express — so the outcome is
442
- * read back from the section rather than predicted here. A save that did not
443
- * land keeps its drafts, so the user can correct them instead of retyping.
444
- */
445
- var CardForm = class {
446
- scope;
447
- specs;
448
- staged = /* @__PURE__ */ new Map();
449
- listeners = /* @__PURE__ */ new Set();
450
- /** The scope subscription installed in the constructor; released by dispose(). */
451
- disposeScope;
452
- disposed = false;
453
- saving = false;
454
- failed = false;
455
- failedReason;
456
- /** @param scope - the bound settings scope for this card's namespace. */
457
- constructor(scope, specs) {
458
- this.scope = scope;
459
- this.specs = new Map(specs.map((spec) => [spec.field, spec]));
460
- this.disposeScope = scope.subscribe(() => {
461
- this.publish();
462
- });
463
- }
464
- /**
465
- * Release the scope subscription and every bound store listener. The card
466
- * must call this on teardown; later calls are no-ops.
467
- */
468
- dispose() {
469
- if (this.disposed) return;
470
- this.disposed = true;
471
- this.disposeScope();
472
- this.listeners.clear();
473
- }
474
- /** Publish a projection of this form, rebuilt whenever the scope or a draft changes. */
475
- bind(project) {
476
- const store = (0, _deepseek_ai_dsh_client_runtime_client.createSnapshotStore)(project());
477
- this.listeners.add(() => {
478
- store.set(project());
479
- });
480
- return store;
481
- }
482
- /** Read the card-level state: what the Host serves, and what a save would do. */
483
- shell() {
484
- const snapshot = this.scope.getSnapshot();
485
- const plan = this.plan();
486
- return {
487
- available: snapshot.status !== "loading",
488
- exposed: snapshot.status === "ready",
489
- writable: snapshot.writable,
490
- dirty: plan.length > 0,
491
- invalid: plan.some((item) => item.run === void 0),
492
- saving: this.saving,
493
- failed: this.failed,
494
- ...this.failedReason === void 0 ? {} : { failedReason: this.failedReason }
495
- };
496
- }
497
- /** Read one field's state from the effective section and its staged draft. */
498
- field(field) {
499
- const spec = this.specOf(field);
500
- const staged = this.staged.get(field);
501
- if (staged === void 0) return {
502
- text: spec.format(this.sectionValue(field)),
503
- overridden: this.stored(field),
504
- invalid: false
505
- };
506
- const write = staged.clear ? { kind: "clear" } : spec.parse(staged.text);
507
- return {
508
- text: staged.text,
509
- overridden: write?.kind === "set",
510
- invalid: write === void 0
511
- };
512
- }
513
- /** The actions the card's slot registration injects. */
514
- actions() {
515
- return {
516
- edit: (field, text) => {
517
- this.stage(field, {
518
- text,
519
- clear: false
520
- });
521
- },
522
- resetField: (field) => {
523
- this.stage(field, {
524
- text: this.specOf(field).format(this.baseValue(field)),
525
- clear: true
526
- });
527
- },
528
- save: () => {
529
- this.save();
530
- },
531
- discard: () => {
532
- if (this.staged.size === 0 && !this.failed) return;
533
- this.staged.clear();
534
- this.failed = false;
535
- this.failedReason = void 0;
536
- this.publish();
537
- }
538
- };
539
- }
540
- /**
541
- * Write every staged edit, then re-seed from what the Host accepted.
542
- *
543
- * When the scope carries the optional batch surface (the dsh-web-ui
544
- * bridge scope), every planned write rides one mutation so cross-field
545
- * validate hooks (baseURL+model) judge the batch as a unit instead of
546
- * deadlocking on per-field writes. Otherwise the per-field loop runs.
547
- * A field lands only when the Host reports it held the staged value; a
548
- * landed field's draft is dropped, a failed one stays staged for the user.
549
- * @returns settlement after every write and the read-back.
550
- */
551
- async save() {
552
- const plan = this.plan();
553
- const valid = plan.filter((item) => item.run !== void 0);
554
- if (plan.length === 0 || this.saving || valid.length !== plan.length) return;
555
- const plannedWrites = valid.map((item) => item.op);
556
- const pending = /* @__PURE__ */ new Map();
557
- for (const item of plan) pending.set(item.field, this.staged.get(item.field));
558
- this.saving = true;
559
- this.failed = false;
560
- this.failedReason = void 0;
561
- this.publish();
562
- const landed = /* @__PURE__ */ new Set();
563
- const batch = this.batchedScope();
564
- if (batch !== void 0) {
565
- const result = await batch.mutate(plannedWrites);
566
- if (result.ok) {
567
- for (const field of result.fields) if (field.landed) landed.add(field.field);
568
- } else this.failedReason = result.message;
569
- } else for (const item of valid) if (await item.run()) landed.add(item.field);
570
- for (const [field, before] of pending) if (landed.has(field) && this.staged.get(field) === before) this.staged.delete(field);
571
- this.saving = false;
572
- this.failed = landed.size !== pending.size;
573
- this.publish();
574
- }
575
- /** The scope's batch surface when it supports one; undefined conservatively otherwise. */
576
- batchedScope() {
577
- const candidate = this.scope;
578
- return typeof candidate?.mutate === "function" ? candidate : void 0;
579
- }
580
- /**
581
- * Every staged edit a save would write. An entry whose draft is not a value
582
- * its field accepts carries no write: the form is still dirty, and the save
583
- * refuses rather than dropping the edit. A staged edit that matches the
584
- * effective section is not a write at all.
585
- * @returns the planned writes, in the order the fields were staged.
586
- */
587
- plan() {
588
- const plan = [];
589
- for (const [field, staged] of this.staged) {
590
- const spec = this.specOf(field);
591
- if (staged.clear) {
592
- if (this.stored(field)) plan.push({
593
- field,
594
- op: {
595
- field,
596
- op: "unset"
597
- },
598
- run: () => this.clear(field)
599
- });
600
- continue;
601
- }
602
- if (staged.text === spec.format(this.sectionValue(field))) continue;
603
- const write = spec.parse(staged.text);
604
- if (write === void 0) plan.push({
605
- field,
606
- op: {
607
- field,
608
- op: "unset"
609
- },
610
- run: void 0
611
- });
612
- else if (write.kind === "clear") plan.push({
613
- field,
614
- op: {
615
- field,
616
- op: "unset"
617
- },
618
- run: () => this.clear(field)
619
- });
620
- else plan.push({
621
- field,
622
- op: {
623
- field,
624
- op: "set",
625
- value: write.value
626
- },
627
- run: () => this.store(field, write.value)
628
- });
629
- }
630
- return plan;
631
- }
632
- async clear(field) {
633
- await this.scope.unset(field);
634
- return !this.stored(field);
635
- }
636
- async store(field, value) {
637
- await this.scope.set(field, value);
638
- if (this.specOf(field).secret) return true;
639
- return this.userLayer()?.[field] === value;
640
- }
641
- stage(field, edit) {
642
- this.staged.set(field, edit);
643
- this.failed = false;
644
- this.failedReason = void 0;
645
- this.publish();
646
- }
647
- specOf(field) {
648
- const spec = this.specs.get(field);
649
- if (spec === void 0) throw new Error(`settings card has no field ${field}`);
650
- return spec;
651
- }
652
- snapshotOf() {
653
- return this.scope.getSnapshot();
654
- }
655
- sectionValue(field) {
656
- return this.snapshotOf().value?.[field];
657
- }
658
- baseValue(field) {
659
- return this.snapshotOf().base?.[field];
660
- }
661
- userLayer() {
662
- return this.snapshotOf().user;
663
- }
664
- stored(field) {
665
- const user = this.userLayer();
666
- return user !== void 0 && Object.hasOwn(user, field);
667
- }
668
- publish() {
669
- for (const listener of this.listeners) listener();
670
- }
671
- };
672
- //#endregion
673
- //#region src/client/generated/community.ts
674
- /**
675
- * AUTO-GENERATED by scripts/community-index — do not edit by hand.
676
- * Community plugin index for the settings page: every entry links to the
677
- * contributor's own repository. This repository never vendors the listed
678
- * plugins — it only points users at them.
679
- * Regenerate with `node scripts/community-index`.
680
- */
681
- /** Stable category ids rendered as marketplace-style filter pills (the runtime guard imports this). */
682
- const COMMUNITY_CATEGORIES = [
683
- "ui",
684
- "agent",
685
- "tools",
686
- "knowledge",
687
- "integration",
688
- "security",
689
- "utility"
690
- ];
691
- /** Every community plugin, in community.json order. */
692
- const COMMUNITY_PLUGINS = [
693
- {
694
- "id": "dsh-data-agent",
695
- "name": "Data Agent",
696
- "nameEn": "Data Agent",
697
- "author": "omdsh-dev",
698
- "repo": "https://github.com/omdsh-dev/dsh-data-agent",
699
- "description": "为 DSH 定义专用 Data Agent 预设,让 AI 帮你查询、更新、分析数据。",
700
- "descriptionEn": "Defines a dedicated Data Agent preset for DSH so the AI can query, update and analyze data.",
701
- "category": "agent"
702
- },
703
- {
704
- "id": "dsh-tui",
705
- "name": "dsh-TUI",
706
- "nameEn": "dsh-TUI",
707
- "author": "ccch1mneyyy",
708
- "repo": "https://github.com/ccch1mneyyy/dsh-TUI",
709
- "description": "Claude Code 风格全屏交互终端插件:像素鲸鱼顶栏、实时工作状态行、思考流式展开、双击 Esc 回滚、上下文进度条与 TPS 仪表。",
710
- "descriptionEn": "A Claude Code style fullscreen interactive terminal plugin: pixel-whale header, live working-state line, streaming reasoning expansion, double-Esc rollback, context progress bar and TPS gauges.",
711
- "category": "ui"
712
- },
713
- {
714
- "id": "dsh-tianshu-tui",
715
- "name": "天书 TUI",
716
- "nameEn": "Tianshu TUI",
717
- "author": "huiliyi37",
718
- "repo": "https://github.com/huiliyi37/dsh-tianshu-tui",
719
- "description": "基于官方 DeepSeek Harness 的交互式终端 UI 插件,在官方基础上增加 TDD 与证据门等工作流。",
720
- "descriptionEn": "An interactive terminal UI plugin for DeepSeek Harness that adds TDD and evidence-gate workflows on top of the official base.",
721
- "category": "ui"
722
- },
723
- {
724
- "id": "dsh-chat-summary",
725
- "name": "Chat Summary",
726
- "nameEn": "Chat Summary",
727
- "author": "v833",
728
- "repo": "https://github.com/v833/dsh-chat-summary",
729
- "description": "总结当前对话并导出为 Markdown / DOCX / PDF,可选 LLM 智能总结(用户自配 API Key)。",
730
- "descriptionEn": "Summarize the current conversation and export it as Markdown / DOCX / PDF, with optional LLM summarization using your own API key.",
731
- "category": "knowledge"
732
- },
733
- {
734
- "id": "dsh-builtin-toggles",
735
- "name": "内置能力检查器",
736
- "nameEn": "Built-in Capability Inspector",
737
- "author": "Starfie1d1272",
738
- "repo": "https://github.com/Starfie1d1272/dsh-builtin-toggles",
739
- "description": "Evidence-backed 内置 capability Inspector:展示 DSH Web built-in capability 的 provenance、compatibility 与 structural drift;仅对 9 个经过审阅的 UI leaves 提供 fail-closed 开关。",
740
- "descriptionEn": "Evidence-backed built-in capability Inspector: surfaces provenance, compatibility and structural drift of DSH Web built-ins, with fail-closed toggles for only the nine reviewed UI leaves.",
741
- "npm": "dsh-builtin-toggles",
742
- "category": "tools"
743
- },
744
- {
745
- "id": "dsh-pilot",
746
- "name": "Pilot 浏览器驾驶舱",
747
- "nameEn": "Pilot Browser Cockpit",
748
- "author": "guo6x",
749
- "repo": "https://github.com/guo6x/dsh-pilot",
750
- "description": "给 agent 一双会开车的手:零依赖 CDP 浏览器操控(8 个 pilot_* 工具:导航/点击/输入/按键/JS/截图)+ Web GUI 可拖拽驾驶舱面板,无需 Playwright、无需 API key。",
751
- "descriptionEn": "Give your agent hands: zero-dependency CDP browser control (8 pilot_* tools: navigate/click/type/keys/eval/screenshot) plus a draggable cockpit panel in the Web GUI - no Playwright, no API key.",
752
- "category": "tools"
753
- },
754
- {
755
- "id": "dsh-housekeeper",
756
- "name": "环境管家",
757
- "nameEn": "Environment Housekeeper",
758
- "author": "guo6x",
759
- "repo": "https://github.com/guo6x/dsh-housekeeper",
760
- "description": "管住 agent 的脏手:工具链台账(node/pnpm/git/gh/ffmpeg 等自动探测)、缓存与临时目录扫描 + 白名单安全一键清理、机器规则 AGENTS.md 查看编辑,全在设置面板完成。",
761
- "descriptionEn": "Keep your agent's hands clean: toolchain inventory, scratch/cache scan with whitelist-guarded one-click cleanup, and the machine rules file (AGENTS.md) view/edit - all in the settings panel.",
762
- "category": "utility"
763
- },
764
- {
765
- "id": "dsh-deepread",
766
- "name": "DeepRead 精读助手",
767
- "nameEn": "DeepRead Assistant",
768
- "author": "xiehuan123",
769
- "repo": "https://github.com/xiehuan123/dsh-deepread",
770
- "description": "五种模式精读插件(quick / deep / map / feynman / book),支持公众号链接与文件输入、批量对比、预算预检与后台任务进度透明,导出 md / mm / html,Web UI 提供工具结果卡片与精读面板。",
771
- "descriptionEn": "A five-mode deep reading plugin (quick / deep / map / feynman / book) for links and files, with batch comparison, budget preflight, transparent background-job progress, md / mm / html exports, and Web UI tool-result cards plus a reading panel.",
772
- "npm": "dsh-deepread",
773
- "category": "knowledge"
774
- },
775
- {
776
- "id": "dsh-mnemon",
777
- "name": "Mnemon 记忆系统",
778
- "nameEn": "Mnemon Memory",
779
- "author": "omdsh-dev",
780
- "repo": "https://github.com/omdsh-dev/dsh-mnemon",
781
- "description": "与 Mnemon CLI 集成的跨 Agent、本地优先持久记忆插件:用户画像 / 工作记忆 / 项目档案与长期 Memory Spaces,支持导入导出。",
782
- "descriptionEn": "A cross-agent, local-first persistent memory plugin integrating the Mnemon CLI: profiles, working memory, project documents and long-term Memory Spaces, with import and export.",
783
- "npm": "dsh-mnemon",
784
- "category": "knowledge"
785
- },
786
- {
787
- "id": "dsh-plugin-hub",
788
- "name": "插件中心(dsh-plugin-hub)",
789
- "nameEn": "Plugin Hub",
790
- "author": "Noob-stupid",
791
- "repo": "https://github.com/Noob-stupid/dsh-plugin-hub",
792
- "description": "插件管理面板:已安装插件一键启用/停用,内置 GitHub dsh-plugin 插件市场(官方/聚合识别、子包浏览、一键安装与本地 AI 兜底修复、删除卸载),版本检测与一键更新、框架一键升级。",
793
- "descriptionEn": "Plugin management panel: one-click enable/disable, a GitHub dsh-plugin marketplace with official/aggregate detection, subpackage browsing, one-click installs with local-AI fallback repair, uninstall, update detection and one-click framework upgrade.",
794
- "npm": "@noob-stupid/dsh-plugin-console",
795
- "category": "tools"
796
- },
797
- {
798
- "id": "dsh-genui",
799
- "name": "GenUI 生成式 UI",
800
- "nameEn": "GenUI",
801
- "author": "omdsh-dev",
802
- "repo": "https://github.com/omdsh-dev/dsh-genui",
803
- "description": "给模型输出配交互式 UI:助手回复内联渲染 dsh-ui 围栏(布局、图表、表格、表单、Mermaid、3D、原生音视频),双通道渲染兼容原版 DSH 与新构建,支持流式渲染、面板停靠与组件交互回传模型。",
804
- "descriptionEn": "Interactive UI inside assistant replies via the dsh-ui fence: layouts, charts, tables, forms, quizzes, Mermaid, 3D and native audio/video. Dual-channel rendering covers stock DSH and newer builds, with streaming render, panel docking and component actions that loop back to the model.",
805
- "category": "ui"
806
- },
807
- {
808
- "id": "dsh-annotation",
809
- "name": "选中批注",
810
- "nameEn": "Selection Annotation",
811
- "author": "omdsh-dev",
812
- "repo": "https://github.com/omdsh-dev/dsh-annotation",
813
- "description": "选中助手文字即可批注,回车随消息发送;自己的气泡只显示问题与「批注 ×N」标签,模型按 Annotation N 逐条对照回复(悬浮芯片);UI 与批注块跟随 DSH 语言切换 zh/en,Cmd/Ctrl+Enter 可直发纯批注,斜杠命令原样放行。",
814
- "descriptionEn": "Select text in an assistant reply to annotate it; annotations ride along with your next message, hidden in your own bubble behind an Annotations xN chip, and the model replies per Annotation N with hoverable chips. UI and annotation block follow the DSH locale (zh/en); Cmd/Ctrl+Enter sends annotations alone; slash commands pass through.",
815
- "category": "ui"
816
- },
817
- {
818
- "id": "deepseek-harness-auth",
819
- "name": "DeepSeek Harness Auth",
820
- "nameEn": "DeepSeek Harness Auth",
821
- "author": "taichuy",
822
- "repo": "https://github.com/taichuy/deepseek-harness-auth",
823
- "description": "为 DSH Web 公网部署提供登录认证前置代理,支持账号密码、验证码、失败锁定和 IP/CIDR 白名单。",
824
- "descriptionEn": "An authentication proxy for public DSH Web deployments with password login, captcha, failed-attempt locking, and IP/CIDR allowlists.",
825
- "npm": "deepseek-harness-auth",
826
- "category": "security"
827
- },
828
- {
829
- "id": "dsh-cloud-sync",
830
- "name": "云同步服务",
831
- "nameEn": "Cloud Sync",
832
- "author": "dickpy",
833
- "repo": "https://github.com/dickpy/dsh-cloud-sync",
834
- "description": "支持 WebDAV、S3、阿里云 OSS、腾讯云 COS 与 MinIO 的 DSH 云同步插件,可同步 profile、插件配置及本地插件源码归档。",
835
- "descriptionEn": "DSH cloud sync for WebDAV, S3, Alibaba Cloud OSS, Tencent Cloud COS and MinIO, syncing profiles, plugin settings and local plugin source archives.",
836
- "npm": "@dickpy/dsh-cloud-sync",
837
- "category": "integration"
838
- },
839
- {
840
- "id": "dsh-auto-memory",
841
- "name": "自动记忆",
842
- "nameEn": "Auto Memory",
843
- "author": "Aik358",
844
- "repo": "https://github.com/Aik358/dsh-auto-memory",
845
- "description": "三层自动记忆插件:用户级/项目笔记/每日日志自动注入与检索、每轮自动沉淀、AI 时段问候、智能检索、日历与工作区思维导图,支持继承 WorkBuddy/CodeBuddy/Claude Code/Codex 等其他 AI 工具的记忆。",
846
- "descriptionEn": "Three-layer auto memory for DSH: user-level/project-notes/daily-logs with automatic injection and retrieval, per-turn auto-consolidation, AI greetings, smart search, calendar, workspace mind map, and inheritance from WorkBuddy/CodeBuddy/Claude Code/Codex.",
847
- "npm": "@a9i5k4/dsh-auto-memory",
848
- "category": "knowledge"
849
- },
850
- {
851
- "id": "dsh-memoir",
852
- "name": "项目记忆 Memoir",
853
- "nameEn": "Project Memory Memoir",
854
- "author": "Qinling-Melon-Farmers",
855
- "repo": "https://github.com/Qinling-Melon-Farmers/dsh-memoir",
856
- "description": "项目持久化记忆与会话经验沉淀:memoir_record / memoir_read 工具(BM25 相关度排序检索)、每轮工作自动蒸馏、记忆诊断面板与跨项目全局检索,纯本地零外部依赖。",
857
- "descriptionEn": "Project persistent memory and session-lessons distillation: memoir_record / memoir_read tools with BM25-ranked retrieval, per-turn auto-distill, a memory diagnostics panel and cross-project search - fully local, no external dependency.",
858
- "npm": "dsh-memoir",
859
- "category": "knowledge"
860
- },
861
- {
862
- "id": "dsh-worktime-board",
863
- "name": "牛马修仙看板",
864
- "nameEn": "Worktime Cultivation Board",
865
- "author": "spacexun2",
866
- "repo": "https://github.com/spacexun2/dsh-worktime-board",
867
- "description": "DeepSeek Harness 工时统计 × 修仙养成:日/周/月/学年四档汇总 agent 活跃时长、token、输入与工具调用,十二重境界(炼气→宇宙洪荒)量化进度,纯本地存储。",
868
- "descriptionEn": "Worktime statistics meets cultivation: daily / weekly / monthly / yearly agent activity, token, input and tool-call summaries with a twelve-realm progression (Qi Refining to Cosmic Chaos), fully local.",
869
- "npm": "dsh-worktime-board",
870
- "category": "utility"
871
- },
872
- {
873
- "id": "dsh-skill-explorer",
874
- "name": "技能中心(Skill Explorer)",
875
- "nameEn": "Skill Explorer",
876
- "author": "wingsky-1",
877
- "repo": "https://github.com/wingsky-1/dsh-skill-explorer",
878
- "description": "DSH 技能中心:按来源分级浏览已加载 skill(系统内置 / 项目 / 用户 / 自定义 / 运行时),支持启用/禁用、创建与删除(移入 .trash)。",
879
- "descriptionEn": "DSH skill center: browse loaded skills grouped by source (bundled / project / user / custom / runtime), with enable/disable, create and delete (move to .trash).",
880
- "npm": "@linxin666/dsh-client-ui-skill-explorer",
881
- "category": "tools"
882
- },
883
- {
884
- "id": "dsh-friendly-steps",
885
- "name": "过程精简 Friendly Steps",
886
- "nameEn": "Friendly Steps",
887
- "author": "dongwenxiu83-web",
888
- "repo": "https://github.com/dongwenxiu83-web/dsh-friendly-steps",
889
- "description": "面向文字工作者的过程精简:纯 CSS 折叠 Think / 工具调用等技术过程行,右下角浮条「已完成 N 步」一键展开收起,失败步骤红色计数反馈;不注入 React 列表、无全量扫描,零侵入。",
890
- "descriptionEn": "Writer-friendly process collapse: hides Think / tool-call rows via pure CSS behind a floating 'N steps done' pill with red failure counts and one-click expand/collapse. No foreign nodes in React lists, no full-DOM scans — zero interference.",
891
- "category": "ui"
892
- },
893
- {
894
- "id": "dsh-full-remote",
895
- "name": "全功能远程访问",
896
- "nameEn": "Full Remote Access",
897
- "author": "JUANWANG-BUAA",
898
- "repo": "https://github.com/JUANWANG-BUAA/dsh-full-remote",
899
- "description": "令牌门控反向代理:公网隧道或局域网下,在手机等设备上远程使用 DeepSeek Harness,设置、凭据与文件访问保持可用,支持按设备会话。",
900
- "descriptionEn": "Token-gated reverse proxy for remote access: use DeepSeek Harness over public tunnels or LAN from phones and other devices, with settings, credentials and file access kept working and per-device sessions.",
901
- "npm": "dsh-full-remote",
902
- "category": "integration"
903
- },
904
- {
905
- "id": "dsh-palate",
906
- "name": "Palate 品味训练",
907
- "nameEn": "Palate Design Taste",
908
- "author": "guo6x",
909
- "repo": "https://github.com/guo6x/dsh-palate",
910
- "description": "会长大的眼:可积累的设计品味语料库(好/坏例子 + 编码原则),喂得越多评审越准;6 个 palate_* 工具(review/add/learn/list/principles/stats)+ 成长面板,node:sqlite + 人可读 Markdown 镜像,零运行时依赖。",
911
- "descriptionEn": "An eye that grows: an accumulated design-taste corpus (good/bad examples plus codified principles) that sharpens with every example you feed; six palate_* tools (review/add/learn/list/principles/stats) plus a growth panel, node:sqlite with human-readable Markdown mirrors, zero runtime dependencies.",
912
- "category": "knowledge"
913
- },
914
- {
915
- "id": "dsh-history-tree",
916
- "name": "历史树",
917
- "nameEn": "History Tree",
918
- "author": "z953218350",
919
- "repo": "https://github.com/z953218350/dsh-history-tree",
920
- "description": "在聊天消息左侧提供 Codex 风格对话轮次时间线点阵与悬浮历史概览卡片,支持鱼眼放大动效与点击直达对应轮次。",
921
- "descriptionEn": "Codex-style conversation turn timeline rail and hover overview cards beside chat messages, with fish-eye magnification and click-to-jump navigation.",
922
- "npm": "dsh-history-tree",
923
- "category": "ui"
924
- },
925
- {
926
- "id": "dsh-gzip",
927
- "name": "dsh-gzip",
928
- "nameEn": "dsh-gzip",
929
- "author": "wingsky-1",
930
- "repo": "https://github.com/wingsky-1/dsh-plugin-hub/tree/main/packages/dsh-gzip",
931
- "description": "/api 响应 gzip 压缩插件:为远程 / 低带宽链路开启 /api 响应压缩,解决会话历史因大响应无压缩而超时加载失败的问题;SSE / zip / 已编码响应自动豁免,无全局副作用。",
932
- "descriptionEn": "API response gzip plugin for DSH Web GUI: enables gzip on /api responses for remote / low-bandwidth links, fixing session-history loads that fail on the timeout of large uncompressed responses; SSE, zip and already-encoded responses are passed through untouched, with no global side effects.",
933
- "npm": "@wingsky-1/dsh-gzip"
934
- },
935
- {
936
- "id": "dsh-wsl-bridge",
937
- "name": "WSL Windows 桥",
938
- "nameEn": "WSL Windows Bridge",
939
- "author": "ch1bug",
940
- "repo": "https://github.com/ch1bug/dsh-wsl-bridge",
941
- "description": "让 WSL 里的 agent 访问 Windows 侧:读写 C:\\ 文件、运行 .exe、Explorer 打开、wslpath 路径互转与盘符枚举(win_ls/read/write/run/open/path/drives)。",
942
- "descriptionEn": "Lets a WSL agent reach the Windows host: read/write C:\\ files, run .exe programs, open in Explorer, convert paths via wslpath and list drives (win_ls/read/write/run/open/path/drives).",
943
- "category": "integration"
944
- },
945
- {
946
- "id": "dsh-mimo-agent-tools",
947
- "name": "MiMo 多模态工具",
948
- "nameEn": "MiMo Multimodal Tools",
949
- "author": "ch1bug",
950
- "repo": "https://github.com/ch1bug/dsh-mimo-agent-tools",
951
- "description": "把小米 MiMo API 封装为 agent 工具:联网搜索、图像/音频/视频理解、语音转写、语音合成与音色克隆(mimo_search/vision/audio/video/asr/tts/voiceclone)。",
952
- "descriptionEn": "Turns the Xiaomi MiMo API into agent tools: web search, image/audio/video understanding, speech-to-text, text-to-speech and voice cloning (mimo_search/vision/audio/video/asr/tts/voiceclone).",
953
- "category": "tools"
954
- },
955
- {
956
- "id": "dsh-skill-fuzzy",
957
- "name": "技能模糊搜索",
958
- "nameEn": "Skill Fuzzy Search",
959
- "author": "ch1bug",
960
- "repo": "https://github.com/ch1bug/dsh-skill-fuzzy",
961
- "description": "Codex 风格模糊技能搜索:/bug、/diag、/regression 都能在 / 技能菜单里命中 diagnosing-bugs(名称子序列 + 描述连续子串匹配)。",
962
- "descriptionEn": "Codex-style fuzzy skill search: /bug, /diag and /regression all find diagnosing-bugs in the / skill menu (name subsequence + description substring matching).",
963
- "category": "ui"
964
- },
965
- {
966
- "id": "dsh-secret-redactor",
967
- "name": "敏感信息脱敏",
968
- "nameEn": "Secret Redactor",
969
- "author": "DamonKoy",
970
- "repo": "https://github.com/DamonKoy/dsh-plugins/tree/main/packages/dsh-secret-redactor",
971
- "description": "自动掩码工具输出中的 API key、token、JWT、私钥与配置密钥。",
972
- "descriptionEn": "Auto-masks API keys, tokens, JWTs and private keys in tool results shown to the model."
973
- },
974
- {
975
- "id": "dsh-approve-for-me",
976
- "name": "自动审批审核",
977
- "nameEn": "Approve for Me",
978
- "author": "DamonKoy",
979
- "repo": "https://github.com/DamonKoy/dsh-plugins/tree/main/packages/dsh-approve-for-me",
980
- "description": "只读工具自动放行、危险命令自动拒绝,可配置全自动模式。",
981
- "descriptionEn": "Auto-approves read-only tools, auto-denies dangerous commands, optional full-auto mode."
982
- },
983
- {
984
- "id": "dsh-mcp-client-v2",
985
- "name": "MCP 客户端 v2",
986
- "nameEn": "MCP Client v2",
987
- "author": "DamonKoy",
988
- "repo": "https://github.com/DamonKoy/dsh-plugins/tree/main/packages/dsh-mcp-client-v2",
989
- "description": "MCP 客户端增强:分页工具发现、非阻塞启动、工具搜索。",
990
- "descriptionEn": "Enhanced MCP client: paginated tool discovery, non-blocking startup, tool search."
991
- },
992
- {
993
- "id": "dsh-memories",
994
- "name": "项目记忆",
995
- "nameEn": "Project Memories",
996
- "author": "DamonKoy",
997
- "repo": "https://github.com/DamonKoy/dsh-plugins/tree/main/packages/dsh-memories",
998
- "description": "按项目作用域持久化的键值记忆,支持增删查列与搜索。",
999
- "descriptionEn": "Project-scoped persistent key-value memories with set/get/list/delete/search."
1000
- },
1001
- {
1002
- "id": "dsh-system-proxy",
1003
- "name": "系统代理",
1004
- "nameEn": "System Proxy",
1005
- "author": "DamonKoy",
1006
- "repo": "https://github.com/DamonKoy/dsh-plugins/tree/main/packages/dsh-system-proxy",
1007
- "description": "检测系统代理(scutil/环境变量/PAC)并为子进程导出代理环境变量。",
1008
- "descriptionEn": "Detects system proxy (scutil/env/PAC) and exports proxy env for child processes."
1009
- },
1010
- {
1011
- "id": "dsh-usage-cost",
1012
- "name": "用量成本提醒",
1013
- "nameEn": "Usage & Cost",
1014
- "author": "DamonKoy",
1015
- "repo": "https://github.com/DamonKoy/dsh-plugins/tree/main/packages/dsh-usage-cost",
1016
- "description": "统计会话与每日 token 用量和估算成本,超预算提醒。",
1017
- "descriptionEn": "Tracks token usage and estimated cost per session/day with budget alerts."
1018
- },
1019
- {
1020
- "id": "dsh-notifier",
1021
- "name": "dsh-notifier",
1022
- "nameEn": "dsh-notifier",
1023
- "author": "wingsky-1",
1024
- "repo": "https://github.com/wingsky-1/dsh-plugin-hub/tree/main/packages/dsh-notifier",
1025
- "description": "审批/完成/错误事件通知:浏览器 Notification + 系统原生 toast(Windows PowerShell WinRT / Linux·macOS notify-send,零依赖);提示音可配、错误同类合并、免打扰时段、通知历史与配置面板;非安全上下文自动降级横幅。",
1026
- "descriptionEn": "Approval / completion / error event notifications: browser Notification API plus native OS toasts (Windows PowerShell WinRT, Linux and macOS notify-send, zero dependencies); configurable sound, error merging, quiet hours, notification history and a settings panel; falls back to in-page banners outside secure contexts.",
1027
- "npm": "@wingsky-1/dsh-notifier",
1028
- "category": "utility"
1029
- },
1030
- {
1031
- "id": "dsh-logicprobe",
1032
- "name": "逻辑探针",
1033
- "nameEn": "Logic Probe",
1034
- "author": "AmethystLuna",
1035
- "repo": "https://github.com/AmethystLuna/logicprobe",
1036
- "description": "AI 智能体声明核查技能:枚举设计文档与重构计划中的每个可验证声明,对照代码库事实逐条核验;行为类声明升级为逻辑原语验证(7 项结构检查 + 7 项对抗探针),重构前后模型对比做回归检测,输出 file:line 证据。",
1037
- "descriptionEn": "Claim verification for AI coding agents: enumerate every verifiable claim in design docs and refactoring plans, verify against codebase facts, then escalate behavioral claims to logic-primitive verification (7 structural checks + 7 adversarial probes), with before/after model comparison for refactoring regression detection.",
1038
- "category": "tools"
1039
- },
1040
- {
1041
- "id": "dsh-chatgpt-subscription",
1042
- "name": "子代理管理",
1043
- "nameEn": "Subagent Management",
1044
- "author": "Aa728848",
1045
- "repo": "https://github.com/Aa728848/dsh-chatgpt-subscription",
1046
- "description": "让 DSH 通过 ChatGPT 订阅使用 GPT 系列模型:PKCE OAuth 登录、DPAPI/钥匙串/0600 凭据存储、流式 Responses、图片生成、Codex 搜索、额度展示与子代理管理。",
1047
- "descriptionEn": "Use GPT models in DSH through your ChatGPT subscription: PKCE OAuth login, DPAPI/keychain/0600 credential storage, streaming Responses, image generation, Codex search, quota display and subagent management.",
1048
- "npm": "@eddyskywalker/dsh-chatgpt-subscription",
1049
- "category": "integration"
1050
- },
1051
- {
1052
- "id": "dsh-imagegen",
1053
- "name": "AI 生图",
1054
- "nameEn": "AI ImageGen",
1055
- "author": "dickpy",
1056
- "repo": "https://github.com/dickpy/dsh-imagegen",
1057
- "description": "AI 生图插件:通过可配置的 OpenAI 兼容端点(gpt-image-2 / gpt-image-1 / dall-e-3)实现文生图与图生图,提供生成历史、提示词模板库与 API 设置卡片。",
1058
- "descriptionEn": "AI image generation for the DSH Web GUI: text-to-image and image-to-image through a configurable OpenAI-compatible endpoint (gpt-image-2 / gpt-image-1 / dall-e-3), with generation history, a prompt template library and an API settings card.",
1059
- "npm": "@dickpy/dsh-imagegen",
1060
- "category": "tools"
1061
- },
1062
- {
1063
- "id": "dsh-api-visualizer",
1064
- "name": "接口捕获",
1065
- "nameEn": "API Capture",
1066
- "author": "lemonmmice",
1067
- "repo": "https://github.com/lemonmmice/dsh-api-visualizer",
1068
- "description": "Fiddler 式实时抓包面板:tail 客户端 System.Net 跟踪日志自动解析 HTTP 请求/响应(gzip 自动解包)并实时入库,内置本地 MITM 代理可抓任意进程,支持筛选 / 详情 / 导出 / 重放 / 标记。",
1069
- "descriptionEn": "Fiddler-style realtime capture panel: tails the client's System.Net trace log into live HTTP request/response records (gzip auto-decompressed), plus a built-in local MITM proxy for arbitrary processes, with filters, detail view, export, replay and flags.",
1070
- "category": "tools"
1071
- },
1072
- {
1073
- "id": "dsh-postman",
1074
- "name": "接口调试",
1075
- "nameEn": "API Debugger",
1076
- "author": "lemonmmice",
1077
- "repo": "https://github.com/lemonmmice/dsh-postman",
1078
- "description": "类 Postman 接口调试面板:由宿主服务端发起 HTTP 请求(绕过浏览器 CORS),支持 WebSocket / 原始 TCP / gRPC、鉴权助手、环境变量、cURL 导入导出、请求集合与历史。",
1079
- "descriptionEn": "Postman-style API debug panel: host-side HTTP requests without browser CORS limits, plus WebSocket / raw TCP / gRPC, auth helpers, env variables, cURL import/export, request collections and history.",
1080
- "category": "tools"
1081
- },
1082
- {
1083
- "id": "dsh-workspace-api",
1084
- "name": "企业信息查询 Agent",
1085
- "nameEn": "Workspace API",
1086
- "author": "liaoyonghong",
1087
- "repo": "https://github.com/liaoyonghong/dsh-workspace-api",
1088
- "description": "把企业文档变成可对话的聊天机器人:员工或应用系统用自然语言提问,AI 代理查阅文档后带出处回答;同时提供 workspace 内容 HTTP API。",
1089
- "descriptionEn": "Turn enterprise documents into a conversational Q&A bot: employees or apps ask in natural language and an AI agent answers with cited sources; also exposes a workspace content HTTP API.",
1090
- "npm": "dsh-workspace-api",
1091
- "category": "knowledge"
1092
- }
1093
- ];
1094
- //#endregion
1095
- //#region src/client/community-guard.ts
1096
- /**
1097
- * Runtime guard for the generated community index entries. The index is
1098
- * build-time generated data, but the card renders whatever the module
1099
- * carries; a hand-written narrowing keeps one malformed entry from breaking
1100
- * the whole list at render time.
1101
- */
1102
- /** Category ids the card knows how to label; others are treated as uncategorized. */
1103
- const KNOWN_CATEGORIES = COMMUNITY_CATEGORIES;
1104
- /**
1105
- * The install command is pasted into a shell, so repo/npm must be free of
1106
- * shell metacharacters: repo is a plain https URL of path-safe characters,
1107
- * npm a standard (optionally scoped) package name.
1108
- */
1109
- const REPO_SAFE_RE = /^https:\/\/[A-Za-z0-9._~\/-]+$/;
1110
- const NPM_SAFE_RE = /^(@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/;
1111
- /** True when the value is a well-formed community plugin entry. */
1112
- function isCommunityPluginEntry(value) {
1113
- if (typeof value !== "object" || value === null) return false;
1114
- const entry = value;
1115
- if (typeof entry.id !== "string" || entry.id === "") return false;
1116
- if (typeof entry.name !== "string" || typeof entry.nameEn !== "string") return false;
1117
- if (typeof entry.author !== "string" || entry.author === "") return false;
1118
- if (typeof entry.repo !== "string" || !REPO_SAFE_RE.test(entry.repo)) return false;
1119
- if (entry.description !== void 0 && typeof entry.description !== "string") return false;
1120
- if (entry.descriptionEn !== void 0 && typeof entry.descriptionEn !== "string") return false;
1121
- if (entry.npm !== void 0 && (typeof entry.npm !== "string" || !NPM_SAFE_RE.test(entry.npm))) return false;
1122
- if (entry.category !== void 0 && (typeof entry.category !== "string" || !KNOWN_CATEGORIES.includes(entry.category))) return false;
1123
- return true;
1124
- }
1125
- //#endregion
1126
- //#region src/client/plugin-manager-bridge.ts
1127
- let snapshot = {
1128
- face: null,
1129
- version: 0
1130
- };
1131
- const listeners = /* @__PURE__ */ new Set();
1132
- /** Replace the held face and notify subscribers. */
1133
- function setFace(face) {
1134
- snapshot = {
1135
- face,
1136
- version: snapshot.version + 1
1137
- };
1138
- for (const listener of listeners) listener();
1139
- }
1140
- /** Current bridge snapshot (cached reference, safe for useSyncExternalStore). */
1141
- function getPluginManagerSnapshot() {
1142
- return snapshot;
1143
- }
1144
- /** Subscribe to face changes; returns the unsubscribe function. */
1145
- function subscribePluginManager(listener) {
1146
- listeners.add(listener);
1147
- return () => {
1148
- listeners.delete(listener);
1149
- };
1150
- }
1151
- /**
1152
- * Bridge the optional 'pluginManager' service into the module store. Uses
1153
- * ctx.inject (NOT the plugin's module-level inject array) so the service
1154
- * stays optional: the inner callback runs when the sibling plugin provides
1155
- * the face and is disposed when it goes away, which clears the store.
1156
- * @param ctx - the client root context.
1157
- */
1158
- function bridgePluginManager(ctx) {
1159
- ctx.inject(["pluginManager"], (inner) => {
1160
- inner.effect(() => {
1161
- setFace(inner.pluginManager ?? null);
1162
- return () => {
1163
- setFace(null);
1164
- };
1165
- }, "community-plugins: pluginManager bridge");
1166
- });
1167
- }
1168
- //#endregion
1169
- //#region src/client/install-source.ts
1170
- /**
1171
- * The spec handed to pluginManager.install(): the npm package name when the
1172
- * entry is published there, else the repository URL (git install).
1173
- * @param entry - the community index entry.
1174
- * @returns the install spec.
1175
- */
1176
- function installSpec(entry) {
1177
- return entry.npm ?? entry.repo;
1178
- }
1179
- /**
1180
- * Normalize a git remote for comparison: lowercase, drop the transport
1181
- * prefix ('git+' wrapper, 'https://', 'http://', 'git://', 'ssh://git@', the
1182
- * scp-style 'git@host:' userinfo, and the pnpm host shorthands 'github:' /
1183
- * 'gitlab:' / 'bitbucket:' that package.json records for shorthand installs),
1184
- * then strip trailing slashes and one trailing '.git'
1185
- * suffix (repeated, so 'x/.git/' and 'x.git' converge). Conservative on
1186
- * purpose: no path rewriting beyond those steps, so distinct repositories
1187
- * never collapse onto each other.
1188
- * @param url - the repository URL as recorded by either side.
1189
- * @returns the comparison key.
1190
- */
1191
- function normalizeGitUrl(url) {
1192
- let key = url.trim().toLowerCase();
1193
- key = key.replace(/^git[+]/, "");
1194
- key = key.replace(/^(github|gitlab):/, "$1.com/");
1195
- key = key.replace(/^bitbucket:/, "bitbucket.org/");
1196
- key = key.replace(/^(?:https?|git):[/][/]/, "");
1197
- key = key.replace(/^ssh:[/][/]git@/, "");
1198
- key = key.replace(/^git@([^/:]+):/, "$1/");
1199
- for (;;) {
1200
- const next = key.replace(/[/]+$/, "").replace(/[.]git$/, "");
1201
- if (next === key) return key;
1202
- key = next;
1203
- }
1204
- }
1205
- /**
1206
- * Match one community entry against the installed snapshot. npm-published
1207
- * entries match on the installed row's package identity (id/name): the npm
1208
- * source spec records the dependency RANGE ('^0.3.2') or an install-time
1209
- * spec, not necessarily the bare package name, so it is only a fallback.
1210
- * Repository entries match on the normalized git URL. An entry with an npm
1211
- * field ONLY matches npm installs — a same-repository git install is a
1212
- * different source and stays unmatched (the card then offers install, which
1213
- * the host reconciles).
1214
- * @param entry - the community index entry.
1215
- * @param installed - the installed snapshot from the pluginManager service.
1216
- * @returns the matching installed row, or null.
1217
- */
1218
- function entryInstalled(entry, installed) {
1219
- if (entry.npm !== void 0) return installed.find((item) => item.source.kind === "npm" && (item.id === entry.npm || item.name === entry.npm || item.source.spec === entry.npm)) ?? null;
1220
- const key = normalizeGitUrl(entry.repo);
1221
- return installed.find((item) => item.source.kind === "git" && normalizeGitUrl(item.source.spec) === key) ?? null;
1222
- }
1223
- //#endregion
1224
- //#region \0dsh-css:packages/dsh-community-plugins/src/client/community.module.css.mjs
1225
- const css = ".z0J_8a_sectionList{margin:0;padding:0;list-style:none}.z0J_8a_market{flex-direction:column;gap:10px;margin-top:12px;display:flex}.z0J_8a_toolbar{display:flex}.z0J_8a_search{min-width:0;font:inherit;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l2);border-radius:6px;flex:1;padding:6px 10px;font-size:13px;line-height:1.5}.z0J_8a_search::placeholder{color:var(--dsw-alias-label-tertiary)}.z0J_8a_search:focus{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}.z0J_8a_search:disabled{opacity:.5}.z0J_8a_filters{flex-wrap:wrap;gap:6px;display:flex}.z0J_8a_pill{font:inherit;color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l2);cursor:pointer;border-radius:999px;padding:2px 10px;font-size:12px;line-height:1.6}.z0J_8a_pill:hover:enabled{color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-dimmed)}.z0J_8a_pill:disabled{opacity:.5;cursor:default}.z0J_8a_pillActive{color:var(--dsw-alias-bg-layer-3);background:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-primary);font-weight:600}.z0J_8a_pillActive:hover:enabled{color:var(--dsw-alias-bg-layer-3);border-color:var(--dsw-alias-label-primary)}.z0J_8a_resultCount{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:1.4}.z0J_8a_grid{grid-template-columns:repeat(auto-fill,minmax(256px,1fr));gap:8px;margin:0;padding:0;list-style:none;display:grid}.z0J_8a_card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);border-radius:8px;flex-direction:column;gap:6px;min-width:0;padding:12px;display:flex}.z0J_8a_card:hover{border-color:var(--dsw-alias-label-dimmed)}.z0J_8a_cardHead{justify-content:space-between;align-items:baseline;gap:8px;min-width:0;display:flex}.z0J_8a_cardBadges{flex:none;align-items:center;gap:4px;min-width:0;display:flex}.z0J_8a_cardName{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-weight:600;overflow:hidden}.z0J_8a_badge{color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-module-platform);border:1px solid var(--dsw-alias-border-l2);white-space:nowrap;border-radius:999px;flex:none;padding:0 8px;font-size:11px;line-height:1.6}.z0J_8a_badgePublished{color:var(--dsw-alias-link-primary,var(--dsw-alias-button-info-fill));border-color:var(--dsw-alias-link-primary,var(--dsw-alias-button-info-fill))}.z0J_8a_badgeInstalled{color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-dimmed);background:var(--dsw-alias-bg-layer-2)}.z0J_8a_cardMeta{min-width:0;color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;margin:0;font-size:12px;line-height:1.4;display:flex}.z0J_8a_cardCategory{color:var(--dsw-alias-label-secondary);white-space:nowrap;flex:none}.z0J_8a_cardDot{flex:none}.z0J_8a_cardAuthor{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.z0J_8a_cardDescription{color:var(--dsw-alias-label-secondary);-webkit-line-clamp:2;overflow-wrap:anywhere;-webkit-box-orient:vertical;margin:0;font-size:13px;line-height:1.45;display:-webkit-box;overflow:hidden}.z0J_8a_cardFooter{flex-direction:column;gap:6px;margin-top:auto;padding-top:6px;display:flex}.z0J_8a_cardTop{justify-content:space-between;align-items:center;gap:8px;min-width:0;display:flex}.z0J_8a_cardLink{color:var(--dsw-alias-link-primary,var(--dsw-alias-button-info-fill));font-size:13px;text-decoration:none}.z0J_8a_cardLink:hover{text-decoration:underline}.z0J_8a_cardCommand{box-sizing:border-box;width:100%;min-width:0;color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);white-space:nowrap;text-overflow:ellipsis;border-radius:4px;padding:2px 6px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px;overflow:hidden}.z0J_8a_installButton{font:inherit;color:var(--dsw-alias-bg-layer-3);background:var(--dsw-alias-button-info-fill);border:1px solid var(--dsw-alias-button-info-fill);cursor:pointer;white-space:nowrap;border-radius:6px;flex:none;padding:4px 12px;font-size:12px;font-weight:600;line-height:1.5}.z0J_8a_installButton:hover:enabled{opacity:.88}.z0J_8a_installButton:disabled{opacity:.5;cursor:default}.z0J_8a_installButtonCopied{color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-dimmed);background:0 0}.z0J_8a_installButtonSecondary{color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-border-l2);background:0 0}.z0J_8a_installButtonSecondary:hover:enabled{border-color:var(--dsw-alias-label-dimmed)}.z0J_8a_cardActions{flex:none;align-items:center;gap:6px;display:flex}.z0J_8a_progress{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:1.4}.z0J_8a_error{color:var(--dsw-alias-label-error,#c53030);overflow-wrap:anywhere;margin:0;font-size:12px;line-height:1.4}.z0J_8a_confirmBody{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px;line-height:1.5}.z0J_8a_modalActions{justify-content:flex-end;gap:8px;margin-top:16px;display:flex}.z0J_8a_dangerButton{background:var(--dsw-alias-label-error,#c53030);border-color:var(--dsw-alias-label-error,#c53030)}.z0J_8a_installNote{color:var(--dsw-alias-label-tertiary);margin:8px 2px 0;font-size:12px;line-height:1.4}.z0J_8a_empty{color:var(--dsw-alias-label-tertiary);margin:0;padding:8px 2px;font-size:13px}.z0J_8a_off{color:var(--dsw-alias-label-tertiary);margin:8px 2px 0;font-size:13px}.z0J_8a_notice{color:var(--dsw-alias-label-tertiary);margin:10px 2px 0;font-size:12px;line-height:1.4}";
1226
- const tagId = "@linxin666/dsh-client-ui-community-plugins/community.module.css";
1227
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
1228
- const tag = document.createElement("style");
1229
- tag.dataset.plugin = "@linxin666/dsh-client-ui-community-plugins";
1230
- tag.dataset.pluginCss = tagId;
1231
- tag.textContent = css;
1232
- document.head.appendChild(tag);
1233
- }
1234
- var community_module_css_default = {
1235
- "badge": "z0J_8a_badge",
1236
- "badgeInstalled": "z0J_8a_badgeInstalled",
1237
- "badgePublished": "z0J_8a_badgePublished",
1238
- "card": "z0J_8a_card",
1239
- "cardActions": "z0J_8a_cardActions",
1240
- "cardAuthor": "z0J_8a_cardAuthor",
1241
- "cardBadges": "z0J_8a_cardBadges",
1242
- "cardCategory": "z0J_8a_cardCategory",
1243
- "cardCommand": "z0J_8a_cardCommand",
1244
- "cardDescription": "z0J_8a_cardDescription",
1245
- "cardDot": "z0J_8a_cardDot",
1246
- "cardFooter": "z0J_8a_cardFooter",
1247
- "cardHead": "z0J_8a_cardHead",
1248
- "cardLink": "z0J_8a_cardLink",
1249
- "cardMeta": "z0J_8a_cardMeta",
1250
- "cardName": "z0J_8a_cardName",
1251
- "cardTop": "z0J_8a_cardTop",
1252
- "confirmBody": "z0J_8a_confirmBody",
1253
- "dangerButton": "z0J_8a_dangerButton",
1254
- "empty": "z0J_8a_empty",
1255
- "error": "z0J_8a_error",
1256
- "filters": "z0J_8a_filters",
1257
- "grid": "z0J_8a_grid",
1258
- "installButton": "z0J_8a_installButton",
1259
- "installButtonCopied": "z0J_8a_installButtonCopied",
1260
- "installButtonSecondary": "z0J_8a_installButtonSecondary",
1261
- "installNote": "z0J_8a_installNote",
1262
- "market": "z0J_8a_market",
1263
- "modalActions": "z0J_8a_modalActions",
1264
- "notice": "z0J_8a_notice",
1265
- "off": "z0J_8a_off",
1266
- "pill": "z0J_8a_pill",
1267
- "pillActive": "z0J_8a_pillActive",
1268
- "progress": "z0J_8a_progress",
1269
- "resultCount": "z0J_8a_resultCount",
1270
- "search": "z0J_8a_search",
1271
- "sectionList": "z0J_8a_sectionList",
1272
- "toolbar": "z0J_8a_toolbar"
1273
- };
1274
- //#endregion
1275
- //#region src/client/CommunityPluginsCard.tsx
1276
- /**
1277
- * The community plugin index card: a first-level settings section that is
1278
- * always open. Its own enable switch (backed by the community-plugins
1279
- * settings namespace) gates the list, which is presented marketplace-style:
1280
- * a search box, category filter pills with counts, and a two-column card grid
1281
- * whose entries link to contributors' own repositories — this package only
1282
- * indexes them, it never vendors their code.
1283
- */
1284
- /** Bridges the community-plugins scope onto the card's staged form. */
1285
- var CommunityPluginsCardController = class {
1286
- form;
1287
- store;
1288
- /** @param scope - the bound settings scope for the community-plugins namespace. */
1289
- constructor(scope) {
1290
- this.form = new CardForm(scope, [booleanField("enabled")]);
1291
- this.store = this.form.bind(() => this.projection());
1292
- }
1293
- projection() {
1294
- return {
1295
- ...this.form.shell(),
1296
- enabled: this.form.field("enabled")
1297
- };
1298
- }
1299
- /**
1300
- * Build the face the card's slot registration injects.
1301
- * @returns the card's snapshot and its form actions.
1302
- */
1303
- inject() {
1304
- return {
1305
- hooks: { communityPluginsCard: this.store },
1306
- ...this.form.actions()
1307
- };
1308
- }
1309
- /**
1310
- * Release the card's scope subscription and bound stores; the slot
1311
- * disposer calls this on teardown.
1312
- */
1313
- dispose() {
1314
- this.form.dispose();
1315
- }
1316
- };
1317
- /** The one-line install command for an entry: npm package when published, else the contributor repository URL. */
1318
- function installCommand(entry) {
1319
- return `dsh plugin --profile web add ${entry.npm ?? entry.repo}`;
1320
- }
1321
- /** Progress polling cadence while an install is in flight. */
1322
- const PROGRESS_POLL_MS = 500;
1323
- /** Extract a displayable reason from an install/uninstall rejection. */
1324
- function messageOf(reason) {
1325
- return reason instanceof Error ? reason.message : String(reason);
1326
- }
1327
- /**
1328
- * Localized entry copy read through the card's `t`. Falls back to the raw
1329
- * entry field when the key is missing — the dictionary only carries the
1330
- * generated registry, so injected test entries land on the fallback.
1331
- */
1332
- function entryCopy(t, key, fallback) {
1333
- const value = t(key);
1334
- return value === key ? fallback : value;
1335
- }
1336
- /** Maps a category id onto its locale dictionary key (kept in the generated union). */
1337
- const CATEGORY_KEY = {
1338
- ui: "category.ui",
1339
- agent: "category.agent",
1340
- tools: "category.tools",
1341
- knowledge: "category.knowledge",
1342
- integration: "category.integration",
1343
- security: "category.security",
1344
- utility: "category.utility"
1345
- };
1346
- /**
1347
- * Render the community plugin index card.
1348
- * @param props - locale copy, the card snapshot, its form actions, and the
1349
- * (default-generated) entry list.
1350
- * @returns the card.
1351
- */
1352
- function CommunityPluginsCard(props) {
1353
- const { t } = props;
1354
- const state = props.useCommunityPluginsCard((snapshot) => snapshot);
1355
- const plugins = (0, react.useMemo)(() => (props.plugins ?? COMMUNITY_PLUGINS).filter(isCommunityPluginEntry), [props.plugins]);
1356
- const [query, setQuery] = (0, react.useState)("");
1357
- const [category, setCategory] = (0, react.useState)(null);
1358
- const [copiedId, setCopiedId] = (0, react.useState)(null);
1359
- const bridge = (0, react.useSyncExternalStore)(subscribePluginManager, getPluginManagerSnapshot);
1360
- const face = props.pluginManager !== void 0 ? props.pluginManager : bridge.face;
1361
- const faceLoopback = face !== null && face.isLoopback;
1362
- const faceLifetime = (0, react.useMemo)(() => ({ active: true }), [face, props.pluginManager !== void 0 ? face : bridge.version]);
1363
- (0, react.useLayoutEffect)(() => {
1364
- faceLifetime.active = true;
1365
- return () => {
1366
- faceLifetime.active = false;
1367
- };
1368
- }, [faceLifetime]);
1369
- const [installed, setInstalled] = (0, react.useState)(null);
1370
- const [pending, setPending] = (0, react.useState)(null);
1371
- const [progress, setProgress] = (0, react.useState)(null);
1372
- const [errors, setErrors] = (0, react.useState)({});
1373
- const [uninstallTarget, setUninstallTarget] = (0, react.useState)(null);
1374
- const listRequestRef = (0, react.useRef)(0);
1375
- (0, react.useEffect)(() => {
1376
- setPending(null);
1377
- setProgress(null);
1378
- setErrors({});
1379
- setUninstallTarget(null);
1380
- listRequestRef.current += 1;
1381
- if (face === null || !face.isLoopback) {
1382
- setInstalled(null);
1383
- return;
1384
- }
1385
- let alive = true;
1386
- const refresh = () => {
1387
- const request = ++listRequestRef.current;
1388
- face.list().then((list) => {
1389
- if (alive && faceLifetime.active && request === listRequestRef.current) setInstalled(list);
1390
- }, () => {});
1391
- };
1392
- refresh();
1393
- const unsubscribe = face.onChange(refresh);
1394
- return () => {
1395
- alive = false;
1396
- unsubscribe();
1397
- };
1398
- }, [
1399
- face,
1400
- faceLoopback,
1401
- faceLifetime
1402
- ]);
1403
- (0, react.useEffect)(() => {
1404
- if (face === null || pending?.kind !== "install") {
1405
- setProgress(null);
1406
- return;
1407
- }
1408
- let alive = true;
1409
- const poll = () => {
1410
- face.status().then((item) => {
1411
- if (alive && faceLifetime.active) setProgress(item);
1412
- }, () => {});
1413
- };
1414
- poll();
1415
- const timer = setInterval(poll, PROGRESS_POLL_MS);
1416
- return () => {
1417
- alive = false;
1418
- clearInterval(timer);
1419
- };
1420
- }, [
1421
- face,
1422
- faceLifetime,
1423
- pending?.kind === "install"
1424
- ]);
1425
- const clearError = (id) => {
1426
- setErrors((previous) => {
1427
- if (!(id in previous)) return previous;
1428
- const next = { ...previous };
1429
- delete next[id];
1430
- return next;
1431
- });
1432
- };
1433
- const onInstall = (entry) => {
1434
- if (face === null || !face.isLoopback || pending !== null) return;
1435
- const lifetime = faceLifetime;
1436
- clearError(entry.id);
1437
- setPending({
1438
- kind: "install",
1439
- id: entry.id
1440
- });
1441
- (async () => {
1442
- try {
1443
- await face.install(installSpec(entry));
1444
- if (!lifetime.active) return;
1445
- const request = ++listRequestRef.current;
1446
- const list = await face.list().catch(() => void 0);
1447
- if (lifetime.active && list !== void 0 && request === listRequestRef.current) setInstalled(list);
1448
- } catch (reason) {
1449
- if (!lifetime.active) return;
1450
- setErrors((previous) => ({
1451
- ...previous,
1452
- [entry.id]: t("installFailed", { reason: messageOf(reason) })
1453
- }));
1454
- } finally {
1455
- if (lifetime.active) setPending(null);
1456
- }
1457
- })();
1458
- };
1459
- const onUninstallConfirm = () => {
1460
- const target = uninstallTarget;
1461
- if (face === null || target === null || pending !== null) return;
1462
- const item = entryInstalled(target, installed ?? []);
1463
- clearError(target.id);
1464
- if (item === null) {
1465
- setUninstallTarget(null);
1466
- return;
1467
- }
1468
- const lifetime = faceLifetime;
1469
- setPending({
1470
- kind: "uninstall",
1471
- id: target.id
1472
- });
1473
- face.uninstall(item.id).then((list) => {
1474
- if (!lifetime.active) return;
1475
- listRequestRef.current += 1;
1476
- setInstalled(list);
1477
- setUninstallTarget(null);
1478
- }, (reason) => {
1479
- if (!lifetime.active) return;
1480
- setErrors((previous) => ({
1481
- ...previous,
1482
- [target.id]: t("uninstallFailed", { reason: messageOf(reason) })
1483
- }));
1484
- setUninstallTarget(null);
1485
- }).finally(() => {
1486
- if (lifetime.active) setPending(null);
1487
- });
1488
- };
1489
- const copyCommand = (id, command) => {
1490
- const mark = () => {
1491
- setCopiedId(id);
1492
- };
1493
- const clipboard = typeof navigator !== "undefined" ? navigator.clipboard : void 0;
1494
- if (clipboard?.writeText !== void 0) {
1495
- clipboard.writeText(command).then(mark, mark);
1496
- return;
1497
- }
1498
- try {
1499
- const area = document.createElement("textarea");
1500
- area.value = command;
1501
- area.setAttribute("readonly", "");
1502
- area.style.position = "fixed";
1503
- area.style.opacity = "0";
1504
- document.body.append(area);
1505
- area.select();
1506
- document.execCommand("copy");
1507
- area.remove();
1508
- } catch {}
1509
- mark();
1510
- };
1511
- const disabled = !state.writable;
1512
- const mutationsDisabled = disabled || pending !== null;
1513
- const visible = state.enabled.text !== "false";
1514
- const fieldProps = {
1515
- overriddenLabel: t("settings.overridden"),
1516
- resetLabel: t("settings.reset"),
1517
- invalidLabel: t("settings.invalidNumber"),
1518
- disabled
1519
- };
1520
- const categoryCounts = (0, react.useMemo)(() => {
1521
- const counts = /* @__PURE__ */ new Map();
1522
- for (const plugin of plugins) if (plugin.category) counts.set(plugin.category, (counts.get(plugin.category) ?? 0) + 1);
1523
- return [...counts.entries()].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]));
1524
- }, [plugins]);
1525
- const visiblePlugins = (0, react.useMemo)(() => {
1526
- const needle = query.trim().toLowerCase();
1527
- return plugins.filter((plugin) => {
1528
- if (category !== null && plugin.category !== category) return false;
1529
- if (!needle) return true;
1530
- const categoryLabel = plugin.category ? t(CATEGORY_KEY[plugin.category]) : "";
1531
- return [
1532
- plugin.name,
1533
- plugin.nameEn,
1534
- plugin.author,
1535
- plugin.description,
1536
- plugin.descriptionEn,
1537
- plugin.npm ?? "",
1538
- categoryLabel
1539
- ].join(" ").toLowerCase().includes(needle);
1540
- });
1541
- }, [
1542
- plugins,
1543
- query,
1544
- category,
1545
- t
1546
- ]);
1547
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PluginSettingsCard, {
1548
- t,
1549
- titleKey: "settings.title",
1550
- descriptionKey: "settings.description",
1551
- state,
1552
- alwaysOpen: true,
1553
- onSave: props.save,
1554
- onDiscard: props.discard,
1555
- children: [
1556
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BooleanField, {
1557
- id: "settings-community-enabled",
1558
- label: t("settings.enabled"),
1559
- hint: t("settings.enabledHint"),
1560
- inheritLabel: t("settings.inherit"),
1561
- onLabel: t("settings.on"),
1562
- offLabel: t("settings.off"),
1563
- ...fieldProps,
1564
- ...state.enabled,
1565
- onEdit: (text) => {
1566
- props.edit("enabled", text);
1567
- },
1568
- onReset: () => {
1569
- props.resetField("enabled");
1570
- }
1571
- }),
1572
- visible ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1573
- className: community_module_css_default.market,
1574
- children: [
1575
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1576
- className: community_module_css_default.toolbar,
1577
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1578
- id: "settings-community-search",
1579
- className: community_module_css_default.search,
1580
- type: "search",
1581
- placeholder: t("search.placeholder"),
1582
- "aria-label": t("search.label"),
1583
- value: query,
1584
- disabled,
1585
- onChange: (event) => {
1586
- setQuery(event.target.value);
1587
- }
1588
- })
1589
- }),
1590
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1591
- className: community_module_css_default.filters,
1592
- role: "group",
1593
- "aria-label": t("filter.all"),
1594
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1595
- type: "button",
1596
- className: category === null ? `${community_module_css_default.pill} ${community_module_css_default.pillActive}` : community_module_css_default.pill,
1597
- "aria-pressed": category === null,
1598
- disabled,
1599
- onClick: () => {
1600
- setCategory(null);
1601
- },
1602
- children: [
1603
- t("filter.all"),
1604
- " ",
1605
- plugins.length
1606
- ]
1607
- }), categoryCounts.map(([id, count]) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1608
- type: "button",
1609
- className: category === id ? `${community_module_css_default.pill} ${community_module_css_default.pillActive}` : community_module_css_default.pill,
1610
- "aria-pressed": category === id,
1611
- disabled,
1612
- onClick: () => {
1613
- setCategory(category === id ? null : id);
1614
- },
1615
- children: [
1616
- t(CATEGORY_KEY[id]),
1617
- " ",
1618
- count
1619
- ]
1620
- }, id))]
1621
- }),
1622
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1623
- className: community_module_css_default.resultCount,
1624
- role: "status",
1625
- children: t("result.count", {
1626
- shown: visiblePlugins.length,
1627
- total: plugins.length
1628
- })
1629
- }),
1630
- plugins.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1631
- className: community_module_css_default.empty,
1632
- role: "status",
1633
- children: t("empty")
1634
- }) : visiblePlugins.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1635
- className: community_module_css_default.empty,
1636
- role: "status",
1637
- children: t("noMatch")
1638
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
1639
- className: community_module_css_default.grid,
1640
- children: visiblePlugins.map((plugin) => {
1641
- const command = installCommand(plugin);
1642
- const copied = copiedId === plugin.id;
1643
- const name = entryCopy(t, `name.${plugin.id}`, plugin.nameEn || plugin.name);
1644
- const description = entryCopy(t, `desc.${plugin.id}`, plugin.descriptionEn ?? plugin.description ?? "");
1645
- const installedItem = faceLoopback ? entryInstalled(plugin, installed ?? []) : null;
1646
- const isInstalling = pending?.kind === "install" && pending.id === plugin.id;
1647
- const isUninstalling = pending?.kind === "uninstall" && pending.id === plugin.id;
1648
- const error = errors[plugin.id];
1649
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
1650
- className: community_module_css_default.card,
1651
- children: [
1652
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1653
- className: community_module_css_default.cardHead,
1654
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1655
- className: community_module_css_default.cardName,
1656
- title: name,
1657
- children: name
1658
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1659
- className: community_module_css_default.cardBadges,
1660
- children: [installedItem !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1661
- className: `${community_module_css_default.badge} ${community_module_css_default.badgeInstalled}`,
1662
- children: t("badge.installed")
1663
- }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1664
- className: plugin.npm ? `${community_module_css_default.badge} ${community_module_css_default.badgePublished}` : community_module_css_default.badge,
1665
- title: plugin.npm ?? plugin.repo,
1666
- children: plugin.npm ? t("badge.published") : t("badge.source")
1667
- })]
1668
- })]
1669
- }),
1670
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1671
- className: community_module_css_default.cardMeta,
1672
- children: [
1673
- plugin.category ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1674
- className: community_module_css_default.cardCategory,
1675
- children: t(CATEGORY_KEY[plugin.category])
1676
- }) : null,
1677
- plugin.category ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1678
- className: community_module_css_default.cardDot,
1679
- "aria-hidden": "true",
1680
- children: "·"
1681
- }) : null,
1682
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1683
- className: community_module_css_default.cardAuthor,
1684
- title: plugin.author,
1685
- children: plugin.author
1686
- })
1687
- ]
1688
- }),
1689
- description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1690
- className: community_module_css_default.cardDescription,
1691
- children: description
1692
- }) : null,
1693
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1694
- className: community_module_css_default.cardFooter,
1695
- children: [
1696
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1697
- className: community_module_css_default.cardTop,
1698
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
1699
- className: community_module_css_default.cardLink,
1700
- href: plugin.repo,
1701
- target: "_blank",
1702
- rel: "noreferrer",
1703
- children: t("repository")
1704
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1705
- className: community_module_css_default.cardActions,
1706
- children: [
1707
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1708
- type: "button",
1709
- className: copied ? `${community_module_css_default.installButton} ${community_module_css_default.installButtonCopied}` : faceLoopback ? `${community_module_css_default.installButton} ${community_module_css_default.installButtonSecondary}` : community_module_css_default.installButton,
1710
- title: command,
1711
- onClick: () => {
1712
- copyCommand(plugin.id, command);
1713
- },
1714
- children: copied ? t("copied") : t("install")
1715
- }),
1716
- faceLoopback && installedItem === null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1717
- type: "button",
1718
- className: community_module_css_default.installButton,
1719
- disabled: mutationsDisabled,
1720
- onClick: () => {
1721
- onInstall(plugin);
1722
- },
1723
- children: isInstalling ? t("installing") : t("installNow")
1724
- }) : null,
1725
- faceLoopback && installedItem !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1726
- type: "button",
1727
- className: `${community_module_css_default.installButton} ${community_module_css_default.installButtonSecondary}`,
1728
- disabled: mutationsDisabled,
1729
- onClick: () => {
1730
- setUninstallTarget(plugin);
1731
- },
1732
- children: isUninstalling ? t("uninstalling") : t("uninstall")
1733
- }) : null
1734
- ]
1735
- })]
1736
- }),
1737
- isInstalling ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1738
- className: community_module_css_default.progress,
1739
- role: "status",
1740
- children: progress !== null && progress.kind !== "idle" ? t(`progress.${progress.stage}`) : t("installing")
1741
- }) : null,
1742
- error !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1743
- className: community_module_css_default.error,
1744
- role: "alert",
1745
- children: error
1746
- }) : null,
1747
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
1748
- className: community_module_css_default.cardCommand,
1749
- title: command,
1750
- children: command
1751
- })
1752
- ]
1753
- })
1754
- ]
1755
- }, plugin.id);
1756
- })
1757
- })
1758
- ]
1759
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1760
- className: community_module_css_default.off,
1761
- role: "status",
1762
- children: t("off")
1763
- }),
1764
- face === null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1765
- className: community_module_css_default.installNote,
1766
- role: "note",
1767
- children: t("managerHint")
1768
- }) : face.isLoopback ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1769
- className: community_module_css_default.installNote,
1770
- role: "note",
1771
- children: t("remoteHint")
1772
- }),
1773
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1774
- className: community_module_css_default.installNote,
1775
- role: "note",
1776
- children: t("installHint")
1777
- }),
1778
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1779
- className: community_module_css_default.notice,
1780
- role: "note",
1781
- children: t("notice")
1782
- }),
1783
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
1784
- open: uninstallTarget !== null,
1785
- onClose: () => {
1786
- if (pending === null) setUninstallTarget(null);
1787
- },
1788
- title: t("uninstallConfirm.title"),
1789
- closeLabel: t("cancel"),
1790
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1791
- className: community_module_css_default.confirmBody,
1792
- children: t("uninstallConfirm.body", { name: uninstallTarget === null ? "" : entryCopy(t, `name.${uninstallTarget.id}`, uninstallTarget.nameEn || uninstallTarget.name) })
1793
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1794
- className: community_module_css_default.modalActions,
1795
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
1796
- variant: "outline",
1797
- disabled: pending !== null,
1798
- onClick: () => {
1799
- setUninstallTarget(null);
1800
- },
1801
- children: t("cancel")
1802
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
1803
- variant: "primary",
1804
- className: community_module_css_default.dangerButton,
1805
- disabled: pending !== null,
1806
- onClick: onUninstallConfirm,
1807
- children: pending?.kind === "uninstall" ? t("uninstalling") : t("uninstallConfirm.confirm")
1808
- })]
1809
- })]
1810
- })
1811
- ]
1812
- });
1813
- }
1814
- /** Render the community plugin index as a first-level settings page. */
1815
- function CommunityPluginsSection(props) {
1816
- const { t, useCommunityPluginsCard, save, discard, edit, resetField, plugins, pluginManager } = props;
1817
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
1818
- className: community_module_css_default.sectionList,
1819
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CommunityPluginsCard, {
1820
- t,
1821
- useCommunityPluginsCard,
1822
- save,
1823
- discard,
1824
- edit,
1825
- resetField,
1826
- plugins,
1827
- pluginManager
1828
- })
1829
- });
1830
- }
1831
- //#endregion
1832
- //#region src/client/locales.ts
1833
- /**
1834
- * The community-plugins locale dictionaries for the index card. Static copy
1835
- * for the card chrome plus one localized name/description pair per index
1836
- * entry (`name.<id>` / `desc.<id>`), so the card localizes data-driven text
1837
- * through the same `t` the rest of the settings UI uses — the document
1838
- * `<html lang>` attribute is not a reliable locale signal in the GUI.
1839
- */
1840
- /** Simplified Chinese copy for the card chrome (the key-set source of truth). */
1841
- const STATIC_ZH = {
1842
- "settings.title": "社区插件",
1843
- "settings.description": "社区贡献者开发与维护的插件,链接指向作者自己的仓库。",
1844
- "settings.enabled": "启用社区插件索引",
1845
- "settings.enabledHint": "此开关只控制索引列表的显示与否,关闭后在这里重新打开。",
1846
- "settings.inherit": "继承",
1847
- "settings.on": "开",
1848
- "settings.off": "关",
1849
- "settings.overridden": "已覆盖",
1850
- "settings.reset": "恢复默认",
1851
- "settings.notExposed": "当前 DSH 版本未向设置页暴露本插件的配置命名空间,表单不可用。可编辑 ~/.dsh/settings.yaml 直接配置,或为 dsh-host-apiproxy 的 WEB_SETTINGS_NAMESPACES 白名单补充本命名空间后重启。",
1852
- "settings.readOnly": "当前部署的设置只读。",
1853
- "settings.expand": "展开设置",
1854
- "settings.collapse": "收起设置",
1855
- "settings.save": "保存",
1856
- "settings.saving": "保存中…",
1857
- "settings.discard": "放弃",
1858
- "settings.unsaved": "未保存",
1859
- "settings.saveFailed": "部署未接受这些值,已保留供你修改。",
1860
- "settings.invalidNumber": "请输入数字,留空则使用默认值。",
1861
- "author": "作者",
1862
- "repository": "仓库",
1863
- "copy": "复制",
1864
- "copied": "已复制",
1865
- "install": "复制安装命令",
1866
- "installNow": "安装",
1867
- "installing": "安装中…",
1868
- "uninstall": "卸载",
1869
- "uninstalling": "卸载中…",
1870
- "cancel": "取消",
1871
- "badge.installed": "已安装 · 重启后生效",
1872
- "progress.fetch": "获取插件信息",
1873
- "progress.download": "下载中",
1874
- "progress.extract": "解压中",
1875
- "progress.write": "写入中",
1876
- "uninstallConfirm.title": "卸载插件",
1877
- "uninstallConfirm.body": "确定要卸载 {name} 吗?移除将在重启 dsh web 后完全生效。",
1878
- "uninstallConfirm.confirm": "确认卸载",
1879
- "installFailed": "安装失败:{reason}",
1880
- "uninstallFailed": "卸载失败:{reason}",
1881
- "managerHint": "未检测到「插件管理器」插件:安装 @linxin666/dsh-client-ui-plugin-manager 后,可在本机浏览器中直接从这里安装与卸载。",
1882
- "remoteHint": "当前是远程浏览器,界面内安装不可用;请在宿主机器的终端执行安装命令。",
1883
- "noMatch": "没有匹配的社区插件。",
1884
- "search.placeholder": "搜索名称、作者或简介",
1885
- "search.label": "搜索社区插件",
1886
- "filter.all": "全部",
1887
- "result.count": "显示 {shown} / {total} 个",
1888
- "badge.published": "npm 已发布",
1889
- "badge.source": "仓库安装",
1890
- "category.ui": "界面与体验",
1891
- "category.agent": "Agent 与自动化",
1892
- "category.tools": "开发者工具",
1893
- "category.knowledge": "记忆与知识",
1894
- "category.integration": "集成与分享",
1895
- "category.security": "安全与运维",
1896
- "category.utility": "实用工具",
1897
- "installHint": "在本机浏览器且已安装「插件管理器」插件时,可直接点击卡片上的「安装 / 卸载」;否则复制安装命令到终端执行。安装与卸载在重启 dsh web 后生效,插件自带的开关与配置(若有)会出现在插件配置里。",
1898
- "empty": "暂无社区插件登记。",
1899
- "off": "社区插件索引已关闭。",
1900
- "notice": "条目由贡献者自行登记,与 dsh-web-ui 的发布内容无关;使用前请自行评估。"
1901
- };
1902
- /** English copy for the card chrome, checked complete against the zh key set. */
1903
- const STATIC_EN = {
1904
- "settings.title": "Community Plugins",
1905
- "settings.description": "Plugins developed and maintained by community contributors, linking to each author's own repository.",
1906
- "settings.enabled": "Enable the community plugin index",
1907
- "settings.enabledHint": "This switch only controls whether the index list is shown; turn it back on here.",
1908
- "settings.inherit": "Inherit",
1909
- "settings.on": "On",
1910
- "settings.off": "Off",
1911
- "settings.overridden": "Overridden",
1912
- "settings.reset": "Reset to default",
1913
- "settings.notExposed": "This DSH version does not expose this plugin's settings namespace to the configuration page, so the form is unavailable. Edit ~/.dsh/settings.yaml directly, or add the namespace to dsh-host-apiproxy's WEB_SETTINGS_NAMESPACES allowlist and restart.",
1914
- "settings.readOnly": "This deployment stores settings read-only.",
1915
- "settings.expand": "Show settings",
1916
- "settings.collapse": "Hide settings",
1917
- "settings.save": "Save",
1918
- "settings.saving": "Saving…",
1919
- "settings.discard": "Discard",
1920
- "settings.unsaved": "Unsaved",
1921
- "settings.saveFailed": "The deployment did not accept these values; they were left for you to correct.",
1922
- "settings.invalidNumber": "Enter a number, or leave blank to use the default.",
1923
- "author": "Author",
1924
- "repository": "Repository",
1925
- "copy": "Copy",
1926
- "copied": "Copied",
1927
- "install": "Copy install command",
1928
- "installNow": "Install",
1929
- "installing": "Installing…",
1930
- "uninstall": "Uninstall",
1931
- "uninstalling": "Uninstalling…",
1932
- "cancel": "Cancel",
1933
- "badge.installed": "Installed · restart to take effect",
1934
- "progress.fetch": "Fetching plugin info",
1935
- "progress.download": "Downloading",
1936
- "progress.extract": "Extracting",
1937
- "progress.write": "Writing",
1938
- "uninstallConfirm.title": "Uninstall plugin",
1939
- "uninstallConfirm.body": "Uninstall {name}? The removal fully takes effect after restarting dsh web.",
1940
- "uninstallConfirm.confirm": "Confirm uninstall",
1941
- "installFailed": "Install failed: {reason}",
1942
- "uninstallFailed": "Uninstall failed: {reason}",
1943
- "managerHint": "The Plugin manager plugin is not detected: install @linxin666/dsh-client-ui-plugin-manager to install and uninstall entries directly from here in a local browser.",
1944
- "remoteHint": "This is a remote browser, so in-GUI install is unavailable; run the install command in a terminal on the host machine.",
1945
- "noMatch": "No matching community plugin found.",
1946
- "search.placeholder": "Search name, author or description",
1947
- "search.label": "Search community plugins",
1948
- "filter.all": "All",
1949
- "result.count": "Showing {shown} / {total}",
1950
- "badge.published": "Published on npm",
1951
- "badge.source": "Install from repo",
1952
- "category.ui": "UI & Experience",
1953
- "category.agent": "Agents & Automation",
1954
- "category.tools": "Developer Tools",
1955
- "category.knowledge": "Memory & Knowledge",
1956
- "category.integration": "Integration & Sharing",
1957
- "category.security": "Security & Ops",
1958
- "category.utility": "Utilities",
1959
- "installHint": "With the Plugin manager plugin present and a local browser, use the Install / Uninstall buttons on each card; otherwise copy the install command into a terminal. Installs and uninstalls take effect after restarting dsh web; once installed, the plugin provides its own switch and config (if any) in the plugin configuration section.",
1960
- "empty": "No community plugins registered yet.",
1961
- "off": "The community plugin index is turned off.",
1962
- "notice": "Entries are contributed by their authors and are separate from dsh-web-ui releases; evaluate before use."
1963
- };
1964
- /** Build the runtime dictionary: static copy plus one localized name/description pair per index entry. */
1965
- function build(base, lang) {
1966
- const dict = { ...base };
1967
- for (const entry of COMMUNITY_PLUGINS) {
1968
- dict[`name.${entry.id}`] = lang === "zh" ? entry.name : entry.nameEn;
1969
- dict[`desc.${entry.id}`] = lang === "zh" ? entry.description ?? entry.descriptionEn ?? "" : entry.descriptionEn ?? entry.description ?? "";
1970
- }
1971
- return dict;
1972
- }
1973
- /** Simplified Chinese dictionary for the index card (chrome + per-entry copy). */
1974
- const zh = build(STATIC_ZH, "zh");
1975
- /** English dictionary, built from the same key set. */
1976
- const en = build(STATIC_EN, "en");
1977
- //#endregion
1978
- //#region src/client/index.ts
1979
- /** Settings namespace the card's enable switch edits (the Host plugin registers it). */
1980
- const COMMUNITY_PLUGINS_NS = "community-plugins";
1981
- /** Required services. */
1982
- const inject = [
1983
- "slots",
1984
- "locale",
1985
- "connection",
1986
- "settingsScope",
1987
- "remote"
1988
- ];
1989
- /**
1990
- * Register the community plugin index as a first-level settings section, with
1991
- * its own enable switch over the community-plugins settings namespace.
1992
- * @param ctx - client root context.
1993
- */
1994
- function apply(ctx) {
1995
- ctx.effect(() => ctx.locale.register("community-plugins", {
1996
- zh,
1997
- en
1998
- }), "community-plugins: dictionaries");
1999
- bridgePluginManager(ctx);
2000
- const controller = new CommunityPluginsCardController((ctx.get("webUiSettings") ?? ctx.settingsScope).bind({ namespace: COMMUNITY_PLUGINS_NS }));
2001
- ctx.slots.inject("settings.section", () => {
2002
- const unregister = ctx.slots.register({
2003
- name: "settings.section",
2004
- id: "community-plugins",
2005
- order: 140,
2006
- label: () => ctx.locale.bind("community-plugins")("settings.title"),
2007
- locale: "community-plugins",
2008
- inject: () => controller.inject()
2009
- }, CommunityPluginsSection);
2010
- return () => {
2011
- controller.dispose();
2012
- unregister();
2013
- };
2014
- });
2015
- }
2016
- //#endregion
2017
- exports.apply = apply;
2018
- exports.inject = inject;
2019
- return module.exports;
2020
- }
2021
- });
2022
-
2023
- //# sourceMappingURL=client.js.map