feat(admin): 服务状态面板(基建/服务探活 + MCP 工具注册)+ mcp-go 工具注册表
管理端新增「运维 › 服务状态」:总览横幅 + 摘要数字 + 请求链路拓扑 (客户端→网关→NATS→调度→MCP,按健康三态着色)+ 应用服务卡(含探针 延迟)+ 基建磁贴 + MCP 工具按能力域分组(中文名/作用)。 探活机制(全走 NATS,无 HTTP): - mcp-go/mcp-py 新增 list_tools 自省工具,能应答=在线 + 上报工具清单 - dispatcher 无端点 → 新增 NATS 心跳主题 sundynix.health.dispatcher (ServeHealth 应答 model/ready/uptime),网关用 bus.Ping 探 - 网关 GET /api/v1/admin/status 并发聚合四探针 + 各项延迟 mcp-go 重构:switch → map 注册表(buildRegistry),dispatch 与 list_tools 共用单一事实源,杜绝漂移;每个工具带中文名 + 作用描述。mcp-py 同样补元信息。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -151,3 +151,33 @@ export async function gatewayOnline(): Promise<boolean> {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// —— 服务状态:基建 / 应用服务探活 + MCP 工具注册 ——
|
||||
export interface StatusItem {
|
||||
name: string;
|
||||
up: boolean;
|
||||
detail?: string;
|
||||
latency_ms?: number;
|
||||
}
|
||||
export interface ToolInfo {
|
||||
name: string;
|
||||
cn: string;
|
||||
desc: string;
|
||||
}
|
||||
export interface ToolGroup {
|
||||
server: string;
|
||||
up: boolean;
|
||||
tools: ToolInfo[] | null;
|
||||
}
|
||||
export interface SystemStatus {
|
||||
checked_at: string;
|
||||
infra: StatusItem[];
|
||||
services: StatusItem[];
|
||||
tools: ToolGroup[];
|
||||
}
|
||||
|
||||
export async function getStatus(): Promise<SystemStatus> {
|
||||
const res = guard(await fetch(`${ADMIN}/status`, { headers: authHeaders() }));
|
||||
if (!res.ok) throw new Error(`status failed: ${res.status}`);
|
||||
return (await res.json()) as SystemStatus;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user