From 663afb61ff6917b065087de714b44c2140024395 Mon Sep 17 00:00:00 2001 From: ekko <152005280+EKKOLearnAI@users.noreply.github.com> Date: Wed, 20 May 2026 12:59:34 +0800 Subject: [PATCH] Improve profile runtime controls (#868) * Improve profile runtime controls * Restore profile selector test id * Update profile switch e2e flow --- packages/client/src/api/hermes/profiles.ts | 51 ++ .../src/components/layout/ProfileSelector.vue | 435 ++++++++++++++++-- packages/client/src/i18n/locales/en.ts | 17 + packages/client/src/i18n/locales/zh.ts | 17 + .../server/src/controllers/hermes/profiles.ts | 149 ++++++ packages/server/src/routes/hermes/profiles.ts | 4 + .../hermes/agent-bridge/hermes_bridge.py | 1 + .../services/hermes/agent-bridge/manager.ts | 6 + .../src/services/hermes/gateway-autostart.ts | 134 +++++- .../server/src/services/hermes/hermes-cli.ts | 19 +- scripts/build-server.mjs | 3 +- tests/e2e/chat-streaming.spec.ts | 5 +- tests/e2e/fixtures.ts | 18 + tests/server/agent-bridge-manager.test.ts | 24 + tests/server/gateway-autostart.test.ts | 21 + 15 files changed, 864 insertions(+), 40 deletions(-) mode change 100644 => 100755 packages/server/src/services/hermes/agent-bridge/hermes_bridge.py diff --git a/packages/client/src/api/hermes/profiles.ts b/packages/client/src/api/hermes/profiles.ts index 3f55269..53c2071 100644 --- a/packages/client/src/api/hermes/profiles.ts +++ b/packages/client/src/api/hermes/profiles.ts @@ -4,6 +4,7 @@ export interface HermesProfile { name: string active: boolean model: string + gatewayStatus?: string alias: string } @@ -17,6 +18,31 @@ export interface HermesProfileDetail { hasSoulMd: boolean } +export interface ProfileRuntimeStatus { + profile: string + bridge: { + running: boolean + profile: string + mode?: string + reachable?: boolean + error?: string + } + gateway: { + profile: string + running: boolean + pid?: number + port?: number + host?: string + url?: string + error?: string + diagnostics?: { + health_url?: string + reason?: string + health_ok?: boolean + } + } +} + export async function fetchProfiles(): Promise { const res = await request<{ profiles: HermesProfile[] }>('/api/hermes/profiles') return res.profiles @@ -27,6 +53,31 @@ export async function fetchProfileDetail(name: string): Promise { + return request(`/api/hermes/profiles/${encodeURIComponent(name)}/runtime-status`) +} + +export async function fetchProfileRuntimeStatuses(): Promise { + const res = await request<{ profiles: ProfileRuntimeStatus[] }>('/api/hermes/profiles/runtime-statuses') + return res.profiles +} + +export async function restartProfileGateway(name: string): Promise { + const res = await request<{ success: boolean; gateway: ProfileRuntimeStatus['gateway'] }>( + `/api/hermes/profiles/${encodeURIComponent(name)}/gateway/restart`, + { method: 'POST' }, + ) + return res.gateway +} + +export async function restartProfileRuntime(name: string): Promise { + const res = await request<{ success: boolean; status: ProfileRuntimeStatus }>( + `/api/hermes/profiles/${encodeURIComponent(name)}/restart`, + { method: 'POST' }, + ) + return res.status +} + export interface CreateProfileResult { success: boolean /** clone=true 时被清理的独占平台凭据 KEY 名 */ diff --git a/packages/client/src/components/layout/ProfileSelector.vue b/packages/client/src/components/layout/ProfileSelector.vue index 929d3da..e550412 100644 --- a/packages/client/src/components/layout/ProfileSelector.vue +++ b/packages/client/src/components/layout/ProfileSelector.vue @@ -1,32 +1,104 @@