@lemoncat7/dsh-partner 1.14.2 → 1.16.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.
Files changed (74) hide show
  1. package/README.md +25 -3
  2. package/docs/architecture.md +2 -0
  3. package/docs/direct-channels.md +24 -0
  4. package/docs/notification-delivery.md +24 -0
  5. package/docs/releases/1.15.0.md +20 -0
  6. package/docs/releases/1.16.0.md +22 -0
  7. package/lib/agent-runtime.d.ts.map +1 -1
  8. package/lib/agent-runtime.js +27 -9
  9. package/lib/agent-runtime.js.map +1 -1
  10. package/lib/api.d.ts.map +1 -1
  11. package/lib/api.js +109 -1
  12. package/lib/api.js.map +1 -1
  13. package/lib/channels/direct/discovery.d.ts +5 -0
  14. package/lib/channels/direct/discovery.d.ts.map +1 -0
  15. package/lib/channels/direct/discovery.js +84 -0
  16. package/lib/channels/direct/discovery.js.map +1 -0
  17. package/lib/channels/direct/login-cache.d.ts +21 -0
  18. package/lib/channels/direct/login-cache.d.ts.map +1 -0
  19. package/lib/channels/direct/login-cache.js +42 -0
  20. package/lib/channels/direct/login-cache.js.map +1 -0
  21. package/lib/channels/direct/login.d.ts +15 -0
  22. package/lib/channels/direct/login.d.ts.map +1 -0
  23. package/lib/channels/direct/login.js +78 -0
  24. package/lib/channels/direct/login.js.map +1 -0
  25. package/lib/channels/direct/transport.d.ts +49 -0
  26. package/lib/channels/direct/transport.d.ts.map +1 -0
  27. package/lib/channels/direct/transport.js +152 -0
  28. package/lib/channels/direct/transport.js.map +1 -0
  29. package/lib/channels/manager.d.ts +9 -1
  30. package/lib/channels/manager.d.ts.map +1 -1
  31. package/lib/channels/manager.js +169 -20
  32. package/lib/channels/manager.js.map +1 -1
  33. package/lib/channels/notification-delivery.d.ts +28 -0
  34. package/lib/channels/notification-delivery.d.ts.map +1 -0
  35. package/lib/channels/notification-delivery.js +69 -0
  36. package/lib/channels/notification-delivery.js.map +1 -0
  37. package/lib/channels/notification-route.d.ts +12 -0
  38. package/lib/channels/notification-route.d.ts.map +1 -0
  39. package/lib/channels/notification-route.js +35 -0
  40. package/lib/channels/notification-route.js.map +1 -0
  41. package/lib/client-api.d.ts +20 -0
  42. package/lib/client-api.d.ts.map +1 -1
  43. package/lib/client-api.js.map +1 -1
  44. package/lib/client.d.ts.map +1 -1
  45. package/lib/client.js +807 -296
  46. package/lib/client.js.map +4 -4
  47. package/lib/concern-store.d.ts +2 -0
  48. package/lib/concern-store.d.ts.map +1 -1
  49. package/lib/concern-store.js +13 -0
  50. package/lib/concern-store.js.map +1 -1
  51. package/lib/domain.d.ts +24 -0
  52. package/lib/domain.d.ts.map +1 -1
  53. package/lib/domain.js.map +1 -1
  54. package/lib/heartbeat.d.ts +1 -0
  55. package/lib/heartbeat.d.ts.map +1 -1
  56. package/lib/heartbeat.js +25 -13
  57. package/lib/heartbeat.js.map +1 -1
  58. package/lib/store.js +15 -0
  59. package/lib/store.js.map +1 -1
  60. package/lib/ui/channels-panel.d.ts +9 -0
  61. package/lib/ui/channels-panel.d.ts.map +1 -0
  62. package/lib/ui/channels-panel.js +66 -0
  63. package/lib/ui/channels-panel.js.map +1 -0
  64. package/lib/ui/notification-settings.d.ts +7 -0
  65. package/lib/ui/notification-settings.d.ts.map +1 -0
  66. package/lib/ui/notification-settings.js +33 -0
  67. package/lib/ui/notification-settings.js.map +1 -0
  68. package/lib/ui/partner-components.js +1 -1
  69. package/lib/ui/partner-components.js.map +1 -1
  70. package/lib/ui/use-channel-status.d.ts +4 -0
  71. package/lib/ui/use-channel-status.d.ts.map +1 -0
  72. package/lib/ui/use-channel-status.js +46 -0
  73. package/lib/ui/use-channel-status.js.map +1 -0
  74. package/package.json +6 -2
package/lib/client.js CHANGED
@@ -35,7 +35,7 @@ __export(client_exports, {
35
35
  inject: () => inject
36
36
  });
37
37
  module.exports = __toCommonJS(client_exports);
38
- var import_react40 = require("react");
38
+ var import_react43 = require("react");
39
39
 
40
40
  // src/workspace-ownership.ts
41
41
  var WORKSPACE_ACTIVATE_EVENT = "@lemoncat7/dsh-plugin-ui/workspace-activate";
@@ -1159,7 +1159,35 @@ var QRCodeSVG = import_react.default.forwardRef(
1159
1159
  QRCodeSVG.displayName = "QRCodeSVG";
1160
1160
 
1161
1161
  // src/client.css
1162
- var client_default = `.dsh-partner-sidebar,
1162
+ var client_default = `.dsh-partner-channel-toolbar { display:flex; align-items:center; justify-content:space-between; gap:16px; }
1163
+ .dsh-partner-channel-toolbar > button { flex-shrink:0; min-height:44px; }
1164
+ .dsh-partner-channel-list { display:grid; gap:12px; }
1165
+ .dsh-partner-channels > .dsh-partner-channel-notifications { margin-top:24px; padding-top:24px; border-top:1px solid var(--partner-separator); }
1166
+ .dsh-partner-workspace .dsh-partner-channel-form { display:grid; grid-template-columns:minmax(0,1fr); gap:18px; }
1167
+ .dsh-partner-workspace .dsh-partner-channel-form > .dsh-partner-channel-field { display:grid; grid-template-columns:minmax(0,1fr); gap:8px; min-width:0; margin:0; }
1168
+ .dsh-partner-channel-field > span { font-weight:600; }
1169
+ .dsh-partner-channel-field > small { color:var(--partner-text-secondary); line-height:1.5; text-align:start; overflow-wrap:anywhere; }
1170
+ .dsh-partner-workspace .dsh-partner-channel-field > :is(input,select) { width:100%; min-width:0; min-height:44px; box-sizing:border-box; }
1171
+ .dsh-partner-channel-form > footer { display:flex; flex-wrap:wrap; gap:8px; justify-content:flex-end; }
1172
+ .dsh-partner-channel-row { min-width:0; display:flex; align-items:center; gap:12px; padding:16px; border:1px solid var(--partner-border); border-radius:14px; background:var(--partner-card-surface); box-shadow:var(--partner-card-shadow); }
1173
+ .dsh-partner-channel-row > span:first-child { flex:1; min-width:0; display:grid; gap:4px; overflow-wrap:anywhere; }
1174
+ .dsh-partner-channel-row > span:first-child small { color:var(--partner-text-secondary); font-size:13px; }
1175
+ .dsh-partner-channel-row > button { flex-shrink:0; min-height:44px; padding-inline:18px; }
1176
+ .dsh-partner-channel-detail { padding:0 16px 16px; display:grid; gap:16px; overflow-wrap:anywhere; }
1177
+ .dsh-partner-channel-detail > form + form { border-top:1px solid var(--partner-border); padding-top:16px; }
1178
+ .dsh-partner-channel-manage { padding:0; gap:20px; }
1179
+ .dsh-partner-channel-connection { display:flex; align-items:center; gap:16px; }
1180
+ .dsh-partner-channel-connection > span:first-child { flex:1; min-width:0; display:grid; gap:6px; }
1181
+ .dsh-partner-channel-manage p { margin:0; color:var(--partner-text-secondary); line-height:1.6; }
1182
+ .dsh-partner-channel-manage small { color:var(--partner-text-secondary); }
1183
+ .dsh-partner-channel-manage .dsh-partner-form-actions { flex-wrap:wrap; gap:12px; }
1184
+ .dsh-partner-channel-manage button { flex-shrink:0; white-space:nowrap; min-height:44px; padding-inline:16px; }
1185
+ .dsh-partner-channel-access { padding-top:20px; border-top:1px solid var(--partner-separator); display:grid; gap:12px; }
1186
+ .dsh-partner-channel-access h3 { margin:0; font-size:var(--partner-font-label); }
1187
+ .dsh-partner-channel-person { display:flex; align-items:center; flex-wrap:wrap; gap:16px; padding:16px; border:1px solid var(--partner-border); border-radius:12px; background:var(--partner-control); }
1188
+ .dsh-partner-channel-person > div { display:grid; gap:6px; flex:1 1 200px; min-width:0; }
1189
+ .dsh-partner-channel-person code { font-size:16px; letter-spacing:.1em; font-weight:600; }
1190
+ .dsh-partner-sidebar,
1163
1191
  .dsh-partner-pendant,
1164
1192
  .dsh-partner-workspace {
1165
1193
  color-scheme: light;
@@ -3226,8 +3254,8 @@ function WeixinGlyph({ large = false }) {
3226
3254
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("b", {})
3227
3255
  ] });
3228
3256
  }
3229
- function TabButton({ active, onClick, icon, children }) {
3230
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("button", { type: "button", className: active ? "is-active" : "", "aria-current": active ? "page" : void 0, onClick, children: [
3257
+ function TabButton({ active: active2, onClick, icon, children }) {
3258
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("button", { type: "button", className: active2 ? "is-active" : "", "aria-current": active2 ? "page" : void 0, onClick, children: [
3231
3259
  icon,
3232
3260
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children })
3233
3261
  ] });
@@ -3261,7 +3289,7 @@ function relativeTime(value) {
3261
3289
  return minutes < 1 ? "\u521A\u521A" : minutes < 60 ? `${minutes} \u5206\u949F\u524D` : minutes < 1440 ? `${Math.floor(minutes / 60)} \u5C0F\u65F6\u524D` : `${Math.floor(minutes / 1440)} \u5929\u524D`;
3262
3290
  }
3263
3291
  function channelStatusLabel(status) {
3264
- return status === "running" ? "\u5FAE\u4FE1\u5728\u7EBF" : status === "starting" ? "\u8FDE\u63A5\u4E2D" : status === "error" ? "\u8FDE\u63A5\u5F02\u5E38" : "\u5DF2\u505C\u7528";
3292
+ return status === "running" ? "\u5DF2\u8FDE\u63A5" : status === "starting" ? "\u8FDE\u63A5\u4E2D" : status === "error" ? "\u8FDE\u63A5\u5F02\u5E38" : "\u5DF2\u505C\u7528";
3265
3293
  }
3266
3294
 
3267
3295
  // src/ui/memory/memory-detail.tsx
@@ -3718,10 +3746,10 @@ function useMemoryResource(path, pollMs = 0) {
3718
3746
  setError(void 0);
3719
3747
  setLoading(Boolean(path));
3720
3748
  let disposed = false;
3721
- let timer;
3749
+ let timer2;
3722
3750
  const schedule = () => {
3723
- if (timer) clearTimeout(timer);
3724
- if (!disposed && pollMs > 0) timer = setTimeout(() => {
3751
+ if (timer2) clearTimeout(timer2);
3752
+ if (!disposed && pollMs > 0) timer2 = setTimeout(() => {
3725
3753
  void tick();
3726
3754
  }, pollMs);
3727
3755
  };
@@ -3732,7 +3760,7 @@ function useMemoryResource(path, pollMs = 0) {
3732
3760
  };
3733
3761
  const visible = () => {
3734
3762
  if (!document.hidden) {
3735
- if (timer) clearTimeout(timer);
3763
+ if (timer2) clearTimeout(timer2);
3736
3764
  void tick();
3737
3765
  }
3738
3766
  };
@@ -3740,7 +3768,7 @@ function useMemoryResource(path, pollMs = 0) {
3740
3768
  if (pollMs) document.addEventListener("visibilitychange", visible);
3741
3769
  return () => {
3742
3770
  disposed = true;
3743
- if (timer) clearTimeout(timer);
3771
+ if (timer2) clearTimeout(timer2);
3744
3772
  document.removeEventListener("visibilitychange", visible);
3745
3773
  ++sequence.current;
3746
3774
  request.current?.abort();
@@ -4363,7 +4391,7 @@ function RecordTargetPicker({ companionId, value, onChange }) {
4363
4391
  const controller = new AbortController();
4364
4392
  setLoading(true);
4365
4393
  setError("");
4366
- const timer = window.setTimeout(() => {
4394
+ const timer2 = window.setTimeout(() => {
4367
4395
  api(`/companions/${encodeURIComponent(companionId)}/recording-sources?q=${encodeURIComponent(query)}`, { signal: controller.signal }).then((result) => {
4368
4396
  if (!controller.signal.aborted) setItems(result.items);
4369
4397
  }).catch(() => {
@@ -4376,7 +4404,7 @@ function RecordTargetPicker({ companionId, value, onChange }) {
4376
4404
  });
4377
4405
  }, 180);
4378
4406
  return () => {
4379
- window.clearTimeout(timer);
4407
+ window.clearTimeout(timer2);
4380
4408
  controller.abort();
4381
4409
  };
4382
4410
  }, [companionId, query, open]);
@@ -4482,7 +4510,7 @@ function ConcernEditor({ companionId, item, close, saved }) {
4482
4510
  var import_jsx_runtime16 = require("react/jsx-runtime");
4483
4511
  function ConcernBoard({ companionId, activity, value, busy, onValue, onAdd, onCheck, onAct, onEdited }) {
4484
4512
  const visible = activity.concerns.filter((item) => item.state !== "archived");
4485
- const active = visible.filter((item) => item.state !== "resolved");
4513
+ const active2 = visible.filter((item) => item.state !== "resolved");
4486
4514
  const resolved = visible.filter((item) => item.state === "resolved");
4487
4515
  const latest = new Map([...activity.observations].reverse().map((item) => [item.concernId, item]));
4488
4516
  const [editing, setEditing] = (0, import_react15.useState)();
@@ -4498,7 +4526,7 @@ function ConcernBoard({ companionId, activity, value, busy, onValue, onAdd, onCh
4498
4526
  const [activeSource, setActiveSource] = (0, import_react15.useState)(0);
4499
4527
  const inputRef = (0, import_react15.useRef)(null);
4500
4528
  const listboxId = (0, import_react15.useId)();
4501
- const shown = active.slice(0, visibleCount);
4529
+ const shown = active2.slice(0, visibleCount);
4502
4530
  const suggestionsOpen = composing && mention !== void 0;
4503
4531
  (0, import_react15.useEffect)(() => {
4504
4532
  if (!suggestionsOpen || mention === void 0) {
@@ -4508,7 +4536,7 @@ function ConcernBoard({ companionId, activity, value, busy, onValue, onAdd, onCh
4508
4536
  return;
4509
4537
  }
4510
4538
  const controller = new AbortController();
4511
- const timer = window.setTimeout(() => {
4539
+ const timer2 = window.setTimeout(() => {
4512
4540
  setSourcesLoading(true);
4513
4541
  setSourceError(void 0);
4514
4542
  const params = new URLSearchParams({ q: mention.query });
@@ -4527,7 +4555,7 @@ function ConcernBoard({ companionId, activity, value, busy, onValue, onAdd, onCh
4527
4555
  });
4528
4556
  }, 150);
4529
4557
  return () => {
4530
- window.clearTimeout(timer);
4558
+ window.clearTimeout(timer2);
4531
4559
  controller.abort();
4532
4560
  };
4533
4561
  }, [companionId, mention?.query, suggestionsOpen]);
@@ -4559,7 +4587,7 @@ function ConcernBoard({ companionId, activity, value, busy, onValue, onAdd, onCh
4559
4587
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { children: [
4560
4588
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("strong", { id: "partner-concerns-title", children: [
4561
4589
  "\u4F19\u4F34\u5728\u610F\u7684\u4E8B ",
4562
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("b", { children: active.length })
4590
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("b", { children: active2.length })
4563
4591
  ] }),
4564
4592
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { children: "\u5C1A\u672A\u95ED\u73AF\u3001\u503C\u5F97\u7EE7\u7EED\u7559\u610F\u7684\u4E8B\u60C5" })
4565
4593
  ] }),
@@ -4657,7 +4685,7 @@ function ConcernBoard({ companionId, activity, value, busy, onValue, onAdd, onCh
4657
4685
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "submit", className: "is-primary", disabled: busy || !value.trim(), children: "\u8BA9\u4F19\u4F34\u8BB0\u7740" })
4658
4686
  ] })
4659
4687
  ] }),
4660
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "dsh-partner-concern-list", role: "list", children: active.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "dsh-partner-concern-empty", children: "\u6700\u8FD1\u6CA1\u6709\u672A\u95ED\u73AF\u7684\u4E8B\u3002\u4F60\u4E5F\u53EF\u4EE5\u76F4\u63A5\u5BF9\u4F19\u4F34\u8BF4\u201C\u8FD9\u4E2A\u5E2E\u6211\u7559\u610F\u201D\u3002" }) : shown.map((item) => {
4688
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "dsh-partner-concern-list", role: "list", children: active2.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "dsh-partner-concern-empty", children: "\u6700\u8FD1\u6CA1\u6709\u672A\u95ED\u73AF\u7684\u4E8B\u3002\u4F60\u4E5F\u53EF\u4EE5\u76F4\u63A5\u5BF9\u4F19\u4F34\u8BF4\u201C\u8FD9\u4E2A\u5E2E\u6211\u7559\u610F\u201D\u3002" }) : shown.map((item) => {
4661
4689
  const observation = latest.get(item.id);
4662
4690
  const expanded = expandedId === item.id;
4663
4691
  const status = observation ? concernObservationStatus(observation) : item.state === "active" ? "\u6B63\u5728\u7559\u610F" : "\u6682\u65F6\u8BB0\u7740";
@@ -4719,9 +4747,9 @@ function ConcernBoard({ companionId, activity, value, busy, onValue, onAdd, onCh
4719
4747
  ] })
4720
4748
  ] }, item.id);
4721
4749
  }) }),
4722
- (active.length > shown.length || visibleCount > 5) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "dsh-partner-concern-more", children: active.length > shown.length ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("button", { type: "button", onClick: () => setVisibleCount((count) => Math.min(active.length, count + 20)), children: [
4750
+ (active2.length > shown.length || visibleCount > 5) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "dsh-partner-concern-more", children: active2.length > shown.length ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("button", { type: "button", onClick: () => setVisibleCount((count) => Math.min(active2.length, count + 20)), children: [
4723
4751
  "\u518D\u663E\u793A ",
4724
- Math.min(20, active.length - shown.length),
4752
+ Math.min(20, active2.length - shown.length),
4725
4753
  " \u6761"
4726
4754
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", onClick: () => setVisibleCount(5), children: "\u6536\u8D77\u5217\u8868" }) }),
4727
4755
  resolved.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("details", { className: "dsh-partner-concern-resolved", children: [
@@ -4785,11 +4813,11 @@ function ConcernPanel({ companion, snapshot, onChanged }) {
4785
4813
  refresh.current = { onChanged, reload: resource.reload };
4786
4814
  (0, import_react16.useEffect)(() => {
4787
4815
  let disposed = false;
4788
- let timer;
4816
+ let timer2;
4789
4817
  const controller = new AbortController();
4790
4818
  awaitingCheck.current = false;
4791
4819
  setChecking(false);
4792
- const poll = async () => {
4820
+ const poll2 = async () => {
4793
4821
  try {
4794
4822
  if (document.hidden) return;
4795
4823
  const status = await api(`${base}/heartbeat/status`, { signal: controller.signal });
@@ -4803,16 +4831,16 @@ function ConcernPanel({ companion, snapshot, onChanged }) {
4803
4831
  if (status.running) awaitingCheck.current = true;
4804
4832
  } catch {
4805
4833
  } finally {
4806
- if (!disposed) timer = setTimeout(() => {
4807
- void poll();
4834
+ if (!disposed) timer2 = setTimeout(() => {
4835
+ void poll2();
4808
4836
  }, 3e3);
4809
4837
  }
4810
4838
  };
4811
- void poll();
4839
+ void poll2();
4812
4840
  return () => {
4813
4841
  disposed = true;
4814
4842
  controller.abort();
4815
- clearTimeout(timer);
4843
+ clearTimeout(timer2);
4816
4844
  };
4817
4845
  }, [base]);
4818
4846
  const lock = (0, import_react16.useRef)(false);
@@ -5327,10 +5355,10 @@ function usePartnerInbox() {
5327
5355
  }, []);
5328
5356
  (0, import_react20.useEffect)(() => {
5329
5357
  mounted.current = true;
5330
- let timer, request, failures = 0, stopped = false;
5331
- const poll = async () => {
5358
+ let timer2, request, failures = 0, stopped = false;
5359
+ const poll2 = async () => {
5332
5360
  if (stopped || document.hidden || request) return;
5333
- clearTimeout(timer);
5361
+ clearTimeout(timer2);
5334
5362
  request = new AbortController();
5335
5363
  const epoch = mutationEpoch.current;
5336
5364
  const timeout = setTimeout(() => request?.abort(), 12e3);
@@ -5354,22 +5382,22 @@ function usePartnerInbox() {
5354
5382
  } finally {
5355
5383
  clearTimeout(timeout);
5356
5384
  request = void 0;
5357
- if (!stopped && !document.hidden) timer = setTimeout(() => {
5358
- void poll();
5385
+ if (!stopped && !document.hidden) timer2 = setTimeout(() => {
5386
+ void poll2();
5359
5387
  }, Math.min(3e4, 4e3 * 2 ** failures));
5360
5388
  }
5361
5389
  };
5362
5390
  const visibility = () => {
5363
- clearTimeout(timer);
5391
+ clearTimeout(timer2);
5364
5392
  if (document.hidden) request?.abort();
5365
- else void poll();
5393
+ else void poll2();
5366
5394
  };
5367
5395
  document.addEventListener("visibilitychange", visibility);
5368
- void poll();
5396
+ void poll2();
5369
5397
  return () => {
5370
5398
  stopped = true;
5371
5399
  mounted.current = false;
5372
- clearTimeout(timer);
5400
+ clearTimeout(timer2);
5373
5401
  request?.abort();
5374
5402
  document.removeEventListener("visibilitychange", visibility);
5375
5403
  };
@@ -6650,16 +6678,16 @@ function useBoardRefresh(read, failed, enabled = true) {
6650
6678
  if (!enabled) return;
6651
6679
  mounted.current = true;
6652
6680
  void refresh();
6653
- const poll = () => {
6681
+ const poll2 = () => {
6654
6682
  if (!pending.current && document.visibilityState === "visible") void refresh();
6655
6683
  };
6656
- const timer = window.setInterval(poll, 4e3);
6657
- document.addEventListener("visibilitychange", poll);
6684
+ const timer2 = window.setInterval(poll2, 4e3);
6685
+ document.addEventListener("visibilitychange", poll2);
6658
6686
  return () => {
6659
6687
  mounted.current = false;
6660
6688
  epoch.current++;
6661
- window.clearInterval(timer);
6662
- document.removeEventListener("visibilitychange", poll);
6689
+ window.clearInterval(timer2);
6690
+ document.removeEventListener("visibilitychange", poll2);
6663
6691
  };
6664
6692
  }, [refresh, enabled]);
6665
6693
  return refresh;
@@ -8124,9 +8152,9 @@ function CapabilityEditor({ companion, presets, onChanged }) {
8124
8152
  ] })
8125
8153
  ] }),
8126
8154
  /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "dsh-partner-capabilities", children: group.choices.map((choice) => {
8127
- const active = form.capabilities.includes(choice.id);
8128
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("button", { type: "button", disabled: saving, className: active ? "is-active" : "", "aria-pressed": active, onClick: () => toggle(choice.id), children: [
8129
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: active && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_dsh_client_ui_primitives18.IconCheckOutline14, { size: 14 }) }),
8155
+ const active2 = form.capabilities.includes(choice.id);
8156
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("button", { type: "button", disabled: saving, className: active2 ? "is-active" : "", "aria-pressed": active2, onClick: () => toggle(choice.id), children: [
8157
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: active2 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_dsh_client_ui_primitives18.IconCheckOutline14, { size: 14 }) }),
8130
8158
  /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("strong", { children: choice.title }),
8131
8159
  /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("small", { children: choice.detail })
8132
8160
  ] }, choice.id);
@@ -8254,16 +8282,495 @@ function IdentityEditorForm({ companion, count, onChanged, onRemoved }) {
8254
8282
  ] });
8255
8283
  }
8256
8284
 
8285
+ // src/ui/channels-panel.tsx
8286
+ var import_react39 = require("react");
8287
+
8288
+ // src/ui/notification-settings.tsx
8289
+ var import_react38 = require("react");
8290
+ var import_jsx_runtime35 = require("react/jsx-runtime");
8291
+ function NotificationSettings({ companion, snapshot, onChanged }) {
8292
+ const channels = snapshot.channels.filter((c) => c.companionId === companion.id);
8293
+ const pairings = snapshot.pairings.filter((p) => channels.some((c) => c.id === p.channelId));
8294
+ const [mode, setMode] = (0, import_react38.useState)(companion.notificationDelivery?.mode ?? "recent");
8295
+ const [targets, setTargets] = (0, import_react38.useState)(companion.notificationDelivery?.targets ?? []);
8296
+ const [selectedChannels, setSelectedChannels] = (0, import_react38.useState)(targets.map((t) => t.channelId));
8297
+ const [busy, setBusy] = (0, import_react38.useState)(false), [feedback, setFeedback] = (0, import_react38.useState)(""), [failed, setFailed] = (0, import_react38.useState)(false);
8298
+ const saveRef = (0, import_react38.useRef)(null);
8299
+ (0, import_react38.useEffect)(() => {
8300
+ if (!busy && feedback && document.activeElement === document.body) saveRef.current?.focus();
8301
+ }, [busy, feedback]);
8302
+ const unavailable = targets.filter((t) => !pairings.some((p) => p.channelId === t.channelId && p.userId === t.userId && p.status === "approved") || !channels.some((c) => c.id === t.channelId && c.enabled));
8303
+ const emptyChannel = selectedChannels.some((id) => !targets.some((t) => t.channelId === id));
8304
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("form", { className: "dsh-partner-feature-form dsh-partner-channel-form dsh-partner-delivery-form", "aria-busy": busy, onSubmit: (e) => {
8305
+ e.preventDefault();
8306
+ if (busy) return;
8307
+ setBusy(true);
8308
+ setFeedback("");
8309
+ setFailed(false);
8310
+ const targetPairingIds = targets.map((t) => pairings.find((p) => p.channelId === t.channelId && p.userId === t.userId)?.id);
8311
+ void api(`/companions/${companion.id}/notifications`, { method: "PUT", body: JSON.stringify({ mode, targetPairingIds: mode === "recent" ? [] : targetPairingIds }) }).then(async () => {
8312
+ await onChanged();
8313
+ setFeedback("\u901A\u77E5\u8BBE\u7F6E\u5DF2\u4FDD\u5B58");
8314
+ }).catch((error) => {
8315
+ setFailed(true);
8316
+ setFeedback(errorMessage(error));
8317
+ }).finally(() => setBusy(false));
8318
+ }, children: [
8319
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "dsh-partner-channel-field", children: [
8320
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "\u901A\u77E5\u53D1\u9001\u5230" }),
8321
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("select", { disabled: busy, value: mode, onChange: (e) => setMode(e.target.value), children: [
8322
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: "recent", children: "\u6700\u8FD1\u8054\u7CFB\u7684\u6E20\u9053\u4E0E\u7528\u6237" }),
8323
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: "selected", children: "\u6307\u5B9A\u6E20\u9053\u4E0E\u63A5\u6536\u4EBA" })
8324
+ ] })
8325
+ ] }),
8326
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { children: "\u4EC5\u5F71\u54CD\u4E3B\u52A8\u901A\u77E5\u4E0E\u7ED3\u679C\u4EA4\u4ED8\u3002\u5BF9\u8BDD\u56DE\u590D\u4ECD\u53D1\u9001\u5230\u6D88\u606F\u6765\u6E90\u6E20\u9053\u3002" }),
8327
+ !companion.notificationDelivery && pairings.some((p) => p.deliveryTarget) && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { role: "status", children: "\u5F53\u524D\u4ECD\u4F7F\u7528\u65E7\u7684\u8054\u7CFB\u4EBA\u6295\u9012\u89C4\u5219\uFF0C\u4FDD\u5B58\u540E\u7EDF\u4E00\u4F7F\u7528\u8FD9\u91CC\u7684\u901A\u77E5\u8BBE\u7F6E\u3002" }),
8328
+ mode === "selected" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "dsh-partner-notification-choices", children: [
8329
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { children: "\u53EF\u9009\u62E9\u591A\u4E2A\u6E20\u9053\uFF1B\u6BCF\u4E2A\u6E20\u9053\u81F3\u5C11\u9009\u62E9\u4E00\u4F4D\u5DF2\u6388\u6743\u63A5\u6536\u4EBA\u3002\u4FDD\u5B58\u540E\u5BF9\u65B0\u901A\u77E5\u751F\u6548\uFF0C\u5F85\u91CD\u8BD5\u901A\u77E5\u4FDD\u7559\u539F\u63A5\u6536\u4EBA\u3002" }),
8330
+ !channels.length && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { children: "\u8BF7\u5148\u6DFB\u52A0\u6E20\u9053\u5E76\u6388\u6743\u8054\u7CFB\u4EBA\u3002" }),
8331
+ channels.map((channel) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("fieldset", { disabled: busy, className: "dsh-partner-notification-channel", children: [
8332
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("legend", { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { children: [
8333
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("input", { type: "checkbox", checked: selectedChannels.includes(channel.id), onChange: (e) => {
8334
+ setSelectedChannels((ids) => e.target.checked ? [...ids, channel.id] : ids.filter((id) => id !== channel.id));
8335
+ if (!e.target.checked) setTargets((items) => items.filter((t) => t.channelId !== channel.id));
8336
+ } }),
8337
+ channel.name,
8338
+ !channel.enabled ? "\uFF08\u5DF2\u505C\u7528\uFF09" : ""
8339
+ ] }) }),
8340
+ selectedChannels.includes(channel.id) && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "dsh-partner-notification-users", children: [
8341
+ !pairings.some((p) => p.channelId === channel.id && p.status === "approved") && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { children: "\u6682\u65E0\u5DF2\u6388\u6743\u63A5\u6536\u4EBA\uFF0C\u8BF7\u5148\u5728\u6E20\u9053\u914D\u7F6E\u4E2D\u6279\u51C6\u8054\u7CFB\u4EBA\u3002" }),
8342
+ pairings.filter((p) => p.channelId === channel.id && p.status === "approved").map((p) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { children: [
8343
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("input", { type: "checkbox", checked: targets.some((t) => t.channelId === p.channelId && t.userId === p.userId), onChange: (e) => setTargets((items) => e.target.checked ? [...items, { channelId: p.channelId, userId: p.userId }] : items.filter((t) => t.channelId !== p.channelId || t.userId !== p.userId)) }),
8344
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { children: [
8345
+ p.displayName,
8346
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("small", { children: p.userId })
8347
+ ] })
8348
+ ] }, p.id))
8349
+ ] })
8350
+ ] }, channel.id)),
8351
+ unavailable.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { role: "alert", children: [
8352
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { children: "\u90E8\u5206\u5DF2\u9009\u63A5\u6536\u4EBA\u5DF2\u5931\u6548\u6216\u6E20\u9053\u5DF2\u505C\u7528\u3002\u8BF7\u79FB\u9664\u6216\u6062\u590D\u6388\u6743\uFF0C\u4E0D\u4F1A\u81EA\u52A8\u6539\u53D1\u5176\u4ED6\u4EBA\u3002" }),
8353
+ unavailable.map((t) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("button", { type: "button", disabled: busy, onClick: () => {
8354
+ setTargets((items) => items.filter((x) => x.channelId !== t.channelId || x.userId !== t.userId));
8355
+ if (!targets.some((x) => x.channelId === t.channelId && x.userId !== t.userId)) setSelectedChannels((ids) => ids.filter((id) => id !== t.channelId));
8356
+ }, children: [
8357
+ "\u79FB\u9664 ",
8358
+ t.userId
8359
+ ] }, JSON.stringify(t)))
8360
+ ] })
8361
+ ] }),
8362
+ feedback && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { role: failed ? "alert" : "status", children: feedback }),
8363
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("footer", { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { ref: saveRef, className: "is-primary", disabled: busy || mode === "selected" && (!targets.length || unavailable.length > 0 || emptyChannel), children: busy ? "\u4FDD\u5B58\u4E2D\u2026" : "\u4FDD\u5B58\u901A\u77E5\u8BBE\u7F6E" }) })
8364
+ ] });
8365
+ }
8366
+
8367
+ // src/ui/channels-panel.tsx
8368
+ var import_jsx_runtime36 = require("react/jsx-runtime");
8369
+ function ChannelsPanel({ companion, snapshot, onChanged, weixin }) {
8370
+ const [platform, setPlatform] = (0, import_react39.useState)("matrix");
8371
+ const [name, setName] = (0, import_react39.useState)("");
8372
+ const [baseUrl, setBaseUrl] = (0, import_react39.useState)("");
8373
+ const [targetId, setTargetId] = (0, import_react39.useState)("");
8374
+ const [botToken, setToken] = (0, import_react39.useState)("");
8375
+ const [authMode, setAuthMode] = (0, import_react39.useState)("password");
8376
+ const [username, setUsername] = (0, import_react39.useState)(""), [password, setPassword] = (0, import_react39.useState)(""), [mfaToken, setMfaToken] = (0, import_react39.useState)("");
8377
+ const [busy, setBusy] = (0, import_react39.useState)(false);
8378
+ const [feedback, setFeedback] = (0, import_react39.useState)("");
8379
+ const [deleting, setDeleting] = (0, import_react39.useState)();
8380
+ const [adding, setAdding] = (0, import_react39.useState)(false);
8381
+ const [fixedPlatform, setFixedPlatform] = (0, import_react39.useState)(false);
8382
+ const [configuring, setConfiguring] = (0, import_react39.useState)();
8383
+ const closeAdd = () => {
8384
+ setAdding(false);
8385
+ setToken("");
8386
+ setPassword("");
8387
+ setMfaToken("");
8388
+ };
8389
+ const openAdd = (selected) => {
8390
+ setFixedPlatform(Boolean(selected));
8391
+ setPlatform(selected ?? "matrix");
8392
+ setName("");
8393
+ setBaseUrl("");
8394
+ setTargetId("");
8395
+ setUsername("");
8396
+ setPassword("");
8397
+ setToken("");
8398
+ setMfaToken("");
8399
+ setAuthMode("password");
8400
+ setFeedback("");
8401
+ setAdding(true);
8402
+ };
8403
+ const channels = snapshot.channels.filter((c) => c.companionId === companion.id);
8404
+ const pairings = snapshot.pairings.filter((p) => channels.some((c) => c.id === p.channelId));
8405
+ const run = async (action) => {
8406
+ if (busy) return;
8407
+ setBusy(true);
8408
+ setFeedback("");
8409
+ try {
8410
+ await action();
8411
+ } catch (error) {
8412
+ setFeedback(errorMessage(error));
8413
+ } finally {
8414
+ setBusy(false);
8415
+ }
8416
+ };
8417
+ const configure = async (save) => run(async () => {
8418
+ const body = { companionId: companion.id, platform, name: name.trim() || platform, baseUrl: baseUrl.trim(), targetId: targetId.trim(), authMode, ...authMode === "password" ? { username, password, mfaToken } : { botToken: botToken.trim() } };
8419
+ await api(save ? "/channels" : "/channels/test", { method: "POST", body: JSON.stringify(body) });
8420
+ if (save) {
8421
+ await onChanged();
8422
+ closeAdd();
8423
+ }
8424
+ setFeedback(save ? "\u8D26\u53F7\u5DF2\u4FDD\u5B58\u3002\u8BF7\u542F\u7528\u6E20\u9053\uFF0C\u518D\u5411\u673A\u5668\u4EBA\u53D1\u9001\u79C1\u804A\u6D88\u606F\uFF0C\u6838\u5BF9\u914D\u5BF9\u7801\u5E76\u6279\u51C6\u8054\u7CFB\u4EBA\u3002" : "\u8D26\u53F7\u9A8C\u8BC1\u901A\u8FC7\uFF0C\u53EF\u4EE5\u4FDD\u5B58\u3002");
8425
+ });
8426
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { id: "dsh-partner-channels", className: "dsh-partner-form is-channel dsh-partner-channels", children: [
8427
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-channel-toolbar", children: [
8428
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(SectionHeading, { eyebrow: "CHANNELS", title: "\u6211\u7684\u6E20\u9053", detail: "\u67E5\u770B\u8FDE\u63A5\u72B6\u6001\uFF0C\u7BA1\u7406\u8054\u7CFB\u4EBA\u4E0E\u901A\u77E5\u6295\u9012\u3002" }),
8429
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", onClick: () => openAdd(), children: "\u6DFB\u52A0\u6E20\u9053" })
8430
+ ] }),
8431
+ !adding && feedback && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { role: "status", children: feedback }),
8432
+ adding && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(WorkspaceDialog, { title: fixedPlatform ? `${platform === "matrix" ? "Matrix" : "Mattermost"} \u914D\u7F6E` : "\u6DFB\u52A0\u6E20\u9053", detail: platform === "matrix" ? "\u4EC5\u672A\u52A0\u5BC6\u7684\u53CC\u4EBA\u4F1A\u8BDD\u53EF\u83B7\u53D6\u914D\u5BF9\u7801\u3002\u8BF7\u65B0\u5EFA\u672A\u5F00\u542F\u7AEF\u5230\u7AEF\u52A0\u5BC6\u7684\u4F1A\u8BDD\uFF0C\u9080\u8BF7\u673A\u5668\u4EBA\u540E\u53D1\u9001\u6587\u5B57\u6D88\u606F\u3002" : "\u5148\u767B\u5F55\uFF0C\u518D\u5411\u673A\u5668\u4EBA\u53D1\u79C1\u804A\u6D88\u606F\uFF0C\u6838\u5BF9\u914D\u5BF9\u7801\u540E\u6388\u6743\u3002", close: () => {
8433
+ if (!busy) closeAdd();
8434
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("form", { className: "dsh-partner-feature-form dsh-partner-channel-form", "aria-busy": busy, onSubmit: (event) => {
8435
+ event.preventDefault();
8436
+ void configure(true);
8437
+ }, children: [
8438
+ !fixedPlatform && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(FormField2, { label: "\u5E73\u53F0", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("select", { autoFocus: true, disabled: busy, value: platform, onChange: (e) => {
8439
+ setPlatform(e.target.value);
8440
+ setPassword("");
8441
+ setToken("");
8442
+ setMfaToken("");
8443
+ setTargetId("");
8444
+ setFeedback("");
8445
+ }, children: [
8446
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("option", { value: "matrix", children: "Matrix" }),
8447
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("option", { value: "mattermost", children: "Mattermost" })
8448
+ ] }) }),
8449
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(FormField2, { label: "\u6E20\u9053\u540D\u79F0", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("input", { autoFocus: fixedPlatform, disabled: busy, maxLength: 80, value: name, onChange: (e) => setName(e.target.value), placeholder: `\u4F8B\u5982\uFF1A\u6211\u7684 ${platform === "matrix" ? "Matrix" : "Mattermost"}` }) }),
8450
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(FormField2, { label: "\u670D\u52A1\u5668\u5730\u5740", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("input", { disabled: busy, required: true, type: "url", value: baseUrl, onChange: (e) => setBaseUrl(e.target.value), placeholder: "https://chat.example.com" }) }),
8451
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("details", { children: [
8452
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("summary", { children: "\u9AD8\u7EA7\u914D\u7F6E\uFF08\u53EF\u9009\uFF09" }),
8453
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(FormField2, { label: platform === "matrix" ? "\u56FA\u5B9A\u623F\u95F4 ID" : "\u56FA\u5B9A DM \u4F1A\u8BDD ID", hint: "\u7559\u7A7A\u5219\u81EA\u52A8\u53D1\u73B0\u79C1\u804A\uFF0C\u901A\u8FC7\u914D\u5BF9\u6388\u6743\u3002\u586B\u5199\u540E\u4EC5\u76D1\u542C\u6307\u5B9A\u4F1A\u8BDD\u3002", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("input", { disabled: busy, value: targetId, onChange: (e) => setTargetId(e.target.value), placeholder: platform === "matrix" ? "!room:example.com" : "DM channel ID" }) })
8454
+ ] }),
8455
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(FormField2, { label: "\u767B\u5F55\u65B9\u5F0F", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("select", { disabled: busy, value: authMode, onChange: (e) => {
8456
+ setAuthMode(e.target.value);
8457
+ setToken("");
8458
+ setPassword("");
8459
+ setMfaToken("");
8460
+ }, children: [
8461
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("option", { value: "password", children: "\u8D26\u53F7\u5BC6\u7801" }),
8462
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("option", { value: "token", children: "Access Token" })
8463
+ ] }) }),
8464
+ authMode === "password" ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
8465
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(FormField2, { label: "\u8D26\u53F7", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("input", { disabled: busy, required: true, autoComplete: "username", value: username, onChange: (e) => setUsername(e.target.value), placeholder: platform === "matrix" ? "@\u8D26\u53F7:\u670D\u52A1\u5668\u57DF\u540D" : "\u7528\u6237\u540D\u6216\u90AE\u7BB1" }) }),
8466
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(FormField2, { label: "\u5BC6\u7801", hint: "\u4EC5\u7528\u4E8E\u6362\u53D6\u4EE4\u724C\uFF0C\u4E0D\u4FDD\u5B58\u5BC6\u7801\uFF1B\u8BF7\u4F18\u5148\u4F7F\u7528 HTTPS \u670D\u52A1\u5668\u3002", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("input", { disabled: busy, required: true, type: "password", autoComplete: "current-password", value: password, onChange: (e) => setPassword(e.target.value) }) }),
8467
+ platform === "mattermost" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(FormField2, { label: "\u53CC\u91CD\u9A8C\u8BC1\u9A8C\u8BC1\u7801\uFF08\u5982\u5DF2\u5F00\u542F\uFF09", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("input", { disabled: busy, autoComplete: "one-time-code", inputMode: "numeric", value: mfaToken, onChange: (e) => setMfaToken(e.target.value) }) })
8468
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(FormField2, { label: "Access Token", hint: "\u4EC5\u4FDD\u5B58\u81F3 DSH \u51ED\u636E\u5E93\uFF1B\u5EFA\u8BAE HTTPS\uFF0CHTTP \u4F1A\u660E\u6587\u4F20\u8F93\u51ED\u636E\u3002", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("input", { disabled: busy, required: true, type: "password", autoComplete: "new-password", value: botToken, onChange: (e) => setToken(e.target.value) }) }),
8469
+ feedback && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { role: "status", children: feedback }),
8470
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("footer", { children: [
8471
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", disabled: busy, onClick: closeAdd, children: "\u53D6\u6D88" }),
8472
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", disabled: busy || !(authMode === "password" ? username && password : botToken) || !baseUrl, onClick: () => void configure(false), children: "\u6D4B\u8BD5\u8FDE\u63A5" }),
8473
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { className: "is-primary", disabled: busy, children: busy ? "\u5904\u7406\u4E2D\u2026" : "\u4FDD\u5B58\u6E20\u9053" })
8474
+ ] })
8475
+ ] }) }),
8476
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-channel-list", children: [
8477
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-channel-row", children: [
8478
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
8479
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: "\u5FAE\u4FE1" }),
8480
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: channels.some((c) => !c.platform || c.platform === "weixin") ? "\u7BA1\u7406\u8FDE\u63A5\u4E0E\u79C1\u804A\u6388\u6743" : "\u5C1A\u672A\u8FDE\u63A5 \xB7 \u626B\u7801\u63A5\u5165" })
8481
+ ] }),
8482
+ channels.find((c) => !c.platform || c.platform === "weixin") && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ChannelStatus, { channel: channels.find((c) => !c.platform || c.platform === "weixin") }),
8483
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", "aria-label": "\u914D\u7F6E\u5FAE\u4FE1", onClick: () => setConfiguring("weixin"), children: "\u914D\u7F6E" }),
8484
+ configuring === "weixin" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(WorkspaceDialog, { title: "\u5FAE\u4FE1\u914D\u7F6E", detail: "\u7BA1\u7406\u626B\u7801\u767B\u5F55\u3001\u8FDE\u63A5\u4E0E\u8054\u7CFB\u4EBA\u6388\u6743\u3002", close: () => setConfiguring(void 0), children: weixin })
8485
+ ] }),
8486
+ ["matrix", "mattermost"].filter((platform2) => !channels.some((c) => c.platform === platform2)).map((platform2) => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-channel-row", children: [
8487
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
8488
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: platform2 === "matrix" ? "Matrix" : "Mattermost" }),
8489
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "\u5C1A\u672A\u8FDE\u63A5" })
8490
+ ] }),
8491
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", "aria-label": `\u914D\u7F6E ${platform2}`, onClick: () => openAdd(platform2), children: "\u914D\u7F6E" })
8492
+ ] }, platform2)),
8493
+ channels.filter((c) => c.platform && c.platform !== "weixin").map((channel) => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-channel-row has-notice-slot", children: [
8494
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
8495
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: channel.name }),
8496
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("small", { children: [
8497
+ channel.platform,
8498
+ " \xB7 ",
8499
+ pairings.filter((p) => p.channelId === channel.id && p.status === "pending").length,
8500
+ " \u4E2A\u5F85\u6388\u6743"
8501
+ ] })
8502
+ ] }),
8503
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ChannelStatus, { channel }),
8504
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", "aria-label": `\u914D\u7F6E ${channel.name}`, onClick: () => {
8505
+ setFeedback("");
8506
+ setConfiguring(channel.id);
8507
+ }, children: "\u914D\u7F6E" }),
8508
+ configuring === channel.id && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(WorkspaceDialog, { title: `${channel.name} \xB7 \u914D\u7F6E`, detail: "\u7BA1\u7406\u8FDE\u63A5\u72B6\u6001\u53CA\u8054\u7CFB\u4EBA\u8BBF\u95EE\u6743\u9650\u3002", close: () => {
8509
+ if (!busy) {
8510
+ setConfiguring(void 0);
8511
+ setDeleting(void 0);
8512
+ }
8513
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-channel-detail dsh-partner-channel-manage", children: [
8514
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-channel-connection", children: [
8515
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
8516
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "\u767B\u5F55\u8D26\u53F7" }),
8517
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: channel.accountId }),
8518
+ channel.direct?.targetId && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: channel.direct.targetId })
8519
+ ] }),
8520
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ChannelStatus, { channel })
8521
+ ] }),
8522
+ channel.platform === "matrix" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { children: "\u4EC5\u652F\u6301\u672A\u52A0\u5BC6\u7684\u53CC\u4EBA\u4F1A\u8BDD\u3002\u52A0\u5BC6\u4F1A\u8BDD\u65E0\u6CD5\u8BFB\u53D6\u6D88\u606F\u6216\u53D1\u9001\u914D\u5BF9\u7801\uFF1B\u8BF7\u65B0\u5EFA\u672A\u5F00\u542F\u7AEF\u5230\u7AEF\u52A0\u5BC6\u7684\u4F1A\u8BDD\uFF0C\u9080\u8BF7\u673A\u5668\u4EBA\u540E\u53D1\u9001\u6587\u5B57\u6D88\u606F\u3002\u68C0\u6D4B\u5230\u52A0\u5BC6\u4F1A\u8BDD\u65F6\u4F1A\u5728\u6B64\u63D0\u793A\uFF0C\u4E0D\u5F71\u54CD\u5176\u4ED6\u672A\u52A0\u5BC6\u4F1A\u8BDD\u3002" }),
8523
+ !channel.direct?.targetId && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { children: "\u5411\u673A\u5668\u4EBA\u53D1\u79C1\u804A\u6D88\u606F\uFF0C\u5728\u4E0B\u65B9\u6838\u5BF9\u914D\u5BF9\u7801\u540E\u6279\u51C6\u3002\u8BF7\u6C42\u4F1A\u81EA\u52A8\u66F4\u65B0\u3002" }),
8524
+ channel.lastError && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { role: "alert", children: channel.lastError }),
8525
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-form-actions", children: [
8526
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { disabled: busy, onClick: () => void run(async () => {
8527
+ await api(`/channels/${channel.id}/enabled`, { method: "POST", body: JSON.stringify({ enabled: !channel.enabled }) });
8528
+ await onChanged();
8529
+ }), children: channel.enabled ? "\u505C\u7528" : "\u542F\u7528" }),
8530
+ channel.enabled && channel.runtimeStatus === "error" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { disabled: busy, onClick: () => void run(async () => {
8531
+ await api(`/channels/${channel.id}/enabled`, { method: "POST", body: JSON.stringify({ enabled: true }) });
8532
+ await onChanged();
8533
+ }), children: "\u91CD\u8FDE" }),
8534
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { disabled: busy, onClick: () => deleting === channel.id ? void run(async () => {
8535
+ await api(`/channels/${channel.id}`, { method: "DELETE" });
8536
+ setDeleting(void 0);
8537
+ await onChanged();
8538
+ }) : setDeleting(channel.id), children: deleting === channel.id ? "\u786E\u8BA4\u5220\u9664\u914D\u7F6E\u4E0E\u51ED\u636E" : "\u5220\u9664\u6E20\u9053" }),
8539
+ deleting === channel.id && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { onClick: () => setDeleting(void 0), children: "\u53D6\u6D88" })
8540
+ ] }),
8541
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("section", { className: "dsh-partner-channel-access", children: [
8542
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h3", { children: "\u8054\u7CFB\u4EBA\u6388\u6743" }),
8543
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("p", { role: "status", children: [
8544
+ pairings.filter((p) => p.channelId === channel.id && p.status === "pending").length,
8545
+ " \u4E2A\u7B49\u5F85\u6279\u51C6 \xB7 \u81EA\u52A8\u5237\u65B0"
8546
+ ] }),
8547
+ pairings.filter((p) => p.channelId === channel.id).map((p) => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-channel-person", children: [
8548
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
8549
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: p.displayName }),
8550
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: p.status === "approved" ? "\u5DF2\u6388\u6743" : p.status === "pending" ? "\u7B49\u5F85\u6279\u51C6" : "\u5DF2\u963B\u6B62" }),
8551
+ p.status === "pending" && p.pairingCode && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
8552
+ "\u914D\u5BF9\u7801 ",
8553
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("code", { children: p.pairingCode })
8554
+ ] })
8555
+ ] }),
8556
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { disabled: busy, onClick: () => void run(async () => {
8557
+ await api(`/pairings/${p.id}/status`, { method: "POST", body: JSON.stringify({ status: p.status === "approved" ? "blocked" : "approved" }) });
8558
+ await onChanged();
8559
+ }), children: p.status === "approved" ? "\u64A4\u9500\u6388\u6743" : "\u6279\u51C6\u8054\u7CFB\u4EBA" })
8560
+ ] }, p.id))
8561
+ ] }),
8562
+ feedback && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { role: "status", children: feedback })
8563
+ ] }) }),
8564
+ channel.lastError && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-channel-inline-notice", role: "status", "aria-atomic": "true", children: [
8565
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: channel.runtimeStatus === "running" ? "\u4F1A\u8BDD\u63D0\u793A" : "\u8FDE\u63A5\u63D0\u793A" }),
8566
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { children: channel.lastError })
8567
+ ] })
8568
+ ] }, channel.id))
8569
+ ] }),
8570
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("section", { className: "dsh-partner-channel-notifications", "aria-label": "\u901A\u77E5\u8BBE\u7F6E", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-channel-row", children: [
8571
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
8572
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: "\u901A\u77E5\u4E0E\u4EA4\u4ED8" }),
8573
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: companion.notificationDelivery?.mode === "selected" ? `\u5DF2\u6307\u5B9A ${companion.notificationDelivery.targets.length} \u4F4D\u63A5\u6536\u4EBA` : "\u9ED8\u8BA4\u8DDF\u968F\u6700\u8FD1\u6E20\u9053\u4E0E\u7528\u6237" })
8574
+ ] }),
8575
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", onClick: () => setConfiguring("delivery"), children: "\u914D\u7F6E" })
8576
+ ] }) }),
8577
+ configuring === "delivery" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(WorkspaceDialog, { title: "\u901A\u77E5\u4E0E\u4EA4\u4ED8", detail: "\u9009\u62E9\u901A\u77E5\u6E20\u9053\uFF0C\u518D\u9009\u62E9\u5404\u6E20\u9053\u7684\u63A5\u6536\u4EBA\uFF1B\u652F\u6301\u540C\u65F6\u6295\u9012\u3002", close: () => setConfiguring(void 0), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(NotificationSettings, { companion, snapshot, onChanged }) })
8578
+ ] });
8579
+ }
8580
+ function FormField2({ label, hint, children }) {
8581
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "dsh-partner-channel-field", children: [
8582
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: label }),
8583
+ children,
8584
+ hint && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: hint })
8585
+ ] });
8586
+ }
8587
+
8588
+ // src/ui/use-channel-status.ts
8589
+ var import_react40 = require("react");
8590
+ var listeners2 = /* @__PURE__ */ new Set();
8591
+ var timer;
8592
+ var active;
8593
+ var lastValue = "";
8594
+ async function poll() {
8595
+ if (active || !listeners2.size) return;
8596
+ const controller = new AbortController();
8597
+ active = controller;
8598
+ try {
8599
+ if (document.visibilityState !== "hidden") {
8600
+ const value = await api("/channels/status", { signal: AbortSignal.any([controller.signal, AbortSignal.timeout(1e4)]) });
8601
+ const serialized = JSON.stringify(value);
8602
+ if (serialized !== lastValue) {
8603
+ lastValue = serialized;
8604
+ listeners2.forEach((listener) => listener(value));
8605
+ }
8606
+ }
8607
+ } catch {
8608
+ } finally {
8609
+ if (active === controller) active = void 0;
8610
+ if (listeners2.size) timer = setTimeout(() => void poll(), 3e3);
8611
+ }
8612
+ }
8613
+ function useChannelStatus(setSnapshot) {
8614
+ (0, import_react40.useEffect)(() => {
8615
+ const update = (value) => setSnapshot((previous) => previous ? { ...previous, ...value } : previous);
8616
+ listeners2.add(update);
8617
+ lastValue = "";
8618
+ if (!active) {
8619
+ clearTimeout(timer);
8620
+ void poll();
8621
+ }
8622
+ return () => {
8623
+ listeners2.delete(update);
8624
+ if (!listeners2.size) {
8625
+ clearTimeout(timer);
8626
+ active?.abort();
8627
+ lastValue = "";
8628
+ }
8629
+ };
8630
+ }, [setSnapshot]);
8631
+ }
8632
+
8257
8633
  // src/ui/identity-editor.css
8258
8634
  var identity_editor_default = "/* Own the identity form skin without changing host forms or theme tokens. */\n#dsh-partner-identity-editor.dsh-partner-form {\n min-width: 0;\n padding: 0;\n border: 0;\n background: transparent;\n box-shadow: none;\n color: var(--partner-text);\n font-family: var(--partner-font-family);\n}\n#dsh-partner-identity-editor .dsh-partner-identity-card {\n min-width: 0;\n padding: 20px;\n border: 1px solid var(--partner-border);\n border-radius: 15px;\n background: var(--partner-card-surface);\n box-shadow: var(--partner-card-shadow);\n}\n#dsh-partner-identity-editor .dsh-partner-field > span { flex-wrap: wrap; gap: 4px 12px; }\n#dsh-partner-identity-editor .dsh-partner-field small { text-align: start; }\n#dsh-partner-identity-editor .dsh-partner-field :is(input, textarea) {\n appearance: none;\n box-sizing: border-box;\n width: 100%;\n min-height: 40px;\n padding: 10px 12px;\n border: 1px solid var(--partner-border);\n border-radius: 10px;\n outline: none;\n color: var(--partner-text);\n background: var(--partner-control);\n font: var(--partner-font-label)/1.5 var(--partner-font-family);\n box-shadow: inset 0 1px 0 var(--partner-glass-highlight);\n}\n#dsh-partner-identity-editor .dsh-partner-field textarea { resize: vertical; }\n#dsh-partner-identity-editor .dsh-partner-field :is(input, textarea):focus {\n border-color: var(--partner-focus-ring);\n background: var(--partner-raised);\n box-shadow: 0 0 0 3px color-mix(in srgb, var(--partner-focus-ring) 18%, transparent);\n}\n#dsh-partner-identity-editor .dsh-partner-form-actions { flex-wrap: wrap; gap: 12px; }\n#dsh-partner-identity-editor .dsh-partner-form-actions > button {\n min-height: 40px;\n padding: 0 16px;\n border: 1px solid var(--partner-border);\n border-radius: 10px;\n color: var(--partner-on-accent);\n background: var(--partner-accent-strong);\n box-shadow: none;\n font: 600 var(--partner-font-body)/1.4 var(--partner-font-family);\n}\n#dsh-partner-identity-editor .dsh-partner-form-actions > button:hover:not(:disabled) { filter: brightness(.94); }\n#dsh-partner-identity-editor .dsh-partner-identity-danger { flex-wrap: wrap; }\n#dsh-partner-identity-editor .dsh-partner-identity-danger > span { flex: 1 1 250px; }\n#dsh-partner-identity-editor .dsh-partner-identity-danger > div { display: flex; flex-wrap: wrap; gap: 8px; }\n#dsh-partner-identity-editor .dsh-partner-identity-danger button {\n min-height: 36px;\n padding: 6px 12px;\n border: 1px solid color-mix(in srgb, var(--partner-danger) 24%, transparent);\n border-radius: 8px;\n color: var(--partner-danger);\n background: transparent;\n box-shadow: none;\n font: var(--partner-font-caption)/1.4 var(--partner-font-family);\n}\n#dsh-partner-identity-editor button:focus-visible { outline: 2px solid var(--partner-focus-ring); outline-offset: 3px; }\n#dsh-partner-identity-editor :is(input, textarea, button):disabled { opacity: .55; cursor: default; }\n@media (max-width: 640px) {\n #dsh-partner-identity-editor .dsh-partner-identity-card { padding: 14px; }\n #dsh-partner-identity-editor .dsh-partner-fields.two { grid-template-columns: minmax(0, 1fr); }\n}\n@media (forced-colors: active) {\n #dsh-partner-identity-editor .dsh-partner-field :is(input, textarea):focus { outline: 2px solid Highlight; }\n}\n";
8259
8635
 
8636
+ // src/ui/form-surface.css
8637
+ var form_surface_default = `/* Deliberate, local boundary against host themes with global !important form rules.
8638
+ Keep layout responsive and use the plugin's light/dark material tokens. */
8639
+ .dsh-partner-workspace #dsh-partner-channels .dsh-partner-delivery-settings { display: grid; gap: 10px; }
8640
+ .dsh-partner-workspace #dsh-partner-channels :is(.dsh-partner-delivery-hint, .dsh-partner-delivery-empty) { margin: 0; color: var(--partner-text-secondary); font-size: var(--partner-font-caption); line-height: 1.5; }
8641
+ .dsh-partner-workspace #dsh-partner-channels .dsh-partner-delivery-contact { padding: 0; border: 1px solid var(--partner-border); border-radius: 10px; background: var(--partner-control); }
8642
+ .dsh-partner-workspace #dsh-partner-channels .dsh-partner-delivery-contact > summary { padding: 12px; cursor: pointer; color: var(--partner-text); }
8643
+ .dsh-partner-workspace #dsh-partner-channels .dsh-partner-delivery-contact > summary > span { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; vertical-align: middle; }
8644
+ .dsh-partner-workspace #dsh-partner-channels .dsh-partner-delivery-contact small { color: var(--partner-text-secondary); }
8645
+ .dsh-partner-workspace #dsh-partner-channels .dsh-partner-delivery-form { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 16px; margin: 0; padding: 0; }
8646
+ .dsh-partner-workspace #dsh-partner-channels .dsh-partner-delivery-form > p:not([role="alert"]) { color: var(--partner-text-secondary); background: transparent; padding: 0; }
8647
+ .dsh-partner-workspace #dsh-partner-channels .dsh-partner-delivery-form > p { grid-column: 1 / -1; margin: 0; }
8648
+ .dsh-partner-workspace #dsh-partner-channels .dsh-partner-workspace-dialog:has(.dsh-partner-delivery-form) { width: min(560px, 100%); height: auto; align-self: center; max-height: calc(100% - 24px); border-radius: 16px !important; }
8649
+ .dsh-partner-workspace #dsh-partner-identity-editor.dsh-partner-form,
8650
+ .dsh-partner-workspace #dsh-partner-channels.dsh-partner-form {
8651
+ background: transparent !important;
8652
+ background-image: none !important;
8653
+ border: 0 !important;
8654
+ box-shadow: none !important;
8655
+ font-family: var(--partner-font-family) !important;
8656
+ color: var(--partner-text) !important;
8657
+ }
8658
+ .dsh-partner-workspace #dsh-partner-identity-editor .dsh-partner-identity-card {
8659
+ background: var(--partner-card-surface) !important;
8660
+ border: 1px solid var(--partner-border) !important;
8661
+ border-radius: 15px !important;
8662
+ box-shadow: var(--partner-card-shadow) !important;
8663
+ }
8664
+ .dsh-partner-workspace #dsh-partner-identity-editor .dsh-partner-field :is(input, textarea),
8665
+ .dsh-partner-workspace #dsh-partner-channels .dsh-partner-channel-field > :is(input, select) {
8666
+ appearance: none !important;
8667
+ box-sizing: border-box;
8668
+ min-width: 0;
8669
+ width: 100%;
8670
+ min-height: 40px;
8671
+ padding: 10px 12px !important;
8672
+ color: var(--partner-text) !important;
8673
+ background-color: var(--partner-control) !important;
8674
+ border: 1px solid var(--partner-border) !important;
8675
+ border-radius: 10px !important;
8676
+ box-shadow: inset 0 1px 0 var(--partner-glass-highlight) !important;
8677
+ font: var(--partner-font-label)/1.5 var(--partner-font-family) !important;
8678
+ }
8679
+ .dsh-partner-workspace #dsh-partner-identity-editor .dsh-partner-field :is(input, textarea),
8680
+ .dsh-partner-workspace #dsh-partner-channels .dsh-partner-channel-field > input { background-image: none !important; }
8681
+ .dsh-partner-workspace #dsh-partner-channels .dsh-partner-channel-field > select {
8682
+ padding-right: 36px !important;
8683
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23909095' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
8684
+ background-repeat: no-repeat !important;
8685
+ background-position: right 12px center !important;
8686
+ }
8687
+ .dsh-partner-workspace #dsh-partner-identity-editor button,
8688
+ .dsh-partner-workspace #dsh-partner-channels button {
8689
+ appearance: none !important;
8690
+ display: inline-flex;
8691
+ align-items: center;
8692
+ justify-content: center;
8693
+ gap: 6px;
8694
+ min-height: 40px;
8695
+ padding: 8px 14px !important;
8696
+ border: 1px solid var(--partner-border) !important;
8697
+ border-radius: 10px !important;
8698
+ color: var(--partner-text) !important;
8699
+ background: var(--partner-control) !important;
8700
+ box-shadow: none !important;
8701
+ font: 600 var(--partner-font-body)/1.4 var(--partner-font-family) !important;
8702
+ cursor: pointer;
8703
+ }
8704
+ .dsh-partner-workspace #dsh-partner-identity-editor .dsh-partner-form-actions > button,
8705
+ .dsh-partner-workspace #dsh-partner-channels button.is-primary {
8706
+ color: var(--partner-on-accent) !important;
8707
+ background: var(--partner-accent-strong) !important;
8708
+ }
8709
+ .dsh-partner-workspace #dsh-partner-identity-editor .dsh-partner-identity-danger button:not(.is-secondary) {
8710
+ color: var(--partner-danger) !important;
8711
+ border-color: color-mix(in srgb, var(--partner-danger) 30%, transparent) !important;
8712
+ }
8713
+ .dsh-partner-workspace #dsh-partner-identity-editor .dsh-partner-identity-danger button.is-danger {
8714
+ background: var(--partner-danger) !important;
8715
+ color: var(--partner-on-accent) !important;
8716
+ }
8717
+ .dsh-partner-workspace #dsh-partner-identity-editor button:hover:not(:disabled),
8718
+ .dsh-partner-workspace #dsh-partner-channels button:hover:not(:disabled) { filter: brightness(.94); }
8719
+ .dsh-partner-workspace #dsh-partner-identity-editor :is(input, textarea, button):focus-visible,
8720
+ .dsh-partner-workspace #dsh-partner-channels :is(input, select, button, summary):focus-visible {
8721
+ outline: 2px solid var(--partner-focus-ring) !important;
8722
+ outline-offset: 2px;
8723
+ }
8724
+ .dsh-partner-workspace #dsh-partner-identity-editor :disabled,
8725
+ .dsh-partner-workspace #dsh-partner-channels :disabled { opacity: .55; cursor: not-allowed; }
8726
+ .dsh-partner-workspace #dsh-partner-channels .dsh-partner-workspace-dialog {
8727
+ background: var(--partner-solid-panel) !important;
8728
+ color: var(--partner-text) !important;
8729
+ border: 1px solid var(--partner-border) !important;
8730
+ border-radius: 16px !important;
8731
+ font-family: var(--partner-font-family) !important;
8732
+ box-shadow: 0 22px 58px color-mix(in srgb, #000 18%, transparent), 0 4px 14px color-mix(in srgb, #000 8%, transparent), inset 0 1px 0 var(--partner-card-highlight) !important;
8733
+ }
8734
+ .dsh-partner-workspace #dsh-partner-channels .dsh-partner-workspace-dialog > header {
8735
+ background: var(--partner-solid-raised) !important;
8736
+ color: var(--partner-text) !important;
8737
+ }
8738
+ .dsh-partner-workspace #dsh-partner-channels .dsh-partner-workspace-dialog > header button {
8739
+ width: 32px; min-height: 32px; padding: 0 !important;
8740
+ background: transparent !important; border-color: transparent !important;
8741
+ }
8742
+ .dsh-partner-workspace #dsh-partner-channels .dsh-partner-channel-form {
8743
+ background: transparent !important; box-shadow: none !important; border: 0 !important;
8744
+ color: var(--partner-text) !important;
8745
+ font: var(--partner-font-body)/1.5 var(--partner-font-family) !important;
8746
+ }
8747
+ @media (max-width: 640px) {
8748
+ .dsh-partner-workspace #dsh-partner-channels button,
8749
+ .dsh-partner-workspace #dsh-partner-identity-editor button { min-height: 44px; }
8750
+ .dsh-partner-workspace #dsh-partner-channels .dsh-partner-workspace-dialog { border-radius: 0 !important; border-width: 0 !important; }
8751
+ .dsh-partner-workspace #dsh-partner-channels .dsh-partner-channel-toolbar { align-items: flex-start; flex-wrap: wrap; }
8752
+ }
8753
+
8754
+ .dsh-partner-workspace #dsh-partner-channels .dsh-partner-notification-choices { display: grid; gap: 16px; min-width: 0; }
8755
+ .dsh-partner-workspace #dsh-partner-channels .dsh-partner-notification-channel { margin: 0; padding: 8px 16px; min-width: 0; border: 1px solid var(--partner-border); border-radius: 12px; }
8756
+ .dsh-partner-workspace #dsh-partner-channels .dsh-partner-notification-channel label { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; }
8757
+ .dsh-partner-workspace #dsh-partner-channels .dsh-partner-notification-channel input[type="checkbox"] { appearance: auto !important; width: 18px !important; height: 18px !important; min-height: 0 !important; flex: 0 0 18px; padding: 0 !important; margin: 0 !important; box-shadow: none !important; }
8758
+ .dsh-partner-workspace #dsh-partner-channels .dsh-partner-notification-users { display: grid; gap: 8px; }
8759
+ .dsh-partner-workspace #dsh-partner-channels .dsh-partner-notification-users span { min-width: 0; overflow-wrap: anywhere; }
8760
+ .dsh-partner-workspace #dsh-partner-channels .dsh-partner-notification-users small { display: block; color: var(--partner-text-secondary); }
8761
+ .dsh-partner-workspace #dsh-partner-channels .dsh-partner-channel-row.has-notice-slot { display: grid; grid-template-columns: minmax(0,1fr) auto auto; }
8762
+ .dsh-partner-workspace #dsh-partner-channels .dsh-partner-channel-inline-notice { grid-column: 1 / -1; min-width: 0; padding-top: 12px; border-top: 1px solid var(--partner-border); color: var(--partner-text); font-size: var(--partner-font-body); line-height: 1.6; overflow-wrap: anywhere; }
8763
+ .dsh-partner-workspace #dsh-partner-channels .dsh-partner-channel-inline-notice strong { font-weight: 600; }
8764
+ .dsh-partner-workspace #dsh-partner-channels .dsh-partner-channel-inline-notice p { margin: 4px 0 0; color: var(--partner-text-secondary); }
8765
+ `;
8766
+
8260
8767
  // src/ui/companion-create.tsx
8261
- var import_react38 = require("react");
8768
+ var import_react41 = require("react");
8262
8769
  var import_dsh_client_ui_primitives20 = require("@deepseek-ai/dsh-client-ui-primitives");
8263
- var import_jsx_runtime35 = require("react/jsx-runtime");
8770
+ var import_jsx_runtime37 = require("react/jsx-runtime");
8264
8771
  function CompanionCreateDialog({ close, create }) {
8265
- const [busy, setBusy] = (0, import_react38.useState)(false);
8266
- const [error, setError] = (0, import_react38.useState)();
8772
+ const [busy, setBusy] = (0, import_react41.useState)(false);
8773
+ const [error, setError] = (0, import_react41.useState)();
8267
8774
  const submit = async (event) => {
8268
8775
  event.preventDefault();
8269
8776
  const data = new FormData(event.currentTarget);
@@ -8282,30 +8789,30 @@ function CompanionCreateDialog({ close, create }) {
8282
8789
  setBusy(false);
8283
8790
  }
8284
8791
  };
8285
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(WorkspaceDialog, { title: "\u65B0\u5EFA\u4F19\u4F34", detail: "\u5148\u5EFA\u7ACB\u6E05\u6670\u7684\u8EAB\u4EFD\u548C\u804C\u8D23\u3002\u6A21\u578B\u3001\u5DE5\u5177\u3001Skill \u4E0E\u534F\u4F5C\u6743\u9650\u4F1A\u5728\u521B\u5EFA\u540E\u5355\u72EC\u914D\u7F6E\u3002", close, width: "wide", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("form", { className: "dsh-partner-feature-form dsh-partner-companion-create-form", "aria-busy": busy, onSubmit: (event) => {
8792
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(WorkspaceDialog, { title: "\u65B0\u5EFA\u4F19\u4F34", detail: "\u5148\u5EFA\u7ACB\u6E05\u6670\u7684\u8EAB\u4EFD\u548C\u804C\u8D23\u3002\u6A21\u578B\u3001\u5DE5\u5177\u3001Skill \u4E0E\u534F\u4F5C\u6743\u9650\u4F1A\u5728\u521B\u5EFA\u540E\u5355\u72EC\u914D\u7F6E\u3002", close, width: "wide", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("form", { className: "dsh-partner-feature-form dsh-partner-companion-create-form", "aria-busy": busy, onSubmit: (event) => {
8286
8793
  void submit(event);
8287
8794
  }, children: [
8288
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { children: [
8289
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "\u4F19\u4F34\u540D\u5B57" }),
8290
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("input", { name: "name", required: true, maxLength: 60, autoFocus: true, placeholder: "\u4F8B\u5982\uFF1A\u5C0F\u9ED1" })
8795
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("label", { children: [
8796
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: "\u4F19\u4F34\u540D\u5B57" }),
8797
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("input", { name: "name", required: true, maxLength: 60, autoFocus: true, placeholder: "\u4F8B\u5982\uFF1A\u5C0F\u9ED1" })
8291
8798
  ] }),
8292
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { children: [
8293
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "\u4E3B\u8981\u89D2\u8272" }),
8294
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("input", { name: "role", required: true, maxLength: 120, placeholder: "\u4F8B\u5982\uFF1A\u4EA7\u54C1\u4E0E\u5DE5\u7A0B\u534F\u4F5C\u4F19\u4F34" })
8799
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("label", { children: [
8800
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: "\u4E3B\u8981\u89D2\u8272" }),
8801
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("input", { name: "role", required: true, maxLength: 120, placeholder: "\u4F8B\u5982\uFF1A\u4EA7\u54C1\u4E0E\u5DE5\u7A0B\u534F\u4F5C\u4F19\u4F34" })
8295
8802
  ] }),
8296
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "is-wide", children: [
8297
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "\u4E00\u53E5\u8BDD\u5B9A\u4F4D" }),
8298
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("input", { name: "description", maxLength: 500, placeholder: "\u5B83\u4E3B\u8981\u8D1F\u8D23\u4EC0\u4E48\uFF0C\u4EC0\u4E48\u65F6\u5019\u5E94\u8BE5\u627E\u5B83" })
8803
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("label", { className: "is-wide", children: [
8804
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: "\u4E00\u53E5\u8BDD\u5B9A\u4F4D" }),
8805
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("input", { name: "description", maxLength: 500, placeholder: "\u5B83\u4E3B\u8981\u8D1F\u8D23\u4EC0\u4E48\uFF0C\u4EC0\u4E48\u65F6\u5019\u5E94\u8BE5\u627E\u5B83" })
8299
8806
  ] }),
8300
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "is-wide", children: [
8301
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "\u521D\u59CB\u884C\u4E3A\u51C6\u5219" }),
8302
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("textarea", { name: "instructions", maxLength: 12e3, rows: 7, placeholder: "\u5199\u6E05\u804C\u8D23\u3001\u8868\u8FBE\u65B9\u5F0F\u3001\u5DE5\u4F5C\u8FB9\u754C\u548C\u4EA4\u4ED8\u6807\u51C6\uFF1B\u4E5F\u53EF\u4EE5\u521B\u5EFA\u540E\u518D\u5B8C\u5584" })
8807
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("label", { className: "is-wide", children: [
8808
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: "\u521D\u59CB\u884C\u4E3A\u51C6\u5219" }),
8809
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("textarea", { name: "instructions", maxLength: 12e3, rows: 7, placeholder: "\u5199\u6E05\u804C\u8D23\u3001\u8868\u8FBE\u65B9\u5F0F\u3001\u5DE5\u4F5C\u8FB9\u754C\u548C\u4EA4\u4ED8\u6807\u51C6\uFF1B\u4E5F\u53EF\u4EE5\u521B\u5EFA\u540E\u518D\u5B8C\u5584" })
8303
8810
  ] }),
8304
- error && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(WorkspaceNotice, { children: error }),
8305
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("footer", { children: [
8306
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", disabled: busy, onClick: close, children: "\u53D6\u6D88" }),
8307
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("button", { type: "submit", className: "is-primary", disabled: busy, children: [
8308
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_dsh_client_ui_primitives20.IconPlusOutline16, { size: 14 }),
8811
+ error && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(WorkspaceNotice, { children: error }),
8812
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("footer", { children: [
8813
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", disabled: busy, onClick: close, children: "\u53D6\u6D88" }),
8814
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("button", { type: "submit", className: "is-primary", disabled: busy, children: [
8815
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_dsh_client_ui_primitives20.IconPlusOutline16, { size: 14 }),
8309
8816
  busy ? "\u6B63\u5728\u521B\u5EFA\u2026" : "\u521B\u5EFA\u4F19\u4F34"
8310
8817
  ] })
8311
8818
  ] })
@@ -8313,7 +8820,7 @@ function CompanionCreateDialog({ close, create }) {
8313
8820
  }
8314
8821
 
8315
8822
  // src/main-panel-compat.ts
8316
- var import_react39 = require("react");
8823
+ var import_react42 = require("react");
8317
8824
  function registerMainPanel(ctx, id, priority, render, onHidden = () => {
8318
8825
  }) {
8319
8826
  const layout = ctx.layout;
@@ -8324,7 +8831,7 @@ function registerMainPanel(ctx, id, priority, render, onHidden = () => {
8324
8831
  let disposed = false;
8325
8832
  let generation = 0;
8326
8833
  const Body = (props) => {
8327
- (0, import_react39.useEffect)(() => {
8834
+ (0, import_react42.useEffect)(() => {
8328
8835
  const current2 = ++generation;
8329
8836
  return () => {
8330
8837
  queueMicrotask(() => {
@@ -8351,12 +8858,12 @@ function registerMainPanel(ctx, id, priority, render, onHidden = () => {
8351
8858
 
8352
8859
  // src/client-controller.tsx
8353
8860
  function createPartnerController(ctx, pluginId, render) {
8354
- const listeners2 = /* @__PURE__ */ new Set();
8861
+ const listeners3 = /* @__PURE__ */ new Set();
8355
8862
  let selected;
8356
8863
  let destination;
8357
8864
  let dispose;
8358
8865
  const notify = () => {
8359
- for (const listener of listeners2) listener();
8866
+ for (const listener of listeners3) listener();
8360
8867
  };
8361
8868
  const controller = {
8362
8869
  open(companionId, target) {
@@ -8401,8 +8908,8 @@ function createPartnerController(ctx, pluginId, render) {
8401
8908
  sessions(ctx).open(renewed.sessionId);
8402
8909
  },
8403
8910
  subscribe(listener) {
8404
- listeners2.add(listener);
8405
- return () => listeners2.delete(listener);
8911
+ listeners3.add(listener);
8912
+ return () => listeners3.delete(listener);
8406
8913
  }
8407
8914
  };
8408
8915
  return controller;
@@ -8431,7 +8938,7 @@ function sessions(ctx) {
8431
8938
  }
8432
8939
 
8433
8940
  // src/client.tsx
8434
- var import_jsx_runtime36 = require("react/jsx-runtime");
8941
+ var import_jsx_runtime38 = require("react/jsx-runtime");
8435
8942
  var PLUGIN_ID = "@lemoncat7/dsh-partner";
8436
8943
  var STYLE_ID = `${PLUGIN_ID}/client`;
8437
8944
  var cssText = `${client_default}
@@ -8442,29 +8949,31 @@ ${requirement_board_default}
8442
8949
  ${widget_default}
8443
8950
  ${settings_panel_default}
8444
8951
  ${memory_ui_default}
8445
- ${identity_editor_default}`;
8952
+ ${identity_editor_default}
8953
+ ${form_surface_default}`;
8446
8954
  var WORKSPACE_PAGES = /* @__PURE__ */ new Set(["skills", "board", "schedules", "pendant"]);
8447
8955
  var inject = ["slots", "layout", "sessions"];
8448
8956
  function apply(ctx) {
8449
8957
  ctx.effect(installStyles, "dsh-partner: styles");
8450
- const controller = createPartnerController(ctx, PLUGIN_ID, (props, current2) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(PartnerWorkspace, { ...props, controller: current2 }));
8451
- ctx.slots.inject("shell.overlay", () => ctx.slots.register({ name: "shell.overlay", id: "partner-pendant", order: 30 }, () => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(PartnerPendant, { controller })));
8958
+ const controller = createPartnerController(ctx, PLUGIN_ID, (props, current2) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PartnerWorkspace, { ...props, controller: current2 }));
8959
+ ctx.slots.inject("shell.overlay", () => ctx.slots.register({ name: "shell.overlay", id: "partner-pendant", order: 30 }, () => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PartnerPendant, { controller })));
8452
8960
  ctx.effect(() => observePluginWorkspace(PLUGIN_ID, controller.close), "dsh-partner: exclusive workspace");
8453
8961
  ctx.effect(() => () => controller.close(), "dsh-partner: workspace lifecycle");
8454
8962
  ctx.slots.inject("sidebar.footer.action", () => ctx.slots.register({
8455
8963
  name: "sidebar.footer.action",
8456
8964
  id: "partner",
8457
8965
  order: -120
8458
- }, (props) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(PartnerSidebar, { ...props, controller, collapse: () => ctx.layout.toggleSidebar() })));
8966
+ }, (props) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PartnerSidebar, { ...props, controller, collapse: () => ctx.layout.toggleSidebar() })));
8459
8967
  }
8460
8968
  function PartnerSidebar(props) {
8461
- const ref = (0, import_react40.useRef)(null);
8969
+ const ref = (0, import_react43.useRef)(null);
8462
8970
  useWorkspaceTopAnchor(ref);
8463
- const [open, setOpen] = (0, import_react40.useState)(true);
8464
- const [snapshot, setSnapshot] = (0, import_react40.useState)();
8465
- const [, update] = (0, import_react40.useState)(0);
8466
- (0, import_react40.useEffect)(() => props.controller.subscribe(() => update((value) => value + 1)), [props.controller]);
8467
- (0, import_react40.useEffect)(() => {
8971
+ const [open, setOpen] = (0, import_react43.useState)(true);
8972
+ const [snapshot, setSnapshot] = (0, import_react43.useState)();
8973
+ useChannelStatus(setSnapshot);
8974
+ const [, update] = (0, import_react43.useState)(0);
8975
+ (0, import_react43.useEffect)(() => props.controller.subscribe(() => update((value) => value + 1)), [props.controller]);
8976
+ (0, import_react43.useEffect)(() => {
8468
8977
  void loadPartner().then(setSnapshot).catch(() => {
8469
8978
  });
8470
8979
  }, [props.controller.isOpen()]);
@@ -8472,34 +8981,35 @@ function PartnerSidebar(props) {
8472
8981
  props.controller.open(id);
8473
8982
  if (props.wide && window.matchMedia("(max-width: 820px)").matches) props.collapse();
8474
8983
  };
8475
- if (!props.wide) return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("section", { ref, className: "dsh-partner-sidebar is-rail", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", className: `dsh-partner-rail${props.controller.isOpen() ? " is-active" : ""}`, title: "\u4F19\u4F34", onClick: () => props.controller.toggle(), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconAgentPresetOutline16, { size: 18 }) }) });
8476
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("section", { ref, className: "dsh-partner-sidebar", children: [
8477
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "dsh-partner-sidebar-heading", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("button", { type: "button", className: "dsh-partner-sidebar-title", "aria-expanded": open, onClick: () => setOpen((value) => !value), children: [
8478
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { "data-open": open, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconChevronDownOutline14, { size: 14 }) }),
8984
+ if (!props.wide) return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("section", { ref, className: "dsh-partner-sidebar is-rail", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", className: `dsh-partner-rail${props.controller.isOpen() ? " is-active" : ""}`, title: "\u4F19\u4F34", onClick: () => props.controller.toggle(), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_dsh_client_ui_primitives21.IconAgentPresetOutline16, { size: 18 }) }) });
8985
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("section", { ref, className: "dsh-partner-sidebar", children: [
8986
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "dsh-partner-sidebar-heading", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("button", { type: "button", className: "dsh-partner-sidebar-title", "aria-expanded": open, onClick: () => setOpen((value) => !value), children: [
8987
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { "data-open": open, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_dsh_client_ui_primitives21.IconChevronDownOutline14, { size: 14 }) }),
8479
8988
  "\u4F19\u4F34"
8480
8989
  ] }) }),
8481
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: `dsh-partner-sidebar-list${open ? " is-open" : ""}`, "aria-hidden": !open, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "dsh-partner-sidebar-list-inner", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("button", { type: "button", tabIndex: open ? 0 : -1, className: `dsh-partner-sidebar-row${props.controller.isOpen() ? " is-active" : ""}`, onClick: () => launch(), children: [
8482
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "dsh-partner-sidebar-symbol", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconAgentPresetOutline16, { size: 16 }) }),
8483
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
8484
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: "\u4F19\u4F34\u9762\u677F" }),
8485
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: snapshot ? `${snapshot.companions.length} \u4F4D\u4F19\u4F34 \xB7 ${snapshot.channels.filter((item) => item.runtimeStatus === "running").length} \u4E2A\u5FAE\u4FE1\u5728\u7EBF` : "\u8EAB\u4EFD\u3001\u80FD\u529B\u4E0E\u6E20\u9053" })
8990
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: `dsh-partner-sidebar-list${open ? " is-open" : ""}`, "aria-hidden": !open, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "dsh-partner-sidebar-list-inner", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("button", { type: "button", tabIndex: open ? 0 : -1, className: `dsh-partner-sidebar-row${props.controller.isOpen() ? " is-active" : ""}`, onClick: () => launch(), children: [
8991
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "dsh-partner-sidebar-symbol", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_dsh_client_ui_primitives21.IconAgentPresetOutline16, { size: 16 }) }),
8992
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { children: [
8993
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("strong", { children: "\u4F19\u4F34\u9762\u677F" }),
8994
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("small", { children: snapshot ? `${snapshot.companions.length} \u4F4D\u4F19\u4F34 \xB7 ${snapshot.channels.filter((item) => item.runtimeStatus === "running").length} \u4E2A\u6E20\u9053\u5728\u7EBF` : "\u8EAB\u4EFD\u3001\u80FD\u529B\u4E0E\u6E20\u9053" })
8486
8995
  ] }),
8487
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("i", { className: snapshot?.channels.some((item) => item.runtimeStatus === "running") ? "is-online" : "" })
8996
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("i", { className: snapshot?.channels.some((item) => item.runtimeStatus === "running") ? "is-online" : "" })
8488
8997
  ] }) }) })
8489
8998
  ] });
8490
8999
  }
8491
9000
  function PartnerWorkspace({ controller }) {
8492
- const [snapshot, setSnapshot] = (0, import_react40.useState)();
8493
- const [selectedId, setSelectedId] = (0, import_react40.useState)(controller.selected());
8494
- const [view, setView] = (0, import_react40.useState)(controller.destination()?.page ?? "home");
8495
- const [requestedDestination, setRequestedDestination] = (0, import_react40.useState)(controller.destination());
8496
- const [error, setError] = (0, import_react40.useState)();
8497
- const [loading, setLoading] = (0, import_react40.useState)(true);
8498
- const [creatingCompanion, setCreatingCompanion] = (0, import_react40.useState)(false);
8499
- const [notice, setNotice] = (0, import_react40.useState)();
8500
- const selectionRef = (0, import_react40.useRef)({ selectedId, companions: snapshot?.companions });
9001
+ const [snapshot, setSnapshot] = (0, import_react43.useState)();
9002
+ useChannelStatus(setSnapshot);
9003
+ const [selectedId, setSelectedId] = (0, import_react43.useState)(controller.selected());
9004
+ const [view, setView] = (0, import_react43.useState)(controller.destination()?.page ?? "home");
9005
+ const [requestedDestination, setRequestedDestination] = (0, import_react43.useState)(controller.destination());
9006
+ const [error, setError] = (0, import_react43.useState)();
9007
+ const [loading, setLoading] = (0, import_react43.useState)(true);
9008
+ const [creatingCompanion, setCreatingCompanion] = (0, import_react43.useState)(false);
9009
+ const [notice, setNotice] = (0, import_react43.useState)();
9010
+ const selectionRef = (0, import_react43.useRef)({ selectedId, companions: snapshot?.companions });
8501
9011
  selectionRef.current = { selectedId, companions: snapshot?.companions };
8502
- const refresh = (0, import_react40.useCallback)(async (throwOnError = false) => {
9012
+ const refresh = (0, import_react43.useCallback)(async (throwOnError = false) => {
8503
9013
  try {
8504
9014
  const next = await loadPartner();
8505
9015
  setSnapshot(next);
@@ -8512,10 +9022,10 @@ function PartnerWorkspace({ controller }) {
8512
9022
  setLoading(false);
8513
9023
  }
8514
9024
  }, []);
8515
- (0, import_react40.useEffect)(() => {
9025
+ (0, import_react43.useEffect)(() => {
8516
9026
  void refresh();
8517
9027
  }, [refresh]);
8518
- (0, import_react40.useEffect)(() => controller.subscribe(() => {
9028
+ (0, import_react43.useEffect)(() => controller.subscribe(() => {
8519
9029
  const next = controller.selected();
8520
9030
  if (next) setSelectedId(next);
8521
9031
  const destination = controller.destination();
@@ -8584,18 +9094,18 @@ function PartnerWorkspace({ controller }) {
8584
9094
  setSelectedId(id);
8585
9095
  setView("home");
8586
9096
  };
8587
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("main", { className: "dsh-partner-workspace", children: [
8588
- creatingCompanion && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(CompanionCreateDialog, { close: () => setCreatingCompanion(false), create }),
8589
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("header", { className: "dsh-partner-topbar", children: [
8590
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-topbar-brand", children: [
8591
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", "data-xiaohei-workspace-close": true, onClick: controller.close, "aria-label": "\u8FD4\u56DE\u4F1A\u8BDD", title: "\u8FD4\u56DE\u4F1A\u8BDD", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconChevronLeftOutline14, { size: 15 }) }),
8592
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconAgentPresetOutline16, { size: 18 }),
8593
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
8594
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: "\u4F19\u4F34" }),
8595
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "\u957F\u671F\u8EAB\u4EFD\u4E0E\u5FAE\u4FE1\u6E20\u9053" })
9097
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("main", { className: "dsh-partner-workspace", children: [
9098
+ creatingCompanion && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CompanionCreateDialog, { close: () => setCreatingCompanion(false), create }),
9099
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("header", { className: "dsh-partner-topbar", children: [
9100
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "dsh-partner-topbar-brand", children: [
9101
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", "data-xiaohei-workspace-close": true, onClick: controller.close, "aria-label": "\u8FD4\u56DE\u4F1A\u8BDD", title: "\u8FD4\u56DE\u4F1A\u8BDD", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_dsh_client_ui_primitives21.IconChevronLeftOutline14, { size: 15 }) }),
9102
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_dsh_client_ui_primitives21.IconAgentPresetOutline16, { size: 18 }),
9103
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { children: [
9104
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("strong", { children: "\u4F19\u4F34" }),
9105
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("small", { children: "\u957F\u671F\u8EAB\u4EFD\u4E0E\u6D88\u606F\u6E20\u9053" })
8596
9106
  ] })
8597
9107
  ] }),
8598
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
9108
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
8599
9109
  MobileWorkspaceControls,
8600
9110
  {
8601
9111
  companions: snapshot?.companions ?? [],
@@ -8607,117 +9117,117 @@ function PartnerWorkspace({ controller }) {
8607
9117
  }
8608
9118
  )
8609
9119
  ] }),
8610
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-grid", children: [
8611
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("aside", { className: "dsh-partner-roster", children: [
8612
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-roster-title", children: [
8613
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
8614
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "COMPANIONS" }),
8615
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: "\u4F19\u4F34\u540D\u518C" })
9120
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "dsh-partner-grid", children: [
9121
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("aside", { className: "dsh-partner-roster", children: [
9122
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "dsh-partner-roster-title", children: [
9123
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { children: [
9124
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("small", { children: "COMPANIONS" }),
9125
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("strong", { children: "\u4F19\u4F34\u540D\u518C" })
8616
9126
  ] }),
8617
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", onClick: () => setCreatingCompanion(true), "aria-label": "\u65B0\u5EFA\u4F19\u4F34", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconPlusOutline16, { size: 16 }) })
9127
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", onClick: () => setCreatingCompanion(true), "aria-label": "\u65B0\u5EFA\u4F19\u4F34", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_dsh_client_ui_primitives21.IconPlusOutline16, { size: 16 }) })
8618
9128
  ] }),
8619
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "dsh-partner-roster-list", children: snapshot?.companions.map((companion) => {
9129
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "dsh-partner-roster-list", children: snapshot?.companions.map((companion) => {
8620
9130
  const channel = snapshot.channels.find((item) => item.companionId === companion.id);
8621
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("button", { type: "button", className: !workspacePage && selectedId === companion.id ? "is-active" : "", onClick: () => openCompanion(companion.id), children: [
8622
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Avatar, { name: companion.name }),
8623
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
8624
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: companion.name }),
8625
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: companion.role })
9131
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("button", { type: "button", className: !workspacePage && selectedId === companion.id ? "is-active" : "", onClick: () => openCompanion(companion.id), children: [
9132
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Avatar, { name: companion.name }),
9133
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { children: [
9134
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("strong", { children: companion.name }),
9135
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("small", { children: companion.role })
8626
9136
  ] }),
8627
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("i", { className: channel?.runtimeStatus === "running" ? "is-online" : "", title: channel ? channel.runtimeStatus : "\u672A\u8FDE\u63A5\u6E20\u9053" })
9137
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("i", { className: channel?.runtimeStatus === "running" ? "is-online" : "", title: channel ? channel.runtimeStatus : "\u672A\u8FDE\u63A5\u6E20\u9053" })
8628
9138
  ] }, companion.id);
8629
9139
  }) }),
8630
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("nav", { className: "dsh-partner-workspace-nav", "aria-label": "\u4F19\u4F34\u5DE5\u4F5C\u533A", children: [
8631
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("button", { type: "button", className: view === "skills" ? "is-active" : "", "aria-current": view === "skills" ? "page" : void 0, onClick: () => setView("skills"), children: [
8632
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconBrowseOutline16, { size: 16 }) }),
8633
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: "Skill \u5E02\u573A" }),
8634
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "\u5B89\u88C5\u4E0E\u7BA1\u7406\u80FD\u529B" })
9140
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("nav", { className: "dsh-partner-workspace-nav", "aria-label": "\u4F19\u4F34\u5DE5\u4F5C\u533A", children: [
9141
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("button", { type: "button", className: view === "skills" ? "is-active" : "", "aria-current": view === "skills" ? "page" : void 0, onClick: () => setView("skills"), children: [
9142
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_dsh_client_ui_primitives21.IconBrowseOutline16, { size: 16 }) }),
9143
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("strong", { children: "Skill \u5E02\u573A" }),
9144
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("small", { children: "\u5B89\u88C5\u4E0E\u7BA1\u7406\u80FD\u529B" })
8635
9145
  ] }),
8636
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("button", { type: "button", className: view === "board" ? "is-active" : "", "aria-current": view === "board" ? "page" : void 0, onClick: () => setView("board"), children: [
8637
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconListPenOutline16, { size: 16 }) }),
8638
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: "\u4EFB\u52A1\u770B\u677F" }),
8639
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "\u534F\u4F5C\u3001\u59D4\u6D3E\u4E0E\u9A8C\u6536" })
9146
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("button", { type: "button", className: view === "board" ? "is-active" : "", "aria-current": view === "board" ? "page" : void 0, onClick: () => setView("board"), children: [
9147
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_dsh_client_ui_primitives21.IconListPenOutline16, { size: 16 }) }),
9148
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("strong", { children: "\u4EFB\u52A1\u770B\u677F" }),
9149
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("small", { children: "\u534F\u4F5C\u3001\u59D4\u6D3E\u4E0E\u9A8C\u6536" })
8640
9150
  ] }),
8641
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("button", { type: "button", className: view === "schedules" ? "is-active" : "", "aria-current": view === "schedules" ? "page" : void 0, onClick: () => setView("schedules"), children: [
8642
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconPlayOutline16, { size: 16 }) }),
8643
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: "\u5B9A\u65F6\u4EFB\u52A1" }),
8644
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "\u9009\u62E9\u4F19\u4F34\u5468\u671F\u6267\u884C" })
9151
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("button", { type: "button", className: view === "schedules" ? "is-active" : "", "aria-current": view === "schedules" ? "page" : void 0, onClick: () => setView("schedules"), children: [
9152
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_dsh_client_ui_primitives21.IconPlayOutline16, { size: 16 }) }),
9153
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("strong", { children: "\u5B9A\u65F6\u4EFB\u52A1" }),
9154
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("small", { children: "\u9009\u62E9\u4F19\u4F34\u5468\u671F\u6267\u884C" })
8645
9155
  ] }),
8646
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("button", { type: "button", className: view === "pendant" ? "is-active" : "", "aria-current": view === "pendant" ? "page" : void 0, onClick: () => setView("pendant"), children: [
8647
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconEditOutline16, { size: 16 }) }),
8648
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: "\u5361\u7247\u8BBE\u7F6E" }),
8649
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "\u6302\u9970\u3001\u7EF3\u5B50\u4E0E\u56FE\u6848" })
9156
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("button", { type: "button", className: view === "pendant" ? "is-active" : "", "aria-current": view === "pendant" ? "page" : void 0, onClick: () => setView("pendant"), children: [
9157
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_dsh_client_ui_primitives21.IconEditOutline16, { size: 16 }) }),
9158
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("strong", { children: "\u5361\u7247\u8BBE\u7F6E" }),
9159
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("small", { children: "\u6302\u9970\u3001\u7EF3\u5B50\u4E0E\u56FE\u6848" })
8650
9160
  ] })
8651
9161
  ] }),
8652
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-roster-note", children: [
8653
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconLinkOutline16, { size: 16 }),
8654
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
8655
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: "\u8EAB\u4EFD\u4E0E\u6E20\u9053\u5206\u79BB" }),
8656
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "\u5FAE\u4FE1\u53EA\u8D1F\u8D23\u6536\u53D1\uFF0C\u6743\u9650\u4ECD\u7531 DSH \u5DE5\u5177\u51B3\u5B9A\u3002" })
9162
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "dsh-partner-roster-note", children: [
9163
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_dsh_client_ui_primitives21.IconLinkOutline16, { size: 16 }),
9164
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { children: [
9165
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("strong", { children: "\u8EAB\u4EFD\u4E0E\u6E20\u9053\u5206\u79BB" }),
9166
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("small", { children: "\u6E20\u9053\u53EA\u8D1F\u8D23\u6536\u53D1\uFF0C\u6743\u9650\u4ECD\u7531 DSH \u5DE5\u5177\u51B3\u5B9A\u3002" })
8657
9167
  ] })
8658
9168
  ] })
8659
9169
  ] }),
8660
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("section", { className: `dsh-partner-stage${workspacePage ? " is-workspace-page" : ""}`, children: [
8661
- loading ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ContentState, { title: "\u6B63\u5728\u8BFB\u53D6\u4F19\u4F34\u2026" }) : workspacePage ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-stage-scroll is-workspace-page", children: [
8662
- view === "skills" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(SkillsPanel, {}),
8663
- view === "board" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(RequirementBoard, { initialTaskId: requestedDestination?.taskId, openRequest: requestedDestination }),
8664
- view === "schedules" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(SchedulePanel, { companions: snapshot?.companions ?? [] }),
8665
- view === "pendant" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(PendantSettingsPanel, {})
8666
- ] }) : selected === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ContentState, { title: "\u521B\u5EFA\u7B2C\u4E00\u4E2A\u4F19\u4F34", detail: "\u4F19\u4F34\u4F1A\u4FDD\u5B58\u72EC\u7ACB\u8EAB\u4EFD\u3001\u80FD\u529B\u548C\u5FAE\u4FE1\u4F1A\u8BDD\u3002", action: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { onClick: () => setCreatingCompanion(true), children: "\u65B0\u5EFA\u4F19\u4F34" }) }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
8667
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-identity", children: [
8668
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Avatar, { name: selected.name }),
8669
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
8670
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "ACTIVE COMPANION" }),
8671
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h1", { children: selected.name }),
8672
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { children: selected.description || selected.role })
9170
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("section", { className: `dsh-partner-stage${workspacePage ? " is-workspace-page" : ""}`, children: [
9171
+ loading ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ContentState, { title: "\u6B63\u5728\u8BFB\u53D6\u4F19\u4F34\u2026" }) : workspacePage ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "dsh-partner-stage-scroll is-workspace-page", children: [
9172
+ view === "skills" && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SkillsPanel, {}),
9173
+ view === "board" && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(RequirementBoard, { initialTaskId: requestedDestination?.taskId, openRequest: requestedDestination }),
9174
+ view === "schedules" && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SchedulePanel, { companions: snapshot?.companions ?? [] }),
9175
+ view === "pendant" && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PendantSettingsPanel, {})
9176
+ ] }) : selected === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ContentState, { title: "\u521B\u5EFA\u7B2C\u4E00\u4E2A\u4F19\u4F34", detail: "\u4F19\u4F34\u4F1A\u4FDD\u5B58\u72EC\u7ACB\u8EAB\u4EFD\u3001\u80FD\u529B\u548C\u5FAE\u4FE1\u4F1A\u8BDD\u3002", action: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { onClick: () => setCreatingCompanion(true), children: "\u65B0\u5EFA\u4F19\u4F34" }) }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
9177
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "dsh-partner-identity", children: [
9178
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Avatar, { name: selected.name }),
9179
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { children: [
9180
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("small", { children: "ACTIVE COMPANION" }),
9181
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h1", { children: selected.name }),
9182
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { children: selected.description || selected.role })
8673
9183
  ] }),
8674
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ChannelStatus, { channel: snapshot?.channels.find((item) => item.companionId === selected.id) })
9184
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ChannelStatus, { channel: snapshot?.channels.find((item) => item.companionId === selected.id) })
8675
9185
  ] }),
8676
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("nav", { className: "dsh-partner-tabs", "aria-label": "\u4F19\u4F34\u914D\u7F6E", children: [
8677
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TabButton, { active: view === "home", onClick: () => setView("home"), icon: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconAgentPresetOutline16, { size: 16 }), children: "\u603B\u89C8" }),
8678
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TabButton, { active: view === "identity", onClick: () => setView("identity"), icon: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconEditOutline16, { size: 16 }), children: "\u8EAB\u4EFD" }),
8679
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TabButton, { active: view === "capabilities", onClick: () => setView("capabilities"), icon: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconAgentPresetOutline16, { size: 16 }), children: "\u80FD\u529B" }),
8680
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TabButton, { active: view === "weixin", onClick: () => setView("weixin"), icon: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(WeixinGlyph, {}), children: "\u5FAE\u4FE1" }),
8681
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TabButton, { active: view === "memory", onClick: () => setView("memory"), icon: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconDataOutline16, { size: 16 }), children: "\u8BB0\u5FC6" }),
8682
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TabButton, { active: view === "concerns", onClick: () => setView("concerns"), icon: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconBrowseOutline16, { size: 16 }), children: "\u6301\u7EED\u5173\u6CE8" })
9186
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("nav", { className: "dsh-partner-tabs", "aria-label": "\u4F19\u4F34\u914D\u7F6E", children: [
9187
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TabButton, { active: view === "home", onClick: () => setView("home"), icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_dsh_client_ui_primitives21.IconAgentPresetOutline16, { size: 16 }), children: "\u603B\u89C8" }),
9188
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TabButton, { active: view === "identity", onClick: () => setView("identity"), icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_dsh_client_ui_primitives21.IconEditOutline16, { size: 16 }), children: "\u8EAB\u4EFD" }),
9189
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TabButton, { active: view === "capabilities", onClick: () => setView("capabilities"), icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_dsh_client_ui_primitives21.IconAgentPresetOutline16, { size: 16 }), children: "\u80FD\u529B" }),
9190
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TabButton, { active: view === "weixin", onClick: () => setView("weixin"), icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_dsh_client_ui_primitives21.IconLinkOutline16, { size: 16 }), children: "\u6E20\u9053" }),
9191
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TabButton, { active: view === "memory", onClick: () => setView("memory"), icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_dsh_client_ui_primitives21.IconDataOutline16, { size: 16 }), children: "\u8BB0\u5FC6" }),
9192
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TabButton, { active: view === "concerns", onClick: () => setView("concerns"), icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_dsh_client_ui_primitives21.IconBrowseOutline16, { size: 16 }), children: "\u6301\u7EED\u5173\u6CE8" })
8683
9193
  ] }),
8684
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-stage-scroll", children: [
8685
- notice && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "dsh-partner-inline-notice", role: "status", children: notice }),
8686
- view === "home" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(HomePanel, { companion: selected, snapshot, navigate: setView, openSession, startSession, renewSession }),
8687
- view === "identity" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(IdentityEditor, { companion: selected, count: snapshot?.companions.length ?? 1, onChanged: () => refresh(true), onRemoved: companionRemoved }),
8688
- view === "capabilities" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(CapabilityEditor, { companion: selected, presets: snapshot?.presets ?? [], onChanged: () => refresh(true) }, selected.id),
8689
- view === "weixin" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(WeixinPanel, { companion: selected, snapshot, onChanged: refresh }),
8690
- view === "memory" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(MemoryPanel, { companion: selected, snapshot, openSession, startSession, renewSession, onChanged: refresh }, selected.id),
8691
- view === "concerns" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ConcernPanel, { companion: selected, snapshot, onChanged: refresh }, selected.id)
9194
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "dsh-partner-stage-scroll", children: [
9195
+ notice && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "dsh-partner-inline-notice", role: "status", children: notice }),
9196
+ view === "home" && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(HomePanel, { companion: selected, snapshot, navigate: setView, openSession, startSession, renewSession }),
9197
+ view === "identity" && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(IdentityEditor, { companion: selected, count: snapshot?.companions.length ?? 1, onChanged: () => refresh(true), onRemoved: companionRemoved }),
9198
+ view === "capabilities" && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CapabilityEditor, { companion: selected, presets: snapshot?.presets ?? [], onChanged: () => refresh(true) }, selected.id),
9199
+ view === "weixin" && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ChannelsPanel, { companion: selected, snapshot, onChanged: refresh, weixin: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(WeixinPanel, { companion: selected, snapshot, onChanged: refresh }) }, selected.id),
9200
+ view === "memory" && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(MemoryPanel, { companion: selected, snapshot, openSession, startSession, renewSession, onChanged: refresh }, selected.id),
9201
+ view === "concerns" && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ConcernPanel, { companion: selected, snapshot, onChanged: refresh }, selected.id)
8692
9202
  ] })
8693
9203
  ] }),
8694
- error && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "dsh-partner-error", role: "alert", children: error })
9204
+ error && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "dsh-partner-error", role: "alert", children: error })
8695
9205
  ] })
8696
9206
  ] })
8697
9207
  ] });
8698
9208
  }
8699
9209
  function MobileWorkspaceControls({ companions, selectedId, view, openCompanion, openPage, createCompanion }) {
8700
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-mobile-controls", children: [
8701
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-mobile-companion-row", children: [
8702
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(CompanionPicker, { companions, selectedId, onChange: openCompanion }),
8703
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", className: "dsh-partner-mobile-create", onClick: createCompanion, "aria-label": "\u65B0\u5EFA\u4F19\u4F34", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconPlusOutline16, { size: 17 }) })
9210
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "dsh-partner-mobile-controls", children: [
9211
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "dsh-partner-mobile-companion-row", children: [
9212
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CompanionPicker, { companions, selectedId, onChange: openCompanion }),
9213
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", className: "dsh-partner-mobile-create", onClick: createCompanion, "aria-label": "\u65B0\u5EFA\u4F19\u4F34", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_dsh_client_ui_primitives21.IconPlusOutline16, { size: 17 }) })
8704
9214
  ] }),
8705
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("nav", { className: "dsh-partner-mobile-workspace-nav", "aria-label": "\u4F19\u4F34\u5DE5\u4F5C\u533A\u5FEB\u6377\u5165\u53E3", children: [
8706
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("button", { type: "button", className: view === "skills" ? "is-active" : "", "aria-pressed": view === "skills", onClick: () => openPage("skills"), children: [
8707
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconBrowseOutline16, { size: 16 }),
8708
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Skill" })
9215
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("nav", { className: "dsh-partner-mobile-workspace-nav", "aria-label": "\u4F19\u4F34\u5DE5\u4F5C\u533A\u5FEB\u6377\u5165\u53E3", children: [
9216
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("button", { type: "button", className: view === "skills" ? "is-active" : "", "aria-pressed": view === "skills", onClick: () => openPage("skills"), children: [
9217
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_dsh_client_ui_primitives21.IconBrowseOutline16, { size: 16 }),
9218
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "Skill" })
8709
9219
  ] }),
8710
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("button", { type: "button", className: view === "board" ? "is-active" : "", "aria-pressed": view === "board", onClick: () => openPage("board"), children: [
8711
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconListPenOutline16, { size: 16 }),
8712
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "\u770B\u677F" })
9220
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("button", { type: "button", className: view === "board" ? "is-active" : "", "aria-pressed": view === "board", onClick: () => openPage("board"), children: [
9221
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_dsh_client_ui_primitives21.IconListPenOutline16, { size: 16 }),
9222
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "\u770B\u677F" })
8713
9223
  ] }),
8714
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("button", { type: "button", className: view === "schedules" ? "is-active" : "", "aria-pressed": view === "schedules", onClick: () => openPage("schedules"), children: [
8715
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconPlayOutline16, { size: 16 }),
8716
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "\u5B9A\u65F6" })
9224
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("button", { type: "button", className: view === "schedules" ? "is-active" : "", "aria-pressed": view === "schedules", onClick: () => openPage("schedules"), children: [
9225
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_dsh_client_ui_primitives21.IconPlayOutline16, { size: 16 }),
9226
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "\u5B9A\u65F6" })
8717
9227
  ] }),
8718
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("button", { type: "button", className: view === "pendant" ? "is-active" : "", "aria-pressed": view === "pendant", onClick: () => openPage("pendant"), children: [
8719
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconEditOutline16, { size: 16 }),
8720
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "\u5361\u7247" })
9228
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("button", { type: "button", className: view === "pendant" ? "is-active" : "", "aria-pressed": view === "pendant", onClick: () => openPage("pendant"), children: [
9229
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_dsh_client_ui_primitives21.IconEditOutline16, { size: 16 }),
9230
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "\u5361\u7247" })
8721
9231
  ] })
8722
9232
  ] })
8723
9233
  ] });
@@ -8730,78 +9240,79 @@ function HomePanel({ companion, snapshot, navigate, openSession, startSession, r
8730
9240
  const approved = channel ? snapshot.pairings.filter((item) => item.channelId === channel.id && item.status === "approved").length : 0;
8731
9241
  const capabilities = companion.capabilities.map((item) => CAPABILITY_LABELS[item]);
8732
9242
  const online = channel?.runtimeStatus === "running";
8733
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-home", children: [
8734
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("header", { className: "dsh-partner-home-heading", children: [
8735
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
8736
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "\u5DE5\u4F5C\u53F0" }),
8737
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h2", { children: online ? `${companion.name} \u6B63\u5728\u5FAE\u4FE1\u5F85\u547D` : `${companion.name} \u5DF2\u51C6\u5907\u5C31\u7EEA` })
9243
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "dsh-partner-home", children: [
9244
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("header", { className: "dsh-partner-home-heading", children: [
9245
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { children: [
9246
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("small", { children: "\u5DE5\u4F5C\u53F0" }),
9247
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h2", { children: online ? `${companion.name} \u6B63\u5728\u6E20\u9053\u5F85\u547D` : `${companion.name} \u5DF2\u51C6\u5907\u5C31\u7EEA` })
8738
9248
  ] }),
8739
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { children: online ? "\u6D88\u606F\u3001\u6388\u6743\u4E0E\u4E0A\u4E0B\u6587\u8FB9\u754C\u90FD\u5728\u8FD9\u91CC\u6C47\u603B\u3002" : "\u4F19\u4F34\u8EAB\u4EFD\u3001\u4F1A\u8BDD\u4E0E\u80FD\u529B\u5DF2\u7ECF\u51C6\u5907\u5B8C\u6210\u3002" })
9249
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { children: online ? "\u6D88\u606F\u3001\u6388\u6743\u4E0E\u4E0A\u4E0B\u6587\u8FB9\u754C\u90FD\u5728\u8FD9\u91CC\u6C47\u603B\u3002" : "\u4F19\u4F34\u8EAB\u4EFD\u3001\u4F1A\u8BDD\u4E0E\u80FD\u529B\u5DF2\u7ECF\u51C6\u5907\u5B8C\u6210\u3002" })
8740
9250
  ] }),
8741
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("section", { className: `dsh-partner-home-channel${online ? " is-online" : ""}`, children: [
8742
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-home-route", "aria-hidden": "true", children: [
8743
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Avatar, { name: companion.name }),
8744
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "dsh-partner-route-line", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("i", {}) }),
8745
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "dsh-partner-route-weixin", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(WeixinGlyph, { large: true }) })
9251
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("section", { className: `dsh-partner-home-channel${online ? " is-online" : ""}`, children: [
9252
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "dsh-partner-home-route", "aria-hidden": "true", children: [
9253
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Avatar, { name: companion.name }),
9254
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "dsh-partner-route-line", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("i", {}) }),
9255
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "dsh-partner-route-weixin", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(WeixinGlyph, { large: true }) })
8746
9256
  ] }),
8747
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-home-channel-copy", children: [
8748
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: "dsh-partner-home-kicker", children: [
8749
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("i", {}),
8750
- "\u4E3B\u8981\u6E20\u9053 \xB7 \u5FAE\u4FE1"
9257
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "dsh-partner-home-channel-copy", children: [
9258
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: "dsh-partner-home-kicker", children: [
9259
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("i", {}),
9260
+ "\u6D88\u606F\u6E20\u9053 \xB7 ",
9261
+ channel?.platform === "matrix" ? "Matrix" : channel?.platform === "mattermost" ? "Mattermost" : "\u5FAE\u4FE1"
8751
9262
  ] }),
8752
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h3", { children: !channel ? "\u7B49\u5F85\u626B\u7801\u8FDE\u63A5" : online ? "\u8FDE\u63A5\u6B63\u5E38\uFF0C\u6B63\u5728\u63A5\u6536\u6D88\u606F" : channel.runtimeStatus === "error" ? "\u6E20\u9053\u8FDE\u63A5\u9700\u8981\u5904\u7406" : "\u6E20\u9053\u5F53\u524D\u5DF2\u505C\u7528" }),
8753
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { children: !channel ? "\u901A\u8FC7\u5FAE\u4FE1 iLink Bot \u63A5\u5165\u3002\u51ED\u636E\u53EA\u8FDB\u5165 DSH \u51ED\u636E\u5E93\uFF0C\u8054\u7CFB\u4EBA\u9996\u6B21\u53D1\u6D88\u606F\u4ECD\u9700\u4F60\u7684\u6279\u51C6\u3002" : online ? "\u6BCF\u4F4D\u8054\u7CFB\u4EBA\u62E5\u6709\u72EC\u7ACB DSH \u4F1A\u8BDD\uFF0C\u4F19\u4F34\u8EAB\u4EFD\u4E00\u81F4\uFF0C\u4F46\u4E0A\u4E0B\u6587\u4E0D\u4F1A\u4E92\u76F8\u6DF7\u5408\u3002" : channel.lastError || "\u6E20\u9053\u914D\u7F6E\u4ECD\u7136\u4FDD\u7559\uFF0C\u53EF\u4EE5\u968F\u65F6\u91CD\u65B0\u542F\u7528\u3002" }),
8754
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-home-channel-actions", children: [
8755
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", className: "is-primary", onClick: () => navigate("weixin"), children: !channel ? "\u8FDE\u63A5\u5FAE\u4FE1" : pending > 0 ? `\u5904\u7406 ${pending} \u4E2A\u8BF7\u6C42` : "\u7BA1\u7406\u6E20\u9053" }),
8756
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: !channel ? "\u626B\u7801\u5B8C\u6210\uFF0C\u65E0\u9700\u7C98\u8D34 Token" : `${approved} \u4F4D\u8054\u7CFB\u4EBA \xB7 ${sessions2.length} \u4E2A\u72EC\u7ACB\u4F1A\u8BDD` })
9263
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h3", { children: !channel ? "\u7B49\u5F85\u626B\u7801\u8FDE\u63A5" : online ? "\u8FDE\u63A5\u6B63\u5E38\uFF0C\u6B63\u5728\u63A5\u6536\u6D88\u606F" : channel.runtimeStatus === "error" ? "\u6E20\u9053\u8FDE\u63A5\u9700\u8981\u5904\u7406" : "\u6E20\u9053\u5F53\u524D\u5DF2\u505C\u7528" }),
9264
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { children: !channel ? "\u8FDE\u63A5\u5FAE\u4FE1\u3001Matrix \u6216 Mattermost\uFF0C\u8054\u7CFB\u4EBA\u9996\u6B21\u53D1\u6D88\u606F\u9700\u6279\u51C6\u3002" : online ? "\u672C\u5730\u4E0E\u6240\u6709\u5DF2\u6388\u6743\u6E20\u9053\u5171\u7528\u4F19\u4F34\u4E3B\u5BF9\u8BDD\uFF0C\u56DE\u590D\u8FD4\u56DE\u6D88\u606F\u6765\u6E90\u3002" : channel.lastError || "\u6E20\u9053\u914D\u7F6E\u4ECD\u7136\u4FDD\u7559\uFF0C\u53EF\u4EE5\u968F\u65F6\u91CD\u65B0\u542F\u7528\u3002" }),
9265
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "dsh-partner-home-channel-actions", children: [
9266
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", className: "is-primary", onClick: () => navigate("weixin"), children: !channel ? "\u8FDE\u63A5\u5FAE\u4FE1" : pending > 0 ? `\u5904\u7406 ${pending} \u4E2A\u8BF7\u6C42` : "\u7BA1\u7406\u6E20\u9053" }),
9267
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: !channel ? "\u9009\u62E9\u6E20\u9053\u5E76\u8FDE\u63A5\u8D26\u53F7" : `${approved} \u4F4D\u8054\u7CFB\u4EBA \xB7 \u5171\u7528\u4E3B\u5BF9\u8BDD` })
8757
9268
  ] })
8758
9269
  ] })
8759
9270
  ] }),
8760
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-home-details", children: [
8761
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("section", { className: "dsh-partner-home-profile", children: [
8762
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("header", { children: [
8763
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconUserOutline16, { size: 16 }) }),
8764
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
8765
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "\u4F19\u4F34\u5E95\u7A3F" }),
8766
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: companion.role })
9271
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "dsh-partner-home-details", children: [
9272
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("section", { className: "dsh-partner-home-profile", children: [
9273
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("header", { children: [
9274
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_dsh_client_ui_primitives21.IconUserOutline16, { size: 16 }) }),
9275
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { children: [
9276
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("small", { children: "\u4F19\u4F34\u5E95\u7A3F" }),
9277
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("strong", { children: companion.role })
8767
9278
  ] }),
8768
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", onClick: () => navigate("identity"), children: "\u7F16\u8F91" })
9279
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", onClick: () => navigate("identity"), children: "\u7F16\u8F91" })
8769
9280
  ] }),
8770
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("blockquote", { children: companion.instructions || companion.description || "\u5C1A\u672A\u8BBE\u7F6E\u957F\u671F\u884C\u4E3A\u51C6\u5219\u3002" })
9281
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("blockquote", { children: companion.instructions || companion.description || "\u5C1A\u672A\u8BBE\u7F6E\u957F\u671F\u884C\u4E3A\u51C6\u5219\u3002" })
8771
9282
  ] }),
8772
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("section", { className: "dsh-partner-home-runtime", children: [
8773
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("header", { children: [
8774
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconAgentPresetOutline16, { size: 16 }) }),
8775
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
8776
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "\u8FD0\u884C\u80FD\u529B" }),
8777
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: companion.presetId || "DSH \u9ED8\u8BA4 Preset" })
9283
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("section", { className: "dsh-partner-home-runtime", children: [
9284
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("header", { children: [
9285
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_dsh_client_ui_primitives21.IconAgentPresetOutline16, { size: 16 }) }),
9286
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { children: [
9287
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("small", { children: "\u8FD0\u884C\u80FD\u529B" }),
9288
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("strong", { children: companion.presetId || "DSH \u9ED8\u8BA4 Preset" })
8778
9289
  ] }),
8779
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", onClick: () => navigate("capabilities"), children: "\u8C03\u6574" })
9290
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", onClick: () => navigate("capabilities"), children: "\u8C03\u6574" })
8780
9291
  ] }),
8781
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "dsh-partner-home-capability-list", children: capabilities.length ? capabilities.map((item) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("em", { children: item }, item)) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "\u5C1A\u672A\u58F0\u660E\u80FD\u529B\u8303\u56F4" }) })
9292
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "dsh-partner-home-capability-list", children: capabilities.length ? capabilities.map((item) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("em", { children: item }, item)) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("small", { children: "\u5C1A\u672A\u58F0\u660E\u80FD\u529B\u8303\u56F4" }) })
8782
9293
  ] }),
8783
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("section", { className: "dsh-partner-home-continuity", children: [
8784
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("header", { children: [
8785
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconDataOutline16, { size: 16 }) }),
8786
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
8787
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "\u4F19\u4F34\u5BF9\u8BDD" }),
8788
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: localSession?.archived ? "\u4F1A\u8BDD\u5DF2\u5F52\u6863" : "\u4F19\u4F34\u4F1A\u8BDD\u5DF2\u5EFA\u7ACB" })
9294
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("section", { className: "dsh-partner-home-continuity", children: [
9295
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("header", { children: [
9296
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_dsh_client_ui_primitives21.IconDataOutline16, { size: 16 }) }),
9297
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { children: [
9298
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("small", { children: "\u4F19\u4F34\u5BF9\u8BDD" }),
9299
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("strong", { children: localSession?.archived ? "\u4F1A\u8BDD\u5DF2\u5F52\u6863" : "\u4F19\u4F34\u4F1A\u8BDD\u5DF2\u5EFA\u7ACB" })
8789
9300
  ] }),
8790
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", onClick: () => localSession === void 0 ? void startSession(companion.id) : localSession.archived ? void renewSession(localSession.id) : void openSession(localSession.id, localSession.sessionId), children: localSession === void 0 ? "\u5F00\u59CB\u5BF9\u8BDD" : localSession.archived ? "\u5F00\u59CB\u65B0\u4F1A\u8BDD" : "\u6253\u5F00\u4F1A\u8BDD" })
9301
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", onClick: () => localSession === void 0 ? void startSession(companion.id) : localSession.archived ? void renewSession(localSession.id) : void openSession(localSession.id, localSession.sessionId), children: localSession === void 0 ? "\u5F00\u59CB\u5BF9\u8BDD" : localSession.archived ? "\u5F00\u59CB\u65B0\u4F1A\u8BDD" : "\u6253\u5F00\u4F1A\u8BDD" })
8791
9302
  ] }),
8792
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { children: localSession ? `\u6700\u8FD1\u6D3B\u52A8\u4E8E ${relativeTime(localSession.lastMessageAt)}\uFF1B\u53E6\u6709 ${sessions2.filter((item) => item.kind === "channel").length} \u4E2A\u6E20\u9053\u4F1A\u8BDD\u3002` : "\u4F19\u4F34\u4F1A\u8BDD\u6B63\u5728\u521D\u59CB\u5316\uFF0C\u7A0D\u540E\u5373\u53EF\u6253\u5F00\u3002" })
9303
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { children: localSession ? `\u6700\u8FD1\u6D3B\u52A8\u4E8E ${relativeTime(localSession.lastMessageAt)}\uFF1B\u672C\u5730\u4E0E\u6E20\u9053\u5728\u8FD9\u91CC\u63A5\u7740\u804A\u3002` : "\u4F19\u4F34\u4F1A\u8BDD\u6B63\u5728\u521D\u59CB\u5316\uFF0C\u7A0D\u540E\u5373\u53EF\u6253\u5F00\u3002" })
8793
9304
  ] })
8794
9305
  ] })
8795
9306
  ] });
8796
9307
  }
8797
9308
  function WeixinPanel({ companion, snapshot, onChanged }) {
8798
- const channel = snapshot.channels.find((item) => item.companionId === companion.id);
8799
- const [login, setLogin] = (0, import_react40.useState)();
8800
- const [busy, setBusy] = (0, import_react40.useState)(false);
8801
- const [error, setError] = (0, import_react40.useState)();
8802
- (0, import_react40.useEffect)(() => {
9309
+ const channel = snapshot.channels.find((item) => item.companionId === companion.id && (!item.platform || item.platform === "weixin"));
9310
+ const [login, setLogin] = (0, import_react43.useState)();
9311
+ const [busy, setBusy] = (0, import_react43.useState)(false);
9312
+ const [error, setError] = (0, import_react43.useState)();
9313
+ (0, import_react43.useEffect)(() => {
8803
9314
  if (!login || login.phase === "confirmed" || login.phase === "expired" || login.phase === "error") return;
8804
- const timer = window.setInterval(() => {
9315
+ const timer2 = window.setInterval(() => {
8805
9316
  void api(`/weixin/login/${login.id}`).then(async (result) => {
8806
9317
  setLogin(result.login);
8807
9318
  if (result.channel) {
@@ -8810,7 +9321,7 @@ function WeixinPanel({ companion, snapshot, onChanged }) {
8810
9321
  }
8811
9322
  }).catch((reason) => setError(errorMessage(reason)));
8812
9323
  }, 2e3);
8813
- return () => clearInterval(timer);
9324
+ return () => clearInterval(timer2);
8814
9325
  }, [login?.id, login?.phase, onChanged]);
8815
9326
  const begin = async () => {
8816
9327
  setBusy(true);
@@ -8845,93 +9356,93 @@ function WeixinPanel({ companion, snapshot, onChanged }) {
8845
9356
  setError(errorMessage(reason));
8846
9357
  }
8847
9358
  };
8848
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-form is-channel", children: [
8849
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(SectionHeading, { eyebrow: "PRIMARY CHANNEL", title: "\u5FAE\u4FE1\u6E20\u9053", detail: "\u4F7F\u7528\u5FAE\u4FE1 iLink Bot \u626B\u7801\u63A5\u5165\u3002\u6BCF\u4E2A\u673A\u5668\u4EBA\u53EA\u7ED1\u5B9A\u4E00\u4E2A\u4F19\u4F34\uFF0C\u6BCF\u4F4D\u8054\u7CFB\u4EBA\u4FDD\u6301\u72EC\u7ACB DSH \u4F1A\u8BDD\u3002" }),
8850
- !channel && !login && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(GlassSurface, { as: "div", interactive: true, className: "dsh-partner-weixin-connect", borderRadius: 15, distortionScale: -10, saturation: 1.06, children: [
8851
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "dsh-partner-weixin-mark", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(WeixinGlyph, { large: true }) }),
8852
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
8853
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("strong", { children: [
9359
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "dsh-partner-form is-channel", children: [
9360
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SectionHeading, { eyebrow: "PRIMARY CHANNEL", title: "\u5FAE\u4FE1\u6E20\u9053", detail: "\u4F7F\u7528\u5FAE\u4FE1 iLink Bot \u626B\u7801\u63A5\u5165\u3002\u6BCF\u4E2A\u673A\u5668\u4EBA\u53EA\u7ED1\u5B9A\u4E00\u4E2A\u4F19\u4F34\uFF0C\u6BCF\u4F4D\u8054\u7CFB\u4EBA\u4FDD\u6301\u72EC\u7ACB DSH \u4F1A\u8BDD\u3002" }),
9361
+ !channel && !login && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(GlassSurface, { as: "div", interactive: true, className: "dsh-partner-weixin-connect", borderRadius: 15, distortionScale: -10, saturation: 1.06, children: [
9362
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "dsh-partner-weixin-mark", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(WeixinGlyph, { large: true }) }),
9363
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { children: [
9364
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("strong", { children: [
8854
9365
  "\u628A ",
8855
9366
  companion.name,
8856
9367
  " \u5E26\u5230\u5FAE\u4FE1"
8857
9368
  ] }),
8858
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { children: "\u626B\u7801\u540E\uFF0C\u673A\u5668\u4EBA\u51ED\u636E\u76F4\u63A5\u4FDD\u5B58\u8FDB DSH \u51ED\u636E\u5E93\uFF0C\u4E0D\u4F1A\u663E\u793A\u5728\u6D4F\u89C8\u5668\u6216\u666E\u901A\u914D\u7F6E\u6587\u4EF6\u4E2D\u3002" }),
8859
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("ul", { children: [
8860
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("li", { children: "\u79C1\u804A\u9996\u6B21\u8054\u7CFB\u5FC5\u987B\u5BA1\u6279" }),
8861
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("li", { children: "\u8054\u7CFB\u4EBA\u4E4B\u95F4\u4E0A\u4E0B\u6587\u5B8C\u5168\u9694\u79BB" }),
8862
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("li", { children: "\u5DE5\u5177\u6743\u9650\u4E0D\u4F1A\u56E0\u5FAE\u4FE1\u8EAB\u4EFD\u81EA\u52A8\u6269\u5927" })
9369
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { children: "\u626B\u7801\u540E\uFF0C\u673A\u5668\u4EBA\u51ED\u636E\u76F4\u63A5\u4FDD\u5B58\u8FDB DSH \u51ED\u636E\u5E93\uFF0C\u4E0D\u4F1A\u663E\u793A\u5728\u6D4F\u89C8\u5668\u6216\u666E\u901A\u914D\u7F6E\u6587\u4EF6\u4E2D\u3002" }),
9370
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("ul", { children: [
9371
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("li", { children: "\u79C1\u804A\u9996\u6B21\u8054\u7CFB\u5FC5\u987B\u5BA1\u6279" }),
9372
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("li", { children: "\u8054\u7CFB\u4EBA\u4E4B\u95F4\u4E0A\u4E0B\u6587\u5B8C\u5168\u9694\u79BB" }),
9373
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("li", { children: "\u5DE5\u5177\u6743\u9650\u4E0D\u4F1A\u56E0\u5FAE\u4FE1\u8EAB\u4EFD\u81EA\u52A8\u6269\u5927" })
8863
9374
  ] })
8864
9375
  ] }),
8865
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", disabled: busy, onClick: () => {
9376
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", disabled: busy, onClick: () => {
8866
9377
  void begin();
8867
9378
  }, children: busy ? "\u6B63\u5728\u7533\u8BF7\u4E8C\u7EF4\u7801\u2026" : "\u626B\u7801\u8FDE\u63A5\u5FAE\u4FE1" })
8868
9379
  ] }),
8869
- login && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(GlassSurface, { as: "div", interactive: true, className: "dsh-partner-qr", borderRadius: 16, distortionScale: -10, saturation: 1.06, children: [
8870
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "dsh-partner-qr-code", children: login.qrContent && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(QRCodeSVG, { value: login.qrContent, size: 176, level: "M" }) }),
8871
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
8872
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "WECHAT ILINK BOT" }),
8873
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: login.phase === "scanned" ? "\u5DF2\u626B\u7801\uFF0C\u8BF7\u5728\u5FAE\u4FE1\u786E\u8BA4" : login.phase === "expired" ? "\u4E8C\u7EF4\u7801\u5DF2\u8FC7\u671F" : login.phase === "error" ? "\u8FDE\u63A5\u5931\u8D25" : "\u4F7F\u7528\u5FAE\u4FE1\u626B\u7801" }),
8874
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { children: login.error || (login.phase === "scanned" ? "\u786E\u8BA4\u540E\u4F1A\u81EA\u52A8\u542F\u52A8\u6E20\u9053\uFF0C\u4E0D\u9700\u8981\u590D\u5236 Token\u3002" : "\u4E8C\u7EF4\u7801\u7EA6 5 \u5206\u949F\u6709\u6548\u3002\u6B64\u9875\u9762\u53EF\u4EE5\u5B89\u5168\u5730\u4FDD\u6301\u6253\u5F00\u3002") }),
8875
- (login.phase === "expired" || login.phase === "error") && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("button", { type: "button", onClick: () => {
9380
+ login && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(GlassSurface, { as: "div", interactive: true, className: "dsh-partner-qr", borderRadius: 16, distortionScale: -10, saturation: 1.06, children: [
9381
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "dsh-partner-qr-code", children: login.qrContent && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(QRCodeSVG, { value: login.qrContent, size: 176, level: "M" }) }),
9382
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { children: [
9383
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("small", { children: "WECHAT ILINK BOT" }),
9384
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("strong", { children: login.phase === "scanned" ? "\u5DF2\u626B\u7801\uFF0C\u8BF7\u5728\u5FAE\u4FE1\u786E\u8BA4" : login.phase === "expired" ? "\u4E8C\u7EF4\u7801\u5DF2\u8FC7\u671F" : login.phase === "error" ? "\u8FDE\u63A5\u5931\u8D25" : "\u4F7F\u7528\u5FAE\u4FE1\u626B\u7801" }),
9385
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { children: login.error || (login.phase === "scanned" ? "\u786E\u8BA4\u540E\u4F1A\u81EA\u52A8\u542F\u52A8\u6E20\u9053\uFF0C\u4E0D\u9700\u8981\u590D\u5236 Token\u3002" : "\u4E8C\u7EF4\u7801\u7EA6 5 \u5206\u949F\u6709\u6548\u3002\u6B64\u9875\u9762\u53EF\u4EE5\u5B89\u5168\u5730\u4FDD\u6301\u6253\u5F00\u3002") }),
9386
+ (login.phase === "expired" || login.phase === "error") && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("button", { type: "button", onClick: () => {
8876
9387
  setLogin(void 0);
8877
9388
  void begin();
8878
9389
  }, children: [
8879
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconRefreshOutline16, { size: 16 }),
9390
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_dsh_client_ui_primitives21.IconRefreshOutline16, { size: 16 }),
8880
9391
  "\u91CD\u65B0\u751F\u6210"
8881
9392
  ] })
8882
9393
  ] })
8883
9394
  ] }),
8884
- channel && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
8885
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(GlassSurface, { as: "div", interactive: true, className: "dsh-partner-channel-card", borderRadius: 14, distortionScale: -10, saturation: 1.06, children: [
8886
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "dsh-partner-weixin-mark", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(WeixinGlyph, { large: true }) }),
8887
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
8888
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "WECHAT CHANNEL" }),
8889
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: channel.name }),
8890
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { children: channel.accountId })
9395
+ channel && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
9396
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(GlassSurface, { as: "div", interactive: true, className: "dsh-partner-channel-card", borderRadius: 14, distortionScale: -10, saturation: 1.06, children: [
9397
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "dsh-partner-weixin-mark", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(WeixinGlyph, { large: true }) }),
9398
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { children: [
9399
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("small", { children: "WECHAT CHANNEL" }),
9400
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("strong", { children: channel.name }),
9401
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { children: channel.accountId })
8891
9402
  ] }),
8892
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ChannelStatus, { channel }),
8893
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", className: "dsh-partner-switch", "data-on": channel.enabled, disabled: busy, "aria-label": channel.enabled ? "\u505C\u7528\u5FAE\u4FE1\u6E20\u9053" : "\u542F\u7528\u5FAE\u4FE1\u6E20\u9053", onClick: () => {
9403
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ChannelStatus, { channel }),
9404
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", className: "dsh-partner-switch", "data-on": channel.enabled, disabled: busy, "aria-label": channel.enabled ? "\u505C\u7528\u5FAE\u4FE1\u6E20\u9053" : "\u542F\u7528\u5FAE\u4FE1\u6E20\u9053", onClick: () => {
8894
9405
  void toggle();
8895
- }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("i", {}) })
9406
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("i", {}) })
8896
9407
  ] }),
8897
- channel.lastError && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "dsh-partner-inline-error", children: channel.lastError }),
8898
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-pairing-heading", children: [
8899
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
8900
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "ACCESS" }),
8901
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: "\u79C1\u804A\u914D\u5BF9" })
9408
+ channel.lastError && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "dsh-partner-inline-error", children: channel.lastError }),
9409
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "dsh-partner-pairing-heading", children: [
9410
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { children: [
9411
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("small", { children: "ACCESS" }),
9412
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("strong", { children: "\u79C1\u804A\u914D\u5BF9" })
8902
9413
  ] }),
8903
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("em", { children: [
9414
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("em", { children: [
8904
9415
  pairings.filter((item) => item.status === "pending").length,
8905
9416
  " \u4E2A\u5F85\u5904\u7406"
8906
9417
  ] })
8907
9418
  ] }),
8908
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "dsh-partner-pairings", children: pairings.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ContentState, { title: "\u8FD8\u6CA1\u6709\u8054\u7CFB\u4EBA", detail: "\u6709\u4EBA\u9996\u6B21\u5411\u673A\u5668\u4EBA\u53D1\u6D88\u606F\u540E\uFF0C\u914D\u5BF9\u8BF7\u6C42\u4F1A\u51FA\u73B0\u5728\u8FD9\u91CC\u3002", compact: true }) : pairings.map((pairing) => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("article", { children: [
8909
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: `is-${pairing.status}`, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconUserOutline16, { size: 16 }) }),
8910
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
8911
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: pairing.displayName }),
8912
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("small", { children: [
9419
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "dsh-partner-pairings", children: pairings.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ContentState, { title: "\u8FD8\u6CA1\u6709\u8054\u7CFB\u4EBA", detail: "\u6709\u4EBA\u9996\u6B21\u5411\u673A\u5668\u4EBA\u53D1\u6D88\u606F\u540E\uFF0C\u914D\u5BF9\u8BF7\u6C42\u4F1A\u51FA\u73B0\u5728\u8FD9\u91CC\u3002", compact: true }) : pairings.map((pairing) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("article", { children: [
9420
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: `is-${pairing.status}`, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_dsh_client_ui_primitives21.IconUserOutline16, { size: 16 }) }),
9421
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { children: [
9422
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("strong", { children: pairing.displayName }),
9423
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("small", { children: [
8913
9424
  pairing.status === "pending" ? "\u7B49\u5F85\u5BA1\u6279" : pairing.status === "approved" ? "\u5DF2\u6388\u6743\u72EC\u7ACB\u4F1A\u8BDD" : "\u5DF2\u963B\u6B62",
8914
9425
  " \xB7 ",
8915
9426
  new Date(pairing.updatedAt).toLocaleString()
8916
9427
  ] })
8917
9428
  ] }),
8918
- pairing.status === "pending" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
8919
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { onClick: () => {
9429
+ pairing.status === "pending" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
9430
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { onClick: () => {
8920
9431
  void actPairing(pairing.id, "blocked");
8921
9432
  }, children: "\u62D2\u7EDD" }),
8922
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { className: "is-primary", onClick: () => {
9433
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { className: "is-primary", onClick: () => {
8923
9434
  void actPairing(pairing.id, "approved");
8924
9435
  }, children: "\u6279\u51C6" })
8925
9436
  ] }),
8926
- pairing.status === "approved" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { onClick: () => {
9437
+ pairing.status === "approved" && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { onClick: () => {
8927
9438
  void actPairing(pairing.id, "blocked");
8928
9439
  }, children: "\u64A4\u9500" }),
8929
- pairing.status === "blocked" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { onClick: () => {
9440
+ pairing.status === "blocked" && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { onClick: () => {
8930
9441
  void actPairing(pairing.id, "approved");
8931
9442
  }, children: "\u91CD\u65B0\u6279\u51C6" })
8932
9443
  ] }, pairing.id)) })
8933
9444
  ] }),
8934
- error && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "dsh-partner-inline-error", children: error })
9445
+ error && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "dsh-partner-inline-error", children: error })
8935
9446
  ] });
8936
9447
  }
8937
9448
  function installStyles() {