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 @@