@lsamien/yaoyao 0.4.76 → 0.4.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -5
- package/THIRD_PARTY_NOTICES.md +8 -0
- package/bin/hermes-yaoyao.mjs +15 -2
- package/build-info.json +35 -3
- package/desktop/main.mjs +12 -4
- package/dist/assets/{AboutDialog-fbm5CG09.js → AboutDialog-jvhTP8-J.js} +2 -2
- package/dist/assets/AboutDialog-jvhTP8-J.js.map +1 -0
- package/dist/assets/BotAutomationsView-ktoci79V.js +2 -0
- package/dist/assets/{BotAutomationsView-DPAAYyuy.js.map → BotAutomationsView-ktoci79V.js.map} +1 -1
- package/dist/assets/{BotPluginsDialog-MwGpwjgu.js → BotPluginsDialog-H85RI-7P.js} +2 -2
- package/dist/assets/{BotPluginsDialog-MwGpwjgu.js.map → BotPluginsDialog-H85RI-7P.js.map} +1 -1
- package/dist/assets/{BotSettingsDialog-DXtsSzi8.js → BotSettingsDialog-Ci_DZL4m.js} +5 -5
- package/dist/assets/{BotSettingsDialog-DXtsSzi8.js.map → BotSettingsDialog-Ci_DZL4m.js.map} +1 -1
- package/dist/assets/ChatView-6cdLMsuy.js +2 -0
- package/dist/assets/ChatView-6cdLMsuy.js.map +1 -0
- package/dist/assets/ChatView-C_7_7olu.css +1 -0
- package/dist/assets/{ComputerPanel-B0QyKQkF.js → ComputerPanel-Dbwgx5n8.js} +2 -2
- package/dist/assets/{ComputerPanel-B0QyKQkF.js.map → ComputerPanel-Dbwgx5n8.js.map} +1 -1
- package/dist/assets/{ComputerViewerView-CaOkTXpc.js → ComputerViewerView-csnhRedK.js} +2 -2
- package/dist/assets/{ComputerViewerView-CaOkTXpc.js.map → ComputerViewerView-csnhRedK.js.map} +1 -1
- package/dist/assets/ConversationsView-CEO2SVGT.js +6 -0
- package/dist/assets/ConversationsView-CEO2SVGT.js.map +1 -0
- package/dist/assets/{ConversationsView-C_VZl5g2.css → ConversationsView-CHLGKsJt.css} +1 -1
- package/dist/assets/FilesView-t5jA-H2-.js +2 -0
- package/dist/assets/{FilesView-CluNyIk8.js.map → FilesView-t5jA-H2-.js.map} +1 -1
- package/dist/assets/FloatingResourceSearch-3GOuDkuO.css +1 -0
- package/dist/assets/FloatingResourceSearch-BAYymuJV.js +9 -0
- package/dist/assets/FloatingResourceSearch-BAYymuJV.js.map +1 -0
- package/dist/assets/HistoryView-BqMSV9iC.js +2 -0
- package/dist/assets/HistoryView-BqMSV9iC.js.map +1 -0
- package/dist/assets/HistoryView-DlVfSP_p.css +1 -0
- package/dist/assets/KanbanView-CWwrwH9S.js +2 -0
- package/dist/assets/{KanbanView-D5AdRwqi.js.map → KanbanView-CWwrwH9S.js.map} +1 -1
- package/dist/assets/{LocalVmSettingsPanel-BILcGHmu.js → LocalVmSettingsPanel-BXvZwFQP.js} +2 -2
- package/dist/assets/{LocalVmSettingsPanel-BILcGHmu.js.map → LocalVmSettingsPanel-BXvZwFQP.js.map} +1 -1
- package/dist/assets/{RunnerSettingsPanel-IHLAFIh8.js → RunnerSettingsPanel-KkpIkkob.js} +2 -2
- package/dist/assets/{RunnerSettingsPanel-IHLAFIh8.js.map → RunnerSettingsPanel-KkpIkkob.js.map} +1 -1
- package/dist/assets/{StandaloneDialog-DdcL_wV2.js → StandaloneDialog-D4BQqjpB.js} +2 -2
- package/dist/assets/{StandaloneDialog-DdcL_wV2.js.map → StandaloneDialog-D4BQqjpB.js.map} +1 -1
- package/dist/assets/{UpdateCheckDialog-CJQezkXo.js → UpdateCheckDialog-Ct0bT6xU.js} +2 -2
- package/dist/assets/{UpdateCheckDialog-CJQezkXo.js.map → UpdateCheckDialog-Ct0bT6xU.js.map} +1 -1
- package/dist/assets/{WorkspaceKnowledgePanel-DS0kOQgg.js → WorkspaceKnowledgePanel-WBcPB49x.js} +2 -2
- package/dist/assets/{WorkspaceKnowledgePanel-DS0kOQgg.js.map → WorkspaceKnowledgePanel-WBcPB49x.js.map} +1 -1
- package/dist/assets/{WorkspaceRoutinesPanel-DpVAtnDX.js → WorkspaceRoutinesPanel-JubUwGsV.js} +2 -2
- package/dist/assets/{WorkspaceRoutinesPanel-DpVAtnDX.js.map → WorkspaceRoutinesPanel-JubUwGsV.js.map} +1 -1
- package/dist/assets/WorkspaceShell-0m4gg6AW.css +1 -0
- package/dist/assets/WorkspaceShell-Do2VAwIz.js +44 -0
- package/dist/assets/WorkspaceShell-Do2VAwIz.js.map +1 -0
- package/dist/assets/{WorkspaceView-Cco3Umfn.js → WorkspaceView-DTanioWW.js} +2 -2
- package/dist/assets/{WorkspaceView-Cco3Umfn.js.map → WorkspaceView-DTanioWW.js.map} +1 -1
- package/dist/assets/{docx-preview-C6qrP-g2.js → docx-preview-B1SjJgD_.js} +2 -2
- package/dist/assets/{docx-preview-C6qrP-g2.js.map → docx-preview-B1SjJgD_.js.map} +1 -1
- package/dist/assets/index-CWamgtSb.js +17 -0
- package/dist/assets/index-CWamgtSb.js.map +1 -0
- package/dist/assets/{pdf-G3DUsfMb.js → pdf-DVDddcFC.js} +2 -2
- package/dist/assets/{pdf-G3DUsfMb.js.map → pdf-DVDddcFC.js.map} +1 -1
- package/dist/assets/sessionOwnership-0hdKcwOs.js +4 -0
- package/dist/assets/sessionOwnership-0hdKcwOs.js.map +1 -0
- package/dist/assets/{sessionOwnership-BTz0Fyp5.css → sessionOwnership-CfO8CfmZ.css} +1 -1
- package/dist/assets/{viewModels-DfaKvI0x.js → viewModels-DKBqaDRg.js} +12 -12
- package/dist/assets/{viewModels-DfaKvI0x.js.map → viewModels-DKBqaDRg.js.map} +1 -1
- package/dist/index.html +1 -1
- package/dist-server/runner/agent.js +15 -4
- package/dist-server/runner/hermes-bots-bridge/README.md +4 -2
- package/dist-server/runner/hermes-bots-bridge/bridge_runtime.py +21 -2
- package/dist-server/runner/hermes-bots-bridge/plugin.yaml +1 -1
- package/dist-server/runner/worker/gateway.js +52 -22
- package/dist-server/runner/worker/profileSession.js +2 -12
- package/dist-server/server/app.js +15 -1
- package/dist-server/server/chatTranscriptApi.js +2 -2
- package/dist-server/server/chatTranscriptStore.js +16 -0
- package/dist-server/server/config.js +3 -0
- package/dist-server/server/credentialVault/broker.js +272 -0
- package/dist-server/server/credentialVault/coordinator.js +297 -0
- package/dist-server/server/credentialVault/executor.js +1 -0
- package/dist-server/server/credentialVault/fixtureWebsiteExecutor.js +51 -0
- package/dist-server/server/credentialVault/index.js +49 -0
- package/dist-server/server/credentialVault/isolation.js +37 -0
- package/dist-server/server/credentialVault/privateFiles.js +17 -0
- package/dist-server/server/credentialVault/protectedExecutor.js +21 -0
- package/dist-server/server/credentialVault/schema.js +45 -0
- package/dist-server/server/credentialVault/sshExecutor.js +135 -0
- package/dist-server/server/credentialVault/store.js +308 -0
- package/dist-server/server/credentialVault/transport.js +127 -0
- package/dist-server/server/credentialVault/websiteExecutor.js +102 -0
- package/dist-server/server/desktopEnvironments.js +2 -2
- package/dist-server/server/hermesRuntimeEnvironment.js +14 -0
- package/dist-server/server/localAuth.js +5 -0
- package/dist-server/server/openVikingMemoryProvider.js +29 -10
- package/dist-server/server/openVikingService.js +44 -14
- package/dist-server/server/openVikingSessionSync.js +148 -37
- package/dist-server/server/pushCoordinator.js +7 -4
- package/dist-server/server/realtimeApi.js +11 -2
- package/dist-server/server/realtimeBroker.js +1 -1
- package/dist-server/server/realtimeReceipts.js +39 -8
- package/dist-server/server/routes.js +18 -0
- package/dist-server/server/runnerHub.js +17 -4
- package/dist-server/server/sessionStop.js +19 -0
- package/dist-server/server/subaccountAccess.js +12 -0
- package/dist-server/server/taskCoordinator.js +3 -1
- package/dist-server/server/unreadCenter.js +61 -0
- package/dist-server/server/uploads.js +4 -1
- package/dist-server/server/workspaceAssets.js +56 -12
- package/dist-server/server/workspaceEnvironment.js +1 -0
- package/dist-server/server/workspaceMemorySynthesis.js +5 -1
- package/dist-server/server/workspacePrompt.js +5 -1
- package/dist-server/server/workspaceRoutes.js +26 -21
- package/dist-server/server/workspaceRuntime.js +89 -8
- package/dist-server/server/workspaceScheduler.js +5 -1
- package/dist-server/server/workspaceStore.js +125 -47
- package/dist-server/server/workspaceSync.js +4 -1
- package/dist-server/shared/botEnvironment.js +3 -3
- package/dist-server/shared/credentialVault.js +2 -0
- package/dist-server/shared/unread.js +6 -0
- package/dist-server/shared/uploadNames.js +14 -0
- package/licenses/libsodium.js/LICENSE +16 -0
- package/licenses/ssh2/LICENSE +19 -0
- package/package.json +8 -5
- package/release.json +3 -3
- package/dist/assets/AboutDialog-fbm5CG09.js.map +0 -1
- package/dist/assets/BotAutomationsView-DPAAYyuy.js +0 -2
- package/dist/assets/ChatView-BNqHa6Ma.js +0 -2
- package/dist/assets/ChatView-BNqHa6Ma.js.map +0 -1
- package/dist/assets/ChatView-Dx8YlcPr.css +0 -1
- package/dist/assets/ConversationsView-CYNc59hv.js +0 -6
- package/dist/assets/ConversationsView-CYNc59hv.js.map +0 -1
- package/dist/assets/FilesView-CluNyIk8.js +0 -2
- package/dist/assets/FloatingResourceSearch-BF2XOLd-.css +0 -1
- package/dist/assets/FloatingResourceSearch-Bg5rUZMy.js +0 -9
- package/dist/assets/FloatingResourceSearch-Bg5rUZMy.js.map +0 -1
- package/dist/assets/HistoryView-DSbSDzsB.js +0 -2
- package/dist/assets/HistoryView-DSbSDzsB.js.map +0 -1
- package/dist/assets/HistoryView-DvuCAjlo.css +0 -1
- package/dist/assets/KanbanView-D5AdRwqi.js +0 -2
- package/dist/assets/WorkspaceShell-7wn8iTne.css +0 -1
- package/dist/assets/WorkspaceShell-Bykfy3AR.js +0 -44
- package/dist/assets/WorkspaceShell-Bykfy3AR.js.map +0 -1
- package/dist/assets/index-CEqMqiJr.js +0 -17
- package/dist/assets/index-CEqMqiJr.js.map +0 -1
- package/dist/assets/sessionOwnership-DMfBRINe.js +0 -6
- package/dist/assets/sessionOwnership-DMfBRINe.js.map +0 -1
|
@@ -7,6 +7,8 @@ import { messageAppendPatch } from '../shared/workspaceMessagePatch.js';
|
|
|
7
7
|
import { z } from 'zod';
|
|
8
8
|
import { HttpError } from './errors.js';
|
|
9
9
|
import { isVisibleMessageFile } from '../shared/messageFiles.js';
|
|
10
|
+
import { normalizeUploadName } from '../shared/uploadNames.js';
|
|
11
|
+
import { isWorkspaceChatReply } from '../shared/unread.js';
|
|
10
12
|
import { notificationPlainText } from './notificationText.js';
|
|
11
13
|
import { readHostTools } from './hostToolSettings.js';
|
|
12
14
|
import { supportsHostEnvironment, deriveComputer } from '../shared/workspace.js';
|
|
@@ -269,7 +271,6 @@ export class WorkspaceStore {
|
|
|
269
271
|
for (const task of this.list(owner, 'conversation-task')) {
|
|
270
272
|
task.unread ??= task.unreadCount > 0;
|
|
271
273
|
task.unreadVersion ??= task.unread ? 1 : 0;
|
|
272
|
-
task.unreadCount = task.unread ? 1 : 0;
|
|
273
274
|
this.put(owner, 'conversation-task', task.id, task);
|
|
274
275
|
}
|
|
275
276
|
for (const conversation of this.list(owner, 'conversation')) {
|
|
@@ -283,6 +284,28 @@ export class WorkspaceStore {
|
|
|
283
284
|
}
|
|
284
285
|
this.db.prepare('INSERT INTO workspace_migrations VALUES(?)').run(migration);
|
|
285
286
|
});
|
|
287
|
+
this.atomic(() => {
|
|
288
|
+
this.db.exec('CREATE TABLE IF NOT EXISTS workspace_chat_reads(owner TEXT NOT NULL,id TEXT NOT NULL,PRIMARY KEY(owner,id))');
|
|
289
|
+
const migration = 'workspace-chat-unread-v2';
|
|
290
|
+
if (this.db.prepare('SELECT id FROM workspace_migrations WHERE id=?').get(migration))
|
|
291
|
+
return;
|
|
292
|
+
for (const owner of this.owners())
|
|
293
|
+
for (const c of this.list(owner, 'conversation')) {
|
|
294
|
+
let version = c.unreadVersion ?? 0;
|
|
295
|
+
for (const m of this.list(owner, 'message').filter(m => m.conversationId === c.id).sort((a, b) => a.seq - b.seq)) {
|
|
296
|
+
if (!isWorkspaceChatReply(m))
|
|
297
|
+
continue;
|
|
298
|
+
m.chatUnreadVersion = ++version;
|
|
299
|
+
const scope = m.conversationTaskId ? this.get(owner, 'conversation-task', m.conversationTaskId) : c;
|
|
300
|
+
if (!scope?.unread || m.seq < scope.readSeq || m.seq === scope.readSeq && m.seq !== scope.lastSeq)
|
|
301
|
+
this.db.prepare('INSERT OR IGNORE INTO workspace_chat_reads VALUES(?,?)').run(owner, m.id);
|
|
302
|
+
this.put(owner, 'message', m.id, m);
|
|
303
|
+
}
|
|
304
|
+
c.unreadVersion = version;
|
|
305
|
+
this.refreshChatUnread(owner, c);
|
|
306
|
+
}
|
|
307
|
+
this.db.prepare('INSERT INTO workspace_migrations VALUES(?)').run(migration);
|
|
308
|
+
});
|
|
286
309
|
this.atomic(() => {
|
|
287
310
|
const migration = 'host-environment-option-v1';
|
|
288
311
|
if (this.db.prepare('SELECT id FROM workspace_migrations WHERE id=?').get(migration))
|
|
@@ -294,6 +317,49 @@ export class WorkspaceStore {
|
|
|
294
317
|
this.db.prepare('INSERT INTO workspace_migrations VALUES(?)').run(migration);
|
|
295
318
|
});
|
|
296
319
|
}
|
|
320
|
+
chatUnreadMessages(owner, conversationId, taskId) {
|
|
321
|
+
return this.db.prepare(`SELECT e.data FROM workspace_entities e LEFT JOIN workspace_chat_reads r ON r.owner=e.owner AND r.id=e.id
|
|
322
|
+
WHERE e.owner=? AND e.kind='message' AND json_extract(e.data,'$.conversationId')=? AND r.id IS NULL`).all(owner, conversationId)
|
|
323
|
+
.map(row => JSON.parse(String(row.data))).filter(m => (!taskId || m.conversationTaskId === taskId) && isWorkspaceChatReply(m))
|
|
324
|
+
.sort((a, b) => a.seq - b.seq || a.id.localeCompare(b.id));
|
|
325
|
+
}
|
|
326
|
+
refreshChatUnread(owner, c) {
|
|
327
|
+
const messages = this.chatUnreadMessages(owner, c.id);
|
|
328
|
+
c.unreadCount = messages.length;
|
|
329
|
+
c.unread = messages.length > 0;
|
|
330
|
+
this.put(owner, 'conversation', c.id, c);
|
|
331
|
+
if (c.kind === 'group')
|
|
332
|
+
for (const task of this.tasks(owner, c.id)) {
|
|
333
|
+
const pending = messages.filter(m => m.conversationTaskId === task.id);
|
|
334
|
+
task.unreadCount = pending.length;
|
|
335
|
+
task.unread = pending.length > 0;
|
|
336
|
+
task.unreadVersion = Math.max(task.unreadVersion ?? 0, ...pending.map(m => m.chatUnreadVersion ?? 0));
|
|
337
|
+
this.put(owner, 'conversation-task', task.id, task);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
markChatMessagesRead(owner, conversationId, ids) {
|
|
341
|
+
return this.atomic(() => {
|
|
342
|
+
const c = this.require(owner, 'conversation', conversationId);
|
|
343
|
+
const selected = new Map(ids.map(m => [m.id, m.version ?? Number.MAX_SAFE_INTEGER]));
|
|
344
|
+
for (const m of this.chatUnreadMessages(owner, c.id)) {
|
|
345
|
+
if (!selected.has(m.id) || (m.chatUnreadVersion ?? 0) > selected.get(m.id))
|
|
346
|
+
continue;
|
|
347
|
+
this.db.prepare('INSERT OR IGNORE INTO workspace_chat_reads VALUES(?,?)').run(owner, m.id);
|
|
348
|
+
c.readSeq = Math.max(c.readSeq, m.seq);
|
|
349
|
+
if (m.conversationTaskId) {
|
|
350
|
+
const task = this.requireTask(owner, c.id, m.conversationTaskId);
|
|
351
|
+
task.readSeq = Math.max(task.readSeq, m.seq);
|
|
352
|
+
this.put(owner, 'conversation-task', task.id, task);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
this.refreshChatUnread(owner, c);
|
|
356
|
+
if (c.kind === 'group')
|
|
357
|
+
for (const task of this.tasks(owner, c.id))
|
|
358
|
+
this.event(owner, 'task.changed', task, c.id);
|
|
359
|
+
this.event(owner, 'conversation.changed', c, c.id);
|
|
360
|
+
return this.conversationSummary(owner, c);
|
|
361
|
+
});
|
|
362
|
+
}
|
|
297
363
|
hasUnreadTask(owner, conversationId) {
|
|
298
364
|
return !!this.db.prepare("SELECT 1 FROM workspace_entities WHERE owner=? AND kind='conversation-task' AND json_extract(data,'$.conversationId')=? AND json_extract(data,'$.unread')=1 LIMIT 1").get(owner, conversationId);
|
|
299
365
|
}
|
|
@@ -431,6 +497,8 @@ export class WorkspaceStore {
|
|
|
431
497
|
if (origin?.createdByAgentId)
|
|
432
498
|
this.require(owner, 'agent', origin.createdByAgentId);
|
|
433
499
|
return this.atomic(() => {
|
|
500
|
+
if (this.get(owner, 'agent-deletion', allocatedId))
|
|
501
|
+
throw new HttpError(409, '已删除的 Bot 编号不能复用', 'agent_deleted');
|
|
434
502
|
if (this.list(owner, 'agent').some((a) => a.name.toLocaleLowerCase() === body.name.toLocaleLowerCase()))
|
|
435
503
|
throw new HttpError(409, '机器人名称已存在', 'duplicate_agent_name');
|
|
436
504
|
const now = Date.now(), id = allocatedId;
|
|
@@ -543,8 +611,8 @@ export class WorkspaceStore {
|
|
|
543
611
|
const hostPermissionChanged = patch.allowHostEnvironment !== undefined && patch.allowHostEnvironment !== (agent.allowHostEnvironment === true);
|
|
544
612
|
const destinationChanged = desktopHostChanged || hostPermissionChanged || (patch.vmExecution !== undefined && patch.vmExecution !== (agent.vmExecution ?? 'worker')) || (patch.computer !== undefined && patch.computer !== agent.computer) || (patch.browserProfile !== undefined && patch.browserProfile !== (agent.browserProfile ?? 'persistent'));
|
|
545
613
|
if (sourceChanged || destinationChanged) {
|
|
546
|
-
if (this.list(owner, 'turn').some(work => work.agentId === id && ['queued', 'running', 'waiting', 'uncertain', 'cancelling'].includes(work.status)))
|
|
547
|
-
throw new HttpError(409, '
|
|
614
|
+
if (this.list(owner, 'turn').some(work => work.agentId === id && (work.cleanupPending || ['queued', 'running', 'waiting', 'uncertain', 'cancelling'].includes(work.status))))
|
|
615
|
+
throw new HttpError(409, '请先确认当前任务停止,再修改机器人来源或电脑', 'agent_execution_busy');
|
|
548
616
|
if (this.list('_system', 'computer-control').some(grant => grant.owner === owner && grant.expiresAt > Date.now() && (grant.agentId === id || grant.environmentId === (agent.computerEnvironmentId ?? id))))
|
|
549
617
|
throw new HttpError(409, '请先交还电脑控制权', 'agent_execution_busy');
|
|
550
618
|
if (sourceChanged && agent.computerEnvironmentId) {
|
|
@@ -557,8 +625,8 @@ export class WorkspaceStore {
|
|
|
557
625
|
throw new HttpError(409, '临时助手由所属任务管理,不能修改权限或恢复为持久成员', 'helper_task_bound');
|
|
558
626
|
if (agent.computerEnvironmentId && patch.execution === 'profile' && (patch.envs?.vm ?? agent.envs?.vm) !== true)
|
|
559
627
|
throw new HttpError(409, '请先解除电脑共享,再切换执行环境', 'shared_computer_active');
|
|
560
|
-
if (patch.execution && patch.execution !== (agent.execution ?? 'profile') && this.list(owner, 'turn').some(work => work.agentId === id && ['running', 'waiting', 'uncertain'].includes(work.status)))
|
|
561
|
-
throw new HttpError(409, '
|
|
628
|
+
if (patch.execution && patch.execution !== (agent.execution ?? 'profile') && this.list(owner, 'turn').some(work => work.agentId === id && (work.cleanupPending || ['running', 'waiting', 'uncertain'].includes(work.status))))
|
|
629
|
+
throw new HttpError(409, '请先确认当前任务停止,再切换执行环境', 'agent_execution_busy');
|
|
562
630
|
if (agent.remoteAgentId && Object.keys(patch).some(key => key !== 'archived' && key !== 'approvalPolicy'))
|
|
563
631
|
throw new HttpError(409, '引用机器人的配置由远端管理', 'remote_agent_read_only');
|
|
564
632
|
if (patch.name &&
|
|
@@ -601,11 +669,17 @@ export class WorkspaceStore {
|
|
|
601
669
|
};
|
|
602
670
|
}
|
|
603
671
|
requireConversationIdle(owner, id) {
|
|
672
|
+
if (this.hasPendingCleanup(owner, { conversationId: id }))
|
|
673
|
+
throw new HttpError(409, '聊天原执行尚未确认停止,请稍后重试', 'conversation_stopping');
|
|
604
674
|
if (['run', 'turn'].some(kind => this.list(owner, kind).some(run => run.conversationId === id && !['complete', 'failed', 'interrupted', 'skipped'].includes(run.status))))
|
|
605
675
|
throw new HttpError(409, '聊天仍有任务未结束,请停止任务后重试', 'conversation_running');
|
|
606
676
|
if (this.list(owner, 'goal').some(goal => (goal.conversationId === id || goal.origin?.conversationId === id) && !['complete', 'blocked', 'cancelled'].includes(goal.status)))
|
|
607
677
|
throw new HttpError(409, '聊天仍有关联任务未结束,请停止任务后重试', 'conversation_running');
|
|
608
678
|
}
|
|
679
|
+
hasPendingCleanup(owner, scope) {
|
|
680
|
+
return this.list(owner, 'turn')
|
|
681
|
+
.some(work => work.cleanupPending && Object.entries(scope).every(([key, value]) => work[key] === value));
|
|
682
|
+
}
|
|
609
683
|
changeConversationLifecycle(owner, id, action, confirmationToken) {
|
|
610
684
|
this.atomic(() => {
|
|
611
685
|
const conversation = this.require(owner, 'conversation', id);
|
|
@@ -627,6 +701,8 @@ export class WorkspaceStore {
|
|
|
627
701
|
throw new HttpError(409, '此 Bot 仍是群聊成员,请确认退出群聊后再归档或删除', 'agent_in_group');
|
|
628
702
|
if (agent?.temporaryGoalId)
|
|
629
703
|
throw new HttpError(409, '临时助手由所属任务管理', 'helper_task_bound');
|
|
704
|
+
if (agent && this.hasPendingCleanup(owner, { agentId: agent.id }))
|
|
705
|
+
throw new HttpError(409, 'Bot 原执行尚未确认停止,请稍后重试', 'agent_stopping');
|
|
630
706
|
if (agent && this.list(owner, 'turn').some(turn => turn.agentId === agent.id && !['complete', 'failed', 'interrupted', 'skipped'].includes(turn.status)))
|
|
631
707
|
throw new HttpError(409, 'Bot 仍有任务未结束,请停止任务后重试', 'agent_running');
|
|
632
708
|
for (const conversationId of [id, ...preview.groups.map(group => group.id)])
|
|
@@ -648,6 +724,8 @@ export class WorkspaceStore {
|
|
|
648
724
|
});
|
|
649
725
|
}
|
|
650
726
|
detachAgentComputer(owner, agent) {
|
|
727
|
+
if (this.hasPendingCleanup(owner, { agentId: agent.id }))
|
|
728
|
+
throw new HttpError(409, 'Bot 原执行尚未确认停止,请稍后重试', 'agent_stopping');
|
|
651
729
|
const environmentId = agent.computerEnvironmentId;
|
|
652
730
|
if (!environmentId)
|
|
653
731
|
return;
|
|
@@ -673,6 +751,8 @@ export class WorkspaceStore {
|
|
|
673
751
|
throw new HttpError(409, '请先归档 Bot,再删除', 'agent_not_archived');
|
|
674
752
|
if (agent.temporaryGoalId)
|
|
675
753
|
throw new HttpError(409, '临时助手由所属任务管理', 'helper_task_bound');
|
|
754
|
+
if (this.hasPendingCleanup(owner, { agentId: id }))
|
|
755
|
+
throw new HttpError(409, 'Bot 原执行尚未确认停止,请稍后重试', 'agent_stopping');
|
|
676
756
|
const conversations = this.list(owner, 'conversation');
|
|
677
757
|
if (conversations.some(c => c.kind === 'group' && c.memberIds.includes(id)))
|
|
678
758
|
throw new HttpError(409, '此 Bot 仍是群聊成员,请先从群聊移除或删除相关群聊', 'agent_in_group');
|
|
@@ -690,6 +770,7 @@ export class WorkspaceStore {
|
|
|
690
770
|
this.put(owner, 'bot-mcp-plugin', plugin.id, { ...plugin, agentIds: plugin.agentIds.filter(agentId => agentId !== id), revision: plugin.revision + 1 });
|
|
691
771
|
}
|
|
692
772
|
this.remove(owner, 'agent', id);
|
|
773
|
+
this.put(owner, 'agent-deletion', id, { id, conversationIds: conversations.filter(c => c.kind === 'direct' && c.memberIds[0] === id).map(c => c.id), deletedAt: Date.now(), memoryCleanupPending: true });
|
|
693
774
|
this.event(owner, 'agent.deleted', { id });
|
|
694
775
|
});
|
|
695
776
|
}
|
|
@@ -918,37 +999,34 @@ export class WorkspaceStore {
|
|
|
918
999
|
});
|
|
919
1000
|
}
|
|
920
1001
|
markTaskRead(owner, conversationId, taskId, seq, unreadVersion) {
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
this.put(owner, 'conversation', conversationId, conversation);
|
|
932
|
-
this.event(owner, 'task.changed', task, conversationId);
|
|
933
|
-
this.event(owner, 'conversation.changed', conversation, conversationId);
|
|
934
|
-
return task;
|
|
935
|
-
});
|
|
1002
|
+
const task = this.requireTask(owner, conversationId, taskId);
|
|
1003
|
+
this.markChatMessagesRead(owner, conversationId, this.chatUnreadMessages(owner, conversationId, taskId)
|
|
1004
|
+
.filter(m => m.seq <= seq && (unreadVersion === undefined || (m.chatUnreadVersion ?? 0) <= unreadVersion))
|
|
1005
|
+
.map(m => ({ id: m.id, version: m.chatUnreadVersion })));
|
|
1006
|
+
task.readSeq = Math.max(task.readSeq, Math.min(seq, task.lastSeq));
|
|
1007
|
+
const updated = this.requireTask(owner, conversationId, taskId);
|
|
1008
|
+
updated.readSeq = Math.max(updated.readSeq, task.readSeq);
|
|
1009
|
+
this.put(owner, 'conversation-task', taskId, updated);
|
|
1010
|
+
this.event(owner, 'task.changed', updated, conversationId);
|
|
1011
|
+
return updated;
|
|
936
1012
|
}
|
|
937
1013
|
markConversationRead(owner, conversationId, seq, unreadVersion) {
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
1014
|
+
const c = this.require(owner, 'conversation', conversationId);
|
|
1015
|
+
if (c.kind === 'group')
|
|
1016
|
+
return this.conversationSummary(owner, c);
|
|
1017
|
+
const updated = this.markChatMessagesRead(owner, conversationId, this.chatUnreadMessages(owner, conversationId)
|
|
1018
|
+
.filter(m => m.seq <= seq && (unreadVersion === undefined || (m.chatUnreadVersion ?? 0) <= unreadVersion))
|
|
1019
|
+
.map(m => ({ id: m.id, version: m.chatUnreadVersion })));
|
|
1020
|
+
updated.readSeq = Math.max(updated.readSeq, Math.min(seq, c.lastSeq));
|
|
1021
|
+
this.put(owner, 'conversation', c.id, updated);
|
|
1022
|
+
this.event(owner, 'conversation.changed', updated, c.id);
|
|
1023
|
+
return updated;
|
|
948
1024
|
}
|
|
949
1025
|
deleteTask(owner, conversationId, taskId) {
|
|
950
1026
|
this.atomic(() => {
|
|
951
1027
|
const task = this.requireTask(owner, conversationId, taskId);
|
|
1028
|
+
if (this.hasPendingCleanup(owner, { conversationTaskId: taskId }))
|
|
1029
|
+
throw new HttpError(409, '任务原执行尚未确认停止,暂时无法移除', 'workspace_task_stopping');
|
|
952
1030
|
if (this.list(owner, 'run').some(run => run.conversationTaskId === taskId && !['complete', 'failed', 'interrupted'].includes(run.status)))
|
|
953
1031
|
throw new HttpError(409, '任务仍在运行,暂时无法移除', 'workspace_task_running');
|
|
954
1032
|
const messageIds = new Set(this.list(owner, 'message').filter(message => message.conversationTaskId === taskId).map(message => message.id));
|
|
@@ -971,8 +1049,7 @@ export class WorkspaceStore {
|
|
|
971
1049
|
conversation.previewAgentId = last?.role === 'assistant' ? last.agentId : undefined;
|
|
972
1050
|
conversation.lastMessageAt = last?.createdAt;
|
|
973
1051
|
conversation.updatedAt = Date.now();
|
|
974
|
-
|
|
975
|
-
conversation.unreadCount = conversation.unread ? 1 : 0;
|
|
1052
|
+
this.refreshChatUnread(owner, conversation);
|
|
976
1053
|
this.projectConversationRuns(owner, conversation);
|
|
977
1054
|
this.put(owner, 'conversation', conversationId, conversation);
|
|
978
1055
|
this.event(owner, 'conversation.changed', conversation, conversationId);
|
|
@@ -1033,7 +1110,8 @@ export class WorkspaceStore {
|
|
|
1033
1110
|
nativeMessageForFile;
|
|
1034
1111
|
visibleFiles(owner) {
|
|
1035
1112
|
const messages = new Map(this.list(owner, 'message').map(message => [message.id, message]));
|
|
1036
|
-
return this.list(owner, 'file').filter(file => isVisibleMessageFile(file, messages.get(file.messageId ?? '') ?? this.nativeMessageForFile?.(owner, file)))
|
|
1113
|
+
return this.list(owner, 'file').filter(file => isVisibleMessageFile(file, messages.get(file.messageId ?? '') ?? this.nativeMessageForFile?.(owner, file)))
|
|
1114
|
+
.map(file => file.sender === 'user' ? { ...file, name: normalizeUploadName(file.name) } : file);
|
|
1037
1115
|
}
|
|
1038
1116
|
messageForDisplay(owner, message) {
|
|
1039
1117
|
const peer = message.peerMessageId && message.role === 'system'
|
|
@@ -1048,13 +1126,14 @@ export class WorkspaceStore {
|
|
|
1048
1126
|
const peerAvatar = entity?.avatar || (incoming ? peer.fromAvatar : peer.targetAvatar) || '';
|
|
1049
1127
|
const files = peer.fileIds.flatMap(id => {
|
|
1050
1128
|
const file = this.get(owner, 'file', id) ?? message.attachments.find(file => file.id === id);
|
|
1051
|
-
return file ? [{ id: file.id, name: file.name, mimeType: file.mimeType, size: file.size, sender: file.sender, createdAt: file.createdAt }] : [];
|
|
1129
|
+
return file ? [{ id: file.id, name: file.sender === 'user' ? normalizeUploadName(file.name) : file.name, mimeType: file.mimeType, size: file.size, sender: file.sender, createdAt: file.createdAt }] : [];
|
|
1052
1130
|
});
|
|
1053
1131
|
return { ...message, reasoning: '', tools: [], attachments: message.visible === false ? [] : files,
|
|
1054
1132
|
communication: { direction: incoming ? 'incoming' : 'outgoing', peerId, peerName, peerAvatar, peerKind, content: peer.content } };
|
|
1055
1133
|
}
|
|
1056
1134
|
const attachments = message.role === 'user' || message.role === 'assistant'
|
|
1057
1135
|
? message.attachments.filter(file => isVisibleMessageFile(this.get(owner, 'file', file.id) ?? file, message))
|
|
1136
|
+
.map(file => file.sender === 'user' ? { ...file, name: normalizeUploadName(file.name) } : file)
|
|
1058
1137
|
: [];
|
|
1059
1138
|
return { ...message, attachments };
|
|
1060
1139
|
}
|
|
@@ -1085,18 +1164,15 @@ export class WorkspaceStore {
|
|
|
1085
1164
|
if (!message.seq)
|
|
1086
1165
|
message.seq = c.lastSeq + 1;
|
|
1087
1166
|
c.lastSeq = Math.max(c.lastSeq, message.seq);
|
|
1088
|
-
const
|
|
1089
|
-
|
|
1090
|
-
&& !!(value.content.trim() || value.error || value.browserCard || value.serviceWarnings?.length || this.messageForDisplay(owner, value).attachments.length);
|
|
1091
|
-
if (needsAttention(message) && !needsAttention(previous)) {
|
|
1092
|
-
c.unread = true;
|
|
1167
|
+
const eligible = isWorkspaceChatReply(message), previousEligible = !!previous && isWorkspaceChatReply(previous);
|
|
1168
|
+
if (eligible && !previous?.chatUnreadVersion) {
|
|
1093
1169
|
c.unreadVersion = (c.unreadVersion ?? 0) + 1;
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
task.unreadVersion =
|
|
1097
|
-
}
|
|
1170
|
+
message.chatUnreadVersion = c.unreadVersion;
|
|
1171
|
+
if (task)
|
|
1172
|
+
task.unreadVersion = c.unreadVersion;
|
|
1098
1173
|
}
|
|
1099
|
-
|
|
1174
|
+
else if (previous?.chatUnreadVersion)
|
|
1175
|
+
message.chatUnreadVersion = previous.chatUnreadVersion;
|
|
1100
1176
|
if (updateSummary && message.visible !== false && (message.content.trim() || message.attachments.length || message.browserCard && !previous?.browserCard || message.serviceWarnings?.length && !previous?.serviceWarnings?.length)) {
|
|
1101
1177
|
c.updatedAt = Date.now();
|
|
1102
1178
|
c.lastMessageAt = Math.max(c.lastMessageAt ?? 0, message.createdAt);
|
|
@@ -1113,7 +1189,6 @@ export class WorkspaceStore {
|
|
|
1113
1189
|
if (becameHidden)
|
|
1114
1190
|
task.messageCount = Math.max(0, task.messageCount - 1);
|
|
1115
1191
|
task.lastSeq = Math.max(task.lastSeq, message.seq);
|
|
1116
|
-
task.unreadCount = task.unread ? 1 : 0;
|
|
1117
1192
|
if (message.visible !== false && (message.content.trim() || message.attachments.length || message.browserCard && !previous?.browserCard || message.serviceWarnings?.length && !previous?.serviceWarnings?.length)) {
|
|
1118
1193
|
if (message.role === 'user' && task.titleSource === 'automatic' && task.messageCount <= 1) {
|
|
1119
1194
|
const source = notificationPlainText(message.content, { maximum: 48, fallback: message.attachments[0]?.name ?? '' }).trim();
|
|
@@ -1124,8 +1199,11 @@ export class WorkspaceStore {
|
|
|
1124
1199
|
task.updatedAt = Date.now();
|
|
1125
1200
|
}
|
|
1126
1201
|
this.put(owner, 'conversation-task', task.id, task);
|
|
1127
|
-
this.event(owner, 'task.changed', task, c.id);
|
|
1128
1202
|
}
|
|
1203
|
+
if (eligible !== previousEligible || eligible && !previous?.chatUnreadVersion)
|
|
1204
|
+
this.refreshChatUnread(owner, c);
|
|
1205
|
+
if (task && updateSummary)
|
|
1206
|
+
this.event(owner, 'task.changed', this.requireTask(owner, c.id, task.id), c.id);
|
|
1129
1207
|
if (patch)
|
|
1130
1208
|
this.event(owner, 'message.patch', patch, c.id, { type: 'message.changed', data: message });
|
|
1131
1209
|
else
|
|
@@ -1150,7 +1228,7 @@ export class WorkspaceStore {
|
|
|
1150
1228
|
...conversation,
|
|
1151
1229
|
unread: conversation.unread ?? false,
|
|
1152
1230
|
unreadVersion: conversation.unreadVersion ?? 0,
|
|
1153
|
-
unreadCount: conversation.
|
|
1231
|
+
unreadCount: conversation.unreadCount ?? 0,
|
|
1154
1232
|
...(member ? { avatar: this.agentSummary(member).avatar } : {}),
|
|
1155
1233
|
lastMessageAt: conversation.lastMessageAt
|
|
1156
1234
|
?? (conversation.lastSeq > 0 ? this.messages(owner, conversation.id, Number.MAX_SAFE_INTEGER, 1).at(-1)?.createdAt : undefined)
|
|
@@ -21,6 +21,7 @@ export function workspaceDetail(store, runtime, owner, conversationId, taskId, l
|
|
|
21
21
|
/** Durable replay followed by live updates. A slow reader reconnects from its last applied cursor. */
|
|
22
22
|
export function streamWorkspace(ctx, store, auth) {
|
|
23
23
|
const owner = auth.require(ctx).id, version = auth.pushAuthorizationVersion(owner);
|
|
24
|
+
const cookie = ctx.get('cookie');
|
|
24
25
|
const patches = store.messagePatchesEnabled && ctx.query.format === 'patch-v1';
|
|
25
26
|
const res = ctx.res;
|
|
26
27
|
const raw = ctx.get('last-event-id') || String(ctx.query.after ?? '0');
|
|
@@ -30,8 +31,10 @@ export function streamWorkspace(ctx, store, auth) {
|
|
|
30
31
|
const pending = new Map();
|
|
31
32
|
const knownMessages = new Set();
|
|
32
33
|
const valid = () => {
|
|
34
|
+
// Koa's localUser is a request snapshot; a long-lived stream must check the
|
|
35
|
+
// captured session itself so logout and expiry revoke this connection.
|
|
33
36
|
try {
|
|
34
|
-
return auth.
|
|
37
|
+
return auth.currentFromCookieHeader(cookie)?.id === owner && auth.isUserActive(owner) && auth.pushAuthorizationVersion(owner) === version;
|
|
35
38
|
}
|
|
36
39
|
catch {
|
|
37
40
|
return false;
|
|
@@ -13,8 +13,8 @@ export function deviceSourceText(snapshot) {
|
|
|
13
13
|
}
|
|
14
14
|
export function deviceInventoryText(snapshot) {
|
|
15
15
|
if (!snapshot.hosts.length)
|
|
16
|
-
return '
|
|
17
|
-
return
|
|
16
|
+
return '当前没有已知的客户端电脑控制通道;不能据此判断服务端 Hermes 离线或原生工具不可用。';
|
|
17
|
+
return `本轮电脑清单(仅描述客户端电脑控制通道,不代表 Hermes 连接状态;名称是数据;重名时使用 host 固定值;状态为采集时快照,调用时重新核对):\n${snapshot.hosts.map(host => {
|
|
18
18
|
const m = host.metadata;
|
|
19
19
|
const details = m ? [
|
|
20
20
|
m.osRelease && `系统版本=${JSON.stringify(m.osRelease)}`, m.arch && `架构=${JSON.stringify(m.arch)}`,
|
|
@@ -23,6 +23,6 @@ export function deviceInventoryText(snapshot) {
|
|
|
23
23
|
m.shellScope && 'Shell范围=桌面用户的系统权限(不受文件工具根目录约束)', m.timezone && `时区=${JSON.stringify(m.timezone)}`,
|
|
24
24
|
].filter(Boolean).join(';') : '运行路径未上报或无文件与命令授权';
|
|
25
25
|
const state = !host.online ? '离线' : !host.open ? '未开放' : '在线';
|
|
26
|
-
return `${JSON.stringify(host.name)}(${host.kind === 'server' ? '
|
|
26
|
+
return `${JSON.stringify(host.name)}(${host.kind === 'server' ? '服务器桌面代理' : '客户端电脑'}${host.source ? '·本机' : ''};host=${JSON.stringify(host.target)};控制通道=${state};系统=${JSON.stringify(host.platform ?? '未知')};屏幕控制=${deviceCapabilityLabels[host.capabilities.view.status]};文件与命令=${deviceCapabilityLabels[host.capabilities.shell.status]})\n${details};文件传输协议=${host.transfer.protocol === 'chunked' ? '分块' : host.transfer.protocol === 'legacy' ? '旧版' : '未知'},读取上限=${host.transfer.readMaxMiB === null ? '未知' : host.transfer.readMaxMiB + ' MiB'},写入上限=${host.transfer.writeMaxMiB === null ? '未知' : host.transfer.writeMaxMiB + ' MiB'}`;
|
|
27
27
|
}).join('\n')}`;
|
|
28
28
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const emptyUnread = () => ({ total: 0, bot: 0, chat: 0, conversations: [] });
|
|
2
|
+
/** Tool traces may accompany a final answer; standalone process/system records never qualify. */
|
|
3
|
+
export function isWorkspaceChatReply(m) {
|
|
4
|
+
return m.role === 'assistant' && m.status === 'complete' && m.visible !== false && !m.error
|
|
5
|
+
&& (!!m.content.replace(/<(think|thinking|reasoning)\b[^>]*>[\s\S]*?(?:<\/\1>|$)/gi, '').trim() || !!m.attachments?.length);
|
|
6
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Recover UTF-8 upload names that older multipart parsing decoded as Latin-1. */
|
|
2
|
+
export function normalizeUploadName(name) {
|
|
3
|
+
// Leave Unicode names and ordinary Latin-1 names alone unless every byte
|
|
4
|
+
// forms valid UTF-8. Fatal decoding avoids replacing data we cannot recover.
|
|
5
|
+
if (!/[\u0080-\u00ff]/.test(name) || /[^\u0000-\u00ff]/.test(name))
|
|
6
|
+
return name;
|
|
7
|
+
try {
|
|
8
|
+
return new TextDecoder('utf-8', { fatal: true, ignoreBOM: true })
|
|
9
|
+
.decode(Uint8Array.from(name, character => character.charCodeAt(0)));
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return name;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Copyright (c) 2015-2026
|
|
2
|
+
Ahmad Ben Mrad <batikhsouri at gmail dot org>
|
|
3
|
+
Frank Denis <j at pureftpd dot org>
|
|
4
|
+
Ryan Lester <ryan at cyph dot com>
|
|
5
|
+
|
|
6
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
7
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
8
|
+
copyright notice and this permission notice appear in all copies.
|
|
9
|
+
|
|
10
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
11
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
12
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
13
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
14
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
15
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
16
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright Brian White. All rights reserved.
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to
|
|
5
|
+
deal in the Software without restriction, including without limitation the
|
|
6
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
7
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
|
11
|
+
all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
18
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
19
|
+
IN THE SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lsamien/yaoyao",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.78",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "夭夭 AI:聊天、多 Agent 团队、文件库与电脑工作空间",
|
|
6
6
|
"type": "module",
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
"node": ">=24.0.0"
|
|
10
10
|
},
|
|
11
11
|
"bin": {
|
|
12
|
-
"hermes-yaoyao": "./bin/hermes-yaoyao.mjs",
|
|
13
12
|
"yaoyao": "./bin/hermes-yaoyao.mjs"
|
|
14
13
|
},
|
|
15
14
|
"scripts": {
|
|
@@ -25,17 +24,18 @@
|
|
|
25
24
|
"brand:verify": "node scripts/verify-brand.mjs",
|
|
26
25
|
"release:verify": "node scripts/verify-release.mjs",
|
|
27
26
|
"verify:lifecycle": "node scripts/verify-lifecycle.mjs",
|
|
27
|
+
"test:pair:mobile": "node --import tsx --test scripts/verify-mobile-pair.test.ts",
|
|
28
28
|
"test:e2e:workspace": "npm run build && playwright test -c playwright.workspace.config.ts",
|
|
29
29
|
"test:e2e:desktop-hosts": "npm run build && playwright test -c playwright.desktop-hosts.config.ts",
|
|
30
30
|
"test:e2e:team-tools": "npm run build && playwright test -c playwright.team-tools.config.ts",
|
|
31
31
|
"desktop:build": "npm run build && node scripts/build-desktop.mjs",
|
|
32
32
|
"desktop:build:client": "node scripts/write-build-info.mjs && node scripts/build-desktop-client.mjs",
|
|
33
|
-
"desktop:dev:client": "npm run desktop:build:client && electron .",
|
|
33
|
+
"desktop:dev:client": "npm run desktop:build:client && cross-env HERMES_YAOYAO_DESKTOP_CLIENT_ONLY=1 electron .",
|
|
34
34
|
"desktop:pack:client": "npm run desktop:build:client && electron-builder --config electron-builder.client.yml --mac --arm64 --publish never",
|
|
35
|
-
"desktop:dev": "npm run desktop:build && electron .",
|
|
35
|
+
"desktop:dev": "npm run desktop:build && cross-env HERMES_YAOYAO_DESKTOP_CLIENT_ONLY=0 electron .",
|
|
36
36
|
"desktop:pack": "npm run desktop:build && electron-builder --mac --arm64 --publish never",
|
|
37
37
|
"desktop:release": "npm run desktop:build && node scripts/desktop-release.mjs",
|
|
38
|
-
"desktop:test": "node --test desktop/*.test.mjs",
|
|
38
|
+
"desktop:test": "cross-env HERMES_YAOYAO_DESKTOP_CLIENT_ONLY=0 node --test desktop/*.test.mjs",
|
|
39
39
|
"runner": "node dist-server/runner/index.js",
|
|
40
40
|
"runner:dev": "tsx src/runner/index.ts",
|
|
41
41
|
"runner:build": "node scripts/build-runner.mjs",
|
|
@@ -69,6 +69,7 @@
|
|
|
69
69
|
"koa": "^2.15.3",
|
|
70
70
|
"koa-send": "^5.0.1",
|
|
71
71
|
"koa-static": "^5.0.0",
|
|
72
|
+
"libsodium-wrappers-sumo": "0.8.4",
|
|
72
73
|
"markdown-it": "^14.1.0",
|
|
73
74
|
"mime-types": "^3.0.1",
|
|
74
75
|
"naive-ui": "^2.44.1",
|
|
@@ -78,6 +79,7 @@
|
|
|
78
79
|
"qrcode": "^1.5.4",
|
|
79
80
|
"read-excel-file": "^7.0.3",
|
|
80
81
|
"sass": "^1.99.0",
|
|
82
|
+
"ssh2": "1.17.0",
|
|
81
83
|
"typescript": "~6.0.2",
|
|
82
84
|
"vite": "^8.0.4",
|
|
83
85
|
"vue": "^3.5.32",
|
|
@@ -89,6 +91,7 @@
|
|
|
89
91
|
"devDependencies": {
|
|
90
92
|
"@playwright/test": "^1.60.0",
|
|
91
93
|
"@types/jsdom": "^21.1.7",
|
|
94
|
+
"@types/ssh2": "1.15.5",
|
|
92
95
|
"@types/supertest": "^6.0.3",
|
|
93
96
|
"@vitest/coverage-v8": "^3.2.4",
|
|
94
97
|
"@vue/test-utils": "^2.4.6",
|
package/release.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AboutDialog-fbm5CG09.js","names":[],"sources":["../../package.json","../../src/client/components/app/AboutDialog.vue","../../src/client/components/app/AboutDialog.vue"],"sourcesContent":["{\n \"name\": \"@lsamien/yaoyao\",\n \"version\": \"0.4.76\",\n \"license\": \"Apache-2.0\",\n \"description\": \"夭夭 AI:聊天、多 Agent 团队、文件库与电脑工作空间\",\n \"type\": \"module\",\n \"main\": \"desktop/main.mjs\",\n \"engines\": {\n \"node\": \">=24.0.0\"\n },\n \"bin\": {\n \"hermes-yaoyao\": \"./bin/hermes-yaoyao.mjs\",\n \"yaoyao\": \"./bin/hermes-yaoyao.mjs\"\n },\n \"scripts\": {\n \"dev\": \"cross-env NODE_ENV=development tsx watch src/server/index.ts\",\n \"build\": \"npm run brand:verify && npm run release:verify && vue-tsc -b tsconfig.client.build.json && vite build && tsc -p tsconfig.server.json && node scripts/copy-worker.mjs && node scripts/write-build-info.mjs\",\n \"start\": \"cross-env NODE_ENV=production node dist-server/server/index.js\",\n \"typecheck\": \"vue-tsc -b && tsc --noEmit -p tsconfig.server.json\",\n \"test\": \"vitest run\",\n \"prepack\": \"npm run build\",\n \"test:watch\": \"vitest\",\n \"test:e2e\": \"npm run build && playwright test\",\n \"test:live\": \"cross-env HERMES_YAOYAO_LIVE_TEST=1 vitest run tests/live\",\n \"brand:verify\": \"node scripts/verify-brand.mjs\",\n \"release:verify\": \"node scripts/verify-release.mjs\",\n \"verify:lifecycle\": \"node scripts/verify-lifecycle.mjs\",\n \"test:e2e:workspace\": \"npm run build && playwright test -c playwright.workspace.config.ts\",\n \"test:e2e:desktop-hosts\": \"npm run build && playwright test -c playwright.desktop-hosts.config.ts\",\n \"test:e2e:team-tools\": \"npm run build && playwright test -c playwright.team-tools.config.ts\",\n \"desktop:build\": \"npm run build && node scripts/build-desktop.mjs\",\n \"desktop:build:client\": \"node scripts/write-build-info.mjs && node scripts/build-desktop-client.mjs\",\n \"desktop:dev:client\": \"npm run desktop:build:client && electron .\",\n \"desktop:pack:client\": \"npm run desktop:build:client && electron-builder --config electron-builder.client.yml --mac --arm64 --publish never\",\n \"desktop:dev\": \"npm run desktop:build && electron .\",\n \"desktop:pack\": \"npm run desktop:build && electron-builder --mac --arm64 --publish never\",\n \"desktop:release\": \"npm run desktop:build && node scripts/desktop-release.mjs\",\n \"desktop:test\": \"node --test desktop/*.test.mjs\",\n \"runner\": \"node dist-server/runner/index.js\",\n \"runner:dev\": \"tsx src/runner/index.ts\",\n \"runner:build\": \"node scripts/build-runner.mjs\",\n \"desktop:build:win\": \"npm run build && node scripts/build-windows-desktop.mjs\",\n \"desktop:pack:win\": \"npm run desktop:build:win && node scripts/windows-desktop-release.mjs\",\n \"desktop:test:win\": \"node scripts/test-windows-desktop.mjs\"\n },\n \"dependencies\": {\n \"@koa/bodyparser\": \"^5.0.0\",\n \"@koa/router\": \"^15.4.0\",\n \"@openviking/sdk\": \"0.1.0\",\n \"@types/busboy\": \"^1.5.4\",\n \"@types/koa\": \"^2.15.0\",\n \"@types/koa-send\": \"^4.1.6\",\n \"@types/koa-static\": \"^4.0.4\",\n \"@types/markdown-it\": \"^14.1.2\",\n \"@types/mime-types\": \"^2.1.4\",\n \"@types/node\": \"^24.10.0\",\n \"@types/qrcode\": \"^1.5.6\",\n \"@types/ws\": \"^8.18.1\",\n \"@vicons/ionicons5\": \"^0.13.0\",\n \"@vicons/tabler\": \"^0.13.0\",\n \"@vitejs/plugin-vue\": \"^6.0.5\",\n \"@vue/tsconfig\": \"^0.9.1\",\n \"busboy\": \"^1.6.0\",\n \"cookie\": \"^1.0.2\",\n \"docx-preview\": \"^0.3.7\",\n \"dompurify\": \"^3.2.6\",\n \"highlight.js\": \"^11.11.1\",\n \"idb\": \"^8.0.3\",\n \"koa\": \"^2.15.3\",\n \"koa-send\": \"^5.0.1\",\n \"koa-static\": \"^5.0.0\",\n \"markdown-it\": \"^14.1.0\",\n \"mime-types\": \"^3.0.1\",\n \"naive-ui\": \"^2.44.1\",\n \"pdfjs-dist\": \"^5.7.284\",\n \"pinia\": \"^3.0.4\",\n \"playwright\": \"1.62.1\",\n \"qrcode\": \"^1.5.4\",\n \"read-excel-file\": \"^7.0.3\",\n \"sass\": \"^1.99.0\",\n \"typescript\": \"~6.0.2\",\n \"vite\": \"^8.0.4\",\n \"vue\": \"^3.5.32\",\n \"vue-router\": \"^4.6.4\",\n \"vue-tsc\": \"^3.2.8\",\n \"ws\": \"^8.20.0\",\n \"zod\": \"^4.1.12\"\n },\n \"devDependencies\": {\n \"@playwright/test\": \"^1.60.0\",\n \"@types/jsdom\": \"^21.1.7\",\n \"@types/supertest\": \"^6.0.3\",\n \"@vitest/coverage-v8\": \"^3.2.4\",\n \"@vue/test-utils\": \"^2.4.6\",\n \"cross-env\": \"^10.1.0\",\n \"electron\": \"43.4.0\",\n \"electron-builder\": \"26.15.3\",\n \"electron-updater\": \"6.8.9\",\n \"esbuild\": \"0.28.2\",\n \"js-yaml\": \"4.3.2\",\n \"jsdom\": \"^27.0.1\",\n \"supertest\": \"^7.1.4\",\n \"tsx\": \"^4.21.0\",\n \"vitest\": \"^3.2.4\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/Lsamien/yaoyao.git\"\n },\n \"files\": [\n \"bin\",\n \"dist\",\n \"dist-server\",\n \"licenses\",\n \"LICENSE\",\n \"NOTICE\",\n \"THIRD_PARTY_NOTICES.md\",\n \"release.json\",\n \"build-info.json\"\n ],\n \"homepage\": \"https://github.com/Lsamien/yaoyao\"\n}\n","<script setup lang=\"ts\">\nimport { version } from '../../../../package.json'\nimport BrandMark from '@/components/common/BrandMark.vue'\nimport StandaloneDialog from '@/components/common/StandaloneDialog.vue'\nconst emit = defineEmits<{ close: [] }>()\n</script>\n<template>\n <StandaloneDialog title=\"关于夭夭 AI\" compact @close=\"emit('close')\"><section class=\"about-content\">\n <BrandMark :size=\"56\" :label=\"false\" compact bare /><h3>夭夭 AI</h3><p class=\"about-version\">版本 {{ version }}</p>\n <p>与 AI 聊天,让 Bot 协作完成任务。<br />基于 Apache-2.0 许可证开放源代码。</p>\n <nav aria-label=\"关于链接\"><a href=\"https://github.com/Lsamien/yaoyao\" target=\"_blank\" rel=\"noopener noreferrer\">GitHub</a><a href=\"https://yaoyao.samien.cn\" target=\"_blank\" rel=\"noopener noreferrer\">帮助中心</a><a href=\"https://github.com/Lsamien/yaoyao/releases\" target=\"_blank\" rel=\"noopener noreferrer\">版本发布</a></nav>\n </section></StandaloneDialog>\n</template>\n<style scoped>\n.about-content{display:grid;justify-items:center;gap:12px;text-align:center}.about-content h3{font-size:21px;margin:0}.about-content p{margin:0;color:var(--text-secondary);font-size:13px;line-height:1.8}.about-content .about-version{font-size:12px}.about-content nav{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin-top:8px}.about-content a{padding:10px 8px;color:var(--accent);font-size:13px;text-decoration:none}.about-content a:hover{text-decoration:underline}.about-content a:focus-visible{outline:2px solid var(--accent);outline-offset:2px}\n</style>\n","<script setup lang=\"ts\">\nimport { version } from '../../../../package.json'\nimport BrandMark from '@/components/common/BrandMark.vue'\nimport StandaloneDialog from '@/components/common/StandaloneDialog.vue'\nconst emit = defineEmits<{ close: [] }>()\n</script>\n<template>\n <StandaloneDialog title=\"关于夭夭 AI\" compact @close=\"emit('close')\"><section class=\"about-content\">\n <BrandMark :size=\"56\" :label=\"false\" compact bare /><h3>夭夭 AI</h3><p class=\"about-version\">版本 {{ version }}</p>\n <p>与 AI 聊天,让 Bot 协作完成任务。<br />基于 Apache-2.0 许可证开放源代码。</p>\n <nav aria-label=\"关于链接\"><a href=\"https://github.com/Lsamien/yaoyao\" target=\"_blank\" rel=\"noopener noreferrer\">GitHub</a><a href=\"https://yaoyao.samien.cn\" target=\"_blank\" rel=\"noopener noreferrer\">帮助中心</a><a href=\"https://github.com/Lsamien/yaoyao/releases\" target=\"_blank\" rel=\"noopener noreferrer\">版本发布</a></nav>\n </section></StandaloneDialog>\n</template>\n<style scoped>\n.about-content{display:grid;justify-items:center;gap:12px;text-align:center}.about-content h3{font-size:21px;margin:0}.about-content p{margin:0;color:var(--text-secondary);font-size:13px;line-height:1.8}.about-content .about-version{font-size:12px}.about-content nav{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin-top:8px}.about-content a{padding:10px 8px;color:var(--accent);font-size:13px;text-decoration:none}.about-content a:hover{text-decoration:underline}.about-content a:focus-visible{outline:2px solid var(--accent);outline-offset:2px}\n</style>\n"],"mappings":"yVCIA,IAAM,EAAO,gBAGX,EAAA,EAAA,EAI6B,EAAA,CAJX,MAAM,UAAU,QAAA,GAAS,QAAK,AAAA,EAAA,KAAA,GAAE,EAAI,OAAA,IAAW,QAAA,MAIvD,CAJuD,EAIvD,UAJuD,EAIvD,CAHR,EAAoD,EAAA,CAAxC,KAAM,GAAK,MAAO,GAAO,QAAA,GAAQ,KAAA,KAAO,AAAA,EAAA,KAAA,EAAc,KAAA,KAAV,QAAK,EAAA,EAAK,EAA6C,IAA7C,EAAyB,MAAG,EAAG,EAAA,CAAA,CAAO,EAAA,CAAA,EACxG,AAAA,EAAA,KAAA,EAAyD,IAAA,KAAA,CAAtD,EAAA,uBAAqB,EAAA,EAAM,IAAA,EAAA,EAAA,yBAAuB,OACrD,AAAA,EAAA,KAAA,EAAyT,MAAA,CAApT,aAAW,MAAM,EAAA,CAAC,EAAgG,IAAA,CAA7F,KAAK,oCAAoC,OAAO,SAAS,IAAI,qBAAsB,EAAA,QAAM,EAAI,EAAqF,IAAA,CAAlF,KAAK,2BAA2B,OAAO,SAAS,IAAI,qBAAsB,EAAA,MAAI,EAAI,EAAuG,IAAA,CAApG,KAAK,6CAA6C,OAAO,SAAS,IAAI,qBAAsB,EAAA,MAAI"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{A as e,D as t,F as n,G as r,L as i,M as a,W as ee,_ as o,at as te,ct as s,d as c,et as l,g as u,h as d,l as f,m as p,o as m,ot as h,p as g,s as _,t as ne,u as re,v,x as y,y as b,z as ie}from"./_plugin-vue_export-helper-CscYwSBt.js";import{$ as ae,P as oe,Q as se,Y as x,i as S}from"./index-CEqMqiJr.js";import{t as ce}from"./WorkspaceRoutinesPanel-DpVAtnDX.js";var le={class:`automations-header`},ue={class:`segmented`,role:`tablist`,"aria-label":`自动化页面`},de=[`aria-selected`],fe=[`aria-selected`],pe={key:0,class:`running-count`},me={class:`new-automation`},he=[`disabled`,`aria-expanded`],ge=[`onClick`],_e={class:`automations-body`},ve={class:`automation-sidebar`,"aria-label":`自动化筛选`},ye={class:`date-filter`},be={"aria-label":`按 Bot 筛选`},xe=[`aria-current`],Se=[`aria-current`,`onClick`],Ce={key:0},we={class:`automation-content`},Te={class:`automation-toolbar`},Ee={key:0,class:`segmented`,role:`tablist`,"aria-label":`日程视图`},De=[`aria-selected`],Oe=[`aria-selected`],ke={class:`date-actions`},Ae={class:`range-label`},je=[`aria-label`],Me=[`value`],Ne=[`value`],Pe={key:0,class:`page-error`,role:`alert`},Fe={key:1,class:`loading`,role:`status`},Ie={class:`schedule-week`,"aria-label":`本周自动化日程`},Le=[`aria-label`],Re=[`onClick`],ze={key:0,class:`no-events`},Be={key:3,class:`automation-list`},Ve={key:0,class:`empty`},He=[`onClick`],Ue=[`onClick`],We={key:4,class:`automation-logs`},Ge={key:0,class:`log-scope`},Ke={key:1,class:`empty`},qe={key:0,class:`failure`},Je={key:1},C=ne(y({__name:`BotAutomationsView`,setup(ne){let y=ae(),C=se(),w=l([]),T=l([]),E=l([]),D=l(!0),O=l(``),k=l(`all`),A=l(``),j=l(``),M=l(`all`),N=l(`schedule`),P=l(`calendar`),F=l(``),I=l(!1),L=l(``),R=l(),z=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`,B=l(z(new Date));function V(){let e=new Date(B.value+`T00:00:00`);return Number.isFinite(e.getTime())?e:new Date}let Ye=[`一`,`二`,`三`,`四`,`五`,`六`,`日`],H={queued:`排队中`,running:`执行中`,waiting:`等待处理`,complete:`已完成`,failed:`失败`,interrupted:`已停止`,uncertain:`状态待确认`,skipped:`已跳过`},Xe=g(()=>typeof C.query.from==`string`&&/^\/conversations(?:\/[a-f0-9-]{36})?(?:\?taskId=[a-f0-9-]{36})?$/i.test(C.query.from)?C.query.from:`/conversations`),Ze=g(()=>w.value.filter(e=>e.name.toLowerCase().includes(A.value.trim().toLowerCase()))),U=g(()=>T.value.filter(e=>(k.value===`all`||e.agentId===k.value)&&`${e.name} ${e.prompt}`.toLowerCase().includes(j.value.trim().toLowerCase())).sort((e,t)=>Number(t.enabled)-Number(e.enabled)||(e.nextAt??1/0)-(t.nextAt??1/0))),W=g(()=>E.value.filter(e=>(k.value===`all`||e.agentId===k.value)&&(!F.value||e.routineId===F.value)&&(M.value===`all`||e.status===M.value)&&`${T.value.find(t=>t.id===e.routineId)?.name??``} ${e.error??``}`.toLowerCase().includes(j.value.trim().toLowerCase()))),Qe=g(()=>E.value.filter(e=>[`queued`,`running`,`waiting`,`uncertain`].includes(e.status)).length),G=g(()=>{let e=V();return e.setDate(e.getDate()-(e.getDay()+6)%7),Ye.map((t,n)=>{let r=new Date(e);return r.setDate(r.getDate()+n),{date:r,key:z(r),weekday:t}})}),$e=g(()=>`${G.value[0].date.toLocaleDateString(`zh-CN`)} — ${G.value[6].date.toLocaleDateString(`zh-CN`)}`),et=e=>U.value.filter(t=>t.enabled&&t.nextAt&&z(new Date(t.nextAt))===e),K=e=>w.value.find(t=>t.id===e),tt=e=>e?new Date(e).toLocaleString(`zh-CN`,{hour12:!1}):`—`,nt=e=>e?new Date(e).toLocaleTimeString(`zh-CN`,{hour12:!1,hour:`2-digit`,minute:`2-digit`}):``,rt=e=>e.schedule.kind===`interval`?`每 ${e.schedule.everyMinutes} 分钟`:e.schedule.kind===`once`?`仅一次`:`${e.schedule.kind===`weekly`?`每周 `+(e.schedule.weekdays??[]).map(e=>`日一二三四五六`[e]).join(`、`):`每天`} ${e.schedule.time}`;function q(e){let t=V();t.setDate(t.getDate()+e*7),B.value=z(t)}function it(e){e.target instanceof Element&&!e.target.closest(`.new-automation`)&&(I.value=!1)}function J(e=``){N.value=`logs`,F.value=e,j.value=``,M.value=`all`}async function Y(e,n){I.value=!1,L.value=e,await t(),R.value?.edit(n)}function at(){let e=k.value===`all`?w.value.length===1?w.value[0].id:void 0:k.value;e?Y(e):I.value=!I.value}let X=0,Z=!1,ot;async function Q(){let e=++X;try{let t=await oe(`/api/app/bot-tools/automations`);if(Z||e!==X)return;w.value=t.agents,T.value=t.routines,E.value=t.runs,O.value=``,k.value!==`all`&&!w.value.some(e=>e.id===k.value)&&(k.value=`all`)}catch(t){!Z&&e===X&&(O.value=t instanceof Error?t.message:`无法读取自动化任务`)}finally{!Z&&e===X&&(D.value=!1)}}async function $(){document.hidden||await Q(),Z||(ot=setTimeout($,5e3))}return a($),e(()=>{Z=!0,X++,clearTimeout(ot)}),(e,t)=>{let a=ie(`RouterLink`);return n(),o(`main`,{class:`automations-page`,"aria-label":`自动化工作区`,onPointerdown:it,onKeydown:t[16]||=f(e=>I.value=!1,[`esc`])},[p(`header`,le,[p(`button`,{class:`icon-button`,type:`button`,"aria-label":`返回聊天`,onClick:t[0]||=e=>te(y).push(Xe.value)},[b(x,{name:`chevron-left`,size:20})]),b(x,{name:`calendar`,size:23}),t[19]||=p(`h1`,null,`自动化`,-1),p(`div`,ue,[p(`button`,{role:`tab`,"aria-selected":N.value===`schedule`,onClick:t[1]||=e=>N.value=`schedule`},`日程`,8,de),p(`button`,{role:`tab`,"aria-selected":N.value===`logs`,onClick:t[2]||=e=>J()},`运行日志`,8,fe)]),Qe.value?(n(),o(`span`,pe,s(Qe.value)+` 项执行中`,1)):u(``,!0),p(`div`,me,[p(`button`,{class:`primary`,type:`button`,disabled:!w.value.length,"aria-expanded":I.value,onClick:at},[b(x,{name:`plus`,size:17}),t[17]||=v(`新建自动化`,-1)],8,he),I.value?(n(),o(`div`,{key:0,class:`new-menu`,role:`group`,"aria-label":`选择执行 Bot`,onKeydown:t[3]||=f(re(e=>I.value=!1,[`stop`]),[`esc`])},[t[18]||=p(`p`,null,`选择执行 Bot`,-1),(n(!0),o(c,null,i(w.value,e=>(n(),o(`button`,{key:e.id,type:`button`,onClick:t=>Y(e.id)},[b(S,{name:e.name,avatar:e.avatar,size:24},null,8,[`name`,`avatar`]),v(s(e.name),1)],8,ge))),128))],32)):u(``,!0)])]),p(`div`,_e,[p(`aside`,ve,[p(`label`,ye,[t[20]||=v(`查看日期`,-1),r(p(`input`,{"onUpdate:modelValue":t[4]||=e=>B.value=e,type:`date`},null,512),[[_,B.value]])]),p(`h2`,null,[t[21]||=v(`我的 Bot `,-1),p(`span`,null,s(w.value.length),1)]),r(p(`input`,{"onUpdate:modelValue":t[5]||=e=>A.value=e,type:`search`,"aria-label":`搜索 Bot`,placeholder:`搜索 Bot`},null,512),[[_,A.value]]),p(`nav`,be,[p(`button`,{"aria-current":k.value===`all`?`true`:void 0,onClick:t[6]||=e=>k.value=`all`},[b(x,{name:`users`,size:22}),t[22]||=v(`全部 Bot`,-1),p(`span`,null,s(T.value.length),1)],8,xe),(n(!0),o(c,null,i(Ze.value,e=>(n(),o(`button`,{key:e.id,"aria-current":k.value===e.id?`true`:void 0,onClick:t=>k.value=e.id},[b(S,{name:e.name,avatar:e.avatar,size:26},null,8,[`name`,`avatar`]),p(`strong`,null,s(e.name),1),p(`span`,null,s(T.value.filter(t=>t.agentId===e.id).length),1)],8,Se))),128))]),w.value.length?u(``,!0):(n(),o(`p`,Ce,`创建 Bot 后,即可安排自动执行的任务。`))]),p(`section`,we,[p(`div`,Te,[N.value===`schedule`?(n(),o(`div`,Ee,[p(`button`,{role:`tab`,"aria-selected":P.value===`calendar`,onClick:t[7]||=e=>P.value=`calendar`},`日历`,8,De),p(`button`,{role:`tab`,"aria-selected":P.value===`list`,onClick:t[8]||=e=>P.value=`list`},`任务列表`,8,Oe)])):u(``,!0),N.value===`schedule`&&P.value===`calendar`?(n(),o(c,{key:1},[p(`div`,ke,[p(`button`,{"aria-label":`上一周`,onClick:t[9]||=e=>q(-1)},[b(x,{name:`chevron-left`,size:16})]),p(`button`,{onClick:t[10]||=e=>B.value=z(new Date)},`今天`),p(`button`,{"aria-label":`下一周`,onClick:t[11]||=e=>q(1)},[b(x,{name:`chevron-left`,class:`next-icon`,size:16})])]),p(`span`,Ae,s($e.value),1)],64)):u(``,!0),r(p(`input`,{"onUpdate:modelValue":t[12]||=e=>j.value=e,class:`task-search`,type:`search`,"aria-label":N.value===`logs`?`搜索运行日志`:`搜索自动化任务`,placeholder:`搜索任务`},null,8,je),[[_,j.value]]),r(p(`select`,{"onUpdate:modelValue":t[13]||=e=>k.value=e,class:`mobile-bot-filter`,"aria-label":`筛选执行 Bot`},[t[23]||=p(`option`,{value:`all`},`全部 Bot`,-1),(n(!0),o(c,null,i(w.value,e=>(n(),o(`option`,{key:e.id,value:e.id},s(e.name),9,Me))),128))],512),[[m,k.value]]),N.value===`logs`?r((n(),o(`select`,{key:2,"onUpdate:modelValue":t[14]||=e=>M.value=e,"aria-label":`筛选执行状态`},[t[24]||=p(`option`,{value:`all`},`全部状态`,-1),(n(),o(c,null,i(H,(e,t)=>p(`option`,{key:t,value:t},s(e),9,Ne)),64))],512)),[[m,M.value]]):u(``,!0),p(`button`,{class:`icon-button`,"aria-label":`刷新自动化`,onClick:Q},[b(x,{name:`refresh`,size:17})])]),O.value?(n(),o(`p`,Pe,s(O.value),1)):u(``,!0),D.value?(n(),o(`p`,Fe,`正在读取自动化任务…`)):N.value===`schedule`&&P.value===`calendar`?(n(),o(c,{key:2},[t[25]||=p(`p`,{class:`calendar-note`},`显示每项任务的下次执行时间,按本地时区展示。`,-1),p(`div`,Ie,[(n(!0),o(c,null,i(G.value,e=>(n(),o(`section`,{key:e.key,class:h([`schedule-day`,{today:e.key===z(new Date)}]),"aria-label":e.key},[p(`header`,null,[p(`span`,null,`周`+s(e.weekday),1),p(`h2`,null,s(e.date.getDate()),1)]),(n(!0),o(c,null,i(et(e.key),e=>(n(),o(`button`,{key:e.id,class:`schedule-event`,onClick:t=>Y(e.agentId,e)},[p(`time`,null,s(nt(e.nextAt)),1),p(`strong`,null,s(e.name),1),p(`span`,null,s(K(e.agentId)?.name),1)],8,Re))),128)),et(e.key).length?u(``,!0):(n(),o(`p`,ze,`暂无任务`))],10,Le))),128))])],64)):N.value===`schedule`?(n(),o(`div`,Be,[U.value.length?u(``,!0):(n(),o(`p`,Ve,s(j.value?`没有匹配的任务。`:`还没有自动化任务。点击“新建自动化”安排工作。`),1)),(n(!0),o(c,null,i(U.value,e=>(n(),o(`article`,{key:e.id,class:`automation-card`},[b(S,{name:K(e.agentId)?.name??`Bot`,avatar:K(e.agentId)?.avatar??``,size:32},null,8,[`name`,`avatar`]),p(`button`,{class:`routine-description`,onClick:t=>Y(e.agentId,e)},[p(`h2`,null,s(e.name),1),p(`p`,null,s(K(e.agentId)?.name)+` · `+s(rt(e))+` · `+s(e.schedule.timezone),1),p(`small`,null,s(e.enabled?`下次执行:`+tt(e.nextAt):`已暂停`),1)],8,He),p(`span`,{class:h([`status-pill`,{enabled:e.enabled}])},s(e.enabled?`已启用`:`已暂停`),3),p(`button`,{class:`quiet`,onClick:t=>J(e.id)},`查看日志`,8,Ue)]))),128))])):(n(),o(`div`,We,[F.value?(n(),o(`p`,Ge,[v(`当前任务:`+s(T.value.find(e=>e.id===F.value)?.name??`自动化任务`)+` `,1),p(`button`,{onClick:t[15]||=e=>F.value=``},`显示全部`)])):u(``,!0),W.value.length?u(``,!0):(n(),o(`p`,Ke,`还没有符合条件的运行记录。`)),(n(!0),o(c,null,i(W.value,e=>(n(),o(`details`,{key:e.id,class:`run-card`},[p(`summary`,null,[p(`div`,null,[p(`strong`,null,s(T.value.find(t=>t.id===e.routineId)?.name??`自动化任务`),1),p(`p`,null,s(K(e.agentId)?.name)+` · `+s(tt(e.startedAt))+` · `+s(e.scheduledAt===0?`手动执行`:`定时执行`),1)]),p(`span`,{class:h({failure:e.status===`failed`,success:e.status===`complete`})},s(H[e.status]),3)]),e.error?(n(),o(`p`,qe,s(e.error),1)):(n(),o(`p`,Je,s(e.status===`complete`?`结果已发送到 Bot 聊天。`:`执行进度会自动更新。`),1)),e.conversationId?(n(),d(a,{key:2,to:`/conversations/`+e.conversationId},{default:ee(()=>[...t[26]||=[v(`查看聊天结果 ↗`,-1)]]),_:1},8,[`to`])):u(``,!0)]))),128))]))])]),L.value?(n(),d(ce,{key:L.value,ref_key:`editor`,ref:R,"agent-id":L.value,"editor-only":``,onChanged:Q,onExecuted:J},null,8,[`agent-id`])):u(``,!0)],32)}}}),[[`__scopeId`,`data-v-751789b5`]]);export{C as default};
|
|
2
|
-
//# sourceMappingURL=BotAutomationsView-DPAAYyuy.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i as e,l as t,r as n}from"./WorkspaceShell-Bykfy3AR.js";import{A as r,D as i,F as a,G as ee,H as te,M as ne,W as o,_ as s,at as c,ct as l,d as u,et as d,f as re,g as f,h as p,l as ie,m,n as ae,p as h,s as oe,st as se,t as ce,u as le,v as g,x as _,y as v}from"./_plugin-vue_export-helper-CscYwSBt.js";import{$ as ue,Q as de,Y as y,c as fe,d as pe,l as me,o as he,p as ge,s as _e,u as ve}from"./index-CEqMqiJr.js";import{_ as ye,g as be,i as xe,n as Se,p as Ce,t as we,v as Te}from"./viewModels-DfaKvI0x.js";import{_ as Ee,g as b,h as De,m as Oe,t as ke}from"./FloatingResourceSearch-Bg5rUZMy.js";import{a as Ae,i as je,n as Me,r as Ne,t as x}from"./sessionOwnership-DMfBRINe.js";import{t as Pe}from"./WorkspaceView-Cco3Umfn.js";var S=`hermes-yaoyao:pending-composer-item`;async function C(e){let t=e.downloadUrl||e.previewUrl;if(!t||!e.name)return null;try{let n=await fetch(t,{credentials:`same-origin`});if(!n.ok)throw Error(`下载文件失败(${n.status})`);let r=await n.blob();return new File([r],e.name,{type:e.mimeType||r.type||`application/octet-stream`})}catch{return null}}async function Fe(){let e=sessionStorage.getItem(S);if(!e)return null;sessionStorage.removeItem(S);try{let t=JSON.parse(e);return await C({name:t.name,downloadUrl:t.url,mimeType:t.mimeType})}catch{return null}}var Ie={class:`chat-workspace`},Le={key:0,class:`chat-error`,role:`alert`},Re=[`disabled`],w=ce(_({__name:`ChatView`,setup(ce){let _=ge(),S=he(),w=de(),T=ue(),E=d(null),D=d(null),O=d(null),k=d(null),A=d(!1),j=d(!1),M=d(!1),N=d(!1),P=d(!1),F=d(``),I=d(!1),L=d(``),R=d({x:8,y:8}),z=d(null),B=d(null),ze=d(null),V=d(``);function Be(t){let n=e(t);n&&n===_.activeProfile?.name&&S.loadModels(n).catch(()=>void 0)}let Ve=h(()=>[...S.sessions].filter(x)),He=h(()=>new Map(_.profiles.map(e=>[e.name,e.agentName||e.displayName||e.name]))),Ue=h(()=>Object.fromEntries(_.profiles.flatMap(e=>e.agentAvatar?[[e.name,e.agentAvatar]]:[]))),We=h(()=>Ve.value.map(e=>xe(e,S.unreadCounts[e.id]??0,He.value.get(e.profile||_.activeProfile?.name||``)))),H=h(()=>Se(S.messages,e=>e?He.value.get(e):void 0)),Ge=h(()=>S.contextUsage?.contextTokens||S.contextUsage?.totalTokens||(W.value?.inputTokens??0)+(W.value?.outputTokens??0)),Ke=h(()=>Me(S.messages)),U=h(()=>Ge.value||Ke.value),qe=h(()=>!Ge.value&&U.value>0),Je=h(()=>Oe(H.value)),Ye=h(()=>Je.value.map(e=>({url:e.previewUrl||e.downloadUrl||``,name:e.name,type:e.kind})).filter(e=>e.url)),W=h(()=>S.activeSession),G=h(()=>S.sessions.find(e=>e.id===F.value)),Xe=h(()=>[`connected`,`ready`].includes(S.connectionState)),K=h(()=>we(S.pendingApproval,S.pendingClarification)),Ze=h(()=>E.value?{id:E.value.id,content:E.value.content,author:E.value.author}:null),Qe=h(()=>{let e=W.value?.parentSessionId;return e?S.sessions.find(t=>t.id===e&&t.profile===W.value?.profile)?.title||e:``}),$e=h(()=>S.selectedModel?me(S.selectedModel):``),et=[{id:``,label:`默认`,description:`使用模型或 Profile 的默认强度`},{id:`none`,label:`关闭`,description:`不使用额外推理`},{id:`low`,label:`低`,description:`更快的轻量推理`},{id:`medium`,label:`中`,description:`速度与深度平衡`},{id:`high`,label:`高`,description:`更深入地分析复杂问题`},{id:`xhigh`,label:`极高`,description:`适用于最复杂的任务`}],tt=h(()=>et.map(e=>({id:e.id,label:e.label,detail:e.description}))),nt=h(()=>et.find(e=>e.id===(S.reasoningEffort||``))?.label||`默认`),rt=h(()=>({left:`${R.value.x}px`,top:`${R.value.y}px`}));function q(){let e=typeof w.query.profile==`string`?w.query.profile:``;return _.profiles.some(t=>t.name===e)?e:``}function J(e,t){return{path:`/chat/${encodeURIComponent(e)}`,query:{profile:t}}}async function it(e){for(let t of _.profiles)try{if((await pe(e,t.name)).id===e)return t.name}catch{}return _.activeProfile?.name||``}async function at(e){!e||_.activeProfile?.name===e||(S.switchProfile(e),V.value=e,_.selectProfile(e),await i())}async function ot(){let e=typeof w.params.sessionId==`string`?w.params.sessionId:``,t=q()||(e?await it(e):_.activeProfile?.name||``);if(t&&_.activeProfile?.name!==t&&(e&&await T.replace(J(e,t)),await at(t)),await S.loadSessions(t,`chat`),e){let n=await pe(e,t).catch(()=>void 0);if(n&&!x(n)){await T.replace({path:`/history/${encodeURIComponent(e)}`,query:{profile:t}});return}}e&&S.activeSessionId!==e&&await S.selectSession(e,t),e&&t&&q()!==t&&await T.replace(J(e,t)),S.loadUnread(t).catch(()=>void 0),!e&&S.activeSession&&!x(S.activeSession)&&S.clearSelection()}async function Y(e){A.value=!1,D.value=null;let t=S.sessions.find(t=>t.id===e)?.profile||_.activeProfile?.name||`default`;await T.push(J(e,t)),await at(t),S.activeProfileName!==t&&await S.loadSessions(t,`chat`),await S.selectSession(e,t),await S.markRead(e,t).catch(()=>void 0),E.value=null}async function st(){A.value=!1,D.value=null;let e=S.createSession(_.activeProfile?.name);await T.push(J(e,_.activeProfile?.name||`default`))}async function ct(e){try{await S.send(e.text,e.files,P.value?`queue`:S.isStreaming?`steer`:`submit`),z.value?.clearAfterSend()}catch{}}function lt(e){let t=b(e.name,e.url||``,e.id,e.kind);t.size=e.size,t.kind===`image`||t.kind===`video`?ut(t):(A.value=!1,D.value=null,O.value=t)}function ut(e){let t=De(e.previewUrl||e.downloadUrl||``),n=Ye.value.findIndex(e=>De(e.url)===t);k.value=n>=0?n:null}function dt({name:e,url:t}){let n=b(e,t);n.kind===`image`||n.kind===`video`?ut(n):(A.value=!1,O.value=n)}async function X(e){let t=await C(e);!t||!z.value||(z.value.attachFiles([t]),D.value=null,O.value=null,k.value=null,await i(),z.value?.focus())}async function ft(e){await X(b(e.name,e.url,`preview:${e.url}`,e.type))}async function pt(e){if(e===$e.value){j.value=!1;return}let t=ve(S.models,e);if(!(!t||M.value)){M.value=!0;try{await S.setModel(t),j.value=!1}finally{M.value=!1}}}function mt(e){S.reasoningEffort=e||void 0}async function ht(e){try{await S.setFastMode(e)}catch{}}function gt(e=_.activeProfile?.name||`default`){N.value=_e(_.user?.id??`local`,e)}function _t(){N.value=!N.value,fe(_.user?.id??`local`,_.activeProfile?.name||`default`,N.value)}function Z(e,t){F.value=e;let n=S.sessions.find(t=>t.id===e);L.value=n?.title||``,I.value=!1;let r=t?.currentTarget instanceof HTMLElement?t.currentTarget.getBoundingClientRect():null,i=t?.type===`contextmenu`?t.clientX:r?r.right-208:window.innerWidth-208-14,a=t?.type===`contextmenu`?t.clientY:r?r.bottom+5:46;R.value={x:Math.max(8,Math.min(i,window.innerWidth-208-8)),y:Math.max(8,Math.min(a,window.innerHeight-210-8))}}function Q(){F.value=``,I.value=!1}async function vt(){Q();try{await S.forceRefreshHistory()}catch{}}function yt(e){!F.value||e.target.closest(`.session-actions`)||Q()}function bt(e){e.key===`Escape`&&F.value&&Q()}async function xt(){let e=S.sessions.find(e=>e.id===F.value);!e||!L.value.trim()||(await S.renameSession(e.id,L.value.trim(),e.profile),Q())}async function St(){let e=G.value;e&&(await S.setSessionPinned(e.id,!e.pinned,e.profile),Q())}async function Ct(){let e=G.value;e&&(Q(),(e.id!==S.activeSessionId||e.profile!==S.activeProfileName)&&await Y(e.id),D.value=null,A.value=!0)}function $(){let e=A.value;D.value=null,A.value=!1,e&&i(()=>ze.value?.focus())}function wt(e){B.value?.scrollToAnchor(e.messageId,e.anchorId),window.matchMedia(`(max-width: 900px)`).matches&&$()}async function Tt(){let e=S.sessions.find(e=>e.id===F.value);e&&(await S.removeSession(e.id,e.profile),Q(),w.params.sessionId===e.id&&await T.replace(`/chat`))}async function Et(){let e=await S.branchSession();e&&await T.push(J(e,S.activeProfileName||_.activeProfile?.name||`default`))}async function Dt(){let e=typeof w.query.message==`string`?w.query.message:``;if(e){await i();for(let t=0;t<10;t+=1){if(B.value?.scrollToMessage(e)||!S.hasMoreBefore)return;await S.loadOlder(),await i()}}}return ne(async()=>{gt(),document.addEventListener(`pointerdown`,yt),document.addEventListener(`keydown`,bt),window.addEventListener(n,Be),await ot(),await Promise.allSettled([S.loadModels(_.activeProfile?.name),S.connect()]),S.refreshActiveSessionModel().catch(()=>void 0),await Dt();let e=await Fe();e&&z.value?.attachFiles([e])}),r(()=>{document.removeEventListener(`pointerdown`,yt),document.removeEventListener(`keydown`,bt),window.removeEventListener(n,Be)}),te(()=>_.activeProfile?.name,async(e,t)=>{if(!e||e===t)return;if(gt(e),A.value=!1,D.value=null,V.value===e){V.value=``;return}S.switchProfile(e);let n=typeof w.params.sessionId==`string`?w.params.sessionId:``;if(n&&q()===e){await Promise.allSettled([S.loadSessions(e,`chat`),S.loadModels(e),S.loadUnread(e),S.connect()]),await S.selectSession(n,e);return}await T.replace({path:`/chat`,query:{profile:e}}),await Promise.allSettled([S.loadSessions(e,`chat`),S.loadModels(e),S.loadUnread(e),S.connect()])}),te(()=>S.activeSessionId,async e=>{let t=S.activeProfileName||_.activeProfile?.name||``;e&&S.refreshActiveSessionModel().catch(()=>void 0),!(!e||w.params.sessionId===e&&q()===t)&&await T.replace(J(e,t))}),(e,n)=>(a(),s(u,null,[v(Pe,{"sidebar-title":`对话`,"sidebar-subtitle":`${Ve.value.length} 个会话`,"inspector-open":!!D.value||A.value,"inspector-close-label":A.value?`关闭会话大纲`:`关闭预览`,onCloseInspector:$},{"sidebar-action":o(()=>[m(`button`,{class:`sidebar-primary-action`,type:`button`,title:`新建聊天`,"aria-label":`新建聊天`,onClick:st},[v(t,{name:`add`}),n[17]||=m(`span`,null,`新建聊天`,-1)])]),sidebar:o(()=>[v(Ce,{items:We.value,"active-id":c(S).activeSessionId,loading:c(S).isLoading,"external-search":``,"single-line":``,"has-more":c(S).hasMoreSessions,"loading-more":c(S).isLoadingMoreSessions,"search-placeholder":`搜索会话`,"empty-title":`还没有会话`,"empty-description":`新建会话后,从输入框开始聊天。`,onLoadMore:n[0]||=e=>c(S).loadMoreSessions(c(_).activeProfile?.name),onSelect:Y,onMore:Z,onContextMenu:Z},null,8,[`items`,`active-id`,`loading`,`has-more`,`loading-more`])]),inspector:o(()=>[A.value?(a(),p(Ne,{key:0,messages:H.value,"has-older":c(S).hasMoreBefore,onNavigate:wt},null,8,[`messages`,`has-older`])):D.value?(a(),p(Te,{key:1,item:D.value,onClose:n[8]||=e=>D.value=null,onAddToComposer:X},null,8,[`item`])):f(``,!0)]),default:o(()=>[m(`div`,Ie,[v(je,{ref_key:`timeline`,ref:B,messages:H.value,title:W.value?.title||`新会话`,subtitle:W.value?`${W.value.profile||c(_).activeProfile?.name||``} · ${W.value.model||c(S).selectedModel?.name||`默认模型`}`:`选择会话或直接开始输入`,loading:c(S).activeRouteState?.isLoadingHistory,"loading-older":c(S).activeRouteState?.isLoadingHistory,"has-older":c(S).hasMoreBefore,connected:Xe.value,synced:c(S).historySynced,"show-tools":N.value,thinking:c(S).isSending||c(S).isStreaming,"show-assistant-identity":!1,"agent-avatars":Ue.value,interaction:K.value,"empty-logo":``,"transparent-header":``,"fork-source-title":Qe.value,onLoadOlder:c(S).loadOlder,onQuote:n[2]||=e=>E.value=e,onBranch:Et,onPreview:lt,onPreviewFile:dt,onApprove:n[3]||=e=>K.value&&c(S).respondToApproval(K.value.id,e),onClarify:n[4]||=e=>K.value&&c(S).respondToClarification(K.value.id,e)},{"header-actions":o(()=>[W.value?(a(),s(`button`,{key:0,ref_key:`headerSessionMenuButton`,ref:ze,class:`icon-button header-session-menu`,type:`button`,title:`会话操作`,"aria-label":`会话操作`,onClick:n[1]||=e=>Z(W.value.id,e)},[v(y,{name:`dots`,size:18})],512)):f(``,!0)]),_:1},8,[`messages`,`title`,`subtitle`,`loading`,`loading-older`,`has-older`,`connected`,`synced`,`show-tools`,`thinking`,`agent-avatars`,`interaction`,`fork-source-title`,`onLoadOlder`]),c(S).error?(a(),s(`p`,Le,[v(y,{name:`alert`,size:13}),g(l(c(S).error),1)])):f(``,!0),v(Ee,{ref_key:`composer`,ref:z,mode:`chat`,"draft-key":`${c(_).user?.id||`local`}:${c(_).activeProfile?.name||`default`}:${c(S).activeSessionId||`new`}`,disabled:c(S).connectionState===`failed`,streaming:c(S).isStreaming,sending:c(S).isSending,"model-label":c(S).selectedModel?.name||`选择模型`,"fast-mode":c(S).fastMode,"fast-mode-disabled":!c(S).activeSessionId,"reasoning-effort":nt.value,"reasoning-value":c(S).reasoningEffort||``,"reasoning-options":tt.value,"context-used":U.value,"context-limit":c(S).contextUsage?.contextLimit||262144,"context-estimated":qe.value,"queue-mode":P.value||c(S).isQueued,"tool-trace-visible":N.value,reference:Ze.value,"slash-commands":[{id:`fork`,label:`fork`,detail:`从当前会话创建分支`},{id:`compact`,label:`compact`,detail:`压缩当前会话上下文`},{id:`model`,label:`model`,detail:`切换模型`}],onSend:ct,onStop:c(S).interrupt,onModelClick:n[5]||=e=>j.value=!0,onFastModeToggle:ht,onReasoningChange:mt,onSettingsClick:_t,onQueueToggle:n[6]||=e=>P.value=!P.value,onClearReference:n[7]||=e=>E.value=null},null,8,[`draft-key`,`disabled`,`streaming`,`sending`,`model-label`,`fast-mode`,`fast-mode-disabled`,`reasoning-effort`,`reasoning-value`,`reasoning-options`,`context-used`,`context-limit`,`context-estimated`,`queue-mode`,`tool-trace-visible`,`reference`,`onStop`])])]),_:1},8,[`sidebar-subtitle`,`inspector-open`,`inspector-close-label`]),v(ke,{section:`chat`,label:`搜索会话`,items:We.value,onSelect:Y},null,8,[`items`]),O.value?(a(),p(ye,{key:0,item:O.value,items:Je.value,onClose:n[9]||=e=>O.value=null,onAddToComposer:X,onSource:n[10]||=e=>O.value=null},null,8,[`item`,`items`])):f(``,!0),v(be,{modelValue:k.value,"onUpdate:modelValue":n[11]||=e=>k.value=e,images:Ye.value,onAdd:ft},null,8,[`modelValue`,`images`]),v(Ae,{open:j.value,options:c(S).models,"selected-id":$e.value,busy:M.value,onClose:n[12]||=e=>j.value=!1,onSelect:pt},null,8,[`open`,`options`,`selected-id`,`busy`]),(a(),p(re,{to:`body`},[v(ae,{name:`session-menu`},{default:o(()=>[F.value?(a(),s(`section`,{key:0,class:`session-actions`,style:se(rt.value),role:`menu`,"aria-label":`会话操作`,onContextmenu:n[16]||=le(()=>{},[`prevent`])},[I.value?(a(),s(u,{key:0},[m(`label`,null,[n[18]||=g(`会话名称`,-1),ee(m(`input`,{"onUpdate:modelValue":n[13]||=e=>L.value=e,maxlength:`120`,autofocus:``,onKeydown:ie(xt,[`enter`])},null,544),[[oe,L.value]])]),m(`div`,null,[m(`button`,{class:`quiet-button`,type:`button`,onClick:n[14]||=e=>I.value=!1},`取消`),m(`button`,{class:`solid-button`,type:`button`,onClick:xt},`保存`)])],64)):(a(),s(u,{key:1},[m(`button`,{class:`action-row`,role:`menuitem`,type:`button`,onClick:Ct},[v(y,{name:`menu`,size:14}),n[19]||=g(`会话大纲`,-1)]),F.value===c(S).activeSessionId?(a(),s(`button`,{key:0,class:`action-row`,role:`menuitem`,type:`button`,disabled:c(S).isStreaming||c(S).isQueued||c(S).isSending||c(S).activeRouteState?.isLoadingHistory,onClick:vt},[v(y,{name:`refresh`,size:14}),n[20]||=g(`强制刷新历史`,-1)],8,Re)):f(``,!0),m(`button`,{class:`action-row`,role:`menuitem`,type:`button`,onClick:St},[v(y,{name:G.value?.pinned?`pin-off`:`pin`,size:14},null,8,[`name`]),g(l(G.value?.pinned?`取消置顶`:`置顶会话`),1)]),m(`button`,{class:`action-row`,role:`menuitem`,type:`button`,onClick:n[15]||=e=>I.value=!0},[v(y,{name:`edit`,size:14}),n[21]||=g(`重命名`,-1)]),m(`button`,{class:`action-row danger`,role:`menuitem`,type:`button`,onClick:Tt},[v(y,{name:`trash`,size:14}),n[22]||=g(`删除会话`,-1)])],64))],36)):f(``,!0)]),_:1})]))],64))}}),[[`__scopeId`,`data-v-7a0e9150`]]);export{w as default};
|
|
2
|
-
//# sourceMappingURL=ChatView-BNqHa6Ma.js.map
|