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;" />

25 lines (23 loc) 1.28 kB
import "reflect-metadata"; import { createCopilotEndpointSingleRoute } from "../../../v2/runtime/endpoints/hono-single.mjs"; import telemetryClient, { getRuntimeInstanceTelemetryInfo } from "../../telemetry-client.mjs"; import { getCommonConfig } from "../shared.mjs"; import { handle } from "hono/vercel"; //#region src/lib/integrations/nextjs/app-router.ts function copilotRuntimeNextJSAppRouterEndpoint(options) { const commonConfig = getCommonConfig(options); telemetryClient.setGlobalProperties({ runtime: { framework: "nextjs-app-router" } }); if (options.properties?._copilotkit) telemetryClient.setGlobalProperties({ _copilotkit: options.properties._copilotkit }); telemetryClient.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options)); commonConfig.logging.debug("Creating NextJS App Router endpoint"); const serviceAdapter = options.serviceAdapter; if (serviceAdapter) options.runtime.handleServiceAdapter(serviceAdapter); return { handleRequest: handle(createCopilotEndpointSingleRoute({ runtime: options.runtime.instance, basePath: options.baseUrl ?? options.endpoint, ...options.cors && { cors: options.cors } })) }; } //#endregion export { copilotRuntimeNextJSAppRouterEndpoint }; //# sourceMappingURL=app-router.mjs.map