Files
copilotkit__copilotkit/registry/public/r/agent-spec.json
2025-12-17 17:48:04 +01:00

27 lines
2.1 KiB
JSON

{
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
"name": "agent-spec",
"type": "registry:block",
"title": "Open Agent Spec Starter",
"description": "A starter for CopilotKit with an Agent Spec backend.",
"dependencies": [
"@copilotkit/runtime",
"@copilotkit/react-core",
"@copilotkit/react-ui"
],
"files": [
{
"path": "registry/layout/agent-layout.tsx",
"content": "import \"@copilotkit/react-ui/styles.css\";\nimport React, { ReactNode } from \"react\";\nimport { CopilotKit } from \"@copilotkit/react-core\";\n\n// Where CopilotKit will proxy requests to. If you're using Copilot Cloud, this environment variable will be empty.\nconst runtimeUrl = process.env.NEXT_PUBLIC_COPILOTKIT_RUNTIME_URL\n// When using Copilot Cloud, all we need is the publicApiKey.\nconst publicApiKey = process.env.NEXT_PUBLIC_COPILOT_API_KEY;\n// The name of the agent that we'll be using.\nconst agentName = process.env.NEXT_PUBLIC_COPILOTKIT_AGENT_NAME\n\nexport default function Layout({ children }: { children: ReactNode }) {\n return (\n <CopilotKit \n runtimeUrl={runtimeUrl}\n publicApiKey={publicApiKey}\n agent={agentName}\n >\n {children}\n </CopilotKit>\n );\n}\n",
"type": "registry:page",
"target": "app/copilotkit/layout.tsx"
},
{
"path": "registry/runtime/remote-endpoint.ts",
"content": "import { NextRequest } from \"next/server\";\nimport {\n CopilotRuntime,\n copilotRuntimeNextJSAppRouterEndpoint,\n ExperimentalEmptyAdapter,\n} from \"@copilotkit/runtime\";\n\nconst serviceAdapter = new ExperimentalEmptyAdapter();\n\nconst runtime = new CopilotRuntime({\n remoteEndpoints: [\n { url: process.env.COPILOTKIT_REMOTE_ENDPOINT || \"http://localhost:8000/chat\" },\n ],\n});\n\nexport const POST = async (req: NextRequest) => {\n const { handleRequest } = copilotRuntimeNextJSAppRouterEndpoint({\n runtime,\n serviceAdapter,\n endpoint: \"/api/copilotkit\",\n });\n\n return handleRequest(req);\n};\n",
"type": "registry:lib",
"target": "app/api/copilotkit/route.ts"
}
]
}