@michengai/dsh-im-connect 0.1.50 → 0.1.53
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/CHANGELOG.md +26 -0
- package/CHANGELOG.zh-CN.md +26 -0
- package/README.md +2 -2
- package/README.zh-CN.md +2 -2
- package/client.js +1440 -772
- package/lib/client.js +1860 -977
- package/lib/engine/command-locale.d.ts.map +1 -1
- package/lib/engine/command-locale.js +24 -2
- package/lib/engine/command-locale.js.map +1 -1
- package/lib/engine/file-delivery.d.ts +2 -0
- package/lib/engine/file-delivery.d.ts.map +1 -1
- package/lib/engine/file-delivery.js +29 -6
- package/lib/engine/file-delivery.js.map +1 -1
- package/package.json +23 -15
- package/src/engine/command-locale.ts +26 -2
- package/src/engine/file-delivery.ts +40 -6
- package/src/plugin-update-ui.js +198 -191
package/client.js
CHANGED
|
@@ -9,7 +9,343 @@ window.__ModuleLoader__.load({
|
|
|
9
9
|
const React = require("react");
|
|
10
10
|
const { useState, useEffect, useLayoutEffect, useCallback, useRef, useSyncExternalStore } = React;
|
|
11
11
|
const ReactDOM = require("react-dom");
|
|
12
|
-
const
|
|
12
|
+
const primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
13
|
+
const HostMenu = typeof primitives.Menu === "function" ? primitives.Menu : function MissingHostMenu(props) { return props.anchor || null; };
|
|
14
|
+
const HostModal = typeof primitives.Modal === "function" ? primitives.Modal : function MissingHostModal() { return null; };
|
|
15
|
+
const HostButton = typeof primitives.Button === "function" ? primitives.Button : function MissingHostButton(props) { return h("button", { type: "button", className: props && props.className, disabled: props && props.disabled, onClick: props && props.onClick }, props && props.children); };
|
|
16
|
+
// 0.1.7 把尺寸从图标名里拿掉了(IconEditOutlineRegular)。旧宿主仍导出 *16/*20。
|
|
17
|
+
function pickHostIcon(...names) {
|
|
18
|
+
for (const name of names) {
|
|
19
|
+
const icon = primitives[name];
|
|
20
|
+
if (typeof icon === "function") return icon;
|
|
21
|
+
}
|
|
22
|
+
return function MissingHostIcon() { return null; };
|
|
23
|
+
}
|
|
24
|
+
function hostOrFallback(icon, Fallback) {
|
|
25
|
+
return function HostOrFallback(props) {
|
|
26
|
+
const node = icon(props);
|
|
27
|
+
return node == null ? Fallback(props) : node;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
// 0.1.7 的 Menu 会渲染 children。更早的 Menu 只认 items。样式和列表功能不再按宿主版本分叉。
|
|
31
|
+
function hostMenuRendersChildren() {
|
|
32
|
+
return typeof primitives.IconEllipsisOutlineRegular === "function";
|
|
33
|
+
}
|
|
34
|
+
const IconListPenOutline16 = pickHostIcon("IconListPenOutlineRegular", "IconListPenOutline16");
|
|
35
|
+
const IconEditOutline16 = pickHostIcon("IconEditOutlineRegular", "IconEditOutline16");
|
|
36
|
+
const IconBranchOutline16 = pickHostIcon("IconBranchOutlineRegular", "IconBranchOutline16");
|
|
37
|
+
const IconArchiveOutline20 = pickHostIcon("IconArchiveOutlineRegular", "IconArchiveOutline20");
|
|
38
|
+
const IconArchiveCheckHost = pickHostIcon("IconArchiveCheckOutlineRegular");
|
|
39
|
+
const IconTrashOutline16 = pickHostIcon("IconTrashOutlineRegular", "IconTrashOutline16");
|
|
40
|
+
const IconEllipsisOutline16 = pickHostIcon("IconEllipsisOutlineRegular", "IconEllipsisOutline16");
|
|
41
|
+
const IconSearchHost = pickHostIcon("IconSearchOutlineRegular", "IconSearchOutline16");
|
|
42
|
+
const IconCloseFillHost = pickHostIcon("IconCloseFillRegular", "IconCloseOutline16");
|
|
43
|
+
const IconSlidersHost = pickHostIcon("IconSlidersTwoOutlineRegular", "IconSlidersOutline16");
|
|
44
|
+
const IconFolderClose = pickHostIcon("IconFolderCloseRegular", "IconFolderClose16", "IconFolderClose");
|
|
45
|
+
const IconClockOutline = pickHostIcon("IconClockOutlineRegular", "IconClockOutline16");
|
|
46
|
+
const IconFlatListOutline = pickHostIcon("IconFlatListOutlineRegular");
|
|
47
|
+
const antd = require("antd");
|
|
48
|
+
const { ConfigProvider, theme, Modal, Select, Switch, Button: AntdButton, Input, Progress, Checkbox, Segmented, Tag, Alert } = antd;
|
|
49
|
+
function Button(props) {
|
|
50
|
+
return React.createElement(AntdButton, Object.assign({ shape: "round", size: "middle" }, props));
|
|
51
|
+
}
|
|
52
|
+
const zhCN = require("antd/locale/zh_CN");
|
|
53
|
+
const enUS = require("antd/locale/en_US");
|
|
54
|
+
const antdZh = zhCN && zhCN.default ? zhCN.default : zhCN;
|
|
55
|
+
const antdEn = enUS && enUS.default ? enUS.default : enUS;
|
|
56
|
+
const HoverCard = primitives.HoverCard;
|
|
57
|
+
const StateDot = primitives.StateDot;
|
|
58
|
+
const IconSettingsOutline16 = pickHostIcon("IconSettingsOutlineRegular", "IconSettingsOutline16");
|
|
59
|
+
const ARCHIVE_MANAGER_PLUGIN = "@michengai/dsh-archive-manager";
|
|
60
|
+
function hasArchiveManagerPlugin(root) {
|
|
61
|
+
return !!(root && typeof root.querySelector === "function" && root.querySelector('[data-plugin="' + ARCHIVE_MANAGER_PLUGIN + '"]'));
|
|
62
|
+
}
|
|
63
|
+
function canDeleteChannelSession(archiveManagerInstalled, deleteSession) {
|
|
64
|
+
return archiveManagerInstalled && typeof deleteSession === "function";
|
|
65
|
+
}
|
|
66
|
+
function canArchiveChannelGroup(archiveManagerInstalled, archiveSession) {
|
|
67
|
+
return archiveManagerInstalled && typeof archiveSession === "function";
|
|
68
|
+
}
|
|
69
|
+
function folderPath(path) {
|
|
70
|
+
return String(path || "").replace(/\\/g, "/").replace(/\/+$/, "");
|
|
71
|
+
}
|
|
72
|
+
function owningParentFolder(path, candidates) {
|
|
73
|
+
const child = folderPath(path);
|
|
74
|
+
let owner;
|
|
75
|
+
let length = -1;
|
|
76
|
+
for (const parent of candidates) {
|
|
77
|
+
const root = folderPath(parent);
|
|
78
|
+
if (root.length > length && child !== root && child.startsWith(root + "/")) {
|
|
79
|
+
owner = parent;
|
|
80
|
+
length = root.length;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return owner;
|
|
84
|
+
}
|
|
85
|
+
function workspaceKey(workspace) {
|
|
86
|
+
return workspace.workspaceId || workspace.id || workspace.path || "";
|
|
87
|
+
}
|
|
88
|
+
/** 0.1.7 宿主的按工作区树:子目录挂到路径最长的已打开工作区下面。 */
|
|
89
|
+
function groupChannelSessionsByWorkspaceTree(sessions, workspaces, ungroupedLabel) {
|
|
90
|
+
const bySession = new Map();
|
|
91
|
+
for (const workspace of workspaces || []) {
|
|
92
|
+
for (const sessionId of workspace.sessionIds || []) bySession.set(sessionId, workspace);
|
|
93
|
+
}
|
|
94
|
+
const buckets = new Map();
|
|
95
|
+
const ungrouped = [];
|
|
96
|
+
for (const session of sessions) {
|
|
97
|
+
const workspace = bySession.get(session.sessionId);
|
|
98
|
+
const key = workspace ? workspaceKey(workspace) : "";
|
|
99
|
+
if (!workspace || !key) { ungrouped.push(session); continue; }
|
|
100
|
+
const bucket = buckets.get(key) || [];
|
|
101
|
+
bucket.push(session);
|
|
102
|
+
buckets.set(key, bucket);
|
|
103
|
+
}
|
|
104
|
+
const byPath = new Map();
|
|
105
|
+
for (const workspace of workspaces || []) {
|
|
106
|
+
if (workspace.path) byPath.set(folderPath(workspace.path), workspace);
|
|
107
|
+
}
|
|
108
|
+
const included = new Map();
|
|
109
|
+
for (const workspace of workspaces || []) {
|
|
110
|
+
const key = workspaceKey(workspace);
|
|
111
|
+
if (!key || !buckets.has(key)) continue;
|
|
112
|
+
included.set(key, workspace);
|
|
113
|
+
let path = workspace.path;
|
|
114
|
+
const seen = new Set();
|
|
115
|
+
while (path && !seen.has(path)) {
|
|
116
|
+
seen.add(path);
|
|
117
|
+
const parentPath = owningParentFolder(path, [...byPath.keys()]);
|
|
118
|
+
if (!parentPath) break;
|
|
119
|
+
const parent = byPath.get(folderPath(parentPath));
|
|
120
|
+
const parentKey = parent ? workspaceKey(parent) : "";
|
|
121
|
+
if (!parent || !parentKey) break;
|
|
122
|
+
included.set(parentKey, parent);
|
|
123
|
+
path = parent.path;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
const present = [...included.values()];
|
|
127
|
+
const paths = present.map((workspace) => workspace.path).filter(Boolean);
|
|
128
|
+
const children = new Map();
|
|
129
|
+
const roots = [];
|
|
130
|
+
for (const workspace of present) {
|
|
131
|
+
const parentPath = workspace.path ? owningParentFolder(workspace.path, paths) : undefined;
|
|
132
|
+
const parent = parentPath ? present.find((item) => item.path && folderPath(item.path) === folderPath(parentPath)) : undefined;
|
|
133
|
+
const parentKey = parent ? workspaceKey(parent) : "";
|
|
134
|
+
if (!parent || !parentKey) roots.push(workspace);
|
|
135
|
+
else {
|
|
136
|
+
const list = children.get(parentKey) || [];
|
|
137
|
+
list.push(workspace);
|
|
138
|
+
children.set(parentKey, list);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const byName = (left, right) => String(left.title || left.path || "").localeCompare(String(right.title || right.path || ""));
|
|
142
|
+
const groups = [];
|
|
143
|
+
const walk = (workspace, depth) => {
|
|
144
|
+
const key = workspaceKey(workspace);
|
|
145
|
+
const sessionsInWorkspace = buckets.get(key) || [];
|
|
146
|
+
const channelIds = [...new Set(sessionsInWorkspace.map((session) => session.channelId).filter(Boolean))];
|
|
147
|
+
groups.push({
|
|
148
|
+
id: key,
|
|
149
|
+
label: workspace.title || workspace.path || ungroupedLabel,
|
|
150
|
+
depth,
|
|
151
|
+
keep: sessionsInWorkspace.length === 0,
|
|
152
|
+
channelId: channelIds.length === 1 ? channelIds[0] : "",
|
|
153
|
+
sessions: sessionsInWorkspace,
|
|
154
|
+
});
|
|
155
|
+
for (const child of (children.get(key) || []).slice().sort(byName)) walk(child, depth + 1);
|
|
156
|
+
};
|
|
157
|
+
for (const root of roots.slice().sort(byName)) walk(root, 0);
|
|
158
|
+
if (ungrouped.length) groups.push({ id: "", label: ungroupedLabel, depth: 0, channelId: "", sessions: ungrouped });
|
|
159
|
+
return groups;
|
|
160
|
+
}
|
|
161
|
+
function channelSessionHoverStatuses(input, t) {
|
|
162
|
+
const count = input.runningSubagentCount || 0;
|
|
163
|
+
const subagents = count === 0 ? undefined : { state: "ongoing", label: t("rail.subagents", { n: count, count }) };
|
|
164
|
+
let pending;
|
|
165
|
+
if (input.pendingKind === "approval") pending = { state: "warning", label: t("rail.waitingApproval"), trailing: t("rail.compactApproval") };
|
|
166
|
+
else if (input.pendingKind === "plan-review") pending = { state: "warning", label: t("rail.planReview"), trailing: t("rail.compactPlan") };
|
|
167
|
+
else if (input.pendingKind === "question") pending = { state: "warning", label: t("rail.waitingAnswer"), trailing: t("rail.compactAnswer") };
|
|
168
|
+
let statuses;
|
|
169
|
+
if (pending) statuses = subagents ? [pending, subagents] : [pending];
|
|
170
|
+
else if (input.running) statuses = subagents ? [{ state: "ongoing", label: t("rail.running") }, subagents] : [{ state: "ongoing", label: t("rail.running") }];
|
|
171
|
+
else if (subagents) statuses = [subagents];
|
|
172
|
+
else if (input.completed) statuses = [{ state: "done", label: t("rail.completed") }];
|
|
173
|
+
else statuses = [{ state: "idle", label: t("rail.idle") }];
|
|
174
|
+
const visible = statuses.filter((status) => !(input.archived && (status.state === "done" || status.state === "idle")));
|
|
175
|
+
if (input.archived) visible.push({ state: "archived", label: t("rail.archived") });
|
|
176
|
+
return visible;
|
|
177
|
+
}
|
|
178
|
+
function placeSessionTitle(title, left, range) {
|
|
179
|
+
title.scrollLeft = left;
|
|
180
|
+
if (left > 0) title.dataset.scrolled = "";
|
|
181
|
+
else delete title.dataset.scrolled;
|
|
182
|
+
if (left < range) title.dataset.clipped = "";
|
|
183
|
+
else delete title.dataset.clipped;
|
|
184
|
+
}
|
|
185
|
+
function restSessionTitle(title) {
|
|
186
|
+
title.scrollLeft = 0;
|
|
187
|
+
delete title.dataset.scrolled;
|
|
188
|
+
delete title.dataset.clipped;
|
|
189
|
+
}
|
|
190
|
+
function startSessionTitleMarquee(title, frame) {
|
|
191
|
+
if (!title) return;
|
|
192
|
+
const range = title.scrollWidth - title.clientWidth;
|
|
193
|
+
if (range <= 8) return;
|
|
194
|
+
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
195
|
+
placeSessionTitle(title, range, range);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
cancelAnimationFrame(frame.id);
|
|
199
|
+
let previous;
|
|
200
|
+
let position = 0;
|
|
201
|
+
const step = (now) => {
|
|
202
|
+
position += previous === undefined ? 0 : (now - previous) * 0.03;
|
|
203
|
+
previous = now;
|
|
204
|
+
placeSessionTitle(title, Math.min(position, range), range);
|
|
205
|
+
if (position < range) frame.id = requestAnimationFrame(step);
|
|
206
|
+
};
|
|
207
|
+
frame.id = requestAnimationFrame(step);
|
|
208
|
+
}
|
|
209
|
+
function stopSessionTitleMarquee(title, frame) {
|
|
210
|
+
cancelAnimationFrame(frame.id);
|
|
211
|
+
if (title) restSessionTitle(title);
|
|
212
|
+
}
|
|
213
|
+
function channelSessionVisible(sessionId, archived, filter) {
|
|
214
|
+
if (!sessionId) return false;
|
|
215
|
+
const isArchived = archived.has(sessionId);
|
|
216
|
+
if (filter === "only") return isArchived;
|
|
217
|
+
if (filter === "show") return true;
|
|
218
|
+
return !isArchived;
|
|
219
|
+
}
|
|
220
|
+
async function archiveChannelGroup(sessionIds, archiveSession, options) {
|
|
221
|
+
for (const sessionId of sessionIds) await archiveSession(sessionId, options);
|
|
222
|
+
}
|
|
223
|
+
function openStopArchive(error, target, open) {
|
|
224
|
+
if (typeof open !== "function" || !activeSessionRefusal(error)) return false;
|
|
225
|
+
open(target);
|
|
226
|
+
return true;
|
|
227
|
+
}
|
|
228
|
+
async function finishStopArchive(target, archiveSession) {
|
|
229
|
+
if (!target || typeof archiveSession !== "function") return "unavailable";
|
|
230
|
+
if (target.sessionIds) {
|
|
231
|
+
await archiveChannelGroup(target.sessionIds, archiveSession, { stopActivity: true });
|
|
232
|
+
return "group";
|
|
233
|
+
}
|
|
234
|
+
await archiveSession(target.id, { stopActivity: true });
|
|
235
|
+
return "session";
|
|
236
|
+
}
|
|
237
|
+
const CHANNEL_SETTINGS_EVENT = "dsh-im-connect:open-channel-settings";
|
|
238
|
+
const CHANNEL_SETTINGS_STORAGE_KEY = "dsh-im-connect:pending-channel-settings";
|
|
239
|
+
const SETTINGS_CODEX_TRIGGER_SELECTOR = "[data-dcu-settings-trigger]";
|
|
240
|
+
const SETTINGS_CODEX_PAGE_SELECTOR = "[data-dcu-settings-page]";
|
|
241
|
+
const SETTINGS_OPEN_SECTION_EVENT = "dcu-settings-open-section";
|
|
242
|
+
function parseChannelSettingsRequest(value) {
|
|
243
|
+
if (!value || typeof value !== "object") return undefined;
|
|
244
|
+
const channelId = typeof value.channelId === "string" ? value.channelId.trim() : "";
|
|
245
|
+
if (!channelId) return undefined;
|
|
246
|
+
return { channelId, name: typeof value.name === "string" ? value.name : "" };
|
|
247
|
+
}
|
|
248
|
+
function writeChannelSettingsRequest(storage, request) {
|
|
249
|
+
try { storage && storage.setItem(CHANNEL_SETTINGS_STORAGE_KEY, JSON.stringify(request)); } catch { /* ignore */ }
|
|
250
|
+
}
|
|
251
|
+
function requestChannelSettings(request) {
|
|
252
|
+
if (typeof window === "undefined") return;
|
|
253
|
+
writeChannelSettingsRequest(window.sessionStorage, request);
|
|
254
|
+
window.dispatchEvent(new CustomEvent(CHANNEL_SETTINGS_EVENT, { detail: request }));
|
|
255
|
+
}
|
|
256
|
+
function readChannelSettingsRequest(storage) {
|
|
257
|
+
if (!storage) return undefined;
|
|
258
|
+
try {
|
|
259
|
+
const raw = storage.getItem(CHANNEL_SETTINGS_STORAGE_KEY);
|
|
260
|
+
return raw == null ? undefined : parseChannelSettingsRequest(JSON.parse(raw));
|
|
261
|
+
} catch { return undefined; }
|
|
262
|
+
}
|
|
263
|
+
function clearChannelSettingsRequest(storage) {
|
|
264
|
+
try { storage && storage.removeItem(CHANNEL_SETTINGS_STORAGE_KEY); } catch { /* ignore */ }
|
|
265
|
+
}
|
|
266
|
+
function resolveChannelSettingsTarget(request, channels) {
|
|
267
|
+
const parsed = parseChannelSettingsRequest(request);
|
|
268
|
+
if (!parsed || !Array.isArray(channels)) return undefined;
|
|
269
|
+
const channel = channels.find((item) => item && item.id === parsed.channelId);
|
|
270
|
+
if (!channel) return undefined;
|
|
271
|
+
const accounts = channel.accounts || [];
|
|
272
|
+
return { channelId: channel.id, accountId: accounts.length === 1 ? accounts[0].id : undefined };
|
|
273
|
+
}
|
|
274
|
+
function pickSettingsSectionButton(buttons, labels) {
|
|
275
|
+
for (const label of labels) {
|
|
276
|
+
const target = String(label || "").trim();
|
|
277
|
+
if (!target) continue;
|
|
278
|
+
const match = buttons.find((button) => String(button.textContent || "").replace(/\s+/g, " ").trim() === target);
|
|
279
|
+
if (match) return match;
|
|
280
|
+
}
|
|
281
|
+
return undefined;
|
|
282
|
+
}
|
|
283
|
+
function pickSettingsLauncher(buttons) {
|
|
284
|
+
const named = buttons.find((button) => {
|
|
285
|
+
const label = `${button.textContent || ""} ${typeof button.getAttribute === "function" ? button.getAttribute("aria-label") || "" : ""}`.trim();
|
|
286
|
+
return /(^|\s)(设置|settings)(\s|$)/i.test(label);
|
|
287
|
+
});
|
|
288
|
+
return named || (buttons.length === 1 ? buttons[0] : undefined);
|
|
289
|
+
}
|
|
290
|
+
function requestCodexSettingsSection(labels) {
|
|
291
|
+
const trigger = typeof document !== "undefined" && document.querySelector(SETTINGS_CODEX_TRIGGER_SELECTOR);
|
|
292
|
+
if (!trigger) return false;
|
|
293
|
+
const request = new CustomEvent(SETTINGS_OPEN_SECTION_EVENT, { detail: { labels: [...labels] }, cancelable: true });
|
|
294
|
+
return !trigger.dispatchEvent(request);
|
|
295
|
+
}
|
|
296
|
+
function openSettingsSection(labels, onSelected, onMissing) {
|
|
297
|
+
if (typeof document === "undefined" || typeof window === "undefined") {
|
|
298
|
+
if (onMissing) onMissing();
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
if (requestCodexSettingsSection(labels)) {
|
|
302
|
+
if (onSelected) onSelected();
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
const launchers = [...document.querySelectorAll('button[aria-haspopup="dialog"]')];
|
|
306
|
+
const launcher = pickSettingsLauncher(launchers);
|
|
307
|
+
const pageTrigger = document.querySelector(SETTINGS_CODEX_TRIGGER_SELECTOR);
|
|
308
|
+
const dialogOpen = document.querySelector('[role="dialog"]') !== null;
|
|
309
|
+
const pageOpen = document.querySelector(SETTINGS_CODEX_PAGE_SELECTOR) !== null;
|
|
310
|
+
if (!dialogOpen && !pageOpen && !launcher && !pageTrigger) {
|
|
311
|
+
if (onMissing) onMissing();
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
if (!dialogOpen && !pageOpen) (pageTrigger || launcher).click();
|
|
315
|
+
let frame;
|
|
316
|
+
let finished = false;
|
|
317
|
+
const observer = new MutationObserver(() => { schedule(); });
|
|
318
|
+
const cleanup = () => {
|
|
319
|
+
if (finished) return;
|
|
320
|
+
finished = true;
|
|
321
|
+
observer.disconnect();
|
|
322
|
+
window.clearTimeout(timeout);
|
|
323
|
+
if (frame !== undefined) window.cancelAnimationFrame(frame);
|
|
324
|
+
};
|
|
325
|
+
const select = () => {
|
|
326
|
+
const buttons = [
|
|
327
|
+
...document.querySelectorAll('[role="dialog"] nav button'),
|
|
328
|
+
...document.querySelectorAll(SETTINGS_CODEX_PAGE_SELECTOR + " nav button"),
|
|
329
|
+
];
|
|
330
|
+
const target = pickSettingsSectionButton(buttons, labels);
|
|
331
|
+
if (!target) return false;
|
|
332
|
+
cleanup();
|
|
333
|
+
target.click();
|
|
334
|
+
if (onSelected) onSelected();
|
|
335
|
+
return true;
|
|
336
|
+
};
|
|
337
|
+
const schedule = () => {
|
|
338
|
+
if (finished || frame !== undefined) return;
|
|
339
|
+
frame = window.requestAnimationFrame(() => { frame = undefined; select(); });
|
|
340
|
+
};
|
|
341
|
+
const timeout = window.setTimeout(() => {
|
|
342
|
+
if (select()) return;
|
|
343
|
+
cleanup();
|
|
344
|
+
if (onMissing) onMissing();
|
|
345
|
+
}, 1500);
|
|
346
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
347
|
+
schedule();
|
|
348
|
+
}
|
|
13
349
|
const EMPTY_EXTRA_TABS = [];
|
|
14
350
|
const inject = ["slots", "sessions", "workspaces", "locale"];
|
|
15
351
|
const API_BASE = "/api/dsh-im-connect";
|
|
@@ -51,21 +387,23 @@ window.__ModuleLoader__.load({
|
|
|
51
387
|
"connection.title": "本次状态检查", "connection.scope": "仅检查本机渠道运行状态,未验证平台凭据或消息收发。", "connection.checkedAt": "检查时间", "connection.receiveOn": "接收开关已开启", "connection.receiveOff": "接收开关已关闭;请在账号列表开启后再发送消息。", "connection.checking": "检查中…",
|
|
52
388
|
"connection.next.connected": "可在原聊天发送消息验证收发;私聊仍需符合准入设置。", "connection.next.connecting": "请稍后再次检查;等待扫码时请完成手机确认。", "connection.next.reconnecting": "渠道正在尝试恢复,请稍后再次检查。", "connection.next.disconnected": "请重新连接;需要扫码的渠道可重新添加绑定。", "connection.next.stopped": "请点击重新连接以启动账号。", "connection.next.error": "请尝试重新连接;仍有异常时查看本机日志。", "connection.next.unknown": "暂时无法确认状态,请稍后再检查或查看本机日志。",
|
|
53
389
|
"settings.label": "IM助理", "settings.title": "IM助理", "settings.description": "管理各渠道账号。每个账号独立选择工作区、模型和权限,配置仅保存在本机。", "settings.viewProject": "GitHub", "settings.feedback": "问题反馈",
|
|
54
|
-
"settings.aria": "IM助理", "settings.
|
|
55
|
-
"account.
|
|
390
|
+
"settings.aria": "IM助理", "settings.publicChatNotice": "未批准用户可以发起聊天,但不能批准工具调用。", "pending.notice": "有访问请求。批准后该用户才能驱动本机助手。", "action.approve": "批准", "action.deny": "拒绝", "loading": "加载中…",
|
|
391
|
+
"account.presetUnavailable": "预设不可用", "account.presetNote": "更改后使用新会话,旧会话保留。", "action.settings": "设置", "command.dm": "私聊命令", "command.group": "群聊命令", "command.enabled": "可以执行命令", "command.disabled": "仅正常对话",
|
|
56
392
|
"account.workspace": "工作区", "account.currentWorkspace": "当前工作区", "account.selectWorkspace": "请选择工作区", "account.selectModel": "请选择模型", "account.selectPermission": "请选择权限", "account.privateAccess": "私聊准入", "account.privateApproved": "仅已批准用户", "account.privateAll": "允许所有私聊用户", "account.autoNameNote": "绑定成功后会自动生成账号名,无需手动填写。", "account.defaultName": "{channel}账号 {count}",
|
|
57
|
-
"account.count": "{count} 个账号", "account.
|
|
393
|
+
"account.count": "{count} 个账号", "account.statusProcessing": "处理中…", "account.statusNotConnected": "未连接", "account.receive": "接收消息", "account.receiveDescription": "关闭后保留账号配置,但不接收新消息", "account.removeConfirm": "确定移除这个账号?本机保存的配置和凭据将一并删除。",
|
|
58
394
|
"action.addAccount": "添加账号", "action.generateQr": "生成二维码", "action.checkConnection": "诊断连接", "action.reconnectAccount": "重新连接", "action.removeAccount": "移除接入", "status.saving": "保存中…", "status.saved": "已保存",
|
|
59
395
|
"channel.dingtalk": "钉钉", "channel.feishu": "飞书", "channel.lark": "Lark", "channel.weixin": "微信", "channel.wecom": "企业微信", "channel.qq": "QQ", "channel.telegram": "Telegram",
|
|
60
396
|
"field.dingtalk.clientId": "Client ID(原 AppKey)", "field.dingtalk.clientSecret": "Client Secret(原 AppSecret)",
|
|
61
|
-
"
|
|
397
|
+
"field.wecom.botId": "Bot ID", "field.wecom.secret": "Secret", "field.qq.appId": "AppID", "field.qq.appSecret": "AppSecret", "field.telegram.token": "Bot Token",
|
|
398
|
+
"bind.title": "配置 {channel}", "bind.quick": "快捷绑定(推荐)", "bind.manual": "手动配置", "bind.saving": "正在保存账号…", "bind.success": "绑定成功,频道已连接", "bind.newIdentity": "检测到新的账号身份,已创建新账号", "bind.qrAlt": "{channel} 绑定二维码", "bind.generating": "正在生成…", "bind.expire": "二维码 {time} 后过期", "bind.scanned": "已扫码,请在手机上确认", "bind.retry": "请重新生成二维码", "bind.refresh": "重新生成二维码", "action.saving": "保存中…", "action.confirm": "确认",
|
|
62
399
|
"qr.weixin": "请使用微信扫描二维码完成绑定", "qr.feishu": "请使用飞书扫描二维码,将自动创建机器人", "qr.lark": "请使用 Lark 扫描二维码完成配对", "qr.wecom": "请使用企业微信扫描二维码,快捷绑定机器人", "qr.dingtalk": "请使用钉钉扫描二维码,自动创建机器人", "qr.qq": "请使用手机 QQ 扫描二维码,创建开放平台机器人", "qr.default": "请使用对应 App 扫描二维码",
|
|
63
|
-
"status.
|
|
400
|
+
"status.connected": "已连接", "action.more": "{channel} 更多",
|
|
64
401
|
"error.loadAssistant": "无法加载账号配置", "error.noModels": "当前 Host 还没有可用模型,请先在网页里配置提供商", "error.save": "保存失败", "error.chooseWorkspace": "请选择工作区目录", "error.workspaceUnavailable": "当前 Host 无法新增工作区", "error.addWorkspace": "新增工作区失败", "error.load": "加载失败", "error.connection": "无法连接本机 IM 助理接口", "error.request": "请求失败", "error.action": "操作失败", "error.qr": "无法生成二维码", "error.detailsInLog": "操作失败,请查看服务器日志。",
|
|
65
|
-
"composer.
|
|
402
|
+
"composer.noWorkspaces": "暂无工作区", "composer.addWorkspace": "添加工作区…", "composer.permission": "权限", "composer.noModels": "暂无模型", "composer.workspacePath": "工作区路径", "action.cancel": "取消", "action.adding": "添加中…",
|
|
66
403
|
"permission.readOnly": "只读", "permission.workspaceWrite": "工作区写入", "permission.fullAccess": "完全访问",
|
|
67
|
-
"rail.workspace": "工作区", "rail.search": "搜索", "rail.searchPlaceholder": "搜索会话...", "rail.clearSearch": "清除搜索", "rail.filter": "筛选", "rail.group": "分组方式", "rail.byWorkspace": "按工作区", "rail.list": "单列表", "rail.
|
|
68
|
-
"time.now": "刚刚", "time.minutes": "{
|
|
404
|
+
"rail.workspace": "工作区", "rail.sessions": "会话", "rail.search": "搜索", "rail.searchPlaceholder": "搜索会话...", "rail.clearSearch": "清除搜索", "rail.filter": "筛选", "rail.group": "分组方式", "rail.byWorkspace": "按工作区", "rail.list": "单列表", "rail.byWorkspaceTree": "按工作区树", "rail.sort": "排序方式", "rail.recent": "最近更新", "rail.showArchived": "显示已归档", "rail.onlyArchived": "仅显示已归档", "rail.running": "运行中", "rail.idle": "空闲", "rail.waitingApproval": "等待审批", "rail.planReview": "计划待审", "rail.waitingAnswer": "等待回答", "rail.subagents": "{n} 个子代理运行中", "rail.completed": "已完成", "rail.archived": "已归档", "rail.compactApproval": "待审批", "rail.compactPlan": "计划待审", "rail.compactAnswer": "待回答", "rail.renameAria": "重命名会话", "rail.rename": "重命名", "rail.fork": "分叉会话", "rail.archive": "归档会话", "rail.unarchive": "恢复会话", "rail.stopArchive": "停止并归档", "rail.stopArchiveDescription": "会话“{name}”仍在运行。停止后才能归档。", "rail.stopArchiveConfirm": "停止并归档", "rail.stopArchivePending": "正在停止并归档…", "rail.stopArchiveGroupDescription": "“{name}”下仍有运行中的会话。停止这些会话后才能归档整组。", "rail.archiveFailed": "归档失败,未移除会话。请稍后重试或检查宿主日志。", "rail.deleteSession": "删除会话", "rail.deleteSessionConfirm": "删除会话", "rail.deleteSessionDescription": "将永久删除会话“{name}”及其子代理(含正在运行的)和全部记录(对话内容、统计、缓存),此操作不可恢复。", "rail.deleteSessionPending": "正在删除会话…", "rail.deleteSessionFailed": "删除会话失败:{message}", "rail.deleteSessionClose": "关闭", "rail.deleteSessionCancel": "取消", "rail.groupActions": "“{name}”的频道操作", "rail.channelSettings": "渠道设置", "rail.archiveGroup": "归档整组会话", "rail.archiveGroupConfirm": "确认归档", "rail.archiveGroupDescription": "将归档“{name}”下的 {count} 个会话。归档后可以在“设置 → 已归档”中恢复。", "rail.archiveGroupPending": "正在归档整组会话…", "rail.archiveGroupFailed": "部分会话归档失败:{message}", "rail.archiveGroupClose": "关闭", "rail.archiveGroupCancel": "取消", "rail.empty": "还没有频道会话。先在设置 → IM助理 里连接渠道,并给机器人发一条消息。", "rail.noTasks": "暂无网页任务", "rail.ungrouped": "未分组", "rail.tabsAria": "工作区分类", "rail.tasks": "任务", "rail.channels": "频道",
|
|
405
|
+
"time.now": "刚刚", "time.minutes": "{n}分钟", "time.hours": "{n}小时", "time.days": "{n}天", "time.months": "{n}个月", "time.years": "{n}年", "time.ago": "{t}前",
|
|
406
|
+
"copy": "复制", "hover.copied": "已复制",
|
|
69
407
|
"server.unknownChannel": "未知渠道", "server.channelUnconfigured": "渠道未配置", "server.sessionMissing": "会话不存在", "server.accountMissing": "账号不存在", "server.accountConnectFailed": "账号连接失败,请查看本机日志", "server.accountReconnectFailed": "重新连接失败,请查看本机日志", "server.selectAccountSettings": "请选择提供商、模型、工作区或权限", "server.selectModel": "请选择提供商和模型", "server.selectWorkspace": "请选择工作区", "server.selectPermission": "请选择权限", "server.missingCredentials": "凭据不足,无法启动渠道", "server.qrUnsupported": "该渠道不支持扫码绑定", "server.qrExpired": "二维码已过期", "server.qrIncomplete": "扫码未完成", "server.accessDenied": "未授权:请管理员在设置 → IM助理 中批准你的访问。",
|
|
70
408
|
"status.disconnected": "已断开", "status.reconnectFailed": "重连失败", "status.connectingSocket": "连接中", "status.waitHandshake": "等待网关握手", "status.authenticating": "鉴权中", "status.reconnecting": "重连中", "status.connectionError": "连接错误", "status.connectionFailed": "连接失败", "status.streamConnected": "Stream 已连接", "status.stopped": "已停止", "status.longConnection": "长连接已建立", "status.polling": "轮询中", "status.notLoggedIn": "未登录", "status.waitQr": "等待扫码", "status.loggedIn": "已登录", "status.loggedInRecovered": "已登录(自动恢复)", "status.loggingIn": "登录中",
|
|
71
409
|
},
|
|
@@ -77,118 +415,87 @@ window.__ModuleLoader__.load({
|
|
|
77
415
|
"connection.title": "Status check result", "connection.scope": "Checks local channel runtime only. Platform credentials and message delivery have not been verified.", "connection.checkedAt": "Checked at", "connection.receiveOn": "Receiving is enabled", "connection.receiveOff": "Receiving is disabled. Enable it in the account list before sending messages.", "connection.checking": "Checking…",
|
|
78
416
|
"connection.next.connected": "Send a message in the original chat to verify delivery. Private chats still follow access settings.", "connection.next.connecting": "Check again shortly. Complete confirmation on your phone if a QR scan is pending.", "connection.next.reconnecting": "The channel is attempting to recover. Check again shortly.", "connection.next.disconnected": "Reconnect the account. QR channels may need to be added again.", "connection.next.stopped": "Select Reconnect to start the account.", "connection.next.error": "Try reconnecting. If the issue persists, check the local logs.", "connection.next.unknown": "The current state could not be confirmed. Check again later or inspect the local logs.",
|
|
79
417
|
"settings.label": "IM Assistant", "settings.title": "IM Assistant", "settings.description": "Manage accounts across channels. Each account has its own workspace, model, and permission settings, stored only on this machine.", "settings.viewProject": "GitHub", "settings.feedback": "Issues",
|
|
80
|
-
"settings.aria": "IM Assistant", "settings.
|
|
81
|
-
"account.
|
|
418
|
+
"settings.aria": "IM Assistant", "settings.publicChatNotice": "Unapproved users can start chats, but they cannot approve tool calls.", "pending.notice": "There are access requests. Approve a user before they can control the local assistant.", "action.approve": "Approve", "action.deny": "Deny", "loading": "Loading…",
|
|
419
|
+
"account.presetUnavailable": "Preset unavailable", "account.presetNote": "Changes start a new session; previous sessions are kept.", "action.settings": "Settings", "command.dm": "DM commands", "command.group": "Group commands", "command.enabled": "Commands enabled", "command.disabled": "Conversation only",
|
|
82
420
|
"account.workspace": "Workspace", "account.currentWorkspace": "Current workspace", "account.selectWorkspace": "Select a workspace", "account.selectModel": "Select a model", "account.selectPermission": "Select a permission", "account.privateAccess": "Private chat access", "account.privateApproved": "Approved users only", "account.privateAll": "Allow all DM users", "account.autoNameNote": "The account name is generated automatically after setup.", "account.defaultName": "{channel} account {count}",
|
|
83
|
-
"account.count": "{count} accounts", "account.
|
|
421
|
+
"account.count": "{count} accounts", "account.statusProcessing": "Processing…", "account.statusNotConnected": "Not connected", "account.receive": "Receive messages", "account.receiveDescription": "Turn this off to keep the account settings without receiving new messages", "account.removeConfirm": "Remove this account? Its saved settings and credentials will also be deleted.",
|
|
84
422
|
"action.addAccount": "Add account", "action.generateQr": "Generate QR code", "action.checkConnection": "Diagnose connection", "action.reconnectAccount": "Reconnect", "action.removeAccount": "Remove", "status.saving": "Saving…", "status.saved": "Saved",
|
|
85
423
|
"channel.dingtalk": "DingTalk", "channel.feishu": "Feishu", "channel.lark": "Lark", "channel.weixin": "WeChat", "channel.wecom": "WeCom", "channel.qq": "QQ", "channel.telegram": "Telegram",
|
|
86
424
|
"field.dingtalk.clientId": "Client ID (formerly AppKey)", "field.dingtalk.clientSecret": "Client Secret (formerly AppSecret)",
|
|
87
|
-
"
|
|
425
|
+
"field.wecom.botId": "Bot ID", "field.wecom.secret": "Secret", "field.qq.appId": "AppID", "field.qq.appSecret": "AppSecret", "field.telegram.token": "Bot Token",
|
|
426
|
+
"bind.title": "Set up {channel}", "bind.quick": "Quick setup (recommended)", "bind.manual": "Manual setup", "bind.saving": "Saving account…", "bind.success": "Connected successfully", "bind.newIdentity": "A new account identity was detected and a new account was created", "bind.qrAlt": "{channel} setup QR code", "bind.generating": "Generating…", "bind.expire": "QR code expires in {time}", "bind.scanned": "Scanned. Confirm on your phone.", "bind.retry": "Generate a new QR code", "bind.refresh": "Generate a new QR code", "action.saving": "Saving…", "action.confirm": "Confirm",
|
|
88
427
|
"qr.weixin": "Scan the QR code with WeChat to connect", "qr.feishu": "Scan with Feishu; a bot will be created automatically", "qr.lark": "Scan with Lark to pair", "qr.wecom": "Scan with WeCom to quickly connect a bot", "qr.dingtalk": "Scan with DingTalk; a bot will be created automatically", "qr.qq": "Scan with mobile QQ to create an Open Platform bot", "qr.default": "Scan the QR code with the corresponding app",
|
|
89
|
-
"status.
|
|
428
|
+
"status.connected": "Connected", "action.more": "More options for {channel}",
|
|
90
429
|
"error.loadAssistant": "Could not load account settings", "error.noModels": "No models are available in the Host. Configure a provider in the web app first.", "error.save": "Could not save", "error.chooseWorkspace": "Choose a workspace directory", "error.workspaceUnavailable": "This Host cannot create workspaces", "error.addWorkspace": "Could not add workspace", "error.load": "Could not load", "error.connection": "Could not connect to the local IM Assistant API", "error.request": "Request failed", "error.action": "Action failed", "error.qr": "Could not generate a QR code", "error.detailsInLog": "The operation failed. Check the server logs for details.",
|
|
91
|
-
"composer.
|
|
430
|
+
"composer.noWorkspaces": "No workspaces", "composer.addWorkspace": "Add workspace…", "composer.permission": "Permission", "composer.noModels": "No models", "composer.workspacePath": "Workspace path", "action.cancel": "Cancel", "action.adding": "Adding…",
|
|
92
431
|
"permission.readOnly": "Read Only", "permission.workspaceWrite": "Workspace Write", "permission.fullAccess": "Full access",
|
|
93
|
-
"rail.workspace": "Workspaces", "rail.search": "Search", "rail.searchPlaceholder": "Search sessions...", "rail.clearSearch": "Clear search", "rail.filter": "Filter", "rail.group": "Group by", "rail.byWorkspace": "By workspace", "rail.list": "Single list", "rail.
|
|
94
|
-
"time.now": "
|
|
432
|
+
"rail.workspace": "Workspaces", "rail.sessions": "Sessions", "rail.search": "Search", "rail.searchPlaceholder": "Search sessions...", "rail.clearSearch": "Clear search", "rail.filter": "Filter", "rail.group": "Group by", "rail.byWorkspace": "By workspace", "rail.list": "Single list", "rail.byWorkspaceTree": "Workspace Tree", "rail.sort": "Sort by", "rail.recent": "Recently updated", "rail.showArchived": "Show archived", "rail.onlyArchived": "Archived only", "rail.running": "Running", "rail.idle": "Idle", "rail.waitingApproval": "Waiting for approval", "rail.planReview": "Plan to review", "rail.waitingAnswer": "Waiting for an answer", "rail.subagents": "{n} subagents running", "rail.completed": "Completed", "rail.archived": "Archived", "rail.compactApproval": "Approval", "rail.compactPlan": "Plan review", "rail.compactAnswer": "Answer", "rail.renameAria": "Rename session", "rail.rename": "Rename", "rail.fork": "Fork session", "rail.archive": "Archive session", "rail.unarchive": "Restore session", "rail.stopArchive": "Stop and archive", "rail.stopArchiveDescription": "Session “{name}” is still running. Stop it before archiving.", "rail.stopArchiveConfirm": "Stop and archive", "rail.stopArchivePending": "Stopping and archiving…", "rail.stopArchiveGroupDescription": "Some conversations in “{name}” are still running. Stop them before archiving the group.", "rail.archiveFailed": "Archive failed. The session was kept. Retry or check the Host logs.", "rail.deleteSession": "Delete session", "rail.deleteSessionConfirm": "Delete session", "rail.deleteSessionDescription": "This permanently deletes session “{name}”, its child agents (including any that are still running), and all of its records (conversation, stats, cache). This cannot be undone.", "rail.deleteSessionPending": "Deleting session…", "rail.deleteSessionFailed": "Could not delete the session: {message}", "rail.deleteSessionClose": "Close", "rail.deleteSessionCancel": "Cancel", "rail.groupActions": "Actions for {name}", "rail.channelSettings": "Channel settings", "rail.archiveGroup": "Archive all conversations", "rail.archiveGroupConfirm": "Archive all", "rail.archiveGroupDescription": "Archive all {count} conversations for “{name}”. You can restore them later in Settings → Archived.", "rail.archiveGroupPending": "Archiving conversations…", "rail.archiveGroupFailed": "Some conversations could not be archived: {message}", "rail.archiveGroupClose": "Close", "rail.archiveGroupCancel": "Cancel", "rail.empty": "No channel sessions yet. Connect a channel in Settings → IM Assistant, then send the bot a message.", "rail.noTasks": "No web tasks", "rail.ungrouped": "Ungrouped", "rail.tabsAria": "Workspace categories", "rail.tasks": "Tasks", "rail.channels": "Channels",
|
|
433
|
+
"time.now": "now", "time.minutes": "{n}min", "time.hours": "{n}h", "time.days": "{n}d", "time.months": "{n}mo", "time.years": "{n}y", "time.ago": "{t} ago",
|
|
434
|
+
"copy": "Copy", "hover.copied": "Copied",
|
|
95
435
|
"server.unknownChannel": "Unknown channel", "server.channelUnconfigured": "Channel is not configured", "server.sessionMissing": "Session does not exist", "server.accountMissing": "Account does not exist", "server.accountConnectFailed": "Could not connect the account. Check the local logs.", "server.accountReconnectFailed": "Could not reconnect the account. Check the local logs.", "server.selectAccountSettings": "Select a provider, model, workspace, or permission setting", "server.selectModel": "Select a provider and model", "server.selectWorkspace": "Select a workspace", "server.selectPermission": "Select a permission", "server.missingCredentials": "The channel cannot start because credentials are missing", "server.qrUnsupported": "This channel does not support QR setup", "server.qrExpired": "QR code has expired", "server.qrIncomplete": "QR setup was not completed", "server.accessDenied": "Access denied: ask an administrator to approve you in Settings → IM Assistant.",
|
|
96
436
|
"status.disconnected": "Disconnected", "status.reconnectFailed": "Reconnect failed", "status.connectingSocket": "Connecting", "status.waitHandshake": "Waiting for gateway handshake", "status.authenticating": "Authenticating", "status.reconnecting": "Reconnecting", "status.connectionError": "Connection error", "status.connectionFailed": "Connection failed", "status.streamConnected": "Stream connected", "status.stopped": "Stopped", "status.longConnection": "Long connection established", "status.polling": "Polling", "status.notLoggedIn": "Not signed in", "status.waitQr": "Waiting for scan", "status.loggedIn": "Signed in", "status.loggedInRecovered": "Signed in (restored)", "status.loggingIn": "Signing in",
|
|
97
437
|
},
|
|
98
438
|
};
|
|
99
439
|
const fallbackT = (key) => key;
|
|
100
440
|
const h = React.createElement;
|
|
441
|
+
function currentUiLang() {
|
|
442
|
+
try {
|
|
443
|
+
if (typeof document !== "undefined" && document.documentElement && document.documentElement.lang) {
|
|
444
|
+
if (/^en/i.test(document.documentElement.lang)) return "en";
|
|
445
|
+
if (/^zh/i.test(document.documentElement.lang)) return "zh";
|
|
446
|
+
}
|
|
447
|
+
} catch { /* ignore */ }
|
|
448
|
+
return "zh";
|
|
449
|
+
}
|
|
450
|
+
function hostIsDark() {
|
|
451
|
+
if (typeof document === "undefined") return false;
|
|
452
|
+
return document.documentElement.hasAttribute("data-ds-dark-theme")
|
|
453
|
+
|| (document.body && document.body.hasAttribute("data-ds-dark-theme") === true);
|
|
454
|
+
}
|
|
455
|
+
function useHostDark() {
|
|
456
|
+
const [dark, setDark] = useState(hostIsDark);
|
|
457
|
+
useEffect(() => {
|
|
458
|
+
const update = () => setDark(hostIsDark());
|
|
459
|
+
update();
|
|
460
|
+
const observer = new MutationObserver(update);
|
|
461
|
+
observer.observe(document.documentElement, { attributes: true, attributeFilter: ["data-ds-dark-theme"] });
|
|
462
|
+
if (document.body) observer.observe(document.body, { attributes: true, attributeFilter: ["data-ds-dark-theme"] });
|
|
463
|
+
return () => observer.disconnect();
|
|
464
|
+
}, []);
|
|
465
|
+
return dark;
|
|
466
|
+
}
|
|
467
|
+
function AntdProvider({ children, locale }) {
|
|
468
|
+
const dark = useHostDark();
|
|
469
|
+
const lang = locale || currentUiLang();
|
|
470
|
+
return h(ConfigProvider, {
|
|
471
|
+
locale: lang === "en" ? antdEn : antdZh,
|
|
472
|
+
theme: {
|
|
473
|
+
algorithm: dark ? theme.darkAlgorithm : theme.defaultAlgorithm,
|
|
474
|
+
token: { fontFamily: "inherit" },
|
|
475
|
+
components: { Button: { borderRadius: 8 } },
|
|
476
|
+
},
|
|
477
|
+
button: { autoInsertSpace: false },
|
|
478
|
+
}, children);
|
|
479
|
+
}
|
|
101
480
|
|
|
102
481
|
const CSS = `
|
|
103
|
-
.ima-page{--ima-text:var(--dsw-alias-label-primary,var(--dsh-text,#e6edf3));--ima-muted:var(--dsw-alias-label-tertiary,var(--dsh-text-muted,#8b949e));--ima-line:var(--dsw-alias-border-l2,var(--dsh-border,rgba(255,255,255,.1)));--ima-card:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.04));--ima-card-hover:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06));--ima-ok:var(--dsw-alias-state-success-primary,#3fb950);--ima-warning:var(--dsw-alias-state-warning-primary,#d29922);--ima-danger:var(--dsw-alias-state-error-primary,#f85149);--ima-accent:var(--dsw-alias-brand-primary,#4b7cff)
|
|
104
|
-
.ima-
|
|
105
|
-
.ima-
|
|
106
|
-
.ima-
|
|
107
|
-
.ima-
|
|
108
|
-
.ima-
|
|
109
|
-
.ima-
|
|
110
|
-
.ima-
|
|
111
|
-
.ima-avatar.user{background:#3d3428}
|
|
112
|
-
.ima-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:12px}.ima-title{margin:0;font-size:24px;line-height:32px;font-weight:600;letter-spacing:-.4px;white-space:nowrap;text-align:left}
|
|
113
|
-
.ima-sub{margin:12px 0 0;max-width:42em;color:var(--ima-muted);font-size:14px;line-height:22px;text-align:left}
|
|
114
|
-
.ima-chip{position:relative;min-width:0;z-index:1}
|
|
115
|
-
.ima-chip.is-open{z-index:30}
|
|
116
|
-
.ima-chip-btn{display:inline-flex;align-items:center;gap:6px;min-height:28px;height:28px;padding:0 8px;border:0;border-radius:8px;background:transparent;color:var(--ima-muted);font-size:13px;font-weight:500;white-space:nowrap;cursor:pointer}
|
|
117
|
-
.ima-chip-btn:hover,.ima-chip.is-open .ima-chip-btn{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.08));color:var(--ima-text)}
|
|
118
|
-
.ima-chip-label{min-width:0;overflow:hidden;text-overflow:ellipsis}
|
|
119
|
-
.ima-chip-btn em{width:6px;height:6px;margin-left:2px;border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:rotate(45deg) translateY(-2px);opacity:.55;flex:none}
|
|
120
|
-
.ima-chip-menu{position:absolute;top:calc(100% + 6px);left:0;z-index:30;min-width:260px;max-height:280px;overflow:auto;padding:6px;border:1px solid var(--ima-line);border-radius:14px;background:var(--dsw-specific-menu,var(--dsw-alias-bg-layer-2,#fff));box-shadow:var(--dsw-shadow-lv3,0 16px 40px rgba(0,0,0,.18))}
|
|
121
|
-
.ima-chip-menu.is-end{left:auto;right:0}
|
|
122
|
-
.ima-chip-row{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;padding:8px 10px;border:0;border-radius:10px;background:transparent;color:inherit;text-align:left;cursor:pointer;font-size:13px}
|
|
123
|
-
.ima-workspace-picker .ima-chip-row{display:grid;grid-template-columns:minmax(0,1fr) 16px;gap:4px 8px;position:relative;padding:10px 12px}.ima-workspace-picker .ima-chip-row-main{grid-column:1;min-width:0}.ima-workspace-picker .ima-chip-row-main>span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ima-workspace-picker .ima-chip-row-main>svg{flex:none}.ima-workspace-picker .ima-chip-row-side{grid-column:1;min-width:0;padding-left:24px}.ima-workspace-picker .ima-chip-row-side>span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ima-workspace-picker .ima-chip-tick{position:absolute;right:12px;top:16px}.ima-workspace-picker .ima-chip-row-side:empty{display:none}
|
|
124
|
-
.ima-chip-row:hover,.ima-chip-row.is-on{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.08))}
|
|
125
|
-
.ima-chip-row-main{display:inline-flex;align-items:center;gap:8px;min-width:0}
|
|
126
|
-
.ima-chip-tick{width:6px;height:12px;border-right:1.6px solid var(--ima-accent);border-bottom:1.6px solid var(--ima-accent);transform:rotate(45deg) translateY(-2px);flex:none}
|
|
127
|
-
.ima-chip-empty{padding:14px 12px;color:var(--ima-muted);font-size:12px;text-align:center}
|
|
128
|
-
.ima-chip svg{flex:none}
|
|
129
|
-
.ima-chip-row.is-kv .ima-chip-row-main{flex:none}
|
|
130
|
-
.ima-chip-row-side{display:inline-flex;align-items:center;gap:8px;color:var(--ima-muted);font-size:12px;min-width:0}
|
|
131
|
-
.ima-chip-next{width:7px;height:7px;border-right:1.6px solid currentColor;border-bottom:1.6px solid currentColor;transform:rotate(-45deg);opacity:.55;flex:none}
|
|
132
|
-
.ima-chip-split{height:1px;margin:6px 8px;background:var(--ima-line)}
|
|
133
|
-
.ima-chip-effort{color:var(--ima-muted);font-weight:500}
|
|
134
|
-
.ima-model-select .ima-chip-btn{border-radius:24px;gap:4px}
|
|
135
|
-
.ima-model-select .ima-chip-menu{width:max-content;min-width:min(240px,calc(100vw - 32px));max-width:calc(100vw - 32px);box-sizing:border-box;max-height:min(360px,calc(100vh - 96px));padding:4px;border-radius:12px;background:var(--dsw-specific-menu,var(--dsw-alias-bg-base,#fff))}
|
|
136
|
-
.ima-model-select .ima-chip-row{min-height:40px;padding:0 10px;font-size:14px}
|
|
137
|
-
.ima-model-select .ima-chip-row-side>span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ima-model-select .ima-chip-row-side{font-size:13px;color:var(--dsw-alias-label-tertiary,var(--ima-muted))}
|
|
138
|
-
.ima-model-group+.ima-model-group{margin-top:4px}
|
|
139
|
-
.ima-model-group-title{position:sticky;top:0;z-index:1;padding:5px 8px 3px;background:var(--dsw-specific-menu,var(--dsw-alias-bg-base,#fff));color:var(--dsw-alias-label-tertiary,var(--ima-muted));font-size:12px;font-weight:500;line-height:18px}
|
|
140
|
-
.ima-model-option{display:flex;width:100%;min-height:38px;align-items:center;gap:8px;padding:6px 8px;border:0;border-radius:10px;background:transparent;color:var(--dsw-alias-label-primary,var(--ima-text));text-align:left;cursor:pointer}
|
|
141
|
-
.ima-model-option:hover,.ima-model-option:focus-visible{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.08));outline:none}
|
|
142
|
-
.ima-model-option-copy{display:flex;min-width:0;flex:1;flex-direction:column}.ima-model-name{overflow:hidden;font-size:14px;font-weight:500;line-height:20px;text-overflow:ellipsis;white-space:nowrap}.ima-model-description{overflow:hidden;color:var(--dsw-alias-label-tertiary,var(--ima-muted));font-size:12px;line-height:18px;text-overflow:ellipsis;white-space:nowrap}.ima-model-check{display:grid;flex:0 0 18px;place-items:center;color:var(--dsw-alias-label-primary,var(--ima-text))}
|
|
143
|
-
.ima-chip-dialog{margin-top:10px;padding:12px;border:1px solid var(--ima-line);border-radius:12px;background:var(--dsw-alias-bg-layer-3,transparent)}
|
|
144
|
-
.ima-chip-dialog strong{display:block;margin:0 0 8px;font-size:13px}
|
|
145
|
-
.ima-chip-dialog input{width:100%;min-height:36px;padding:8px 10px;border-radius:8px;border:1px solid var(--ima-line);background:var(--dsw-alias-bg-layer-3,var(--dsw-alias-button-elevated-fill,transparent));color:var(--ima-text);box-sizing:border-box}
|
|
146
|
-
.ima-chip-dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:10px}
|
|
147
|
-
|
|
148
|
-
.ima-list{display:flex;flex-direction:column;gap:10px}
|
|
149
|
-
.ima-card{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:12px;min-height:52px;padding:13px 16px;border:1px solid var(--ima-line);border-radius:12px;background:var(--ima-card)}
|
|
150
|
-
.ima-card:hover{background:var(--ima-card-hover)}
|
|
151
|
-
.ima-card-main{min-width:0}
|
|
152
|
-
.ima-name-row{display:flex;align-items:center;gap:10px;min-height:28px}
|
|
153
|
-
.ima-status{margin-left:auto;color:var(--ima-muted);font-size:12px;line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:42%}
|
|
154
|
-
.ima-name{font-size:15px;font-weight:650}
|
|
155
|
-
.ima-badge{font-size:11px;line-height:18px;padding:0 7px;border-radius:8px;background:rgba(46,160,67,.16);color:var(--ima-ok)}
|
|
156
|
-
.ima-desc,.ima-meta{margin-top:3px;margin-left:38px;color:var(--ima-muted);font-size:12px;line-height:1.45;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-height:17px}
|
|
157
|
-
.ima-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;min-height:36px;position:relative}
|
|
158
|
-
.ima-btn{appearance:none;border:1px solid var(--dsw-alias-border-l2,rgba(255,255,255,.16));background:transparent;color:var(--dsw-alias-label-primary,inherit);border-radius:8px;min-width:72px;min-height:32px;padding:0 12px;font:inherit;font-size:13px;cursor:pointer}
|
|
159
|
-
.ima-btn:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}
|
|
160
|
-
.ima-btn:focus-visible,.ima-more:focus-visible,.ima-switch:focus-visible,.ima-link:focus-visible,.ima-x:focus-visible{outline:2px solid var(--ima-accent);outline-offset:2px}
|
|
161
|
-
.ima-btn:disabled{opacity:.5;cursor:not-allowed}
|
|
162
|
-
.ima-btn.primary{background:var(--dsw-alias-button-primary-fill,var(--ima-accent));border-color:transparent;color:var(--dsw-alias-label-primary-foreground,#fff)}
|
|
163
|
-
.ima-more{width:32px;height:32px;border:0;border-radius:8px;background:transparent;color:var(--ima-text);cursor:pointer;font-size:18px;line-height:1}
|
|
164
|
-
.ima-more:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.08))}
|
|
165
|
-
.ima-menu{position:absolute;right:0;top:36px;min-width:128px;padding:6px;border:1px solid var(--ima-line);border-radius:10px;background:var(--dsw-specific-menu,var(--dsw-alias-bg-layer-2,#fff));z-index:5;box-shadow:var(--dsw-shadow-lv3,0 8px 24px rgba(0,0,0,.18))}
|
|
166
|
-
.ima-menu button{display:block;width:100%;text-align:left;border:0;background:transparent;color:var(--ima-text);padding:8px 10px;border-radius:6px;cursor:pointer;min-height:36px}
|
|
167
|
-
.ima-menu button:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.08))}
|
|
168
|
-
.ima-switch{width:40px;height:22px;border-radius:11px;border:0;background:var(--ima-ok);position:relative;cursor:pointer;flex:none}
|
|
169
|
-
.ima-switch.off{background:var(--dsw-alias-label-tertiary,#8b8f98)}
|
|
170
|
-
.ima-switch i{position:absolute;top:2px;left:20px;width:18px;height:18px;border-radius:50%;background:#fff;transition:left .16s ease}
|
|
171
|
-
.ima-switch.off i{left:2px}
|
|
482
|
+
.ima-page,.ima-account-modal,.ima-bind-modal,.ima-inspector{--ima-text:var(--dsw-alias-label-primary,var(--dsh-text,#e6edf3));--ima-muted:var(--dsw-alias-label-tertiary,var(--dsh-text-muted,#8b949e));--ima-line:var(--dsw-alias-border-l2,var(--dsh-border,rgba(255,255,255,.1)));--ima-card:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.04));--ima-card-hover:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06));--ima-ok:var(--dsw-alias-state-success-primary,#3fb950);--ima-warning:var(--dsw-alias-state-warning-primary,#d29922);--ima-danger:var(--dsw-alias-state-error-primary,#f85149);--ima-accent:var(--dsw-alias-brand-primary,#4b7cff)}
|
|
483
|
+
.ima-page{box-sizing:border-box;max-width:none;width:100%;margin:0;padding:0 0 32px;color:var(--ima-text)}
|
|
484
|
+
.ima-head{display:flex;flex-direction:column;align-items:stretch;gap:12px;margin-bottom:12px}
|
|
485
|
+
.ima-heading h2,.ima-title{margin:0;font-size:24px;line-height:32px;font-weight:600;letter-spacing:-.4px;white-space:nowrap;text-align:left}
|
|
486
|
+
.ima-title-row{display:flex;align-items:center;gap:8px;min-width:0;flex-wrap:wrap}
|
|
487
|
+
.ima-title-links{display:inline-flex;align-items:center;gap:8px;min-width:0;flex-wrap:wrap}
|
|
488
|
+
.ima-title-links .ant-btn{flex:none}
|
|
489
|
+
.ima-sub{margin:12px 0 0;max-width:none;color:var(--ima-muted);font-size:14px;line-height:22px;text-align:left}
|
|
172
490
|
.ima-error{color:var(--ima-danger);font-size:12px;margin:0 0 12px}
|
|
173
|
-
.ima-pending{margin:0 0
|
|
491
|
+
.ima-pending,.ima-page>.ant-alert,.ima-inspector .ant-alert{margin:0 0 12px}
|
|
174
492
|
.ima-pending-row{display:flex;gap:8px;align-items:center;margin-top:8px}
|
|
175
|
-
.ima-wrap{display:flex;flex-direction:column;min-height:0;flex:1;height:100%;overflow:hidden}.ima-official-tree{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.ima-native
|
|
493
|
+
.ima-wrap{display:flex;flex-direction:column;min-height:0;flex:1;height:100%;overflow:hidden}.ima-official-tree{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.ima-native.ima-rail,.ima-rail.dcu-wb{box-sizing:border-box;overflow:hidden}
|
|
176
494
|
.ima-tabs{display:flex;gap:18px;padding:4px 12px 0;border-bottom:1px solid var(--ima-line)}
|
|
177
495
|
.ima-tab{appearance:none;border:0;background:transparent;color:var(--ima-muted);padding:8px 0;font-size:13px;cursor:pointer}
|
|
178
496
|
.ima-tab.on{color:var(--ima-text);box-shadow:inset 0 -2px 0 currentColor}
|
|
179
497
|
.ima-tabs{flex:none}
|
|
180
498
|
.ima-rail{flex:1 1 auto;min-height:180px;overflow:auto}
|
|
181
|
-
.ima-item{display:flex;align-items:center;gap:6px;padding:0 8px 0 18px;border-radius:8px;cursor:pointer;font-size:13px;min-height:32px;position:relative}
|
|
182
|
-
.ima-item-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
183
|
-
.ima-item:hover,.ima-item.on{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.08))}
|
|
184
|
-
.ima-sess-actions{display:none;flex:none;align-items:center;gap:2px}
|
|
185
|
-
.ima-item:hover .ima-sess-actions,.ima-item.menu-on .ima-sess-actions{display:flex}
|
|
186
|
-
.ima-sess-btn{width:24px;height:24px;border:0;border-radius:6px;background:transparent;color:inherit;cursor:pointer;font-size:16px;line-height:1}
|
|
187
|
-
.ima-sess-btn:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.08))}
|
|
188
|
-
.ima-sess-menu{position:absolute;right:8px;top:30px;min-width:132px;padding:6px;border:1px solid var(--ima-line);border-radius:10px;background:var(--dsw-specific-menu,var(--dsw-alias-bg-layer-2,#fff));z-index:8;box-shadow:var(--dsw-shadow-lv3,0 8px 24px rgba(0,0,0,.18))}
|
|
189
|
-
.ima-sess-menu button{display:block;width:100%;text-align:left;border:0;background:transparent;color:var(--ima-text);padding:7px 10px;border-radius:6px;cursor:pointer}
|
|
190
|
-
.ima-sess-menu button:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.08))}
|
|
191
|
-
.ima-sess-menu button.danger{color:var(--ima-danger)}
|
|
192
499
|
.ima-rename{flex:1;min-width:0;min-height:28px;padding:2px 8px;border-radius:6px;border:1px solid var(--ima-line);background:var(--dsw-alias-bg-layer-3,var(--dsw-alias-button-elevated-fill,transparent));color:var(--ima-text);font-size:13px}
|
|
193
500
|
.ima-empty{color:var(--ima-muted);font-size:12px;padding:12px 8px}
|
|
194
501
|
.ima-logo{width:28px;height:28px;flex:none;display:block;line-height:0;background:transparent}
|
|
@@ -197,57 +504,46 @@ window.__ModuleLoader__.load({
|
|
|
197
504
|
.ima-logo.sm svg{width:16px;height:16px;transform:none}
|
|
198
505
|
.ima-logo[data-brand="wecom"]{border-radius:6px;box-shadow:inset 0 0 0 1px rgba(15,23,42,.12);overflow:hidden;background:#fff}
|
|
199
506
|
.ima-logo.sm[data-brand="wecom"]{border-radius:4px;box-shadow:none;background:transparent}
|
|
200
|
-
.ima-mask{position:fixed;inset:0;background:var(--dsw-alias-bg-mask-1,rgba(0,0,0,.45));backdrop-filter:var(--dsw-mask-blur,blur(8px));display:grid;place-items:center;z-index:80;padding:24px}
|
|
201
|
-
.ima-modal{width:min(440px,100%);background:var(--dsw-alias-bg-layer-2,#fff);color:var(--ima-text);border:1px solid var(--ima-line);border-radius:16px;padding:20px 22px 22px;text-align:left;box-shadow:var(--dsw-shadow-lv3,0 16px 48px rgba(0,0,0,.18))}
|
|
202
|
-
.ima-modal-h{display:flex;align-items:center;justify-content:space-between;margin-bottom:14px}
|
|
203
|
-
.ima-modal-h h2{margin:0;font-size:16px;font-weight:650}
|
|
204
|
-
.ima-x{border:0;background:transparent;font-size:20px;line-height:1;cursor:pointer;color:var(--ima-muted);width:32px;height:32px}
|
|
205
|
-
.ima-seg{display:flex;gap:0;border-bottom:1px solid var(--ima-line);margin:0 -22px 16px;padding:0 22px}
|
|
206
|
-
.ima-seg button{flex:1;border:0;background:transparent;padding:10px 0;font-size:13px;color:var(--ima-muted);cursor:pointer}
|
|
207
|
-
.ima-seg button.on{color:var(--ima-accent);box-shadow:inset 0 -2px 0 var(--ima-accent);font-weight:600}
|
|
208
507
|
.ima-qrbox{display:flex;flex-direction:column;align-items:center;gap:10px;padding:8px 0 4px}
|
|
209
508
|
.ima-qrbox img{width:200px;height:200px;background:#fff;border:1px solid var(--ima-line);border-radius:12px;object-fit:contain}
|
|
210
|
-
.ima-bind-ready{display:flex;flex-direction:column;align-items:center;gap:14px;padding:12px 0 4px}.ima-bind-ready .
|
|
509
|
+
.ima-bind-ready{display:flex;flex-direction:column;align-items:center;gap:14px;padding:12px 0 4px}.ima-bind-ready .ant-btn{min-width:136px}.ima-bind-status{min-height:40px;display:grid;place-items:center;color:var(--ima-muted);font-size:13px;text-align:center}
|
|
211
510
|
.ima-hint{margin:0;color:var(--ima-muted);font-size:13px;text-align:center;line-height:1.6}
|
|
212
|
-
.ima-link{border:0;background:transparent;color:var(--ima-accent);cursor:pointer;font-size:13px;min-height:32px}
|
|
213
511
|
.ima-field{display:flex;flex-direction:column;gap:6px;margin-bottom:12px;font-size:13px}
|
|
214
|
-
.ima-field input
|
|
215
|
-
.ima-
|
|
216
|
-
.ima-
|
|
217
|
-
.ima-radio small{display:block;color:var(--ima-muted);margin-top:2px}
|
|
218
|
-
.ima-ok{color:var(--ima-ok);font-size:14px;text-align:center;padding:24px 0}
|
|
219
|
-
.ima-modal .ima-error{color:var(--ima-danger)}
|
|
220
|
-
.ima-page.ima-account-page{container-type:inline-size;min-width:0;max-width:none;padding-bottom:40px}
|
|
512
|
+
.ima-field .ant-input,.ima-field input{width:100%}
|
|
513
|
+
.ima-page.ima-account-page{container-type:inline-size;min-width:0;max-width:1080px;width:100%;margin:0 auto;padding:0 0 32px}
|
|
514
|
+
.ima-account-shell,.ima-account-shell *{box-sizing:border-box}
|
|
221
515
|
.ima-account-shell{display:block;min-height:0;border:0;border-radius:0;overflow:visible;background:transparent}
|
|
222
|
-
.ima-platforms{display:flex;flex-direction:column;gap:12px;padding:0;border:0;background:transparent}
|
|
516
|
+
.ima-platforms{display:flex;flex-direction:column;gap:12px;padding:0;border:0;background:transparent;min-width:0}
|
|
223
517
|
.ima-platform{border:1px solid color-mix(in srgb,var(--ima-text) 16%,transparent);border-radius:12px;margin:0;overflow:hidden;background:var(--dsw-alias-bg-layer-1,color-mix(in srgb,var(--ima-text) 4%,transparent))}.ima-platform.open{border-color:color-mix(in srgb,var(--ima-text) 24%,transparent)}
|
|
224
|
-
.ima-platform-head{display:
|
|
225
|
-
.ima-platform:not(.open):not(.empty) .ima-platform-head:hover{background:var(--ima-card-hover)}.ima-platform.empty .ima-platform-head{cursor:default}
|
|
226
|
-
.ima-platform-
|
|
227
|
-
.ima-platform-
|
|
228
|
-
.ima-
|
|
229
|
-
.ima-platform-
|
|
230
|
-
.ima-
|
|
231
|
-
.ima-
|
|
232
|
-
.ima-
|
|
233
|
-
.ima-
|
|
234
|
-
.ima-
|
|
235
|
-
.ima-
|
|
236
|
-
.ima-
|
|
237
|
-
.ima-inspector-
|
|
238
|
-
.ima-
|
|
239
|
-
.ima-
|
|
240
|
-
.ima-
|
|
241
|
-
.ima-
|
|
242
|
-
.ima-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
.ima-
|
|
246
|
-
|
|
247
|
-
|
|
518
|
+
.ima-platform-head{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:10px;width:100%;min-height:56px;padding:10px 16px;border:0;border-radius:0;background:transparent;color:inherit;text-align:left;cursor:pointer}
|
|
519
|
+
.ima-platform:not(.open):not(.empty) .ima-platform-head:hover{background:var(--ima-card-hover)}.ima-platform.empty .ima-platform-head{cursor:default}
|
|
520
|
+
.ima-platform-head>.ima-logo,.ima-platform-head>.ima-logo svg{width:24px;height:24px}
|
|
521
|
+
.ima-platform-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:600}
|
|
522
|
+
.ima-platform-meta{display:inline-flex;align-items:center;gap:10px}
|
|
523
|
+
.ima-platform-count{color:var(--ima-muted);font-size:12px;white-space:nowrap}
|
|
524
|
+
.ima-platform-caret{display:grid;width:18px;height:18px;place-items:center;color:var(--ima-muted);transition:transform .15s ease}.ima-platform-caret.empty{visibility:hidden}.ima-platform.open .ima-platform-caret{transform:rotate(90deg)}
|
|
525
|
+
.ima-account-list{display:flex;flex-direction:column;gap:8px;padding:0 14px 14px}
|
|
526
|
+
.ima-account-row{display:grid;grid-template-columns:minmax(0,1fr) auto auto auto;align-items:center;gap:12px;width:100%;min-height:48px;padding:10px 12px;border:0;border-radius:8px;background:color-mix(in srgb,var(--ima-text) 7%,transparent);color:inherit;text-align:left}
|
|
527
|
+
.ima-account-row:hover{background:var(--ima-card-hover)}
|
|
528
|
+
.ima-platform-head:focus-visible,.ima-account-row:focus-visible{outline:2px solid var(--ima-accent);outline-offset:2px}
|
|
529
|
+
.ima-account-copy{min-width:0}.ima-account-name{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:500}.ima-account-id{display:block;margin-top:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--ima-muted);font-size:11px}.ima-account-row .ant-tag{margin-inline-end:0}
|
|
530
|
+
.ima-account-receive{display:inline-flex;align-items:center;justify-content:flex-end;gap:8px;white-space:nowrap;font-size:12px;color:var(--ima-muted)}
|
|
531
|
+
.ima-inspector{padding:22px 24px 26px;min-width:0}.ima-inspector-head{display:flex;align-items:flex-start;gap:12px;padding-bottom:18px;border-bottom:1px solid var(--ima-line)}.ima-inspector-head-copy{min-width:0;flex:1}.ima-inspector-title{margin:1px 0 3px;font-size:17px;line-height:24px}.ima-inspector-title-row{display:flex;align-items:center;gap:12px;min-width:0}.ima-inspector-title-row .ima-inspector-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin:0}.ima-inspector-title-row .ima-inspector-status{flex:none;white-space:nowrap;font-size:11px}.ima-inspector-head-copy>.ima-account-id{margin-top:5px}
|
|
532
|
+
.ima-inspector-status{flex:none}
|
|
533
|
+
.ima-form{display:flex;flex-direction:column;gap:16px;padding-top:20px}
|
|
534
|
+
.ima-command-permissions{min-width:0;margin:0;padding:0;border:0}
|
|
535
|
+
.ima-diagnostic-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.ima-inspector-title-row .ant-tag{margin-inline-end:0}.ima-bind-modal .ant-segmented{width:100%;margin:0 0 16px}.ima-bind-modal .ant-alert{margin-bottom:12px}.ima-connection-check{display:grid;gap:6px;padding:12px;border:1px solid var(--ima-line);border-radius:8px;font-size:12px;line-height:1.6;overflow-wrap:anywhere;color:var(--ima-muted)}.ima-connection-check strong{color:var(--ima-text)}.ima-diagnostic-item{padding:8px 0;border-top:1px solid var(--ima-line)}
|
|
536
|
+
.ima-inspector-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:6px;padding-top:18px;border-top:1px solid var(--ima-line)}.ima-inspector-actions .ant-btn{flex:none;white-space:nowrap}.ima-inspector-actions .ant-btn-dangerous{margin-left:auto}
|
|
537
|
+
.ima-account-settings{display:grid;grid-template-columns:1fr 1fr;gap:12px 16px}.ima-account-settings.compact{grid-template-columns:1fr}.ima-account-settings .ant-select{width:100%;min-width:0}.ima-account-settings .ant-select-selector{min-height:36px}
|
|
538
|
+
.ima-picker-field{display:flex;min-width:0;flex-direction:column;gap:6px}.ima-picker-field.wide,.ima-picker-note,.ima-model-effort{grid-column:1/-1}.ima-model-effort{display:grid;grid-template-columns:1fr 1fr;gap:12px 16px;min-width:0}.ima-account-settings.compact .ima-model-effort{grid-template-columns:1fr}.ima-picker-label{color:var(--ima-muted);font-size:12px;font-weight:550}.ima-picker-note{color:var(--ima-muted);font-size:11px;line-height:1.5}.ima-picker-note.warning{color:var(--ima-warning)}
|
|
539
|
+
.ima-save-note{color:var(--ima-muted);font-size:11px}.ima-save-note.ok{color:var(--ima-ok)}
|
|
540
|
+
.ima-account-modal .ima-inspector,.ima-bind-modal .ima-setup-section{padding:0}.ima-setup-section{margin:0 0 14px;padding-bottom:14px;border-bottom:1px solid var(--ima-line)}
|
|
541
|
+
.ima-account-picker{width:100%}
|
|
542
|
+
@container (max-width:480px){.ima-account-row{grid-template-columns:minmax(0,1fr) auto auto;gap:8px;padding:10px}.ima-account-receive>span{display:none}.ima-platform-head{padding:10px 12px}.ima-account-list{padding:0 12px 12px}}
|
|
543
|
+
|
|
248
544
|
`;
|
|
249
545
|
|
|
250
|
-
const TITLE_LINK_CSS = "
|
|
546
|
+
const TITLE_LINK_CSS = "@media(max-width:720px){.ima-title-row{flex-wrap:wrap}}";
|
|
251
547
|
|
|
252
548
|
let styleEl = null;
|
|
253
549
|
const ensureStyle = () => {
|
|
@@ -415,12 +711,148 @@ window.__ModuleLoader__.load({
|
|
|
415
711
|
return translated === key ? t("qr.default") : translated;
|
|
416
712
|
}
|
|
417
713
|
|
|
714
|
+
// 有 reflect 时只 probe,不能硬读未注入的官方导航服务,否则 Cordis 会挡住插件激活。
|
|
715
|
+
function probeService(ctx, name) {
|
|
716
|
+
if (!ctx) return undefined;
|
|
717
|
+
const reflect = ctx.reflect;
|
|
718
|
+
if (reflect && typeof reflect.get === "function") {
|
|
719
|
+
try {
|
|
720
|
+
const found = reflect.get(name);
|
|
721
|
+
if (found !== undefined) return found;
|
|
722
|
+
} catch { /* 未注入时不硬读 ctx[name],改走 get */ }
|
|
723
|
+
}
|
|
724
|
+
if (typeof ctx.get === "function") {
|
|
725
|
+
try {
|
|
726
|
+
const found = ctx.get(name);
|
|
727
|
+
if (found !== undefined) return found;
|
|
728
|
+
} catch { return undefined; }
|
|
729
|
+
}
|
|
730
|
+
if (reflect && typeof reflect.get === "function") return undefined;
|
|
731
|
+
try { return ctx[name]; } catch { return undefined; }
|
|
732
|
+
}
|
|
733
|
+
// 旧宿主读 list.current;alpha.2 主视图改由 retainedBy.mainView 标记。
|
|
734
|
+
function currentSessionId(state) {
|
|
735
|
+
if (!state) return null;
|
|
736
|
+
if (typeof state.current === "string" && state.current) return state.current;
|
|
737
|
+
const byId = state.byId || {};
|
|
738
|
+
const ids = Array.isArray(state.ids) && state.ids.length ? state.ids : Object.keys(byId);
|
|
739
|
+
const pick = (id, row) => {
|
|
740
|
+
if (!row || !row.retainedBy || (row.retainedBy.mainView ?? 0) <= 0) return null;
|
|
741
|
+
const explicit = row.id && String(row.id).trim();
|
|
742
|
+
return explicit || id;
|
|
743
|
+
};
|
|
744
|
+
for (let i = 0; i < ids.length; i++) {
|
|
745
|
+
const found = pick(ids[i], byId[ids[i]]);
|
|
746
|
+
if (found) return found;
|
|
747
|
+
}
|
|
748
|
+
for (const id in byId) {
|
|
749
|
+
if (ids.indexOf(id) !== -1) continue;
|
|
750
|
+
const found = pick(id, byId[id]);
|
|
751
|
+
if (found) return found;
|
|
752
|
+
}
|
|
753
|
+
return null;
|
|
754
|
+
}
|
|
755
|
+
function resolveHostSessionId(sessionId, sessionById) {
|
|
756
|
+
if (!sessionId) return sessionId;
|
|
757
|
+
const listed = sessionById && sessionById[sessionId];
|
|
758
|
+
const fromKey = listed && (listed.id || listed.sessionId);
|
|
759
|
+
if (fromKey && String(fromKey).trim()) return String(fromKey).trim();
|
|
760
|
+
return sessionId;
|
|
761
|
+
}
|
|
762
|
+
function isCurrentListedSession(selectedId, sessionId, sessionById) {
|
|
763
|
+
if (!selectedId || !sessionId) return false;
|
|
764
|
+
if (selectedId === sessionId) return true;
|
|
765
|
+
const listed = sessionById && sessionById[sessionId];
|
|
766
|
+
if (listed && (listed.id === selectedId || listed.sessionId === selectedId)) return true;
|
|
767
|
+
const selected = sessionById && sessionById[selectedId];
|
|
768
|
+
if (selected && (selected.id === sessionId || selected.sessionId === sessionId)) return true;
|
|
769
|
+
return false;
|
|
770
|
+
}
|
|
771
|
+
function openHostSession(ctx, id) {
|
|
772
|
+
if (!id) return false;
|
|
773
|
+
const uiWorkspace = probeService(ctx, "uiWorkspace");
|
|
774
|
+
if (uiWorkspace && typeof uiWorkspace.openSession === "function") {
|
|
775
|
+
uiWorkspace.openSession(id);
|
|
776
|
+
return true;
|
|
777
|
+
}
|
|
778
|
+
// alpha.2 有 retain:旧的 sessions.open 即使还在也不会写入 mainView,点了等于没打开。
|
|
779
|
+
if (ctx.sessions && typeof ctx.sessions.retain === "function") return false;
|
|
780
|
+
if (ctx.sessions && typeof ctx.sessions.open === "function") {
|
|
781
|
+
ctx.sessions.open(id);
|
|
782
|
+
return true;
|
|
783
|
+
}
|
|
784
|
+
return false;
|
|
785
|
+
}
|
|
786
|
+
function pickHostDirectory(ctx) {
|
|
787
|
+
const uiWorkspace = probeService(ctx, "uiWorkspace");
|
|
788
|
+
if (uiWorkspace && typeof uiWorkspace.pickDirectory === "function") return uiWorkspace.pickDirectory();
|
|
789
|
+
if (ctx.workspaces && typeof ctx.workspaces.pickDirectory === "function") return ctx.workspaces.pickDirectory();
|
|
790
|
+
}
|
|
791
|
+
function activeSessionRefusal(error) {
|
|
792
|
+
const reason = error && (error.reason || error);
|
|
793
|
+
if (reason && reason.name === "WorkspaceArchiveError") return true;
|
|
794
|
+
const rpc = error && (error.rpcError || error);
|
|
795
|
+
if (rpc && (rpc.code === "workspace/session-active" || (rpc.details && rpc.details.activity))) return true;
|
|
796
|
+
return /workspace\/session-active|WorkspaceArchiveError|still running|still active/i.test(String((error && error.message) || ""));
|
|
797
|
+
}
|
|
798
|
+
function hostWorkspaceApi(ctx) {
|
|
799
|
+
return probeService(ctx, "uiWorkspace") || ctx.workspaces || {};
|
|
800
|
+
}
|
|
801
|
+
function archiveHostSession(ctx, id, options) {
|
|
802
|
+
const api = hostWorkspaceApi(ctx);
|
|
803
|
+
if (typeof api.archiveSession !== "function") return;
|
|
804
|
+
return options ? api.archiveSession(id, options) : api.archiveSession(id);
|
|
805
|
+
}
|
|
806
|
+
function unarchiveHostSession(ctx, id) {
|
|
807
|
+
const api = hostWorkspaceApi(ctx);
|
|
808
|
+
if (typeof api.unarchiveSession === "function") return api.unarchiveSession(id);
|
|
809
|
+
if (typeof api.restoreSession === "function") return api.restoreSession(id);
|
|
810
|
+
}
|
|
811
|
+
function forkHostSession(ctx, id) {
|
|
812
|
+
const uiWorkspace = probeService(ctx, "uiWorkspace");
|
|
813
|
+
if (uiWorkspace && typeof uiWorkspace.forkSession === "function") return Promise.resolve(uiWorkspace.forkSession(id));
|
|
814
|
+
if (!ctx.sessions || typeof ctx.sessions.fork !== "function") return Promise.resolve();
|
|
815
|
+
return ctx.sessions.fork({ sessionId: id, increaseTitle: true })
|
|
816
|
+
.then((childId) => { openHostSession(ctx, childId); })
|
|
817
|
+
.catch(() => undefined);
|
|
818
|
+
}
|
|
819
|
+
async function renameHostSession(ctx, sessionId, title) {
|
|
820
|
+
const sessions = ctx.sessions;
|
|
821
|
+
if (!sessions) throw new Error("unknown session");
|
|
822
|
+
const renameBound = async (session) => {
|
|
823
|
+
if (!session || typeof session.rename !== "function") throw new Error("unknown session");
|
|
824
|
+
const result = await session.rename(title);
|
|
825
|
+
if (result && result.ok === false) throw new Error((result.error && result.error.message) || "rename failed");
|
|
826
|
+
};
|
|
827
|
+
if (typeof sessions.using === "function") {
|
|
828
|
+
return sessions.using(sessionId, { source: "controllerOperation" }, async (reference) => {
|
|
829
|
+
if (reference && reference.ready) await reference.ready;
|
|
830
|
+
return renameBound(reference && reference.binding && reference.binding.session);
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
const existing = sessions.binding && sessions.binding(sessionId);
|
|
834
|
+
if (existing && existing.session) return renameBound(existing.session);
|
|
835
|
+
if (typeof sessions.retain !== "function") throw new Error("unknown session");
|
|
836
|
+
const ref = sessions.retain(sessionId, { source: "controllerOperation" });
|
|
837
|
+
try {
|
|
838
|
+
if (ref && ref.ready) await ref.ready;
|
|
839
|
+
return renameBound(ref && ref.binding && ref.binding.session);
|
|
840
|
+
} finally {
|
|
841
|
+
if (ref && typeof ref.release === "function") ref.release();
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
|
|
418
845
|
let openImSession = (id) => {
|
|
419
846
|
try {
|
|
420
847
|
if (window.__dshSessionsOpen) { window.__dshSessionsOpen(id); return true; }
|
|
421
848
|
} catch { /* ignore */ }
|
|
422
849
|
return false;
|
|
423
850
|
};
|
|
851
|
+
const tryOpenListedSession = (id, hostOpen) => {
|
|
852
|
+
if (openImSession(id)) return true;
|
|
853
|
+
if (typeof hostOpen !== "function") return false;
|
|
854
|
+
try { hostOpen(id); return true; } catch { return false; }
|
|
855
|
+
};
|
|
424
856
|
const openListedSession = (id, hostOpen) => {
|
|
425
857
|
if (!id) return;
|
|
426
858
|
if (isChannelSession(id)) {
|
|
@@ -438,17 +870,11 @@ window.__ModuleLoader__.load({
|
|
|
438
870
|
}).catch((error) => console.warn("[dsh-im-connect] 无法恢复会话", id, error));
|
|
439
871
|
return;
|
|
440
872
|
}
|
|
441
|
-
|
|
442
|
-
else openImSession(id);
|
|
873
|
+
tryOpenListedSession(id, hostOpen);
|
|
443
874
|
};
|
|
444
875
|
let channelSkin = "native";
|
|
445
876
|
|
|
446
|
-
function
|
|
447
|
-
// 离开设置侧栏的层叠上下文,同时保留账号表单使用的主题变量。
|
|
448
|
-
return ReactDOM.createPortal(h("div", { ...events, className: "ima-page ima-mask" }, children), document.body);
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
function BindModal({ ch, onClose, onConnected, catalog, permissions, agentPresets, workspaces, defaults, createWorkspace, pickDirectory, modelT, permissionT, t = fallbackT }) {
|
|
877
|
+
function BindModal({ ch, onClose, onConnected, catalog, permissions, agentPresets, workspaces, defaults, createWorkspace, pickDirectory, modelT, permissionT, presetT, t = fallbackT }) {
|
|
452
878
|
const hasQr = ch.kind === "qr" || ch.kind === "qr-or-credentials";
|
|
453
879
|
const hasManual = ch.kind === "credentials" || ch.kind === "qr-or-credentials";
|
|
454
880
|
const [tab, setTab] = useState(hasQr ? "qr" : "manual");
|
|
@@ -572,127 +998,83 @@ window.__ModuleLoader__.load({
|
|
|
572
998
|
const src = qrStarted ? qrSrc(pairing) : "";
|
|
573
999
|
const remain = qrStarted && pairing && pairing.remainingSeconds;
|
|
574
1000
|
|
|
575
|
-
return h(
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
1001
|
+
return h(Modal, {
|
|
1002
|
+
open: true,
|
|
1003
|
+
className: "ima-bind-modal",
|
|
1004
|
+
title: t("bind.title", { channel: channelLabel(ch, t) }),
|
|
1005
|
+
width: 560,
|
|
1006
|
+
zIndex: 1100,
|
|
1007
|
+
destroyOnHidden: true,
|
|
1008
|
+
maskClosable: !saving,
|
|
1009
|
+
keyboard: false,
|
|
1010
|
+
onCancel: close,
|
|
1011
|
+
footer: tab === "manual" && hasManual
|
|
1012
|
+
? [h(Button, { key: "save", type: "primary", disabled: busy, onClick: saveManual }, busy ? t("action.saving") : t("action.confirm"))]
|
|
1013
|
+
: null,
|
|
1014
|
+
},
|
|
1015
|
+
hasQr && hasManual && h(Segmented, {
|
|
1016
|
+
block: true,
|
|
1017
|
+
value: tab,
|
|
1018
|
+
disabled: saving,
|
|
1019
|
+
options: [
|
|
1020
|
+
{ value: "qr", label: t("bind.quick") },
|
|
1021
|
+
{ value: "manual", label: t("bind.manual") },
|
|
1022
|
+
],
|
|
1023
|
+
onChange: (next) => switchTab(next),
|
|
1024
|
+
}),
|
|
1025
|
+
error && h(Alert, { type: "error", showIcon: true, message: error }),
|
|
1026
|
+
success && h(Alert, { type: "success", showIcon: true, message: success }),
|
|
1027
|
+
h("div", { className: "ima-setup-section" },
|
|
1028
|
+
h(AccountSettingsPicker, {
|
|
1029
|
+
value: settings,
|
|
1030
|
+
onChange: (patch) => setSettings((current) => ({ ...current, ...patch })),
|
|
1031
|
+
catalog,
|
|
1032
|
+
permissions,
|
|
1033
|
+
agentPresets,
|
|
1034
|
+
workspaces,
|
|
1035
|
+
createWorkspace,
|
|
1036
|
+
pickDirectory,
|
|
1037
|
+
modelT,
|
|
1038
|
+
permissionT,
|
|
1039
|
+
presetT,
|
|
1040
|
+
compact: true,
|
|
1041
|
+
showAutoNameNote: true,
|
|
1042
|
+
t,
|
|
1043
|
+
}),
|
|
1044
|
+
h(CommandPermissionSettings, { value: settings.commandPermissions, onSave: commandPermissions => setSettings(current => ({ ...current, commandPermissions })), t }),
|
|
1045
|
+
),
|
|
1046
|
+
tab === "qr" && hasQr && (
|
|
1047
|
+
status === "success"
|
|
1048
|
+
? h(Alert, { type: "success", showIcon: true, message: t("bind.success") })
|
|
1049
|
+
: status === "saving"
|
|
1050
|
+
? h("div", { className: "ima-bind-status" }, t("bind.saving"))
|
|
1051
|
+
: src
|
|
1052
|
+
? h("div", { className: "ima-qrbox" },
|
|
1053
|
+
h("p", { className: "ima-hint" }, hintOf(ch, t)),
|
|
1054
|
+
h("img", { src, alt: t("bind.qrAlt", { channel: channelLabel(ch, t) }) }),
|
|
1055
|
+
remain > 0 && h("p", { className: "ima-hint" }, t("bind.expire", { time: Math.floor(remain / 60) + ":" + String(remain % 60).padStart(2, "0") })),
|
|
1056
|
+
status === "scanned" && h("p", { className: "ima-hint" }, t("bind.scanned")),
|
|
1057
|
+
(status === "expired" || status === "failed") && h("p", { className: "ima-error" }, serverText(pairing && pairing.error, t) || t("bind.retry")),
|
|
1058
|
+
h(Button, { disabled: busy, onClick: () => startQr(true) }, t("bind.refresh")),
|
|
1059
|
+
)
|
|
1060
|
+
: h("div", { className: "ima-bind-ready" },
|
|
611
1061
|
h("p", { className: "ima-hint" }, hintOf(ch, t)),
|
|
612
|
-
h("
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
(status === "expired" || status === "failed") && h("p", { className: "ima-error" }, serverText(pairing && pairing.error, t) || t("bind.retry")),
|
|
616
|
-
h("button", { className: "ima-btn", disabled: busy, onClick: () => startQr(true) }, t("bind.refresh")),
|
|
1062
|
+
(busy || status === "starting") && h("div", { className: "ima-bind-status" }, t("bind.generating")),
|
|
1063
|
+
(status === "expired" || status === "failed") && h("div", { className: "ima-error" }, serverText(pairing && pairing.error, t) || t("bind.retry")),
|
|
1064
|
+
h(Button, { type: "primary", disabled: busy || !settings.cwd || !settings.provider || !settings.model || !settings.permission, onClick: () => startQr(qrStarted) }, busy ? t("bind.generating") : qrStarted ? t("bind.refresh") : t("action.generateQr")),
|
|
617
1065
|
)
|
|
618
|
-
: h("div", { className: "ima-bind-ready" },
|
|
619
|
-
h("p", { className: "ima-hint" }, hintOf(ch, t)),
|
|
620
|
-
(busy || status === "starting") && h("div", { className: "ima-bind-status" }, t("bind.generating")),
|
|
621
|
-
(status === "expired" || status === "failed") && h("div", { className: "ima-error" }, serverText(pairing && pairing.error, t) || t("bind.retry")),
|
|
622
|
-
h("button", { className: "ima-btn primary", disabled: busy || !settings.cwd || !settings.provider || !settings.model || !settings.permission, onClick: () => startQr(qrStarted) }, busy ? t("bind.generating") : qrStarted ? t("bind.refresh") : t("action.generateQr")),
|
|
623
|
-
)
|
|
624
|
-
),
|
|
625
|
-
tab === "manual" && hasManual && h("div", null,
|
|
626
|
-
...ch.fields.map((f) => h("label", { key: f.key, className: "ima-field" },
|
|
627
|
-
fieldLabel(ch, f, t),
|
|
628
|
-
h("input", {
|
|
629
|
-
type: f.secret ? "password" : "text",
|
|
630
|
-
value: draft[f.key] || "",
|
|
631
|
-
placeholder: fieldLabel(ch, f, t),
|
|
632
|
-
onChange: (e) => setDraft({ ...draft, [f.key]: e.target.value }),
|
|
633
|
-
}),
|
|
634
|
-
)),
|
|
635
|
-
h("div", { style: { display: "flex", justifyContent: "flex-end" } },
|
|
636
|
-
h("button", { className: "ima-btn primary", disabled: busy, onClick: saveManual }, busy ? t("action.saving") : t("action.confirm")),
|
|
637
|
-
),
|
|
638
|
-
),
|
|
639
1066
|
),
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
setMenu(false);
|
|
651
|
-
};
|
|
652
|
-
const onKey = (event) => {
|
|
653
|
-
if (event.key === "Escape") setMenu(false);
|
|
654
|
-
};
|
|
655
|
-
document.addEventListener("pointerdown", close, true);
|
|
656
|
-
document.addEventListener("keydown", onKey);
|
|
657
|
-
return () => {
|
|
658
|
-
document.removeEventListener("pointerdown", close, true);
|
|
659
|
-
document.removeEventListener("keydown", onKey);
|
|
660
|
-
};
|
|
661
|
-
}, [menu]);
|
|
662
|
-
|
|
663
|
-
const configuring = !ch.connected;
|
|
664
|
-
const meta = configuring ? t("status.unconfigured") : (ch.status && ch.status !== "未连接" ? serverText(ch.status, t) : t("status.connected"));
|
|
665
|
-
const right = h("div", { className: "ima-actions", ref: menuRoot },
|
|
666
|
-
configuring
|
|
667
|
-
? h("button", { className: "ima-btn", disabled: busy, onClick: onConfigure }, busy ? t("status.connecting") : t("action.configure"))
|
|
668
|
-
: [
|
|
669
|
-
h("button", { key: "more", className: "ima-more", "aria-label": t("action.more", { channel: channelLabel(ch, t) }), "aria-expanded": menu, onClick: (event) => { event.stopPropagation(); setMenu(!menu); } }, "…"),
|
|
670
|
-
menu && h("div", { key: "menu", className: "ima-menu", "data-ima-card-menu": "", onClick: (event) => event.stopPropagation() },
|
|
671
|
-
h("button", { onClick: () => { setMenu(false); onConfigure(); } }, t("action.reconnect")),
|
|
672
|
-
h("button", { onClick: () => { setMenu(false); onAction(ch.id, "disconnect"); } }, t("action.disconnect")),
|
|
673
|
-
h("button", { onClick: () => { setMenu(false); onAction(ch.id, "remove"); } }, t("action.removeConfig")),
|
|
674
|
-
),
|
|
675
|
-
h("button", {
|
|
676
|
-
key: "sw",
|
|
677
|
-
className: ch.receiveEnabled ? "ima-switch" : "ima-switch off",
|
|
678
|
-
role: "switch",
|
|
679
|
-
"aria-checked": ch.receiveEnabled,
|
|
680
|
-
"aria-label": t("action.receive"),
|
|
681
|
-
onClick: () => onAction(ch.id, "receive", { receiveEnabled: !ch.receiveEnabled }),
|
|
682
|
-
}, h("i")),
|
|
683
|
-
],
|
|
684
|
-
);
|
|
685
|
-
|
|
686
|
-
return h("div", { className: "ima-card", title: channelLabel(ch, t) },
|
|
687
|
-
h("div", { className: "ima-card-main" },
|
|
688
|
-
h("div", { className: "ima-name-row" },
|
|
689
|
-
h(Logo, { id: ch.id }),
|
|
690
|
-
h("span", { className: "ima-name" }, channelLabel(ch, t)),
|
|
691
|
-
ch.connected && h("span", { className: "ima-badge" }, t("status.connected")),
|
|
692
|
-
h("span", { className: "ima-status" }, meta),
|
|
693
|
-
),
|
|
1067
|
+
tab === "manual" && hasManual && h("div", null,
|
|
1068
|
+
...ch.fields.map((f) => h("label", { key: f.key, className: "ima-field" },
|
|
1069
|
+
fieldLabel(ch, f, t),
|
|
1070
|
+
h(Input, {
|
|
1071
|
+
type: f.secret ? "password" : "text",
|
|
1072
|
+
value: draft[f.key] || "",
|
|
1073
|
+
placeholder: fieldLabel(ch, f, t),
|
|
1074
|
+
onChange: (e) => setDraft({ ...draft, [f.key]: e.target.value }),
|
|
1075
|
+
}),
|
|
1076
|
+
)),
|
|
694
1077
|
),
|
|
695
|
-
right,
|
|
696
1078
|
);
|
|
697
1079
|
}
|
|
698
1080
|
|
|
@@ -707,98 +1089,33 @@ window.__ModuleLoader__.load({
|
|
|
707
1089
|
if (builtIn && (option.name === option.value || option.name === builtIn[1])) return t(builtIn[0]);
|
|
708
1090
|
return option.name || option.value;
|
|
709
1091
|
}
|
|
710
|
-
function FolderIcon() {
|
|
711
|
-
return h("svg", { viewBox: "0 0 16 16", width: 14, height: 14, fill: "none", "aria-hidden": "true" },
|
|
712
|
-
h("path", { d: "M5.196 1.571c.615 0 1.19.308 1.532.819l.471.708c.086.128.23.205.383.205h4.588A2.666 2.666 0 0 1 14.586 5.72v.907c.683.4 1.074 1.223.852 2.06l-1.053 3.971A2.666 2.666 0 0 1 12.05 14.453H2.917A2.416 2.416 0 0 1 .502 11.952V3.987A2.416 2.416 0 0 1 2.918 1.571h2.278Z", fill: "currentColor" }),
|
|
713
|
-
);
|
|
714
|
-
}
|
|
715
1092
|
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
1093
|
+
// 与宿主 settings.agentPreset 一致:内置预设没有自报名称时走官方词条。
|
|
1094
|
+
const BUILT_IN_PRESET_KEYS = {
|
|
1095
|
+
standard: { name: "presetStandardName", description: "presetStandardDescription" },
|
|
1096
|
+
ptc: { name: "presetPtcName", description: "presetPtcDescription" },
|
|
1097
|
+
minimal: { name: "presetMinimalName", description: "presetMinimalDescription" },
|
|
1098
|
+
cordis: { name: "presetCordisName", description: "presetCordisDescription" },
|
|
1099
|
+
};
|
|
1100
|
+
function presetDisplayText(preset, presetT) {
|
|
1101
|
+
const keys = BUILT_IN_PRESET_KEYS[preset.id];
|
|
1102
|
+
if (keys && (preset.name === undefined || preset.name === "" || preset.name === preset.id)) {
|
|
1103
|
+
return { name: presetT(keys.name), description: presetT(keys.description) };
|
|
1104
|
+
}
|
|
1105
|
+
return { name: preset.name || preset.id, description: preset.description };
|
|
721
1106
|
}
|
|
722
|
-
|
|
723
1107
|
function PlusIcon() {
|
|
724
1108
|
return h("svg", { viewBox: "0 0 16 16", width: 14, height: 14, fill: "none", "aria-hidden": "true" },
|
|
725
1109
|
h("path", { d: "M8 3v10M3 8h10", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" }),
|
|
726
1110
|
);
|
|
727
1111
|
}
|
|
728
1112
|
|
|
729
|
-
function ChipMenu(props) {
|
|
730
|
-
const root = useRef(null);
|
|
731
|
-
useEffect(() => {
|
|
732
|
-
if (!props.open) return undefined;
|
|
733
|
-
const close = (event) => {
|
|
734
|
-
if (root.current && root.current.contains(event.target)) return;
|
|
735
|
-
props.onToggle(false);
|
|
736
|
-
};
|
|
737
|
-
document.addEventListener("mousedown", close);
|
|
738
|
-
return () => document.removeEventListener("mousedown", close);
|
|
739
|
-
}, [props.open]);
|
|
740
|
-
return h("div", { className: "ima-chip" + (props.className ? " " + props.className : "") + (props.open ? " is-open" : ""), ref: root },
|
|
741
|
-
h("button", {
|
|
742
|
-
type: "button",
|
|
743
|
-
className: "ima-chip-btn",
|
|
744
|
-
title: props.title || undefined,
|
|
745
|
-
"aria-label": props.ariaLabel,
|
|
746
|
-
"aria-expanded": Boolean(props.open),
|
|
747
|
-
onMouseDown: (event) => event.stopPropagation(),
|
|
748
|
-
onClick: () => props.onToggle(!props.open),
|
|
749
|
-
},
|
|
750
|
-
props.icon,
|
|
751
|
-
h("span", { className: "ima-chip-label" }, props.label),
|
|
752
|
-
props.suffix && h("span", { className: "ima-chip-effort" }, props.suffix),
|
|
753
|
-
h("em"),
|
|
754
|
-
),
|
|
755
|
-
props.open && h("div", { className: "ima-chip-menu" + (props.menuClassName ? " " + props.menuClassName : "") + (props.align === "end" ? " is-end" : ""), role: "menu", "aria-label": props.menuAria }, props.children),
|
|
756
|
-
);
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
function ModelChoiceRow(props) {
|
|
760
|
-
return h("button", {
|
|
761
|
-
type: "button",
|
|
762
|
-
className: "ima-model-option",
|
|
763
|
-
role: "menuitemradio",
|
|
764
|
-
"aria-checked": props.active,
|
|
765
|
-
onClick: props.onClick,
|
|
766
|
-
},
|
|
767
|
-
h("span", { className: "ima-model-option-copy" },
|
|
768
|
-
h("span", { className: "ima-model-name" }, props.label),
|
|
769
|
-
props.description && h("span", { className: "ima-model-description" }, props.description),
|
|
770
|
-
),
|
|
771
|
-
h("span", { className: "ima-model-check" }, props.active && h("i", { className: "ima-chip-tick" })),
|
|
772
|
-
);
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
function ChipRow(props) {
|
|
776
|
-
return h("button", {
|
|
777
|
-
type: "button",
|
|
778
|
-
className: "ima-chip-row" + (props.active ? " is-on" : "") + (props.kv ? " is-kv" : ""),
|
|
779
|
-
role: "menuitem",
|
|
780
|
-
title: props.hint || undefined,
|
|
781
|
-
onClick: props.onClick,
|
|
782
|
-
},
|
|
783
|
-
h("span", { className: "ima-chip-row-main" },
|
|
784
|
-
props.icon,
|
|
785
|
-
h("span", null, props.label),
|
|
786
|
-
),
|
|
787
|
-
h("span", { className: "ima-chip-row-side" },
|
|
788
|
-
props.hint && h("span", null, props.hint),
|
|
789
|
-
props.active && !props.chevron && h("i", { className: "ima-chip-tick" }),
|
|
790
|
-
props.chevron && h("i", { className: "ima-chip-next" }),
|
|
791
|
-
),
|
|
792
|
-
);
|
|
793
|
-
}
|
|
794
|
-
|
|
795
1113
|
function AccountSettingsPicker(props) {
|
|
796
1114
|
const t = props.t || fallbackT;
|
|
797
1115
|
const modelT = props.modelT || ((key) => key);
|
|
798
1116
|
const permissionT = props.permissionT || ((key) => key);
|
|
1117
|
+
const presetT = props.presetT || ((key) => key);
|
|
799
1118
|
const value = props.value || {};
|
|
800
|
-
const [open, setOpen] = useState("");
|
|
801
|
-
const [modelPane, setModelPane] = useState("root");
|
|
802
1119
|
const [adding, setAdding] = useState(false);
|
|
803
1120
|
const [addPath, setAddPath] = useState("");
|
|
804
1121
|
const [addBusy, setAddBusy] = useState(false);
|
|
@@ -858,12 +1175,10 @@ window.__ModuleLoader__.load({
|
|
|
858
1175
|
update({ cwd: cwdPath });
|
|
859
1176
|
setAdding(false);
|
|
860
1177
|
setAddPath("");
|
|
861
|
-
setOpen("");
|
|
862
1178
|
}).catch((error) => setHint((error && error.message) || t("error.addWorkspace")))
|
|
863
1179
|
.finally(() => setAddBusy(false));
|
|
864
1180
|
};
|
|
865
1181
|
const onAddWorkspace = () => {
|
|
866
|
-
setOpen("");
|
|
867
1182
|
setHint("");
|
|
868
1183
|
setAdding(true);
|
|
869
1184
|
setAddPath("");
|
|
@@ -875,7 +1190,6 @@ window.__ModuleLoader__.load({
|
|
|
875
1190
|
}
|
|
876
1191
|
};
|
|
877
1192
|
const selectPermission = (next) => {
|
|
878
|
-
setOpen("");
|
|
879
1193
|
if (next === permission) return;
|
|
880
1194
|
if (next === "danger-full-access") {
|
|
881
1195
|
setFullAccessAcknowledged(false);
|
|
@@ -890,147 +1204,135 @@ window.__ModuleLoader__.load({
|
|
|
890
1204
|
);
|
|
891
1205
|
|
|
892
1206
|
return h("div", { className: "ima-account-settings" + (props.compact ? " compact" : "") },
|
|
893
|
-
field("workspace", props.workspaceLabel || t("account.workspace"), h(
|
|
894
|
-
open: open === "workspace",
|
|
895
|
-
onToggle: (next) => setOpen(next ? "workspace" : ""),
|
|
896
|
-
icon: h(FolderIcon),
|
|
897
|
-
label: (workspace && (workspace.title || workspace.path)) || cwd || t("account.selectWorkspace"),
|
|
898
|
-
ariaLabel: props.workspaceLabel || t("account.workspace"),
|
|
1207
|
+
field("workspace", props.workspaceLabel || t("account.workspace"), h(Select, {
|
|
899
1208
|
className: "ima-account-picker ima-workspace-picker",
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
h(ChipRow, { icon: h(PlusIcon), label: t("composer.addWorkspace"), onClick: onAddWorkspace }),
|
|
912
|
-
), true),
|
|
913
|
-
adding && h("div", { className: "ima-chip-dialog" },
|
|
914
|
-
h("strong", null, t("composer.addWorkspace")),
|
|
915
|
-
h("input", { autoFocus: true, value: addPath, placeholder: t("composer.workspacePath"), "aria-label": t("composer.workspacePath"), onChange: (event) => setAddPath(event.target.value) }),
|
|
916
|
-
h("div", { className: "ima-chip-dialog-actions" },
|
|
917
|
-
h("button", { className: "ima-btn", onClick: () => { setAdding(false); setAddPath(""); } }, t("action.cancel")),
|
|
918
|
-
h("button", { className: "ima-btn primary", disabled: addBusy || !addPath.trim(), onClick: () => addWorkspace(addPath) }, addBusy ? t("action.adding") : t("action.confirm")),
|
|
1209
|
+
value: cwd || undefined,
|
|
1210
|
+
placeholder: t("account.selectWorkspace"),
|
|
1211
|
+
"aria-label": props.workspaceLabel || t("account.workspace"),
|
|
1212
|
+
popupMatchSelectWidth: false,
|
|
1213
|
+
options: items.map((item) => ({ value: item.path, label: item.title || item.path })),
|
|
1214
|
+
notFoundContent: t("composer.noWorkspaces"),
|
|
1215
|
+
onChange: (next) => update({ cwd: next }),
|
|
1216
|
+
dropdownRender: (menu) => h("div", null,
|
|
1217
|
+
menu,
|
|
1218
|
+
h("div", { style: { height: 1, margin: "6px 8px", background: "var(--dsw-alias-border-l2,rgba(255,255,255,.1))" } }),
|
|
1219
|
+
h(Button, { type: "link", icon: h(PlusIcon), onClick: onAddWorkspace }, t("composer.addWorkspace")),
|
|
919
1220
|
),
|
|
920
|
-
),
|
|
921
|
-
field("agentPreset",
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
label: (
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
1221
|
+
})),
|
|
1222
|
+
field("agentPreset", presetT("nav"), h(Select, {
|
|
1223
|
+
className: "ima-account-picker",
|
|
1224
|
+
value: value.agentPreset || undefined,
|
|
1225
|
+
"aria-label": presetT("nav"),
|
|
1226
|
+
options: (props.agentPresets || []).map((item) => {
|
|
1227
|
+
const copy = presetDisplayText(item, presetT);
|
|
1228
|
+
return {
|
|
1229
|
+
value: item.id,
|
|
1230
|
+
label: copy.name,
|
|
1231
|
+
disabled: !!item.broken,
|
|
1232
|
+
title: item.broken ? t("account.presetUnavailable") : copy.description,
|
|
1233
|
+
};
|
|
1234
|
+
}),
|
|
1235
|
+
onChange: (next) => update({ agentPreset: next }),
|
|
1236
|
+
})),
|
|
1237
|
+
h("div", { key: "model-effort", className: "ima-model-effort" },
|
|
1238
|
+
field("model", modelT("menu.model"), h(Select, {
|
|
1239
|
+
className: "ima-account-picker ima-model-select",
|
|
1240
|
+
value: currentModel ? currentModel.value : undefined,
|
|
1241
|
+
placeholder: t("account.selectModel"),
|
|
1242
|
+
title: currentModel && currentModel.label,
|
|
1243
|
+
"aria-label": modelT("trigger.selectAria"),
|
|
1244
|
+
popupMatchSelectWidth: false,
|
|
1245
|
+
options: modelGroups.map((group) => ({
|
|
1246
|
+
label: group.name,
|
|
1247
|
+
options: group.models.map((item) => ({ value: item.value, label: item.label })),
|
|
1248
|
+
})),
|
|
1249
|
+
notFoundContent: modelT("empty.models"),
|
|
1250
|
+
onChange: (next) => {
|
|
1251
|
+
const item = models.find((entry) => entry.value === next);
|
|
1252
|
+
if (!item) return;
|
|
1253
|
+
update({ provider: item.provider, model: item.model, reasoningEffort: (item.reasoning && item.reasoning.defaultEffort) || "" });
|
|
1254
|
+
},
|
|
931
1255
|
})),
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
title: currentModel && currentModel.label,
|
|
939
|
-
suffix: effortLabel,
|
|
940
|
-
ariaLabel: modelT("trigger.selectAria"),
|
|
941
|
-
menuAria: modelT("menu.aria"),
|
|
942
|
-
className: "ima-account-picker ima-model-select",
|
|
943
|
-
menuClassName: "ima-model-menu",
|
|
944
|
-
},
|
|
945
|
-
modelPane === "root" && [
|
|
946
|
-
h(ChipRow, { key: "model", kv: true, label: modelT("menu.model"), hint: (currentModel && currentModel.label) || t("account.selectModel"), chevron: true, onClick: () => setModelPane("model") }),
|
|
947
|
-
reasoning && h(ChipRow, { key: "effort", kv: true, label: modelT("menu.effort"), hint: effortLabel || modelT("effort.providerDefault"), chevron: true, onClick: () => setModelPane("effort") }),
|
|
948
|
-
],
|
|
949
|
-
modelPane === "model" && (models.length === 0
|
|
950
|
-
? h("div", { className: "ima-chip-empty" }, modelT("empty.models"))
|
|
951
|
-
: modelGroups.map((group) => h("section", { key: group.id, className: "ima-model-group", role: "group", "aria-label": group.name },
|
|
952
|
-
h("div", { className: "ima-model-group-title" }, group.name),
|
|
953
|
-
...group.models.map((item) => h(ModelChoiceRow, {
|
|
954
|
-
key: item.value,
|
|
955
|
-
label: item.label,
|
|
956
|
-
active: item.provider === provider && item.model === model,
|
|
957
|
-
onClick: () => {
|
|
958
|
-
const nextEffort = (item.reasoning && item.reasoning.defaultEffort) || "";
|
|
959
|
-
update({ provider: item.provider, model: item.model, reasoningEffort: nextEffort });
|
|
960
|
-
setOpen("");
|
|
961
|
-
},
|
|
962
|
-
})),
|
|
963
|
-
))),
|
|
964
|
-
modelPane === "effort" && efforts.map((item) => h(ModelChoiceRow, {
|
|
965
|
-
key: item.id,
|
|
966
|
-
label: item.name,
|
|
967
|
-
description: item.description,
|
|
968
|
-
active: item.id === effectiveEffort,
|
|
969
|
-
onClick: () => { update({ provider, model, reasoningEffort: item.id }); setOpen(""); },
|
|
1256
|
+
reasoning && field("effort", modelT("menu.effort"), h(Select, {
|
|
1257
|
+
className: "ima-account-picker",
|
|
1258
|
+
value: effectiveEffort,
|
|
1259
|
+
"aria-label": modelT("menu.effort"),
|
|
1260
|
+
options: efforts.map((item) => ({ value: item.id, label: item.name })),
|
|
1261
|
+
onChange: (next) => update({ provider, model, reasoningEffort: next }),
|
|
970
1262
|
})),
|
|
971
|
-
)
|
|
972
|
-
field("permission", t("composer.permission"), h(
|
|
973
|
-
open: open === "permission",
|
|
974
|
-
onToggle: (next) => setOpen(next ? "permission" : ""),
|
|
975
|
-
icon: h(ShieldIcon),
|
|
976
|
-
label: (currentPermission && currentPermission.label) || t("account.selectPermission"),
|
|
977
|
-
ariaLabel: t("composer.permission"),
|
|
1263
|
+
),
|
|
1264
|
+
field("permission", t("composer.permission"), h(Select, {
|
|
978
1265
|
className: "ima-account-picker",
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
})),
|
|
987
|
-
)),
|
|
988
|
-
field("private", t("account.privateAccess"), h(ChipMenu, {
|
|
989
|
-
open: open === "private",
|
|
990
|
-
onToggle: (next) => setOpen(next ? "private" : ""),
|
|
991
|
-
icon: h(ShieldIcon),
|
|
992
|
-
label: privateAccess === "all" ? t("account.privateAll") : t("account.privateApproved"),
|
|
993
|
-
ariaLabel: t("account.privateAccess"),
|
|
1266
|
+
value: permission || undefined,
|
|
1267
|
+
placeholder: t("account.selectPermission"),
|
|
1268
|
+
"aria-label": t("composer.permission"),
|
|
1269
|
+
options: permissionOptions.map((item) => ({ value: item.value, label: item.label })),
|
|
1270
|
+
onChange: selectPermission,
|
|
1271
|
+
})),
|
|
1272
|
+
field("private", t("account.privateAccess"), h(Select, {
|
|
994
1273
|
className: "ima-account-picker",
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
1274
|
+
value: privateAccess,
|
|
1275
|
+
"aria-label": t("account.privateAccess"),
|
|
1276
|
+
options: [
|
|
1277
|
+
{ value: "approved", label: t("account.privateApproved") },
|
|
1278
|
+
{ value: "all", label: t("account.privateAll") },
|
|
1279
|
+
],
|
|
1280
|
+
onChange: (next) => update({ privateAccess: next }),
|
|
1281
|
+
})),
|
|
999
1282
|
h("div", { className: "ima-picker-note" }, t("account.presetNote")),
|
|
1000
1283
|
privateAccess === "all" && h("div", { className: "ima-picker-note warning" }, t("settings.publicChatNotice")),
|
|
1001
1284
|
hint && h("div", { className: "ima-picker-note" }, hint),
|
|
1002
1285
|
props.showAutoNameNote && h("div", { className: "ima-picker-note" }, t("account.autoNameNote")),
|
|
1003
|
-
h(
|
|
1286
|
+
h(Modal, {
|
|
1287
|
+
open: adding,
|
|
1288
|
+
title: t("composer.addWorkspace"),
|
|
1289
|
+
onCancel: () => { setAdding(false); setAddPath(""); },
|
|
1290
|
+
onOk: () => addWorkspace(addPath),
|
|
1291
|
+
okButtonProps: { disabled: addBusy || !addPath.trim() },
|
|
1292
|
+
confirmLoading: addBusy,
|
|
1293
|
+
okText: addBusy ? t("action.adding") : t("action.confirm"),
|
|
1294
|
+
cancelText: t("action.cancel"),
|
|
1295
|
+
},
|
|
1296
|
+
h(Input, { autoFocus: true, value: addPath, placeholder: t("composer.workspacePath"), "aria-label": t("composer.workspacePath"), onChange: (event) => setAddPath(event.target.value) }),
|
|
1297
|
+
),
|
|
1298
|
+
h(Modal, {
|
|
1004
1299
|
open: confirmingFullAccess,
|
|
1005
1300
|
title: permissionT("confirm.title"),
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
onAcknowledgedChange: setFullAccessAcknowledged,
|
|
1301
|
+
keyboard: false,
|
|
1302
|
+
maskClosable: false,
|
|
1303
|
+
okText: permissionT("confirm.enable"),
|
|
1304
|
+
cancelText: permissionT("confirm.cancel"),
|
|
1305
|
+
okButtonProps: { disabled: !fullAccessAcknowledged },
|
|
1012
1306
|
onCancel: () => { setFullAccessAcknowledged(false); setConfirmingFullAccess(false); },
|
|
1013
|
-
|
|
1307
|
+
onOk: () => {
|
|
1308
|
+
if (!fullAccessAcknowledged) return;
|
|
1014
1309
|
update({ permission: "danger-full-access" });
|
|
1015
1310
|
setFullAccessAcknowledged(false);
|
|
1016
1311
|
setConfirmingFullAccess(false);
|
|
1017
1312
|
},
|
|
1018
|
-
}
|
|
1313
|
+
},
|
|
1314
|
+
h("p", null, permissionT("confirm.description")),
|
|
1315
|
+
h(Checkbox, { checked: fullAccessAcknowledged, onChange: (event) => setFullAccessAcknowledged(event.target.checked) }, permissionT("confirm.acknowledge")),
|
|
1316
|
+
),
|
|
1019
1317
|
);
|
|
1020
1318
|
}
|
|
1021
1319
|
|
|
1022
|
-
//
|
|
1320
|
+
// 与账号配置共用两列网格和 Ant 下拉,私聊与群聊分别保存。
|
|
1023
1321
|
function CommandPermissionSettings({ value, onSave, t }) {
|
|
1024
|
-
const [open, setOpen] = useState("");
|
|
1025
1322
|
const policy = value || { dm: { enabled: true, users: [] }, group: { enabled: true, users: [] } };
|
|
1026
1323
|
return h("div", { className: "ima-command-permissions ima-account-settings" },
|
|
1027
1324
|
...["dm", "group"].map(kind => h("div", { key: kind, className: "ima-picker-field" },
|
|
1028
1325
|
h("span", { className: "ima-picker-label" }, t("command." + kind)),
|
|
1029
|
-
h(
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1326
|
+
h(Select, {
|
|
1327
|
+
className: "ima-account-picker",
|
|
1328
|
+
value: policy[kind].enabled ? "on" : "off",
|
|
1329
|
+
"aria-label": t("command." + kind),
|
|
1330
|
+
options: [
|
|
1331
|
+
{ value: "on", label: t("command.enabled") },
|
|
1332
|
+
{ value: "off", label: t("command.disabled") },
|
|
1333
|
+
],
|
|
1334
|
+
onChange: (next) => onSave({ dm: { enabled: policy.dm.enabled, users: [] }, group: { enabled: policy.group.enabled, users: [] }, [kind]: { enabled: next === "on", users: [] } }),
|
|
1335
|
+
}))));
|
|
1034
1336
|
}
|
|
1035
1337
|
|
|
1036
1338
|
function AccountConnectionCheck({ account, t }) {
|
|
@@ -1039,7 +1341,10 @@ window.__ModuleLoader__.load({
|
|
|
1039
1341
|
h("strong", null, t("diagnostic.title")),
|
|
1040
1342
|
h("div", null, t("connection.checkedAt") + ": ", h("time", { dateTime: diagnostics.checkedAt }, new Date(diagnostics.checkedAt).toLocaleString(t("settings.label") === "IM Assistant" ? "en-US" : "zh-CN"))),
|
|
1041
1343
|
diagnostics.checks.map(item => h("div", { className: "ima-diagnostic-item", key: item.id },
|
|
1042
|
-
h("
|
|
1344
|
+
h("div", { className: "ima-diagnostic-head" },
|
|
1345
|
+
h("strong", null, t("diagnostic." + item.id)),
|
|
1346
|
+
h(Tag, { color: item.status === "passed" ? "success" : item.status === "failed" ? "error" : "warning" }, t("diagnostic." + item.status)),
|
|
1347
|
+
),
|
|
1043
1348
|
h("div", null, t("diagnostic." + item.reason)),
|
|
1044
1349
|
h("small", null, [item.durationMs == null ? null : item.durationMs + " ms", item.httpStatus == null ? null : "HTTP " + item.httpStatus, item.platformCode == null ? null : "Code " + item.platformCode].filter(Boolean).join(" · ")),
|
|
1045
1350
|
)),
|
|
@@ -1048,7 +1353,8 @@ window.__ModuleLoader__.load({
|
|
|
1048
1353
|
);
|
|
1049
1354
|
}
|
|
1050
1355
|
|
|
1051
|
-
function AccountInspector({ account, catalog, permissions, agentPresets, workspaces, createWorkspace, pickDirectory, modelT, permissionT, t, onAction, onSave, busy }) {
|
|
1356
|
+
function AccountInspector({ account, catalog, permissions, agentPresets, workspaces, createWorkspace, pickDirectory, modelT, permissionT, presetT, t, onAction, onSave, busy }) {
|
|
1357
|
+
const [modal, modalHolder] = Modal.useModal();
|
|
1052
1358
|
const [draft, setDraft] = useState(account);
|
|
1053
1359
|
const [note, setNote] = useState("");
|
|
1054
1360
|
const [checkResult, setCheckResult] = useState(null);
|
|
@@ -1122,12 +1428,16 @@ window.__ModuleLoader__.load({
|
|
|
1122
1428
|
return save({ assistant });
|
|
1123
1429
|
};
|
|
1124
1430
|
return h("div", { className: "ima-inspector" },
|
|
1431
|
+
modalHolder,
|
|
1125
1432
|
h("div", { className: "ima-inspector-head" },
|
|
1126
1433
|
h(Logo, { id: account.platform }),
|
|
1127
1434
|
h("div", { className: "ima-inspector-head-copy" },
|
|
1128
1435
|
h("div", { className: "ima-inspector-title-row" },
|
|
1129
1436
|
h("h3", { className: "ima-inspector-title" }, accountLabel(account, t)),
|
|
1130
|
-
h("div", { className: account.connectionState === "connected" ? "ima-inspector-status ok" : "ima-inspector-status" },
|
|
1437
|
+
h("div", { className: account.connectionState === "connected" ? "ima-inspector-status ok" : "ima-inspector-status" }, h(Tag, {
|
|
1438
|
+
color: account.receiveConfigured === false ? "warning" : account.connectionState === "connected" ? "success" : "warning",
|
|
1439
|
+
bordered: false,
|
|
1440
|
+
}, t(account.receiveConfigured === false ? "connection.paused" : "connection." + (account.connectionState || "unknown")))),
|
|
1131
1441
|
),
|
|
1132
1442
|
h("div", { className: "ima-account-id" }, account.id),
|
|
1133
1443
|
),
|
|
@@ -1144,19 +1454,28 @@ window.__ModuleLoader__.load({
|
|
|
1144
1454
|
pickDirectory,
|
|
1145
1455
|
modelT,
|
|
1146
1456
|
permissionT,
|
|
1147
|
-
|
|
1457
|
+
presetT,
|
|
1148
1458
|
workspaceLabel: t("account.currentWorkspace"),
|
|
1149
1459
|
t,
|
|
1150
1460
|
}),
|
|
1151
1461
|
h(CommandPermissionSettings, { value: draft.commandPermissions, onSave: commandPermissions => save({ commandPermissions }), t }),
|
|
1152
|
-
h("div", { className: note === "status.saved" ? "ima-save-note ok" : "ima-save-note" },
|
|
1462
|
+
note && h("div", { className: note === "status.saved" ? "ima-save-note ok" : "ima-save-note" }, t(note)),
|
|
1153
1463
|
h("div", { className: "ima-inspector-actions" },
|
|
1154
|
-
h(
|
|
1155
|
-
h(
|
|
1156
|
-
h(
|
|
1464
|
+
h(Button, { disabled: Boolean(busy) || checking, onClick: check }, t(checking ? "connection.checking" : "action.checkConnection")),
|
|
1465
|
+
h(Button, { disabled: Boolean(busy) || checking, onClick: () => { setCheckResult(null); return onAction(account.id, "reconnect"); } }, t("action.reconnectAccount")),
|
|
1466
|
+
h(Button, { danger: true, disabled: Boolean(busy) || checking, onClick: () => {
|
|
1467
|
+
modal.confirm({
|
|
1468
|
+
title: t("action.removeAccount"),
|
|
1469
|
+
content: t("account.removeConfirm"),
|
|
1470
|
+
okText: t("action.removeAccount"),
|
|
1471
|
+
cancelText: t("action.cancel"),
|
|
1472
|
+
okButtonProps: { danger: true },
|
|
1473
|
+
onOk: () => onAction(account.id, "remove"),
|
|
1474
|
+
});
|
|
1475
|
+
} }, t("action.removeAccount")),
|
|
1157
1476
|
),
|
|
1158
1477
|
checkResult && h(AccountConnectionCheck, { account: checkResult, t }),
|
|
1159
|
-
checkFailed && h(
|
|
1478
|
+
checkFailed && h(Alert, { type: "error", showIcon: true, role: "alert", message: t(typeof checkFailed === "string" ? checkFailed : "connection.checkFailed") }),
|
|
1160
1479
|
),
|
|
1161
1480
|
);
|
|
1162
1481
|
}
|
|
@@ -1178,6 +1497,7 @@ window.__ModuleLoader__.load({
|
|
|
1178
1497
|
const [selected, setSelected] = useState(storedAccountSelection);
|
|
1179
1498
|
const [settingsAccount, setSettingsAccount] = useState(null);
|
|
1180
1499
|
const [expanded, setExpanded] = useState({ weixin: true });
|
|
1500
|
+
const [channelSettingsRequest, setChannelSettingsRequest] = useState(() => typeof window !== "undefined" ? readChannelSettingsRequest(window.sessionStorage) : undefined);
|
|
1181
1501
|
const [catalog, setCatalog] = useState({ providers: [], permissions: [], assistant: null, cwd: "", permission: "" });
|
|
1182
1502
|
const workspaces = props.useWorkspaces ? (props.useWorkspaces((state) => state && state.items || []) || []) : [];
|
|
1183
1503
|
const refreshSeq = useRef(0);
|
|
@@ -1213,6 +1533,44 @@ window.__ModuleLoader__.load({
|
|
|
1213
1533
|
}).catch(() => undefined);
|
|
1214
1534
|
}, [refresh]);
|
|
1215
1535
|
useEffect(() => { const timer = setInterval(refresh, 4000); return () => clearInterval(timer); }, [refresh]);
|
|
1536
|
+
useEffect(() => {
|
|
1537
|
+
if (!settingsAccount) return undefined;
|
|
1538
|
+
const onKey = (event) => {
|
|
1539
|
+
if (event.key !== "Escape") return;
|
|
1540
|
+
if (document.querySelector(".ant-select-dropdown:not(.ant-select-dropdown-hidden), .ant-dropdown:not(.ant-dropdown-hidden)")) return;
|
|
1541
|
+
event.preventDefault();
|
|
1542
|
+
event.stopPropagation();
|
|
1543
|
+
if (typeof event.stopImmediatePropagation === "function") event.stopImmediatePropagation();
|
|
1544
|
+
setSettingsAccount(null);
|
|
1545
|
+
};
|
|
1546
|
+
window.addEventListener("keydown", onKey, true);
|
|
1547
|
+
return () => window.removeEventListener("keydown", onKey, true);
|
|
1548
|
+
}, [settingsAccount]);
|
|
1549
|
+
useEffect(() => {
|
|
1550
|
+
if (typeof window === "undefined") return undefined;
|
|
1551
|
+
const onRequest = (event) => {
|
|
1552
|
+
const request = parseChannelSettingsRequest(event.detail);
|
|
1553
|
+
if (request) setChannelSettingsRequest(request);
|
|
1554
|
+
};
|
|
1555
|
+
window.addEventListener(CHANNEL_SETTINGS_EVENT, onRequest);
|
|
1556
|
+
return () => window.removeEventListener(CHANNEL_SETTINGS_EVENT, onRequest);
|
|
1557
|
+
}, []);
|
|
1558
|
+
useEffect(() => {
|
|
1559
|
+
if (!channelSettingsRequest || channels == null) return;
|
|
1560
|
+
const target = resolveChannelSettingsTarget(channelSettingsRequest, channels);
|
|
1561
|
+
clearChannelSettingsRequest(typeof window !== "undefined" ? window.sessionStorage : undefined);
|
|
1562
|
+
setChannelSettingsRequest(undefined);
|
|
1563
|
+
if (!target) return;
|
|
1564
|
+
setExpanded((current) => Object.assign({}, current, { [target.channelId]: true }));
|
|
1565
|
+
if (target.accountId) {
|
|
1566
|
+
selectAccount(target.accountId);
|
|
1567
|
+
setSettingsAccount(target.accountId);
|
|
1568
|
+
}
|
|
1569
|
+
if (typeof document !== "undefined") {
|
|
1570
|
+
const node = document.querySelector('[data-ima-platform="' + target.channelId + '"]');
|
|
1571
|
+
if (node && typeof node.scrollIntoView === "function") node.scrollIntoView({ block: "nearest" });
|
|
1572
|
+
}
|
|
1573
|
+
}, [channelSettingsRequest, channels, selectAccount]);
|
|
1216
1574
|
|
|
1217
1575
|
const onAction = (id, action, body) => {
|
|
1218
1576
|
const removalFallback = action === "remove"
|
|
@@ -1244,26 +1602,29 @@ window.__ModuleLoader__.load({
|
|
|
1244
1602
|
|
|
1245
1603
|
return h("section", { className: "ima-page ima-account-page", "aria-label": t("settings.aria") },
|
|
1246
1604
|
h("header", { className: "ima-head" },
|
|
1247
|
-
h("div",
|
|
1605
|
+
h("div", { className: "ima-heading" },
|
|
1248
1606
|
h("div", { className: "ima-title-row" },
|
|
1249
1607
|
h("h2", { className: "ima-title" }, t("settings.title")),
|
|
1250
1608
|
h("div", { className: "ima-title-links" },
|
|
1251
|
-
h(
|
|
1252
|
-
h(
|
|
1609
|
+
h(Button, { size: "small", shape: "default", href: "https://github.com/MichengAI/dsh-im-connect", target: "_blank", rel: "noreferrer", "aria-label": t("settings.viewProject"), icon: h(GithubMark16) }, t("settings.viewProject")),
|
|
1610
|
+
h(Button, { size: "small", shape: "default", href: "https://github.com/MichengAI/dsh-im-connect/issues", target: "_blank", rel: "noreferrer", "aria-label": t("settings.feedback"), icon: h(IconListPenOutline16, { size: 16 }) }, t("settings.feedback")),
|
|
1253
1611
|
),
|
|
1254
1612
|
),
|
|
1255
1613
|
h("p", { className: "ima-sub" }, t("settings.description")),
|
|
1256
1614
|
),
|
|
1257
1615
|
),
|
|
1258
|
-
error && h("
|
|
1259
|
-
pending.length > 0 && h(
|
|
1260
|
-
|
|
1261
|
-
|
|
1616
|
+
error && h(Alert, { type: "error", showIcon: true, className: "ima-error", message: error }),
|
|
1617
|
+
pending.length > 0 && h(Alert, {
|
|
1618
|
+
type: "warning",
|
|
1619
|
+
showIcon: true,
|
|
1620
|
+
className: "ima-pending",
|
|
1621
|
+
message: t("pending.notice"),
|
|
1622
|
+
description: pending.map((p) => h("div", { key: p.channelId + p.userId, className: "ima-pending-row" },
|
|
1262
1623
|
h("span", { style: { flex: 1 } }, (p.username || p.userId) + " · " + (accountLabel(allAccounts.find((item) => item.id === p.channelId), t) || p.channelId)),
|
|
1263
|
-
h(
|
|
1264
|
-
h(
|
|
1624
|
+
h(Button, { onClick: () => onAction(p.channelId, "approve", { userId: p.userId }) }, t("action.approve")),
|
|
1625
|
+
h(Button, { onClick: () => onAction(p.channelId, "deny", { userId: p.userId }) }, t("action.deny")),
|
|
1265
1626
|
)),
|
|
1266
|
-
),
|
|
1627
|
+
}),
|
|
1267
1628
|
channels == null
|
|
1268
1629
|
? h("div", { className: "ima-empty" }, t("loading"))
|
|
1269
1630
|
: h("div", { className: "ima-account-shell" },
|
|
@@ -1272,32 +1633,45 @@ window.__ModuleLoader__.load({
|
|
|
1272
1633
|
const canExpand = (ch.accounts || []).length > 0;
|
|
1273
1634
|
const open = canExpand && Boolean(expanded[ch.id]);
|
|
1274
1635
|
const toggleExpanded = canExpand ? () => setExpanded({ ...expanded, [ch.id]: !open }) : undefined;
|
|
1275
|
-
return h("div", { key: ch.id, className: "ima-platform" + (open ? " open" : "") + (canExpand ? "" : " empty") },
|
|
1636
|
+
return h("div", { key: ch.id, className: "ima-platform" + (open ? " open" : "") + (canExpand ? "" : " empty"), "data-ima-platform": ch.id },
|
|
1276
1637
|
h("div", { className: "ima-platform-head", role: canExpand ? "button" : undefined, tabIndex: canExpand ? 0 : undefined, "aria-expanded": canExpand ? open : undefined, onClick: toggleExpanded, onKeyDown: canExpand ? (e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); toggleExpanded(); } } : undefined },
|
|
1277
1638
|
h(Logo, { id: ch.id }),
|
|
1278
1639
|
h("span", { className: "ima-platform-title" }, channelLabel(ch, t)),
|
|
1279
|
-
h("
|
|
1280
|
-
|
|
1281
|
-
|
|
1640
|
+
h("div", { className: "ima-platform-meta" },
|
|
1641
|
+
h("span", { className: "ima-platform-count" }, t("account.count", { count: ch.total })),
|
|
1642
|
+
h(Button, { onClick: (e) => { e.stopPropagation(); setEditing(ch.id); } }, t("action.addAccount")),
|
|
1643
|
+
h("span", { className: canExpand ? "ima-platform-caret" : "ima-platform-caret empty", "aria-hidden": "true" }, canExpand && h(IconChevron)),
|
|
1644
|
+
),
|
|
1282
1645
|
),
|
|
1283
1646
|
open && h("div", { className: "ima-account-list" },
|
|
1284
1647
|
...(ch.accounts || []).map((account) => h("div", { key: account.id, className: "ima-account-row" },
|
|
1285
1648
|
h("span", { className: "ima-account-copy" }, h("span", { className: "ima-account-name" }, accountLabel(account, t))),
|
|
1286
|
-
h(
|
|
1649
|
+
h(Tag, {
|
|
1650
|
+
color: busy[account.id] ? "default" : account.receiveConfigured === false ? "warning" : account.connectionState === "connected" ? "success" : "warning",
|
|
1651
|
+
bordered: false,
|
|
1652
|
+
}, busy[account.id] ? t("account.statusProcessing") : t(account.receiveConfigured === false ? "connection.paused" : "connection." + (account.connectionState || "unknown"))),
|
|
1287
1653
|
h("div", { className: "ima-account-receive", title: t("account.receiveDescription") },
|
|
1288
1654
|
h("span", null, t("account.receive")),
|
|
1289
|
-
h(
|
|
1290
|
-
h(
|
|
1655
|
+
h(Switch, { role: "switch", checked: account.receiveConfigured === true, "aria-checked": Boolean(account.receiveConfigured === true), "aria-label": accountLabel(account, t) + " · " + t("account.receive"), title: account.receiveConfigured === undefined ? t("connection.receiveUnknown") : t("account.receive"), disabled: Boolean(busy[account.id]) || account.receiveConfigured === undefined, onChange: (checked) => onAction(account.id, "receive", { receiveEnabled: checked }) })),
|
|
1656
|
+
h(Button, { onClick: () => { selectAccount(account.id); setSettingsAccount(account.id); } }, t("action.settings")),
|
|
1291
1657
|
)),
|
|
1292
1658
|
),
|
|
1293
1659
|
);
|
|
1294
1660
|
}),
|
|
1295
1661
|
),
|
|
1296
1662
|
),
|
|
1297
|
-
selectedAccount && h(
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1663
|
+
selectedAccount && h(Modal, {
|
|
1664
|
+
open: true,
|
|
1665
|
+
className: "ima-account-modal",
|
|
1666
|
+
title: t("action.settings"),
|
|
1667
|
+
width: 640,
|
|
1668
|
+
zIndex: 1100,
|
|
1669
|
+
destroyOnHidden: true,
|
|
1670
|
+
keyboard: false,
|
|
1671
|
+
onCancel: () => setSettingsAccount(null),
|
|
1672
|
+
footer: null,
|
|
1673
|
+
},
|
|
1674
|
+
h(AccountInspector, {
|
|
1301
1675
|
account: selectedAccount,
|
|
1302
1676
|
busy: busy[selectedAccount.id],
|
|
1303
1677
|
catalog: catalog.providers,
|
|
@@ -1308,11 +1682,11 @@ window.__ModuleLoader__.load({
|
|
|
1308
1682
|
pickDirectory: props.pickDirectory,
|
|
1309
1683
|
modelT: props.modelT,
|
|
1310
1684
|
permissionT: props.permissionT,
|
|
1685
|
+
presetT: props.presetT,
|
|
1311
1686
|
t,
|
|
1312
1687
|
onAction,
|
|
1313
1688
|
onSave: saveAccount,
|
|
1314
1689
|
}),
|
|
1315
|
-
),
|
|
1316
1690
|
),
|
|
1317
1691
|
editing && h(BindModal, {
|
|
1318
1692
|
ch: (channels || []).find((item) => item.id === editing) || { id: editing, label: editing, kind: "qr", fields: [] },
|
|
@@ -1324,6 +1698,7 @@ window.__ModuleLoader__.load({
|
|
|
1324
1698
|
pickDirectory: props.pickDirectory,
|
|
1325
1699
|
modelT: props.modelT,
|
|
1326
1700
|
permissionT: props.permissionT,
|
|
1701
|
+
presetT: props.presetT,
|
|
1327
1702
|
defaults: catalog,
|
|
1328
1703
|
onClose: () => setEditing(null),
|
|
1329
1704
|
onConnected: () => { setEditing(null); setExpanded((prev) => ({ ...prev, [editing]: true })); refresh(); },
|
|
@@ -1331,9 +1706,8 @@ window.__ModuleLoader__.load({
|
|
|
1331
1706
|
}),
|
|
1332
1707
|
);
|
|
1333
1708
|
}
|
|
1334
|
-
const WB_CSS = `.dcu-wb,.ima-native{display:flex;flex:1;min-height:0;flex-direction:column;padding:0;padding-right:var(--dsh-
|
|
1335
|
-
.dcu-wb
|
|
1336
|
-
.dcu-wb-tree,.ima-native-tree{flex:1;min-height:0;overflow-y:auto;padding-bottom:16px;user-select:none}
|
|
1709
|
+
const WB_CSS = `.dcu-wb,.ima-native{--dsh-session-list-edge-inset:var(--dsh-sidebar-inline-padding,12px);--dsh-session-list-scrollbar-width:5px;--dsh-session-list-scrollbar-offset:2px;display:flex;flex:1;min-width:0;min-height:0;flex-direction:column;padding:0;padding-right:var(--dsh-session-list-edge-inset);box-sizing:border-box;overflow:hidden;color:var(--dsw-alias-label-primary,var(--ima-text));font:14px/20px inherit}.ima-n-toolbar{box-sizing:border-box;flex:none;height:36px;margin:2px -4px 4px 0;padding-left:4px;display:flex;justify-content:flex-end;align-items:center;gap:4px;overflow:visible;position:relative;z-index:2;color:var(--dsw-alias-label-tertiary,#81858C);border-radius:12px}.ima-n-head-label{white-space:nowrap;min-width:0;max-width:45%;flex:none;line-height:20px;font-size:14px;overflow:hidden;transition:max-width .18s var(--ds-ease-in-out,ease),margin-right .18s var(--ds-ease-in-out,ease),opacity .12s var(--ds-ease-in-out,ease),transform .18s var(--ds-ease-in-out,ease),visibility 0s linear}.ima-n-toolbar.is-search .ima-n-head-label{opacity:0;visibility:hidden;max-width:0;margin-right:-4px;transform:translate(-4px);transition-delay:0s,0s,0s,0s,.18s}.ima-n-search-slot{box-sizing:border-box;min-width:28px;max-width:28px;transition:max-width .18s var(--ds-ease-in-out,ease);flex:none;align-items:center;margin-left:auto;display:flex;position:relative;z-index:2}.ima-n-toolbar.is-search .ima-n-search-slot{flex:1;min-width:0;max-width:100%}.ima-n-search{box-sizing:border-box;cursor:text;width:100%;height:28px;color:var(--dsw-alias-label-secondary);transition:width .18s var(--ds-ease-in-out,ease),padding .18s var(--ds-ease-in-out,ease),border-color .18s var(--ds-ease-in-out,ease);background:transparent;border:none;border-radius:50%;flex:none;align-items:center;margin:0;padding:0;display:flex;overflow:hidden}.ima-n-toolbar.is-search .ima-n-search{border:.5px solid var(--dsw-alias-border-l4);width:calc(100% + 4px);height:30px;color:var(--dsw-alias-label-caption);border-radius:10px;margin-inline:-2px;padding:0 4px 0 0}.ima-n-search-btn,.ima-n-head-btn{cursor:pointer;width:28px;height:28px;min-width:28px;min-height:28px;position:relative;z-index:1;color:var(--dsw-alias-label-secondary);background:transparent;border:none;border-radius:50%;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.ima-n-toolbar.is-search .ima-n-search-btn{width:28px;height:30px}.ima-n-search-btn:hover,.ima-n-head-btn:hover,.ima-n-head-btn.on,.ima-n-head-btn.is-on{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06));color:var(--dsw-alias-label-primary,var(--ima-text))}.ima-n-toolbar.is-search .ima-n-search-btn:hover{background:transparent}.ima-n-head-acts{opacity:1;visibility:visible;max-width:32px;transition:max-width .18s var(--ds-ease-in-out,ease),opacity .12s var(--ds-ease-in-out,ease),transform .18s var(--ds-ease-in-out,ease),visibility 0s linear;flex:none;align-items:center;gap:4px;display:flex;overflow:visible;position:relative}.ima-n-toolbar.is-search .ima-n-head-acts{opacity:0;visibility:hidden;pointer-events:none;max-width:0;transform:translate(4px);transition-delay:0s,0s,0s,.18s}.ima-n-search-input{display:none;opacity:0;pointer-events:none;width:0;min-width:0;flex:none;color:var(--dsw-alias-label-primary,var(--ima-text));transition:opacity .12s var(--ds-ease-in-out,ease);background:transparent;border:none;outline:none;flex:1;font-size:13px;line-height:18px}.ima-n-toolbar.is-search .ima-n-search-input{display:block;opacity:1;pointer-events:auto;margin-left:-2px;width:auto;flex:1;min-width:0}.ima-n-search-input::placeholder{color:var(--dsw-alias-label-tertiary,#81858C)}.ima-n-search-clear{cursor:pointer;width:24px;height:24px;color:var(--dsw-alias-label-secondary);background:transparent;border:none;border-radius:50%;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.ima-n-search-clear:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}@media (prefers-reduced-motion:reduce){.ima-n-head-label,.ima-n-search-slot,.ima-n-search,.ima-n-head-acts,.ima-n-search-input{transition:none}}.ima-n-list-area,.dcu-wb-list-area{min-height:0;margin-left:-4px;margin-right:calc(-1 * var(--dsh-session-list-edge-inset));flex-direction:column;flex:1;padding-left:4px;display:flex;overflow:visible}.ima-native-tree,.dcu-wb-tree{flex:1;min-width:0;min-height:0;overflow-x:hidden;overflow-y:auto;user-select:none;margin-left:-4px;margin-right:var(--dsh-session-list-scrollbar-offset);padding-top:0;padding-bottom:16px;padding-left:4px;padding-right:calc(var(--dsh-session-list-edge-inset) - var(--dsh-session-list-scrollbar-width) - var(--dsh-session-list-scrollbar-offset));scrollbar-gutter:stable}.ima-native-project,.dcu-wb-project{position:relative;min-width:0;max-width:100%}.ima-native-project+.ima-native-project,.dcu-wb-project+.dcu-wb-project{margin-top:4px}.ima-native-project>*+*,.dcu-wb-project>*+*{margin-top:2px}.dcu-wb *,.ima-native *{box-sizing:border-box}
|
|
1710
|
+
.dcu-wb-tree,.ima-native-tree{flex:1;min-height:0}
|
|
1337
1711
|
.dcu-wb-project-head,.ima-native-head,.dcu-wb-session,.ima-native-session{display:flex;align-items:center;gap:6px;width:100%;border:0;border-radius:8px;padding:0 8px;background:transparent;color:inherit;cursor:pointer;font:inherit;text-align:left}
|
|
1338
1712
|
.dcu-wb-project-head,.ima-native-head{height:34px}
|
|
1339
1713
|
.dcu-wb-project-head:hover,.dcu-wb-session:hover,.dcu-wb-session.dcu-wb-selected,.ima-native-head:hover,.ima-native-session:hover,.ima-native-session.on{background:var(--dsw-alias-interactive-bg-hover,var(--dcu-sidebar-hover,rgba(255,255,255,.06)))}
|
|
@@ -1344,32 +1718,39 @@ window.__ModuleLoader__.load({
|
|
|
1344
1718
|
.dcu-wb-actions,.ima-native-actions{display:none;align-items:center;flex:none}
|
|
1345
1719
|
.dcu-wb-session:hover .dcu-wb-actions,.dcu-wb-session.dcu-wb-menu-open .dcu-wb-actions,.ima-native-session:hover .ima-native-actions,.ima-native-session.menu-on .ima-native-actions{display:flex}
|
|
1346
1720
|
.dcu-wb-more,.ima-native-more{display:grid;place-items:center;width:20px;height:20px;border:0;border-radius:4px;padding:0;background:transparent;color:var(--dsw-alias-label-secondary,var(--ima-muted));cursor:pointer}
|
|
1347
|
-
.dcu-wb-empty,.ima-native-empty{padding:
|
|
1348
|
-
.ima-sess-menu{position:fixed;right:auto;top:auto;min-width:132px;padding:6px;border:1px solid var(--dsw-alias-stroke-primary,var(--ima-line));border-radius:10px;background:var(--dsw-specific-menu,var(--dsw-alias-bg-layer-2));z-index:4000}
|
|
1349
|
-
.ima-sess-menu button{display:block;width:100%;text-align:left;border:0;background:transparent;color:inherit;padding:7px 10px;border-radius:6px;cursor:pointer;font:13px/18px inherit}
|
|
1350
|
-
.ima-sess-menu button:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}
|
|
1351
|
-
.ima-sess-menu button.danger{color:var(--dsw-alias-state-error-primary,var(--ima-danger))}
|
|
1721
|
+
.dcu-wb-empty,.ima-native-empty{padding:16px 12px;color:var(--dsw-alias-label-tertiary,var(--ima-muted));font-size:13px}
|
|
1352
1722
|
.ima-rename{flex:1;min-width:0;min-height:28px;padding:2px 8px;border-radius:6px;border:1px solid var(--dsw-alias-stroke-primary,var(--ima-line));background:transparent;color:inherit;font:inherit}
|
|
1353
|
-
.ima-n-row,.ima-n-sess{display:flex;align-items:center;gap:6px;border-radius:8px;padding:0 8px
|
|
1723
|
+
.ima-n-row,.ima-n-sess{display:flex;align-items:center;max-width:100%;gap:6px;border-radius:8px;padding:0 8px;padding-inline-start:calc(8px + var(--dsh-workspace-indent,0px));cursor:pointer;user-select:none;width:100%;border:0;background:transparent;color:var(--dsw-alias-label-primary,var(--ima-text));font:14px/20px inherit;text-align:left;box-sizing:border-box}
|
|
1354
1724
|
.ima-n-row{height:34px}
|
|
1355
|
-
.ima-n-sess{height:32px;gap:0;position:relative}
|
|
1356
|
-
.ima-n-row:hover,.ima-n-sess:hover,.ima-n-sess.on,.ima-n-row.menu-on,.ima-n-sess.menu-on{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}
|
|
1357
|
-
.ima-n-
|
|
1725
|
+
.ima-n-sess{height:32px;gap:0;position:relative;appearance:none}
|
|
1726
|
+
.ima-n-row:hover,.ima-n-sess:hover,.ima-n-sess.on,.ima-n-sess.is-on,.ima-n-row.menu-on,.ima-n-row.is-menu,.ima-n-sess.menu-on,.ima-n-sess.is-menu{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}
|
|
1727
|
+
.ima-n-row.has-current-session .ima-n-folder{color:var(--dsw-alias-state-business-primary,#4c8dff)}
|
|
1728
|
+
.ima-n-project-text{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}
|
|
1729
|
+
.ima-n-row .ima-n-acts{height:20px}
|
|
1730
|
+
.ima-n-sess.is-flat-idle .ima-n-title{margin-left:0}
|
|
1731
|
+
.ima-n-sess:focus{outline:none}.ima-n-sess:focus-visible:not(.is-on){box-shadow:inset 0 0 0 2px var(--dsw-alias-state-business-primary,#4c8dff)}
|
|
1732
|
+
.ima-n-slot{flex:none;width:16px;min-width:16px;height:20px;display:inline-flex;align-items:center;justify-content:center;color:var(--dsw-alias-label-tertiary,#81858C)}
|
|
1358
1733
|
.ima-n-folder{color:var(--dsw-alias-label-secondary,#9ca39f)}
|
|
1359
1734
|
.ima-n-lead{color:var(--dsw-alias-label-tertiary,#81858C)}
|
|
1360
1735
|
.ima-n-corner{color:var(--dsw-alias-label-caption,#ADB2B8);width:8px}
|
|
1361
|
-
.ima-n-hover{position:fixed;z-index:
|
|
1362
|
-
.ima-n-hover-
|
|
1363
|
-
.ima-n-hover-
|
|
1364
|
-
.ima-n-hover-
|
|
1365
|
-
.ima-n-hover-
|
|
1366
|
-
.ima-n-hover-dot
|
|
1736
|
+
.ima-n-hover{--dsw-hovercard-bg:#2C2C2E;position:fixed;z-index:100;box-sizing:border-box;width:244px;padding:12px 16px;border:0;border-radius:12px;background:var(--dsw-hovercard-bg);box-shadow:var(--dsw-shadow-lv3,0 8px 24px rgba(0,0,0,.36))}
|
|
1737
|
+
.ima-n-hover-content{display:flex;flex-direction:column;gap:8px;min-width:0}
|
|
1738
|
+
.ima-n-hover-title{color:#fff;font-size:14px;line-height:20px;font-weight:400;overflow-wrap:break-word}
|
|
1739
|
+
.ima-n-hover-time{margin:0;color:#cfd3d6;font-size:12px;line-height:16px}
|
|
1740
|
+
.ima-n-hover-state{display:flex;align-items:center;gap:8px;margin:0;font-size:12px;line-height:20px;color:#adb2b8}
|
|
1741
|
+
.ima-n-hover-dot{width:10px;height:10px;border-radius:50%;background:var(--dsw-alias-state-success-primary,#34c759);flex:none;position:relative}
|
|
1742
|
+
.ima-n-hover-dot.is-run{background:var(--dsw-static-deepseek-450,#4c8dff)}
|
|
1367
1743
|
.ima-n-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;line-height:20px;flex:1;font-weight:400}
|
|
1368
1744
|
.ima-n-sess .ima-n-title{margin:0 6px 0 4px}
|
|
1369
|
-
.ima-n-
|
|
1370
|
-
.ima-n-
|
|
1371
|
-
.ima-n-
|
|
1372
|
-
.ima-n-sess:hover .ima-n-
|
|
1745
|
+
.ima-n-sess .ima-n-title[data-scrolled]{mask-image:linear-gradient(90deg,#0000,#000 12px)}
|
|
1746
|
+
.ima-n-sess .ima-n-title[data-clipped]{mask-image:linear-gradient(270deg,#0000,#000 12px)}
|
|
1747
|
+
.ima-n-sess .ima-n-title[data-scrolled][data-clipped]{mask-image:linear-gradient(90deg,#0000,#000 12px calc(100% - 12px),#0000)}
|
|
1748
|
+
@media (hover:hover){.ima-n-sess:hover .ima-n-title,.ima-n-sess.is-menu .ima-n-title{text-overflow:clip}}
|
|
1749
|
+
.ima-n-sess.is-archived .ima-n-title,.ima-n-sess.is-archived .ima-n-time{color:var(--dsw-alias-label-caption,#ADB2B8)}
|
|
1750
|
+
.ima-n-time{flex:none;font-size:10px;line-height:16px;color:var(--dsw-alias-label-caption,#ADB2B8);white-space:nowrap}
|
|
1751
|
+
.ima-n-acts{flex:none;display:none;align-items:center;gap:10px}
|
|
1752
|
+
.ima-n-row:hover .ima-n-acts,.ima-n-sess:hover .ima-n-acts,.ima-n-row.menu-on .ima-n-acts,.ima-n-row.is-menu .ima-n-acts,.ima-n-sess.menu-on .ima-n-acts,.ima-n-sess.is-menu .ima-n-acts{display:inline-flex}
|
|
1753
|
+
.ima-n-sess:hover .ima-n-time,.ima-n-sess.menu-on .ima-n-time,.ima-n-sess.is-menu .ima-n-time{display:none}
|
|
1373
1754
|
.ima-n-ico{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;border:0;border-radius:4px;padding:0;background:transparent;cursor:pointer;color:var(--dsw-alias-label-tertiary,#81858C)}
|
|
1374
1755
|
.ima-n-ico:hover{color:var(--dsw-alias-label-primary,var(--ima-text))}
|
|
1375
1756
|
.ima-n-menu{position:fixed;right:auto;top:auto;z-index:4000;min-width:218px;max-width:360px;box-sizing:border-box;padding:4px;display:flex;flex-direction:column;border:1px solid var(--dsw-alias-border-inverted,rgba(255,255,255,.12));border-radius:12px;background:var(--dsw-specific-menu,var(--dsw-alias-bg-layer-2));box-shadow:var(--dsw-shadow-lv3,0 8px 24px rgba(0,0,0,.36))}
|
|
@@ -1378,7 +1759,15 @@ window.__ModuleLoader__.load({
|
|
|
1378
1759
|
.ima-n-mi{display:inline-flex;flex:none;width:16px;height:16px;align-items:center;justify-content:center;color:var(--dsw-alias-label-tertiary,#81858C)}
|
|
1379
1760
|
.ima-n-menu button.danger{color:var(--dsw-alias-state-error-primary,#f85149)}
|
|
1380
1761
|
.ima-n-menu button.danger .ima-n-mi{color:inherit}
|
|
1381
|
-
.ima-n-menu button.danger:hover{background:var(--dsw-alias-interactive-bg-hover-danger,rgba(248,81,73,.12))}
|
|
1762
|
+
.ima-n-menu button.danger:hover{background:var(--dsw-alias-interactive-bg-hover-danger,rgba(248,81,73,.12))}
|
|
1763
|
+
.ima-n-rename{flex:1;min-width:0;margin:0 6px 0 4px;border:.5px solid var(--dsw-alias-border-l4);border-radius:4px;outline:none;background:var(--dsw-alias-button-elevated-fill,rgba(255,255,255,.04));color:inherit;padding:0 2px;font-size:14px;line-height:20px}
|
|
1764
|
+
.ima-n-dialog-actions{display:flex;justify-content:flex-end;gap:8px}
|
|
1765
|
+
.ima-n-dialog-copy{margin:0;color:var(--dsw-alias-label-secondary);font-size:14px;line-height:22px}
|
|
1766
|
+
.ima-n-dialog-status{margin-top:12px;color:var(--dsw-alias-label-secondary);font-size:13px;line-height:20px}
|
|
1767
|
+
.ima-n-dialog-error{margin-top:12px;color:var(--dsw-alias-state-error-primary,#f85149);font-size:13px;line-height:20px}
|
|
1768
|
+
.ima-n-danger-button{color:var(--dsw-alias-state-error-primary,#f85149)!important}
|
|
1769
|
+
.ima-n-danger-button:hover{background:var(--dsw-alias-interactive-bg-hover-danger,rgba(248,81,73,.12))!important}
|
|
1770
|
+
.ima-n-restore{flex:none;border:0;background:transparent;color:var(--dsw-alias-label-secondary,#c9cdd4);font:12px/16px inherit;padding:2px 4px;cursor:pointer}`;
|
|
1382
1771
|
|
|
1383
1772
|
function NativeSvg(viewBox, size, children) {
|
|
1384
1773
|
return h("svg", { viewBox, width: size, height: size, fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true" }, children);
|
|
@@ -1386,195 +1775,177 @@ window.__ModuleLoader__.load({
|
|
|
1386
1775
|
function NativePath(d, extra) {
|
|
1387
1776
|
return h("path", Object.assign({ d, fill: "currentColor" }, extra || {}));
|
|
1388
1777
|
}
|
|
1389
|
-
function IconEllipsis() {
|
|
1390
|
-
return NativeSvg("0 0 16 16", 16, [
|
|
1391
|
-
NativePath("M4.55146 8.00001C4.55146 8.63513 4.03659 9.15001 3.40146 9.15001C2.76634 9.15001 2.25146 8.63513 2.25146 8.00001C2.25146 7.36488 2.76634 6.85001 3.40146 6.85001C4.03659 6.85001 4.55146 7.36488 4.55146 8.00001Z"),
|
|
1392
|
-
NativePath("M9.1476 8.00001C9.1476 8.63513 8.63273 9.15001 7.9976 9.15001C7.36248 9.15001 6.8476 8.63513 6.8476 8.00001C6.8476 7.36488 7.36248 6.85001 7.9976 6.85001C8.63273 6.85001 9.1476 7.36488 9.1476 8.00001Z"),
|
|
1393
|
-
NativePath("M13.7486 8.00001C13.7486 8.63513 13.2338 9.15001 12.5986 9.15001C11.9635 9.15001 11.4486 8.63513 11.4486 8.00001C11.4486 7.36488 11.9635 6.85001 12.5986 6.85001C13.2338 6.85001 13.7486 7.36488 13.7486 8.00001Z"),
|
|
1394
|
-
]);
|
|
1395
|
-
}
|
|
1396
|
-
function IconEdit() {
|
|
1397
|
-
return NativeSvg("0 0 16 16", 16, NativePath("M9.941 1.349a2.54 2.54 0 0 1 2.473 0c.292.171.555.442.897.784.341.341.612.604.783.896a2.54 2.54 0 0 1 0 2.473c-.171.292-.442.555-.784.896L6.659 13.05c-.378.378-.652.661-.994.86-.341.199-.722.298-1.238.44l-1.183.326c-.469.13-.899.25-1.243.292-.349.043-.821.033-1.19-.336-.369-.369-.379-.841-.336-1.19.042-.344.163-.774.292-1.243l.326-1.183c.143-.516.242-.897.44-1.238.199-.342.482-.615.86-.994l6.652-6.651c.341-.342.604-.613.896-.784Zm1.759 1.222a1.16 1.16 0 0 0-1.045 0c-.095.056-.206.158-.61.562L9.456 3.721l2.265 2.265.589-.588c.404-.403.507-.515.562-.61a1.16 1.16 0 0 0 0-1.045c-.056-.095-.158-.206-.562-.61-.404-.404-.515-.507-.61-.562ZM3.394 9.784c-.429.429-.551.56-.637.706-.085.147-.138.318-.3.903l-.326 1.183c-.129.468-.209.766-.242.978.212-.033.51-.112.979-.241l1.183-.327c.585-.161.756-.214.902-.3.147-.085.277-.208.706-.636l5.062-5.063-2.265-2.265-5.062 5.062Z"));
|
|
1398
|
-
}
|
|
1399
|
-
function IconBranch() {
|
|
1400
|
-
return NativeSvg("0 0 16 16", 16, NativePath("M13.076 1.372c1.008 0 1.826.819 1.826 1.827s-.818 1.826-1.826 1.826c-.78 0-1.444-.488-1.706-1.175H4.355c.439.415.804.915 1.062 1.485l1.69 3.733a4.83 4.83 0 0 0 4.312 2.97c.29-.626.923-1.061 1.658-1.061 1.008 0 1.826.818 1.826 1.826s-.818 1.826-1.826 1.826c-.823 0-1.519-.545-1.747-1.293a6.34 6.34 0 0 1-5.406-3.731L4.232 5.871A3.83 3.83 0 0 0 1.098 3.85V2.549h10.272c.263-.687.927-1.177 1.706-1.177Zm0 10.904a.525.525 0 1 0 0 1.052.525.525 0 0 0 0-1.052Zm0-9.603a.526.526 0 1 0 0 1.053.526.526 0 0 0 0-1.053Z", { fillRule: "evenodd", clipRule: "evenodd" }));
|
|
1401
|
-
}
|
|
1402
|
-
function IconArchive() {
|
|
1403
|
-
return NativeSvg("0 0 20 20", 16, [
|
|
1404
|
-
NativePath("M15.866 2.06a2.526 2.526 0 0 1 2.525 2.525v.902c0 .54-.172 1.04-.461 1.45l.009.085v5.866c0 .746 0 1.35-.039 1.837-.035.434-.106.825-.262 1.189l-.072.154a3.03 3.03 0 0 1-1.262 1.366l-.236.132c-.408.208-.848.294-1.344.334-.488.04-1.091.04-1.837.04H7.111c-.746 0-1.35 0-1.837-.04-.434-.035-.825-.105-1.189-.261l-.154-.073a3.03 3.03 0 0 1-1.366-1.262l-.132-.235a2.53 2.53 0 0 1-.335-1.344c-.04-.487-.039-1.091-.039-1.837V7.022c0-.029.005-.057.008-.086A2.48 2.48 0 0 1 1.609 5.487v-.902A2.526 2.526 0 0 1 4.134 2.06h11.732Zm.632 5.87a2.48 2.48 0 0 1-.632.083H4.134a2.48 2.48 0 0 1-.634-.083v4.959c0 .77 0 1.304.034 1.72.034.406.095.635.182.806l.076.137c.191.311.465.565.792.731l.141.061c.156.055.361.096.666.121.415.034.95.035 1.72.035h5.775c.77 0 1.305 0 1.72-.035.407-.033.636-.095.807-.182l.138-.077c.311-.191.565-.464.731-.791l.06-.142c.056-.155.097-.36.122-.665.034-.415.034-.95.034-1.72V7.93ZM4.134 3.5a1.086 1.086 0 0 0-1.085 1.085v.902c0 .599.486 1.085 1.085 1.085h11.732c.599 0 1.085-.486 1.085-1.085v-.902A1.086 1.086 0 0 0 15.866 3.5H4.134Z", { fillRule: "evenodd", clipRule: "evenodd" }),
|
|
1405
|
-
NativePath("M12.796 12.566v-1.483H7.205v1.483h5.591Z"),
|
|
1406
|
-
]);
|
|
1407
|
-
}
|
|
1408
|
-
function IconTrash() {
|
|
1409
|
-
return NativeSvg("0 0 16 16", 16, NativePath("M14.478 4.841 14.214 10.115c-.104 2.072-.147 2.896-.827 3.846a3.53 3.53 0 0 1-1.044.993c-.519.333-1.101.478-1.784.546-.671.067-1.509.066-2.559.066s-1.887.001-2.558-.066c-.683-.068-1.266-.213-1.784-.546a3.53 3.53 0 0 1-1.044-.993c-.681-.95-.724-1.774-.828-3.846L1.522 4.841l1.368-.068.263 5.273c.109 2.176.171 2.556.573 3.117a2.16 2.16 0 0 0 .673.64c.263.169.603.277 1.179.334.587.059 1.345.06 2.422.06s1.834-.001 2.422-.06c.575-.057.916-.165 1.179-.335.262-.168.49-.386.672-.64.402-.56.464-.94.573-3.116l.263-5.273 1.369.068ZM5.43 6.228h1.37v5.163H5.43V6.228Zm3.77 0h1.37v5.163H9.2V6.228ZM8.536.434c.644 0 1.116-.007 1.56.137.14.045.276.101.406.168.416.212.745.552 1.2 1.007l.796.795h2.876v1.37H.626V2.541h2.876l.796-.795c.456-.455.784-.795 1.2-1.007.13-.067.266-.123.405-.168C6.348.427 6.82.434 7.464.434h1.072Zm-1.072 1.37c-.732 0-.948.008-1.138.07a2.2 2.2 0 0 0-.206.085c-.156.08-.296.204-.678.583h5.117c-.382-.379-.522-.503-.679-.583a2.2 2.2 0 0 0-.205-.085c-.191-.062-.406-.07-1.138-.07H7.464Z"));
|
|
1410
|
-
}
|
|
1411
|
-
function IconFolderClose() {
|
|
1412
|
-
return NativeSvg("0 0 16 16", 16, h("path", { fill: "currentColor", transform: "translate(1.5 2.429)", d: "M5.05582 0.518756L4.50669 0.86654L5.05582 0.518756ZM13 9.4837L13.65 9.4837L13.65 3.53962L13 3.53962L12.35 3.53962L12.35 9.4837L13 9.4837ZM11.3264 1.86603L11.3264 1.21603L6.52313 1.21603L6.52313 1.86603L6.52313 2.51603L11.3264 2.51603L11.3264 1.86603ZM5.58054 1.34727L6.12968 0.999489L5.60495 0.170972L5.05582 0.518756L4.50669 0.86654L5.03141 1.69506L5.58054 1.34727ZM4.11323 1.23058e-13L4.11323 -0.65L1.67359 -0.65L1.67359 5.00699e-14L1.67359 0.65L4.11323 0.65L4.11323 1.23058e-13ZM0 1.67359L-0.65 1.67359L-0.65 9.4837L0 9.4837L0.65 9.4837L0.65 1.67359L0 1.67359ZM11.3264 11.1573L11.3264 10.5073L1.67359 10.5073L1.67359 11.1573L1.67359 11.8073L11.3264 11.8073L11.3264 11.1573ZM0 9.4837L-0.65 9.4837C-0.65 10.767 0.390308 11.8073 1.67359 11.8073L1.67359 11.1573L1.67359 10.5073C1.10828 10.5073 0.65 10.049 0.65 9.4837L0 9.4837ZM1.67359 5.00699e-14L1.67359 -0.65C0.390307 -0.65 -0.65 0.390309 -0.65 1.67359L0 1.67359L0.65 1.67359C0.65 1.10828 1.10828 0.65 1.67359 0.65L1.67359 5.00699e-14ZM5.05582 0.518756L5.60495 0.170972C5.28121 -0.340193 4.71829 -0.65 4.11323 -0.65L4.11323 1.23058e-13L4.11323 0.65C4.27282 0.65 4.4213 0.731715 4.50669 0.86654L5.05582 0.518756ZM6.52313 1.86603L6.52313 1.21603C6.36354 1.21603 6.21507 1.13431 6.12968 0.999489L5.58054 1.34727L5.03141 1.69506C5.35515 2.20622 5.91808 2.51603 6.52313 2.51603L6.52313 1.86603ZM13 3.53962L13.65 3.53962C13.65 2.25634 12.6097 1.21603 11.3264 1.21603L11.3264 1.86603L11.3264 2.51603C11.8917 2.51603 12.35 2.97431 12.35 3.53962L13 3.53962ZM13 9.4837L12.35 9.4837C12.35 10.049 11.8917 10.5073 11.3264 10.5073L11.3264 11.1573L11.3264 11.8073C12.6097 11.8073 13.65 10.767 13.65 9.4837L13 9.4837Z" }));
|
|
1413
|
-
}
|
|
1414
|
-
function IconFolderOpen() {
|
|
1415
|
-
return NativeSvg("0 0 16 16", 16, [
|
|
1416
|
-
NativePath("M5.19629 1.57104C5.81144 1.5711 6.38623 1.8786 6.72754 2.39038L7.19922 3.09839C7.28454 3.22635 7.42824 3.30344 7.58203 3.30347H12.1699C13.5039 3.30348 14.5859 4.38548 14.5859 5.71948V6.62671C15.2694 7.02689 15.6605 7.85012 15.4385 8.68726L14.3848 12.658C14.1037 13.7164 13.1449 14.4527 12.0498 14.4529H2.91699C1.51651 14.4529 0.451662 13.2814 0.501954 11.9519V3.98706C0.501954 2.65305 1.58396 1.57104 2.91797 1.57104H5.19629ZM3.7793 7.75562C3.30994 7.75562 2.89883 8.07153 2.77832 8.52515L1.91602 11.7722C1.74167 12.4291 2.23734 13.073 2.91699 13.073H12.0498C12.5191 13.0728 12.9304 12.757 13.0508 12.3035L14.1045 8.33374C14.1819 8.04202 13.9619 7.756 13.6602 7.75562H3.7793ZM2.91797 2.9519C2.34625 2.9519 1.88281 3.41534 1.88281 3.98706V7.2937C2.33068 6.7269 3.02249 6.37476 3.7793 6.37476H13.2051V5.71948C13.2051 5.14777 12.7416 4.68434 12.1699 4.68433H7.58203C6.96675 4.6843 6.39209 4.37595 6.05078 3.86401L5.5791 3.15601C5.49379 3.02821 5.34995 2.95196 5.19629 2.9519H2.91797Z"),
|
|
1417
|
-
h("path", { fill: "currentColor", opacity: "0.2", d: "M13.6602 7.75525C13.9618 7.7556 14.1815 8.04179 14.1045 8.33337L13.0508 12.3031C12.9304 12.7567 12.5191 13.0725 12.0498 13.0726H2.91701C2.23744 13.0725 1.7417 12.4287 1.91603 11.7719L2.77834 8.52478C2.89898 8.07146 3.31018 7.75532 3.77931 7.75525H13.6602ZM5.1963 2.95154C5.34985 2.95159 5.49377 3.02803 5.57912 3.15564L6.0508 3.86365C6.39205 4.37553 6.96685 4.68385 7.58205 4.68396H12.1699C12.7416 4.68396 13.2049 5.14754 13.2051 5.71912V6.37439H3.77931C3.02267 6.37444 2.33067 6.72671 1.88283 7.29333V3.98669C1.88299 3.4152 2.34649 2.95168 2.91798 2.95154H5.1963Z" }),
|
|
1418
|
-
]);
|
|
1419
|
-
}
|
|
1420
1778
|
function IconChevron() {
|
|
1421
1779
|
return NativeSvg("0 0 14 14", 14, NativePath("M4.25 2.828v8.344c0 .49.592.735.939.389l4.172-4.172a.55.55 0 0 0 0-.778L5.189 2.439c-.347-.347-.939-.101-.939.389Z"));
|
|
1422
1780
|
}
|
|
1423
|
-
function
|
|
1781
|
+
function IconSearchFallback(props) {
|
|
1424
1782
|
const size = props && props.size ? props.size : 16;
|
|
1425
1783
|
return NativeSvg("0 0 16 16", size, [
|
|
1426
1784
|
NativePath("M11.894845 6.647401C11.894845 3.725463 9.534486 1.356779 6.623219 1.35657C3.711786 1.35657 1.351635 3.725338 1.351635 6.647401C1.351843 9.569296 3.711911 11.938273 6.623219 11.938273C9.534361 11.938064 11.894637 9.569171 11.894845 6.647401ZM13.245462 6.647401C13.245254 10.317935 10.280401 13.293613 6.623219 13.293821C2.965871 13.293821 0.000204 10.31806 0 6.647401C0 2.976574 2.965746 0 6.623219 0C10.280526 0.000205 13.245462 2.9767 13.245462 6.647401Z"),
|
|
1427
1785
|
NativePath("M16.000417 15.041079L15.044449 16.000433L11.530434 12.473588L12.486298 11.514234L16.000417 15.041079Z"),
|
|
1428
1786
|
]);
|
|
1429
1787
|
}
|
|
1430
|
-
function
|
|
1788
|
+
function IconSlidersFallback() {
|
|
1431
1789
|
return NativeSvg("0 0 16 16", 16, NativePath("M2.2 3.4h6.05a1.85 1.85 0 0 0 3.5 0H13.8v1.3H11.75a1.85 1.85 0 0 0-3.5 0H2.2V3.4Zm8.6 1.15A.75.75 0 1 1 10.05 4.55.75.75 0 0 1 10.8 4.55ZM2.2 7.35h2.35a1.85 1.85 0 0 0 3.5 0H13.8v1.3H8.05a1.85 1.85 0 0 0-3.5 0H2.2V7.35Zm4.1 1.15A.75.75 0 1 1 5.55 8.5a.75.75 0 0 1 .75-.75ZM2.2 11.3h7.35a1.85 1.85 0 0 0 3.5 0H13.8v1.3h-.75a1.85 1.85 0 0 0-3.5 0H2.2v-1.3Zm9.9 1.15a.75.75 0 1 1-.75-.75.75.75 0 0 1 .75.75Z"));
|
|
1432
1790
|
}
|
|
1433
|
-
function
|
|
1791
|
+
function IconCloseOutlineFallback(props) {
|
|
1434
1792
|
const size = props && props.size ? props.size : 16;
|
|
1435
1793
|
return NativeSvg("0 0 16 16", size, [
|
|
1436
1794
|
NativePath("M14.1168 13.197L13.197 14.1167L1.8833 2.80303L2.80309 1.88324L14.1168 13.197Z"),
|
|
1437
1795
|
NativePath("M13.197 1.88326L14.1168 2.80305L2.80309 14.1168L1.8833 13.197L13.197 1.88326Z"),
|
|
1438
1796
|
]);
|
|
1439
1797
|
}
|
|
1440
|
-
function
|
|
1441
|
-
return NativeSvg("0 0 16 16", 16, NativePath("
|
|
1442
|
-
}
|
|
1443
|
-
function
|
|
1444
|
-
return
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1798
|
+
function IconListFallback() {
|
|
1799
|
+
return NativeSvg("0 0 16 16", 16, NativePath("M3 4h10M3 8h10M3 12h10", { fill: "none", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round" }));
|
|
1800
|
+
}
|
|
1801
|
+
function IconArchiveCheckFallback() {
|
|
1802
|
+
return NativeSvg("0 0 16 16", 16, NativePath("M3 6.5h10v6H3v-6Zm1.2-2.5h7.6L13 6.5H3L4.2 4Zm2.3 5.2 1.3 1.3 2.6-2.6", { fill: "none", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round", strokeLinejoin: "round" }));
|
|
1803
|
+
}
|
|
1804
|
+
const IconSearchOutline = hostOrFallback(IconSearchHost, IconSearchFallback);
|
|
1805
|
+
const IconCloseFill = hostOrFallback(IconCloseFillHost, IconCloseOutlineFallback);
|
|
1806
|
+
const IconSlidersTwoOutline = hostOrFallback(IconSlidersHost, IconSlidersFallback);
|
|
1807
|
+
const IconFlatList = hostOrFallback(IconFlatListOutline, IconListFallback);
|
|
1808
|
+
const IconWorkspaceTree = hostOrFallback(pickHostIcon("IconWorkspaceTreeOutlineRegular", "IconWorkspaceTreeOutline16"), function IconTreeFallback() {
|
|
1809
|
+
return NativeSvg("0 0 16 16", 16, NativePath("M3 3h4v3H3V3Zm6 1h4M3 10h4v3H3v-3Zm6 1.5h4M7 4.5h2M7 11.5h2", { fill: "none", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round" }));
|
|
1810
|
+
});
|
|
1811
|
+
const IconArchiveCheckOutline = hostOrFallback(IconArchiveCheckHost, IconArchiveCheckFallback);
|
|
1812
|
+
function ChannelWorkspaceHead({ query, sort, groupMode, archivedFilter, onQuery, onSort, onGroupMode, onArchivedFilterChange, t = fallbackT }) {
|
|
1450
1813
|
const [searching, setSearching] = useState(!!query);
|
|
1451
|
-
const [
|
|
1814
|
+
const [filterOpen, setFilterOpen] = useState(false);
|
|
1452
1815
|
const searchSize = searching ? 11 : 14;
|
|
1816
|
+
const items = [
|
|
1817
|
+
{ type: "label", id: "group-by", text: t("rail.group") },
|
|
1818
|
+
{ id: "workspace", label: t("rail.byWorkspace"), icon: h(IconFolderClose, { size: 16 }) },
|
|
1819
|
+
{ id: "workspace-tree", label: t("rail.byWorkspaceTree"), icon: h(IconWorkspaceTree, { size: 16 }) },
|
|
1820
|
+
{ id: "flat", label: t("rail.list"), icon: h(IconFlatList, { size: 16 }) },
|
|
1821
|
+
{ type: "separator", id: "order-by-separator" },
|
|
1822
|
+
{ type: "label", id: "order-by", text: t("rail.sort") },
|
|
1823
|
+
{ id: "updated", label: t("rail.recent"), icon: h(IconClockOutline, { size: 16 }) },
|
|
1824
|
+
{ type: "separator", id: "archived-filter-separator" },
|
|
1825
|
+
{ type: "label", id: "filter-by", text: t("rail.filter") },
|
|
1826
|
+
{ id: "show-archived", label: t("rail.showArchived"), icon: h(IconArchiveOutline20, { size: 16 }) },
|
|
1827
|
+
{ id: "only-archived", label: t("rail.onlyArchived"), icon: h(IconArchiveCheckOutline, { size: 16 }) },
|
|
1828
|
+
];
|
|
1829
|
+
const selectedIds = [
|
|
1830
|
+
groupMode === "list" ? "flat" : groupMode,
|
|
1831
|
+
"updated",
|
|
1832
|
+
...(archivedFilter === "show" ? ["show-archived"] : []),
|
|
1833
|
+
...(archivedFilter === "only" ? ["only-archived"] : []),
|
|
1834
|
+
];
|
|
1453
1835
|
return h("div", { className: searching ? "ima-n-toolbar is-search" : "ima-n-toolbar" },
|
|
1454
|
-
h("span", { className: "ima-n-head-label" }, t("rail.workspace")),
|
|
1836
|
+
h("span", { className: "ima-n-head-label" }, groupMode === "list" ? t("rail.sessions") : t("rail.workspace")),
|
|
1455
1837
|
h("div", { className: "ima-n-search-slot" },
|
|
1456
|
-
h("div", { className: "ima-n-search", onClick: () => {
|
|
1457
|
-
h("button", { type: "button", className: "ima-n-search-btn", "aria-label": t("rail.search"), "aria-expanded": searching, onClick: () => {
|
|
1458
|
-
h("input", { className: "ima-n-search-input", value: query, placeholder: t("rail.searchPlaceholder"), "aria-label": t("rail.search"), tabIndex: searching ? 0 : -1, onChange: (e) => onQuery(e.target.value), onKeyDown: (e) => { if (e.key === "Escape") { onQuery(""); setSearching(false); } } }),
|
|
1459
|
-
searching && h("button", { type: "button", className: "ima-n-search-clear", "aria-label": t("rail.clearSearch"), onClick: (e) => { e.stopPropagation(); onQuery(""); setSearching(false); } }, h(
|
|
1838
|
+
h("div", { className: "ima-n-search", onClick: () => { setFilterOpen(false); setSearching(true); } },
|
|
1839
|
+
h("button", { type: "button", className: "ima-n-search-btn", "aria-label": t("rail.search"), "aria-expanded": searching, onClick: () => { setFilterOpen(false); setSearching(true); } }, h(IconSearchOutline, { size: searchSize })),
|
|
1840
|
+
h("input", { className: "ima-n-search-input", value: query, placeholder: t("rail.searchPlaceholder"), "aria-label": t("rail.search"), tabIndex: searching ? 0 : -1, "aria-hidden": !searching, onChange: (e) => onQuery(e.target.value), onKeyDown: (e) => { if (e.key === "Escape") { onQuery(""); setSearching(false); } } }),
|
|
1841
|
+
searching && h("button", { type: "button", className: "ima-n-search-clear", "aria-label": t("rail.clearSearch"), onClick: (e) => { e.stopPropagation(); onQuery(""); setSearching(false); } }, h(IconCloseFill, { size: 14 })),
|
|
1460
1842
|
),
|
|
1461
1843
|
),
|
|
1462
1844
|
h("div", { className: "ima-n-head-acts" },
|
|
1463
|
-
h(
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1845
|
+
h(HostMenu, {
|
|
1846
|
+
open: filterOpen,
|
|
1847
|
+
onClose: () => { setFilterOpen(false); },
|
|
1848
|
+
items,
|
|
1849
|
+
selectedIds,
|
|
1850
|
+
align: "end",
|
|
1851
|
+
dense: true,
|
|
1852
|
+
portal: true,
|
|
1853
|
+
onSelect: (id) => {
|
|
1854
|
+
if (id === "workspace" || id === "workspace-tree") onGroupMode(id);
|
|
1855
|
+
if (id === "flat") onGroupMode("list");
|
|
1856
|
+
if (id === "updated") onSort("time");
|
|
1857
|
+
if (id === "show-archived") onArchivedFilterChange(archivedFilter === "show" ? "default" : "show");
|
|
1858
|
+
if (id === "only-archived") onArchivedFilterChange(archivedFilter === "only" ? "default" : "only");
|
|
1859
|
+
setFilterOpen(false);
|
|
1860
|
+
},
|
|
1861
|
+
anchor: h("button", { type: "button", className: filterOpen ? "ima-n-head-btn is-on" : "ima-n-head-btn", "aria-label": t("rail.filter"), "aria-expanded": filterOpen, onClick: () => setFilterOpen((open) => !open) }, h(IconSlidersTwoOutline, { size: 16 })),
|
|
1862
|
+
}),
|
|
1475
1863
|
),
|
|
1476
1864
|
);
|
|
1477
1865
|
}
|
|
1478
|
-
function
|
|
1479
|
-
return NativeSvg("0 0 16 16", 16,
|
|
1480
|
-
NativePath("M14.1446 8C14.1446 4.6062 11.3938 1.85539 8 1.85539C4.6062 1.85539 1.85539 4.6062 1.85539 8C1.85539 11.3938 4.6062 14.1446 8 14.1446C11.3938 14.1446 14.1446 11.3938 14.1446 8ZM15.511 8C15.511 12.148 12.148 15.511 8 15.511C3.85202 15.511 0.489014 12.148 0.489014 8C0.489014 3.85202 3.85202 0.489014 8 0.489014C12.148 0.489014 15.511 3.85202 15.511 8Z"),
|
|
1481
|
-
NativePath("M10.5617 8.42578C10.852 8.21614 10.852 7.78386 10.5617 7.57422L7.25708 5.18751C6.90974 4.93666 6.42436 5.18484 6.42436 5.61329V10.3867C6.42436 10.8152 6.90974 11.0633 7.25708 10.8125L10.5617 8.42578Z"),
|
|
1482
|
-
]);
|
|
1866
|
+
function ChannelSettingsIcon() {
|
|
1867
|
+
return typeof IconSettingsOutline16 === "function" ? h(IconSettingsOutline16, { size: 16 }) : NativeSvg("0 0 16 16", 16, NativePath("M8 2.2a1.2 1.2 0 0 1 1.15.84l.16.5.5.16A1.2 1.2 0 0 1 11.3 5.3l.45.45a1.2 1.2 0 0 1 0 1.7l-.45.45-.16.5A1.2 1.2 0 0 1 10.3 9.7l-.5.16-.16.5A1.2 1.2 0 0 1 8.5 11.8H7.5a1.2 1.2 0 0 1-1.15-.84l-.16-.5-.5-.16A1.2 1.2 0 0 1 4.7 9.7l-.45-.45a1.2 1.2 0 0 1 0-1.7l.45-.45.16-.5A1.2 1.2 0 0 1 5.7 5.3l.5-.16.16-.5A1.2 1.2 0 0 1 7.5 2.2H8Zm0 4.3A1.5 1.5 0 1 0 8 9.5 1.5 1.5 0 0 0 8 6.5Z"));
|
|
1483
1868
|
}
|
|
1484
|
-
function
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
);
|
|
1869
|
+
function SessionHoverStatusDot({ running, size }) {
|
|
1870
|
+
if (typeof StateDot === "function") return h(StateDot, { state: running ? "ongoing" : "idle", size: size || 10 });
|
|
1871
|
+
return h("span", { className: running ? "ima-n-hover-dot is-run" : "ima-n-hover-dot" });
|
|
1488
1872
|
}
|
|
1489
|
-
function
|
|
1490
|
-
|
|
1873
|
+
function SessionHoverContent({ title, time, running, statuses, t = fallbackT }) {
|
|
1874
|
+
const rows = statuses && statuses.length ? statuses : [{ state: running ? "ongoing" : "idle", label: running ? t("rail.running") : t("rail.idle") }];
|
|
1875
|
+
return h("div", { className: "ima-n-hover-content" },
|
|
1491
1876
|
h("div", { className: "ima-n-hover-title" }, title),
|
|
1492
1877
|
time ? h("div", { className: "ima-n-hover-time" }, time) : null,
|
|
1493
|
-
h("div", { className: "ima-n-hover-state" },
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1878
|
+
rows.map((status) => h("div", { key: status.label, className: "ima-n-hover-state" },
|
|
1879
|
+
status.state === "archived"
|
|
1880
|
+
? h(IconArchiveOutline20, { size: 14 })
|
|
1881
|
+
: (typeof StateDot === "function"
|
|
1882
|
+
? h(StateDot, { state: status.state === "ongoing" ? "ongoing" : status.state === "warning" ? "warning" : status.state === "done" ? "done" : "idle", size: 10 })
|
|
1883
|
+
: h(SessionHoverStatusDot, { running: status.state === "ongoing" })),
|
|
1884
|
+
status.label,
|
|
1885
|
+
)),
|
|
1497
1886
|
);
|
|
1498
1887
|
}
|
|
1499
|
-
function
|
|
1500
|
-
return h(
|
|
1501
|
-
|
|
1502
|
-
const RUN_CELLS = [[0,0],[4,0],[8,0],[8,4],[8,8],[4,8],[0,8],[0,4]];
|
|
1503
|
-
function RunningStateDot() {
|
|
1504
|
-
return h("svg", { className: "ima-run-dot", width: 10, height: 10, viewBox: "0 0 10 10", shapeRendering: "crispEdges", "aria-hidden": "true" },
|
|
1505
|
-
RUN_CELLS.map(function (cell, index) {
|
|
1506
|
-
return h("rect", { key: cell[0] + "-" + cell[1], className: "ima-run-dot-cell", x: cell[0], y: cell[1], width: "2", height: "2", style: { animationDelay: ((index - RUN_CELLS.length) * 125) + "ms" } });
|
|
1507
|
-
})
|
|
1888
|
+
function SessionHoverCard({ title, time, running, statuses, style, cardRef, onMouseEnter, onMouseLeave, t = fallbackT }) {
|
|
1889
|
+
return h("div", { className: "ima-n-hover", style, ref: cardRef, onMouseEnter, onMouseLeave },
|
|
1890
|
+
h(SessionHoverContent, { title, time, running, statuses, t }),
|
|
1508
1891
|
);
|
|
1509
1892
|
}
|
|
1510
|
-
function
|
|
1511
|
-
const ts = Date.parse(value || "");
|
|
1512
|
-
if (!Number.isFinite(ts)) return "";
|
|
1513
|
-
const delta = Math.max(0, Date.now() - ts);
|
|
1514
|
-
const min = Math.floor(delta / 60000);
|
|
1515
|
-
if (min < 1) return t("time.now");
|
|
1516
|
-
if (min < 60) return t("time.minutes", { count: min });
|
|
1517
|
-
const hour = Math.floor(min / 60);
|
|
1518
|
-
if (hour < 24) return t("time.hours", { count: hour });
|
|
1519
|
-
return t("time.days", { count: Math.floor(hour / 24) });
|
|
1520
|
-
}
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
function pointerPoint(event) {
|
|
1524
|
-
const x = Number(event && event.clientX);
|
|
1525
|
-
const y = Number(event && event.clientY);
|
|
1526
|
-
return {
|
|
1527
|
-
x: Number.isFinite(x) ? x : 8,
|
|
1528
|
-
y: Number.isFinite(y) ? y : 8,
|
|
1529
|
-
};
|
|
1530
|
-
}
|
|
1531
|
-
function clampMenuPoint(x, y, width, height) {
|
|
1893
|
+
function nativeSessionHoverStyle(row, card, viewport) {
|
|
1532
1894
|
const pad = 8;
|
|
1533
|
-
const
|
|
1534
|
-
const
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
};
|
|
1895
|
+
const left = row.right + pad;
|
|
1896
|
+
const top = row.top + card.height > viewport.height - pad
|
|
1897
|
+
? Math.max(pad, viewport.height - card.height - pad)
|
|
1898
|
+
: Math.max(pad, row.top);
|
|
1899
|
+
return { position: "fixed", zIndex: 4100, left: Math.round(left) + "px", top: Math.round(top) + "px" };
|
|
1539
1900
|
}
|
|
1540
|
-
function
|
|
1541
|
-
const
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1901
|
+
function relativeTimeParts(value, now) {
|
|
1902
|
+
const ts = Date.parse(value || "");
|
|
1903
|
+
if (!Number.isFinite(ts)) return null;
|
|
1904
|
+
const MIN = 6e4;
|
|
1905
|
+
const HOUR = 36e5;
|
|
1906
|
+
const DAY = 864e5;
|
|
1907
|
+
const diff = Math.max(0, (now || Date.now()) - ts);
|
|
1908
|
+
if (diff < MIN) return { unit: "now", n: 0 };
|
|
1909
|
+
if (diff < HOUR) return { unit: "minutes", n: Math.floor(diff / MIN) };
|
|
1910
|
+
if (diff < DAY) return { unit: "hours", n: Math.floor(diff / HOUR) };
|
|
1911
|
+
if (diff < 30 * DAY) return { unit: "days", n: Math.floor(diff / DAY) };
|
|
1912
|
+
if (diff < 365 * DAY) return { unit: "months", n: Math.floor(diff / (30 * DAY)) };
|
|
1913
|
+
return { unit: "years", n: Math.floor(diff / (365 * DAY)) };
|
|
1914
|
+
}
|
|
1915
|
+
function timeLabel(value, t = fallbackT, now) {
|
|
1916
|
+
const parts = relativeTimeParts(value, now);
|
|
1917
|
+
if (!parts) return "";
|
|
1918
|
+
return parts.unit === "now" ? t("time.now") : t("time." + parts.unit, { n: parts.n, count: parts.n });
|
|
1919
|
+
}
|
|
1920
|
+
function hoverTimeLabel(value, t = fallbackT, now) {
|
|
1921
|
+
const parts = relativeTimeParts(value, now);
|
|
1922
|
+
if (!parts) return "";
|
|
1923
|
+
if (parts.unit === "now") return t("time.now");
|
|
1924
|
+
return t("time.ago", { t: t("time." + parts.unit, { n: parts.n, count: parts.n }) });
|
|
1925
|
+
}
|
|
1926
|
+
function ChannelSessionRow({ sess, selected, onOpen, onChanged, skin, sessionActions, sessionById, menuOpen, onMenuChange, canDelete, onDeleteSession, flat, renderSlot, onStopArchive, hoverStatuses }) {
|
|
1565
1927
|
const t = arguments[0].t || fallbackT;
|
|
1566
1928
|
const menu = !!menuOpen;
|
|
1567
1929
|
const setMenu = (next) => onMenuChange(!!next);
|
|
1568
1930
|
const [renaming, setRenaming] = useState(false);
|
|
1569
1931
|
const [draft, setDraft] = useState(sess.title || sess.chatId || "");
|
|
1570
1932
|
const rowRef = useRef(null);
|
|
1933
|
+
const titleRef = useRef(null);
|
|
1934
|
+
const titleFrame = useRef({ id: 0 });
|
|
1571
1935
|
const hoverRef = useRef(null);
|
|
1572
1936
|
const hoverTimer = useRef(null);
|
|
1573
1937
|
const [hoverOpen, setHoverOpen] = useState(false);
|
|
1574
1938
|
const [hoverStyle, setHoverStyle] = useState({});
|
|
1575
1939
|
const title = sess.title || sess.chatId;
|
|
1576
1940
|
const native = skin !== "codex";
|
|
1941
|
+
const useOfficialHover = native && typeof HoverCard === "function";
|
|
1942
|
+
const archived = !!arguments[0].archived;
|
|
1577
1943
|
const running = !!(sess.running || (sessionById && sessionById[sess.sessionId] && sessionById[sess.sessionId].running));
|
|
1944
|
+
const statuses = hoverStatuses || channelSessionHoverStatuses({ running, archived }, t);
|
|
1945
|
+
const primary = statuses.find((status) => status.state !== "archived");
|
|
1946
|
+
const showDot = !archived && primary && primary.state !== "idle";
|
|
1947
|
+
const trailing = primary && primary.trailing;
|
|
1948
|
+
const hoverTitle = (sessionById && sessionById[sess.sessionId] && (sessionById[sess.sessionId].displayTitle || sessionById[sess.sessionId].title)) || title;
|
|
1578
1949
|
const showHover = () => {
|
|
1579
1950
|
if (menu || !native) return;
|
|
1580
1951
|
if (hoverTimer.current) window.clearTimeout(hoverTimer.current);
|
|
@@ -1586,15 +1957,29 @@ window.__ModuleLoader__.load({
|
|
|
1586
1957
|
};
|
|
1587
1958
|
useLayoutEffect(() => {
|
|
1588
1959
|
if (!hoverOpen || menu || !rowRef.current) return;
|
|
1589
|
-
const row = rowRef.current.getBoundingClientRect();
|
|
1590
1960
|
const card = hoverRef.current;
|
|
1591
|
-
const
|
|
1592
|
-
const
|
|
1593
|
-
|
|
1961
|
+
const size = card ? { width: card.offsetWidth || 220, height: card.offsetHeight || 96 } : { width: 220, height: 96 };
|
|
1962
|
+
const update = () => {
|
|
1963
|
+
if (!rowRef.current) return;
|
|
1964
|
+
setHoverStyle(nativeSessionHoverStyle(rowRef.current.getBoundingClientRect(), {
|
|
1965
|
+
width: (hoverRef.current && hoverRef.current.offsetWidth) || size.width,
|
|
1966
|
+
height: (hoverRef.current && hoverRef.current.offsetHeight) || size.height,
|
|
1967
|
+
}, { width: window.innerWidth, height: window.innerHeight }));
|
|
1968
|
+
};
|
|
1969
|
+
update();
|
|
1970
|
+
window.addEventListener("resize", update);
|
|
1971
|
+
document.addEventListener("scroll", update, true);
|
|
1972
|
+
return () => {
|
|
1973
|
+
window.removeEventListener("resize", update);
|
|
1974
|
+
document.removeEventListener("scroll", update, true);
|
|
1975
|
+
};
|
|
1594
1976
|
}, [hoverOpen, menu, title, running]);
|
|
1595
|
-
useEffect(() => () => {
|
|
1977
|
+
useEffect(() => () => {
|
|
1978
|
+
if (hoverTimer.current) window.clearTimeout(hoverTimer.current);
|
|
1979
|
+
stopSessionTitleMarquee(titleRef.current, titleFrame.current);
|
|
1980
|
+
}, []);
|
|
1596
1981
|
const rowClass = native
|
|
1597
|
-
? ("ima-
|
|
1982
|
+
? ("ima-n-sess" + (selected ? " is-on" : "") + (menu ? " is-menu" : "") + (archived ? " is-archived" : ""))
|
|
1598
1983
|
: ("dcu-wb-session" + (selected ? " dcu-wb-selected" : "") + (menu ? " dcu-wb-menu-open" : ""));
|
|
1599
1984
|
const syncList = (groups) => { if (groups) onChanged(groups); };
|
|
1600
1985
|
const run = (action, extra) => {
|
|
@@ -1615,8 +2000,15 @@ window.__ModuleLoader__.load({
|
|
|
1615
2000
|
Promise.resolve(acts.renameSession(sess.sessionId, (extra && extra.title) || title)).then(afterHost).catch((error) => console.warn("[dsh-im-connect] 重命名失败", error));
|
|
1616
2001
|
return;
|
|
1617
2002
|
}
|
|
2003
|
+
if (action === "unarchive") {
|
|
2004
|
+
if (typeof acts.unarchiveSession === "function") {
|
|
2005
|
+
Promise.resolve(acts.unarchiveSession(sess.sessionId)).catch((error) => console.warn("[dsh-im-connect] 恢复失败", error));
|
|
2006
|
+
}
|
|
2007
|
+
return;
|
|
2008
|
+
}
|
|
1618
2009
|
if (action === "archive") {
|
|
1619
2010
|
const cleanupMissing = async error => {
|
|
2011
|
+
if (openStopArchive(error, { id: sess.sessionId, title }, onStopArchive)) return;
|
|
1620
2012
|
console.warn("[dsh-im-connect] archive failed", error);
|
|
1621
2013
|
try {
|
|
1622
2014
|
const data = await api("/sessions/cleanup-missing", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ sessionId: sess.sessionId }) });
|
|
@@ -1647,9 +2039,9 @@ window.__ModuleLoader__.load({
|
|
|
1647
2039
|
}).then((data) => { if (data.ok) syncList(data.groups); }).catch(() => undefined);
|
|
1648
2040
|
};
|
|
1649
2041
|
if (renaming) {
|
|
1650
|
-
return h("div", { className: rowClass },
|
|
2042
|
+
return h("div", { className: rowClass, ref: rowRef },
|
|
1651
2043
|
h("input", {
|
|
1652
|
-
className: "ima-rename",
|
|
2044
|
+
className: native ? "ima-n-rename" : "ima-rename",
|
|
1653
2045
|
value: draft,
|
|
1654
2046
|
autoFocus: true,
|
|
1655
2047
|
"aria-label": t("rail.renameAria"),
|
|
@@ -1663,51 +2055,153 @@ window.__ModuleLoader__.load({
|
|
|
1663
2055
|
}),
|
|
1664
2056
|
);
|
|
1665
2057
|
}
|
|
1666
|
-
const
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
2058
|
+
const displayTitle = String(hoverTitle || title).trim() || title;
|
|
2059
|
+
// 0.1.7 的 Menu 渲染 children。不请求 pin,频道会话不提供置顶。更早版本不渲染 children,仍用下面的 items。
|
|
2060
|
+
const menuSlot = renderSlot && hostMenuRendersChildren()
|
|
2061
|
+
? ["rename", "fork", "archive", "archive-manager.delete-session"].map((only) => renderSlot("sidebar.workspaces.session.menu.item", {
|
|
2062
|
+
sessionId: sess.sessionId,
|
|
2063
|
+
displayTitle,
|
|
2064
|
+
}, { hookContext: [menu, (open) => onMenuChange(!!open)], only }))
|
|
2065
|
+
: undefined;
|
|
2066
|
+
const menuItems = menuSlot !== undefined ? [] : (archived
|
|
2067
|
+
? [
|
|
2068
|
+
{ id: "unarchive", label: t("rail.unarchive"), icon: h(IconArchiveOutline20, { size: 16 }) },
|
|
2069
|
+
...(canDelete ? [{ id: "delete-session", label: t("rail.deleteSession"), icon: h(IconTrashOutline16), danger: true }] : []),
|
|
2070
|
+
]
|
|
2071
|
+
: [
|
|
2072
|
+
{ id: "rename", label: t("rail.rename"), icon: h(IconEditOutline16) },
|
|
2073
|
+
{ id: "fork", label: t("rail.fork"), icon: h(IconBranchOutline16) },
|
|
2074
|
+
{ id: "archive", label: t("rail.archive"), icon: h(IconArchiveOutline20, { size: 16 }) },
|
|
2075
|
+
...(canDelete ? [{ id: "delete-session", label: t("rail.deleteSession"), icon: h(IconTrashOutline16), danger: true }] : []),
|
|
2076
|
+
]);
|
|
2077
|
+
const row = h("div", {
|
|
1672
2078
|
ref: rowRef,
|
|
1673
|
-
className:
|
|
2079
|
+
className: rowClass,
|
|
1674
2080
|
role: "treeitem",
|
|
1675
2081
|
tabIndex: 0,
|
|
1676
2082
|
"aria-selected": selected,
|
|
2083
|
+
"data-n-menu-root": sess.sessionId,
|
|
1677
2084
|
onClick: () => { setMenu(false); hideHover(); onOpen(sess.sessionId); },
|
|
1678
|
-
onMouseEnter:
|
|
1679
|
-
|
|
2085
|
+
onMouseEnter: () => {
|
|
2086
|
+
startSessionTitleMarquee(titleRef.current, titleFrame.current);
|
|
2087
|
+
if (!useOfficialHover) showHover();
|
|
2088
|
+
},
|
|
2089
|
+
onMouseLeave: () => {
|
|
2090
|
+
stopSessionTitleMarquee(titleRef.current, titleFrame.current);
|
|
2091
|
+
if (!useOfficialHover) hideHover();
|
|
2092
|
+
},
|
|
1680
2093
|
onKeyDown: (e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); setMenu(false); onOpen(sess.sessionId); } },
|
|
1681
|
-
onContextMenu: (e) => { e.preventDefault(); e.stopPropagation(); hideHover(); onMenuChange(true
|
|
2094
|
+
onContextMenu: (e) => { e.preventDefault(); e.stopPropagation(); hideHover(); onMenuChange(true); },
|
|
1682
2095
|
},
|
|
1683
|
-
native && h("span", { className: "ima-n-slot" },
|
|
1684
|
-
h("span", {
|
|
1685
|
-
|
|
2096
|
+
native && h("span", { className: "ima-n-slot" }, showDot && typeof StateDot === "function" ? h(StateDot, { state: primary.state === "ongoing" ? "ongoing" : primary.state === "warning" ? "warning" : "done", size: 10 }) : null),
|
|
2097
|
+
h("span", {
|
|
2098
|
+
ref: native ? titleRef : undefined,
|
|
2099
|
+
className: native ? "ima-n-title" : "dcu-wb-session-title",
|
|
2100
|
+
onDoubleClick: (e) => {
|
|
2101
|
+
if (!sessionActions || typeof sessionActions.renameSession !== "function") return;
|
|
2102
|
+
e.stopPropagation();
|
|
2103
|
+
setRenaming(true);
|
|
2104
|
+
},
|
|
2105
|
+
}, title),
|
|
2106
|
+
native && h("span", { className: "ima-n-time", "aria-hidden": trailing ? true : undefined }, trailing || timeLabel(sess.updatedAt, t)),
|
|
1686
2107
|
h("span", { className: native ? "ima-n-acts" : "dcu-wb-actions" },
|
|
1687
|
-
h("button", {
|
|
2108
|
+
menuSlot === undefined && archived && h("button", {
|
|
1688
2109
|
type: "button",
|
|
1689
|
-
className:
|
|
1690
|
-
|
|
1691
|
-
"
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
2110
|
+
className: "ima-n-restore",
|
|
2111
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
2112
|
+
onClick: (e) => { e.stopPropagation(); run("unarchive"); },
|
|
2113
|
+
}, t("rail.unarchive")),
|
|
2114
|
+
h(HostMenu, {
|
|
2115
|
+
open: menu,
|
|
2116
|
+
onClose: () => { onMenuChange(false); },
|
|
2117
|
+
items: menuItems,
|
|
2118
|
+
onSelect: (action) => {
|
|
2119
|
+
onMenuChange(false);
|
|
2120
|
+
if (action === "rename") setRenaming(true);
|
|
2121
|
+
if (action === "fork") run("fork");
|
|
2122
|
+
if (action === "archive") run("archive");
|
|
2123
|
+
if (action === "unarchive") run("unarchive");
|
|
2124
|
+
if (action === "delete-session") onDeleteSession && onDeleteSession();
|
|
2125
|
+
},
|
|
2126
|
+
portal: true,
|
|
2127
|
+
closeOnPointerLeave: true,
|
|
2128
|
+
anchor: h("button", {
|
|
2129
|
+
type: "button",
|
|
2130
|
+
className: native ? "ima-n-ico" : "dcu-wb-more",
|
|
2131
|
+
"data-ima-session-more": "",
|
|
2132
|
+
"aria-expanded": menu,
|
|
2133
|
+
"aria-label": t("action.more", { channel: title }),
|
|
2134
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
2135
|
+
onClick: (e) => { e.stopPropagation(); hideHover(); onMenuChange(!menu); },
|
|
2136
|
+
}, h(IconEllipsisOutline16, { size: 16 })),
|
|
2137
|
+
}, menuSlot),
|
|
2138
|
+
renderSlot && renderSlot("sidebar.workspaces.session.row.action", { sessionId: sess.sessionId, displayTitle }, { only: "archive" }),
|
|
1695
2139
|
),
|
|
1696
|
-
hoverOpen && !menu && native && h(SessionHoverCard, {
|
|
1697
|
-
title,
|
|
1698
|
-
time:
|
|
2140
|
+
!useOfficialHover && hoverOpen && !menu && native && typeof document !== "undefined" && ReactDOM.createPortal(h(SessionHoverCard, {
|
|
2141
|
+
title: hoverTitle,
|
|
2142
|
+
time: hoverTimeLabel(sess.updatedAt, t),
|
|
1699
2143
|
running,
|
|
2144
|
+
statuses,
|
|
1700
2145
|
t,
|
|
1701
2146
|
style: hoverStyle,
|
|
1702
2147
|
cardRef: hoverRef,
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
2148
|
+
onMouseEnter: showHover,
|
|
2149
|
+
onMouseLeave: hideHover,
|
|
2150
|
+
}), document.body),
|
|
2151
|
+
);
|
|
2152
|
+
if (useOfficialHover) {
|
|
2153
|
+
return h(HoverCard, {
|
|
2154
|
+
anchor: row,
|
|
2155
|
+
content: h(SessionHoverContent, { title: hoverTitle, time: hoverTimeLabel(sess.updatedAt, t), running, statuses, t }),
|
|
2156
|
+
openDelayMs: 800,
|
|
2157
|
+
disabled: menu,
|
|
2158
|
+
copyText: displayTitle,
|
|
2159
|
+
copyLabel: t("copy"),
|
|
2160
|
+
copiedLabel: t("hover.copied"),
|
|
2161
|
+
});
|
|
2162
|
+
}
|
|
2163
|
+
return row;
|
|
2164
|
+
}
|
|
2165
|
+
|
|
2166
|
+
function ChannelGroupRow({ id, name, expanded, hasCurrentSession, menuOpen, canArchiveGroup, channelLogo = true, onToggle, onMenuChange, onChannelSettings, onArchiveGroup, t = fallbackT }) {
|
|
2167
|
+
const items = [
|
|
2168
|
+
...(channelLogo ? [{ id: "channel-settings", label: t("rail.channelSettings"), icon: h(ChannelSettingsIcon) }] : []),
|
|
2169
|
+
...(canArchiveGroup ? [
|
|
2170
|
+
{ type: "separator", id: "archive-separator" },
|
|
2171
|
+
{ id: "archive-group", label: t("rail.archiveGroup"), icon: h(IconArchiveOutline20, { size: 16 }), danger: true },
|
|
2172
|
+
] : []),
|
|
2173
|
+
];
|
|
2174
|
+
const rowClass = "ima-n-row" + (hasCurrentSession ? " has-current-session" : "") + (menuOpen ? " is-menu" : "");
|
|
2175
|
+
return h("div", {
|
|
2176
|
+
className: rowClass,
|
|
2177
|
+
role: "treeitem",
|
|
2178
|
+
"aria-expanded": expanded,
|
|
2179
|
+
"data-n-group": id,
|
|
2180
|
+
onClick: onToggle,
|
|
2181
|
+
},
|
|
2182
|
+
h("span", { className: "ima-n-slot ima-n-folder" }, channelLogo ? h(Logo, { id, small: true }) : h(IconFolderClose, { size: 16 })),
|
|
2183
|
+
h("span", { className: "ima-n-project-text" }, h("span", { className: "ima-n-title" }, name)),
|
|
2184
|
+
h("span", { className: "ima-n-acts" },
|
|
2185
|
+
h(HostMenu, {
|
|
2186
|
+
open: menuOpen,
|
|
2187
|
+
onClose: () => { onMenuChange(false); },
|
|
2188
|
+
items,
|
|
2189
|
+
onSelect: (action) => {
|
|
2190
|
+
onMenuChange(false);
|
|
2191
|
+
if (action === "channel-settings") onChannelSettings && onChannelSettings();
|
|
2192
|
+
if (action === "archive-group") onArchiveGroup && onArchiveGroup();
|
|
2193
|
+
},
|
|
2194
|
+
portal: true,
|
|
2195
|
+
closeOnPointerLeave: true,
|
|
2196
|
+
anchor: h("button", {
|
|
2197
|
+
type: "button",
|
|
2198
|
+
className: "ima-n-ico",
|
|
2199
|
+
"aria-label": t("rail.groupActions", { name }),
|
|
2200
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
2201
|
+
onClick: (e) => { e.stopPropagation(); onMenuChange(!menuOpen); },
|
|
2202
|
+
}, h(IconEllipsisOutline16, { size: 16 })),
|
|
2203
|
+
}),
|
|
2204
|
+
),
|
|
1711
2205
|
);
|
|
1712
2206
|
}
|
|
1713
2207
|
|
|
@@ -1718,7 +2212,7 @@ window.__ModuleLoader__.load({
|
|
|
1718
2212
|
|
|
1719
2213
|
function ChannelRailWithSessions(props) {
|
|
1720
2214
|
const selectedId = typeof props.useSessions === "function"
|
|
1721
|
-
? props.useSessions((state) => (state
|
|
2215
|
+
? props.useSessions((state) => currentSessionId(state))
|
|
1722
2216
|
: (props.selectedId || null);
|
|
1723
2217
|
const archivedIds = typeof props.useWorkspaces === "function"
|
|
1724
2218
|
? props.useWorkspaces((state) => (state && state.archivedSessionIds) || [])
|
|
@@ -1726,10 +2220,22 @@ window.__ModuleLoader__.load({
|
|
|
1726
2220
|
const sessionById = typeof props.useSessions === "function"
|
|
1727
2221
|
? props.useSessions((state) => (state && state.byId) || {})
|
|
1728
2222
|
: {};
|
|
2223
|
+
const workspaceItems = typeof props.useWorkspaces === "function"
|
|
2224
|
+
? props.useWorkspaces((state) => (state && state.items) || [])
|
|
2225
|
+
: (props.workspaceItems || []);
|
|
2226
|
+
const sessionStatuses = typeof props.useSessionStatus === "function"
|
|
2227
|
+
? props.useSessionStatus((state) => state)
|
|
2228
|
+
: props.sessionStatuses;
|
|
2229
|
+
const projections = typeof props.useSessions === "function"
|
|
2230
|
+
? props.useSessions((state) => (state && state.projectionsBySession) || {})
|
|
2231
|
+
: (props.projections || {});
|
|
1729
2232
|
return h(ChannelRailView, Object.assign({}, props, {
|
|
1730
2233
|
selectedId: selectedId || props.selectedId || null,
|
|
1731
2234
|
archivedIds,
|
|
1732
2235
|
sessionById,
|
|
2236
|
+
workspaceItems,
|
|
2237
|
+
sessionStatuses,
|
|
2238
|
+
projections,
|
|
1733
2239
|
}));
|
|
1734
2240
|
}
|
|
1735
2241
|
|
|
@@ -1738,15 +2244,29 @@ window.__ModuleLoader__.load({
|
|
|
1738
2244
|
const [groups, setGroups] = useState([]);
|
|
1739
2245
|
const [folded, setFolded] = useState({});
|
|
1740
2246
|
const [error, setError] = useState("");
|
|
1741
|
-
const [openMenu, setOpenMenu] = useState(
|
|
2247
|
+
const [openMenu, setOpenMenu] = useState();
|
|
2248
|
+
const [openGroupMenu, setOpenGroupMenu] = useState();
|
|
1742
2249
|
const [query, setQuery] = useState("");
|
|
1743
2250
|
const [sort, setSort] = useState("time");
|
|
1744
2251
|
const [groupMode, setGroupMode] = useState("workspace");
|
|
2252
|
+
const [archiveManagerInstalled, setArchiveManagerInstalled] = useState(() => typeof document !== "undefined" && hasArchiveManagerPlugin(document));
|
|
2253
|
+
const [deleteTarget, setDeleteTarget] = useState();
|
|
2254
|
+
const [deleteBusy, setDeleteBusy] = useState(false);
|
|
2255
|
+
const [deleteError, setDeleteError] = useState();
|
|
2256
|
+
const [archiveGroupTarget, setArchiveGroupTarget] = useState();
|
|
2257
|
+
const [archiveGroupBusy, setArchiveGroupBusy] = useState(false);
|
|
2258
|
+
const [archiveGroupError, setArchiveGroupError] = useState();
|
|
2259
|
+
const [archivedFilter, setArchivedFilter] = useState("default");
|
|
2260
|
+
const [stopArchiveTarget, setStopArchiveTarget] = useState();
|
|
2261
|
+
const [stopArchiveBusy, setStopArchiveBusy] = useState(false);
|
|
2262
|
+
const [stopArchiveError, setStopArchiveError] = useState();
|
|
1745
2263
|
const selectedId = props.selectedId;
|
|
1746
2264
|
const archived = new Set(props.archivedIds || []);
|
|
1747
2265
|
const skin = props.skin || channelSkin;
|
|
1748
2266
|
const native = skin !== "codex";
|
|
1749
|
-
const open = (id) => openListedSession(id, props.openSession || props.open);
|
|
2267
|
+
const open = (id) => openListedSession(resolveHostSessionId(id, props.sessionById), props.openSession || props.open);
|
|
2268
|
+
const canDelete = canDeleteChannelSession(archiveManagerInstalled, props.deleteSession);
|
|
2269
|
+
const canArchiveGroup = canArchiveChannelGroup(archiveManagerInstalled, props.archiveSession);
|
|
1750
2270
|
useEffect(() => {
|
|
1751
2271
|
ensureStyle();
|
|
1752
2272
|
const load = () => api("/channels").then((data) => {
|
|
@@ -1758,22 +2278,65 @@ window.__ModuleLoader__.load({
|
|
|
1758
2278
|
return () => clearInterval(timer);
|
|
1759
2279
|
}, []);
|
|
1760
2280
|
useEffect(() => {
|
|
1761
|
-
if (
|
|
1762
|
-
const
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
2281
|
+
if (typeof document === "undefined" || typeof MutationObserver === "undefined") return undefined;
|
|
2282
|
+
const refresh = () => { setArchiveManagerInstalled(hasArchiveManagerPlugin(document)); };
|
|
2283
|
+
refresh();
|
|
2284
|
+
const observer = new MutationObserver(refresh);
|
|
2285
|
+
observer.observe(document.documentElement, { childList: true, subtree: true });
|
|
2286
|
+
return () => observer.disconnect();
|
|
2287
|
+
}, []);
|
|
2288
|
+
const confirmDelete = () => {
|
|
2289
|
+
if (!deleteTarget || typeof props.deleteSession !== "function" || deleteBusy) return;
|
|
2290
|
+
const target = deleteTarget;
|
|
2291
|
+
setDeleteBusy(true);
|
|
2292
|
+
setDeleteError(undefined);
|
|
2293
|
+
Promise.resolve(props.deleteSession(target.id))
|
|
2294
|
+
.then(() => api("/sessions/remove", {
|
|
2295
|
+
method: "POST",
|
|
2296
|
+
headers: { "content-type": "application/json" },
|
|
2297
|
+
body: JSON.stringify({ sessionId: target.id }),
|
|
2298
|
+
}).then((data) => { if (data.ok && data.groups) setGroups(data.groups); }).catch(() => undefined))
|
|
2299
|
+
.then(() => { setDeleteTarget(undefined); })
|
|
2300
|
+
.catch((caught) => { setDeleteError(caught instanceof Error ? caught.message : t("error.action")); })
|
|
2301
|
+
.finally(() => { setDeleteBusy(false); });
|
|
2302
|
+
};
|
|
2303
|
+
const confirmArchiveGroup = () => {
|
|
2304
|
+
if (!archiveGroupTarget || typeof props.archiveSession !== "function" || archiveGroupBusy) return;
|
|
2305
|
+
const target = archiveGroupTarget;
|
|
2306
|
+
setArchiveGroupBusy(true);
|
|
2307
|
+
setArchiveGroupError(undefined);
|
|
2308
|
+
archiveChannelGroup(target.sessionIds, props.archiveSession)
|
|
2309
|
+
.then(() => api("/channels").then((data) => { if (data.ok) setGroups(data.groups || []); }).catch(() => undefined))
|
|
2310
|
+
.then(() => { setArchiveGroupTarget(undefined); })
|
|
2311
|
+
.catch((caught) => {
|
|
2312
|
+
if (openStopArchive(caught, { id: target.id, title: target.name, sessionIds: target.sessionIds, group: true }, (next) => {
|
|
2313
|
+
setArchiveGroupTarget(undefined);
|
|
2314
|
+
setStopArchiveError(undefined);
|
|
2315
|
+
setStopArchiveTarget(next);
|
|
2316
|
+
})) return;
|
|
2317
|
+
setArchiveGroupError(caught instanceof Error ? caught.message : t("error.action"));
|
|
2318
|
+
})
|
|
2319
|
+
.finally(() => { setArchiveGroupBusy(false); });
|
|
2320
|
+
};
|
|
2321
|
+
const confirmStopArchive = () => {
|
|
2322
|
+
if (!stopArchiveTarget || typeof props.archiveSession !== "function" || stopArchiveBusy) return;
|
|
2323
|
+
const target = stopArchiveTarget;
|
|
2324
|
+
setStopArchiveBusy(true);
|
|
2325
|
+
setStopArchiveError(undefined);
|
|
2326
|
+
const work = finishStopArchive(target, props.archiveSession).then((kind) => {
|
|
2327
|
+
if (kind === "group") return api("/channels").then((data) => { if (data.ok) setGroups(data.groups || []); }).catch(() => undefined);
|
|
2328
|
+
if (kind !== "session") return;
|
|
2329
|
+
return api("/sessions/remove", {
|
|
2330
|
+
method: "POST",
|
|
2331
|
+
headers: { "content-type": "application/json" },
|
|
2332
|
+
body: JSON.stringify({ sessionId: target.id }),
|
|
2333
|
+
}).then((data) => { if (data.ok && data.groups) setGroups(data.groups); }).catch(() => undefined);
|
|
2334
|
+
});
|
|
2335
|
+
work
|
|
2336
|
+
.then(() => { setStopArchiveTarget(undefined); })
|
|
2337
|
+
.catch((caught) => { setStopArchiveError(caught instanceof Error ? caught.message : t("error.action")); })
|
|
2338
|
+
.finally(() => { setStopArchiveBusy(false); });
|
|
2339
|
+
};
|
|
1777
2340
|
const needle = query.trim().toLowerCase();
|
|
1778
2341
|
const visibleGroups = groups.map((g) => {
|
|
1779
2342
|
const sessions = (g.sessions || []).map((sess) => {
|
|
@@ -1782,12 +2345,15 @@ window.__ModuleLoader__.load({
|
|
|
1782
2345
|
if (sess.titleSource === "user" || (!sess.titleSource && typeof sess.title === "string" && sess.title.trim())) return sess;
|
|
1783
2346
|
return host && typeof host.title === "string" && host.title.trim()
|
|
1784
2347
|
? Object.assign({}, sess, { title: host.title }) : sess;
|
|
1785
|
-
}).filter((sess) =>
|
|
2348
|
+
}).filter((sess) => channelSessionVisible(sess.sessionId, archived, archivedFilter)).map((sess) => Object.assign({}, sess, { channelId: g.id }));
|
|
1786
2349
|
if (!needle) return Object.assign({}, g, { sessions });
|
|
1787
2350
|
const nameHit = String(channelLabel(g, t)).toLowerCase().includes(needle);
|
|
1788
2351
|
return Object.assign({}, g, { sessions: nameHit ? sessions : sessions.filter((sess) => String(sess.title || sess.chatId || "").toLowerCase().includes(needle)) });
|
|
1789
2352
|
}).filter((g) => (g.sessions || []).length > 0);
|
|
1790
|
-
if (
|
|
2353
|
+
if (groupMode === "workspace-tree") {
|
|
2354
|
+
const flat = visibleGroups.flatMap((g) => g.sessions || []);
|
|
2355
|
+
visibleGroups.splice(0, visibleGroups.length, ...groupChannelSessionsByWorkspaceTree(flat, props.workspaceItems || [], t("rail.ungrouped")));
|
|
2356
|
+
} else if (sort === "time") {
|
|
1791
2357
|
visibleGroups.sort((a, b) => {
|
|
1792
2358
|
const latest = (g) => Math.max(0, ...(g.sessions || []).map((sess) => Date.parse(sess.updatedAt || "") || 0));
|
|
1793
2359
|
return latest(b) - latest(a);
|
|
@@ -1801,48 +2367,94 @@ window.__ModuleLoader__.load({
|
|
|
1801
2367
|
}
|
|
1802
2368
|
return h("div", { className: native ? "ima-native ima-rail" : "dcu-wb ima-rail" },
|
|
1803
2369
|
h("style", null, WB_CSS),
|
|
1804
|
-
h(ChannelWorkspaceHead, { query, sort, groupMode, onQuery: setQuery, onSort: setSort, onGroupMode: setGroupMode, t }),
|
|
2370
|
+
h(ChannelWorkspaceHead, { query, sort, groupMode, archivedFilter, onQuery: setQuery, onSort: setSort, onGroupMode: setGroupMode, onArchivedFilterChange: setArchivedFilter, t }),
|
|
2371
|
+
h("div", { className: native ? "ima-n-list-area" : "dcu-wb-list-area" },
|
|
1805
2372
|
h("div", { className: native ? "ima-native-tree" : "dcu-wb-tree", role: "tree" },
|
|
1806
2373
|
error && h("div", { className: native ? "ima-native-empty" : "dcu-wb-empty" }, error),
|
|
1807
2374
|
!error && visibleGroups.length === 0 && h("div", { className: native ? "ima-native-empty" : "dcu-wb-empty" }, t("rail.empty")),
|
|
1808
2375
|
...visibleGroups.map((g) => {
|
|
1809
2376
|
const visible = g.sessions || [];
|
|
1810
2377
|
const expanded = !folded[g.id];
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
2378
|
+
const hasCurrentSession = typeof selectedId === "string" && visible.some((sess) => isCurrentListedSession(selectedId, sess.sessionId, props.sessionById));
|
|
2379
|
+
const depth = g.depth || 0;
|
|
2380
|
+
const channelLogo = groupMode !== "workspace-tree" || !!g.channelId;
|
|
2381
|
+
const groupStyle = depth > 0 ? { "--dsh-workspace-indent": (depth * 12) + "px" } : undefined;
|
|
2382
|
+
return h("div", { key: g.id || "ungrouped", className: native ? "ima-native-project" : "dcu-wb-project", style: groupStyle },
|
|
2383
|
+
groupMode !== "list" && (g.keep || visible.length > 0) && (native
|
|
2384
|
+
? h(ChannelGroupRow, {
|
|
2385
|
+
id: g.channelId || g.id,
|
|
2386
|
+
channelLogo,
|
|
2387
|
+
name: channelLabel(g, t),
|
|
2388
|
+
expanded,
|
|
2389
|
+
hasCurrentSession,
|
|
2390
|
+
menuOpen: openGroupMenu === g.id,
|
|
2391
|
+
canArchiveGroup,
|
|
2392
|
+
onToggle: () => setFolded({ ...folded, [g.id]: !folded[g.id] }),
|
|
2393
|
+
onMenuChange: (next) => {
|
|
2394
|
+
setOpenMenu(undefined);
|
|
2395
|
+
setOpenGroupMenu(next ? g.id : undefined);
|
|
2396
|
+
},
|
|
2397
|
+
onChannelSettings: () => {
|
|
2398
|
+
const channelId = g.channelId || g.id;
|
|
2399
|
+
if (typeof props.openChannelSettings === "function") props.openChannelSettings({ channelId, name: channelLabel({ id: channelId, label: g.label }, t) });
|
|
2400
|
+
},
|
|
2401
|
+
onArchiveGroup: () => {
|
|
2402
|
+
setArchiveGroupError(undefined);
|
|
2403
|
+
setArchiveGroupTarget({
|
|
2404
|
+
id: g.id,
|
|
2405
|
+
name: channelLabel(g, t),
|
|
2406
|
+
sessionIds: visible.map((sess) => sess.sessionId),
|
|
2407
|
+
});
|
|
2408
|
+
},
|
|
2409
|
+
t,
|
|
2410
|
+
})
|
|
2411
|
+
: h("button", {
|
|
2412
|
+
className: "dcu-wb-project-head",
|
|
2413
|
+
type: "button",
|
|
2414
|
+
role: "treeitem",
|
|
2415
|
+
"aria-expanded": expanded,
|
|
2416
|
+
onClick: () => setFolded({ ...folded, [g.id]: !folded[g.id] }),
|
|
2417
|
+
},
|
|
2418
|
+
h("span", { className: "dcu-wb-folder" }, h(Logo, { id: g.id, small: true })),
|
|
2419
|
+
h("span", { className: "dcu-wb-project-title" }, channelLabel(g, t)),
|
|
2420
|
+
)
|
|
1828
2421
|
),
|
|
1829
2422
|
(groupMode === "list" || !folded[g.id]) && visible.length > 0 && visible.map((sess) => h(ChannelSessionRow, {
|
|
1830
2423
|
key: sess.sessionId,
|
|
1831
2424
|
sess,
|
|
1832
|
-
|
|
2425
|
+
flat: groupMode === "list",
|
|
2426
|
+
selected: isCurrentListedSession(selectedId, sess.sessionId, props.sessionById),
|
|
1833
2427
|
sessionById: props.sessionById,
|
|
1834
|
-
menuOpen: openMenu
|
|
1835
|
-
onMenuChange: (
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
}
|
|
1840
|
-
onOpen: open,
|
|
2428
|
+
menuOpen: openMenu === sess.sessionId,
|
|
2429
|
+
onMenuChange: (next) => {
|
|
2430
|
+
setOpenGroupMenu(undefined);
|
|
2431
|
+
setOpenMenu(next ? sess.sessionId : undefined);
|
|
2432
|
+
},
|
|
2433
|
+
onOpen: (id) => { setOpenMenu(undefined); open(id); },
|
|
1841
2434
|
onChanged: (next) => setGroups(next),
|
|
2435
|
+
canDelete,
|
|
2436
|
+
onDeleteSession: () => {
|
|
2437
|
+
setDeleteError(undefined);
|
|
2438
|
+
setDeleteTarget({
|
|
2439
|
+
id: sess.sessionId,
|
|
2440
|
+
title: String((props.sessionById && props.sessionById[sess.sessionId] && (props.sessionById[sess.sessionId].displayTitle || props.sessionById[sess.sessionId].title)) || sess.title || sess.chatId || sess.sessionId),
|
|
2441
|
+
});
|
|
2442
|
+
},
|
|
2443
|
+
archived: archived.has(sess.sessionId),
|
|
2444
|
+
hoverStatuses: channelSessionHoverStatuses({
|
|
2445
|
+
running: !!(sess.running || (props.sessionById && props.sessionById[sess.sessionId] && props.sessionById[sess.sessionId].running) || (props.sessionStatuses && props.sessionStatuses.get && props.sessionStatuses.get(sess.sessionId) && props.sessionStatuses.get(sess.sessionId).running)),
|
|
2446
|
+
archived: archived.has(sess.sessionId),
|
|
2447
|
+
completed: !!(props.sessionStatuses && props.sessionStatuses.get && props.sessionStatuses.get(sess.sessionId) && props.sessionStatuses.get(sess.sessionId).completionUnread),
|
|
2448
|
+
pendingKind: props.sessionStatuses && props.sessionStatuses.get && props.sessionStatuses.get(sess.sessionId) && props.sessionStatuses.get(sess.sessionId).pendingInteraction && props.sessionStatuses.get(sess.sessionId).pendingInteraction.kind,
|
|
2449
|
+
runningSubagentCount: (((props.projections && props.projections[sess.sessionId] && props.projections[sess.sessionId].values && props.projections[sess.sessionId].values.subagentCatalog) || []).filter((child) => child && child.id && props.sessionStatuses && props.sessionStatuses.get && props.sessionStatuses.get(child.id) && props.sessionStatuses.get(child.id).running)).length,
|
|
2450
|
+
}, t),
|
|
2451
|
+
onStopArchive: (target) => { setStopArchiveError(undefined); setStopArchiveTarget(target); },
|
|
2452
|
+
renderSlot: props.renderSlot,
|
|
1842
2453
|
skin,
|
|
1843
2454
|
sessionActions: {
|
|
1844
2455
|
renameSession: props.renameSession,
|
|
1845
2456
|
archiveSession: props.archiveSession,
|
|
2457
|
+
unarchiveSession: props.unarchiveSession,
|
|
1846
2458
|
deleteSession: props.deleteSession,
|
|
1847
2459
|
forkSession: props.forkSession,
|
|
1848
2460
|
openPath: props.openPath,
|
|
@@ -1852,6 +2464,49 @@ window.__ModuleLoader__.load({
|
|
|
1852
2464
|
);
|
|
1853
2465
|
}),
|
|
1854
2466
|
),
|
|
2467
|
+
),
|
|
2468
|
+
h(HostModal, {
|
|
2469
|
+
open: !!archiveGroupTarget,
|
|
2470
|
+
onClose: () => { if (!archiveGroupBusy) { setArchiveGroupTarget(undefined); setArchiveGroupError(undefined); } },
|
|
2471
|
+
closeLabel: t("rail.archiveGroupClose"),
|
|
2472
|
+
title: t("rail.archiveGroup"),
|
|
2473
|
+
footer: h("div", { className: "ima-n-dialog-actions" },
|
|
2474
|
+
h(HostButton, { variant: "outline", disabled: archiveGroupBusy, onClick: () => { setArchiveGroupTarget(undefined); setArchiveGroupError(undefined); } }, t("rail.archiveGroupCancel")),
|
|
2475
|
+
h(HostButton, { variant: "outline", className: "ima-n-danger-button", disabled: archiveGroupBusy, onClick: confirmArchiveGroup }, t("rail.archiveGroupConfirm")),
|
|
2476
|
+
),
|
|
2477
|
+
},
|
|
2478
|
+
h("p", { className: "ima-n-dialog-copy" }, archiveGroupTarget ? t("rail.archiveGroupDescription", { name: archiveGroupTarget.name, count: archiveGroupTarget.sessionIds.length }) : ""),
|
|
2479
|
+
archiveGroupBusy && h("div", { className: "ima-n-dialog-status", role: "status" }, t("rail.archiveGroupPending")),
|
|
2480
|
+
archiveGroupError && h("div", { className: "ima-n-dialog-error", role: "alert" }, t("rail.archiveGroupFailed", { message: archiveGroupError })),
|
|
2481
|
+
),
|
|
2482
|
+
h(HostModal, {
|
|
2483
|
+
open: !!stopArchiveTarget,
|
|
2484
|
+
onClose: () => { if (!stopArchiveBusy) { setStopArchiveTarget(undefined); setStopArchiveError(undefined); } },
|
|
2485
|
+
closeLabel: t("action.cancel"),
|
|
2486
|
+
title: t("rail.stopArchive"),
|
|
2487
|
+
footer: h("div", { className: "ima-n-dialog-actions" },
|
|
2488
|
+
h(HostButton, { variant: "outline", disabled: stopArchiveBusy, onClick: () => { setStopArchiveTarget(undefined); setStopArchiveError(undefined); } }, t("action.cancel")),
|
|
2489
|
+
h(HostButton, { variant: "outline", className: "ima-n-danger-button", disabled: stopArchiveBusy, onClick: confirmStopArchive }, t("rail.stopArchiveConfirm")),
|
|
2490
|
+
),
|
|
2491
|
+
},
|
|
2492
|
+
h("p", { className: "ima-n-dialog-copy" }, stopArchiveTarget ? t(stopArchiveTarget.group ? "rail.stopArchiveGroupDescription" : "rail.stopArchiveDescription", { name: stopArchiveTarget.title }) : ""),
|
|
2493
|
+
stopArchiveBusy && h("div", { className: "ima-n-dialog-status", role: "status" }, t("rail.stopArchivePending")),
|
|
2494
|
+
stopArchiveError && h("div", { className: "ima-n-dialog-error", role: "alert" }, t("rail.archiveFailed")),
|
|
2495
|
+
),
|
|
2496
|
+
h(HostModal, {
|
|
2497
|
+
open: !!deleteTarget,
|
|
2498
|
+
onClose: () => { if (!deleteBusy) { setDeleteTarget(undefined); setDeleteError(undefined); } },
|
|
2499
|
+
closeLabel: t("rail.deleteSessionClose"),
|
|
2500
|
+
title: t("rail.deleteSession"),
|
|
2501
|
+
footer: h("div", { className: "ima-n-dialog-actions" },
|
|
2502
|
+
h(HostButton, { variant: "outline", disabled: deleteBusy, onClick: () => { setDeleteTarget(undefined); setDeleteError(undefined); } }, t("rail.deleteSessionCancel")),
|
|
2503
|
+
h(HostButton, { variant: "outline", className: "ima-n-danger-button", disabled: deleteBusy, onClick: confirmDelete }, t("rail.deleteSessionConfirm")),
|
|
2504
|
+
),
|
|
2505
|
+
},
|
|
2506
|
+
h("p", { className: "ima-n-dialog-copy" }, deleteTarget ? t("rail.deleteSessionDescription", { name: deleteTarget.title }) : ""),
|
|
2507
|
+
deleteBusy && h("div", { className: "ima-n-dialog-status", role: "status" }, t("rail.deleteSessionPending")),
|
|
2508
|
+
deleteError && h("div", { className: "ima-n-dialog-error", role: "alert" }, t("rail.deleteSessionFailed", { message: deleteError })),
|
|
2509
|
+
),
|
|
1855
2510
|
);
|
|
1856
2511
|
}
|
|
1857
2512
|
|
|
@@ -1890,7 +2545,7 @@ window.__ModuleLoader__.load({
|
|
|
1890
2545
|
.map((id) => snap.byId[id])
|
|
1891
2546
|
.filter((item) => item && !assigned.has(item.id) && isTaskSessionItem(item) && !archived.has(item.id));
|
|
1892
2547
|
if (ungrouped.length) groups.push({ id: "", label: t("rail.ungrouped"), sessions: ungrouped });
|
|
1893
|
-
return h(TaskListView, { groups, current: snap
|
|
2548
|
+
return h(TaskListView, { groups, current: currentSessionId(snap), openSession: props.openSession, t });
|
|
1894
2549
|
}
|
|
1895
2550
|
|
|
1896
2551
|
function TaskListView({ groups, current, openSession, t = fallbackT }) {
|
|
@@ -2024,9 +2679,11 @@ window.__ModuleLoader__.load({
|
|
|
2024
2679
|
const [tab, setTab] = useState(() => {
|
|
2025
2680
|
try { return localStorage.getItem(TAB_KEY) || "tasks"; } catch { return "tasks"; }
|
|
2026
2681
|
});
|
|
2027
|
-
const
|
|
2028
|
-
? rawUseSessions((state) =>
|
|
2029
|
-
:
|
|
2682
|
+
const sessionSnap = typeof rawUseSessions === "function"
|
|
2683
|
+
? rawUseSessions((state) => state)
|
|
2684
|
+
: undefined;
|
|
2685
|
+
const currentId = sessionSnap ? currentSessionId(sessionSnap) : (props.selectedId || null);
|
|
2686
|
+
const sessionById = (sessionSnap && sessionSnap.byId) || {};
|
|
2030
2687
|
const useTaskSessions = useCallback((selector, eq) => {
|
|
2031
2688
|
if (typeof rawUseSessions !== "function") return selector({ ids: [], byId: {}, current: null });
|
|
2032
2689
|
return rawUseSessions((state) => selector(applyRegistryFilters(filterTaskSessions(state), nativeTabs)), eq);
|
|
@@ -2053,20 +2710,25 @@ window.__ModuleLoader__.load({
|
|
|
2053
2710
|
const matched = extraTabs.find((item) => item.matchSession && item.matchSession(currentId));
|
|
2054
2711
|
if (matched && matched.id !== "schedule") setTab(matched.id);
|
|
2055
2712
|
}, [currentId, extraTabs, membershipRevision]);
|
|
2056
|
-
const openSession = (id) =>
|
|
2057
|
-
|
|
2713
|
+
const openSession = (id) => {
|
|
2714
|
+
openListedSession(resolveHostSessionId(id, sessionById), props.openSession || props.open);
|
|
2715
|
+
};
|
|
2716
|
+
const officialProps = Object.assign({}, props, { useSessions: useTaskSessions, t: officialT, openSession, open: openSession });
|
|
2058
2717
|
const channelRail = h(ChannelRail, {
|
|
2059
2718
|
openSession,
|
|
2060
2719
|
open: openSession,
|
|
2061
2720
|
useSessions: rawUseSessions,
|
|
2062
2721
|
useWorkspaces: props.useWorkspaces,
|
|
2722
|
+
useSessionStatus: props.useSessionStatus,
|
|
2063
2723
|
selectedId: currentId || props.selectedId || null,
|
|
2064
2724
|
skin: "native",
|
|
2065
2725
|
renameSession: props.renameSession,
|
|
2066
2726
|
archiveSession: props.archiveSession,
|
|
2727
|
+
unarchiveSession: props.unarchiveSession,
|
|
2067
2728
|
deleteSession: props.deleteSession,
|
|
2068
2729
|
forkSession: props.forkSession,
|
|
2069
2730
|
openPath: props.openPath,
|
|
2731
|
+
openChannelSettings: props.openChannelSettings,
|
|
2070
2732
|
t,
|
|
2071
2733
|
});
|
|
2072
2734
|
if (props.wide === false) return Official ? h(Official, officialProps) : null;
|
|
@@ -2161,22 +2823,35 @@ window.__ModuleLoader__.load({
|
|
|
2161
2823
|
}), "im-connect: plugin update ui");
|
|
2162
2824
|
const permissionT = ctx.locale.bind("permission.access");
|
|
2163
2825
|
const modelT = ctx.locale.bind("model");
|
|
2826
|
+
const presetT = ctx.locale.bind("settings.agentPreset");
|
|
2164
2827
|
const subscribeLocale = (listener) => ctx.locale.subscribe(listener);
|
|
2165
2828
|
const localeSnapshot = () => ctx.locale.getSnapshot();
|
|
2829
|
+
const openChannelSettings = (request) => {
|
|
2830
|
+
const next = parseChannelSettingsRequest(request);
|
|
2831
|
+
if (!next) return;
|
|
2832
|
+
requestChannelSettings(next);
|
|
2833
|
+
openSettingsSection(
|
|
2834
|
+
[t("settings.label"), IM_LOCALES.en["settings.label"], IM_LOCALES.zh["settings.label"]],
|
|
2835
|
+
() => { requestChannelSettings(next); },
|
|
2836
|
+
);
|
|
2837
|
+
};
|
|
2166
2838
|
function LocalizedChannelRail(props) {
|
|
2167
2839
|
useSyncExternalStore(subscribeLocale, localeSnapshot, localeSnapshot);
|
|
2168
|
-
return h(ChannelRail, Object.assign({}, props, { t }));
|
|
2840
|
+
return h(AntdProvider, null, h(ChannelRail, Object.assign({}, props, { t, openChannelSettings })));
|
|
2169
2841
|
}
|
|
2170
2842
|
function LocalizedSessionSwitcher(props) {
|
|
2171
2843
|
useSyncExternalStore(subscribeLocale, localeSnapshot, localeSnapshot);
|
|
2172
|
-
return h(SessionSwitcher, Object.assign({}, props, { t, officialT: props.t }));
|
|
2844
|
+
return h(AntdProvider, null, h(SessionSwitcher, Object.assign({}, props, { t, officialT: props.t, openChannelSettings })));
|
|
2173
2845
|
}
|
|
2174
2846
|
function LocalizedSettingsPage(props) {
|
|
2175
2847
|
useSyncExternalStore(subscribeLocale, localeSnapshot, localeSnapshot);
|
|
2176
|
-
return h(SettingsPage, Object.assign({}, props, { t, permissionT, modelT }));
|
|
2848
|
+
return h(AntdProvider, null, h(SettingsPage, Object.assign({}, props, { t, permissionT, modelT, presetT })));
|
|
2177
2849
|
}
|
|
2178
2850
|
openImSession = (id) => {
|
|
2179
|
-
try {
|
|
2851
|
+
try {
|
|
2852
|
+
if (window.__dshSessionsOpen) { window.__dshSessionsOpen(id); return true; }
|
|
2853
|
+
} catch { /* ignore */ }
|
|
2854
|
+
try { return openHostSession(ctx, id); }
|
|
2180
2855
|
catch (error) { console.warn("[dsh-im-connect] 无法打开会话", id, error); return false; }
|
|
2181
2856
|
};
|
|
2182
2857
|
ctx.slots.inject("settings.section", () => ctx.slots.register({
|
|
@@ -2188,9 +2863,10 @@ window.__ModuleLoader__.load({
|
|
|
2188
2863
|
locale: IM_LOCALE_NS,
|
|
2189
2864
|
inject: () => ({
|
|
2190
2865
|
createWorkspace: (input) => ctx.workspaces.create(input),
|
|
2191
|
-
pickDirectory: () => ctx
|
|
2866
|
+
pickDirectory: () => pickHostDirectory(ctx),
|
|
2192
2867
|
permissionT,
|
|
2193
2868
|
modelT,
|
|
2869
|
+
presetT,
|
|
2194
2870
|
}),
|
|
2195
2871
|
}, LocalizedSettingsPage));
|
|
2196
2872
|
|
|
@@ -2199,22 +2875,14 @@ window.__ModuleLoader__.load({
|
|
|
2199
2875
|
id: "im-connect-channels",
|
|
2200
2876
|
locale: IM_LOCALE_NS,
|
|
2201
2877
|
inject: () => ({
|
|
2202
|
-
openSession: (id) => { ctx
|
|
2203
|
-
open: (id) => { ctx
|
|
2204
|
-
archiveSession: (id) => ctx
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
.catch(() => undefined);
|
|
2209
|
-
},
|
|
2210
|
-
renameSession: async (sessionId, title) => {
|
|
2211
|
-
const session = ctx.sessions.binding && ctx.sessions.binding(sessionId)?.session;
|
|
2212
|
-
if (!session) throw new Error("unknown session");
|
|
2213
|
-
const result = await session.rename(title);
|
|
2214
|
-
if (!result.ok) throw new Error(result.error.message);
|
|
2215
|
-
},
|
|
2878
|
+
openSession: (id) => { openHostSession(ctx, id); },
|
|
2879
|
+
open: (id) => { openHostSession(ctx, id); },
|
|
2880
|
+
archiveSession: (id, options) => archiveHostSession(ctx, id, options),
|
|
2881
|
+
unarchiveSession: (id) => unarchiveHostSession(ctx, id),
|
|
2882
|
+
forkSession: (id) => forkHostSession(ctx, id),
|
|
2883
|
+
renameSession: (sessionId, title) => renameHostSession(ctx, sessionId, title),
|
|
2216
2884
|
}),
|
|
2217
|
-
},
|
|
2885
|
+
}, LocalizedChannelRail));
|
|
2218
2886
|
|
|
2219
2887
|
// 只包一层官方任务树,绝不在通知回调里再 register,否则会把启动卡在 Loading plugins。
|
|
2220
2888
|
ctx.slots.inject("sidebar.workspaces", () => {
|
|
@@ -2264,8 +2932,8 @@ window.__ModuleLoader__.load({
|
|
|
2264
2932
|
matchSession: isChannelSession,
|
|
2265
2933
|
render: (props) => h(LocalizedChannelRail, Object.assign({}, props, {
|
|
2266
2934
|
skin: "native",
|
|
2267
|
-
|
|
2268
|
-
|
|
2935
|
+
archiveSession: props.archiveSession || ((id, options) => archiveHostSession(ctx, id, options)),
|
|
2936
|
+
unarchiveSession: props.unarchiveSession || ((id) => unarchiveHostSession(ctx, id)),
|
|
2269
2937
|
})),
|
|
2270
2938
|
});
|
|
2271
2939
|
};
|