@copilotkit/runtime
Version:
<img src="https://github.com/user-attachments/assets/0a6b64d9-e193-4940-a3f6-60334ac34084" alt="banner" style="border-radius: 12px; border: 2px solid #d6d4fa;" />
1 lines • 2 kB
Source Map (JSON)
{"version":3,"file":"express-single.cjs","names":["createCopilotExpressHandler"],"sources":["../../../../src/v2/runtime/endpoints/express-single.ts"],"sourcesContent":["import type { Router } from \"express\";\nimport { createCopilotExpressHandler } from \"./express\";\nimport type { CopilotRuntimeLike } from \"../core/runtime\";\nimport type { CopilotRuntimeHooks } from \"../core/hooks\";\n\ninterface CopilotSingleRouteExpressParams {\n runtime: CopilotRuntimeLike;\n basePath: string;\n /**\n * Lifecycle hooks for request processing.\n */\n hooks?: CopilotRuntimeHooks;\n}\n\n/**\n * Creates an Express router that serves the CopilotKit runtime as a single\n * POST endpoint. Clients send a JSON envelope with `{ method, params, body }`\n * to dispatch to the appropriate handler.\n *\n * This is a convenience wrapper around {@link createCopilotExpressHandler}\n * with `mode: \"single-route\"` and `cors: true`.\n *\n * @example\n * ```typescript\n * import express from \"express\";\n * import { CopilotRuntime } from \"@copilotkit/runtime/v2\";\n * import { createCopilotEndpointSingleRouteExpress } from \"@copilotkit/runtime/v2/express\";\n *\n * const runtime = new CopilotRuntime({\n * agents: { default: new BuiltInAgent({ model: \"openai/gpt-4o-mini\" }) },\n * });\n *\n * const app = express();\n * app.use(createCopilotEndpointSingleRouteExpress({\n * runtime,\n * basePath: \"/api/copilotkit\",\n * }));\n * app.listen(4000);\n * ```\n */\n/** @deprecated Use `createCopilotExpressHandler` with `mode: \"single-route\"` instead. */\nexport function createCopilotEndpointSingleRouteExpress({\n runtime,\n basePath,\n hooks,\n}: CopilotSingleRouteExpressParams): Router {\n return createCopilotExpressHandler({\n runtime,\n basePath,\n mode: \"single-route\",\n cors: true,\n hooks,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,SAAgB,wCAAwC,EACtD,SACA,UACA,SAC0C;AAC1C,QAAOA,4CAA4B;EACjC;EACA;EACA,MAAM;EACN,MAAM;EACN;EACD,CAAC"}