@aprovan/stitchery 0.1.0-dev.03aaf5b

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/server/index.ts","../../src/server/routes.ts","../../src/prompts.ts","../../src/server/local-packages.ts","../../src/server/vfs-routes.ts","../../src/server/services.ts"],"sourcesContent":["import { createServer, type Server } from \"node:http\";\nimport { createMCPClient } from \"@ai-sdk/mcp\";\nimport { Experimental_StdioMCPTransport } from \"@ai-sdk/mcp/mcp-stdio\";\nimport { createUtcpBackend } from \"@aprovan/patchwork-utcp\";\nimport { jsonSchema, type Tool } from \"ai\";\nimport type { ServerConfig, McpServerConfig } from \"../types.js\";\nimport { handleChat, handleEdit, type RouteContext } from \"./routes.js\";\nimport { handleLocalPackages } from \"./local-packages.js\";\nimport { handleVFS, type VFSContext } from \"./vfs-routes.js\";\nimport { ServiceRegistry, generateServicesPrompt } from \"./services.js\";\n\nexport interface StitcheryServer {\n server: Server;\n registry: ServiceRegistry;\n start(): Promise<{ port: number; host: string }>;\n stop(): Promise<void>;\n}\n\nasync function initMcpTools(\n configs: McpServerConfig[],\n registry: ServiceRegistry,\n): Promise<void> {\n for (const config of configs) {\n const client = await createMCPClient({\n transport: new Experimental_StdioMCPTransport({\n command: config.command,\n args: config.args,\n }),\n });\n // Use MCP server name as namespace for all tools from this server\n registry.registerTools(await client.tools(), config.name);\n }\n}\n\nconst searchServicesSchema = {\n type: \"object\",\n properties: {\n query: {\n type: \"string\",\n description:\n 'Natural language description of what you want to do (e.g., \"get weather forecast\", \"list github repos\")',\n },\n namespace: {\n type: \"string\",\n description:\n 'Filter results to a specific service namespace (e.g., \"weather\", \"github\")',\n },\n tool_name: {\n type: \"string\",\n description: \"Get detailed info about a specific tool by name\",\n },\n limit: {\n type: \"number\",\n description: \"Maximum number of results to return\",\n default: 10,\n },\n include_interfaces: {\n type: \"boolean\",\n description: \"Include TypeScript interface definitions in results\",\n default: true,\n },\n },\n} as const;\n\ninterface SearchServicesArgs {\n query?: string;\n namespace?: string;\n tool_name?: string;\n limit?: number;\n include_interfaces?: boolean;\n}\n\n/**\n * Create the search_services tool for LLM use\n */\nfunction createSearchServicesTool(registry: ServiceRegistry): Tool {\n return {\n description: `Search for available services/tools. Use this to discover what APIs are available for widgets to call.\n\nReturns matching services with their TypeScript interfaces. Use when:\n- You need to find a service to accomplish a task\n- You want to explore available APIs in a namespace\n- You need the exact interface/parameters for a service call`,\n inputSchema: jsonSchema<SearchServicesArgs>(searchServicesSchema),\n execute: async (args: SearchServicesArgs) => {\n // If requesting specific tool info\n if (args.tool_name) {\n const info = registry.getToolInfo(args.tool_name);\n if (!info) {\n return {\n success: false,\n error: `Tool '${args.tool_name}' not found`,\n };\n }\n return { success: true, tool: info };\n }\n\n // Search for tools\n const results = registry.searchServices({\n query: args.query,\n namespace: args.namespace,\n limit: args.limit ?? 10,\n includeInterfaces: args.include_interfaces ?? true,\n });\n\n return {\n success: true,\n count: results.length,\n tools: results,\n namespaces: registry.getNamespaces(),\n };\n },\n };\n}\n\nfunction parseBody<T>(req: import(\"node:http\").IncomingMessage): Promise<T> {\n return new Promise((resolve, reject) => {\n let body = \"\";\n req.on(\"data\", (chunk) => (body += chunk));\n req.on(\"end\", () => {\n try {\n resolve(JSON.parse(body));\n } catch (err) {\n reject(err);\n }\n });\n req.on(\"error\", reject);\n });\n}\n\nexport async function createStitcheryServer(\n config: Partial<ServerConfig> = {},\n): Promise<StitcheryServer> {\n const {\n port = 6434,\n host = \"127.0.0.1\",\n copilotProxyUrl = \"http://127.0.0.1:6433/v1\",\n localPackages = {},\n mcpServers = [],\n utcp,\n vfsDir,\n vfsUsePaths = false,\n verbose = false,\n } = config;\n\n const log = verbose\n ? (...args: unknown[]) => console.log(\"[stitchery]\", ...args)\n : () => {};\n\n // Create service registry\n const registry = new ServiceRegistry();\n\n log(\"Initializing MCP tools...\");\n await initMcpTools(mcpServers, registry);\n log(`Loaded ${registry.size} tools from ${mcpServers.length} MCP servers`);\n\n // Initialize UTCP backend if config provided\n if (utcp) {\n log(\"Initializing UTCP backend...\");\n log(\"UTCP config:\", JSON.stringify(utcp, null, 2));\n try {\n // Cast to unknown since createUtcpBackend uses UtcpClientConfigSerializer to validate\n const { backend, toolInfos } = await createUtcpBackend(\n utcp as unknown as Parameters<typeof createUtcpBackend>[0],\n utcp.cwd,\n );\n registry.registerBackend(backend, toolInfos);\n log(\n `Registered UTCP backend with ${toolInfos.length} tools:`,\n toolInfos.map((tool: { name: string }) => tool.name).join(\", \"),\n );\n } catch (err) {\n console.error(\"[stitchery] Failed to initialize UTCP backend:\", err);\n }\n }\n\n log(\"Local packages:\", localPackages);\n\n // Create internal tools (search_services, etc.)\n const internalTools = {\n search_services: createSearchServicesTool(registry),\n };\n\n // Combine MCP tools with internal tools\n const allTools = { ...registry.getTools(), ...internalTools };\n\n const routeCtx: RouteContext = {\n copilotProxyUrl,\n tools: allTools,\n registry,\n servicesPrompt: generateServicesPrompt(registry),\n log,\n };\n\n const localPkgCtx = { localPackages, log };\n\n const vfsCtx: VFSContext | null = vfsDir\n ? { rootDir: vfsDir, usePaths: vfsUsePaths, log }\n : null;\n\n const server = createServer(async (req, res) => {\n res.setHeader(\"Access-Control-Allow-Origin\", \"*\");\n res.setHeader(\n \"Access-Control-Allow-Methods\",\n \"GET, POST, PUT, DELETE, HEAD, OPTIONS\",\n );\n res.setHeader(\n \"Access-Control-Allow-Headers\",\n \"Content-Type, Authorization\",\n );\n\n if (req.method === \"OPTIONS\") {\n res.writeHead(204);\n res.end();\n return;\n }\n\n const url = req.url || \"/\";\n log(`${req.method} ${url}`);\n\n try {\n if (handleLocalPackages(req, res, localPkgCtx)) {\n return;\n }\n\n if (vfsCtx && handleVFS(req, res, vfsCtx)) {\n return;\n }\n\n if (url === \"/api/chat\" && req.method === \"POST\") {\n await handleChat(req, res, routeCtx);\n return;\n }\n\n if (url === \"/api/edit\" && req.method === \"POST\") {\n await handleEdit(req, res, routeCtx);\n return;\n }\n\n // Service proxy endpoint for widgets\n const proxyMatch = url.match(/^\\/api\\/proxy\\/([^/]+)\\/(.+)$/);\n if (proxyMatch && req.method === \"POST\") {\n const [, namespace, procedure] = proxyMatch;\n try {\n const body = await parseBody<{ args?: unknown }>(req);\n const result = await registry.call(\n namespace!,\n procedure!,\n body.args ?? {},\n );\n res.setHeader(\"Content-Type\", \"application/json\");\n res.writeHead(200);\n res.end(JSON.stringify(result));\n } catch (err) {\n log(\"Proxy error:\", err);\n res.setHeader(\"Content-Type\", \"application/json\");\n res.writeHead(500);\n res.end(\n JSON.stringify({\n error: err instanceof Error ? err.message : \"Service call failed\",\n }),\n );\n }\n return;\n }\n\n // Services search endpoint (POST with body for complex queries)\n if (url === \"/api/services/search\" && req.method === \"POST\") {\n const body = await parseBody<{\n query?: string;\n namespace?: string;\n tool_name?: string;\n limit?: number;\n include_interfaces?: boolean;\n }>(req);\n\n res.setHeader(\"Content-Type\", \"application/json\");\n res.writeHead(200);\n\n if (body.tool_name) {\n const info = registry.getToolInfo(body.tool_name);\n if (!info) {\n res.end(\n JSON.stringify({\n success: false,\n error: `Tool '${body.tool_name}' not found`,\n }),\n );\n } else {\n res.end(JSON.stringify({ success: true, tool: info }));\n }\n return;\n }\n\n const results = registry.searchServices({\n query: body.query,\n namespace: body.namespace,\n limit: body.limit ?? 20,\n includeInterfaces: body.include_interfaces ?? false,\n });\n\n res.end(\n JSON.stringify({\n success: true,\n count: results.length,\n tools: results,\n namespaces: registry.getNamespaces(),\n }),\n );\n return;\n }\n\n // Services metadata endpoint\n if (url === \"/api/services\" && req.method === \"GET\") {\n res.setHeader(\"Content-Type\", \"application/json\");\n res.writeHead(200);\n res.end(\n JSON.stringify({\n namespaces: registry.getNamespaces(),\n services: registry.getServiceInfo(),\n }),\n );\n return;\n }\n\n if (url === \"/health\" || url === \"/\") {\n res.setHeader(\"Content-Type\", \"application/json\");\n res.writeHead(200);\n res.end(JSON.stringify({ status: \"ok\", service: \"stitchery\" }));\n return;\n }\n\n res.writeHead(404);\n res.end(`Not found: ${url}`);\n } catch (err) {\n log(\"Error:\", err);\n res.writeHead(500);\n res.end(err instanceof Error ? err.message : \"Internal server error\");\n }\n });\n\n return {\n server,\n registry,\n\n async start() {\n return new Promise((resolve, reject) => {\n server.on(\"error\", reject);\n server.listen(port, host, () => {\n log(`Server listening on http://${host}:${port}`);\n resolve({ port, host });\n });\n });\n },\n\n async stop() {\n return new Promise((resolve, reject) => {\n server.close((err) => {\n if (err) reject(err);\n else resolve();\n });\n });\n },\n };\n}\n","import type { IncomingMessage, ServerResponse } from 'node:http';\nimport { createOpenAICompatible } from '@ai-sdk/openai-compatible';\nimport {\n streamText,\n convertToModelMessages,\n stepCountIs,\n type UIMessage,\n type Tool,\n} from 'ai';\nimport { PATCHWORK_PROMPT, EDIT_PROMPT } from '../prompts.js';\nimport type { ServiceRegistry } from './services.js';\n\nexport interface RouteContext {\n copilotProxyUrl: string;\n tools: Record<string, Tool>;\n registry: ServiceRegistry;\n servicesPrompt: string;\n log: (...args: unknown[]) => void;\n}\n\nfunction parseBody<T>(req: IncomingMessage): Promise<T> {\n return new Promise((resolve, reject) => {\n let body = '';\n req.on('data', (chunk) => (body += chunk));\n req.on('end', () => {\n try {\n resolve(JSON.parse(body));\n } catch (err) {\n reject(err);\n }\n });\n req.on('error', reject);\n });\n}\n\nexport async function handleChat(\n req: IncomingMessage,\n res: ServerResponse,\n ctx: RouteContext,\n): Promise<void> {\n const {\n messages,\n metadata,\n }: {\n messages: UIMessage[];\n metadata?: { patchwork?: { compilers?: string[] } };\n } = await parseBody(req);\n\n const normalizedMessages = messages.map((msg) => ({\n ...msg,\n parts: msg.parts ?? [{ type: 'text' as const, text: '' }],\n }));\n\n const provider = createOpenAICompatible({\n name: 'copilot-proxy',\n baseURL: ctx.copilotProxyUrl,\n });\n\n const result = streamText({\n model: provider('claude-sonnet-4'),\n system: `---\\npatchwork:\\n compilers: ${\n (metadata?.patchwork?.compilers ?? []).join(',') ?? '[]'\n }\\n services: ${ctx.registry\n .getNamespaces()\n .join(',')}\\n---\\n\\n${PATCHWORK_PROMPT}\\n\\n${ctx.servicesPrompt}`,\n messages: await convertToModelMessages(normalizedMessages),\n stopWhen: stepCountIs(5),\n tools: ctx.tools,\n });\n\n const response = result.toUIMessageStreamResponse();\n response.headers.forEach((value: string, key: string) =>\n res.setHeader(key, value),\n );\n\n if (!response.body) {\n res.end();\n return;\n }\n\n const reader = response.body.getReader();\n const pump = async () => {\n const { done, value } = await reader.read();\n if (done) {\n res.end();\n return;\n }\n res.write(value);\n await pump();\n };\n await pump();\n}\n\nexport async function handleEdit(\n req: IncomingMessage,\n res: ServerResponse,\n ctx: RouteContext,\n): Promise<void> {\n const { code, prompt }: { code: string; prompt: string } = await parseBody(\n req,\n );\n\n const provider = createOpenAICompatible({\n name: 'copilot-proxy',\n baseURL: ctx.copilotProxyUrl,\n });\n\n const result = streamText({\n model: provider('claude-opus-4.5'),\n system: `Current component code:\\n\\`\\`\\`tsx\\n${code}\\n\\`\\`\\`\\n\\n${EDIT_PROMPT}`,\n messages: [{ role: 'user', content: prompt }],\n });\n\n res.setHeader('Content-Type', 'text/plain');\n res.setHeader('Transfer-Encoding', 'chunked');\n res.writeHead(200);\n\n for await (const chunk of result.textStream) {\n res.write(chunk);\n }\n res.end();\n}\n","export const PATCHWORK_PROMPT = `\nYou are a friendly assistant! When responding to the user, you _must_ respond with JSX files!\n\nLook at 'patchwork.compilers' to see what specific runtime components and libraries are supported. (e.g. '['@aprovan/patchwork-image-shadcn' supports React, Tailwind, & ShadCN components). If there are no compilers, respond as you normally would. If compilers are available, ALWAYS respond with a component following [Component Generation](#component-generation).\n\nLook at 'patchwork.services' to see what services are available for widgets to call. If services are listed, you can generate widgets that make service calls using global namespace objects.\n\n**IMPORTANT: If you need to discover available services or get details about a specific service, use the \\`search_services\\` tool.**\n\n## Component Generation\n\nRespond with code blocks using tagged attributes on the fence line. The \\`note\\` attribute (optional but encouraged) provides a brief description visible in the UI. The \\`path\\` attribute specifies the virtual file path.\n\n### Code Block Format\n\n\\`\\`\\`tsx note=\"Main component\" path=\"components/weather/main.tsx\"\nexport default function WeatherWidget() {\n // component code\n}\n\\`\\`\\`\n\n### Attribute Order\nPut \\`note\\` first so it's available soonest in streaming UI.\n\n### Multi-File Generation\n\nWhen generating complex widgets, you can output multiple files. Use the \\`@/\\` prefix for virtual file system paths. ALWAYS prefer to generate visible components before metadata.\n\n**Example multi-file widget:**\n\n\\`\\`\\`json note=\"Widget configuration\" path=\"components/dashboard/package.json\"\n{\n \"description\": \"Interactive dashboard widget\",\n \"patchwork\": {\n \"inputs\": {\n \"type\": \"object\",\n \"properties\": {\n \"title\": { \"type\": \"string\" }\n }\n },\n \"services\": {\n \"analytics\": [\"getMetrics\", \"getChartData\"]\n }\n }\n}\n\\`\\`\\`\n\n\\`\\`\\`tsx note=\"Main widget component\" path=\"components/dashboard/main.tsx\"\nimport { Card } from './Card';\nimport { Chart } from './Chart';\n\nexport default function Dashboard({ title = \"Dashboard\" }) {\n return (\n <div>\n <h1>{title}</h1>\n <Card />\n <Chart />\n </div>\n );\n}\n\\`\\`\\`\n\n\\`\\`\\`tsx note=\"Card subcomponent\" path=\"components/dashboard/Card.tsx\"\nexport function Card() {\n return <div className=\"p-4 rounded border\">Card content</div>;\n}\n\\`\\`\\`\n\n### Requirements\n- DO think heavily about correctness of code and syntax\n- DO keep things simple and self-contained\n- ALWAYS include the \\`path\\` attribute specifying the file location. Be generic with the name and describe the general component's use\n- ALWAYS output the COMPLETE code block with opening \\`\\`\\`tsx and closing \\`\\`\\` markers\n- Use \\`note\\` attribute to describe what each code block does (optional but encouraged)\n- NEVER truncate or cut off code - finish the entire component before stopping\n- If the component is complex, simplify it rather than leaving it incomplete\n- Do NOT include: a heading/title\n\n### Visual Design Guidelines\nCreate professional, polished interfaces that present information **spatially** rather than as vertical lists:\n- Use **cards, grids, and flexbox layouts** to organize related data into visual groups\n- Leverage **icons** (from lucide-react) alongside text to communicate meaning at a glance\n- Apply **visual hierarchy** through typography scale, weight, and color contrast\n- Use **whitespace strategically** to create breathing room and separation\n- Prefer **horizontal arrangements** where data fits naturally (e.g., stats in a row, badges inline)\n- Group related metrics into **compact visual clusters** rather than separate line items\n- Use **subtle backgrounds, borders, and shadows** to define sections without heavy dividers\n\n### Root Element Constraints\nThe component will be rendered inside a parent container that handles positioning. Your root element should:\n- ✅ Use intrinsic sizing (let content determine dimensions)\n- ✅ Handle internal padding (e.g., \\`p-4\\`, \\`p-6\\`)\n- ❌ NEVER add centering utilities (\\`items-center\\`, \\`justify-center\\`) to position itself\n- ❌ NEVER add viewport-relative sizing (\\`min-h-screen\\`, \\`h-screen\\`, \\`w-screen\\`)\n- ❌ NEVER add flex/grid on root just for self-centering\n\n### Using Services in Widgets (CRITICAL)\n\n**MANDATORY workflow - you must follow these steps IN ORDER:**\n\n1. **Use \\`search_services\\`** to discover the service schema\n2. **STOP. Make an actual call to the service tool itself** (e.g., \\`weather_get_forecast\\`, \\`github_get_repo\\`) with real arguments. This is NOT optional. Do NOT skip this step.\n3. **Observe the response** - verify it succeeded and note the exact data structure\n4. **Only then generate the widget** that fetches the same data at runtime\n\n**\\`search_services\\` is NOT a substitute for calling the actual service.** It only returns documentation. You MUST invoke the real service tool to validate your arguments work.\n\n**Tool naming:** Service tools use underscores, not dots. For example: \\`weather_get_forecast\\`, \\`github_list_repos\\`.\n\n**Example workflow for a weather widget:**\n\\`\\`\\`\nStep 1: search_services({ query: \"weather\" })\n → Learn that weather_get_current_conditions exists with params: { latitude, longitude }\n\nStep 2: weather_get_current_conditions({ latitude: 29.7604, longitude: -95.3698 }) ← REQUIRED!\n → Verify it returns { temp: 72, humidity: 65, ... }\n\nStep 3: Generate widget that calls weather.get_current_conditions at runtime\n\\`\\`\\`\n\n**If you skip Step 2, you will generate broken widgets.** Arguments that look correct in the schema may fail at runtime due to validation rules, required formats, or service-specific constraints.\n\n**NEVER embed static data directly in the component.**\n\n❌ **WRONG** - Embedding data directly:\n\\`\\`\\`tsx path=\"components/weather/bad-example.tsx\"\n// DON'T DO THIS - calling tool, then embedding the response as static data\nexport default function WeatherWidget() {\n // Static data embedded at generation time - BAD!\n const weather = { temp: 72, condition: \"sunny\", humidity: 45 };\n return <div>Temperature: {weather.temp}°F</div>;\n}\n\\`\\`\\`\n\n✅ **CORRECT** - Fetching data at runtime:\n\\`\\`\\`tsx note=\"Weather widget with runtime data\" path=\"components/weather/main.tsx\"\nexport default function WeatherWidget() {\n const [data, setData] = useState(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState(null);\n\n useEffect(() => {\n // Fetch data at runtime - GOOD!\n weather.get_forecast({ latitude: 48.8566, longitude: 2.3522 })\n .then(setData)\n .catch(setError)\n .finally(() => setLoading(false));\n }, []);\n\n if (loading) return <Skeleton className=\"h-32 w-full\" />;\n if (error) return <Alert variant=\"destructive\">{error.message}</Alert>;\n \n return <div>Temperature: {data.temp}°F</div>;\n}\n\\`\\`\\`\n\n**Why this matters:**\n- Widgets with runtime service calls show **live data** that updates when refreshed\n- Static embedded data becomes **stale immediately** after generation\n- The proxy pattern allows widgets to be **reusable** across different contexts\n- Error handling and loading states improve **user experience**\n\n**Service call pattern:**\n\\`\\`\\`tsx\n// Services are available as global namespace objects\n// Call format: namespace.procedure_name({ ...args })\n\nconst [data, setData] = useState(null);\nconst [loading, setLoading] = useState(true);\nconst [error, setError] = useState(null);\n\nuseEffect(() => {\n serviceName.procedure_name({ param1: value1 })\n .then(setData)\n .catch(setError)\n .finally(() => setLoading(false));\n}, [/* dependencies */]);\n\\`\\`\\`\n\n**Required for service-using widgets:**\n- Always show loading indicators (Skeleton, Loader2 spinner, etc.)\n- Always handle errors gracefully with user-friendly messages\n- Use appropriate React hooks (useState, useEffect) for async data\n- Services are injected as globals - NO imports needed\n\n### Validating Service Calls (CRITICAL - READ CAREFULLY)\n\n**Calling \\`search_services\\` multiple times is NOT validation.** You must call the actual service tool.\n\n❌ **WRONG workflow (will produce broken widgets):**\n\\`\\`\\`\n1. search_services({ query: \"weather\" }) ← Only gets schema\n2. search_services({ query: \"location\" }) ← Still only schema\n3. Generate widget ← BROKEN - never tested the actual service!\n\\`\\`\\`\n\n✅ **CORRECT workflow:**\n\\`\\`\\`\n1. search_services({ query: \"weather\" }) ← Get schema\n2. weather_get_forecast({ latitude: 29.76, longitude: -95.37 }) ← ACTUALLY CALL IT\n3. Observe response: { temp: 72, conditions: \"sunny\", ... }\n4. Generate widget that calls weather.get_forecast at runtime\n\\`\\`\\`\n\n**The service tool (e.g., \\`weather_get_forecast\\`, \\`github_list_repos\\`) is a DIFFERENT tool from \\`search_services\\`.** You have access to both. Use both.\n\n**Only after a successful test call to the actual service should you generate the widget.**\n\n### Component Parameterization (IMPORTANT)\n\n**Widgets should accept props for dynamic values instead of hardcoding:**\n\n❌ **WRONG** - Hardcoded values:\n\\`\\`\\`tsx path=\"components/weather/bad-example.tsx\"\nexport default function WeatherWidget() {\n // Location hardcoded - BAD!\n const [lat, lon] = [48.8566, 2.3522]; // Paris\n // ...\n}\n\\`\\`\\`\n\n✅ **CORRECT** - Parameterized with props and defaults:\n\\`\\`\\`tsx note=\"Parameterized weather widget\" path=\"components/weather/main.tsx\"\ninterface WeatherWidgetProps {\n location?: string; // e.g., \"Paris, France\"\n latitude?: number; // Direct coordinates (optional)\n longitude?: number;\n}\n\nexport default function WeatherWidget({ \n location = \"Paris, France\",\n latitude,\n longitude \n}: WeatherWidgetProps) {\n // Use provided coordinates or look up from location name\n // ...\n}\n\\`\\`\\`\n\n**Why parameterize:**\n- Components become **reusable** across different contexts\n- Users can **customize behavior** without editing code\n- Enables **composition** - parent components can pass different values\n- Supports **testing** with various inputs\n\n**What to parameterize:**\n- Location names, coordinates, IDs\n- Search queries and filters\n- Display options (count, format, theme)\n- API-specific identifiers (usernames, repo names, etc.)\n\n### Anti-patterns to Avoid\n- ❌ Bulleted or numbered lists of key-value pairs\n- ❌ Vertical stacks where horizontal layouts would fit\n- ❌ Plain text labels without visual treatment\n- ❌ Uniform styling that doesn't distinguish primary from secondary information\n- ❌ Wrapping components in centering containers (parent handles this)\n- ❌ **Embedding API response data directly in components instead of fetching at runtime**\n- ❌ **Calling a tool, then putting the response as static JSX/JSON in the generated code**\n- ❌ **Hardcoding values that should be component props**\n- ❌ **Calling \\`search_services\\` multiple times instead of calling the actual service tool**\n- ❌ **Generating a widget without first making a real call to the service with your intended arguments**\n- ❌ **Treating schema documentation as proof that a service call will work**\n- ❌ **Omitting the \\`path\\` attribute on code blocks**\n`;\n\nexport const EDIT_PROMPT = `\nYou are editing an existing JSX component. The user will provide the current code and describe the changes they want.\n\n## Response Format\n\nUse code fences with tagged attributes. The \\`note\\` attribute (optional but encouraged) provides a brief description visible in the UI. The \\`path\\` attribute specifies the target file.\n\n\\`\\`\\`diff note=\"Brief description of this change\" path=\"@/components/Button.tsx\"\n<<<<<<< SEARCH\nexact code to find\n=======\nreplacement code\n>>>>>>> REPLACE\n\\`\\`\\`\n\n### Attribute Order\nPut \\`note\\` first so it's available soonest in streaming UI.\n\n### Multi-File Edits\nWhen editing multiple files, use the \\`path\\` attribute with virtual paths (\\`@/\\` prefix for generated files):\n\n\\`\\`\\`diff note=\"Update button handler\" path=\"@/components/Button.tsx\"\n<<<<<<< SEARCH\nonClick={() => {}}\n=======\nonClick={() => handleClick()}\n>>>>>>> REPLACE\n\\`\\`\\`\n\n\\`\\`\\`diff note=\"Add utility function\" path=\"@/lib/utils.ts\"\n<<<<<<< SEARCH\nexport const formatDate = ...\n=======\nexport const formatDate = ...\n\nexport const handleClick = () => console.log('clicked');\n>>>>>>> REPLACE\n\\`\\`\\`\n\n## Rules\n- SEARCH block must match the existing code EXACTLY (whitespace, indentation, everything)\n- You can include multiple diff blocks for multiple changes\n- Each diff block should have its own \\`note\\` attribute annotation\n- Keep changes minimal and targeted\n- Do NOT output the full file - only the diffs\n- If clarification is needed, ask briefly before any diffs\n\n## CRITICAL: Diff Marker Safety\n- NEVER include the strings \"<<<<<<< SEARCH\", \"=======\", or \">>>>>>> REPLACE\" inside your replacement code\n- These are reserved markers for parsing the diff format\n- If you need to show diff-like content, use alternative notation (e.g., \"// old code\" / \"// new code\")\n- Malformed diff markers will cause the edit to fail\n\n## Summary\nAfter all diffs, provide a brief markdown summary of the changes made. Use formatting like:\n- **Bold** for emphasis on key changes\n- Bullet points for listing multiple changes\n- Keep it concise (2-4 lines max)\n- Do NOT include: a heading/title\n`;\n","import type { IncomingMessage, ServerResponse } from 'node:http';\nimport fs from 'fs';\nimport path from 'path';\n\nexport interface LocalPackagesContext {\n localPackages: Record<string, string>;\n log: (...args: unknown[]) => void;\n}\n\nexport function handleLocalPackages(\n req: IncomingMessage,\n res: ServerResponse,\n ctx: LocalPackagesContext,\n): boolean {\n const rawUrl = req.url || '';\n\n // Only handle /_local-packages routes\n if (!rawUrl.startsWith('/_local-packages')) {\n return false;\n }\n\n const urlWithoutPrefix = rawUrl.replace('/_local-packages', '');\n\n // Strip query string (bundlers add ?import to dynamic imports)\n const url = urlWithoutPrefix.split('?')[0] || '';\n\n // Parse the package name from URL (handles scoped packages like @scope/name)\n const match = url.match(/^\\/@([^/]+)\\/([^/@]+)(.*)$/);\n if (!match) {\n return false;\n }\n\n const [, scope, name, restPath] = match;\n const packageName = `@${scope}/${name}`;\n const localPath = ctx.localPackages[packageName];\n\n if (!localPath) {\n res.writeHead(404);\n res.end(`Package ${packageName} not found in local overrides`);\n return true;\n }\n\n // Determine what file to serve\n const rest = restPath || '';\n let filePath: string;\n\n try {\n if (rest === '/package.json') {\n filePath = path.join(localPath, 'package.json');\n } else if (rest === '' || rest === '/') {\n const pkgJson = JSON.parse(\n fs.readFileSync(path.join(localPath, 'package.json'), 'utf-8'),\n );\n const mainEntry = pkgJson.main || 'dist/index.js';\n filePath = path.join(localPath, mainEntry);\n } else {\n const normalizedPath = rest.startsWith('/') ? rest.slice(1) : rest;\n const distPath = path.join(localPath, 'dist', normalizedPath);\n const rootPath = path.join(localPath, normalizedPath);\n filePath = fs.existsSync(distPath) ? distPath : rootPath;\n }\n } catch (err) {\n ctx.log('Error resolving file path:', err);\n res.writeHead(500);\n res.end(`Error resolving path for ${packageName}: ${err}`);\n return true;\n }\n\n try {\n ctx.log(`Serving ${filePath}`);\n const content = fs.readFileSync(filePath, 'utf-8');\n const ext = path.extname(filePath);\n const contentType =\n ext === '.json'\n ? 'application/json'\n : ext === '.js'\n ? 'application/javascript'\n : ext === '.ts'\n ? 'application/typescript'\n : 'text/plain';\n res.setHeader('Content-Type', contentType);\n res.writeHead(200);\n res.end(content);\n } catch (err) {\n ctx.log('Error serving file:', filePath, err);\n res.writeHead(404);\n res.end(`File not found: ${filePath}`);\n }\n\n return true;\n}\n","import {\n readFile,\n writeFile,\n unlink,\n readdir,\n stat,\n mkdir,\n rm,\n} from \"node:fs/promises\";\nimport { watch } from \"node:fs\";\nimport { dirname, resolve, sep } from \"node:path\";\nimport type { IncomingMessage, ServerResponse } from \"node:http\";\n\nexport interface VFSContext {\n rootDir: string;\n usePaths: boolean;\n log: (...args: unknown[]) => void;\n}\n\nfunction normalizeRelPath(path: string): string {\n const decoded = decodeURIComponent(path).replace(/\\\\/g, \"/\");\n return decoded.replace(/^\\/+|\\/+$/g, \"\");\n}\n\nfunction resolvePath(rootDir: string, relPath: string): string {\n const root = resolve(rootDir);\n const full = resolve(root, relPath);\n if (full !== root && !full.startsWith(`${root}${sep}`)) {\n throw new Error(\"Invalid path\");\n }\n return full;\n}\n\nfunction joinRelPath(base: string, name: string): string {\n return base ? `${base}/${name}` : name;\n}\n\nasync function listAllFiles(\n rootDir: string,\n relPath: string,\n): Promise<string[]> {\n const targetPath = resolvePath(rootDir, relPath);\n let entries: Awaited<ReturnType<typeof readdir>> = [];\n try {\n entries = await readdir(targetPath, { withFileTypes: true });\n } catch {\n return [];\n }\n\n const results: string[] = [];\n for (const entry of entries) {\n const entryRelPath = joinRelPath(relPath, entry.name);\n if (entry.isDirectory()) {\n results.push(...(await listAllFiles(rootDir, entryRelPath)));\n } else {\n results.push(entryRelPath);\n }\n }\n\n return results.sort((a, b) => a.localeCompare(b));\n}\n\nasync function ensureDir(filePath: string): Promise<void> {\n await mkdir(dirname(filePath), { recursive: true });\n}\n\nfunction sendJson(res: ServerResponse, status: number, body: unknown): void {\n res.setHeader(\"Content-Type\", \"application/json\");\n res.writeHead(status);\n res.end(JSON.stringify(body));\n}\n\nexport function handleVFS(\n req: IncomingMessage,\n res: ServerResponse,\n ctx: VFSContext,\n): boolean {\n const url = req.url || \"/\";\n const method = req.method || \"GET\";\n\n if (!url.startsWith(\"/vfs\")) return false;\n\n // Handle config endpoint\n if (url === \"/vfs/config\" && method === \"GET\") {\n res.setHeader(\"Content-Type\", \"application/json\");\n res.writeHead(200);\n res.end(JSON.stringify({ usePaths: ctx.usePaths }));\n return true;\n }\n\n const handleRequest = async () => {\n const urlObj = new URL(url, \"http://localhost\");\n const query = urlObj.searchParams;\n const rawPath = urlObj.pathname.slice(4);\n const relPath = normalizeRelPath(rawPath);\n\n if (query.has(\"watch\")) {\n if (method !== \"GET\") {\n res.writeHead(405);\n res.end(\"Method not allowed\");\n return;\n }\n\n const watchPath = normalizeRelPath(query.get(\"watch\") || \"\");\n const fullWatchPath = resolvePath(ctx.rootDir, watchPath);\n let watchStats;\n try {\n watchStats = await stat(fullWatchPath);\n } catch {\n res.writeHead(404);\n res.end(\"Not found\");\n return;\n }\n\n res.setHeader(\"Content-Type\", \"text/event-stream\");\n res.setHeader(\"Cache-Control\", \"no-cache\");\n res.setHeader(\"Connection\", \"keep-alive\");\n res.writeHead(200);\n\n const watcher = watch(\n fullWatchPath,\n { recursive: watchStats.isDirectory() },\n async (eventType, filename) => {\n const eventPath = normalizeRelPath(\n [watchPath, filename ? filename.toString() : \"\"]\n .filter(Boolean)\n .join(\"/\"),\n );\n const fullEventPath = resolvePath(ctx.rootDir, eventPath);\n\n let type: \"create\" | \"update\" | \"delete\" = \"update\";\n if (eventType === \"rename\") {\n try {\n await stat(fullEventPath);\n type = \"create\";\n } catch {\n type = \"delete\";\n }\n }\n\n res.write(\"event: change\\n\");\n res.write(\n `data: ${JSON.stringify({\n type,\n path: eventPath,\n mtime: new Date().toISOString(),\n })}\\n\\n`,\n );\n },\n );\n\n req.on(\"close\", () => watcher.close());\n return;\n }\n\n if (method === \"HEAD\" && !relPath) {\n res.writeHead(200);\n res.end();\n return;\n }\n\n if (method === \"GET\" && !relPath && !query.toString()) {\n const files = await listAllFiles(ctx.rootDir, \"\");\n sendJson(res, 200, files);\n return;\n }\n\n if (!relPath && method !== \"GET\" && method !== \"HEAD\") {\n res.writeHead(400);\n res.end(\"Invalid path\");\n return;\n }\n\n const targetPath = resolvePath(ctx.rootDir, relPath);\n\n if (method === \"GET\" && query.get(\"stat\") === \"true\") {\n try {\n const stats = await stat(targetPath);\n sendJson(res, 200, {\n size: stats.size,\n mtime: stats.mtime.toISOString(),\n isFile: stats.isFile(),\n isDirectory: stats.isDirectory(),\n });\n } catch {\n res.writeHead(404);\n res.end(\"Not found\");\n }\n return;\n }\n\n if (method === \"GET\" && query.get(\"readdir\") === \"true\") {\n try {\n const entries = await readdir(targetPath, { withFileTypes: true });\n const mapped = entries\n .map((entry) => ({\n name: entry.name,\n isDirectory: entry.isDirectory(),\n }))\n .sort((a, b) => a.name.localeCompare(b.name));\n sendJson(res, 200, mapped);\n } catch (err) {\n const code = (err as NodeJS.ErrnoException).code;\n if (code === \"ENOTDIR\") {\n res.writeHead(409);\n res.end(\"Not a directory\");\n return;\n }\n res.writeHead(404);\n res.end(\"Not found\");\n }\n return;\n }\n\n if (method === \"POST\" && query.get(\"mkdir\") === \"true\") {\n const recursive = query.get(\"recursive\") === \"true\";\n try {\n await mkdir(targetPath, { recursive });\n res.writeHead(200);\n res.end(\"ok\");\n } catch {\n res.writeHead(500);\n res.end(\"Mkdir failed\");\n }\n return;\n }\n\n switch (method) {\n case \"GET\": {\n try {\n const content = await readFile(targetPath, \"utf-8\");\n res.setHeader(\"Content-Type\", \"text/plain\");\n res.writeHead(200);\n res.end(content);\n } catch {\n res.writeHead(404);\n res.end(\"Not found\");\n }\n return;\n }\n case \"PUT\": {\n let body = \"\";\n req.on(\"data\", (chunk) => (body += chunk));\n req.on(\"end\", async () => {\n try {\n await ensureDir(targetPath);\n await writeFile(targetPath, body, \"utf-8\");\n res.writeHead(200);\n res.end(\"ok\");\n } catch (err) {\n ctx.log(\"VFS PUT error:\", err);\n res.writeHead(500);\n res.end(\"Write failed\");\n }\n });\n return;\n }\n case \"DELETE\": {\n const recursive = query.get(\"recursive\") === \"true\";\n let stats;\n try {\n stats = await stat(targetPath);\n } catch {\n res.writeHead(404);\n res.end(\"Not found\");\n return;\n }\n\n if (stats.isDirectory()) {\n if (!recursive) {\n try {\n const entries = await readdir(targetPath);\n if (entries.length > 0) {\n res.writeHead(409);\n res.end(\"Directory not empty\");\n return;\n }\n await rm(targetPath, { recursive: false });\n res.writeHead(200);\n res.end(\"ok\");\n } catch {\n res.writeHead(500);\n res.end(\"Delete failed\");\n }\n return;\n }\n try {\n await rm(targetPath, { recursive: true });\n res.writeHead(200);\n res.end(\"ok\");\n } catch {\n res.writeHead(500);\n res.end(\"Delete failed\");\n }\n return;\n }\n\n try {\n await unlink(targetPath);\n res.writeHead(200);\n res.end(\"ok\");\n } catch {\n res.writeHead(404);\n res.end(\"Not found\");\n }\n return;\n }\n case \"HEAD\": {\n try {\n await stat(targetPath);\n res.writeHead(200);\n res.end();\n } catch {\n res.writeHead(404);\n res.end();\n }\n return;\n }\n default:\n res.writeHead(405);\n res.end(\"Method not allowed\");\n }\n };\n\n handleRequest().catch((err) => {\n ctx.log(\"VFS error:\", err);\n res.writeHead(500);\n res.end(\"Internal error\");\n });\n\n return true;\n}\n","/**\n * Service Registry - Tracks available services for widget calls\n *\n * Services can be registered from:\n * - MCP servers (via --mcp CLI)\n * - External backends (UTCP, HTTP, etc.)\n *\n * Provides unified interface for calling services and exposing metadata.\n */\n\nimport { jsonSchema, type Tool } from 'ai';\n\n/**\n * Service backend interface - abstracts service call mechanisms\n * Backends can be UTCP, HTTP proxies, direct MCP, etc.\n */\nexport interface ServiceBackend {\n call(service: string, procedure: string, args: unknown[]): Promise<unknown>;\n}\n\n/**\n * Service tool metadata for prompt generation\n */\nexport interface ServiceToolInfo {\n /** Full tool name (e.g., 'weather.get_forecast') */\n name: string;\n /** Namespace (e.g., 'weather') */\n namespace: string;\n /** Procedure name (e.g., 'get_forecast') */\n procedure: string;\n /** Tool description */\n description?: string;\n /** Parameter schema */\n parameters?: Record<string, unknown>;\n /** TypeScript interface definition (optional, for search results) */\n typescriptInterface?: string;\n}\n\n/**\n * Search options for tool discovery\n */\nexport interface SearchServicesOptions {\n /** Natural language task description to search for */\n query?: string;\n /** Filter by namespace */\n namespace?: string;\n /** Maximum results to return */\n limit?: number;\n /** Include full TypeScript interfaces in results */\n includeInterfaces?: boolean;\n}\n\n/**\n * Service registry that tracks available services\n */\nexport class ServiceRegistry {\n private tools: Map<string, Tool> = new Map();\n private toolInfo: Map<string, ServiceToolInfo> = new Map();\n private backends: ServiceBackend[] = [];\n\n /**\n * Register tools from MCP or other sources\n * @param tools - Record of tool name to Tool\n * @param namespace - Optional namespace to prefix all tools (e.g., MCP server name)\n */\n registerTools(tools: Record<string, Tool>, namespace?: string): void {\n for (const [toolName, tool] of Object.entries(tools)) {\n // Build the full name: namespace.toolName or just toolName\n const name = namespace ? `${namespace}.${toolName}` : toolName;\n this.tools.set(name, tool);\n\n // Parse namespace and procedure from the full name using '.' separator\n const dotIndex = name.indexOf('.');\n const ns = dotIndex > 0 ? name.substring(0, dotIndex) : name;\n const procedure = dotIndex > 0 ? name.substring(dotIndex + 1) : name;\n\n this.toolInfo.set(name, {\n name,\n namespace: ns,\n procedure,\n description: tool.description,\n parameters: (tool.inputSchema ?? {}) as Record<string, unknown>,\n typescriptInterface: this.generateTypeScriptInterface(name, tool),\n });\n }\n }\n\n /**\n * Register a service backend (UTCP, HTTP, etc.)\n * Creates callable Tool objects for each procedure so the LLM can invoke them directly.\n * Backends are tried in order of registration, first success wins.\n */\n registerBackend(\n backend: ServiceBackend,\n toolInfos?: ServiceToolInfo[],\n ): void {\n this.backends.push(backend);\n if (toolInfos) {\n for (const info of toolInfos) {\n this.toolInfo.set(info.name, info);\n\n // Create a callable Tool object for LLM use\n const tool: Tool = {\n description: info.description,\n inputSchema: jsonSchema(\n info.parameters ?? { type: 'object', properties: {} },\n ),\n execute: async (args: unknown) => {\n return backend.call(info.namespace, info.procedure, [args]);\n },\n };\n this.tools.set(info.name, tool);\n }\n }\n }\n\n /**\n * Generate TypeScript interface from tool schema\n */\n private generateTypeScriptInterface(name: string, tool: Tool): string {\n const schema = tool.inputSchema as Record<string, unknown> | undefined;\n const props = (schema?.properties ?? {}) as Record<\n string,\n { type?: string; description?: string }\n >;\n const required = (schema?.required ?? []) as string[];\n\n const params = Object.entries(props)\n .map(([key, val]) => {\n const optional = !required.includes(key) ? '?' : '';\n const type =\n val.type === 'number'\n ? 'number'\n : val.type === 'boolean'\n ? 'boolean'\n : val.type === 'array'\n ? 'unknown[]'\n : val.type === 'object'\n ? 'Record<string, unknown>'\n : 'string';\n const comment = val.description ? ` // ${val.description}` : '';\n return ` ${key}${optional}: ${type};${comment}`;\n })\n .join('\\n');\n\n return `interface ${name.replace(\n /[^a-zA-Z0-9]/g,\n '_',\n )}Args {\\n${params}\\n}`;\n }\n\n /**\n * Convert internal tool name (namespace.procedure) to LLM-safe name (namespace_procedure)\n * OpenAI-compatible APIs require tool names to match ^[a-zA-Z0-9_-]+$\n */\n private toLLMToolName(internalName: string): string {\n return internalName.replace(/\\./g, '_');\n }\n\n /**\n * Convert LLM tool name (namespace_procedure) back to internal name (namespace.procedure)\n * Only converts the first underscore after the namespace prefix\n */\n private fromLLMToolName(llmName: string): string {\n // Find the tool by checking if any registered tool converts to this LLM name\n for (const internalName of this.tools.keys()) {\n if (this.toLLMToolName(internalName) === llmName) {\n return internalName;\n }\n }\n // Fallback: convert first underscore to dot\n const underscoreIndex = llmName.indexOf('_');\n if (underscoreIndex > 0) {\n return (\n llmName.substring(0, underscoreIndex) +\n '.' +\n llmName.substring(underscoreIndex + 1)\n );\n }\n return llmName;\n }\n\n /**\n * Get all tools for LLM usage with LLM-safe names (underscores instead of dots)\n */\n getTools(): Record<string, Tool> {\n const result: Record<string, Tool> = {};\n for (const [name, tool] of this.tools) {\n result[this.toLLMToolName(name)] = tool;\n }\n return result;\n }\n\n /**\n * Get service metadata for prompt generation\n */\n getServiceInfo(): ServiceToolInfo[] {\n return Array.from(this.toolInfo.values());\n }\n\n /**\n * Get unique namespaces\n */\n getNamespaces(): string[] {\n const namespaces = new Set<string>();\n for (const info of this.toolInfo.values()) {\n namespaces.add(info.namespace);\n }\n return Array.from(namespaces);\n }\n\n /**\n * Search for services by query, namespace, or list all\n */\n searchServices(options: SearchServicesOptions = {}): ServiceToolInfo[] {\n const { query, namespace, limit = 20, includeInterfaces = false } = options;\n\n let results = Array.from(this.toolInfo.values());\n\n // Filter by namespace\n if (namespace) {\n results = results.filter((info) => info.namespace === namespace);\n }\n\n // Search by query (simple keyword matching)\n if (query) {\n const queryLower = query.toLowerCase();\n const keywords = queryLower.split(/\\s+/).filter(Boolean);\n\n results = results\n .map((info) => {\n const searchText = `${info.name} ${info.namespace} ${\n info.procedure\n } ${info.description ?? ''}`.toLowerCase();\n const matchCount = keywords.filter((kw) =>\n searchText.includes(kw),\n ).length;\n return { info, score: matchCount / keywords.length };\n })\n .filter(({ score }) => score > 0)\n .sort((a, b) => b.score - a.score)\n .map(({ info }) => info);\n }\n\n // Apply limit\n results = results.slice(0, limit);\n\n // Optionally include TypeScript interfaces\n if (!includeInterfaces) {\n results = results.map(({ typescriptInterface: _, ...rest }) => rest);\n }\n\n return results;\n }\n\n /**\n * Get detailed info about a specific tool\n */\n getToolInfo(toolName: string): ServiceToolInfo | undefined {\n return this.toolInfo.get(toolName);\n }\n\n /**\n * List all tool names\n */\n listToolNames(): string[] {\n return Array.from(this.toolInfo.keys());\n }\n\n /**\n * Call a service procedure\n */\n async call(\n namespace: string,\n procedure: string,\n args: unknown,\n ): Promise<unknown> {\n // Try registered backends first (in order)\n for (const backend of this.backends) {\n try {\n return await backend.call(namespace, procedure, [args]);\n } catch {\n // Try next backend\n }\n }\n\n // Fall back to MCP tools - use dot separator\n const exactKey = `${namespace}.${procedure}`;\n let tool = this.tools.get(exactKey);\n\n if (!tool) {\n // Try finding by namespace prefix match\n for (const [name, t] of this.tools) {\n if (name.startsWith(`${namespace}.`) && name.endsWith(procedure)) {\n tool = t;\n break;\n }\n }\n }\n\n if (!tool) {\n throw new Error(\n `Service not found: ${namespace}.${procedure}. Available: ${Array.from(\n this.tools.keys(),\n )\n .slice(0, 10)\n .join(', ')}`,\n );\n }\n\n // Execute the tool\n if (!tool.execute) {\n throw new Error(`Tool ${namespace}.${procedure} has no execute function`);\n }\n\n const result = await tool.execute(args as Record<string, unknown>, {\n toolCallId: `${Date.now()}-${Math.random().toString(36).slice(2)}`,\n messages: [],\n });\n\n return result;\n }\n\n /**\n * Check if a service exists\n */\n has(namespace: string, procedure: string): boolean {\n const key = `${namespace}.${procedure}`;\n return this.tools.has(key);\n }\n\n /**\n * Get count of registered tools\n */\n get size(): number {\n return this.toolInfo.size;\n }\n}\n\n/**\n * Generate a services description for prompts\n */\nexport function generateServicesPrompt(registry: ServiceRegistry): string {\n const namespaces = registry.getNamespaces();\n if (namespaces.length === 0) return '';\n\n const services = registry.getServiceInfo();\n const byNamespace = new Map<string, ServiceToolInfo[]>();\n\n for (const service of services) {\n const existing = byNamespace.get(service.namespace) || [];\n existing.push(service);\n byNamespace.set(service.namespace, existing);\n }\n\n let prompt = `## Available Services\\n\\nThe following services are available for generated widgets to call:\\n\\n`;\n\n for (const [ns, tools] of byNamespace) {\n prompt += `### \\`${ns}\\`\\n`;\n for (const tool of tools) {\n prompt += `- \\`${ns}.${tool.procedure}()\\``;\n if (tool.description) {\n prompt += `: ${tool.description}`;\n }\n prompt += '\\n';\n }\n prompt += '\\n';\n }\n\n prompt += `**Usage in widgets:**\n\\`\\`\\`tsx\n// Services are available as global namespaces\nconst result = await ${namespaces[0] ?? 'service'}.${\n byNamespace.get(namespaces[0] ?? '')?.[0]?.procedure ?? 'example'\n }({ /* args */ });\n\\`\\`\\`\n\nMake sure to handle loading states and errors when calling services.\n`;\n\n return prompt;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA0C;AAC1C,iBAAgC;AAChC,uBAA+C;AAC/C,4BAAkC;AAClC,IAAAA,aAAsC;;;ACHtC,+BAAuC;AACvC,gBAMO;;;ACRA,IAAM,mBAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IAEA,MAAM,QAAQ;AACZ,aAAO,IAAI,QAAQ,CAACC,UAAS,WAAW;AACtC,eAAO,GAAG,SAAS,MAAM;AACzB,eAAO,OAAO,MAAM,MAAM,MAAM;AAC9B,cAAI,8BAA8B,IAAI,IAAI,IAAI,EAAE;AAChD,UAAAA,SAAQ,EAAE,MAAM,KAAK,CAAC;AAAA,QACxB,CAAC;AAAA,MACH,CAAC;AAAA,IACH;AAAA,IAEA,MAAM,OAAO;AACX,aAAO,IAAI,QAAQ,CAACA,UAAS,WAAW;AACtC,eAAO,MAAM,CAAC,QAAQ;AACpB,cAAI,IAAK,QAAO,GAAG;AAAA,cACd,CAAAA,SAAQ;AAAA,QACf,CAAC;AAAA,MACH,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":["import_ai","resolve","path","fs","path","import_ai","parseBody","resolve"]}
@@ -0,0 +1,3 @@
1
+ import 'node:http';
2
+ export { e as StitcheryServer, f as createStitcheryServer } from '../index-DNQY1UAP.cjs';
3
+ import 'ai';
@@ -0,0 +1,3 @@
1
+ import 'node:http';
2
+ export { e as StitcheryServer, f as createStitcheryServer } from '../index-DNQY1UAP.js';
3
+ import 'ai';