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