{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ai-sdk",
  "type": "registry:block",
  "title": "AI SDK",
  "description": "Vercel AI SDK model configuration, streaming helpers, and gateway-ready defaults.",
  "dependencies": [
    "ai",
    "@ai-sdk/gateway"
  ],
  "devDependencies": [],
  "registryDependencies": [],
  "files": [
    {
      "path": "apps/web/src/lib/ai/ai-sdk.ts",
      "type": "registry:file",
      "target": "apps/web/src/lib/ai/ai-sdk.ts",
      "content": "export const DEFAULT_AI_MODEL = process.env.AI_GATEWAY_MODEL;\n\nexport function getAIGatewayModel(model?: string) {\n  const selected = model || DEFAULT_AI_MODEL;\n  if (!selected) {\n    throw new Error(\"AI_GATEWAY_MODEL is not set.\");\n  }\n  return selected;\n}\n\nexport function assertAIGatewayConfigured() {\n  if (!process.env.AI_GATEWAY_API_KEY) {\n    throw new Error(\"AI_GATEWAY_API_KEY is not set.\");\n  }\n}\n"
    },
    {
      "path": "apps/web/src/lib/ai/streaming.ts",
      "type": "registry:file",
      "target": "apps/web/src/lib/ai/streaming.ts",
      "content": "import { convertToModelMessages, streamText, type UIMessage } from \"ai\";\n\nimport { getAIGatewayModel } from \"@/lib/ai/ai-sdk\";\n\nexport function streamChatMessages({\n  messages,\n  model,\n  system,\n}: {\n  messages: UIMessage[];\n  model?: string;\n  system: string;\n}) {\n  return streamText({\n    model: getAIGatewayModel(model),\n    system,\n    messages: convertToModelMessages(messages),\n  });\n}\n"
    }
  ],
  "maintenanceSkills": [
    {
      "name": "ai-sdk",
      "target": ".stackfoundry/skills/ai-sdk-module/SKILL.md",
      "content": "---\nname: ai-sdk\ndescription: Maintain the AI SDK module installed by StackFoundry.\n---\n\n# AI SDK Maintenance Instructions\n\n- Keep provider keys server-only.\n- Use AI SDK abstractions instead of importing provider SDKs directly.\n- Keep model IDs, gateway routing, and fallback behavior documented.\n- Re-run chat route and stream verification after changing model or streaming helpers.\n\n## Shared Skills\n\nWhen provider, framework, or database behavior changes, load the installed shared skill before editing implementation details:\n\n- `.stackfoundry/skills/nextjs/SKILL.md` (source: `registry/skills/nextjs/SKILL.md`)\n\nKeep this module skill focused on ownership, installed files, env vars, deployment checks, and module-specific invariants.\n"
    },
    {
      "name": "nextjs",
      "target": ".stackfoundry/skills/nextjs/SKILL.md",
      "content": "---\nname: nextjs\ndescription: Maintain Next.js App Router code installed by StackFoundry modules.\n---\n\n# Next.js Operating Instructions\n\n## Installed Location\n\n- Installed target: `.stackfoundry/skills/nextjs/SKILL.md`\n- Registry source: `registry/skills/nextjs/SKILL.md`\n\nAgents maintaining an installed module should load this shared skill from the installed target when provider, framework, database, SDK, or platform behavior is involved. Keep provider-specific API details here instead of duplicating them inside module maintenance skills.\n\n- Keep server-only data access out of Client Components.\n- Put route handlers under `app/api` and UI routes under the relevant App Router segment.\n- Prefer Server Components for data loading and add `\"use client\"` only for interactivity.\n- Keep public environment variables prefixed with `NEXT_PUBLIC_`; keep secrets server-only.\n- Re-run typecheck and build after changing route handlers, layouts, or shared app configuration.\n"
    }
  ],
  "envVars": {
    "AI_GATEWAY_API_KEY": "",
    "AI_GATEWAY_MODEL": ""
  },
  "docs": "# AI SDK\n\nVercel AI SDK model configuration, streaming helpers, and gateway-ready defaults.\n\nThis module is inspired by Vercel's AI SDK guidance for model abstraction, UI message streaming, and gateway-based provider routing.\n\n## Owns\n\n- `apps/web/src/lib/ai/ai-sdk.ts`\n- `apps/web/src/lib/ai/streaming.ts`\n\n## Dependencies\n\n- `ai`\n- `@ai-sdk/gateway`\n\n## Environment\n\n- `AI_GATEWAY_API_KEY`\n- `AI_GATEWAY_MODEL`\n\n## Maintenance\n\n- Keep provider keys server-only.\n- Prefer AI SDK provider and gateway abstractions over direct provider SDK imports.\n- Use UI message streams for chat surfaces.\n- Document model IDs, fallback behavior, and cost-sensitive paths.\n",
  "meta": {
    "category": "ai",
    "env": [
      "AI_GATEWAY_API_KEY",
      "AI_GATEWAY_MODEL"
    ],
    "status": "ready",
    "maturity": "ready",
    "recommendedFor": []
  }
}
