@agent-native/core 0.22.13 → 0.22.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/engine/registry.d.ts.map +1 -1
- package/dist/agent/engine/registry.js +13 -1
- package/dist/agent/engine/registry.js.map +1 -1
- package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
- package/dist/client/MultiTabAssistantChat.js +5 -6
- package/dist/client/MultiTabAssistantChat.js.map +1 -1
- package/dist/client/agent-chat.d.ts.map +1 -1
- package/dist/client/agent-chat.js +13 -0
- package/dist/client/agent-chat.js.map +1 -1
- package/dist/client/embed-auth.d.ts.map +1 -1
- package/dist/client/embed-auth.js +161 -20
- package/dist/client/embed-auth.js.map +1 -1
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/mcp-app-host.d.ts +40 -0
- package/dist/client/mcp-app-host.d.ts.map +1 -0
- package/dist/client/mcp-app-host.js +165 -0
- package/dist/client/mcp-app-host.js.map +1 -0
- package/dist/client/sharing/ShareButton.d.ts +9 -0
- package/dist/client/sharing/ShareButton.d.ts.map +1 -1
- package/dist/client/sharing/ShareButton.js +19 -2
- package/dist/client/sharing/ShareButton.js.map +1 -1
- package/dist/client/use-action.d.ts.map +1 -1
- package/dist/client/use-action.js +13 -0
- package/dist/client/use-action.js.map +1 -1
- package/dist/client/use-chat-models.d.ts.map +1 -1
- package/dist/client/use-chat-models.js +4 -5
- package/dist/client/use-chat-models.js.map +1 -1
- package/dist/client/use-db-sync.d.ts.map +1 -1
- package/dist/client/use-db-sync.js +58 -3
- package/dist/client/use-db-sync.js.map +1 -1
- package/dist/client/use-db-sync.spec.js +27 -0
- package/dist/client/use-db-sync.spec.js.map +1 -1
- package/dist/deploy/build.d.ts +30 -0
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +31 -16
- package/dist/deploy/build.js.map +1 -1
- package/dist/index.browser.d.ts +2 -1
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +2 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/builtin-tools.d.ts.map +1 -1
- package/dist/mcp/builtin-tools.js +0 -1
- package/dist/mcp/builtin-tools.js.map +1 -1
- package/dist/mcp/embed-app.d.ts +2 -0
- package/dist/mcp/embed-app.d.ts.map +1 -1
- package/dist/mcp/embed-app.js +180 -6
- package/dist/mcp/embed-app.js.map +1 -1
- package/dist/mcp/embed-route.d.ts +26 -0
- package/dist/mcp/embed-route.d.ts.map +1 -0
- package/dist/mcp/embed-route.js +38 -0
- package/dist/mcp/embed-route.js.map +1 -0
- package/dist/mcp/index.d.ts +1 -0
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +1 -0
- package/dist/mcp/index.js.map +1 -1
- package/dist/scripts/agent-engines/list-agent-engines.d.ts.map +1 -1
- package/dist/scripts/agent-engines/list-agent-engines.js +18 -12
- package/dist/scripts/agent-engines/list-agent-engines.js.map +1 -1
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +9 -1
- package/dist/server/auth.js.map +1 -1
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +22 -1
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/embed-route.d.ts.map +1 -1
- package/dist/server/embed-route.js +36 -7
- package/dist/server/embed-route.js.map +1 -1
- package/dist/server/embed-session.d.ts.map +1 -1
- package/dist/server/embed-session.js +11 -1
- package/dist/server/embed-session.js.map +1 -1
- package/dist/server/security-headers.d.ts +6 -1
- package/dist/server/security-headers.d.ts.map +1 -1
- package/dist/server/security-headers.js +10 -2
- package/dist/server/security-headers.js.map +1 -1
- package/dist/shared/embed-auth.d.ts +1 -0
- package/dist/shared/embed-auth.d.ts.map +1 -1
- package/dist/shared/embed-auth.js +1 -0
- package/dist/shared/embed-auth.js.map +1 -1
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +28 -0
- package/dist/vite/client.js.map +1 -1
- package/docs/content/actions.md +22 -7
- package/docs/content/client.md +43 -0
- package/docs/content/external-agents.md +40 -1
- package/docs/content/mcp-protocol.md +25 -0
- package/package.json +1 -1
package/dist/vite/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/vite/client.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,OAAO,EAAE,KAAK,IAAI,eAAe,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AAEjF,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE/D;;;;;;;;;;;;;GAaG;AACH,SAAS,qBAAqB,CAC5B,QAAgB;IAEhB,4EAA4E;IAC5E,IAAI,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACjC,IAAI,aAAa,GAAkB,IAAI,CAAC;IACxC,IAAI,WAAW,GAAkB,IAAI,CAAC;IACtC,KAA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E;YAChE,kEAAkE;YAClE,qEAAqE;YACrE,iEAAiE;YACjE,6DAA6D;YAC7D,OAAO,EAAE;gBACP,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC7D,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,OAAO,IAAI,EAAE,CAAC;aACzC;SACF;QACD,OAAO,EAAE;YACP,sEAAsE;YACtE,sEAAsE;YACtE,sEAAsE;YACtE,4EAA4E;YAC5E,0DAA0D;YAC1D,MAAM,EAAE,eAAe,CAAC,GAAG,CAAC;YAC5B,KAAK,EAAE;gBACL,iEAAiE;gBACjE,yDAAyD;gBACzD,qEAAqE;gBACrE,GAAG,oBAAoB,CAAC,GAAG,CAAC;gBAC5B,uDAAuD;gBACvD,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE;gBACtD,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC,EAAE;gBAC/D,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,EAAE,CAAC,CAAC;oBACrE,IAAI;oBACJ,WAAW;iBACZ,CAAC,CAAC;aACJ;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["import path from \"path\";\nimport fs from \"fs\";\nimport { createRequire } from \"module\";\nimport type { Plugin, UserConfig } from \"vite\";\nimport { nitro as nitroVitePlugin } from \"nitro/vite\";\nimport { actionTypesPlugin } from \"./action-types-plugin.js\";\nimport { agentsBundlePlugin } from \"./agents-bundle-plugin.js\";\nimport { findWorkspaceRoot } from \"../scripts/utils.js\";\nimport { getViteDevRecoveryScript } from \"../client/vite-dev-recovery-script.js\";\n\nimport { fileURLToPath } from \"url\";\n\nconst require = createRequire(import.meta.url);\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\n/**\n * Sync discovery for the workspace-core in an enterprise monorepo.\n *\n * Mirrors `getWorkspaceCoreExports` in deploy/workspace-core.ts but stays\n * synchronous so it can run inline in `defineConfig`. Returns the workspace\n * core's package name + absolute directory, or null if no workspace core is\n * declared in the ancestor chain.\n *\n * Walks up from `startDir` looking for a package.json with\n * `agent-native.workspaceCore`. Resolves the declared package name through\n * `<workspaceRoot>/node_modules/<name>` (pnpm symlink, fastest) or by\n * scanning `packages/*` for a matching `name` field (fallback for\n * pre-install scenarios).\n */\nfunction findWorkspaceCoreSync(\n startDir: string,\n): { packageName: string; packageDir: string } | null {\n // 1) Walk up looking for the root package.json that declares workspaceCore.\n let dir = path.resolve(startDir);\n let workspaceRoot: string | null = null;\n let packageName: string | null = null;\n for (let i = 0; i < 20; i++) {\n const pkgPath = path.join(dir, \"package.json\");\n if (fs.existsSync(pkgPath)) {\n try {\n const pkg = JSON.parse(fs.readFileSync(pkgPath, \"utf-8\"));\n const declared = pkg?.[\"agent-native\"]?.workspaceCore;\n if (typeof declared === \"string\" && declared.length > 0) {\n workspaceRoot = dir;\n packageName = declared;\n break;\n }\n } catch {\n // Malformed package.json — keep walking up.\n }\n }\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n if (!workspaceRoot || !packageName) return null;\n\n // 2a) pnpm/npm symlink under workspaceRoot/node_modules.\n const nm = path.join(workspaceRoot, \"node_modules\", packageName);\n if (fs.existsSync(path.join(nm, \"package.json\"))) {\n return { packageName, packageDir: fs.realpathSync(nm) };\n }\n\n // 2b) Scan packages/* and packages/@scope/* for a matching `name`.\n const packagesDir = path.join(workspaceRoot, \"packages\");\n if (fs.existsSync(packagesDir)) {\n const candidates: string[] = [];\n for (const entry of fs.readdirSync(packagesDir, { withFileTypes: true })) {\n if (!entry.isDirectory()) continue;\n candidates.push(path.join(packagesDir, entry.name));\n if (entry.name.startsWith(\"@\")) {\n const scopeDir = path.join(packagesDir, entry.name);\n for (const sub of fs.readdirSync(scopeDir, { withFileTypes: true })) {\n if (sub.isDirectory()) candidates.push(path.join(scopeDir, sub.name));\n }\n }\n }\n for (const c of candidates) {\n const p = path.join(c, \"package.json\");\n if (!fs.existsSync(p)) continue;\n try {\n const pkg = JSON.parse(fs.readFileSync(p, \"utf-8\"));\n if (pkg?.name === packageName)\n return { packageName, packageDir: fs.realpathSync(c) };\n } catch {\n // ignore malformed package.json\n }\n }\n }\n return null;\n}\n\n/** Escape a string so it can be embedded as a regex literal. */\nfunction escapeRegex(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\n/** Check if a package is installed in the project */\nfunction hasDep(pkg: string, cwd: string): boolean {\n try {\n const pkgJson = JSON.parse(\n fs.readFileSync(path.join(cwd, \"package.json\"), \"utf-8\"),\n );\n return !!(\n pkgJson.dependencies?.[pkg] ||\n pkgJson.devDependencies?.[pkg] ||\n pkgJson.peerDependencies?.[pkg]\n );\n } catch {\n return false;\n }\n}\n\n/**\n * Build the `resolve.dedupe` list dynamically. Reads core's package.json and\n * collects every peerDependency that the consuming app also declares. This\n * ensures Vite resolves them from the app root, not from core's own\n * node_modules — preventing duplicate React context / singleton issues.\n */\nfunction getClientDedupe(cwd: string): string[] {\n // Always dedupe React internals (sub-path exports aren't in peerDeps)\n const always = new Set([\"react\", \"react-dom\", \"react-dom/client\"]);\n\n // Server-only packages that never run in the browser — no point deduping.\n const serverOnly = new Set([\n \"drizzle-kit\",\n \"node-pty\",\n \"postgres\",\n \"ws\",\n \"typescript\",\n \"vite\",\n \"@vitejs/plugin-react-swc\",\n \"tailwindcss\",\n \"@tailwindcss/vite\",\n ]);\n\n try {\n const corePkgPath = path.resolve(__dirname, \"../../package.json\");\n const corePkg = JSON.parse(fs.readFileSync(corePkgPath, \"utf-8\"));\n\n // Scan both peerDependencies and dependencies. Direct deps like\n // @radix-ui/* use React internally — they must resolve against the\n // app's React, not a second copy inside core's node_modules.\n const coreDeps = new Set([\n ...Object.keys(corePkg.peerDependencies ?? {}),\n ...Object.keys(corePkg.dependencies ?? {}),\n ]);\n\n // Read the consuming app's dependencies\n const appPkg = JSON.parse(\n fs.readFileSync(path.join(cwd, \"package.json\"), \"utf-8\"),\n );\n const appDeps = new Set([\n ...Object.keys(appPkg.dependencies ?? {}),\n ...Object.keys(appPkg.devDependencies ?? {}),\n ]);\n\n for (const dep of coreDeps) {\n if (serverOnly.has(dep)) continue;\n // Dedupe if the app also declares it, OR if it's a React-based\n // UI library (Radix, Tanstack) that must share the app's React.\n if (\n appDeps.has(dep) ||\n dep.startsWith(\"@radix-ui/\") ||\n dep.startsWith(\"@tanstack/\")\n ) {\n always.add(dep);\n }\n }\n } catch {\n // Can't read package.json — fall back to known singletons\n }\n\n return [...always];\n}\n\n/**\n * Locate `packages/core/src` if we're inside the framework monorepo.\n * Shared between `getCoreSourceAliases` (which redirects imports to src/)\n * and `getDefaultOptimizeDeps` (which must NOT prebundle from dist/ when\n * the alias is active — otherwise the prebundle is built from a snapshot\n * of dist/ at startup and never picks up new exports).\n */\nfunction findCoreSrcDir(cwd: string): string | null {\n const candidates = [\n path.resolve(cwd, \"../../packages/core\"), // templates/<name>/\n path.resolve(cwd, \"../core\"), // packages/<name>/\n ];\n for (const candidate of candidates) {\n if (fs.existsSync(path.join(candidate, \"src/index.ts\"))) {\n return path.join(candidate, \"src\");\n }\n }\n return null;\n}\n\n/**\n * Every `@agent-native/core` subpath that gets a source alias. Must stay in\n * sync with `getCoreSourceAliases`. Used by `getDefaultOptimizeDeps` to skip\n * prebundling in monorepo mode, and by the consumer config to add them to\n * `optimizeDeps.exclude` so Vite always resolves them through the source\n * alias on every request — never from a stale dist/ snapshot.\n */\nconst CORE_CLIENT_SUBPATHS = [\n \"@agent-native/core\",\n \"@agent-native/core/client\",\n \"@agent-native/core/client/extensions\",\n \"@agent-native/core/client/tools\", // legacy alias\n \"@agent-native/core/client/org\",\n \"@agent-native/core/client/observability\",\n \"@agent-native/core/client/onboarding\",\n \"@agent-native/core/client/sharing\",\n \"@agent-native/core/client/notifications\",\n \"@agent-native/core/client/progress\",\n];\n\nfunction getDefaultOptimizeDeps(cwd: string): string[] {\n const inMonorepo = findCoreSrcDir(cwd) !== null;\n const entries: Array<{ specifier: string; packageName?: string }> = [\n // In monorepo mode the source alias resolves these to src/ on every\n // import, so prebundling from dist/ would just create a stale snapshot.\n // Skip them entirely — `optimizeDeps.exclude` below makes that explicit.\n ...(inMonorepo\n ? []\n : ([\n { specifier: \"@agent-native/core\" },\n {\n specifier: \"@agent-native/core/client\",\n packageName: \"@agent-native/core\",\n },\n {\n specifier: \"@agent-native/core/client/org\",\n packageName: \"@agent-native/core\",\n },\n {\n specifier: \"@agent-native/core/client/extensions\",\n packageName: \"@agent-native/core\",\n },\n {\n // Legacy alias — prior name for @agent-native/core/client/extensions.\n // Keep so deployed templates that haven't been updated still resolve.\n specifier: \"@agent-native/core/client/tools\",\n packageName: \"@agent-native/core\",\n },\n ] as Array<{ specifier: string; packageName?: string }>)),\n { specifier: \"@libsql/client\" },\n { specifier: \"@radix-ui/react-accordion\" },\n { specifier: \"@radix-ui/react-alert-dialog\" },\n { specifier: \"@radix-ui/react-avatar\" },\n { specifier: \"@radix-ui/react-checkbox\" },\n { specifier: \"@radix-ui/react-collapsible\" },\n { specifier: \"@radix-ui/react-context-menu\" },\n { specifier: \"@radix-ui/react-dialog\" },\n { specifier: \"@radix-ui/react-dropdown-menu\" },\n { specifier: \"@radix-ui/react-hover-card\" },\n { specifier: \"@radix-ui/react-label\" },\n { specifier: \"@radix-ui/react-menubar\" },\n { specifier: \"@radix-ui/react-navigation-menu\" },\n { specifier: \"@radix-ui/react-popover\" },\n { specifier: \"@radix-ui/react-progress\" },\n { specifier: \"@radix-ui/react-radio-group\" },\n { specifier: \"@radix-ui/react-scroll-area\" },\n { specifier: \"@radix-ui/react-select\" },\n { specifier: \"@radix-ui/react-separator\" },\n { specifier: \"@radix-ui/react-slider\" },\n { specifier: \"@radix-ui/react-slot\" },\n { specifier: \"@radix-ui/react-switch\" },\n { specifier: \"@radix-ui/react-tabs\" },\n { specifier: \"@radix-ui/react-toast\" },\n { specifier: \"@radix-ui/react-toggle\" },\n { specifier: \"@radix-ui/react-toggle-group\" },\n { specifier: \"@radix-ui/react-tooltip\" },\n { specifier: \"@tanstack/react-query\" },\n { specifier: \"@tabler/icons-react\" },\n { specifier: \"class-variance-authority\" },\n { specifier: \"clsx\" },\n { specifier: \"cmdk\" },\n { specifier: \"drizzle-orm\" },\n { specifier: \"drizzle-orm/pg-core\", packageName: \"drizzle-orm\" },\n { specifier: \"drizzle-orm/sqlite-core\", packageName: \"drizzle-orm\" },\n { specifier: \"h3\" },\n { specifier: \"next-themes\" },\n { specifier: \"react-hook-form\" },\n { specifier: \"sonner\" },\n { specifier: \"tailwind-merge\" },\n { specifier: \"zod\" },\n ];\n\n return entries\n .filter(({ specifier, packageName }) =>\n hasDep(packageName ?? specifier, cwd),\n )\n .map(({ specifier }) => specifier);\n}\n\n/**\n * In monorepo dev mode, resolve @agent-native/core imports to source (src/)\n * instead of dist/ so that Vite HMR picks up changes without rebuilding.\n *\n * Returns Vite array-style aliases with exact matching (regex anchored with $)\n * to prevent `@agent-native/core` from prefix-matching and swallowing\n * sub-path imports like `@agent-native/core/client`.\n */\nfunction getCoreSourceAliases(\n cwd: string,\n): Array<{ find: RegExp; replacement: string }> {\n const coreSrc = findCoreSrcDir(cwd);\n if (!coreSrc) return []; // Not in monorepo — use dist as normal\n\n // Map every @agent-native/core/* export to its src/ equivalent.\n // Each entry uses a regex with $ anchor for exact matching.\n const entries: Record<string, string> = {\n \"@agent-native/core\": path.join(coreSrc, \"index.browser.ts\"),\n \"@agent-native/core/server\": path.join(coreSrc, \"server/index.ts\"),\n \"@agent-native/core/client\": path.join(coreSrc, \"client/index.ts\"),\n \"@agent-native/core/client/extensions\": path.join(\n coreSrc,\n \"client/extensions/index.ts\",\n ),\n // Legacy alias — see exports map note above.\n \"@agent-native/core/client/tools\": path.join(\n coreSrc,\n \"client/extensions/index.ts\",\n ),\n \"@agent-native/core/client/org\": path.join(coreSrc, \"client/org/index.ts\"),\n \"@agent-native/core/client/observability\": path.join(\n coreSrc,\n \"client/observability/index.ts\",\n ),\n \"@agent-native/core/client/onboarding\": path.join(\n coreSrc,\n \"client/onboarding/index.ts\",\n ),\n \"@agent-native/core/client/sharing\": path.join(\n coreSrc,\n \"client/sharing/index.ts\",\n ),\n \"@agent-native/core/client/notifications\": path.join(\n coreSrc,\n \"client/notifications/index.ts\",\n ),\n \"@agent-native/core/client/progress\": path.join(\n coreSrc,\n \"client/progress/index.ts\",\n ),\n \"@agent-native/core/db\": path.join(coreSrc, \"db/index.ts\"),\n \"@agent-native/core/db/schema\": path.join(coreSrc, \"db/schema.ts\"),\n \"@agent-native/core/shared\": path.join(coreSrc, \"shared/index.ts\"),\n \"@agent-native/core/scripts\": path.join(coreSrc, \"scripts/index.ts\"),\n \"@agent-native/core/application-state\": path.join(\n coreSrc,\n \"application-state/index.ts\",\n ),\n \"@agent-native/core/settings\": path.join(coreSrc, \"settings/index.ts\"),\n \"@agent-native/core/credentials\": path.join(\n coreSrc,\n \"credentials/index.ts\",\n ),\n \"@agent-native/core/resources\": path.join(coreSrc, \"resources/index.ts\"),\n \"@agent-native/core/oauth-tokens\": path.join(\n coreSrc,\n \"oauth-tokens/index.ts\",\n ),\n \"@agent-native/core/workspace-connections\": path.join(\n coreSrc,\n \"workspace-connections/index.ts\",\n ),\n \"@agent-native/core/a2a\": path.join(coreSrc, \"a2a/index.ts\"),\n \"@agent-native/core/router\": path.join(coreSrc, \"router/index.ts\"),\n \"@agent-native/core/terminal\": path.join(\n coreSrc,\n \"client/terminal/index.ts\",\n ),\n \"@agent-native/core/terminal/server\": path.join(\n coreSrc,\n \"terminal/index.ts\",\n ),\n \"@agent-native/core/adapters/cli\": path.join(\n coreSrc,\n \"adapters/cli/index.ts\",\n ),\n \"@agent-native/core/usage\": path.join(coreSrc, \"usage/store.ts\"),\n // Shared stylesheet — alias to src so CSS edits (composer/theme rules)\n // take effect live in dev instead of silently loading the stale built\n // copy at dist/styles/. From src/styles/ the `@source \"../client/**\"`\n // directive resolves to the real .tsx source, which is what dev should\n // scan for Tailwind classes anyway.\n \"@agent-native/core/styles/agent-native.css\": path.join(\n coreSrc,\n \"styles/agent-native.css\",\n ),\n };\n\n // Escape special regex chars in the key and anchor with $\n return Object.entries(entries).map(([find, replacement]) => ({\n find: new RegExp(`^${find.replace(/[/]/g, \"\\\\/\")}$`),\n replacement,\n }));\n}\n\nexport interface NitroOptions {\n /** Nitro deployment preset (e.g. \"node\", \"vercel\", \"netlify\", \"cloudflare_pages\"). Default: \"node\" */\n preset?: string;\n /** Source directory for server files. Default: \"./server\" */\n srcDir?: string;\n /** Routes directory name (relative to srcDir). Default: \"routes\" */\n routesDir?: string;\n /** Any additional Nitro config overrides */\n [key: string]: unknown;\n}\n\nexport interface ClientConfigOptions {\n /** Port for dev server. Default: 8080 */\n port?: number;\n /** Additional hostnames allowed to access the dev server. */\n allowedHosts?: NonNullable<NonNullable<UserConfig[\"server\"]>[\"allowedHosts\"]>;\n /** Vite log level. Workspace child apps default to \"warn\" so only the gateway URL is advertised. */\n logLevel?: UserConfig[\"logLevel\"];\n /** Additional Vite plugins */\n plugins?: any[];\n /** Nitro plugin options (preset, srcDir, etc) */\n nitro?: NitroOptions;\n /** Override resolve aliases */\n aliases?: Record<string, string>;\n /** Override build.outDir. Default: \"dist/spa\" */\n outDir?: string;\n /** Additional fs.allow paths */\n fsAllow?: string[];\n /** Additional fs.deny patterns */\n fsDeny?: string[];\n /** Additional Vite optimizeDeps configuration */\n optimizeDeps?: NonNullable<UserConfig[\"optimizeDeps\"]>;\n /**\n * Whether to auto-inject the Tailwind v4 Vite plugin (`@tailwindcss/vite`).\n * Defaults to true — set to `false` if a template wants to manage Tailwind\n * itself (e.g. the legacy v3 PostCSS pipeline).\n */\n tailwind?: boolean;\n /**\n * Package names to stub in the SSR bundle with an empty proxy object.\n *\n * Use this for dependencies that only run in the browser (canvas / diagram\n * libraries, editors, WebGL) but would otherwise get pulled into the\n * server bundle via SSR's noExternal policy — pushing the CF Pages\n * Functions bundle over the 25 MiB limit.\n *\n * Only add packages that are provably never called during SSR. If the\n * server imports one, it will receive a Proxy that throws on any real\n * use (which is better than bundling a 10 MiB dep the worker never calls).\n *\n * @example\n * ssrStubs: [\"mermaid\", \"@excalidraw/excalidraw\"]\n */\n ssrStubs?: string[];\n /**\n * @deprecated Pass `reactRouter()` directly in the `plugins` array instead.\n * Previously used to auto-load the React Router Vite plugin via require(),\n * but this fails in ESM contexts. Templates should now do:\n * ```ts\n * import { reactRouter } from \"@react-router/dev/vite\";\n * defineConfig({ plugins: [reactRouter()] })\n * ```\n */\n reactRouter?: boolean | Record<string, unknown>;\n}\n\n/**\n * Vite plugin that recovers the page when Vite's dependency optimizer\n * invalidates modules mid-load (the \"504 Outdated Optimize Dep\" error).\n *\n * Without this, the page silently fails: <script type=\"module\"> tags 504,\n * React never mounts, and the user is stuck on a blank screen until they\n * manually refresh. We catch the failure modes and auto-reload, with a\n * visible overlay so the user knows what's happening, and a loop guard\n * so we never thrash forever.\n *\n * CRITICAL: this must be a SYNCHRONOUS (non-module) script injected at\n * `head-prepend`. Module scripts are deferred — the browser starts fetching\n * all module scripts in parallel during HTML parsing, so a module listener\n * registers AFTER sibling modules have already started loading and\n * possibly errored out. A regular <script> blocks parsing and runs\n * synchronously, so the listener is registered before ANY module fetch\n * begins.\n *\n * Catches three failure modes (all before React needs to mount):\n * 1. <script type=\"module\"> / <link> 504 — window \"error\" event, capture phase\n * 2. Dynamic import 504 — \"unhandledrejection\" with \"dynamically imported module\"\n * 3. Child module 504 — resource timing when browser exposes the HTTP status\n */\nfunction autoReloadOnOptimizeDep(): Plugin {\n return {\n name: \"agent-native-auto-reload-optimize-dep\",\n apply: \"serve\",\n transformIndexHtml() {\n return [\n {\n tag: \"script\",\n // NOTE: no `type: \"module\"` — this must be a synchronous script.\n children: getViteDevRecoveryScript(),\n injectTo: \"head-prepend\",\n },\n ];\n },\n };\n}\n\n/**\n * Vite handles outdated optimized-dep requests inside its own transform\n * middleware and ends the HTTP response with `504 Outdated Optimize Dep`.\n * Browser module loaders do not consistently surface those child-module\n * failures to userland JavaScript, so also nudge the Vite HMR client from the\n * server side. This turns the confusing blank-screen state into the same\n * full-page reload Vite would have requested once optimization settled.\n */\nfunction fullReloadOnOptimizeDep504(): Plugin {\n return {\n name: \"agent-native-full-reload-optimize-dep-504\",\n apply: \"serve\",\n configureServer(server) {\n let lastReloadAt = 0;\n server.middlewares.use((req, res, next) => {\n const originalEnd = res.end;\n (res as unknown as { end: (...args: unknown[]) => unknown }).end = (\n ...endArgs: unknown[]\n ) => {\n const statusMessage = String(res.statusMessage || \"\");\n if (\n res.statusCode === 504 &&\n statusMessage === \"Outdated Optimize Dep\"\n ) {\n const now = Date.now();\n if (now - lastReloadAt > 500) {\n lastReloadAt = now;\n server.ws.send({ type: \"full-reload\" });\n server.config.logger.info(\n `[agent-native] Vite optimized deps changed while loading ${\n req.url ?? \"a module\"\n }; reloading the page.`,\n { timestamp: true },\n );\n }\n }\n return (originalEnd as (...args: unknown[]) => unknown).apply(\n res,\n endArgs,\n );\n };\n next();\n });\n },\n };\n}\n\n/**\n * Vite plugin that prevents the built-in base middleware from redirecting\n * \"/\" → \"/app/\" (or whatever the base is). When agent-native apps run with\n * --base /app/ in single-port mode, Vite's baseMiddleware sends a 302 from\n * \"/\" to the base path. This breaks Electron webview and iframe embeds\n * that load the app at the root. Instead, we rewrite \"/\" to the base path\n * internally so the app serves without a visible redirect.\n */\nfunction baseRedirectGuard(): Plugin {\n return {\n name: \"agent-native-base-redirect-guard\",\n apply: \"serve\",\n configureServer(server) {\n // Return a function so the middleware is added AFTER Vite's internal\n // middleware is built — but we insert BEFORE by using the pre-hook\n // approach: configureServer hooks that return nothing run before\n // internal middleware.\n server.middlewares.use((req, res, next) => {\n const base = server.config.base;\n if (base && base !== \"/\" && req.url?.startsWith(base)) {\n const relativeUrl = req.url.slice(base.length - 1);\n try {\n const url = new URL(relativeUrl, \"http://agent-native.local\");\n const publicDir = server.config.publicDir;\n if (typeof publicDir !== \"string\") {\n return next();\n }\n const publicPath = path.normalize(\n path.join(publicDir, decodeURIComponent(url.pathname)),\n );\n if (\n publicPath.startsWith(publicDir + path.sep) &&\n fs.existsSync(publicPath) &&\n fs.statSync(publicPath).isFile()\n ) {\n const contentType = contentTypeForPublicFile(publicPath);\n if (contentType) res.setHeader(\"content-type\", contentType);\n if (req.method === \"HEAD\") {\n res.statusCode = 200;\n res.end();\n return;\n }\n fs.createReadStream(publicPath).pipe(res);\n return;\n }\n } catch {\n // Fall through to Vite/Nitro. Malformed URLs should keep their\n // original path so the normal dev-server error handling applies.\n }\n }\n req.url = stripMountedDevApiPath(req.url, base);\n if (\n req.method === \"HEAD\" &&\n req.url &&\n !isFrameworkDevPath(req.url, base)\n ) {\n req.method = \"GET\";\n }\n if (\n base &&\n base !== \"/\" &&\n (req.url === \"/\" || req.url === \"/index.html\")\n ) {\n // Rewrite to the base path so Vite serves the app directly\n req.url = base;\n }\n next();\n });\n },\n };\n}\n\nfunction contentTypeForPublicFile(filePath: string): string | null {\n switch (path.extname(filePath).toLowerCase()) {\n case \".css\":\n return \"text/css\";\n case \".html\":\n return \"text/html\";\n case \".ico\":\n return \"image/x-icon\";\n case \".json\":\n case \".webmanifest\":\n return \"application/json\";\n case \".js\":\n case \".mjs\":\n return \"text/javascript\";\n case \".png\":\n return \"image/png\";\n case \".svg\":\n return \"image/svg+xml\";\n case \".txt\":\n return \"text/plain\";\n case \".xml\":\n return \"application/xml\";\n default:\n return null;\n }\n}\n\nfunction devPathname(reqUrl: string): string {\n return new URL(reqUrl, \"http://agent-native.local\").pathname;\n}\n\nfunction isApiDevPath(reqUrl: string): boolean {\n const pathname = devPathname(reqUrl);\n return pathname === \"/api\" || pathname.startsWith(\"/api/\");\n}\n\nexport function stripMountedDevApiPath(\n reqUrl: string | undefined,\n base: string | undefined,\n): string | undefined {\n if (!reqUrl || !base || base === \"/\") return reqUrl;\n const normalizedBase = base.endsWith(\"/\") ? base : `${base}/`;\n if (!reqUrl.startsWith(normalizedBase)) return reqUrl;\n const stripped = reqUrl.slice(normalizedBase.length - 1) || \"/\";\n return isApiDevPath(stripped) ? stripped : reqUrl;\n}\n\nexport function isFrameworkDevPath(\n reqUrl: string,\n base: string | undefined,\n): boolean {\n const pathname = devPathname(reqUrl);\n if (pathname === \"/_agent-native\" || pathname.startsWith(\"/_agent-native/\")) {\n return true;\n }\n if (!base || base === \"/\") return false;\n const normalizedBase = base.endsWith(\"/\") ? base.slice(0, -1) : base;\n return (\n pathname === `${normalizedBase}/_agent-native` ||\n pathname.startsWith(`${normalizedBase}/_agent-native/`)\n );\n}\n\n/**\n * Work around a Rolldown bug where Nitro passes service entries as objects\n * ({index: \"path\"}) but Rolldown expects strings. This plugin normalizes\n * rollupOptions.input entries in the SSR environment.\n */\nfunction rolldownInputFix(): Plugin {\n return {\n name: \"agent-native-rolldown-input-fix\",\n configEnvironment(name, config) {\n const input = config.build?.rollupOptions?.input;\n if (!Array.isArray(input)) return;\n // Flatten any object entries to just their string values\n const fixed = input.map((entry: any) => {\n if (typeof entry === \"string\") return entry;\n if (typeof entry === \"object\" && entry !== null) {\n const values = Object.values(entry);\n return values[0] as string;\n }\n return entry;\n });\n config.build!.rollupOptions!.input = fixed;\n },\n };\n}\n\n/**\n * Expose the resolved Vite dev server port as process.env.PORT so that\n * in-process scripts (which use localFetch → http://localhost:${PORT}/api/...)\n * hit the right address even when Vite auto-increments the port.\n */\n/**\n * Replace caller-specified packages with an empty proxy stub during SSR\n * builds. For apps whose heavy browser-only deps would otherwise bloat the\n * edge worker past CF Pages' 25 MiB Functions limit.\n *\n * The template lists the packages in its `defineConfig({ ssrStubs })` call —\n * the framework never hardcodes package names.\n */\nfunction ssrStubPlugin(packages: string[]): Plugin | null {\n if (!packages.length) return null;\n const stubbed = new Set(packages);\n const STUB_ID = \"\\0agent-native-ssr-stub\";\n return {\n name: \"agent-native-ssr-stub-heavy-libs\",\n enforce: \"pre\",\n resolveId(id, _importer, opts) {\n if (!opts?.ssr) return null;\n // Match the bare package name or any subpath\n const pkg = id\n .split(\"/\")\n .slice(0, id.startsWith(\"@\") ? 2 : 1)\n .join(\"/\");\n if (stubbed.has(pkg)) return STUB_ID;\n return null;\n },\n load(id) {\n if (id !== STUB_ID) return null;\n // Proxy that answers any property access with itself — lets dead\n // import/re-export chains parse without blowing up, and still throws\n // if code actually tries to call any of it on the server.\n return (\n \"const handler = { get(_, p) { \" +\n \"if (p === Symbol.toPrimitive) return () => ''; \" +\n \"if (p === 'then') return undefined; \" +\n \"return new Proxy(() => {}, handler); \" +\n \"} };\" +\n \"const stub = new Proxy(() => {}, handler);\" +\n \"export default stub;\"\n );\n },\n };\n}\n\nfunction portExposer(): Plugin {\n return {\n name: \"agent-native-port-exposer\",\n apply: \"serve\",\n configureServer(server) {\n server.httpServer?.once(\"listening\", () => {\n const addr = server.httpServer?.address();\n if (addr && typeof addr === \"object\" && addr.port) {\n process.env.PORT = String(addr.port); // guard:allow-env-mutation — Vite dev server port published once at boot before any request\n }\n });\n },\n };\n}\n\n/**\n * Silence benign connection-reset noise from Vite's dev middleware.\n * Fires when a browser closes/reloads/navigates mid-request — the peer has\n * already gone away, there's nothing to fix, and Vite's error middleware\n * spams the terminal and browser HMR overlay with errors like\n * \"read ECONNRESET\" and \"socket hang up\". Our H3 server layer already\n * swallows these (create-server.ts onError); this plugin does the same for\n * Vite's own connect pipeline.\n */\nfunction silenceConnectionResets(): Plugin {\n const isBenign = (err: unknown) => {\n const e = err as\n | (NodeJS.ErrnoException & { cause?: NodeJS.ErrnoException })\n | undefined;\n const code = e?.code || (e?.cause as NodeJS.ErrnoException)?.code;\n const message = String(e?.message ?? \"\");\n return (\n code === \"ECONNRESET\" ||\n code === \"ECONNABORTED\" ||\n code === \"EPIPE\" ||\n /^(read ECONNRESET|write ECONNRESET|socket hang up|aborted|write EPIPE)$/i.test(\n message,\n )\n );\n };\n const isBenignErrorPayload = (payload: unknown) => {\n const p = payload as { type?: string; err?: unknown } | undefined;\n return p?.type === \"error\" && isBenign(p.err);\n };\n return {\n name: \"agent-native-silence-connection-resets\",\n apply: \"serve\",\n configureServer(server) {\n // Swallow socket-level resets so Node doesn't surface them as uncaught.\n server.httpServer?.on(\"connection\", (socket) => {\n socket.on(\"error\", (err) => {\n if (!isBenign(err)) throw err;\n });\n });\n // Drop Vite's \"Internal server error: read ECONNRESET\" log lines.\n const origError = server.config.logger.error.bind(server.config.logger);\n server.config.logger.error = (msg, opts) => {\n const text = typeof msg === \"string\" ? msg : String(msg ?? \"\");\n if (\n (opts?.error && isBenign(opts.error)) ||\n /Internal server error:\\s*(read ECONNRESET|write ECONNRESET|socket hang up|aborted|EPIPE)/i.test(\n text,\n )\n ) {\n return;\n }\n origError(msg, opts);\n };\n\n // Vite's error middleware sends these same benign errors to the HMR\n // client, which turns them into the full-screen browser overlay.\n // Suppress just those payloads while leaving real transform/runtime\n // errors untouched.\n const hot = (\n server as unknown as {\n environments?: { client?: { hot?: { send?: Function } } };\n }\n ).environments?.client?.hot;\n if (hot?.send) {\n const origHotSend = hot.send.bind(hot);\n hot.send = (payload: unknown, ...args: unknown[]) => {\n if (isBenignErrorPayload(payload)) return;\n return origHotSend(payload, ...args);\n };\n }\n\n const ws = (server as unknown as { ws?: { send?: Function } }).ws;\n if (ws?.send) {\n const origWsSend = ws.send.bind(ws);\n ws.send = (payload: unknown, ...args: unknown[]) => {\n if (isBenignErrorPayload(payload)) return;\n return origWsSend(payload, ...args);\n };\n }\n },\n };\n}\n\n/**\n * Create the client Vite config with sensible agent-native defaults.\n * Supports two modes:\n * - Legacy SPA mode (default): React SWC plugin, client-only routing\n * - React Router framework mode: SSR-capable with file-based routing\n *\n * Both modes include Nitro for API routes, path aliases, and fs restrictions.\n */\nexport function defineConfig(options: ClientConfigOptions = {}): UserConfig {\n // Check if React Router plugin was passed directly in plugins array\n const hasReactRouterPlugin = options.plugins?.some(\n (p: any) =>\n p?.name === \"react-router\" ||\n (Array.isArray(p) && p.some((pp: any) => pp?.name === \"react-router\")),\n );\n\n let reactTransformPlugin: any;\n\n if (!hasReactRouterPlugin && !options.reactRouter) {\n // Legacy SPA mode — use React SWC plugin (only when React Router is not used)\n try {\n reactTransformPlugin = require(\"@vitejs/plugin-react-swc\");\n if (reactTransformPlugin.default)\n reactTransformPlugin = reactTransformPlugin.default;\n } catch {\n // Will be resolved at runtime by Vite\n }\n }\n\n const cwd = process.cwd();\n\n // Workspace env fallback. If this app is inside a workspace, tell Vite to\n // also look for .env files at the workspace root. Per-app .env still wins\n // (Vite's loadEnv merges in precedence order — app dir is loaded after).\n const workspaceRoot = findWorkspaceRoot(cwd);\n const envDir = workspaceRoot && workspaceRoot !== cwd ? workspaceRoot : cwd;\n\n // Preload workspace-root .env into process.env so Nitro server code sees\n // shared keys during dev (Nitro reads process.env, not vite's envDir).\n if (workspaceRoot && workspaceRoot !== cwd) {\n try {\n const dotenv = require(\"dotenv\");\n dotenv.config({\n path: path.join(workspaceRoot, \".env\"),\n override: false,\n // Suppress the dotenv v17 tip line — this loader fires alongside\n // utils.ts loadEnv() during dev startup and would otherwise emit a\n // duplicate \"[dotenv] injecting env\" message.\n quiet: true,\n });\n } catch {}\n }\n\n // Build the React transform plugin (only for legacy SPA mode)\n const reactPluginInstance = reactTransformPlugin?.();\n\n // Auto-inject the Tailwind v4 Vite plugin if `@tailwindcss/vite` is\n // installed (which it is by default for all agent-native templates).\n // Templates can opt out by setting `options.tailwind = false`.\n let tailwindPluginInstance: any = null;\n if (options.tailwind !== false) {\n try {\n let tailwindPlugin = require(\"@tailwindcss/vite\");\n if (tailwindPlugin.default) tailwindPlugin = tailwindPlugin.default;\n // Tailwind's Vite optimizer uses Lightning CSS internally and runs\n // before Vite's own CSS minifier. Lightning CSS collapses the standard\n // `backdrop-filter` declaration when a `-webkit-` fallback is present,\n // so let Vite/esbuild handle the production CSS pass instead.\n tailwindPluginInstance = tailwindPlugin({ optimize: false });\n } catch {\n // Plugin not installed — silently skip. Old templates may still be on v3.\n }\n }\n\n // APP_BASE_PATH lets this app be mounted under a prefix (e.g. \"/mail\") as\n // part of a unified workspace deploy. Defaults to \"/\" for standalone apps.\n const appBasePath =\n process.env.VITE_APP_BASE_PATH || process.env.APP_BASE_PATH || \"/\";\n const isWorkspaceChild = process.env.AGENT_NATIVE_WORKSPACE === \"1\";\n const base = appBasePath.endsWith(\"/\") ? appBasePath : `${appBasePath}/`;\n const monorepoCoreAllow = [\n path.resolve(cwd, \"../../packages/core\"),\n path.resolve(cwd, \"../core\"),\n ].filter((candidate) => fs.existsSync(path.join(candidate, \"package.json\")));\n\n // Workspace-core (enterprise monorepo): pull its directory into Vite's\n // file watcher + module graph so edits to its TS sources hot-reload the\n // dev server, and its package name into ssr.noExternal so the dynamic\n // import in framework-request-handler.ts goes through Vite's transform\n // pipeline (TypeScript, SSR HMR, the works).\n const workspaceCore = findWorkspaceCoreSync(cwd);\n const workspaceCoreFsAllow = workspaceCore ? [workspaceCore.packageDir] : [];\n const workspaceCoreNoExternal = workspaceCore\n ? [new RegExp(`^${escapeRegex(workspaceCore.packageName)}(/.*)?$`)]\n : [];\n\n return {\n logLevel: options.logLevel ?? (isWorkspaceChild ? \"warn\" : undefined),\n envDir,\n base,\n server: {\n host: \"::\",\n port: options.port ?? 8080,\n allowedHosts: options.allowedHosts ?? [\n \".ngrok-free.dev\",\n \".ngrok-free.app\",\n \".ngrok.io\",\n ],\n fs: {\n allow: [\n \".\",\n ...monorepoCoreAllow,\n ...workspaceCoreFsAllow,\n ...(options.fsAllow ?? []),\n ],\n deny: [\n \".env\",\n \".env.*\",\n \"*.{crt,pem}\",\n \"**/.git/**\",\n ...(options.fsDeny ?? []),\n ],\n },\n },\n build: {\n outDir: options.outDir ?? \"dist/spa\",\n // Vite 8 defaults CSS minification to Lightning CSS, which collapses a\n // `backdrop-filter` + `-webkit-backdrop-filter` pair down to only the\n // prefixed form. Chrome ignores that, so glass effects disappear in\n // production. Keep esbuild as the CSS minifier and target Safari 18+ so\n // the standard property survives the production pipeline.\n cssMinify: \"esbuild\",\n cssTarget: [\"es2020\", \"safari18\"],\n },\n // Bundle all non-Node.js deps into the production SSR server build.\n // Edge runtimes (CF Workers, Deno) don't have node_modules at runtime.\n // In dev, React Router's Vite Environment runner expects CJS packages\n // like React to stay external; forcing them through the module runner\n // raises `module is not defined`.\n ssr: process.argv.includes(\"build\")\n ? {\n noExternal: /^(?!node:)/,\n // Pick the workspace-core's compiled `dist/` exports in prod —\n // Node-style `default` condition matches what edge runtimes (CF\n // Workers, Deno) can actually load. Without this, Vite's prod\n // build inherits the dev-condition src/ entry and ships unbuilt\n // TypeScript into the worker.\n resolve: {\n conditions: [\"node\", \"module\", \"import\", \"default\"],\n externalConditions: [\"node\", \"module\", \"import\", \"default\"],\n },\n }\n : {\n // Vite already sets `development` in the dev resolve conditions,\n // so the workspace-core template's exports.development → src/\n // entry is picked automatically — Vite handles TS compilation\n // and triggers a server restart when those files change.\n noExternal: [\n /^@agent-native\\/core(\\/.*)?$/,\n // Radix UI primitives are transitive deps of @agent-native/core\n // (used by FeedbackButton, AgentSidebar, ShareDialog, etc.). When\n // a consumer app SSRs a component that imports Radix, Node's\n // externalized resolver can't find @radix-ui/* from the app cwd\n // because pnpm doesn't hoist transitive deps. Bundling them\n // through Vite resolves them via the workspace store.\n /^@radix-ui\\//,\n // scheduling ships tsc-compiled dist files that contain literal\n // `@/` path-alias imports (e.g. `import { Input } from\n // \"@/components/ui/input\"`). In standalone (published) mode Node\n // treats the package as an external CJS dep and can't resolve\n // `@/components`. Adding it to noExternal makes Vite process it\n // through the module pipeline, where the consumer app's `@` →\n // `./app` alias is already registered.\n ...(hasDep(\"@agent-native/scheduling\", cwd)\n ? [/^@agent-native\\/scheduling(\\/.*)?$/]\n : []),\n ...workspaceCoreNoExternal,\n ],\n external: [\n \"react\",\n \"react-dom\",\n \"react-dom/server\",\n \"react-router\",\n \"react-router/dom\",\n \"react-router-dom\",\n ],\n },\n plugins: [\n // Stub packages from `options.ssrStubs` in the SSR bundle so they\n // don't bloat the edge worker. Opt-in per template — the framework\n // hardcodes nothing (e.g. docs sites legitimately import `shiki` on\n // the server, so we can't blanket-stub it here).\n ...(() => {\n const p = ssrStubPlugin(options.ssrStubs ?? []);\n return p ? [p] : [];\n })(),\n ...(options.plugins ?? []),\n actionTypesPlugin(),\n agentsBundlePlugin(),\n autoReloadOnOptimizeDep(),\n fullReloadOnOptimizeDep504(),\n baseRedirectGuard(),\n portExposer(),\n silenceConnectionResets(),\n rolldownInputFix(),\n // Nitro Vite plugin for dev-mode API route serving and HMR.\n // Disabled during build — React Router's build handles production.\n ...(process.argv.includes(\"build\")\n ? []\n : [\n nitroVitePlugin({\n serverDir: \"./server\",\n ...(options.nitro ?? {}),\n } as any),\n ]),\n reactPluginInstance,\n tailwindPluginInstance,\n ].filter(Boolean),\n optimizeDeps: {\n include: [\n ...getDefaultOptimizeDeps(cwd),\n ...(hasDep(\"@agent-native/pinpoint\", cwd)\n ? [\"@agent-native/pinpoint/react\"]\n : []),\n ...(options.optimizeDeps?.include ?? []),\n ],\n // In monorepo mode: explicitly exclude @agent-native/core subpaths so\n // Vite never prebundles them from dist/. The source alias above\n // (`getCoreSourceAliases`) resolves every import to src/ on every\n // request, so HMR picks up new exports immediately. Without exclude,\n // the prebundle is built from dist/ once at startup and silently\n // serves stale code even after the source / dist is updated.\n exclude: [\n ...(findCoreSrcDir(cwd) !== null ? CORE_CLIENT_SUBPATHS : []),\n ...(options.optimizeDeps?.exclude ?? []),\n ],\n },\n resolve: {\n // Dedupe all client-side packages that core shares with the consuming\n // app. In pnpm monorepos, core's devDependencies can install separate\n // copies (linked to different React versions). Without deduping, each\n // copy creates its own React context — QueryClientProvider, RouterProvider,\n // Radix, etc. — causing \"No provider\" crashes at runtime.\n dedupe: getClientDedupe(cwd),\n alias: [\n // In monorepo dev: resolve @agent-native/core to source for HMR.\n // Uses regex with $ anchor for exact matching to prevent\n // @agent-native/core from prefix-matching @agent-native/core/client.\n ...getCoreSourceAliases(cwd),\n // Standard path aliases (prefix matching is fine here)\n { find: \"@\", replacement: path.resolve(cwd, \"./app\") },\n { find: \"@shared\", replacement: path.resolve(cwd, \"./shared\") },\n ...Object.entries(options.aliases ?? {}).map(([find, replacement]) => ({\n find,\n replacement,\n })),\n ],\n },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/vite/client.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,OAAO,EAAE,KAAK,IAAI,eAAe,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AAEjF,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE/D;;;;;;;;;;;;;GAaG;AACH,SAAS,qBAAqB,CAC5B,QAAgB;IAEhB,4EAA4E;IAC5E,IAAI,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACjC,IAAI,aAAa,GAAkB,IAAI,CAAC;IACxC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CAAC,CAAC,CAAC,EAAE,CAAC;gBAC7D,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,OAAO,IAAI,EAAE,CAAC;aACzC;SACF;QACD,OAAO,EAAE;YACP,sEAAsE;YACtE,sEAAsE;YACtE,sEAAsE;YACtE,4EAA4E;YAC5E,0DAA0D;YAC1D,MAAM,EAAE,eAAe,CAAC,GAAG,CAAC;YAC5B,KAAK,EAAE;gBACL,iEAAiE;gBACjE,yDAAyD;gBACzD,qEAAqE;gBACrE,GAAG,oBAAoB,CAAC,GAAG,CAAC;gBAC5B,uDAAuD;gBACvD,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE;gBACtD,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC,EAAE;gBAC/D,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,EAAE,CAAC,CAAC;oBACrE,IAAI;oBACJ,WAAW;iBACZ,CAAC,CAAC;aACJ;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["import path from \"path\";\nimport fs from \"fs\";\nimport { createRequire } from \"module\";\nimport type { Plugin, UserConfig } from \"vite\";\nimport { nitro as nitroVitePlugin } from \"nitro/vite\";\nimport { actionTypesPlugin } from \"./action-types-plugin.js\";\nimport { agentsBundlePlugin } from \"./agents-bundle-plugin.js\";\nimport { findWorkspaceRoot } from \"../scripts/utils.js\";\nimport { getViteDevRecoveryScript } from \"../client/vite-dev-recovery-script.js\";\n\nimport { fileURLToPath } from \"url\";\n\nconst require = createRequire(import.meta.url);\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\n/**\n * Sync discovery for the workspace-core in an enterprise monorepo.\n *\n * Mirrors `getWorkspaceCoreExports` in deploy/workspace-core.ts but stays\n * synchronous so it can run inline in `defineConfig`. Returns the workspace\n * core's package name + absolute directory, or null if no workspace core is\n * declared in the ancestor chain.\n *\n * Walks up from `startDir` looking for a package.json with\n * `agent-native.workspaceCore`. Resolves the declared package name through\n * `<workspaceRoot>/node_modules/<name>` (pnpm symlink, fastest) or by\n * scanning `packages/*` for a matching `name` field (fallback for\n * pre-install scenarios).\n */\nfunction findWorkspaceCoreSync(\n startDir: string,\n): { packageName: string; packageDir: string } | null {\n // 1) Walk up looking for the root package.json that declares workspaceCore.\n let dir = path.resolve(startDir);\n let workspaceRoot: string | null = null;\n let packageName: string | null = null;\n for (let i = 0; i < 20; i++) {\n const pkgPath = path.join(dir, \"package.json\");\n if (fs.existsSync(pkgPath)) {\n try {\n const pkg = JSON.parse(fs.readFileSync(pkgPath, \"utf-8\"));\n const declared = pkg?.[\"agent-native\"]?.workspaceCore;\n if (typeof declared === \"string\" && declared.length > 0) {\n workspaceRoot = dir;\n packageName = declared;\n break;\n }\n } catch {\n // Malformed package.json — keep walking up.\n }\n }\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n if (!workspaceRoot || !packageName) return null;\n\n // 2a) pnpm/npm symlink under workspaceRoot/node_modules.\n const nm = path.join(workspaceRoot, \"node_modules\", packageName);\n if (fs.existsSync(path.join(nm, \"package.json\"))) {\n return { packageName, packageDir: fs.realpathSync(nm) };\n }\n\n // 2b) Scan packages/* and packages/@scope/* for a matching `name`.\n const packagesDir = path.join(workspaceRoot, \"packages\");\n if (fs.existsSync(packagesDir)) {\n const candidates: string[] = [];\n for (const entry of fs.readdirSync(packagesDir, { withFileTypes: true })) {\n if (!entry.isDirectory()) continue;\n candidates.push(path.join(packagesDir, entry.name));\n if (entry.name.startsWith(\"@\")) {\n const scopeDir = path.join(packagesDir, entry.name);\n for (const sub of fs.readdirSync(scopeDir, { withFileTypes: true })) {\n if (sub.isDirectory()) candidates.push(path.join(scopeDir, sub.name));\n }\n }\n }\n for (const c of candidates) {\n const p = path.join(c, \"package.json\");\n if (!fs.existsSync(p)) continue;\n try {\n const pkg = JSON.parse(fs.readFileSync(p, \"utf-8\"));\n if (pkg?.name === packageName)\n return { packageName, packageDir: fs.realpathSync(c) };\n } catch {\n // ignore malformed package.json\n }\n }\n }\n return null;\n}\n\n/** Escape a string so it can be embedded as a regex literal. */\nfunction escapeRegex(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\n/** Check if a package is installed in the project */\nfunction hasDep(pkg: string, cwd: string): boolean {\n try {\n const pkgJson = JSON.parse(\n fs.readFileSync(path.join(cwd, \"package.json\"), \"utf-8\"),\n );\n return !!(\n pkgJson.dependencies?.[pkg] ||\n pkgJson.devDependencies?.[pkg] ||\n pkgJson.peerDependencies?.[pkg]\n );\n } catch {\n return false;\n }\n}\n\n/**\n * Build the `resolve.dedupe` list dynamically. Reads core's package.json and\n * collects every peerDependency that the consuming app also declares. This\n * ensures Vite resolves them from the app root, not from core's own\n * node_modules — preventing duplicate React context / singleton issues.\n */\nfunction getClientDedupe(cwd: string): string[] {\n // Always dedupe React internals (sub-path exports aren't in peerDeps)\n const always = new Set([\"react\", \"react-dom\", \"react-dom/client\"]);\n\n // Server-only packages that never run in the browser — no point deduping.\n const serverOnly = new Set([\n \"drizzle-kit\",\n \"node-pty\",\n \"postgres\",\n \"ws\",\n \"typescript\",\n \"vite\",\n \"@vitejs/plugin-react-swc\",\n \"tailwindcss\",\n \"@tailwindcss/vite\",\n ]);\n\n try {\n const corePkgPath = path.resolve(__dirname, \"../../package.json\");\n const corePkg = JSON.parse(fs.readFileSync(corePkgPath, \"utf-8\"));\n\n // Scan both peerDependencies and dependencies. Direct deps like\n // @radix-ui/* use React internally — they must resolve against the\n // app's React, not a second copy inside core's node_modules.\n const coreDeps = new Set([\n ...Object.keys(corePkg.peerDependencies ?? {}),\n ...Object.keys(corePkg.dependencies ?? {}),\n ]);\n\n // Read the consuming app's dependencies\n const appPkg = JSON.parse(\n fs.readFileSync(path.join(cwd, \"package.json\"), \"utf-8\"),\n );\n const appDeps = new Set([\n ...Object.keys(appPkg.dependencies ?? {}),\n ...Object.keys(appPkg.devDependencies ?? {}),\n ]);\n\n for (const dep of coreDeps) {\n if (serverOnly.has(dep)) continue;\n // Dedupe if the app also declares it, OR if it's a React-based\n // UI library (Radix, Tanstack) that must share the app's React.\n if (\n appDeps.has(dep) ||\n dep.startsWith(\"@radix-ui/\") ||\n dep.startsWith(\"@tanstack/\")\n ) {\n always.add(dep);\n }\n }\n } catch {\n // Can't read package.json — fall back to known singletons\n }\n\n return [...always];\n}\n\n/**\n * Locate `packages/core/src` if we're inside the framework monorepo.\n * Shared between `getCoreSourceAliases` (which redirects imports to src/)\n * and `getDefaultOptimizeDeps` (which must NOT prebundle from dist/ when\n * the alias is active — otherwise the prebundle is built from a snapshot\n * of dist/ at startup and never picks up new exports).\n */\nfunction findCoreSrcDir(cwd: string): string | null {\n const candidates = [\n path.resolve(cwd, \"../../packages/core\"), // templates/<name>/\n path.resolve(cwd, \"../core\"), // packages/<name>/\n ];\n for (const candidate of candidates) {\n if (fs.existsSync(path.join(candidate, \"src/index.ts\"))) {\n return path.join(candidate, \"src\");\n }\n }\n return null;\n}\n\n/**\n * Every `@agent-native/core` subpath that gets a source alias. Must stay in\n * sync with `getCoreSourceAliases`. Used by `getDefaultOptimizeDeps` to skip\n * prebundling in monorepo mode, and by the consumer config to add them to\n * `optimizeDeps.exclude` so Vite always resolves them through the source\n * alias on every request — never from a stale dist/ snapshot.\n */\nconst CORE_CLIENT_SUBPATHS = [\n \"@agent-native/core\",\n \"@agent-native/core/client\",\n \"@agent-native/core/client/extensions\",\n \"@agent-native/core/client/tools\", // legacy alias\n \"@agent-native/core/client/org\",\n \"@agent-native/core/client/observability\",\n \"@agent-native/core/client/onboarding\",\n \"@agent-native/core/client/sharing\",\n \"@agent-native/core/client/notifications\",\n \"@agent-native/core/client/progress\",\n];\n\nfunction getDefaultOptimizeDeps(cwd: string): string[] {\n const inMonorepo = findCoreSrcDir(cwd) !== null;\n const entries: Array<{ specifier: string; packageName?: string }> = [\n // In monorepo mode the source alias resolves these to src/ on every\n // import, so prebundling from dist/ would just create a stale snapshot.\n // Skip them entirely — `optimizeDeps.exclude` below makes that explicit.\n ...(inMonorepo\n ? []\n : ([\n { specifier: \"@agent-native/core\" },\n {\n specifier: \"@agent-native/core/client\",\n packageName: \"@agent-native/core\",\n },\n {\n specifier: \"@agent-native/core/client/org\",\n packageName: \"@agent-native/core\",\n },\n {\n specifier: \"@agent-native/core/client/extensions\",\n packageName: \"@agent-native/core\",\n },\n {\n // Legacy alias — prior name for @agent-native/core/client/extensions.\n // Keep so deployed templates that haven't been updated still resolve.\n specifier: \"@agent-native/core/client/tools\",\n packageName: \"@agent-native/core\",\n },\n ] as Array<{ specifier: string; packageName?: string }>)),\n { specifier: \"@libsql/client\" },\n { specifier: \"@radix-ui/react-accordion\" },\n { specifier: \"@radix-ui/react-alert-dialog\" },\n { specifier: \"@radix-ui/react-avatar\" },\n { specifier: \"@radix-ui/react-checkbox\" },\n { specifier: \"@radix-ui/react-collapsible\" },\n { specifier: \"@radix-ui/react-context-menu\" },\n { specifier: \"@radix-ui/react-dialog\" },\n { specifier: \"@radix-ui/react-dropdown-menu\" },\n { specifier: \"@radix-ui/react-hover-card\" },\n { specifier: \"@radix-ui/react-label\" },\n { specifier: \"@radix-ui/react-menubar\" },\n { specifier: \"@radix-ui/react-navigation-menu\" },\n { specifier: \"@radix-ui/react-popover\" },\n { specifier: \"@radix-ui/react-progress\" },\n { specifier: \"@radix-ui/react-radio-group\" },\n { specifier: \"@radix-ui/react-scroll-area\" },\n { specifier: \"@radix-ui/react-select\" },\n { specifier: \"@radix-ui/react-separator\" },\n { specifier: \"@radix-ui/react-slider\" },\n { specifier: \"@radix-ui/react-slot\" },\n { specifier: \"@radix-ui/react-switch\" },\n { specifier: \"@radix-ui/react-tabs\" },\n { specifier: \"@radix-ui/react-toast\" },\n { specifier: \"@radix-ui/react-toggle\" },\n { specifier: \"@radix-ui/react-toggle-group\" },\n { specifier: \"@radix-ui/react-tooltip\" },\n { specifier: \"@tanstack/react-query\" },\n { specifier: \"@tabler/icons-react\" },\n { specifier: \"class-variance-authority\" },\n { specifier: \"clsx\" },\n { specifier: \"cmdk\" },\n { specifier: \"drizzle-orm\" },\n { specifier: \"drizzle-orm/pg-core\", packageName: \"drizzle-orm\" },\n { specifier: \"drizzle-orm/sqlite-core\", packageName: \"drizzle-orm\" },\n { specifier: \"h3\" },\n { specifier: \"next-themes\" },\n { specifier: \"react-hook-form\" },\n { specifier: \"sonner\" },\n { specifier: \"tailwind-merge\" },\n { specifier: \"zod\" },\n ];\n\n return entries\n .filter(({ specifier, packageName }) =>\n hasDep(packageName ?? specifier, cwd),\n )\n .map(({ specifier }) => specifier);\n}\n\n/**\n * In monorepo dev mode, resolve @agent-native/core imports to source (src/)\n * instead of dist/ so that Vite HMR picks up changes without rebuilding.\n *\n * Returns Vite array-style aliases with exact matching (regex anchored with $)\n * to prevent `@agent-native/core` from prefix-matching and swallowing\n * sub-path imports like `@agent-native/core/client`.\n */\nfunction getCoreSourceAliases(\n cwd: string,\n): Array<{ find: RegExp; replacement: string }> {\n const coreSrc = findCoreSrcDir(cwd);\n if (!coreSrc) return []; // Not in monorepo — use dist as normal\n\n // Map every @agent-native/core/* export to its src/ equivalent.\n // Each entry uses a regex with $ anchor for exact matching.\n const entries: Record<string, string> = {\n \"@agent-native/core\": path.join(coreSrc, \"index.browser.ts\"),\n \"@agent-native/core/server\": path.join(coreSrc, \"server/index.ts\"),\n \"@agent-native/core/client\": path.join(coreSrc, \"client/index.ts\"),\n \"@agent-native/core/client/extensions\": path.join(\n coreSrc,\n \"client/extensions/index.ts\",\n ),\n // Legacy alias — see exports map note above.\n \"@agent-native/core/client/tools\": path.join(\n coreSrc,\n \"client/extensions/index.ts\",\n ),\n \"@agent-native/core/client/org\": path.join(coreSrc, \"client/org/index.ts\"),\n \"@agent-native/core/client/observability\": path.join(\n coreSrc,\n \"client/observability/index.ts\",\n ),\n \"@agent-native/core/client/onboarding\": path.join(\n coreSrc,\n \"client/onboarding/index.ts\",\n ),\n \"@agent-native/core/client/sharing\": path.join(\n coreSrc,\n \"client/sharing/index.ts\",\n ),\n \"@agent-native/core/client/notifications\": path.join(\n coreSrc,\n \"client/notifications/index.ts\",\n ),\n \"@agent-native/core/client/progress\": path.join(\n coreSrc,\n \"client/progress/index.ts\",\n ),\n \"@agent-native/core/db\": path.join(coreSrc, \"db/index.ts\"),\n \"@agent-native/core/db/schema\": path.join(coreSrc, \"db/schema.ts\"),\n \"@agent-native/core/shared\": path.join(coreSrc, \"shared/index.ts\"),\n \"@agent-native/core/scripts\": path.join(coreSrc, \"scripts/index.ts\"),\n \"@agent-native/core/application-state\": path.join(\n coreSrc,\n \"application-state/index.ts\",\n ),\n \"@agent-native/core/settings\": path.join(coreSrc, \"settings/index.ts\"),\n \"@agent-native/core/credentials\": path.join(\n coreSrc,\n \"credentials/index.ts\",\n ),\n \"@agent-native/core/resources\": path.join(coreSrc, \"resources/index.ts\"),\n \"@agent-native/core/oauth-tokens\": path.join(\n coreSrc,\n \"oauth-tokens/index.ts\",\n ),\n \"@agent-native/core/workspace-connections\": path.join(\n coreSrc,\n \"workspace-connections/index.ts\",\n ),\n \"@agent-native/core/a2a\": path.join(coreSrc, \"a2a/index.ts\"),\n \"@agent-native/core/router\": path.join(coreSrc, \"router/index.ts\"),\n \"@agent-native/core/terminal\": path.join(\n coreSrc,\n \"client/terminal/index.ts\",\n ),\n \"@agent-native/core/terminal/server\": path.join(\n coreSrc,\n \"terminal/index.ts\",\n ),\n \"@agent-native/core/adapters/cli\": path.join(\n coreSrc,\n \"adapters/cli/index.ts\",\n ),\n \"@agent-native/core/usage\": path.join(coreSrc, \"usage/store.ts\"),\n // Shared stylesheet — alias to src so CSS edits (composer/theme rules)\n // take effect live in dev instead of silently loading the stale built\n // copy at dist/styles/. From src/styles/ the `@source \"../client/**\"`\n // directive resolves to the real .tsx source, which is what dev should\n // scan for Tailwind classes anyway.\n \"@agent-native/core/styles/agent-native.css\": path.join(\n coreSrc,\n \"styles/agent-native.css\",\n ),\n };\n\n // Escape special regex chars in the key and anchor with $\n return Object.entries(entries).map(([find, replacement]) => ({\n find: new RegExp(`^${find.replace(/[/]/g, \"\\\\/\")}$`),\n replacement,\n }));\n}\n\nexport interface NitroOptions {\n /** Nitro deployment preset (e.g. \"node\", \"vercel\", \"netlify\", \"cloudflare_pages\"). Default: \"node\" */\n preset?: string;\n /** Source directory for server files. Default: \"./server\" */\n srcDir?: string;\n /** Routes directory name (relative to srcDir). Default: \"routes\" */\n routesDir?: string;\n /** Any additional Nitro config overrides */\n [key: string]: unknown;\n}\n\nexport interface ClientConfigOptions {\n /** Port for dev server. Default: 8080 */\n port?: number;\n /** Additional hostnames allowed to access the dev server. */\n allowedHosts?: NonNullable<NonNullable<UserConfig[\"server\"]>[\"allowedHosts\"]>;\n /** Vite log level. Workspace child apps default to \"warn\" so only the gateway URL is advertised. */\n logLevel?: UserConfig[\"logLevel\"];\n /** Additional Vite plugins */\n plugins?: any[];\n /** Nitro plugin options (preset, srcDir, etc) */\n nitro?: NitroOptions;\n /** Override resolve aliases */\n aliases?: Record<string, string>;\n /** Override build.outDir. Default: \"dist/spa\" */\n outDir?: string;\n /** Additional fs.allow paths */\n fsAllow?: string[];\n /** Additional fs.deny patterns */\n fsDeny?: string[];\n /** Additional Vite optimizeDeps configuration */\n optimizeDeps?: NonNullable<UserConfig[\"optimizeDeps\"]>;\n /**\n * Whether to auto-inject the Tailwind v4 Vite plugin (`@tailwindcss/vite`).\n * Defaults to true — set to `false` if a template wants to manage Tailwind\n * itself (e.g. the legacy v3 PostCSS pipeline).\n */\n tailwind?: boolean;\n /**\n * Package names to stub in the SSR bundle with an empty proxy object.\n *\n * Use this for dependencies that only run in the browser (canvas / diagram\n * libraries, editors, WebGL) but would otherwise get pulled into the\n * server bundle via SSR's noExternal policy — pushing the CF Pages\n * Functions bundle over the 25 MiB limit.\n *\n * Only add packages that are provably never called during SSR. If the\n * server imports one, it will receive a Proxy that throws on any real\n * use (which is better than bundling a 10 MiB dep the worker never calls).\n *\n * @example\n * ssrStubs: [\"mermaid\", \"@excalidraw/excalidraw\"]\n */\n ssrStubs?: string[];\n /**\n * @deprecated Pass `reactRouter()` directly in the `plugins` array instead.\n * Previously used to auto-load the React Router Vite plugin via require(),\n * but this fails in ESM contexts. Templates should now do:\n * ```ts\n * import { reactRouter } from \"@react-router/dev/vite\";\n * defineConfig({ plugins: [reactRouter()] })\n * ```\n */\n reactRouter?: boolean | Record<string, unknown>;\n}\n\n/**\n * Vite plugin that recovers the page when Vite's dependency optimizer\n * invalidates modules mid-load (the \"504 Outdated Optimize Dep\" error).\n *\n * Without this, the page silently fails: <script type=\"module\"> tags 504,\n * React never mounts, and the user is stuck on a blank screen until they\n * manually refresh. We catch the failure modes and auto-reload, with a\n * visible overlay so the user knows what's happening, and a loop guard\n * so we never thrash forever.\n *\n * CRITICAL: this must be a SYNCHRONOUS (non-module) script injected at\n * `head-prepend`. Module scripts are deferred — the browser starts fetching\n * all module scripts in parallel during HTML parsing, so a module listener\n * registers AFTER sibling modules have already started loading and\n * possibly errored out. A regular <script> blocks parsing and runs\n * synchronously, so the listener is registered before ANY module fetch\n * begins.\n *\n * Catches three failure modes (all before React needs to mount):\n * 1. <script type=\"module\"> / <link> 504 — window \"error\" event, capture phase\n * 2. Dynamic import 504 — \"unhandledrejection\" with \"dynamically imported module\"\n * 3. Child module 504 — resource timing when browser exposes the HTTP status\n */\nfunction autoReloadOnOptimizeDep(): Plugin {\n return {\n name: \"agent-native-auto-reload-optimize-dep\",\n apply: \"serve\",\n transformIndexHtml() {\n return [\n {\n tag: \"script\",\n // NOTE: no `type: \"module\"` — this must be a synchronous script.\n children: getViteDevRecoveryScript(),\n injectTo: \"head-prepend\",\n },\n ];\n },\n };\n}\n\n/**\n * Vite handles outdated optimized-dep requests inside its own transform\n * middleware and ends the HTTP response with `504 Outdated Optimize Dep`.\n * Browser module loaders do not consistently surface those child-module\n * failures to userland JavaScript, so also nudge the Vite HMR client from the\n * server side. This turns the confusing blank-screen state into the same\n * full-page reload Vite would have requested once optimization settled.\n */\nfunction fullReloadOnOptimizeDep504(): Plugin {\n return {\n name: \"agent-native-full-reload-optimize-dep-504\",\n apply: \"serve\",\n configureServer(server) {\n let lastReloadAt = 0;\n server.middlewares.use((req, res, next) => {\n const originalEnd = res.end;\n (res as unknown as { end: (...args: unknown[]) => unknown }).end = (\n ...endArgs: unknown[]\n ) => {\n const statusMessage = String(res.statusMessage || \"\");\n if (\n res.statusCode === 504 &&\n statusMessage === \"Outdated Optimize Dep\"\n ) {\n const now = Date.now();\n if (now - lastReloadAt > 500) {\n lastReloadAt = now;\n server.ws.send({ type: \"full-reload\" });\n server.config.logger.info(\n `[agent-native] Vite optimized deps changed while loading ${\n req.url ?? \"a module\"\n }; reloading the page.`,\n { timestamp: true },\n );\n }\n }\n return (originalEnd as (...args: unknown[]) => unknown).apply(\n res,\n endArgs,\n );\n };\n next();\n });\n },\n };\n}\n\n/**\n * Vite plugin that prevents the built-in base middleware from redirecting\n * \"/\" → \"/app/\" (or whatever the base is). When agent-native apps run with\n * --base /app/ in single-port mode, Vite's baseMiddleware sends a 302 from\n * \"/\" to the base path. This breaks Electron webview and iframe embeds\n * that load the app at the root. Instead, we rewrite \"/\" to the base path\n * internally so the app serves without a visible redirect.\n */\nfunction baseRedirectGuard(): Plugin {\n return {\n name: \"agent-native-base-redirect-guard\",\n apply: \"serve\",\n configureServer(server) {\n // Return a function so the middleware is added AFTER Vite's internal\n // middleware is built — but we insert BEFORE by using the pre-hook\n // approach: configureServer hooks that return nothing run before\n // internal middleware.\n server.middlewares.use((req, res, next) => {\n const base = server.config.base;\n if (base && base !== \"/\" && req.url?.startsWith(base)) {\n const relativeUrl = req.url.slice(base.length - 1);\n try {\n const url = new URL(relativeUrl, \"http://agent-native.local\");\n const publicDir = server.config.publicDir;\n if (typeof publicDir !== \"string\") {\n return next();\n }\n const publicPath = path.normalize(\n path.join(publicDir, decodeURIComponent(url.pathname)),\n );\n if (\n publicPath.startsWith(publicDir + path.sep) &&\n fs.existsSync(publicPath) &&\n fs.statSync(publicPath).isFile()\n ) {\n const contentType = contentTypeForPublicFile(publicPath);\n if (contentType) res.setHeader(\"content-type\", contentType);\n if (req.method === \"HEAD\") {\n res.statusCode = 200;\n res.end();\n return;\n }\n fs.createReadStream(publicPath).pipe(res);\n return;\n }\n } catch {\n // Fall through to Vite/Nitro. Malformed URLs should keep their\n // original path so the normal dev-server error handling applies.\n }\n }\n req.url = stripMountedDevApiPath(req.url, base);\n if (\n req.method === \"HEAD\" &&\n req.url &&\n !isFrameworkDevPath(req.url, base)\n ) {\n req.method = \"GET\";\n }\n if (\n base &&\n base !== \"/\" &&\n (req.url === \"/\" || req.url === \"/index.html\")\n ) {\n // Rewrite to the base path so Vite serves the app directly\n req.url = base;\n }\n next();\n });\n },\n };\n}\n\nfunction embedDevFrameHeaders(): Plugin {\n return {\n name: \"agent-native-embed-dev-frame-headers\",\n apply: \"serve\",\n configureServer(server) {\n server.middlewares.use((req, res, next) => {\n const cookieHeader = String(req.headers.cookie ?? \"\");\n let hasEmbedMarker = /\\ban_embed_session=/.test(cookieHeader);\n try {\n const url = new URL(req.url ?? \"/\", \"http://agent-native.local\");\n hasEmbedMarker =\n hasEmbedMarker || url.searchParams.has(\"__an_embed_token\");\n } catch {\n // Malformed URLs should continue through Vite's normal handling.\n }\n if (hasEmbedMarker) {\n res.setHeader(\"Cross-Origin-Embedder-Policy\", \"require-corp\");\n res.setHeader(\"Cross-Origin-Opener-Policy\", \"same-origin\");\n res.setHeader(\"Cross-Origin-Resource-Policy\", \"cross-origin\");\n res.setHeader(\"Referrer-Policy\", \"no-referrer\");\n }\n next();\n });\n },\n };\n}\n\nfunction contentTypeForPublicFile(filePath: string): string | null {\n switch (path.extname(filePath).toLowerCase()) {\n case \".css\":\n return \"text/css\";\n case \".html\":\n return \"text/html\";\n case \".ico\":\n return \"image/x-icon\";\n case \".json\":\n case \".webmanifest\":\n return \"application/json\";\n case \".js\":\n case \".mjs\":\n return \"text/javascript\";\n case \".png\":\n return \"image/png\";\n case \".svg\":\n return \"image/svg+xml\";\n case \".txt\":\n return \"text/plain\";\n case \".xml\":\n return \"application/xml\";\n default:\n return null;\n }\n}\n\nfunction devPathname(reqUrl: string): string {\n return new URL(reqUrl, \"http://agent-native.local\").pathname;\n}\n\nfunction isApiDevPath(reqUrl: string): boolean {\n const pathname = devPathname(reqUrl);\n return pathname === \"/api\" || pathname.startsWith(\"/api/\");\n}\n\nexport function stripMountedDevApiPath(\n reqUrl: string | undefined,\n base: string | undefined,\n): string | undefined {\n if (!reqUrl || !base || base === \"/\") return reqUrl;\n const normalizedBase = base.endsWith(\"/\") ? base : `${base}/`;\n if (!reqUrl.startsWith(normalizedBase)) return reqUrl;\n const stripped = reqUrl.slice(normalizedBase.length - 1) || \"/\";\n return isApiDevPath(stripped) ? stripped : reqUrl;\n}\n\nexport function isFrameworkDevPath(\n reqUrl: string,\n base: string | undefined,\n): boolean {\n const pathname = devPathname(reqUrl);\n if (pathname === \"/_agent-native\" || pathname.startsWith(\"/_agent-native/\")) {\n return true;\n }\n if (!base || base === \"/\") return false;\n const normalizedBase = base.endsWith(\"/\") ? base.slice(0, -1) : base;\n return (\n pathname === `${normalizedBase}/_agent-native` ||\n pathname.startsWith(`${normalizedBase}/_agent-native/`)\n );\n}\n\n/**\n * Work around a Rolldown bug where Nitro passes service entries as objects\n * ({index: \"path\"}) but Rolldown expects strings. This plugin normalizes\n * rollupOptions.input entries in the SSR environment.\n */\nfunction rolldownInputFix(): Plugin {\n return {\n name: \"agent-native-rolldown-input-fix\",\n configEnvironment(name, config) {\n const input = config.build?.rollupOptions?.input;\n if (!Array.isArray(input)) return;\n // Flatten any object entries to just their string values\n const fixed = input.map((entry: any) => {\n if (typeof entry === \"string\") return entry;\n if (typeof entry === \"object\" && entry !== null) {\n const values = Object.values(entry);\n return values[0] as string;\n }\n return entry;\n });\n config.build!.rollupOptions!.input = fixed;\n },\n };\n}\n\n/**\n * Expose the resolved Vite dev server port as process.env.PORT so that\n * in-process scripts (which use localFetch → http://localhost:${PORT}/api/...)\n * hit the right address even when Vite auto-increments the port.\n */\n/**\n * Replace caller-specified packages with an empty proxy stub during SSR\n * builds. For apps whose heavy browser-only deps would otherwise bloat the\n * edge worker past CF Pages' 25 MiB Functions limit.\n *\n * The template lists the packages in its `defineConfig({ ssrStubs })` call —\n * the framework never hardcodes package names.\n */\nfunction ssrStubPlugin(packages: string[]): Plugin | null {\n if (!packages.length) return null;\n const stubbed = new Set(packages);\n const STUB_ID = \"\\0agent-native-ssr-stub\";\n return {\n name: \"agent-native-ssr-stub-heavy-libs\",\n enforce: \"pre\",\n resolveId(id, _importer, opts) {\n if (!opts?.ssr) return null;\n // Match the bare package name or any subpath\n const pkg = id\n .split(\"/\")\n .slice(0, id.startsWith(\"@\") ? 2 : 1)\n .join(\"/\");\n if (stubbed.has(pkg)) return STUB_ID;\n return null;\n },\n load(id) {\n if (id !== STUB_ID) return null;\n // Proxy that answers any property access with itself — lets dead\n // import/re-export chains parse without blowing up, and still throws\n // if code actually tries to call any of it on the server.\n return (\n \"const handler = { get(_, p) { \" +\n \"if (p === Symbol.toPrimitive) return () => ''; \" +\n \"if (p === 'then') return undefined; \" +\n \"return new Proxy(() => {}, handler); \" +\n \"} };\" +\n \"const stub = new Proxy(() => {}, handler);\" +\n \"export default stub;\"\n );\n },\n };\n}\n\nfunction portExposer(): Plugin {\n return {\n name: \"agent-native-port-exposer\",\n apply: \"serve\",\n configureServer(server) {\n server.httpServer?.once(\"listening\", () => {\n const addr = server.httpServer?.address();\n if (addr && typeof addr === \"object\" && addr.port) {\n process.env.PORT = String(addr.port); // guard:allow-env-mutation — Vite dev server port published once at boot before any request\n }\n });\n },\n };\n}\n\n/**\n * Silence benign connection-reset noise from Vite's dev middleware.\n * Fires when a browser closes/reloads/navigates mid-request — the peer has\n * already gone away, there's nothing to fix, and Vite's error middleware\n * spams the terminal and browser HMR overlay with errors like\n * \"read ECONNRESET\" and \"socket hang up\". Our H3 server layer already\n * swallows these (create-server.ts onError); this plugin does the same for\n * Vite's own connect pipeline.\n */\nfunction silenceConnectionResets(): Plugin {\n const isBenign = (err: unknown) => {\n const e = err as\n | (NodeJS.ErrnoException & { cause?: NodeJS.ErrnoException })\n | undefined;\n const code = e?.code || (e?.cause as NodeJS.ErrnoException)?.code;\n const message = String(e?.message ?? \"\");\n return (\n code === \"ECONNRESET\" ||\n code === \"ECONNABORTED\" ||\n code === \"EPIPE\" ||\n /^(read ECONNRESET|write ECONNRESET|socket hang up|aborted|write EPIPE)$/i.test(\n message,\n )\n );\n };\n const isBenignErrorPayload = (payload: unknown) => {\n const p = payload as { type?: string; err?: unknown } | undefined;\n return p?.type === \"error\" && isBenign(p.err);\n };\n return {\n name: \"agent-native-silence-connection-resets\",\n apply: \"serve\",\n configureServer(server) {\n // Swallow socket-level resets so Node doesn't surface them as uncaught.\n server.httpServer?.on(\"connection\", (socket) => {\n socket.on(\"error\", (err) => {\n if (!isBenign(err)) throw err;\n });\n });\n // Drop Vite's \"Internal server error: read ECONNRESET\" log lines.\n const origError = server.config.logger.error.bind(server.config.logger);\n server.config.logger.error = (msg, opts) => {\n const text = typeof msg === \"string\" ? msg : String(msg ?? \"\");\n if (\n (opts?.error && isBenign(opts.error)) ||\n /Internal server error:\\s*(read ECONNRESET|write ECONNRESET|socket hang up|aborted|EPIPE)/i.test(\n text,\n )\n ) {\n return;\n }\n origError(msg, opts);\n };\n\n // Vite's error middleware sends these same benign errors to the HMR\n // client, which turns them into the full-screen browser overlay.\n // Suppress just those payloads while leaving real transform/runtime\n // errors untouched.\n const hot = (\n server as unknown as {\n environments?: { client?: { hot?: { send?: Function } } };\n }\n ).environments?.client?.hot;\n if (hot?.send) {\n const origHotSend = hot.send.bind(hot);\n hot.send = (payload: unknown, ...args: unknown[]) => {\n if (isBenignErrorPayload(payload)) return;\n return origHotSend(payload, ...args);\n };\n }\n\n const ws = (server as unknown as { ws?: { send?: Function } }).ws;\n if (ws?.send) {\n const origWsSend = ws.send.bind(ws);\n ws.send = (payload: unknown, ...args: unknown[]) => {\n if (isBenignErrorPayload(payload)) return;\n return origWsSend(payload, ...args);\n };\n }\n },\n };\n}\n\n/**\n * Create the client Vite config with sensible agent-native defaults.\n * Supports two modes:\n * - Legacy SPA mode (default): React SWC plugin, client-only routing\n * - React Router framework mode: SSR-capable with file-based routing\n *\n * Both modes include Nitro for API routes, path aliases, and fs restrictions.\n */\nexport function defineConfig(options: ClientConfigOptions = {}): UserConfig {\n // Check if React Router plugin was passed directly in plugins array\n const hasReactRouterPlugin = options.plugins?.some(\n (p: any) =>\n p?.name === \"react-router\" ||\n (Array.isArray(p) && p.some((pp: any) => pp?.name === \"react-router\")),\n );\n\n let reactTransformPlugin: any;\n\n if (!hasReactRouterPlugin && !options.reactRouter) {\n // Legacy SPA mode — use React SWC plugin (only when React Router is not used)\n try {\n reactTransformPlugin = require(\"@vitejs/plugin-react-swc\");\n if (reactTransformPlugin.default)\n reactTransformPlugin = reactTransformPlugin.default;\n } catch {\n // Will be resolved at runtime by Vite\n }\n }\n\n const cwd = process.cwd();\n\n // Workspace env fallback. If this app is inside a workspace, tell Vite to\n // also look for .env files at the workspace root. Per-app .env still wins\n // (Vite's loadEnv merges in precedence order — app dir is loaded after).\n const workspaceRoot = findWorkspaceRoot(cwd);\n const envDir = workspaceRoot && workspaceRoot !== cwd ? workspaceRoot : cwd;\n\n // Preload workspace-root .env into process.env so Nitro server code sees\n // shared keys during dev (Nitro reads process.env, not vite's envDir).\n if (workspaceRoot && workspaceRoot !== cwd) {\n try {\n const dotenv = require(\"dotenv\");\n dotenv.config({\n path: path.join(workspaceRoot, \".env\"),\n override: false,\n // Suppress the dotenv v17 tip line — this loader fires alongside\n // utils.ts loadEnv() during dev startup and would otherwise emit a\n // duplicate \"[dotenv] injecting env\" message.\n quiet: true,\n });\n } catch {}\n }\n\n // Build the React transform plugin (only for legacy SPA mode)\n const reactPluginInstance = reactTransformPlugin?.();\n\n // Auto-inject the Tailwind v4 Vite plugin if `@tailwindcss/vite` is\n // installed (which it is by default for all agent-native templates).\n // Templates can opt out by setting `options.tailwind = false`.\n let tailwindPluginInstance: any = null;\n if (options.tailwind !== false) {\n try {\n let tailwindPlugin = require(\"@tailwindcss/vite\");\n if (tailwindPlugin.default) tailwindPlugin = tailwindPlugin.default;\n // Tailwind's Vite optimizer uses Lightning CSS internally and runs\n // before Vite's own CSS minifier. Lightning CSS collapses the standard\n // `backdrop-filter` declaration when a `-webkit-` fallback is present,\n // so let Vite/esbuild handle the production CSS pass instead.\n tailwindPluginInstance = tailwindPlugin({ optimize: false });\n } catch {\n // Plugin not installed — silently skip. Old templates may still be on v3.\n }\n }\n\n // APP_BASE_PATH lets this app be mounted under a prefix (e.g. \"/mail\") as\n // part of a unified workspace deploy. Defaults to \"/\" for standalone apps.\n const appBasePath =\n process.env.VITE_APP_BASE_PATH || process.env.APP_BASE_PATH || \"/\";\n const isWorkspaceChild = process.env.AGENT_NATIVE_WORKSPACE === \"1\";\n const base = appBasePath.endsWith(\"/\") ? appBasePath : `${appBasePath}/`;\n const monorepoCoreAllow = [\n path.resolve(cwd, \"../../packages/core\"),\n path.resolve(cwd, \"../core\"),\n ].filter((candidate) => fs.existsSync(path.join(candidate, \"package.json\")));\n\n // Workspace-core (enterprise monorepo): pull its directory into Vite's\n // file watcher + module graph so edits to its TS sources hot-reload the\n // dev server, and its package name into ssr.noExternal so the dynamic\n // import in framework-request-handler.ts goes through Vite's transform\n // pipeline (TypeScript, SSR HMR, the works).\n const workspaceCore = findWorkspaceCoreSync(cwd);\n const workspaceCoreFsAllow = workspaceCore ? [workspaceCore.packageDir] : [];\n const workspaceCoreNoExternal = workspaceCore\n ? [new RegExp(`^${escapeRegex(workspaceCore.packageName)}(/.*)?$`)]\n : [];\n\n return {\n logLevel: options.logLevel ?? (isWorkspaceChild ? \"warn\" : undefined),\n envDir,\n base,\n server: {\n host: \"::\",\n port: options.port ?? 8080,\n allowedHosts: options.allowedHosts ?? [\n \".ngrok-free.dev\",\n \".ngrok-free.app\",\n \".ngrok.io\",\n ],\n fs: {\n allow: [\n \".\",\n ...monorepoCoreAllow,\n ...workspaceCoreFsAllow,\n ...(options.fsAllow ?? []),\n ],\n deny: [\n \".env\",\n \".env.*\",\n \"*.{crt,pem}\",\n \"**/.git/**\",\n ...(options.fsDeny ?? []),\n ],\n },\n },\n build: {\n outDir: options.outDir ?? \"dist/spa\",\n // Vite 8 defaults CSS minification to Lightning CSS, which collapses a\n // `backdrop-filter` + `-webkit-backdrop-filter` pair down to only the\n // prefixed form. Chrome ignores that, so glass effects disappear in\n // production. Keep esbuild as the CSS minifier and target Safari 18+ so\n // the standard property survives the production pipeline.\n cssMinify: \"esbuild\",\n cssTarget: [\"es2020\", \"safari18\"],\n },\n // Bundle all non-Node.js deps into the production SSR server build.\n // Edge runtimes (CF Workers, Deno) don't have node_modules at runtime.\n // In dev, React Router's Vite Environment runner expects CJS packages\n // like React to stay external; forcing them through the module runner\n // raises `module is not defined`.\n ssr: process.argv.includes(\"build\")\n ? {\n noExternal: /^(?!node:)/,\n // Pick the workspace-core's compiled `dist/` exports in prod —\n // Node-style `default` condition matches what edge runtimes (CF\n // Workers, Deno) can actually load. Without this, Vite's prod\n // build inherits the dev-condition src/ entry and ships unbuilt\n // TypeScript into the worker.\n resolve: {\n conditions: [\"node\", \"module\", \"import\", \"default\"],\n externalConditions: [\"node\", \"module\", \"import\", \"default\"],\n },\n }\n : {\n // Vite already sets `development` in the dev resolve conditions,\n // so the workspace-core template's exports.development → src/\n // entry is picked automatically — Vite handles TS compilation\n // and triggers a server restart when those files change.\n noExternal: [\n /^@agent-native\\/core(\\/.*)?$/,\n // Radix UI primitives are transitive deps of @agent-native/core\n // (used by FeedbackButton, AgentSidebar, ShareDialog, etc.). When\n // a consumer app SSRs a component that imports Radix, Node's\n // externalized resolver can't find @radix-ui/* from the app cwd\n // because pnpm doesn't hoist transitive deps. Bundling them\n // through Vite resolves them via the workspace store.\n /^@radix-ui\\//,\n // scheduling ships tsc-compiled dist files that contain literal\n // `@/` path-alias imports (e.g. `import { Input } from\n // \"@/components/ui/input\"`). In standalone (published) mode Node\n // treats the package as an external CJS dep and can't resolve\n // `@/components`. Adding it to noExternal makes Vite process it\n // through the module pipeline, where the consumer app's `@` →\n // `./app` alias is already registered.\n ...(hasDep(\"@agent-native/scheduling\", cwd)\n ? [/^@agent-native\\/scheduling(\\/.*)?$/]\n : []),\n ...workspaceCoreNoExternal,\n ],\n external: [\n \"react\",\n \"react-dom\",\n \"react-dom/server\",\n \"react-router\",\n \"react-router/dom\",\n \"react-router-dom\",\n ],\n },\n plugins: [\n // Stub packages from `options.ssrStubs` in the SSR bundle so they\n // don't bloat the edge worker. Opt-in per template — the framework\n // hardcodes nothing (e.g. docs sites legitimately import `shiki` on\n // the server, so we can't blanket-stub it here).\n ...(() => {\n const p = ssrStubPlugin(options.ssrStubs ?? []);\n return p ? [p] : [];\n })(),\n ...(options.plugins ?? []),\n actionTypesPlugin(),\n agentsBundlePlugin(),\n autoReloadOnOptimizeDep(),\n fullReloadOnOptimizeDep504(),\n embedDevFrameHeaders(),\n baseRedirectGuard(),\n portExposer(),\n silenceConnectionResets(),\n rolldownInputFix(),\n // Nitro Vite plugin for dev-mode API route serving and HMR.\n // Disabled during build — React Router's build handles production.\n ...(process.argv.includes(\"build\")\n ? []\n : [\n nitroVitePlugin({\n serverDir: \"./server\",\n ...(options.nitro ?? {}),\n } as any),\n ]),\n reactPluginInstance,\n tailwindPluginInstance,\n ].filter(Boolean),\n optimizeDeps: {\n include: [\n ...getDefaultOptimizeDeps(cwd),\n ...(hasDep(\"@agent-native/pinpoint\", cwd)\n ? [\"@agent-native/pinpoint/react\"]\n : []),\n ...(options.optimizeDeps?.include ?? []),\n ],\n // In monorepo mode: explicitly exclude @agent-native/core subpaths so\n // Vite never prebundles them from dist/. The source alias above\n // (`getCoreSourceAliases`) resolves every import to src/ on every\n // request, so HMR picks up new exports immediately. Without exclude,\n // the prebundle is built from dist/ once at startup and silently\n // serves stale code even after the source / dist is updated.\n exclude: [\n ...(findCoreSrcDir(cwd) !== null ? CORE_CLIENT_SUBPATHS : []),\n ...(options.optimizeDeps?.exclude ?? []),\n ],\n },\n resolve: {\n // Dedupe all client-side packages that core shares with the consuming\n // app. In pnpm monorepos, core's devDependencies can install separate\n // copies (linked to different React versions). Without deduping, each\n // copy creates its own React context — QueryClientProvider, RouterProvider,\n // Radix, etc. — causing \"No provider\" crashes at runtime.\n dedupe: getClientDedupe(cwd),\n alias: [\n // In monorepo dev: resolve @agent-native/core to source for HMR.\n // Uses regex with $ anchor for exact matching to prevent\n // @agent-native/core from prefix-matching @agent-native/core/client.\n ...getCoreSourceAliases(cwd),\n // Standard path aliases (prefix matching is fine here)\n { find: \"@\", replacement: path.resolve(cwd, \"./app\") },\n { find: \"@shared\", replacement: path.resolve(cwd, \"./shared\") },\n ...Object.entries(options.aliases ?? {}).map(([find, replacement]) => ({\n find,\n replacement,\n })),\n ],\n },\n };\n}\n"]}
|
package/docs/content/actions.md
CHANGED
|
@@ -166,25 +166,33 @@ This works for draft emails, filtered inboxes, calendar event drafts, full
|
|
|
166
166
|
dashboards, saved analyses, extension routes, decks, design editors, and any
|
|
167
167
|
other state the app can load from a route.
|
|
168
168
|
|
|
169
|
+
Keep MCP Apps URL-first. Prefer a durable app route such as
|
|
170
|
+
`/dashboards/:id`, `/compose?draft=...`, or `/chart?payload=...` over passing
|
|
171
|
+
large opaque state through the bridge. When an action's `link` and `mcpApp`
|
|
172
|
+
should point at the same route, use `embedRoute()` to create both from one pure
|
|
173
|
+
path builder. The host bridge is for host-owned capabilities: model context
|
|
174
|
+
updates, host-mediated links, host context, and display-mode requests.
|
|
175
|
+
|
|
169
176
|
When a whole app surface is too much, embed a narrow route that renders a real
|
|
170
177
|
shared React component instead. For example, Analytics can render `/chart` with
|
|
171
178
|
a compact `SqlPanel` URL payload so the MCP host shows one live chart while the
|
|
172
179
|
implementation still reuses the dashboard chart component.
|
|
173
180
|
|
|
174
181
|
```ts
|
|
175
|
-
import {
|
|
182
|
+
import { embedRoute } from "@agent-native/core";
|
|
176
183
|
|
|
177
184
|
export default defineAction({
|
|
178
185
|
description: "Create an email draft for review.",
|
|
179
186
|
schema: z.object({ body: z.string() }),
|
|
180
187
|
run: async ({ body }) => ({ body }),
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
188
|
+
...embedRoute({
|
|
189
|
+
title: "Review draft",
|
|
190
|
+
openLabel: "Open in Mail",
|
|
191
|
+
path: ({ result }) => ({
|
|
192
|
+
label: "Open draft in Mail",
|
|
193
|
+
url: "/_agent-native/open?app=mail&view=inbox",
|
|
194
|
+
}),
|
|
184
195
|
}),
|
|
185
|
-
mcpApp: {
|
|
186
|
-
resource: embedApp({ title: "Review draft", openLabel: "Open in Mail" }),
|
|
187
|
-
},
|
|
188
196
|
});
|
|
189
197
|
```
|
|
190
198
|
|
|
@@ -192,6 +200,13 @@ This advertises the MCP Apps extension (`io.modelcontextprotocol/ui`), exposes t
|
|
|
192
200
|
|
|
193
201
|
The helper launches the action's `link` target through `/_agent-native/embed/start` with a short-lived browser session, so routes such as full dashboards, filtered inboxes, drafts, and extension pages can reuse the app's React components directly.
|
|
194
202
|
|
|
203
|
+
Embedded routes can use the exported client helpers for the MCP App host
|
|
204
|
+
bridge. Under the hood, routes receive `agentNative.mcpHostContext` and may
|
|
205
|
+
post `agentNative.mcpHost.updateModelContext`,
|
|
206
|
+
`agentNative.mcpHost.openLink`, or
|
|
207
|
+
`agentNative.mcpHost.requestDisplayMode`; the wrapper replies with
|
|
208
|
+
`agentNative.mcpHost.response`.
|
|
209
|
+
|
|
195
210
|
## Standard actions {#standard-actions}
|
|
196
211
|
|
|
197
212
|
Every template should include these two for [context awareness](/docs/context-awareness):
|
package/docs/content/client.md
CHANGED
|
@@ -73,6 +73,14 @@ navigate(`/inbox/${threadId}`);
|
|
|
73
73
|
|
|
74
74
|
Send a message to the agent chat via postMessage. Used to delegate AI tasks from UI interactions.
|
|
75
75
|
|
|
76
|
+
When the app route is running inside an MCP App embed created with `embedApp()`,
|
|
77
|
+
auto-submitted messages (`submit` omitted or `true`) are forwarded to the MCP
|
|
78
|
+
App wrapper, which asks the containing host to add hidden context and send the
|
|
79
|
+
visible user turn. `context` is sent as model context before the visible
|
|
80
|
+
message, so it stays model-visible without being posted as user-facing chat.
|
|
81
|
+
`submit: false` keeps the local prefill/review behavior because MCP Apps do not
|
|
82
|
+
define a standard draft-prefill API.
|
|
83
|
+
|
|
76
84
|
```ts
|
|
77
85
|
import { sendToAgentChat } from "@agent-native/core";
|
|
78
86
|
|
|
@@ -102,6 +110,41 @@ sendToAgentChat({
|
|
|
102
110
|
| `preset` | `string?` | Optional preset name for downstream consumers |
|
|
103
111
|
| `referenceImagePaths` | `string[]?` | Optional reference image paths |
|
|
104
112
|
|
|
113
|
+
## MCP App Host Bridge {#mcp-app-host-bridge}
|
|
114
|
+
|
|
115
|
+
Routes embedded by `embedApp()` should be URL-first: load the current artifact
|
|
116
|
+
from path/query params, render the real React route or a focused shared
|
|
117
|
+
component, and use host bridge messages only for host-owned behavior.
|
|
118
|
+
|
|
119
|
+
The wire contract is:
|
|
120
|
+
|
|
121
|
+
| Direction | Message type | Purpose |
|
|
122
|
+
| --------------- | ---------------------------------------- | ------------------------------------------------- |
|
|
123
|
+
| wrapper → route | `agentNative.mcpHostContext` | Push host context such as theme/display mode |
|
|
124
|
+
| route → wrapper | `agentNative.mcpHost.updateModelContext` | Add hidden model context |
|
|
125
|
+
| route → wrapper | `agentNative.mcpHost.openLink` | Ask the host to open a URL |
|
|
126
|
+
| route → wrapper | `agentNative.mcpHost.requestDisplayMode` | Ask for `inline`, `fullscreen`, or `pip` |
|
|
127
|
+
| wrapper → route | `agentNative.mcpHost.response` | Resolve or reject a request by matching requestId |
|
|
128
|
+
|
|
129
|
+
Use the exported helpers from `@agent-native/core/client` inside embedded
|
|
130
|
+
routes:
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
import {
|
|
134
|
+
getMcpAppHostContext,
|
|
135
|
+
openMcpAppHostLink,
|
|
136
|
+
requestMcpAppDisplayMode,
|
|
137
|
+
updateMcpAppModelContext,
|
|
138
|
+
useMcpAppHostContext,
|
|
139
|
+
} from "@agent-native/core/client";
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
`getMcpAppHostContext()` reads the latest pushed host context snapshot;
|
|
143
|
+
`useMcpAppHostContext()` subscribes React components to changes. The request
|
|
144
|
+
helpers return `false` outside an embedded MCP App frame, or
|
|
145
|
+
`Promise<boolean>` inside a frame. `sendToAgentChat()` uses the same bridge for
|
|
146
|
+
auto-submitted prompts from embedded routes.
|
|
147
|
+
|
|
105
148
|
## Dynamic Suggestions {#dynamic-suggestions}
|
|
106
149
|
|
|
107
150
|
`<AgentSidebar>`, `<AgentPanel>`, and `<AssistantChat>` merge static `suggestions` with context-aware suggestions by default. The framework reads `navigation`, `selection`, `pending-selection-context`, and the current URL from application state while an empty chat is visible, then offers prompt chips that match the current screen.
|
|
@@ -215,6 +215,34 @@ That makes the same app surface available to every compatible host rather than b
|
|
|
215
215
|
|
|
216
216
|
Claude Code and other CLI-first clients still receive the same resources and metadata when they support MCP Apps, but the deep link remains the reliable fallback when a host chooses not to render an iframe. In practice, every agent-native app should be authored with both: MCP Apps for inline review/edit in capable hosts, and `link` for universal round-tripping back to the full app.
|
|
217
217
|
|
|
218
|
+
### First-class MCP App bridge {#mcp-app-bridge}
|
|
219
|
+
|
|
220
|
+
MCP App embeds are route embeds, not separate mini-products. `embedApp()`
|
|
221
|
+
starts from the action's `link` target, creates a short-lived embed session,
|
|
222
|
+
and loads that URL in an iframe. Design embedded routes so a reload with the
|
|
223
|
+
same URL reconstructs the same view.
|
|
224
|
+
|
|
225
|
+
The host bridge is deliberately small:
|
|
226
|
+
|
|
227
|
+
| Direction | Message type | Use it for |
|
|
228
|
+
| --------------- | ---------------------------------------- | ---------------------------------------- |
|
|
229
|
+
| wrapper → route | `agentNative.mcpHostContext` | Theme, locale, host platform, dimensions |
|
|
230
|
+
| route → wrapper | `agentNative.mcpHost.updateModelContext` | Hidden context for the host model |
|
|
231
|
+
| route → wrapper | `agentNative.mcpHost.openLink` | Open an external or app URL via the host |
|
|
232
|
+
| route → wrapper | `agentNative.mcpHost.requestDisplayMode` | Request `inline`, `fullscreen`, or `pip` |
|
|
233
|
+
| wrapper → route | `agentNative.mcpHost.response` | Correlate async request results |
|
|
234
|
+
|
|
235
|
+
Embedded routes can use `updateMcpAppModelContext()`,
|
|
236
|
+
`openMcpAppHostLink()`, `requestMcpAppDisplayMode()`,
|
|
237
|
+
`getMcpAppHostContext()`, and `useMcpAppHostContext()` from
|
|
238
|
+
`@agent-native/core/client`. `sendToAgentChat()` uses the same path from
|
|
239
|
+
full-app embeds for auto-submitted prompts.
|
|
240
|
+
|
|
241
|
+
Display mode is best-effort. The in-app `McpAppRenderer` currently reports an
|
|
242
|
+
inline web host context and an inline-only display mode; external hosts may
|
|
243
|
+
honor larger display requests, ignore them, or reply with an unsupported-mode
|
|
244
|
+
error. Always keep the inline route usable.
|
|
245
|
+
|
|
218
246
|
### Generic cross-app verbs {#cross-app}
|
|
219
247
|
|
|
220
248
|
On top of the per-action tools the MCP server exposes a stable verb set, so an external agent has a predictable surface without guessing per-app action names:
|
|
@@ -231,6 +259,8 @@ On top of the per-action tools the MCP server exposes a stable verb set, so an e
|
|
|
231
259
|
|
|
232
260
|
For OAuth callers that request `mcp:apps`, the server intentionally advertises a compact `tools/list` catalog so app hosts do not ingest every internal action schema. The model sees app-facing builtins (`list_apps`, `open_app`, app-only `create_embed_session`) and actions with `mcpApp`. Stdio/static-token developer clients still get the full connected action surface, and `publicAgent.expose` remains the opt-in for safe read/ingest tools outside the compact app catalog. If a UI-capable host should be able to call a new action from an MCP App conversation, mark it with `mcpApp`; use `publicAgent` for non-UI read/ingest handoff tools.
|
|
233
261
|
|
|
262
|
+
For fast ChatGPT/Claude handoffs, the ideal path is direct: call the action that creates or opens the artifact, then let the MCP App widget launch the iframe. A Mail request should call `manage_draft` and render the real compose route. A dashboard request should call `open_app({ path, embed: true })` or a dashboard action with `mcpApp` and render the full Analytics route. Calendar, Forms, Content, Slides, Design, and Clips should follow the same pattern with their draft/create/search actions. `list_apps` is useful when the model must choose among granted apps; broad `resources/list`, full-catalog discovery, or `ask_app` delegation should not be the normal route for an obvious UI handoff.
|
|
263
|
+
|
|
234
264
|
### Per-app tour {#tour}
|
|
235
265
|
|
|
236
266
|
Every allow-listed template that produces or lists a navigable resource ships a `link` builder, and the ingest-heavy ones ship a GET + `publicAgent` action so a connected agent can pull live state:
|
|
@@ -283,7 +313,7 @@ List/search actions point at a record-focused view the same way — e.g. calenda
|
|
|
283
313
|
|
|
284
314
|
For hosts that support the MCP Apps extension, an action can also advertise an inline UI resource with `mcpApp`. This is a progressive enhancement for flows where the external agent should hand the user an interactive surface instead of only text — for example reviewing an email draft, editing a calendar invite, or choosing between generated dashboard variants.
|
|
285
315
|
|
|
286
|
-
Use the real React app with `embedApp()` whenever the user needs UI. The mental model is simple: the action's `link` target is also the MCP App embed target. Expose the operation as a normal action/tool, return a focused deep link with `link`, and add `mcpApp.resource = embedApp(...)` so capable hosts load that same route inline instead of opening a new tab.
|
|
316
|
+
Use the real React app with `embedRoute()` or `embedApp()` whenever the user needs UI. The mental model is simple: the action's `link` target is also the MCP App embed target. Expose the operation as a normal action/tool, return a focused deep link with `link`, and add `mcpApp.resource = embedApp(...)` so capable hosts load that same route inline instead of opening a new tab. When both should be built from the same route, prefer `embedRoute({ title, openLabel, path })`; it returns matching `link` and `mcpApp` action fields.
|
|
287
317
|
|
|
288
318
|
That means full-app embeds can do anything the route can do once opened: review or edit an email draft, show a filtered inbox/search, open a calendar event or event draft, load an extension page, inspect a full analytics dashboard or saved analysis, continue a deck in the Slides editor, or open a Design project/editor. Prefer URL/deep-link params and the existing `/_agent-native/open` navigation/app-state bridge over inventing a second state protocol for MCP Apps.
|
|
289
319
|
|
|
@@ -312,6 +342,12 @@ The MCP server advertises extension `io.modelcontextprotocol/ui`, adds `_meta.ui
|
|
|
312
342
|
|
|
313
343
|
Keep the existing `link` builder even when adding `mcpApp`. CLI-only clients, older hosts, and any host that does not render MCP Apps will ignore the UI metadata and still need the `"Open in … →"` link. `embedApp()` uses that link as its launch target, calls the app-only `create_embed_session` helper, exchanges a one-time SQL ticket at `/_agent-native/embed/start`, and loads the target route in an iframe with a short-lived browser session plus a bearer fallback for same-origin fetches. `open_app({ app, path, embed: true })` is the generic escape hatch for routes such as full dashboards, filtered inboxes, calendar draft views, analyses, and extension pages, and should be used liberally when the full app is the clearest review/edit surface.
|
|
314
344
|
|
|
345
|
+
Inside those `embedApp()` full-app iframes, `sendToAgentChat()` is host-aware:
|
|
346
|
+
auto-submitted prompts are relayed to the wrapper, which uses the host's model
|
|
347
|
+
context and message APIs for hidden context plus the visible user turn. Hosts
|
|
348
|
+
without MCP Apps messaging support simply ignore the bridge, and
|
|
349
|
+
`submit: false` remains a local review/prefill path.
|
|
350
|
+
|
|
315
351
|
### The `link` contract {#link-contract}
|
|
316
352
|
|
|
317
353
|
The `link` builder is **pure and synchronous — no I/O, no awaits**. It runs best-effort: a throw, `null`, or `undefined` is swallowed and **never** fails the tool call. It only reads the call's `args` and `result`; it must not query the DB, read app-state, or call other actions. Return `null` when there's nothing to open.
|
|
@@ -452,6 +488,9 @@ The fallback hosted `connect` flow never copies the deployment's shared secret.
|
|
|
452
488
|
- Make external-agent ingest actions GET + `readOnly` + `publicAgent`, and read live (Yjs) state, not the stale DB column.
|
|
453
489
|
- Let the open route resolve the browser session; pass record ids as deep-link params and let the UI focus them via the polled `navigate` command.
|
|
454
490
|
- Revoke a minted connect token by `jti` when an agent client is decommissioned.
|
|
491
|
+
- Test MCP Apps with the lightweight fixtures around `embedApp()` and
|
|
492
|
+
`McpAppRenderer`; they cover CSP, host context, app launch, and bridge
|
|
493
|
+
message behavior without needing a real external host.
|
|
455
494
|
|
|
456
495
|
**Don't**
|
|
457
496
|
|
|
@@ -74,6 +74,31 @@ The server supports the standard MCP handshake: `initialize` → `initialized`
|
|
|
74
74
|
|
|
75
75
|
If an action declares `mcpApp`, the server also advertises the official MCP Apps extension (`io.modelcontextprotocol/ui`) and supports `resources/list`, `resources/templates/list`, and `resources/read` for the app resource. Hosts that render MCP Apps can show the UI inline; hosts that do not can still call the tool and use the deep-link fallback. Product UIs should use `embedApp()` so the inline surface is the real React app route, or a focused route that renders a shared React component such as an Analytics chart, not a separate plain HTML implementation. The server emits both standard MCP Apps metadata and ChatGPT Apps SDK compatibility metadata so app-capable hosts can find the same `ui://` resource. The current official extension matrix includes Claude, Claude Desktop, VS Code GitHub Copilot, Goose, Postman, MCPJam, ChatGPT, and Cursor; host support varies by version and plan, so use the [External Agents MCP Apps notes](/docs/external-agents#mcp-apps-compatibility) for the user-facing guidance.
|
|
76
76
|
|
|
77
|
+
### MCP App embed bridge {#mcp-app-embed-bridge}
|
|
78
|
+
|
|
79
|
+
`embedApp()` is the low-level URL-first MCP App helper. It reads the action
|
|
80
|
+
result's open link, asks the app-only `create_embed_session` tool to mint a
|
|
81
|
+
route-scoped session, then loads the resulting route in an iframe. For normal
|
|
82
|
+
action authoring, use `embedRoute()` when the action's `link` and `mcpApp`
|
|
83
|
+
should come from the same pure route builder. The route itself should derive
|
|
84
|
+
state from the URL and normal app data fetching.
|
|
85
|
+
|
|
86
|
+
The bridge between the wrapper and the embedded route uses Agent-Native
|
|
87
|
+
postMessage types:
|
|
88
|
+
|
|
89
|
+
| Direction | Type | Payload shape |
|
|
90
|
+
| --------------- | ---------------------------------------- | --------------------------------------------- |
|
|
91
|
+
| wrapper → route | `agentNative.mcpHostContext` | `{ context, capabilities, version }` |
|
|
92
|
+
| route → wrapper | `agentNative.mcpHost.updateModelContext` | `{ requestId, content?, structuredContent? }` |
|
|
93
|
+
| route → wrapper | `agentNative.mcpHost.openLink` | `{ requestId, url }` |
|
|
94
|
+
| route → wrapper | `agentNative.mcpHost.requestDisplayMode` | `{ requestId, mode }` |
|
|
95
|
+
| wrapper → route | `agentNative.mcpHost.response` | `{ requestId, ok, result?, error? }` |
|
|
96
|
+
|
|
97
|
+
Host-mediated open links keep the iframe from choosing its own browser target.
|
|
98
|
+
Model context updates are opt-in and hidden from the user-facing transcript.
|
|
99
|
+
Display mode requests are best-effort: a host can honor, ignore, or reject the
|
|
100
|
+
request. Embedded routes must remain functional in the default inline mode.
|
|
101
|
+
|
|
77
102
|
## Tools {#tools}
|
|
78
103
|
|
|
79
104
|
Stdio/static-token developer clients see all connected app actions as MCP tools. OAuth callers that request `mcp:apps` get a compact app-host catalog: app-facing builtins and actions with `mcpApp`. `publicAgent.expose` remains the opt-in for safe read/ingest tools outside that compact app catalog. This keeps ChatGPT/Claude app-host discovery small while preserving the full developer surface for local agents.
|
package/package.json
CHANGED