dsh-wecom-bot 0.5.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.js CHANGED
@@ -4,9 +4,11 @@ window.__ModuleLoader__.load({
4
4
  var module = { exports: {} };
5
5
  var exports = module.exports;
6
6
  "use strict";
7
+ var __create = Object.create;
7
8
  var __defProp = Object.defineProperty;
8
9
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
10
  var __getOwnPropNames = Object.getOwnPropertyNames;
11
+ var __getProtoOf = Object.getPrototypeOf;
10
12
  var __hasOwnProp = Object.prototype.hasOwnProperty;
11
13
  var __export = (target, all) => {
12
14
  for (var name in all)
@@ -20,6 +22,14 @@ window.__ModuleLoader__.load({
20
22
  }
21
23
  return to;
22
24
  };
25
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
26
+ // If the importer is in node compatibility mode or this is not an ESM
27
+ // file that has been converted to a CommonJS file using a Babel-
28
+ // compatible transform (i.e. "__esModule" has not been set), then set
29
+ // "default" to the CommonJS "module.exports" for node compatibility.
30
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
31
+ mod
32
+ ));
23
33
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
34
 
25
35
  // src/client/index.tsx
@@ -41,7 +51,7 @@ window.__ModuleLoader__.load({
41
51
  var DEFAULT_LOG_RETENTION_DAYS = 14;
42
52
 
43
53
  // src/client/components/SettingsPage.tsx
44
- var import_react8 = require("react");
54
+ var import_react9 = require("react");
45
55
 
46
56
  // src/client/hooks.ts
47
57
  var import_react = require("react");
@@ -206,10 +216,10 @@ window.__ModuleLoader__.load({
206
216
  return choice?.efforts?.find((item) => item.id === effort)?.name ?? effort;
207
217
  }
208
218
  var BUILT_IN_PRESET_NAME = {
209
- standard: "标准",
210
- ptc: "PTC",
211
- minimal: "极简",
212
- cordis: "Cordis"
219
+ standard: "标准模式",
220
+ ptc: "PTC 模式",
221
+ minimal: "极简模式",
222
+ cordis: "创造模式"
213
223
  };
214
224
  function presetName(preset) {
215
225
  return preset.name || BUILT_IN_PRESET_NAME[preset.id] || preset.id;
@@ -227,6 +237,11 @@ window.__ModuleLoader__.load({
227
237
  const fallback = presets?.presets.find((preset) => preset.isDefault);
228
238
  return fallback ? `${presetName(fallback)}(DSH 默认)` : "DSH 默认";
229
239
  }
240
+ function contextLevel(context) {
241
+ if (!context?.window) return void 0;
242
+ const ratio = context.used / context.window;
243
+ return ratio >= 0.9 ? "high" : ratio >= 0.7 ? "warn" : "ok";
244
+ }
230
245
  function formatTokens(value) {
231
246
  if (value < 1e3) return String(Math.round(value));
232
247
  if (value < 1e5) return `${(value / 1e3).toFixed(1)}k`;
@@ -244,6 +259,7 @@ window.__ModuleLoader__.load({
244
259
  if (!value) return "跟随 DSH 默认模型";
245
260
  return `跟随 DSH 默认模型(${modelName(catalog, value)})`;
246
261
  }
262
+ var BINDING_KIND_LABEL = { user: "个人(单聊)", group: "群聊" };
247
263
  var SESSION_STATE_LABEL = {
248
264
  bound: "已绑定",
249
265
  auto: "待创建",
@@ -252,6 +268,26 @@ window.__ModuleLoader__.load({
252
268
  archived: "会话已归档",
253
269
  unusable: "会话不可用"
254
270
  };
271
+ function sessionActivity(member) {
272
+ if (member.sessionRunning) return "运行中";
273
+ return member.sessionState === "blank" ? "待使用" : "空闲";
274
+ }
275
+ function groupFacts(group, catalog, presets) {
276
+ const effort = group.reasoningEffort ? effortLabel(catalog, {
277
+ provider: group.effectiveProvider,
278
+ model: group.effectiveModel,
279
+ reasoningEffort: group.reasoningEffort
280
+ }) || group.reasoningEffort : "默认";
281
+ return [
282
+ { key: "workspace", label: "工作区", value: group.workspaceTitle, title: group.workspacePath },
283
+ { key: "model", label: "模型", value: groupModelSummary(catalog, group) },
284
+ { key: "effort", label: "推理等级", value: effort },
285
+ { key: "preset", label: "Agent 预设", value: presetSummaryLabel(presets, group.preset) }
286
+ ];
287
+ }
288
+ function scopeSummary(stored, total) {
289
+ return stored.length === 0 ? "全部工作区" : `${stored.length} / ${Math.max(total, stored.length)} 个工作区`;
290
+ }
255
291
  function personKey(kind, id) {
256
292
  return `${kind}:${id}`;
257
293
  }
@@ -464,235 +500,298 @@ window.__ModuleLoader__.load({
464
500
  return { saving, error, saved, save };
465
501
  }
466
502
 
467
- // src/client/components/AdminCard.tsx
503
+ // src/client/components/AdminSection.tsx
468
504
  var import_react3 = require("react");
469
505
  var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
470
506
 
507
+ // src/client/components/icons.tsx
508
+ var primitives = __toESM(require("@deepseek-ai/dsh-client-ui-primitives"), 1);
509
+ var import_jsx_runtime = require("react/jsx-runtime");
510
+ function icon(name) {
511
+ function Icon(props) {
512
+ const Component = primitives[name];
513
+ return Component ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ...props }) : null;
514
+ }
515
+ Icon.displayName = name;
516
+ return Icon;
517
+ }
518
+ var IconChevronRight = icon("IconChevronRightOutlineRegular");
519
+ var IconPlus = icon("IconPlusOutlineRegular");
520
+ var IconRefresh = icon("IconRefreshOutlineRegular");
521
+ var IconTrash = icon("IconTrashOutlineRegular");
522
+ var IconArchive = icon("IconArchiveOutlineRegular");
523
+ var IconCopy = icon("IconCopyOutlineRegular");
524
+ var IconCheck = icon("IconCheckOutlineRegular");
525
+ var IconUser = icon("IconUserOutlineRegular");
526
+ var IconUsers = icon("IconUsersOutlineRegular");
527
+ var IconWarning = icon("IconWarningTriangleOutlineRegular");
528
+ var IconOpen = icon("IconRightUpOutlineRegular");
529
+
471
530
  // src/client/components/ui.tsx
472
531
  var import_react2 = require("react");
473
532
  var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
474
- var import_jsx_runtime = require("react/jsx-runtime");
475
- function Select({ className, ...rest }) {
476
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("select", { ...rest, className: ["wcb-select", className].filter(Boolean).join(" ") });
477
- }
478
- function Card(props) {
479
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "wcb-card", children: [
480
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CardHead, { ...props }),
481
- props.children
533
+ var import_jsx_runtime2 = require("react/jsx-runtime");
534
+ function Section({ id, title, count, description, actions, children }) {
535
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "wcb-section", "data-section": id, children: [
536
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "wcb-section-head", children: [
537
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h4", { className: "wcb-section-title", children: title }),
538
+ count !== void 0 && count !== "" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "wcb-section-count", children: count }),
539
+ actions && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "wcb-section-actions", children: actions })
540
+ ] }),
541
+ description && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "wcb-section-desc", children: description }),
542
+ children
482
543
  ] });
483
544
  }
484
- function CardHead({ step, title, description, aside }) {
485
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "wcb-card-head", children: [
486
- step !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "wcb-step", children: step }),
487
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "wcb-card-titles", children: [
488
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "wcb-card-title", children: title }),
489
- description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "wcb-card-desc", children: description })
490
- ] }),
491
- aside && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "wcb-card-aside", children: aside })
545
+ function Notice({ tone, children }) {
546
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { className: "wcb-notice", "data-tone": tone ?? "warning", role: "status", children: [
547
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "wcb-notice-icon", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(IconWarning, { size: 14 }) }),
548
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children })
492
549
  ] });
493
550
  }
494
- function Collapse({ open, onToggle, title, summary, facts, actions, children, className }) {
495
- const hasFacts = Boolean(facts?.length);
496
- const showFacts = hasFacts && !open;
497
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: ["wcb-group", className].filter(Boolean).join(" "), "data-open": open ? "" : void 0, "data-facts": showFacts ? "" : void 0, children: [
498
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "wcb-group-head", children: [
499
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { type: "button", className: "wcb-group-toggle", "aria-expanded": open, onClick: onToggle, children: [
500
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "wcb-group-title-line", children: [
501
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "wcb-chevron", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconChevronRightOutlineRegular, { size: 14 }) }),
502
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "wcb-group-title", children: title })
503
- ] }),
504
- summary && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "wcb-group-summary", children: summary }),
505
- showFacts && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "wcb-group-facts", children: facts.map((fact) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "wcb-group-fact", children: [
506
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "wcb-group-fact-label", children: fact.label }),
507
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "wcb-group-fact-value", title: fact.title, children: fact.value })
508
- ] }, fact.key)) })
509
- ] }),
510
- actions && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "wcb-group-actions", children: actions })
511
- ] }),
512
- open && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "wcb-group-body", children })
551
+ function Select({ className, compact, ...rest }) {
552
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("select", { ...rest, "data-compact": compact ? "" : void 0, className: ["wcb-select", className].filter(Boolean).join(" ") });
553
+ }
554
+ function Field({ label, hint, error, children }) {
555
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "wcb-field", "data-invalid": error ? "" : void 0, children: [
556
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "wcb-field-label", children: label }),
557
+ children,
558
+ error ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "wcb-error", role: "alert", children: error }) : hint && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "wcb-hint", children: hint })
513
559
  ] });
514
560
  }
515
- function Field({ label, required, hint, error, children }) {
516
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "wcb-field", "data-invalid": error ? "" : void 0, children: [
517
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "wcb-field-label", children: [
518
- label,
519
- required && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "wcb-required", "aria-label": "必填", children: "*" })
520
- ] }),
521
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "wcb-field-control", children: [
522
- children,
523
- error ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "wcb-field-error", role: "alert", children: error }) : hint && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "wcb-hint", children: hint })
524
- ] })
561
+ function Editor({ children }) {
562
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "wcb-editor", children });
563
+ }
564
+ function FormFooter({ message, tone, start, children }) {
565
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "wcb-footer", children: [
566
+ start,
567
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "wcb-footer-message", "data-tone": tone, role: "status", children: message }),
568
+ children
525
569
  ] });
526
570
  }
527
- function CheckRow({ checked, onToggle, label, children, meta, disabled }) {
528
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "wcb-row", "data-selected": checked ? "" : void 0, children: [
529
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
530
- "input",
531
- {
532
- type: "checkbox",
533
- className: "wcb-check",
534
- checked,
535
- disabled,
536
- "aria-label": label,
537
- onChange: (event) => onToggle(event.target.checked)
538
- }
539
- ),
540
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "wcb-row-main", children }),
541
- meta && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "wcb-row-meta", children: meta })
571
+ function Facts({ facts, className }) {
572
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: ["wcb-kvs", className].filter(Boolean).join(" "), children: facts.map((fact) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "wcb-kv", "data-fact": fact.key, children: [
573
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "wcb-kv-label", children: fact.label }),
574
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "wcb-kv-value", title: fact.title, children: fact.value })
575
+ ] }, fact.key)) });
576
+ }
577
+ function KindAvatar({ kind }) {
578
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "wcb-avatar", "data-kind": kind, "aria-hidden": "true", children: kind === "group" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(IconUsers, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(IconUser, { size: 14 }) });
579
+ }
580
+ function PersonButton({ kind, name, label, disabled, onClick }) {
581
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("button", { type: "button", className: "wcb-person", "aria-label": label, title: name, disabled, onClick, children: [
582
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(KindAvatar, { kind }),
583
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "wcb-person-name", children: name }),
584
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "wcb-person-chevron", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(IconChevronRight, { size: 12 }) })
542
585
  ] });
543
586
  }
544
- function KindBadge({ kind, plain }) {
545
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "wcb-avatar", "data-kind": kind, "data-plain": plain ? "" : void 0, "aria-hidden": "true", children: kind === "group" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconUsersOutlineRegular, { size: 15 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconUserOutlineRegular, { size: 15 }) });
587
+ function ContextMeter({ context }) {
588
+ if (!context) return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "wcb-muted", children: "—" });
589
+ const level = contextLevel(context);
590
+ if (!context.window || !level) return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "wcb-meter-text", children: formatTokens(context.used) });
591
+ const percent = Math.min(100, Math.round(context.used / context.window * 100));
592
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "wcb-meter", "data-level": level, title: `上下文 ${contextLabel(context)}`, children: [
593
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "wcb-meter-track", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "wcb-meter-fill", style: { width: `${percent}%` } }) }),
594
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "wcb-meter-text", children: [
595
+ formatTokens(context.used),
596
+ " / ",
597
+ formatTokens(context.window)
598
+ ] })
599
+ ] });
546
600
  }
547
- function PersonAvatar({ kind, label, disabled, onClick }) {
548
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
601
+ function CopyButton({ text: text2, label }) {
602
+ const [copied, setCopied] = (0, import_react2.useState)(false);
603
+ const timer = (0, import_react2.useRef)();
604
+ (0, import_react2.useEffect)(() => () => {
605
+ if (timer.current) clearTimeout(timer.current);
606
+ }, []);
607
+ const copy = async () => {
608
+ if (!await (0, import_dsh_client_ui_primitives.writeClipboard)(text2)) return;
609
+ setCopied(true);
610
+ if (timer.current) clearTimeout(timer.current);
611
+ timer.current = setTimeout(() => setCopied(false), 1500);
612
+ };
613
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
549
614
  "button",
550
615
  {
551
616
  type: "button",
552
- className: "wcb-avatar",
553
- "data-kind": kind,
554
- "data-button": "",
555
- "aria-label": label,
556
- title: "查看详情、编辑备注",
557
- disabled,
558
- onClick,
559
- children: [
560
- kind === "group" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconUsersOutlineRegular, { size: 15 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconUserOutlineRegular, { size: 15 }),
561
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "wcb-avatar-pencil", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconEditOutlineRegular, { size: 9 }) })
562
- ]
617
+ className: "wcb-icon-button",
618
+ "aria-label": copied ? "已复制" : label,
619
+ title: copied ? "已复制" : label,
620
+ onClick: () => {
621
+ void copy();
622
+ },
623
+ children: copied ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(IconCheck, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(IconCopy, { size: 14 })
563
624
  }
564
625
  );
565
626
  }
566
- function PersonRow({ kind, title, meta, label, disabled, onOpen }) {
567
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "wcb-person-head", children: [
568
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PersonAvatar, { kind, label, disabled, onClick: onOpen }),
569
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "wcb-row-title", title: typeof title === "string" ? title : void 0, children: title }),
570
- meta && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "wcb-person-meta", children: meta })
627
+ function Dialog({ open, onClose, title, children, footer }) {
628
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.Modal, { open, onClose, title, closeLabel: "关闭", className: "wcb-dialog", footer, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "wcb-dialog-body", children }) });
629
+ }
630
+ function FactRow({ label, mono, children }) {
631
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
632
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dt", { children: label }),
633
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dd", { className: mono ? "wcb-mono" : void 0, children })
571
634
  ] });
572
635
  }
573
- function Fact({ name, children, mono }) {
574
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "wcb-fact", children: [
575
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "wcb-fact-key", children: name }),
576
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: ["wcb-fact-value", mono ? "wcb-mono" : ""].filter(Boolean).join(" "), children })
636
+ function PersonDialog({
637
+ open,
638
+ onClose,
639
+ title,
640
+ kind,
641
+ typeLabel,
642
+ id,
643
+ note,
644
+ noteLabel,
645
+ disabled,
646
+ onNote,
647
+ children,
648
+ hint,
649
+ error,
650
+ footer
651
+ }) {
652
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Dialog, { open, onClose, title, footer, children: [
653
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("dl", { className: "wcb-facts", children: [
654
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FactRow, { label: "类型", children: typeLabel ?? BINDING_KIND_LABEL[kind] }),
655
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(FactRow, { label: "企业微信 ID", mono: true, children: [
656
+ id,
657
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CopyButton, { text: id, label: "复制企业微信 ID" })
658
+ ] }),
659
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FactRow, { label: "备注", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
660
+ import_dsh_client_ui_primitives.Input,
661
+ {
662
+ className: "wcb-input",
663
+ defaultValue: note,
664
+ placeholder: id,
665
+ disabled,
666
+ "aria-label": noteLabel,
667
+ onBlur: (event) => {
668
+ const next = event.target.value.trim();
669
+ if (next !== note) onNote(next);
670
+ },
671
+ onKeyDown: (event) => {
672
+ if (event.key === "Enter") event.currentTarget.blur();
673
+ }
674
+ },
675
+ note
676
+ ) }),
677
+ children
678
+ ] }),
679
+ hint && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "wcb-hint", children: hint }),
680
+ error && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "wcb-error", role: "alert", children: error })
577
681
  ] });
578
682
  }
579
- function PersonDialog({ open, onClose, title, typeLabel, id, label, noteLabel, disabled, onNote, children, footer }) {
580
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
581
- import_dsh_client_ui_primitives.Modal,
683
+ function SessionDialog({
684
+ open,
685
+ onClose,
686
+ name,
687
+ title,
688
+ id,
689
+ running,
690
+ blank,
691
+ preset,
692
+ context,
693
+ disabled,
694
+ error,
695
+ onOpen,
696
+ onArchive
697
+ }) {
698
+ const [confirming, setConfirming] = (0, import_react2.useState)(false);
699
+ (0, import_react2.useEffect)(() => {
700
+ if (!open) setConfirming(false);
701
+ }, [open]);
702
+ const archive = async () => {
703
+ if (await onArchive()) setConfirming(false);
704
+ };
705
+ if (confirming) {
706
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
707
+ Dialog,
708
+ {
709
+ open,
710
+ onClose,
711
+ title: `归档「${name}」的会话?`,
712
+ footer: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
713
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.Button, { variant: "outline", size: "sm", disabled, onClick: () => setConfirming(false), children: "取消" }),
714
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.Button, { variant: "primary", size: "sm", className: "wcb-danger-solid", disabled, onClick: () => {
715
+ void archive();
716
+ }, children: disabled ? "归档中…" : "确认归档" })
717
+ ] }),
718
+ children: [
719
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { className: "wcb-confirm-text", children: [
720
+ "归档后这个会话不再被继续,它的历史不会再进入任何请求;",
721
+ name,
722
+ " 的下一条消息会按分组当前的工作区、模型与 Agent 预设新建会话。会话记录仍保留在 DSH 的「已归档」中。"
723
+ ] }),
724
+ error && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "wcb-error", role: "alert", children: error })
725
+ ]
726
+ }
727
+ );
728
+ }
729
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
730
+ Dialog,
582
731
  {
583
732
  open,
584
733
  onClose,
585
- title,
586
- closeLabel: "关闭",
587
- className: "wcb-modal",
588
- contentClassName: "wcb-modal-content",
734
+ title: `${name} 的会话`,
735
+ footer: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
736
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
737
+ import_dsh_client_ui_primitives.Button,
738
+ {
739
+ variant: "outline",
740
+ size: "sm",
741
+ className: "wcb-danger wcb-footer-start",
742
+ disabled,
743
+ "aria-label": `归档 ${name} 的会话`,
744
+ onClick: () => setConfirming(true),
745
+ children: "归档会话"
746
+ }
747
+ ),
748
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.Button, { variant: "primary", size: "sm", disabled, onClick: onOpen, children: "打开会话" })
749
+ ] }),
589
750
  children: [
590
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "wcb-person-facts", children: [
591
- typeLabel && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Fact, { name: "类型", children: typeLabel }),
592
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Fact, { name: "企微 ID", mono: true, children: id }),
593
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "wcb-fact", children: [
594
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "wcb-fact-key", children: "备注" }),
595
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
596
- import_dsh_client_ui_primitives.Input,
597
- {
598
- defaultValue: label,
599
- placeholder: id,
600
- disabled,
601
- "aria-label": noteLabel,
602
- className: "wcb-fact-input",
603
- onBlur: (event) => {
604
- const next = event.target.value.trim();
605
- if (next !== label) onNote(next);
606
- },
607
- onKeyDown: (event) => {
608
- if (event.key === "Enter") event.currentTarget.blur();
609
- }
610
- },
611
- label
612
- )
751
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("dl", { className: "wcb-facts", children: [
752
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FactRow, { label: "会话名称", children: title }),
753
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(FactRow, { label: "状态", children: [
754
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.StateDot, { state: running ? "ongoing" : "idle", size: 10 }),
755
+ blank ? "待使用(还没有开始)" : running ? "运行中" : "空闲"
756
+ ] }),
757
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FactRow, { label: "Agent 预设", children: preset }),
758
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FactRow, { label: "上下文", children: contextLabel(context) || "—" }),
759
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(FactRow, { label: "会话 ID", mono: true, children: [
760
+ id,
761
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CopyButton, { text: id, label: "复制会话 ID" })
613
762
  ] })
614
763
  ] }),
615
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "wcb-hint", children: "备注即时生效,会代替企微 ID 显示;它属于这个人,移出分组后仍然保留。" }),
616
- children,
617
- footer && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "wcb-dialog-actions", children: footer })
764
+ error && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "wcb-error", role: "alert", children: error })
618
765
  ]
619
766
  }
620
767
  );
621
768
  }
622
- function SessionDialog({ open, onClose, name, title, id, running, blank, disabled, error, onOpen }) {
623
- const [copied, setCopied] = (0, import_react2.useState)(false);
624
- const copy = async () => {
625
- if (!await (0, import_dsh_client_ui_primitives.writeClipboard)(id)) return;
626
- setCopied(true);
627
- setTimeout(() => setCopied(false), 1500);
628
- };
629
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
630
- import_dsh_client_ui_primitives.Modal,
769
+ function ConfirmDialog({ open, title, children, confirmLabel, busy, error, onCancel, onConfirm }) {
770
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
771
+ Dialog,
631
772
  {
632
773
  open,
633
- onClose,
634
- title: `${name} 的会话`,
635
- closeLabel: "关闭",
636
- className: "wcb-modal",
637
- contentClassName: "wcb-modal-content",
774
+ onClose: onCancel,
775
+ title,
776
+ footer: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
777
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.Button, { variant: "outline", size: "sm", disabled: busy, onClick: onCancel, children: "取消" }),
778
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.Button, { variant: "primary", size: "sm", className: "wcb-danger-solid", disabled: busy, onClick: onConfirm, children: busy ? "处理中…" : confirmLabel })
779
+ ] }),
638
780
  children: [
639
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "wcb-person-facts", children: [
640
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Fact, { name: "会话名称", children: title }),
641
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Fact, { name: "Session ID", mono: true, children: id }),
642
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Fact, { name: "状态", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "wcb-running", children: [
643
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.StateDot, { state: running ? "ongoing" : "idle", size: 8 }),
644
- blank ? "待使用(还没有开始)" : running ? "运行中" : "空闲"
645
- ] }) })
646
- ] }),
647
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "wcb-hint", children: "这里只展示会话身份,不会切换页面;点「在 DSH 中打开」才会跳转到这个会话。打开不会改变绑定,也不会新建会话。" }),
648
- error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "wcb-field-error", role: "alert", children: error }),
649
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "wcb-dialog-actions", children: [
650
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { variant: "outline", size: "sm", onClick: () => {
651
- void copy();
652
- }, children: copied ? "已复制" : "复制 Session ID" }),
653
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { variant: "ghost", size: "sm", onClick: onClose, children: "关闭" }),
654
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { variant: "primary", size: "sm", disabled, onClick: onOpen, children: "在 DSH 中打开" })
655
- ] })
781
+ children,
782
+ error && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "wcb-error", role: "alert", children: error })
656
783
  ]
657
784
  }
658
785
  );
659
786
  }
660
- function SaveBar({ dirty, saving, saved, error, disabled, onSave, onDiscard }) {
661
- if (!dirty && !saved && !error) return null;
662
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "wcb-savebar", children: [
663
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "wcb-savebar-msg", "data-tone": error ? "error" : saved && !dirty ? "success" : dirty ? "dirty" : void 0, role: "status", children: error ?? (saved && !dirty ? "已保存。" : "有未保存的更改") }),
664
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { variant: "ghost", size: "sm", disabled: disabled || saving || !dirty, onClick: onDiscard, children: "放弃" }),
665
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { variant: "primary", size: "sm", disabled: disabled || saving || !dirty, onClick: onSave, children: saving ? "保存中…" : "保存" })
666
- ] });
667
- }
668
- function ConfirmDialog({ open, title, children, confirmLabel, busy, disabled, onCancel, onConfirm }) {
669
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dsh_client_ui_primitives.Modal, { open, onClose: onCancel, title, closeLabel: "关闭", className: "wcb-modal", contentClassName: "wcb-modal-content", children: [
670
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "wcb-confirm-body", children }),
671
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "wcb-dialog-actions", children: [
672
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { variant: "ghost", size: "sm", disabled: busy, onClick: onCancel, children: "取消" }),
673
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { variant: "primary", size: "sm", disabled: busy || disabled, onClick: onConfirm, children: busy ? "处理中…" : confirmLabel })
674
- ] })
675
- ] });
676
- }
677
- function Empty({ children }) {
678
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "wcb-empty", children });
679
- }
680
- function CountTag({ count, noun, tone }) {
681
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dsh_client_ui_primitives.Tag, { tone: tone ?? (count ? "info" : "quiet"), children: [
682
- count,
683
- " ",
684
- noun
685
- ] });
686
- }
687
787
 
688
- // src/client/components/AdminCard.tsx
689
- var import_jsx_runtime2 = require("react/jsx-runtime");
690
- function AdminCard({ state, disabled, onChanged }) {
788
+ // src/client/components/AdminSection.tsx
789
+ var import_jsx_runtime3 = require("react/jsx-runtime");
790
+ function AdminSection({ state, disabled, onChanged }) {
691
791
  const storedIds = state?.settings?.adminUserIds ?? [];
692
792
  const storedScope = state?.settings?.adminWorkspaces ?? [];
693
793
  const [draft, setDraft] = (0, import_react3.useState)(() => ({ adminUserIds: [...storedIds], adminWorkspaces: [...storedScope] }));
694
794
  const [picking, setPicking] = (0, import_react3.useState)(false);
695
- const [query, setQuery] = (0, import_react3.useState)("");
696
795
  const [scopeOpen, setScopeOpen] = (0, import_react3.useState)(false);
697
796
  const save = useStoreSettingsSave(onChanged);
698
797
  const routing = useStoreApply(onChanged);
@@ -707,220 +806,179 @@ window.__ModuleLoader__.load({
707
806
  }, [storedKey]);
708
807
  const apply2 = async (patch) => {
709
808
  setDraft((current) => ({ ...current, ...patch }));
710
- if (!await save.save(patch)) {
711
- setDraft({ adminUserIds: [...storedIds], adminWorkspaces: [...storedScope] });
712
- }
809
+ if (!await save.save(patch)) setDraft({ adminUserIds: [...storedIds], adminWorkspaces: [...storedScope] });
713
810
  };
714
811
  const known = new Map(admins.map((admin) => [admin.id, admin]));
812
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
813
+ Section,
814
+ {
815
+ id: "admins",
816
+ title: "管理员",
817
+ count: draft.adminUserIds.length ? `${draft.adminUserIds.length} 人` : void 0,
818
+ description: "可以在单聊中切换会话(/sessions、/use、/new、/workspaces)、审批工具调用,并接收通知范围内所有会话的通知。管理员无需加入分组。",
819
+ actions: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives2.Button, { variant: "outline", size: "sm", icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(IconPlus, { size: 14 }), disabled: busy, "aria-label": "添加管理员", onClick: () => setPicking(true), children: "添加" }),
820
+ children: [
821
+ routing.error && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Notice, { tone: "error", children: routing.error }),
822
+ save.error && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Notice, { tone: "error", children: save.error }),
823
+ draft.adminUserIds.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "wcb-empty-line", children: "还没有管理员:没有人可以切换会话、审批工具调用或接收其他会话的通知。" }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "wcb-card", children: [
824
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { className: "wcb-list", children: draft.adminUserIds.map((id) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
825
+ AdminRow,
826
+ {
827
+ id,
828
+ label: known.get(id)?.label ?? "",
829
+ groupName: known.get(id)?.groupName,
830
+ groups,
831
+ disabled: busy || routing.busy === personKey("user", id),
832
+ onAssign: (groupId) => routing.apply(personKey("user", id), [addMember(groupId, "user", id)]),
833
+ onNote: (next) => {
834
+ void routing.apply(personKey("user", id), [setLabel(personKey("user", id), next)]);
835
+ },
836
+ onRemove: () => {
837
+ void apply2({ adminUserIds: toggle(draft.adminUserIds, id, false) });
838
+ }
839
+ },
840
+ id
841
+ )) }),
842
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "wcb-scope", children: [
843
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "wcb-scope-head", children: [
844
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("button", { type: "button", className: "wcb-scope-toggle", "aria-expanded": scopeOpen, onClick: () => setScopeOpen((value) => !value), children: [
845
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "wcb-chevron", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(IconChevronRight, { size: 14 }) }),
846
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "通知范围" }),
847
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "wcb-section-summary", children: scopeSummary(draft.adminWorkspaces, workspaces.length) })
848
+ ] }),
849
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "wcb-spacer" }),
850
+ !all && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "wcb-link", disabled: busy, onClick: () => {
851
+ void apply2({ adminWorkspaces: [] });
852
+ }, children: "恢复为全部" })
853
+ ] }),
854
+ scopeOpen && (workspaces.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "wcb-hint", children: "还没有注册任何工作区。默认分组的工作区会在第一次创建会话时注册。" }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
855
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { className: "wcb-scope-list", children: workspaces.map((workspace) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "wcb-check-row", children: [
856
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
857
+ "input",
858
+ {
859
+ type: "checkbox",
860
+ checked: scopeIncludes(draft.adminWorkspaces, workspace.path),
861
+ disabled: busy,
862
+ "aria-label": `管理员接收 ${workspace.title} 的通知`,
863
+ onChange: (event) => {
864
+ void apply2({
865
+ adminWorkspaces: toggleScope(draft.adminWorkspaces, workspaces.map((item) => item.path), workspace.path, event.target.checked)
866
+ });
867
+ }
868
+ }
869
+ ),
870
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "wcb-row-main", children: [
871
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "wcb-row-title", children: workspace.title }),
872
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "wcb-row-quote wcb-mono", title: workspace.path, children: displayPath(workspace.path) })
873
+ ] }),
874
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "wcb-row-meta", children: workspace.sessionCount ? `${workspace.sessionCount} 个会话` : "暂无会话" })
875
+ ] }) }, workspace.path)) }),
876
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { className: "wcb-hint", children: [
877
+ all ? "全部勾选(默认):包括以后新增的工作区。" : "只接收勾选工作区中的会话通知。",
878
+ "勾选即生效。"
879
+ ] })
880
+ ] }))
881
+ ] })
882
+ ] }),
883
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
884
+ AdminPicker,
885
+ {
886
+ open: picking,
887
+ state,
888
+ current: draft.adminUserIds,
889
+ onClose: () => setPicking(false),
890
+ onPick: (id) => {
891
+ void apply2({ adminUserIds: toggle(draft.adminUserIds, id, true) });
892
+ setPicking(false);
893
+ }
894
+ }
895
+ )
896
+ ]
897
+ }
898
+ );
899
+ }
900
+ function AdminPicker({ open, state, current, onClose, onPick }) {
901
+ const [query, setQuery] = (0, import_react3.useState)("");
902
+ (0, import_react3.useEffect)(() => {
903
+ if (!open) setQuery("");
904
+ }, [open]);
715
905
  const candidates = (0, import_react3.useMemo)(() => {
716
906
  const rows = /* @__PURE__ */ new Map();
717
907
  for (const sender of state?.rejected ?? []) {
718
908
  if (sender.kind !== "user") continue;
719
- rows.set(sender.id, {
720
- id: sender.id,
721
- name: sender.label || sender.id,
722
- hint: sender.label ? `未授权用户 · ${sender.id}` : "未授权用户(刚给机器人发过消息)"
723
- });
909
+ rows.set(sender.id, { id: sender.id, name: sender.label || sender.id, hint: sender.label ? `待授权 · ${sender.id}` : "待授权" });
724
910
  }
725
911
  for (const group of state?.routing?.groups ?? []) {
726
912
  for (const member of group.members) {
727
913
  if (member.kind !== "user") continue;
728
- rows.set(member.id, {
729
- id: member.id,
730
- name: member.displayName,
731
- hint: member.label ? `分组:${group.name} · ${member.id}` : `分组:${group.name}`
732
- });
914
+ rows.set(member.id, { id: member.id, name: member.displayName, hint: member.label ? `${group.name} · ${member.id}` : group.name });
733
915
  }
734
916
  }
735
- for (const id of draft.adminUserIds) rows.delete(id);
917
+ for (const id of current) rows.delete(id);
736
918
  return [...rows.values()].sort((left, right) => left.name.localeCompare(right.name));
737
- }, [state, draft.adminUserIds]);
919
+ }, [state, current]);
738
920
  const needle = query.trim().toLowerCase();
739
921
  const matches = needle ? candidates.filter((row) => row.name.toLowerCase().includes(needle) || row.id.toLowerCase().includes(needle)) : candidates;
740
922
  const typed = query.trim();
741
- const addAdmin = (id) => {
742
- void apply2({ adminUserIds: toggle(draft.adminUserIds, id, true) });
743
- setQuery("");
744
- setPicking(false);
745
- };
746
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
747
- Card,
748
- {
749
- step: 4,
750
- title: "管理员",
751
- description: "只有这里列出的 userid 可以切换会话(/sessions、/use、/new、/workspaces)、在单聊里审批工具调用,并按下面的范围接收通知。其它用户永远只能访问自己专属的会话。改动即时生效。",
752
- aside: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
753
- draft.adminUserIds.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_dsh_client_ui_primitives2.Tag, { tone: "success", children: [
754
- draft.adminUserIds.length,
755
- " 人"
923
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Dialog, { open, onClose, title: "添加管理员", children: [
924
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
925
+ import_dsh_client_ui_primitives2.Input,
926
+ {
927
+ className: "wcb-input",
928
+ value: query,
929
+ autoFocus: true,
930
+ placeholder: "搜索备注名或企业微信 userid",
931
+ "aria-label": "搜索已知用户",
932
+ onChange: (event) => setQuery(event.target.value)
933
+ }
934
+ ),
935
+ matches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "wcb-picker-list", role: "listbox", "aria-label": "已知用户", children: matches.map((row) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("button", { type: "button", className: "wcb-picker-row", role: "option", "aria-selected": false, onClick: () => onPick(row.id), children: [
936
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "wcb-row-title", children: row.name }),
937
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "wcb-picker-hint", children: row.hint })
938
+ ] }, row.id)) }),
939
+ typed && !candidates.some((row) => row.id === typed) && !current.includes(typed) && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "wcb-picker-manual", children: [
940
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "wcb-row-main", children: [
941
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "wcb-row-title", children: [
942
+ "按 userid 添加「",
943
+ typed,
944
+ "」"
756
945
  ] }),
757
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
758
- import_dsh_client_ui_primitives2.Button,
759
- {
760
- variant: "outline",
761
- size: "sm",
762
- icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.IconPlusOutlineRegular, {}),
763
- disabled: busy,
764
- "aria-label": "添加管理员",
765
- onClick: () => setPicking(true),
766
- children: "添加"
767
- }
768
- )
946
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "wcb-picker-hint", children: "适用于还没给机器人发过消息的人" })
769
947
  ] }),
770
- children: [
771
- routing.error && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "wcb-banner", "data-tone": "danger", role: "status", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "wcb-banner-body", children: routing.error }) }) }),
772
- save.error && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "wcb-banner", "data-tone": "danger", role: "status", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "wcb-banner-body", children: save.error }) }) }),
773
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "wcb-panel", children: draft.adminUserIds.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { padding: 10 }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Empty, { children: [
774
- "还没有管理员:没有人可以切换会话、审批工具调用或接收他人会话的通知。",
775
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { marginTop: 10 }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.Button, { variant: "outline", size: "sm", icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.IconPlusOutlineRegular, {}), disabled: busy, onClick: () => setPicking(true), children: "添加管理员" }) })
776
- ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "wcb-panel-scroll", children: draft.adminUserIds.map((id) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
777
- AdminRow,
778
- {
779
- id,
780
- label: known.get(id)?.label ?? "",
781
- groupName: known.get(id)?.groupName,
782
- groups,
783
- disabled: busy || routing.busy === personKey("user", id),
784
- onAssign: (groupId) => routing.apply(personKey("user", id), [addMember(groupId, "user", id)]),
785
- onNote: (next) => {
786
- void routing.apply(personKey("user", id), [setLabel(personKey("user", id), next)]);
787
- },
788
- onRemove: () => {
789
- void apply2({ adminUserIds: toggle(draft.adminUserIds, id, false) });
790
- }
791
- },
792
- id
793
- )) }) }),
794
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { marginTop: 14 }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
795
- Collapse,
796
- {
797
- open: scopeOpen,
798
- onToggle: () => setScopeOpen((value) => !value),
799
- title: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
800
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.IconShieldOutlineRegular, { size: 15 }),
801
- " 可接收通知的 Workspace"
802
- ] }),
803
- summary: all ? "全部 Workspace" : `${draft.adminWorkspaces.length} / ${workspaces.length || draft.adminWorkspaces.length} 个 Workspace`,
804
- actions: all ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.Button, { variant: "outline", size: "sm", disabled: busy, onClick: () => {
805
- void apply2({ adminWorkspaces: [] });
806
- }, children: "全选" }),
807
- children: workspaces.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Empty, { children: "还没有注册任何 Workspace。默认分组的 Workspace 会在创建会话时注册。" }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "wcb-panel", children: [
808
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "wcb-panel-scroll", children: workspaces.map((workspace) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
809
- CheckRow,
810
- {
811
- checked: scopeIncludes(draft.adminWorkspaces, workspace.path),
812
- label: `管理员接收 ${workspace.title} 的通知`,
813
- disabled: busy,
814
- onToggle: (on) => {
815
- void apply2({
816
- adminWorkspaces: toggleScope(draft.adminWorkspaces, workspaces.map((item) => item.path), workspace.path, on)
817
- });
818
- },
819
- meta: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "wcb-row-meta", children: workspace.sessionCount ? `${workspace.sessionCount} 个会话` : "暂无会话" }),
820
- children: [
821
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "wcb-row-title", children: workspace.title }),
822
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "wcb-row-sub wcb-mono wcb-ellipsis", title: workspace.path, children: displayPath(workspace.path) })
823
- ]
824
- },
825
- workspace.path
826
- )) }),
827
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "wcb-add", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "wcb-grow wcb-hint", children: [
828
- all ? "未限定(全部勾选):管理员会收到所有这些 Workspace 中会话的通知。取消勾选任意一项即改为只收勾选的 Workspace。" : "管理员只接收已勾选 Workspace 中会话的通知(外加他们自己绑定的会话)。",
829
- " ",
830
- "只有归档会话的 Workspace 也会列出。勾选即生效。"
831
- ] }) })
832
- ] })
833
- }
834
- ) }),
835
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
836
- import_dsh_client_ui_primitives2.Modal,
837
- {
838
- open: picking,
839
- onClose: () => setPicking(false),
840
- title: "添加管理员",
841
- closeLabel: "关闭",
842
- className: "wcb-modal",
843
- contentClassName: "wcb-modal-content",
844
- children: [
845
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
846
- import_dsh_client_ui_primitives2.Input,
847
- {
848
- value: query,
849
- autoFocus: true,
850
- placeholder: "搜索备注名或企微 userid",
851
- "aria-label": "搜索已知用户",
852
- onChange: (event) => setQuery(event.target.value)
853
- }
854
- ),
855
- matches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "wcb-picker-list", role: "listbox", "aria-label": "已知用户", children: matches.map((row) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
856
- "button",
857
- {
858
- type: "button",
859
- className: "wcb-picker-row",
860
- role: "option",
861
- "aria-selected": false,
862
- onClick: () => addAdmin(row.id),
863
- children: [
864
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "wcb-row-title", children: row.name }),
865
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "wcb-picker-hint", children: row.hint })
866
- ]
867
- },
868
- row.id
869
- )) }),
870
- typed && !candidates.some((row) => row.id === typed) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "wcb-picker-row", "data-manual": true, children: [
871
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "wcb-row-title", children: [
872
- "直接添加「",
873
- typed,
874
- "」"
875
- ] }),
876
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "wcb-picker-hint", children: "按 userid 添加一个还没给机器人发过消息的人" }),
877
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.Button, { variant: "outline", size: "sm", onClick: () => addAdmin(typed), children: "添加" })
878
- ] }),
879
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "wcb-hint", children: "名单来自未授权用户和已授权成员,优先显示备注名;没有备注时显示企微 userid。选中即生效。" })
880
- ]
881
- }
882
- )
883
- ]
884
- }
885
- );
948
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives2.Button, { variant: "outline", size: "sm", onClick: () => onPick(typed), children: "添加" })
949
+ ] }),
950
+ !typed && matches.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "wcb-hint", children: "还没有已知用户。输入企业微信 userid 即可直接添加。" }),
951
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "wcb-hint", children: "候选人来自待授权与分组成员,选中即生效。" })
952
+ ] });
886
953
  }
887
954
  function AdminRow({ id, label, groupName, groups, disabled, onAssign, onNote, onRemove }) {
888
955
  const [details, setDetails] = (0, import_react3.useState)(false);
889
956
  const [assigning, setAssigning] = (0, import_react3.useState)(false);
890
957
  const name = label || id;
891
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "wcb-member", children: [
892
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
893
- PersonRow,
894
- {
895
- kind: "user",
896
- title: name,
897
- label: `${name} 的详情`,
898
- disabled,
899
- onOpen: () => setDetails(true),
900
- meta: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
901
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.Tag, { tone: "success", children: "管理员" }),
902
- groupName ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "wcb-row-sub", children: [
903
- "分组:",
904
- groupName
905
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
906
- "button",
907
- {
908
- type: "button",
909
- className: "wcb-link",
910
- disabled,
911
- "aria-label": `为 ${name} 分配分组`,
912
- "aria-expanded": assigning,
913
- onClick: () => setAssigning((value) => !value),
914
- children: "不在任何分组"
915
- }
916
- )
917
- ] })
918
- }
919
- ),
920
- assigning && !groupName && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "wcb-member-edit", children: [
921
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "wcb-binding-field", children: [
922
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "wcb-binding-label", children: "加入分组" }),
923
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
958
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("li", { className: "wcb-admin-row", children: [
959
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "wcb-row-line", children: [
960
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PersonButton, { kind: "user", name, label: `${name} 的详情`, disabled, onClick: () => setDetails(true) }),
961
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "wcb-spacer" }),
962
+ groupName ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "wcb-row-meta", children: [
963
+ "分组:",
964
+ groupName
965
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
966
+ "button",
967
+ {
968
+ type: "button",
969
+ className: "wcb-link",
970
+ disabled,
971
+ "aria-label": `为 ${name} 分配分组`,
972
+ "aria-expanded": assigning,
973
+ onClick: () => setAssigning((value) => !value),
974
+ children: "不在任何分组"
975
+ }
976
+ )
977
+ ] }),
978
+ assigning && !groupName && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Editor, { children: [
979
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "wcb-field", children: [
980
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "wcb-field-label", children: "加入分组" }),
981
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
924
982
  Select,
925
983
  {
926
984
  value: "",
@@ -935,60 +993,59 @@ window.__ModuleLoader__.load({
935
993
  });
936
994
  },
937
995
  children: [
938
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "", disabled: true, children: groups.length ? "请选择分组" : "暂无可用分组" }),
939
- groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: group.id, children: group.name }, group.id))
996
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "", disabled: true, children: groups.length ? "请选择分组" : "暂无可用分组" }),
997
+ groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: group.id, children: group.name }, group.id))
940
998
  ]
941
999
  }
942
1000
  ),
943
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "wcb-hint", children: "选择后立即加入;下一条消息按该组的 Workspace、模型与 preset 创建会话,管理员权限不变。" })
1001
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "wcb-hint", children: "选择后立即加入;之后的消息按该组的工作区、模型与 Agent 预设处理,管理员权限不变。" })
944
1002
  ] }),
945
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.Button, { variant: "ghost", size: "sm", disabled, onClick: () => setAssigning(false), children: "取消" })
1003
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FormFooter, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives2.Button, { variant: "ghost", size: "sm", disabled, onClick: () => setAssigning(false), children: "取消" }) })
946
1004
  ] }),
947
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1005
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
948
1006
  PersonDialog,
949
1007
  {
950
1008
  open: details,
951
1009
  onClose: () => setDetails(false),
952
1010
  title: name,
953
- typeLabel: "管理员(个人 userid)",
1011
+ kind: "user",
1012
+ typeLabel: "管理员(个人)",
954
1013
  id,
955
- label,
1014
+ note: label,
956
1015
  noteLabel: `管理员 ${id} 的备注`,
957
1016
  disabled,
958
1017
  onNote,
959
- footer: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
960
- import_dsh_client_ui_primitives2.Button,
961
- {
962
- variant: "outline",
963
- size: "sm",
964
- icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.IconTrashOutlineRegular, {}),
965
- disabled,
966
- "aria-label": `移除管理员 ${id}`,
967
- onClick: onRemove,
968
- children: "移除管理员"
969
- }
970
- ),
971
- children: [
972
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "wcb-person-facts", children: [
973
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Fact, { name: "授权来源", children: "插件设置里的管理员列表(改动即时生效)" }),
974
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Fact, { name: "所属分组", children: groupName ?? "不在任何分组" })
975
- ] }),
976
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "wcb-hint", children: "备注与管理员名单都即时生效。" })
977
- ]
1018
+ hint: "备注会代替企业微信 ID 显示。移除管理员不会影响 TA 的分组成员身份。",
1019
+ footer: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
1020
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1021
+ import_dsh_client_ui_primitives2.Button,
1022
+ {
1023
+ variant: "outline",
1024
+ size: "sm",
1025
+ className: "wcb-danger wcb-footer-start",
1026
+ disabled,
1027
+ "aria-label": `移除管理员 ${id}`,
1028
+ onClick: onRemove,
1029
+ children: "移除管理员"
1030
+ }
1031
+ ),
1032
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives2.Button, { variant: "primary", size: "sm", onClick: () => setDetails(false), children: "完成" })
1033
+ ] }),
1034
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FactRow, { label: "所属分组", children: groupName ?? "不在任何分组" })
978
1035
  }
979
1036
  )
980
1037
  ] });
981
1038
  }
982
1039
 
983
- // src/client/components/AdvancedCard.tsx
1040
+ // src/client/components/AdvancedSection.tsx
984
1041
  var import_react4 = require("react");
985
1042
  var import_dsh_client_ui_primitives3 = require("@deepseek-ai/dsh-client-ui-primitives");
986
- var import_jsx_runtime3 = require("react/jsx-runtime");
987
- function AdvancedCard({ settings, journal, disabled, onChanged }) {
1043
+ var import_jsx_runtime4 = require("react/jsx-runtime");
1044
+ function AdvancedSection({ settings, journal, disabled, onChanged }) {
988
1045
  const stored = advancedSlice(settings);
1046
+ const [open, setOpen] = (0, import_react4.useState)(false);
989
1047
  const [draft, setDraft] = (0, import_react4.useState)(() => advancedSlice(settings));
990
1048
  const [attempted, setAttempted] = (0, import_react4.useState)(false);
991
- const [copied, setCopied] = (0, import_react4.useState)(false);
992
1049
  const save = useStoreSettingsSave(onChanged);
993
1050
  const patch = settingsPatch(draft, stored);
994
1051
  const dirty = Object.keys(patch).length > 0;
@@ -997,61 +1054,47 @@ window.__ModuleLoader__.load({
997
1054
  (0, import_react4.useEffect)(() => {
998
1055
  setDraft(advancedSlice(settings));
999
1056
  }, [storedKey]);
1000
- const copy = async () => {
1001
- if (!journal?.directory) return;
1002
- setCopied(await (0, import_dsh_client_ui_primitives3.writeClipboard)(journal.directory));
1003
- setTimeout(() => setCopied(false), 1500);
1004
- };
1005
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("details", { className: "wcb-card wcb-details", children: [
1006
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("summary", { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1007
- CardHead,
1008
- {
1009
- step: 5,
1010
- title: "连接与日志",
1011
- description: "私有化部署的 WebSocket 地址,以及对话日志的开关、保留天数与目录。",
1012
- aside: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "wcb-chevron", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.IconChevronRightOutlineRegular, { size: 16 }) })
1013
- }
1014
- ) }),
1015
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1016
- Field,
1017
- {
1018
- label: "WebSocket 地址",
1019
- error: errors.wsUrl,
1020
- hint: "留空使用 SDK 默认地址。仅在企业私有化部署时需要,只接受 wss://。保存这一项会重新连接机器人——它是连接的一半;本卡其余设置保存后立即生效,不会断开正在进行的对话。",
1021
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1022
- import_dsh_client_ui_primitives3.Input,
1023
- {
1024
- className: "wcb-grow",
1025
- value: draft.wsUrl,
1026
- placeholder: "wss://openws.work.weixin.qq.com",
1027
- spellCheck: false,
1028
- disabled,
1029
- "aria-label": "WebSocket 地址",
1030
- onChange: (event) => setDraft((current) => ({ ...current, wsUrl: event.target.value }))
1031
- }
1032
- )
1033
- }
1034
- ),
1035
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1036
- Field,
1037
- {
1038
- label: "对话日志(JSONL)",
1039
- hint: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
1040
- "每条企微消息一行 ",
1041
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "wcb-code", children: "round.complete" }),
1042
- ",含原始请求、回复与元数据;另有 ",
1043
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "wcb-code", children: "wecom.message" }),
1044
- "、",
1045
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "wcb-code", children: "dsh.prompt" }),
1046
- "、",
1047
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "wcb-code", children: "dsh.turn.end" }),
1048
- "、",
1049
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "wcb-code", children: "wecom.send" }),
1050
- " 等明细行。Secret、回调 URL 与媒体密钥会被脱敏;文件权限仅当前用户可读。"
1051
- ] }),
1052
- children: [
1053
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "wcb-field-row", children: [
1054
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1057
+ const summary = [
1058
+ stored.wsUrl ? "自定义接入地址" : "默认接入地址",
1059
+ stored.logEnabled ? `对话日志保留 ${stored.logRetentionDays} 天` : "对话日志已关闭"
1060
+ ].join(" · ");
1061
+ const message = save.error ?? (dirty ? "有未保存的更改" : save.saved ? "已保存。" : void 0);
1062
+ const tone = save.error ? "error" : dirty ? "dirty" : save.saved ? "success" : void 0;
1063
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: "wcb-section", "data-section": "advanced", children: [
1064
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "wcb-section-head", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("button", { type: "button", className: "wcb-section-toggle", "aria-expanded": open, onClick: () => setOpen((value) => !value), children: [
1065
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "wcb-chevron", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IconChevronRight, { size: 14 }) }),
1066
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h4", { className: "wcb-section-title", children: "高级设置" }),
1067
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "wcb-section-summary", children: summary })
1068
+ ] }) }),
1069
+ open && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "wcb-card", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "wcb-card-body wcb-advanced", children: [
1070
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1071
+ Field,
1072
+ {
1073
+ label: "WebSocket 地址",
1074
+ error: errors.wsUrl,
1075
+ hint: "留空使用企业微信默认地址,仅私有化部署需要填写(wss://)。保存这一项会重新连接机器人。",
1076
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1077
+ import_dsh_client_ui_primitives3.Input,
1078
+ {
1079
+ className: "wcb-input",
1080
+ value: draft.wsUrl,
1081
+ placeholder: "wss://openws.work.weixin.qq.com",
1082
+ spellCheck: false,
1083
+ disabled,
1084
+ "aria-label": "WebSocket 地址",
1085
+ onChange: (event) => setDraft((current) => ({ ...current, wsUrl: event.target.value }))
1086
+ }
1087
+ )
1088
+ }
1089
+ ),
1090
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1091
+ Field,
1092
+ {
1093
+ label: "对话日志",
1094
+ error: errors.logRetentionDays,
1095
+ hint: "每条企业微信消息写一行 JSONL(round.complete 及明细),Secret 等敏感字段已脱敏。修改即时生效,不会断开连接。",
1096
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "wcb-switch-row", children: [
1097
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1055
1098
  import_dsh_client_ui_primitives3.Switch,
1056
1099
  {
1057
1100
  checked: draft.logEnabled,
@@ -1060,447 +1103,251 @@ window.__ModuleLoader__.load({
1060
1103
  onChange: (next) => setDraft((current) => ({ ...current, logEnabled: next }))
1061
1104
  }
1062
1105
  ),
1063
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { color: "var(--wcb-text-2)", fontSize: 13 }, children: "保留" }),
1064
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1065
- import_dsh_client_ui_primitives3.Input,
1066
- {
1067
- className: "wcb-number",
1068
- type: "number",
1069
- min: 1,
1070
- max: 365,
1071
- step: 1,
1072
- value: draft.logRetentionDays,
1073
- disabled: disabled || !draft.logEnabled,
1074
- "aria-label": "日志保留天数",
1075
- onChange: (event) => setDraft((current) => ({ ...current, logRetentionDays: Number(event.target.value) }))
1076
- }
1077
- ),
1078
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { color: "var(--wcb-text-2)", fontSize: 13 }, children: "天" })
1079
- ] }),
1080
- errors.logRetentionDays && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "wcb-field-error", children: errors.logRetentionDays }),
1081
- journal?.directory && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "wcb-field-row", style: { marginTop: 10 }, children: [
1082
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "wcb-path wcb-grow", title: journal.file, children: journal.directory }),
1083
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "outline", size: "sm", icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.IconCopyOutlineRegular, {}), onClick: () => {
1084
- void copy();
1085
- }, children: copied ? "已复制" : "复制路径" })
1106
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: draft.logEnabled ? "记录,保留" : "不记录" }),
1107
+ draft.logEnabled && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1108
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1109
+ import_dsh_client_ui_primitives3.Input,
1110
+ {
1111
+ className: "wcb-number",
1112
+ type: "number",
1113
+ min: 1,
1114
+ max: 365,
1115
+ step: 1,
1116
+ value: draft.logRetentionDays,
1117
+ disabled,
1118
+ "aria-label": "日志保留天数",
1119
+ onChange: (event) => setDraft((current) => ({ ...current, logRetentionDays: Number(event.target.value) }))
1120
+ }
1121
+ ),
1122
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "天" })
1123
+ ] })
1086
1124
  ] })
1087
- ]
1088
- }
1089
- ),
1090
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1091
- SaveBar,
1092
- {
1093
- dirty,
1094
- saving: save.saving,
1095
- saved: save.saved,
1096
- error: save.error,
1097
- disabled,
1098
- onSave: () => {
1099
- setAttempted(true);
1100
- if (dirty) void save.save(patch);
1101
- },
1102
- onDiscard: () => {
1103
- setDraft(advancedSlice(settings));
1104
- setAttempted(false);
1105
1125
  }
1106
- }
1107
- )
1126
+ ),
1127
+ journal?.directory && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "wcb-path", title: journal.file, children: [
1128
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "wcb-path-text", children: journal.directory }),
1129
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CopyButton, { text: journal.directory, label: "复制日志目录" })
1130
+ ] }),
1131
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(FormFooter, { message, tone, children: [
1132
+ dirty && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1133
+ import_dsh_client_ui_primitives3.Button,
1134
+ {
1135
+ variant: "ghost",
1136
+ size: "sm",
1137
+ disabled: save.saving,
1138
+ onClick: () => {
1139
+ setDraft(advancedSlice(settings));
1140
+ setAttempted(false);
1141
+ },
1142
+ children: "放弃"
1143
+ }
1144
+ ),
1145
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1146
+ import_dsh_client_ui_primitives3.Button,
1147
+ {
1148
+ variant: "primary",
1149
+ size: "sm",
1150
+ disabled: disabled || save.saving || !dirty,
1151
+ onClick: () => {
1152
+ setAttempted(true);
1153
+ if (Object.keys(validateAdvanced(draft)).length) return;
1154
+ void save.save(patch);
1155
+ },
1156
+ children: save.saving ? "保存中…" : "保存"
1157
+ }
1158
+ )
1159
+ ] })
1160
+ ] }) })
1108
1161
  ] });
1109
1162
  }
1110
1163
 
1111
- // src/client/components/CredentialsCard.tsx
1164
+ // src/client/components/ConnectionSection.tsx
1112
1165
  var import_react5 = require("react");
1113
1166
  var import_dsh_client_ui_primitives4 = require("@deepseek-ai/dsh-client-ui-primitives");
1114
- var import_jsx_runtime4 = require("react/jsx-runtime");
1115
- function CredentialsCard({ scope, base, disabled, remote, onChanged }) {
1116
- const [reveal, setReveal] = (0, import_react5.useState)(false);
1117
- const [secret, setSecret] = (0, import_react5.useState)("");
1167
+ var import_jsx_runtime5 = require("react/jsx-runtime");
1168
+ var PHASES = {
1169
+ unconfigured: { label: "未配置", dot: "idle" },
1170
+ invalid: { label: "配置无效", dot: "error", tone: "error" },
1171
+ connecting: { label: "连接中", dot: "ongoing" },
1172
+ online: { label: "在线", dot: "done" },
1173
+ reconnecting: { label: "重连中", dot: "ongoing", tone: "warning" },
1174
+ offline: { label: "已断开", dot: "warning", tone: "warning" },
1175
+ displaced: { label: "被其他连接替换", dot: "error", tone: "error" },
1176
+ error: { label: "连接错误", dot: "error", tone: "error" }
1177
+ };
1178
+ function ConnectionSection({ scope, base, state, error, disabled, remote, onChanged }) {
1179
+ const status = useSecretStatus(remote, base.secretEnv);
1180
+ const save = useConfigSave(scope, onChanged);
1181
+ const [editing, setEditing] = (0, import_react5.useState)();
1118
1182
  const [botId, setBotId] = (0, import_react5.useState)(base.botId);
1119
- const [error, setError] = (0, import_react5.useState)();
1183
+ const [secret, setSecret] = (0, import_react5.useState)("");
1184
+ const [reveal, setReveal] = (0, import_react5.useState)(false);
1120
1185
  const [attempted, setAttempted] = (0, import_react5.useState)(false);
1121
- const save = useConfigSave(scope, onChanged);
1122
- const status = useSecretStatus(remote, base.secretEnv);
1123
- const ready = Boolean(botId.trim()) && (status.configured || Boolean(secret.trim()));
1124
- const dirty = botId.trim() !== base.botId || Boolean(secret.trim());
1125
- const errors = attempted ? validateCredentials({ botId, secret }, status.configured) : {};
1186
+ const [secretError, setSecretError] = (0, import_react5.useState)();
1126
1187
  (0, import_react5.useEffect)(() => {
1127
1188
  setBotId(base.botId);
1128
1189
  }, [base.botId]);
1190
+ const incomplete = !base.botId || status.known && !status.configured;
1191
+ const open = editing ?? incomplete;
1192
+ const dirty = botId.trim() !== base.botId || Boolean(secret.trim());
1193
+ const errors = attempted ? validateCredentials({ botId, secret }, status.configured) : {};
1194
+ const phase = state ? PHASES[state.connection.phase] ?? PHASES.error : void 0;
1195
+ const detail = error ?? state?.connection.detail;
1196
+ const close = () => {
1197
+ setEditing(false);
1198
+ setBotId(base.botId);
1199
+ setSecret("");
1200
+ setReveal(false);
1201
+ setAttempted(false);
1202
+ setSecretError(void 0);
1203
+ };
1129
1204
  async function onSave() {
1130
1205
  setAttempted(true);
1131
- setError(void 0);
1206
+ setSecretError(void 0);
1132
1207
  if (Object.keys(validateCredentials({ botId, secret }, status.configured)).length) return;
1133
1208
  if (!await save.save({ botId: botId.trim() })) return;
1134
- if (!secret.trim()) return;
1135
- try {
1136
- await storeCredential(remote?.credentials, base.secretEnv, secret.trim());
1137
- setSecret("");
1138
- status.refresh();
1139
- } catch (cause) {
1140
- setError(`其它配置已保存,但 Secret 保存失败:${cause instanceof Error ? cause.message : String(cause)}`);
1209
+ if (secret.trim()) {
1210
+ try {
1211
+ await storeCredential(remote?.credentials, base.secretEnv, secret.trim());
1212
+ status.refresh();
1213
+ } catch (cause) {
1214
+ setSecretError(`Bot ID 已保存,但 Secret 保存失败:${cause instanceof Error ? cause.message : String(cause)}`);
1215
+ return;
1216
+ }
1141
1217
  }
1218
+ setSecret("");
1219
+ setReveal(false);
1220
+ setAttempted(false);
1221
+ setEditing(false);
1142
1222
  }
1143
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1144
- Card,
1145
- {
1146
- step: 1,
1147
- title: "连接机器人",
1148
- description: "在企业微信管理后台 → 智能机器人 → API 模式(长连接)中获取。这是仅有的两项必填配置。",
1149
- aside: ready ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives4.Tag, { tone: "success", children: "已填写" }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives4.Tag, { tone: "danger", children: "必填" }),
1150
- children: [
1151
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Field, { label: "Bot ID", required: true, error: errors.botId, hint: "机器人的唯一标识,可公开显示。", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1152
- import_dsh_client_ui_primitives4.Input,
1153
- {
1154
- className: "wcb-grow",
1155
- value: botId,
1156
- placeholder: "例如 aib0xxxxxxxxxxxx",
1157
- spellCheck: false,
1158
- autoComplete: "off",
1159
- disabled,
1160
- "aria-label": "Bot ID",
1161
- onChange: (event) => setBotId(event.target.value)
1162
- }
1163
- ) }),
1164
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1165
- Field,
1166
- {
1167
- label: "Bot Secret",
1168
- required: !status.configured,
1169
- error: errors.secret,
1170
- hint: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1171
- "保存到 DSH 凭据库(引用名 ",
1172
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "wcb-code", children: base.secretEnv }),
1173
- "),不会写入插件配置,也不会回显。",
1174
- status.configured ? "留空表示保持当前 Secret。" : ""
1175
- ] }),
1176
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "wcb-field-row", children: [
1177
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1178
- import_dsh_client_ui_primitives4.Input,
1179
- {
1180
- className: "wcb-grow",
1181
- type: reveal ? "text" : "password",
1182
- value: secret,
1183
- placeholder: status.configured ? "已保存 · 输入新值以替换" : "粘贴 Bot Secret",
1184
- autoComplete: "new-password",
1185
- spellCheck: false,
1186
- disabled,
1187
- "aria-label": "Bot Secret",
1188
- onChange: (event) => setSecret(event.target.value)
1189
- }
1190
- ),
1191
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives4.Button, { variant: "outline", size: "sm", type: "button", onClick: () => setReveal((value) => !value), disabled: !secret, children: reveal ? "隐藏" : "显示" }),
1192
- status.configured ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives4.Tag, { tone: "success", children: "已保存" }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives4.Tag, { tone: "warning", children: "未设置" })
1193
- ] })
1194
- }
1195
- ),
1196
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1197
- SaveBar,
1198
- {
1199
- dirty,
1200
- saving: save.saving,
1201
- saved: save.saved,
1202
- error: error ?? save.error,
1203
- disabled,
1204
- onSave: () => {
1205
- void onSave();
1206
- },
1207
- onDiscard: () => {
1208
- setBotId(base.botId);
1209
- setSecret("");
1210
- setError(void 0);
1211
- setAttempted(false);
1212
- }
1213
- }
1214
- )
1215
- ]
1216
- }
1217
- );
1218
- }
1219
-
1220
- // src/client/components/GroupsCard.tsx
1221
- var import_react6 = require("react");
1222
- var import_dsh_client_ui_primitives5 = require("@deepseek-ai/dsh-client-ui-primitives");
1223
- var import_jsx_runtime5 = require("react/jsx-runtime");
1224
- function GroupsCard({ state, error, disabled, refreshing, onRefresh, onChanged, onOpenSession }) {
1225
- const { busy, error: applyError, apply: apply2 } = useStoreApply(onChanged);
1226
- const [freshId, setFreshId] = (0, import_react6.useState)();
1227
- const view = state?.routing;
1228
- (0, import_react6.useEffect)(() => {
1229
- if (freshId && view?.groups.some((group) => group.id === freshId)) setFreshId(void 0);
1230
- }, [freshId, view]);
1231
- const add = async () => {
1232
- const response = await apply2("group:new", [addGroup()]);
1233
- if (response?.createdGroupId) setFreshId(response.createdGroupId);
1234
- };
1235
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1236
- Card,
1237
- {
1238
- step: 2,
1239
- title: "用户分组",
1240
- description: "每个分组决定成员在哪个 Workspace、用哪个模型与 preset;把企微用户或群聊放进分组即为授权。改动即时生效。",
1241
- aside: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1242
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CountTag, { count: view?.groups.length ?? 0, noun: "个分组", tone: "quiet" }),
1243
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CountTag, { count: view?.total ?? 0, noun: "位成员" })
1223
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Section, { id: "connection", title: "连接", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "wcb-card", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "wcb-card-body", children: [
1224
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "wcb-connection-head", children: [
1225
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "wcb-status", role: "status", children: [
1226
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives4.StateDot, { state: error ? "error" : phase?.dot ?? "ongoing", size: 10 }),
1227
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "wcb-status-label", children: error ? "状态不可用" : phase?.label ?? "正在读取状态…" }),
1228
+ state && !error && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "wcb-status-since", children: relativeTime(state.connection.since) })
1244
1229
  ] }),
1245
- children: [
1246
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "wcb-toolbar", children: [
1247
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "wcb-grow wcb-hint", children: "没有分组的用户无法与机器人对话;他们发消息后会出现在「未授权用户」卡片里,加入分组即完成授权。" }),
1248
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives5.Button, { variant: "outline", size: "sm", icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives5.IconRefreshOutlineRegular, {}), disabled: refreshing, onClick: onRefresh, children: refreshing ? "刷新中" : "刷新" }),
1249
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives5.Button, { variant: "outline", size: "sm", icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives5.IconPlusOutlineRegular, {}), disabled: disabled || busy === "group:new", onClick: () => {
1250
- void add();
1251
- }, children: "添加分组" })
1252
- ] }),
1253
- applyError && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "wcb-banner", "data-tone": "danger", role: "status", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "wcb-banner-body", children: applyError }) }) }),
1254
- !view ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Empty, { children: error ?? state?.routingError ?? "正在读取分组信息…" }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "wcb-groups", children: view.groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1255
- GroupPanel,
1256
- {
1257
- group,
1258
- state,
1259
- startEditing: group.id === freshId,
1260
- disabled: disabled || busy.startsWith(`group:${group.id}`),
1261
- onApply: apply2,
1262
- onChanged,
1263
- onOpenSession
1264
- },
1265
- group.id
1266
- )) })
1267
- ]
1268
- }
1269
- );
1270
- }
1271
- function draftOf(group) {
1272
- return {
1273
- name: group.name,
1274
- workspace: group.workspace,
1275
- provider: group.provider,
1276
- model: group.model,
1277
- effort: group.reasoningEffort ?? "",
1278
- preset: group.preset
1279
- };
1280
- }
1281
- function patchOf(group, draft) {
1282
- const patch = {};
1283
- const name = draft.name.trim();
1284
- if (name && name !== group.name) patch.name = name;
1285
- if (draft.workspace !== group.workspace) patch.workspace = draft.workspace;
1286
- if (draft.provider !== group.provider || draft.model !== group.model) {
1287
- patch.provider = draft.provider;
1288
- patch.model = draft.model;
1289
- patch.reasoningEffort = "";
1290
- } else if (draft.effort !== (group.reasoningEffort ?? "")) {
1291
- patch.reasoningEffort = draft.effort;
1292
- }
1293
- if (draft.preset !== group.preset) patch.preset = draft.preset;
1294
- return patch;
1295
- }
1296
- function GroupPanel({ group, state, startEditing, disabled, onApply, onChanged, onOpenSession }) {
1297
- const [open, setOpen] = (0, import_react6.useState)(startEditing);
1298
- const [editing, setEditing] = (0, import_react6.useState)(startEditing);
1299
- const [draft, setDraft] = (0, import_react6.useState)(() => draftOf(group));
1300
- const [confirming, setConfirming] = (0, import_react6.useState)(false);
1301
- const catalog = state?.models;
1302
- const presets = state?.presets;
1303
- const workspaces = state?.workspaces ?? [];
1304
- const key = `group:${group.id}`;
1305
- const effort = group.reasoningEffort ? effortLabel(catalog, {
1306
- provider: group.effectiveProvider,
1307
- model: group.effectiveModel,
1308
- reasoningEffort: group.reasoningEffort
1309
- }) || group.reasoningEffort : "默认";
1310
- const facts = [
1311
- { key: "members", label: "成员", value: `${group.memberCount} 位` },
1312
- { key: "workspace", label: "Workspace", value: group.workspaceTitle, title: group.workspacePath },
1313
- { key: "model", label: "模型", value: groupModelSummary(catalog, group) },
1314
- { key: "effort", label: "effort", value: effort },
1315
- { key: "preset", label: "preset", value: presetSummaryLabel(presets, group.preset) }
1316
- ];
1317
- (0, import_react6.useEffect)(() => {
1318
- if (!editing) setDraft(draftOf(group));
1319
- }, [group, editing]);
1320
- const efforts = effortsFor(catalog, draft.provider || group.effectiveProvider, draft.model || group.effectiveModel);
1321
- const update = (patch) => setDraft((current) => ({ ...current, ...patch }));
1322
- const startEdit = () => {
1323
- setDraft(draftOf(group));
1324
- setEditing(true);
1325
- setOpen(true);
1326
- };
1327
- const save = async () => {
1328
- const patch = patchOf(group, draft);
1329
- if (!Object.keys(patch).length) {
1330
- setEditing(false);
1331
- return;
1332
- }
1333
- const response = await onApply(key, [updateGroup(group.id, patch)]);
1334
- if (response) setEditing(false);
1335
- };
1336
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1337
- Collapse,
1338
- {
1339
- open,
1340
- onToggle: () => setOpen((value) => !value),
1341
- title: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1342
- group.name,
1343
- group.isDefault && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives5.Tag, { tone: "quiet", children: "默认" })
1344
- ] }),
1345
- facts,
1346
- actions: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1347
- editing ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1348
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives5.Button, { variant: "ghost", size: "sm", disabled, onClick: () => {
1349
- setEditing(false);
1350
- setDraft(draftOf(group));
1351
- }, children: "取消" }),
1352
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives5.Button, { variant: "primary", size: "sm", disabled, onClick: () => {
1353
- void save();
1354
- }, children: "保存" })
1355
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives5.Button, { variant: "outline", size: "sm", disabled, "aria-label": `编辑 ${group.name}`, onClick: startEdit, children: "编辑" }),
1356
- !group.isDefault && (confirming ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1357
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives5.Button, { variant: "ghost", size: "sm", disabled, onClick: () => setConfirming(false), children: "取消" }),
1358
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1359
- import_dsh_client_ui_primitives5.Button,
1360
- {
1361
- variant: "outline",
1362
- size: "sm",
1363
- icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives5.IconTrashOutlineRegular, {}),
1364
- disabled,
1365
- onClick: () => {
1366
- void onApply(key, [deleteGroup(group.id)]);
1367
- },
1368
- children: "确认删除"
1369
- }
1370
- )
1371
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives5.Button, { variant: "outline", size: "sm", icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives5.IconTrashOutlineRegular, {}), disabled, onClick: () => setConfirming(true), children: "删除分组" }))
1230
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "wcb-spacer" }),
1231
+ save.saved && !open && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "wcb-saved", role: "status", children: "已保存。" }),
1232
+ !open && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives4.Button, { variant: "outline", size: "sm", disabled, "aria-label": "编辑连接", onClick: () => setEditing(true), children: "编辑" })
1233
+ ] }),
1234
+ detail && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "wcb-status-detail", "data-tone": error ? "error" : phase?.tone, children: detail }),
1235
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "wcb-kvs", children: [
1236
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "wcb-kv", children: [
1237
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "wcb-kv-label", children: "Bot ID" }),
1238
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "wcb-kv-value wcb-mono", children: base.botId || "未填写" })
1372
1239
  ] }),
1373
- children: [
1374
- editing && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "wcb-binding-controls", children: [
1375
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "wcb-binding-field", children: [
1376
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "wcb-binding-label", children: "分组名称" }),
1240
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "wcb-kv", children: [
1241
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "wcb-kv-label", children: "Bot Secret" }),
1242
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "wcb-kv-value", children: status.configured ? "已保存" : "未设置" })
1243
+ ] })
1244
+ ] }),
1245
+ state && state.connection.phase !== "unconfigured" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Traffic, { traffic: state.traffic }),
1246
+ open && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Editor, { children: [
1247
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Field, { label: "Bot ID", error: errors.botId, hint: "在企业微信管理后台 → 智能机器人 → API 模式(长连接)中获取。", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1248
+ import_dsh_client_ui_primitives4.Input,
1249
+ {
1250
+ className: "wcb-input",
1251
+ value: botId,
1252
+ placeholder: "例如 aib0xxxxxxxxxxxx",
1253
+ spellCheck: false,
1254
+ autoComplete: "off",
1255
+ disabled,
1256
+ "aria-label": "Bot ID",
1257
+ onChange: (event) => setBotId(event.target.value)
1258
+ }
1259
+ ) }),
1260
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1261
+ Field,
1262
+ {
1263
+ label: "Bot Secret",
1264
+ error: errors.secret ?? secretError,
1265
+ hint: status.configured ? `已保存在 DSH 凭据库(${base.secretEnv}),不会回显;留空则保持不变。` : `保存在 DSH 凭据库(${base.secretEnv}),不会写入插件配置。`,
1266
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "wcb-input-row", children: [
1377
1267
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1378
- import_dsh_client_ui_primitives5.Input,
1379
- {
1380
- value: draft.name,
1381
- disabled,
1382
- "aria-label": `${group.name} 的名称`,
1383
- onChange: (event) => update({ name: event.target.value })
1384
- }
1385
- )
1386
- ] }),
1387
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "wcb-binding-field", children: [
1388
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "wcb-binding-label", children: "Workspace" }),
1389
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1390
- Select,
1268
+ import_dsh_client_ui_primitives4.Input,
1391
1269
  {
1392
- value: draft.workspace,
1270
+ className: "wcb-input",
1271
+ type: reveal ? "text" : "password",
1272
+ value: secret,
1273
+ placeholder: status.configured ? "输入新值以替换" : "粘贴 Bot Secret",
1274
+ autoComplete: "new-password",
1275
+ spellCheck: false,
1393
1276
  disabled,
1394
- "aria-label": `${group.name} 的 Workspace`,
1395
- onChange: (event) => update({ workspace: event.target.value }),
1396
- children: [
1397
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("option", { value: "", children: [
1398
- "插件自带(",
1399
- displayPath(workspaces.find((workspace) => workspace.pluginOwned)?.path),
1400
- ")"
1401
- ] }),
1402
- workspaces.map((workspace) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("option", { value: workspace.path, children: [
1403
- workspace.title,
1404
- " — ",
1405
- displayPath(workspace.path)
1406
- ] }, workspace.path)),
1407
- draft.workspace && !workspaces.some((workspace) => workspace.path === draft.workspace) && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("option", { value: draft.workspace, children: [
1408
- displayPath(draft.workspace),
1409
- "(未注册)"
1410
- ] })
1411
- ]
1412
- }
1413
- )
1414
- ] }),
1415
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "wcb-binding-field", children: [
1416
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "wcb-binding-label", children: "模型" }),
1417
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1418
- Select,
1419
- {
1420
- value: modelKey(draft.provider, draft.model),
1421
- disabled: disabled || !catalog,
1422
- "aria-label": `${group.name} 的模型`,
1423
- onChange: (event) => {
1424
- const next = parseModelKey(event.target.value);
1425
- update({ provider: next.provider, model: next.model, effort: "" });
1426
- },
1427
- children: [
1428
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "", children: dshDefaultLabel(catalog) }),
1429
- (catalog?.choices ?? []).map((choice) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("option", { value: modelKey(choice.provider, choice.model), children: [
1430
- choice.providerName,
1431
- " / ",
1432
- choiceLabel(choice)
1433
- ] }, modelKey(choice.provider, choice.model)))
1434
- ]
1435
- }
1436
- )
1437
- ] }),
1438
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "wcb-binding-field", children: [
1439
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "wcb-binding-label", children: "effort(思考强度)" }),
1440
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1441
- Select,
1442
- {
1443
- value: draft.effort,
1444
- disabled: disabled || !efforts.length || !(draft.provider || draft.model),
1445
- "aria-label": `${group.name} 的 effort`,
1446
- onChange: (event) => update({ effort: event.target.value }),
1447
- children: [
1448
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "", children: "默认" }),
1449
- efforts.map((item) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: item.id, children: item.name }, item.id))
1450
- ]
1277
+ "aria-label": "Bot Secret",
1278
+ onChange: (event) => setSecret(event.target.value)
1451
1279
  }
1452
- )
1453
- ] }),
1454
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "wcb-binding-field", children: [
1455
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "wcb-binding-label", children: "preset" }),
1456
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1457
- Select,
1458
- {
1459
- value: draft.preset,
1460
- disabled: disabled || !presets?.presets.length,
1461
- "aria-label": `${group.name} 的 preset`,
1462
- onChange: (event) => update({ preset: event.target.value }),
1463
- children: [
1464
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "", children: presetLabel(presets, "") }),
1465
- (presets?.presets ?? []).map((preset) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("option", { value: preset.id, children: [
1466
- presetName(preset),
1467
- preset.broken ? "(不可用)" : ""
1468
- ] }, preset.id))
1469
- ]
1470
- }
1471
- )
1280
+ ),
1281
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives4.Button, { variant: "outline", size: "sm", disabled: !secret, onClick: () => setReveal((value) => !value), children: reveal ? "隐藏" : "显示" })
1472
1282
  ] })
1473
- ] }),
1474
- editing && (!efforts.length || !presets?.presets.length) && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "wcb-hint", children: [
1475
- !efforts.length && "当前模型没有可选的 effort:先选一个支持思考强度的模型,或让 DSH 默认模型决定。",
1476
- !efforts.length && !presets?.presets.length && " ",
1477
- !presets?.presets.length && `没有读到 DSH 的 preset 列表${state?.presetsError ? `:${state.presetsError}` : "(这个部署没有挂载 preset registry)"}。`
1478
- ] }),
1479
- group.workspaceError && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "wcb-hint wcb-inline-error", children: group.workspaceError }),
1480
- editing && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "wcb-hint", children: "更换 Workspace 后,本组成员的会话会在下一条消息时重新创建。模型与 effort 是本组默认值,不覆盖成员为当前会话单独选择的模型; preset 只影响此后新建的会话(DSH 不允许改写已经开始的会话)。" }),
1481
- group.members.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Empty, { children: "这个分组还没有成员。让对方先给机器人发一条消息,然后在「未授权用户」里把 TA 加入本组。" }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "wcb-members-scroll", tabIndex: 0, role: "region", "aria-label": `${group.name} 成员表格,可横向滚动`, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("table", { className: "wcb-members-table", "aria-label": `${group.name} 的成员`, children: [
1482
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tr", { children: ["成员", "会话", "preset", "模型", "effort", "上下文", "操作"].map((label) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("th", { scope: "col", children: label }, label)) }) }),
1483
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tbody", { children: group.members.map((member) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1484
- MemberRow,
1485
- {
1486
- member,
1487
- group,
1488
- groups: state?.routing?.groups ?? [],
1489
- state,
1490
- disabled,
1491
- onChanged,
1492
- onOpenSession
1493
- },
1494
- `${member.key}:${member.sessionId}`
1495
- )) })
1496
- ] }) })
1497
- ]
1498
- }
1499
- );
1283
+ }
1284
+ ),
1285
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(FormFooter, { message: save.error, tone: save.error ? "error" : void 0, children: [
1286
+ !incomplete && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives4.Button, { variant: "ghost", size: "sm", disabled: save.saving, onClick: close, children: "取消" }),
1287
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives4.Button, { variant: "primary", size: "sm", disabled: disabled || save.saving || !dirty, onClick: () => {
1288
+ void onSave();
1289
+ }, children: save.saving ? "保存中…" : "保存" })
1290
+ ] })
1291
+ ] })
1292
+ ] }) }) });
1293
+ }
1294
+ function Traffic({ traffic }) {
1295
+ if (!traffic.received && !traffic.notifications) {
1296
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "wcb-hint", children: "本次启动以来还没有收到消息。" });
1297
+ }
1298
+ const items = [
1299
+ ["收到", traffic.received],
1300
+ ["拒绝", traffic.rejected],
1301
+ ["提交", traffic.prompts],
1302
+ ["通知", traffic.notifications]
1303
+ ];
1304
+ if (traffic.failures) items.push(["失败", traffic.failures]);
1305
+ if (traffic.lastMessageAt) items.push(["最近消息", relativeTime(traffic.lastMessageAt)]);
1306
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "wcb-kvs", "aria-label": "本次 DSH 启动以来的统计", children: [
1307
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "wcb-kv-label", children: "本次启动以来" }),
1308
+ items.map(([label, value]) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "wcb-kv", children: [
1309
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "wcb-kv-label", children: label }),
1310
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "wcb-kv-value", children: value })
1311
+ ] }, label))
1312
+ ] });
1313
+ }
1314
+
1315
+ // src/client/components/GroupsSection.tsx
1316
+ var import_react7 = require("react");
1317
+ var import_dsh_client_ui_primitives6 = require("@deepseek-ai/dsh-client-ui-primitives");
1318
+
1319
+ // src/client/components/MembersTable.tsx
1320
+ var import_react6 = require("react");
1321
+ var import_dsh_client_ui_primitives5 = require("@deepseek-ai/dsh-client-ui-primitives");
1322
+ var import_jsx_runtime6 = require("react/jsx-runtime");
1323
+ var COLUMNS = ["成员", "会话", "模型", "推理等级", "上下文"];
1324
+ function MembersTable({ group, groups, state, disabled, onChanged, onOpenSession }) {
1325
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "wcb-table-scroll", tabIndex: 0, role: "region", "aria-label": `${group.name} 成员表格,可横向滚动`, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("table", { className: "wcb-table", "aria-label": `${group.name} 的成员`, children: [
1326
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("colgroup", { children: [
1327
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("col", {}),
1328
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("col", { className: "wcb-col-session" }),
1329
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("col", { className: "wcb-col-model" }),
1330
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("col", { className: "wcb-col-effort" }),
1331
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("col", { className: "wcb-col-context" })
1332
+ ] }),
1333
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("tr", { children: COLUMNS.map((label) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("th", { scope: "col", children: label }, label)) }) }),
1334
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("tbody", { children: group.members.map((member) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1335
+ MemberRow,
1336
+ {
1337
+ member,
1338
+ group,
1339
+ groups,
1340
+ state,
1341
+ disabled,
1342
+ onChanged,
1343
+ onOpenSession
1344
+ },
1345
+ `${member.key}:${member.sessionId}`
1346
+ )) })
1347
+ ] }) });
1500
1348
  }
1501
1349
  function MemberRow({ member, group, groups, state, disabled, onChanged, onOpenSession }) {
1502
1350
  const [details, setDetails] = (0, import_react6.useState)(false);
1503
- const [archiving, setArchiving] = (0, import_react6.useState)(false);
1504
1351
  const [sessionOpen, setSessionOpen] = (0, import_react6.useState)(false);
1505
1352
  const [navigationError, setNavigationError] = (0, import_react6.useState)();
1506
1353
  const pending = (0, import_react6.useRef)(false);
@@ -1515,7 +1362,7 @@ window.__ModuleLoader__.load({
1515
1362
  const sessionInfo = `会话:${sessionTitle}
1516
1363
  Session ID:${member.sessionId}`;
1517
1364
  const error = write.error ?? navigationError;
1518
- const apply2 = async (_key, ops) => {
1365
+ const apply2 = async (ops) => {
1519
1366
  if (disabled || pending.current) return void 0;
1520
1367
  pending.current = true;
1521
1368
  setNavigationError(void 0);
@@ -1535,10 +1382,6 @@ window.__ModuleLoader__.load({
1535
1382
  setNavigationError(cause instanceof Error ? cause.message : String(cause));
1536
1383
  }
1537
1384
  };
1538
- const showSession = () => {
1539
- setNavigationError(void 0);
1540
- setSessionOpen(true);
1541
- };
1542
1385
  const closeSession = () => {
1543
1386
  if (pending.current) return;
1544
1387
  setSessionOpen(false);
@@ -1548,23 +1391,22 @@ window.__ModuleLoader__.load({
1548
1391
  const next = parseModelKey(value);
1549
1392
  if (!usable || !next.provider || !next.model) return;
1550
1393
  if (next.provider === selection?.provider && next.model === selection?.model) return;
1551
- await apply2(member.key, [setMemberModel(member.key, member.sessionId, next)]);
1394
+ await apply2([setMemberModel(member.key, member.sessionId, next)]);
1552
1395
  };
1553
1396
  const changeEffort = async (value) => {
1554
1397
  if (!usable || !selection || value && !efforts.some((item) => item.id === value)) return;
1555
1398
  if (value === (selection.reasoningEffort ?? "")) return;
1556
1399
  const next = { provider: selection.provider, model: selection.model, ...value ? { reasoningEffort: value } : {} };
1557
- await apply2(member.key, [setMemberModel(member.key, member.sessionId, next)]);
1400
+ await apply2([setMemberModel(member.key, member.sessionId, next)]);
1558
1401
  };
1559
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1560
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("tr", { className: "wcb-member-row", "aria-busy": Boolean(write.busy), children: [
1561
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("td", { children: [
1562
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "wcb-member-identity", children: [
1563
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PersonAvatar, { kind: member.kind, label: `${name} 的详情`, disabled: blocked, onClick: () => setDetails(true) }),
1564
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "wcb-member-name", title: name, children: name }),
1565
- member.admin && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives5.Tag, { tone: "success", children: "管理员" })
1402
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1403
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("tr", { className: "wcb-member-row", "aria-busy": Boolean(write.busy), children: [
1404
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("td", { children: [
1405
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "wcb-identity", children: [
1406
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PersonButton, { kind: member.kind, name, label: `${name} 的详情`, disabled: blocked, onClick: () => setDetails(true) }),
1407
+ member.admin && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives5.Tag, { tone: "neutral", children: "管理员" })
1566
1408
  ] }),
1567
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1409
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1568
1410
  PersonDialog,
1569
1411
  {
1570
1412
  open: details,
@@ -1572,55 +1414,60 @@ window.__ModuleLoader__.load({
1572
1414
  if (!pending.current) setDetails(false);
1573
1415
  },
1574
1416
  title: name,
1417
+ kind: member.kind,
1575
1418
  id: member.id,
1576
- label: member.label,
1419
+ note: member.label,
1577
1420
  noteLabel: `${member.id} 的备注`,
1578
1421
  disabled: blocked,
1579
1422
  onNote: (next) => {
1580
- void apply2(member.key, [setLabel(member.key, next)]);
1423
+ void apply2([setLabel(member.key, next)]);
1581
1424
  },
1582
- footer: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RemoveMember, { member, disabled: blocked, onApply: apply2 }),
1583
- children: [
1584
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "wcb-binding-field", children: [
1585
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "wcb-binding-label", children: "所属分组" }),
1586
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1587
- Select,
1588
- {
1589
- value: group.id,
1590
- disabled: blocked,
1591
- "aria-label": `${member.id} 的所属分组`,
1592
- onChange: (event) => {
1593
- const groupId = event.target.value;
1594
- if (!groupId || groupId === group.id) return;
1595
- void apply2(member.key, [updateMember(member.key, { groupId })]);
1596
- },
1597
- children: groups.map((item) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: item.id, children: item.name }, item.id))
1598
- }
1599
- ),
1600
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "wcb-hint", children: "切换后解除当前绑定,恢复目标分组原有的可用会话;没有可恢复会话时,下一条消息按目标组配置创建。" })
1601
- ] }),
1602
- write.error && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "wcb-field-error", role: "alert", children: write.error })
1603
- ]
1425
+ hint: "备注会代替企业微信 ID 显示,移出分组后仍保留。切换分组时,目标分组里有 TA 之前的会话就恢复,否则下一条消息新建。",
1426
+ error: write.error,
1427
+ footer: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1428
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(RemoveMember, { member, disabled: blocked, onApply: apply2 }),
1429
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives5.Button, { variant: "primary", size: "sm", onClick: () => {
1430
+ if (!pending.current) setDetails(false);
1431
+ }, children: "完成" })
1432
+ ] }),
1433
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FactRow, { label: "所属分组", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1434
+ Select,
1435
+ {
1436
+ value: group.id,
1437
+ disabled: blocked,
1438
+ "aria-label": `${member.id} 的所属分组`,
1439
+ onChange: (event) => {
1440
+ const groupId = event.target.value;
1441
+ if (!groupId || groupId === group.id) return;
1442
+ void apply2([updateMember(member.key, { groupId })]);
1443
+ },
1444
+ children: groups.map((item) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: item.id, children: item.name }, item.id))
1445
+ }
1446
+ ) })
1604
1447
  }
1605
1448
  )
1606
1449
  ] }),
1607
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { children: usable ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1608
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1450
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("td", { children: usable ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1451
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1609
1452
  "button",
1610
1453
  {
1611
1454
  type: "button",
1612
- className: "wcb-cell-pill",
1455
+ className: "wcb-session",
1456
+ "data-running": member.sessionRunning ? "" : void 0,
1613
1457
  title: sessionInfo,
1614
1458
  "aria-label": `查看 ${name} 的会话详情`,
1615
- onClick: showSession,
1459
+ onClick: () => {
1460
+ setNavigationError(void 0);
1461
+ setSessionOpen(true);
1462
+ },
1616
1463
  children: [
1617
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives5.StateDot, { state: member.sessionRunning ? "ongoing" : "idle", size: 8 }),
1618
- member.sessionState === "blank" ? "待使用" : "已绑定",
1619
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "wcb-cell-pill-chevron", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives5.IconChevronRightOutlineRegular, { size: 11 }) })
1464
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives5.StateDot, { state: member.sessionRunning ? "ongoing" : "idle", size: 8 }),
1465
+ sessionActivity(member),
1466
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "wcb-session-chevron", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IconChevronRight, { size: 10 }) })
1620
1467
  ]
1621
1468
  }
1622
1469
  ),
1623
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1470
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1624
1471
  SessionDialog,
1625
1472
  {
1626
1473
  open: sessionOpen,
@@ -1630,37 +1477,42 @@ window.__ModuleLoader__.load({
1630
1477
  id: member.sessionId,
1631
1478
  running: member.sessionRunning,
1632
1479
  blank: member.sessionState === "blank",
1480
+ preset: member.sessionPreset ? presetLabel(state?.presets, member.sessionPreset) : "—",
1481
+ context: member.sessionContext,
1633
1482
  disabled: Boolean(write.busy),
1634
- error: navigationError,
1483
+ error,
1635
1484
  onOpen: () => {
1636
1485
  void openSession();
1486
+ },
1487
+ onArchive: async () => {
1488
+ const result = await apply2([archiveMember(member.key)]);
1489
+ if (result) setSessionOpen(false);
1490
+ return Boolean(result);
1637
1491
  }
1638
1492
  }
1639
1493
  )
1640
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "wcb-muted", title: member.sessionId ? sessionInfo : void 0, children: SESSION_STATE_LABEL[member.sessionState] }) }),
1641
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { children: member.sessionPreset ? presetLabel(state?.presets, member.sessionPreset) : "—" }),
1642
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { children: usable ? (
1643
- // Always a select: one click opens the list. The previous
1644
- // click-to-swap-a-button behaviour needed a second click, because
1645
- // an autofocused select does not open its popup by itself.
1646
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1494
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "wcb-muted", title: member.sessionId ? sessionInfo : void 0, children: SESSION_STATE_LABEL[member.sessionState] }) }),
1495
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("td", { children: usable ? (
1496
+ // Always a select: one click opens the list. Only this Session
1497
+ // changes; new Sessions keep using the group's default.
1498
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1647
1499
  Select,
1648
1500
  {
1649
- className: "wcb-cell-select",
1501
+ compact: true,
1650
1502
  value: modelKey(selection?.provider ?? "", selection?.model ?? ""),
1651
1503
  disabled: blocked || !catalog?.choices.length,
1652
1504
  "aria-label": `${member.id} 当前会话的模型`,
1653
- title: "只修改当前会话;新会话仍使用分组默认模型",
1505
+ title: "只修改当前会话;新会话仍使用分组的默认模型",
1654
1506
  onChange: (event) => {
1655
1507
  void changeModel(event.target.value);
1656
1508
  },
1657
1509
  children: [
1658
- !selection && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "", disabled: true, children: "请选择模型" }),
1659
- selection && !catalog?.choices.some((item) => item.provider === selection.provider && item.model === selection.model) && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("option", { value: modelKey(selection.provider, selection.model), children: [
1510
+ !selection && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "", disabled: true, children: "请选择模型" }),
1511
+ selection && !catalog?.choices.some((item) => item.provider === selection.provider && item.model === selection.model) && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("option", { value: modelKey(selection.provider, selection.model), children: [
1660
1512
  modelName(catalog, selection),
1661
1513
  "(当前)"
1662
1514
  ] }),
1663
- (catalog?.choices ?? []).map((choice) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1515
+ (catalog?.choices ?? []).map((choice) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1664
1516
  "option",
1665
1517
  {
1666
1518
  value: modelKey(choice.provider, choice.model),
@@ -1672,78 +1524,42 @@ window.__ModuleLoader__.load({
1672
1524
  ]
1673
1525
  }
1674
1526
  )
1675
- ) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "wcb-muted", children: "—" }) }),
1676
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { children: usable && selection ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1527
+ ) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "wcb-muted", children: "—" }) }),
1528
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("td", { children: usable && selection ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1677
1529
  Select,
1678
1530
  {
1679
- className: "wcb-cell-select",
1531
+ compact: true,
1680
1532
  value: selection.reasoningEffort ?? "",
1681
1533
  disabled: blocked || !efforts.length,
1682
- "aria-label": `${member.id} 当前会话的 effort`,
1683
- title: efforts.length ? "只修改当前会话的思考强度" : "当前模型没有可选的思考强度",
1534
+ "aria-label": `${member.id} 当前会话的推理等级`,
1535
+ title: efforts.length ? "只修改当前会话的推理等级" : "当前模型没有可调的推理等级",
1684
1536
  onChange: (event) => {
1685
1537
  void changeEffort(event.target.value);
1686
1538
  },
1687
1539
  children: [
1688
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "", children: "默认" }),
1689
- efforts.map((item) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: item.id, children: item.name }, item.id))
1540
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "", children: "默认" }),
1541
+ efforts.map((item) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: item.id, children: item.name }, item.id))
1690
1542
  ]
1691
1543
  }
1692
- ) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "wcb-muted", children: "—" }) }),
1693
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { className: "wcb-context-cell", children: contextLabel(member.sessionContext) || "—" }),
1694
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("td", { children: [
1695
- member.sessionId && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1696
- import_dsh_client_ui_primitives5.Button,
1697
- {
1698
- variant: "outline",
1699
- size: "sm",
1700
- icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives5.IconTrashOutlineRegular, {}),
1701
- disabled: blocked,
1702
- "aria-label": `归档 ${name} 的会话`,
1703
- onClick: () => setArchiving(true),
1704
- children: "归档会话"
1705
- }
1706
- ),
1707
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1708
- ConfirmDialog,
1709
- {
1710
- open: archiving,
1711
- title: `归档「${name}」的会话?`,
1712
- confirmLabel: "确认归档",
1713
- busy: Boolean(write.busy),
1714
- disabled,
1715
- onCancel: () => {
1716
- if (!pending.current) setArchiving(false);
1717
- },
1718
- onConfirm: () => {
1719
- void apply2(member.key, [archiveMember(member.key)]).then((result) => {
1720
- if (result) setArchiving(false);
1721
- });
1722
- },
1723
- children: [
1724
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: "归档后这个会话不再被继续,它的历史不会再进入任何请求;下一条消息会按分组当前的 Workspace、模型与 preset 新建一个会话。DSH 的会话文件仍保留在磁盘上,需要时可到 DSH 页面查看。" }),
1725
- write.error && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "wcb-field-error", role: "alert", children: write.error })
1726
- ]
1727
- }
1728
- )
1729
- ] })
1544
+ ) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "wcb-muted", children: "—" }) }),
1545
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ContextMeter, { context: member.sessionContext }) })
1730
1546
  ] }),
1731
- error && !details && !archiving && !sessionOpen && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tr", { className: "wcb-member-error", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { colSpan: 7, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "wcb-field-error", role: "alert", children: error }) }) })
1547
+ error && !details && !sessionOpen && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("tr", { className: "wcb-member-error", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("td", { colSpan: COLUMNS.length, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "wcb-error", role: "alert", children: error }) }) })
1732
1548
  ] });
1733
1549
  }
1734
1550
  function RemoveMember({ member, disabled, onApply }) {
1735
1551
  const [confirming, setConfirming] = (0, import_react6.useState)(false);
1736
- return confirming ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1737
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives5.Button, { variant: "ghost", size: "sm", disabled, onClick: () => setConfirming(false), children: "取消" }),
1738
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1552
+ return confirming ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "wcb-footer-start", children: [
1553
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives5.Button, { variant: "ghost", size: "sm", disabled, onClick: () => setConfirming(false), children: "取消" }),
1554
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1739
1555
  import_dsh_client_ui_primitives5.Button,
1740
1556
  {
1741
1557
  variant: "outline",
1742
1558
  size: "sm",
1743
- icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives5.IconTrashOutlineRegular, {}),
1559
+ className: "wcb-danger",
1744
1560
  disabled,
1745
1561
  onClick: () => {
1746
- void onApply(member.key, [removeMember(member.key)]);
1562
+ void onApply([removeMember(member.key)]);
1747
1563
  },
1748
1564
  children: [
1749
1565
  "确认移出「",
@@ -1752,36 +1568,299 @@ window.__ModuleLoader__.load({
1752
1568
  ]
1753
1569
  }
1754
1570
  )
1755
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives5.Button, { variant: "outline", size: "sm", icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives5.IconTrashOutlineRegular, {}), disabled, onClick: () => setConfirming(true), children: "移出分组" });
1571
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives5.Button, { variant: "outline", size: "sm", className: "wcb-danger wcb-footer-start", disabled, onClick: () => setConfirming(true), children: "移出分组" });
1756
1572
  }
1757
1573
 
1758
- // src/client/components/RejectedCard.tsx
1759
- var import_react7 = require("react");
1760
- var import_dsh_client_ui_primitives6 = require("@deepseek-ai/dsh-client-ui-primitives");
1761
- var import_jsx_runtime6 = require("react/jsx-runtime");
1762
- function RejectedCard({ state, disabled, onChanged }) {
1574
+ // src/client/components/GroupsSection.tsx
1575
+ var import_jsx_runtime7 = require("react/jsx-runtime");
1576
+ function GroupsSection({ state, error, disabled, refreshing, onRefresh, onChanged, onOpenSession }) {
1577
+ const { busy, error: applyError, apply: apply2 } = useStoreApply(onChanged);
1578
+ const [freshId, setFreshId] = (0, import_react7.useState)();
1579
+ const view = state?.routing;
1580
+ (0, import_react7.useEffect)(() => {
1581
+ if (freshId && view?.groups.some((group) => group.id === freshId)) setFreshId(void 0);
1582
+ }, [freshId, view]);
1583
+ const add = async () => {
1584
+ const response = await apply2("group:new", [addGroup()]);
1585
+ if (response?.createdGroupId) setFreshId(response.createdGroupId);
1586
+ };
1587
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1588
+ Section,
1589
+ {
1590
+ id: "groups",
1591
+ title: "用户分组",
1592
+ count: view ? `${view.groups.length} 个分组 · ${view.total} 位成员` : void 0,
1593
+ description: "分组决定成员使用的工作区、模型与 Agent 预设;每位成员(单聊的人或一个群聊)各有自己的会话。",
1594
+ actions: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
1595
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dsh_client_ui_primitives6.Button, { variant: "ghost", size: "sm", icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(IconRefresh, { size: 14 }), disabled: refreshing, title: "重新读取会话状态", onClick: onRefresh, children: refreshing ? "刷新中" : "刷新" }),
1596
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dsh_client_ui_primitives6.Button, { variant: "outline", size: "sm", icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(IconPlus, { size: 14 }), disabled: disabled || busy === "group:new", onClick: () => {
1597
+ void add();
1598
+ }, children: "添加分组" })
1599
+ ] }),
1600
+ children: [
1601
+ applyError && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Notice, { tone: "error", children: applyError }),
1602
+ !view ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "wcb-empty-line", children: error ?? state?.routingError ?? "正在读取分组…" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "wcb-groups", children: view.groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1603
+ GroupCard,
1604
+ {
1605
+ group,
1606
+ state,
1607
+ startEditing: group.id === freshId,
1608
+ startOpen: view.groups.length === 1,
1609
+ disabled: disabled || busy.startsWith(`group:${group.id}`),
1610
+ onApply: apply2,
1611
+ onChanged,
1612
+ onOpenSession
1613
+ },
1614
+ group.id
1615
+ )) }),
1616
+ view && view.total === 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "wcb-empty-line", children: "还没有成员:让对方先给机器人发一条消息,再在「待授权」中把 TA 加入分组。" })
1617
+ ]
1618
+ }
1619
+ );
1620
+ }
1621
+ function draftOf(group) {
1622
+ return {
1623
+ name: group.name,
1624
+ workspace: group.workspace,
1625
+ provider: group.provider,
1626
+ model: group.model,
1627
+ effort: group.reasoningEffort ?? "",
1628
+ preset: group.preset
1629
+ };
1630
+ }
1631
+ function patchOf(group, draft) {
1632
+ const patch = {};
1633
+ const name = draft.name.trim();
1634
+ if (name && name !== group.name) patch.name = name;
1635
+ if (draft.workspace !== group.workspace) patch.workspace = draft.workspace;
1636
+ if (draft.provider !== group.provider || draft.model !== group.model) {
1637
+ patch.provider = draft.provider;
1638
+ patch.model = draft.model;
1639
+ patch.reasoningEffort = "";
1640
+ } else if (draft.effort !== (group.reasoningEffort ?? "")) {
1641
+ patch.reasoningEffort = draft.effort;
1642
+ }
1643
+ if (draft.preset !== group.preset) patch.preset = draft.preset;
1644
+ return patch;
1645
+ }
1646
+ function GroupCard({ group, state, startEditing, startOpen, disabled, onApply, onChanged, onOpenSession }) {
1647
+ const [open, setOpen] = (0, import_react7.useState)(startEditing || startOpen);
1648
+ const [editing, setEditing] = (0, import_react7.useState)(startEditing);
1649
+ const [draft, setDraft] = (0, import_react7.useState)(() => draftOf(group));
1650
+ const [deleting, setDeleting] = (0, import_react7.useState)(false);
1651
+ const catalog = state?.models;
1652
+ const presets = state?.presets;
1653
+ const workspaces = state?.workspaces ?? [];
1654
+ const key = `group:${group.id}`;
1655
+ const facts = groupFacts(group, catalog, presets);
1656
+ (0, import_react7.useEffect)(() => {
1657
+ if (!editing) setDraft(draftOf(group));
1658
+ }, [group, editing]);
1659
+ const efforts = effortsFor(catalog, draft.provider || group.effectiveProvider, draft.model || group.effectiveModel);
1660
+ const update = (patch2) => setDraft((current) => ({ ...current, ...patch2 }));
1661
+ const patch = patchOf(group, draft);
1662
+ const changed = Object.keys(patch).length > 0;
1663
+ const modelChanged = draft.provider !== group.provider || draft.model !== group.model || draft.effort !== (group.reasoningEffort ?? "");
1664
+ const roster = presets?.presets ?? [];
1665
+ const startEdit = () => {
1666
+ setDraft(draftOf(group));
1667
+ setEditing(true);
1668
+ setOpen(true);
1669
+ };
1670
+ const save = async () => {
1671
+ if (!changed) {
1672
+ setEditing(false);
1673
+ return;
1674
+ }
1675
+ if (await onApply(key, [updateGroup(group.id, patch)])) setEditing(false);
1676
+ };
1677
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "wcb-card wcb-group", "data-open": open ? "" : void 0, children: [
1678
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "wcb-group-head", children: [
1679
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "wcb-group-toggle", "aria-expanded": open, onClick: () => setOpen((value) => !value), children: [
1680
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "wcb-group-title-line", children: [
1681
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "wcb-chevron", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(IconChevronRight, { size: 14 }) }),
1682
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "wcb-group-name", children: group.name }),
1683
+ group.isDefault && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dsh_client_ui_primitives6.Tag, { tone: "neutral", children: "默认" }),
1684
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "wcb-group-count", children: group.memberCount ? `${group.memberCount} 位成员` : "暂无成员" })
1685
+ ] }),
1686
+ !editing && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Facts, { facts, className: "wcb-group-facts" })
1687
+ ] }),
1688
+ !editing && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "wcb-group-actions", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dsh_client_ui_primitives6.Button, { variant: "outline", size: "sm", disabled, "aria-label": `编辑 ${group.name}`, onClick: startEdit, children: "编辑" }) })
1689
+ ] }),
1690
+ group.workspaceError && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "wcb-group-error", role: "alert", children: group.workspaceError }),
1691
+ editing && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Editor, { children: [
1692
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "wcb-editor-grid", children: [
1693
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Field, { label: "名称", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1694
+ import_dsh_client_ui_primitives6.Input,
1695
+ {
1696
+ className: "wcb-input",
1697
+ value: draft.name,
1698
+ disabled,
1699
+ "aria-label": `${group.name} 的名称`,
1700
+ onChange: (event) => update({ name: event.target.value })
1701
+ }
1702
+ ) }),
1703
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Field, { label: "工作区", hint: draft.workspace !== group.workspace ? "保存后,本组成员会在下一条消息时于新工作区中新建会话。" : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1704
+ Select,
1705
+ {
1706
+ value: draft.workspace,
1707
+ disabled,
1708
+ "aria-label": `${group.name} 的工作区`,
1709
+ onChange: (event) => update({ workspace: event.target.value }),
1710
+ children: [
1711
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("option", { value: "", children: [
1712
+ "插件自带(",
1713
+ displayPath(workspaces.find((workspace) => workspace.pluginOwned)?.path),
1714
+ ")"
1715
+ ] }),
1716
+ workspaces.map((workspace) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("option", { value: workspace.path, children: [
1717
+ workspace.title,
1718
+ "(",
1719
+ displayPath(workspace.path),
1720
+ ")"
1721
+ ] }, workspace.path)),
1722
+ draft.workspace && !workspaces.some((workspace) => workspace.path === draft.workspace) && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("option", { value: draft.workspace, children: [
1723
+ displayPath(draft.workspace),
1724
+ "(未注册)"
1725
+ ] })
1726
+ ]
1727
+ }
1728
+ ) }),
1729
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Field, { label: "模型", hint: modelChanged ? "是本组新会话的默认值;为单个会话选过模型的成员不受影响。" : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1730
+ Select,
1731
+ {
1732
+ value: modelKey(draft.provider, draft.model),
1733
+ disabled: disabled || !catalog,
1734
+ "aria-label": `${group.name} 的模型`,
1735
+ onChange: (event) => {
1736
+ const next = parseModelKey(event.target.value);
1737
+ update({ provider: next.provider, model: next.model, effort: "" });
1738
+ },
1739
+ children: [
1740
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "", children: dshDefaultLabel(catalog) }),
1741
+ (catalog?.choices ?? []).map((choice) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("option", { value: modelKey(choice.provider, choice.model), children: [
1742
+ choice.providerName,
1743
+ " / ",
1744
+ choiceLabel(choice)
1745
+ ] }, modelKey(choice.provider, choice.model)))
1746
+ ]
1747
+ }
1748
+ ) }),
1749
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Field, { label: "推理等级", hint: !(draft.provider || draft.model) ? "跟随 DSH 默认模型时,使用它的默认推理等级。" : !efforts.length ? "所选模型没有可调的推理等级。" : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1750
+ Select,
1751
+ {
1752
+ value: draft.effort,
1753
+ disabled: disabled || !efforts.length || !(draft.provider || draft.model),
1754
+ "aria-label": `${group.name} 的推理等级`,
1755
+ onChange: (event) => update({ effort: event.target.value }),
1756
+ children: [
1757
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "", children: "默认" }),
1758
+ efforts.map((item) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: item.id, children: item.name }, item.id))
1759
+ ]
1760
+ }
1761
+ ) }),
1762
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1763
+ Field,
1764
+ {
1765
+ label: "Agent 预设",
1766
+ hint: draft.preset !== group.preset ? "只影响之后新建的会话;已开始的会话无法更换预设。" : !roster.length ? `未读取到预设列表${state?.presetsError ? `:${state.presetsError}` : ""}。` : void 0,
1767
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1768
+ Select,
1769
+ {
1770
+ value: draft.preset,
1771
+ disabled: disabled || !roster.length,
1772
+ "aria-label": `${group.name} 的 Agent 预设`,
1773
+ onChange: (event) => update({ preset: event.target.value }),
1774
+ children: [
1775
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "", children: presetLabel(presets, "") }),
1776
+ roster.map((preset) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("option", { value: preset.id, children: [
1777
+ presetName(preset),
1778
+ preset.broken ? "(加载失败)" : ""
1779
+ ] }, preset.id))
1780
+ ]
1781
+ }
1782
+ )
1783
+ }
1784
+ )
1785
+ ] }),
1786
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(FormFooter, { start: !group.isDefault && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1787
+ import_dsh_client_ui_primitives6.Button,
1788
+ {
1789
+ variant: "outline",
1790
+ size: "sm",
1791
+ className: "wcb-danger",
1792
+ icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(IconTrash, { size: 14 }),
1793
+ disabled,
1794
+ onClick: () => setDeleting(true),
1795
+ children: "删除分组"
1796
+ }
1797
+ ), children: [
1798
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dsh_client_ui_primitives6.Button, { variant: "ghost", size: "sm", disabled, onClick: () => {
1799
+ setEditing(false);
1800
+ setDraft(draftOf(group));
1801
+ }, children: "取消" }),
1802
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dsh_client_ui_primitives6.Button, { variant: "primary", size: "sm", disabled: disabled || !changed, onClick: () => {
1803
+ void save();
1804
+ }, children: "保存" })
1805
+ ] })
1806
+ ] }),
1807
+ open && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "wcb-group-body", children: group.members.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "wcb-empty", children: "这个分组还没有成员。对方给机器人发一条消息后,在「待授权」里把 TA 加入本组。" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1808
+ MembersTable,
1809
+ {
1810
+ group,
1811
+ groups: state?.routing?.groups ?? [],
1812
+ state,
1813
+ disabled,
1814
+ onChanged,
1815
+ onOpenSession
1816
+ }
1817
+ ) }),
1818
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1819
+ ConfirmDialog,
1820
+ {
1821
+ open: deleting,
1822
+ title: `删除分组「${group.name}」?`,
1823
+ confirmLabel: "确认删除",
1824
+ busy: disabled,
1825
+ onCancel: () => setDeleting(false),
1826
+ onConfirm: () => {
1827
+ void onApply(key, [deleteGroup(group.id)]).then((result) => {
1828
+ if (result) setDeleting(false);
1829
+ });
1830
+ },
1831
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("p", { className: "wcb-confirm-text", children: [
1832
+ group.memberCount ? `组内 ${group.memberCount} 位成员会被移出并失去授权,之后需要在「待授权」中重新加入分组。` : "这个分组没有成员。",
1833
+ "DSH 中已有的会话不会被删除。"
1834
+ ] })
1835
+ }
1836
+ )
1837
+ ] });
1838
+ }
1839
+
1840
+ // src/client/components/PendingSection.tsx
1841
+ var import_react8 = require("react");
1842
+ var import_dsh_client_ui_primitives7 = require("@deepseek-ai/dsh-client-ui-primitives");
1843
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1844
+ function PendingSection({ state, disabled, onChanged }) {
1763
1845
  const rows = state?.rejected ?? [];
1764
1846
  const groups = state?.routing?.groups ?? [];
1765
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1766
- Card,
1847
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1848
+ Section,
1767
1849
  {
1768
- step: 3,
1769
- title: "未授权用户",
1770
- description: "给机器人发过消息、但不在任何分组里的人。选择分组并确认即完成授权;备注会代替 userid 显示。列表只保留在内存中,重启 DSH 后清空。",
1771
- aside: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_dsh_client_ui_primitives6.Tag, { tone: rows.length ? "warning" : "quiet", children: [
1772
- rows.length,
1773
- " 个待处理"
1774
- ] }),
1775
- children: rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Empty, { children: "暂时没有被拒绝的用户。任何人给机器人发消息后,如果它不在任何分组里,就会出现在这里。" }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "wcb-scroll", children: rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(RejectedRow, { row, groups, disabled, onChanged }, row.key)) })
1850
+ id: "pending",
1851
+ title: "待授权",
1852
+ count: rows.length ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dsh_client_ui_primitives7.Tag, { tone: "warning", children: rows.length }) : void 0,
1853
+ description: "给机器人发过消息、但还不在任何分组里的人或群聊。加入分组即完成授权;列表只保存在内存中,重启 DSH 后清空。",
1854
+ children: rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "wcb-empty-line", children: "暂无。对方给机器人发一条消息后会出现在这里。" }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "wcb-card", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { className: "wcb-list", children: rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PendingRow, { row, groups, disabled, onChanged }, row.key)) }) })
1776
1855
  }
1777
1856
  );
1778
1857
  }
1779
- function RejectedRow({ row, groups, disabled, onChanged }) {
1780
- const [open, setOpen] = (0, import_react7.useState)(false);
1781
- const [groupId, setGroupId] = (0, import_react7.useState)(groups.find((group) => group.id === "default")?.id ?? groups[0]?.id ?? "");
1782
- const [label, setLabel2] = (0, import_react7.useState)("");
1783
- const [busy, setBusy] = (0, import_react7.useState)(false);
1784
- const [error, setError] = (0, import_react7.useState)();
1858
+ function PendingRow({ row, groups, disabled, onChanged }) {
1859
+ const [open, setOpen] = (0, import_react8.useState)(false);
1860
+ const [groupId, setGroupId] = (0, import_react8.useState)(groups.find((group) => group.isDefault)?.id ?? groups[0]?.id ?? "");
1861
+ const [label, setLabel2] = (0, import_react8.useState)("");
1862
+ const [busy, setBusy] = (0, import_react8.useState)(false);
1863
+ const [error, setError] = (0, import_react8.useState)();
1785
1864
  async function authorize() {
1786
1865
  if (!groupId) {
1787
1866
  setError("还没有可用的分组。");
@@ -1798,38 +1877,31 @@ window.__ModuleLoader__.load({
1798
1877
  setBusy(false);
1799
1878
  }
1800
1879
  }
1801
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "wcb-member", children: [
1802
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "wcb-member-head", children: [
1803
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(KindBadge, { kind: row.kind, plain: true }),
1804
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "wcb-row-title", title: row.id, children: row.displayName }),
1805
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { flex: 1 } }),
1806
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "wcb-row-sub", children: [
1880
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("li", { className: "wcb-pending-row", children: [
1881
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "wcb-row-line", children: [
1882
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(KindAvatar, { kind: row.kind }),
1883
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "wcb-row-main", children: [
1884
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "wcb-row-title", title: row.id, children: row.displayName }),
1885
+ row.text && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "wcb-row-quote", title: row.text, children: [
1886
+ "“",
1887
+ row.text,
1888
+ "”"
1889
+ ] })
1890
+ ] }),
1891
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "wcb-row-meta", children: [
1807
1892
  row.messages,
1808
- " 次 · ",
1893
+ " 条 · ",
1809
1894
  relativeTime(row.lastSeenAt)
1810
1895
  ] }),
1811
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives6.Button, { variant: "outline", size: "sm", disabled: disabled || !groups.length, onClick: () => setOpen((value) => !value), children: open ? "收起" : "加入分组" })
1896
+ !open && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dsh_client_ui_primitives7.Button, { variant: "outline", size: "sm", disabled: disabled || !groups.length, onClick: () => setOpen(true), children: "加入分组" })
1812
1897
  ] }),
1813
- row.text && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "wcb-rejected-text", title: row.text, children: row.text }),
1814
- open && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "wcb-member-edit", children: [
1815
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "wcb-binding-field", children: [
1816
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "wcb-binding-label", children: "分组" }),
1817
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1818
- Select,
1819
- {
1820
- value: groupId,
1821
- disabled: disabled || busy,
1822
- "aria-label": `${row.id} 的分组`,
1823
- onChange: (event) => setGroupId(event.target.value),
1824
- children: groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: group.id, children: group.name }, group.id))
1825
- }
1826
- )
1827
- ] }),
1828
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "wcb-binding-field", children: [
1829
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "wcb-binding-label", children: "备注(优先显示)" }),
1830
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1831
- import_dsh_client_ui_primitives6.Input,
1898
+ open && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Editor, { children: [
1899
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "wcb-editor-grid", children: [
1900
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Field, { label: "分组", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Select, { value: groupId, disabled: disabled || busy, "aria-label": `${row.id} 的分组`, onChange: (event) => setGroupId(event.target.value), children: groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: group.id, children: group.name }, group.id)) }) }),
1901
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Field, { label: "备注(可选)", hint: "会代替企业微信 ID 显示。", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1902
+ import_dsh_client_ui_primitives7.Input,
1832
1903
  {
1904
+ className: "wcb-input",
1833
1905
  value: label,
1834
1906
  placeholder: row.id,
1835
1907
  disabled: disabled || busy,
@@ -1842,99 +1914,54 @@ window.__ModuleLoader__.load({
1842
1914
  }
1843
1915
  }
1844
1916
  }
1845
- )
1846
- ] }),
1847
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "wcb-member-actions", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives6.Button, { variant: "primary", size: "sm", icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives6.IconCheckCircleOutlineRegular, {}), disabled: disabled || busy, onClick: () => {
1848
- void authorize();
1849
- }, children: busy ? "授权中…" : "确认授权" }) }),
1850
- error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "wcb-field-error", role: "alert", children: error })
1851
- ] })
1852
- ] });
1853
- }
1854
-
1855
- // src/client/components/StatusHeader.tsx
1856
- var import_dsh_client_ui_primitives7 = require("@deepseek-ai/dsh-client-ui-primitives");
1857
- var import_jsx_runtime7 = require("react/jsx-runtime");
1858
- var PHASES = {
1859
- unconfigured: { label: "未配置", tone: "idle", dot: "idle" },
1860
- invalid: { label: "配置无效", tone: "err", dot: "error" },
1861
- connecting: { label: "连接中", tone: "warn", dot: "ongoing" },
1862
- online: { label: "在线", tone: "ok", dot: "done" },
1863
- reconnecting: { label: "重连中", tone: "warn", dot: "ongoing" },
1864
- offline: { label: "已断开", tone: "warn", dot: "warning" },
1865
- displaced: { label: "被其他连接替换", tone: "err", dot: "error" },
1866
- error: { label: "连接错误", tone: "err", dot: "error" }
1867
- };
1868
- function StatusHeader({ state, error }) {
1869
- const phase = state ? PHASES[state.connection.phase] ?? PHASES.error : void 0;
1870
- const traffic = state?.traffic;
1871
- const detail = error ?? state?.connection.detail;
1872
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("header", { className: "wcb-hero", children: [
1873
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "wcb-hero-mark", "aria-hidden": "true", children: "企" }),
1874
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "wcb-hero-text", children: [
1875
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "wcb-hero-title", children: "企业微信机器人" }),
1876
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "wcb-hero-sub", children: "在企业微信里接收 DSH 的完成通知与提问,直接回复即可继续对应会话。" })
1877
- ] }),
1878
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "wcb-hero-status", children: [
1879
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "wcb-pill", "data-tone": error ? "err" : phase?.tone ?? "idle", role: "status", children: [
1880
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dsh_client_ui_primitives7.StateDot, { state: error ? "error" : phase?.dot ?? "ongoing" }),
1881
- error ? "状态不可用" : phase ? phase.label : "读取状态…",
1882
- state && !error && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { style: { fontWeight: 400, opacity: 0.75 }, children: [
1883
- "· ",
1884
- relativeTime(state.connection.since)
1885
- ] })
1917
+ ) })
1886
1918
  ] }),
1887
- detail && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "wcb-status-detail", children: detail })
1888
- ] }),
1889
- traffic && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "wcb-stats", "aria-label": "本次 DSH 启动以来的统计", children: [
1890
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Stat, { value: traffic.received, label: `收到消息${traffic.lastMessageAt ? ` · ${relativeTime(traffic.lastMessageAt)}` : ""}` }),
1891
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Stat, { value: traffic.rejected, label: "已拒绝" }),
1892
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Stat, { value: traffic.prompts, label: "提交到 DSH" }),
1893
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Stat, { value: traffic.notifications, label: "推送通知" })
1919
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(FormFooter, { message: error, tone: error ? "error" : void 0, children: [
1920
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dsh_client_ui_primitives7.Button, { variant: "ghost", size: "sm", disabled: busy, onClick: () => {
1921
+ setOpen(false);
1922
+ setError(void 0);
1923
+ }, children: "取消" }),
1924
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dsh_client_ui_primitives7.Button, { variant: "primary", size: "sm", disabled: disabled || busy, onClick: () => {
1925
+ void authorize();
1926
+ }, children: busy ? "授权中…" : "确认授权" })
1927
+ ] })
1894
1928
  ] })
1895
1929
  ] });
1896
1930
  }
1897
- function Stat({ value, label }) {
1898
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "wcb-stat", children: [
1899
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "wcb-stat-value", children: value }),
1900
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "wcb-stat-label", children: label })
1901
- ] });
1902
- }
1903
1931
 
1904
1932
  // src/client/components/SettingsPage.tsx
1905
- var import_jsx_runtime8 = require("react/jsx-runtime");
1933
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1906
1934
  function SettingsPage({ scope, remote, onOpenSession }) {
1907
1935
  const snapshot = useFormSnapshot(scope);
1908
1936
  if (snapshot.status !== "ready") {
1909
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "wcb-page", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "wcb-card", children: snapshot.status === "loading" ? "正在加载插件配置…" : "插件配置暂不可用:请确认插件已启用。" }) });
1937
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "wcb-page", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "wcb-status-text", children: snapshot.status === "loading" ? "正在加载插件配置…" : "插件配置暂不可用:请确认插件已启用。" }) });
1910
1938
  }
1911
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SettingsEditor, { snapshot, scope, remote, onOpenSession });
1939
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SettingsEditor, { snapshot, scope, remote, onOpenSession });
1912
1940
  }
1913
1941
  function SettingsEditor({ snapshot, scope, remote, onOpenSession }) {
1914
- const base = (0, import_react8.useMemo)(() => storedFrom(snapshot.value), [snapshot.revision]);
1942
+ const base = (0, import_react9.useMemo)(() => storedFrom(snapshot.value), [snapshot.revision]);
1915
1943
  const bridge = useBridgeState();
1916
- const writable = snapshot.writable !== false;
1944
+ const disabled = snapshot.writable === false;
1917
1945
  const state = bridge.data;
1918
1946
  const onChanged = () => bridge.refresh(true);
1919
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "wcb-page", children: [
1920
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(StatusHeader, { state, error: bridge.error }),
1921
- state?.notices.map((notice) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "wcb-banner", "data-tone": "warning", role: "status", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "wcb-banner-body", children: notice }) }) }, notice)),
1922
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CredentialsCard, { scope, base, disabled: !writable, remote, onChanged }),
1923
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1924
- GroupsCard,
1947
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "wcb-page", children: [
1948
+ Boolean(state?.notices.length) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "wcb-notices", children: state.notices.map((notice) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Notice, { children: notice }, notice)) }),
1949
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ConnectionSection, { scope, base, state, error: bridge.error, disabled, remote, onChanged }),
1950
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PendingSection, { state, disabled, onChanged }),
1951
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1952
+ GroupsSection,
1925
1953
  {
1926
1954
  state,
1927
1955
  error: bridge.error,
1928
- disabled: !writable,
1956
+ disabled,
1929
1957
  refreshing: bridge.refreshing,
1930
1958
  onRefresh: () => bridge.refresh(true),
1931
1959
  onChanged,
1932
1960
  onOpenSession
1933
1961
  }
1934
1962
  ),
1935
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(RejectedCard, { state, disabled: !writable, onChanged }),
1936
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AdminCard, { state, disabled: !writable, onChanged }),
1937
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AdvancedCard, { settings: state?.settings, journal: state?.journal, disabled: !writable, onChanged })
1963
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AdminSection, { state, disabled, onChanged }),
1964
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AdvancedSection, { settings: state?.settings, journal: state?.journal, disabled, onChanged })
1938
1965
  ] });
1939
1966
  }
1940
1967
 
@@ -1942,394 +1969,299 @@ window.__ModuleLoader__.load({
1942
1969
  var STYLES = (
1943
1970
  /* css */
1944
1971
  `
1945
- /* The person dialog is portalled to document.body, outside .wcb-page, so the
1946
- token set is declared once for both roots. */
1947
- .wcb-page, .wcb-modal {
1948
- /* DSH is monochrome; the business blue is its accent for focus and info. */
1949
- --wcb-brand: var(--dsw-alias-state-business-primary, #4176e6);
1972
+ /* Dialogs are portalled to document.body, outside .wcb-page, so the aliases
1973
+ are declared on both roots — and nothing else is: .wcb-dialog is DSH's own
1974
+ Modal element, whose padding and layout must stay DSH's. */
1975
+ .wcb-page, .wcb-dialog {
1950
1976
  --wcb-text: var(--dsw-alias-label-primary, #0f1115);
1951
1977
  --wcb-text-2: var(--dsw-alias-label-secondary, #61666b);
1952
1978
  --wcb-text-3: var(--dsw-alias-label-tertiary, #81858c);
1953
- --wcb-surface: var(--dsw-alias-bg-layer-1, #fff);
1954
- --wcb-surface-2: var(--dsw-alias-bg-module-platform, #f5f6f7);
1955
- --wcb-line: var(--dsw-alias-border-l2, rgba(0,0,0,.1));
1956
- --wcb-line-2: var(--dsw-alias-border-l3, rgba(0,0,0,.12));
1957
- --wcb-ok: var(--dsw-alias-state-success-primary, #1a7f37);
1958
- --wcb-warn: var(--dsw-alias-state-warn-primary, #bf8700);
1959
- --wcb-err: var(--dsw-alias-state-error-primary, #cf222e);
1960
- --wcb-hover: var(--dsw-alias-interactive-bg-hover, rgba(127,127,127,.08));
1961
- --wcb-mono: var(--dsw-font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
1962
- box-sizing: border-box;
1963
- display: flex;
1964
- flex-direction: column;
1965
- gap: 16px;
1966
- max-width: 960px;
1967
- margin: 0 auto;
1968
- padding: 4px 0 24px;
1969
- color: var(--wcb-text);
1970
- font-size: 14px;
1971
- line-height: 1.5;
1979
+ --wcb-line: var(--dsw-alias-border-l2, rgba(0, 0, 0, .1));
1980
+ --wcb-line-strong: var(--dsw-alias-border-l3, rgba(0, 0, 0, .12));
1981
+ --wcb-field-line: var(--dsw-alias-border-l4, rgba(0, 0, 0, .16));
1982
+ --wcb-card: var(--dsw-alias-settings-card-fill, var(--dsw-alias-bg-layer-2, #fff));
1983
+ --wcb-card-line: var(--dsw-alias-settings-card-stroke, var(--dsw-alias-border-l4, rgba(0, 0, 0, .16)));
1984
+ --wcb-well: var(--dsw-alias-bg-module-platform, #f5f6f7);
1985
+ --wcb-field: var(--dsw-alias-bg-layer-1, #fff);
1986
+ --wcb-hover: var(--dsw-alias-interactive-bg-hover, rgba(38, 49, 72, .06));
1987
+ --wcb-hover-danger: var(--dsw-alias-interactive-bg-hover-danger, rgba(236, 19, 19, .05));
1988
+ --wcb-accent: var(--dsw-alias-state-business-primary, #4176e6);
1989
+ --wcb-ok: var(--dsw-alias-state-success-primary, #22c55e);
1990
+ --wcb-warn: var(--dsw-alias-state-warn-primary, #f59e0b);
1991
+ --wcb-warn-text: var(--dsw-alias-state-warn-label, #dd8629);
1992
+ --wcb-warn-bg: var(--dsw-alias-state-warn-tertiary, #fef5e7);
1993
+ --wcb-err: var(--dsw-alias-state-error-primary, #ec1313);
1994
+ --wcb-focus: var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary, #4176e6));
1995
+ --wcb-focus-width: var(--dsw-focus-ring-width, 2px);
1996
+ --wcb-radius-card: var(--dsw-radius-xl, 20px);
1997
+ --wcb-radius-lg: var(--dsw-radius-lg, 16px);
1998
+ --wcb-radius-md: var(--dsw-radius-md, 12px);
1999
+ --wcb-radius-sm: var(--dsw-radius-sm, 8px);
2000
+ --wcb-radius-xs: var(--dsw-radius-xs, 4px);
2001
+ --wcb-mono: var(--ds-font-family-code, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
2002
+ }
2003
+
2004
+ /* The page sits in the Plugin Manager's detail column (max 960px), between
2005
+ the package header and its rows, so it uses that page's 32px rhythm. */
2006
+ .wcb-page {
2007
+ display: flex; flex-direction: column; gap: 32px; min-width: 0;
2008
+ color: var(--wcb-text); font-size: 13px; line-height: 20px;
1972
2009
  }
1973
2010
  .wcb-page *, .wcb-page *::before, .wcb-page *::after,
1974
- .wcb-modal *, .wcb-modal *::before, .wcb-modal *::after { box-sizing: border-box; }
2011
+ .wcb-dialog-body, .wcb-dialog-body *, .wcb-dialog-body *::before, .wcb-dialog-body *::after { box-sizing: border-box; }
2012
+ .wcb-status-text { margin: 0; color: var(--wcb-text-3); font-size: 13px; line-height: 20px; }
2013
+ .wcb-spacer { flex: 1; min-width: 0; }
2014
+ .wcb-mono { font-family: var(--wcb-mono); font-size: 12px; }
2015
+ .wcb-muted { color: var(--wcb-text-3); }
1975
2016
 
1976
- /* Hero */
1977
- .wcb-hero {
1978
- display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
1979
- padding: 20px 22px; border-radius: 16px;
1980
- border: .5px solid var(--wcb-line);
1981
- background:
1982
- radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--wcb-brand) 14%, transparent), transparent 60%),
1983
- var(--wcb-surface);
1984
- }
1985
- .wcb-hero-mark {
1986
- flex: none; width: 46px; height: 46px; border-radius: 14px;
1987
- display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 18px;
1988
- background: linear-gradient(135deg, #2f9bff, #2a6df4);
1989
- box-shadow: 0 6px 18px color-mix(in srgb, #2a6df4 35%, transparent);
1990
- }
1991
- .wcb-hero-text { flex: 1; min-width: 220px; }
1992
- .wcb-hero-title { font-size: 18px; font-weight: 650; letter-spacing: .2px; }
1993
- .wcb-hero-sub { color: var(--wcb-text-2); font-size: 13px; margin-top: 2px; }
1994
- .wcb-hero-status { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
1995
- .wcb-pill {
1996
- display: inline-flex; align-items: center; gap: 8px;
1997
- padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 550;
1998
- background: var(--wcb-surface-2); border: .5px solid var(--wcb-line);
1999
- }
2000
- .wcb-pill[data-tone="ok"] { color: var(--wcb-ok); background: color-mix(in srgb, var(--wcb-ok) 10%, transparent); }
2001
- .wcb-pill[data-tone="warn"] { color: var(--wcb-warn); background: color-mix(in srgb, var(--wcb-warn) 12%, transparent); }
2002
- .wcb-pill[data-tone="err"] { color: var(--wcb-err); background: color-mix(in srgb, var(--wcb-err) 10%, transparent); }
2003
- .wcb-status-detail { color: var(--wcb-text-3); font-size: 12px; max-width: 320px; text-align: right; }
2004
- .wcb-stats {
2005
- display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px;
2006
- width: 100%; margin-top: 4px; border-radius: 12px; overflow: hidden;
2007
- background: var(--wcb-line); border: .5px solid var(--wcb-line);
2008
- }
2009
- .wcb-stat { background: var(--wcb-surface); padding: 10px 14px; }
2010
- .wcb-stat-value { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
2011
- .wcb-stat-label { color: var(--wcb-text-3); font-size: 12px; }
2017
+ /* Sections: a 14px title, a quiet count, actions on the right. */
2018
+ .wcb-section { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
2019
+ .wcb-section-head { display: flex; align-items: center; gap: 8px; min-height: 28px; }
2020
+ .wcb-section-title { margin: 0; font-size: 14px; font-weight: 500; line-height: 20px; color: var(--wcb-text); }
2021
+ .wcb-section-count { color: var(--wcb-text-2); font-size: 12px; line-height: 18px; font-variant-numeric: tabular-nums; }
2022
+ .wcb-section-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
2023
+ .wcb-section-desc { margin: -6px 0 0; color: var(--wcb-text-3); font-size: 12px; line-height: 18px; }
2024
+ .wcb-section-toggle {
2025
+ display: inline-flex; align-items: center; gap: 8px; min-width: 0; padding: 0;
2026
+ border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
2027
+ }
2028
+ .wcb-section-toggle:focus-visible { outline: var(--wcb-focus-width) solid var(--wcb-focus); outline-offset: 2px; border-radius: var(--wcb-radius-xs); }
2029
+ .wcb-section-summary { color: var(--wcb-text-3); font-size: 12px; line-height: 18px; }
2012
2030
 
2013
- /* Banner */
2014
- .wcb-banner {
2015
- display: flex; gap: 12px; align-items: flex-start;
2016
- padding: 14px 16px; border-radius: 14px; border: .5px solid var(--wcb-line);
2017
- }
2018
- .wcb-banner[data-tone="danger"] { border-color: color-mix(in srgb, var(--wcb-err) 40%, transparent); background: color-mix(in srgb, var(--wcb-err) 7%, var(--wcb-surface)); }
2019
- .wcb-banner[data-tone="warning"] { border-color: color-mix(in srgb, var(--wcb-warn) 40%, transparent); background: color-mix(in srgb, var(--wcb-warn) 8%, var(--wcb-surface)); }
2020
- .wcb-banner[data-tone="success"] { border-color: color-mix(in srgb, var(--wcb-ok) 35%, transparent); background: color-mix(in srgb, var(--wcb-ok) 6%, var(--wcb-surface)); }
2021
- .wcb-banner-icon { flex: none; margin-top: 2px; }
2022
- .wcb-banner[data-tone="danger"] .wcb-banner-icon { color: var(--wcb-err); }
2023
- .wcb-banner[data-tone="warning"] .wcb-banner-icon { color: var(--wcb-warn); }
2024
- .wcb-banner[data-tone="success"] .wcb-banner-icon { color: var(--wcb-ok); }
2025
- .wcb-banner-title { font-weight: 650; }
2026
- .wcb-banner-body { color: var(--wcb-text-2); font-size: 13px; margin-top: 4px; }
2027
- .wcb-banner-body ol, .wcb-banner-body ul { margin: 6px 0 0; padding-left: 20px; }
2028
- .wcb-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
2031
+ /* Notices: DSH's inline warning surface. */
2032
+ .wcb-notices { display: flex; flex-direction: column; gap: 8px; }
2033
+ .wcb-notice {
2034
+ display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 10px 12px;
2035
+ border-radius: var(--wcb-radius-md); background: var(--wcb-warn-bg);
2036
+ color: var(--wcb-text-2); font-size: 12px; line-height: 18px;
2037
+ }
2038
+ .wcb-notice-icon { flex: none; display: inline-flex; margin-top: 1px; color: var(--wcb-warn); }
2039
+ .wcb-notice[data-tone="error"] { background: color-mix(in srgb, var(--wcb-err) 8%, transparent); color: var(--wcb-err); }
2040
+ .wcb-notice[data-tone="error"] .wcb-notice-icon { color: var(--wcb-err); }
2029
2041
 
2030
- /* Cards */
2042
+ /* Settings cards: one per object (the connection, a group, a list). */
2031
2043
  .wcb-card {
2032
- background: var(--wcb-surface); border: .5px solid var(--wcb-line);
2033
- border-radius: 16px; padding: 18px 20px;
2034
- }
2035
- .wcb-card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
2036
- .wcb-step {
2037
- flex: none; width: 26px; height: 26px; border-radius: 50%;
2038
- display: grid; place-items: center; font-size: 12px; font-weight: 700;
2039
- color: var(--wcb-brand); background: color-mix(in srgb, var(--wcb-brand) 13%, transparent);
2040
- }
2041
- .wcb-card-titles { flex: 1; min-width: 0; }
2042
- .wcb-card-title { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
2043
- .wcb-card-desc { color: var(--wcb-text-2); font-size: 12.5px; margin-top: 2px; }
2044
- .wcb-card-aside { flex: none; display: flex; gap: 6px; align-items: center; }
2045
-
2046
- /* Fields */
2047
- .wcb-field {
2048
- display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 4px 18px;
2049
- padding: 12px 0; border-top: .5px solid var(--wcb-line);
2050
- }
2051
- .wcb-field:first-child { border-top: none; padding-top: 2px; }
2052
- .wcb-field-label { font-weight: 550; padding-top: 6px; }
2053
- .wcb-required { color: var(--wcb-err); margin-left: 2px; }
2054
- .wcb-field-control { min-width: 0; }
2055
- .wcb-field-row { display: flex; gap: 8px; align-items: center; }
2056
- .wcb-grow { flex: 1; min-width: 0; width: 100%; }
2057
- .wcb-hint { color: var(--wcb-text-3); font-size: 12px; margin-top: 6px; }
2058
- .wcb-field-error { color: var(--wcb-err); font-size: 12px; margin-top: 6px; }
2059
- .wcb-field[data-invalid] .wcb-grow { border-color: var(--wcb-err); }
2060
- .wcb-number { width: 120px; }
2061
- @media (max-width: 720px) {
2062
- .wcb-field { grid-template-columns: 1fr; }
2063
- .wcb-field-label { padding-top: 0; }
2064
- .wcb-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
2044
+ min-width: 0; border: .5px solid var(--wcb-card-line); border-radius: var(--wcb-radius-card);
2045
+ background: var(--wcb-card);
2065
2046
  }
2066
-
2067
- /* Lists */
2068
- .wcb-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
2069
- .wcb-toolbar .wcb-search { flex: 1; min-width: 220px; }
2070
- .wcb-scroll { max-height: 460px; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding: 1px; }
2071
- /* The group list grows with the page: nested scroll boxes inside another
2072
- scroll box are what make a settings page impossible to scan. */
2073
- .wcb-groups { display: flex; flex-direction: column; gap: 8px; padding: 1px; }
2074
- .wcb-group { border: .5px solid var(--wcb-line); border-radius: 12px; overflow: hidden; background: var(--wcb-surface); }
2075
- .wcb-group-head {
2076
- display: flex; align-items: center; gap: 8px; width: 100%;
2077
- padding: 0 12px 0 0; background: var(--wcb-surface-2);
2078
- }
2079
- .wcb-group-toggle {
2080
- flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
2081
- padding: 9px 12px; background: none; border: none; color: inherit;
2082
- font: inherit; text-align: left; cursor: pointer;
2083
- }
2084
- .wcb-group-toggle:hover { box-shadow: inset 0 0 0 999px var(--wcb-hover); }
2085
- .wcb-group-actions { flex: none; display: flex; gap: 6px; align-items: center; }
2086
- .wcb-group-body { border-top: .5px solid var(--wcb-line); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
2087
- .wcb-chevron { flex: none; color: var(--wcb-text-3); transition: transform .15s ease; }
2088
- .wcb-group[data-open] .wcb-chevron { transform: rotate(90deg); }
2089
- .wcb-group-icon { flex: none; color: var(--wcb-text-2); }
2090
- .wcb-group-title-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
2091
- .wcb-group-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
2092
- /* The group overview: labelled facts that wrap instead of hiding behind an ellipsis. */
2093
- .wcb-group-summary {
2094
- flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end;
2095
- gap: 2px 10px; color: var(--wcb-text-3); font-size: 12px; text-align: right;
2096
- }
2097
- .wcb-group-summary .wcb-fact-inline { white-space: nowrap; }
2098
- /* A group owns five facts, so its collapsed header is a five-track grid: the
2099
- label sits above its value and the same track holds the same fact in every
2100
- group. Values wrap; nothing is hidden behind an ellipsis. */
2101
- .wcb-group[data-facts] .wcb-group-head { align-items: flex-start; }
2102
- .wcb-group[data-facts] .wcb-group-toggle { flex-direction: column; align-items: stretch; gap: 5px; }
2103
- .wcb-group[data-facts] .wcb-group-actions { padding-top: 5px; }
2104
- .wcb-group-facts {
2105
- display: grid;
2106
- grid-template-columns: 64px 128px minmax(150px, 1.6fr) 64px minmax(100px, 1fr);
2107
- gap: 2px 14px;
2108
- width: 100%; text-align: left;
2109
- }
2110
- .wcb-group-fact { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
2111
- .wcb-group-fact-label { color: var(--wcb-text-3); font-size: 10.5px; line-height: 1.2; }
2112
- .wcb-group-fact-value { color: var(--wcb-text-2); font-size: 12px; line-height: 1.35; overflow-wrap: anywhere; }
2113
- @media (max-width: 860px) {
2114
- .wcb-group-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
2115
- }
2116
- .wcb-row {
2117
- display: flex; align-items: center; gap: 12px;
2118
- padding: 9px 12px; border-top: .5px solid var(--wcb-line); cursor: pointer;
2119
- }
2120
- .wcb-row:hover { background: var(--wcb-hover); }
2121
- .wcb-row[data-selected] { background: color-mix(in srgb, var(--wcb-brand) 7%, transparent); }
2122
- .wcb-check { flex: none; width: 16px; height: 16px; margin: 0; accent-color: var(--wcb-brand); cursor: pointer; }
2123
- .wcb-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
2124
- .wcb-row-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
2125
- .wcb-row-title[data-muted] { color: var(--wcb-text-3); font-weight: 400; font-style: italic; }
2126
- .wcb-row-sub { display: flex; gap: 8px; align-items: center; color: var(--wcb-text-3); font-size: 12px; min-width: 0; }
2127
- .wcb-mono { font-family: var(--wcb-mono); font-size: 11.5px; }
2128
- .wcb-ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
2129
- .wcb-row-meta { flex: none; display: flex; gap: 6px; align-items: center; color: var(--wcb-text-3); font-size: 12px; }
2130
- .wcb-running { display: inline-flex; align-items: center; gap: 4px; color: var(--wcb-text-2); }
2131
- .wcb-pin { color: var(--wcb-brand); display: inline-flex; }
2132
- .wcb-list-foot { color: var(--wcb-text-3); font-size: 12px; margin-top: 10px; display: flex; gap: 12px; flex-wrap: wrap; }
2047
+ .wcb-card-body { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; }
2048
+ .wcb-empty-line { margin: 0; color: var(--wcb-text-3); font-size: 12px; line-height: 18px; }
2133
2049
  .wcb-empty {
2134
- padding: 22px 18px; border-radius: 12px; text-align: center;
2135
- border: 1px dashed var(--wcb-line-2); color: var(--wcb-text-2); font-size: 13px;
2050
+ margin: 0; padding: 12px; border: 1px dashed var(--wcb-line-strong); border-radius: var(--wcb-radius-lg);
2051
+ color: var(--wcb-text-3); font-size: 12px; line-height: 18px; text-align: center;
2136
2052
  }
2137
- .wcb-empty ol { display: inline-block; text-align: left; margin: 8px 0 0; padding-left: 20px; color: var(--wcb-text-3); }
2138
- .wcb-hidden-list { margin-top: 12px; border: .5px dashed color-mix(in srgb, var(--wcb-warn) 50%, transparent); border-radius: 12px; padding: 4px 0; }
2139
- .wcb-hidden-head { padding: 6px 12px; font-size: 12.5px; color: var(--wcb-warn); font-weight: 600; display: flex; align-items: center; gap: 8px; }
2140
2053
 
2141
- /* Identities */
2142
- .wcb-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
2143
- @media (max-width: 820px) { .wcb-columns { grid-template-columns: 1fr; } }
2144
- .wcb-subhead { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
2145
- .wcb-subhead-title { font-weight: 600; }
2146
- .wcb-subhead-hint { color: var(--wcb-text-3); font-size: 12px; }
2147
- .wcb-subhead .wcb-card-aside { margin-left: auto; }
2148
- .wcb-panel { border: .5px solid var(--wcb-line); border-radius: 12px; overflow: hidden; }
2149
- .wcb-panel .wcb-row:first-child { border-top: none; }
2150
- .wcb-panel-scroll { max-height: 320px; overflow: auto; }
2151
- .wcb-add { display: flex; gap: 8px; padding: 10px 12px; border-top: .5px solid var(--wcb-line); background: var(--wcb-surface-2); }
2054
+ /* Inline key/value facts in a summary line. */
2055
+ .wcb-kvs { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 16px; margin: 0; font-size: 12px; line-height: 18px; }
2056
+ .wcb-kv { display: inline-flex; align-items: baseline; gap: 6px; min-width: 0; }
2057
+ .wcb-kv-label { flex: none; color: var(--wcb-text-3); }
2058
+ .wcb-kv-value { min-width: 0; color: var(--wcb-text-2); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
2152
2059
 
2153
- /* Advanced */
2154
- .wcb-details > summary { list-style: none; cursor: pointer; }
2155
- .wcb-details > summary::-webkit-details-marker { display: none; }
2156
- .wcb-details > summary .wcb-card-head { margin-bottom: 0; }
2157
- .wcb-details[open] > summary .wcb-card-head { margin-bottom: 14px; }
2158
- .wcb-details[open] > summary .wcb-chevron { transform: rotate(90deg); }
2159
- .wcb-path {
2160
- font-family: var(--wcb-mono); font-size: 12px; padding: 7px 10px; border-radius: 8px;
2161
- background: var(--wcb-surface-2); border: .5px solid var(--wcb-line); word-break: break-all;
2162
- }
2163
- .wcb-code { font-family: var(--wcb-mono); font-size: 12px; background: var(--wcb-surface-2); padding: 1px 5px; border-radius: 5px; }
2060
+ /* Connection */
2061
+ .wcb-connection-head { display: flex; align-items: center; gap: 8px; min-height: 28px; }
2062
+ .wcb-status { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
2063
+ .wcb-status-label { font-size: 14px; font-weight: 500; line-height: 22px; }
2064
+ .wcb-status-since { color: var(--wcb-text-3); font-size: 12px; line-height: 18px; }
2065
+ .wcb-status-detail { margin: 0; color: var(--wcb-text-2); font-size: 12px; line-height: 18px; }
2066
+ .wcb-status-detail[data-tone="error"] { color: var(--wcb-err); }
2067
+ .wcb-status-detail[data-tone="warning"] { color: var(--wcb-warn-text); }
2068
+ .wcb-saved { color: var(--wcb-ok); font-size: 12px; line-height: 18px; }
2069
+ .wcb-card-body > .wcb-editor { margin-top: 6px; }
2164
2070
 
2165
- /* Per-section save row: a card saves itself, nothing waits at the bottom. */
2166
- .wcb-savebar {
2167
- display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
2168
- margin-top: 14px; padding-top: 12px; border-top: .5px solid var(--wcb-line);
2169
- }
2170
- .wcb-savebar-msg { flex: 1; min-width: 160px; color: var(--wcb-text-2); font-size: 12.5px; }
2171
- .wcb-savebar-msg[data-tone="error"] { color: var(--wcb-err); }
2172
- .wcb-savebar-msg[data-tone="success"] { color: var(--wcb-ok); }
2173
- .wcb-savebar-msg[data-tone="dirty"] { color: var(--wcb-warn); }
2071
+ /* Lists inside a card: hairline rows, DSH row rhythm. */
2072
+ .wcb-list { list-style: none; margin: 0; padding: 0 16px; }
2073
+ .wcb-list > li { padding: 12px 0; border-top: .5px solid var(--wcb-line); }
2074
+ .wcb-list > li:first-child { border-top: 0; }
2075
+ .wcb-row-line { display: flex; align-items: center; gap: 12px; min-width: 0; }
2076
+ .wcb-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
2077
+ .wcb-row-title { min-width: 0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
2078
+ .wcb-row-quote { min-width: 0; color: var(--wcb-text-3); font-size: 12px; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
2079
+ .wcb-row-meta { flex: none; color: var(--wcb-text-3); font-size: 12px; line-height: 18px; white-space: nowrap; font-variant-numeric: tabular-nums; }
2080
+ .wcb-list > li > .wcb-editor { margin-top: 12px; }
2174
2081
 
2175
- /* Selects and inline text */
2176
- .wcb-select {
2177
- min-width: 0; max-width: 100%; height: 32px; padding: 0 8px;
2178
- border: .5px solid var(--wcb-line-2); border-radius: 8px;
2179
- background: var(--wcb-surface); color: var(--wcb-text); font: inherit; font-size: 13px;
2180
- cursor: pointer; appearance: auto;
2181
- }
2182
- .wcb-select:disabled { opacity: .55; cursor: not-allowed; }
2183
- .wcb-muted { color: var(--wcb-text-3); }
2184
- .wcb-inline-error { color: var(--wcb-err); }
2185
- .wcb-link {
2186
- border: none; background: none; padding: 0; cursor: pointer;
2187
- color: var(--wcb-brand); font: inherit; font-size: 12px; text-decoration: underline;
2188
- }
2189
- .wcb-link:disabled { color: var(--wcb-text-3); cursor: not-allowed; text-decoration: none; }
2190
- .wcb-banner-foot { margin-top: 6px; color: var(--wcb-text-3); font-size: 12px; }
2191
- .wcb-row-meta-inner { display: inline-flex; align-items: center; gap: 6px; }
2082
+ /* People: a kind badge (person / group chat) and the name it is known by. */
2083
+ .wcb-avatar {
2084
+ flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
2085
+ }
2086
+ .wcb-avatar[data-kind="user"] { color: var(--wcb-accent); background: color-mix(in srgb, var(--wcb-accent) 12%, transparent); }
2087
+ .wcb-avatar[data-kind="group"] { color: var(--wcb-warn-text); background: color-mix(in srgb, var(--wcb-warn) 16%, transparent); }
2088
+ .wcb-person {
2089
+ display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; padding: 0;
2090
+ border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
2091
+ }
2092
+ .wcb-person-name { min-width: 0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
2093
+ .wcb-person-chevron { flex: none; display: inline-flex; color: var(--wcb-text-3); }
2094
+ .wcb-person:hover:not(:disabled) .wcb-person-name { text-decoration: underline; text-underline-offset: 3px; }
2095
+ .wcb-person:hover:not(:disabled) .wcb-person-chevron { color: var(--wcb-text); }
2096
+ .wcb-person:disabled { cursor: default; opacity: .5; }
2097
+ .wcb-person:focus-visible { outline: var(--wcb-focus-width) solid var(--wcb-focus); outline-offset: 2px; border-radius: var(--wcb-radius-xs); }
2098
+ .wcb-identity { display: flex; align-items: center; gap: 8px; min-width: 0; }
2192
2099
 
2193
- /* Groups and members */
2194
- /* Name, Workspace, model, effort, preset: the model needs the most room. */
2195
- .wcb-binding-controls {
2196
- display: grid; gap: 8px;
2197
- grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) minmax(0, 1.6fr) minmax(0, .8fr) minmax(0, 1.25fr);
2198
- }
2199
- @media (max-width: 900px) {
2200
- .wcb-binding-controls { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
2201
- }
2202
- .wcb-binding-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
2203
- .wcb-binding-label { color: var(--wcb-text-3); font-size: 11.5px; }
2204
- .wcb-members { display: flex; flex-direction: column; gap: 4px; padding: 4px; border: .5px solid var(--wcb-line); border-radius: 10px; }
2205
- .wcb-member { display: flex; flex-direction: column; gap: 4px; padding: 6px 8px; border-radius: 8px; }
2206
- .wcb-member + .wcb-member { border-top: .5px solid var(--wcb-line); border-top-left-radius: 0; border-top-right-radius: 0; }
2207
- .wcb-member-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
2100
+ /* Groups */
2101
+ .wcb-groups { display: flex; flex-direction: column; gap: 8px; }
2102
+ .wcb-group-head { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; }
2103
+ .wcb-group-toggle {
2104
+ flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 0;
2105
+ border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
2106
+ }
2107
+ .wcb-group-toggle:focus-visible { outline: var(--wcb-focus-width) solid var(--wcb-focus); outline-offset: 4px; border-radius: var(--wcb-radius-xs); }
2108
+ .wcb-group-title-line { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 28px; }
2109
+ .wcb-chevron { flex: none; display: inline-flex; color: var(--wcb-text-3); transition: transform .14s ease, color .1s ease; }
2110
+ .wcb-group-toggle:hover .wcb-chevron, .wcb-section-toggle:hover .wcb-chevron { color: var(--wcb-text); }
2111
+ .wcb-group[data-open] .wcb-group-head .wcb-chevron, .wcb-section-toggle[aria-expanded="true"] .wcb-chevron,
2112
+ .wcb-scope-toggle[aria-expanded="true"] .wcb-chevron { transform: rotate(90deg); }
2113
+ .wcb-group-name { min-width: 0; font-size: 14px; font-weight: 500; line-height: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
2114
+ .wcb-group-count { flex: none; color: var(--wcb-text-3); font-size: 12px; line-height: 18px; }
2115
+ /* The overview names every fact a group owns; values wrap instead of hiding
2116
+ behind an ellipsis, and the line is indented under the name. */
2117
+ .wcb-group-facts { padding-left: 22px; }
2118
+ .wcb-group-actions { flex: none; display: flex; align-items: center; gap: 8px; min-height: 28px; }
2119
+ .wcb-group-error { margin: -4px 16px 12px 38px; color: var(--wcb-err); font-size: 12px; line-height: 18px; }
2120
+ .wcb-group > .wcb-editor { margin: 0 16px 14px; }
2121
+ .wcb-group-body { padding: 0 16px 8px; }
2122
+ .wcb-group-body > .wcb-empty { margin-bottom: 8px; }
2208
2123
 
2209
- /* A person line: the colored badge is the only thing that opens the details. */
2210
- .wcb-person-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
2211
- .wcb-person-meta { flex: none; display: flex; align-items: center; gap: 6px; color: var(--wcb-text-3); font-size: 12px; margin-left: auto; }
2212
- .wcb-avatar {
2213
- flex: none; position: relative; display: grid; place-items: center;
2214
- width: 26px; height: 26px; padding: 0; border-radius: 50%;
2215
- border: .5px solid transparent;
2216
- }
2217
- .wcb-avatar[data-kind="user"] { color: #2a6df4; background: color-mix(in srgb, #2a6df4 12%, transparent); }
2218
- .wcb-avatar[data-kind="group"] { color: #b06f00; background: color-mix(in srgb, #bf8700 18%, transparent); }
2219
- .wcb-avatar[data-button] { cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; }
2220
- .wcb-avatar[data-button]:hover:not(:disabled) {
2221
- transform: translateY(-1px);
2222
- box-shadow: 0 2px 8px color-mix(in srgb, var(--wcb-text) 22%, transparent);
2223
- }
2224
- .wcb-avatar[data-button]:active:not(:disabled) { transform: none; }
2225
- .wcb-avatar[data-button]:focus-visible { outline: 2px solid var(--wcb-brand); outline-offset: 2px; }
2226
- .wcb-avatar[data-button]:disabled { cursor: not-allowed; opacity: .5; }
2227
- /* The pencil badge: "pressing this opens the details form". */
2228
- .wcb-avatar-pencil {
2229
- position: absolute; right: -3px; bottom: -3px;
2230
- width: 13px; height: 13px; border-radius: 50%;
2231
- display: grid; place-items: center;
2232
- color: var(--wcb-text-2); background: var(--wcb-surface);
2233
- border: .5px solid var(--wcb-line-2);
2234
- }
2124
+ /* Members: a semantic table, left-aligned like every DSH list. */
2125
+ .wcb-table-scroll { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
2126
+ .wcb-table-scroll:focus-visible { outline: var(--wcb-focus-width) solid var(--wcb-focus); outline-offset: -2px; }
2127
+ .wcb-table { width: 100%; min-width: 660px; border-collapse: collapse; table-layout: fixed; }
2128
+ .wcb-table th, .wcb-table td { padding: 8px 12px 8px 0; text-align: left; vertical-align: middle; white-space: nowrap; }
2129
+ .wcb-table th:last-child, .wcb-table td:last-child { padding-right: 0; }
2130
+ .wcb-table th { border-top: .5px solid var(--wcb-line); color: var(--wcb-text-3); font-size: 12px; font-weight: 400; line-height: 18px; }
2131
+ .wcb-table td { border-top: .5px solid var(--wcb-line); overflow: hidden; text-overflow: ellipsis; }
2132
+ .wcb-col-session { width: 108px; }
2133
+ .wcb-col-model { width: 200px; }
2134
+ .wcb-col-effort { width: 108px; }
2135
+ .wcb-col-context { width: 140px; }
2136
+ .wcb-member-error td { white-space: normal; }
2235
2137
 
2236
- /* Native table semantics keep every member's facts aligned under one header.
2237
- Narrow surfaces scroll the table rather than wrapping unrelated columns.
2238
- Every column is centred: the row is a set of short facts, not prose. */
2239
- .wcb-members-scroll { overflow-x: auto; border: .5px solid var(--wcb-line); border-radius: 10px; }
2240
- .wcb-members-scroll:focus-visible { outline: 2px solid var(--wcb-brand); outline-offset: 2px; }
2241
- .wcb-members-table { width: 100%; min-width: 860px; border-collapse: collapse; table-layout: fixed; font-size: 12px; }
2242
- .wcb-members-table th, .wcb-members-table td { padding: 9px 10px; text-align: center; vertical-align: middle; white-space: nowrap; }
2243
- .wcb-members-table th { color: var(--wcb-text-3); background: var(--wcb-surface-2); font-weight: 500; font-size: 11.5px; }
2244
- .wcb-members-table td { border-top: .5px solid var(--wcb-line); color: var(--wcb-text-2); }
2245
- /* Fixed widths keep a long model name from squeezing every other column. */
2246
- .wcb-members-table th:nth-child(1) { width: 18%; }
2247
- .wcb-members-table th:nth-child(2) { width: 88px; }
2248
- .wcb-members-table th:nth-child(3) { width: 70px; }
2249
- .wcb-members-table th:nth-child(4) { width: 195px; }
2250
- .wcb-members-table th:nth-child(5) { width: 86px; }
2251
- .wcb-members-table th:nth-child(6) { width: 160px; }
2252
- .wcb-members-table th:nth-child(7) { width: 112px; }
2253
- .wcb-member-row:hover { background: var(--wcb-hover); }
2254
- .wcb-member-identity { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; }
2255
- .wcb-member-name { color: var(--wcb-text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
2138
+ /* The bound Session: a pill that opens its details, never navigates itself. */
2139
+ .wcb-session {
2140
+ display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 24px; padding: 0 6px 0 8px;
2141
+ border: .5px solid var(--wcb-line-strong); border-radius: 999px; background: transparent;
2142
+ color: var(--wcb-text-2); font: inherit; font-size: 12px; line-height: 18px; cursor: pointer;
2143
+ }
2144
+ .wcb-session:hover:not(:disabled) { background: var(--wcb-hover); color: var(--wcb-text); }
2145
+ .wcb-session:focus-visible { outline: var(--wcb-focus-width) solid var(--wcb-focus); outline-offset: 2px; }
2146
+ .wcb-session:disabled { cursor: default; opacity: .5; }
2147
+ .wcb-session[data-running] { color: var(--wcb-text); }
2148
+ .wcb-session-chevron { display: inline-flex; color: var(--wcb-text-3); }
2149
+
2150
+ /* Context occupancy: a short bar that turns amber and red as it fills. */
2151
+ .wcb-meter { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; }
2152
+ .wcb-meter-track { flex: none; width: 36px; height: 4px; border-radius: 2px; background: var(--wcb-line); overflow: hidden; }
2153
+ .wcb-meter-fill { display: block; height: 100%; border-radius: inherit; background: var(--wcb-text-3); }
2154
+ .wcb-meter[data-level="warn"] .wcb-meter-fill { background: var(--wcb-warn); }
2155
+ .wcb-meter[data-level="high"] .wcb-meter-fill { background: var(--wcb-err); }
2156
+ .wcb-meter-text { color: var(--wcb-text-2); font-size: 12px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
2157
+
2158
+ /* Native select dressed like DSH's settings selects. */
2159
+ .wcb-select {
2160
+ box-sizing: border-box; min-width: 0; max-width: 100%; height: 32px; padding: 0 30px 0 10px;
2161
+ border: .5px solid var(--wcb-field-line); border-radius: var(--wcb-radius-md);
2162
+ background: var(--wcb-field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%2381858C' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center / 12px 12px;
2163
+ color: var(--wcb-text); font: inherit; font-size: 13px; line-height: 20px;
2164
+ appearance: none; -webkit-appearance: none; cursor: pointer; text-overflow: ellipsis;
2165
+ }
2166
+ .wcb-select:focus-visible { outline: none; border-color: var(--wcb-focus); }
2167
+ .wcb-select:disabled { cursor: default; opacity: .5; }
2168
+ .wcb-select[data-compact] { height: 28px; padding: 0 24px 0 8px; border-radius: var(--wcb-radius-sm); font-size: 12px; line-height: 18px; background-position: right 7px center; }
2169
+ .wcb-table .wcb-select { width: 100%; }
2170
+ .wcb-input { width: 100%; }
2171
+ .wcb-input-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
2172
+ .wcb-input-row > .wcb-input { flex: 1; }
2173
+ .wcb-number { width: 88px; }
2256
2174
 
2257
- /* One convention for every interactive cell: it looks like a control, not like
2258
- plain text. The Session identity is a pill, the model/effort are selects. */
2259
- .wcb-cell-pill {
2260
- display: inline-flex; align-items: center; gap: 6px;
2261
- height: 26px; padding: 0 9px 0 10px;
2262
- border: .5px solid color-mix(in srgb, var(--wcb-brand) 35%, transparent);
2263
- border-radius: 999px;
2264
- background: color-mix(in srgb, var(--wcb-brand) 7%, transparent);
2265
- color: var(--wcb-brand); font: inherit; font-size: 12px; font-weight: 550;
2266
- cursor: pointer; transition: background .12s ease, border-color .12s ease;
2267
- }
2268
- .wcb-cell-pill:hover:not(:disabled) {
2269
- background: color-mix(in srgb, var(--wcb-brand) 15%, transparent);
2270
- border-color: color-mix(in srgb, var(--wcb-brand) 55%, transparent);
2271
- }
2272
- .wcb-cell-pill:active:not(:disabled) { background: color-mix(in srgb, var(--wcb-brand) 20%, transparent); }
2273
- .wcb-cell-pill:focus-visible { outline: 2px solid var(--wcb-brand); outline-offset: 2px; }
2274
- .wcb-cell-pill:disabled { cursor: default; opacity: .55; }
2275
- .wcb-cell-pill-chevron { display: inline-flex; color: color-mix(in srgb, var(--wcb-brand) 70%, transparent); }
2276
- .wcb-members-table .wcb-cell-select {
2277
- display: block; width: 100%; max-width: 220px; margin: 0 auto;
2278
- min-width: 0; height: 28px; font-size: 12px; text-align: center;
2279
- }
2280
- .wcb-members-table .wcb-context-cell { font-variant-numeric: tabular-nums; }
2281
- .wcb-member-error td { white-space: normal; text-align: center !important; }
2282
- .wcb-member-error .wcb-field-error { margin-top: 0; display: inline-block; max-width: 640px; text-align: left; }
2283
- .wcb-fact-inline {
2284
- display: inline-flex; align-items: center; gap: 5px; min-width: 0;
2285
- color: var(--wcb-text-2); font-size: 12px;
2286
- }
2287
- .wcb-fact-key { color: var(--wcb-text-3); font-size: 11px; }
2288
- .wcb-fact-strong {
2289
- color: var(--wcb-text); white-space: nowrap; overflow: hidden;
2290
- text-overflow: ellipsis; max-width: 170px;
2291
- }
2292
- .wcb-member-edit {
2293
- display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px;
2294
- align-items: end; padding: 8px 10px; border-radius: 8px; background: var(--wcb-surface-2);
2295
- }
2296
- @media (max-width: 820px) { .wcb-member-edit { grid-template-columns: 1fr; } }
2297
- .wcb-member-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
2175
+ /* Inline editors: a recessed well with stacked fields, actions at the end. */
2176
+ .wcb-editor {
2177
+ display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 14px 16px;
2178
+ border-radius: var(--wcb-radius-lg); background: var(--wcb-well);
2179
+ }
2180
+ .wcb-editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
2181
+ .wcb-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
2182
+ .wcb-field-label { color: var(--wcb-text-2); font-size: 12px; font-weight: 500; line-height: 18px; }
2183
+ .wcb-hint { margin: 0; color: var(--wcb-text-3); font-size: 12px; line-height: 18px; }
2184
+ .wcb-error { margin: 0; color: var(--wcb-err); font-size: 12px; line-height: 18px; overflow-wrap: anywhere; }
2185
+ .wcb-field[data-invalid] .wcb-input { border-color: var(--wcb-err); }
2186
+ .wcb-footer { display: flex; align-items: center; gap: 8px; min-width: 0; }
2187
+ .wcb-footer-message { flex: 1; min-width: 0; margin: 0; color: var(--wcb-text-3); font-size: 12px; line-height: 18px; }
2188
+ .wcb-footer-message[data-tone="error"] { color: var(--wcb-err); }
2189
+ .wcb-footer-message[data-tone="success"] { color: var(--wcb-ok); }
2190
+ .wcb-footer-message[data-tone="dirty"] { color: var(--wcb-warn-text); }
2191
+ .wcb-switch-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--wcb-text-2); }
2192
+ .wcb-path { display: flex; align-items: center; gap: 4px; min-width: 0; }
2193
+ .wcb-path-text { flex: 1; min-width: 0; color: var(--wcb-text-2); font-family: var(--wcb-mono); font-size: 12px; line-height: 18px; overflow-wrap: anywhere; }
2298
2194
 
2299
- /* A picker list inside a dialog: one known person per row. */
2300
- .wcb-picker-list {
2301
- display: flex; flex-direction: column; max-height: 300px; overflow: auto;
2302
- border: .5px solid var(--wcb-line); border-radius: 10px;
2195
+ /* Buttons beyond the primitives: danger, text links and small icon buttons. */
2196
+ .wcb-page .wcb-danger, .wcb-dialog .wcb-danger {
2197
+ color: var(--wcb-err); border-color: color-mix(in srgb, var(--wcb-err) 30%, transparent);
2198
+ --dsw-alias-interactive-bg-hover: var(--wcb-hover-danger);
2303
2199
  }
2200
+ .wcb-page .wcb-danger-solid, .wcb-dialog .wcb-danger-solid {
2201
+ --dsw-alias-button-primary-fill: var(--wcb-err); --dsw-alias-button-primary-hover: var(--wcb-err);
2202
+ }
2203
+ .wcb-link {
2204
+ padding: 0; border: 0; background: none; color: var(--wcb-accent); font: inherit;
2205
+ font-size: 12px; line-height: 18px; cursor: pointer; white-space: nowrap;
2206
+ }
2207
+ .wcb-link:hover:not(:disabled) { text-decoration: underline; text-underline-offset: 3px; }
2208
+ .wcb-link:disabled { color: var(--wcb-text-3); cursor: default; }
2209
+ .wcb-link:focus-visible { outline: var(--wcb-focus-width) solid var(--wcb-focus); outline-offset: 2px; border-radius: var(--wcb-radius-xs); }
2210
+ .wcb-icon-button {
2211
+ flex: none; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0;
2212
+ border: 0; border-radius: var(--wcb-radius-sm); background: none; color: var(--wcb-text-3); cursor: pointer;
2213
+ }
2214
+ .wcb-icon-button:hover:not(:disabled) { background: var(--wcb-hover); color: var(--wcb-text); }
2215
+ .wcb-icon-button:focus-visible { outline: var(--wcb-focus-width) solid var(--wcb-focus); outline-offset: 1px; }
2216
+
2217
+ /* Administrators and their notification scope. */
2218
+ .wcb-scope { padding: 10px 16px 12px; border-top: .5px solid var(--wcb-line); }
2219
+ .wcb-scope-head { display: flex; align-items: center; gap: 8px; min-height: 28px; }
2220
+ .wcb-scope-toggle {
2221
+ display: inline-flex; align-items: center; gap: 8px; min-width: 0; padding: 0;
2222
+ border: 0; background: none; color: inherit; font: inherit; cursor: pointer;
2223
+ }
2224
+ .wcb-scope-toggle:focus-visible { outline: var(--wcb-focus-width) solid var(--wcb-focus); outline-offset: 2px; border-radius: var(--wcb-radius-xs); }
2225
+ .wcb-scope-list { list-style: none; margin: 6px 0 0; padding: 0 0 0 22px; }
2226
+ .wcb-scope-list > li { border-top: .5px solid var(--wcb-line); }
2227
+ .wcb-scope-list > li:first-child { border-top: 0; }
2228
+ .wcb-check-row { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px 0; cursor: pointer; }
2229
+ .wcb-check-row input { flex: none; width: 16px; height: 16px; margin: 0; accent-color: var(--dsw-alias-brand-primary, #0f1115); cursor: inherit; }
2230
+ .wcb-check-row input:focus-visible { outline: var(--wcb-focus-width) solid var(--wcb-focus); outline-offset: 2px; }
2231
+ .wcb-check-row:has(input:disabled) { cursor: default; opacity: .5; }
2232
+ .wcb-scope-list + .wcb-hint { margin: 4px 0 0 22px; }
2233
+
2234
+ /* Dialog content. The dialog itself keeps DSH's padding; only its width and
2235
+ the stacking of our own content are set here. */
2236
+ [role="dialog"].wcb-dialog { width: min(480px, 100%); }
2237
+ .wcb-dialog-body { display: flex; flex-direction: column; gap: 14px; min-width: 0; color: var(--wcb-text); font-size: 13px; line-height: 20px; }
2238
+ .wcb-facts { margin: 0; }
2239
+ .wcb-facts > div {
2240
+ display: flex; align-items: center; justify-content: space-between; gap: 16px;
2241
+ min-height: 44px; padding: 8px 0; border-bottom: .5px solid var(--wcb-line);
2242
+ }
2243
+ .wcb-facts > div:last-child { border-bottom: 0; }
2244
+ .wcb-facts dt { flex: none; color: var(--wcb-text-2); }
2245
+ .wcb-facts dd { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; margin: 0; text-align: end; overflow-wrap: anywhere; }
2246
+ .wcb-facts dd .wcb-input, .wcb-facts dd .wcb-select { width: 220px; max-width: 100%; }
2247
+ .wcb-confirm-text { margin: 0; color: var(--wcb-text-2); }
2248
+ .wcb-footer-start { margin-right: auto; }
2249
+ span.wcb-footer-start { display: inline-flex; align-items: center; gap: 8px; }
2250
+ .wcb-picker-list { display: flex; flex-direction: column; max-height: 300px; overflow: auto; margin: 0 -8px; }
2304
2251
  .wcb-picker-row {
2305
- display: flex; align-items: baseline; gap: 10px; width: 100%;
2306
- padding: 8px 12px; background: none; border: none; border-top: .5px solid var(--wcb-line);
2307
- color: inherit; font: inherit; text-align: left; cursor: pointer;
2308
- }
2309
- .wcb-picker-row:first-child { border-top: none; }
2310
- .wcb-picker-row:hover { background: var(--wcb-hover); }
2311
- .wcb-picker-row[data-manual] { border: .5px dashed var(--wcb-line-2); border-radius: 10px; padding: 10px 12px; flex-wrap: wrap; }
2312
- .wcb-picker-hint { color: var(--wcb-text-3); font-size: 12px; min-width: 0; }
2313
- .wcb-confirm-body { color: var(--wcb-text-2); font-size: 13px; }
2314
- .wcb-confirm-body p { margin: 0; }
2252
+ display: flex; align-items: baseline; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: var(--wcb-radius-sm);
2253
+ background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
2254
+ }
2255
+ .wcb-picker-row:hover, .wcb-picker-row:focus-visible { background: var(--wcb-hover); outline: none; }
2256
+ .wcb-picker-hint { min-width: 0; color: var(--wcb-text-3); font-size: 12px; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
2257
+ .wcb-picker-manual { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px dashed var(--wcb-line-strong); border-radius: var(--wcb-radius-md); }
2315
2258
 
2316
- /* The person dialog (portalled, so it re-declares the page tokens). */
2317
- .wcb-modal { padding: 0; }
2318
- .wcb-modal-content { display: flex; flex-direction: column; gap: 14px; }
2319
- .wcb-person-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 18px; }
2320
- .wcb-person-facts + .wcb-hint { margin-top: 0; }
2321
- /* The session block sits under the identity facts, behind a hairline. */
2322
- .wcb-dialog-section { border-top: .5px solid var(--wcb-line); padding-top: 14px; }
2323
- .wcb-dialog-section .wcb-binding-field { margin-top: 12px; }
2324
- .wcb-fact { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
2325
- .wcb-fact-key { color: var(--wcb-text-3); font-size: 11.5px; }
2326
- .wcb-fact-value { min-width: 0; overflow-wrap: anywhere; }
2327
- .wcb-fact-input { width: 100%; }
2328
- .wcb-dialog-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
2329
- .wcb-rejected-text {
2330
- color: var(--wcb-text-2); font-size: 12.5px; padding: 6px 10px; border-radius: 8px;
2331
- background: var(--wcb-surface-2); border-left: 2px solid var(--wcb-line-2);
2332
- white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
2259
+ @media (max-width: 640px) {
2260
+ .wcb-editor-grid { grid-template-columns: minmax(0, 1fr); }
2261
+ .wcb-row-meta { display: none; }
2262
+ }
2263
+ @media (prefers-reduced-motion: reduce) {
2264
+ .wcb-chevron { transition: none; }
2333
2265
  }
2334
2266
  `
2335
2267
  );
@@ -2342,7 +2274,7 @@ window.__ModuleLoader__.load({
2342
2274
  }
2343
2275
 
2344
2276
  // src/client/index.tsx
2345
- var import_jsx_runtime9 = require("react/jsx-runtime");
2277
+ var import_jsx_runtime10 = require("react/jsx-runtime");
2346
2278
  var inject = ["slots", "configForms", "remote", "remote.credentials"];
2347
2279
  function apply(ctx) {
2348
2280
  const slots = ctx.get("slots");
@@ -2359,7 +2291,7 @@ window.__ModuleLoader__.load({
2359
2291
  ctx.effect(() => insertStyles(), "wecom-bot: styles");
2360
2292
  ctx.effect(() => forms.whileServed([CONFIG_NAMESPACE], () => slots.inject("plugins.bundle.config", () => slots.register(
2361
2293
  { name: "plugins.bundle.config", key: PACKAGE_NAME },
2362
- ({ view }) => view === "page" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SettingsPage, { scope: forms.get(CONFIG_NAMESPACE), remote, onOpenSession: openSession }) : null
2294
+ ({ view }) => view === "page" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SettingsPage, { scope: forms.get(CONFIG_NAMESPACE), remote, onOpenSession: openSession }) : null
2363
2295
  ))), "wecom-bot: plugin homepage");
2364
2296
  }
2365
2297