@lemoncat7/dsh-partner 2.7.3 → 2.7.4
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 +1 -1
- package/docs/releases/2.7.4.md +12 -0
- package/lib/api.d.ts.map +1 -1
- package/lib/api.js +9 -15
- package/lib/api.js.map +1 -1
- package/lib/channels/weixin/connect.d.ts +26 -0
- package/lib/channels/weixin/connect.d.ts.map +1 -0
- package/lib/channels/weixin/connect.js +52 -0
- package/lib/channels/weixin/connect.js.map +1 -0
- package/lib/channels/weixin/login.d.ts +4 -0
- package/lib/channels/weixin/login.d.ts.map +1 -1
- package/lib/channels/weixin/login.js +46 -5
- package/lib/channels/weixin/login.js.map +1 -1
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +597 -526
- package/lib/client.js.map +4 -4
- package/lib/companions/removal.d.ts +1 -0
- package/lib/companions/removal.d.ts.map +1 -1
- package/lib/companions/removal.js +5 -1
- package/lib/companions/removal.js.map +1 -1
- package/lib/ui/companion-deletion.d.ts +8 -0
- package/lib/ui/companion-deletion.d.ts.map +1 -0
- package/lib/ui/companion-deletion.js +43 -0
- package/lib/ui/companion-deletion.js.map +1 -0
- package/lib/ui/identity-editor.d.ts +0 -2
- package/lib/ui/identity-editor.d.ts.map +1 -1
- package/lib/ui/identity-editor.js +6 -37
- package/lib/ui/identity-editor.js.map +1 -1
- package/package.json +2 -1
package/lib/client.js
CHANGED
|
@@ -35,7 +35,7 @@ __export(client_exports, {
|
|
|
35
35
|
inject: () => inject
|
|
36
36
|
});
|
|
37
37
|
module.exports = __toCommonJS(client_exports);
|
|
38
|
-
var
|
|
38
|
+
var import_react52 = require("react");
|
|
39
39
|
|
|
40
40
|
// src/workspace-ownership.ts
|
|
41
41
|
var WORKSPACE_ACTIVATE_EVENT = "@lemoncat7/dsh-plugin-ui/workspace-activate";
|
|
@@ -54,7 +54,7 @@ function observePluginWorkspace(pluginId, close) {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
// src/client.tsx
|
|
57
|
-
var
|
|
57
|
+
var import_dsh_client_ui_primitives25 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
58
58
|
|
|
59
59
|
// node_modules/qrcode.react/lib/esm/index.js
|
|
60
60
|
var import_react = __toESM(require("react"), 1);
|
|
@@ -2043,6 +2043,14 @@ body[data-ds-dark-theme] .dsh-partner-workspace {
|
|
|
2043
2043
|
.dsh-partner-qr button { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 11px; border: 1px solid var(--partner-border); border-radius: 9px; color: inherit; background: var(--partner-raised); cursor: pointer; }
|
|
2044
2044
|
.dsh-partner-channel-card { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 15px; border: 1px solid var(--partner-border); border-radius: 14px; background: color-mix(in srgb, var(--partner-raised) 72%, transparent); }
|
|
2045
2045
|
.dsh-partner-channel-card > span:nth-child(2) { display: grid; gap: 3px; }
|
|
2046
|
+
.dsh-partner-weixin-actions { display: flex; align-items: center; gap: 12px; }
|
|
2047
|
+
.dsh-partner-weixin-actions > .dsh-partner-switch { flex: none; }
|
|
2048
|
+
.dsh-partner-weixin-actions > .dsh-partner-weixin-rescan { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 32px; padding: 5px 9px; border: 1px solid var(--partner-border); border-radius: 9px; background: transparent; color: var(--partner-text-secondary); font: inherit; font-size: var(--partner-font-caption); white-space: nowrap; cursor: pointer; }
|
|
2049
|
+
.dsh-partner-weixin-actions > .dsh-partner-weixin-rescan:hover:not(:disabled) { background: var(--partner-raised); color: var(--partner-text); }
|
|
2050
|
+
.dsh-partner-weixin-actions > .dsh-partner-weixin-rescan:disabled { opacity: .5; cursor: wait; }
|
|
2051
|
+
.dsh-partner-weixin-help { margin: 8px 0 0; color: var(--partner-text-secondary); font-size: var(--partner-font-caption); line-height: 1.6; }
|
|
2052
|
+
.dsh-partner-overview-delete { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
|
|
2053
|
+
.dsh-partner-overview-delete > button { display: inline-flex; align-items: center; gap: 6px; }
|
|
2046
2054
|
.dsh-partner-channel-card strong { font-size: var(--partner-font-label); }
|
|
2047
2055
|
.dsh-partner-channel-card p { margin: 0; color: var(--partner-text-tertiary); font: var(--partner-font-caption)/1.4 ui-monospace, monospace; }
|
|
2048
2056
|
.dsh-partner-switch { position: relative; width: 38px; height: 22px; padding: 0; border: 1px solid var(--partner-border); border-radius: 999px; background: color-mix(in srgb, var(--partner-text) 9%, transparent); cursor: pointer; transition: background .16s ease; }
|
|
@@ -2736,6 +2744,8 @@ body[data-ds-dark-theme] .dsh-partner-workspace {
|
|
|
2736
2744
|
.dsh-partner-qr > span { justify-items: center; }
|
|
2737
2745
|
.dsh-partner-channel-card { grid-template-columns: 45px minmax(0, 1fr) auto; }
|
|
2738
2746
|
.dsh-partner-channel-card > .dsh-partner-status { display: none; }
|
|
2747
|
+
.dsh-partner-channel-card:has(> .dsh-partner-weixin-actions) { grid-template-columns: 45px minmax(0, 1fr); }
|
|
2748
|
+
.dsh-partner-weixin-actions { grid-column: 1 / -1; justify-content: flex-end; }
|
|
2739
2749
|
.dsh-partner-library-header { display: grid; gap: 0; }
|
|
2740
2750
|
.dsh-partner-library-header nav { min-height: 38px; }
|
|
2741
2751
|
.dsh-partner-library-tools { display: grid; }
|
|
@@ -15932,13 +15942,11 @@ var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
|
15932
15942
|
function IdentityEditor(props) {
|
|
15933
15943
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(IdentityEditorForm, { ...props }, props.companion.id);
|
|
15934
15944
|
}
|
|
15935
|
-
function IdentityEditorForm({ companion,
|
|
15945
|
+
function IdentityEditorForm({ companion, onChanged }) {
|
|
15936
15946
|
const [form, setForm] = (0, import_react43.useState)(() => companionDraft(companion));
|
|
15937
15947
|
const [operation, setOperation] = (0, import_react43.useState)();
|
|
15938
15948
|
const [saved, setSaved] = (0, import_react43.useState)(false);
|
|
15939
|
-
const [removed, setRemoved] = (0, import_react43.useState)(false);
|
|
15940
15949
|
const [error, setError] = (0, import_react43.useState)();
|
|
15941
|
-
const [confirmationId, setConfirmationId] = (0, import_react43.useState)();
|
|
15942
15950
|
const locked = (0, import_react43.useRef)(false);
|
|
15943
15951
|
const alive = (0, import_react43.useRef)(true);
|
|
15944
15952
|
(0, import_react43.useEffect)(() => {
|
|
@@ -15950,17 +15958,14 @@ function IdentityEditorForm({ companion, count, onChanged, onRemoved }) {
|
|
|
15950
15958
|
(0, import_react43.useEffect)(() => {
|
|
15951
15959
|
setForm(companionDraft(companion));
|
|
15952
15960
|
setSaved(false);
|
|
15953
|
-
setConfirmationId(void 0);
|
|
15954
15961
|
}, [companion.updatedAt]);
|
|
15955
|
-
const
|
|
15956
|
-
const busy = operation !== void 0 || removed;
|
|
15962
|
+
const busy = operation !== void 0;
|
|
15957
15963
|
const submit = async (event) => {
|
|
15958
15964
|
event.preventDefault();
|
|
15959
|
-
if (locked.current
|
|
15965
|
+
if (locked.current) return;
|
|
15960
15966
|
locked.current = true;
|
|
15961
15967
|
setOperation("save");
|
|
15962
15968
|
setError(void 0);
|
|
15963
|
-
setConfirmationId(void 0);
|
|
15964
15969
|
let committed = false;
|
|
15965
15970
|
try {
|
|
15966
15971
|
await api(`/companions/${encodeURIComponent(companion.id)}`, { method: "PUT", body: JSON.stringify({ companion: form }) });
|
|
@@ -15974,26 +15979,6 @@ function IdentityEditorForm({ companion, count, onChanged, onRemoved }) {
|
|
|
15974
15979
|
if (alive.current) setOperation(void 0);
|
|
15975
15980
|
}
|
|
15976
15981
|
};
|
|
15977
|
-
const remove = async () => {
|
|
15978
|
-
if (locked.current || removed || !confirming || count <= 1) return;
|
|
15979
|
-
const targetId = confirmationId;
|
|
15980
|
-
locked.current = true;
|
|
15981
|
-
setOperation("remove");
|
|
15982
|
-
setError(void 0);
|
|
15983
|
-
setConfirmationId(void 0);
|
|
15984
|
-
let committed = false;
|
|
15985
|
-
try {
|
|
15986
|
-
await api(`/companions/${encodeURIComponent(targetId)}?removeFiles=1`, { method: "DELETE" });
|
|
15987
|
-
committed = true;
|
|
15988
|
-
if (alive.current) setRemoved(true);
|
|
15989
|
-
await onRemoved(targetId);
|
|
15990
|
-
} catch (reason) {
|
|
15991
|
-
if (alive.current) setError(`${committed ? "\u4F19\u4F34\u5DF2\u5220\u9664\uFF0C\u4F46\u9875\u9762\u5237\u65B0\u5931\u8D25\uFF0C\u8BF7\u5237\u65B0\u9875\u9762\uFF0C\u4E0D\u8981\u518D\u6B21\u5220\u9664\uFF1A" : "\u5220\u9664\u5931\u8D25\uFF1A"}${errorMessage(reason)}`);
|
|
15992
|
-
} finally {
|
|
15993
|
-
locked.current = false;
|
|
15994
|
-
if (alive.current) setOperation(void 0);
|
|
15995
|
-
}
|
|
15996
|
-
};
|
|
15997
15982
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("form", { id: "dsh-partner-identity-editor", className: "dsh-partner-form is-identity", "aria-busy": operation !== void 0, onSubmit: (event) => {
|
|
15998
15983
|
void submit(event);
|
|
15999
15984
|
}, children: [
|
|
@@ -16013,43 +15998,94 @@ function IdentityEditorForm({ companion, count, onChanged, onRemoved }) {
|
|
|
16013
15998
|
] }) }),
|
|
16014
15999
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("button", { disabled: busy, children: operation === "save" ? "\u6B63\u5728\u4FDD\u5B58\u2026" : "\u4FDD\u5B58\u8EAB\u4EFD" })
|
|
16015
16000
|
] })
|
|
16001
|
+
] })
|
|
16002
|
+
] });
|
|
16003
|
+
}
|
|
16004
|
+
|
|
16005
|
+
// src/ui/companion-deletion.tsx
|
|
16006
|
+
var import_react44 = require("react");
|
|
16007
|
+
var import_dsh_client_ui_primitives22 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
16008
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
16009
|
+
function CompanionDeletion({ companion, count, channelCount, onRemoved }) {
|
|
16010
|
+
const [open, setOpen] = (0, import_react44.useState)(false);
|
|
16011
|
+
const [busy, setBusy] = (0, import_react44.useState)(false);
|
|
16012
|
+
const [removed, setRemoved] = (0, import_react44.useState)(false);
|
|
16013
|
+
const [error, setError] = (0, import_react44.useState)("");
|
|
16014
|
+
const locked = (0, import_react44.useRef)(false), alive = (0, import_react44.useRef)(true);
|
|
16015
|
+
(0, import_react44.useEffect)(() => {
|
|
16016
|
+
alive.current = true;
|
|
16017
|
+
return () => {
|
|
16018
|
+
alive.current = false;
|
|
16019
|
+
};
|
|
16020
|
+
}, []);
|
|
16021
|
+
const remove = async () => {
|
|
16022
|
+
if (!open || locked.current || removed || count <= 1) return;
|
|
16023
|
+
const id = companion.id;
|
|
16024
|
+
locked.current = true;
|
|
16025
|
+
setBusy(true);
|
|
16026
|
+
setError("");
|
|
16027
|
+
let committed = false;
|
|
16028
|
+
try {
|
|
16029
|
+
await api(`/companions/${encodeURIComponent(id)}?removeFiles=1`, { method: "DELETE" });
|
|
16030
|
+
committed = true;
|
|
16031
|
+
if (alive.current) {
|
|
16032
|
+
setRemoved(true);
|
|
16033
|
+
setOpen(false);
|
|
16034
|
+
}
|
|
16035
|
+
await onRemoved(id);
|
|
16036
|
+
} catch (reason) {
|
|
16037
|
+
if (alive.current) setError(`${committed ? "\u4F19\u4F34\u5DF2\u5220\u9664\uFF0C\u9875\u9762\u5237\u65B0\u5931\u8D25\uFF0C\u8BF7\u5237\u65B0\u9875\u9762\uFF1A" : "\u5220\u9664\u5931\u8D25\uFF1A"}${errorMessage(reason)}`);
|
|
16038
|
+
} finally {
|
|
16039
|
+
locked.current = false;
|
|
16040
|
+
if (alive.current) setBusy(false);
|
|
16041
|
+
}
|
|
16042
|
+
};
|
|
16043
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "dsh-partner-overview-delete", children: [
|
|
16044
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("button", { type: "button", className: "is-danger", disabled: busy || removed || count <= 1, title: count <= 1 ? "\u81F3\u5C11\u4FDD\u7559\u4E00\u4E2A\u4F19\u4F34" : void 0, onClick: () => {
|
|
16045
|
+
setError("");
|
|
16046
|
+
setOpen(true);
|
|
16047
|
+
}, children: [
|
|
16048
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_dsh_client_ui_primitives22.IconTrashOutlineRegular, { size: 16 }),
|
|
16049
|
+
"\u5220\u9664\u4F19\u4F34"
|
|
16016
16050
|
] }),
|
|
16017
|
-
/* @__PURE__ */ (0,
|
|
16018
|
-
|
|
16019
|
-
|
|
16020
|
-
|
|
16021
|
-
|
|
16022
|
-
/* @__PURE__ */ (0,
|
|
16023
|
-
|
|
16024
|
-
|
|
16025
|
-
|
|
16026
|
-
|
|
16027
|
-
|
|
16051
|
+
!open && error && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "dsh-partner-inline-error", role: "alert", children: error }),
|
|
16052
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(WorkspaceDialog, { title: `\u5220\u9664\u300C${companion.name}\u300D\uFF1F`, detail: "\u6B64\u64CD\u4F5C\u4E0D\u53EF\u64A4\u9500\uFF0C\u53EA\u5220\u9664\u5F53\u524D\u786E\u8BA4\u7684\u4F19\u4F34\u3002", close: () => {
|
|
16053
|
+
if (!locked.current) setOpen(false);
|
|
16054
|
+
}, children: [
|
|
16055
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { children: "\u5C06\u6E05\u7406\u8EAB\u4EFD\u3001\u8BB0\u5FC6\u3001\u6301\u7EED\u5173\u6CE8\u3001\u80FD\u529B\u7ED1\u5B9A\u3001\u5B9A\u65F6\u4EFB\u52A1\u53CA\u4E13\u5C5E\u76EE\u5F55\u4E2D\u7684\u5168\u90E8\u6587\u4EF6\u3002" }),
|
|
16056
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { children: channelCount ? `\u5DF2\u7ED1\u5B9A ${channelCount} \u4E2A\u6E20\u9053\u3002\u786E\u8BA4\u540E\u4F1A\u81EA\u52A8\u505C\u6B62\u5E76\u5220\u9664\u8FD9\u4E9B\u6E20\u9053\u3001\u767B\u5F55\u51ED\u636E\u548C\u8054\u7CFB\u4EBA\u6388\u6743\uFF0C\u65E0\u9700\u5148\u624B\u52A8\u89E3\u7ED1\u3002` : "\u8BE5\u4F19\u4F34\u6CA1\u6709\u7ED1\u5B9A\u6E20\u9053\u3002" }),
|
|
16057
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { children: "DSH \u539F\u4F1A\u8BDD\u65E5\u5FD7\u7531\u5BBF\u4E3B\u7BA1\u7406\uFF0C\u4E0D\u5728\u6B64\u6B21\u5220\u9664\u8303\u56F4\u3002\u6B63\u5728\u6267\u884C\u7684\u4EFB\u52A1\u53CA\u5171\u4EAB\u6216\u5F02\u5E38\u76EE\u5F55\u4ECD\u4F1A\u62E6\u622A\u5220\u9664\u3002" }),
|
|
16058
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "dsh-partner-inline-error", role: "alert", children: error }),
|
|
16059
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "dsh-partner-form-actions", children: [
|
|
16060
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("button", { type: "button", disabled: busy, onClick: () => setOpen(false), children: "\u53D6\u6D88" }),
|
|
16061
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("button", { type: "button", className: "is-danger", disabled: busy, onClick: () => {
|
|
16062
|
+
void remove();
|
|
16063
|
+
}, children: busy ? "\u6B63\u5728\u5220\u9664\u2026" : "\u786E\u8BA4\u5220\u9664" })
|
|
16028
16064
|
] })
|
|
16029
16065
|
] })
|
|
16030
16066
|
] });
|
|
16031
16067
|
}
|
|
16032
16068
|
|
|
16033
16069
|
// src/ui/channels-panel.tsx
|
|
16034
|
-
var
|
|
16070
|
+
var import_react46 = require("react");
|
|
16035
16071
|
|
|
16036
16072
|
// src/ui/notification-settings.tsx
|
|
16037
|
-
var
|
|
16038
|
-
var
|
|
16073
|
+
var import_react45 = require("react");
|
|
16074
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
16039
16075
|
function NotificationSettings({ companion, snapshot, onChanged }) {
|
|
16040
16076
|
const channels = snapshot.channels.filter((c) => c.companionId === companion.id);
|
|
16041
16077
|
const pairings = snapshot.pairings.filter((p) => channels.some((c) => c.id === p.channelId));
|
|
16042
|
-
const [mode, setMode] = (0,
|
|
16043
|
-
const [targets, setTargets] = (0,
|
|
16044
|
-
const [selectedChannels, setSelectedChannels] = (0,
|
|
16045
|
-
const [busy, setBusy] = (0,
|
|
16046
|
-
const saveRef = (0,
|
|
16047
|
-
(0,
|
|
16078
|
+
const [mode, setMode] = (0, import_react45.useState)(companion.notificationDelivery?.mode ?? "recent");
|
|
16079
|
+
const [targets, setTargets] = (0, import_react45.useState)(companion.notificationDelivery?.targets ?? []);
|
|
16080
|
+
const [selectedChannels, setSelectedChannels] = (0, import_react45.useState)(targets.map((t) => t.channelId));
|
|
16081
|
+
const [busy, setBusy] = (0, import_react45.useState)(false), [feedback, setFeedback] = (0, import_react45.useState)(""), [failed, setFailed] = (0, import_react45.useState)(false);
|
|
16082
|
+
const saveRef = (0, import_react45.useRef)(null);
|
|
16083
|
+
(0, import_react45.useEffect)(() => {
|
|
16048
16084
|
if (!busy && feedback && document.activeElement === document.body) saveRef.current?.focus();
|
|
16049
16085
|
}, [busy, feedback]);
|
|
16050
16086
|
const unavailable = targets.filter((t) => !pairings.some((p) => p.channelId === t.channelId && p.userId === t.userId && p.status === "approved") || !channels.some((c) => c.id === t.channelId && c.enabled));
|
|
16051
16087
|
const emptyChannel = selectedChannels.some((id) => !targets.some((t) => t.channelId === id));
|
|
16052
|
-
return /* @__PURE__ */ (0,
|
|
16088
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("form", { className: "dsh-partner-feature-form dsh-partner-channel-form dsh-partner-delivery-form", "aria-busy": busy, onSubmit: (e) => {
|
|
16053
16089
|
e.preventDefault();
|
|
16054
16090
|
if (busy) return;
|
|
16055
16091
|
setBusy(true);
|
|
@@ -16064,41 +16100,41 @@ function NotificationSettings({ companion, snapshot, onChanged }) {
|
|
|
16064
16100
|
setFeedback(errorMessage(error));
|
|
16065
16101
|
}).finally(() => setBusy(false));
|
|
16066
16102
|
}, children: [
|
|
16067
|
-
/* @__PURE__ */ (0,
|
|
16068
|
-
/* @__PURE__ */ (0,
|
|
16069
|
-
/* @__PURE__ */ (0,
|
|
16070
|
-
/* @__PURE__ */ (0,
|
|
16071
|
-
/* @__PURE__ */ (0,
|
|
16103
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("label", { className: "dsh-partner-channel-field", children: [
|
|
16104
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { children: "\u901A\u77E5\u53D1\u9001\u5230" }),
|
|
16105
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("select", { disabled: busy, value: mode, onChange: (e) => setMode(e.target.value), children: [
|
|
16106
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("option", { value: "recent", children: "\u6700\u8FD1\u8054\u7CFB\u7684\u6E20\u9053\u4E0E\u7528\u6237" }),
|
|
16107
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("option", { value: "selected", children: "\u6307\u5B9A\u6E20\u9053\u4E0E\u63A5\u6536\u4EBA" })
|
|
16072
16108
|
] })
|
|
16073
16109
|
] }),
|
|
16074
|
-
/* @__PURE__ */ (0,
|
|
16075
|
-
!companion.notificationDelivery && pairings.some((p) => p.deliveryTarget) && /* @__PURE__ */ (0,
|
|
16076
|
-
mode === "selected" && /* @__PURE__ */ (0,
|
|
16077
|
-
/* @__PURE__ */ (0,
|
|
16078
|
-
!channels.length && /* @__PURE__ */ (0,
|
|
16079
|
-
channels.map((channel) => /* @__PURE__ */ (0,
|
|
16080
|
-
/* @__PURE__ */ (0,
|
|
16081
|
-
/* @__PURE__ */ (0,
|
|
16110
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { children: "\u4EC5\u5F71\u54CD\u4E3B\u52A8\u901A\u77E5\u4E0E\u7ED3\u679C\u4EA4\u4ED8\u3002\u5BF9\u8BDD\u56DE\u590D\u4ECD\u53D1\u9001\u5230\u6D88\u606F\u6765\u6E90\u6E20\u9053\u3002" }),
|
|
16111
|
+
!companion.notificationDelivery && pairings.some((p) => p.deliveryTarget) && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { role: "status", children: "\u5F53\u524D\u4ECD\u4F7F\u7528\u65E7\u7684\u8054\u7CFB\u4EBA\u6295\u9012\u89C4\u5219\uFF0C\u4FDD\u5B58\u540E\u7EDF\u4E00\u4F7F\u7528\u8FD9\u91CC\u7684\u901A\u77E5\u8BBE\u7F6E\u3002" }),
|
|
16112
|
+
mode === "selected" && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "dsh-partner-notification-choices", children: [
|
|
16113
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { children: "\u53EF\u9009\u62E9\u591A\u4E2A\u6E20\u9053\uFF1B\u6BCF\u4E2A\u6E20\u9053\u81F3\u5C11\u9009\u62E9\u4E00\u4F4D\u5DF2\u6388\u6743\u63A5\u6536\u4EBA\u3002\u4FDD\u5B58\u540E\u5BF9\u65B0\u901A\u77E5\u751F\u6548\uFF0C\u5F85\u91CD\u8BD5\u901A\u77E5\u4FDD\u7559\u539F\u63A5\u6536\u4EBA\u3002" }),
|
|
16114
|
+
!channels.length && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { children: "\u8BF7\u5148\u6DFB\u52A0\u6E20\u9053\u5E76\u6388\u6743\u8054\u7CFB\u4EBA\u3002" }),
|
|
16115
|
+
channels.map((channel) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("fieldset", { disabled: busy, className: "dsh-partner-notification-channel", children: [
|
|
16116
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("legend", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("label", { children: [
|
|
16117
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("input", { type: "checkbox", checked: selectedChannels.includes(channel.id), onChange: (e) => {
|
|
16082
16118
|
setSelectedChannels((ids) => e.target.checked ? [...ids, channel.id] : ids.filter((id) => id !== channel.id));
|
|
16083
16119
|
if (!e.target.checked) setTargets((items) => items.filter((t) => t.channelId !== channel.id));
|
|
16084
16120
|
} }),
|
|
16085
16121
|
channel.name,
|
|
16086
16122
|
!channel.enabled ? "\uFF08\u5DF2\u505C\u7528\uFF09" : ""
|
|
16087
16123
|
] }) }),
|
|
16088
|
-
selectedChannels.includes(channel.id) && /* @__PURE__ */ (0,
|
|
16089
|
-
!pairings.some((p) => p.channelId === channel.id && p.status === "approved") && /* @__PURE__ */ (0,
|
|
16090
|
-
pairings.filter((p) => p.channelId === channel.id && p.status === "approved").map((p) => /* @__PURE__ */ (0,
|
|
16091
|
-
/* @__PURE__ */ (0,
|
|
16092
|
-
/* @__PURE__ */ (0,
|
|
16124
|
+
selectedChannels.includes(channel.id) && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "dsh-partner-notification-users", children: [
|
|
16125
|
+
!pairings.some((p) => p.channelId === channel.id && p.status === "approved") && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { children: "\u6682\u65E0\u5DF2\u6388\u6743\u63A5\u6536\u4EBA\uFF0C\u8BF7\u5148\u5728\u6E20\u9053\u914D\u7F6E\u4E2D\u6279\u51C6\u8054\u7CFB\u4EBA\u3002" }),
|
|
16126
|
+
pairings.filter((p) => p.channelId === channel.id && p.status === "approved").map((p) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("label", { children: [
|
|
16127
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("input", { type: "checkbox", checked: targets.some((t) => t.channelId === p.channelId && t.userId === p.userId), onChange: (e) => setTargets((items) => e.target.checked ? [...items, { channelId: p.channelId, userId: p.userId }] : items.filter((t) => t.channelId !== p.channelId || t.userId !== p.userId)) }),
|
|
16128
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { children: [
|
|
16093
16129
|
p.displayName,
|
|
16094
|
-
/* @__PURE__ */ (0,
|
|
16130
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("small", { children: p.userId })
|
|
16095
16131
|
] })
|
|
16096
16132
|
] }, p.id))
|
|
16097
16133
|
] })
|
|
16098
16134
|
] }, channel.id)),
|
|
16099
|
-
unavailable.length > 0 && /* @__PURE__ */ (0,
|
|
16100
|
-
/* @__PURE__ */ (0,
|
|
16101
|
-
unavailable.map((t) => /* @__PURE__ */ (0,
|
|
16135
|
+
unavailable.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { role: "alert", children: [
|
|
16136
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { children: "\u90E8\u5206\u5DF2\u9009\u63A5\u6536\u4EBA\u5DF2\u5931\u6548\u6216\u6E20\u9053\u5DF2\u505C\u7528\u3002\u8BF7\u79FB\u9664\u6216\u6062\u590D\u6388\u6743\uFF0C\u4E0D\u4F1A\u81EA\u52A8\u6539\u53D1\u5176\u4ED6\u4EBA\u3002" }),
|
|
16137
|
+
unavailable.map((t) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("button", { type: "button", disabled: busy, onClick: () => {
|
|
16102
16138
|
setTargets((items) => items.filter((x) => x.channelId !== t.channelId || x.userId !== t.userId));
|
|
16103
16139
|
if (!targets.some((x) => x.channelId === t.channelId && x.userId !== t.userId)) setSelectedChannels((ids) => ids.filter((id) => id !== t.channelId));
|
|
16104
16140
|
}, children: [
|
|
@@ -16107,27 +16143,27 @@ function NotificationSettings({ companion, snapshot, onChanged }) {
|
|
|
16107
16143
|
] }, JSON.stringify(t)))
|
|
16108
16144
|
] })
|
|
16109
16145
|
] }),
|
|
16110
|
-
feedback && /* @__PURE__ */ (0,
|
|
16111
|
-
/* @__PURE__ */ (0,
|
|
16146
|
+
feedback && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { role: failed ? "alert" : "status", children: feedback }),
|
|
16147
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("footer", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("button", { ref: saveRef, className: "is-primary", disabled: busy || mode === "selected" && (!targets.length || unavailable.length > 0 || emptyChannel), children: busy ? "\u4FDD\u5B58\u4E2D\u2026" : "\u4FDD\u5B58\u901A\u77E5\u8BBE\u7F6E" }) })
|
|
16112
16148
|
] });
|
|
16113
16149
|
}
|
|
16114
16150
|
|
|
16115
16151
|
// src/ui/channels-panel.tsx
|
|
16116
|
-
var
|
|
16152
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
16117
16153
|
function ChannelsPanel({ companion, snapshot, onChanged, weixin }) {
|
|
16118
|
-
const [platform, setPlatform] = (0,
|
|
16119
|
-
const [name, setName] = (0,
|
|
16120
|
-
const [baseUrl, setBaseUrl] = (0,
|
|
16121
|
-
const [targetId, setTargetId] = (0,
|
|
16122
|
-
const [botToken, setToken] = (0,
|
|
16123
|
-
const [authMode, setAuthMode] = (0,
|
|
16124
|
-
const [username, setUsername] = (0,
|
|
16125
|
-
const [busy, setBusy] = (0,
|
|
16126
|
-
const [feedback, setFeedback] = (0,
|
|
16127
|
-
const [deleting, setDeleting] = (0,
|
|
16128
|
-
const [adding, setAdding] = (0,
|
|
16129
|
-
const [fixedPlatform, setFixedPlatform] = (0,
|
|
16130
|
-
const [configuring, setConfiguring] = (0,
|
|
16154
|
+
const [platform, setPlatform] = (0, import_react46.useState)("matrix");
|
|
16155
|
+
const [name, setName] = (0, import_react46.useState)("");
|
|
16156
|
+
const [baseUrl, setBaseUrl] = (0, import_react46.useState)("");
|
|
16157
|
+
const [targetId, setTargetId] = (0, import_react46.useState)("");
|
|
16158
|
+
const [botToken, setToken] = (0, import_react46.useState)("");
|
|
16159
|
+
const [authMode, setAuthMode] = (0, import_react46.useState)("password");
|
|
16160
|
+
const [username, setUsername] = (0, import_react46.useState)(""), [password, setPassword] = (0, import_react46.useState)(""), [mfaToken, setMfaToken] = (0, import_react46.useState)("");
|
|
16161
|
+
const [busy, setBusy] = (0, import_react46.useState)(false);
|
|
16162
|
+
const [feedback, setFeedback] = (0, import_react46.useState)("");
|
|
16163
|
+
const [deleting, setDeleting] = (0, import_react46.useState)();
|
|
16164
|
+
const [adding, setAdding] = (0, import_react46.useState)(false);
|
|
16165
|
+
const [fixedPlatform, setFixedPlatform] = (0, import_react46.useState)(false);
|
|
16166
|
+
const [configuring, setConfiguring] = (0, import_react46.useState)();
|
|
16131
16167
|
const closeAdd = () => {
|
|
16132
16168
|
setAdding(false);
|
|
16133
16169
|
setToken("");
|
|
@@ -16171,19 +16207,19 @@ function ChannelsPanel({ companion, snapshot, onChanged, weixin }) {
|
|
|
16171
16207
|
}
|
|
16172
16208
|
setFeedback(save ? "\u8D26\u53F7\u5DF2\u4FDD\u5B58\u3002\u8BF7\u542F\u7528\u6E20\u9053\uFF0C\u518D\u5411\u673A\u5668\u4EBA\u53D1\u9001\u79C1\u804A\u6D88\u606F\uFF0C\u6838\u5BF9\u914D\u5BF9\u7801\u5E76\u6279\u51C6\u8054\u7CFB\u4EBA\u3002" : "\u8D26\u53F7\u9A8C\u8BC1\u901A\u8FC7\uFF0C\u53EF\u4EE5\u4FDD\u5B58\u3002");
|
|
16173
16209
|
});
|
|
16174
|
-
return /* @__PURE__ */ (0,
|
|
16175
|
-
/* @__PURE__ */ (0,
|
|
16176
|
-
/* @__PURE__ */ (0,
|
|
16177
|
-
/* @__PURE__ */ (0,
|
|
16210
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { id: "dsh-partner-channels", className: "dsh-partner-form is-channel dsh-partner-channels", children: [
|
|
16211
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "dsh-partner-channel-toolbar", children: [
|
|
16212
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(SectionHeading, { eyebrow: "CHANNELS", title: "\u6211\u7684\u6E20\u9053", detail: "\u67E5\u770B\u8FDE\u63A5\u72B6\u6001\uFF0C\u7BA1\u7406\u8054\u7CFB\u4EBA\u4E0E\u901A\u77E5\u6295\u9012\u3002" }),
|
|
16213
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { type: "button", onClick: () => openAdd(), children: "\u6DFB\u52A0\u6E20\u9053" })
|
|
16178
16214
|
] }),
|
|
16179
|
-
!adding && feedback && /* @__PURE__ */ (0,
|
|
16180
|
-
adding && /* @__PURE__ */ (0,
|
|
16215
|
+
!adding && feedback && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { role: "status", children: feedback }),
|
|
16216
|
+
adding && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(WorkspaceDialog, { title: fixedPlatform ? `${platform === "matrix" ? "Matrix" : "Mattermost"} \u914D\u7F6E` : "\u6DFB\u52A0\u6E20\u9053", detail: platform === "matrix" ? "\u4EC5\u672A\u52A0\u5BC6\u7684\u53CC\u4EBA\u4F1A\u8BDD\u53EF\u83B7\u53D6\u914D\u5BF9\u7801\u3002\u8BF7\u65B0\u5EFA\u672A\u5F00\u542F\u7AEF\u5230\u7AEF\u52A0\u5BC6\u7684\u4F1A\u8BDD\uFF0C\u9080\u8BF7\u673A\u5668\u4EBA\u540E\u53D1\u9001\u6587\u5B57\u6D88\u606F\u3002" : "\u5148\u767B\u5F55\uFF0C\u518D\u5411\u673A\u5668\u4EBA\u53D1\u79C1\u804A\u6D88\u606F\uFF0C\u6838\u5BF9\u914D\u5BF9\u7801\u540E\u6388\u6743\u3002", close: () => {
|
|
16181
16217
|
if (!busy) closeAdd();
|
|
16182
|
-
}, children: /* @__PURE__ */ (0,
|
|
16218
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("form", { className: "dsh-partner-feature-form dsh-partner-channel-form", "aria-busy": busy, onSubmit: (event) => {
|
|
16183
16219
|
event.preventDefault();
|
|
16184
16220
|
void configure2(true);
|
|
16185
16221
|
}, children: [
|
|
16186
|
-
!fixedPlatform && /* @__PURE__ */ (0,
|
|
16222
|
+
!fixedPlatform && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(FormField2, { label: "\u5E73\u53F0", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("select", { autoFocus: true, disabled: busy, value: platform, onChange: (e) => {
|
|
16187
16223
|
setPlatform(e.target.value);
|
|
16188
16224
|
setPassword("");
|
|
16189
16225
|
setToken("");
|
|
@@ -16191,150 +16227,150 @@ function ChannelsPanel({ companion, snapshot, onChanged, weixin }) {
|
|
|
16191
16227
|
setTargetId("");
|
|
16192
16228
|
setFeedback("");
|
|
16193
16229
|
}, children: [
|
|
16194
|
-
/* @__PURE__ */ (0,
|
|
16195
|
-
/* @__PURE__ */ (0,
|
|
16230
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("option", { value: "matrix", children: "Matrix" }),
|
|
16231
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("option", { value: "mattermost", children: "Mattermost" })
|
|
16196
16232
|
] }) }),
|
|
16197
|
-
/* @__PURE__ */ (0,
|
|
16198
|
-
/* @__PURE__ */ (0,
|
|
16199
|
-
/* @__PURE__ */ (0,
|
|
16200
|
-
/* @__PURE__ */ (0,
|
|
16201
|
-
/* @__PURE__ */ (0,
|
|
16233
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(FormField2, { label: "\u6E20\u9053\u540D\u79F0", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("input", { autoFocus: fixedPlatform, disabled: busy, maxLength: 80, value: name, onChange: (e) => setName(e.target.value), placeholder: `\u4F8B\u5982\uFF1A\u6211\u7684 ${platform === "matrix" ? "Matrix" : "Mattermost"}` }) }),
|
|
16234
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(FormField2, { label: "\u670D\u52A1\u5668\u5730\u5740", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("input", { disabled: busy, required: true, type: "url", value: baseUrl, onChange: (e) => setBaseUrl(e.target.value), placeholder: "https://chat.example.com" }) }),
|
|
16235
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("details", { children: [
|
|
16236
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("summary", { children: "\u9AD8\u7EA7\u914D\u7F6E\uFF08\u53EF\u9009\uFF09" }),
|
|
16237
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(FormField2, { label: platform === "matrix" ? "\u56FA\u5B9A\u623F\u95F4 ID" : "\u56FA\u5B9A DM \u4F1A\u8BDD ID", hint: "\u7559\u7A7A\u5219\u81EA\u52A8\u53D1\u73B0\u79C1\u804A\uFF0C\u901A\u8FC7\u914D\u5BF9\u6388\u6743\u3002\u586B\u5199\u540E\u4EC5\u76D1\u542C\u6307\u5B9A\u4F1A\u8BDD\u3002", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("input", { disabled: busy, value: targetId, onChange: (e) => setTargetId(e.target.value), placeholder: platform === "matrix" ? "!room:example.com" : "DM channel ID" }) })
|
|
16202
16238
|
] }),
|
|
16203
|
-
/* @__PURE__ */ (0,
|
|
16239
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(FormField2, { label: "\u767B\u5F55\u65B9\u5F0F", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("select", { disabled: busy, value: authMode, onChange: (e) => {
|
|
16204
16240
|
setAuthMode(e.target.value);
|
|
16205
16241
|
setToken("");
|
|
16206
16242
|
setPassword("");
|
|
16207
16243
|
setMfaToken("");
|
|
16208
16244
|
}, children: [
|
|
16209
|
-
/* @__PURE__ */ (0,
|
|
16210
|
-
/* @__PURE__ */ (0,
|
|
16245
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("option", { value: "password", children: "\u8D26\u53F7\u5BC6\u7801" }),
|
|
16246
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("option", { value: "token", children: "Access Token" })
|
|
16211
16247
|
] }) }),
|
|
16212
|
-
authMode === "password" ? /* @__PURE__ */ (0,
|
|
16213
|
-
/* @__PURE__ */ (0,
|
|
16214
|
-
/* @__PURE__ */ (0,
|
|
16215
|
-
platform === "mattermost" && /* @__PURE__ */ (0,
|
|
16216
|
-
] }) : /* @__PURE__ */ (0,
|
|
16217
|
-
feedback && /* @__PURE__ */ (0,
|
|
16218
|
-
/* @__PURE__ */ (0,
|
|
16219
|
-
/* @__PURE__ */ (0,
|
|
16220
|
-
/* @__PURE__ */ (0,
|
|
16221
|
-
/* @__PURE__ */ (0,
|
|
16248
|
+
authMode === "password" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
16249
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(FormField2, { label: "\u8D26\u53F7", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("input", { disabled: busy, required: true, autoComplete: "username", value: username, onChange: (e) => setUsername(e.target.value), placeholder: platform === "matrix" ? "@\u8D26\u53F7:\u670D\u52A1\u5668\u57DF\u540D" : "\u7528\u6237\u540D\u6216\u90AE\u7BB1" }) }),
|
|
16250
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(FormField2, { label: "\u5BC6\u7801", hint: "\u4EC5\u7528\u4E8E\u6362\u53D6\u4EE4\u724C\uFF0C\u4E0D\u4FDD\u5B58\u5BC6\u7801\uFF1B\u8BF7\u4F18\u5148\u4F7F\u7528 HTTPS \u670D\u52A1\u5668\u3002", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("input", { disabled: busy, required: true, type: "password", autoComplete: "current-password", value: password, onChange: (e) => setPassword(e.target.value) }) }),
|
|
16251
|
+
platform === "mattermost" && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(FormField2, { label: "\u53CC\u91CD\u9A8C\u8BC1\u9A8C\u8BC1\u7801\uFF08\u5982\u5DF2\u5F00\u542F\uFF09", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("input", { disabled: busy, autoComplete: "one-time-code", inputMode: "numeric", value: mfaToken, onChange: (e) => setMfaToken(e.target.value) }) })
|
|
16252
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(FormField2, { label: "Access Token", hint: "\u4EC5\u4FDD\u5B58\u81F3 DSH \u51ED\u636E\u5E93\uFF1B\u5EFA\u8BAE HTTPS\uFF0CHTTP \u4F1A\u660E\u6587\u4F20\u8F93\u51ED\u636E\u3002", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("input", { disabled: busy, required: true, type: "password", autoComplete: "new-password", value: botToken, onChange: (e) => setToken(e.target.value) }) }),
|
|
16253
|
+
feedback && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { role: "status", children: feedback }),
|
|
16254
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("footer", { children: [
|
|
16255
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { type: "button", disabled: busy, onClick: closeAdd, children: "\u53D6\u6D88" }),
|
|
16256
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { type: "button", disabled: busy || !(authMode === "password" ? username && password : botToken) || !baseUrl, onClick: () => void configure2(false), children: "\u6D4B\u8BD5\u8FDE\u63A5" }),
|
|
16257
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { className: "is-primary", disabled: busy, children: busy ? "\u5904\u7406\u4E2D\u2026" : "\u4FDD\u5B58\u6E20\u9053" })
|
|
16222
16258
|
] })
|
|
16223
16259
|
] }) }),
|
|
16224
|
-
/* @__PURE__ */ (0,
|
|
16225
|
-
/* @__PURE__ */ (0,
|
|
16226
|
-
/* @__PURE__ */ (0,
|
|
16227
|
-
/* @__PURE__ */ (0,
|
|
16228
|
-
/* @__PURE__ */ (0,
|
|
16260
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "dsh-partner-channel-list", children: [
|
|
16261
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "dsh-partner-channel-row", children: [
|
|
16262
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { children: [
|
|
16263
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("strong", { children: "\u5FAE\u4FE1" }),
|
|
16264
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("small", { children: channels.some((c) => !c.platform || c.platform === "weixin") ? "\u7BA1\u7406\u8FDE\u63A5\u4E0E\u79C1\u804A\u6388\u6743" : "\u5C1A\u672A\u8FDE\u63A5 \xB7 \u626B\u7801\u63A5\u5165" })
|
|
16229
16265
|
] }),
|
|
16230
|
-
channels.find((c) => !c.platform || c.platform === "weixin") && /* @__PURE__ */ (0,
|
|
16231
|
-
/* @__PURE__ */ (0,
|
|
16232
|
-
configuring === "weixin" && /* @__PURE__ */ (0,
|
|
16266
|
+
channels.find((c) => !c.platform || c.platform === "weixin") && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ChannelStatus, { channel: channels.find((c) => !c.platform || c.platform === "weixin") }),
|
|
16267
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { type: "button", "aria-label": "\u914D\u7F6E\u5FAE\u4FE1", onClick: () => setConfiguring("weixin"), children: "\u914D\u7F6E" }),
|
|
16268
|
+
configuring === "weixin" && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(WorkspaceDialog, { title: "\u5FAE\u4FE1\u914D\u7F6E", detail: "\u7BA1\u7406\u626B\u7801\u767B\u5F55\u3001\u8FDE\u63A5\u4E0E\u8054\u7CFB\u4EBA\u6388\u6743\u3002", close: () => setConfiguring(void 0), children: weixin })
|
|
16233
16269
|
] }),
|
|
16234
|
-
["matrix", "mattermost"].filter((platform2) => !channels.some((c) => c.platform === platform2)).map((platform2) => /* @__PURE__ */ (0,
|
|
16235
|
-
/* @__PURE__ */ (0,
|
|
16236
|
-
/* @__PURE__ */ (0,
|
|
16237
|
-
/* @__PURE__ */ (0,
|
|
16270
|
+
["matrix", "mattermost"].filter((platform2) => !channels.some((c) => c.platform === platform2)).map((platform2) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "dsh-partner-channel-row", children: [
|
|
16271
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { children: [
|
|
16272
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("strong", { children: platform2 === "matrix" ? "Matrix" : "Mattermost" }),
|
|
16273
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("small", { children: "\u5C1A\u672A\u8FDE\u63A5" })
|
|
16238
16274
|
] }),
|
|
16239
|
-
/* @__PURE__ */ (0,
|
|
16275
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { type: "button", "aria-label": `\u914D\u7F6E ${platform2}`, onClick: () => openAdd(platform2), children: "\u914D\u7F6E" })
|
|
16240
16276
|
] }, platform2)),
|
|
16241
|
-
channels.filter((c) => c.platform && c.platform !== "weixin").map((channel) => /* @__PURE__ */ (0,
|
|
16242
|
-
/* @__PURE__ */ (0,
|
|
16243
|
-
/* @__PURE__ */ (0,
|
|
16244
|
-
/* @__PURE__ */ (0,
|
|
16277
|
+
channels.filter((c) => c.platform && c.platform !== "weixin").map((channel) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "dsh-partner-channel-row has-notice-slot", children: [
|
|
16278
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { children: [
|
|
16279
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("strong", { children: channel.name }),
|
|
16280
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("small", { children: [
|
|
16245
16281
|
channel.platform,
|
|
16246
16282
|
" \xB7 ",
|
|
16247
16283
|
pairings.filter((p) => p.channelId === channel.id && p.status === "pending").length,
|
|
16248
16284
|
" \u4E2A\u5F85\u6388\u6743"
|
|
16249
16285
|
] })
|
|
16250
16286
|
] }),
|
|
16251
|
-
/* @__PURE__ */ (0,
|
|
16252
|
-
/* @__PURE__ */ (0,
|
|
16287
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ChannelStatus, { channel }),
|
|
16288
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { type: "button", "aria-label": `\u914D\u7F6E ${channel.name}`, onClick: () => {
|
|
16253
16289
|
setFeedback("");
|
|
16254
16290
|
setConfiguring(channel.id);
|
|
16255
16291
|
}, children: "\u914D\u7F6E" }),
|
|
16256
|
-
configuring === channel.id && /* @__PURE__ */ (0,
|
|
16292
|
+
configuring === channel.id && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(WorkspaceDialog, { title: `${channel.name} \xB7 \u914D\u7F6E`, detail: "\u7BA1\u7406\u8FDE\u63A5\u72B6\u6001\u53CA\u8054\u7CFB\u4EBA\u8BBF\u95EE\u6743\u9650\u3002", close: () => {
|
|
16257
16293
|
if (!busy) {
|
|
16258
16294
|
setConfiguring(void 0);
|
|
16259
16295
|
setDeleting(void 0);
|
|
16260
16296
|
}
|
|
16261
|
-
}, children: /* @__PURE__ */ (0,
|
|
16262
|
-
/* @__PURE__ */ (0,
|
|
16263
|
-
/* @__PURE__ */ (0,
|
|
16264
|
-
/* @__PURE__ */ (0,
|
|
16265
|
-
/* @__PURE__ */ (0,
|
|
16266
|
-
channel.direct?.targetId && /* @__PURE__ */ (0,
|
|
16297
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "dsh-partner-channel-detail dsh-partner-channel-manage", children: [
|
|
16298
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "dsh-partner-channel-connection", children: [
|
|
16299
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { children: [
|
|
16300
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("small", { children: "\u767B\u5F55\u8D26\u53F7" }),
|
|
16301
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("strong", { children: channel.accountId }),
|
|
16302
|
+
channel.direct?.targetId && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("small", { children: channel.direct.targetId })
|
|
16267
16303
|
] }),
|
|
16268
|
-
/* @__PURE__ */ (0,
|
|
16304
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ChannelStatus, { channel })
|
|
16269
16305
|
] }),
|
|
16270
|
-
channel.platform === "matrix" && /* @__PURE__ */ (0,
|
|
16271
|
-
!channel.direct?.targetId && /* @__PURE__ */ (0,
|
|
16272
|
-
channel.lastError && /* @__PURE__ */ (0,
|
|
16273
|
-
/* @__PURE__ */ (0,
|
|
16274
|
-
/* @__PURE__ */ (0,
|
|
16306
|
+
channel.platform === "matrix" && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { children: "\u4EC5\u652F\u6301\u672A\u52A0\u5BC6\u7684\u53CC\u4EBA\u4F1A\u8BDD\u3002\u52A0\u5BC6\u4F1A\u8BDD\u65E0\u6CD5\u8BFB\u53D6\u6D88\u606F\u6216\u53D1\u9001\u914D\u5BF9\u7801\uFF1B\u8BF7\u65B0\u5EFA\u672A\u5F00\u542F\u7AEF\u5230\u7AEF\u52A0\u5BC6\u7684\u4F1A\u8BDD\uFF0C\u9080\u8BF7\u673A\u5668\u4EBA\u540E\u53D1\u9001\u6587\u5B57\u6D88\u606F\u3002\u68C0\u6D4B\u5230\u52A0\u5BC6\u4F1A\u8BDD\u65F6\u4F1A\u5728\u6B64\u63D0\u793A\uFF0C\u4E0D\u5F71\u54CD\u5176\u4ED6\u672A\u52A0\u5BC6\u4F1A\u8BDD\u3002" }),
|
|
16307
|
+
!channel.direct?.targetId && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { children: "\u5411\u673A\u5668\u4EBA\u53D1\u79C1\u804A\u6D88\u606F\uFF0C\u5728\u4E0B\u65B9\u6838\u5BF9\u914D\u5BF9\u7801\u540E\u6279\u51C6\u3002\u8BF7\u6C42\u4F1A\u81EA\u52A8\u66F4\u65B0\u3002" }),
|
|
16308
|
+
channel.lastError && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { role: "alert", children: channel.lastError }),
|
|
16309
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "dsh-partner-form-actions", children: [
|
|
16310
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { disabled: busy, onClick: () => void run(async () => {
|
|
16275
16311
|
await api(`/channels/${channel.id}/enabled`, { method: "POST", body: JSON.stringify({ enabled: !channel.enabled }) });
|
|
16276
16312
|
await onChanged();
|
|
16277
16313
|
}), children: channel.enabled ? "\u505C\u7528" : "\u542F\u7528" }),
|
|
16278
|
-
channel.enabled && channel.runtimeStatus === "error" && /* @__PURE__ */ (0,
|
|
16314
|
+
channel.enabled && channel.runtimeStatus === "error" && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { disabled: busy, onClick: () => void run(async () => {
|
|
16279
16315
|
await api(`/channels/${channel.id}/enabled`, { method: "POST", body: JSON.stringify({ enabled: true }) });
|
|
16280
16316
|
await onChanged();
|
|
16281
16317
|
}), children: "\u91CD\u8FDE" }),
|
|
16282
|
-
/* @__PURE__ */ (0,
|
|
16318
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { disabled: busy, onClick: () => deleting === channel.id ? void run(async () => {
|
|
16283
16319
|
await api(`/channels/${channel.id}`, { method: "DELETE" });
|
|
16284
16320
|
setDeleting(void 0);
|
|
16285
16321
|
await onChanged();
|
|
16286
16322
|
}) : setDeleting(channel.id), children: deleting === channel.id ? "\u786E\u8BA4\u5220\u9664\u914D\u7F6E\u4E0E\u51ED\u636E" : "\u5220\u9664\u6E20\u9053" }),
|
|
16287
|
-
deleting === channel.id && /* @__PURE__ */ (0,
|
|
16323
|
+
deleting === channel.id && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { onClick: () => setDeleting(void 0), children: "\u53D6\u6D88" })
|
|
16288
16324
|
] }),
|
|
16289
|
-
/* @__PURE__ */ (0,
|
|
16290
|
-
/* @__PURE__ */ (0,
|
|
16291
|
-
/* @__PURE__ */ (0,
|
|
16325
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("section", { className: "dsh-partner-channel-access", children: [
|
|
16326
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("h3", { children: "\u8054\u7CFB\u4EBA\u6388\u6743" }),
|
|
16327
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("p", { role: "status", children: [
|
|
16292
16328
|
pairings.filter((p) => p.channelId === channel.id && p.status === "pending").length,
|
|
16293
16329
|
" \u4E2A\u7B49\u5F85\u6279\u51C6 \xB7 \u81EA\u52A8\u5237\u65B0"
|
|
16294
16330
|
] }),
|
|
16295
|
-
pairings.filter((p) => p.channelId === channel.id).map((p) => /* @__PURE__ */ (0,
|
|
16296
|
-
/* @__PURE__ */ (0,
|
|
16297
|
-
/* @__PURE__ */ (0,
|
|
16298
|
-
/* @__PURE__ */ (0,
|
|
16299
|
-
p.status === "pending" && p.pairingCode && /* @__PURE__ */ (0,
|
|
16331
|
+
pairings.filter((p) => p.channelId === channel.id).map((p) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "dsh-partner-channel-person", children: [
|
|
16332
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
|
|
16333
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("strong", { children: p.displayName }),
|
|
16334
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("small", { children: p.status === "approved" ? "\u5DF2\u6388\u6743" : p.status === "pending" ? "\u7B49\u5F85\u6279\u51C6" : "\u5DF2\u963B\u6B62" }),
|
|
16335
|
+
p.status === "pending" && p.pairingCode && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { children: [
|
|
16300
16336
|
"\u914D\u5BF9\u7801 ",
|
|
16301
|
-
/* @__PURE__ */ (0,
|
|
16337
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("code", { children: p.pairingCode })
|
|
16302
16338
|
] })
|
|
16303
16339
|
] }),
|
|
16304
|
-
/* @__PURE__ */ (0,
|
|
16340
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { disabled: busy, onClick: () => void run(async () => {
|
|
16305
16341
|
await api(`/pairings/${p.id}/status`, { method: "POST", body: JSON.stringify({ status: p.status === "approved" ? "blocked" : "approved" }) });
|
|
16306
16342
|
await onChanged();
|
|
16307
16343
|
}), children: p.status === "approved" ? "\u64A4\u9500\u6388\u6743" : "\u6279\u51C6\u8054\u7CFB\u4EBA" })
|
|
16308
16344
|
] }, p.id))
|
|
16309
16345
|
] }),
|
|
16310
|
-
feedback && /* @__PURE__ */ (0,
|
|
16346
|
+
feedback && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { role: "status", children: feedback })
|
|
16311
16347
|
] }) }),
|
|
16312
|
-
channel.lastError && /* @__PURE__ */ (0,
|
|
16313
|
-
/* @__PURE__ */ (0,
|
|
16314
|
-
/* @__PURE__ */ (0,
|
|
16348
|
+
channel.lastError && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "dsh-partner-channel-inline-notice", role: "status", "aria-atomic": "true", children: [
|
|
16349
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("strong", { children: channel.runtimeStatus === "running" ? "\u4F1A\u8BDD\u63D0\u793A" : "\u8FDE\u63A5\u63D0\u793A" }),
|
|
16350
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { children: channel.lastError })
|
|
16315
16351
|
] })
|
|
16316
16352
|
] }, channel.id))
|
|
16317
16353
|
] }),
|
|
16318
|
-
/* @__PURE__ */ (0,
|
|
16319
|
-
/* @__PURE__ */ (0,
|
|
16320
|
-
/* @__PURE__ */ (0,
|
|
16321
|
-
/* @__PURE__ */ (0,
|
|
16354
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("section", { className: "dsh-partner-channel-notifications", "aria-label": "\u901A\u77E5\u8BBE\u7F6E", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "dsh-partner-channel-row", children: [
|
|
16355
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { children: [
|
|
16356
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("strong", { children: "\u901A\u77E5\u4E0E\u4EA4\u4ED8" }),
|
|
16357
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("small", { children: companion.notificationDelivery?.mode === "selected" ? `\u5DF2\u6307\u5B9A ${companion.notificationDelivery.targets.length} \u4F4D\u63A5\u6536\u4EBA` : "\u9ED8\u8BA4\u8DDF\u968F\u6700\u8FD1\u6E20\u9053\u4E0E\u7528\u6237" })
|
|
16322
16358
|
] }),
|
|
16323
|
-
/* @__PURE__ */ (0,
|
|
16359
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { type: "button", onClick: () => setConfiguring("delivery"), children: "\u914D\u7F6E" })
|
|
16324
16360
|
] }) }),
|
|
16325
|
-
configuring === "delivery" && /* @__PURE__ */ (0,
|
|
16361
|
+
configuring === "delivery" && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(WorkspaceDialog, { title: "\u901A\u77E5\u4E0E\u4EA4\u4ED8", detail: "\u9009\u62E9\u901A\u77E5\u6E20\u9053\uFF0C\u518D\u9009\u62E9\u5404\u6E20\u9053\u7684\u63A5\u6536\u4EBA\uFF1B\u652F\u6301\u540C\u65F6\u6295\u9012\u3002", close: () => setConfiguring(void 0), children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(NotificationSettings, { companion, snapshot, onChanged }) })
|
|
16326
16362
|
] });
|
|
16327
16363
|
}
|
|
16328
16364
|
function FormField2({ label, hint, children }) {
|
|
16329
|
-
return /* @__PURE__ */ (0,
|
|
16330
|
-
/* @__PURE__ */ (0,
|
|
16365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { className: "dsh-partner-channel-field", children: [
|
|
16366
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: label }),
|
|
16331
16367
|
children,
|
|
16332
|
-
hint && /* @__PURE__ */ (0,
|
|
16368
|
+
hint && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("small", { children: hint })
|
|
16333
16369
|
] });
|
|
16334
16370
|
}
|
|
16335
16371
|
|
|
16336
16372
|
// src/ui/use-channel-status.ts
|
|
16337
|
-
var
|
|
16373
|
+
var import_react47 = require("react");
|
|
16338
16374
|
var listeners2 = /* @__PURE__ */ new Set();
|
|
16339
16375
|
var timer;
|
|
16340
16376
|
var active;
|
|
@@ -16359,7 +16395,7 @@ async function poll() {
|
|
|
16359
16395
|
}
|
|
16360
16396
|
}
|
|
16361
16397
|
function useChannelStatus(setSnapshot) {
|
|
16362
|
-
(0,
|
|
16398
|
+
(0, import_react47.useEffect)(() => {
|
|
16363
16399
|
const update = (value) => setSnapshot((previous3) => previous3 ? { ...previous3, ...value } : previous3);
|
|
16364
16400
|
listeners2.add(update);
|
|
16365
16401
|
lastValue = "";
|
|
@@ -16513,12 +16549,12 @@ var form_surface_default = `/* Deliberate, local boundary against host themes wi
|
|
|
16513
16549
|
`;
|
|
16514
16550
|
|
|
16515
16551
|
// src/ui/companion-create.tsx
|
|
16516
|
-
var
|
|
16517
|
-
var
|
|
16518
|
-
var
|
|
16552
|
+
var import_react48 = require("react");
|
|
16553
|
+
var import_dsh_client_ui_primitives23 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
16554
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
16519
16555
|
function CompanionCreateDialog({ close, create }) {
|
|
16520
|
-
const [busy, setBusy] = (0,
|
|
16521
|
-
const [error, setError] = (0,
|
|
16556
|
+
const [busy, setBusy] = (0, import_react48.useState)(false);
|
|
16557
|
+
const [error, setError] = (0, import_react48.useState)();
|
|
16522
16558
|
const submit = async (event) => {
|
|
16523
16559
|
event.preventDefault();
|
|
16524
16560
|
const data = new FormData(event.currentTarget);
|
|
@@ -16537,30 +16573,30 @@ function CompanionCreateDialog({ close, create }) {
|
|
|
16537
16573
|
setBusy(false);
|
|
16538
16574
|
}
|
|
16539
16575
|
};
|
|
16540
|
-
return /* @__PURE__ */ (0,
|
|
16576
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(WorkspaceDialog, { title: "\u65B0\u5EFA\u4F19\u4F34", detail: "\u5148\u5EFA\u7ACB\u6E05\u6670\u7684\u8EAB\u4EFD\u548C\u804C\u8D23\u3002\u6A21\u578B\u3001\u5DE5\u5177\u3001Skill \u4E0E\u534F\u4F5C\u6743\u9650\u4F1A\u5728\u521B\u5EFA\u540E\u5355\u72EC\u914D\u7F6E\u3002", close, width: "wide", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("form", { className: "dsh-partner-feature-form dsh-partner-companion-create-form", "aria-busy": busy, onSubmit: (event) => {
|
|
16541
16577
|
void submit(event);
|
|
16542
16578
|
}, children: [
|
|
16543
|
-
/* @__PURE__ */ (0,
|
|
16544
|
-
/* @__PURE__ */ (0,
|
|
16545
|
-
/* @__PURE__ */ (0,
|
|
16579
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { children: [
|
|
16580
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: "\u4F19\u4F34\u540D\u5B57" }),
|
|
16581
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("input", { name: "name", required: true, maxLength: 60, autoFocus: true, placeholder: "\u4F8B\u5982\uFF1A\u5C0F\u9ED1" })
|
|
16546
16582
|
] }),
|
|
16547
|
-
/* @__PURE__ */ (0,
|
|
16548
|
-
/* @__PURE__ */ (0,
|
|
16549
|
-
/* @__PURE__ */ (0,
|
|
16583
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { children: [
|
|
16584
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: "\u4E3B\u8981\u89D2\u8272" }),
|
|
16585
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("input", { name: "role", required: true, maxLength: 120, placeholder: "\u4F8B\u5982\uFF1A\u4EA7\u54C1\u4E0E\u5DE5\u7A0B\u534F\u4F5C\u4F19\u4F34" })
|
|
16550
16586
|
] }),
|
|
16551
|
-
/* @__PURE__ */ (0,
|
|
16552
|
-
/* @__PURE__ */ (0,
|
|
16553
|
-
/* @__PURE__ */ (0,
|
|
16587
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "is-wide", children: [
|
|
16588
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: "\u4E00\u53E5\u8BDD\u5B9A\u4F4D" }),
|
|
16589
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("input", { name: "description", maxLength: 500, placeholder: "\u5B83\u4E3B\u8981\u8D1F\u8D23\u4EC0\u4E48\uFF0C\u4EC0\u4E48\u65F6\u5019\u5E94\u8BE5\u627E\u5B83" })
|
|
16554
16590
|
] }),
|
|
16555
|
-
/* @__PURE__ */ (0,
|
|
16556
|
-
/* @__PURE__ */ (0,
|
|
16557
|
-
/* @__PURE__ */ (0,
|
|
16591
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "is-wide", children: [
|
|
16592
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: "\u521D\u59CB\u884C\u4E3A\u51C6\u5219" }),
|
|
16593
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("textarea", { name: "instructions", maxLength: 12e3, rows: 7, placeholder: "\u5199\u6E05\u804C\u8D23\u3001\u8868\u8FBE\u65B9\u5F0F\u3001\u5DE5\u4F5C\u8FB9\u754C\u548C\u4EA4\u4ED8\u6807\u51C6\uFF1B\u4E5F\u53EF\u4EE5\u521B\u5EFA\u540E\u518D\u5B8C\u5584" })
|
|
16558
16594
|
] }),
|
|
16559
|
-
error && /* @__PURE__ */ (0,
|
|
16560
|
-
/* @__PURE__ */ (0,
|
|
16561
|
-
/* @__PURE__ */ (0,
|
|
16562
|
-
/* @__PURE__ */ (0,
|
|
16563
|
-
/* @__PURE__ */ (0,
|
|
16595
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(WorkspaceNotice, { children: error }),
|
|
16596
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("footer", { children: [
|
|
16597
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("button", { type: "button", disabled: busy, onClick: close, children: "\u53D6\u6D88" }),
|
|
16598
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("button", { type: "submit", className: "is-primary", disabled: busy, children: [
|
|
16599
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_dsh_client_ui_primitives23.IconPlusOutlineRegular, { size: 14 }),
|
|
16564
16600
|
busy ? "\u6B63\u5728\u521B\u5EFA\u2026" : "\u521B\u5EFA\u4F19\u4F34"
|
|
16565
16601
|
] })
|
|
16566
16602
|
] })
|
|
@@ -16568,7 +16604,7 @@ function CompanionCreateDialog({ close, create }) {
|
|
|
16568
16604
|
}
|
|
16569
16605
|
|
|
16570
16606
|
// src/main-panel-compat.ts
|
|
16571
|
-
var
|
|
16607
|
+
var import_react49 = require("react");
|
|
16572
16608
|
function registerMainPanel(ctx, id, priority, render, onHidden = () => {
|
|
16573
16609
|
}) {
|
|
16574
16610
|
const layout = ctx.layout;
|
|
@@ -16579,7 +16615,7 @@ function registerMainPanel(ctx, id, priority, render, onHidden = () => {
|
|
|
16579
16615
|
let disposed = false;
|
|
16580
16616
|
let generation = 0;
|
|
16581
16617
|
const Body = (props) => {
|
|
16582
|
-
(0,
|
|
16618
|
+
(0, import_react49.useEffect)(() => {
|
|
16583
16619
|
const current2 = ++generation;
|
|
16584
16620
|
return () => {
|
|
16585
16621
|
queueMicrotask(() => {
|
|
@@ -16686,10 +16722,10 @@ function sessions(ctx) {
|
|
|
16686
16722
|
}
|
|
16687
16723
|
|
|
16688
16724
|
// src/ui/workspace-navigation.tsx
|
|
16689
|
-
var
|
|
16725
|
+
var import_dsh_client_ui_primitives24 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
16690
16726
|
|
|
16691
16727
|
// src/ui/storage-settings.tsx
|
|
16692
|
-
var
|
|
16728
|
+
var import_react51 = require("react");
|
|
16693
16729
|
|
|
16694
16730
|
// src/ui/storage-recovery.ts
|
|
16695
16731
|
var StorageStatusError = class extends Error {
|
|
@@ -16737,16 +16773,16 @@ async function waitForStorage(signal, onWait, options = {}) {
|
|
|
16737
16773
|
}
|
|
16738
16774
|
|
|
16739
16775
|
// src/ui/attachment-storage.tsx
|
|
16740
|
-
var
|
|
16741
|
-
var
|
|
16776
|
+
var import_react50 = require("react");
|
|
16777
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
16742
16778
|
var size = (bytes) => `${(bytes / 1048576).toFixed(2)} MiB`;
|
|
16743
16779
|
function AttachmentStoragePanel() {
|
|
16744
|
-
const [view, setView] = (0,
|
|
16745
|
-
const [owner, setOwner] = (0,
|
|
16746
|
-
const [selected, setSelected] = (0,
|
|
16747
|
-
const [error, setError] = (0,
|
|
16748
|
-
const [expanded, setExpanded] = (0,
|
|
16749
|
-
(0,
|
|
16780
|
+
const [view, setView] = (0, import_react50.useState)(), [limit, setLimit] = (0, import_react50.useState)("512");
|
|
16781
|
+
const [owner, setOwner] = (0, import_react50.useState)(""), [days, setDays] = (0, import_react50.useState)("0"), [offset, setOffset] = (0, import_react50.useState)(0);
|
|
16782
|
+
const [selected, setSelected] = (0, import_react50.useState)([]), [busy, setBusy] = (0, import_react50.useState)(false), [confirm, setConfirm] = (0, import_react50.useState)(false);
|
|
16783
|
+
const [error, setError] = (0, import_react50.useState)(""), [notice, setNotice] = (0, import_react50.useState)(""), [revision, setRevision] = (0, import_react50.useState)(0);
|
|
16784
|
+
const [expanded, setExpanded] = (0, import_react50.useState)(false);
|
|
16785
|
+
(0, import_react50.useEffect)(() => {
|
|
16750
16786
|
const controller = new AbortController();
|
|
16751
16787
|
setBusy(true);
|
|
16752
16788
|
setSelected([]);
|
|
@@ -16790,65 +16826,65 @@ function AttachmentStoragePanel() {
|
|
|
16790
16826
|
setBusy(false);
|
|
16791
16827
|
}
|
|
16792
16828
|
};
|
|
16793
|
-
return /* @__PURE__ */ (0,
|
|
16794
|
-
/* @__PURE__ */ (0,
|
|
16795
|
-
/* @__PURE__ */ (0,
|
|
16796
|
-
/* @__PURE__ */ (0,
|
|
16797
|
-
/* @__PURE__ */ (0,
|
|
16798
|
-
/* @__PURE__ */ (0,
|
|
16829
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(WorkspaceBlock, { title: "\u9644\u4EF6\u5B58\u50A8", className: "attachment-storage-block", children: [
|
|
16830
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { id: "partner-attachment-storage", className: "dsh-partner-attachment-storage", "aria-busy": busy, children: [
|
|
16831
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "attachment-storage-overview", children: [
|
|
16832
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "attachment-storage-usage", children: [
|
|
16833
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("strong", { children: view ? `${size(view.usedBytes)} / ${view.limitMiB} MiB` : "\u6B63\u5728\u8BFB\u53D6\u2026" }),
|
|
16834
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("small", { children: view ? `${view.count} \u4E2A\u526F\u672C \xB7 \u5168\u90E8\u4F19\u4F34\u5171\u4EAB` : "\u6B63\u5728\u7EDF\u8BA1\u9644\u4EF6\u5360\u7528" })
|
|
16799
16835
|
] }),
|
|
16800
|
-
/* @__PURE__ */ (0,
|
|
16836
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("form", { onSubmit: (e) => {
|
|
16801
16837
|
e.preventDefault();
|
|
16802
16838
|
void save();
|
|
16803
16839
|
}, children: [
|
|
16804
|
-
/* @__PURE__ */ (0,
|
|
16840
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("label", { children: [
|
|
16805
16841
|
"\u989D\u5EA6",
|
|
16806
|
-
/* @__PURE__ */ (0,
|
|
16807
|
-
/* @__PURE__ */ (0,
|
|
16842
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("input", { "aria-label": "\u603B\u989D\u5EA6\uFF08MiB\uFF09", type: "number", min: "64", max: "1048576", step: "1", required: true, value: limit, disabled: busy, onChange: (e) => setLimit(e.target.value) }),
|
|
16843
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { children: "MiB" })
|
|
16808
16844
|
] }),
|
|
16809
|
-
/* @__PURE__ */ (0,
|
|
16845
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("button", { "aria-label": "\u4FDD\u5B58\u989D\u5EA6", disabled: busy || !view || Number(limit) === view.limitMiB, children: "\u4FDD\u5B58" })
|
|
16810
16846
|
] }),
|
|
16811
|
-
/* @__PURE__ */ (0,
|
|
16847
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("button", { type: "button", "aria-expanded": expanded, "aria-controls": "attachment-storage-manager", onClick: () => setExpanded((v) => !v), children: expanded ? "\u6536\u8D77\u660E\u7EC6" : "\u7BA1\u7406\u526F\u672C" })
|
|
16812
16848
|
] }),
|
|
16813
|
-
expanded && /* @__PURE__ */ (0,
|
|
16814
|
-
/* @__PURE__ */ (0,
|
|
16815
|
-
/* @__PURE__ */ (0,
|
|
16849
|
+
expanded && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { id: "attachment-storage-manager", children: [
|
|
16850
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "attachment-storage-filters", children: [
|
|
16851
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("label", { children: [
|
|
16816
16852
|
"\u4F19\u4F34",
|
|
16817
|
-
/* @__PURE__ */ (0,
|
|
16853
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("select", { value: owner, disabled: busy, onChange: (e) => {
|
|
16818
16854
|
setOwner(e.target.value);
|
|
16819
16855
|
setOffset(0);
|
|
16820
16856
|
}, children: [
|
|
16821
|
-
/* @__PURE__ */ (0,
|
|
16822
|
-
view?.owners.map((o) => /* @__PURE__ */ (0,
|
|
16857
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("option", { value: "", children: "\u5168\u90E8\u4F19\u4F34" }),
|
|
16858
|
+
view?.owners.map((o) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("option", { value: o.id, children: o.name }, o.id))
|
|
16823
16859
|
] })
|
|
16824
16860
|
] }),
|
|
16825
|
-
/* @__PURE__ */ (0,
|
|
16861
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("label", { children: [
|
|
16826
16862
|
"\u521B\u5EFA\u65F6\u95F4",
|
|
16827
|
-
/* @__PURE__ */ (0,
|
|
16863
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("select", { value: days, disabled: busy, onChange: (e) => {
|
|
16828
16864
|
setDays(e.target.value);
|
|
16829
16865
|
setOffset(0);
|
|
16830
16866
|
}, children: [
|
|
16831
|
-
/* @__PURE__ */ (0,
|
|
16832
|
-
/* @__PURE__ */ (0,
|
|
16833
|
-
/* @__PURE__ */ (0,
|
|
16834
|
-
/* @__PURE__ */ (0,
|
|
16867
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("option", { value: "0", children: "\u5168\u90E8\u65F6\u95F4" }),
|
|
16868
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("option", { value: "7", children: "7 \u5929\u4EE5\u524D" }),
|
|
16869
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("option", { value: "30", children: "30 \u5929\u4EE5\u524D" }),
|
|
16870
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("option", { value: "90", children: "90 \u5929\u4EE5\u524D" })
|
|
16835
16871
|
] })
|
|
16836
16872
|
] }),
|
|
16837
|
-
/* @__PURE__ */ (0,
|
|
16873
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("button", { disabled: busy, onClick: () => setRevision((v) => v + 1), children: "\u5237\u65B0" })
|
|
16838
16874
|
] }),
|
|
16839
|
-
/* @__PURE__ */ (0,
|
|
16840
|
-
/* @__PURE__ */ (0,
|
|
16841
|
-
/* @__PURE__ */ (0,
|
|
16875
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "attachment-storage-selection", children: [
|
|
16876
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("button", { disabled: busy || !view?.items.some((i) => !i.protectedReason), onClick: () => setSelected(selected.length ? [] : view.items.filter((i) => !i.protectedReason).map((i) => i.id)), children: selected.length ? "\u53D6\u6D88\u9009\u62E9" : "\u9009\u62E9\u672C\u9875" }),
|
|
16877
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("small", { children: [
|
|
16842
16878
|
"\u53EF\u6E05\u7406 ",
|
|
16843
16879
|
size(view?.eligibleBytes ?? 0),
|
|
16844
16880
|
" \xB7 \u4F7F\u7528\u4E2D\u7684\u526F\u672C\u53D7\u4FDD\u62A4"
|
|
16845
16881
|
] })
|
|
16846
16882
|
] }),
|
|
16847
|
-
/* @__PURE__ */ (0,
|
|
16848
|
-
/* @__PURE__ */ (0,
|
|
16849
|
-
/* @__PURE__ */ (0,
|
|
16850
|
-
/* @__PURE__ */ (0,
|
|
16851
|
-
/* @__PURE__ */ (0,
|
|
16883
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "attachment-storage-list", children: view?.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("label", { className: "attachment-storage-row", children: [
|
|
16884
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("input", { type: "checkbox", disabled: busy || !!item.protectedReason, checked: selected.includes(item.id), onChange: (e) => setSelected((ids) => e.target.checked ? [...ids, item.id] : ids.filter((id) => id !== item.id)) }),
|
|
16885
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { children: [
|
|
16886
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("strong", { title: item.name, children: item.name }),
|
|
16887
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("small", { children: [
|
|
16852
16888
|
item.companionName,
|
|
16853
16889
|
" \xB7 ",
|
|
16854
16890
|
size(item.size),
|
|
@@ -16859,60 +16895,60 @@ function AttachmentStoragePanel() {
|
|
|
16859
16895
|
] })
|
|
16860
16896
|
] })
|
|
16861
16897
|
] }, item.id)) }),
|
|
16862
|
-
view && !view.items.length && /* @__PURE__ */ (0,
|
|
16863
|
-
/* @__PURE__ */ (0,
|
|
16864
|
-
/* @__PURE__ */ (0,
|
|
16865
|
-
/* @__PURE__ */ (0,
|
|
16898
|
+
view && !view.items.length && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { children: "\u6CA1\u6709\u7B26\u5408\u6761\u4EF6\u7684\u526F\u672C\u3002" }),
|
|
16899
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "attachment-storage-filters", children: [
|
|
16900
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("button", { disabled: busy || offset === 0, onClick: () => setOffset(Math.max(0, offset - 30)), children: "\u4E0A\u4E00\u9875" }),
|
|
16901
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { children: [
|
|
16866
16902
|
"\u7B2C ",
|
|
16867
16903
|
Math.floor(offset / 30) + 1,
|
|
16868
16904
|
" \u9875 \xB7 \u5171 ",
|
|
16869
16905
|
view?.filteredCount ?? 0,
|
|
16870
16906
|
" \u9879"
|
|
16871
16907
|
] }),
|
|
16872
|
-
/* @__PURE__ */ (0,
|
|
16873
|
-
/* @__PURE__ */ (0,
|
|
16908
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("button", { disabled: busy || !view || offset + 30 >= view.filteredCount, onClick: () => setOffset(offset + 30), children: "\u4E0B\u4E00\u9875" }),
|
|
16909
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("button", { disabled: busy || !selected.length, onClick: () => setConfirm(true), children: [
|
|
16874
16910
|
"\u6E05\u7406\u6240\u9009\uFF08",
|
|
16875
16911
|
selected.length,
|
|
16876
16912
|
"\uFF09"
|
|
16877
16913
|
] })
|
|
16878
16914
|
] }),
|
|
16879
|
-
/* @__PURE__ */ (0,
|
|
16880
|
-
/* @__PURE__ */ (0,
|
|
16881
|
-
/* @__PURE__ */ (0,
|
|
16882
|
-
/* @__PURE__ */ (0,
|
|
16883
|
-
[...new Set(view?.owners.map((o) => o.directory) ?? [])].map((directory) => /* @__PURE__ */ (0,
|
|
16915
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("details", { className: "attachment-storage-help", children: [
|
|
16916
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("summary", { children: "\u5B58\u50A8\u4E0E\u6E05\u7406\u8BF4\u660E" }),
|
|
16917
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { children: "\u526F\u672C\u7EDF\u4E00\u5B58\u653E\uFF0C\u539F\u6587\u4EF6\u4E0D\u53D7\u5F71\u54CD\u3002\u4E0D\u4F1A\u81EA\u52A8\u6E05\u7406\uFF1B\u964D\u4F4E\u989D\u5EA6\u4E0D\u5220\u9664\u65E7\u526F\u672C\uFF0C\u8D85\u989D\u65F6\u505C\u6B62\u65B0\u589E\u3002\u5355\u6587\u4EF6\u4E0A\u9650 64 MiB\u3002" }),
|
|
16918
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { children: "\u53D1\u9001\u4E2D\u3001\u5931\u8D25\u5F85\u91CD\u8BD5\u3001\u6700\u8FD1 5 \u5206\u949F\u521B\u5EFA\u53CA\u672A\u5B8C\u6210\u4EFB\u52A1/\u9700\u6C42\u5F15\u7528\u7684\u526F\u672C\u4E0D\u80FD\u6E05\u7406\u3002\u6E05\u7406\u540E\u5BF9\u5E94\u5386\u53F2\u4E0B\u8F7D\u94FE\u63A5\u5931\u6548\u3002" }),
|
|
16919
|
+
[...new Set(view?.owners.map((o) => o.directory) ?? [])].map((directory) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("code", { children: directory }, directory))
|
|
16884
16920
|
] })
|
|
16885
16921
|
] }),
|
|
16886
|
-
error && /* @__PURE__ */ (0,
|
|
16887
|
-
notice && /* @__PURE__ */ (0,
|
|
16922
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { role: "alert", children: error }),
|
|
16923
|
+
notice && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { role: "status", children: notice })
|
|
16888
16924
|
] }),
|
|
16889
|
-
confirm && /* @__PURE__ */ (0,
|
|
16925
|
+
confirm && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(WorkspaceDialog, { eyebrow: "\u9644\u4EF6\u7BA1\u7406", title: "\u6E05\u7406\u4EA4\u4ED8\u526F\u672C", detail: `\u5DF2\u9009\u62E9 ${selected.length} \u4E2A\u526F\u672C\u3002\u6B64\u64CD\u4F5C\u4E0D\u53EF\u64A4\u9500\u3002`, close: () => {
|
|
16890
16926
|
if (!busy) setConfirm(false);
|
|
16891
|
-
}, children: /* @__PURE__ */ (0,
|
|
16927
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("form", { className: "dsh-partner-feature-form", onSubmit: (event) => {
|
|
16892
16928
|
event.preventDefault();
|
|
16893
16929
|
if (!busy) void clean();
|
|
16894
16930
|
}, children: [
|
|
16895
|
-
/* @__PURE__ */ (0,
|
|
16896
|
-
error && /* @__PURE__ */ (0,
|
|
16897
|
-
/* @__PURE__ */ (0,
|
|
16898
|
-
/* @__PURE__ */ (0,
|
|
16899
|
-
/* @__PURE__ */ (0,
|
|
16931
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "is-wide", children: "\u53EA\u5220\u9664\u4EA4\u4ED8\u526F\u672C\uFF0C\u539F\u59CB\u6587\u4EF6\u4FDD\u6301\u4E0D\u53D8\u3002\u5386\u53F2\u4F1A\u8BDD\u548C\u770B\u677F\u4E2D\u7684\u5BF9\u5E94\u9644\u4EF6\u4E0B\u8F7D\u94FE\u63A5\u5C06\u5931\u6548\u3002\u6267\u884C\u65F6\u4F1A\u518D\u6B21\u68C0\u67E5\u4FDD\u62A4\u72B6\u6001\u3002" }),
|
|
16932
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "is-wide", role: "alert", children: error }),
|
|
16933
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("footer", { children: [
|
|
16934
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("button", { type: "button", disabled: busy, onClick: () => setConfirm(false), children: "\u53D6\u6D88" }),
|
|
16935
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("button", { type: "submit", className: "is-primary", disabled: busy, children: busy ? "\u6E05\u7406\u4E2D\u2026" : "\u786E\u8BA4\u6E05\u7406" })
|
|
16900
16936
|
] })
|
|
16901
16937
|
] }) })
|
|
16902
16938
|
] });
|
|
16903
16939
|
}
|
|
16904
16940
|
|
|
16905
16941
|
// src/ui/storage-settings.tsx
|
|
16906
|
-
var
|
|
16942
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
16907
16943
|
function GeneralSettingsPanel() {
|
|
16908
|
-
const [version, setVersion] = (0,
|
|
16909
|
-
const [inspection, setInspection] = (0,
|
|
16910
|
-
const [busy, setBusy] = (0,
|
|
16911
|
-
const [error, setError] = (0,
|
|
16912
|
-
const request = (0,
|
|
16913
|
-
const mounted = (0,
|
|
16914
|
-
const [reconnect, setReconnect] = (0,
|
|
16915
|
-
const [cleanupPending, setCleanupPending] = (0,
|
|
16944
|
+
const [version, setVersion] = (0, import_react51.useState)();
|
|
16945
|
+
const [inspection, setInspection] = (0, import_react51.useState)();
|
|
16946
|
+
const [busy, setBusy] = (0, import_react51.useState)(false), [confirm, setConfirm] = (0, import_react51.useState)(false);
|
|
16947
|
+
const [error, setError] = (0, import_react51.useState)(""), [notice, setNotice] = (0, import_react51.useState)("");
|
|
16948
|
+
const request = (0, import_react51.useRef)();
|
|
16949
|
+
const mounted = (0, import_react51.useRef)(true);
|
|
16950
|
+
const [reconnect, setReconnect] = (0, import_react51.useState)(false);
|
|
16951
|
+
const [cleanupPending, setCleanupPending] = (0, import_react51.useState)(0);
|
|
16916
16952
|
const cleanup = version === 1 && cleanupPending > 0;
|
|
16917
16953
|
const recover = async (expected = pendingStorageRecovery()) => {
|
|
16918
16954
|
request.current?.abort();
|
|
@@ -16943,7 +16979,7 @@ function GeneralSettingsPanel() {
|
|
|
16943
16979
|
if (!controller.signal.aborted) setBusy(false);
|
|
16944
16980
|
}
|
|
16945
16981
|
};
|
|
16946
|
-
(0,
|
|
16982
|
+
(0, import_react51.useEffect)(() => {
|
|
16947
16983
|
mounted.current = true;
|
|
16948
16984
|
void recover();
|
|
16949
16985
|
return () => {
|
|
@@ -16980,17 +17016,17 @@ function GeneralSettingsPanel() {
|
|
|
16980
17016
|
}
|
|
16981
17017
|
if (mounted.current) await recover(expected);
|
|
16982
17018
|
};
|
|
16983
|
-
return /* @__PURE__ */ (0,
|
|
16984
|
-
/* @__PURE__ */ (0,
|
|
16985
|
-
/* @__PURE__ */ (0,
|
|
16986
|
-
/* @__PURE__ */ (0,
|
|
16987
|
-
/* @__PURE__ */ (0,
|
|
17019
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("section", { className: "dsh-partner-general-settings", "aria-busy": busy, children: [
|
|
17020
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("h2", { children: "\u57FA\u672C\u8BBE\u7F6E" }),
|
|
17021
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(AttachmentStoragePanel, {}),
|
|
17022
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(WorkspaceBlock, { className: "is-storage-migration", title: "\u5347\u7EA7\u8FC1\u79FB", detail: "\u624B\u52A8\u6574\u7406\u516C\u5171\u6570\u636E\u548C\u6BCF\u4F4D\u4F19\u4F34\u7684\u79C1\u6709\u76EE\u5F55\uFF0C\u4E0D\u4F1A\u81EA\u52A8\u6267\u884C\u3002", actions: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", disabled: busy, onClick: () => void inspect(), children: busy ? "\u5904\u7406\u4E2D\u2026" : "\u68C0\u67E5\u8FC1\u79FB" }), children: [
|
|
17023
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("p", { children: [
|
|
16988
17024
|
"\u6570\u636E\u5B58\u50A8\u7248\u672C\uFF1A",
|
|
16989
17025
|
version === void 0 ? "\u6B63\u5728\u8BFB\u53D6\u2026" : `v${version}${version === 0 ? " \xB7 \u5F85\u8FC1\u79FB" : " \xB7 \u5DF2\u5347\u7EA7"}`
|
|
16990
17026
|
] }),
|
|
16991
|
-
/* @__PURE__ */ (0,
|
|
16992
|
-
inspection && /* @__PURE__ */ (0,
|
|
16993
|
-
inspection.steps.map((step) => /* @__PURE__ */ (0,
|
|
17027
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { children: "\u5347\u7EA7\u524D\u8BF7\u7ED3\u675F\u4F19\u4F34\u4F1A\u8BDD\u548C\u540E\u53F0\u6267\u884C\u3002\u5B8C\u6574\u5907\u4EFD\u5E76\u6821\u9A8C\u540E\u624D\u6E05\u7406\u5DF2\u8FC1\u79FB\u7684\u65E7\u8DEF\u5F84\uFF0C\u4E0D\u4FEE\u6539\u7528\u6237\u5DE5\u4F5C\u6587\u6863\uFF1B\u670D\u52A1\u91CD\u8F7D\u540E\u81EA\u52A8\u91CD\u65B0\u8FDE\u63A5\u3002" }),
|
|
17028
|
+
inspection && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
17029
|
+
inspection.steps.map((step) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("p", { children: [
|
|
16994
17030
|
"v",
|
|
16995
17031
|
step.from,
|
|
16996
17032
|
" \u2192 v",
|
|
@@ -16998,79 +17034,79 @@ function GeneralSettingsPanel() {
|
|
|
16998
17034
|
" \xB7 ",
|
|
16999
17035
|
step.title
|
|
17000
17036
|
] }, step.id)),
|
|
17001
|
-
/* @__PURE__ */ (0,
|
|
17002
|
-
/* @__PURE__ */ (0,
|
|
17003
|
-
/* @__PURE__ */ (0,
|
|
17004
|
-
/* @__PURE__ */ (0,
|
|
17005
|
-
/* @__PURE__ */ (0,
|
|
17006
|
-
/* @__PURE__ */ (0,
|
|
17007
|
-
/* @__PURE__ */ (0,
|
|
17008
|
-
/* @__PURE__ */ (0,
|
|
17037
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("details", { children: [
|
|
17038
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("summary", { children: "\u67E5\u770B\u76EE\u5F55\u4E0E\u68C0\u67E5\u8BE6\u60C5" }),
|
|
17039
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "dsh-partner-migration-paths", children: inspection.items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { children: [
|
|
17040
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("strong", { children: item.label }),
|
|
17041
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("code", { children: item.source }),
|
|
17042
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { children: "\u8FC1\u79FB\u81F3" }),
|
|
17043
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("code", { children: item.target }),
|
|
17044
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("small", { children: item.exists ? `${item.files} \u4E2A\u6587\u4EF6 \xB7 ${(item.bytes / 1024 / 1024).toFixed(2)} MB` : "\u5F53\u524D\u65E0\u6587\u4EF6" })
|
|
17009
17045
|
] }, i)) }),
|
|
17010
|
-
inspection.notices.map((text4, i) => /* @__PURE__ */ (0,
|
|
17046
|
+
inspection.notices.map((text4, i) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { children: text4 }, i))
|
|
17011
17047
|
] }),
|
|
17012
|
-
!!inspection.blockers.length && /* @__PURE__ */ (0,
|
|
17013
|
-
/* @__PURE__ */ (0,
|
|
17014
|
-
/* @__PURE__ */ (0,
|
|
17048
|
+
!!inspection.blockers.length && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { role: "alert", children: [
|
|
17049
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { children: "\u4EE5\u4E0B\u95EE\u9898\u9700\u8981\u5148\u5904\u7406\uFF1A" }),
|
|
17050
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("ul", { children: inspection.blockers.map((text4, i) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("li", { children: text4 }, i)) })
|
|
17015
17051
|
] }),
|
|
17016
|
-
inspection.migrationAvailable && /* @__PURE__ */ (0,
|
|
17052
|
+
inspection.migrationAvailable && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: "is-primary", disabled: busy, onClick: () => setConfirm(true), children: "\u5347\u7EA7\u8FC1\u79FB" })
|
|
17017
17053
|
] }),
|
|
17018
|
-
error && /* @__PURE__ */ (0,
|
|
17019
|
-
notice && /* @__PURE__ */ (0,
|
|
17020
|
-
reconnect && /* @__PURE__ */ (0,
|
|
17021
|
-
cleanup && /* @__PURE__ */ (0,
|
|
17054
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { role: "alert", children: error }),
|
|
17055
|
+
notice && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { role: "status", children: notice }),
|
|
17056
|
+
reconnect && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", disabled: busy, onClick: () => void recover(), children: "\u91CD\u65B0\u8FDE\u63A5" }),
|
|
17057
|
+
cleanup && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", disabled: busy, onClick: () => setConfirm(true), children: "\u91CD\u8BD5\u6E05\u7406\u65E7\u8DEF\u5F84" })
|
|
17022
17058
|
] }),
|
|
17023
|
-
confirm && /* @__PURE__ */ (0,
|
|
17059
|
+
confirm && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(WorkspaceDialog, { title: cleanup ? "\u786E\u8BA4\u6E05\u7406\u65E7\u8DEF\u5F84" : "\u786E\u8BA4\u5347\u7EA7\u8FC1\u79FB", detail: cleanup ? "\u91CD\u65B0\u6838\u5BF9\u5B8C\u6574\u5907\u4EFD\uFF0C\u53EA\u6E05\u7406\u672A\u53D8\u5316\u7684\u65E7\u6587\u4EF6\uFF0C\u4E0D\u91CD\u65B0\u8FC1\u79FB\u6D3B\u52A8\u6570\u636E\u3002" : "\u516C\u5171\u6570\u636E\u4E0E\u6240\u6709\u4F19\u4F34\u79C1\u6709\u6570\u636E\u5C06\u4E00\u8D77\u8FC1\u79FB\uFF0C\u5168\u90E8\u6821\u9A8C\u540E\u624D\u5207\u6362\u76EE\u5F55\u7248\u672C\u3002", close: () => {
|
|
17024
17060
|
if (!busy) setConfirm(false);
|
|
17025
|
-
}, children: /* @__PURE__ */ (0,
|
|
17061
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("form", { className: "dsh-partner-feature-form", onSubmit: (event) => {
|
|
17026
17062
|
event.preventDefault();
|
|
17027
17063
|
void migrate();
|
|
17028
17064
|
}, children: [
|
|
17029
|
-
/* @__PURE__ */ (0,
|
|
17030
|
-
/* @__PURE__ */ (0,
|
|
17031
|
-
/* @__PURE__ */ (0,
|
|
17032
|
-
/* @__PURE__ */ (0,
|
|
17033
|
-
/* @__PURE__ */ (0,
|
|
17065
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "is-wide", children: "\u5148\u5B8C\u6574\u5907\u4EFD\uFF0C\u7248\u672C\u63D0\u4EA4\u540E\u6E05\u7406\u5DF2\u6838\u9A8C\u7684\u65E7\u8DEF\u5F84\uFF1B\u5386\u53F2\u8BB0\u5FC6\u5907\u4EFD\u4F1A\u539F\u6837\u5F52\u6863\u3002\u5907\u4EFD\u4E0D\u4F1A\u81EA\u52A8\u5220\u9664\u3002\u8FC1\u79FB\u671F\u95F4\u8BF7\u52FF\u7F16\u8F91\u6587\u4EF6\u3001\u4FEE\u6539\u63D2\u4EF6\u914D\u7F6E\u6216\u542F\u52A8\u5176\u4ED6\u5B9E\u4F8B\u3002" }),
|
|
17066
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "is-wide", children: "\u8D26\u53F7\u51ED\u636E\u548C\u5BBF\u4E3B\u4F1A\u8BDD\u4E0D\u642C\u52A8\u3002\u5347\u7EA7\u540E\u4E0D\u8981\u76F4\u63A5\u5B89\u88C5\u4E0D\u652F\u6301\u65B0\u7248\u5B58\u50A8\u7684\u65E7\u63D2\u4EF6\u3002" }),
|
|
17067
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("footer", { children: [
|
|
17068
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", disabled: busy, onClick: () => setConfirm(false), children: "\u53D6\u6D88" }),
|
|
17069
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "submit", className: "is-primary", disabled: busy, children: busy ? "\u6B63\u5728\u5904\u7406\uFF0C\u8BF7\u52FF\u5173\u95ED\u2026" : cleanup ? "\u786E\u8BA4\u6E05\u7406\u5DF2\u5907\u4EFD\u7684\u65E7\u8DEF\u5F84" : "\u786E\u8BA4\u8FC1\u79FB\u76EE\u5F55\u548C\u6570\u636E" })
|
|
17034
17070
|
] })
|
|
17035
17071
|
] }) })
|
|
17036
17072
|
] });
|
|
17037
17073
|
}
|
|
17038
17074
|
|
|
17039
17075
|
// src/ui/workspace-navigation.tsx
|
|
17040
|
-
var
|
|
17076
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
17041
17077
|
var workspaceGroups = [
|
|
17042
|
-
{ id: "features", label: "\u529F\u80FD", detail: "\u80FD\u529B\u3001\u534F\u4F5C\u4E0E\u8BA1\u5212", icon:
|
|
17043
|
-
{ id: "skills", label: "Skill \u5E02\u573A", icon:
|
|
17044
|
-
{ id: "mcp", label: "MCP \u670D\u52A1", icon:
|
|
17045
|
-
{ id: "board", label: "\u4EFB\u52A1\u770B\u677F", icon:
|
|
17046
|
-
{ id: "schedules", label: "\u5B9A\u65F6\u4EFB\u52A1", icon:
|
|
17078
|
+
{ id: "features", label: "\u529F\u80FD", detail: "\u80FD\u529B\u3001\u534F\u4F5C\u4E0E\u8BA1\u5212", icon: import_dsh_client_ui_primitives24.IconBrowseOutlineRegular, pages: [
|
|
17079
|
+
{ id: "skills", label: "Skill \u5E02\u573A", icon: import_dsh_client_ui_primitives24.IconBrowseOutlineRegular },
|
|
17080
|
+
{ id: "mcp", label: "MCP \u670D\u52A1", icon: import_dsh_client_ui_primitives24.IconBrowseOutlineRegular },
|
|
17081
|
+
{ id: "board", label: "\u4EFB\u52A1\u770B\u677F", icon: import_dsh_client_ui_primitives24.IconListPenOutlineRegular },
|
|
17082
|
+
{ id: "schedules", label: "\u5B9A\u65F6\u4EFB\u52A1", icon: import_dsh_client_ui_primitives24.IconPlayOutlineRegular }
|
|
17047
17083
|
] },
|
|
17048
|
-
{ id: "settings", label: "\u8BBE\u7F6E", detail: "\u57FA\u672C\u8BBE\u7F6E\u4E0E\u5361\u7247\u5916\u89C2", icon:
|
|
17049
|
-
{ id: "general", label: "\u57FA\u672C\u8BBE\u7F6E", icon:
|
|
17050
|
-
{ id: "pendant", label: "\u5361\u7247\u8BBE\u7F6E", icon:
|
|
17084
|
+
{ id: "settings", label: "\u8BBE\u7F6E", detail: "\u57FA\u672C\u8BBE\u7F6E\u4E0E\u5361\u7247\u5916\u89C2", icon: import_dsh_client_ui_primitives24.IconEditOutlineRegular, pages: [
|
|
17085
|
+
{ id: "general", label: "\u57FA\u672C\u8BBE\u7F6E", icon: import_dsh_client_ui_primitives24.IconEditOutlineRegular },
|
|
17086
|
+
{ id: "pendant", label: "\u5361\u7247\u8BBE\u7F6E", icon: import_dsh_client_ui_primitives24.IconEditOutlineRegular }
|
|
17051
17087
|
] }
|
|
17052
17088
|
];
|
|
17053
17089
|
var workspaceGroup = (page) => workspaceGroups.find((group) => group.pages.some((item) => item.id === page));
|
|
17054
17090
|
function WorkspaceGroupLinks({ view, open, compact = false }) {
|
|
17055
17091
|
const active2 = workspaceGroup(view);
|
|
17056
|
-
return /* @__PURE__ */ (0,
|
|
17092
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_jsx_runtime47.Fragment, { children: workspaceGroups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("button", { type: "button", className: active2?.id === group.id ? "is-active" : "", "aria-current": active2?.id === group.id ? "page" : void 0, onClick: () => {
|
|
17057
17093
|
if (active2?.id !== group.id) open(group.pages[0].id);
|
|
17058
17094
|
}, children: [
|
|
17059
|
-
/* @__PURE__ */ (0,
|
|
17060
|
-
compact ? /* @__PURE__ */ (0,
|
|
17061
|
-
/* @__PURE__ */ (0,
|
|
17062
|
-
/* @__PURE__ */ (0,
|
|
17095
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(group.icon, { size: 16 }) }),
|
|
17096
|
+
compact ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: group.label }) : /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
17097
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("strong", { children: group.label }),
|
|
17098
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("small", { children: group.detail })
|
|
17063
17099
|
] })
|
|
17064
17100
|
] }, group.id)) });
|
|
17065
17101
|
}
|
|
17066
17102
|
function WorkspaceGroupTabs({ view, open }) {
|
|
17067
17103
|
const group = workspaceGroup(view);
|
|
17068
17104
|
if (!group) return null;
|
|
17069
|
-
return /* @__PURE__ */ (0,
|
|
17105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("nav", { className: "dsh-partner-tabs dsh-partner-group-tabs", "aria-label": `${group.label}\u6807\u7B7E\u9875`, children: group.pages.map((page) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TabButton, { active: view === page.id, onClick: () => open(page.id), icon: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(page.icon, { size: 16 }), children: page.label }, page.id)) });
|
|
17070
17106
|
}
|
|
17071
17107
|
|
|
17072
17108
|
// src/client.tsx
|
|
17073
|
-
var
|
|
17109
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
17074
17110
|
var PLUGIN_ID = "@lemoncat7/dsh-partner";
|
|
17075
17111
|
var STYLE_ID = `${PLUGIN_ID}/client`;
|
|
17076
17112
|
var cssText = `${client_default}
|
|
@@ -17088,26 +17124,26 @@ var WORKSPACE_PAGES = /* @__PURE__ */ new Set(["skills", "mcp", "board", "schedu
|
|
|
17088
17124
|
var inject = ["slots", "layout", "sessions", "uiWorkspace"];
|
|
17089
17125
|
function apply(ctx) {
|
|
17090
17126
|
ctx.effect(installStyles, "dsh-partner: styles");
|
|
17091
|
-
const controller = createPartnerController(ctx, PLUGIN_ID, (props, current2) => /* @__PURE__ */ (0,
|
|
17127
|
+
const controller = createPartnerController(ctx, PLUGIN_ID, (props, current2) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(PartnerWorkspace, { ...props, controller: current2 }));
|
|
17092
17128
|
if (pendingStorageRecovery() !== void 0) controller.open(void 0, { page: "general" });
|
|
17093
|
-
ctx.slots.inject("shell.overlay", () => ctx.slots.register({ name: "shell.overlay", id: "partner-pendant", order: 30 }, () => /* @__PURE__ */ (0,
|
|
17129
|
+
ctx.slots.inject("shell.overlay", () => ctx.slots.register({ name: "shell.overlay", id: "partner-pendant", order: 30 }, () => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(PartnerPendant, { controller })));
|
|
17094
17130
|
ctx.effect(() => observePluginWorkspace(PLUGIN_ID, controller.close), "dsh-partner: exclusive workspace");
|
|
17095
17131
|
ctx.effect(() => () => controller.close(), "dsh-partner: workspace lifecycle");
|
|
17096
17132
|
ctx.slots.inject("sidebar.footer.action", () => ctx.slots.register({
|
|
17097
17133
|
name: "sidebar.footer.action",
|
|
17098
17134
|
id: "partner",
|
|
17099
17135
|
order: -120
|
|
17100
|
-
}, (props) => /* @__PURE__ */ (0,
|
|
17136
|
+
}, (props) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(PartnerSidebar, { ...props, controller, collapse: () => ctx.layout.toggleSidebar() })));
|
|
17101
17137
|
}
|
|
17102
17138
|
function PartnerSidebar(props) {
|
|
17103
|
-
const ref = (0,
|
|
17139
|
+
const ref = (0, import_react52.useRef)(null);
|
|
17104
17140
|
useWorkspaceTopAnchor(ref);
|
|
17105
|
-
const [open, setOpen] = (0,
|
|
17106
|
-
const [snapshot, setSnapshot] = (0,
|
|
17141
|
+
const [open, setOpen] = (0, import_react52.useState)(true);
|
|
17142
|
+
const [snapshot, setSnapshot] = (0, import_react52.useState)();
|
|
17107
17143
|
useChannelStatus(setSnapshot);
|
|
17108
|
-
const [, update] = (0,
|
|
17109
|
-
(0,
|
|
17110
|
-
(0,
|
|
17144
|
+
const [, update] = (0, import_react52.useState)(0);
|
|
17145
|
+
(0, import_react52.useEffect)(() => props.controller.subscribe(() => update((value) => value + 1)), [props.controller]);
|
|
17146
|
+
(0, import_react52.useEffect)(() => {
|
|
17111
17147
|
void loadPartner().then(setSnapshot).catch(() => {
|
|
17112
17148
|
});
|
|
17113
17149
|
}, [props.controller.isOpen()]);
|
|
@@ -17115,35 +17151,35 @@ function PartnerSidebar(props) {
|
|
|
17115
17151
|
props.controller.open(id);
|
|
17116
17152
|
if (props.wide && window.matchMedia("(max-width: 820px)").matches) props.collapse();
|
|
17117
17153
|
};
|
|
17118
|
-
if (!props.wide) return /* @__PURE__ */ (0,
|
|
17119
|
-
return /* @__PURE__ */ (0,
|
|
17120
|
-
/* @__PURE__ */ (0,
|
|
17121
|
-
/* @__PURE__ */ (0,
|
|
17154
|
+
if (!props.wide) return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("section", { ref, className: "dsh-partner-sidebar is-rail", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", className: `dsh-partner-rail${props.controller.isOpen() ? " is-active" : ""}`, title: "\u4F19\u4F34", onClick: () => props.controller.toggle(), children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_dsh_client_ui_primitives25.IconAgentPresetOutlineRegular, { size: 18 }) }) });
|
|
17155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("section", { ref, className: "dsh-partner-sidebar", children: [
|
|
17156
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "dsh-partner-sidebar-heading", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("button", { type: "button", className: "dsh-partner-sidebar-title", "aria-expanded": open, onClick: () => setOpen((value) => !value), children: [
|
|
17157
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { "data-open": open, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_dsh_client_ui_primitives25.IconChevronDownOutlineRegular, { size: 14 }) }),
|
|
17122
17158
|
"\u4F19\u4F34"
|
|
17123
17159
|
] }) }),
|
|
17124
|
-
/* @__PURE__ */ (0,
|
|
17125
|
-
/* @__PURE__ */ (0,
|
|
17126
|
-
/* @__PURE__ */ (0,
|
|
17127
|
-
/* @__PURE__ */ (0,
|
|
17128
|
-
/* @__PURE__ */ (0,
|
|
17160
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: `dsh-partner-sidebar-list${open ? " is-open" : ""}`, "aria-hidden": !open, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "dsh-partner-sidebar-list-inner", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("button", { type: "button", tabIndex: open ? 0 : -1, className: `dsh-partner-sidebar-row${props.controller.isOpen() ? " is-active" : ""}`, onClick: () => launch(), children: [
|
|
17161
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "dsh-partner-sidebar-symbol", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_dsh_client_ui_primitives25.IconAgentPresetOutlineRegular, { size: 16 }) }),
|
|
17162
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { children: [
|
|
17163
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("strong", { children: "\u4F19\u4F34\u9762\u677F" }),
|
|
17164
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("small", { children: snapshot ? `${snapshot.companions.length} \u4F4D\u4F19\u4F34 \xB7 ${snapshot.channels.filter((item) => item.runtimeStatus === "running").length} \u4E2A\u6E20\u9053\u5728\u7EBF` : "\u8EAB\u4EFD\u3001\u80FD\u529B\u4E0E\u6E20\u9053" })
|
|
17129
17165
|
] }),
|
|
17130
|
-
/* @__PURE__ */ (0,
|
|
17166
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("i", { className: snapshot?.channels.some((item) => item.runtimeStatus === "running") ? "is-online" : "" })
|
|
17131
17167
|
] }) }) })
|
|
17132
17168
|
] });
|
|
17133
17169
|
}
|
|
17134
17170
|
function PartnerWorkspace({ controller }) {
|
|
17135
|
-
const [snapshot, setSnapshot] = (0,
|
|
17171
|
+
const [snapshot, setSnapshot] = (0, import_react52.useState)();
|
|
17136
17172
|
useChannelStatus(setSnapshot);
|
|
17137
|
-
const [selectedId, setSelectedId] = (0,
|
|
17138
|
-
const [view, setView] = (0,
|
|
17139
|
-
const [requestedDestination, setRequestedDestination] = (0,
|
|
17140
|
-
const [error, setError] = (0,
|
|
17141
|
-
const [loading, setLoading] = (0,
|
|
17142
|
-
const [creatingCompanion, setCreatingCompanion] = (0,
|
|
17143
|
-
const [notice, setNotice] = (0,
|
|
17144
|
-
const selectionRef = (0,
|
|
17173
|
+
const [selectedId, setSelectedId] = (0, import_react52.useState)(controller.selected());
|
|
17174
|
+
const [view, setView] = (0, import_react52.useState)(controller.destination()?.page ?? "home");
|
|
17175
|
+
const [requestedDestination, setRequestedDestination] = (0, import_react52.useState)(controller.destination());
|
|
17176
|
+
const [error, setError] = (0, import_react52.useState)();
|
|
17177
|
+
const [loading, setLoading] = (0, import_react52.useState)(true);
|
|
17178
|
+
const [creatingCompanion, setCreatingCompanion] = (0, import_react52.useState)(false);
|
|
17179
|
+
const [notice, setNotice] = (0, import_react52.useState)();
|
|
17180
|
+
const selectionRef = (0, import_react52.useRef)({ selectedId, companions: snapshot?.companions });
|
|
17145
17181
|
selectionRef.current = { selectedId, companions: snapshot?.companions };
|
|
17146
|
-
const refresh = (0,
|
|
17182
|
+
const refresh = (0, import_react52.useCallback)(async (throwOnError = false) => {
|
|
17147
17183
|
try {
|
|
17148
17184
|
const next = await loadPartner();
|
|
17149
17185
|
setSnapshot(next);
|
|
@@ -17156,10 +17192,10 @@ function PartnerWorkspace({ controller }) {
|
|
|
17156
17192
|
setLoading(false);
|
|
17157
17193
|
}
|
|
17158
17194
|
}, []);
|
|
17159
|
-
(0,
|
|
17195
|
+
(0, import_react52.useEffect)(() => {
|
|
17160
17196
|
void refresh();
|
|
17161
17197
|
}, [refresh]);
|
|
17162
|
-
(0,
|
|
17198
|
+
(0, import_react52.useEffect)(() => controller.subscribe(() => {
|
|
17163
17199
|
const next = controller.selected();
|
|
17164
17200
|
if (next) setSelectedId(next);
|
|
17165
17201
|
const destination = controller.destination();
|
|
@@ -17228,18 +17264,18 @@ function PartnerWorkspace({ controller }) {
|
|
|
17228
17264
|
setSelectedId(id);
|
|
17229
17265
|
setView("home");
|
|
17230
17266
|
};
|
|
17231
|
-
return /* @__PURE__ */ (0,
|
|
17232
|
-
creatingCompanion && /* @__PURE__ */ (0,
|
|
17233
|
-
/* @__PURE__ */ (0,
|
|
17234
|
-
/* @__PURE__ */ (0,
|
|
17235
|
-
/* @__PURE__ */ (0,
|
|
17236
|
-
/* @__PURE__ */ (0,
|
|
17237
|
-
/* @__PURE__ */ (0,
|
|
17238
|
-
/* @__PURE__ */ (0,
|
|
17239
|
-
/* @__PURE__ */ (0,
|
|
17267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("main", { className: "dsh-partner-workspace", children: [
|
|
17268
|
+
creatingCompanion && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(CompanionCreateDialog, { close: () => setCreatingCompanion(false), create }),
|
|
17269
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("header", { className: "dsh-partner-topbar", children: [
|
|
17270
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "dsh-partner-topbar-brand", children: [
|
|
17271
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", "data-xiaohei-workspace-close": true, onClick: controller.close, "aria-label": "\u8FD4\u56DE\u4F1A\u8BDD", title: "\u8FD4\u56DE\u4F1A\u8BDD", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_dsh_client_ui_primitives25.IconChevronLeftOutlineRegular, { size: 15 }) }),
|
|
17272
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_dsh_client_ui_primitives25.IconAgentPresetOutlineRegular, { size: 18 }),
|
|
17273
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { children: [
|
|
17274
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("strong", { children: "\u4F19\u4F34" }),
|
|
17275
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("small", { children: "\u957F\u671F\u8EAB\u4EFD\u4E0E\u6D88\u606F\u6E20\u9053" })
|
|
17240
17276
|
] })
|
|
17241
17277
|
] }),
|
|
17242
|
-
/* @__PURE__ */ (0,
|
|
17278
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
17243
17279
|
MobileWorkspaceControls,
|
|
17244
17280
|
{
|
|
17245
17281
|
companions: snapshot?.companions ?? [],
|
|
@@ -17251,87 +17287,90 @@ function PartnerWorkspace({ controller }) {
|
|
|
17251
17287
|
}
|
|
17252
17288
|
)
|
|
17253
17289
|
] }),
|
|
17254
|
-
/* @__PURE__ */ (0,
|
|
17255
|
-
/* @__PURE__ */ (0,
|
|
17256
|
-
/* @__PURE__ */ (0,
|
|
17257
|
-
/* @__PURE__ */ (0,
|
|
17258
|
-
/* @__PURE__ */ (0,
|
|
17259
|
-
/* @__PURE__ */ (0,
|
|
17290
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "dsh-partner-grid", children: [
|
|
17291
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("aside", { className: "dsh-partner-roster", children: [
|
|
17292
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "dsh-partner-roster-title", children: [
|
|
17293
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { children: [
|
|
17294
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("small", { children: "COMPANIONS" }),
|
|
17295
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("strong", { children: "\u4F19\u4F34\u540D\u518C" })
|
|
17260
17296
|
] }),
|
|
17261
|
-
/* @__PURE__ */ (0,
|
|
17297
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", onClick: () => setCreatingCompanion(true), "aria-label": "\u65B0\u5EFA\u4F19\u4F34", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_dsh_client_ui_primitives25.IconPlusOutlineRegular, { size: 16 }) })
|
|
17262
17298
|
] }),
|
|
17263
|
-
/* @__PURE__ */ (0,
|
|
17299
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "dsh-partner-roster-list", children: snapshot?.companions.map((companion) => {
|
|
17264
17300
|
const channel = snapshot.channels.find((item) => item.companionId === companion.id);
|
|
17265
|
-
return /* @__PURE__ */ (0,
|
|
17266
|
-
/* @__PURE__ */ (0,
|
|
17267
|
-
/* @__PURE__ */ (0,
|
|
17268
|
-
/* @__PURE__ */ (0,
|
|
17269
|
-
/* @__PURE__ */ (0,
|
|
17301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("button", { type: "button", className: !workspacePage && selectedId === companion.id ? "is-active" : "", onClick: () => openCompanion(companion.id), children: [
|
|
17302
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Avatar, { name: companion.name }),
|
|
17303
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { children: [
|
|
17304
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("strong", { children: companion.name }),
|
|
17305
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("small", { children: companion.role })
|
|
17270
17306
|
] }),
|
|
17271
|
-
/* @__PURE__ */ (0,
|
|
17307
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("i", { className: channel?.runtimeStatus === "running" ? "is-online" : "", title: channel ? channel.runtimeStatus : "\u672A\u8FDE\u63A5\u6E20\u9053" })
|
|
17272
17308
|
] }, companion.id);
|
|
17273
17309
|
}) }),
|
|
17274
|
-
/* @__PURE__ */ (0,
|
|
17275
|
-
/* @__PURE__ */ (0,
|
|
17276
|
-
/* @__PURE__ */ (0,
|
|
17277
|
-
/* @__PURE__ */ (0,
|
|
17278
|
-
/* @__PURE__ */ (0,
|
|
17279
|
-
/* @__PURE__ */ (0,
|
|
17310
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("nav", { className: "dsh-partner-workspace-nav", "aria-label": "\u4F19\u4F34\u5DE5\u4F5C\u533A", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(WorkspaceGroupLinks, { view, open: setView }) }),
|
|
17311
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "dsh-partner-roster-note", children: [
|
|
17312
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_dsh_client_ui_primitives25.IconLinkOutlineRegular, { size: 16 }),
|
|
17313
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { children: [
|
|
17314
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("strong", { children: "\u8EAB\u4EFD\u4E0E\u6E20\u9053\u5206\u79BB" }),
|
|
17315
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("small", { children: "\u6E20\u9053\u53EA\u8D1F\u8D23\u6536\u53D1\uFF0C\u6743\u9650\u4ECD\u7531 DSH \u5DE5\u5177\u51B3\u5B9A\u3002" })
|
|
17280
17316
|
] })
|
|
17281
17317
|
] })
|
|
17282
17318
|
] }),
|
|
17283
|
-
/* @__PURE__ */ (0,
|
|
17284
|
-
loading ? /* @__PURE__ */ (0,
|
|
17285
|
-
/* @__PURE__ */ (0,
|
|
17286
|
-
/* @__PURE__ */ (0,
|
|
17287
|
-
/* @__PURE__ */ (0,
|
|
17288
|
-
view === "skills" && /* @__PURE__ */ (0,
|
|
17289
|
-
view === "mcp" && /* @__PURE__ */ (0,
|
|
17290
|
-
view === "board" && /* @__PURE__ */ (0,
|
|
17291
|
-
view === "schedules" && /* @__PURE__ */ (0,
|
|
17292
|
-
view === "pendant" && /* @__PURE__ */ (0,
|
|
17293
|
-
view === "general" && /* @__PURE__ */ (0,
|
|
17319
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("section", { className: `dsh-partner-stage${workspacePage ? " is-workspace-page" : ""}`, children: [
|
|
17320
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ContentState, { title: "\u6B63\u5728\u8BFB\u53D6\u4F19\u4F34\u2026" }) : workspacePage ? /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
17321
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "dsh-partner-group-heading", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("h1", { children: workspaceGroup(view)?.label }) }),
|
|
17322
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(WorkspaceGroupTabs, { view, open: setView }),
|
|
17323
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "dsh-partner-stage-scroll is-workspace-page", children: [
|
|
17324
|
+
view === "skills" && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SkillsPanel, {}),
|
|
17325
|
+
view === "mcp" && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(McpPanel, {}),
|
|
17326
|
+
view === "board" && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(RequirementBoard, { initialTaskId: requestedDestination?.taskId, openRequest: requestedDestination }),
|
|
17327
|
+
view === "schedules" && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SchedulePanel, { companions: snapshot?.companions ?? [] }),
|
|
17328
|
+
view === "pendant" && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(PendantSettingsPanel, {}),
|
|
17329
|
+
view === "general" && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(GeneralSettingsPanel, {})
|
|
17294
17330
|
] })
|
|
17295
|
-
] }) : selected === void 0 ? /* @__PURE__ */ (0,
|
|
17296
|
-
/* @__PURE__ */ (0,
|
|
17297
|
-
/* @__PURE__ */ (0,
|
|
17298
|
-
/* @__PURE__ */ (0,
|
|
17299
|
-
/* @__PURE__ */ (0,
|
|
17300
|
-
/* @__PURE__ */ (0,
|
|
17301
|
-
/* @__PURE__ */ (0,
|
|
17331
|
+
] }) : selected === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ContentState, { title: "\u521B\u5EFA\u7B2C\u4E00\u4E2A\u4F19\u4F34", detail: "\u4F19\u4F34\u4F1A\u4FDD\u5B58\u72EC\u7ACB\u8EAB\u4EFD\u3001\u80FD\u529B\u548C\u5FAE\u4FE1\u4F1A\u8BDD\u3002", action: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { onClick: () => setCreatingCompanion(true), children: "\u65B0\u5EFA\u4F19\u4F34" }) }) : /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
17332
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "dsh-partner-identity", children: [
|
|
17333
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Avatar, { name: selected.name }),
|
|
17334
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { children: [
|
|
17335
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("small", { children: "ACTIVE COMPANION" }),
|
|
17336
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("h1", { children: selected.name }),
|
|
17337
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { children: selected.description || selected.role })
|
|
17302
17338
|
] }),
|
|
17303
|
-
/* @__PURE__ */ (0,
|
|
17339
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ChannelStatus, { channel: snapshot?.channels.find((item) => item.companionId === selected.id) })
|
|
17304
17340
|
] }),
|
|
17305
|
-
/* @__PURE__ */ (0,
|
|
17306
|
-
/* @__PURE__ */ (0,
|
|
17307
|
-
/* @__PURE__ */ (0,
|
|
17308
|
-
/* @__PURE__ */ (0,
|
|
17309
|
-
/* @__PURE__ */ (0,
|
|
17310
|
-
/* @__PURE__ */ (0,
|
|
17311
|
-
/* @__PURE__ */ (0,
|
|
17341
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("nav", { className: "dsh-partner-tabs", "aria-label": "\u4F19\u4F34\u914D\u7F6E", children: [
|
|
17342
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TabButton, { active: view === "home", onClick: () => setView("home"), icon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_dsh_client_ui_primitives25.IconAgentPresetOutlineRegular, { size: 16 }), children: "\u603B\u89C8" }),
|
|
17343
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TabButton, { active: view === "identity", onClick: () => setView("identity"), icon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_dsh_client_ui_primitives25.IconEditOutlineRegular, { size: 16 }), children: "\u8EAB\u4EFD" }),
|
|
17344
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TabButton, { active: view === "capabilities", onClick: () => setView("capabilities"), icon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_dsh_client_ui_primitives25.IconAgentPresetOutlineRegular, { size: 16 }), children: "\u80FD\u529B" }),
|
|
17345
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TabButton, { active: view === "weixin", onClick: () => setView("weixin"), icon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_dsh_client_ui_primitives25.IconLinkOutlineRegular, { size: 16 }), children: "\u6E20\u9053" }),
|
|
17346
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TabButton, { active: view === "memory", onClick: () => setView("memory"), icon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_dsh_client_ui_primitives25.IconDataOutlineRegular, { size: 16 }), children: "\u8BB0\u5FC6" }),
|
|
17347
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TabButton, { active: view === "concerns", onClick: () => setView("concerns"), icon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_dsh_client_ui_primitives25.IconBrowseOutlineRegular, { size: 16 }), children: "\u6301\u7EED\u5173\u6CE8" })
|
|
17312
17348
|
] }),
|
|
17313
|
-
/* @__PURE__ */ (0,
|
|
17314
|
-
notice && /* @__PURE__ */ (0,
|
|
17315
|
-
view === "home" && /* @__PURE__ */ (0,
|
|
17316
|
-
|
|
17317
|
-
|
|
17318
|
-
|
|
17319
|
-
view === "
|
|
17320
|
-
view === "
|
|
17349
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "dsh-partner-stage-scroll", children: [
|
|
17350
|
+
notice && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "dsh-partner-inline-notice", role: "status", children: notice }),
|
|
17351
|
+
view === "home" && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
17352
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(CompanionDeletion, { companion: selected, count: snapshot?.companions.length ?? 1, channelCount: snapshot.channels.filter((channel) => channel.companionId === selected.id).length, onRemoved: companionRemoved }, selected.id),
|
|
17353
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(HomePanel, { companion: selected, snapshot, navigate: setView, openSession, startSession, renewSession })
|
|
17354
|
+
] }),
|
|
17355
|
+
view === "identity" && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(IdentityEditor, { companion: selected, onChanged: () => refresh(true) }),
|
|
17356
|
+
view === "capabilities" && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(CapabilityEditor, { companion: selected, presets: snapshot?.presets ?? [], onChanged: () => refresh(true) }, selected.id),
|
|
17357
|
+
view === "weixin" && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ChannelsPanel, { companion: selected, snapshot, onChanged: refresh, weixin: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(WeixinPanel, { companion: selected, snapshot, onChanged: refresh }) }, selected.id),
|
|
17358
|
+
view === "memory" && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(MemoryPanel, { companion: selected, snapshot, openSession, startSession, renewSession, onChanged: refresh }, selected.id),
|
|
17359
|
+
view === "concerns" && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ConcernPanel, { companion: selected, snapshot, onChanged: refresh }, selected.id)
|
|
17321
17360
|
] })
|
|
17322
17361
|
] }),
|
|
17323
|
-
error && /* @__PURE__ */ (0,
|
|
17362
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "dsh-partner-error", role: "alert", children: error })
|
|
17324
17363
|
] })
|
|
17325
17364
|
] })
|
|
17326
17365
|
] });
|
|
17327
17366
|
}
|
|
17328
17367
|
function MobileWorkspaceControls({ companions, selectedId, view, openCompanion, openPage, createCompanion }) {
|
|
17329
|
-
return /* @__PURE__ */ (0,
|
|
17330
|
-
/* @__PURE__ */ (0,
|
|
17331
|
-
/* @__PURE__ */ (0,
|
|
17332
|
-
/* @__PURE__ */ (0,
|
|
17368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "dsh-partner-mobile-controls", children: [
|
|
17369
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "dsh-partner-mobile-companion-row", children: [
|
|
17370
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(CompanionPicker, { companions, selectedId, onChange: openCompanion }),
|
|
17371
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", className: "dsh-partner-mobile-create", onClick: createCompanion, "aria-label": "\u65B0\u5EFA\u4F19\u4F34", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_dsh_client_ui_primitives25.IconPlusOutlineRegular, { size: 17 }) })
|
|
17333
17372
|
] }),
|
|
17334
|
-
/* @__PURE__ */ (0,
|
|
17373
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("nav", { className: "dsh-partner-mobile-workspace-nav", "aria-label": "\u4F19\u4F34\u5DE5\u4F5C\u533A\u5FEB\u6377\u5165\u53E3", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(WorkspaceGroupLinks, { view, open: openPage, compact: true }) })
|
|
17335
17374
|
] });
|
|
17336
17375
|
}
|
|
17337
17376
|
function HomePanel({ companion, snapshot, navigate, openSession, startSession, renewSession }) {
|
|
@@ -17342,90 +17381,113 @@ function HomePanel({ companion, snapshot, navigate, openSession, startSession, r
|
|
|
17342
17381
|
const approved = channel ? snapshot.pairings.filter((item) => item.channelId === channel.id && item.status === "approved").length : 0;
|
|
17343
17382
|
const capabilities = companion.capabilities.map((item) => CAPABILITY_LABELS[item]);
|
|
17344
17383
|
const online = channel?.runtimeStatus === "running";
|
|
17345
|
-
return /* @__PURE__ */ (0,
|
|
17346
|
-
/* @__PURE__ */ (0,
|
|
17347
|
-
/* @__PURE__ */ (0,
|
|
17348
|
-
/* @__PURE__ */ (0,
|
|
17349
|
-
/* @__PURE__ */ (0,
|
|
17384
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "dsh-partner-home", children: [
|
|
17385
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("header", { className: "dsh-partner-home-heading", children: [
|
|
17386
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { children: [
|
|
17387
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("small", { children: "\u5DE5\u4F5C\u53F0" }),
|
|
17388
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("h2", { children: online ? `${companion.name} \u6B63\u5728\u6E20\u9053\u5F85\u547D` : `${companion.name} \u5DF2\u51C6\u5907\u5C31\u7EEA` })
|
|
17350
17389
|
] }),
|
|
17351
|
-
/* @__PURE__ */ (0,
|
|
17390
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { children: online ? "\u6D88\u606F\u3001\u6388\u6743\u4E0E\u4E0A\u4E0B\u6587\u8FB9\u754C\u90FD\u5728\u8FD9\u91CC\u6C47\u603B\u3002" : "\u4F19\u4F34\u8EAB\u4EFD\u3001\u4F1A\u8BDD\u4E0E\u80FD\u529B\u5DF2\u7ECF\u51C6\u5907\u5B8C\u6210\u3002" })
|
|
17352
17391
|
] }),
|
|
17353
|
-
/* @__PURE__ */ (0,
|
|
17354
|
-
/* @__PURE__ */ (0,
|
|
17355
|
-
/* @__PURE__ */ (0,
|
|
17356
|
-
/* @__PURE__ */ (0,
|
|
17357
|
-
/* @__PURE__ */ (0,
|
|
17392
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("section", { className: `dsh-partner-home-channel${online ? " is-online" : ""}`, children: [
|
|
17393
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "dsh-partner-home-route", "aria-hidden": "true", children: [
|
|
17394
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Avatar, { name: companion.name }),
|
|
17395
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "dsh-partner-route-line", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("i", {}) }),
|
|
17396
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "dsh-partner-route-weixin", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(WeixinGlyph, { large: true }) })
|
|
17358
17397
|
] }),
|
|
17359
|
-
/* @__PURE__ */ (0,
|
|
17360
|
-
/* @__PURE__ */ (0,
|
|
17361
|
-
/* @__PURE__ */ (0,
|
|
17398
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "dsh-partner-home-channel-copy", children: [
|
|
17399
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "dsh-partner-home-kicker", children: [
|
|
17400
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("i", {}),
|
|
17362
17401
|
"\u6D88\u606F\u6E20\u9053 \xB7 ",
|
|
17363
17402
|
channel?.platform === "matrix" ? "Matrix" : channel?.platform === "mattermost" ? "Mattermost" : "\u5FAE\u4FE1"
|
|
17364
17403
|
] }),
|
|
17365
|
-
/* @__PURE__ */ (0,
|
|
17366
|
-
/* @__PURE__ */ (0,
|
|
17367
|
-
/* @__PURE__ */ (0,
|
|
17368
|
-
/* @__PURE__ */ (0,
|
|
17369
|
-
/* @__PURE__ */ (0,
|
|
17404
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("h3", { children: !channel ? "\u7B49\u5F85\u626B\u7801\u8FDE\u63A5" : online ? "\u8FDE\u63A5\u6B63\u5E38\uFF0C\u6B63\u5728\u63A5\u6536\u6D88\u606F" : channel.runtimeStatus === "error" ? "\u6E20\u9053\u8FDE\u63A5\u9700\u8981\u5904\u7406" : "\u6E20\u9053\u5F53\u524D\u5DF2\u505C\u7528" }),
|
|
17405
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { children: !channel ? "\u8FDE\u63A5\u5FAE\u4FE1\u3001Matrix \u6216 Mattermost\uFF0C\u8054\u7CFB\u4EBA\u9996\u6B21\u53D1\u6D88\u606F\u9700\u6279\u51C6\u3002" : online ? "\u672C\u5730\u4E0E\u6240\u6709\u5DF2\u6388\u6743\u6E20\u9053\u5171\u7528\u4F19\u4F34\u4E3B\u5BF9\u8BDD\uFF0C\u56DE\u590D\u8FD4\u56DE\u6D88\u606F\u6765\u6E90\u3002" : channel.lastError || "\u6E20\u9053\u914D\u7F6E\u4ECD\u7136\u4FDD\u7559\uFF0C\u53EF\u4EE5\u968F\u65F6\u91CD\u65B0\u542F\u7528\u3002" }),
|
|
17406
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "dsh-partner-home-channel-actions", children: [
|
|
17407
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", className: "is-primary", onClick: () => navigate("weixin"), children: !channel ? "\u8FDE\u63A5\u5FAE\u4FE1" : pending > 0 ? `\u5904\u7406 ${pending} \u4E2A\u8BF7\u6C42` : "\u7BA1\u7406\u6E20\u9053" }),
|
|
17408
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { children: !channel ? "\u9009\u62E9\u6E20\u9053\u5E76\u8FDE\u63A5\u8D26\u53F7" : `${approved} \u4F4D\u8054\u7CFB\u4EBA \xB7 \u5171\u7528\u4E3B\u5BF9\u8BDD` })
|
|
17370
17409
|
] })
|
|
17371
17410
|
] })
|
|
17372
17411
|
] }),
|
|
17373
|
-
/* @__PURE__ */ (0,
|
|
17374
|
-
/* @__PURE__ */ (0,
|
|
17375
|
-
/* @__PURE__ */ (0,
|
|
17376
|
-
/* @__PURE__ */ (0,
|
|
17377
|
-
/* @__PURE__ */ (0,
|
|
17378
|
-
/* @__PURE__ */ (0,
|
|
17379
|
-
/* @__PURE__ */ (0,
|
|
17412
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "dsh-partner-home-details", children: [
|
|
17413
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("section", { className: "dsh-partner-home-profile", children: [
|
|
17414
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("header", { children: [
|
|
17415
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_dsh_client_ui_primitives25.IconUserOutlineRegular, { size: 16 }) }),
|
|
17416
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { children: [
|
|
17417
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("small", { children: "\u4F19\u4F34\u5E95\u7A3F" }),
|
|
17418
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("strong", { children: companion.role })
|
|
17380
17419
|
] }),
|
|
17381
|
-
/* @__PURE__ */ (0,
|
|
17420
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", onClick: () => navigate("identity"), children: "\u7F16\u8F91" })
|
|
17382
17421
|
] }),
|
|
17383
|
-
/* @__PURE__ */ (0,
|
|
17422
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("blockquote", { children: companion.instructions || companion.description || "\u5C1A\u672A\u8BBE\u7F6E\u957F\u671F\u884C\u4E3A\u51C6\u5219\u3002" })
|
|
17384
17423
|
] }),
|
|
17385
|
-
/* @__PURE__ */ (0,
|
|
17386
|
-
/* @__PURE__ */ (0,
|
|
17387
|
-
/* @__PURE__ */ (0,
|
|
17388
|
-
/* @__PURE__ */ (0,
|
|
17389
|
-
/* @__PURE__ */ (0,
|
|
17390
|
-
/* @__PURE__ */ (0,
|
|
17424
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("section", { className: "dsh-partner-home-runtime", children: [
|
|
17425
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("header", { children: [
|
|
17426
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_dsh_client_ui_primitives25.IconAgentPresetOutlineRegular, { size: 16 }) }),
|
|
17427
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { children: [
|
|
17428
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("small", { children: "\u8FD0\u884C\u80FD\u529B" }),
|
|
17429
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("strong", { children: companion.presetId || "DSH \u9ED8\u8BA4 Preset" })
|
|
17391
17430
|
] }),
|
|
17392
|
-
/* @__PURE__ */ (0,
|
|
17431
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", onClick: () => navigate("capabilities"), children: "\u8C03\u6574" })
|
|
17393
17432
|
] }),
|
|
17394
|
-
/* @__PURE__ */ (0,
|
|
17433
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "dsh-partner-home-capability-list", children: capabilities.length ? capabilities.map((item) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("em", { children: item }, item)) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("small", { children: "\u5C1A\u672A\u58F0\u660E\u80FD\u529B\u8303\u56F4" }) })
|
|
17395
17434
|
] }),
|
|
17396
|
-
/* @__PURE__ */ (0,
|
|
17397
|
-
/* @__PURE__ */ (0,
|
|
17398
|
-
/* @__PURE__ */ (0,
|
|
17399
|
-
/* @__PURE__ */ (0,
|
|
17400
|
-
/* @__PURE__ */ (0,
|
|
17401
|
-
/* @__PURE__ */ (0,
|
|
17435
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("section", { className: "dsh-partner-home-continuity", children: [
|
|
17436
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("header", { children: [
|
|
17437
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_dsh_client_ui_primitives25.IconDataOutlineRegular, { size: 16 }) }),
|
|
17438
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { children: [
|
|
17439
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("small", { children: "\u4F19\u4F34\u5BF9\u8BDD" }),
|
|
17440
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("strong", { children: localSession?.archived ? "\u4F1A\u8BDD\u5DF2\u5F52\u6863" : "\u4F19\u4F34\u4F1A\u8BDD\u5DF2\u5EFA\u7ACB" })
|
|
17402
17441
|
] }),
|
|
17403
|
-
/* @__PURE__ */ (0,
|
|
17442
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", onClick: () => localSession === void 0 ? void startSession(companion.id) : localSession.archived ? void renewSession(localSession.id) : void openSession(localSession.id, localSession.sessionId), children: localSession === void 0 ? "\u5F00\u59CB\u5BF9\u8BDD" : localSession.archived ? "\u5F00\u59CB\u65B0\u4F1A\u8BDD" : "\u6253\u5F00\u4F1A\u8BDD" })
|
|
17404
17443
|
] }),
|
|
17405
|
-
/* @__PURE__ */ (0,
|
|
17444
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { children: localSession ? `\u6700\u8FD1\u6D3B\u52A8\u4E8E ${relativeTime(localSession.lastMessageAt)}\uFF1B\u672C\u5730\u4E0E\u6E20\u9053\u5728\u8FD9\u91CC\u63A5\u7740\u804A\u3002` : "\u4F19\u4F34\u4F1A\u8BDD\u6B63\u5728\u521D\u59CB\u5316\uFF0C\u7A0D\u540E\u5373\u53EF\u6253\u5F00\u3002" })
|
|
17406
17445
|
] })
|
|
17407
17446
|
] })
|
|
17408
17447
|
] });
|
|
17409
17448
|
}
|
|
17410
17449
|
function WeixinPanel({ companion, snapshot, onChanged }) {
|
|
17411
17450
|
const channel = snapshot.channels.find((item) => item.companionId === companion.id && (!item.platform || item.platform === "weixin"));
|
|
17412
|
-
const [login, setLogin] = (0,
|
|
17413
|
-
const [busy, setBusy] = (0,
|
|
17414
|
-
const [error, setError] = (0,
|
|
17415
|
-
(0,
|
|
17451
|
+
const [login, setLogin] = (0, import_react52.useState)();
|
|
17452
|
+
const [busy, setBusy] = (0, import_react52.useState)(false);
|
|
17453
|
+
const [error, setError] = (0, import_react52.useState)();
|
|
17454
|
+
const loginGeneration = (0, import_react52.useRef)(0);
|
|
17455
|
+
const changedRef = (0, import_react52.useRef)(onChanged);
|
|
17456
|
+
changedRef.current = onChanged;
|
|
17457
|
+
(0, import_react52.useEffect)(() => {
|
|
17416
17458
|
if (!login || login.phase === "confirmed" || login.phase === "expired" || login.phase === "error") return;
|
|
17417
|
-
|
|
17418
|
-
|
|
17459
|
+
let disposed = false;
|
|
17460
|
+
let timer2;
|
|
17461
|
+
const generation = loginGeneration.current;
|
|
17462
|
+
const poll2 = async () => {
|
|
17463
|
+
try {
|
|
17464
|
+
const result = await api(`/weixin/login/${login.id}`);
|
|
17465
|
+
if (disposed || generation !== loginGeneration.current) return;
|
|
17466
|
+
setError(void 0);
|
|
17419
17467
|
setLogin(result.login);
|
|
17420
17468
|
if (result.channel) {
|
|
17421
17469
|
setLogin(void 0);
|
|
17422
|
-
await
|
|
17470
|
+
await changedRef.current();
|
|
17471
|
+
return;
|
|
17423
17472
|
}
|
|
17424
|
-
}
|
|
17473
|
+
} catch (reason) {
|
|
17474
|
+
if (!disposed && generation === loginGeneration.current) setError(errorMessage(reason));
|
|
17475
|
+
}
|
|
17476
|
+
if (!disposed && generation === loginGeneration.current) timer2 = window.setTimeout(() => {
|
|
17477
|
+
void poll2();
|
|
17478
|
+
}, 2e3);
|
|
17479
|
+
};
|
|
17480
|
+
timer2 = window.setTimeout(() => {
|
|
17481
|
+
void poll2();
|
|
17425
17482
|
}, 2e3);
|
|
17426
|
-
return () =>
|
|
17427
|
-
|
|
17483
|
+
return () => {
|
|
17484
|
+
disposed = true;
|
|
17485
|
+
clearTimeout(timer2);
|
|
17486
|
+
};
|
|
17487
|
+
}, [login?.id, login?.phase]);
|
|
17428
17488
|
const begin = async () => {
|
|
17489
|
+
loginGeneration.current += 1;
|
|
17490
|
+
setLogin(void 0);
|
|
17429
17491
|
setBusy(true);
|
|
17430
17492
|
setError(void 0);
|
|
17431
17493
|
try {
|
|
@@ -17458,93 +17520,102 @@ function WeixinPanel({ companion, snapshot, onChanged }) {
|
|
|
17458
17520
|
setError(errorMessage(reason));
|
|
17459
17521
|
}
|
|
17460
17522
|
};
|
|
17461
|
-
return /* @__PURE__ */ (0,
|
|
17462
|
-
/* @__PURE__ */ (0,
|
|
17463
|
-
!channel && !login && /* @__PURE__ */ (0,
|
|
17464
|
-
/* @__PURE__ */ (0,
|
|
17465
|
-
/* @__PURE__ */ (0,
|
|
17466
|
-
/* @__PURE__ */ (0,
|
|
17523
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "dsh-partner-form is-channel", children: [
|
|
17524
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SectionHeading, { eyebrow: "PRIMARY CHANNEL", title: "\u5FAE\u4FE1\u6E20\u9053", detail: "\u4F7F\u7528\u5FAE\u4FE1 iLink Bot \u626B\u7801\u63A5\u5165\u3002\u6BCF\u4E2A\u673A\u5668\u4EBA\u53EA\u7ED1\u5B9A\u4E00\u4E2A\u4F19\u4F34\uFF0C\u6BCF\u4F4D\u8054\u7CFB\u4EBA\u4FDD\u6301\u72EC\u7ACB DSH \u4F1A\u8BDD\u3002" }),
|
|
17525
|
+
!channel && !login && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(GlassSurface, { as: "div", interactive: true, className: "dsh-partner-weixin-connect", borderRadius: 15, distortionScale: -10, saturation: 1.06, children: [
|
|
17526
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "dsh-partner-weixin-mark", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(WeixinGlyph, { large: true }) }),
|
|
17527
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { children: [
|
|
17528
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("strong", { children: [
|
|
17467
17529
|
"\u628A ",
|
|
17468
17530
|
companion.name,
|
|
17469
17531
|
" \u5E26\u5230\u5FAE\u4FE1"
|
|
17470
17532
|
] }),
|
|
17471
|
-
/* @__PURE__ */ (0,
|
|
17472
|
-
/* @__PURE__ */ (0,
|
|
17473
|
-
/* @__PURE__ */ (0,
|
|
17474
|
-
/* @__PURE__ */ (0,
|
|
17475
|
-
/* @__PURE__ */ (0,
|
|
17533
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { children: "\u626B\u7801\u540E\uFF0C\u673A\u5668\u4EBA\u51ED\u636E\u76F4\u63A5\u4FDD\u5B58\u8FDB DSH \u51ED\u636E\u5E93\uFF0C\u4E0D\u4F1A\u663E\u793A\u5728\u6D4F\u89C8\u5668\u6216\u666E\u901A\u914D\u7F6E\u6587\u4EF6\u4E2D\u3002" }),
|
|
17534
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("ul", { children: [
|
|
17535
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("li", { children: "\u79C1\u804A\u9996\u6B21\u8054\u7CFB\u5FC5\u987B\u5BA1\u6279" }),
|
|
17536
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("li", { children: "\u8054\u7CFB\u4EBA\u4E4B\u95F4\u4E0A\u4E0B\u6587\u5B8C\u5168\u9694\u79BB" }),
|
|
17537
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("li", { children: "\u5DE5\u5177\u6743\u9650\u4E0D\u4F1A\u56E0\u5FAE\u4FE1\u8EAB\u4EFD\u81EA\u52A8\u6269\u5927" })
|
|
17476
17538
|
] })
|
|
17477
17539
|
] }),
|
|
17478
|
-
/* @__PURE__ */ (0,
|
|
17540
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", disabled: busy, onClick: () => {
|
|
17479
17541
|
void begin();
|
|
17480
17542
|
}, children: busy ? "\u6B63\u5728\u7533\u8BF7\u4E8C\u7EF4\u7801\u2026" : "\u626B\u7801\u8FDE\u63A5\u5FAE\u4FE1" })
|
|
17481
17543
|
] }),
|
|
17482
|
-
login && /* @__PURE__ */ (0,
|
|
17483
|
-
/* @__PURE__ */ (0,
|
|
17484
|
-
/* @__PURE__ */ (0,
|
|
17485
|
-
/* @__PURE__ */ (0,
|
|
17486
|
-
/* @__PURE__ */ (0,
|
|
17487
|
-
/* @__PURE__ */ (0,
|
|
17488
|
-
(login.phase === "expired" || login.phase === "error") && /* @__PURE__ */ (0,
|
|
17544
|
+
login && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(GlassSurface, { as: "div", interactive: true, className: "dsh-partner-qr", borderRadius: 16, distortionScale: -10, saturation: 1.06, children: [
|
|
17545
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "dsh-partner-qr-code", children: login.qrContent && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(QRCodeSVG, { value: login.qrContent, size: 176, level: "M" }) }),
|
|
17546
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { children: [
|
|
17547
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("small", { children: "WECHAT ILINK BOT" }),
|
|
17548
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("strong", { children: login.phase === "scanned" ? "\u5DF2\u626B\u7801\uFF0C\u8BF7\u5728\u5FAE\u4FE1\u786E\u8BA4" : login.phase === "expired" ? "\u4E8C\u7EF4\u7801\u5DF2\u8FC7\u671F" : login.phase === "error" ? "\u8FDE\u63A5\u5931\u8D25" : "\u4F7F\u7528\u5FAE\u4FE1\u626B\u7801" }),
|
|
17549
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { children: login.error || (login.phase === "scanned" ? "\u786E\u8BA4\u540E\u4F1A\u81EA\u52A8\u542F\u52A8\u6E20\u9053\uFF0C\u4E0D\u9700\u8981\u590D\u5236 Token\u3002" : "\u4E8C\u7EF4\u7801\u7EA6 5 \u5206\u949F\u6709\u6548\u3002\u6B64\u9875\u9762\u53EF\u4EE5\u5B89\u5168\u5730\u4FDD\u6301\u6253\u5F00\u3002") }),
|
|
17550
|
+
(login.phase === "expired" || login.phase === "error") && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("button", { type: "button", onClick: () => {
|
|
17489
17551
|
setLogin(void 0);
|
|
17490
17552
|
void begin();
|
|
17491
17553
|
}, children: [
|
|
17492
|
-
/* @__PURE__ */ (0,
|
|
17554
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_dsh_client_ui_primitives25.IconRefreshOutlineRegular, { size: 16 }),
|
|
17493
17555
|
"\u91CD\u65B0\u751F\u6210"
|
|
17494
17556
|
] })
|
|
17495
17557
|
] })
|
|
17496
17558
|
] }),
|
|
17497
|
-
channel && /* @__PURE__ */ (0,
|
|
17498
|
-
/* @__PURE__ */ (0,
|
|
17499
|
-
/* @__PURE__ */ (0,
|
|
17500
|
-
/* @__PURE__ */ (0,
|
|
17501
|
-
/* @__PURE__ */ (0,
|
|
17502
|
-
/* @__PURE__ */ (0,
|
|
17503
|
-
/* @__PURE__ */ (0,
|
|
17559
|
+
channel && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
17560
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(GlassSurface, { as: "div", interactive: true, className: "dsh-partner-channel-card", borderRadius: 14, distortionScale: -10, saturation: 1.06, children: [
|
|
17561
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "dsh-partner-weixin-mark", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(WeixinGlyph, { large: true }) }),
|
|
17562
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { children: [
|
|
17563
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("small", { children: "WECHAT CHANNEL" }),
|
|
17564
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("strong", { children: channel.name }),
|
|
17565
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { children: channel.accountId })
|
|
17504
17566
|
] }),
|
|
17505
|
-
/* @__PURE__ */ (0,
|
|
17506
|
-
/* @__PURE__ */ (0,
|
|
17507
|
-
|
|
17508
|
-
|
|
17567
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ChannelStatus, { channel }),
|
|
17568
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "dsh-partner-weixin-actions", children: [
|
|
17569
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", className: "dsh-partner-switch", "data-on": channel.enabled, disabled: busy, role: "switch", "aria-checked": channel.enabled, "aria-label": channel.enabled ? "\u505C\u7528\u5FAE\u4FE1\u6E20\u9053" : "\u542F\u7528\u5FAE\u4FE1\u6E20\u9053", onClick: () => {
|
|
17570
|
+
void toggle();
|
|
17571
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("i", {}) }),
|
|
17572
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("button", { type: "button", className: "dsh-partner-weixin-rescan", disabled: busy, title: "\u66F4\u65B0\u5F53\u524D\u673A\u5668\u4EBA\u7684\u767B\u5F55\u51ED\u636E\uFF0C\u4FDD\u7559\u8054\u7CFB\u4EBA\u6388\u6743", onClick: () => {
|
|
17573
|
+
void begin();
|
|
17574
|
+
}, children: [
|
|
17575
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_dsh_client_ui_primitives25.IconRefreshOutlineRegular, { size: 16 }),
|
|
17576
|
+
busy ? "\u8BF7\u7A0D\u5019\u2026" : "\u91CD\u65B0\u626B\u7801"
|
|
17577
|
+
] })
|
|
17578
|
+
] })
|
|
17509
17579
|
] }),
|
|
17510
|
-
channel.lastError && /* @__PURE__ */ (0,
|
|
17511
|
-
/* @__PURE__ */ (0,
|
|
17512
|
-
|
|
17513
|
-
|
|
17514
|
-
/* @__PURE__ */ (0,
|
|
17580
|
+
channel.enabled && channel.runtimeStatus === "starting" && !channel.lastError && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "dsh-partner-weixin-help", role: "status", children: "\u767B\u5F55\u51ED\u636E\u5DF2\u4FDD\u5B58\uFF0C\u6B63\u5728\u7B49\u5F85\u5FAE\u4FE1\u63A5\u6536\u901A\u9053\u9996\u6B21\u54CD\u5E94\u3002\u957F\u8F6E\u8BE2\u53EF\u80FD\u9700\u8981\u51E0\u5341\u79D2\uFF1B\u5411\u673A\u5668\u4EBA\u53D1\u9001\u4E00\u6761\u6D88\u606F\u53EF\u5E2E\u52A9\u786E\u8BA4\u6536\u53D1\u662F\u5426\u6B63\u5E38\uFF0C\u65E0\u9700\u91CD\u590D\u626B\u7801\u3002" }),
|
|
17581
|
+
channel.lastError && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "dsh-partner-inline-error", children: channel.lastError }),
|
|
17582
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "dsh-partner-pairing-heading", children: [
|
|
17583
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { children: [
|
|
17584
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("small", { children: "ACCESS" }),
|
|
17585
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("strong", { children: "\u79C1\u804A\u914D\u5BF9" })
|
|
17515
17586
|
] }),
|
|
17516
|
-
/* @__PURE__ */ (0,
|
|
17587
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("em", { children: [
|
|
17517
17588
|
pairings.filter((item) => item.status === "pending").length,
|
|
17518
17589
|
" \u4E2A\u5F85\u5904\u7406"
|
|
17519
17590
|
] })
|
|
17520
17591
|
] }),
|
|
17521
|
-
/* @__PURE__ */ (0,
|
|
17522
|
-
/* @__PURE__ */ (0,
|
|
17523
|
-
/* @__PURE__ */ (0,
|
|
17524
|
-
/* @__PURE__ */ (0,
|
|
17525
|
-
/* @__PURE__ */ (0,
|
|
17592
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "dsh-partner-pairings", children: pairings.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ContentState, { title: "\u7B49\u5F85\u9996\u6B21\u6D88\u606F", detail: "\u626B\u7801\u53EA\u5B8C\u6210\u673A\u5668\u4EBA\u767B\u5F55\uFF0C\u4E0D\u4F1A\u81EA\u52A8\u6388\u6743\u8054\u7CFB\u4EBA\u3002\u8BF7\u5148\u5728\u5FAE\u4FE1\u5411\u673A\u5668\u4EBA\u53D1\u9001\u4E00\u6761\u6D88\u606F\uFF0C\u518D\u56DE\u5230\u8FD9\u91CC\u70B9\u51FB\u300C\u6279\u51C6\u300D\uFF0C\u4E4B\u540E\u5373\u53EF\u5BF9\u8BDD\u3002", compact: true }) : pairings.map((pairing) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("article", { children: [
|
|
17593
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: `is-${pairing.status}`, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_dsh_client_ui_primitives25.IconUserOutlineRegular, { size: 16 }) }),
|
|
17594
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { children: [
|
|
17595
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("strong", { children: pairing.displayName }),
|
|
17596
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("small", { children: [
|
|
17526
17597
|
pairing.status === "pending" ? "\u7B49\u5F85\u5BA1\u6279" : pairing.status === "approved" ? "\u5DF2\u6388\u6743\u72EC\u7ACB\u4F1A\u8BDD" : "\u5DF2\u963B\u6B62",
|
|
17527
17598
|
" \xB7 ",
|
|
17528
17599
|
new Date(pairing.updatedAt).toLocaleString()
|
|
17529
17600
|
] })
|
|
17530
17601
|
] }),
|
|
17531
|
-
pairing.status === "pending" && /* @__PURE__ */ (0,
|
|
17532
|
-
/* @__PURE__ */ (0,
|
|
17602
|
+
pairing.status === "pending" && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
17603
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { onClick: () => {
|
|
17533
17604
|
void actPairing(pairing.id, "blocked");
|
|
17534
17605
|
}, children: "\u62D2\u7EDD" }),
|
|
17535
|
-
/* @__PURE__ */ (0,
|
|
17606
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { className: "is-primary", onClick: () => {
|
|
17536
17607
|
void actPairing(pairing.id, "approved");
|
|
17537
17608
|
}, children: "\u6279\u51C6" })
|
|
17538
17609
|
] }),
|
|
17539
|
-
pairing.status === "approved" && /* @__PURE__ */ (0,
|
|
17610
|
+
pairing.status === "approved" && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { onClick: () => {
|
|
17540
17611
|
void actPairing(pairing.id, "blocked");
|
|
17541
17612
|
}, children: "\u64A4\u9500" }),
|
|
17542
|
-
pairing.status === "blocked" && /* @__PURE__ */ (0,
|
|
17613
|
+
pairing.status === "blocked" && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { onClick: () => {
|
|
17543
17614
|
void actPairing(pairing.id, "approved");
|
|
17544
17615
|
}, children: "\u91CD\u65B0\u6279\u51C6" })
|
|
17545
17616
|
] }, pairing.id)) })
|
|
17546
17617
|
] }),
|
|
17547
|
-
error && /* @__PURE__ */ (0,
|
|
17618
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "dsh-partner-inline-error", children: error })
|
|
17548
17619
|
] });
|
|
17549
17620
|
}
|
|
17550
17621
|
function installStyles() {
|