@@ -4,31 +4,25 @@ import type { AbstractAgent } from "@ag-ui/client";
44import type { FrontendTool } from "@copilotkit/core" ;
55import type React from "react" ;
66import {
7- type ReactNode ,
87 useMemo ,
98 useEffect ,
109 useLayoutEffect ,
1110 useReducer ,
1211 useRef ,
1312 useState ,
1413} from "react" ;
14+ import type { ReactNode } from "react" ;
1515// Context extracted to ../context.ts for cross-platform reuse (React Native)
16- import {
17- CopilotKitContext ,
18- type CopilotKitContextValue ,
19- LicenseContext ,
20- } from "../context" ;
16+ import { CopilotKitContext , LicenseContext } from "../context" ;
17+ import type { CopilotKitContextValue } from "../context" ;
2118export type { CopilotKitContextValue } from "../context" ;
2219export { CopilotKitContext , useLicenseContext } from "../context" ;
2320import { z } from "zod" ;
2421import { CopilotKitInspector } from "../components/CopilotKitInspector" ;
2522import type { Anchor } from "@copilotkit/web-inspector" ;
2623import { LicenseWarningBanner } from "../components/license-warning-banner" ;
27- import {
28- createLicenseContextValue ,
29- type LicenseContextValue ,
30- type DebugConfig ,
31- } from "@copilotkit/shared" ;
24+ import { createLicenseContextValue } from "@copilotkit/shared" ;
25+ import type { LicenseContextValue , DebugConfig } from "@copilotkit/shared" ;
3226import type { CopilotKitCoreErrorCode } from "@copilotkit/core" ;
3327import {
3428 MCPAppsActivityContentSchema ,
@@ -62,6 +56,9 @@ import { zodToJsonSchema } from "zod-to-json-schema";
6256
6357const HEADER_NAME = "X-CopilotCloud-Public-Api-Key" ;
6458const COPILOT_CLOUD_CHAT_URL = "https://api.cloud.copilotkit.ai/copilotkit/v1" ;
59+ const EMPTY_HEADERS : Record < string , string > = { } ;
60+ const EMPTY_PROPERTIES : Record < string , unknown > = { } ;
61+ const EMPTY_AGENTS : Record < string , AbstractAgent > = { } ;
6562
6663const DEFAULT_DESIGN_SKILL = `When generating UI with generateSandboxedUi, follow these design principles inspired by shadcn/ui:
6764
@@ -246,14 +243,14 @@ function useStableArrayProp<T>(
246243export const CopilotKitProvider : React . FC < CopilotKitProviderProps > = ( {
247244 children,
248245 runtimeUrl,
249- headers : headersProp = { } ,
246+ headers : headersProp = EMPTY_HEADERS ,
250247 credentials,
251248 publicApiKey,
252249 publicLicenseKey,
253250 licenseToken,
254- properties = { } ,
255- agents__unsafe_dev_only : agents = { } ,
256- selfManagedAgents = { } ,
251+ properties = EMPTY_PROPERTIES ,
252+ agents__unsafe_dev_only : agents = EMPTY_AGENTS ,
253+ selfManagedAgents = EMPTY_AGENTS ,
257254 renderToolCalls,
258255 renderActivityMessages,
259256 renderCustomMessages,
0 commit comments