dsh-subagent-library 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js CHANGED
@@ -28,7 +28,548 @@ react = __toESM(react);
28
28
  let react_jsx_runtime = require("react/jsx-runtime");
29
29
  react_jsx_runtime = __toESM(react_jsx_runtime);
30
30
 
31
+ //#region src/client/settings-theme.ts
32
+ /** Host theme tokens keep the roster at home in both desktop color schemes. */
33
+ const TOKEN = {
34
+ primary: "var(--dsw-alias-label-primary, currentColor)",
35
+ secondary: "var(--dsw-alias-label-secondary, #737780)",
36
+ muted: "var(--dsw-alias-label-tertiary, #858993)",
37
+ border: "var(--dsw-alias-border-l2, rgba(128,128,128,0.2))",
38
+ borderStrong: "var(--dsw-alias-border-l3, rgba(128,128,128,0.32))",
39
+ divider: "var(--dsw-alias-border-l1, rgba(128,128,128,0.12))",
40
+ surface: "var(--dsw-alias-bg-layer-2, rgba(128,128,128,0.035))",
41
+ inset: "var(--dsw-alias-bg-module-platform, rgba(128,128,128,0.07))",
42
+ hover: "var(--dsw-alias-interactive-bg-hover, rgba(128,128,128,0.08))",
43
+ accent: "var(--dsw-alias-state-business-primary, #4176e6)",
44
+ accentFill: "var(--dsw-alias-brand-primary-new-colorprimary-new-color, #4176e6)",
45
+ accentSoft: "var(--dsw-alias-state-business-tertiary, rgba(65,118,230,0.12))",
46
+ success: "var(--dsw-alias-state-success-primary, #16a34a)",
47
+ successSoft: "var(--dsw-alias-state-success-tertiary, rgba(22,163,74,0.12))",
48
+ warn: "var(--dsw-alias-state-warn-label, #b45309)",
49
+ warnSoft: "var(--dsw-alias-state-warn-tertiary, rgba(217,119,6,0.12))",
50
+ danger: "var(--dsw-alias-state-error-primary, #dc2626)",
51
+ dangerSoft: "var(--dsw-alias-state-error-secondary, rgba(220,38,38,0.12))"
52
+ };
53
+ const ACCENT = TOKEN.accent;
54
+ const SUCCESS = TOKEN.success;
55
+ const DANGER = TOKEN.danger;
56
+ const MONO = "ui-monospace, SFMono-Regular, Consolas, \"Liberation Mono\", Menlo, monospace";
57
+ const button = {
58
+ display: "inline-flex",
59
+ alignItems: "center",
60
+ justifyContent: "center",
61
+ minHeight: 32,
62
+ padding: "5px 12px",
63
+ fontSize: 12.5,
64
+ lineHeight: 1.5,
65
+ fontFamily: "inherit",
66
+ fontWeight: 500,
67
+ borderRadius: 8,
68
+ border: `1px solid ${TOKEN.borderStrong}`,
69
+ background: "transparent",
70
+ color: TOKEN.secondary,
71
+ cursor: "pointer",
72
+ whiteSpace: "nowrap"
73
+ };
74
+ const chip = {
75
+ display: "inline-flex",
76
+ alignItems: "baseline",
77
+ gap: 4,
78
+ maxWidth: "100%",
79
+ padding: "2px 7px",
80
+ borderRadius: 5,
81
+ fontSize: 11.5,
82
+ lineHeight: 1.5,
83
+ color: TOKEN.secondary,
84
+ background: TOKEN.inset,
85
+ overflowWrap: "anywhere"
86
+ };
87
+ const S = {
88
+ root: {
89
+ display: "flex",
90
+ flexDirection: "column",
91
+ gap: 16,
92
+ width: "100%",
93
+ minWidth: 0,
94
+ maxWidth: 880,
95
+ boxSizing: "border-box",
96
+ padding: "16px 4px",
97
+ color: TOKEN.primary,
98
+ containerType: "inline-size",
99
+ containerName: "dsh-library"
100
+ },
101
+ pageHeader: {
102
+ display: "flex",
103
+ flexDirection: "column",
104
+ gap: 7
105
+ },
106
+ headingRow: {
107
+ display: "flex",
108
+ alignItems: "center",
109
+ gap: 12,
110
+ flexWrap: "wrap"
111
+ },
112
+ heading: {
113
+ fontSize: 20,
114
+ lineHeight: 1.4,
115
+ fontWeight: 650,
116
+ letterSpacing: "-0.025em",
117
+ margin: 0
118
+ },
119
+ sub: {
120
+ fontSize: 12.5,
121
+ lineHeight: 1.65,
122
+ color: TOKEN.muted,
123
+ margin: 0
124
+ },
125
+ band: {
126
+ display: "flex",
127
+ flexDirection: "column",
128
+ gap: 10,
129
+ padding: "13px 16px",
130
+ background: TOKEN.inset,
131
+ borderRadius: 10
132
+ },
133
+ bandStats: {
134
+ display: "flex",
135
+ alignItems: "baseline",
136
+ gap: "8px 24px",
137
+ flexWrap: "wrap"
138
+ },
139
+ bandStat: {
140
+ display: "flex",
141
+ alignItems: "baseline",
142
+ gap: 6
143
+ },
144
+ bandValue: {
145
+ fontSize: 19,
146
+ fontWeight: 600,
147
+ lineHeight: 1.3,
148
+ fontVariantNumeric: "tabular-nums"
149
+ },
150
+ bandLabel: {
151
+ fontSize: 11.5,
152
+ color: TOKEN.muted,
153
+ flexShrink: 0
154
+ },
155
+ bandDir: {
156
+ display: "flex",
157
+ alignItems: "baseline",
158
+ gap: 10,
159
+ minWidth: 0
160
+ },
161
+ bandPath: {
162
+ fontFamily: MONO,
163
+ fontSize: 11.5,
164
+ color: TOKEN.secondary,
165
+ overflowWrap: "anywhere",
166
+ minWidth: 0
167
+ },
168
+ banner: {
169
+ fontSize: 12.5,
170
+ lineHeight: 1.65,
171
+ padding: "10px 12px",
172
+ borderRadius: 8,
173
+ display: "flex",
174
+ flexDirection: "column",
175
+ gap: 6,
176
+ overflowWrap: "anywhere"
177
+ },
178
+ bar: {
179
+ display: "flex",
180
+ alignItems: "center",
181
+ gap: 8,
182
+ flexWrap: "wrap"
183
+ },
184
+ search: {
185
+ display: "flex",
186
+ alignItems: "center",
187
+ gap: 8,
188
+ flex: "1 1 220px",
189
+ minWidth: 0,
190
+ minHeight: 34,
191
+ padding: "6px 10px",
192
+ border: `1px solid ${TOKEN.borderStrong}`,
193
+ borderRadius: 8
194
+ },
195
+ searchInput: {
196
+ flex: 1,
197
+ minWidth: 0,
198
+ border: "none",
199
+ outline: "none",
200
+ padding: 0,
201
+ background: "transparent",
202
+ color: "inherit",
203
+ fontSize: 13,
204
+ fontFamily: "inherit"
205
+ },
206
+ listCaption: {
207
+ display: "flex",
208
+ justifyContent: "space-between",
209
+ gap: "4px 12px",
210
+ flexWrap: "wrap",
211
+ fontSize: 11.5,
212
+ color: TOKEN.muted,
213
+ marginTop: 2,
214
+ marginBottom: -7
215
+ },
216
+ list: {
217
+ display: "flex",
218
+ flexDirection: "column",
219
+ gap: 10
220
+ },
221
+ row: {
222
+ minWidth: 0,
223
+ border: `1px solid ${TOKEN.border}`,
224
+ borderRadius: 12,
225
+ background: TOKEN.surface,
226
+ overflow: "hidden",
227
+ transition: "border-color 140ms ease, box-shadow 140ms ease"
228
+ },
229
+ rowOpen: {
230
+ borderColor: TOKEN.accent,
231
+ boxShadow: `0 0 0 1px ${TOKEN.accentSoft}`
232
+ },
233
+ rowOff: { background: "transparent" },
234
+ head: {
235
+ display: "flex",
236
+ alignItems: "flex-start",
237
+ gap: 12,
238
+ padding: "12px 16px 0 12px"
239
+ },
240
+ disclosure: {
241
+ display: "flex",
242
+ alignItems: "flex-start",
243
+ flex: 1,
244
+ minWidth: 0,
245
+ gap: 6,
246
+ minHeight: 28,
247
+ padding: "2px 0",
248
+ textAlign: "left",
249
+ font: "inherit",
250
+ border: 0,
251
+ borderRadius: 4,
252
+ color: TOKEN.primary,
253
+ background: "transparent",
254
+ cursor: "pointer"
255
+ },
256
+ titleRow: {
257
+ display: "flex",
258
+ flex: 1,
259
+ minWidth: 0,
260
+ alignItems: "center",
261
+ gap: "5px 8px",
262
+ flexWrap: "wrap"
263
+ },
264
+ chevron: {
265
+ flex: "none",
266
+ width: 18,
267
+ height: 22,
268
+ display: "inline-flex",
269
+ alignItems: "center",
270
+ justifyContent: "center",
271
+ color: TOKEN.muted,
272
+ transition: "transform 140ms ease"
273
+ },
274
+ id: {
275
+ fontSize: 14,
276
+ lineHeight: 1.6,
277
+ fontWeight: 650,
278
+ fontFamily: MONO,
279
+ overflowWrap: "anywhere",
280
+ minWidth: 0
281
+ },
282
+ headToggle: {
283
+ display: "flex",
284
+ alignItems: "center",
285
+ flex: "none",
286
+ gap: 7,
287
+ minHeight: 28,
288
+ fontSize: 11.5,
289
+ color: TOKEN.muted,
290
+ cursor: "pointer"
291
+ },
292
+ overview: {
293
+ display: "flex",
294
+ flexDirection: "column",
295
+ gap: 9,
296
+ padding: "2px 16px 13px 36px",
297
+ minWidth: 0
298
+ },
299
+ excerpt: {
300
+ display: "-webkit-box",
301
+ WebkitBoxOrient: "vertical",
302
+ WebkitLineClamp: 2,
303
+ overflow: "hidden",
304
+ margin: 0,
305
+ fontSize: 13,
306
+ lineHeight: 1.65,
307
+ color: TOKEN.secondary,
308
+ overflowWrap: "anywhere"
309
+ },
310
+ route: {
311
+ display: "flex",
312
+ flexWrap: "wrap",
313
+ alignItems: "baseline",
314
+ gap: "2px 8px",
315
+ minWidth: 0
316
+ },
317
+ metaLabel: {
318
+ fontSize: 11.5,
319
+ color: TOKEN.muted,
320
+ flexShrink: 0
321
+ },
322
+ model: {
323
+ fontFamily: MONO,
324
+ fontSize: 12.5,
325
+ fontWeight: 500,
326
+ color: TOKEN.primary,
327
+ overflowWrap: "anywhere",
328
+ minWidth: 0,
329
+ maxWidth: "100%"
330
+ },
331
+ provider: {
332
+ fontFamily: MONO,
333
+ fontSize: 11.5,
334
+ color: TOKEN.muted,
335
+ paddingLeft: 8,
336
+ borderLeft: `1px solid ${TOKEN.borderStrong}`,
337
+ overflowWrap: "anywhere",
338
+ minWidth: 0,
339
+ maxWidth: "100%"
340
+ },
341
+ glyphs: {
342
+ display: "flex",
343
+ alignItems: "center",
344
+ gap: 6,
345
+ flexWrap: "wrap",
346
+ minWidth: 0
347
+ },
348
+ glyph: chip,
349
+ metaValue: {
350
+ fontFamily: MONO,
351
+ fontVariantNumeric: "tabular-nums"
352
+ },
353
+ modeChip: {
354
+ ...chip,
355
+ color: TOKEN.accent,
356
+ background: TOKEN.accentSoft
357
+ },
358
+ chip: {
359
+ ...chip,
360
+ fontSize: 10.5
361
+ },
362
+ dirtyChip: {
363
+ ...chip,
364
+ fontSize: 10.5,
365
+ color: TOKEN.warn,
366
+ background: TOKEN.warnSoft
367
+ },
368
+ draftActions: {
369
+ display: "flex",
370
+ alignItems: "center",
371
+ gap: 8,
372
+ flexWrap: "wrap",
373
+ padding: "9px 16px",
374
+ borderTop: `1px solid ${TOKEN.divider}`
375
+ },
376
+ addHead: {
377
+ display: "flex",
378
+ alignItems: "center",
379
+ flexWrap: "wrap",
380
+ gap: 12,
381
+ padding: "16px"
382
+ },
383
+ addIntro: {
384
+ display: "flex",
385
+ flex: "1 1 220px",
386
+ flexDirection: "column",
387
+ gap: 3,
388
+ minWidth: 0
389
+ },
390
+ body: {
391
+ display: "flex",
392
+ flexDirection: "column",
393
+ gap: 20,
394
+ padding: 16,
395
+ borderTop: `1px solid ${TOKEN.divider}`
396
+ },
397
+ group: {
398
+ display: "flex",
399
+ flexDirection: "column",
400
+ gap: 12
401
+ },
402
+ groupTitle: {
403
+ fontSize: 12.5,
404
+ fontWeight: 600,
405
+ color: TOKEN.primary
406
+ },
407
+ fieldLabel: {
408
+ fontSize: 12,
409
+ color: TOKEN.secondary,
410
+ marginBottom: 6,
411
+ display: "block"
412
+ },
413
+ field: {
414
+ display: "flex",
415
+ flexDirection: "column",
416
+ minWidth: 0
417
+ },
418
+ grid: {
419
+ display: "grid",
420
+ gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
421
+ gap: 12,
422
+ alignItems: "start"
423
+ },
424
+ actions: {
425
+ display: "flex",
426
+ alignItems: "center",
427
+ gap: 8,
428
+ flexWrap: "wrap",
429
+ paddingTop: 12,
430
+ borderTop: `1px solid ${TOKEN.divider}`
431
+ },
432
+ spacer: { flex: 1 },
433
+ input: {
434
+ width: "100%",
435
+ minHeight: 35,
436
+ boxSizing: "border-box",
437
+ fontSize: 13,
438
+ fontFamily: MONO,
439
+ lineHeight: 1.5,
440
+ padding: "6px 9px",
441
+ border: `1px solid ${TOKEN.borderStrong}`,
442
+ borderRadius: 7,
443
+ background: "transparent",
444
+ color: "inherit"
445
+ },
446
+ prose: {
447
+ width: "100%",
448
+ minHeight: 64,
449
+ boxSizing: "border-box",
450
+ fontSize: 13,
451
+ fontFamily: "inherit",
452
+ lineHeight: 1.7,
453
+ padding: "8px 10px",
454
+ border: `1px solid ${TOKEN.borderStrong}`,
455
+ borderRadius: 7,
456
+ background: "transparent",
457
+ color: "inherit",
458
+ resize: "vertical",
459
+ whiteSpace: "pre-wrap",
460
+ overflowWrap: "anywhere"
461
+ },
462
+ button,
463
+ primary: {
464
+ ...button,
465
+ padding: "5px 13px",
466
+ borderColor: "transparent",
467
+ background: TOKEN.accentFill,
468
+ color: "#fff"
469
+ },
470
+ danger: {
471
+ ...button,
472
+ borderColor: TOKEN.dangerSoft,
473
+ color: TOKEN.danger
474
+ },
475
+ ghost: {
476
+ ...button,
477
+ borderColor: "transparent",
478
+ color: TOKEN.muted
479
+ },
480
+ hint: {
481
+ fontSize: 11.5,
482
+ lineHeight: 1.65,
483
+ color: TOKEN.muted,
484
+ margin: 0,
485
+ overflowWrap: "anywhere"
486
+ },
487
+ empty: {
488
+ padding: "28px 16px",
489
+ textAlign: "center",
490
+ fontSize: 13,
491
+ lineHeight: 1.7,
492
+ color: TOKEN.muted,
493
+ border: `1px dashed ${TOKEN.border}`,
494
+ borderRadius: 10
495
+ },
496
+ footer: {
497
+ padding: "4px 0",
498
+ color: TOKEN.muted,
499
+ overflowWrap: "anywhere"
500
+ },
501
+ footerSummary: {
502
+ cursor: "pointer",
503
+ fontSize: 11.5,
504
+ paddingBottom: 8
505
+ }
506
+ };
507
+ const BANNER = {
508
+ ok: {
509
+ ...S.banner,
510
+ background: TOKEN.successSoft
511
+ },
512
+ error: {
513
+ ...S.banner,
514
+ background: TOKEN.dangerSoft
515
+ },
516
+ warn: {
517
+ ...S.banner,
518
+ background: TOKEN.warnSoft
519
+ },
520
+ info: {
521
+ ...S.banner,
522
+ background: TOKEN.inset
523
+ }
524
+ };
525
+ /** Scoped styles travel with the client bundle; no extra host CSS loader. */
526
+ const SETTINGS_CSS = `
527
+ .dsh-library *, .dsh-library *::before { box-sizing: border-box; }
528
+ .dsh-library button:disabled { cursor: default !important; opacity: .5; }
529
+ .dsh-library :is(button, input, textarea, select, summary):focus-visible {
530
+ outline: 2px solid ${TOKEN.accent}; outline-offset: 3px;
531
+ }
532
+ .dsh-library label:has(input[aria-label="筛选子代理"]):focus-within {
533
+ outline: 2px solid ${TOKEN.accent}; outline-offset: 2px;
534
+ }
535
+ .dsh-library input[aria-label="筛选子代理"]:focus-visible { outline: none; }
536
+ .dsh-library select option { background: ${TOKEN.surface}; color: ${TOKEN.primary}; }
537
+ .dsh-library-switch {
538
+ appearance: none; position: relative; display: inline-block; flex: none;
539
+ width: 30px; height: 18px; margin: 0; border: 1px solid ${TOKEN.borderStrong};
540
+ border-radius: 999px; background: ${TOKEN.hover}; cursor: pointer;
541
+ transition: background 140ms ease;
542
+ }
543
+ .dsh-library-switch::before {
544
+ content: ''; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px;
545
+ border-radius: 50%; background: ${TOKEN.muted}; transition: transform 140ms ease;
546
+ }
547
+ .dsh-library-switch:checked { background: ${TOKEN.accentFill}; border-color: transparent; }
548
+ .dsh-library-switch:checked::before { transform: translateX(12px); background: #fff; }
549
+ @container dsh-library (max-width: 520px) {
550
+ .dsh-library-grid { grid-template-columns: minmax(0, 1fr) !important; }
551
+ }
552
+ @media (hover: hover) {
553
+ .dsh-library-card:hover { border-color: ${TOKEN.borderStrong}; }
554
+ .dsh-library-disclosure:hover { color: ${TOKEN.accent} !important; }
555
+ .dsh-library button:not(:disabled):hover { filter: brightness(.96); }
556
+ }
557
+ @media (prefers-reduced-motion: reduce) {
558
+ .dsh-library *, .dsh-library *::before { transition: none !important; }
559
+ }
560
+ @media (forced-colors: active) {
561
+ .dsh-library-switch { appearance: auto; }
562
+ .dsh-library-switch::before { display: none; }
563
+ }
564
+ `;
565
+
566
+ //#endregion
31
567
  //#region src/client/LibrarySettings.tsx
568
+ /** Deep equality for the two entry shapes we compare (server row vs draft).
569
+ * JSON round-trip is enough: every field is a string, number, boolean, or
570
+ * array of strings, and key order is stable because both sides are built by
571
+ * the same spread-from-server path. */
572
+ const sameEntry = (a, b) => JSON.stringify(a) === JSON.stringify(b);
32
573
  /** Content-adaptive textarea: grows with its text (clamped) so long personas
33
574
  * are readable without dragging while short ones stay compact. Re-measures
34
575
  * after every render (value changes re-render) and on input. */
@@ -39,7 +580,7 @@ function AutoTextarea(props) {
39
580
  const el = ref.current;
40
581
  if (el === null) return;
41
582
  el.style.height = "auto";
42
- el.style.height = `${Math.min(Math.max(el.scrollHeight, 110), 440)}px`;
583
+ el.style.height = `${Math.min(Math.max(el.scrollHeight, 86), 440)}px`;
43
584
  };
44
585
  (0, react.useEffect)(() => {
45
586
  resize();
@@ -54,8 +595,60 @@ function AutoTextarea(props) {
54
595
  }
55
596
  });
56
597
  }
598
+ /** Single-line label + control, so every field in the editor lines up on the
599
+ * same left edge regardless of how many share a row. */
600
+ function Field(props) {
601
+ const { label, hint, children } = props;
602
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
603
+ style: S.field,
604
+ children: [
605
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
606
+ style: S.fieldLabel,
607
+ children: label
608
+ }),
609
+ children,
610
+ hint !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
611
+ style: {
612
+ ...S.hint,
613
+ marginTop: 3
614
+ },
615
+ children: hint
616
+ })
617
+ ]
618
+ });
619
+ }
620
+ /** Chevron that rotates on open — the only motion in the page, and cheap. */
621
+ function Chevron(props) {
622
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
623
+ style: {
624
+ ...S.chevron,
625
+ transform: props.open ? "rotate(90deg)" : "none"
626
+ },
627
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
628
+ width: "11",
629
+ height: "11",
630
+ viewBox: "0 0 12 12",
631
+ fill: "none",
632
+ stroke: "currentColor",
633
+ strokeWidth: "1.6",
634
+ strokeLinecap: "round",
635
+ strokeLinejoin: "round",
636
+ "aria-hidden": "true",
637
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M4.5 2.5L8 6l-3.5 3.5" })
638
+ })
639
+ });
640
+ }
641
+ /** Parse / render the comma-separated deny list without ever dropping a
642
+ * hand-written allow list the editor does not surface. */
643
+ const parseList = (value) => value.split(",").map((item) => item.trim()).filter(Boolean);
644
+ const listToText = (list) => (list ?? []).join(", ");
645
+ /** Draft actions disappear on success. Keep keyboard focus on their card. */
646
+ function focusDisclosure(event) {
647
+ if (event.detail === 0) event.currentTarget.closest("[data-entry-id]")?.querySelector("[data-row-id]")?.focus();
648
+ }
57
649
  function LibrarySettings(props) {
58
650
  const { readView: readView$1, writeView: writeView$1, subscribeRefresh } = props;
651
+ const sectionId = (0, react.useId)();
59
652
  const [view, setView] = (0, react.useState)(null);
60
653
  const [entries, setEntries] = (0, react.useState)({});
61
654
  const [busy, setBusy] = (0, react.useState)(false);
@@ -67,6 +660,10 @@ function LibrarySettings(props) {
67
660
  model: "",
68
661
  backgroundMode: "one-shot"
69
662
  });
663
+ /** Editing is opt-in; newly created entries open to finish configuration. */
664
+ const [open, setOpen] = (0, react.useState)({});
665
+ const [adding, setAdding] = (0, react.useState)(false);
666
+ const [filter, setFilter] = (0, react.useState)("");
70
667
  const alive = (0, react.useRef)(true);
71
668
  /** Synchronous busy flag (see applyWrite's re-entry guard). */
72
669
  const busyRef = (0, react.useRef)(false);
@@ -170,8 +767,8 @@ function LibrarySettings(props) {
170
767
  if (clean.description === "") delete clean.description;
171
768
  if (clean.maxDepth === void 0) delete clean.maxDepth;
172
769
  if (clean.maxTokens === void 0) delete clean.maxTokens;
173
- const filter = clean.toolFilter;
174
- if (filter !== void 0 && (filter.allow === void 0 || filter.allow.length === 0) && (filter.deny === void 0 || filter.deny.length === 0)) delete clean.toolFilter;
770
+ const filter$1 = clean.toolFilter;
771
+ if (filter$1 !== void 0 && (filter$1.allow === void 0 || filter$1.allow.length === 0) && (filter$1.deny === void 0 || filter$1.deny.length === 0)) delete clean.toolFilter;
175
772
  return clean;
176
773
  };
177
774
  const updateEntry = (id, entry) => {
@@ -180,6 +777,10 @@ function LibrarySettings(props) {
180
777
  kind: "error",
181
778
  text: "描述不能为空。"
182
779
  });
780
+ setOpen((current) => ({
781
+ ...current,
782
+ [id]: true
783
+ }));
183
784
  return;
184
785
  }
185
786
  if (entry.maxDepth !== void 0 && (!Number.isInteger(entry.maxDepth) || entry.maxDepth < 1)) {
@@ -187,6 +788,10 @@ function LibrarySettings(props) {
187
788
  kind: "error",
188
789
  text: "深度上限需为 ≥1 的整数。"
189
790
  });
791
+ setOpen((current) => ({
792
+ ...current,
793
+ [id]: true
794
+ }));
190
795
  return;
191
796
  }
192
797
  if (entry.maxTokens !== void 0 && (!Number.isInteger(entry.maxTokens) || entry.maxTokens < 1)) {
@@ -194,6 +799,10 @@ function LibrarySettings(props) {
194
799
  kind: "error",
195
800
  text: "输出上限需为 ≥1 的整数。"
196
801
  });
802
+ setOpen((current) => ({
803
+ ...current,
804
+ [id]: true
805
+ }));
197
806
  return;
198
807
  }
199
808
  applyWrite({
@@ -260,223 +869,161 @@ function LibrarySettings(props) {
260
869
  model: "",
261
870
  backgroundMode: "one-shot"
262
871
  });
872
+ setAdding(false);
873
+ setOpen((current) => ({
874
+ ...current,
875
+ [id]: true
876
+ }));
263
877
  }
264
878
  });
265
879
  };
266
- const rootStyle = {
267
- display: "flex",
268
- flexDirection: "column",
269
- gap: 14,
270
- maxWidth: 860,
271
- padding: "12px 4px"
272
- };
273
- const headingStyle = {
274
- fontSize: 15,
275
- fontWeight: 600,
276
- margin: 0
277
- };
278
- const subStyle = {
279
- fontSize: 12.5,
280
- opacity: .7,
281
- margin: 0
282
- };
283
- const rowStyle = {
284
- display: "flex",
285
- alignItems: "center",
286
- gap: 8,
287
- flexWrap: "wrap"
288
- };
289
- /** Shrinkable multi-column row: min-width 0 lets inputs shrink below their
290
- * intrinsic width instead of overflowing the settings card (form controls
291
- * otherwise keep their default width as a flex minimum). */
292
- const colStyle = {
293
- display: "flex",
294
- alignItems: "center",
295
- gap: 8,
296
- flex: 1,
297
- minWidth: 0
298
- };
299
- /** Content-width column for FIXED-width controls (number input, select):
300
- * flex-basis-0 columns ignore their children when distributing width, and
301
- * an overflowing visible-box child paints over the neighbor. */
302
- const fixedColStyle = {
303
- display: "flex",
304
- alignItems: "center",
305
- gap: 8
306
- };
307
- const labelStyle = {
308
- fontSize: 13,
309
- opacity: .75,
310
- minWidth: "72px"
311
- };
312
- const inputStyle = {
313
- flex: 1,
314
- minWidth: 0,
315
- fontSize: 13,
316
- fontFamily: "Consolas, Menlo, monospace",
317
- lineHeight: 1.5,
318
- padding: "5px 8px",
319
- border: "1px solid rgba(128,128,128,0.4)",
320
- borderRadius: 6,
321
- background: "transparent",
322
- color: "inherit"
323
- };
324
- /** Prose fields (description, persona) use the UI font at a readable size —
325
- * long Chinese text in small monospace was the readability complaint. */
326
- const proseStyle = {
327
- ...inputStyle,
328
- fontFamily: "inherit",
329
- fontSize: 13.5,
330
- lineHeight: 1.6
331
- };
332
- /** Persona editor: adaptive height comes from AutoTextarea (110–440px by
333
- * content); the style only carries font/border. */
334
- const textareaStyle = {
335
- ...proseStyle,
336
- resize: "vertical",
337
- whiteSpace: "pre-wrap",
338
- overflowWrap: "anywhere"
339
- };
340
- const buttonStyle = {
341
- padding: "4px 12px",
342
- fontSize: 12.5,
343
- borderRadius: 6,
344
- border: "1px solid rgba(128,128,128,0.4)",
345
- background: "transparent",
346
- color: "inherit",
347
- cursor: "pointer",
348
- opacity: busy ? .55 : 1
349
- };
350
- const primaryStyle = {
351
- ...buttonStyle,
352
- border: "1px solid transparent",
353
- background: "rgba(59,130,246,0.9)",
354
- color: "#fff"
355
- };
356
- const dangerStyle = {
357
- ...buttonStyle,
358
- border: "1px solid rgba(220,38,38,0.55)"
359
- };
360
- const chipStyle = {
361
- display: "inline-flex",
362
- alignItems: "center",
363
- padding: "1px 8px",
364
- fontSize: 11,
365
- borderRadius: 999,
366
- border: "1px solid rgba(128,128,128,0.45)",
367
- opacity: .8
368
- };
369
- const cardStyle = {
370
- display: "flex",
371
- flexDirection: "column",
372
- gap: 8,
373
- padding: 12,
374
- border: "1px solid rgba(128,128,128,0.35)",
375
- borderRadius: 8
376
- };
377
- const hintStyle = {
378
- fontSize: 11.5,
379
- opacity: .6,
380
- margin: 0
381
- };
382
- const bannerStyle = {
383
- fontSize: 12,
384
- padding: "6px 10px",
385
- borderRadius: 6,
386
- display: "flex",
387
- flexDirection: "column",
388
- gap: 2
389
- };
390
- const okBannerStyle = {
391
- ...bannerStyle,
392
- background: "rgba(22,163,74,0.12)",
393
- border: "1px solid rgba(22,163,74,0.4)"
880
+ /** One row's field edit; `patch` merges onto the current draft. */
881
+ const patch = (id, changes) => {
882
+ setEntries((current) => ({
883
+ ...current,
884
+ [id]: {
885
+ ...current[id],
886
+ ...changes
887
+ }
888
+ }));
394
889
  };
395
- const errorBannerStyle = {
396
- ...bannerStyle,
397
- background: "rgba(220,38,38,0.12)",
398
- border: "1px solid rgba(220,38,38,0.45)",
399
- color: "inherit"
890
+ const revertEntry = (id) => {
891
+ const saved = view?.entries[id];
892
+ if (saved !== void 0) setEntries((current) => ({
893
+ ...current,
894
+ [id]: structuredClone(saved)
895
+ }));
400
896
  };
401
- const warnBannerStyle = {
402
- ...bannerStyle,
403
- background: "rgba(217,119,6,0.14)",
404
- border: "1px solid rgba(217,119,6,0.45)"
897
+ const setDeny = (id, text) => {
898
+ const deny = parseList(text);
899
+ const allow = entries[id]?.toolFilter?.allow;
900
+ const keepAllow = allow !== void 0 && allow.length > 0;
901
+ patch(id, { toolFilter: keepAllow || deny.length > 0 ? {
902
+ ...keepAllow ? { allow } : {},
903
+ ...deny.length > 0 ? { deny } : {}
904
+ } : void 0 });
405
905
  };
406
- const infoBannerStyle = {
407
- ...bannerStyle,
408
- background: "rgba(128,128,128,0.12)",
409
- border: "1px solid rgba(128,128,128,0.35)"
906
+ const ids = (0, react.useMemo)(() => Object.keys(entries), [entries]);
907
+ const stats = (0, react.useMemo)(() => {
908
+ let off = 0;
909
+ let legacy = 0;
910
+ for (const id of ids) {
911
+ const entry = entries[id];
912
+ if (entry.enabled === false) off += 1;
913
+ if (entry.source === "legacy") legacy += 1;
914
+ }
915
+ return {
916
+ total: ids.length,
917
+ off,
918
+ legacy
919
+ };
920
+ }, [ids, entries]);
921
+ /** Disabled rows sink to the bottom (they are not what you came to look at),
922
+ * then plain alphabetical. */
923
+ const orderedIds = (0, react.useMemo)(() => [...ids].sort((a, b) => {
924
+ const offA = entries[a].enabled === false ? 1 : 0;
925
+ const offB = entries[b].enabled === false ? 1 : 0;
926
+ if (offA !== offB) return offA - offB;
927
+ return a.localeCompare(b);
928
+ }), [ids, entries]);
929
+ const needle = filter.trim().toLowerCase();
930
+ const visibleIds = (0, react.useMemo)(() => {
931
+ if (needle === "") return orderedIds;
932
+ return orderedIds.filter((id) => {
933
+ const entry = entries[id];
934
+ return [
935
+ id,
936
+ entry.description,
937
+ entry.model,
938
+ entry.provider,
939
+ entry.reasoningEffort,
940
+ entry.persona
941
+ ].filter((value) => typeof value === "string").join("\n").toLowerCase().includes(needle);
942
+ });
943
+ }, [
944
+ orderedIds,
945
+ entries,
946
+ needle
947
+ ]);
948
+ const dirtyIds = (0, react.useMemo)(() => {
949
+ const set = /* @__PURE__ */ new Set();
950
+ for (const id of ids) if (!sameEntry(entries[id], view?.entries[id])) set.add(id);
951
+ return set;
952
+ }, [
953
+ ids,
954
+ entries,
955
+ view
956
+ ]);
957
+ const openCount = visibleIds.filter((id) => open[id] === true).length;
958
+ const allOpen = visibleIds.length > 0 && openCount === visibleIds.length;
959
+ const toggleAll = () => {
960
+ setOpen((current) => {
961
+ const next = { ...current };
962
+ for (const id of visibleIds) next[id] = !allOpen;
963
+ return next;
964
+ });
410
965
  };
411
966
  if (view === null) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
412
- style: rootStyle,
967
+ className: "dsh-library",
968
+ style: S.root,
413
969
  children: [
970
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: SETTINGS_CSS }),
414
971
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
415
- style: {
416
- display: "flex",
417
- alignItems: "center",
418
- gap: 10
419
- },
972
+ style: S.headingRow,
420
973
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
421
- style: headingStyle,
974
+ style: S.heading,
422
975
  children: "子代理库"
423
976
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
424
977
  type: "button",
425
978
  onClick: load,
426
- style: buttonStyle,
979
+ style: S.button,
427
980
  children: "重试"
428
981
  })]
429
982
  }),
430
983
  status !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
431
- style: status.kind === "ok" ? okBannerStyle : errorBannerStyle,
984
+ style: status.kind === "ok" ? BANNER.ok : BANNER.error,
432
985
  children: status.text
433
986
  }),
434
987
  status === null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
435
- style: subStyle,
988
+ style: S.sub,
436
989
  children: "正在加载…(若长时间无响应,请重试或检查插件是否加载)"
437
990
  })
438
991
  ]
439
992
  });
440
- const ids = Object.keys(entries);
441
993
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
442
- style: rootStyle,
994
+ className: "dsh-library",
995
+ style: S.root,
443
996
  children: [
997
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: SETTINGS_CSS }),
444
998
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
445
- style: {
446
- display: "flex",
447
- flexDirection: "column",
448
- gap: 2
449
- },
999
+ style: S.pageHeader,
450
1000
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
451
- style: {
452
- display: "flex",
453
- alignItems: "center",
454
- gap: 10
455
- },
456
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
457
- style: headingStyle,
458
- children: "子代理库"
459
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
460
- type: "button",
461
- onClick: load,
462
- style: buttonStyle,
463
- children: "刷新"
464
- })]
465
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
466
- style: subStyle,
1001
+ style: S.headingRow,
467
1002
  children: [
468
- "管理具名角色子代理(每条目一个 YAML 文件,保存即热生效)。让 agent 修改条目前,建议先把原文件复制到名册目录的 ",
469
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: "_backups/" }),
470
- " 里。"
1003
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
1004
+ style: S.heading,
1005
+ children: "子代理库"
1006
+ }),
1007
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: { flex: 1 } }),
1008
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1009
+ type: "button",
1010
+ onClick: load,
1011
+ disabled: busy,
1012
+ style: S.button,
1013
+ children: "刷新"
1014
+ })
471
1015
  ]
1016
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1017
+ style: S.sub,
1018
+ children: "集中管理角色、模型与执行方式。展开条目编辑,保存后即刻生效。"
472
1019
  })]
473
1020
  }),
474
1021
  (view.diagnostics?.length ?? 0) > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
475
- style: warnBannerStyle,
1022
+ style: BANNER.warn,
476
1023
  children: view.diagnostics.map((item, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
477
1024
  style: {
478
1025
  fontWeight: item.severity === "error" ? 600 : 400,
479
- opacity: item.severity === "info" ? .75 : 1
1026
+ opacity: item.severity === "info" ? .78 : 1
480
1027
  },
481
1028
  children: [
482
1029
  item.severity === "error" ? "错误" : item.severity === "warning" ? "警告" : "提示",
@@ -487,7 +1034,7 @@ function LibrarySettings(props) {
487
1034
  }, index))
488
1035
  }),
489
1036
  (view.legacyCount ?? 0) > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
490
- style: infoBannerStyle,
1037
+ style: BANNER.info,
491
1038
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
492
1039
  "0.2→0.3 迁移:",
493
1040
  view.legacyCount,
@@ -502,619 +1049,766 @@ function LibrarySettings(props) {
502
1049
  }, "");
503
1050
  },
504
1051
  style: {
505
- ...buttonStyle,
1052
+ ...S.button,
506
1053
  alignSelf: "flex-start"
507
1054
  },
508
1055
  children: "清除旧条目"
509
1056
  })]
510
1057
  }),
511
- ids.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
512
- style: subStyle,
513
- children: "库为空。添加第一个条目开始使用,或在名册目录放一个 <id>.yaml。"
514
- }),
515
- ids.map((id) => {
516
- const entry = entries[id];
517
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
518
- style: cardStyle,
1058
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1059
+ style: S.band,
1060
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1061
+ style: S.bandStats,
519
1062
  children: [
520
1063
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
521
- style: {
522
- display: "flex",
523
- alignItems: "center",
524
- gap: 10,
525
- flexWrap: "wrap"
526
- },
527
- children: [
528
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
529
- style: {
530
- fontSize: 13,
531
- fontWeight: 600,
532
- fontFamily: "Consolas, Menlo, monospace",
533
- opacity: entry.enabled === false ? .5 : 1
534
- },
535
- children: id
536
- }),
537
- entry.source === "legacy" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
538
- style: chipStyle,
539
- children: "legacy"
540
- }),
541
- entry.enabled === false && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
542
- style: chipStyle,
543
- children: "已停用"
544
- }),
545
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
546
- style: {
547
- fontSize: 11.5,
548
- opacity: .7
549
- },
550
- children: [
551
- entry.provider || "默认路由",
552
- "/",
553
- entry.model || "默认模型",
554
- entry.backgroundMode === "continuable" ? " · 可续聊" : "",
555
- entry.maxDepth !== void 0 ? ` · 深度${entry.maxDepth}` : "",
556
- entry.maxTokens !== void 0 ? ` · ${entry.maxTokens}tok` : ""
557
- ]
558
- }),
559
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: { flex: 1 } }),
560
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
561
- style: {
562
- fontSize: 12.5,
563
- display: "flex",
564
- alignItems: "center",
565
- gap: 4,
566
- cursor: "pointer"
567
- },
568
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
569
- type: "checkbox",
570
- checked: entry.enabled !== false,
571
- onChange: (event) => setEntries({
572
- ...entries,
573
- [id]: {
574
- ...entry,
575
- enabled: event.target.checked ? void 0 : false
576
- }
577
- })
578
- }), "启用"]
579
- }),
580
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
581
- type: "button",
582
- disabled: busy,
583
- onClick: () => removeEntry(id),
584
- style: dangerStyle,
585
- children: "删除"
586
- }),
587
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
588
- type: "button",
589
- disabled: busy,
590
- onClick: () => updateEntry(id, entry),
591
- style: primaryStyle,
592
- children: "保存"
593
- })
594
- ]
595
- }),
596
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
597
- style: rowStyle,
1064
+ style: S.bandStat,
598
1065
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
599
- style: labelStyle,
600
- children: "描述"
601
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
602
- value: entry.description ?? "",
603
- onChange: (event) => setEntries({
604
- ...entries,
605
- [id]: {
606
- ...entry,
607
- description: event.target.value
608
- }
609
- }),
610
- placeholder: "角色描述(模型可见,可拖右下角展开)",
611
- rows: 1,
612
- style: {
613
- ...proseStyle,
614
- resize: "vertical",
615
- whiteSpace: "pre-wrap",
616
- overflowWrap: "anywhere",
617
- overflow: "auto"
618
- }
1066
+ style: S.bandValue,
1067
+ children: stats.total
1068
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1069
+ style: S.bandLabel,
1070
+ children: "个子代理"
619
1071
  })]
620
1072
  }),
621
1073
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
622
- style: {
623
- display: "flex",
624
- flexWrap: "wrap",
625
- gap: "8px"
626
- },
627
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
628
- style: colStyle,
629
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
630
- style: labelStyle,
631
- children: "Provider"
632
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
633
- value: entry.provider ?? "",
634
- onChange: (event) => setEntries({
635
- ...entries,
636
- [id]: {
637
- ...entry,
638
- provider: event.target.value
639
- }
640
- }),
641
- placeholder: "deepseek-official / kimi-coding",
642
- style: inputStyle
643
- })]
644
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
645
- style: colStyle,
646
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
647
- style: labelStyle,
648
- children: "模型"
649
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
650
- value: entry.model ?? "",
651
- onChange: (event) => setEntries({
652
- ...entries,
653
- [id]: {
654
- ...entry,
655
- model: event.target.value
656
- }
657
- }),
658
- placeholder: "k3-256k",
659
- style: inputStyle
660
- })]
661
- })]
662
- }),
663
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
664
- style: {
665
- display: "flex",
666
- flexWrap: "wrap",
667
- gap: "8px"
668
- },
669
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
670
- style: colStyle,
671
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
672
- style: labelStyle,
673
- children: "传输层"
674
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
675
- value: entry.subagentProvider ?? "",
676
- onChange: (event) => setEntries({
677
- ...entries,
678
- [id]: {
679
- ...entry,
680
- subagentProvider: event.target.value
681
- }
682
- }),
683
- placeholder: "spawn(默认)",
684
- style: inputStyle
685
- })]
686
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
687
- style: fixedColStyle,
688
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
689
- style: labelStyle,
690
- children: "输出上限"
691
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
692
- type: "number",
693
- min: 1,
694
- value: entry.maxTokens ?? "",
695
- onChange: (event) => setEntries({
696
- ...entries,
697
- [id]: {
698
- ...entry,
699
- maxTokens: event.target.value === "" ? void 0 : Number(event.target.value)
700
- }
701
- }),
702
- placeholder: "tokens",
703
- style: {
704
- ...inputStyle,
705
- flex: "none",
706
- width: 116
707
- }
708
- })]
709
- })]
710
- }),
711
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
712
- style: {
713
- display: "flex",
714
- flexWrap: "wrap",
715
- gap: "8px"
716
- },
717
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
718
- style: fixedColStyle,
719
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
720
- style: labelStyle,
721
- children: "深度上限"
722
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
723
- type: "number",
724
- min: 1,
725
- value: entry.maxDepth ?? "",
726
- onChange: (event) => setEntries({
727
- ...entries,
728
- [id]: {
729
- ...entry,
730
- maxDepth: event.target.value === "" ? void 0 : Number(event.target.value)
731
- }
732
- }),
733
- style: {
734
- ...inputStyle,
735
- flex: "none",
736
- width: 84
737
- }
738
- })]
739
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1074
+ style: S.bandStat,
1075
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
740
1076
  style: {
741
- ...colStyle,
742
- flex: 1
1077
+ ...S.bandValue,
1078
+ color: SUCCESS
743
1079
  },
744
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
745
- style: labelStyle,
746
- children: "禁用工具"
747
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
748
- value: (entry.toolFilter?.deny ?? []).join(", "),
749
- onChange: (event) => {
750
- const deny = event.target.value.split(",").map((item) => item.trim()).filter(Boolean);
751
- const allow = entry.toolFilter?.allow;
752
- setEntries({
753
- ...entries,
754
- [id]: {
755
- ...entry,
756
- toolFilter: allow !== void 0 && allow.length > 0 || deny.length > 0 ? {
757
- ...allow !== void 0 && allow.length > 0 ? { allow } : {},
758
- ...deny.length > 0 ? { deny } : {}
759
- } : void 0
760
- }
761
- });
762
- },
763
- placeholder: "write, edit, todo_write, …",
764
- style: inputStyle
765
- })]
1080
+ children: stats.total - stats.off
1081
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1082
+ style: S.bandLabel,
1083
+ children: "已启用"
766
1084
  })]
767
1085
  }),
768
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
769
- style: {
770
- display: "flex",
771
- flexWrap: "wrap",
772
- gap: "8px"
773
- },
774
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
775
- style: {
776
- ...colStyle,
777
- flex: 1
778
- },
779
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
780
- style: labelStyle,
781
- children: "思考强度"
782
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
783
- value: entry.reasoningEffort ?? "",
784
- onChange: (event) => setEntries({
785
- ...entries,
786
- [id]: {
787
- ...entry,
788
- reasoningEffort: event.target.value === "" ? void 0 : event.target.value.trim()
789
- }
790
- }),
791
- placeholder: "如 max / high / medium / low(留空随父会话默认)",
792
- style: inputStyle
793
- })]
794
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
795
- style: fixedColStyle,
796
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
797
- style: labelStyle,
798
- children: "后台模式"
799
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
800
- value: entry.backgroundMode ?? "one-shot",
801
- onChange: (event) => setEntries({
802
- ...entries,
803
- [id]: {
804
- ...entry,
805
- backgroundMode: event.target.value
806
- }
807
- }),
808
- style: {
809
- ...inputStyle,
810
- flex: "none",
811
- width: 132
812
- },
813
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
814
- value: "one-shot",
815
- children: "one-shot"
816
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
817
- value: "continuable",
818
- children: "continuable"
819
- })]
820
- })]
1086
+ stats.off > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1087
+ style: S.bandStat,
1088
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1089
+ style: S.bandValue,
1090
+ children: stats.off
1091
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1092
+ style: S.bandLabel,
1093
+ children: "已停用"
821
1094
  })]
822
1095
  }),
823
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
824
- style: rowStyle,
1096
+ dirtyIds.size > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1097
+ style: S.bandStat,
825
1098
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
826
- style: labelStyle,
827
- children: "角色提示词"
828
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AutoTextarea, {
829
- value: entry.persona ?? "",
830
- onChange: (event) => setEntries({
831
- ...entries,
832
- [id]: {
833
- ...entry,
834
- persona: event.target.value
835
- }
836
- }),
837
- placeholder: "子代理的系统提示词(可选)",
838
- style: textareaStyle
1099
+ style: {
1100
+ ...S.bandValue,
1101
+ color: DANGER
1102
+ },
1103
+ children: dirtyIds.size
1104
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1105
+ style: S.bandLabel,
1106
+ children: "未保存"
839
1107
  })]
840
1108
  })
841
1109
  ]
842
- }, id);
1110
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1111
+ style: S.bandDir,
1112
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1113
+ style: S.bandLabel,
1114
+ children: "名册目录"
1115
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1116
+ style: S.bandPath,
1117
+ title: view.dir || "~/.dsh/subagents",
1118
+ children: view.dir || "~/.dsh/subagents"
1119
+ })]
1120
+ })]
843
1121
  }),
844
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
845
- style: cardStyle,
1122
+ stats.total > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1123
+ style: S.bar,
846
1124
  children: [
847
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
848
- style: {
849
- display: "flex",
850
- alignItems: "center",
851
- gap: "10px"
852
- },
1125
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
1126
+ style: S.search,
853
1127
  children: [
854
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1128
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
1129
+ width: "12",
1130
+ height: "12",
1131
+ viewBox: "0 0 12 12",
1132
+ fill: "none",
1133
+ stroke: "currentColor",
1134
+ strokeWidth: "1.5",
1135
+ strokeLinecap: "round",
855
1136
  style: {
856
- fontSize: 13,
857
- fontWeight: 600
1137
+ color: "inherit",
1138
+ opacity: .6,
1139
+ flex: "none"
858
1140
  },
859
- children: "新增子代理"
1141
+ "aria-hidden": "true",
1142
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
1143
+ cx: "5",
1144
+ cy: "5",
1145
+ r: "3.4"
1146
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M7.6 7.6L10.5 10.5" })]
860
1147
  }),
861
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: { flex: 1 } }),
862
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1148
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1149
+ value: filter,
1150
+ onChange: (event) => setFilter(event.target.value),
1151
+ placeholder: "筛选 id、描述、模型…",
1152
+ "aria-label": "筛选子代理",
1153
+ style: S.searchInput
1154
+ }),
1155
+ filter !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
863
1156
  type: "button",
864
- disabled: busy,
865
- onClick: addEntry,
866
- style: primaryStyle,
867
- children: "添加"
1157
+ onClick: () => setFilter(""),
1158
+ title: "清除筛选",
1159
+ style: {
1160
+ ...S.ghost,
1161
+ padding: 0,
1162
+ fontSize: 13,
1163
+ lineHeight: 1
1164
+ },
1165
+ children: "×"
868
1166
  })
869
1167
  ]
870
1168
  }),
871
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
872
- style: rowStyle,
873
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
874
- style: labelStyle,
875
- children: "ID"
876
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
877
- value: newId,
878
- onChange: (event) => setNewId(event.target.value),
879
- placeholder: "k3-reviewer",
880
- style: {
881
- ...inputStyle,
882
- maxWidth: "200px"
883
- }
884
- })]
1169
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1170
+ type: "button",
1171
+ onClick: toggleAll,
1172
+ disabled: visibleIds.length === 0,
1173
+ style: S.button,
1174
+ children: allOpen ? "全部收起" : "全部展开"
885
1175
  }),
886
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
887
- style: rowStyle,
1176
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1177
+ type: "button",
1178
+ onClick: () => setAdding((current) => !current),
1179
+ style: adding ? S.button : S.primary,
1180
+ children: adding ? "取消新增" : "+ 新增子代理"
1181
+ })
1182
+ ]
1183
+ }),
1184
+ (adding || stats.total === 0) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1185
+ className: "dsh-library-card",
1186
+ style: {
1187
+ ...S.row,
1188
+ ...S.rowOpen
1189
+ },
1190
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1191
+ style: S.addHead,
1192
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1193
+ style: S.addIntro,
888
1194
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
889
- style: labelStyle,
890
- children: "描述"
891
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
892
- value: newEntry.description ?? "",
893
- onChange: (event) => setNewEntry({
894
- ...newEntry,
895
- description: event.target.value
896
- }),
897
- placeholder: "角色描述(模型可见,可拖右下角展开)",
898
- rows: 1,
899
1195
  style: {
900
- ...proseStyle,
901
- resize: "vertical",
902
- whiteSpace: "pre-wrap",
903
- overflowWrap: "anywhere",
904
- overflow: "auto"
905
- }
906
- })]
907
- }),
908
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
909
- style: {
910
- display: "flex",
911
- flexWrap: "wrap",
912
- gap: "8px"
913
- },
914
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
915
- style: colStyle,
916
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
917
- style: labelStyle,
918
- children: "Provider"
919
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
920
- value: newEntry.provider ?? "",
921
- onChange: (event) => setNewEntry({
922
- ...newEntry,
923
- provider: event.target.value
924
- }),
925
- placeholder: "kimi-coding",
926
- style: inputStyle
927
- })]
928
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
929
- style: colStyle,
930
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
931
- style: labelStyle,
932
- children: "模型"
933
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
934
- value: newEntry.model ?? "",
935
- onChange: (event) => setNewEntry({
936
- ...newEntry,
937
- model: event.target.value
938
- }),
939
- placeholder: "k3-256k",
940
- style: inputStyle
941
- })]
1196
+ ...S.id,
1197
+ color: ACCENT
1198
+ },
1199
+ children: "新增子代理"
1200
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1201
+ style: S.sub,
1202
+ children: "填写 ID 与角色描述,其余配置可稍后补充。"
942
1203
  })]
943
- }),
944
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
945
- style: {
946
- display: "flex",
947
- flexWrap: "wrap",
948
- gap: "8px"
949
- },
950
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
951
- style: colStyle,
952
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
953
- style: labelStyle,
954
- children: "传输层"
955
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
956
- value: newEntry.subagentProvider ?? "",
957
- onChange: (event) => setNewEntry({
958
- ...newEntry,
959
- subagentProvider: event.target.value
960
- }),
961
- placeholder: "spawn(默认)",
962
- style: inputStyle
1204
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1205
+ type: "button",
1206
+ disabled: busy,
1207
+ onClick: addEntry,
1208
+ style: S.primary,
1209
+ children: "创建子代理"
1210
+ })]
1211
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1212
+ style: S.body,
1213
+ children: [
1214
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1215
+ className: "dsh-library-grid",
1216
+ style: S.grid,
1217
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1218
+ label: "ID",
1219
+ hint: "小写字母 / 数字 / 连字符",
1220
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1221
+ value: newId,
1222
+ onChange: (event) => setNewId(event.target.value),
1223
+ placeholder: "k3-reviewer",
1224
+ style: S.input
1225
+ })
1226
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1227
+ label: "模型",
1228
+ hint: "留空随默认路由",
1229
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1230
+ value: newEntry.model ?? "",
1231
+ onChange: (event) => setNewEntry({
1232
+ ...newEntry,
1233
+ model: event.target.value
1234
+ }),
1235
+ placeholder: "k3-256k",
1236
+ style: S.input
1237
+ })
963
1238
  })]
964
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
965
- style: fixedColStyle,
966
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
967
- style: labelStyle,
968
- children: "输出上限"
969
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
970
- type: "number",
971
- min: 1,
972
- value: newEntry.maxTokens ?? "",
1239
+ }),
1240
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1241
+ label: "描述(模型可见)",
1242
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
1243
+ value: newEntry.description ?? "",
973
1244
  onChange: (event) => setNewEntry({
974
1245
  ...newEntry,
975
- maxTokens: event.target.value === "" ? void 0 : Number(event.target.value)
1246
+ description: event.target.value
976
1247
  }),
977
- placeholder: "tokens(可选)",
1248
+ placeholder: "一句话说明这个角色做什么——模型靠它选人",
1249
+ rows: 1,
978
1250
  style: {
979
- ...inputStyle,
980
- flex: "none",
981
- width: 116
1251
+ ...S.prose,
1252
+ overflow: "auto"
982
1253
  }
983
- })]
984
- })]
985
- }),
986
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
987
- style: {
988
- display: "flex",
989
- flexWrap: "wrap",
990
- gap: "8px"
991
- },
992
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
993
- style: fixedColStyle,
994
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
995
- style: labelStyle,
996
- children: "深度上限"
997
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
998
- type: "number",
999
- min: 1,
1000
- value: newEntry.maxDepth ?? "",
1001
- onChange: (event) => setNewEntry({
1002
- ...newEntry,
1003
- maxDepth: event.target.value === "" ? void 0 : Number(event.target.value)
1254
+ })
1255
+ }),
1256
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1257
+ className: "dsh-library-grid",
1258
+ style: S.grid,
1259
+ children: [
1260
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1261
+ label: "Provider",
1262
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1263
+ value: newEntry.provider ?? "",
1264
+ onChange: (event) => setNewEntry({
1265
+ ...newEntry,
1266
+ provider: event.target.value
1267
+ }),
1268
+ placeholder: "kimi-coding",
1269
+ style: S.input
1270
+ })
1004
1271
  }),
1005
- style: {
1006
- ...inputStyle,
1007
- flex: "none",
1008
- width: 84
1009
- }
1010
- })]
1011
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1012
- style: {
1013
- ...colStyle,
1014
- flex: 1
1015
- },
1016
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1017
- style: labelStyle,
1018
- children: "禁用工具"
1019
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1020
- value: (newEntry.toolFilter?.deny ?? []).join(", "),
1021
- onChange: (event) => {
1022
- const deny = event.target.value.split(",").map((item) => item.trim()).filter(Boolean);
1023
- const allow = newEntry.toolFilter?.allow;
1024
- setNewEntry({
1025
- ...newEntry,
1026
- toolFilter: allow !== void 0 && allow.length > 0 || deny.length > 0 ? {
1027
- ...allow !== void 0 && allow.length > 0 ? { allow } : {},
1028
- ...deny.length > 0 ? { deny } : {}
1029
- } : void 0
1030
- });
1031
- },
1032
- placeholder: "write, edit, todo_write, …",
1033
- style: inputStyle
1034
- })]
1035
- })]
1036
- }),
1037
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1038
- style: {
1039
- display: "flex",
1040
- flexWrap: "wrap",
1041
- gap: "8px"
1042
- },
1043
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1044
- style: {
1045
- ...colStyle,
1046
- flex: 1
1047
- },
1048
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1049
- style: labelStyle,
1050
- children: "思考强度"
1051
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1052
- value: newEntry.reasoningEffort ?? "",
1053
- onChange: (event) => setNewEntry({
1054
- ...newEntry,
1055
- reasoningEffort: event.target.value === "" ? void 0 : event.target.value.trim()
1272
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1273
+ label: "传输层",
1274
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1275
+ value: newEntry.subagentProvider ?? "",
1276
+ onChange: (event) => setNewEntry({
1277
+ ...newEntry,
1278
+ subagentProvider: event.target.value
1279
+ }),
1280
+ placeholder: "spawn(默认)",
1281
+ style: S.input
1282
+ })
1283
+ }),
1284
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1285
+ label: "后台模式",
1286
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
1287
+ value: newEntry.backgroundMode ?? "one-shot",
1288
+ onChange: (event) => setNewEntry({
1289
+ ...newEntry,
1290
+ backgroundMode: event.target.value
1291
+ }),
1292
+ style: S.input,
1293
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
1294
+ value: "one-shot",
1295
+ children: "one-shot"
1296
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
1297
+ value: "continuable",
1298
+ children: "continuable"
1299
+ })]
1300
+ })
1301
+ }),
1302
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1303
+ label: "深度上限",
1304
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1305
+ type: "number",
1306
+ min: 1,
1307
+ value: newEntry.maxDepth ?? "",
1308
+ onChange: (event) => setNewEntry({
1309
+ ...newEntry,
1310
+ maxDepth: event.target.value === "" ? void 0 : Number(event.target.value)
1311
+ }),
1312
+ style: S.input
1313
+ })
1056
1314
  }),
1057
- placeholder: "如 max / high / medium / low(留空随父会话默认)",
1058
- style: inputStyle
1315
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1316
+ label: "输出上限",
1317
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1318
+ type: "number",
1319
+ min: 1,
1320
+ value: newEntry.maxTokens ?? "",
1321
+ onChange: (event) => setNewEntry({
1322
+ ...newEntry,
1323
+ maxTokens: event.target.value === "" ? void 0 : Number(event.target.value)
1324
+ }),
1325
+ placeholder: "tokens",
1326
+ style: S.input
1327
+ })
1328
+ })
1329
+ ]
1330
+ }),
1331
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1332
+ className: "dsh-library-grid",
1333
+ style: S.grid,
1334
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1335
+ label: "思考强度",
1336
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1337
+ value: newEntry.reasoningEffort ?? "",
1338
+ onChange: (event) => setNewEntry({
1339
+ ...newEntry,
1340
+ reasoningEffort: event.target.value === "" ? void 0 : event.target.value.trim()
1341
+ }),
1342
+ placeholder: "max / high / medium / low(留空随父会话默认)",
1343
+ style: S.input
1344
+ })
1345
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1346
+ label: "禁用工具",
1347
+ hint: "英文逗号分隔;写入时只增删 deny,不触碰手写的 allow",
1348
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1349
+ value: listToText(newEntry.toolFilter?.deny),
1350
+ onChange: (event) => {
1351
+ const deny = parseList(event.target.value);
1352
+ const allow = newEntry.toolFilter?.allow;
1353
+ const keepAllow = allow !== void 0 && allow.length > 0;
1354
+ setNewEntry({
1355
+ ...newEntry,
1356
+ toolFilter: keepAllow || deny.length > 0 ? {
1357
+ ...keepAllow ? { allow } : {},
1358
+ ...deny.length > 0 ? { deny } : {}
1359
+ } : void 0
1360
+ });
1361
+ },
1362
+ placeholder: "write, edit, todo_write, …",
1363
+ style: S.input
1364
+ })
1059
1365
  })]
1060
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1061
- style: fixedColStyle,
1062
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1063
- style: labelStyle,
1064
- children: "后台模式"
1065
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
1066
- value: newEntry.backgroundMode ?? "one-shot",
1366
+ }),
1367
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1368
+ label: "角色提示词(可选)",
1369
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AutoTextarea, {
1370
+ value: newEntry.persona ?? "",
1067
1371
  onChange: (event) => setNewEntry({
1068
1372
  ...newEntry,
1069
- backgroundMode: event.target.value
1373
+ persona: event.target.value
1070
1374
  }),
1071
- style: {
1072
- ...inputStyle,
1073
- flex: "none",
1074
- width: 132
1075
- },
1076
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
1077
- value: "one-shot",
1078
- children: "one-shot"
1079
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
1080
- value: "continuable",
1081
- children: "continuable"
1375
+ placeholder: "子代理的系统提示词",
1376
+ style: S.prose
1377
+ })
1378
+ })
1379
+ ]
1380
+ })]
1381
+ }),
1382
+ stats.total === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1383
+ style: S.empty,
1384
+ children: [
1385
+ "库为空。在上方填一个 id 与描述即可创建第一个条目,",
1386
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("br", {}),
1387
+ "或直接在名册目录放一个 ",
1388
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: "<id>.yaml" }),
1389
+ "。"
1390
+ ]
1391
+ }),
1392
+ stats.total > 0 && visibleIds.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1393
+ style: S.empty,
1394
+ children: [
1395
+ "没有匹配「",
1396
+ filter,
1397
+ "」的条目。"
1398
+ ]
1399
+ }),
1400
+ visibleIds.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1401
+ style: S.listCaption,
1402
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: needle === "" ? "角色名册" : `匹配 ${visibleIds.length} / ${stats.total} 个子代理` }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "点击名称展开配置" })]
1403
+ }),
1404
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1405
+ style: S.list,
1406
+ children: visibleIds.map((id) => {
1407
+ const entry = entries[id];
1408
+ const isOpen = open[id] === true;
1409
+ const dirty = dirtyIds.has(id);
1410
+ const off = entry.enabled === false;
1411
+ const model = entry.model || "";
1412
+ const provider = entry.provider || "";
1413
+ const route = provider !== "" && model !== "" ? `${provider}/${model}` : model !== "" ? model : provider !== "" ? provider : "默认路由";
1414
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1415
+ className: "dsh-library-card",
1416
+ "data-entry-id": id,
1417
+ style: {
1418
+ ...S.row,
1419
+ ...isOpen ? S.rowOpen : null,
1420
+ ...off ? S.rowOff : null
1421
+ },
1422
+ children: [
1423
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1424
+ style: S.head,
1425
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1426
+ type: "button",
1427
+ className: "dsh-library-disclosure",
1428
+ style: S.disclosure,
1429
+ "aria-expanded": isOpen,
1430
+ "aria-controls": `${sectionId}-${id}`,
1431
+ "aria-label": `${isOpen ? "收起" : "展开"} ${id} 的配置`,
1432
+ "data-row-id": id,
1433
+ onClick: () => setOpen((current) => ({
1434
+ ...current,
1435
+ [id]: !isOpen
1436
+ })),
1437
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chevron, { open: isOpen }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1438
+ style: S.titleRow,
1439
+ children: [
1440
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1441
+ style: S.id,
1442
+ children: id
1443
+ }),
1444
+ entry.source === "legacy" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1445
+ style: S.chip,
1446
+ children: "旧版条目"
1447
+ }),
1448
+ dirty && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1449
+ style: S.dirtyChip,
1450
+ children: "未保存"
1451
+ })
1452
+ ]
1453
+ })]
1454
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
1455
+ style: S.headToggle,
1456
+ title: "切换后需保存此条目才会生效",
1457
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1458
+ className: "dsh-library-switch",
1459
+ type: "checkbox",
1460
+ role: "switch",
1461
+ "aria-label": `启用 ${id}`,
1462
+ checked: !off,
1463
+ onChange: (event) => patch(id, { enabled: event.target.checked ? void 0 : false })
1464
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: off ? "已停用" : "已启用" })]
1082
1465
  })]
1083
- })]
1084
- })]
1085
- }),
1086
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1087
- style: rowStyle,
1088
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1089
- style: labelStyle,
1090
- children: "角色提示词"
1091
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AutoTextarea, {
1092
- value: newEntry.persona ?? "",
1093
- onChange: (event) => setNewEntry({
1094
- ...newEntry,
1095
- persona: event.target.value
1096
1466
  }),
1097
- placeholder: "子代理的系统提示词(可选)",
1098
- style: textareaStyle
1099
- })]
1100
- })
1101
- ]
1467
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1468
+ style: S.overview,
1469
+ children: [
1470
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1471
+ style: S.excerpt,
1472
+ title: entry.description ?? "",
1473
+ children: entry.description || "暂无角色描述"
1474
+ }),
1475
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1476
+ style: S.route,
1477
+ title: `路由:${route}`,
1478
+ children: [
1479
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1480
+ style: S.metaLabel,
1481
+ children: "模型"
1482
+ }),
1483
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1484
+ style: S.model,
1485
+ children: model || "跟随默认模型"
1486
+ }),
1487
+ provider !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1488
+ style: S.provider,
1489
+ children: provider
1490
+ })
1491
+ ]
1492
+ }),
1493
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1494
+ style: S.glyphs,
1495
+ children: [
1496
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1497
+ style: entry.backgroundMode === "continuable" ? S.modeChip : S.glyph,
1498
+ children: entry.backgroundMode === "continuable" ? "可续聊" : "单次任务"
1499
+ }),
1500
+ entry.reasoningEffort && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1501
+ style: S.glyph,
1502
+ children: ["思考 ", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1503
+ style: S.metaValue,
1504
+ children: entry.reasoningEffort
1505
+ })]
1506
+ }),
1507
+ entry.maxDepth !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1508
+ style: S.glyph,
1509
+ children: ["深度 ", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1510
+ style: S.metaValue,
1511
+ children: entry.maxDepth
1512
+ })]
1513
+ }),
1514
+ entry.maxTokens !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1515
+ style: S.glyph,
1516
+ children: [
1517
+ "输出 ",
1518
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1519
+ style: S.metaValue,
1520
+ children: entry.maxTokens.toLocaleString("en-US")
1521
+ }),
1522
+ " tokens"
1523
+ ]
1524
+ }),
1525
+ entry.persona && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1526
+ style: S.glyph,
1527
+ children: "角色提示词"
1528
+ }),
1529
+ (entry.toolFilter?.deny?.length ?? 0) > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1530
+ style: S.glyph,
1531
+ children: [
1532
+ "禁用 ",
1533
+ entry.toolFilter.deny.length,
1534
+ " 项工具"
1535
+ ]
1536
+ }),
1537
+ (entry.toolFilter?.allow?.length ?? 0) > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1538
+ style: S.glyph,
1539
+ children: [
1540
+ "允许 ",
1541
+ entry.toolFilter.allow.length,
1542
+ " 项工具"
1543
+ ]
1544
+ })
1545
+ ]
1546
+ })
1547
+ ]
1548
+ }),
1549
+ dirty && !isOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1550
+ style: S.draftActions,
1551
+ children: [
1552
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1553
+ style: S.hint,
1554
+ children: "保存后生效"
1555
+ }),
1556
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: S.spacer }),
1557
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1558
+ type: "button",
1559
+ disabled: busy,
1560
+ onClick: (event) => {
1561
+ focusDisclosure(event);
1562
+ revertEntry(id);
1563
+ },
1564
+ style: S.ghost,
1565
+ children: "还原"
1566
+ }),
1567
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1568
+ type: "button",
1569
+ disabled: busy,
1570
+ onClick: (event) => {
1571
+ focusDisclosure(event);
1572
+ updateEntry(id, entry);
1573
+ },
1574
+ style: S.primary,
1575
+ children: "保存修改"
1576
+ })
1577
+ ]
1578
+ }),
1579
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1580
+ id: `${sectionId}-${id}`,
1581
+ hidden: !isOpen,
1582
+ children: isOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1583
+ style: S.body,
1584
+ children: [
1585
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1586
+ style: S.group,
1587
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1588
+ style: S.groupTitle,
1589
+ children: "概述"
1590
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1591
+ label: "描述(模型可见)",
1592
+ hint: "模型用 list_subagents 读到的就是这句话,写清角色与适用场景",
1593
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
1594
+ value: entry.description ?? "",
1595
+ onChange: (event) => patch(id, { description: event.target.value }),
1596
+ placeholder: "角色描述",
1597
+ rows: 1,
1598
+ style: {
1599
+ ...S.prose,
1600
+ overflow: "auto"
1601
+ }
1602
+ })
1603
+ })]
1604
+ }),
1605
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1606
+ style: S.group,
1607
+ children: [
1608
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1609
+ style: S.groupTitle,
1610
+ children: "路由与执行"
1611
+ }),
1612
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1613
+ className: "dsh-library-grid",
1614
+ style: S.grid,
1615
+ children: [
1616
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1617
+ label: "Provider",
1618
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1619
+ value: entry.provider ?? "",
1620
+ onChange: (event) => patch(id, { provider: event.target.value }),
1621
+ placeholder: "deepseek-official / kimi-coding",
1622
+ style: S.input
1623
+ })
1624
+ }),
1625
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1626
+ label: "模型",
1627
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1628
+ value: entry.model ?? "",
1629
+ onChange: (event) => patch(id, { model: event.target.value }),
1630
+ placeholder: "k3-256k",
1631
+ style: S.input
1632
+ })
1633
+ }),
1634
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1635
+ label: "传输层",
1636
+ hint: "留空用 spawn",
1637
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1638
+ value: entry.subagentProvider ?? "",
1639
+ onChange: (event) => patch(id, { subagentProvider: event.target.value }),
1640
+ placeholder: "spawn(默认)",
1641
+ style: S.input
1642
+ })
1643
+ }),
1644
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1645
+ label: "后台模式",
1646
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
1647
+ value: entry.backgroundMode ?? "one-shot",
1648
+ onChange: (event) => patch(id, { backgroundMode: event.target.value }),
1649
+ style: S.input,
1650
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
1651
+ value: "one-shot",
1652
+ children: "one-shot"
1653
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
1654
+ value: "continuable",
1655
+ children: "continuable"
1656
+ })]
1657
+ })
1658
+ })
1659
+ ]
1660
+ }),
1661
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1662
+ className: "dsh-library-grid",
1663
+ style: S.grid,
1664
+ children: [
1665
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1666
+ label: "思考强度",
1667
+ hint: "留空随父会话默认",
1668
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1669
+ value: entry.reasoningEffort ?? "",
1670
+ onChange: (event) => patch(id, { reasoningEffort: event.target.value === "" ? void 0 : event.target.value.trim() }),
1671
+ placeholder: "max / high / medium / low",
1672
+ style: S.input
1673
+ })
1674
+ }),
1675
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1676
+ label: "深度上限",
1677
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1678
+ type: "number",
1679
+ min: 1,
1680
+ value: entry.maxDepth ?? "",
1681
+ onChange: (event) => patch(id, { maxDepth: event.target.value === "" ? void 0 : Number(event.target.value) }),
1682
+ style: S.input
1683
+ })
1684
+ }),
1685
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1686
+ label: "输出上限",
1687
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1688
+ type: "number",
1689
+ min: 1,
1690
+ value: entry.maxTokens ?? "",
1691
+ onChange: (event) => patch(id, { maxTokens: event.target.value === "" ? void 0 : Number(event.target.value) }),
1692
+ placeholder: "tokens",
1693
+ style: S.input
1694
+ })
1695
+ })
1696
+ ]
1697
+ })
1698
+ ]
1699
+ }),
1700
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1701
+ style: S.group,
1702
+ children: [
1703
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1704
+ style: S.groupTitle,
1705
+ children: "工具与提示词"
1706
+ }),
1707
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1708
+ label: "禁用工具",
1709
+ hint: "英文逗号分隔;留空表示不限制。手写的 allow 列表会原样保留",
1710
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1711
+ value: listToText(entry.toolFilter?.deny),
1712
+ onChange: (event) => setDeny(id, event.target.value),
1713
+ placeholder: "write, edit, todo_write, …",
1714
+ style: S.input
1715
+ })
1716
+ }),
1717
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1718
+ label: "角色提示词(可选)",
1719
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AutoTextarea, {
1720
+ value: entry.persona ?? "",
1721
+ onChange: (event) => patch(id, { persona: event.target.value }),
1722
+ placeholder: "子代理的系统提示词",
1723
+ style: S.prose
1724
+ })
1725
+ })
1726
+ ]
1727
+ }),
1728
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1729
+ style: S.actions,
1730
+ children: [
1731
+ dirty ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1732
+ style: {
1733
+ ...S.hint,
1734
+ color: DANGER
1735
+ },
1736
+ children: "此条目有未保存修改"
1737
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1738
+ style: S.hint,
1739
+ children: entry.source === "legacy" ? "来自 settings.yaml 的迁移副本" : "与名册文件一致"
1740
+ }),
1741
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: S.spacer }),
1742
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1743
+ type: "button",
1744
+ disabled: busy || !dirty,
1745
+ onClick: () => revertEntry(id),
1746
+ style: {
1747
+ ...S.ghost,
1748
+ opacity: busy || !dirty ? .45 : 1
1749
+ },
1750
+ title: "丢弃本行的未保存修改,恢复为服务器当前值",
1751
+ children: "还原"
1752
+ }),
1753
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1754
+ type: "button",
1755
+ disabled: busy,
1756
+ onClick: () => removeEntry(id),
1757
+ style: {
1758
+ ...S.danger,
1759
+ opacity: busy ? .55 : 1
1760
+ },
1761
+ children: "删除"
1762
+ }),
1763
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1764
+ type: "button",
1765
+ disabled: busy || !dirty,
1766
+ onClick: () => updateEntry(id, entry),
1767
+ style: {
1768
+ ...S.primary,
1769
+ opacity: busy || !dirty ? .5 : 1
1770
+ },
1771
+ children: "保存"
1772
+ })
1773
+ ]
1774
+ })
1775
+ ]
1776
+ })
1777
+ })
1778
+ ]
1779
+ }, id);
1780
+ })
1102
1781
  }),
1103
1782
  status !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1104
- style: status.kind === "ok" ? okBannerStyle : errorBannerStyle,
1783
+ role: "status",
1784
+ "aria-live": "polite",
1785
+ style: status.kind === "ok" ? BANNER.ok : BANNER.error,
1105
1786
  children: status.text
1106
1787
  }),
1107
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1108
- style: hintStyle,
1109
- children: [
1110
- "配置存储于名册目录 ",
1111
- view.dir || "~/.dsh/subagents",
1112
- "(每具名子代理一个 <id>.yaml,可手编、热生效;",
1113
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: "_" }),
1114
- " 前缀的文件/目录为非名册内容,如 ",
1115
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: "_backups/" }),
1116
- " 备份区)。 settings.yaml 中的旧 entries 仅作迁移兜底读取,文件优先生效。"
1117
- ]
1788
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", {
1789
+ style: S.footer,
1790
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("summary", {
1791
+ style: S.footerSummary,
1792
+ children: "存储与备份说明"
1793
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1794
+ style: S.hint,
1795
+ children: [
1796
+ "配置存储于名册目录 ",
1797
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
1798
+ style: { fontFamily: MONO },
1799
+ children: view.dir || "~/.dsh/subagents"
1800
+ }),
1801
+ "(每具名子代理一个 ",
1802
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: "<id>.yaml" }),
1803
+ ",可手编、热生效;",
1804
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: "_" }),
1805
+ " 前缀的文件/目录为非名册内容,如 ",
1806
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: "_backups/" }),
1807
+ " 备份区)。 让 agent 修改条目前,建议先把原文件复制到 ",
1808
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: "_backups/" }),
1809
+ " 里。 settings.yaml 中的旧 entries 仅作迁移兜底读取,文件优先生效。"
1810
+ ]
1811
+ })]
1118
1812
  })
1119
1813
  ]
1120
1814
  });
@@ -1138,10 +1832,10 @@ function decorateSettingsNavIcon(ctx) {
1138
1832
  ctx.effect(() => {
1139
1833
  const decorate = () => {
1140
1834
  if (document.querySelector("[role=\"dialog\"]") === null) return;
1141
- for (const button of Array.from(document.querySelectorAll("button"))) {
1142
- const label = button.querySelector(":scope > span");
1835
+ for (const button$1 of Array.from(document.querySelectorAll("button"))) {
1836
+ const label = button$1.querySelector(":scope > span");
1143
1837
  if (label === null || !NAV_LABELS.has(label.textContent ?? "")) continue;
1144
- const existing = button.firstElementChild;
1838
+ const existing = button$1.firstElementChild;
1145
1839
  if (existing instanceof SVGElement) {
1146
1840
  if (existing.dataset.navIcon === "1") continue;
1147
1841
  const template = document.createElement("template");