import { a as MastraTracingOptions } from "./mastra-CPBWgXGH.js"; import * as _mastra_core_server0 from "@mastra/core/server"; import { ContextWithMastra } from "@mastra/core/server"; import { CopilotServiceAdapter } from "@copilotkit/runtime"; import { AgentsConfig, CopilotCorsConfig, CopilotRuntimeOptions } from "@copilotkit/runtime/v2"; import { RequestContext } from "@mastra/core/request-context"; //#region src/copilotkit.d.ts /** * `Omit` that distributes over each member of a union, so a discriminated union * (e.g. `CopilotRuntimeOptions`) keeps its discriminant correlation. Plain * `Omit` collapses to `Omit` because `keyof (A | B)` is only * the shared keys, which destroys the union. */ type DistributiveOmit = T extends unknown ? Omit : never; /** * Registers a CopilotKit endpoint that exposes Mastra agents through the AG-UI protocol. * This function creates an API route that handles CopilotKit requests and forwards them to Mastra agents, enabling seamless integration between CopilotKit's UI components and Mastra's agent framework. * * @example * ```ts * registerCopilotKit({ * path: "/api/copilotkit" * }); * ``` */ declare function registerCopilotKit({ path, resourceId, serviceAdapter, setContext, agents, cors, tracingOptions, ...runtimeOptions }: { path: string; resourceId: string; /** * Mastra tracing options forwarded to each agent run (default-agent path * only; ignored when `agents` is supplied since those are pre-constructed). * See MastraAgentConfig.tracingOptions. */ tracingOptions?: MastraTracingOptions; /** * @deprecated The v2 CopilotKit runtime handler used internally has no * service-adapter slot (AG-UI agents don't use one), so this option is * accepted for backwards compatibility but ignored. Safe to remove. */ serviceAdapter?: CopilotServiceAdapter; /** * Hook to populate the request context before agents run. It runs inside the * route handler, i.e. *after* any Mastra server middleware, so the * `requestContext` it receives already holds whatever keys that middleware * set. Be careful not to clobber those keys (e.g. `MASTRA_RESOURCE_ID_KEY`) * unless that is the intent. */ setContext?: (c: ContextWithMastra, requestContext: RequestContext) => void | Promise; cors?: boolean | CopilotCorsConfig; } & DistributiveOmit & { agents?: AgentsConfig; }): _mastra_core_server0.ApiRoute; //#endregion export { registerCopilotKit }; //# sourceMappingURL=copilotkit.d.ts.map