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