Files
Migu2.0/frontends/apps/simple-platform-vue/src/api/health.ts
T
黄兆尉andCursor 3686abdc78 将调度内核标识从 SimpleLite 全面重命名为 Simple3。
配置段/环境变量、Launcher、健康检查 API、OpenAPI 与前后端文案同步;兼容探测旧 SimpleLite 进程名。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-26 17:46:52 +08:00

56 lines
1.3 KiB
TypeScript

import http from '@/api/http'
import type { LaunchMode, RunMode } from '@/types/auth'
export interface HealthInfo {
status: string
startTime: string
uptimeSec: number
}
export interface Simple3Diagnostics {
enabled: boolean
isRunning: boolean
lastLaunchMode?: string | null
projectionPort: number
projectionPortReachable: boolean
gotoSiteApiAvailable?: boolean | null
executableExists: boolean
deployHint?: string | null
}
export interface Simple3LaunchResult {
started: boolean
status: string
detail: string
displayMode?: string | null
warning?: string | null
}
export function getHealth() {
return http.get<HealthInfo>('/health')
}
export function getSimple3Diagnostics() {
return http.get<Simple3Diagnostics>('/health/simple3')
}
export function stopSimple3() {
return http.post<{ killed: number; diagnostics: Simple3Diagnostics }>('/health/simple3/stop')
}
export function restartSimple3(launchMode: LaunchMode) {
return http.post<{ restart: Simple3LaunchResult; diagnostics: Simple3Diagnostics }>(
'/health/simple3/restart',
null,
{ params: { launchMode }, timeout: 60_000 }
)
}
/** Simple3 仅 Web;重启一律 WebOnly(保留函数签名供旧调用方)。 */
export function resolveRestartLaunchMode(
_lastLaunchMode?: string | null,
_runMode?: RunMode | null
): LaunchMode {
return 'WebOnly'
}