import { PageContainer } from "@/components/layout/PageContainer"; import { ErrorState, EmptyState } from "@/components/shared/StateViews"; import { ToolRegistry } from "@/components/admin/ToolRegistry"; import { McpServerPanel } from "@/components/admin/mcp/McpServerPanel"; import { GatewayPanel } from "@/components/admin/mcp/GatewayPanel"; import { ToolRuntimeTabs } from "@/components/admin/mcp/ToolRuntimeTabs"; import { SkillManager } from "@/components/tools/SkillManager"; import { serverApi } from "@/lib/api/server-client"; import { describeError } from "@/lib/utils/error"; import type { McpServer, Skill, ToolInfo } from "@/types/api"; export const dynamic = "force-dynamic"; /** * 百工枢 · 器用技艺治理(对应设计稿 admin-preview.html 百工枢 视图)。 * * 四标签页: * ① 工具注册表 — 清单与管理 * ② MCP 服务器 — 外部能力接入 * ③ 玄关网关 — 路由与代理 * ④ Skill 能力包 — 可插拔能力 */ export default async function AdminToolsPage() { let tools: ToolInfo[] = []; let skills: Skill[] = []; let mcpServers: McpServer[] = []; let error: string | null = null; try { [tools, skills, mcpServers] = await Promise.all([ serverApi.get("/tools"), serverApi.get("/tools/skills"), serverApi.get("/tools/mcp-servers"), ]); } catch (e) { error = describeError(e); } return ( {error ? ( ) : (

工具注册表

{tools.length === 0 ? ( ) : ( )} ), }, { key: "mcp", label: "MCP 服务器", badge: mcpServers.length, content: (

MCP 服务器

), }, { key: "gateway", label: "玄关网关", content: (

玄关网关管理

), }, { key: "skills", label: "Skill 能力包", badge: skills.length, content: (

Skill 能力包

{skills.length === 0 ? ( ) : ( )}
), }, ]} defaultTab="tools" />
)}
); }