83 lines
3.1 KiB
TypeScript
83 lines
3.1 KiB
TypeScript
import { ReactCustomMessageRenderer } from "../types/react-custom-message-renderer.mjs";
|
|
import { ReactToolCallRenderer } from "../types/react-tool-call-renderer.mjs";
|
|
import { ReactActivityMessageRenderer } from "../types/react-activity-message-renderer.mjs";
|
|
import { ReactFrontendTool } from "../types/frontend-tool.mjs";
|
|
import { ReactHumanInTheLoop } from "../types/human-in-the-loop.mjs";
|
|
import "../types/index.mjs";
|
|
import { CopilotKitCoreReact } from "../lib/react-core.mjs";
|
|
import { AbstractAgent } from "@ag-ui/client";
|
|
import React, { ReactNode } from "react";
|
|
import { CopilotKitCoreErrorCode } from "@copilotkitnext/core";
|
|
import { Theme } from "@copilotkit/a2ui-renderer";
|
|
|
|
//#region src/providers/CopilotKitProvider.d.ts
|
|
interface CopilotKitContextValue {
|
|
copilotkit: CopilotKitCoreReact;
|
|
/**
|
|
* Set of tool call IDs currently being executed.
|
|
* This is tracked at the provider level to ensure tool execution events
|
|
* are captured even before child components mount.
|
|
*/
|
|
executingToolCallIds: ReadonlySet<string>;
|
|
}
|
|
interface CopilotKitProviderProps {
|
|
children: ReactNode;
|
|
runtimeUrl?: string;
|
|
headers?: Record<string, string>;
|
|
/**
|
|
* Credentials mode for fetch requests (e.g., "include" for HTTP-only cookies in cross-origin requests).
|
|
*/
|
|
credentials?: RequestCredentials;
|
|
/**
|
|
* The Copilot Cloud public API key.
|
|
*/
|
|
publicApiKey?: string;
|
|
/**
|
|
* Alias for `publicApiKey`
|
|
**/
|
|
publicLicenseKey?: string;
|
|
properties?: Record<string, unknown>;
|
|
useSingleEndpoint?: boolean;
|
|
agents__unsafe_dev_only?: Record<string, AbstractAgent>;
|
|
selfManagedAgents?: Record<string, AbstractAgent>;
|
|
renderToolCalls?: ReactToolCallRenderer<any>[];
|
|
renderActivityMessages?: ReactActivityMessageRenderer<any>[];
|
|
renderCustomMessages?: ReactCustomMessageRenderer[];
|
|
frontendTools?: ReactFrontendTool[];
|
|
humanInTheLoop?: ReactHumanInTheLoop[];
|
|
showDevConsole?: boolean | "auto";
|
|
/**
|
|
* Error handler called when CopilotKit encounters an error.
|
|
* Fires for all error types (runtime connection failures, agent errors, tool errors).
|
|
*/
|
|
onError?: (event: {
|
|
error: Error;
|
|
code: CopilotKitCoreErrorCode;
|
|
context: Record<string, any>;
|
|
}) => void | Promise<void>;
|
|
/**
|
|
* Configuration for the A2UI (Agent-to-UI) renderer.
|
|
* The built-in A2UI renderer is activated automatically when the runtime reports
|
|
* that `a2ui` is configured in `CopilotRuntime`. This prop is optional and only
|
|
* needed if you want to override the default theme.
|
|
*
|
|
* @example
|
|
* ```tsx
|
|
* <CopilotKit runtimeUrl="/api/copilotkit" a2ui={{ theme: myCustomTheme }}>
|
|
* {children}
|
|
* </CopilotKit>
|
|
* ```
|
|
*/
|
|
a2ui?: {
|
|
/**
|
|
* Override the default A2UI viewer theme.
|
|
* When omitted, the built-in `viewerTheme` from `@copilotkit/a2ui-renderer` is used.
|
|
*/
|
|
theme?: Theme;
|
|
};
|
|
}
|
|
declare const CopilotKitProvider: React.FC<CopilotKitProviderProps>;
|
|
declare const useCopilotKit: () => CopilotKitContextValue;
|
|
//#endregion
|
|
export { CopilotKitContextValue, CopilotKitProvider, CopilotKitProviderProps, useCopilotKit };
|
|
//# sourceMappingURL=CopilotKitProvider.d.mts.map
|