UNPKG

@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 1.83 kB
{"version":3,"file":"pages-router.mjs","names":[],"sources":["../../../../src/lib/integrations/nextjs/pages-router.ts"],"sourcesContent":["import { CreateCopilotRuntimeServerOptions, getCommonConfig } from \"../shared\";\nimport telemetry, {\n getRuntimeInstanceTelemetryInfo,\n} from \"../../telemetry-client\";\nimport { copilotRuntimeNodeHttpEndpoint } from \"../node-http\";\n\nexport const config = {\n api: {\n bodyParser: false,\n },\n};\n\n// This import is needed to fix the type error\n// Fix is currently in TypeScript 5.5 beta, waiting for stable version\n// https://github.com/microsoft/TypeScript/issues/42873#issuecomment-2066874644\n// oxlint-disable-next-line unicorn/require-module-specifiers, typescript/no-useless-empty-export\nexport type {} from \"@whatwg-node/server\";\n\nexport function copilotRuntimeNextJSPagesRouterEndpoint(\n options: CreateCopilotRuntimeServerOptions,\n) {\n const commonConfig = getCommonConfig(options);\n\n telemetry.setGlobalProperties({\n runtime: {\n framework: \"nextjs-pages-router\",\n },\n });\n\n if (options.properties?._copilotkit) {\n telemetry.setGlobalProperties({\n _copilotkit: options.properties._copilotkit,\n });\n }\n\n telemetry.capture(\n \"oss.runtime.instance_created\",\n getRuntimeInstanceTelemetryInfo(options),\n );\n\n const logger = commonConfig.logging;\n logger.debug(\"Creating NextJS Pages Router endpoint\");\n\n return copilotRuntimeNodeHttpEndpoint(options);\n}\n"],"mappings":";;;;;;AAMA,MAAa,SAAS,EACpB,KAAK,EACH,YAAY,OACb,EACF;AAQD,SAAgB,wCACd,SACA;CACA,MAAM,eAAe,gBAAgB,QAAQ;AAE7C,iBAAU,oBAAoB,EAC5B,SAAS,EACP,WAAW,uBACZ,EACF,CAAC;AAEF,KAAI,QAAQ,YAAY,YACtB,iBAAU,oBAAoB,EAC5B,aAAa,QAAQ,WAAW,aACjC,CAAC;AAGJ,iBAAU,QACR,gCACA,gCAAgC,QAAQ,CACzC;AAGD,CADe,aAAa,QACrB,MAAM,wCAAwC;AAErD,QAAO,+BAA+B,QAAQ"}