dsh-plugin-lark-bridge 0.1.1 → 0.1.3
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 +45 -26
- package/cordis.patch.yml +2 -12
- package/dist/auth.d.ts +12 -47
- package/dist/auth.d.ts.map +1 -1
- package/dist/bridge.d.ts +6 -6
- package/dist/bridge.d.ts.map +1 -1
- package/dist/cli.d.ts +17 -21
- package/dist/cli.d.ts.map +1 -1
- package/dist/client/api.d.ts +9 -36
- package/dist/client/api.d.ts.map +1 -1
- package/dist/client/auth-overlay.d.ts +54 -6
- package/dist/client/auth-overlay.d.ts.map +1 -1
- package/dist/client/auth-panel.d.ts +17 -5
- package/dist/client/auth-panel.d.ts.map +1 -1
- package/dist/client/config-form.d.ts +2 -15
- package/dist/client/config-form.d.ts.map +1 -1
- package/dist/client/config-page.d.ts +32 -6
- package/dist/client/config-page.d.ts.map +1 -1
- package/dist/client/index.d.ts +2 -8
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/locales.d.ts +23 -55
- package/dist/client/locales.d.ts.map +1 -1
- package/dist/client/status-controller.d.ts +43 -0
- package/dist/client/status-controller.d.ts.map +1 -0
- package/dist/client/terminal-command.d.ts +11 -0
- package/dist/client/terminal-command.d.ts.map +1 -0
- package/dist/client.js +776 -835
- package/dist/config.d.ts +6 -28
- package/dist/config.d.ts.map +1 -1
- package/dist/constants.d.ts +2 -6
- package/dist/constants.d.ts.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +434 -604
- package/dist/message.d.ts +27 -0
- package/dist/message.d.ts.map +1 -0
- package/dist/reminder.d.ts +33 -0
- package/dist/reminder.d.ts.map +1 -0
- package/dist/routes.d.ts +5 -15
- package/dist/routes.d.ts.map +1 -1
- package/dist/sessions.d.ts +12 -13
- package/dist/sessions.d.ts.map +1 -1
- package/dist/state.d.ts +0 -2
- package/dist/state.d.ts.map +1 -1
- package/dist/tools.d.ts +0 -2
- package/dist/tools.d.ts.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +3 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/workspace-path.d.ts +8 -0
- package/dist/workspace-path.d.ts.map +1 -0
- package/dist/workspace.d.ts +32 -0
- package/dist/workspace.d.ts.map +1 -0
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +6 -5
package/dist/client.js
CHANGED
|
@@ -7,12 +7,39 @@ window.__ModuleLoader__.load({
|
|
|
7
7
|
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
8
8
|
let react = require("react");
|
|
9
9
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
+
//#region src/workspace-path.ts
|
|
11
|
+
/** 工作区路径:统一 Linux 风格表示、平台比较与 Host 原生路径转换。 */
|
|
12
|
+
/** 判断原始或归一化路径是否使用 Windows 语义。 */
|
|
13
|
+
function isWindowsPath(value) {
|
|
14
|
+
return /^(?:[A-Za-z]:[\\/]|\\\\|\/\/|\/[A-Za-z](?:\/|$))/.test(value);
|
|
15
|
+
}
|
|
16
|
+
/** 统一斜杠、末尾分隔符与 Windows 盘符,例如 `C:\work\demo` 转为 `/c/work/demo`。 */
|
|
17
|
+
function normalizeWorkspacePath(value) {
|
|
18
|
+
const slashed = value.trim().replaceAll("\\", "/");
|
|
19
|
+
if (slashed === "") return "";
|
|
20
|
+
const drive = /^([A-Za-z]):(?:\/+(.*))?$/.exec(slashed);
|
|
21
|
+
if (drive !== null) {
|
|
22
|
+
const rest = (drive[2] ?? "").replace(/\/{2,}/g, "/").replace(/\/+$/, "");
|
|
23
|
+
return `/${drive[1]?.toLowerCase()}${rest === "" ? "" : `/${rest}`}`;
|
|
24
|
+
}
|
|
25
|
+
const unc = slashed.startsWith("//");
|
|
26
|
+
const collapsed = slashed.replace(/\/{2,}/g, "/");
|
|
27
|
+
const withoutTrailing = collapsed.length > 1 ? collapsed.replace(/\/+$/, "") : collapsed;
|
|
28
|
+
return unc ? `/${withoutTrailing}` : withoutTrailing;
|
|
29
|
+
}
|
|
30
|
+
/** 比较工作区路径;Windows 忽略大小写,POSIX 保持大小写敏感。 */
|
|
31
|
+
function sameWorkspacePath(a, b) {
|
|
32
|
+
const left = normalizeWorkspacePath(a);
|
|
33
|
+
const right = normalizeWorkspacePath(b);
|
|
34
|
+
return isWindowsPath(a) || isWindowsPath(b) ? left.toLowerCase() === right.toLowerCase() : left === right;
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
10
37
|
//#region src/client/api.ts
|
|
11
38
|
/** 构造路由地址。 */
|
|
12
39
|
function endpoint(path) {
|
|
13
40
|
return `${window.location.origin}/lark-bridge/${path}`;
|
|
14
41
|
}
|
|
15
|
-
/** 发起一次 JSON
|
|
42
|
+
/** 发起一次 JSON 调用;网络失败映射为内部结果。 */
|
|
16
43
|
async function callApi(path, init = {}, signal) {
|
|
17
44
|
try {
|
|
18
45
|
const text = await (await fetch(endpoint(path), {
|
|
@@ -59,492 +86,276 @@ window.__ModuleLoader__.load({
|
|
|
59
86
|
};
|
|
60
87
|
}
|
|
61
88
|
}
|
|
62
|
-
/**
|
|
89
|
+
/** 读取最近一次连接状态。 */
|
|
63
90
|
function fetchStatus(signal) {
|
|
64
91
|
return callApi("status", { method: "GET" }, signal);
|
|
65
92
|
}
|
|
66
|
-
/**
|
|
93
|
+
/** 执行一次完整检测。 */
|
|
67
94
|
function checkAuth() {
|
|
68
95
|
return callApi("check", {
|
|
69
96
|
method: "POST",
|
|
70
97
|
body: "{}"
|
|
71
98
|
});
|
|
72
99
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region src/client/status-controller.ts
|
|
102
|
+
/** 共享连接状态控制器:完整检测、只读轮询、订阅与清理。 */
|
|
103
|
+
const INITIAL_STATUS = {
|
|
104
|
+
cli: "checking",
|
|
105
|
+
bot: "checking",
|
|
106
|
+
user: "checking",
|
|
107
|
+
ready: false,
|
|
108
|
+
checkedAt: 0
|
|
109
|
+
};
|
|
110
|
+
/** 共享一份状态,避免弹窗与配置页分别执行检测。 */
|
|
111
|
+
var StatusController = class {
|
|
112
|
+
options;
|
|
113
|
+
fetchStatus;
|
|
114
|
+
checkAuth;
|
|
115
|
+
snapshot = {
|
|
116
|
+
status: INITIAL_STATUS,
|
|
117
|
+
busy: false
|
|
118
|
+
};
|
|
119
|
+
listeners = /* @__PURE__ */ new Set();
|
|
120
|
+
timer;
|
|
121
|
+
checking;
|
|
122
|
+
generation = 0;
|
|
123
|
+
disposed = false;
|
|
124
|
+
constructor(options = {}) {
|
|
125
|
+
this.options = options;
|
|
126
|
+
this.fetchStatus = options.fetchStatus ?? fetchStatus;
|
|
127
|
+
this.checkAuth = options.checkAuth ?? checkAuth;
|
|
128
|
+
if (options.autoStart !== false) this.start();
|
|
129
|
+
}
|
|
130
|
+
/** 当前状态快照。 */
|
|
131
|
+
getSnapshot = () => this.snapshot;
|
|
132
|
+
/** 订阅状态变化。 */
|
|
133
|
+
subscribe(listener) {
|
|
134
|
+
this.listeners.add(listener);
|
|
135
|
+
return () => this.listeners.delete(listener);
|
|
136
|
+
}
|
|
137
|
+
/** 开始加载检测和只读轮询。 */
|
|
138
|
+
start() {
|
|
139
|
+
if (this.disposed || this.timer !== void 0) return;
|
|
140
|
+
this.timer = setInterval(() => {
|
|
141
|
+
this.refresh();
|
|
142
|
+
}, this.options.intervalMs ?? 3e3);
|
|
143
|
+
this.check();
|
|
144
|
+
}
|
|
145
|
+
/** 完整检测;并发调用共享同一次请求。 */
|
|
146
|
+
check() {
|
|
147
|
+
if (this.checking !== void 0) return this.checking;
|
|
148
|
+
const generation = ++this.generation;
|
|
149
|
+
this.publish({
|
|
150
|
+
...this.snapshot,
|
|
151
|
+
busy: true
|
|
152
|
+
});
|
|
153
|
+
this.checking = this.checkAuth().then((result) => {
|
|
154
|
+
if (!this.disposed && generation === this.generation && result.ok) this.publish({
|
|
155
|
+
status: result.data,
|
|
156
|
+
busy: false
|
|
157
|
+
});
|
|
158
|
+
}).finally(() => {
|
|
159
|
+
if (generation === this.generation) {
|
|
160
|
+
this.checking = void 0;
|
|
161
|
+
if (!this.disposed && this.snapshot.busy) this.publish({
|
|
162
|
+
...this.snapshot,
|
|
163
|
+
busy: false
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
return this.checking;
|
|
168
|
+
}
|
|
169
|
+
/** 停止轮询并使未完成的请求结果失效。 */
|
|
170
|
+
dispose() {
|
|
171
|
+
this.disposed = true;
|
|
172
|
+
this.generation += 1;
|
|
173
|
+
if (this.timer !== void 0) clearInterval(this.timer);
|
|
174
|
+
this.timer = void 0;
|
|
175
|
+
this.checking = void 0;
|
|
176
|
+
this.listeners.clear();
|
|
177
|
+
}
|
|
178
|
+
async refresh() {
|
|
179
|
+
if (this.disposed || this.checking !== void 0) return;
|
|
180
|
+
const generation = this.generation;
|
|
181
|
+
const result = await this.fetchStatus();
|
|
182
|
+
if (!this.disposed && generation === this.generation && result.ok) this.publish({
|
|
183
|
+
...this.snapshot,
|
|
184
|
+
status: result.data
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
publish(next) {
|
|
188
|
+
if (this.disposed) return;
|
|
189
|
+
this.snapshot = next;
|
|
190
|
+
for (const listener of this.listeners) listener(next);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
/** 在 React 组件中订阅共享状态。 */
|
|
194
|
+
function useStatusSnapshot(controller) {
|
|
195
|
+
return (0, react.useSyncExternalStore)((listener) => controller.subscribe(() => listener()), controller.getSnapshot, controller.getSnapshot);
|
|
89
196
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
197
|
+
//#endregion
|
|
198
|
+
//#region src/client/terminal-command.tsx
|
|
199
|
+
/** 只读终端命令:展示需要在插件外执行的命令,并在右侧提供复制。 */
|
|
200
|
+
/** 展示一条可选择文本的只读命令与复制按钮。 */
|
|
201
|
+
function TerminalCommand({ kind, command, t }) {
|
|
202
|
+
const { copied, onCopy } = (0, _deepseek_ai_dsh_client_ui_primitives.useClipboardCopy)(command);
|
|
203
|
+
const label = copied ? t("auth.command.copied") : t("auth.command.copy");
|
|
204
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
205
|
+
style: rowStyle$1,
|
|
206
|
+
"data-dsh-lark-command-row": kind,
|
|
207
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
|
|
208
|
+
"data-dsh-lark-command": kind,
|
|
209
|
+
style: commandStyle,
|
|
210
|
+
children: command
|
|
211
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
212
|
+
type: "button",
|
|
213
|
+
variant: "ghost",
|
|
214
|
+
size: "sm",
|
|
215
|
+
style: copyButtonStyle,
|
|
216
|
+
"aria-label": label,
|
|
217
|
+
title: label,
|
|
218
|
+
"data-copied": copied ? "" : void 0,
|
|
219
|
+
icon: copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCheckOutlineRegular, { size: 16 }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopyIcon, {}),
|
|
220
|
+
onClick: onCopy
|
|
221
|
+
})]
|
|
95
222
|
});
|
|
96
223
|
}
|
|
97
|
-
/**
|
|
98
|
-
function
|
|
99
|
-
return
|
|
100
|
-
|
|
101
|
-
|
|
224
|
+
/** 复制图标:宿主没有对应图标,用 16px 描边 SVG。 */
|
|
225
|
+
function CopyIcon() {
|
|
226
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
227
|
+
viewBox: "0 0 16 16",
|
|
228
|
+
width: 16,
|
|
229
|
+
height: 16,
|
|
230
|
+
fill: "none",
|
|
231
|
+
stroke: "currentColor",
|
|
232
|
+
strokeWidth: 1.3,
|
|
233
|
+
strokeLinecap: "round",
|
|
234
|
+
strokeLinejoin: "round",
|
|
235
|
+
"aria-hidden": "true",
|
|
236
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
237
|
+
x: "5.75",
|
|
238
|
+
y: "5.75",
|
|
239
|
+
width: "7.5",
|
|
240
|
+
height: "7.5",
|
|
241
|
+
rx: "1.5"
|
|
242
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M10.25 3.25h-4.5A1.5 1.5 0 0 0 4.25 4.75v4.5" })]
|
|
102
243
|
});
|
|
103
244
|
}
|
|
104
|
-
|
|
105
|
-
//#region src/client/auth-overlay.tsx
|
|
106
|
-
/**
|
|
107
|
-
* 全局鉴权弹窗:每次打开 GUI 读取状态,未就绪时显示可关闭的提示。
|
|
108
|
-
* 导出 AuthOverlay。
|
|
109
|
-
*/
|
|
110
|
-
/** 鉴权弹窗。 */
|
|
111
|
-
function AuthOverlay({ t, openSettings }) {
|
|
112
|
-
const [status, setStatus] = (0, react.useState)(void 0);
|
|
113
|
-
const [dismissed, setDismissed] = (0, react.useState)(false);
|
|
114
|
-
const [busy, setBusy] = (0, react.useState)(false);
|
|
115
|
-
const lastReady = (0, react.useRef)(void 0);
|
|
116
|
-
const refresh = (0, react.useCallback)(async () => {
|
|
117
|
-
const result = await fetchStatus();
|
|
118
|
-
if (!result.ok) return;
|
|
119
|
-
setStatus(result.data);
|
|
120
|
-
if (lastReady.current === true && !result.data.ready) setDismissed(false);
|
|
121
|
-
lastReady.current = result.data.ready;
|
|
122
|
-
}, []);
|
|
123
|
-
(0, react.useEffect)(() => {
|
|
124
|
-
refresh();
|
|
125
|
-
const timer = window.setInterval(() => {
|
|
126
|
-
refresh();
|
|
127
|
-
}, 5e3);
|
|
128
|
-
return () => {
|
|
129
|
-
window.clearInterval(timer);
|
|
130
|
-
};
|
|
131
|
-
}, [refresh]);
|
|
132
|
-
if (status === void 0 || status.ready || dismissed) return null;
|
|
133
|
-
const stage = status.stage;
|
|
134
|
-
const hint = t(`auth.stage.${stage}.hint`);
|
|
135
|
-
const detail = status.detail !== void 0 && status.detail !== "" ? `\n${t("auth.detail", { detail: status.detail })}` : "";
|
|
136
|
-
const onRetry = async () => {
|
|
137
|
-
setBusy(true);
|
|
138
|
-
try {
|
|
139
|
-
const result = await checkAuth();
|
|
140
|
-
if (result.ok) {
|
|
141
|
-
setStatus(result.data);
|
|
142
|
-
lastReady.current = result.data.ready;
|
|
143
|
-
}
|
|
144
|
-
} finally {
|
|
145
|
-
setBusy(false);
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
|
|
149
|
-
open: true,
|
|
150
|
-
onClose: () => setDismissed(true),
|
|
151
|
-
title: t("auth.title"),
|
|
152
|
-
closeLabel: t("auth.close"),
|
|
153
|
-
description: `${hint}${detail}`,
|
|
154
|
-
tone: "warning",
|
|
155
|
-
footer: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
156
|
-
style: footerStyle,
|
|
157
|
-
children: [
|
|
158
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
159
|
-
type: "button",
|
|
160
|
-
style: secondaryStyle,
|
|
161
|
-
onClick: () => setDismissed(true),
|
|
162
|
-
children: t("auth.close")
|
|
163
|
-
}),
|
|
164
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: spacerStyle }),
|
|
165
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
166
|
-
type: "button",
|
|
167
|
-
style: secondaryStyle,
|
|
168
|
-
disabled: busy,
|
|
169
|
-
onClick: () => void onRetry(),
|
|
170
|
-
children: busy ? t("auth.checking") : t("auth.retry")
|
|
171
|
-
}),
|
|
172
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
173
|
-
type: "button",
|
|
174
|
-
style: primaryStyle,
|
|
175
|
-
onClick: () => {
|
|
176
|
-
openSettings();
|
|
177
|
-
setDismissed(true);
|
|
178
|
-
},
|
|
179
|
-
children: t("auth.openSettings")
|
|
180
|
-
})
|
|
181
|
-
]
|
|
182
|
-
}),
|
|
183
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
184
|
-
style: bodyStyle,
|
|
185
|
-
children: t("auth.description")
|
|
186
|
-
}), status.profile !== "" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
187
|
-
style: bodyStyle,
|
|
188
|
-
children: t("auth.profile", { profile: status.profile })
|
|
189
|
-
}) : null]
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
const footerStyle = {
|
|
245
|
+
const rowStyle$1 = {
|
|
193
246
|
display: "flex",
|
|
194
247
|
alignItems: "center",
|
|
195
|
-
gap:
|
|
196
|
-
width: "100%"
|
|
248
|
+
gap: 4
|
|
197
249
|
};
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
|
|
250
|
+
const commandStyle = {
|
|
251
|
+
flex: "1 1 auto",
|
|
252
|
+
minWidth: 0,
|
|
253
|
+
padding: "6px 8px",
|
|
201
254
|
borderRadius: "var(--dsw-radius-sm, 6px)",
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
};
|
|
206
|
-
const secondaryStyle = {
|
|
207
|
-
...buttonBase$1,
|
|
208
|
-
border: "1px solid var(--dsw-alias-border-l2)",
|
|
209
|
-
background: "var(--dsw-alias-button-tool-bar-fill, transparent)",
|
|
210
|
-
color: "var(--dsw-alias-label-primary)"
|
|
211
|
-
};
|
|
212
|
-
const primaryStyle = {
|
|
213
|
-
...buttonBase$1,
|
|
214
|
-
border: "1px solid var(--dsw-alias-brand-fill, #0969da)",
|
|
215
|
-
background: "var(--dsw-alias-brand-fill, #0969da)",
|
|
216
|
-
color: "var(--dsw-alias-label-on-brand, #fff)"
|
|
217
|
-
};
|
|
218
|
-
const bodyStyle = {
|
|
219
|
-
margin: "0 0 6px",
|
|
255
|
+
background: "var(--dsw-alias-bg-secondary, transparent)",
|
|
256
|
+
color: "var(--dsw-alias-label-primary)",
|
|
257
|
+
fontFamily: "monospace",
|
|
220
258
|
fontSize: 12,
|
|
221
259
|
lineHeight: "18px",
|
|
222
|
-
|
|
260
|
+
overflowWrap: "anywhere",
|
|
261
|
+
userSelect: "text"
|
|
223
262
|
};
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
const ROW_ID = "dsh-plugin-lark-bridge";
|
|
230
|
-
/** 判断路径是否为绝对路径。 */
|
|
231
|
-
function isAbsolutePath(value) {
|
|
232
|
-
return /^(?:[A-Za-z]:[\\/]|\\\\|\/)/.test(value);
|
|
233
|
-
}
|
|
234
|
-
const workspaceSpec = {
|
|
235
|
-
field: "workspaceRoot",
|
|
236
|
-
format: (value) => typeof value === "string" ? value : "",
|
|
237
|
-
parse: (text) => {
|
|
238
|
-
const path = text.trim();
|
|
239
|
-
return isAbsolutePath(path) ? {
|
|
240
|
-
kind: "set",
|
|
241
|
-
value: path
|
|
242
|
-
} : void 0;
|
|
243
|
-
}
|
|
244
|
-
};
|
|
245
|
-
const titleSpec = {
|
|
246
|
-
field: "sessionTitle",
|
|
247
|
-
format: (value) => typeof value === "string" ? value : "",
|
|
248
|
-
parse: (text) => {
|
|
249
|
-
const title = text.trim();
|
|
250
|
-
return title === "" ? void 0 : {
|
|
251
|
-
kind: "set",
|
|
252
|
-
value: title
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
};
|
|
256
|
-
const profileSpec = {
|
|
257
|
-
field: "profile",
|
|
258
|
-
format: (value) => typeof value === "string" ? value : "",
|
|
259
|
-
parse: (text) => {
|
|
260
|
-
const profile = text.trim();
|
|
261
|
-
return /^[A-Za-z0-9._-]+$/.test(profile) ? {
|
|
262
|
-
kind: "set",
|
|
263
|
-
value: profile
|
|
264
|
-
} : void 0;
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
|
-
const cliSpec = {
|
|
268
|
-
field: "larkCli",
|
|
269
|
-
format: (value) => typeof value === "string" ? value : "",
|
|
270
|
-
parse: (text) => ({
|
|
271
|
-
kind: "set",
|
|
272
|
-
value: text.trim()
|
|
273
|
-
})
|
|
274
|
-
};
|
|
275
|
-
const ownerSpec = {
|
|
276
|
-
field: "ownerOpenId",
|
|
277
|
-
format: (value) => typeof value === "string" ? value : "",
|
|
278
|
-
parse: (text) => {
|
|
279
|
-
const owner = text.trim();
|
|
280
|
-
return owner === "" || owner.startsWith("ou_") ? {
|
|
281
|
-
kind: "set",
|
|
282
|
-
value: owner
|
|
283
|
-
} : void 0;
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
const authCheckSpec = {
|
|
287
|
-
field: "authCheckOnStartup",
|
|
288
|
-
format: (value) => value === false ? "false" : "true",
|
|
289
|
-
parse: (text) => text === "true" || text === "false" ? {
|
|
290
|
-
kind: "set",
|
|
291
|
-
value: text === "true"
|
|
292
|
-
} : void 0
|
|
293
|
-
};
|
|
294
|
-
/** 暂存配置页的编辑,保存时一次写入宿主配置。 */
|
|
295
|
-
var PluginConfigForm = class {
|
|
296
|
-
form;
|
|
297
|
-
state;
|
|
298
|
-
/** @param scope - 宿主为该行提供的配置表单。 */
|
|
299
|
-
constructor(scope) {
|
|
300
|
-
this.form = new _deepseek_ai_dsh_client_ui_primitives.SettingsFormModel(scope, [
|
|
301
|
-
workspaceSpec,
|
|
302
|
-
titleSpec,
|
|
303
|
-
profileSpec,
|
|
304
|
-
cliSpec,
|
|
305
|
-
ownerSpec,
|
|
306
|
-
authCheckSpec
|
|
307
|
-
]);
|
|
308
|
-
this.state = this.form.bind(() => ({
|
|
309
|
-
...this.form.shell(),
|
|
310
|
-
workspaceRoot: this.form.field("workspaceRoot"),
|
|
311
|
-
sessionTitle: this.form.field("sessionTitle"),
|
|
312
|
-
profile: this.form.field("profile"),
|
|
313
|
-
larkCli: this.form.field("larkCli"),
|
|
314
|
-
ownerOpenId: this.form.field("ownerOpenId"),
|
|
315
|
-
authCheckOnStartup: this.form.field("authCheckOnStartup")
|
|
316
|
-
}));
|
|
317
|
-
}
|
|
318
|
-
/** @returns 配置页向槽位组件提供的注入值。 */
|
|
319
|
-
inject() {
|
|
320
|
-
return {
|
|
321
|
-
hooks: { configForm: this.state },
|
|
322
|
-
...this.form.actions()
|
|
323
|
-
};
|
|
324
|
-
}
|
|
325
|
-
/** 释放对宿主表单的订阅。 */
|
|
326
|
-
dispose() {
|
|
327
|
-
this.form.dispose();
|
|
328
|
-
}
|
|
263
|
+
const copyButtonStyle = {
|
|
264
|
+
flex: "none",
|
|
265
|
+
width: 28,
|
|
266
|
+
padding: 0,
|
|
267
|
+
color: "var(--dsw-alias-label-secondary)"
|
|
329
268
|
};
|
|
330
269
|
//#endregion
|
|
331
270
|
//#region src/client/auth-panel.tsx
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
const timer = window.setInterval(() => {
|
|
356
|
-
refresh();
|
|
357
|
-
}, 3e3);
|
|
358
|
-
return () => {
|
|
359
|
-
mounted.current = false;
|
|
360
|
-
window.clearInterval(timer);
|
|
361
|
-
};
|
|
362
|
-
}, [refresh]);
|
|
363
|
-
const apply = (result, fallback) => {
|
|
364
|
-
if (!mounted.current) return;
|
|
365
|
-
if (result.ok) {
|
|
366
|
-
setStatus(result.data);
|
|
367
|
-
setError("");
|
|
368
|
-
} else setError(messageOf(result, fallback));
|
|
369
|
-
};
|
|
370
|
-
const onBind = async () => {
|
|
371
|
-
setBusy("bind");
|
|
372
|
-
try {
|
|
373
|
-
const result = await bindApp(appId, appSecret);
|
|
374
|
-
if (result.ok) {
|
|
375
|
-
setStatus(result.data);
|
|
376
|
-
setError("");
|
|
377
|
-
setAppSecret("");
|
|
378
|
-
} else setError(t("auth.bindError", { message: result.error.message }));
|
|
379
|
-
} finally {
|
|
380
|
-
if (mounted.current) setBusy(void 0);
|
|
381
|
-
}
|
|
382
|
-
};
|
|
383
|
-
const onStart = async () => {
|
|
384
|
-
setBusy("login");
|
|
385
|
-
try {
|
|
386
|
-
const result = await startLogin();
|
|
387
|
-
if (!mounted.current) return;
|
|
388
|
-
if (result.ok) {
|
|
389
|
-
setStatus((current) => current === void 0 ? current : {
|
|
390
|
-
...current,
|
|
391
|
-
login: result.data
|
|
392
|
-
});
|
|
393
|
-
setError("");
|
|
394
|
-
} else setError(result.error.message);
|
|
395
|
-
} finally {
|
|
396
|
-
if (mounted.current) setBusy(void 0);
|
|
397
|
-
}
|
|
398
|
-
};
|
|
399
|
-
const onCancel = async () => {
|
|
400
|
-
setBusy("cancel");
|
|
401
|
-
try {
|
|
402
|
-
const result = await cancelLogin();
|
|
403
|
-
apply(result, "");
|
|
404
|
-
} finally {
|
|
405
|
-
if (mounted.current) setBusy(void 0);
|
|
406
|
-
}
|
|
407
|
-
};
|
|
408
|
-
const onCheck = async () => {
|
|
409
|
-
setBusy("check");
|
|
410
|
-
try {
|
|
411
|
-
const result = await checkAuth();
|
|
412
|
-
apply(result, "");
|
|
413
|
-
} finally {
|
|
414
|
-
if (mounted.current) setBusy(void 0);
|
|
415
|
-
}
|
|
416
|
-
};
|
|
417
|
-
const stage = status?.stage ?? "cli-missing";
|
|
418
|
-
const ready = status?.ready === true;
|
|
419
|
-
const needsApp = stage === "app-missing" || stage === "bot-unavailable";
|
|
420
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
271
|
+
const CONNECTIONS = [
|
|
272
|
+
{
|
|
273
|
+
key: "cli",
|
|
274
|
+
name: "auth.name.cli",
|
|
275
|
+
check: "auth.check.cli",
|
|
276
|
+
command: "auth.command.cli"
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
key: "bot",
|
|
280
|
+
name: "auth.name.bot",
|
|
281
|
+
check: "auth.check.bot",
|
|
282
|
+
command: "auth.command.bot"
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
key: "user",
|
|
286
|
+
name: "auth.name.user",
|
|
287
|
+
check: "auth.check.user",
|
|
288
|
+
command: "auth.command.user"
|
|
289
|
+
}
|
|
290
|
+
];
|
|
291
|
+
/** 只读连接状态与三个检测入口。 */
|
|
292
|
+
function AuthPanelStatus({ t, status, busy, onCheck }) {
|
|
293
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
|
|
421
294
|
"data-dsh-lark-auth-panel": true,
|
|
422
295
|
style: sectionStyle,
|
|
423
|
-
children:
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
473
|
-
style: inputStyle,
|
|
474
|
-
value: appId,
|
|
475
|
-
placeholder: "cli_xxxxxxxxxxxxxxxx",
|
|
476
|
-
autoComplete: "off",
|
|
477
|
-
onChange: (event) => setAppId(event.target.value)
|
|
478
|
-
})]
|
|
479
|
-
}),
|
|
480
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
481
|
-
style: labelStyle,
|
|
482
|
-
children: [
|
|
483
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
484
|
-
style: labelTextStyle,
|
|
485
|
-
children: t("auth.appSecret")
|
|
486
|
-
}),
|
|
487
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
488
|
-
style: inputStyle,
|
|
489
|
-
value: appSecret,
|
|
490
|
-
type: "password",
|
|
491
|
-
autoComplete: "new-password",
|
|
492
|
-
onChange: (event) => setAppSecret(event.target.value)
|
|
493
|
-
}),
|
|
494
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
495
|
-
style: hintSmallStyle,
|
|
496
|
-
children: t("auth.appSecretHint")
|
|
497
|
-
})
|
|
498
|
-
]
|
|
499
|
-
}),
|
|
500
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
501
|
-
type: "button",
|
|
502
|
-
style: primaryButtonStyle,
|
|
503
|
-
disabled: busy !== void 0 || appId.trim() === "" || appSecret.trim() === "",
|
|
504
|
-
onClick: () => void onBind(),
|
|
505
|
-
children: busy === "bind" ? t("auth.binding") : t("auth.bind")
|
|
506
|
-
})
|
|
507
|
-
]
|
|
508
|
-
}) : null,
|
|
509
|
-
stage === "user-missing" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
510
|
-
style: formStyle,
|
|
511
|
-
children: status?.login !== null && status?.login !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
512
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
513
|
-
href: status.login.verificationUrl,
|
|
514
|
-
target: "_blank",
|
|
515
|
-
rel: "noreferrer",
|
|
516
|
-
style: linkStyle,
|
|
517
|
-
children: t("auth.openLink")
|
|
518
|
-
}),
|
|
519
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
520
|
-
style: metaStyle,
|
|
521
|
-
children: t("auth.waiting")
|
|
522
|
-
}),
|
|
523
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
524
|
-
type: "button",
|
|
525
|
-
style: secondaryButtonStyle$1,
|
|
526
|
-
disabled: busy !== void 0,
|
|
527
|
-
onClick: () => void onCancel(),
|
|
528
|
-
children: busy === "cancel" ? t("auth.checking") : t("auth.cancel")
|
|
529
|
-
})
|
|
530
|
-
] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
531
|
-
type: "button",
|
|
532
|
-
style: primaryButtonStyle,
|
|
533
|
-
disabled: busy !== void 0,
|
|
534
|
-
onClick: () => void onStart(),
|
|
535
|
-
children: busy === "login" ? t("auth.starting") : t("auth.startLogin")
|
|
536
|
-
})
|
|
537
|
-
}) : null
|
|
538
|
-
]
|
|
296
|
+
children: CONNECTIONS.map((connection) => {
|
|
297
|
+
const state = status?.[connection.key] ?? "checking";
|
|
298
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
299
|
+
style: rowStyle,
|
|
300
|
+
"data-dsh-lark-connection": connection.key,
|
|
301
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
302
|
+
style: headerStyle,
|
|
303
|
+
children: [
|
|
304
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
305
|
+
style: {
|
|
306
|
+
...dotStyle,
|
|
307
|
+
...stateDotStyle[state]
|
|
308
|
+
},
|
|
309
|
+
"data-state": state,
|
|
310
|
+
"aria-hidden": "true"
|
|
311
|
+
}),
|
|
312
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
313
|
+
style: titleStyle$1,
|
|
314
|
+
children: t(connection.name)
|
|
315
|
+
}),
|
|
316
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
317
|
+
style: stateStyle,
|
|
318
|
+
children: t(`auth.state.${state}`)
|
|
319
|
+
}),
|
|
320
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
321
|
+
type: "button",
|
|
322
|
+
style: linkButtonStyle,
|
|
323
|
+
disabled: busy,
|
|
324
|
+
onClick: onCheck,
|
|
325
|
+
children: t(connection.check)
|
|
326
|
+
})
|
|
327
|
+
]
|
|
328
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TerminalCommand, {
|
|
329
|
+
kind: connection.key,
|
|
330
|
+
command: t(connection.command),
|
|
331
|
+
t
|
|
332
|
+
})]
|
|
333
|
+
}, connection.key);
|
|
334
|
+
})
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
/** 从共享控制器读取状态的面板。 */
|
|
338
|
+
function AuthPanel({ t, controller }) {
|
|
339
|
+
const snapshot = useStatusSnapshot(controller);
|
|
340
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AuthPanelStatus, {
|
|
341
|
+
t,
|
|
342
|
+
status: snapshot.status,
|
|
343
|
+
busy: snapshot.busy,
|
|
344
|
+
onCheck: () => void controller.check()
|
|
539
345
|
});
|
|
540
346
|
}
|
|
541
347
|
const sectionStyle = {
|
|
542
348
|
display: "flex",
|
|
543
349
|
flexDirection: "column",
|
|
544
|
-
gap:
|
|
350
|
+
gap: 12,
|
|
545
351
|
padding: "12px 0",
|
|
546
352
|
borderBottom: "0.5px solid var(--dsw-alias-border-l2)"
|
|
547
353
|
};
|
|
354
|
+
const rowStyle = {
|
|
355
|
+
display: "flex",
|
|
356
|
+
flexDirection: "column",
|
|
357
|
+
gap: 6
|
|
358
|
+
};
|
|
548
359
|
const headerStyle = {
|
|
549
360
|
display: "flex",
|
|
550
361
|
alignItems: "center",
|
|
@@ -556,84 +367,20 @@ window.__ModuleLoader__.load({
|
|
|
556
367
|
borderRadius: 999,
|
|
557
368
|
flex: "none"
|
|
558
369
|
};
|
|
559
|
-
const
|
|
560
|
-
|
|
561
|
-
background: "var(--dsw-alias-success-fill, #2da44e)"
|
|
562
|
-
|
|
563
|
-
const warnDotStyle = {
|
|
564
|
-
...dotStyle,
|
|
565
|
-
background: "var(--dsw-alias-warning-fill, #bf8700)"
|
|
370
|
+
const stateDotStyle = {
|
|
371
|
+
checking: { background: "var(--dsw-alias-warning-fill, #bf8700)" },
|
|
372
|
+
connected: { background: "var(--dsw-alias-success-fill, #2da44e)" },
|
|
373
|
+
disconnected: { background: "var(--dsw-alias-label-tertiary, #8c959f)" }
|
|
566
374
|
};
|
|
567
375
|
const titleStyle$1 = {
|
|
568
376
|
fontSize: 13,
|
|
569
377
|
fontWeight: 500,
|
|
570
|
-
color: "var(--dsw-alias-label-primary)"
|
|
571
|
-
flex: 1
|
|
572
|
-
};
|
|
573
|
-
const hintStyle = {
|
|
574
|
-
margin: 0,
|
|
575
|
-
fontSize: 12,
|
|
576
|
-
lineHeight: "18px",
|
|
577
|
-
color: "var(--dsw-alias-label-secondary)"
|
|
378
|
+
color: "var(--dsw-alias-label-primary)"
|
|
578
379
|
};
|
|
579
|
-
const
|
|
580
|
-
margin: 0,
|
|
380
|
+
const stateStyle = {
|
|
581
381
|
fontSize: 12,
|
|
582
|
-
lineHeight: "18px",
|
|
583
382
|
color: "var(--dsw-alias-label-secondary)"
|
|
584
383
|
};
|
|
585
|
-
const errorStyle = {
|
|
586
|
-
...metaStyle,
|
|
587
|
-
color: "var(--dsw-alias-error-fill, #cf222e)"
|
|
588
|
-
};
|
|
589
|
-
const hintSmallStyle = {
|
|
590
|
-
...metaStyle,
|
|
591
|
-
fontSize: 11
|
|
592
|
-
};
|
|
593
|
-
const formStyle = {
|
|
594
|
-
display: "flex",
|
|
595
|
-
flexDirection: "column",
|
|
596
|
-
gap: 8,
|
|
597
|
-
paddingTop: 4
|
|
598
|
-
};
|
|
599
|
-
const labelStyle = {
|
|
600
|
-
display: "flex",
|
|
601
|
-
flexDirection: "column",
|
|
602
|
-
gap: 4
|
|
603
|
-
};
|
|
604
|
-
const labelTextStyle = {
|
|
605
|
-
...metaStyle,
|
|
606
|
-
fontWeight: 500
|
|
607
|
-
};
|
|
608
|
-
const inputStyle = {
|
|
609
|
-
padding: "6px 8px",
|
|
610
|
-
border: "1px solid var(--dsw-alias-border-l2)",
|
|
611
|
-
borderRadius: "var(--dsw-radius-sm, 6px)",
|
|
612
|
-
background: "var(--dsw-alias-bg-l1, transparent)",
|
|
613
|
-
color: "var(--dsw-alias-label-primary)",
|
|
614
|
-
font: "inherit",
|
|
615
|
-
fontSize: 13
|
|
616
|
-
};
|
|
617
|
-
const buttonBase = {
|
|
618
|
-
alignSelf: "flex-start",
|
|
619
|
-
padding: "4px 10px",
|
|
620
|
-
borderRadius: "var(--dsw-radius-sm, 6px)",
|
|
621
|
-
font: "inherit",
|
|
622
|
-
fontSize: 12,
|
|
623
|
-
cursor: "pointer"
|
|
624
|
-
};
|
|
625
|
-
const primaryButtonStyle = {
|
|
626
|
-
...buttonBase,
|
|
627
|
-
border: "1px solid var(--dsw-alias-brand-fill, #0969da)",
|
|
628
|
-
background: "var(--dsw-alias-brand-fill, #0969da)",
|
|
629
|
-
color: "var(--dsw-alias-label-on-brand, #fff)"
|
|
630
|
-
};
|
|
631
|
-
const secondaryButtonStyle$1 = {
|
|
632
|
-
...buttonBase,
|
|
633
|
-
border: "1px solid var(--dsw-alias-border-l2)",
|
|
634
|
-
background: "var(--dsw-alias-button-tool-bar-fill, transparent)",
|
|
635
|
-
color: "var(--dsw-alias-label-primary)"
|
|
636
|
-
};
|
|
637
384
|
const linkButtonStyle = {
|
|
638
385
|
border: "none",
|
|
639
386
|
background: "transparent",
|
|
@@ -643,13 +390,97 @@ window.__ModuleLoader__.load({
|
|
|
643
390
|
cursor: "pointer",
|
|
644
391
|
padding: 0
|
|
645
392
|
};
|
|
646
|
-
const linkStyle = {
|
|
647
|
-
...linkButtonStyle,
|
|
648
|
-
fontSize: 12,
|
|
649
|
-
textDecoration: "underline"
|
|
650
|
-
};
|
|
651
393
|
//#endregion
|
|
652
394
|
//#region src/client/config-page.tsx
|
|
395
|
+
/** 读取宿主当前工作区条目。 */
|
|
396
|
+
function useWorkspaceItems(useWorkspaces) {
|
|
397
|
+
return useWorkspaces((state) => state.items);
|
|
398
|
+
}
|
|
399
|
+
/** 把注册列表转成下拉选项,路径统一为 Linux 风格。 */
|
|
400
|
+
function workspaceOptions(items) {
|
|
401
|
+
return items.map((item) => ({
|
|
402
|
+
id: String(item.workspaceId),
|
|
403
|
+
title: item.title,
|
|
404
|
+
path: normalizeWorkspacePath(item.path)
|
|
405
|
+
}));
|
|
406
|
+
}
|
|
407
|
+
/** 从当前注册列表选择工作区,值为归一化路径。 */
|
|
408
|
+
function WorkspaceSelect({ t, useWorkspaces, value, disabled, onChange, invalid = false }) {
|
|
409
|
+
const id = (0, react.useId)();
|
|
410
|
+
const options = workspaceOptions(useWorkspaceItems(useWorkspaces));
|
|
411
|
+
const selected = options.find((option) => sameWorkspacePath(option.path, value));
|
|
412
|
+
const [open, setOpen] = (0, react.useState)(false);
|
|
413
|
+
const triggerRef = (0, react.useRef)(null);
|
|
414
|
+
const empty = options.length === 0;
|
|
415
|
+
const label = empty ? t("config.workspaceRoot.empty") : selected === void 0 ? t("config.workspaceRoot.placeholder") : `${selected.title} — ${selected.path}`;
|
|
416
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
417
|
+
style: fieldStyle,
|
|
418
|
+
"data-dsh-lark-config-workspace": true,
|
|
419
|
+
children: [
|
|
420
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
421
|
+
style: labelRowStyle,
|
|
422
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
423
|
+
htmlFor: id,
|
|
424
|
+
style: titleStyle,
|
|
425
|
+
children: t("config.workspaceRoot.title")
|
|
426
|
+
})
|
|
427
|
+
}),
|
|
428
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
429
|
+
style: triggerRowStyle,
|
|
430
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
|
|
431
|
+
open,
|
|
432
|
+
anchorRef: triggerRef,
|
|
433
|
+
portal: true,
|
|
434
|
+
align: "start",
|
|
435
|
+
items: options.map((option) => ({
|
|
436
|
+
id: option.id,
|
|
437
|
+
label: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
438
|
+
style: optionLabelStyle,
|
|
439
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
440
|
+
style: optionTitleStyle,
|
|
441
|
+
children: option.title
|
|
442
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
443
|
+
style: optionPathStyle,
|
|
444
|
+
children: option.path
|
|
445
|
+
})]
|
|
446
|
+
})
|
|
447
|
+
})),
|
|
448
|
+
selectedId: selected?.id,
|
|
449
|
+
onSelect: (selectedId) => {
|
|
450
|
+
setOpen(false);
|
|
451
|
+
const option = options.find((candidate) => candidate.id === selectedId);
|
|
452
|
+
if (option !== void 0) onChange(option.path);
|
|
453
|
+
},
|
|
454
|
+
onClose: () => setOpen(false),
|
|
455
|
+
anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
456
|
+
ref: triggerRef,
|
|
457
|
+
id,
|
|
458
|
+
type: "button",
|
|
459
|
+
variant: "outline",
|
|
460
|
+
size: "md",
|
|
461
|
+
style: triggerStyle,
|
|
462
|
+
disabled: disabled || empty,
|
|
463
|
+
"aria-haspopup": "menu",
|
|
464
|
+
"aria-expanded": open,
|
|
465
|
+
onClick: () => setOpen((previous) => !previous),
|
|
466
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
467
|
+
style: triggerLabelStyle,
|
|
468
|
+
children: label
|
|
469
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, { size: 16 })]
|
|
470
|
+
})
|
|
471
|
+
})
|
|
472
|
+
}),
|
|
473
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
474
|
+
style: descriptionStyle,
|
|
475
|
+
children: t("config.workspaceRoot.description")
|
|
476
|
+
}),
|
|
477
|
+
invalid ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
478
|
+
style: invalidStyle,
|
|
479
|
+
children: t("config.workspaceRoot.invalid")
|
|
480
|
+
}) : null
|
|
481
|
+
]
|
|
482
|
+
});
|
|
483
|
+
}
|
|
653
484
|
/** 表单框架文案。 */
|
|
654
485
|
function formLabels(t) {
|
|
655
486
|
return {
|
|
@@ -663,183 +494,39 @@ window.__ModuleLoader__.load({
|
|
|
663
494
|
/** 渲染插件行配置。 */
|
|
664
495
|
function ConfigPage(props) {
|
|
665
496
|
const { t } = props;
|
|
666
|
-
const id = (0, react.useId)();
|
|
667
497
|
const state = props.useConfigForm((value) => value);
|
|
668
|
-
const [resetNotice, setResetNotice] = (0, react.useState)("");
|
|
669
498
|
if (props.view === "summary") return t("config.summary");
|
|
670
|
-
const disabled = !state.writable || state.saving;
|
|
671
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(AuthPanel, {
|
|
499
|
+
const disabled = !state.available || !state.writable || state.saving;
|
|
500
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(AuthPanel, {
|
|
501
|
+
t,
|
|
502
|
+
controller: props.controller
|
|
503
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.SettingsForm, {
|
|
672
504
|
state,
|
|
673
505
|
labels: formLabels(t),
|
|
674
506
|
onSave: props.save,
|
|
675
507
|
onDiscard: props.discard,
|
|
676
|
-
children:
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.SettingsValueField, {
|
|
685
|
-
id: `${id}-workspace`,
|
|
686
|
-
label: t("config.workspaceRoot.title"),
|
|
687
|
-
hint: t("config.workspaceRoot.description"),
|
|
688
|
-
invalidLabel: t("config.workspaceRoot.invalid"),
|
|
689
|
-
overriddenLabel: t("config.overridden"),
|
|
690
|
-
resetLabel: t("config.reset"),
|
|
691
|
-
text: state.workspaceRoot.text,
|
|
692
|
-
overridden: state.workspaceRoot.overridden,
|
|
693
|
-
invalid: state.workspaceRoot.invalid,
|
|
694
|
-
disabled,
|
|
695
|
-
onEdit: (text) => props.edit("workspaceRoot", text),
|
|
696
|
-
onReset: () => props.resetField("workspaceRoot")
|
|
697
|
-
})
|
|
698
|
-
}),
|
|
699
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
700
|
-
style: fieldStyle,
|
|
701
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.SettingsValueField, {
|
|
702
|
-
id: `${id}-title`,
|
|
703
|
-
label: t("config.sessionTitle.title"),
|
|
704
|
-
hint: t("config.sessionTitle.description"),
|
|
705
|
-
invalidLabel: t("config.sessionTitle.invalid"),
|
|
706
|
-
overriddenLabel: t("config.overridden"),
|
|
707
|
-
resetLabel: t("config.reset"),
|
|
708
|
-
text: state.sessionTitle.text,
|
|
709
|
-
overridden: state.sessionTitle.overridden,
|
|
710
|
-
invalid: state.sessionTitle.invalid,
|
|
711
|
-
disabled,
|
|
712
|
-
onEdit: (text) => props.edit("sessionTitle", text),
|
|
713
|
-
onReset: () => props.resetField("sessionTitle")
|
|
714
|
-
})
|
|
715
|
-
}),
|
|
716
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
717
|
-
style: rowStyle,
|
|
718
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
719
|
-
style: textStyle,
|
|
720
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
721
|
-
style: titleStyle,
|
|
722
|
-
children: t("config.authCheckOnStartup.title")
|
|
723
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
724
|
-
style: descriptionStyle,
|
|
725
|
-
children: t("config.authCheckOnStartup.description")
|
|
726
|
-
})]
|
|
727
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Switch, {
|
|
728
|
-
checked: state.authCheckOnStartup.text !== "false",
|
|
729
|
-
label: t("config.authCheckOnStartup.title"),
|
|
730
|
-
disabled,
|
|
731
|
-
onChange: (next) => props.edit("authCheckOnStartup", next ? "true" : "false")
|
|
732
|
-
})]
|
|
733
|
-
}),
|
|
734
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h4", {
|
|
735
|
-
style: sectionTitleStyle,
|
|
736
|
-
children: t("config.section.auth")
|
|
737
|
-
}),
|
|
738
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
739
|
-
style: fieldStyle,
|
|
740
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.SettingsValueField, {
|
|
741
|
-
id: `${id}-profile`,
|
|
742
|
-
label: t("config.profile.title"),
|
|
743
|
-
hint: t("config.profile.description"),
|
|
744
|
-
invalidLabel: t("config.profile.invalid"),
|
|
745
|
-
overriddenLabel: t("config.overridden"),
|
|
746
|
-
resetLabel: t("config.reset"),
|
|
747
|
-
text: state.profile.text,
|
|
748
|
-
overridden: state.profile.overridden,
|
|
749
|
-
invalid: state.profile.invalid,
|
|
750
|
-
disabled,
|
|
751
|
-
onEdit: (text) => props.edit("profile", text),
|
|
752
|
-
onReset: () => props.resetField("profile")
|
|
753
|
-
})
|
|
754
|
-
}),
|
|
755
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
756
|
-
style: fieldStyle,
|
|
757
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.SettingsValueField, {
|
|
758
|
-
id: `${id}-cli`,
|
|
759
|
-
label: t("config.larkCli.title"),
|
|
760
|
-
hint: t("config.larkCli.description"),
|
|
761
|
-
invalidLabel: t("config.larkCli.description"),
|
|
762
|
-
overriddenLabel: t("config.overridden"),
|
|
763
|
-
resetLabel: t("config.reset"),
|
|
764
|
-
text: state.larkCli.text,
|
|
765
|
-
overridden: state.larkCli.overridden,
|
|
766
|
-
invalid: state.larkCli.invalid,
|
|
767
|
-
disabled,
|
|
768
|
-
onEdit: (text) => props.edit("larkCli", text),
|
|
769
|
-
onReset: () => props.resetField("larkCli")
|
|
770
|
-
})
|
|
771
|
-
}),
|
|
772
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
773
|
-
style: fieldStyle,
|
|
774
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.SettingsValueField, {
|
|
775
|
-
id: `${id}-owner`,
|
|
776
|
-
label: t("config.ownerOpenId.title"),
|
|
777
|
-
hint: t("config.ownerOpenId.description"),
|
|
778
|
-
invalidLabel: t("config.ownerOpenId.invalid"),
|
|
779
|
-
overriddenLabel: t("config.overridden"),
|
|
780
|
-
resetLabel: t("config.reset"),
|
|
781
|
-
text: state.ownerOpenId.text,
|
|
782
|
-
overridden: state.ownerOpenId.overridden,
|
|
783
|
-
invalid: state.ownerOpenId.invalid,
|
|
784
|
-
disabled,
|
|
785
|
-
onEdit: (text) => props.edit("ownerOpenId", text),
|
|
786
|
-
onReset: () => props.resetField("ownerOpenId")
|
|
787
|
-
})
|
|
788
|
-
}),
|
|
789
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
790
|
-
style: rowStyle,
|
|
791
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
792
|
-
style: textStyle,
|
|
793
|
-
children: [
|
|
794
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
795
|
-
style: titleStyle,
|
|
796
|
-
children: t("config.resetSession")
|
|
797
|
-
}),
|
|
798
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
799
|
-
style: descriptionStyle,
|
|
800
|
-
children: t("config.resetSessionHint")
|
|
801
|
-
}),
|
|
802
|
-
resetNotice !== "" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
803
|
-
style: noticeStyle,
|
|
804
|
-
children: resetNotice
|
|
805
|
-
}) : null
|
|
806
|
-
]
|
|
807
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
808
|
-
type: "button",
|
|
809
|
-
style: secondaryButtonStyle,
|
|
810
|
-
disabled,
|
|
811
|
-
onClick: () => {
|
|
812
|
-
resetSession().then((result) => {
|
|
813
|
-
setResetNotice(result.ok ? t("config.resetDone") : result.error.message);
|
|
814
|
-
});
|
|
815
|
-
},
|
|
816
|
-
children: t("config.resetSession")
|
|
817
|
-
})]
|
|
818
|
-
})
|
|
819
|
-
]
|
|
508
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WorkspaceSelect, {
|
|
509
|
+
t,
|
|
510
|
+
useWorkspaces: props.useWorkspaces,
|
|
511
|
+
value: state.workspaceRoot.text,
|
|
512
|
+
disabled,
|
|
513
|
+
invalid: state.workspaceRoot.invalid,
|
|
514
|
+
onChange: (path) => props.edit("workspaceRoot", path)
|
|
515
|
+
})
|
|
820
516
|
})] });
|
|
821
517
|
}
|
|
822
|
-
const
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
letterSpacing: "0.04em"
|
|
518
|
+
const fieldStyle = {
|
|
519
|
+
display: "flex",
|
|
520
|
+
flexDirection: "column",
|
|
521
|
+
gap: 6,
|
|
522
|
+
padding: "12px 0",
|
|
523
|
+
borderTop: "0.5px solid var(--dsw-alias-border-l2)"
|
|
829
524
|
};
|
|
830
|
-
const
|
|
525
|
+
const labelRowStyle = {
|
|
831
526
|
display: "flex",
|
|
832
527
|
alignItems: "center",
|
|
833
528
|
justifyContent: "space-between",
|
|
834
|
-
gap:
|
|
835
|
-
padding: "12px 0"
|
|
836
|
-
};
|
|
837
|
-
const fieldStyle = { borderTop: "0.5px solid var(--dsw-alias-border-l2)" };
|
|
838
|
-
const textStyle = {
|
|
839
|
-
display: "flex",
|
|
840
|
-
flexDirection: "column",
|
|
841
|
-
gap: 4,
|
|
842
|
-
minWidth: 0
|
|
529
|
+
gap: 12
|
|
843
530
|
};
|
|
844
531
|
const titleStyle = {
|
|
845
532
|
fontSize: 13,
|
|
@@ -847,27 +534,340 @@ window.__ModuleLoader__.load({
|
|
|
847
534
|
lineHeight: 1.5,
|
|
848
535
|
color: "var(--dsw-alias-label-primary)"
|
|
849
536
|
};
|
|
537
|
+
const triggerRowStyle = { display: "grid" };
|
|
538
|
+
const triggerStyle = {
|
|
539
|
+
width: "100%",
|
|
540
|
+
justifyContent: "space-between",
|
|
541
|
+
gap: 8,
|
|
542
|
+
paddingInline: 10,
|
|
543
|
+
fontSize: 13,
|
|
544
|
+
fontWeight: 400
|
|
545
|
+
};
|
|
546
|
+
const triggerLabelStyle = {
|
|
547
|
+
flex: "1 1 auto",
|
|
548
|
+
minWidth: 0,
|
|
549
|
+
overflow: "hidden",
|
|
550
|
+
textOverflow: "ellipsis",
|
|
551
|
+
whiteSpace: "nowrap",
|
|
552
|
+
textAlign: "left"
|
|
553
|
+
};
|
|
554
|
+
const optionLabelStyle = {
|
|
555
|
+
display: "flex",
|
|
556
|
+
flexDirection: "column",
|
|
557
|
+
gap: 1,
|
|
558
|
+
minWidth: 0,
|
|
559
|
+
whiteSpace: "normal"
|
|
560
|
+
};
|
|
561
|
+
const optionTitleStyle = {
|
|
562
|
+
overflow: "hidden",
|
|
563
|
+
textOverflow: "ellipsis",
|
|
564
|
+
whiteSpace: "nowrap"
|
|
565
|
+
};
|
|
566
|
+
const optionPathStyle = {
|
|
567
|
+
overflow: "hidden",
|
|
568
|
+
textOverflow: "ellipsis",
|
|
569
|
+
whiteSpace: "nowrap",
|
|
570
|
+
fontSize: 11,
|
|
571
|
+
lineHeight: "16px",
|
|
572
|
+
color: "var(--dsw-alias-label-secondary)"
|
|
573
|
+
};
|
|
850
574
|
const descriptionStyle = {
|
|
851
575
|
margin: 0,
|
|
852
576
|
fontSize: 12,
|
|
853
577
|
lineHeight: "18px",
|
|
854
578
|
color: "var(--dsw-alias-label-secondary)"
|
|
855
579
|
};
|
|
856
|
-
const
|
|
580
|
+
const invalidStyle = {
|
|
857
581
|
...descriptionStyle,
|
|
858
|
-
color: "var(--dsw-alias-
|
|
582
|
+
color: "var(--dsw-alias-error-fill, #cf222e)"
|
|
859
583
|
};
|
|
860
|
-
|
|
861
|
-
|
|
584
|
+
//#endregion
|
|
585
|
+
//#region src/client/auth-overlay.tsx
|
|
586
|
+
/** 共用设置弹窗:连接状态、注册工作区选择、失效重开与保存状态。 */
|
|
587
|
+
/** 计算当前失效签名;连接与工作区均有效时返回空串。 */
|
|
588
|
+
function getAuthOverlaySignature(status, workspaceRoot, workspacePaths) {
|
|
589
|
+
const root = normalizeWorkspacePath(workspaceRoot);
|
|
590
|
+
const workspaceValid = workspacePaths.some((path) => sameWorkspacePath(path, root));
|
|
591
|
+
if (status.ready && workspaceValid) return "";
|
|
592
|
+
return `${status.cli}/${status.bot}/${status.user}|${workspaceValid ? "valid" : "invalid"}:${root}`;
|
|
593
|
+
}
|
|
594
|
+
/** 弹窗初始状态。 */
|
|
595
|
+
const INITIAL_AUTH_OVERLAY_STATE = {
|
|
596
|
+
signature: "initial",
|
|
597
|
+
open: true,
|
|
598
|
+
dismissed: false,
|
|
599
|
+
settleDismissed: false,
|
|
600
|
+
editing: false,
|
|
601
|
+
saving: false
|
|
602
|
+
};
|
|
603
|
+
/** 管理失效重开和显式保存;未发起保存的 settle 不产生副作用。 */
|
|
604
|
+
function reduceAuthOverlayState(state, action) {
|
|
605
|
+
switch (action.type) {
|
|
606
|
+
case "sync": {
|
|
607
|
+
const changed = action.signature !== state.signature;
|
|
608
|
+
if (action.signature === "" && !state.editing && !state.saving) return {
|
|
609
|
+
signature: "",
|
|
610
|
+
open: false,
|
|
611
|
+
dismissed: false,
|
|
612
|
+
settleDismissed: false,
|
|
613
|
+
editing: false,
|
|
614
|
+
saving: false
|
|
615
|
+
};
|
|
616
|
+
if (state.dismissed && (state.settleDismissed || !changed)) return {
|
|
617
|
+
...state,
|
|
618
|
+
signature: action.signature,
|
|
619
|
+
settleDismissed: false
|
|
620
|
+
};
|
|
621
|
+
return {
|
|
622
|
+
...state,
|
|
623
|
+
signature: action.signature,
|
|
624
|
+
open: true,
|
|
625
|
+
dismissed: false
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
case "editStart": return {
|
|
629
|
+
...state,
|
|
630
|
+
open: true,
|
|
631
|
+
dismissed: false,
|
|
632
|
+
editing: true
|
|
633
|
+
};
|
|
634
|
+
case "dismiss": return {
|
|
635
|
+
...state,
|
|
636
|
+
open: false,
|
|
637
|
+
dismissed: true,
|
|
638
|
+
settleDismissed: false,
|
|
639
|
+
editing: false,
|
|
640
|
+
saving: false
|
|
641
|
+
};
|
|
642
|
+
case "discard": return {
|
|
643
|
+
...state,
|
|
644
|
+
open: false,
|
|
645
|
+
dismissed: true,
|
|
646
|
+
settleDismissed: true,
|
|
647
|
+
editing: false,
|
|
648
|
+
saving: false
|
|
649
|
+
};
|
|
650
|
+
case "saveStart": return {
|
|
651
|
+
...state,
|
|
652
|
+
open: true,
|
|
653
|
+
dismissed: false,
|
|
654
|
+
saving: true
|
|
655
|
+
};
|
|
656
|
+
case "saveSettled":
|
|
657
|
+
if (!state.saving) return state;
|
|
658
|
+
if (action.saving || action.dirty || action.failed) return {
|
|
659
|
+
...state,
|
|
660
|
+
open: true,
|
|
661
|
+
saving: false,
|
|
662
|
+
editing: true
|
|
663
|
+
};
|
|
664
|
+
return {
|
|
665
|
+
signature: "",
|
|
666
|
+
open: false,
|
|
667
|
+
dismissed: false,
|
|
668
|
+
settleDismissed: false,
|
|
669
|
+
editing: false,
|
|
670
|
+
saving: false
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
/** 连接面板与工作区选择正文。 */
|
|
675
|
+
function AuthOverlayContent({ t, controller, useWorkspaces, form, onEdit, onSave, onClose, onOpenSettings }) {
|
|
676
|
+
const disabled = !form.available || !form.writable || form.saving;
|
|
677
|
+
const saveDisabled = disabled || !form.dirty || form.invalid || form.workspaceRoot.text === "";
|
|
678
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [
|
|
679
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(AuthPanel, {
|
|
680
|
+
t,
|
|
681
|
+
controller
|
|
682
|
+
}),
|
|
683
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(WorkspaceSelect, {
|
|
684
|
+
t,
|
|
685
|
+
useWorkspaces,
|
|
686
|
+
value: form.workspaceRoot.text,
|
|
687
|
+
disabled,
|
|
688
|
+
invalid: form.workspaceRoot.invalid,
|
|
689
|
+
onChange: onEdit
|
|
690
|
+
}),
|
|
691
|
+
form.failed ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
692
|
+
style: failedStyle,
|
|
693
|
+
children: t("config.saveFailed")
|
|
694
|
+
}) : null,
|
|
695
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
696
|
+
style: actionsStyle,
|
|
697
|
+
children: [
|
|
698
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
699
|
+
type: "button",
|
|
700
|
+
style: secondaryStyle,
|
|
701
|
+
onClick: onClose,
|
|
702
|
+
children: t("auth.close")
|
|
703
|
+
}),
|
|
704
|
+
onOpenSettings === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
705
|
+
type: "button",
|
|
706
|
+
style: secondaryStyle,
|
|
707
|
+
onClick: onOpenSettings,
|
|
708
|
+
children: t("auth.openSettings")
|
|
709
|
+
}),
|
|
710
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
711
|
+
type: "button",
|
|
712
|
+
style: {
|
|
713
|
+
...primaryStyle,
|
|
714
|
+
...saveDisabled ? disabledButtonStyle : {}
|
|
715
|
+
},
|
|
716
|
+
disabled: saveDisabled,
|
|
717
|
+
onClick: onSave,
|
|
718
|
+
children: form.saving ? t("config.saving") : t("config.saveSelection")
|
|
719
|
+
})
|
|
720
|
+
]
|
|
721
|
+
})
|
|
722
|
+
] });
|
|
723
|
+
}
|
|
724
|
+
/** 共用设置弹窗。 */
|
|
725
|
+
function AuthOverlay(props) {
|
|
726
|
+
const { t, controller } = props;
|
|
727
|
+
const { status } = useStatusSnapshot(controller);
|
|
728
|
+
const form = props.useConfigForm((value) => value);
|
|
729
|
+
const workspacePaths = useWorkspaceItems(props.useWorkspaces).map((item) => item.path);
|
|
730
|
+
const signature = getAuthOverlaySignature(status, form.workspaceRoot.text, workspacePaths);
|
|
731
|
+
const [state, dispatch] = (0, react.useReducer)(reduceAuthOverlayState, INITIAL_AUTH_OVERLAY_STATE, (initial) => ({
|
|
732
|
+
...initial,
|
|
733
|
+
signature,
|
|
734
|
+
open: signature !== ""
|
|
735
|
+
}));
|
|
736
|
+
const wasSaving = (0, react.useRef)(false);
|
|
737
|
+
(0, react.useEffect)(() => {
|
|
738
|
+
dispatch({
|
|
739
|
+
type: "sync",
|
|
740
|
+
signature
|
|
741
|
+
});
|
|
742
|
+
}, [signature]);
|
|
743
|
+
(0, react.useEffect)(() => {
|
|
744
|
+
if (wasSaving.current && !form.saving) dispatch({
|
|
745
|
+
type: "saveSettled",
|
|
746
|
+
saving: form.saving,
|
|
747
|
+
dirty: form.dirty,
|
|
748
|
+
failed: form.failed
|
|
749
|
+
});
|
|
750
|
+
wasSaving.current = form.saving;
|
|
751
|
+
}, [
|
|
752
|
+
form.saving,
|
|
753
|
+
form.dirty,
|
|
754
|
+
form.failed
|
|
755
|
+
]);
|
|
756
|
+
if (!state.open) return null;
|
|
757
|
+
const onClose = () => {
|
|
758
|
+
if (state.editing) {
|
|
759
|
+
props.discard();
|
|
760
|
+
dispatch({ type: "discard" });
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
763
|
+
dispatch({ type: "dismiss" });
|
|
764
|
+
};
|
|
765
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
|
|
766
|
+
open: true,
|
|
767
|
+
onClose,
|
|
768
|
+
title: t("auth.title"),
|
|
769
|
+
closeLabel: t("auth.close"),
|
|
770
|
+
description: t("auth.description"),
|
|
771
|
+
tone: "warning",
|
|
772
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AuthOverlayContent, {
|
|
773
|
+
t,
|
|
774
|
+
controller,
|
|
775
|
+
useWorkspaces: props.useWorkspaces,
|
|
776
|
+
form,
|
|
777
|
+
onEdit: (path) => {
|
|
778
|
+
dispatch({ type: "editStart" });
|
|
779
|
+
props.edit("workspaceRoot", path);
|
|
780
|
+
},
|
|
781
|
+
onSave: () => {
|
|
782
|
+
dispatch({ type: "saveStart" });
|
|
783
|
+
props.save();
|
|
784
|
+
},
|
|
785
|
+
onClose,
|
|
786
|
+
onOpenSettings: () => {
|
|
787
|
+
props.openSettings();
|
|
788
|
+
dispatch({ type: "dismiss" });
|
|
789
|
+
}
|
|
790
|
+
})
|
|
791
|
+
});
|
|
792
|
+
}
|
|
793
|
+
const actionsStyle = {
|
|
794
|
+
display: "flex",
|
|
795
|
+
justifyContent: "flex-end",
|
|
796
|
+
gap: 8,
|
|
797
|
+
paddingTop: 12
|
|
798
|
+
};
|
|
799
|
+
const buttonBase = {
|
|
862
800
|
padding: "4px 10px",
|
|
863
|
-
border: "1px solid var(--dsw-alias-border-l2)",
|
|
864
801
|
borderRadius: "var(--dsw-radius-sm, 6px)",
|
|
865
|
-
background: "var(--dsw-alias-button-tool-bar-fill, transparent)",
|
|
866
|
-
color: "var(--dsw-alias-label-primary)",
|
|
867
802
|
font: "inherit",
|
|
868
803
|
fontSize: 12,
|
|
869
804
|
cursor: "pointer"
|
|
870
805
|
};
|
|
806
|
+
const secondaryStyle = {
|
|
807
|
+
...buttonBase,
|
|
808
|
+
border: "1px solid var(--dsw-alias-border-l2)",
|
|
809
|
+
background: "var(--dsw-alias-button-tool-bar-fill, transparent)",
|
|
810
|
+
color: "var(--dsw-alias-label-primary)"
|
|
811
|
+
};
|
|
812
|
+
const primaryStyle = {
|
|
813
|
+
...buttonBase,
|
|
814
|
+
border: "1px solid var(--dsw-alias-brand-fill, #0969da)",
|
|
815
|
+
background: "var(--dsw-alias-brand-fill, #0969da)",
|
|
816
|
+
color: "var(--dsw-alias-label-on-brand, #fff)"
|
|
817
|
+
};
|
|
818
|
+
const disabledButtonStyle = {
|
|
819
|
+
borderColor: "var(--dsw-alias-border-l2)",
|
|
820
|
+
background: "var(--dsw-alias-button-tool-bar-fill, transparent)",
|
|
821
|
+
color: "var(--dsw-alias-label-secondary)",
|
|
822
|
+
cursor: "not-allowed",
|
|
823
|
+
opacity: .65
|
|
824
|
+
};
|
|
825
|
+
const failedStyle = {
|
|
826
|
+
margin: "8px 0 0",
|
|
827
|
+
fontSize: 12,
|
|
828
|
+
color: "var(--dsw-alias-error-fill, #cf222e)"
|
|
829
|
+
};
|
|
830
|
+
//#endregion
|
|
831
|
+
//#region src/client/config-form.ts
|
|
832
|
+
/** 插件在前端使用的行键:`<包名>#<行 id>`。 */
|
|
833
|
+
const ROW_KEY = "dsh-plugin-lark-bridge#dsh-plugin-lark-bridge";
|
|
834
|
+
/** 行 id,同时是宿主配置的条目 id 与表单命名空间。 */
|
|
835
|
+
const ROW_ID = "dsh-plugin-lark-bridge";
|
|
836
|
+
const workspaceSpec = {
|
|
837
|
+
field: "workspaceRoot",
|
|
838
|
+
format: (value) => typeof value === "string" ? normalizeWorkspacePath(value) : "",
|
|
839
|
+
parse: (text) => {
|
|
840
|
+
const path = normalizeWorkspacePath(text);
|
|
841
|
+
return path.startsWith("/") ? {
|
|
842
|
+
kind: "set",
|
|
843
|
+
value: path
|
|
844
|
+
} : void 0;
|
|
845
|
+
}
|
|
846
|
+
};
|
|
847
|
+
/** 暂存工作区编辑,保存时写入宿主配置。 */
|
|
848
|
+
var PluginConfigForm = class {
|
|
849
|
+
form;
|
|
850
|
+
state;
|
|
851
|
+
/** @param scope - 宿主为该行提供的配置表单。 */
|
|
852
|
+
constructor(scope) {
|
|
853
|
+
this.form = new _deepseek_ai_dsh_client_ui_primitives.SettingsFormModel(scope, [workspaceSpec]);
|
|
854
|
+
this.state = this.form.bind(() => ({
|
|
855
|
+
...this.form.shell(),
|
|
856
|
+
workspaceRoot: this.form.field("workspaceRoot")
|
|
857
|
+
}));
|
|
858
|
+
}
|
|
859
|
+
/** @returns 配置页向槽位组件提供的注入值。 */
|
|
860
|
+
inject() {
|
|
861
|
+
return {
|
|
862
|
+
hooks: { configForm: this.state },
|
|
863
|
+
...this.form.actions()
|
|
864
|
+
};
|
|
865
|
+
}
|
|
866
|
+
/** 释放对宿主表单的订阅。 */
|
|
867
|
+
dispose() {
|
|
868
|
+
this.form.dispose();
|
|
869
|
+
}
|
|
870
|
+
};
|
|
871
871
|
//#endregion
|
|
872
872
|
//#region src/client/locales.ts
|
|
873
873
|
/** 前端字典与命名空间。中文字典是键集事实源。 */
|
|
@@ -875,142 +875,75 @@ window.__ModuleLoader__.load({
|
|
|
875
875
|
const NS = "dsh-plugin-lark-bridge";
|
|
876
876
|
/** 中文字典。 */
|
|
877
877
|
const zh = {
|
|
878
|
-
"auth.title": "
|
|
879
|
-
"auth.description": "
|
|
878
|
+
"auth.title": "飞书桥接设置",
|
|
879
|
+
"auth.description": "完成连接检查并选择工作区。命令需要在终端执行。",
|
|
880
|
+
"auth.ready": "飞书连接已就绪",
|
|
880
881
|
"auth.close": "本次不再提示",
|
|
881
882
|
"auth.openSettings": "打开设置",
|
|
882
|
-
"auth.
|
|
883
|
-
"auth.
|
|
884
|
-
"auth.
|
|
885
|
-
"auth.
|
|
886
|
-
"auth.
|
|
887
|
-
"auth.
|
|
888
|
-
"auth.
|
|
889
|
-
"auth.
|
|
890
|
-
"auth.
|
|
891
|
-
"auth.
|
|
892
|
-
"auth.
|
|
893
|
-
"auth.
|
|
894
|
-
"auth.
|
|
895
|
-
"auth.
|
|
896
|
-
"
|
|
897
|
-
"auth.stage.ready.hint": "机器人可以接收飞书私聊,并向你发送通知。",
|
|
898
|
-
"auth.appId": "App ID",
|
|
899
|
-
"auth.appSecret": "App Secret",
|
|
900
|
-
"auth.appSecretHint": "只写入 lark-cli 的专用配置,不保存到插件配置。",
|
|
901
|
-
"auth.bind": "绑定应用",
|
|
902
|
-
"auth.binding": "绑定中…",
|
|
903
|
-
"auth.startLogin": "开始授权",
|
|
904
|
-
"auth.starting": "启动授权…",
|
|
905
|
-
"auth.openLink": "打开授权链接",
|
|
906
|
-
"auth.waiting": "等待浏览器授权完成…",
|
|
907
|
-
"auth.cancel": "取消授权",
|
|
908
|
-
"auth.detail": "详情:{detail}",
|
|
909
|
-
"auth.profile": "配置档案:{profile}",
|
|
910
|
-
"config.summary": "工作区、会话标题与飞书鉴权",
|
|
911
|
-
"config.section.auth": "鉴权",
|
|
912
|
-
"config.section.session": "会话",
|
|
883
|
+
"auth.name.cli": "lark-cli",
|
|
884
|
+
"auth.name.bot": "机器人身份(bot)",
|
|
885
|
+
"auth.name.user": "用户身份(user)",
|
|
886
|
+
"auth.state.checking": "检测中…",
|
|
887
|
+
"auth.state.connected": "已连接",
|
|
888
|
+
"auth.state.disconnected": "未连接",
|
|
889
|
+
"auth.check.cli": "检测 lark-cli",
|
|
890
|
+
"auth.check.bot": "检测机器人身份",
|
|
891
|
+
"auth.check.user": "检测用户身份",
|
|
892
|
+
"auth.command.cli": "npm install -g @larksuite/cli@latest",
|
|
893
|
+
"auth.command.bot": "lark-cli config init",
|
|
894
|
+
"auth.command.user": "lark-cli auth login --scope auth:user.id:read",
|
|
895
|
+
"auth.command.copy": "复制命令",
|
|
896
|
+
"auth.command.copied": "已复制",
|
|
897
|
+
"config.summary": "工作区与飞书连接",
|
|
913
898
|
"config.workspaceRoot.title": "工作区",
|
|
914
|
-
"config.workspaceRoot.description": "
|
|
915
|
-
"config.workspaceRoot.invalid": "
|
|
916
|
-
"config.
|
|
917
|
-
"config.
|
|
918
|
-
"config.
|
|
919
|
-
"config.profile.title": "lark-cli 档案名",
|
|
920
|
-
"config.profile.description": "插件使用独立档案,不影响你现有的 lark-cli 登录。",
|
|
921
|
-
"config.profile.invalid": "只能包含字母、数字、点、下划线与短横线。",
|
|
922
|
-
"config.larkCli.title": "lark-cli 路径",
|
|
923
|
-
"config.larkCli.description": "留空自动使用插件依赖的 @larksuite/cli。",
|
|
924
|
-
"config.ownerOpenId.title": "用户 open_id",
|
|
925
|
-
"config.ownerOpenId.description": "留空使用授权结果;填写后跳过用户授权检查。",
|
|
926
|
-
"config.ownerOpenId.invalid": "open_id 必须以 ou_ 开头。",
|
|
927
|
-
"config.authCheckOnStartup.title": "启动时检测鉴权",
|
|
928
|
-
"config.authCheckOnStartup.description": "每次打开 DSH 都检查一次;失败时显示提示弹窗。",
|
|
929
|
-
"config.resetSession": "重置桥接会话",
|
|
930
|
-
"config.resetSessionHint": "清除已记录的会话标识,下一条飞书消息会在工作区新建会话。",
|
|
931
|
-
"config.resetDone": "会话记录已清除。",
|
|
899
|
+
"config.workspaceRoot.description": "飞书消息注入到所选 DSH 工作区的会话。",
|
|
900
|
+
"config.workspaceRoot.invalid": "请选择一个已注册的工作区。",
|
|
901
|
+
"config.workspaceRoot.placeholder": "请选择工作区",
|
|
902
|
+
"config.workspaceRoot.empty": "暂无已注册工作区",
|
|
903
|
+
"config.saveSelection": "保存选择",
|
|
932
904
|
"config.unavailable": "配置不可用。",
|
|
933
905
|
"config.readOnly": "此部署以只读方式保存设置。",
|
|
934
906
|
"config.saveFailed": "此部署未接受这些值,已保留以便修改。",
|
|
935
907
|
"config.save": "保存",
|
|
936
|
-
"config.saving": "保存中…"
|
|
937
|
-
"config.overridden": "已覆盖",
|
|
938
|
-
"config.reset": "恢复默认",
|
|
939
|
-
"config.currentSession": "当前会话:{session}",
|
|
940
|
-
"config.noSession": "尚未创建桥接会话。"
|
|
908
|
+
"config.saving": "保存中…"
|
|
941
909
|
};
|
|
942
910
|
/** 英文字典,键集与中文一致。 */
|
|
943
911
|
const en = {
|
|
944
|
-
"auth.title": "Lark
|
|
945
|
-
"auth.description": "
|
|
912
|
+
"auth.title": "Lark bridge setup",
|
|
913
|
+
"auth.description": "Check the connections and select a workspace. Run commands in a terminal.",
|
|
914
|
+
"auth.ready": "Lark connections are ready",
|
|
946
915
|
"auth.close": "Not now",
|
|
947
916
|
"auth.openSettings": "Open settings",
|
|
948
|
-
"auth.
|
|
949
|
-
"auth.
|
|
950
|
-
"auth.
|
|
951
|
-
"auth.
|
|
952
|
-
"auth.
|
|
953
|
-
"auth.
|
|
954
|
-
"auth.
|
|
955
|
-
"auth.
|
|
956
|
-
"auth.
|
|
957
|
-
"auth.
|
|
958
|
-
"auth.
|
|
959
|
-
"auth.
|
|
960
|
-
"auth.
|
|
961
|
-
"auth.
|
|
962
|
-
"
|
|
963
|
-
"auth.stage.ready.hint": "The bot can receive Lark direct messages and send you notifications.",
|
|
964
|
-
"auth.appId": "App ID",
|
|
965
|
-
"auth.appSecret": "App Secret",
|
|
966
|
-
"auth.appSecretHint": "Written only to the dedicated lark-cli profile, never to plugin configuration.",
|
|
967
|
-
"auth.bind": "Bind app",
|
|
968
|
-
"auth.binding": "Binding…",
|
|
969
|
-
"auth.startLogin": "Start authorization",
|
|
970
|
-
"auth.starting": "Starting…",
|
|
971
|
-
"auth.openLink": "Open authorization link",
|
|
972
|
-
"auth.waiting": "Waiting for the browser authorization…",
|
|
973
|
-
"auth.cancel": "Cancel authorization",
|
|
974
|
-
"auth.detail": "Details: {detail}",
|
|
975
|
-
"auth.profile": "Profile: {profile}",
|
|
976
|
-
"config.summary": "Workspace, session title, and Lark authentication",
|
|
977
|
-
"config.section.auth": "Authentication",
|
|
978
|
-
"config.section.session": "Session",
|
|
917
|
+
"auth.name.cli": "lark-cli",
|
|
918
|
+
"auth.name.bot": "Bot identity",
|
|
919
|
+
"auth.name.user": "User identity",
|
|
920
|
+
"auth.state.checking": "Checking…",
|
|
921
|
+
"auth.state.connected": "Connected",
|
|
922
|
+
"auth.state.disconnected": "Disconnected",
|
|
923
|
+
"auth.check.cli": "Check lark-cli",
|
|
924
|
+
"auth.check.bot": "Check bot identity",
|
|
925
|
+
"auth.check.user": "Check user identity",
|
|
926
|
+
"auth.command.cli": "npm install -g @larksuite/cli@latest",
|
|
927
|
+
"auth.command.bot": "lark-cli config init",
|
|
928
|
+
"auth.command.user": "lark-cli auth login --scope auth:user.id:read",
|
|
929
|
+
"auth.command.copy": "Copy command",
|
|
930
|
+
"auth.command.copied": "Copied",
|
|
931
|
+
"config.summary": "Workspace and Lark connections",
|
|
979
932
|
"config.workspaceRoot.title": "Workspace",
|
|
980
|
-
"config.workspaceRoot.description": "Lark messages are injected into the DSH
|
|
981
|
-
"config.workspaceRoot.invalid": "
|
|
982
|
-
"config.
|
|
983
|
-
"config.
|
|
984
|
-
"config.
|
|
985
|
-
"config.profile.title": "lark-cli profile",
|
|
986
|
-
"config.profile.description": "The plugin uses its own profile and leaves your existing lark-cli login untouched.",
|
|
987
|
-
"config.profile.invalid": "Use letters, digits, dots, underscores, and hyphens only.",
|
|
988
|
-
"config.larkCli.title": "lark-cli path",
|
|
989
|
-
"config.larkCli.description": "Leave empty to use the bundled @larksuite/cli dependency.",
|
|
990
|
-
"config.ownerOpenId.title": "User open_id",
|
|
991
|
-
"config.ownerOpenId.description": "Leave empty to use the authorization result; setting it skips the user-auth check.",
|
|
992
|
-
"config.ownerOpenId.invalid": "The open_id must start with ou_.",
|
|
993
|
-
"config.authCheckOnStartup.title": "Check authentication on startup",
|
|
994
|
-
"config.authCheckOnStartup.description": "Run one check whenever DSH opens and show the notice when it fails.",
|
|
995
|
-
"config.resetSession": "Reset bridge session",
|
|
996
|
-
"config.resetSessionHint": "Clears the recorded session id; the next Lark message creates a new session in the workspace.",
|
|
997
|
-
"config.resetDone": "The session record was cleared.",
|
|
933
|
+
"config.workspaceRoot.description": "Lark messages are injected into the selected DSH workspace.",
|
|
934
|
+
"config.workspaceRoot.invalid": "Select a registered workspace.",
|
|
935
|
+
"config.workspaceRoot.placeholder": "Select a workspace",
|
|
936
|
+
"config.workspaceRoot.empty": "No registered workspaces",
|
|
937
|
+
"config.saveSelection": "Save selection",
|
|
998
938
|
"config.unavailable": "Configuration is unavailable.",
|
|
999
939
|
"config.readOnly": "This deployment stores settings read-only.",
|
|
1000
940
|
"config.saveFailed": "The deployment did not accept these values; they were left for you to correct.",
|
|
1001
941
|
"config.save": "Save",
|
|
1002
|
-
"config.saving": "Saving…"
|
|
1003
|
-
"config.overridden": "Overridden",
|
|
1004
|
-
"config.reset": "Restore default",
|
|
1005
|
-
"config.currentSession": "Current session: {session}",
|
|
1006
|
-
"config.noSession": "No bridge session yet."
|
|
942
|
+
"config.saving": "Saving…"
|
|
1007
943
|
};
|
|
1008
944
|
//#endregion
|
|
1009
945
|
//#region src/client/index.ts
|
|
1010
|
-
/**
|
|
1011
|
-
* 插件在前端启用时调用。
|
|
1012
|
-
* 字典、弹窗与配置页各自等待所需服务;服务缺失时该功能不加载。
|
|
1013
|
-
*/
|
|
946
|
+
/** 注册共享状态、弹窗和配置页。 */
|
|
1014
947
|
function apply(ctx) {
|
|
1015
948
|
ctx.inject(["locale"], (ctx) => {
|
|
1016
949
|
ctx.effect(() => ctx.locale.register(NS, {
|
|
@@ -1018,37 +951,45 @@ window.__ModuleLoader__.load({
|
|
|
1018
951
|
en
|
|
1019
952
|
}), `${NS}: dictionaries`);
|
|
1020
953
|
});
|
|
1021
|
-
ctx.inject(["slots", "locale"], (ctx) => {
|
|
1022
|
-
const layout = ctx.get("layout");
|
|
1023
|
-
const navigation = ctx.get("pluginNavigation");
|
|
1024
|
-
ctx.slots.inject("shell.overlay", () => ctx.slots.register({
|
|
1025
|
-
name: "shell.overlay",
|
|
1026
|
-
id: "lark-bridge-auth",
|
|
1027
|
-
order: 20,
|
|
1028
|
-
locale: NS,
|
|
1029
|
-
inject: () => ({ openSettings: () => {
|
|
1030
|
-
if (navigation?.openBundle !== void 0) {
|
|
1031
|
-
navigation.openBundle("dsh-plugin-lark-bridge");
|
|
1032
|
-
return;
|
|
1033
|
-
}
|
|
1034
|
-
layout?.selectPanel("plugins");
|
|
1035
|
-
} })
|
|
1036
|
-
}, AuthOverlay));
|
|
1037
|
-
});
|
|
1038
954
|
ctx.inject([
|
|
1039
955
|
"slots",
|
|
1040
956
|
"locale",
|
|
1041
957
|
"configForms"
|
|
1042
958
|
], (ctx) => {
|
|
1043
959
|
const form = new PluginConfigForm(ctx.configForms.get(ROW_ID));
|
|
960
|
+
const controller = new StatusController({ autoStart: typeof window !== "undefined" && typeof window.setInterval === "function" && typeof window.clearInterval === "function" });
|
|
1044
961
|
ctx.effect(() => () => {
|
|
962
|
+
controller.dispose();
|
|
1045
963
|
form.dispose();
|
|
1046
|
-
}, `${NS}:
|
|
964
|
+
}, `${NS}: shared state`);
|
|
965
|
+
const layout = ctx.get("layout");
|
|
966
|
+
const navigation = ctx.get("pluginNavigation");
|
|
967
|
+
const openSettings = () => {
|
|
968
|
+
if (navigation?.openBundle !== void 0) {
|
|
969
|
+
navigation.openBundle("dsh-plugin-lark-bridge");
|
|
970
|
+
return;
|
|
971
|
+
}
|
|
972
|
+
layout?.selectPanel("plugins");
|
|
973
|
+
};
|
|
974
|
+
ctx.slots.inject("shell.overlay", () => ctx.slots.register({
|
|
975
|
+
name: "shell.overlay",
|
|
976
|
+
id: "lark-bridge-auth",
|
|
977
|
+
order: 20,
|
|
978
|
+
locale: NS,
|
|
979
|
+
inject: () => ({
|
|
980
|
+
...form.inject(),
|
|
981
|
+
controller,
|
|
982
|
+
openSettings
|
|
983
|
+
})
|
|
984
|
+
}, AuthOverlay));
|
|
1047
985
|
ctx.slots.inject("plugins.row.config", () => ctx.slots.register({
|
|
1048
986
|
name: "plugins.row.config",
|
|
1049
987
|
key: ROW_KEY,
|
|
1050
988
|
locale: NS,
|
|
1051
|
-
inject: () =>
|
|
989
|
+
inject: () => ({
|
|
990
|
+
...form.inject(),
|
|
991
|
+
controller
|
|
992
|
+
})
|
|
1052
993
|
}, ConfigPage));
|
|
1053
994
|
});
|
|
1054
995
|
}
|