- Add GatewayManager for multi-profile gateway lifecycle management - Auto-detect running gateways on startup via PID + health check - Port conflict detection: check managed gateways, allocated ports, and system-level port availability (TCP bind test) - Two-phase startup: sequential port resolution, parallel process launch - Use `gateway start/restart` on normal systems, `gateway run --replace` on WSL/Docker - Wait for health check before returning start/stop responses - Add Gateways page with card-based layout showing profile status - Reorganize sidebar navigation into collapsible groups - Hide API server settings (now auto-managed by GatewayManager) - Profile switch reloads page; Ctrl+C no longer stops gateways - Remove redundant ensureApiServerConfig from index.ts and profiles.ts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
30 lines
914 B
TypeScript
30 lines
914 B
TypeScript
import { request } from '../client'
|
|
|
|
export interface GatewayStatus {
|
|
profile: string
|
|
port: number
|
|
host: string
|
|
url: string
|
|
running: boolean
|
|
pid?: number
|
|
}
|
|
|
|
export async function fetchGateways(): Promise<GatewayStatus[]> {
|
|
const res = await request<{ gateways: GatewayStatus[] }>('/api/hermes/gateways')
|
|
return res.gateways
|
|
}
|
|
|
|
export async function startGateway(name: string): Promise<GatewayStatus> {
|
|
const res = await request<{ success: boolean; gateway: GatewayStatus }>(`/api/hermes/gateways/${name}/start`, { method: 'POST' })
|
|
return res.gateway
|
|
}
|
|
|
|
export async function stopGateway(name: string): Promise<void> {
|
|
await request(`/api/hermes/gateways/${name}/stop`, { method: 'POST' })
|
|
}
|
|
|
|
export async function checkGatewayHealth(name: string): Promise<GatewayStatus> {
|
|
const res = await request<{ gateway: GatewayStatus }>(`/api/hermes/gateways/${name}/health`)
|
|
return res.gateway
|
|
}
|