dsh-subagent-library 0.3.2 → 0.3.4

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);
@@ -161,6 +758,7 @@ function LibrarySettings(props) {
161
758
  const cleanEntry = (entry) => {
162
759
  const clean = { ...entry };
163
760
  delete clean.source;
761
+ delete clean.routeNote;
164
762
  if (clean.enabled === void 0 || clean.enabled) delete clean.enabled;
165
763
  if (clean.provider === "") delete clean.provider;
166
764
  if (clean.model === "") delete clean.model;
@@ -170,8 +768,8 @@ function LibrarySettings(props) {
170
768
  if (clean.description === "") delete clean.description;
171
769
  if (clean.maxDepth === void 0) delete clean.maxDepth;
172
770
  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;
771
+ const filter$1 = clean.toolFilter;
772
+ 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
773
  return clean;
176
774
  };
177
775
  const updateEntry = (id, entry) => {
@@ -180,6 +778,10 @@ function LibrarySettings(props) {
180
778
  kind: "error",
181
779
  text: "描述不能为空。"
182
780
  });
781
+ setOpen((current) => ({
782
+ ...current,
783
+ [id]: true
784
+ }));
183
785
  return;
184
786
  }
185
787
  if (entry.maxDepth !== void 0 && (!Number.isInteger(entry.maxDepth) || entry.maxDepth < 1)) {
@@ -187,6 +789,10 @@ function LibrarySettings(props) {
187
789
  kind: "error",
188
790
  text: "深度上限需为 ≥1 的整数。"
189
791
  });
792
+ setOpen((current) => ({
793
+ ...current,
794
+ [id]: true
795
+ }));
190
796
  return;
191
797
  }
192
798
  if (entry.maxTokens !== void 0 && (!Number.isInteger(entry.maxTokens) || entry.maxTokens < 1)) {
@@ -194,6 +800,10 @@ function LibrarySettings(props) {
194
800
  kind: "error",
195
801
  text: "输出上限需为 ≥1 的整数。"
196
802
  });
803
+ setOpen((current) => ({
804
+ ...current,
805
+ [id]: true
806
+ }));
197
807
  return;
198
808
  }
199
809
  applyWrite({
@@ -260,223 +870,161 @@ function LibrarySettings(props) {
260
870
  model: "",
261
871
  backgroundMode: "one-shot"
262
872
  });
873
+ setAdding(false);
874
+ setOpen((current) => ({
875
+ ...current,
876
+ [id]: true
877
+ }));
263
878
  }
264
879
  });
265
880
  };
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)"
881
+ /** One row's field edit; `patch` merges onto the current draft. */
882
+ const patch = (id, changes) => {
883
+ setEntries((current) => ({
884
+ ...current,
885
+ [id]: {
886
+ ...current[id],
887
+ ...changes
888
+ }
889
+ }));
394
890
  };
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"
891
+ const revertEntry = (id) => {
892
+ const saved = view?.entries[id];
893
+ if (saved !== void 0) setEntries((current) => ({
894
+ ...current,
895
+ [id]: structuredClone(saved)
896
+ }));
400
897
  };
401
- const warnBannerStyle = {
402
- ...bannerStyle,
403
- background: "rgba(217,119,6,0.14)",
404
- border: "1px solid rgba(217,119,6,0.45)"
898
+ const setDeny = (id, text) => {
899
+ const deny = parseList(text);
900
+ const allow = entries[id]?.toolFilter?.allow;
901
+ const keepAllow = allow !== void 0 && allow.length > 0;
902
+ patch(id, { toolFilter: keepAllow || deny.length > 0 ? {
903
+ ...keepAllow ? { allow } : {},
904
+ ...deny.length > 0 ? { deny } : {}
905
+ } : void 0 });
405
906
  };
406
- const infoBannerStyle = {
407
- ...bannerStyle,
408
- background: "rgba(128,128,128,0.12)",
409
- border: "1px solid rgba(128,128,128,0.35)"
907
+ const ids = (0, react.useMemo)(() => Object.keys(entries), [entries]);
908
+ const stats = (0, react.useMemo)(() => {
909
+ let off = 0;
910
+ let legacy = 0;
911
+ for (const id of ids) {
912
+ const entry = entries[id];
913
+ if (entry.enabled === false) off += 1;
914
+ if (entry.source === "legacy") legacy += 1;
915
+ }
916
+ return {
917
+ total: ids.length,
918
+ off,
919
+ legacy
920
+ };
921
+ }, [ids, entries]);
922
+ /** Disabled rows sink to the bottom (they are not what you came to look at),
923
+ * then plain alphabetical. */
924
+ const orderedIds = (0, react.useMemo)(() => [...ids].sort((a, b) => {
925
+ const offA = entries[a].enabled === false ? 1 : 0;
926
+ const offB = entries[b].enabled === false ? 1 : 0;
927
+ if (offA !== offB) return offA - offB;
928
+ return a.localeCompare(b);
929
+ }), [ids, entries]);
930
+ const needle = filter.trim().toLowerCase();
931
+ const visibleIds = (0, react.useMemo)(() => {
932
+ if (needle === "") return orderedIds;
933
+ return orderedIds.filter((id) => {
934
+ const entry = entries[id];
935
+ return [
936
+ id,
937
+ entry.description,
938
+ entry.model,
939
+ entry.provider,
940
+ entry.reasoningEffort,
941
+ entry.persona
942
+ ].filter((value) => typeof value === "string").join("\n").toLowerCase().includes(needle);
943
+ });
944
+ }, [
945
+ orderedIds,
946
+ entries,
947
+ needle
948
+ ]);
949
+ const dirtyIds = (0, react.useMemo)(() => {
950
+ const set = /* @__PURE__ */ new Set();
951
+ for (const id of ids) if (!sameEntry(entries[id], view?.entries[id])) set.add(id);
952
+ return set;
953
+ }, [
954
+ ids,
955
+ entries,
956
+ view
957
+ ]);
958
+ const openCount = visibleIds.filter((id) => open[id] === true).length;
959
+ const allOpen = visibleIds.length > 0 && openCount === visibleIds.length;
960
+ const toggleAll = () => {
961
+ setOpen((current) => {
962
+ const next = { ...current };
963
+ for (const id of visibleIds) next[id] = !allOpen;
964
+ return next;
965
+ });
410
966
  };
411
967
  if (view === null) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
412
- style: rootStyle,
968
+ className: "dsh-library",
969
+ style: S.root,
413
970
  children: [
971
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: SETTINGS_CSS }),
414
972
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
415
- style: {
416
- display: "flex",
417
- alignItems: "center",
418
- gap: 10
419
- },
973
+ style: S.headingRow,
420
974
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
421
- style: headingStyle,
975
+ style: S.heading,
422
976
  children: "子代理库"
423
977
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
424
978
  type: "button",
425
979
  onClick: load,
426
- style: buttonStyle,
980
+ style: S.button,
427
981
  children: "重试"
428
982
  })]
429
983
  }),
430
984
  status !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
431
- style: status.kind === "ok" ? okBannerStyle : errorBannerStyle,
985
+ style: status.kind === "ok" ? BANNER.ok : BANNER.error,
432
986
  children: status.text
433
987
  }),
434
988
  status === null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
435
- style: subStyle,
989
+ style: S.sub,
436
990
  children: "正在加载…(若长时间无响应,请重试或检查插件是否加载)"
437
991
  })
438
992
  ]
439
993
  });
440
- const ids = Object.keys(entries);
441
994
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
442
- style: rootStyle,
995
+ className: "dsh-library",
996
+ style: S.root,
443
997
  children: [
998
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: SETTINGS_CSS }),
444
999
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
445
- style: {
446
- display: "flex",
447
- flexDirection: "column",
448
- gap: 2
449
- },
1000
+ style: S.pageHeader,
450
1001
  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,
1002
+ style: S.headingRow,
467
1003
  children: [
468
- "管理具名角色子代理(每条目一个 YAML 文件,保存即热生效)。让 agent 修改条目前,建议先把原文件复制到名册目录的 ",
469
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: "_backups/" }),
470
- " 里。"
1004
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
1005
+ style: S.heading,
1006
+ children: "子代理库"
1007
+ }),
1008
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: { flex: 1 } }),
1009
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1010
+ type: "button",
1011
+ onClick: load,
1012
+ disabled: busy,
1013
+ style: S.button,
1014
+ children: "刷新"
1015
+ })
471
1016
  ]
1017
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1018
+ style: S.sub,
1019
+ children: "集中管理角色、模型与执行方式。展开条目编辑,保存后即刻生效。"
472
1020
  })]
473
1021
  }),
474
1022
  (view.diagnostics?.length ?? 0) > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
475
- style: warnBannerStyle,
1023
+ style: BANNER.warn,
476
1024
  children: view.diagnostics.map((item, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
477
1025
  style: {
478
1026
  fontWeight: item.severity === "error" ? 600 : 400,
479
- opacity: item.severity === "info" ? .75 : 1
1027
+ opacity: item.severity === "info" ? .78 : 1
480
1028
  },
481
1029
  children: [
482
1030
  item.severity === "error" ? "错误" : item.severity === "warning" ? "警告" : "提示",
@@ -486,8 +1034,16 @@ function LibrarySettings(props) {
486
1034
  ]
487
1035
  }, index))
488
1036
  }),
1037
+ view.profile !== void 0 && view.profile !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1038
+ style: BANNER.info,
1039
+ children: [
1040
+ "当前 profile:",
1041
+ view.profile,
1042
+ "。这里填写的 Provider / 模型只保存到这个 profile,不会改写另一个 profile 的路由。共享名册里的模型若未在这里注册,调用会改用本会话的模型。"
1043
+ ]
1044
+ }),
489
1045
  (view.legacyCount ?? 0) > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
490
- style: infoBannerStyle,
1046
+ style: BANNER.info,
491
1047
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
492
1048
  "0.2→0.3 迁移:",
493
1049
  view.legacyCount,
@@ -502,619 +1058,767 @@ function LibrarySettings(props) {
502
1058
  }, "");
503
1059
  },
504
1060
  style: {
505
- ...buttonStyle,
1061
+ ...S.button,
506
1062
  alignSelf: "flex-start"
507
1063
  },
508
1064
  children: "清除旧条目"
509
1065
  })]
510
1066
  }),
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,
1067
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1068
+ style: S.band,
1069
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1070
+ style: S.bandStats,
519
1071
  children: [
520
1072
  /* @__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,
1073
+ style: S.bandStat,
598
1074
  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
- }
1075
+ style: S.bandValue,
1076
+ children: stats.total
1077
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1078
+ style: S.bandLabel,
1079
+ children: "个子代理"
619
1080
  })]
620
1081
  }),
621
1082
  /* @__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", {
1083
+ style: S.bandStat,
1084
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
740
1085
  style: {
741
- ...colStyle,
742
- flex: 1
1086
+ ...S.bandValue,
1087
+ color: SUCCESS
743
1088
  },
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
- })]
1089
+ children: stats.total - stats.off
1090
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1091
+ style: S.bandLabel,
1092
+ children: "已启用"
766
1093
  })]
767
1094
  }),
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
- })]
1095
+ stats.off > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1096
+ style: S.bandStat,
1097
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1098
+ style: S.bandValue,
1099
+ children: stats.off
1100
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1101
+ style: S.bandLabel,
1102
+ children: "已停用"
821
1103
  })]
822
1104
  }),
823
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
824
- style: rowStyle,
1105
+ dirtyIds.size > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1106
+ style: S.bandStat,
825
1107
  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
1108
+ style: {
1109
+ ...S.bandValue,
1110
+ color: DANGER
1111
+ },
1112
+ children: dirtyIds.size
1113
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1114
+ style: S.bandLabel,
1115
+ children: "未保存"
839
1116
  })]
840
1117
  })
841
1118
  ]
842
- }, id);
1119
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1120
+ style: S.bandDir,
1121
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1122
+ style: S.bandLabel,
1123
+ children: "名册目录"
1124
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1125
+ style: S.bandPath,
1126
+ title: view.dir || "~/.dsh/subagents",
1127
+ children: view.dir || "~/.dsh/subagents"
1128
+ })]
1129
+ })]
843
1130
  }),
844
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
845
- style: cardStyle,
1131
+ stats.total > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1132
+ style: S.bar,
846
1133
  children: [
847
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
848
- style: {
849
- display: "flex",
850
- alignItems: "center",
851
- gap: "10px"
852
- },
1134
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
1135
+ style: S.search,
853
1136
  children: [
854
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1137
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
1138
+ width: "12",
1139
+ height: "12",
1140
+ viewBox: "0 0 12 12",
1141
+ fill: "none",
1142
+ stroke: "currentColor",
1143
+ strokeWidth: "1.5",
1144
+ strokeLinecap: "round",
855
1145
  style: {
856
- fontSize: 13,
857
- fontWeight: 600
1146
+ color: "inherit",
1147
+ opacity: .6,
1148
+ flex: "none"
858
1149
  },
859
- children: "新增子代理"
1150
+ "aria-hidden": "true",
1151
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
1152
+ cx: "5",
1153
+ cy: "5",
1154
+ r: "3.4"
1155
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M7.6 7.6L10.5 10.5" })]
1156
+ }),
1157
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1158
+ value: filter,
1159
+ onChange: (event) => setFilter(event.target.value),
1160
+ placeholder: "筛选 id、描述、模型…",
1161
+ "aria-label": "筛选子代理",
1162
+ style: S.searchInput
860
1163
  }),
861
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: { flex: 1 } }),
862
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1164
+ filter !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
863
1165
  type: "button",
864
- disabled: busy,
865
- onClick: addEntry,
866
- style: primaryStyle,
867
- children: "添加"
1166
+ onClick: () => setFilter(""),
1167
+ title: "清除筛选",
1168
+ style: {
1169
+ ...S.ghost,
1170
+ padding: 0,
1171
+ fontSize: 13,
1172
+ lineHeight: 1
1173
+ },
1174
+ children: "×"
868
1175
  })
869
1176
  ]
870
1177
  }),
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
- })]
1178
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1179
+ type: "button",
1180
+ onClick: toggleAll,
1181
+ disabled: visibleIds.length === 0,
1182
+ style: S.button,
1183
+ children: allOpen ? "全部收起" : "全部展开"
885
1184
  }),
886
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
887
- style: rowStyle,
1185
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1186
+ type: "button",
1187
+ onClick: () => setAdding((current) => !current),
1188
+ style: adding ? S.button : S.primary,
1189
+ children: adding ? "取消新增" : "+ 新增子代理"
1190
+ })
1191
+ ]
1192
+ }),
1193
+ (adding || stats.total === 0) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1194
+ className: "dsh-library-card",
1195
+ style: {
1196
+ ...S.row,
1197
+ ...S.rowOpen
1198
+ },
1199
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1200
+ style: S.addHead,
1201
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1202
+ style: S.addIntro,
888
1203
  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
1204
  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
- })]
1205
+ ...S.id,
1206
+ color: ACCENT
1207
+ },
1208
+ children: "新增子代理"
1209
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1210
+ style: S.sub,
1211
+ children: "填写 ID 与角色描述,其余配置可稍后补充。"
942
1212
  })]
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
1213
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1214
+ type: "button",
1215
+ disabled: busy,
1216
+ onClick: addEntry,
1217
+ style: S.primary,
1218
+ children: "创建子代理"
1219
+ })]
1220
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1221
+ style: S.body,
1222
+ children: [
1223
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1224
+ className: "dsh-library-grid",
1225
+ style: S.grid,
1226
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1227
+ label: "ID",
1228
+ hint: "小写字母 / 数字 / 连字符",
1229
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1230
+ value: newId,
1231
+ onChange: (event) => setNewId(event.target.value),
1232
+ placeholder: "k3-reviewer",
1233
+ style: S.input
1234
+ })
1235
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1236
+ label: "模型",
1237
+ hint: "留空随默认路由",
1238
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1239
+ value: newEntry.model ?? "",
1240
+ onChange: (event) => setNewEntry({
1241
+ ...newEntry,
1242
+ model: event.target.value
1243
+ }),
1244
+ placeholder: "k3-256k",
1245
+ style: S.input
1246
+ })
963
1247
  })]
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 ?? "",
1248
+ }),
1249
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1250
+ label: "描述(模型可见)",
1251
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
1252
+ value: newEntry.description ?? "",
973
1253
  onChange: (event) => setNewEntry({
974
1254
  ...newEntry,
975
- maxTokens: event.target.value === "" ? void 0 : Number(event.target.value)
1255
+ description: event.target.value
976
1256
  }),
977
- placeholder: "tokens(可选)",
1257
+ placeholder: "一句话说明这个角色做什么——模型靠它选人",
1258
+ rows: 1,
978
1259
  style: {
979
- ...inputStyle,
980
- flex: "none",
981
- width: 116
1260
+ ...S.prose,
1261
+ overflow: "auto"
982
1262
  }
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)
1263
+ })
1264
+ }),
1265
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1266
+ className: "dsh-library-grid",
1267
+ style: S.grid,
1268
+ children: [
1269
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1270
+ label: "Provider",
1271
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1272
+ value: newEntry.provider ?? "",
1273
+ onChange: (event) => setNewEntry({
1274
+ ...newEntry,
1275
+ provider: event.target.value
1276
+ }),
1277
+ placeholder: "kimi-coding",
1278
+ style: S.input
1279
+ })
1004
1280
  }),
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()
1281
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1282
+ label: "传输层",
1283
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1284
+ value: newEntry.subagentProvider ?? "",
1285
+ onChange: (event) => setNewEntry({
1286
+ ...newEntry,
1287
+ subagentProvider: event.target.value
1288
+ }),
1289
+ placeholder: "spawn(默认)",
1290
+ style: S.input
1291
+ })
1292
+ }),
1293
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1294
+ label: "后台模式",
1295
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
1296
+ value: newEntry.backgroundMode ?? "one-shot",
1297
+ onChange: (event) => setNewEntry({
1298
+ ...newEntry,
1299
+ backgroundMode: event.target.value
1300
+ }),
1301
+ style: S.input,
1302
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
1303
+ value: "one-shot",
1304
+ children: "one-shot"
1305
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
1306
+ value: "continuable",
1307
+ children: "continuable"
1308
+ })]
1309
+ })
1310
+ }),
1311
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1312
+ label: "深度上限",
1313
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1314
+ type: "number",
1315
+ min: 1,
1316
+ value: newEntry.maxDepth ?? "",
1317
+ onChange: (event) => setNewEntry({
1318
+ ...newEntry,
1319
+ maxDepth: event.target.value === "" ? void 0 : Number(event.target.value)
1320
+ }),
1321
+ style: S.input
1322
+ })
1056
1323
  }),
1057
- placeholder: "如 max / high / medium / low(留空随父会话默认)",
1058
- style: inputStyle
1324
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1325
+ label: "输出上限",
1326
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1327
+ type: "number",
1328
+ min: 1,
1329
+ value: newEntry.maxTokens ?? "",
1330
+ onChange: (event) => setNewEntry({
1331
+ ...newEntry,
1332
+ maxTokens: event.target.value === "" ? void 0 : Number(event.target.value)
1333
+ }),
1334
+ placeholder: "tokens",
1335
+ style: S.input
1336
+ })
1337
+ })
1338
+ ]
1339
+ }),
1340
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1341
+ className: "dsh-library-grid",
1342
+ style: S.grid,
1343
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1344
+ label: "思考强度",
1345
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1346
+ value: newEntry.reasoningEffort ?? "",
1347
+ onChange: (event) => setNewEntry({
1348
+ ...newEntry,
1349
+ reasoningEffort: event.target.value === "" ? void 0 : event.target.value.trim()
1350
+ }),
1351
+ placeholder: "max / high / medium / low(留空随父会话默认)",
1352
+ style: S.input
1353
+ })
1354
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1355
+ label: "禁用工具",
1356
+ hint: "英文逗号分隔;写入时只增删 deny,不触碰手写的 allow",
1357
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1358
+ value: listToText(newEntry.toolFilter?.deny),
1359
+ onChange: (event) => {
1360
+ const deny = parseList(event.target.value);
1361
+ const allow = newEntry.toolFilter?.allow;
1362
+ const keepAllow = allow !== void 0 && allow.length > 0;
1363
+ setNewEntry({
1364
+ ...newEntry,
1365
+ toolFilter: keepAllow || deny.length > 0 ? {
1366
+ ...keepAllow ? { allow } : {},
1367
+ ...deny.length > 0 ? { deny } : {}
1368
+ } : void 0
1369
+ });
1370
+ },
1371
+ placeholder: "write, edit, todo_write, …",
1372
+ style: S.input
1373
+ })
1059
1374
  })]
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",
1375
+ }),
1376
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1377
+ label: "角色提示词(可选)",
1378
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AutoTextarea, {
1379
+ value: newEntry.persona ?? "",
1067
1380
  onChange: (event) => setNewEntry({
1068
1381
  ...newEntry,
1069
- backgroundMode: event.target.value
1382
+ persona: event.target.value
1070
1383
  }),
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"
1384
+ placeholder: "子代理的系统提示词",
1385
+ style: S.prose
1386
+ })
1387
+ })
1388
+ ]
1389
+ })]
1390
+ }),
1391
+ stats.total === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1392
+ style: S.empty,
1393
+ children: [
1394
+ "库为空。在上方填一个 id 与描述即可创建第一个条目,",
1395
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("br", {}),
1396
+ "或直接在名册目录放一个 ",
1397
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: "<id>.yaml" }),
1398
+ "。"
1399
+ ]
1400
+ }),
1401
+ stats.total > 0 && visibleIds.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1402
+ style: S.empty,
1403
+ children: [
1404
+ "没有匹配「",
1405
+ filter,
1406
+ "」的条目。"
1407
+ ]
1408
+ }),
1409
+ visibleIds.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1410
+ style: S.listCaption,
1411
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: needle === "" ? "角色名册" : `匹配 ${visibleIds.length} / ${stats.total} 个子代理` }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "点击名称展开配置" })]
1412
+ }),
1413
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1414
+ style: S.list,
1415
+ children: visibleIds.map((id) => {
1416
+ const entry = entries[id];
1417
+ const isOpen = open[id] === true;
1418
+ const dirty = dirtyIds.has(id);
1419
+ const off = entry.enabled === false;
1420
+ const model = entry.model || "";
1421
+ const provider = entry.provider || "";
1422
+ const route = provider !== "" && model !== "" ? `${provider}/${model}` : model !== "" ? model : provider !== "" ? provider : "默认路由";
1423
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1424
+ className: "dsh-library-card",
1425
+ "data-entry-id": id,
1426
+ style: {
1427
+ ...S.row,
1428
+ ...isOpen ? S.rowOpen : null,
1429
+ ...off ? S.rowOff : null
1430
+ },
1431
+ children: [
1432
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1433
+ style: S.head,
1434
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1435
+ type: "button",
1436
+ className: "dsh-library-disclosure",
1437
+ style: S.disclosure,
1438
+ "aria-expanded": isOpen,
1439
+ "aria-controls": `${sectionId}-${id}`,
1440
+ "aria-label": `${isOpen ? "收起" : "展开"} ${id} 的配置`,
1441
+ "data-row-id": id,
1442
+ onClick: () => setOpen((current) => ({
1443
+ ...current,
1444
+ [id]: !isOpen
1445
+ })),
1446
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chevron, { open: isOpen }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1447
+ style: S.titleRow,
1448
+ children: [
1449
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1450
+ style: S.id,
1451
+ children: id
1452
+ }),
1453
+ entry.source === "legacy" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1454
+ style: S.chip,
1455
+ children: "旧版条目"
1456
+ }),
1457
+ dirty && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1458
+ style: S.dirtyChip,
1459
+ children: "未保存"
1460
+ })
1461
+ ]
1462
+ })]
1463
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
1464
+ style: S.headToggle,
1465
+ title: "切换后需保存此条目才会生效",
1466
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1467
+ className: "dsh-library-switch",
1468
+ type: "checkbox",
1469
+ role: "switch",
1470
+ "aria-label": `启用 ${id}`,
1471
+ checked: !off,
1472
+ onChange: (event) => patch(id, { enabled: event.target.checked ? void 0 : false })
1473
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: off ? "已停用" : "已启用" })]
1082
1474
  })]
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
1475
  }),
1097
- placeholder: "子代理的系统提示词(可选)",
1098
- style: textareaStyle
1099
- })]
1100
- })
1101
- ]
1476
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1477
+ style: S.overview,
1478
+ children: [
1479
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1480
+ style: S.excerpt,
1481
+ title: entry.description ?? "",
1482
+ children: entry.description || "暂无角色描述"
1483
+ }),
1484
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1485
+ style: S.route,
1486
+ title: `路由:${route}`,
1487
+ children: [
1488
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1489
+ style: S.metaLabel,
1490
+ children: "模型"
1491
+ }),
1492
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1493
+ style: S.model,
1494
+ children: model || "跟随默认模型"
1495
+ }),
1496
+ provider !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1497
+ style: S.provider,
1498
+ children: provider
1499
+ })
1500
+ ]
1501
+ }),
1502
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1503
+ style: S.glyphs,
1504
+ children: [
1505
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1506
+ style: entry.backgroundMode === "continuable" ? S.modeChip : S.glyph,
1507
+ children: entry.backgroundMode === "continuable" ? "可续聊" : "单次任务"
1508
+ }),
1509
+ entry.reasoningEffort && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1510
+ style: S.glyph,
1511
+ children: ["思考 ", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1512
+ style: S.metaValue,
1513
+ children: entry.reasoningEffort
1514
+ })]
1515
+ }),
1516
+ entry.maxDepth !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1517
+ style: S.glyph,
1518
+ children: ["深度 ", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1519
+ style: S.metaValue,
1520
+ children: entry.maxDepth
1521
+ })]
1522
+ }),
1523
+ entry.maxTokens !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1524
+ style: S.glyph,
1525
+ children: [
1526
+ "输出 ",
1527
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1528
+ style: S.metaValue,
1529
+ children: entry.maxTokens.toLocaleString("en-US")
1530
+ }),
1531
+ " tokens"
1532
+ ]
1533
+ }),
1534
+ entry.persona && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1535
+ style: S.glyph,
1536
+ children: "角色提示词"
1537
+ }),
1538
+ (entry.toolFilter?.deny?.length ?? 0) > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1539
+ style: S.glyph,
1540
+ children: [
1541
+ "禁用 ",
1542
+ entry.toolFilter.deny.length,
1543
+ " 项工具"
1544
+ ]
1545
+ }),
1546
+ (entry.toolFilter?.allow?.length ?? 0) > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1547
+ style: S.glyph,
1548
+ children: [
1549
+ "允许 ",
1550
+ entry.toolFilter.allow.length,
1551
+ " 项工具"
1552
+ ]
1553
+ })
1554
+ ]
1555
+ })
1556
+ ]
1557
+ }),
1558
+ dirty && !isOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1559
+ style: S.draftActions,
1560
+ children: [
1561
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1562
+ style: S.hint,
1563
+ children: "保存后生效"
1564
+ }),
1565
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: S.spacer }),
1566
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1567
+ type: "button",
1568
+ disabled: busy,
1569
+ onClick: (event) => {
1570
+ focusDisclosure(event);
1571
+ revertEntry(id);
1572
+ },
1573
+ style: S.ghost,
1574
+ children: "还原"
1575
+ }),
1576
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1577
+ type: "button",
1578
+ disabled: busy,
1579
+ onClick: (event) => {
1580
+ focusDisclosure(event);
1581
+ updateEntry(id, entry);
1582
+ },
1583
+ style: S.primary,
1584
+ children: "保存修改"
1585
+ })
1586
+ ]
1587
+ }),
1588
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1589
+ id: `${sectionId}-${id}`,
1590
+ hidden: !isOpen,
1591
+ children: isOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1592
+ style: S.body,
1593
+ children: [
1594
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1595
+ style: S.group,
1596
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1597
+ style: S.groupTitle,
1598
+ children: "概述"
1599
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1600
+ label: "描述(模型可见)",
1601
+ hint: "模型用 list_subagents 读到的就是这句话,写清角色与适用场景",
1602
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
1603
+ value: entry.description ?? "",
1604
+ onChange: (event) => patch(id, { description: event.target.value }),
1605
+ placeholder: "角色描述",
1606
+ rows: 1,
1607
+ style: {
1608
+ ...S.prose,
1609
+ overflow: "auto"
1610
+ }
1611
+ })
1612
+ })]
1613
+ }),
1614
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1615
+ style: S.group,
1616
+ children: [
1617
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1618
+ style: S.groupTitle,
1619
+ children: "路由与执行"
1620
+ }),
1621
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1622
+ className: "dsh-library-grid",
1623
+ style: S.grid,
1624
+ children: [
1625
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1626
+ label: "Provider",
1627
+ hint: entry.routeNote === "foreign-ignored" ? "共享名册里的路由当前 profile 没有,调用会改用本会话模型。留空保存不会改掉共享路由。" : entry.routeNote === "profile" ? `只保存在 profile ${view.profile ?? ""}` : entry.routeNote === "inherit" ? "本 profile 固定使用会话模型,不跟随共享名册路由" : entry.routeNote === "profile-missing" ? "这个 profile 保存的 Provider 未注册" : void 0,
1628
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1629
+ value: entry.provider ?? "",
1630
+ onChange: (event) => patch(id, { provider: event.target.value }),
1631
+ placeholder: "deepseek-official / kimi-coding",
1632
+ style: S.input
1633
+ })
1634
+ }),
1635
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1636
+ label: "模型",
1637
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1638
+ value: entry.model ?? "",
1639
+ onChange: (event) => patch(id, { model: event.target.value }),
1640
+ placeholder: "k3-256k",
1641
+ style: S.input
1642
+ })
1643
+ }),
1644
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1645
+ label: "传输层",
1646
+ hint: "留空用 spawn",
1647
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1648
+ value: entry.subagentProvider ?? "",
1649
+ onChange: (event) => patch(id, { subagentProvider: event.target.value }),
1650
+ placeholder: "spawn(默认)",
1651
+ style: S.input
1652
+ })
1653
+ }),
1654
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1655
+ label: "后台模式",
1656
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
1657
+ value: entry.backgroundMode ?? "one-shot",
1658
+ onChange: (event) => patch(id, { backgroundMode: event.target.value }),
1659
+ style: S.input,
1660
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
1661
+ value: "one-shot",
1662
+ children: "one-shot"
1663
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
1664
+ value: "continuable",
1665
+ children: "continuable"
1666
+ })]
1667
+ })
1668
+ })
1669
+ ]
1670
+ }),
1671
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1672
+ className: "dsh-library-grid",
1673
+ style: S.grid,
1674
+ children: [
1675
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1676
+ label: "思考强度",
1677
+ hint: "留空随父会话默认",
1678
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1679
+ value: entry.reasoningEffort ?? "",
1680
+ onChange: (event) => patch(id, { reasoningEffort: event.target.value === "" ? void 0 : event.target.value.trim() }),
1681
+ placeholder: "max / high / medium / low",
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.maxDepth ?? "",
1691
+ onChange: (event) => patch(id, { maxDepth: event.target.value === "" ? void 0 : Number(event.target.value) }),
1692
+ style: S.input
1693
+ })
1694
+ }),
1695
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1696
+ label: "输出上限",
1697
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1698
+ type: "number",
1699
+ min: 1,
1700
+ value: entry.maxTokens ?? "",
1701
+ onChange: (event) => patch(id, { maxTokens: event.target.value === "" ? void 0 : Number(event.target.value) }),
1702
+ placeholder: "tokens",
1703
+ style: S.input
1704
+ })
1705
+ })
1706
+ ]
1707
+ })
1708
+ ]
1709
+ }),
1710
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1711
+ style: S.group,
1712
+ children: [
1713
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1714
+ style: S.groupTitle,
1715
+ children: "工具与提示词"
1716
+ }),
1717
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1718
+ label: "禁用工具",
1719
+ hint: "英文逗号分隔;留空表示不限制。手写的 allow 列表会原样保留",
1720
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1721
+ value: listToText(entry.toolFilter?.deny),
1722
+ onChange: (event) => setDeny(id, event.target.value),
1723
+ placeholder: "write, edit, todo_write, …",
1724
+ style: S.input
1725
+ })
1726
+ }),
1727
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
1728
+ label: "角色提示词(可选)",
1729
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AutoTextarea, {
1730
+ value: entry.persona ?? "",
1731
+ onChange: (event) => patch(id, { persona: event.target.value }),
1732
+ placeholder: "子代理的系统提示词",
1733
+ style: S.prose
1734
+ })
1735
+ })
1736
+ ]
1737
+ }),
1738
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1739
+ style: S.actions,
1740
+ children: [
1741
+ dirty ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1742
+ style: {
1743
+ ...S.hint,
1744
+ color: DANGER
1745
+ },
1746
+ children: "此条目有未保存修改"
1747
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1748
+ style: S.hint,
1749
+ children: entry.source === "legacy" ? "来自 settings.yaml 的迁移副本" : "与名册文件一致"
1750
+ }),
1751
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: S.spacer }),
1752
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1753
+ type: "button",
1754
+ disabled: busy || !dirty,
1755
+ onClick: () => revertEntry(id),
1756
+ style: {
1757
+ ...S.ghost,
1758
+ opacity: busy || !dirty ? .45 : 1
1759
+ },
1760
+ title: "丢弃本行的未保存修改,恢复为服务器当前值",
1761
+ children: "还原"
1762
+ }),
1763
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1764
+ type: "button",
1765
+ disabled: busy,
1766
+ onClick: () => removeEntry(id),
1767
+ style: {
1768
+ ...S.danger,
1769
+ opacity: busy ? .55 : 1
1770
+ },
1771
+ children: "删除"
1772
+ }),
1773
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1774
+ type: "button",
1775
+ disabled: busy || !dirty,
1776
+ onClick: () => updateEntry(id, entry),
1777
+ style: {
1778
+ ...S.primary,
1779
+ opacity: busy || !dirty ? .5 : 1
1780
+ },
1781
+ children: "保存"
1782
+ })
1783
+ ]
1784
+ })
1785
+ ]
1786
+ })
1787
+ })
1788
+ ]
1789
+ }, id);
1790
+ })
1102
1791
  }),
1103
1792
  status !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1104
- style: status.kind === "ok" ? okBannerStyle : errorBannerStyle,
1793
+ role: "status",
1794
+ "aria-live": "polite",
1795
+ style: status.kind === "ok" ? BANNER.ok : BANNER.error,
1105
1796
  children: status.text
1106
1797
  }),
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
- ]
1798
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", {
1799
+ style: S.footer,
1800
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("summary", {
1801
+ style: S.footerSummary,
1802
+ children: "存储与备份说明"
1803
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1804
+ style: S.hint,
1805
+ children: [
1806
+ "配置存储于名册目录 ",
1807
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
1808
+ style: { fontFamily: MONO },
1809
+ children: view.dir || "~/.dsh/subagents"
1810
+ }),
1811
+ "(每具名子代理一个 ",
1812
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: "<id>.yaml" }),
1813
+ ",可手编、热生效;",
1814
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: "_" }),
1815
+ " 前缀的文件/目录为非名册内容,如 ",
1816
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: "_backups/" }),
1817
+ " 备份区)。 让 agent 修改条目前,建议先把原文件复制到 ",
1818
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: "_backups/" }),
1819
+ " 里。 settings.yaml 中的旧 entries 仅作迁移兜底读取,文件优先生效。"
1820
+ ]
1821
+ })]
1118
1822
  })
1119
1823
  ]
1120
1824
  });
@@ -1138,10 +1842,10 @@ function decorateSettingsNavIcon(ctx) {
1138
1842
  ctx.effect(() => {
1139
1843
  const decorate = () => {
1140
1844
  if (document.querySelector("[role=\"dialog\"]") === null) return;
1141
- for (const button of Array.from(document.querySelectorAll("button"))) {
1142
- const label = button.querySelector(":scope > span");
1845
+ for (const button$1 of Array.from(document.querySelectorAll("button"))) {
1846
+ const label = button$1.querySelector(":scope > span");
1143
1847
  if (label === null || !NAV_LABELS.has(label.textContent ?? "")) continue;
1144
- const existing = button.firstElementChild;
1848
+ const existing = button$1.firstElementChild;
1145
1849
  if (existing instanceof SVGElement) {
1146
1850
  if (existing.dataset.navIcon === "1") continue;
1147
1851
  const template = document.createElement("template");
@@ -1223,7 +1927,8 @@ const ERROR_TEXT = {
1223
1927
  "invalid-id": "条目 ID 非法。",
1224
1928
  "unknown-op": "未知操作。",
1225
1929
  "roster-unreadable": "名册目录读取失败。",
1226
- "write-failed": "名册文件写入失败。"
1930
+ "write-failed": "名册文件写入失败。",
1931
+ "profile-path": "当前 profile 名称不能保存独立模型路由。"
1227
1932
  };
1228
1933
  /** Map a wire view onto the UI model. Exported for the wire-contract tests —
1229
1934
  * a dropped field here silently kills UI features (k3 review: legacyCount). */
@@ -1233,7 +1938,8 @@ const parseView = (value) => ({
1233
1938
  hash: value.hash ?? "",
1234
1939
  entries: value.entries ?? {},
1235
1940
  diagnostics: value.diagnostics ?? [],
1236
- legacyCount: value.legacyCount ?? 0
1941
+ legacyCount: value.legacyCount ?? 0,
1942
+ ...typeof value.profile === "string" && value.profile !== "" ? { profile: value.profile } : {}
1237
1943
  });
1238
1944
  async function readView() {
1239
1945
  const response = await fetch(API_PATH, { cache: "no-store" });