@lemoncat7/dsh-partner 1.14.1 → 1.15.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 (70) hide show
  1. package/README.md +18 -3
  2. package/docs/architecture.md +2 -0
  3. package/docs/direct-channels.md +24 -0
  4. package/docs/releases/1.14.2.md +10 -0
  5. package/docs/releases/1.15.0.md +20 -0
  6. package/lib/agent-runtime.d.ts.map +1 -1
  7. package/lib/agent-runtime.js +27 -9
  8. package/lib/agent-runtime.js.map +1 -1
  9. package/lib/api.d.ts.map +1 -1
  10. package/lib/api.js +83 -0
  11. package/lib/api.js.map +1 -1
  12. package/lib/channels/direct/discovery.d.ts +5 -0
  13. package/lib/channels/direct/discovery.d.ts.map +1 -0
  14. package/lib/channels/direct/discovery.js +70 -0
  15. package/lib/channels/direct/discovery.js.map +1 -0
  16. package/lib/channels/direct/login-cache.d.ts +21 -0
  17. package/lib/channels/direct/login-cache.d.ts.map +1 -0
  18. package/lib/channels/direct/login-cache.js +42 -0
  19. package/lib/channels/direct/login-cache.js.map +1 -0
  20. package/lib/channels/direct/login.d.ts +15 -0
  21. package/lib/channels/direct/login.d.ts.map +1 -0
  22. package/lib/channels/direct/login.js +78 -0
  23. package/lib/channels/direct/login.js.map +1 -0
  24. package/lib/channels/direct/transport.d.ts +48 -0
  25. package/lib/channels/direct/transport.d.ts.map +1 -0
  26. package/lib/channels/direct/transport.js +152 -0
  27. package/lib/channels/direct/transport.js.map +1 -0
  28. package/lib/channels/manager.d.ts +6 -0
  29. package/lib/channels/manager.d.ts.map +1 -1
  30. package/lib/channels/manager.js +140 -8
  31. package/lib/channels/manager.js.map +1 -1
  32. package/lib/channels/notification-route.d.ts +8 -0
  33. package/lib/channels/notification-route.d.ts.map +1 -0
  34. package/lib/channels/notification-route.js +14 -0
  35. package/lib/channels/notification-route.js.map +1 -0
  36. package/lib/client-api.d.ts +13 -0
  37. package/lib/client-api.d.ts.map +1 -1
  38. package/lib/client-api.js.map +1 -1
  39. package/lib/client-controller.d.ts.map +1 -1
  40. package/lib/client-controller.js +3 -3
  41. package/lib/client-controller.js.map +1 -1
  42. package/lib/client.d.ts.map +1 -1
  43. package/lib/client.js +681 -311
  44. package/lib/client.js.map +4 -4
  45. package/lib/concern-store.d.ts +2 -0
  46. package/lib/concern-store.d.ts.map +1 -1
  47. package/lib/concern-store.js +13 -0
  48. package/lib/concern-store.js.map +1 -1
  49. package/lib/domain.d.ts +16 -0
  50. package/lib/domain.d.ts.map +1 -1
  51. package/lib/domain.js.map +1 -1
  52. package/lib/heartbeat.js +9 -9
  53. package/lib/heartbeat.js.map +1 -1
  54. package/lib/main-panel-compat.d.ts +5 -0
  55. package/lib/main-panel-compat.d.ts.map +1 -0
  56. package/lib/main-panel-compat.js +38 -0
  57. package/lib/main-panel-compat.js.map +1 -0
  58. package/lib/ui/channels-panel.d.ts +9 -0
  59. package/lib/ui/channels-panel.d.ts.map +1 -0
  60. package/lib/ui/channels-panel.js +72 -0
  61. package/lib/ui/channels-panel.js.map +1 -0
  62. package/lib/ui/identity-editor.js +1 -1
  63. package/lib/ui/identity-editor.js.map +1 -1
  64. package/lib/ui/partner-components.js +1 -1
  65. package/lib/ui/partner-components.js.map +1 -1
  66. package/lib/ui/use-channel-status.d.ts +4 -0
  67. package/lib/ui/use-channel-status.d.ts.map +1 -0
  68. package/lib/ui/use-channel-status.js +46 -0
  69. package/lib/ui/use-channel-status.js.map +1 -0
  70. package/package.json +18 -15
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_react39 = require("react");
38
+ var import_react42 = 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);
@@ -8218,23 +8246,25 @@ function IdentityEditorForm({ companion, count, onChanged, onRemoved }) {
8218
8246
  if (alive.current) setOperation(void 0);
8219
8247
  }
8220
8248
  };
8221
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("form", { className: "dsh-partner-form is-identity", "aria-busy": operation !== void 0, onSubmit: (event) => {
8249
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("form", { id: "dsh-partner-identity-editor", className: "dsh-partner-form is-identity", "aria-busy": operation !== void 0, onSubmit: (event) => {
8222
8250
  void submit(event);
8223
8251
  }, children: [
8224
8252
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SectionHeading, { eyebrow: "IDENTITY", title: "\u5DE5\u4F5C\u8EAB\u4EFD", detail: "\u5B83\u4E0D\u662F\u4E00\u6B21\u5BF9\u8BDD\u7684\u63D0\u793A\u8BCD\uFF0C\u800C\u662F\u8FD9\u4E2A\u4F19\u4F34\u5728\u684C\u9762\u548C\u5FAE\u4FE1\u4E2D\u7684\u957F\u671F\u884C\u4E3A\u57FA\u7EBF\u3002" }),
8225
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "dsh-partner-fields two", children: [
8226
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(FormField, { label: "\u540D\u5B57", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("input", { disabled: busy, required: true, maxLength: 60, value: form.name, onChange: (event) => setForm({ ...form, name: event.target.value }) }) }),
8227
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(FormField, { label: "\u89D2\u8272", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("input", { disabled: busy, required: true, maxLength: 120, value: form.role, onChange: (event) => setForm({ ...form, role: event.target.value }) }) })
8228
- ] }),
8229
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(FormField, { label: "\u4E00\u53E5\u8BDD\u5B9A\u4F4D", hint: "\u7528\u4E8E\u540D\u518C\u8BC6\u522B\uFF0C\u4E0D\u4F1A\u66FF\u4EE3\u5B8C\u6574\u884C\u4E3A\u51C6\u5219\u3002", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("textarea", { disabled: busy, rows: 2, maxLength: 500, value: form.description, onChange: (event) => setForm({ ...form, description: event.target.value }) }) }),
8230
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(FormField, { label: "\u957F\u671F\u884C\u4E3A\u51C6\u5219", hint: "\u5EFA\u8BAE\u5199\u804C\u8D23\u3001\u8868\u8FBE\u65B9\u5F0F\u4E0E\u8FB9\u754C\uFF1B\u6E20\u9053\u3001\u5DE5\u5177\u548C\u6388\u6743\u7531\u7CFB\u7EDF\u5355\u72EC\u63A7\u5236\u3002", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("textarea", { disabled: busy, rows: 9, maxLength: 12e3, value: form.instructions, onChange: (event) => setForm({ ...form, instructions: event.target.value }) }) }),
8231
- error && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "dsh-partner-inline-error", role: "alert", children: error }),
8232
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "dsh-partner-form-actions", children: [
8233
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { role: "status", children: saved && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
8234
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_dsh_client_ui_primitives19.IconCheckOutline14, { size: 14 }),
8235
- "\u5DF2\u4FDD\u5B58\uFF0C\u4E0B\u4E00\u8F6E\u5C06\u4F7F\u7528\u65B0\u8EAB\u4EFD"
8236
- ] }) }),
8237
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { disabled: busy, children: operation === "save" ? "\u6B63\u5728\u4FDD\u5B58\u2026" : "\u4FDD\u5B58\u8EAB\u4EFD" })
8253
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("section", { className: "dsh-partner-identity-card", "aria-label": "\u8EAB\u4EFD\u914D\u7F6E", children: [
8254
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "dsh-partner-fields two", children: [
8255
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(FormField, { label: "\u540D\u5B57", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("input", { disabled: busy, required: true, maxLength: 60, value: form.name, onChange: (event) => setForm({ ...form, name: event.target.value }) }) }),
8256
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(FormField, { label: "\u89D2\u8272", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("input", { disabled: busy, required: true, maxLength: 120, value: form.role, onChange: (event) => setForm({ ...form, role: event.target.value }) }) })
8257
+ ] }),
8258
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(FormField, { label: "\u4E00\u53E5\u8BDD\u5B9A\u4F4D", hint: "\u7528\u4E8E\u540D\u518C\u8BC6\u522B\uFF0C\u4E0D\u4F1A\u66FF\u4EE3\u5B8C\u6574\u884C\u4E3A\u51C6\u5219\u3002", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("textarea", { disabled: busy, rows: 2, maxLength: 500, value: form.description, onChange: (event) => setForm({ ...form, description: event.target.value }) }) }),
8259
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(FormField, { label: "\u957F\u671F\u884C\u4E3A\u51C6\u5219", hint: "\u5EFA\u8BAE\u5199\u804C\u8D23\u3001\u8868\u8FBE\u65B9\u5F0F\u4E0E\u8FB9\u754C\uFF1B\u6E20\u9053\u3001\u5DE5\u5177\u548C\u6388\u6743\u7531\u7CFB\u7EDF\u5355\u72EC\u63A7\u5236\u3002", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("textarea", { disabled: busy, rows: 9, maxLength: 12e3, value: form.instructions, onChange: (event) => setForm({ ...form, instructions: event.target.value }) }) }),
8260
+ error && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "dsh-partner-inline-error", role: "alert", children: error }),
8261
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "dsh-partner-form-actions", children: [
8262
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { role: "status", children: saved && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
8263
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_dsh_client_ui_primitives19.IconCheckOutline14, { size: 14 }),
8264
+ "\u5DF2\u4FDD\u5B58\uFF0C\u4E0B\u4E00\u8F6E\u5C06\u4F7F\u7528\u65B0\u8EAB\u4EFD"
8265
+ ] }) }),
8266
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { disabled: busy, children: operation === "save" ? "\u6B63\u5728\u4FDD\u5B58\u2026" : "\u4FDD\u5B58\u8EAB\u4EFD" })
8267
+ ] })
8238
8268
  ] }),
8239
8269
  /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "dsh-partner-identity-danger", "data-confirming": confirming, children: [
8240
8270
  /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { children: [
@@ -8252,13 +8282,313 @@ function IdentityEditorForm({ companion, count, onChanged, onRemoved }) {
8252
8282
  ] });
8253
8283
  }
8254
8284
 
8255
- // src/ui/companion-create.tsx
8285
+ // src/ui/channels-panel.tsx
8256
8286
  var import_react38 = require("react");
8257
- var import_dsh_client_ui_primitives20 = require("@deepseek-ai/dsh-client-ui-primitives");
8258
8287
  var import_jsx_runtime35 = require("react/jsx-runtime");
8259
- function CompanionCreateDialog({ close, create }) {
8288
+ function ChannelsPanel({ companion, snapshot, onChanged, weixin }) {
8289
+ const [platform, setPlatform] = (0, import_react38.useState)("matrix");
8290
+ const [name, setName] = (0, import_react38.useState)("");
8291
+ const [baseUrl, setBaseUrl] = (0, import_react38.useState)("");
8292
+ const [targetId, setTargetId] = (0, import_react38.useState)("");
8293
+ const [botToken, setToken] = (0, import_react38.useState)("");
8294
+ const [authMode, setAuthMode] = (0, import_react38.useState)("password");
8295
+ const [username, setUsername] = (0, import_react38.useState)(""), [password, setPassword] = (0, import_react38.useState)(""), [mfaToken, setMfaToken] = (0, import_react38.useState)("");
8260
8296
  const [busy, setBusy] = (0, import_react38.useState)(false);
8261
- const [error, setError] = (0, import_react38.useState)();
8297
+ const [feedback, setFeedback] = (0, import_react38.useState)("");
8298
+ const [deleting, setDeleting] = (0, import_react38.useState)();
8299
+ const [adding, setAdding] = (0, import_react38.useState)(false);
8300
+ const [fixedPlatform, setFixedPlatform] = (0, import_react38.useState)(false);
8301
+ const [configuring, setConfiguring] = (0, import_react38.useState)();
8302
+ const closeAdd = () => {
8303
+ setAdding(false);
8304
+ setToken("");
8305
+ setPassword("");
8306
+ setMfaToken("");
8307
+ };
8308
+ const openAdd = (selected) => {
8309
+ setFixedPlatform(Boolean(selected));
8310
+ setPlatform(selected ?? "matrix");
8311
+ setName("");
8312
+ setBaseUrl("");
8313
+ setTargetId("");
8314
+ setUsername("");
8315
+ setPassword("");
8316
+ setToken("");
8317
+ setMfaToken("");
8318
+ setAuthMode("password");
8319
+ setFeedback("");
8320
+ setAdding(true);
8321
+ };
8322
+ const channels = snapshot.channels.filter((c) => c.companionId === companion.id);
8323
+ const pairings = snapshot.pairings.filter((p) => channels.some((c) => c.id === p.channelId));
8324
+ const run = async (action) => {
8325
+ if (busy) return;
8326
+ setBusy(true);
8327
+ setFeedback("");
8328
+ try {
8329
+ await action();
8330
+ } catch (error) {
8331
+ setFeedback(errorMessage(error));
8332
+ } finally {
8333
+ setBusy(false);
8334
+ }
8335
+ };
8336
+ const configure = async (save) => run(async () => {
8337
+ 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() } };
8338
+ await api(save ? "/channels" : "/channels/test", { method: "POST", body: JSON.stringify(body) });
8339
+ if (save) {
8340
+ await onChanged();
8341
+ closeAdd();
8342
+ }
8343
+ 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");
8344
+ });
8345
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "dsh-partner-form is-channel dsh-partner-channels", children: [
8346
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "dsh-partner-channel-toolbar", children: [
8347
+ /* @__PURE__ */ (0, import_jsx_runtime35.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" }),
8348
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", onClick: () => openAdd(), children: "\u6DFB\u52A0\u6E20\u9053" })
8349
+ ] }),
8350
+ !adding && feedback && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { role: "status", children: feedback }),
8351
+ adding && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(WorkspaceDialog, { title: fixedPlatform ? `${platform === "matrix" ? "Matrix" : "Mattermost"} \u914D\u7F6E` : "\u6DFB\u52A0\u6E20\u9053", detail: platform === "matrix" ? "\u5148\u767B\u5F55\uFF0C\u518D\u9080\u8BF7\u673A\u5668\u4EBA\u8FDB\u5165\u672A\u52A0\u5BC6\u53CC\u4EBA\u623F\u95F4\u5E76\u53D1\u6D88\u606F\u914D\u5BF9\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: () => {
8352
+ if (!busy) closeAdd();
8353
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("form", { className: "dsh-partner-feature-form dsh-partner-channel-form", "aria-busy": busy, onSubmit: (event) => {
8354
+ event.preventDefault();
8355
+ void configure(true);
8356
+ }, children: [
8357
+ !fixedPlatform && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(FormField2, { label: "\u5E73\u53F0", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("select", { autoFocus: true, disabled: busy, value: platform, onChange: (e) => {
8358
+ setPlatform(e.target.value);
8359
+ setPassword("");
8360
+ setToken("");
8361
+ setMfaToken("");
8362
+ setTargetId("");
8363
+ setFeedback("");
8364
+ }, children: [
8365
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: "matrix", children: "Matrix" }),
8366
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: "mattermost", children: "Mattermost" })
8367
+ ] }) }),
8368
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(FormField2, { label: "\u6E20\u9053\u540D\u79F0", children: /* @__PURE__ */ (0, import_jsx_runtime35.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"}` }) }),
8369
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(FormField2, { label: "\u670D\u52A1\u5668\u5730\u5740", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("input", { disabled: busy, required: true, type: "url", value: baseUrl, onChange: (e) => setBaseUrl(e.target.value), placeholder: "https://chat.example.com" }) }),
8370
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("details", { children: [
8371
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("summary", { children: "\u9AD8\u7EA7\u914D\u7F6E\uFF08\u53EF\u9009\uFF09" }),
8372
+ /* @__PURE__ */ (0, import_jsx_runtime35.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_runtime35.jsx)("input", { disabled: busy, value: targetId, onChange: (e) => setTargetId(e.target.value), placeholder: platform === "matrix" ? "!room:example.com" : "DM channel ID" }) })
8373
+ ] }),
8374
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(FormField2, { label: "\u767B\u5F55\u65B9\u5F0F", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("select", { disabled: busy, value: authMode, onChange: (e) => {
8375
+ setAuthMode(e.target.value);
8376
+ setToken("");
8377
+ setPassword("");
8378
+ setMfaToken("");
8379
+ }, children: [
8380
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: "password", children: "\u8D26\u53F7\u5BC6\u7801" }),
8381
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: "token", children: "Access Token" })
8382
+ ] }) }),
8383
+ authMode === "password" ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
8384
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(FormField2, { label: "\u8D26\u53F7", children: /* @__PURE__ */ (0, import_jsx_runtime35.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" }) }),
8385
+ /* @__PURE__ */ (0, import_jsx_runtime35.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_runtime35.jsx)("input", { disabled: busy, required: true, type: "password", autoComplete: "current-password", value: password, onChange: (e) => setPassword(e.target.value) }) }),
8386
+ platform === "mattermost" && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(FormField2, { label: "\u53CC\u91CD\u9A8C\u8BC1\u9A8C\u8BC1\u7801\uFF08\u5982\u5DF2\u5F00\u542F\uFF09", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("input", { disabled: busy, autoComplete: "one-time-code", inputMode: "numeric", value: mfaToken, onChange: (e) => setMfaToken(e.target.value) }) })
8387
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime35.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_runtime35.jsx)("input", { disabled: busy, required: true, type: "password", autoComplete: "new-password", value: botToken, onChange: (e) => setToken(e.target.value) }) }),
8388
+ feedback && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { role: "status", children: feedback }),
8389
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("footer", { children: [
8390
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", disabled: busy, onClick: closeAdd, children: "\u53D6\u6D88" }),
8391
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", disabled: busy || !(authMode === "password" ? username && password : botToken) || !baseUrl, onClick: () => void configure(false), children: "\u6D4B\u8BD5\u8FDE\u63A5" }),
8392
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { className: "is-primary", disabled: busy, children: busy ? "\u5904\u7406\u4E2D\u2026" : "\u4FDD\u5B58\u6E20\u9053" })
8393
+ ] })
8394
+ ] }) }),
8395
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "dsh-partner-channel-list", children: [
8396
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "dsh-partner-channel-row", children: [
8397
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { children: [
8398
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("strong", { children: "\u5FAE\u4FE1" }),
8399
+ /* @__PURE__ */ (0, import_jsx_runtime35.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" })
8400
+ ] }),
8401
+ channels.find((c) => !c.platform || c.platform === "weixin") && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChannelStatus, { channel: channels.find((c) => !c.platform || c.platform === "weixin") }),
8402
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", "aria-label": "\u914D\u7F6E\u5FAE\u4FE1", onClick: () => setConfiguring("weixin"), children: "\u914D\u7F6E" }),
8403
+ configuring === "weixin" && /* @__PURE__ */ (0, import_jsx_runtime35.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 })
8404
+ ] }),
8405
+ ["matrix", "mattermost"].filter((platform2) => !channels.some((c) => c.platform === platform2)).map((platform2) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "dsh-partner-channel-row", children: [
8406
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { children: [
8407
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("strong", { children: platform2 === "matrix" ? "Matrix" : "Mattermost" }),
8408
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("small", { children: "\u5C1A\u672A\u8FDE\u63A5" })
8409
+ ] }),
8410
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", "aria-label": `\u914D\u7F6E ${platform2}`, onClick: () => openAdd(platform2), children: "\u914D\u7F6E" })
8411
+ ] }, platform2)),
8412
+ channels.filter((c) => c.platform && c.platform !== "weixin").map((channel) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "dsh-partner-channel-row", children: [
8413
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { children: [
8414
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("strong", { children: channel.name }),
8415
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("small", { children: [
8416
+ channel.platform,
8417
+ " \xB7 ",
8418
+ pairings.filter((p) => p.channelId === channel.id && p.status === "pending").length,
8419
+ " \u4E2A\u5F85\u6388\u6743"
8420
+ ] })
8421
+ ] }),
8422
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChannelStatus, { channel }),
8423
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", "aria-label": `\u914D\u7F6E ${channel.name}`, onClick: () => {
8424
+ setFeedback("");
8425
+ setConfiguring(channel.id);
8426
+ }, children: "\u914D\u7F6E" }),
8427
+ configuring === channel.id && /* @__PURE__ */ (0, import_jsx_runtime35.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: () => {
8428
+ if (!busy) {
8429
+ setConfiguring(void 0);
8430
+ setDeleting(void 0);
8431
+ }
8432
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "dsh-partner-channel-detail dsh-partner-channel-manage", children: [
8433
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "dsh-partner-channel-connection", children: [
8434
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { children: [
8435
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("small", { children: "\u767B\u5F55\u8D26\u53F7" }),
8436
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("strong", { children: channel.accountId }),
8437
+ channel.direct?.targetId && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("small", { children: channel.direct.targetId })
8438
+ ] }),
8439
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChannelStatus, { channel })
8440
+ ] }),
8441
+ !channel.direct?.targetId && /* @__PURE__ */ (0, import_jsx_runtime35.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" }),
8442
+ channel.lastError && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { role: "alert", children: channel.lastError }),
8443
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "dsh-partner-form-actions", children: [
8444
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { disabled: busy, onClick: () => void run(async () => {
8445
+ await api(`/channels/${channel.id}/enabled`, { method: "POST", body: JSON.stringify({ enabled: !channel.enabled }) });
8446
+ await onChanged();
8447
+ }), children: channel.enabled ? "\u505C\u7528" : "\u542F\u7528" }),
8448
+ channel.enabled && channel.runtimeStatus === "error" && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { disabled: busy, onClick: () => void run(async () => {
8449
+ await api(`/channels/${channel.id}/enabled`, { method: "POST", body: JSON.stringify({ enabled: true }) });
8450
+ await onChanged();
8451
+ }), children: "\u91CD\u8FDE" }),
8452
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { disabled: busy, onClick: () => deleting === channel.id ? void run(async () => {
8453
+ await api(`/channels/${channel.id}`, { method: "DELETE" });
8454
+ setDeleting(void 0);
8455
+ await onChanged();
8456
+ }) : setDeleting(channel.id), children: deleting === channel.id ? "\u786E\u8BA4\u5220\u9664\u914D\u7F6E\u4E0E\u51ED\u636E" : "\u5220\u9664\u6E20\u9053" }),
8457
+ deleting === channel.id && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { onClick: () => setDeleting(void 0), children: "\u53D6\u6D88" })
8458
+ ] }),
8459
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("section", { className: "dsh-partner-channel-access", children: [
8460
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("h3", { children: "\u8054\u7CFB\u4EBA\u6388\u6743" }),
8461
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("p", { role: "status", children: [
8462
+ pairings.filter((p) => p.channelId === channel.id && p.status === "pending").length,
8463
+ " \u4E2A\u7B49\u5F85\u6279\u51C6 \xB7 \u81EA\u52A8\u5237\u65B0"
8464
+ ] }),
8465
+ pairings.filter((p) => p.channelId === channel.id).map((p) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "dsh-partner-channel-person", children: [
8466
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { children: [
8467
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("strong", { children: p.displayName }),
8468
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("small", { children: p.status === "approved" ? "\u5DF2\u6388\u6743" : p.status === "pending" ? "\u7B49\u5F85\u6279\u51C6" : "\u5DF2\u963B\u6B62" }),
8469
+ p.status === "pending" && p.pairingCode && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { children: [
8470
+ "\u914D\u5BF9\u7801 ",
8471
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("code", { children: p.pairingCode })
8472
+ ] })
8473
+ ] }),
8474
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { disabled: busy, onClick: () => void run(async () => {
8475
+ await api(`/pairings/${p.id}/status`, { method: "POST", body: JSON.stringify({ status: p.status === "approved" ? "blocked" : "approved" }) });
8476
+ await onChanged();
8477
+ }), children: p.status === "approved" ? "\u64A4\u9500\u6388\u6743" : "\u6279\u51C6\u8054\u7CFB\u4EBA" })
8478
+ ] }, p.id))
8479
+ ] }),
8480
+ feedback && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { role: "status", children: feedback })
8481
+ ] }) })
8482
+ ] }, channel.id))
8483
+ ] }),
8484
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("section", { className: "dsh-partner-channel-notifications", "aria-label": "\u901A\u77E5\u8BBE\u7F6E", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "dsh-partner-channel-row", children: [
8485
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { children: [
8486
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("strong", { children: "\u901A\u77E5\u4E0E\u4EA4\u4ED8" }),
8487
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("small", { children: "\u9ED8\u8BA4\u8DDF\u968F\u6700\u8FD1\u6E20\u9053" })
8488
+ ] }),
8489
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", onClick: () => setConfiguring("delivery"), children: "\u914D\u7F6E" })
8490
+ ] }) }),
8491
+ configuring === "delivery" && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(WorkspaceDialog, { title: "\u901A\u77E5\u4E0E\u4EA4\u4ED8", detail: "\u8BBE\u7F6E\u901A\u77E5\u6295\u9012\u76EE\u6807\u3002", close: () => setConfiguring(void 0), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "dsh-partner-channel-detail", children: [
8492
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { children: "\u672C\u5730\u4E0E\u6240\u6709\u5DF2\u6388\u6743\u6E20\u9053\u5171\u7528\u4F19\u4F34\u4E3B\u5BF9\u8BDD\uFF0C\u65E0\u9700\u5173\u8054\u8054\u7CFB\u4EBA\u3002\u901A\u77E5\u9ED8\u8BA4\u8D70\u6700\u8FD1\u6536\u5230\u6D88\u606F\u7684\u6E20\u9053\uFF1B\u6307\u5B9A\u76EE\u6807\u4E0D\u53EF\u7528\u65F6\u7B49\u5F85\u91CD\u8BD5\uFF0C\u4E0D\u6539\u53D1\u5176\u4ED6\u6E20\u9053\u3002" }),
8493
+ !pairings.some((p) => p.status === "approved") && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { children: "\u6279\u51C6\u8054\u7CFB\u4EBA\u540E\uFF0C\u5373\u53EF\u8BBE\u7F6E\u901A\u77E5\u6295\u9012\u76EE\u6807\u3002" }),
8494
+ pairings.filter((p) => p.status === "approved").map((p) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DeliverySettings, { pairing: p, pairings, channels, onChanged }, `${p.id}:${p.updatedAt}`))
8495
+ ] }) })
8496
+ ] });
8497
+ }
8498
+ function FormField2({ label, hint, children }) {
8499
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "dsh-partner-channel-field", children: [
8500
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: label }),
8501
+ children,
8502
+ hint && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("small", { children: hint })
8503
+ ] });
8504
+ }
8505
+ function DeliverySettings({ pairing, pairings, channels, onChanged }) {
8506
+ const contactKey = pairing.contactKey ?? "";
8507
+ const [target, setTarget] = (0, import_react38.useState)(pairing.deliveryTarget ? pairings.find((p) => p.status === "approved" && p.channelId === pairing.deliveryTarget?.channelId && p.userId === pairing.deliveryTarget?.userId)?.id ?? "unavailable" : "");
8508
+ const [busy, setBusy] = (0, import_react38.useState)(false), [error, setError] = (0, import_react38.useState)("");
8509
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("form", { className: "dsh-partner-feature-form dsh-partner-channel-form", onSubmit: (e) => {
8510
+ e.preventDefault();
8511
+ if (busy) return;
8512
+ setBusy(true);
8513
+ setError("");
8514
+ void api(`/pairings/${pairing.id}/delivery`, { method: "POST", body: JSON.stringify({ contactKey, targetPairingId: target || null }) }).then(onChanged).catch((e2) => setError(errorMessage(e2))).finally(() => setBusy(false));
8515
+ }, children: [
8516
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("h4", { children: [
8517
+ channels.find((c) => c.id === pairing.channelId)?.name,
8518
+ " \xB7 ",
8519
+ pairing.displayName
8520
+ ] }),
8521
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(FormField2, { label: "\u901A\u77E5\u6295\u9012\u76EE\u6807", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("select", { disabled: busy, value: target, onChange: (e) => setTarget(e.target.value), children: [
8522
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: "", children: "\u81EA\u52A8\uFF1A\u8BE5\u8054\u7CFB\u4EBA\u6700\u8FD1\u6E20\u9053" }),
8523
+ target === "unavailable" && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: "unavailable", disabled: true, children: "\u539F\u6307\u5B9A\u76EE\u6807\u4E0D\u53EF\u7528\uFF0C\u8BF7\u660E\u786E\u91CD\u65B0\u9009\u62E9" }),
8524
+ pairings.filter((p) => p.status === "approved").map((p) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("option", { value: p.id, children: [
8525
+ channels.find((c) => c.id === p.channelId)?.name,
8526
+ " \xB7 ",
8527
+ p.displayName
8528
+ ] }, p.id))
8529
+ ] }) }),
8530
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "dsh-partner-form-actions", children: [
8531
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { role: "alert", children: error }),
8532
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { disabled: busy, children: "\u4FDD\u5B58\u6295\u9012\u8BBE\u7F6E" })
8533
+ ] })
8534
+ ] });
8535
+ }
8536
+
8537
+ // src/ui/use-channel-status.ts
8538
+ var import_react39 = require("react");
8539
+ var listeners2 = /* @__PURE__ */ new Set();
8540
+ var timer;
8541
+ var active;
8542
+ var lastValue = "";
8543
+ async function poll() {
8544
+ if (active || !listeners2.size) return;
8545
+ const controller = new AbortController();
8546
+ active = controller;
8547
+ try {
8548
+ if (document.visibilityState !== "hidden") {
8549
+ const value = await api("/channels/status", { signal: AbortSignal.any([controller.signal, AbortSignal.timeout(1e4)]) });
8550
+ const serialized = JSON.stringify(value);
8551
+ if (serialized !== lastValue) {
8552
+ lastValue = serialized;
8553
+ listeners2.forEach((listener) => listener(value));
8554
+ }
8555
+ }
8556
+ } catch {
8557
+ } finally {
8558
+ if (active === controller) active = void 0;
8559
+ if (listeners2.size) timer = setTimeout(() => void poll(), 3e3);
8560
+ }
8561
+ }
8562
+ function useChannelStatus(setSnapshot) {
8563
+ (0, import_react39.useEffect)(() => {
8564
+ const update = (value) => setSnapshot((previous) => previous ? { ...previous, ...value } : previous);
8565
+ listeners2.add(update);
8566
+ lastValue = "";
8567
+ if (!active) {
8568
+ clearTimeout(timer);
8569
+ void poll();
8570
+ }
8571
+ return () => {
8572
+ listeners2.delete(update);
8573
+ if (!listeners2.size) {
8574
+ clearTimeout(timer);
8575
+ active?.abort();
8576
+ lastValue = "";
8577
+ }
8578
+ };
8579
+ }, [setSnapshot]);
8580
+ }
8581
+
8582
+ // src/ui/identity-editor.css
8583
+ 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";
8584
+
8585
+ // src/ui/companion-create.tsx
8586
+ var import_react40 = require("react");
8587
+ var import_dsh_client_ui_primitives20 = require("@deepseek-ai/dsh-client-ui-primitives");
8588
+ var import_jsx_runtime36 = require("react/jsx-runtime");
8589
+ function CompanionCreateDialog({ close, create }) {
8590
+ const [busy, setBusy] = (0, import_react40.useState)(false);
8591
+ const [error, setError] = (0, import_react40.useState)();
8262
8592
  const submit = async (event) => {
8263
8593
  event.preventDefault();
8264
8594
  const data = new FormData(event.currentTarget);
@@ -8277,44 +8607,81 @@ function CompanionCreateDialog({ close, create }) {
8277
8607
  setBusy(false);
8278
8608
  }
8279
8609
  };
8280
- 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) => {
8610
+ return /* @__PURE__ */ (0, import_jsx_runtime36.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_runtime36.jsxs)("form", { className: "dsh-partner-feature-form dsh-partner-companion-create-form", "aria-busy": busy, onSubmit: (event) => {
8281
8611
  void submit(event);
8282
8612
  }, children: [
8283
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { children: [
8284
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "\u4F19\u4F34\u540D\u5B57" }),
8285
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("input", { name: "name", required: true, maxLength: 60, autoFocus: true, placeholder: "\u4F8B\u5982\uFF1A\u5C0F\u9ED1" })
8613
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { children: [
8614
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "\u4F19\u4F34\u540D\u5B57" }),
8615
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("input", { name: "name", required: true, maxLength: 60, autoFocus: true, placeholder: "\u4F8B\u5982\uFF1A\u5C0F\u9ED1" })
8286
8616
  ] }),
8287
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { children: [
8288
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "\u4E3B\u8981\u89D2\u8272" }),
8289
- /* @__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" })
8617
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { children: [
8618
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "\u4E3B\u8981\u89D2\u8272" }),
8619
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("input", { name: "role", required: true, maxLength: 120, placeholder: "\u4F8B\u5982\uFF1A\u4EA7\u54C1\u4E0E\u5DE5\u7A0B\u534F\u4F5C\u4F19\u4F34" })
8290
8620
  ] }),
8291
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "is-wide", children: [
8292
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "\u4E00\u53E5\u8BDD\u5B9A\u4F4D" }),
8293
- /* @__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" })
8621
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "is-wide", children: [
8622
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "\u4E00\u53E5\u8BDD\u5B9A\u4F4D" }),
8623
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("input", { name: "description", maxLength: 500, placeholder: "\u5B83\u4E3B\u8981\u8D1F\u8D23\u4EC0\u4E48\uFF0C\u4EC0\u4E48\u65F6\u5019\u5E94\u8BE5\u627E\u5B83" })
8294
8624
  ] }),
8295
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "is-wide", children: [
8296
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "\u521D\u59CB\u884C\u4E3A\u51C6\u5219" }),
8297
- /* @__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" })
8625
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "is-wide", children: [
8626
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "\u521D\u59CB\u884C\u4E3A\u51C6\u5219" }),
8627
+ /* @__PURE__ */ (0, import_jsx_runtime36.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" })
8298
8628
  ] }),
8299
- error && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(WorkspaceNotice, { children: error }),
8300
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("footer", { children: [
8301
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", disabled: busy, onClick: close, children: "\u53D6\u6D88" }),
8302
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("button", { type: "submit", className: "is-primary", disabled: busy, children: [
8303
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_dsh_client_ui_primitives20.IconPlusOutline16, { size: 14 }),
8629
+ error && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(WorkspaceNotice, { children: error }),
8630
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("footer", { children: [
8631
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", disabled: busy, onClick: close, children: "\u53D6\u6D88" }),
8632
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("button", { type: "submit", className: "is-primary", disabled: busy, children: [
8633
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives20.IconPlusOutline16, { size: 14 }),
8304
8634
  busy ? "\u6B63\u5728\u521B\u5EFA\u2026" : "\u521B\u5EFA\u4F19\u4F34"
8305
8635
  ] })
8306
8636
  ] })
8307
8637
  ] }) });
8308
8638
  }
8309
8639
 
8640
+ // src/main-panel-compat.ts
8641
+ var import_react41 = require("react");
8642
+ function registerMainPanel(ctx, id, priority, render, onHidden = () => {
8643
+ }) {
8644
+ const layout = ctx.layout;
8645
+ if (typeof layout.selectPanel !== "function") {
8646
+ return ctx.slots.register({ name: "conversation", priority }, render);
8647
+ }
8648
+ const slots = ctx.slots;
8649
+ let disposed = false;
8650
+ let generation = 0;
8651
+ const Body = (props) => {
8652
+ (0, import_react41.useEffect)(() => {
8653
+ const current2 = ++generation;
8654
+ return () => {
8655
+ queueMicrotask(() => {
8656
+ if (!disposed && generation === current2) onHidden();
8657
+ });
8658
+ };
8659
+ }, []);
8660
+ return render(props);
8661
+ };
8662
+ const remove = slots.register({ name: "main", key: id }, Body);
8663
+ const dispose = () => {
8664
+ if (disposed) return;
8665
+ disposed = true;
8666
+ remove();
8667
+ };
8668
+ try {
8669
+ layout.selectPanel(id);
8670
+ } catch (error) {
8671
+ dispose();
8672
+ throw error;
8673
+ }
8674
+ return dispose;
8675
+ }
8676
+
8310
8677
  // src/client-controller.tsx
8311
8678
  function createPartnerController(ctx, pluginId, render) {
8312
- const listeners2 = /* @__PURE__ */ new Set();
8679
+ const listeners3 = /* @__PURE__ */ new Set();
8313
8680
  let selected;
8314
8681
  let destination;
8315
8682
  let dispose;
8316
8683
  const notify = () => {
8317
- for (const listener of listeners2) listener();
8684
+ for (const listener of listeners3) listener();
8318
8685
  };
8319
8686
  const controller = {
8320
8687
  open(companionId, target) {
@@ -8322,7 +8689,7 @@ function createPartnerController(ctx, pluginId, render) {
8322
8689
  if (companionId !== void 0) selected = companionId;
8323
8690
  if (dispose === void 0) {
8324
8691
  activatePluginWorkspace(pluginId);
8325
- dispose = ctx.slots.register({ name: "conversation", priority: -3 }, (props) => render(props, controller));
8692
+ dispose = registerMainPanel(ctx, pluginId, -3, (props) => render(props, controller), () => controller.close());
8326
8693
  }
8327
8694
  notify();
8328
8695
  },
@@ -8349,8 +8716,7 @@ function createPartnerController(ctx, pluginId, render) {
8349
8716
  async startSession(companionId) {
8350
8717
  const created = await api(`/companions/${encodeURIComponent(companionId)}/session`, { method: "POST" });
8351
8718
  await waitForClientSession(ctx, created.sessionId);
8352
- dispose?.();
8353
- dispose = void 0;
8719
+ controller.close();
8354
8720
  sessions(ctx).open(created.sessionId);
8355
8721
  },
8356
8722
  async renewSession(routeId) {
@@ -8360,8 +8726,8 @@ function createPartnerController(ctx, pluginId, render) {
8360
8726
  sessions(ctx).open(renewed.sessionId);
8361
8727
  },
8362
8728
  subscribe(listener) {
8363
- listeners2.add(listener);
8364
- return () => listeners2.delete(listener);
8729
+ listeners3.add(listener);
8730
+ return () => listeners3.delete(listener);
8365
8731
  }
8366
8732
  };
8367
8733
  return controller;
@@ -8390,7 +8756,7 @@ function sessions(ctx) {
8390
8756
  }
8391
8757
 
8392
8758
  // src/client.tsx
8393
- var import_jsx_runtime36 = require("react/jsx-runtime");
8759
+ var import_jsx_runtime37 = require("react/jsx-runtime");
8394
8760
  var PLUGIN_ID = "@lemoncat7/dsh-partner";
8395
8761
  var STYLE_ID = `${PLUGIN_ID}/client`;
8396
8762
  var cssText = `${client_default}
@@ -8400,29 +8766,31 @@ ${responsive_ui_default}
8400
8766
  ${requirement_board_default}
8401
8767
  ${widget_default}
8402
8768
  ${settings_panel_default}
8403
- ${memory_ui_default}`;
8769
+ ${memory_ui_default}
8770
+ ${identity_editor_default}`;
8404
8771
  var WORKSPACE_PAGES = /* @__PURE__ */ new Set(["skills", "board", "schedules", "pendant"]);
8405
8772
  var inject = ["slots", "layout", "sessions"];
8406
8773
  function apply(ctx) {
8407
8774
  ctx.effect(installStyles, "dsh-partner: styles");
8408
- const controller = createPartnerController(ctx, PLUGIN_ID, (props, current2) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(PartnerWorkspace, { ...props, controller: current2 }));
8409
- ctx.slots.inject("shell.overlay", () => ctx.slots.register({ name: "shell.overlay", id: "partner-pendant", order: 30 }, () => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(PartnerPendant, { controller })));
8775
+ const controller = createPartnerController(ctx, PLUGIN_ID, (props, current2) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(PartnerWorkspace, { ...props, controller: current2 }));
8776
+ ctx.slots.inject("shell.overlay", () => ctx.slots.register({ name: "shell.overlay", id: "partner-pendant", order: 30 }, () => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(PartnerPendant, { controller })));
8410
8777
  ctx.effect(() => observePluginWorkspace(PLUGIN_ID, controller.close), "dsh-partner: exclusive workspace");
8411
8778
  ctx.effect(() => () => controller.close(), "dsh-partner: workspace lifecycle");
8412
8779
  ctx.slots.inject("sidebar.footer.action", () => ctx.slots.register({
8413
8780
  name: "sidebar.footer.action",
8414
8781
  id: "partner",
8415
8782
  order: -120
8416
- }, (props) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(PartnerSidebar, { ...props, controller, collapse: () => ctx.layout.toggleSidebar() })));
8783
+ }, (props) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(PartnerSidebar, { ...props, controller, collapse: () => ctx.layout.toggleSidebar() })));
8417
8784
  }
8418
8785
  function PartnerSidebar(props) {
8419
- const ref = (0, import_react39.useRef)(null);
8786
+ const ref = (0, import_react42.useRef)(null);
8420
8787
  useWorkspaceTopAnchor(ref);
8421
- const [open, setOpen] = (0, import_react39.useState)(true);
8422
- const [snapshot, setSnapshot] = (0, import_react39.useState)();
8423
- const [, update] = (0, import_react39.useState)(0);
8424
- (0, import_react39.useEffect)(() => props.controller.subscribe(() => update((value) => value + 1)), [props.controller]);
8425
- (0, import_react39.useEffect)(() => {
8788
+ const [open, setOpen] = (0, import_react42.useState)(true);
8789
+ const [snapshot, setSnapshot] = (0, import_react42.useState)();
8790
+ useChannelStatus(setSnapshot);
8791
+ const [, update] = (0, import_react42.useState)(0);
8792
+ (0, import_react42.useEffect)(() => props.controller.subscribe(() => update((value) => value + 1)), [props.controller]);
8793
+ (0, import_react42.useEffect)(() => {
8426
8794
  void loadPartner().then(setSnapshot).catch(() => {
8427
8795
  });
8428
8796
  }, [props.controller.isOpen()]);
@@ -8430,34 +8798,35 @@ function PartnerSidebar(props) {
8430
8798
  props.controller.open(id);
8431
8799
  if (props.wide && window.matchMedia("(max-width: 820px)").matches) props.collapse();
8432
8800
  };
8433
- 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 }) }) });
8434
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("section", { ref, className: "dsh-partner-sidebar", children: [
8435
- /* @__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: [
8436
- /* @__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 }) }),
8801
+ if (!props.wide) return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("section", { ref, className: "dsh-partner-sidebar is-rail", children: /* @__PURE__ */ (0, import_jsx_runtime37.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_runtime37.jsx)(import_dsh_client_ui_primitives21.IconAgentPresetOutline16, { size: 18 }) }) });
8802
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("section", { ref, className: "dsh-partner-sidebar", children: [
8803
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "dsh-partner-sidebar-heading", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("button", { type: "button", className: "dsh-partner-sidebar-title", "aria-expanded": open, onClick: () => setOpen((value) => !value), children: [
8804
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { "data-open": open, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_dsh_client_ui_primitives21.IconChevronDownOutline14, { size: 14 }) }),
8437
8805
  "\u4F19\u4F34"
8438
8806
  ] }) }),
8439
- /* @__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: [
8440
- /* @__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 }) }),
8441
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
8442
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: "\u4F19\u4F34\u9762\u677F" }),
8443
- /* @__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" })
8807
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: `dsh-partner-sidebar-list${open ? " is-open" : ""}`, "aria-hidden": !open, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "dsh-partner-sidebar-list-inner", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("button", { type: "button", tabIndex: open ? 0 : -1, className: `dsh-partner-sidebar-row${props.controller.isOpen() ? " is-active" : ""}`, onClick: () => launch(), children: [
8808
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "dsh-partner-sidebar-symbol", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_dsh_client_ui_primitives21.IconAgentPresetOutline16, { size: 16 }) }),
8809
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { children: [
8810
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("strong", { children: "\u4F19\u4F34\u9762\u677F" }),
8811
+ /* @__PURE__ */ (0, import_jsx_runtime37.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" })
8444
8812
  ] }),
8445
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("i", { className: snapshot?.channels.some((item) => item.runtimeStatus === "running") ? "is-online" : "" })
8813
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("i", { className: snapshot?.channels.some((item) => item.runtimeStatus === "running") ? "is-online" : "" })
8446
8814
  ] }) }) })
8447
8815
  ] });
8448
8816
  }
8449
8817
  function PartnerWorkspace({ controller }) {
8450
- const [snapshot, setSnapshot] = (0, import_react39.useState)();
8451
- const [selectedId, setSelectedId] = (0, import_react39.useState)(controller.selected());
8452
- const [view, setView] = (0, import_react39.useState)(controller.destination()?.page ?? "home");
8453
- const [requestedDestination, setRequestedDestination] = (0, import_react39.useState)(controller.destination());
8454
- const [error, setError] = (0, import_react39.useState)();
8455
- const [loading, setLoading] = (0, import_react39.useState)(true);
8456
- const [creatingCompanion, setCreatingCompanion] = (0, import_react39.useState)(false);
8457
- const [notice, setNotice] = (0, import_react39.useState)();
8458
- const selectionRef = (0, import_react39.useRef)({ selectedId, companions: snapshot?.companions });
8818
+ const [snapshot, setSnapshot] = (0, import_react42.useState)();
8819
+ useChannelStatus(setSnapshot);
8820
+ const [selectedId, setSelectedId] = (0, import_react42.useState)(controller.selected());
8821
+ const [view, setView] = (0, import_react42.useState)(controller.destination()?.page ?? "home");
8822
+ const [requestedDestination, setRequestedDestination] = (0, import_react42.useState)(controller.destination());
8823
+ const [error, setError] = (0, import_react42.useState)();
8824
+ const [loading, setLoading] = (0, import_react42.useState)(true);
8825
+ const [creatingCompanion, setCreatingCompanion] = (0, import_react42.useState)(false);
8826
+ const [notice, setNotice] = (0, import_react42.useState)();
8827
+ const selectionRef = (0, import_react42.useRef)({ selectedId, companions: snapshot?.companions });
8459
8828
  selectionRef.current = { selectedId, companions: snapshot?.companions };
8460
- const refresh = (0, import_react39.useCallback)(async (throwOnError = false) => {
8829
+ const refresh = (0, import_react42.useCallback)(async (throwOnError = false) => {
8461
8830
  try {
8462
8831
  const next = await loadPartner();
8463
8832
  setSnapshot(next);
@@ -8470,10 +8839,10 @@ function PartnerWorkspace({ controller }) {
8470
8839
  setLoading(false);
8471
8840
  }
8472
8841
  }, []);
8473
- (0, import_react39.useEffect)(() => {
8842
+ (0, import_react42.useEffect)(() => {
8474
8843
  void refresh();
8475
8844
  }, [refresh]);
8476
- (0, import_react39.useEffect)(() => controller.subscribe(() => {
8845
+ (0, import_react42.useEffect)(() => controller.subscribe(() => {
8477
8846
  const next = controller.selected();
8478
8847
  if (next) setSelectedId(next);
8479
8848
  const destination = controller.destination();
@@ -8542,18 +8911,18 @@ function PartnerWorkspace({ controller }) {
8542
8911
  setSelectedId(id);
8543
8912
  setView("home");
8544
8913
  };
8545
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("main", { className: "dsh-partner-workspace", children: [
8546
- creatingCompanion && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(CompanionCreateDialog, { close: () => setCreatingCompanion(false), create }),
8547
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("header", { className: "dsh-partner-topbar", children: [
8548
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-topbar-brand", children: [
8549
- /* @__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 }) }),
8550
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconAgentPresetOutline16, { size: 18 }),
8551
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
8552
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: "\u4F19\u4F34" }),
8553
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "\u957F\u671F\u8EAB\u4EFD\u4E0E\u5FAE\u4FE1\u6E20\u9053" })
8914
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("main", { className: "dsh-partner-workspace", children: [
8915
+ creatingCompanion && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CompanionCreateDialog, { close: () => setCreatingCompanion(false), create }),
8916
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("header", { className: "dsh-partner-topbar", children: [
8917
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "dsh-partner-topbar-brand", children: [
8918
+ /* @__PURE__ */ (0, import_jsx_runtime37.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_runtime37.jsx)(import_dsh_client_ui_primitives21.IconChevronLeftOutline14, { size: 15 }) }),
8919
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_dsh_client_ui_primitives21.IconAgentPresetOutline16, { size: 18 }),
8920
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { children: [
8921
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("strong", { children: "\u4F19\u4F34" }),
8922
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("small", { children: "\u957F\u671F\u8EAB\u4EFD\u4E0E\u6D88\u606F\u6E20\u9053" })
8554
8923
  ] })
8555
8924
  ] }),
8556
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
8925
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8557
8926
  MobileWorkspaceControls,
8558
8927
  {
8559
8928
  companions: snapshot?.companions ?? [],
@@ -8565,117 +8934,117 @@ function PartnerWorkspace({ controller }) {
8565
8934
  }
8566
8935
  )
8567
8936
  ] }),
8568
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-grid", children: [
8569
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("aside", { className: "dsh-partner-roster", children: [
8570
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-roster-title", children: [
8571
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
8572
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "COMPANIONS" }),
8573
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: "\u4F19\u4F34\u540D\u518C" })
8937
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "dsh-partner-grid", children: [
8938
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("aside", { className: "dsh-partner-roster", children: [
8939
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "dsh-partner-roster-title", children: [
8940
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { children: [
8941
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("small", { children: "COMPANIONS" }),
8942
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("strong", { children: "\u4F19\u4F34\u540D\u518C" })
8574
8943
  ] }),
8575
- /* @__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 }) })
8944
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", onClick: () => setCreatingCompanion(true), "aria-label": "\u65B0\u5EFA\u4F19\u4F34", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_dsh_client_ui_primitives21.IconPlusOutline16, { size: 16 }) })
8576
8945
  ] }),
8577
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "dsh-partner-roster-list", children: snapshot?.companions.map((companion) => {
8946
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "dsh-partner-roster-list", children: snapshot?.companions.map((companion) => {
8578
8947
  const channel = snapshot.channels.find((item) => item.companionId === companion.id);
8579
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("button", { type: "button", className: !workspacePage && selectedId === companion.id ? "is-active" : "", onClick: () => openCompanion(companion.id), children: [
8580
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Avatar, { name: companion.name }),
8581
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
8582
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: companion.name }),
8583
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: companion.role })
8948
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("button", { type: "button", className: !workspacePage && selectedId === companion.id ? "is-active" : "", onClick: () => openCompanion(companion.id), children: [
8949
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Avatar, { name: companion.name }),
8950
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { children: [
8951
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("strong", { children: companion.name }),
8952
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("small", { children: companion.role })
8584
8953
  ] }),
8585
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("i", { className: channel?.runtimeStatus === "running" ? "is-online" : "", title: channel ? channel.runtimeStatus : "\u672A\u8FDE\u63A5\u6E20\u9053" })
8954
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("i", { className: channel?.runtimeStatus === "running" ? "is-online" : "", title: channel ? channel.runtimeStatus : "\u672A\u8FDE\u63A5\u6E20\u9053" })
8586
8955
  ] }, companion.id);
8587
8956
  }) }),
8588
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("nav", { className: "dsh-partner-workspace-nav", "aria-label": "\u4F19\u4F34\u5DE5\u4F5C\u533A", children: [
8589
- /* @__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: [
8590
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconBrowseOutline16, { size: 16 }) }),
8591
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: "Skill \u5E02\u573A" }),
8592
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "\u5B89\u88C5\u4E0E\u7BA1\u7406\u80FD\u529B" })
8957
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("nav", { className: "dsh-partner-workspace-nav", "aria-label": "\u4F19\u4F34\u5DE5\u4F5C\u533A", children: [
8958
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("button", { type: "button", className: view === "skills" ? "is-active" : "", "aria-current": view === "skills" ? "page" : void 0, onClick: () => setView("skills"), children: [
8959
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_dsh_client_ui_primitives21.IconBrowseOutline16, { size: 16 }) }),
8960
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("strong", { children: "Skill \u5E02\u573A" }),
8961
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("small", { children: "\u5B89\u88C5\u4E0E\u7BA1\u7406\u80FD\u529B" })
8593
8962
  ] }),
8594
- /* @__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: [
8595
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconListPenOutline16, { size: 16 }) }),
8596
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: "\u4EFB\u52A1\u770B\u677F" }),
8597
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "\u534F\u4F5C\u3001\u59D4\u6D3E\u4E0E\u9A8C\u6536" })
8963
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("button", { type: "button", className: view === "board" ? "is-active" : "", "aria-current": view === "board" ? "page" : void 0, onClick: () => setView("board"), children: [
8964
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_dsh_client_ui_primitives21.IconListPenOutline16, { size: 16 }) }),
8965
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("strong", { children: "\u4EFB\u52A1\u770B\u677F" }),
8966
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("small", { children: "\u534F\u4F5C\u3001\u59D4\u6D3E\u4E0E\u9A8C\u6536" })
8598
8967
  ] }),
8599
- /* @__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: [
8600
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconPlayOutline16, { size: 16 }) }),
8601
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: "\u5B9A\u65F6\u4EFB\u52A1" }),
8602
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "\u9009\u62E9\u4F19\u4F34\u5468\u671F\u6267\u884C" })
8968
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("button", { type: "button", className: view === "schedules" ? "is-active" : "", "aria-current": view === "schedules" ? "page" : void 0, onClick: () => setView("schedules"), children: [
8969
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_dsh_client_ui_primitives21.IconPlayOutline16, { size: 16 }) }),
8970
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("strong", { children: "\u5B9A\u65F6\u4EFB\u52A1" }),
8971
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("small", { children: "\u9009\u62E9\u4F19\u4F34\u5468\u671F\u6267\u884C" })
8603
8972
  ] }),
8604
- /* @__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: [
8605
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconEditOutline16, { size: 16 }) }),
8606
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: "\u5361\u7247\u8BBE\u7F6E" }),
8607
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "\u6302\u9970\u3001\u7EF3\u5B50\u4E0E\u56FE\u6848" })
8973
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("button", { type: "button", className: view === "pendant" ? "is-active" : "", "aria-current": view === "pendant" ? "page" : void 0, onClick: () => setView("pendant"), children: [
8974
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_dsh_client_ui_primitives21.IconEditOutline16, { size: 16 }) }),
8975
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("strong", { children: "\u5361\u7247\u8BBE\u7F6E" }),
8976
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("small", { children: "\u6302\u9970\u3001\u7EF3\u5B50\u4E0E\u56FE\u6848" })
8608
8977
  ] })
8609
8978
  ] }),
8610
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-roster-note", children: [
8611
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconLinkOutline16, { size: 16 }),
8612
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
8613
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: "\u8EAB\u4EFD\u4E0E\u6E20\u9053\u5206\u79BB" }),
8614
- /* @__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" })
8979
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "dsh-partner-roster-note", children: [
8980
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_dsh_client_ui_primitives21.IconLinkOutline16, { size: 16 }),
8981
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { children: [
8982
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("strong", { children: "\u8EAB\u4EFD\u4E0E\u6E20\u9053\u5206\u79BB" }),
8983
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("small", { children: "\u6E20\u9053\u53EA\u8D1F\u8D23\u6536\u53D1\uFF0C\u6743\u9650\u4ECD\u7531 DSH \u5DE5\u5177\u51B3\u5B9A\u3002" })
8615
8984
  ] })
8616
8985
  ] })
8617
8986
  ] }),
8618
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("section", { className: `dsh-partner-stage${workspacePage ? " is-workspace-page" : ""}`, children: [
8619
- 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: [
8620
- view === "skills" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(SkillsPanel, {}),
8621
- view === "board" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(RequirementBoard, { initialTaskId: requestedDestination?.taskId, openRequest: requestedDestination }),
8622
- view === "schedules" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(SchedulePanel, { companions: snapshot?.companions ?? [] }),
8623
- view === "pendant" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(PendantSettingsPanel, {})
8624
- ] }) : 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: [
8625
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-identity", children: [
8626
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Avatar, { name: selected.name }),
8627
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
8628
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "ACTIVE COMPANION" }),
8629
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h1", { children: selected.name }),
8630
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { children: selected.description || selected.role })
8987
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("section", { className: `dsh-partner-stage${workspacePage ? " is-workspace-page" : ""}`, children: [
8988
+ loading ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ContentState, { title: "\u6B63\u5728\u8BFB\u53D6\u4F19\u4F34\u2026" }) : workspacePage ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "dsh-partner-stage-scroll is-workspace-page", children: [
8989
+ view === "skills" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(SkillsPanel, {}),
8990
+ view === "board" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(RequirementBoard, { initialTaskId: requestedDestination?.taskId, openRequest: requestedDestination }),
8991
+ view === "schedules" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(SchedulePanel, { companions: snapshot?.companions ?? [] }),
8992
+ view === "pendant" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(PendantSettingsPanel, {})
8993
+ ] }) : selected === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime37.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_runtime37.jsx)("button", { onClick: () => setCreatingCompanion(true), children: "\u65B0\u5EFA\u4F19\u4F34" }) }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
8994
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "dsh-partner-identity", children: [
8995
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Avatar, { name: selected.name }),
8996
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { children: [
8997
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("small", { children: "ACTIVE COMPANION" }),
8998
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("h1", { children: selected.name }),
8999
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { children: selected.description || selected.role })
8631
9000
  ] }),
8632
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ChannelStatus, { channel: snapshot?.channels.find((item) => item.companionId === selected.id) })
9001
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ChannelStatus, { channel: snapshot?.channels.find((item) => item.companionId === selected.id) })
8633
9002
  ] }),
8634
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("nav", { className: "dsh-partner-tabs", "aria-label": "\u4F19\u4F34\u914D\u7F6E", children: [
8635
- /* @__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" }),
8636
- /* @__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" }),
8637
- /* @__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" }),
8638
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TabButton, { active: view === "weixin", onClick: () => setView("weixin"), icon: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(WeixinGlyph, {}), children: "\u5FAE\u4FE1" }),
8639
- /* @__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" }),
8640
- /* @__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" })
9003
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("nav", { className: "dsh-partner-tabs", "aria-label": "\u4F19\u4F34\u914D\u7F6E", children: [
9004
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TabButton, { active: view === "home", onClick: () => setView("home"), icon: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_dsh_client_ui_primitives21.IconAgentPresetOutline16, { size: 16 }), children: "\u603B\u89C8" }),
9005
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TabButton, { active: view === "identity", onClick: () => setView("identity"), icon: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_dsh_client_ui_primitives21.IconEditOutline16, { size: 16 }), children: "\u8EAB\u4EFD" }),
9006
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TabButton, { active: view === "capabilities", onClick: () => setView("capabilities"), icon: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_dsh_client_ui_primitives21.IconAgentPresetOutline16, { size: 16 }), children: "\u80FD\u529B" }),
9007
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TabButton, { active: view === "weixin", onClick: () => setView("weixin"), icon: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_dsh_client_ui_primitives21.IconLinkOutline16, { size: 16 }), children: "\u6E20\u9053" }),
9008
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TabButton, { active: view === "memory", onClick: () => setView("memory"), icon: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_dsh_client_ui_primitives21.IconDataOutline16, { size: 16 }), children: "\u8BB0\u5FC6" }),
9009
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TabButton, { active: view === "concerns", onClick: () => setView("concerns"), icon: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_dsh_client_ui_primitives21.IconBrowseOutline16, { size: 16 }), children: "\u6301\u7EED\u5173\u6CE8" })
8641
9010
  ] }),
8642
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-stage-scroll", children: [
8643
- notice && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "dsh-partner-inline-notice", role: "status", children: notice }),
8644
- view === "home" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(HomePanel, { companion: selected, snapshot, navigate: setView, openSession, startSession, renewSession }),
8645
- view === "identity" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(IdentityEditor, { companion: selected, count: snapshot?.companions.length ?? 1, onChanged: () => refresh(true), onRemoved: companionRemoved }),
8646
- view === "capabilities" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(CapabilityEditor, { companion: selected, presets: snapshot?.presets ?? [], onChanged: () => refresh(true) }, selected.id),
8647
- view === "weixin" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(WeixinPanel, { companion: selected, snapshot, onChanged: refresh }),
8648
- view === "memory" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(MemoryPanel, { companion: selected, snapshot, openSession, startSession, renewSession, onChanged: refresh }, selected.id),
8649
- view === "concerns" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ConcernPanel, { companion: selected, snapshot, onChanged: refresh }, selected.id)
9011
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "dsh-partner-stage-scroll", children: [
9012
+ notice && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "dsh-partner-inline-notice", role: "status", children: notice }),
9013
+ view === "home" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(HomePanel, { companion: selected, snapshot, navigate: setView, openSession, startSession, renewSession }),
9014
+ view === "identity" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(IdentityEditor, { companion: selected, count: snapshot?.companions.length ?? 1, onChanged: () => refresh(true), onRemoved: companionRemoved }),
9015
+ view === "capabilities" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CapabilityEditor, { companion: selected, presets: snapshot?.presets ?? [], onChanged: () => refresh(true) }, selected.id),
9016
+ view === "weixin" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ChannelsPanel, { companion: selected, snapshot, onChanged: refresh, weixin: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(WeixinPanel, { companion: selected, snapshot, onChanged: refresh }) }, selected.id),
9017
+ view === "memory" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(MemoryPanel, { companion: selected, snapshot, openSession, startSession, renewSession, onChanged: refresh }, selected.id),
9018
+ view === "concerns" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ConcernPanel, { companion: selected, snapshot, onChanged: refresh }, selected.id)
8650
9019
  ] })
8651
9020
  ] }),
8652
- error && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "dsh-partner-error", role: "alert", children: error })
9021
+ error && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "dsh-partner-error", role: "alert", children: error })
8653
9022
  ] })
8654
9023
  ] })
8655
9024
  ] });
8656
9025
  }
8657
9026
  function MobileWorkspaceControls({ companions, selectedId, view, openCompanion, openPage, createCompanion }) {
8658
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-mobile-controls", children: [
8659
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-mobile-companion-row", children: [
8660
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(CompanionPicker, { companions, selectedId, onChange: openCompanion }),
8661
- /* @__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 }) })
9027
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "dsh-partner-mobile-controls", children: [
9028
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "dsh-partner-mobile-companion-row", children: [
9029
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CompanionPicker, { companions, selectedId, onChange: openCompanion }),
9030
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", className: "dsh-partner-mobile-create", onClick: createCompanion, "aria-label": "\u65B0\u5EFA\u4F19\u4F34", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_dsh_client_ui_primitives21.IconPlusOutline16, { size: 17 }) })
8662
9031
  ] }),
8663
- /* @__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: [
8664
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("button", { type: "button", className: view === "skills" ? "is-active" : "", "aria-pressed": view === "skills", onClick: () => openPage("skills"), children: [
8665
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconBrowseOutline16, { size: 16 }),
8666
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Skill" })
9032
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("nav", { className: "dsh-partner-mobile-workspace-nav", "aria-label": "\u4F19\u4F34\u5DE5\u4F5C\u533A\u5FEB\u6377\u5165\u53E3", children: [
9033
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("button", { type: "button", className: view === "skills" ? "is-active" : "", "aria-pressed": view === "skills", onClick: () => openPage("skills"), children: [
9034
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_dsh_client_ui_primitives21.IconBrowseOutline16, { size: 16 }),
9035
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: "Skill" })
8667
9036
  ] }),
8668
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("button", { type: "button", className: view === "board" ? "is-active" : "", "aria-pressed": view === "board", onClick: () => openPage("board"), children: [
8669
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconListPenOutline16, { size: 16 }),
8670
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "\u770B\u677F" })
9037
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("button", { type: "button", className: view === "board" ? "is-active" : "", "aria-pressed": view === "board", onClick: () => openPage("board"), children: [
9038
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_dsh_client_ui_primitives21.IconListPenOutline16, { size: 16 }),
9039
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: "\u770B\u677F" })
8671
9040
  ] }),
8672
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("button", { type: "button", className: view === "schedules" ? "is-active" : "", "aria-pressed": view === "schedules", onClick: () => openPage("schedules"), children: [
8673
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconPlayOutline16, { size: 16 }),
8674
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "\u5B9A\u65F6" })
9041
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("button", { type: "button", className: view === "schedules" ? "is-active" : "", "aria-pressed": view === "schedules", onClick: () => openPage("schedules"), children: [
9042
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_dsh_client_ui_primitives21.IconPlayOutline16, { size: 16 }),
9043
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: "\u5B9A\u65F6" })
8675
9044
  ] }),
8676
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("button", { type: "button", className: view === "pendant" ? "is-active" : "", "aria-pressed": view === "pendant", onClick: () => openPage("pendant"), children: [
8677
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconEditOutline16, { size: 16 }),
8678
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "\u5361\u7247" })
9045
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("button", { type: "button", className: view === "pendant" ? "is-active" : "", "aria-pressed": view === "pendant", onClick: () => openPage("pendant"), children: [
9046
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_dsh_client_ui_primitives21.IconEditOutline16, { size: 16 }),
9047
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: "\u5361\u7247" })
8679
9048
  ] })
8680
9049
  ] })
8681
9050
  ] });
@@ -8688,78 +9057,79 @@ function HomePanel({ companion, snapshot, navigate, openSession, startSession, r
8688
9057
  const approved = channel ? snapshot.pairings.filter((item) => item.channelId === channel.id && item.status === "approved").length : 0;
8689
9058
  const capabilities = companion.capabilities.map((item) => CAPABILITY_LABELS[item]);
8690
9059
  const online = channel?.runtimeStatus === "running";
8691
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-home", children: [
8692
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("header", { className: "dsh-partner-home-heading", children: [
8693
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
8694
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "\u5DE5\u4F5C\u53F0" }),
8695
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h2", { children: online ? `${companion.name} \u6B63\u5728\u5FAE\u4FE1\u5F85\u547D` : `${companion.name} \u5DF2\u51C6\u5907\u5C31\u7EEA` })
9060
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "dsh-partner-home", children: [
9061
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("header", { className: "dsh-partner-home-heading", children: [
9062
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { children: [
9063
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("small", { children: "\u5DE5\u4F5C\u53F0" }),
9064
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("h2", { children: online ? `${companion.name} \u6B63\u5728\u6E20\u9053\u5F85\u547D` : `${companion.name} \u5DF2\u51C6\u5907\u5C31\u7EEA` })
8696
9065
  ] }),
8697
- /* @__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" })
9066
+ /* @__PURE__ */ (0, import_jsx_runtime37.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" })
8698
9067
  ] }),
8699
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("section", { className: `dsh-partner-home-channel${online ? " is-online" : ""}`, children: [
8700
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-home-route", "aria-hidden": "true", children: [
8701
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Avatar, { name: companion.name }),
8702
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "dsh-partner-route-line", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("i", {}) }),
8703
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "dsh-partner-route-weixin", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(WeixinGlyph, { large: true }) })
9068
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("section", { className: `dsh-partner-home-channel${online ? " is-online" : ""}`, children: [
9069
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "dsh-partner-home-route", "aria-hidden": "true", children: [
9070
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Avatar, { name: companion.name }),
9071
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "dsh-partner-route-line", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("i", {}) }),
9072
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "dsh-partner-route-weixin", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(WeixinGlyph, { large: true }) })
8704
9073
  ] }),
8705
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-home-channel-copy", children: [
8706
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: "dsh-partner-home-kicker", children: [
8707
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("i", {}),
8708
- "\u4E3B\u8981\u6E20\u9053 \xB7 \u5FAE\u4FE1"
9074
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "dsh-partner-home-channel-copy", children: [
9075
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "dsh-partner-home-kicker", children: [
9076
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("i", {}),
9077
+ "\u6D88\u606F\u6E20\u9053 \xB7 ",
9078
+ channel?.platform === "matrix" ? "Matrix" : channel?.platform === "mattermost" ? "Mattermost" : "\u5FAE\u4FE1"
8709
9079
  ] }),
8710
- /* @__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" }),
8711
- /* @__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" }),
8712
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-home-channel-actions", children: [
8713
- /* @__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" }),
8714
- /* @__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` })
9080
+ /* @__PURE__ */ (0, import_jsx_runtime37.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" }),
9081
+ /* @__PURE__ */ (0, import_jsx_runtime37.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" }),
9082
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "dsh-partner-home-channel-actions", children: [
9083
+ /* @__PURE__ */ (0, import_jsx_runtime37.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" }),
9084
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: !channel ? "\u9009\u62E9\u6E20\u9053\u5E76\u8FDE\u63A5\u8D26\u53F7" : `${approved} \u4F4D\u8054\u7CFB\u4EBA \xB7 \u5171\u7528\u4E3B\u5BF9\u8BDD` })
8715
9085
  ] })
8716
9086
  ] })
8717
9087
  ] }),
8718
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-home-details", children: [
8719
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("section", { className: "dsh-partner-home-profile", children: [
8720
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("header", { children: [
8721
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconUserOutline16, { size: 16 }) }),
8722
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
8723
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "\u4F19\u4F34\u5E95\u7A3F" }),
8724
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: companion.role })
9088
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "dsh-partner-home-details", children: [
9089
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("section", { className: "dsh-partner-home-profile", children: [
9090
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("header", { children: [
9091
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_dsh_client_ui_primitives21.IconUserOutline16, { size: 16 }) }),
9092
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { children: [
9093
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("small", { children: "\u4F19\u4F34\u5E95\u7A3F" }),
9094
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("strong", { children: companion.role })
8725
9095
  ] }),
8726
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", onClick: () => navigate("identity"), children: "\u7F16\u8F91" })
9096
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", onClick: () => navigate("identity"), children: "\u7F16\u8F91" })
8727
9097
  ] }),
8728
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("blockquote", { children: companion.instructions || companion.description || "\u5C1A\u672A\u8BBE\u7F6E\u957F\u671F\u884C\u4E3A\u51C6\u5219\u3002" })
9098
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("blockquote", { children: companion.instructions || companion.description || "\u5C1A\u672A\u8BBE\u7F6E\u957F\u671F\u884C\u4E3A\u51C6\u5219\u3002" })
8729
9099
  ] }),
8730
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("section", { className: "dsh-partner-home-runtime", children: [
8731
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("header", { children: [
8732
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconAgentPresetOutline16, { size: 16 }) }),
8733
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
8734
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "\u8FD0\u884C\u80FD\u529B" }),
8735
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: companion.presetId || "DSH \u9ED8\u8BA4 Preset" })
9100
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("section", { className: "dsh-partner-home-runtime", children: [
9101
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("header", { children: [
9102
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_dsh_client_ui_primitives21.IconAgentPresetOutline16, { size: 16 }) }),
9103
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { children: [
9104
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("small", { children: "\u8FD0\u884C\u80FD\u529B" }),
9105
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("strong", { children: companion.presetId || "DSH \u9ED8\u8BA4 Preset" })
8736
9106
  ] }),
8737
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", onClick: () => navigate("capabilities"), children: "\u8C03\u6574" })
9107
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", onClick: () => navigate("capabilities"), children: "\u8C03\u6574" })
8738
9108
  ] }),
8739
- /* @__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" }) })
9109
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "dsh-partner-home-capability-list", children: capabilities.length ? capabilities.map((item) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("em", { children: item }, item)) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("small", { children: "\u5C1A\u672A\u58F0\u660E\u80FD\u529B\u8303\u56F4" }) })
8740
9110
  ] }),
8741
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("section", { className: "dsh-partner-home-continuity", children: [
8742
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("header", { children: [
8743
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconDataOutline16, { size: 16 }) }),
8744
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
8745
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "\u4F19\u4F34\u5BF9\u8BDD" }),
8746
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: localSession?.archived ? "\u4F1A\u8BDD\u5DF2\u5F52\u6863" : "\u4F19\u4F34\u4F1A\u8BDD\u5DF2\u5EFA\u7ACB" })
9111
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("section", { className: "dsh-partner-home-continuity", children: [
9112
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("header", { children: [
9113
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_dsh_client_ui_primitives21.IconDataOutline16, { size: 16 }) }),
9114
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { children: [
9115
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("small", { children: "\u4F19\u4F34\u5BF9\u8BDD" }),
9116
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("strong", { children: localSession?.archived ? "\u4F1A\u8BDD\u5DF2\u5F52\u6863" : "\u4F19\u4F34\u4F1A\u8BDD\u5DF2\u5EFA\u7ACB" })
8747
9117
  ] }),
8748
- /* @__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" })
9118
+ /* @__PURE__ */ (0, import_jsx_runtime37.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" })
8749
9119
  ] }),
8750
- /* @__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" })
9120
+ /* @__PURE__ */ (0, import_jsx_runtime37.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" })
8751
9121
  ] })
8752
9122
  ] })
8753
9123
  ] });
8754
9124
  }
8755
9125
  function WeixinPanel({ companion, snapshot, onChanged }) {
8756
- const channel = snapshot.channels.find((item) => item.companionId === companion.id);
8757
- const [login, setLogin] = (0, import_react39.useState)();
8758
- const [busy, setBusy] = (0, import_react39.useState)(false);
8759
- const [error, setError] = (0, import_react39.useState)();
8760
- (0, import_react39.useEffect)(() => {
9126
+ const channel = snapshot.channels.find((item) => item.companionId === companion.id && (!item.platform || item.platform === "weixin"));
9127
+ const [login, setLogin] = (0, import_react42.useState)();
9128
+ const [busy, setBusy] = (0, import_react42.useState)(false);
9129
+ const [error, setError] = (0, import_react42.useState)();
9130
+ (0, import_react42.useEffect)(() => {
8761
9131
  if (!login || login.phase === "confirmed" || login.phase === "expired" || login.phase === "error") return;
8762
- const timer = window.setInterval(() => {
9132
+ const timer2 = window.setInterval(() => {
8763
9133
  void api(`/weixin/login/${login.id}`).then(async (result) => {
8764
9134
  setLogin(result.login);
8765
9135
  if (result.channel) {
@@ -8768,7 +9138,7 @@ function WeixinPanel({ companion, snapshot, onChanged }) {
8768
9138
  }
8769
9139
  }).catch((reason) => setError(errorMessage(reason)));
8770
9140
  }, 2e3);
8771
- return () => clearInterval(timer);
9141
+ return () => clearInterval(timer2);
8772
9142
  }, [login?.id, login?.phase, onChanged]);
8773
9143
  const begin = async () => {
8774
9144
  setBusy(true);
@@ -8803,93 +9173,93 @@ function WeixinPanel({ companion, snapshot, onChanged }) {
8803
9173
  setError(errorMessage(reason));
8804
9174
  }
8805
9175
  };
8806
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-form is-channel", children: [
8807
- /* @__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" }),
8808
- !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: [
8809
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "dsh-partner-weixin-mark", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(WeixinGlyph, { large: true }) }),
8810
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
8811
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("strong", { children: [
9176
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "dsh-partner-form is-channel", children: [
9177
+ /* @__PURE__ */ (0, import_jsx_runtime37.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" }),
9178
+ !channel && !login && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(GlassSurface, { as: "div", interactive: true, className: "dsh-partner-weixin-connect", borderRadius: 15, distortionScale: -10, saturation: 1.06, children: [
9179
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "dsh-partner-weixin-mark", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(WeixinGlyph, { large: true }) }),
9180
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { children: [
9181
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("strong", { children: [
8812
9182
  "\u628A ",
8813
9183
  companion.name,
8814
9184
  " \u5E26\u5230\u5FAE\u4FE1"
8815
9185
  ] }),
8816
- /* @__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" }),
8817
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("ul", { children: [
8818
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("li", { children: "\u79C1\u804A\u9996\u6B21\u8054\u7CFB\u5FC5\u987B\u5BA1\u6279" }),
8819
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("li", { children: "\u8054\u7CFB\u4EBA\u4E4B\u95F4\u4E0A\u4E0B\u6587\u5B8C\u5168\u9694\u79BB" }),
8820
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("li", { children: "\u5DE5\u5177\u6743\u9650\u4E0D\u4F1A\u56E0\u5FAE\u4FE1\u8EAB\u4EFD\u81EA\u52A8\u6269\u5927" })
9186
+ /* @__PURE__ */ (0, import_jsx_runtime37.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" }),
9187
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("ul", { children: [
9188
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("li", { children: "\u79C1\u804A\u9996\u6B21\u8054\u7CFB\u5FC5\u987B\u5BA1\u6279" }),
9189
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("li", { children: "\u8054\u7CFB\u4EBA\u4E4B\u95F4\u4E0A\u4E0B\u6587\u5B8C\u5168\u9694\u79BB" }),
9190
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("li", { children: "\u5DE5\u5177\u6743\u9650\u4E0D\u4F1A\u56E0\u5FAE\u4FE1\u8EAB\u4EFD\u81EA\u52A8\u6269\u5927" })
8821
9191
  ] })
8822
9192
  ] }),
8823
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", disabled: busy, onClick: () => {
9193
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", disabled: busy, onClick: () => {
8824
9194
  void begin();
8825
9195
  }, children: busy ? "\u6B63\u5728\u7533\u8BF7\u4E8C\u7EF4\u7801\u2026" : "\u626B\u7801\u8FDE\u63A5\u5FAE\u4FE1" })
8826
9196
  ] }),
8827
- login && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(GlassSurface, { as: "div", interactive: true, className: "dsh-partner-qr", borderRadius: 16, distortionScale: -10, saturation: 1.06, children: [
8828
- /* @__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" }) }),
8829
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
8830
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "WECHAT ILINK BOT" }),
8831
- /* @__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" }),
8832
- /* @__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") }),
8833
- (login.phase === "expired" || login.phase === "error") && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("button", { type: "button", onClick: () => {
9197
+ login && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(GlassSurface, { as: "div", interactive: true, className: "dsh-partner-qr", borderRadius: 16, distortionScale: -10, saturation: 1.06, children: [
9198
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "dsh-partner-qr-code", children: login.qrContent && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(QRCodeSVG, { value: login.qrContent, size: 176, level: "M" }) }),
9199
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { children: [
9200
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("small", { children: "WECHAT ILINK BOT" }),
9201
+ /* @__PURE__ */ (0, import_jsx_runtime37.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" }),
9202
+ /* @__PURE__ */ (0, import_jsx_runtime37.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") }),
9203
+ (login.phase === "expired" || login.phase === "error") && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("button", { type: "button", onClick: () => {
8834
9204
  setLogin(void 0);
8835
9205
  void begin();
8836
9206
  }, children: [
8837
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_dsh_client_ui_primitives21.IconRefreshOutline16, { size: 16 }),
9207
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_dsh_client_ui_primitives21.IconRefreshOutline16, { size: 16 }),
8838
9208
  "\u91CD\u65B0\u751F\u6210"
8839
9209
  ] })
8840
9210
  ] })
8841
9211
  ] }),
8842
- channel && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
8843
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(GlassSurface, { as: "div", interactive: true, className: "dsh-partner-channel-card", borderRadius: 14, distortionScale: -10, saturation: 1.06, children: [
8844
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "dsh-partner-weixin-mark", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(WeixinGlyph, { large: true }) }),
8845
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
8846
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "WECHAT CHANNEL" }),
8847
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: channel.name }),
8848
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { children: channel.accountId })
9212
+ channel && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
9213
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(GlassSurface, { as: "div", interactive: true, className: "dsh-partner-channel-card", borderRadius: 14, distortionScale: -10, saturation: 1.06, children: [
9214
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "dsh-partner-weixin-mark", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(WeixinGlyph, { large: true }) }),
9215
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { children: [
9216
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("small", { children: "WECHAT CHANNEL" }),
9217
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("strong", { children: channel.name }),
9218
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { children: channel.accountId })
8849
9219
  ] }),
8850
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ChannelStatus, { channel }),
8851
- /* @__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: () => {
9220
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ChannelStatus, { channel }),
9221
+ /* @__PURE__ */ (0, import_jsx_runtime37.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: () => {
8852
9222
  void toggle();
8853
- }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("i", {}) })
9223
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("i", {}) })
8854
9224
  ] }),
8855
- channel.lastError && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "dsh-partner-inline-error", children: channel.lastError }),
8856
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dsh-partner-pairing-heading", children: [
8857
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
8858
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "ACCESS" }),
8859
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: "\u79C1\u804A\u914D\u5BF9" })
9225
+ channel.lastError && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "dsh-partner-inline-error", children: channel.lastError }),
9226
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "dsh-partner-pairing-heading", children: [
9227
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { children: [
9228
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("small", { children: "ACCESS" }),
9229
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("strong", { children: "\u79C1\u804A\u914D\u5BF9" })
8860
9230
  ] }),
8861
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("em", { children: [
9231
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("em", { children: [
8862
9232
  pairings.filter((item) => item.status === "pending").length,
8863
9233
  " \u4E2A\u5F85\u5904\u7406"
8864
9234
  ] })
8865
9235
  ] }),
8866
- /* @__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: [
8867
- /* @__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 }) }),
8868
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
8869
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: pairing.displayName }),
8870
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("small", { children: [
9236
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "dsh-partner-pairings", children: pairings.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime37.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_runtime37.jsxs)("article", { children: [
9237
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: `is-${pairing.status}`, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_dsh_client_ui_primitives21.IconUserOutline16, { size: 16 }) }),
9238
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { children: [
9239
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("strong", { children: pairing.displayName }),
9240
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("small", { children: [
8871
9241
  pairing.status === "pending" ? "\u7B49\u5F85\u5BA1\u6279" : pairing.status === "approved" ? "\u5DF2\u6388\u6743\u72EC\u7ACB\u4F1A\u8BDD" : "\u5DF2\u963B\u6B62",
8872
9242
  " \xB7 ",
8873
9243
  new Date(pairing.updatedAt).toLocaleString()
8874
9244
  ] })
8875
9245
  ] }),
8876
- pairing.status === "pending" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
8877
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { onClick: () => {
9246
+ pairing.status === "pending" && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
9247
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { onClick: () => {
8878
9248
  void actPairing(pairing.id, "blocked");
8879
9249
  }, children: "\u62D2\u7EDD" }),
8880
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { className: "is-primary", onClick: () => {
9250
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { className: "is-primary", onClick: () => {
8881
9251
  void actPairing(pairing.id, "approved");
8882
9252
  }, children: "\u6279\u51C6" })
8883
9253
  ] }),
8884
- pairing.status === "approved" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { onClick: () => {
9254
+ pairing.status === "approved" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { onClick: () => {
8885
9255
  void actPairing(pairing.id, "blocked");
8886
9256
  }, children: "\u64A4\u9500" }),
8887
- pairing.status === "blocked" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { onClick: () => {
9257
+ pairing.status === "blocked" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { onClick: () => {
8888
9258
  void actPairing(pairing.id, "approved");
8889
9259
  }, children: "\u91CD\u65B0\u6279\u51C6" })
8890
9260
  ] }, pairing.id)) })
8891
9261
  ] }),
8892
- error && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "dsh-partner-inline-error", children: error })
9262
+ error && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "dsh-partner-inline-error", children: error })
8893
9263
  ] });
8894
9264
  }
8895
9265
  function installStyles() {