feat(mcp): add preset setup and capability mentions

This commit is contained in:
Xubin Ren
2026-05-24 19:43:20 +08:00
parent 8be258212e
commit 704ac558f6
54 changed files with 8425 additions and 708 deletions
+20
View File
@@ -0,0 +1,20 @@
import type { McpPresetInfo, McpPresetsPayload } from "@/lib/types";
export const MCP_PRESETS_CHANGED_EVENT = "nanobot:mcp-presets-changed";
export function isMcpPresetsPayload(value: unknown): value is McpPresetsPayload {
return !!value
&& typeof value === "object"
&& Array.isArray((value as { presets?: unknown }).presets);
}
export function installedMcpPresetsFromPayload(payload: McpPresetsPayload): McpPresetInfo[] {
return payload.presets.filter((preset) => preset.installed && preset.configured);
}
export function notifyMcpPresetsChanged(payload: McpPresetsPayload): void {
if (typeof window === "undefined") return;
window.dispatchEvent(new CustomEvent<McpPresetsPayload>(MCP_PRESETS_CHANGED_EVENT, {
detail: payload,
}));
}