forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
128 lines (116 loc) · 4.07 KB
/
Copy pathindex.ts
File metadata and controls
128 lines (116 loc) · 4.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/**
* @copilotkit/react-native
*
* React Native bindings for CopilotKit. Provides a lightweight provider
* and re-exports platform-agnostic hooks from @copilotkit/react-core.
*
* Polyfills (DOMException, ReadableStream, TextEncoder, etc.) are
* auto-imported when this module loads -- no manual
* `import "@copilotkit/react-native/polyfills"` needed.
*
* Quick start:
* ```tsx
* import { CopilotKitProvider, useAgent, useCopilotKit } from "@copilotkit/react-native";
* ```
*/
// Auto-install polyfills so consumers don't need a manual import.
// Must run before any CopilotKit code that relies on ReadableStream / fetch streaming.
import "./polyfills";
// React Native provider (no web dependencies)
export { CopilotKitProvider } from "./CopilotKitProvider";
export type { CopilotKitNativeProviderProps } from "./CopilotKitProvider";
// Provider props alias (mirrors web's CopilotKitProviderProps)
export type { CopilotKitNativeProviderProps as CopilotKitProviderProps } from "./CopilotKitProvider";
// Headless chat components (no DOM, consumer provides UI)
export { CopilotChat, useCopilotChatContext } from "./CopilotChat";
export type { CopilotChatProps, CopilotChatContextValue } from "./CopilotChat";
export { CopilotModal } from "./CopilotModal";
export type { CopilotModalProps } from "./CopilotModal";
// Native attachments hook and types
export { useAttachments } from "./hooks/use-attachments";
export type {
NativeAttachmentsConfig,
NativeFileInput,
UseNativeAttachmentsProps,
UseNativeAttachmentsReturn,
} from "./hooks/use-attachments";
// Pre-built UI components
export { CopilotSidebar } from "./CopilotSidebar";
export type {
CopilotSidebarProps,
CopilotSidebarHandle,
} from "./CopilotSidebar";
export { CopilotPopup } from "./CopilotPopup";
export type { CopilotPopupProps, CopilotPopupHandle } from "./CopilotPopup";
// Re-export context and hooks from react-core (platform-agnostic)
export {
useCopilotKit,
useLicenseContext,
CopilotKitContext,
type CopilotKitContextValue,
} from "@copilotkit/react-core/v2/context";
// Re-export hooks that work without web deps
// These consume the CopilotKitContext which our provider sets
export {
useAgent,
useFrontendTool,
useComponent,
useHumanInTheLoop,
useInterrupt,
useSuggestions,
useConfigureSuggestions,
useAgentContext,
useThreads,
useCapabilities,
defineToolCallRenderer,
CopilotChatDefaultLabels,
type UseAgentUpdate,
type UseInterruptConfig,
type AgentContextInput,
type JsonSerializable,
type Thread,
type UseThreadsInput,
type UseThreadsResult,
type CopilotChatLabels,
type CopilotChatConfigurationValue,
type InterruptEvent,
type InterruptHandlerProps,
type InterruptRenderProps,
type Interrupt,
type ResumeEntry,
type ResumeStatus,
type ReactFrontendTool,
type ReactHumanInTheLoop,
type RenderToolInProgressProps,
type RenderToolExecutingProps,
type RenderToolCompleteProps,
} from "@copilotkit/react-core/v2/headless";
// useRenderToolCall — web-specific (depends on DOM elements via DefaultToolCallRenderer)
// useRenderCustomMessages — web-specific (tightly coupled to web chat UI rendering pipeline)
// useRenderActivityMessage — web-specific (tightly coupled to web chat UI rendering pipeline)
// useDefaultRenderTool — web-specific (DefaultToolCallRenderer uses <div>, <svg>, etc.)
// Re-export core types commonly needed
export type {
CopilotKitCoreRuntimeConnectionStatus,
CopilotKitCoreErrorCode,
Suggestion,
FrontendTool,
ToolCallStatus,
} from "@copilotkit/core";
// Re-export AG-UI types for consumer convenience (matches web SDK surface)
export type {
Message,
AssistantMessage as AssistantMessageType,
ToolCall,
ToolMessage,
AbstractAgent,
AgentCapabilities,
} from "@ag-ui/client";
// Render tool hook (React Native version with render registry integration)
export { useRenderTool } from "./hooks/useRenderTool";
export type { UseRenderToolOptions } from "./hooks/useRenderTool";
export {
RenderToolProvider,
useRenderToolRegistry,
} from "./hooks/RenderToolContext";
export type { RenderToolProps } from "./hooks/RenderToolContext";