From 716bb98b502871d6ace4f3edfb513710f5794c24 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 19 Jun 2026 18:58:07 -0400 Subject: [PATCH] x --- apps/mcp-server/menu-toolkit.ts | 2 +- apps/mcp-server/menu-tools.ts | 5 +++-- apps/mcp-server/section-toolkit.ts | 2 +- packages/types/index.ts | 10 ++++++---- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/apps/mcp-server/menu-toolkit.ts b/apps/mcp-server/menu-toolkit.ts index edf0690..45d2c1b 100644 --- a/apps/mcp-server/menu-toolkit.ts +++ b/apps/mcp-server/menu-toolkit.ts @@ -191,7 +191,7 @@ export const MENU_TOOL_DEFINITIONS = [ } ] as const; -export const MENU_TOOL_NAMES = new Set(MENU_TOOL_DEFINITIONS.map((tool) => tool.name)); +export const MENU_TOOL_NAMES = new Set(MENU_TOOL_DEFINITIONS.map((tool) => tool.name)); export async function handleMenuTool(api: AxiosInstance, name: string, params: any) { if (!MENU_TOOL_NAMES.has(name)) return null; diff --git a/apps/mcp-server/menu-tools.ts b/apps/mcp-server/menu-tools.ts index 476872b..c977328 100644 --- a/apps/mcp-server/menu-tools.ts +++ b/apps/mcp-server/menu-tools.ts @@ -142,16 +142,17 @@ function validateMenuNodeData(nodeData: any, parentId?: string | null) { function validateMenuTranslations(translations: any) { const issues: string[] = []; + const warnings: string[] = []; if (!isPlainObject(translations)) { issues.push("translations must be a plain object"); - return { issues }; + return { issues, warnings }; } for (const [key, value] of Object.entries(translations)) { if (typeof value !== "string") { issues.push(`translation for "${key}" must be a string`); } } - return { issues }; + return { issues, warnings }; } function validateMenuItems(items: any) { diff --git a/apps/mcp-server/section-toolkit.ts b/apps/mcp-server/section-toolkit.ts index c8ec331..5144e98 100644 --- a/apps/mcp-server/section-toolkit.ts +++ b/apps/mcp-server/section-toolkit.ts @@ -253,7 +253,7 @@ export const SECTION_TOOL_DEFINITIONS = [ } ] as const; -export const SECTION_TOOL_NAMES = new Set(SECTION_TOOL_DEFINITIONS.map((tool) => tool.name)); +export const SECTION_TOOL_NAMES = new Set(SECTION_TOOL_DEFINITIONS.map((tool) => tool.name)); export async function handleSectionTool(api: AxiosInstance, name: string, params: any) { if (!SECTION_TOOL_NAMES.has(name)) return null; diff --git a/packages/types/index.ts b/packages/types/index.ts index f0744cf..6e8e5f8 100644 --- a/packages/types/index.ts +++ b/packages/types/index.ts @@ -68,16 +68,18 @@ function resolveApiBase() { if (envValue) { const isDev = Boolean(viteEnv?.DEV) const isLocalhostUrl = /^https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?\/api\/?$/.test(envValue) + const win = (globalThis as any).window - if (isDev && typeof window !== 'undefined' && isLocalhostUrl) { - return `${window.location.protocol}//${window.location.hostname}:${DEFAULT_DEV_API_PORT}/api` + if (isDev && typeof win !== 'undefined' && isLocalhostUrl) { + return `${win.location.protocol}//${win.location.hostname}:${DEFAULT_DEV_API_PORT}/api` } return envValue } - if (typeof window !== 'undefined') { - return `${window.location.protocol}//${window.location.hostname}:${DEFAULT_DEV_API_PORT}/api` + const win = (globalThis as any).window + if (typeof win !== 'undefined') { + return `${win.location.protocol}//${win.location.hostname}:${DEFAULT_DEV_API_PORT}/api` } return 'http://localhost:3000/api'