44 * React Native bindings for CopilotKit. Provides a lightweight provider
55 * and re-exports platform-agnostic hooks from @copilotkit/react-core.
66 *
7+ * Polyfills (DOMException, ReadableStream, TextEncoder, etc.) are
8+ * auto-imported when this module loads -- no manual
9+ * `import "@copilotkit/react-native/polyfills"` needed.
10+ *
711 * Quick start:
812 * ```tsx
913 * import { CopilotKitProvider, useAgent, useCopilotKit } from "@copilotkit/react-native";
1014 * ```
1115 */
1216
17+ // Auto-install polyfills so consumers don't need a manual import.
18+ // Must run before any CopilotKit code that relies on ReadableStream / fetch streaming.
19+ import "./polyfills" ;
20+
1321// React Native provider (no web dependencies)
1422export { CopilotKitProvider } from "./CopilotKitProvider" ;
1523export type { CopilotKitNativeProviderProps } from "./CopilotKitProvider" ;
1624
25+ // Provider props alias (mirrors web's CopilotKitProviderProps)
26+ export type { CopilotKitNativeProviderProps as CopilotKitProviderProps } from "./CopilotKitProvider" ;
27+
28+ // Headless chat components (no DOM, consumer provides UI)
29+ export { CopilotChat , useCopilotChatContext } from "./CopilotChat" ;
30+ export type { CopilotChatProps , CopilotChatContextValue } from "./CopilotChat" ;
31+ export { CopilotModal } from "./CopilotModal" ;
32+ export type { CopilotModalProps } from "./CopilotModal" ;
33+
34+ // Native attachments hook and types
35+ export { useAttachments } from "./hooks/use-attachments" ;
36+ export type {
37+ NativeAttachmentsConfig ,
38+ NativeFileInput ,
39+ UseNativeAttachmentsProps ,
40+ UseNativeAttachmentsReturn ,
41+ } from "./hooks/use-attachments" ;
42+
43+ // Pre-built UI components
44+ export { CopilotSidebar } from "./CopilotSidebar" ;
45+ export type {
46+ CopilotSidebarProps ,
47+ CopilotSidebarHandle ,
48+ } from "./CopilotSidebar" ;
49+ export { CopilotPopup } from "./CopilotPopup" ;
50+ export type { CopilotPopupProps , CopilotPopupHandle } from "./CopilotPopup" ;
51+
1752// Re-export context and hooks from react-core (platform-agnostic)
1853export {
1954 useCopilotKit ,
@@ -34,11 +69,50 @@ export {
3469 useConfigureSuggestions ,
3570 useAgentContext ,
3671 useThreads ,
72+ useRenderTool ,
73+ useCapabilities ,
74+ defineToolCallRenderer ,
75+ CopilotChatDefaultLabels ,
3776 type UseAgentUpdate ,
77+ type UseInterruptConfig ,
78+ type AgentContextInput ,
79+ type JsonSerializable ,
80+ type Thread ,
81+ type UseThreadsInput ,
82+ type UseThreadsResult ,
83+ type CopilotChatLabels ,
84+ type CopilotChatConfigurationValue ,
85+ type InterruptEvent ,
86+ type InterruptHandlerProps ,
87+ type InterruptRenderProps ,
88+ type ReactFrontendTool ,
89+ type ReactHumanInTheLoop ,
90+ type RenderToolProps ,
91+ type RenderToolInProgressProps ,
92+ type RenderToolExecutingProps ,
93+ type RenderToolCompleteProps ,
3894} from "@copilotkit/react-core/v2/headless" ;
3995
96+ // useRenderToolCall — web-specific (depends on DOM elements via DefaultToolCallRenderer)
97+ // useRenderCustomMessages — web-specific (tightly coupled to web chat UI rendering pipeline)
98+ // useRenderActivityMessage — web-specific (tightly coupled to web chat UI rendering pipeline)
99+ // useDefaultRenderTool — web-specific (DefaultToolCallRenderer uses <div>, <svg>, etc.)
100+
40101// Re-export core types commonly needed
41- export {
42- type CopilotKitCoreRuntimeConnectionStatus ,
43- type CopilotKitCoreErrorCode ,
102+ export type {
103+ CopilotKitCoreRuntimeConnectionStatus ,
104+ CopilotKitCoreErrorCode ,
105+ Suggestion ,
106+ FrontendTool ,
107+ ToolCallStatus ,
44108} from "@copilotkit/core" ;
109+
110+ // Re-export AG-UI types for consumer convenience (matches web SDK surface)
111+ export type {
112+ Message ,
113+ AssistantMessage ,
114+ ToolCall ,
115+ ToolMessage ,
116+ AbstractAgent ,
117+ AgentCapabilities ,
118+ } from "@ag-ui/client" ;
0 commit comments