import { a as CopilotKitNativeProviderProps, i as RenderToolProps, n as useRenderTool, o as CopilotKitProvider, r as RenderToolFunction, t as UseRenderToolOptions } from "./useRenderTool-BWo11PCL.cjs"; import { AbstractAgent, AgentCapabilities, AgentContextInput, AssistantMessageType, CopilotChatConfigurationValue, CopilotChatDefaultLabels, CopilotChatLabels, CopilotKitContext, CopilotKitContextValue, CopilotKitCoreErrorCode, CopilotKitCoreRuntimeConnectionStatus, FrontendTool, Interrupt, InterruptEvent, InterruptHandlerProps, InterruptRenderProps, JsonSerializable, Message, ReactFrontendTool, ReactHumanInTheLoop, ReactToolCallRenderer, RenderToolCompleteProps, RenderToolExecutingProps, RenderToolInProgressProps, ResumeEntry, ResumeStatus, Suggestion, Thread, ToolCall, ToolCallStatus, ToolMessage, UseAgentUpdate, UseInterruptConfig, UseThreadsInput, UseThreadsResult, defineToolCallRenderer, useAgent, useAgentContext, useCapabilities, useComponent, useConfigureSuggestions, useCopilotKit, useFrontendTool, useHumanInTheLoop, useInterrupt, useLicenseContext, useRenderToolCall, useSuggestions, useThreads } from "./headless.cjs"; import * as react_jsx_runtime0 from "react/jsx-runtime"; import React, { ReactNode } from "react"; import { ViewStyle } from "react-native"; import { CopilotKitCoreErrorCode as CopilotKitCoreErrorCode$1 } from "@copilotkit/core"; import { Attachment, AttachmentUploadErrorReason, AttachmentUploadResult } from "@copilotkit/shared"; //#region src/hooks/use-attachments.d.ts /** * Platform-neutral file descriptor for React Native. * Replaces the web `File` object in all attachment APIs. */ interface NativeFileInput { /** Local file URI (e.g. `file:///path/to/file`). */ uri: string; /** Filename with extension. */ name: string; /** File size in bytes. */ size: number; /** MIME type (e.g. `"image/jpeg"`). */ mimeType: string; } /** * React Native variant of AttachmentsConfig. * Identical to the shared AttachmentsConfig except `onUpload` receives * a `NativeFileInput` instead of a web `File`. */ interface NativeAttachmentsConfig { /** Enable file attachments in the chat input. */ enabled: boolean; /** MIME type filter for the file picker, default all files. */ accept?: string; /** Maximum file size in bytes, default 20MB (20 * 1024 * 1024). */ maxSize?: number; /** Custom upload handler. Receives the native file descriptor. */ onUpload?: (file: NativeFileInput) => AttachmentUploadResult | Promise; /** Called when an attachment fails validation or upload. */ onUploadFailed?: (error: { reason: AttachmentUploadErrorReason; file: NativeFileInput; message: string; }) => void; } interface UseNativeAttachmentsProps { config?: NativeAttachmentsConfig; } interface UseNativeAttachmentsReturn { /** Currently selected attachments (uploading + ready). */ attachments: Attachment[]; /** Whether attachments are enabled. */ enabled: boolean; /** Open the native document picker. */ openPicker: () => Promise; /** Process an array of NativeFileInput objects (validate, read, add to state). */ processFiles: (files: NativeFileInput[]) => Promise; /** Remove an attachment by ID. */ removeAttachment: (id: string) => void; /** Consume ready attachments and clear the queue. Returns the consumed attachments. */ consumeAttachments: () => Attachment[]; } /** * React Native hook that manages file attachment state -- picking, uploading, * and lifecycle. All returned callbacks are referentially stable via useCallback. * * This is the RN counterpart of the web `useAttachments` hook from * `@copilotkit/react-core`. It replaces web APIs (FileReader, DragEvent, * HTMLInputElement) with Expo modules (expo-document-picker, expo-file-system). */ declare function useAttachments({ config }: UseNativeAttachmentsProps): UseNativeAttachmentsReturn; //#endregion //#region src/CopilotChat.d.ts interface CopilotChatContextValue { /** The resolved agent instance. */ agent: any; /** Whether the agent is currently running. */ isRunning: boolean; /** Current messages in the conversation. */ messages: any[]; /** Currently selected attachments (uploading + ready). */ attachments: Attachment[]; /** Whether attachments are enabled. */ attachmentsEnabled: boolean; /** Open the native document picker to add files. */ openPicker: () => Promise; /** Remove an attachment by ID. */ removeAttachment: (id: string) => void; /** * Submit a message with optional attachments. * Handles consuming ready attachments, building InputContent[], * calling agent.addMessage, and running the agent. */ submitMessage: (text: string) => Promise; } /** * Hook to access the CopilotChat context from child components. * Must be called inside a `` component tree. */ declare function useCopilotChatContext(): CopilotChatContextValue; interface CopilotChatBaseProps { /** * The agent ID to use for this chat session. * Matches the web SDK's CopilotChat `agentId` prop. * * Resolution order: `agentId` > `agentName` > `"default"` */ agentId?: string; /** * @deprecated Use `agentId` instead. `agentName` is kept for backwards * compatibility and will be removed in a future release. */ agentName?: string; /** * Thread ID for this chat session. When provided, the chat will resume * the specified thread. Matches the web SDK's CopilotChat `threadId` prop. */ threadId?: string; /** * Error handler scoped to this chat's agent. Fires in addition to the * provider-level onError (does not suppress it). Receives only errors * whose context.agentId matches this chat's agent. */ onError?: (event: { error: Error; code: CopilotKitCoreErrorCode$1; context: Record; }) => void | Promise; /** * Throttle interval (in milliseconds) for re-renders triggered by message * change notifications. Overrides the provider-level `defaultThrottleMs` * for this chat instance. Forwarded to the internal `useAgent()` hook. * * @default undefined -- inherits from provider `defaultThrottleMs`; * if that is also unset, re-renders are unthrottled. */ throttleMs?: number; /** * Enable multimodal file attachments (images, audio, video, documents). * Pass a NativeAttachmentsConfig object to configure file picking behavior. */ attachments?: NativeAttachmentsConfig; /** * Optional children rendered inside the chat context. */ children?: ReactNode; } interface CopilotChatProps extends CopilotChatBaseProps { /** Passthrough props are forwarded to consumers via the agent context. */ [key: string]: unknown; } /** * Headless CopilotChat component for React Native. * * Wires up the `useAgent` hook with `agentId` resolution and renders children. * Unlike the web SDK's CopilotChat, this component does not render any UI * elements -- consumers provide their own React Native views. * * Children can access chat state via `useCopilotChatContext()`. * * ```tsx * import { CopilotChat, useCopilotChatContext } from "@copilotkit/react-native"; * * function MyChatUI() { * const { messages, submitMessage, attachments, openPicker } = useCopilotChatContext(); * // ... render your UI * } * * * * * ``` */ declare function CopilotChat({ agentId, agentName, threadId, onError, throttleMs, attachments: attachmentsConfig, children, ..._rest }: CopilotChatProps): react_jsx_runtime0.JSX.Element; //#endregion //#region src/CopilotModal.d.ts interface CopilotModalProps extends CopilotChatProps { /** * Optional children rendered inside the modal context. */ children?: ReactNode; } /** * Headless CopilotModal component for React Native. * * A thin wrapper around CopilotChat that mirrors the web SDK's CopilotModal * API surface. On React Native, modal presentation is handled by the consumer * (e.g. React Native's `Modal` component) -- this component only provides * the agent wiring and prop resolution. * * ```tsx * import { CopilotModal } from "@copilotkit/react-native"; * import { Modal } from "react-native"; * * * * * * * ``` */ declare function CopilotModal({ children, ...props }: CopilotModalProps): react_jsx_runtime0.JSX.Element; //#endregion //#region src/CopilotSidebar.d.ts interface CopilotSidebarHandle { /** Slide the drawer open. */ open(): void; /** Slide the drawer closed. */ close(): void; /** Toggle the drawer open/closed. */ toggle(): void; } interface CopilotSidebarProps extends Omit { /** * Start the drawer in the open position. * @default false */ defaultOpen?: boolean; /** * Width of the drawer panel. Accepts a number (points) or a percentage * string (e.g. `"85%"`). Defaults to 85% of the screen width. */ width?: number | string; /** * Title displayed in the drawer header bar. * @default "Copilot" */ headerTitle?: string; /** * Show a floating action button to toggle the drawer. * @default true */ showToggleButton?: boolean; /** Called after the drawer finishes opening. */ onOpen?: () => void; /** Called after the drawer finishes closing. */ onClose?: () => void; /** Custom style applied to the drawer container. */ style?: ViewStyle; /** Content rendered inside the drawer below the chat area. */ children?: ReactNode; } /** * CopilotSidebar -- a slide-in drawer from the right edge of the screen * that wraps CopilotChat for React Native. * * ```tsx * import { CopilotSidebar } from "@copilotkit/react-native"; * * const ref = useRef(null); * * * ``` */ declare const CopilotSidebar: React.ForwardRefExoticComponent>; //#endregion //#region src/CopilotPopup.d.ts interface CopilotPopupProps { /** * The agent ID to use for this chat session. * Passed through to CopilotChat. */ agentId?: string; /** * @deprecated Use `agentId` instead. */ agentName?: string; /** * Thread ID for this chat session. */ threadId?: string; /** * Throttle interval (ms) for re-renders. */ throttleMs?: number; /** * Whether the popup starts in the open state. * @default false */ defaultOpen?: boolean; /** * Height of the popup card. Accepts a number (points) or a percentage * string (e.g. "60%") relative to the screen height. * @default "60%" */ height?: number | string; /** * Error handler scoped to this popup's chat agent. */ onError?: (error: Error) => void; /** * Title displayed in the popup header bar. * @default "CopilotKit" */ headerTitle?: string; /** * Enable multimodal file attachments. Forwarded to the internal CopilotChat. * Children access attachment state via `useCopilotChatContext()`. */ attachments?: NativeAttachmentsConfig; /** * Optional children rendered below the CopilotChat content * inside the popup card. */ children?: ReactNode; /** * Callback fired when the popup opens. */ onOpen?: () => void; /** * Callback fired when the popup closes. */ onClose?: () => void; /** * Whether tapping the semi-transparent backdrop dismisses the popup. * Equivalent to web SDK's `clickOutsideToClose`. * @default true */ dismissOnBackdropPress?: boolean; /** * Whether to show the floating action button (FAB) that toggles the popup. * @default true */ showToggleButton?: boolean; /** * Custom styles applied to the popup card container. */ style?: ViewStyle; } /** * Imperative handle exposed via ref for controlling the popup programmatically. */ interface CopilotPopupHandle { open: () => void; close: () => void; toggle: () => void; } /** * CopilotPopup for React Native. * * A floating action button (FAB) that opens a modal chat overlay. * The popup appears as a card floating above content with rounded corners, * a shadow, and a semi-transparent backdrop. * * ```tsx * import { CopilotPopup } from "@copilotkit/react-native"; * * const popupRef = useRef(null); * * * ``` */ declare const CopilotPopup: React.ForwardRefExoticComponent>; //#endregion export { AbstractAgent, AgentCapabilities, AgentContextInput, AssistantMessageType, CopilotChat, CopilotChatConfigurationValue, type CopilotChatContextValue, CopilotChatDefaultLabels, CopilotChatLabels, type CopilotChatProps, CopilotKitContext, CopilotKitContextValue, CopilotKitCoreErrorCode, CopilotKitCoreRuntimeConnectionStatus, CopilotKitNativeProviderProps, CopilotKitNativeProviderProps as CopilotKitProviderProps, CopilotKitProvider, CopilotModal, type CopilotModalProps, CopilotPopup, type CopilotPopupHandle, type CopilotPopupProps, CopilotSidebar, type CopilotSidebarHandle, type CopilotSidebarProps, FrontendTool, Interrupt, InterruptEvent, InterruptHandlerProps, InterruptRenderProps, JsonSerializable, Message, type NativeAttachmentsConfig, type NativeFileInput, ReactFrontendTool, ReactHumanInTheLoop, ReactToolCallRenderer, RenderToolCompleteProps, RenderToolExecutingProps, RenderToolFunction, RenderToolInProgressProps, RenderToolProps, ResumeEntry, ResumeStatus, Suggestion, Thread, ToolCall, ToolCallStatus, ToolMessage, UseAgentUpdate, UseInterruptConfig, type UseNativeAttachmentsProps, type UseNativeAttachmentsReturn, UseRenderToolOptions, UseThreadsInput, UseThreadsResult, defineToolCallRenderer, useAgent, useAgentContext, useAttachments, useCapabilities, useComponent, useConfigureSuggestions, useCopilotChatContext, useCopilotKit, useFrontendTool, useHumanInTheLoop, useInterrupt, useLicenseContext, useRenderTool, useRenderToolCall, useSuggestions, useThreads }; //# sourceMappingURL=index.d.cts.map