@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
package/dist/index.html
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-touch-icon.png" />
|
|
10
10
|
<link rel="manifest" href="/manifest.webmanifest" />
|
|
11
11
|
<title>夭夭</title>
|
|
12
|
-
<script type="module" crossorigin src="/assets/index-
|
|
12
|
+
<script type="module" crossorigin src="/assets/index-CWamgtSb.js"></script>
|
|
13
13
|
<link rel="modulepreload" crossorigin href="/assets/_plugin-vue_export-helper-CscYwSBt.js">
|
|
14
14
|
<link rel="stylesheet" crossorigin href="/assets/index-g5POnMkp.css">
|
|
15
15
|
</head>
|
|
@@ -18,7 +18,7 @@ import { assertRunnerHermes } from './config.js';
|
|
|
18
18
|
import { RunnerBrowser } from './managedBrowser.js';
|
|
19
19
|
import { BrowserRuntimeError } from './browser/types.js';
|
|
20
20
|
import { LoopbackTransport, isLocalAuthorizationTarget } from '../server/loopbackAuthorization.js';
|
|
21
|
-
const commands = new Set(['session.create', 'session.resume', 'session.close', 'session.usage', 'session.interrupt', 'session.cwd.set', 'prompt.submit', 'session.steer', 'image.attach_bytes', 'file.attach', 'approval.respond', 'clarify.respond']);
|
|
21
|
+
const commands = new Set(['session.create', 'session.resume', 'session.close', 'session.usage', 'session.interrupt', 'session.active_list', 'session.cwd.set', 'prompt.submit', 'session.steer', 'image.attach_bytes', 'file.attach', 'approval.respond', 'clarify.respond']);
|
|
22
22
|
export class RunnerAgent {
|
|
23
23
|
config;
|
|
24
24
|
fetchImpl;
|
|
@@ -76,8 +76,8 @@ export class RunnerAgent {
|
|
|
76
76
|
url.hostname = '127.0.0.1';
|
|
77
77
|
const toolId = body && typeof body === 'object' && 'toolId' in body ? body.toolId : undefined;
|
|
78
78
|
const response = await (isLocalAuthorizationTarget(url) && this.fetchImpl === fetch ? this.controlTransport.fetch.bind(this.controlTransport) : this.fetchImpl)(url, {
|
|
79
|
-
method: body === undefined ? 'GET' : 'POST', redirect: 'error', signal: AbortSignal.any([this.controlAbort.signal, AbortSignal.timeout(path === 'desktop' ? 75000 : path === 'tool' && typeof toolId === 'string' && toolId.startsWith('managed_browser_') ? 600000 : 25000)]),
|
|
80
|
-
headers: { Authorization: `Bearer ${this.config.token}`, 'x-runner-instance': this.instance, 'x-runner-protocol': '1', 'x-runner-features': (this.computers ? 'execution-context-v1,vm-egress-v1,workspace-memory-bind-v1,hermes-computer-v2,profile-computer-v1,host-computer-tools-v1,file-transfer-v1,idle-stop-policy-v1,computer-worker-v1,artifact-chunks-v1,computer-control-v1,shared-computer-v1,local-vm-v1' + (this.computers.provider.fixedCapacity ? ',compose-desktops-v1' : ',helper-retirement-v1,image-options-v1') + (this.computers.config.imageId !== UNCONFIGURED_COMPUTER_IMAGE ? ',image-ready-v1' : '') : 'execution-context-v1,workspace-memory-bind-v1') + (this.browsers ? ',managed-browser-setup-v1,managed-browser-retention-v1' : ',managed-browser-disabled-v1') + (this.browsers?.available ? ',managed-browser-v1' : ''), ...(this.serverEpoch ? { 'x-runner-epoch': this.serverEpoch } : {}), 'Content-Type': 'application/json', ...(path === 'poll' && !this.connected ? { 'x-runner-reset': '1' } : {}) },
|
|
79
|
+
method: body === undefined ? 'GET' : 'POST', redirect: 'error', signal: AbortSignal.any([this.controlAbort.signal, AbortSignal.timeout(path === 'desktop' ? 75000 : path === 'tool' && typeof toolId === 'string' && (toolId.startsWith('managed_browser_') || toolId.startsWith('credential_')) ? 600000 : 25000)]),
|
|
80
|
+
headers: { Authorization: `Bearer ${this.config.token}`, 'x-runner-instance': this.instance, 'x-runner-protocol': '1', 'x-runner-features': (this.computers ? 'execution-context-v1,vm-egress-v1,workspace-memory-bind-v1,hermes-computer-v2,profile-computer-v1,host-computer-tools-v1,file-transfer-v1,idle-stop-policy-v1,computer-worker-v1,artifact-chunks-v1,computer-control-v1,shared-computer-v1,local-vm-v1' + (this.computers.provider.fixedCapacity ? ',compose-desktops-v1' : ',helper-retirement-v1,image-options-v1') + (this.computers.config.imageId !== UNCONFIGURED_COMPUTER_IMAGE ? ',image-ready-v1' : '') : 'execution-context-v1,workspace-memory-bind-v1') + (this.browsers ? ',managed-browser-setup-v1,managed-browser-retention-v1' : ',managed-browser-disabled-v1') + (this.browsers?.available ? ',managed-browser-v1' : '') + ',credential-ref-v1', ...(this.serverEpoch ? { 'x-runner-epoch': this.serverEpoch } : {}), 'Content-Type': 'application/json', ...(path === 'poll' && !this.connected ? { 'x-runner-reset': '1' } : {}) },
|
|
81
81
|
...(body === undefined ? {} : { body: JSON.stringify(body) }),
|
|
82
82
|
});
|
|
83
83
|
if (!response.ok) {
|
|
@@ -376,8 +376,19 @@ export class RunnerAgent {
|
|
|
376
376
|
const computerCommand = method === 'computer.invoke' || method === 'computer.transfer' || method === 'computer.complete';
|
|
377
377
|
if (!connection || (!commands.has(method) && !(computerCommand && connection.gateway instanceof ComputerGateway)) || !params || typeof params !== 'object')
|
|
378
378
|
throw new HttpError(403, '执行通道或命令无效', 'runner_command_forbidden');
|
|
379
|
-
if (connection.cleanupOnly && !['session.resume', 'session.interrupt', 'session.close'].includes(method))
|
|
379
|
+
if (connection.cleanupOnly && !['session.resume', 'session.interrupt', 'session.close', 'session.active_list'].includes(method))
|
|
380
380
|
throw new HttpError(403, '清理通道不允许执行新工作', 'runner_cleanup_forbidden');
|
|
381
|
+
if (method === 'session.active_list') {
|
|
382
|
+
const id = String(params.current_session_id ?? ''), profile = connection.sessions.get(id);
|
|
383
|
+
if (!profile || params.profile !== profile || Object.keys(params).some(key => !['profile', 'current_session_id'].includes(key)))
|
|
384
|
+
throw new HttpError(403, '停止状态查询不属于这个通道', 'runner_session_forbidden');
|
|
385
|
+
if (connection.gateway instanceof ComputerGateway)
|
|
386
|
+
throw new HttpError(409, '电脑通道使用独立停止确认', 'computer_method_unavailable');
|
|
387
|
+
const state = await connection.gateway.rpc(method, { profile, current_session_id: id });
|
|
388
|
+
if (!Array.isArray(state?.sessions))
|
|
389
|
+
throw new HttpError(502, 'Hermes 停止状态无效', 'session_stop_unconfirmed');
|
|
390
|
+
return { sessions: state.sessions.filter((item) => item.id === id).map((item) => ({ id: item.id, status: item.status })) };
|
|
391
|
+
}
|
|
381
392
|
if (method === 'session.create' || method === 'session.resume') {
|
|
382
393
|
if (!connection.cleanupOnly)
|
|
383
394
|
this.requireProfile(params.profile);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 夭夭 Bot 的 Hermes 工具桥
|
|
2
2
|
|
|
3
|
-
这是运行在 Hermes 内的用户插件,版本 1.
|
|
3
|
+
这是运行在 Hermes 内的用户插件,版本 1.3.1。它连接 Yaoyao 每轮授权的电脑、团队和应用工具。随附安装器还提供有备份的 Hermes Profile 模型兼容修复。
|
|
4
4
|
|
|
5
5
|
## Hermes 托管虚拟机会话
|
|
6
6
|
|
|
@@ -44,7 +44,7 @@ Runner 包内可直接运行同目录的 `install-hermes-bridge.py`。安装器
|
|
|
44
44
|
|
|
45
45
|
前缀:`/api/plugins/yaoyao-bot-bridge`。
|
|
46
46
|
|
|
47
|
-
- `GET /capabilities?profile=...`:检查对应 Profile 及托管能力。
|
|
47
|
+
- `GET /capabilities?profile=...`:检查对应 Profile 及托管能力。1.3.1 起可选的 `runtime_environment` 返回版本 1 的 Hermes 进程系统信息及对应 Profile 的原生终端、文件、桌面和浏览器工具名称;按完整目录采集,包含延迟发现的工具,不执行工具或探测其后端。进程系统信息不代表 SSH、容器或桌面工具的实际目标,不返回配置、凭据或客户端路径。
|
|
48
48
|
- `GET /model-options?profile=...`:读取 Profile 的模型目录、默认值、思考能力与速度能力;只返回公开配置,不返回凭据。
|
|
49
49
|
- `POST /model-settings/resolve`:接收 `profile` 与 `settings`,通过 Hermes 原生解析器校验完整组合,返回版本 1 的有效配置和模型确认提示;不写 Profile 配置。
|
|
50
50
|
- 模型目录与配置解析均使用 Hermes 原生配置作用域,同时绑定 Profile 目录和凭据;多 Profile Dashboard 不会因缺少凭据作用域而报错,也不会借用其他 Profile 的环境变量。默认 Profile 保留 Hermes 自身的启动凭据规则。
|
|
@@ -99,4 +99,6 @@ CLI 增加 `--check` 可只读检查默认及命名 Profile;`--enable` 明确
|
|
|
99
99
|
|
|
100
100
|
1.3.0 增加 Bot 个人资料的模型设置协议(`model_settings_version: 1`)。模型与 Provider 成对选择,思考等级和 `normal / fast / auto / cold` 速度可分别继承。Web 服务在每轮提交前解析配置,并通过原生 `config.set` 按模型、思考、速度的顺序应用到当前 Bot 会话;保存资料不修改 Profile 默认值,也不打断正在运行的回复。恢复中的原轮次只继续追踪,不重新设置或提交。模型目录未声明具体等级时返回 `reasoningKnown: false`;快速能力同时检查模型和 Provider 路由。
|
|
101
101
|
|
|
102
|
+
1.3.1 增加上述 Hermes 环境快照。Bot 的服务端连接状态取自本轮 Hermes 会话,客户端电脑清单仅表示 `desktop_*` 控制通道。服务器未打开客户端或客户端退出时,Hermes 原生能力不因此被标记离线;非回环地址也不会隐藏 Hermes 运行环境。旧工具桥没有快照时保持聊天与原生工具兼容,系统与目录信息显示未知。更新工具桥后需要重启 Hermes 才能加载新快照协议。
|
|
103
|
+
|
|
102
104
|
发布时先更新工具桥与 Web 服务,在空闲时重启 Hermes Dashboard,再发布 Web/桌面端、iOS 和 Android 客户端。旧桥不能编辑新增设置,会明确提示升级;未设置 `modelSettings` 的旧 Bot 继续按原有继承路径运行。原生会话配置回执不兼容、模型无效或应用失败会停止本轮,不使用旧配置继续运行。
|
|
@@ -13,6 +13,7 @@ import json
|
|
|
13
13
|
import math
|
|
14
14
|
import mimetypes
|
|
15
15
|
import os
|
|
16
|
+
import platform
|
|
16
17
|
import re
|
|
17
18
|
import sys
|
|
18
19
|
import threading
|
|
@@ -28,7 +29,7 @@ from pathlib import Path
|
|
|
28
29
|
from typing import Any
|
|
29
30
|
|
|
30
31
|
VERSION = 1
|
|
31
|
-
PLUGIN_VERSION = "1.3.
|
|
32
|
+
PLUGIN_VERSION = "1.3.1"
|
|
32
33
|
def _plugin_fingerprint():
|
|
33
34
|
root = Path(__file__).parent
|
|
34
35
|
digest = hashlib.sha256()
|
|
@@ -351,6 +352,23 @@ def _transport_identity(transport) -> tuple[str, str]:
|
|
|
351
352
|
return "local-session-token", "dashboard"
|
|
352
353
|
|
|
353
354
|
|
|
355
|
+
def _runtime_environment(profile: str, definitions: list) -> dict:
|
|
356
|
+
# Only directory facts: never execute tools, probe desktops, or expose config
|
|
357
|
+
# credentials. Process metadata does not identify an SSH/container/UI backend.
|
|
358
|
+
names = {tool.get("function", {}).get("name") for tool in definitions if isinstance(tool, dict)}
|
|
359
|
+
names = {name for name in names if isinstance(name, str) and re.fullmatch(r"[A-Za-z0-9_.:-]{1,128}", name)}
|
|
360
|
+
return {
|
|
361
|
+
"version": 1, "profile": profile, "platform": sys.platform,
|
|
362
|
+
"osRelease": platform.release(), "arch": platform.machine(),
|
|
363
|
+
"nativeTools": {
|
|
364
|
+
"terminal": sorted(names & {"terminal", "process", "process_manage", "execute_code", "code_execution"}),
|
|
365
|
+
"files": sorted(names & {"read_file", "write_file", "patch", "search_files"}),
|
|
366
|
+
"desktop": sorted(names & {"computer_use", "desktop_project"}),
|
|
367
|
+
"browser": sorted(name for name in names if name.startswith("browser_")),
|
|
368
|
+
},
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
|
|
354
372
|
def capabilities(profile: str = "default") -> dict:
|
|
355
373
|
in_process = False
|
|
356
374
|
try:
|
|
@@ -386,7 +404,8 @@ def capabilities(profile: str = "default") -> dict:
|
|
|
386
404
|
return {"version": VERSION, "ready": True, "in_process": True, "profile": profile, "native_tools": True,
|
|
387
405
|
"computer_runtime_version": 2, "execution_policy_version": 1, "plugin_version": PLUGIN_VERSION, "plugin_fingerprint": PLUGIN_FINGERPRINT,
|
|
388
406
|
"memory_isolation": True, "memory_isolation_transport": "bridge-bind-v1", "memory_extraction": True,
|
|
389
|
-
"isolated_context_files": True, "skill_learning": True, "model_settings_version": 1, "file_transfer_version": 1
|
|
407
|
+
"isolated_context_files": True, "skill_learning": True, "model_settings_version": 1, "file_transfer_version": 1,
|
|
408
|
+
"runtime_environment": _runtime_environment(profile, definitions)}
|
|
390
409
|
finally:
|
|
391
410
|
reset_hermes_home_override(context)
|
|
392
411
|
except Exception as exc:
|
|
@@ -131,7 +131,12 @@ export class ComputerRuntime {
|
|
|
131
131
|
if (!gateways.size)
|
|
132
132
|
this.gateways.delete(gateway.meta.environmentId);
|
|
133
133
|
} }
|
|
134
|
-
activeGateways(environmentId) {
|
|
134
|
+
activeGateways(environmentId) {
|
|
135
|
+
if (this.stopPending(environmentId))
|
|
136
|
+
throw new HttpError(409, '原电脑执行尚未确认停止,不能接管或复用', 'computer_stopping');
|
|
137
|
+
return [...(this.gateways.get(environmentId) ?? [])].filter(gateway => gateway.active || gateway.paused);
|
|
138
|
+
}
|
|
139
|
+
stopPending(environmentId) { return this.db.prepare('SELECT value FROM computer_sessions').all().some(row => { const session = JSON.parse(row.value); return session.environmentId === environmentId && session.stopPending === true; }); }
|
|
135
140
|
/** One guest proxy per environment, shared by every holder; the guest
|
|
136
141
|
* reserves port 3128, so concurrent holders must never start their own. */
|
|
137
142
|
acquireProxy(spec, authorize) {
|
|
@@ -380,7 +385,10 @@ export class ComputerGateway {
|
|
|
380
385
|
return { status: 'interrupted' };
|
|
381
386
|
}
|
|
382
387
|
if ((method === 'session.interrupt' || method === 'session.close') && params.session_id === this.recoverySession?.id) {
|
|
388
|
+
await this.profileSession?.stop();
|
|
383
389
|
await this.runtime.pool.stopHolder(this.meta.ownerKey, this.meta.environmentId, this.workId);
|
|
390
|
+
this.recoverySession.stopPending = false;
|
|
391
|
+
this.runtime.save(this.recoverySession);
|
|
384
392
|
return { status: 'interrupted' };
|
|
385
393
|
}
|
|
386
394
|
this.guard();
|
|
@@ -391,6 +399,8 @@ export class ComputerGateway {
|
|
|
391
399
|
if (method === 'session.resume' && params.recoverOnly === true) {
|
|
392
400
|
const session = this.runtime.session(String(params.session_id), this.meta, String(params.profile));
|
|
393
401
|
this.recoverySession = session;
|
|
402
|
+
session.stopPending = true;
|
|
403
|
+
this.runtime.save(session);
|
|
394
404
|
if (session.profileSessionId) {
|
|
395
405
|
await this.openProfile(session, params);
|
|
396
406
|
await this.profileSession.stop();
|
|
@@ -398,8 +408,12 @@ export class ComputerGateway {
|
|
|
398
408
|
const resource = this.runtime.pool.status(this.meta.ownerKey).find(item => item.environmentId === this.meta.environmentId);
|
|
399
409
|
if (resource?.holderIds.includes(this.workId))
|
|
400
410
|
await this.runtime.pool.stopHolder(this.meta.ownerKey, this.meta.environmentId, this.workId);
|
|
411
|
+
session.stopPending = false;
|
|
412
|
+
this.runtime.save(session);
|
|
401
413
|
return { session_id: session.id, stored_session_id: session.id, running: false, info: { profile_name: session.profile } };
|
|
402
414
|
}
|
|
415
|
+
if (this.runtime.stopPending(this.meta.environmentId))
|
|
416
|
+
throw new HttpError(409, '原电脑执行尚未确认停止,不能复用', 'computer_stopping');
|
|
403
417
|
const profile = String(params.profile), resolved = this.hermesManaged ? { cwd: this.runtime.pool.definition(this.meta.ownerKey, this.meta.environmentId)?.cwd ?? COMPUTER_WORKSPACE, configuredCwd: '.' } : await (this.meta.profileSession ? this.runtime.resolveWorkspace(profile, this.controller.signal) : this.runtime.resolve(profile, this.controller.signal));
|
|
404
418
|
if (this.meta.hostAccess) {
|
|
405
419
|
const configured = String(resolved.configuredCwd ?? '.');
|
|
@@ -646,8 +660,12 @@ export class ComputerGateway {
|
|
|
646
660
|
throw new HttpError(409, '请先在应用设置的本地虚拟机页面完成准备', 'computer_image_required');
|
|
647
661
|
await this.runtime.pool.configure(this.spec(live.session), () => this.guard());
|
|
648
662
|
await this.authorized();
|
|
649
|
-
|
|
650
|
-
|
|
663
|
+
// Tool cancellation must not discard the reservation before native Hermes
|
|
664
|
+
// termination is confirmed. Only this existing holder may renew for cleanup.
|
|
665
|
+
const leaseController = new AbortController();
|
|
666
|
+
live.leaseController = leaseController;
|
|
667
|
+
const lease = await this.runtime.pool.acquire(this.spec(live.session), this.workId, () => { if (live.session.stopPending && !live.releasing)
|
|
668
|
+
return; this.guard(); }, leaseController.signal);
|
|
651
669
|
if (this.closed) {
|
|
652
670
|
await this.runtime.pool.release(lease);
|
|
653
671
|
throw new Error('电脑通道已关闭');
|
|
@@ -665,7 +683,8 @@ export class ComputerGateway {
|
|
|
665
683
|
}
|
|
666
684
|
}
|
|
667
685
|
this.timer = setInterval(() => { if (this.checking || !this.live?.lease)
|
|
668
|
-
return; this.checking = true; void
|
|
686
|
+
return; this.checking = true; void Promise.resolve().then(async () => { if (!this.live.session.stopPending)
|
|
687
|
+
await this.authorized(); this.runtime.pool.renew(this.live.lease); }).catch(async () => { await this.interrupt().catch(() => { }); if (!this.closed)
|
|
669
688
|
this.onDisconnect(); }).finally(() => { this.checking = false; }); }, 5000);
|
|
670
689
|
this.timer.unref();
|
|
671
690
|
return lease;
|
|
@@ -921,6 +940,7 @@ export class ComputerGateway {
|
|
|
921
940
|
* records pending tool calls so the model can resume coherently. The pool
|
|
922
941
|
* lease stays — the human acquires a holder of the same shared desktop. */
|
|
923
942
|
async takeControl(controlId, authorize) {
|
|
943
|
+
this.guard();
|
|
924
944
|
const live = this.live;
|
|
925
945
|
if (!live || !this.active)
|
|
926
946
|
throw new HttpError(409, '机器人已不在执行,请重新打开电脑', 'computer_not_active');
|
|
@@ -978,32 +998,42 @@ export class ComputerGateway {
|
|
|
978
998
|
if (live.stopping)
|
|
979
999
|
return live.stopping;
|
|
980
1000
|
live.stopping = (async () => {
|
|
1001
|
+
live.session.stopPending = true;
|
|
1002
|
+
this.runtime.save(live.session);
|
|
981
1003
|
live.controller.abort();
|
|
982
|
-
|
|
1004
|
+
await this.profileSession?.stop();
|
|
1005
|
+
await this.profileSession?.close();
|
|
1006
|
+
await live.worker?.close();
|
|
983
1007
|
try {
|
|
984
|
-
await this.
|
|
1008
|
+
await this.release(live);
|
|
985
1009
|
}
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
try {
|
|
990
|
-
await this.release(live);
|
|
991
|
-
}
|
|
992
|
-
catch (error) {
|
|
993
|
-
if (error.code !== 'computer_lease_stale')
|
|
994
|
-
throw error;
|
|
995
|
-
}
|
|
996
|
-
live.running = false;
|
|
1010
|
+
catch (error) {
|
|
1011
|
+
if (error.code !== 'computer_lease_stale')
|
|
1012
|
+
throw error;
|
|
997
1013
|
}
|
|
998
|
-
|
|
1014
|
+
live.running = false;
|
|
1015
|
+
live.session.stopPending = false;
|
|
1016
|
+
this.runtime.save(live.session);
|
|
1017
|
+
if (this.closed)
|
|
1018
|
+
this.runtime.detachGateway(this);
|
|
1019
|
+
})().finally(() => { live.stopping = undefined; });
|
|
999
1020
|
return live.stopping;
|
|
1000
1021
|
}
|
|
1001
1022
|
async stopControl() { await this.interrupt(); this.event('message.complete', { text: '电脑控制已结束,本轮已停止', status: 'interrupted' }); }
|
|
1002
|
-
async close() {
|
|
1023
|
+
async close() {
|
|
1024
|
+
this.closed = true;
|
|
1025
|
+
this.controller.abort();
|
|
1026
|
+
this.team = undefined;
|
|
1003
1027
|
if (this.live?.running || this.live && !this.live.releasing)
|
|
1004
1028
|
await this.interrupt();
|
|
1005
|
-
|
|
1006
|
-
|
|
1029
|
+
if (this.recoverySession?.stopPending) {
|
|
1030
|
+
await this.profileSession?.stop();
|
|
1031
|
+
await this.runtime.pool.stopHolder(this.meta.ownerKey, this.meta.environmentId, this.workId);
|
|
1032
|
+
this.recoverySession.stopPending = false;
|
|
1033
|
+
this.runtime.save(this.recoverySession);
|
|
1034
|
+
}
|
|
1007
1035
|
await this.profileSession?.close();
|
|
1008
|
-
|
|
1036
|
+
clearInterval(this.timer);
|
|
1037
|
+
this.runtime.detachGateway(this);
|
|
1038
|
+
}
|
|
1009
1039
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { waitForHermesSessionIdle } from '../../server/sessionStop.js';
|
|
2
2
|
import { HttpError } from '../../server/errors.js';
|
|
3
3
|
import { WorkspaceGateway } from '../../server/workspaceGateway.js';
|
|
4
4
|
import { createWorkspaceToolLease, requireTeamToolBridge } from '../../server/workspaceToolLease.js';
|
|
@@ -121,17 +121,7 @@ export class ProfileComputerSession {
|
|
|
121
121
|
if (!this.runtimeId || this.closed)
|
|
122
122
|
return;
|
|
123
123
|
await this.rpc('session.interrupt');
|
|
124
|
-
|
|
125
|
-
const deadline = Date.now() + 20000;
|
|
126
|
-
for (;;) {
|
|
127
|
-
const state = await this.rpc('session.active_list');
|
|
128
|
-
const session = state.sessions?.find((item) => item.id === this.runtimeId);
|
|
129
|
-
if (session?.status === 'idle')
|
|
130
|
-
return;
|
|
131
|
-
if (Date.now() >= deadline)
|
|
132
|
-
throw new HttpError(409, '本机任务尚未停止,暂不能交出电脑控制权', 'computer_profile_stopping');
|
|
133
|
-
await delay(100, undefined, { signal: this.controller.signal });
|
|
134
|
-
}
|
|
124
|
+
await waitForHermesSessionIdle((method, params) => this.rpc(method, params), this.runtimeId, this.profile, { signal: this.controller.signal });
|
|
135
125
|
}
|
|
136
126
|
async close() {
|
|
137
127
|
if (this.closed)
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { unreadSnapshot } from './unreadCenter.js';
|
|
1
2
|
import { ExecutionSettings } from './executionSettings.js';
|
|
3
|
+
import { CredentialVaultCoordinator } from './credentialVault/coordinator.js';
|
|
4
|
+
import { CredentialVaultClient } from './credentialVault/transport.js';
|
|
2
5
|
import { ManagedBrowsers } from './managedBrowsers.js';
|
|
3
6
|
import { isWorkspaceAccountPath } from './subaccountAccess.js';
|
|
4
7
|
import { chatTranscriptRouter } from './chatTranscriptApi.js';
|
|
@@ -155,6 +158,7 @@ export function createApplication(options = {}) {
|
|
|
155
158
|
});
|
|
156
159
|
// The application owns group events. No Dashboard plugin is queried.
|
|
157
160
|
const workspace = new WorkspaceStore(config.home);
|
|
161
|
+
push.setUnreadCounter(owner => unreadSnapshot(workspace, chatCache.store, owner, (node, profile) => auth.canUseSource(owner, node, profile)).total);
|
|
158
162
|
const openVikingService = new OpenVikingService(workspace, openVikingConfiguration);
|
|
159
163
|
const workspaceNodes = new WorkspaceNodes(workspace, config, { url: config.upstream, client: upstream, session: upstreamSession }, pairings.nodeID);
|
|
160
164
|
workspaceNodes.sourceAllowed = (owner, nodeId, profile) => auth.canUseSource(owner, nodeId, profile);
|
|
@@ -168,8 +172,10 @@ export function createApplication(options = {}) {
|
|
|
168
172
|
runners.controlAllowed = (id, runnerId) => computerControls.allowed(id, runnerId);
|
|
169
173
|
workspaceNodes.runnerTarget = (owner, nodeId, computer) => runners.target(owner, nodeId, computer);
|
|
170
174
|
const executionSettings = new ExecutionSettings(workspace, workspaceNodes, auth);
|
|
175
|
+
const credentialVault = new CredentialVaultCoordinator(new CredentialVaultClient(config.credentialVault), workspace, auth, runners);
|
|
171
176
|
const workspaceRuntime = new WorkspaceRuntime(workspace, workspaceNodes, uploads, owner => auth.isUserActive(owner), owner => auth.pushAuthorizationVersion(owner) ?? 0, openVikingService);
|
|
172
177
|
workspaceRuntime.executionSettings = executionSettings;
|
|
178
|
+
workspaceRuntime.credentialVault = credentialVault;
|
|
173
179
|
runners.executionSettings = executionSettings;
|
|
174
180
|
executionSettings.onProxyChange = () => runners.configureNetworks();
|
|
175
181
|
executionSettings.testProxy = () => runners.testNetworks();
|
|
@@ -427,7 +433,13 @@ export function createApplication(options = {}) {
|
|
|
427
433
|
else
|
|
428
434
|
await next();
|
|
429
435
|
});
|
|
430
|
-
|
|
436
|
+
app.use(async (ctx, next) => {
|
|
437
|
+
const user = ctx.state.localUser, cookie = ctx.get('cookie');
|
|
438
|
+
if (['/api/app/logout', '/auth/logout'].includes(ctx.path) && ctx.method === 'POST' && user)
|
|
439
|
+
await credentialVault.logout(user.id, cookie);
|
|
440
|
+
await next();
|
|
441
|
+
});
|
|
442
|
+
for (const router of [credentialVault.router(), executionSettings.router(), managedBrowsers.router(), desktopEnvironments.router(), grokCloud.authorization.router(), grokCloud.router(), workspaceInspector.router(), workspaceRoutines.router(), workspacePlugins.router()]) {
|
|
431
443
|
app.use(router.routes());
|
|
432
444
|
app.use(router.allowedMethods());
|
|
433
445
|
}
|
|
@@ -511,6 +523,7 @@ export function createApplication(options = {}) {
|
|
|
511
523
|
await next();
|
|
512
524
|
});
|
|
513
525
|
return {
|
|
526
|
+
credentialVault,
|
|
514
527
|
runners,
|
|
515
528
|
hermesBridge,
|
|
516
529
|
localVm,
|
|
@@ -545,6 +558,7 @@ export function createApplication(options = {}) {
|
|
|
545
558
|
chatCache,
|
|
546
559
|
startBackground,
|
|
547
560
|
close: () => {
|
|
561
|
+
credentialVault.close();
|
|
548
562
|
closed = true;
|
|
549
563
|
openVikingSessionSync.close();
|
|
550
564
|
workspaceMemory.close();
|
|
@@ -36,7 +36,7 @@ export function chatTranscriptRouter(cache, auth) {
|
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
router.get('/api/app/chat/sessions/:id/events', ctx => {
|
|
39
|
-
const { owner, profile, id } = scope(ctx), version = auth.pushAuthorizationVersion(owner);
|
|
39
|
+
const { owner, profile, id } = scope(ctx), version = auth.pushAuthorizationVersion(owner), cookie = ctx.get('cookie');
|
|
40
40
|
const raw = ctx.get('last-event-id') || String(ctx.query.after ?? ''), parts = raw.split(':');
|
|
41
41
|
let cursor = Number(parts.at(-1)), closed = false, lastFlush = 0, ready = false;
|
|
42
42
|
transcripts.seed(owner, profile, id);
|
|
@@ -45,7 +45,7 @@ export function chatTranscriptRouter(cache, auth) {
|
|
|
45
45
|
throw new HttpError(409, '聊天事件需要重新同步', 'transcript_reset');
|
|
46
46
|
const res = ctx.res;
|
|
47
47
|
let timer, heartbeat, off = () => { };
|
|
48
|
-
const valid = () => !store.isClosed && auth.isUserActive(owner) && auth.pushAuthorizationVersion(owner) === version && auth.
|
|
48
|
+
const valid = () => !store.isClosed && auth.isUserActive(owner) && auth.pushAuthorizationVersion(owner) === version && auth.currentFromCookieHeader(cookie)?.id === owner && store.ownsSession(owner, profile, id) && auth.canUseSource(owner, 'local', profile);
|
|
49
49
|
const close = () => { if (closed)
|
|
50
50
|
return; closed = true; clearTimeout(timer); clearInterval(heartbeat); off(); if (!res.writableEnded)
|
|
51
51
|
res.end(); };
|
|
@@ -447,6 +447,22 @@ export class ChatTranscriptStore {
|
|
|
447
447
|
.prepare('INSERT OR IGNORE INTO chat_transcript_reads VALUES(?,?,?,?)')
|
|
448
448
|
.run(owner, profile, sessionId, m.id);
|
|
449
449
|
}
|
|
450
|
+
unreadMessages(...scope) {
|
|
451
|
+
this.unread(...scope);
|
|
452
|
+
return this.db.prepare(`SELECT m.data FROM chat_transcript_messages m LEFT JOIN chat_transcript_reads r USING(owner,profile,session_id,id)
|
|
453
|
+
WHERE m.owner=? AND m.profile=? AND m.session_id=? AND m.deleted=0 AND r.id IS NULL ORDER BY m.seq,m.id`).all(...scope)
|
|
454
|
+
.map(row => JSON.parse(String(row.data))).filter(m => m.final_result === true && isFinalChatResult(m));
|
|
455
|
+
}
|
|
456
|
+
markMessagesRead(owner, profile, sessionId, ids) {
|
|
457
|
+
const selected = new Set(ids);
|
|
458
|
+
const head = this.head(owner, profile, sessionId);
|
|
459
|
+
head.localReadEstablished = true;
|
|
460
|
+
this.db.prepare('UPDATE chat_transcript_heads SET data=? WHERE owner=? AND profile=? AND session_id=?').run(JSON.stringify(head), owner, profile, sessionId);
|
|
461
|
+
for (const m of this.unreadMessages(owner, profile, sessionId))
|
|
462
|
+
if (selected.has(m.id))
|
|
463
|
+
this.db.prepare('INSERT OR IGNORE INTO chat_transcript_reads VALUES(?,?,?,?)').run(owner, profile, sessionId, m.id);
|
|
464
|
+
this.notify();
|
|
465
|
+
}
|
|
450
466
|
unread(...scope) {
|
|
451
467
|
// Legacy read cursors can finish importing after the initial local snapshot.
|
|
452
468
|
// Map only persisted source rows, never consume a live streaming result.
|
|
@@ -151,6 +151,9 @@ export function loadServerConfig(env = process.env) {
|
|
|
151
151
|
attachmentsRoot,
|
|
152
152
|
imagesRoot,
|
|
153
153
|
mediaOwner: basename(homedir()),
|
|
154
|
+
...(env.HERMES_YAOYAO_VAULT_SOCKET || env.HERMES_YAOYAO_VAULT_TOKEN_FILE ? { credentialVault: {
|
|
155
|
+
socket: env.HERMES_YAOYAO_VAULT_SOCKET || '', tokenFile: env.HERMES_YAOYAO_VAULT_TOKEN_FILE || '', hermesUid: Number(env.HERMES_YAOYAO_VAULT_HERMES_UID),
|
|
156
|
+
} } : {}),
|
|
154
157
|
tlsCert,
|
|
155
158
|
tlsKey,
|
|
156
159
|
allowInsecureLan,
|