@michengai/dsh-im-connect 0.1.49 → 0.1.51
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 +17 -0
- package/CHANGELOG.zh-CN.md +17 -0
- package/README.md +2 -2
- package/README.zh-CN.md +2 -2
- package/client.js +664 -222
- package/lib/client.js +664 -222
- package/lib/engine/chat-commands.d.ts.map +1 -1
- package/lib/engine/chat-commands.js +2 -1
- package/lib/engine/chat-commands.js.map +1 -1
- package/lib/engine/file-delivery.d.ts +0 -1
- package/lib/engine/file-delivery.d.ts.map +1 -1
- package/lib/engine/file-delivery.js +4 -3
- package/lib/engine/file-delivery.js.map +1 -1
- package/lib/engine/gateway.d.ts.map +1 -1
- package/lib/engine/gateway.js +4 -3
- package/lib/engine/gateway.js.map +1 -1
- package/lib/engine/router.d.ts.map +1 -1
- package/lib/engine/router.js +7 -6
- package/lib/engine/router.js.map +1 -1
- package/lib/engine/session-history.d.ts +22 -0
- package/lib/engine/session-history.d.ts.map +1 -0
- package/lib/engine/session-history.js +31 -0
- package/lib/engine/session-history.js.map +1 -0
- package/package.json +15 -15
- package/src/engine/chat-commands.ts +3 -2
- package/src/engine/file-delivery.ts +4 -4
- package/src/engine/gateway.ts +4 -4
- package/src/engine/router.ts +9 -8
- package/src/engine/session-history.ts +38 -0
package/client.js
CHANGED
|
@@ -9,7 +9,151 @@ 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 {
|
|
14
|
+
RiskConfirmation,
|
|
15
|
+
Button,
|
|
16
|
+
Menu,
|
|
17
|
+
Modal,
|
|
18
|
+
IconListPenOutline16,
|
|
19
|
+
IconRefreshOutline16,
|
|
20
|
+
IconDownloadOutline16,
|
|
21
|
+
IconCopyOutline16,
|
|
22
|
+
IconCloseOutline16,
|
|
23
|
+
IconEditOutline16,
|
|
24
|
+
IconBranchOutline16,
|
|
25
|
+
IconArchiveOutline20,
|
|
26
|
+
IconTrashOutline16,
|
|
27
|
+
IconEllipsisOutline16,
|
|
28
|
+
} = primitives;
|
|
29
|
+
const HoverCard = primitives.HoverCard;
|
|
30
|
+
const StateDot = primitives.StateDot;
|
|
31
|
+
const IconSettingsOutline16 = primitives.IconSettingsOutline16;
|
|
32
|
+
const ARCHIVE_MANAGER_PLUGIN = "@michengai/dsh-archive-manager";
|
|
33
|
+
function hasArchiveManagerPlugin(root) {
|
|
34
|
+
return !!(root && typeof root.querySelector === "function" && root.querySelector('[data-plugin="' + ARCHIVE_MANAGER_PLUGIN + '"]'));
|
|
35
|
+
}
|
|
36
|
+
function canDeleteChannelSession(archiveManagerInstalled, deleteSession) {
|
|
37
|
+
return archiveManagerInstalled && typeof deleteSession === "function";
|
|
38
|
+
}
|
|
39
|
+
function canArchiveChannelGroup(archiveManagerInstalled, archiveSession) {
|
|
40
|
+
return archiveManagerInstalled && typeof archiveSession === "function";
|
|
41
|
+
}
|
|
42
|
+
async function archiveChannelGroup(sessionIds, archiveSession) {
|
|
43
|
+
for (const sessionId of sessionIds) await archiveSession(sessionId);
|
|
44
|
+
}
|
|
45
|
+
const CHANNEL_SETTINGS_EVENT = "dsh-im-connect:open-channel-settings";
|
|
46
|
+
const CHANNEL_SETTINGS_STORAGE_KEY = "dsh-im-connect:pending-channel-settings";
|
|
47
|
+
const SETTINGS_CODEX_TRIGGER_SELECTOR = "[data-dcu-settings-trigger]";
|
|
48
|
+
const SETTINGS_CODEX_PAGE_SELECTOR = "[data-dcu-settings-page]";
|
|
49
|
+
const SETTINGS_OPEN_SECTION_EVENT = "dcu-settings-open-section";
|
|
50
|
+
function parseChannelSettingsRequest(value) {
|
|
51
|
+
if (!value || typeof value !== "object") return undefined;
|
|
52
|
+
const channelId = typeof value.channelId === "string" ? value.channelId.trim() : "";
|
|
53
|
+
if (!channelId) return undefined;
|
|
54
|
+
return { channelId, name: typeof value.name === "string" ? value.name : "" };
|
|
55
|
+
}
|
|
56
|
+
function writeChannelSettingsRequest(storage, request) {
|
|
57
|
+
try { storage && storage.setItem(CHANNEL_SETTINGS_STORAGE_KEY, JSON.stringify(request)); } catch { /* ignore */ }
|
|
58
|
+
}
|
|
59
|
+
function requestChannelSettings(request) {
|
|
60
|
+
if (typeof window === "undefined") return;
|
|
61
|
+
writeChannelSettingsRequest(window.sessionStorage, request);
|
|
62
|
+
window.dispatchEvent(new CustomEvent(CHANNEL_SETTINGS_EVENT, { detail: request }));
|
|
63
|
+
}
|
|
64
|
+
function readChannelSettingsRequest(storage) {
|
|
65
|
+
if (!storage) return undefined;
|
|
66
|
+
try {
|
|
67
|
+
const raw = storage.getItem(CHANNEL_SETTINGS_STORAGE_KEY);
|
|
68
|
+
return raw == null ? undefined : parseChannelSettingsRequest(JSON.parse(raw));
|
|
69
|
+
} catch { return undefined; }
|
|
70
|
+
}
|
|
71
|
+
function clearChannelSettingsRequest(storage) {
|
|
72
|
+
try { storage && storage.removeItem(CHANNEL_SETTINGS_STORAGE_KEY); } catch { /* ignore */ }
|
|
73
|
+
}
|
|
74
|
+
function resolveChannelSettingsTarget(request, channels) {
|
|
75
|
+
const parsed = parseChannelSettingsRequest(request);
|
|
76
|
+
if (!parsed || !Array.isArray(channels)) return undefined;
|
|
77
|
+
const channel = channels.find((item) => item && item.id === parsed.channelId);
|
|
78
|
+
if (!channel) return undefined;
|
|
79
|
+
const accounts = channel.accounts || [];
|
|
80
|
+
return { channelId: channel.id, accountId: accounts.length === 1 ? accounts[0].id : undefined };
|
|
81
|
+
}
|
|
82
|
+
function pickSettingsSectionButton(buttons, labels) {
|
|
83
|
+
for (const label of labels) {
|
|
84
|
+
const target = String(label || "").trim();
|
|
85
|
+
if (!target) continue;
|
|
86
|
+
const match = buttons.find((button) => String(button.textContent || "").replace(/\s+/g, " ").trim() === target);
|
|
87
|
+
if (match) return match;
|
|
88
|
+
}
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
function pickSettingsLauncher(buttons) {
|
|
92
|
+
const named = buttons.find((button) => {
|
|
93
|
+
const label = `${button.textContent || ""} ${typeof button.getAttribute === "function" ? button.getAttribute("aria-label") || "" : ""}`.trim();
|
|
94
|
+
return /(^|\s)(设置|settings)(\s|$)/i.test(label);
|
|
95
|
+
});
|
|
96
|
+
return named || (buttons.length === 1 ? buttons[0] : undefined);
|
|
97
|
+
}
|
|
98
|
+
function requestCodexSettingsSection(labels) {
|
|
99
|
+
const trigger = typeof document !== "undefined" && document.querySelector(SETTINGS_CODEX_TRIGGER_SELECTOR);
|
|
100
|
+
if (!trigger) return false;
|
|
101
|
+
const request = new CustomEvent(SETTINGS_OPEN_SECTION_EVENT, { detail: { labels: [...labels] }, cancelable: true });
|
|
102
|
+
return !trigger.dispatchEvent(request);
|
|
103
|
+
}
|
|
104
|
+
function openSettingsSection(labels, onSelected, onMissing) {
|
|
105
|
+
if (typeof document === "undefined" || typeof window === "undefined") {
|
|
106
|
+
if (onMissing) onMissing();
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (requestCodexSettingsSection(labels)) {
|
|
110
|
+
if (onSelected) onSelected();
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const launchers = [...document.querySelectorAll('button[aria-haspopup="dialog"]')];
|
|
114
|
+
const launcher = pickSettingsLauncher(launchers);
|
|
115
|
+
const pageTrigger = document.querySelector(SETTINGS_CODEX_TRIGGER_SELECTOR);
|
|
116
|
+
const dialogOpen = document.querySelector('[role="dialog"]') !== null;
|
|
117
|
+
const pageOpen = document.querySelector(SETTINGS_CODEX_PAGE_SELECTOR) !== null;
|
|
118
|
+
if (!dialogOpen && !pageOpen && !launcher && !pageTrigger) {
|
|
119
|
+
if (onMissing) onMissing();
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (!dialogOpen && !pageOpen) (pageTrigger || launcher).click();
|
|
123
|
+
let frame;
|
|
124
|
+
let finished = false;
|
|
125
|
+
const observer = new MutationObserver(() => { schedule(); });
|
|
126
|
+
const cleanup = () => {
|
|
127
|
+
if (finished) return;
|
|
128
|
+
finished = true;
|
|
129
|
+
observer.disconnect();
|
|
130
|
+
window.clearTimeout(timeout);
|
|
131
|
+
if (frame !== undefined) window.cancelAnimationFrame(frame);
|
|
132
|
+
};
|
|
133
|
+
const select = () => {
|
|
134
|
+
const buttons = [
|
|
135
|
+
...document.querySelectorAll('[role="dialog"] nav button'),
|
|
136
|
+
...document.querySelectorAll(SETTINGS_CODEX_PAGE_SELECTOR + " nav button"),
|
|
137
|
+
];
|
|
138
|
+
const target = pickSettingsSectionButton(buttons, labels);
|
|
139
|
+
if (!target) return false;
|
|
140
|
+
cleanup();
|
|
141
|
+
target.click();
|
|
142
|
+
if (onSelected) onSelected();
|
|
143
|
+
return true;
|
|
144
|
+
};
|
|
145
|
+
const schedule = () => {
|
|
146
|
+
if (finished || frame !== undefined) return;
|
|
147
|
+
frame = window.requestAnimationFrame(() => { frame = undefined; select(); });
|
|
148
|
+
};
|
|
149
|
+
const timeout = window.setTimeout(() => {
|
|
150
|
+
if (select()) return;
|
|
151
|
+
cleanup();
|
|
152
|
+
if (onMissing) onMissing();
|
|
153
|
+
}, 1500);
|
|
154
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
155
|
+
schedule();
|
|
156
|
+
}
|
|
13
157
|
const EMPTY_EXTRA_TABS = [];
|
|
14
158
|
const inject = ["slots", "sessions", "workspaces", "locale"];
|
|
15
159
|
const API_BASE = "/api/dsh-im-connect";
|
|
@@ -64,8 +208,9 @@ window.__ModuleLoader__.load({
|
|
|
64
208
|
"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
209
|
"composer.aria": "全局会话配置", "composer.project": "选择项目", "composer.projectAria": "项目", "composer.noWorkspaces": "暂无工作区", "composer.addWorkspace": "添加工作区…", "composer.permission": "权限", "composer.noModels": "暂无模型", "composer.workspacePath": "工作区路径", "action.cancel": "取消", "action.adding": "添加中…",
|
|
66
210
|
"permission.readOnly": "只读", "permission.workspaceWrite": "工作区写入", "permission.fullAccess": "完全访问",
|
|
67
|
-
"rail.workspace": "工作区", "rail.search": "搜索", "rail.searchPlaceholder": "搜索会话...", "rail.clearSearch": "清除搜索", "rail.filter": "筛选", "rail.group": "分组方式", "rail.byWorkspace": "按工作区", "rail.list": "单列表", "rail.sort": "排序方式", "rail.manual": "手动排序", "rail.recent": "最近更新", "rail.running": "运行中", "rail.idle": "空闲", "rail.renameAria": "重命名会话", "rail.rename": "重命名", "rail.fork": "分叉会话", "rail.archive": "归档会话", "rail.archiveFailed": "归档失败,未移除会话。请稍后重试或检查宿主日志。", "rail.empty": "还没有频道会话。先在设置 → IM助理 里连接渠道,并给机器人发一条消息。", "rail.noTasks": "暂无网页任务", "rail.ungrouped": "未分组", "rail.tabsAria": "工作区分类", "rail.tasks": "任务", "rail.channels": "频道",
|
|
68
|
-
"time.now": "刚刚", "time.minutes": "{
|
|
211
|
+
"rail.workspace": "工作区", "rail.search": "搜索", "rail.searchPlaceholder": "搜索会话...", "rail.clearSearch": "清除搜索", "rail.filter": "筛选", "rail.group": "分组方式", "rail.byWorkspace": "按工作区", "rail.list": "单列表", "rail.sort": "排序方式", "rail.manual": "手动排序", "rail.recent": "最近更新", "rail.running": "运行中", "rail.idle": "空闲", "rail.renameAria": "重命名会话", "rail.rename": "重命名", "rail.fork": "分叉会话", "rail.archive": "归档会话", "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": "频道",
|
|
212
|
+
"time.now": "刚刚", "time.minutes": "{n}分钟", "time.hours": "{n}小时", "time.days": "{n}天", "time.months": "{n}个月", "time.years": "{n}年", "time.ago": "{t}前",
|
|
213
|
+
"copy": "复制", "hover.copied": "已复制",
|
|
69
214
|
"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
215
|
"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
216
|
},
|
|
@@ -90,8 +235,9 @@ window.__ModuleLoader__.load({
|
|
|
90
235
|
"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
236
|
"composer.aria": "Global session settings", "composer.project": "Select project", "composer.projectAria": "Project", "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
237
|
"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.sort": "Sort by", "rail.manual": "Manual", "rail.recent": "Recently updated", "rail.running": "Running", "rail.idle": "Idle", "rail.renameAria": "Rename session", "rail.rename": "Rename", "rail.fork": "Fork session", "rail.archive": "Archive session", "rail.archiveFailed": "Archive failed. The session was kept. Retry or check the Host logs.", "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",
|
|
94
|
-
"time.now": "
|
|
238
|
+
"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.sort": "Sort by", "rail.manual": "Manual", "rail.recent": "Recently updated", "rail.running": "Running", "rail.idle": "Idle", "rail.renameAria": "Rename session", "rail.rename": "Rename", "rail.fork": "Fork session", "rail.archive": "Archive session", "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",
|
|
239
|
+
"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",
|
|
240
|
+
"copy": "Copy", "hover.copied": "Copied",
|
|
95
241
|
"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
242
|
"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
243
|
},
|
|
@@ -172,7 +318,7 @@ window.__ModuleLoader__.load({
|
|
|
172
318
|
.ima-error{color:var(--ima-danger);font-size:12px;margin:0 0 12px}
|
|
173
319
|
.ima-pending{margin:0 0 14px;padding:10px 12px;border:1px solid rgba(210,153,34,.35);border-radius:12px}
|
|
174
320
|
.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
|
|
321
|
+
.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
322
|
.ima-tabs{display:flex;gap:18px;padding:4px 12px 0;border-bottom:1px solid var(--ima-line)}
|
|
177
323
|
.ima-tab{appearance:none;border:0;background:transparent;color:var(--ima-muted);padding:8px 0;font-size:13px;cursor:pointer}
|
|
178
324
|
.ima-tab.on{color:var(--ima-text);box-shadow:inset 0 -2px 0 currentColor}
|
|
@@ -415,12 +561,133 @@ window.__ModuleLoader__.load({
|
|
|
415
561
|
return translated === key ? t("qr.default") : translated;
|
|
416
562
|
}
|
|
417
563
|
|
|
564
|
+
// 有 reflect 时只 probe,不能硬读未注入的官方导航服务,否则 Cordis 会挡住插件激活。
|
|
565
|
+
function probeService(ctx, name) {
|
|
566
|
+
if (!ctx) return undefined;
|
|
567
|
+
const reflect = ctx.reflect;
|
|
568
|
+
if (reflect && typeof reflect.get === "function") {
|
|
569
|
+
try {
|
|
570
|
+
const found = reflect.get(name);
|
|
571
|
+
if (found !== undefined) return found;
|
|
572
|
+
} catch { /* 未注入时不硬读 ctx[name],改走 get */ }
|
|
573
|
+
}
|
|
574
|
+
if (typeof ctx.get === "function") {
|
|
575
|
+
try {
|
|
576
|
+
const found = ctx.get(name);
|
|
577
|
+
if (found !== undefined) return found;
|
|
578
|
+
} catch { return undefined; }
|
|
579
|
+
}
|
|
580
|
+
if (reflect && typeof reflect.get === "function") return undefined;
|
|
581
|
+
try { return ctx[name]; } catch { return undefined; }
|
|
582
|
+
}
|
|
583
|
+
// 旧宿主读 list.current;alpha.2 主视图改由 retainedBy.mainView 标记。
|
|
584
|
+
function currentSessionId(state) {
|
|
585
|
+
if (!state) return null;
|
|
586
|
+
if (typeof state.current === "string" && state.current) return state.current;
|
|
587
|
+
const byId = state.byId || {};
|
|
588
|
+
const ids = Array.isArray(state.ids) && state.ids.length ? state.ids : Object.keys(byId);
|
|
589
|
+
const pick = (id, row) => {
|
|
590
|
+
if (!row || !row.retainedBy || (row.retainedBy.mainView ?? 0) <= 0) return null;
|
|
591
|
+
const explicit = row.id && String(row.id).trim();
|
|
592
|
+
return explicit || id;
|
|
593
|
+
};
|
|
594
|
+
for (let i = 0; i < ids.length; i++) {
|
|
595
|
+
const found = pick(ids[i], byId[ids[i]]);
|
|
596
|
+
if (found) return found;
|
|
597
|
+
}
|
|
598
|
+
for (const id in byId) {
|
|
599
|
+
if (ids.indexOf(id) !== -1) continue;
|
|
600
|
+
const found = pick(id, byId[id]);
|
|
601
|
+
if (found) return found;
|
|
602
|
+
}
|
|
603
|
+
return null;
|
|
604
|
+
}
|
|
605
|
+
function resolveHostSessionId(sessionId, sessionById) {
|
|
606
|
+
if (!sessionId) return sessionId;
|
|
607
|
+
const listed = sessionById && sessionById[sessionId];
|
|
608
|
+
const fromKey = listed && (listed.id || listed.sessionId);
|
|
609
|
+
if (fromKey && String(fromKey).trim()) return String(fromKey).trim();
|
|
610
|
+
return sessionId;
|
|
611
|
+
}
|
|
612
|
+
function isCurrentListedSession(selectedId, sessionId, sessionById) {
|
|
613
|
+
if (!selectedId || !sessionId) return false;
|
|
614
|
+
if (selectedId === sessionId) return true;
|
|
615
|
+
const listed = sessionById && sessionById[sessionId];
|
|
616
|
+
if (listed && (listed.id === selectedId || listed.sessionId === selectedId)) return true;
|
|
617
|
+
const selected = sessionById && sessionById[selectedId];
|
|
618
|
+
if (selected && (selected.id === sessionId || selected.sessionId === sessionId)) return true;
|
|
619
|
+
return false;
|
|
620
|
+
}
|
|
621
|
+
function openHostSession(ctx, id) {
|
|
622
|
+
if (!id) return false;
|
|
623
|
+
const uiWorkspace = probeService(ctx, "uiWorkspace");
|
|
624
|
+
if (uiWorkspace && typeof uiWorkspace.openSession === "function") {
|
|
625
|
+
uiWorkspace.openSession(id);
|
|
626
|
+
return true;
|
|
627
|
+
}
|
|
628
|
+
// alpha.2 有 retain:旧的 sessions.open 即使还在也不会写入 mainView,点了等于没打开。
|
|
629
|
+
if (ctx.sessions && typeof ctx.sessions.retain === "function") return false;
|
|
630
|
+
if (ctx.sessions && typeof ctx.sessions.open === "function") {
|
|
631
|
+
ctx.sessions.open(id);
|
|
632
|
+
return true;
|
|
633
|
+
}
|
|
634
|
+
return false;
|
|
635
|
+
}
|
|
636
|
+
function pickHostDirectory(ctx) {
|
|
637
|
+
const uiWorkspace = probeService(ctx, "uiWorkspace");
|
|
638
|
+
if (uiWorkspace && typeof uiWorkspace.pickDirectory === "function") return uiWorkspace.pickDirectory();
|
|
639
|
+
if (ctx.workspaces && typeof ctx.workspaces.pickDirectory === "function") return ctx.workspaces.pickDirectory();
|
|
640
|
+
}
|
|
641
|
+
function archiveHostSession(ctx, id) {
|
|
642
|
+
const uiWorkspace = probeService(ctx, "uiWorkspace");
|
|
643
|
+
if (uiWorkspace && typeof uiWorkspace.archiveSession === "function") return uiWorkspace.archiveSession(id);
|
|
644
|
+
if (ctx.workspaces && typeof ctx.workspaces.archiveSession === "function") return ctx.workspaces.archiveSession(id);
|
|
645
|
+
}
|
|
646
|
+
function forkHostSession(ctx, id) {
|
|
647
|
+
const uiWorkspace = probeService(ctx, "uiWorkspace");
|
|
648
|
+
if (uiWorkspace && typeof uiWorkspace.forkSession === "function") return Promise.resolve(uiWorkspace.forkSession(id));
|
|
649
|
+
if (!ctx.sessions || typeof ctx.sessions.fork !== "function") return Promise.resolve();
|
|
650
|
+
return ctx.sessions.fork({ sessionId: id, increaseTitle: true })
|
|
651
|
+
.then((childId) => { openHostSession(ctx, childId); })
|
|
652
|
+
.catch(() => undefined);
|
|
653
|
+
}
|
|
654
|
+
async function renameHostSession(ctx, sessionId, title) {
|
|
655
|
+
const sessions = ctx.sessions;
|
|
656
|
+
if (!sessions) throw new Error("unknown session");
|
|
657
|
+
const renameBound = async (session) => {
|
|
658
|
+
if (!session || typeof session.rename !== "function") throw new Error("unknown session");
|
|
659
|
+
const result = await session.rename(title);
|
|
660
|
+
if (result && result.ok === false) throw new Error((result.error && result.error.message) || "rename failed");
|
|
661
|
+
};
|
|
662
|
+
if (typeof sessions.using === "function") {
|
|
663
|
+
return sessions.using(sessionId, { source: "controllerOperation" }, async (reference) => {
|
|
664
|
+
if (reference && reference.ready) await reference.ready;
|
|
665
|
+
return renameBound(reference && reference.binding && reference.binding.session);
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
const existing = sessions.binding && sessions.binding(sessionId);
|
|
669
|
+
if (existing && existing.session) return renameBound(existing.session);
|
|
670
|
+
if (typeof sessions.retain !== "function") throw new Error("unknown session");
|
|
671
|
+
const ref = sessions.retain(sessionId, { source: "controllerOperation" });
|
|
672
|
+
try {
|
|
673
|
+
if (ref && ref.ready) await ref.ready;
|
|
674
|
+
return renameBound(ref && ref.binding && ref.binding.session);
|
|
675
|
+
} finally {
|
|
676
|
+
if (ref && typeof ref.release === "function") ref.release();
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
|
|
418
680
|
let openImSession = (id) => {
|
|
419
681
|
try {
|
|
420
682
|
if (window.__dshSessionsOpen) { window.__dshSessionsOpen(id); return true; }
|
|
421
683
|
} catch { /* ignore */ }
|
|
422
684
|
return false;
|
|
423
685
|
};
|
|
686
|
+
const tryOpenListedSession = (id, hostOpen) => {
|
|
687
|
+
if (openImSession(id)) return true;
|
|
688
|
+
if (typeof hostOpen !== "function") return false;
|
|
689
|
+
try { hostOpen(id); return true; } catch { return false; }
|
|
690
|
+
};
|
|
424
691
|
const openListedSession = (id, hostOpen) => {
|
|
425
692
|
if (!id) return;
|
|
426
693
|
if (isChannelSession(id)) {
|
|
@@ -438,8 +705,7 @@ window.__ModuleLoader__.load({
|
|
|
438
705
|
}).catch((error) => console.warn("[dsh-im-connect] 无法恢复会话", id, error));
|
|
439
706
|
return;
|
|
440
707
|
}
|
|
441
|
-
|
|
442
|
-
else openImSession(id);
|
|
708
|
+
tryOpenListedSession(id, hostOpen);
|
|
443
709
|
};
|
|
444
710
|
let channelSkin = "native";
|
|
445
711
|
|
|
@@ -1178,6 +1444,7 @@ window.__ModuleLoader__.load({
|
|
|
1178
1444
|
const [selected, setSelected] = useState(storedAccountSelection);
|
|
1179
1445
|
const [settingsAccount, setSettingsAccount] = useState(null);
|
|
1180
1446
|
const [expanded, setExpanded] = useState({ weixin: true });
|
|
1447
|
+
const [channelSettingsRequest, setChannelSettingsRequest] = useState(() => typeof window !== "undefined" ? readChannelSettingsRequest(window.sessionStorage) : undefined);
|
|
1181
1448
|
const [catalog, setCatalog] = useState({ providers: [], permissions: [], assistant: null, cwd: "", permission: "" });
|
|
1182
1449
|
const workspaces = props.useWorkspaces ? (props.useWorkspaces((state) => state && state.items || []) || []) : [];
|
|
1183
1450
|
const refreshSeq = useRef(0);
|
|
@@ -1213,6 +1480,31 @@ window.__ModuleLoader__.load({
|
|
|
1213
1480
|
}).catch(() => undefined);
|
|
1214
1481
|
}, [refresh]);
|
|
1215
1482
|
useEffect(() => { const timer = setInterval(refresh, 4000); return () => clearInterval(timer); }, [refresh]);
|
|
1483
|
+
useEffect(() => {
|
|
1484
|
+
if (typeof window === "undefined") return undefined;
|
|
1485
|
+
const onRequest = (event) => {
|
|
1486
|
+
const request = parseChannelSettingsRequest(event.detail);
|
|
1487
|
+
if (request) setChannelSettingsRequest(request);
|
|
1488
|
+
};
|
|
1489
|
+
window.addEventListener(CHANNEL_SETTINGS_EVENT, onRequest);
|
|
1490
|
+
return () => window.removeEventListener(CHANNEL_SETTINGS_EVENT, onRequest);
|
|
1491
|
+
}, []);
|
|
1492
|
+
useEffect(() => {
|
|
1493
|
+
if (!channelSettingsRequest || channels == null) return;
|
|
1494
|
+
const target = resolveChannelSettingsTarget(channelSettingsRequest, channels);
|
|
1495
|
+
clearChannelSettingsRequest(typeof window !== "undefined" ? window.sessionStorage : undefined);
|
|
1496
|
+
setChannelSettingsRequest(undefined);
|
|
1497
|
+
if (!target) return;
|
|
1498
|
+
setExpanded((current) => Object.assign({}, current, { [target.channelId]: true }));
|
|
1499
|
+
if (target.accountId) {
|
|
1500
|
+
selectAccount(target.accountId);
|
|
1501
|
+
setSettingsAccount(target.accountId);
|
|
1502
|
+
}
|
|
1503
|
+
if (typeof document !== "undefined") {
|
|
1504
|
+
const node = document.querySelector('[data-ima-platform="' + target.channelId + '"]');
|
|
1505
|
+
if (node && typeof node.scrollIntoView === "function") node.scrollIntoView({ block: "nearest" });
|
|
1506
|
+
}
|
|
1507
|
+
}, [channelSettingsRequest, channels, selectAccount]);
|
|
1216
1508
|
|
|
1217
1509
|
const onAction = (id, action, body) => {
|
|
1218
1510
|
const removalFallback = action === "remove"
|
|
@@ -1272,7 +1564,7 @@ window.__ModuleLoader__.load({
|
|
|
1272
1564
|
const canExpand = (ch.accounts || []).length > 0;
|
|
1273
1565
|
const open = canExpand && Boolean(expanded[ch.id]);
|
|
1274
1566
|
const toggleExpanded = canExpand ? () => setExpanded({ ...expanded, [ch.id]: !open }) : undefined;
|
|
1275
|
-
return h("div", { key: ch.id, className: "ima-platform" + (open ? " open" : "") + (canExpand ? "" : " empty") },
|
|
1567
|
+
return h("div", { key: ch.id, className: "ima-platform" + (open ? " open" : "") + (canExpand ? "" : " empty"), "data-ima-platform": ch.id },
|
|
1276
1568
|
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
1569
|
h(Logo, { id: ch.id }),
|
|
1278
1570
|
h("span", { className: "ima-platform-title" }, channelLabel(ch, t)),
|
|
@@ -1331,9 +1623,9 @@ window.__ModuleLoader__.load({
|
|
|
1331
1623
|
}),
|
|
1332
1624
|
);
|
|
1333
1625
|
}
|
|
1334
|
-
const WB_CSS = `.dcu-wb,.ima-native{display:flex;flex:1;min-height:0;flex-direction:column;padding:0;padding-right:var(--dsh-
|
|
1626
|
+
const WB_CSS = `.dcu-wb,.ima-native{--dsh-session-list-edge-inset:var(--dsh-sidebar-inline-padding,12px);--dsh-session-list-scrollbar-width:8px;--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{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-head-filter{position:relative}.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-filter-menu{position:absolute;right:0;top:calc(100% + 6px);z-index:30;min-width:196px;padding:8px 6px;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,#1c2128));box-shadow:var(--dsw-shadow-lv3,0 8px 24px rgba(0,0,0,.36))}.ima-n-filter-label{padding:6px 10px 4px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary,#81858C)}.ima-n-filter-split{height:1px;margin:6px 8px;background:var(--dsw-alias-border-l2,rgba(255,255,255,.1))}.ima-n-filter-menu button{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:36px;padding:6px 10px;border:0;border-radius:8px;background:transparent;color:inherit;font:14px/20px inherit;cursor:pointer;text-align:left}.ima-n-filter-menu button:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}.ima-n-filter-tick{width:16px;height:16px;flex: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}
|
|
1335
1627
|
.dcu-wb *,.ima-native *{box-sizing:border-box}
|
|
1336
|
-
.dcu-wb-tree,.ima-native-tree{flex:1;min-height:0
|
|
1628
|
+
.dcu-wb-tree,.ima-native-tree{flex:1;min-height:0}
|
|
1337
1629
|
.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
1630
|
.dcu-wb-project-head,.ima-native-head{height:34px}
|
|
1339
1631
|
.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 +1636,43 @@ window.__ModuleLoader__.load({
|
|
|
1344
1636
|
.dcu-wb-actions,.ima-native-actions{display:none;align-items:center;flex:none}
|
|
1345
1637
|
.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
1638
|
.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:
|
|
1639
|
+
.dcu-wb-empty,.ima-native-empty{padding:16px 12px;color:var(--dsw-alias-label-tertiary,var(--ima-muted));font-size:13px}
|
|
1348
1640
|
.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
1641
|
.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
1642
|
.ima-sess-menu button:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}
|
|
1351
1643
|
.ima-sess-menu button.danger{color:var(--dsw-alias-state-error-primary,var(--ima-danger))}
|
|
1352
1644
|
.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
|
|
1645
|
+
.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
1646
|
.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-
|
|
1647
|
+
.ima-n-sess{height:32px;gap:0;position:relative;appearance:none}
|
|
1648
|
+
.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))}
|
|
1649
|
+
.ima-n-row.has-current-session .ima-n-folder{color:var(--dsw-alias-state-business-primary,#4c8dff)}
|
|
1650
|
+
.ima-n-chevron{display:none;color:var(--dsw-alias-label-caption,#ADB2B8)}
|
|
1651
|
+
.ima-n-row:hover .ima-n-chevron{display:inline-flex}
|
|
1652
|
+
.ima-n-row:hover .ima-n-folder{display:none}
|
|
1653
|
+
.ima-n-arrow{transition:transform .15s var(--ds-ease-in-out,ease)}
|
|
1654
|
+
.ima-n-arrow.is-open{transform:rotate(90deg)}
|
|
1655
|
+
.ima-n-project-text{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}
|
|
1656
|
+
.ima-n-row .ima-n-acts{height:20px}
|
|
1657
|
+
.ima-n-sess.is-flat-idle .ima-n-title{margin-left:0}
|
|
1658
|
+
.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)}
|
|
1659
|
+
.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)}.ima-run-dot{flex:none;color:var(--dsw-static-deepseek-450,#4c8dff)}.ima-run-dot-cell{fill:currentColor;opacity:.15;animation:ima-run-chase 1s infinite}@keyframes ima-run-chase{0%,12.4%{opacity:1}12.5%,24.9%{opacity:.6}25%,37.4%{opacity:.35}37.5%,100%{opacity:.15}}
|
|
1358
1660
|
.ima-n-folder{color:var(--dsw-alias-label-secondary,#9ca39f)}
|
|
1359
1661
|
.ima-n-lead{color:var(--dsw-alias-label-tertiary,#81858C)}
|
|
1360
1662
|
.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
|
|
1663
|
+
.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))}
|
|
1664
|
+
.ima-n-hover-content{display:flex;flex-direction:column;gap:8px;min-width:0}
|
|
1665
|
+
.ima-n-hover-title{color:#fff;font-size:14px;line-height:20px;font-weight:400;overflow-wrap:break-word}
|
|
1666
|
+
.ima-n-hover-time{margin:0;color:#cfd3d6;font-size:12px;line-height:16px}
|
|
1667
|
+
.ima-n-hover-state{display:flex;align-items:center;gap:8px;margin:0;font-size:12px;line-height:20px;color:#adb2b8}
|
|
1668
|
+
.ima-n-hover-dot{width:10px;height:10px;border-radius:50%;background:var(--dsw-alias-state-success-primary,#34c759);flex:none;position:relative}
|
|
1669
|
+
.ima-n-hover-dot.is-run{background:var(--dsw-static-deepseek-450,#4c8dff)}
|
|
1367
1670
|
.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
1671
|
.ima-n-sess .ima-n-title{margin:0 6px 0 4px}
|
|
1369
|
-
.ima-n-time{flex:none;font-size:12px;line-height:20px;color:var(--dsw-alias-label-tertiary,#81858C)}
|
|
1672
|
+
.ima-n-time{flex:none;font-size:12px;line-height:20px;color:var(--dsw-alias-label-tertiary,#81858C);white-space:nowrap}
|
|
1370
1673
|
.ima-n-acts{flex:none;display:none;align-items:center;gap:12px}
|
|
1371
|
-
.ima-n-row:hover .ima-n-acts,.ima-n-sess:hover .ima-n-acts,.ima-n-row.menu-on .ima-n-acts,.ima-n-sess.menu-on .ima-n-acts{display:inline-flex}
|
|
1372
|
-
.ima-n-sess:hover .ima-n-time,.ima-n-sess.menu-on .ima-n-time{display:none}
|
|
1674
|
+
.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}
|
|
1675
|
+
.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
1676
|
.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
1677
|
.ima-n-ico:hover{color:var(--dsw-alias-label-primary,var(--ima-text))}
|
|
1375
1678
|
.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 +1681,14 @@ window.__ModuleLoader__.load({
|
|
|
1378
1681
|
.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
1682
|
.ima-n-menu button.danger{color:var(--dsw-alias-state-error-primary,#f85149)}
|
|
1380
1683
|
.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))}
|
|
1684
|
+
.ima-n-menu button.danger:hover{background:var(--dsw-alias-interactive-bg-hover-danger,rgba(248,81,73,.12))}
|
|
1685
|
+
.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}
|
|
1686
|
+
.ima-n-dialog-actions{display:flex;justify-content:flex-end;gap:8px}
|
|
1687
|
+
.ima-n-dialog-copy{margin:0;color:var(--dsw-alias-label-secondary);font-size:14px;line-height:22px}
|
|
1688
|
+
.ima-n-dialog-status{margin-top:12px;color:var(--dsw-alias-label-secondary);font-size:13px;line-height:20px}
|
|
1689
|
+
.ima-n-dialog-error{margin-top:12px;color:var(--dsw-alias-state-error-primary,#f85149);font-size:13px;line-height:20px}
|
|
1690
|
+
.ima-n-danger-button{color:var(--dsw-alias-state-error-primary,#f85149)!important}
|
|
1691
|
+
.ima-n-danger-button:hover{background:var(--dsw-alias-interactive-bg-hover-danger,rgba(248,81,73,.12))!important}`;
|
|
1382
1692
|
|
|
1383
1693
|
function NativeSvg(viewBox, size, children) {
|
|
1384
1694
|
return h("svg", { viewBox, width: size, height: size, fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true" }, children);
|
|
@@ -1386,37 +1696,6 @@ window.__ModuleLoader__.load({
|
|
|
1386
1696
|
function NativePath(d, extra) {
|
|
1387
1697
|
return h("path", Object.assign({ d, fill: "currentColor" }, extra || {}));
|
|
1388
1698
|
}
|
|
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
1699
|
function IconChevron() {
|
|
1421
1700
|
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
1701
|
}
|
|
@@ -1486,18 +1765,35 @@ window.__ModuleLoader__.load({
|
|
|
1486
1765
|
NativePath("M0 0L-0.5 0L-0.5 7L0 7L0.5 7L0.5 0L0 0ZM3 10L3 10.5L8 10.5L8 10L8 9.5L3 9.5L3 10ZM0 7L-0.5 7C-0.5 8.933 1.067 10.5 3 10.5L3 10L3 9.5C1.61929 9.5 0.5 8.38071 0.5 7L0 7Z"),
|
|
1487
1766
|
);
|
|
1488
1767
|
}
|
|
1489
|
-
function
|
|
1490
|
-
return h(
|
|
1768
|
+
function ChannelSettingsIcon() {
|
|
1769
|
+
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"));
|
|
1770
|
+
}
|
|
1771
|
+
function SessionHoverStatusDot({ running }) {
|
|
1772
|
+
if (typeof StateDot === "function") return h(StateDot, { state: running ? "ongoing" : "done" });
|
|
1773
|
+
return h("span", { className: running ? "ima-n-hover-dot is-run" : "ima-n-hover-dot" });
|
|
1774
|
+
}
|
|
1775
|
+
function SessionHoverContent({ title, time, running, t = fallbackT }) {
|
|
1776
|
+
return h("div", { className: "ima-n-hover-content" },
|
|
1491
1777
|
h("div", { className: "ima-n-hover-title" }, title),
|
|
1492
1778
|
time ? h("div", { className: "ima-n-hover-time" }, time) : null,
|
|
1493
1779
|
h("div", { className: "ima-n-hover-state" },
|
|
1494
|
-
h(
|
|
1780
|
+
h(SessionHoverStatusDot, { running }),
|
|
1495
1781
|
running ? t("rail.running") : t("rail.idle"),
|
|
1496
1782
|
),
|
|
1497
1783
|
);
|
|
1498
1784
|
}
|
|
1499
|
-
function
|
|
1500
|
-
return h(
|
|
1785
|
+
function SessionHoverCard({ title, time, running, style, cardRef, onMouseEnter, onMouseLeave, t = fallbackT }) {
|
|
1786
|
+
return h("div", { className: "ima-n-hover", style, ref: cardRef, onMouseEnter, onMouseLeave },
|
|
1787
|
+
h(SessionHoverContent, { title, time, running, t }),
|
|
1788
|
+
);
|
|
1789
|
+
}
|
|
1790
|
+
function nativeSessionHoverStyle(row, card, viewport) {
|
|
1791
|
+
const pad = 8;
|
|
1792
|
+
const left = row.right + pad;
|
|
1793
|
+
const top = row.top + card.height > viewport.height - pad
|
|
1794
|
+
? Math.max(pad, viewport.height - card.height - pad)
|
|
1795
|
+
: Math.max(pad, row.top);
|
|
1796
|
+
return { position: "fixed", zIndex: 4100, left: Math.round(left) + "px", top: Math.round(top) + "px" };
|
|
1501
1797
|
}
|
|
1502
1798
|
const RUN_CELLS = [[0,0],[4,0],[8,0],[8,4],[8,8],[4,8],[0,8],[0,4]];
|
|
1503
1799
|
function RunningStateDot() {
|
|
@@ -1507,61 +1803,37 @@ window.__ModuleLoader__.load({
|
|
|
1507
1803
|
})
|
|
1508
1804
|
);
|
|
1509
1805
|
}
|
|
1510
|
-
function
|
|
1806
|
+
function relativeTimeParts(value, now) {
|
|
1511
1807
|
const ts = Date.parse(value || "");
|
|
1512
|
-
if (!Number.isFinite(ts)) return
|
|
1513
|
-
const
|
|
1514
|
-
const
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
if (
|
|
1519
|
-
return
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
const
|
|
1526
|
-
return
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
const vh = window.innerHeight || height + pad * 2;
|
|
1535
|
-
return {
|
|
1536
|
-
x: Math.max(pad, Math.min(x, Math.max(pad, vw - width - pad))),
|
|
1537
|
-
y: Math.max(pad, Math.min(y, Math.max(pad, vh - height - pad))),
|
|
1538
|
-
};
|
|
1808
|
+
if (!Number.isFinite(ts)) return null;
|
|
1809
|
+
const MIN = 6e4;
|
|
1810
|
+
const HOUR = 36e5;
|
|
1811
|
+
const DAY = 864e5;
|
|
1812
|
+
const diff = Math.max(0, (now || Date.now()) - ts);
|
|
1813
|
+
if (diff < MIN) return { unit: "now", n: 0 };
|
|
1814
|
+
if (diff < HOUR) return { unit: "minutes", n: Math.floor(diff / MIN) };
|
|
1815
|
+
if (diff < DAY) return { unit: "hours", n: Math.floor(diff / HOUR) };
|
|
1816
|
+
if (diff < 30 * DAY) return { unit: "days", n: Math.floor(diff / DAY) };
|
|
1817
|
+
if (diff < 365 * DAY) return { unit: "months", n: Math.floor(diff / (30 * DAY)) };
|
|
1818
|
+
return { unit: "years", n: Math.floor(diff / (365 * DAY)) };
|
|
1819
|
+
}
|
|
1820
|
+
function timeLabel(value, t = fallbackT, now) {
|
|
1821
|
+
const parts = relativeTimeParts(value, now);
|
|
1822
|
+
if (!parts) return "";
|
|
1823
|
+
return parts.unit === "now" ? t("time.now") : t("time." + parts.unit, { n: parts.n, count: parts.n });
|
|
1824
|
+
}
|
|
1825
|
+
function hoverTimeLabel(value, t = fallbackT, now) {
|
|
1826
|
+
const parts = relativeTimeParts(value, now);
|
|
1827
|
+
if (!parts) return "";
|
|
1828
|
+
if (parts.unit === "now") return t("time.now");
|
|
1829
|
+
return t("time.ago", { t: t("time." + parts.unit, { n: parts.n, count: parts.n }) });
|
|
1539
1830
|
}
|
|
1540
|
-
function
|
|
1541
|
-
|
|
1542
|
-
const [pos, setPos] = useState(() => clampMenuPoint(x, y, native ? 218 : 132, native ? 176 : 140));
|
|
1543
|
-
useLayoutEffect(() => {
|
|
1544
|
-
const el = ref.current;
|
|
1545
|
-
if (!el) return;
|
|
1546
|
-
const rect = el.getBoundingClientRect();
|
|
1547
|
-
setPos(clampMenuPoint(x, y, rect.width, rect.height));
|
|
1548
|
-
}, [x, y]);
|
|
1549
|
-
const node = h("div", {
|
|
1550
|
-
ref,
|
|
1551
|
-
className: native ? "ima-n-menu" : "ima-sess-menu",
|
|
1552
|
-
"data-ima-session-menu": "",
|
|
1553
|
-
style: { left: pos.x + "px", top: pos.y + "px" },
|
|
1554
|
-
onClick: (event) => event.stopPropagation(),
|
|
1555
|
-
}, items.map((item) => h("button", {
|
|
1556
|
-
key: item.id,
|
|
1557
|
-
type: "button",
|
|
1558
|
-
className: item.danger ? "danger" : undefined,
|
|
1559
|
-
onClick: () => onPick(item),
|
|
1560
|
-
}, native && h("span", { className: "ima-n-mi" }, item.icon), item.label)));
|
|
1561
|
-
return ReactDOM.createPortal(node, document.body);
|
|
1831
|
+
function relativeTime(value, t = fallbackT) {
|
|
1832
|
+
return timeLabel(value, t);
|
|
1562
1833
|
}
|
|
1563
1834
|
|
|
1564
|
-
|
|
1835
|
+
|
|
1836
|
+
function ChannelSessionRow({ sess, selected, onOpen, onChanged, skin, sessionActions, sessionById, menuOpen, onMenuChange, canDelete, onDeleteSession, flat }) {
|
|
1565
1837
|
const t = arguments[0].t || fallbackT;
|
|
1566
1838
|
const menu = !!menuOpen;
|
|
1567
1839
|
const setMenu = (next) => onMenuChange(!!next);
|
|
@@ -1574,7 +1846,9 @@ window.__ModuleLoader__.load({
|
|
|
1574
1846
|
const [hoverStyle, setHoverStyle] = useState({});
|
|
1575
1847
|
const title = sess.title || sess.chatId;
|
|
1576
1848
|
const native = skin !== "codex";
|
|
1849
|
+
const useOfficialHover = native && typeof HoverCard === "function";
|
|
1577
1850
|
const running = !!(sess.running || (sessionById && sessionById[sess.sessionId] && sessionById[sess.sessionId].running));
|
|
1851
|
+
const hoverTitle = (sessionById && sessionById[sess.sessionId] && (sessionById[sess.sessionId].displayTitle || sessionById[sess.sessionId].title)) || title;
|
|
1578
1852
|
const showHover = () => {
|
|
1579
1853
|
if (menu || !native) return;
|
|
1580
1854
|
if (hoverTimer.current) window.clearTimeout(hoverTimer.current);
|
|
@@ -1586,15 +1860,27 @@ window.__ModuleLoader__.load({
|
|
|
1586
1860
|
};
|
|
1587
1861
|
useLayoutEffect(() => {
|
|
1588
1862
|
if (!hoverOpen || menu || !rowRef.current) return;
|
|
1589
|
-
const row = rowRef.current.getBoundingClientRect();
|
|
1590
1863
|
const card = hoverRef.current;
|
|
1591
|
-
const
|
|
1592
|
-
const
|
|
1593
|
-
|
|
1864
|
+
const size = card ? { width: card.offsetWidth || 220, height: card.offsetHeight || 96 } : { width: 220, height: 96 };
|
|
1865
|
+
const update = () => {
|
|
1866
|
+
if (!rowRef.current) return;
|
|
1867
|
+
setHoverStyle(nativeSessionHoverStyle(rowRef.current.getBoundingClientRect(), {
|
|
1868
|
+
width: (hoverRef.current && hoverRef.current.offsetWidth) || size.width,
|
|
1869
|
+
height: (hoverRef.current && hoverRef.current.offsetHeight) || size.height,
|
|
1870
|
+
}, { width: window.innerWidth, height: window.innerHeight }));
|
|
1871
|
+
};
|
|
1872
|
+
update();
|
|
1873
|
+
window.addEventListener("resize", update);
|
|
1874
|
+
document.addEventListener("scroll", update, true);
|
|
1875
|
+
return () => {
|
|
1876
|
+
window.removeEventListener("resize", update);
|
|
1877
|
+
document.removeEventListener("scroll", update, true);
|
|
1878
|
+
};
|
|
1594
1879
|
}, [hoverOpen, menu, title, running]);
|
|
1595
1880
|
useEffect(() => () => { if (hoverTimer.current) window.clearTimeout(hoverTimer.current); }, []);
|
|
1881
|
+
const omitStatusSlot = native && !!flat && !running;
|
|
1596
1882
|
const rowClass = native
|
|
1597
|
-
? ("ima-
|
|
1883
|
+
? ("ima-n-sess" + (selected ? " is-on" : "") + (menu ? " is-menu" : "") + (omitStatusSlot ? " is-flat-idle" : ""))
|
|
1598
1884
|
: ("dcu-wb-session" + (selected ? " dcu-wb-selected" : "") + (menu ? " dcu-wb-menu-open" : ""));
|
|
1599
1885
|
const syncList = (groups) => { if (groups) onChanged(groups); };
|
|
1600
1886
|
const run = (action, extra) => {
|
|
@@ -1647,9 +1933,9 @@ window.__ModuleLoader__.load({
|
|
|
1647
1933
|
}).then((data) => { if (data.ok) syncList(data.groups); }).catch(() => undefined);
|
|
1648
1934
|
};
|
|
1649
1935
|
if (renaming) {
|
|
1650
|
-
return h("div", { className: rowClass },
|
|
1936
|
+
return h("div", { className: rowClass, ref: rowRef },
|
|
1651
1937
|
h("input", {
|
|
1652
|
-
className: "ima-rename",
|
|
1938
|
+
className: native ? "ima-n-rename" : "ima-rename",
|
|
1653
1939
|
value: draft,
|
|
1654
1940
|
autoFocus: true,
|
|
1655
1941
|
"aria-label": t("rail.renameAria"),
|
|
@@ -1664,50 +1950,116 @@ window.__ModuleLoader__.load({
|
|
|
1664
1950
|
);
|
|
1665
1951
|
}
|
|
1666
1952
|
const menuItems = [
|
|
1667
|
-
{ id: "rename", label: t("rail.rename"), icon: h(
|
|
1668
|
-
{ id: "fork", label: t("rail.fork"), icon: h(
|
|
1669
|
-
{ id: "archive", label: t("rail.archive"), icon: h(
|
|
1953
|
+
{ id: "rename", label: t("rail.rename"), icon: h(IconEditOutline16) },
|
|
1954
|
+
{ id: "fork", label: t("rail.fork"), icon: h(IconBranchOutline16) },
|
|
1955
|
+
{ id: "archive", label: t("rail.archive"), icon: h(IconArchiveOutline20, { size: 16 }) },
|
|
1956
|
+
...(canDelete ? [{ id: "delete-session", label: t("rail.deleteSession"), icon: h(IconTrashOutline16), danger: true }] : []),
|
|
1670
1957
|
];
|
|
1671
|
-
|
|
1958
|
+
const row = h("div", {
|
|
1672
1959
|
ref: rowRef,
|
|
1673
|
-
className:
|
|
1960
|
+
className: rowClass,
|
|
1674
1961
|
role: "treeitem",
|
|
1675
1962
|
tabIndex: 0,
|
|
1676
1963
|
"aria-selected": selected,
|
|
1964
|
+
"data-n-menu-root": sess.sessionId,
|
|
1677
1965
|
onClick: () => { setMenu(false); hideHover(); onOpen(sess.sessionId); },
|
|
1678
|
-
onMouseEnter: showHover,
|
|
1679
|
-
onMouseLeave: hideHover,
|
|
1966
|
+
onMouseEnter: useOfficialHover ? undefined : showHover,
|
|
1967
|
+
onMouseLeave: useOfficialHover ? undefined : hideHover,
|
|
1680
1968
|
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
|
|
1969
|
+
onContextMenu: (e) => { e.preventDefault(); e.stopPropagation(); hideHover(); onMenuChange(true); },
|
|
1682
1970
|
},
|
|
1683
|
-
native && h("span", { className: "ima-n-slot" }, running ? h(RunningStateDot) : null),
|
|
1971
|
+
native && !omitStatusSlot && h("span", { className: "ima-n-slot" }, running ? h(RunningStateDot) : null),
|
|
1684
1972
|
h("span", { className: native ? "ima-n-title" : "dcu-wb-session-title" }, title),
|
|
1685
|
-
native && h("span", { className: "ima-n-time" },
|
|
1973
|
+
native && h("span", { className: "ima-n-time" }, timeLabel(sess.updatedAt, t)),
|
|
1686
1974
|
h("span", { className: native ? "ima-n-acts" : "dcu-wb-actions" },
|
|
1687
|
-
h(
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1975
|
+
h(Menu, {
|
|
1976
|
+
open: menu,
|
|
1977
|
+
onClose: () => onMenuChange(false),
|
|
1978
|
+
items: menuItems,
|
|
1979
|
+
onSelect: (action) => {
|
|
1980
|
+
onMenuChange(false);
|
|
1981
|
+
if (action === "rename") setRenaming(true);
|
|
1982
|
+
if (action === "fork") run("fork");
|
|
1983
|
+
if (action === "archive") run("archive");
|
|
1984
|
+
if (action === "delete-session") onDeleteSession && onDeleteSession();
|
|
1985
|
+
},
|
|
1986
|
+
portal: true,
|
|
1987
|
+
closeOnPointerLeave: true,
|
|
1988
|
+
anchor: h("button", {
|
|
1989
|
+
type: "button",
|
|
1990
|
+
className: native ? "ima-n-ico" : "dcu-wb-more",
|
|
1991
|
+
"data-ima-session-more": "",
|
|
1992
|
+
"aria-expanded": menu,
|
|
1993
|
+
"aria-label": t("action.more", { channel: title }),
|
|
1994
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
1995
|
+
onClick: (e) => { e.stopPropagation(); hideHover(); onMenuChange(!menu); },
|
|
1996
|
+
}, h(IconEllipsisOutline16, { size: 16 })),
|
|
1997
|
+
}),
|
|
1695
1998
|
),
|
|
1696
|
-
hoverOpen && !menu && native && h(SessionHoverCard, {
|
|
1697
|
-
title,
|
|
1698
|
-
time:
|
|
1999
|
+
!useOfficialHover && hoverOpen && !menu && native && typeof document !== "undefined" && ReactDOM.createPortal(h(SessionHoverCard, {
|
|
2000
|
+
title: hoverTitle,
|
|
2001
|
+
time: hoverTimeLabel(sess.updatedAt, t),
|
|
1699
2002
|
running,
|
|
1700
2003
|
t,
|
|
1701
2004
|
style: hoverStyle,
|
|
1702
2005
|
cardRef: hoverRef,
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
2006
|
+
onMouseEnter: showHover,
|
|
2007
|
+
onMouseLeave: hideHover,
|
|
2008
|
+
}), document.body),
|
|
2009
|
+
);
|
|
2010
|
+
if (useOfficialHover) {
|
|
2011
|
+
return h(HoverCard, {
|
|
2012
|
+
anchor: row,
|
|
2013
|
+
content: h(SessionHoverContent, { title: hoverTitle, time: hoverTimeLabel(sess.updatedAt, t), running, t }),
|
|
2014
|
+
disabled: menu,
|
|
2015
|
+
copyText: title,
|
|
2016
|
+
copyLabel: t("copy"),
|
|
2017
|
+
copiedLabel: t("hover.copied"),
|
|
2018
|
+
});
|
|
2019
|
+
}
|
|
2020
|
+
return row;
|
|
2021
|
+
}
|
|
2022
|
+
|
|
2023
|
+
function ChannelGroupRow({ id, name, expanded, hasCurrentSession, menuOpen, canArchiveGroup, onToggle, onMenuChange, onChannelSettings, onArchiveGroup, t = fallbackT }) {
|
|
2024
|
+
const items = [
|
|
2025
|
+
{ id: "channel-settings", label: t("rail.channelSettings"), icon: h(ChannelSettingsIcon) },
|
|
2026
|
+
...(canArchiveGroup ? [
|
|
2027
|
+
{ type: "separator", id: "archive-separator" },
|
|
2028
|
+
{ id: "archive-group", label: t("rail.archiveGroup"), icon: h(IconArchiveOutline20, { size: 16 }), danger: true },
|
|
2029
|
+
] : []),
|
|
2030
|
+
];
|
|
2031
|
+
const rowClass = "ima-n-row" + (hasCurrentSession ? " has-current-session" : "") + (menuOpen ? " is-menu" : "");
|
|
2032
|
+
return h("div", {
|
|
2033
|
+
className: rowClass,
|
|
2034
|
+
role: "treeitem",
|
|
2035
|
+
"aria-expanded": expanded,
|
|
2036
|
+
"data-n-group": id,
|
|
2037
|
+
onClick: onToggle,
|
|
2038
|
+
},
|
|
2039
|
+
h("span", { className: "ima-n-slot ima-n-folder" }, h(Logo, { id, small: true })),
|
|
2040
|
+
h("span", { className: "ima-n-slot ima-n-chevron" }, h("span", { className: expanded ? "ima-n-arrow is-open" : "ima-n-arrow" }, h(IconChevron))),
|
|
2041
|
+
h("span", { className: "ima-n-project-text" }, h("span", { className: "ima-n-title" }, name)),
|
|
2042
|
+
h("span", { className: "ima-n-acts" },
|
|
2043
|
+
h(Menu, {
|
|
2044
|
+
open: menuOpen,
|
|
2045
|
+
onClose: () => onMenuChange(false),
|
|
2046
|
+
items,
|
|
2047
|
+
onSelect: (action) => {
|
|
2048
|
+
onMenuChange(false);
|
|
2049
|
+
if (action === "channel-settings") onChannelSettings && onChannelSettings();
|
|
2050
|
+
if (action === "archive-group") onArchiveGroup && onArchiveGroup();
|
|
2051
|
+
},
|
|
2052
|
+
portal: true,
|
|
2053
|
+
closeOnPointerLeave: true,
|
|
2054
|
+
anchor: h("button", {
|
|
2055
|
+
type: "button",
|
|
2056
|
+
className: "ima-n-ico",
|
|
2057
|
+
"aria-label": t("rail.groupActions", { name }),
|
|
2058
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
2059
|
+
onClick: (e) => { e.stopPropagation(); onMenuChange(!menuOpen); },
|
|
2060
|
+
}, h(IconEllipsisOutline16, { size: 16 })),
|
|
2061
|
+
}),
|
|
2062
|
+
),
|
|
1711
2063
|
);
|
|
1712
2064
|
}
|
|
1713
2065
|
|
|
@@ -1718,7 +2070,7 @@ window.__ModuleLoader__.load({
|
|
|
1718
2070
|
|
|
1719
2071
|
function ChannelRailWithSessions(props) {
|
|
1720
2072
|
const selectedId = typeof props.useSessions === "function"
|
|
1721
|
-
? props.useSessions((state) => (state
|
|
2073
|
+
? props.useSessions((state) => currentSessionId(state))
|
|
1722
2074
|
: (props.selectedId || null);
|
|
1723
2075
|
const archivedIds = typeof props.useWorkspaces === "function"
|
|
1724
2076
|
? props.useWorkspaces((state) => (state && state.archivedSessionIds) || [])
|
|
@@ -1738,15 +2090,25 @@ window.__ModuleLoader__.load({
|
|
|
1738
2090
|
const [groups, setGroups] = useState([]);
|
|
1739
2091
|
const [folded, setFolded] = useState({});
|
|
1740
2092
|
const [error, setError] = useState("");
|
|
1741
|
-
const [openMenu, setOpenMenu] = useState(
|
|
2093
|
+
const [openMenu, setOpenMenu] = useState();
|
|
2094
|
+
const [openGroupMenu, setOpenGroupMenu] = useState();
|
|
1742
2095
|
const [query, setQuery] = useState("");
|
|
1743
2096
|
const [sort, setSort] = useState("time");
|
|
1744
2097
|
const [groupMode, setGroupMode] = useState("workspace");
|
|
2098
|
+
const [archiveManagerInstalled, setArchiveManagerInstalled] = useState(() => typeof document !== "undefined" && hasArchiveManagerPlugin(document));
|
|
2099
|
+
const [deleteTarget, setDeleteTarget] = useState();
|
|
2100
|
+
const [deleteBusy, setDeleteBusy] = useState(false);
|
|
2101
|
+
const [deleteError, setDeleteError] = useState();
|
|
2102
|
+
const [archiveGroupTarget, setArchiveGroupTarget] = useState();
|
|
2103
|
+
const [archiveGroupBusy, setArchiveGroupBusy] = useState(false);
|
|
2104
|
+
const [archiveGroupError, setArchiveGroupError] = useState();
|
|
1745
2105
|
const selectedId = props.selectedId;
|
|
1746
2106
|
const archived = new Set(props.archivedIds || []);
|
|
1747
2107
|
const skin = props.skin || channelSkin;
|
|
1748
2108
|
const native = skin !== "codex";
|
|
1749
|
-
const open = (id) => openListedSession(id, props.openSession || props.open);
|
|
2109
|
+
const open = (id) => openListedSession(resolveHostSessionId(id, props.sessionById), props.openSession || props.open);
|
|
2110
|
+
const canDelete = canDeleteChannelSession(archiveManagerInstalled, props.deleteSession);
|
|
2111
|
+
const canArchiveGroup = canArchiveChannelGroup(archiveManagerInstalled, props.archiveSession);
|
|
1750
2112
|
useEffect(() => {
|
|
1751
2113
|
ensureStyle();
|
|
1752
2114
|
const load = () => api("/channels").then((data) => {
|
|
@@ -1758,22 +2120,39 @@ window.__ModuleLoader__.load({
|
|
|
1758
2120
|
return () => clearInterval(timer);
|
|
1759
2121
|
}, []);
|
|
1760
2122
|
useEffect(() => {
|
|
1761
|
-
if (
|
|
1762
|
-
const
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
2123
|
+
if (typeof document === "undefined" || typeof MutationObserver === "undefined") return undefined;
|
|
2124
|
+
const refresh = () => { setArchiveManagerInstalled(hasArchiveManagerPlugin(document)); };
|
|
2125
|
+
refresh();
|
|
2126
|
+
const observer = new MutationObserver(refresh);
|
|
2127
|
+
observer.observe(document.documentElement, { childList: true, subtree: true });
|
|
2128
|
+
return () => observer.disconnect();
|
|
2129
|
+
}, []);
|
|
2130
|
+
const confirmDelete = () => {
|
|
2131
|
+
if (!deleteTarget || typeof props.deleteSession !== "function" || deleteBusy) return;
|
|
2132
|
+
const target = deleteTarget;
|
|
2133
|
+
setDeleteBusy(true);
|
|
2134
|
+
setDeleteError(undefined);
|
|
2135
|
+
Promise.resolve(props.deleteSession(target.id))
|
|
2136
|
+
.then(() => api("/sessions/remove", {
|
|
2137
|
+
method: "POST",
|
|
2138
|
+
headers: { "content-type": "application/json" },
|
|
2139
|
+
body: JSON.stringify({ sessionId: target.id }),
|
|
2140
|
+
}).then((data) => { if (data.ok && data.groups) setGroups(data.groups); }).catch(() => undefined))
|
|
2141
|
+
.then(() => { setDeleteTarget(undefined); })
|
|
2142
|
+
.catch((caught) => { setDeleteError(caught instanceof Error ? caught.message : t("error.action")); })
|
|
2143
|
+
.finally(() => { setDeleteBusy(false); });
|
|
2144
|
+
};
|
|
2145
|
+
const confirmArchiveGroup = () => {
|
|
2146
|
+
if (!archiveGroupTarget || typeof props.archiveSession !== "function" || archiveGroupBusy) return;
|
|
2147
|
+
const target = archiveGroupTarget;
|
|
2148
|
+
setArchiveGroupBusy(true);
|
|
2149
|
+
setArchiveGroupError(undefined);
|
|
2150
|
+
archiveChannelGroup(target.sessionIds, props.archiveSession)
|
|
2151
|
+
.then(() => api("/channels").then((data) => { if (data.ok) setGroups(data.groups || []); }).catch(() => undefined))
|
|
2152
|
+
.then(() => { setArchiveGroupTarget(undefined); })
|
|
2153
|
+
.catch((caught) => { setArchiveGroupError(caught instanceof Error ? caught.message : t("error.action")); })
|
|
2154
|
+
.finally(() => { setArchiveGroupBusy(false); });
|
|
2155
|
+
};
|
|
1777
2156
|
const needle = query.trim().toLowerCase();
|
|
1778
2157
|
const visibleGroups = groups.map((g) => {
|
|
1779
2158
|
const sessions = (g.sessions || []).map((sess) => {
|
|
@@ -1802,43 +2181,73 @@ window.__ModuleLoader__.load({
|
|
|
1802
2181
|
return h("div", { className: native ? "ima-native ima-rail" : "dcu-wb ima-rail" },
|
|
1803
2182
|
h("style", null, WB_CSS),
|
|
1804
2183
|
h(ChannelWorkspaceHead, { query, sort, groupMode, onQuery: setQuery, onSort: setSort, onGroupMode: setGroupMode, t }),
|
|
2184
|
+
h("div", { className: native ? "ima-n-list-area" : "dcu-wb-list-area" },
|
|
1805
2185
|
h("div", { className: native ? "ima-native-tree" : "dcu-wb-tree", role: "tree" },
|
|
1806
2186
|
error && h("div", { className: native ? "ima-native-empty" : "dcu-wb-empty" }, error),
|
|
1807
2187
|
!error && visibleGroups.length === 0 && h("div", { className: native ? "ima-native-empty" : "dcu-wb-empty" }, t("rail.empty")),
|
|
1808
2188
|
...visibleGroups.map((g) => {
|
|
1809
2189
|
const visible = g.sessions || [];
|
|
1810
2190
|
const expanded = !folded[g.id];
|
|
2191
|
+
const hasCurrentSession = typeof selectedId === "string" && visible.some((sess) => isCurrentListedSession(selectedId, sess.sessionId, props.sessionById));
|
|
1811
2192
|
return h("div", { key: g.id, className: native ? "ima-native-project" : "dcu-wb-project" },
|
|
1812
|
-
groupMode !== "list" &&
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
2193
|
+
groupMode !== "list" && (native
|
|
2194
|
+
? h(ChannelGroupRow, {
|
|
2195
|
+
id: g.id,
|
|
2196
|
+
name: channelLabel(g, t),
|
|
2197
|
+
expanded,
|
|
2198
|
+
hasCurrentSession,
|
|
2199
|
+
menuOpen: openGroupMenu === g.id,
|
|
2200
|
+
canArchiveGroup,
|
|
2201
|
+
onToggle: () => setFolded({ ...folded, [g.id]: !folded[g.id] }),
|
|
2202
|
+
onMenuChange: (next) => {
|
|
2203
|
+
setOpenMenu(undefined);
|
|
2204
|
+
setOpenGroupMenu(next ? g.id : undefined);
|
|
2205
|
+
},
|
|
2206
|
+
onChannelSettings: () => {
|
|
2207
|
+
if (typeof props.openChannelSettings === "function") props.openChannelSettings({ channelId: g.id, name: channelLabel(g, t) });
|
|
2208
|
+
},
|
|
2209
|
+
onArchiveGroup: () => {
|
|
2210
|
+
setArchiveGroupError(undefined);
|
|
2211
|
+
setArchiveGroupTarget({
|
|
2212
|
+
id: g.id,
|
|
2213
|
+
name: channelLabel(g, t),
|
|
2214
|
+
sessionIds: visible.map((sess) => sess.sessionId),
|
|
2215
|
+
});
|
|
2216
|
+
},
|
|
2217
|
+
t,
|
|
2218
|
+
})
|
|
2219
|
+
: h("button", {
|
|
2220
|
+
className: "dcu-wb-project-head",
|
|
2221
|
+
type: "button",
|
|
2222
|
+
role: "treeitem",
|
|
2223
|
+
"aria-expanded": expanded,
|
|
2224
|
+
onClick: () => setFolded({ ...folded, [g.id]: !folded[g.id] }),
|
|
2225
|
+
},
|
|
2226
|
+
h("span", { className: "dcu-wb-folder" }, h(Logo, { id: g.id, small: true })),
|
|
2227
|
+
h("span", { className: "dcu-wb-project-title" }, channelLabel(g, t)),
|
|
2228
|
+
)
|
|
1828
2229
|
),
|
|
1829
2230
|
(groupMode === "list" || !folded[g.id]) && visible.length > 0 && visible.map((sess) => h(ChannelSessionRow, {
|
|
1830
2231
|
key: sess.sessionId,
|
|
1831
2232
|
sess,
|
|
1832
|
-
|
|
2233
|
+
flat: groupMode === "list",
|
|
2234
|
+
selected: isCurrentListedSession(selectedId, sess.sessionId, props.sessionById),
|
|
1833
2235
|
sessionById: props.sessionById,
|
|
1834
|
-
menuOpen: openMenu
|
|
1835
|
-
onMenuChange: (
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
}
|
|
1840
|
-
onOpen: open,
|
|
2236
|
+
menuOpen: openMenu === sess.sessionId,
|
|
2237
|
+
onMenuChange: (next) => {
|
|
2238
|
+
setOpenGroupMenu(undefined);
|
|
2239
|
+
setOpenMenu(next ? sess.sessionId : undefined);
|
|
2240
|
+
},
|
|
2241
|
+
onOpen: (id) => { setOpenMenu(undefined); open(id); },
|
|
1841
2242
|
onChanged: (next) => setGroups(next),
|
|
2243
|
+
canDelete,
|
|
2244
|
+
onDeleteSession: () => {
|
|
2245
|
+
setDeleteError(undefined);
|
|
2246
|
+
setDeleteTarget({
|
|
2247
|
+
id: sess.sessionId,
|
|
2248
|
+
title: String((props.sessionById && props.sessionById[sess.sessionId] && (props.sessionById[sess.sessionId].displayTitle || props.sessionById[sess.sessionId].title)) || sess.title || sess.chatId || sess.sessionId),
|
|
2249
|
+
});
|
|
2250
|
+
},
|
|
1842
2251
|
skin,
|
|
1843
2252
|
sessionActions: {
|
|
1844
2253
|
renameSession: props.renameSession,
|
|
@@ -1852,6 +2261,35 @@ window.__ModuleLoader__.load({
|
|
|
1852
2261
|
);
|
|
1853
2262
|
}),
|
|
1854
2263
|
),
|
|
2264
|
+
),
|
|
2265
|
+
h(Modal, {
|
|
2266
|
+
open: !!archiveGroupTarget,
|
|
2267
|
+
onClose: () => { if (!archiveGroupBusy) { setArchiveGroupTarget(undefined); setArchiveGroupError(undefined); } },
|
|
2268
|
+
closeLabel: t("rail.archiveGroupClose"),
|
|
2269
|
+
title: t("rail.archiveGroup"),
|
|
2270
|
+
footer: h("div", { className: "ima-n-dialog-actions" },
|
|
2271
|
+
h(Button, { variant: "outline", disabled: archiveGroupBusy, onClick: () => { setArchiveGroupTarget(undefined); setArchiveGroupError(undefined); } }, t("rail.archiveGroupCancel")),
|
|
2272
|
+
h(Button, { variant: "outline", className: "ima-n-danger-button", disabled: archiveGroupBusy, onClick: confirmArchiveGroup }, t("rail.archiveGroupConfirm")),
|
|
2273
|
+
),
|
|
2274
|
+
},
|
|
2275
|
+
h("p", { className: "ima-n-dialog-copy" }, archiveGroupTarget ? t("rail.archiveGroupDescription", { name: archiveGroupTarget.name, count: archiveGroupTarget.sessionIds.length }) : ""),
|
|
2276
|
+
archiveGroupBusy && h("div", { className: "ima-n-dialog-status", role: "status" }, t("rail.archiveGroupPending")),
|
|
2277
|
+
archiveGroupError && h("div", { className: "ima-n-dialog-error", role: "alert" }, t("rail.archiveGroupFailed", { message: archiveGroupError })),
|
|
2278
|
+
),
|
|
2279
|
+
h(Modal, {
|
|
2280
|
+
open: !!deleteTarget,
|
|
2281
|
+
onClose: () => { if (!deleteBusy) { setDeleteTarget(undefined); setDeleteError(undefined); } },
|
|
2282
|
+
closeLabel: t("rail.deleteSessionClose"),
|
|
2283
|
+
title: t("rail.deleteSession"),
|
|
2284
|
+
footer: h("div", { className: "ima-n-dialog-actions" },
|
|
2285
|
+
h(Button, { variant: "outline", disabled: deleteBusy, onClick: () => { setDeleteTarget(undefined); setDeleteError(undefined); } }, t("rail.deleteSessionCancel")),
|
|
2286
|
+
h(Button, { variant: "outline", className: "ima-n-danger-button", disabled: deleteBusy, onClick: confirmDelete }, t("rail.deleteSessionConfirm")),
|
|
2287
|
+
),
|
|
2288
|
+
},
|
|
2289
|
+
h("p", { className: "ima-n-dialog-copy" }, deleteTarget ? t("rail.deleteSessionDescription", { name: deleteTarget.title }) : ""),
|
|
2290
|
+
deleteBusy && h("div", { className: "ima-n-dialog-status", role: "status" }, t("rail.deleteSessionPending")),
|
|
2291
|
+
deleteError && h("div", { className: "ima-n-dialog-error", role: "alert" }, t("rail.deleteSessionFailed", { message: deleteError })),
|
|
2292
|
+
),
|
|
1855
2293
|
);
|
|
1856
2294
|
}
|
|
1857
2295
|
|
|
@@ -1890,7 +2328,7 @@ window.__ModuleLoader__.load({
|
|
|
1890
2328
|
.map((id) => snap.byId[id])
|
|
1891
2329
|
.filter((item) => item && !assigned.has(item.id) && isTaskSessionItem(item) && !archived.has(item.id));
|
|
1892
2330
|
if (ungrouped.length) groups.push({ id: "", label: t("rail.ungrouped"), sessions: ungrouped });
|
|
1893
|
-
return h(TaskListView, { groups, current: snap
|
|
2331
|
+
return h(TaskListView, { groups, current: currentSessionId(snap), openSession: props.openSession, t });
|
|
1894
2332
|
}
|
|
1895
2333
|
|
|
1896
2334
|
function TaskListView({ groups, current, openSession, t = fallbackT }) {
|
|
@@ -2024,9 +2462,11 @@ window.__ModuleLoader__.load({
|
|
|
2024
2462
|
const [tab, setTab] = useState(() => {
|
|
2025
2463
|
try { return localStorage.getItem(TAB_KEY) || "tasks"; } catch { return "tasks"; }
|
|
2026
2464
|
});
|
|
2027
|
-
const
|
|
2028
|
-
? rawUseSessions((state) =>
|
|
2029
|
-
:
|
|
2465
|
+
const sessionSnap = typeof rawUseSessions === "function"
|
|
2466
|
+
? rawUseSessions((state) => state)
|
|
2467
|
+
: undefined;
|
|
2468
|
+
const currentId = sessionSnap ? currentSessionId(sessionSnap) : (props.selectedId || null);
|
|
2469
|
+
const sessionById = (sessionSnap && sessionSnap.byId) || {};
|
|
2030
2470
|
const useTaskSessions = useCallback((selector, eq) => {
|
|
2031
2471
|
if (typeof rawUseSessions !== "function") return selector({ ids: [], byId: {}, current: null });
|
|
2032
2472
|
return rawUseSessions((state) => selector(applyRegistryFilters(filterTaskSessions(state), nativeTabs)), eq);
|
|
@@ -2053,8 +2493,10 @@ window.__ModuleLoader__.load({
|
|
|
2053
2493
|
const matched = extraTabs.find((item) => item.matchSession && item.matchSession(currentId));
|
|
2054
2494
|
if (matched && matched.id !== "schedule") setTab(matched.id);
|
|
2055
2495
|
}, [currentId, extraTabs, membershipRevision]);
|
|
2056
|
-
const openSession = (id) =>
|
|
2057
|
-
|
|
2496
|
+
const openSession = (id) => {
|
|
2497
|
+
openListedSession(resolveHostSessionId(id, sessionById), props.openSession || props.open);
|
|
2498
|
+
};
|
|
2499
|
+
const officialProps = Object.assign({}, props, { useSessions: useTaskSessions, t: officialT, openSession, open: openSession });
|
|
2058
2500
|
const channelRail = h(ChannelRail, {
|
|
2059
2501
|
openSession,
|
|
2060
2502
|
open: openSession,
|
|
@@ -2067,6 +2509,7 @@ window.__ModuleLoader__.load({
|
|
|
2067
2509
|
deleteSession: props.deleteSession,
|
|
2068
2510
|
forkSession: props.forkSession,
|
|
2069
2511
|
openPath: props.openPath,
|
|
2512
|
+
openChannelSettings: props.openChannelSettings,
|
|
2070
2513
|
t,
|
|
2071
2514
|
});
|
|
2072
2515
|
if (props.wide === false) return Official ? h(Official, officialProps) : null;
|
|
@@ -2163,20 +2606,32 @@ window.__ModuleLoader__.load({
|
|
|
2163
2606
|
const modelT = ctx.locale.bind("model");
|
|
2164
2607
|
const subscribeLocale = (listener) => ctx.locale.subscribe(listener);
|
|
2165
2608
|
const localeSnapshot = () => ctx.locale.getSnapshot();
|
|
2609
|
+
const openChannelSettings = (request) => {
|
|
2610
|
+
const next = parseChannelSettingsRequest(request);
|
|
2611
|
+
if (!next) return;
|
|
2612
|
+
requestChannelSettings(next);
|
|
2613
|
+
openSettingsSection(
|
|
2614
|
+
[t("settings.label"), IM_LOCALES.en["settings.label"], IM_LOCALES.zh["settings.label"]],
|
|
2615
|
+
() => { requestChannelSettings(next); },
|
|
2616
|
+
);
|
|
2617
|
+
};
|
|
2166
2618
|
function LocalizedChannelRail(props) {
|
|
2167
2619
|
useSyncExternalStore(subscribeLocale, localeSnapshot, localeSnapshot);
|
|
2168
|
-
return h(ChannelRail, Object.assign({}, props, { t }));
|
|
2620
|
+
return h(ChannelRail, Object.assign({}, props, { t, openChannelSettings }));
|
|
2169
2621
|
}
|
|
2170
2622
|
function LocalizedSessionSwitcher(props) {
|
|
2171
2623
|
useSyncExternalStore(subscribeLocale, localeSnapshot, localeSnapshot);
|
|
2172
|
-
return h(SessionSwitcher, Object.assign({}, props, { t, officialT: props.t }));
|
|
2624
|
+
return h(SessionSwitcher, Object.assign({}, props, { t, officialT: props.t, openChannelSettings }));
|
|
2173
2625
|
}
|
|
2174
2626
|
function LocalizedSettingsPage(props) {
|
|
2175
2627
|
useSyncExternalStore(subscribeLocale, localeSnapshot, localeSnapshot);
|
|
2176
2628
|
return h(SettingsPage, Object.assign({}, props, { t, permissionT, modelT }));
|
|
2177
2629
|
}
|
|
2178
2630
|
openImSession = (id) => {
|
|
2179
|
-
try {
|
|
2631
|
+
try {
|
|
2632
|
+
if (window.__dshSessionsOpen) { window.__dshSessionsOpen(id); return true; }
|
|
2633
|
+
} catch { /* ignore */ }
|
|
2634
|
+
try { return openHostSession(ctx, id); }
|
|
2180
2635
|
catch (error) { console.warn("[dsh-im-connect] 无法打开会话", id, error); return false; }
|
|
2181
2636
|
};
|
|
2182
2637
|
ctx.slots.inject("settings.section", () => ctx.slots.register({
|
|
@@ -2188,7 +2643,7 @@ window.__ModuleLoader__.load({
|
|
|
2188
2643
|
locale: IM_LOCALE_NS,
|
|
2189
2644
|
inject: () => ({
|
|
2190
2645
|
createWorkspace: (input) => ctx.workspaces.create(input),
|
|
2191
|
-
pickDirectory: () => ctx
|
|
2646
|
+
pickDirectory: () => pickHostDirectory(ctx),
|
|
2192
2647
|
permissionT,
|
|
2193
2648
|
modelT,
|
|
2194
2649
|
}),
|
|
@@ -2199,22 +2654,13 @@ window.__ModuleLoader__.load({
|
|
|
2199
2654
|
id: "im-connect-channels",
|
|
2200
2655
|
locale: IM_LOCALE_NS,
|
|
2201
2656
|
inject: () => ({
|
|
2202
|
-
openSession: (id) => { ctx
|
|
2203
|
-
open: (id) => { ctx
|
|
2204
|
-
archiveSession: (id) => ctx
|
|
2205
|
-
forkSession: (id) =>
|
|
2206
|
-
|
|
2207
|
-
.then((childId) => { ctx.sessions.open(childId); })
|
|
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
|
-
},
|
|
2657
|
+
openSession: (id) => { openHostSession(ctx, id); },
|
|
2658
|
+
open: (id) => { openHostSession(ctx, id); },
|
|
2659
|
+
archiveSession: (id) => archiveHostSession(ctx, id),
|
|
2660
|
+
forkSession: (id) => forkHostSession(ctx, id),
|
|
2661
|
+
renameSession: (sessionId, title) => renameHostSession(ctx, sessionId, title),
|
|
2216
2662
|
}),
|
|
2217
|
-
},
|
|
2663
|
+
}, LocalizedChannelRail));
|
|
2218
2664
|
|
|
2219
2665
|
// 只包一层官方任务树,绝不在通知回调里再 register,否则会把启动卡在 Loading plugins。
|
|
2220
2666
|
ctx.slots.inject("sidebar.workspaces", () => {
|
|
@@ -2262,11 +2708,7 @@ window.__ModuleLoader__.load({
|
|
|
2262
2708
|
label: t("rail.channels"),
|
|
2263
2709
|
order: 20,
|
|
2264
2710
|
matchSession: isChannelSession,
|
|
2265
|
-
render: (props) => h(LocalizedChannelRail, Object.assign({}, props, {
|
|
2266
|
-
skin: "native",
|
|
2267
|
-
openSession: (id) => openListedSession(id, props.openSession || props.open),
|
|
2268
|
-
open: (id) => openListedSession(id, props.openSession || props.open),
|
|
2269
|
-
})),
|
|
2711
|
+
render: (props) => h(LocalizedChannelRail, Object.assign({}, props, { skin: "native" })),
|
|
2270
2712
|
});
|
|
2271
2713
|
};
|
|
2272
2714
|
refreshInsertedTab();
|