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

40 lines (38 loc) 1.53 kB
import { CopilotRuntimeLike } from "./runtime.cjs"; import { CopilotCorsConfig } from "./fetch-cors.cjs"; import { CopilotRuntimeHooks } from "./hooks.cjs"; //#region src/v2/runtime/core/fetch-handler.d.ts interface CopilotRuntimeHandlerOptions { runtime: CopilotRuntimeLike; /** * Optional base path for routing. * * When provided: strict prefix stripping. The handler strips this prefix from the * URL pathname and matches the remainder against known routes. * * When omitted: suffix matching. The handler matches known route patterns as * suffixes of the URL pathname. */ basePath?: string; /** * Endpoint mode: * - "multi-route" (default): Routes like POST /agent/:agentId/run, GET /info, etc. * - "single-route": Single POST endpoint with JSON envelope { method, params, body } */ mode?: "multi-route" | "single-route"; /** * Optional CORS configuration. * When not provided, no CORS headers are added (let the framework handle it). * Set to true for permissive defaults, or provide an object. */ cors?: boolean | CopilotCorsConfig; /** * Lifecycle hooks for request processing. */ hooks?: CopilotRuntimeHooks; } type CopilotRuntimeFetchHandler = (request: Request) => Promise<Response>; declare function createCopilotRuntimeHandler(options: CopilotRuntimeHandlerOptions): CopilotRuntimeFetchHandler; //#endregion export { CopilotRuntimeFetchHandler, CopilotRuntimeHandlerOptions, createCopilotRuntimeHandler }; //# sourceMappingURL=fetch-handler.d.cts.map