@cadraos/sdk 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { Components } from 'react-markdown';
3
3
  import * as React$1 from 'react';
4
+ import React__default from 'react';
4
5
 
5
6
  interface MarkdownContentProps {
6
7
  /** Markdown content to render */
@@ -188,11 +189,19 @@ interface AttachmentFile {
188
189
  /** Original file object */
189
190
  file: File;
190
191
  /** Upload status */
191
- status: "pending" | "uploading" | "ready" | "failed";
192
+ status: "pending" | "uploading" | "processing" | "ready" | "error" | "failed";
192
193
  /** Preview URL for local display */
193
194
  previewUrl?: string;
194
195
  /** Progress percentage (0-100) */
195
- progress?: number;
196
+ progress: number;
197
+ /** File category */
198
+ category: "document" | "image" | "audio";
199
+ /** Error message when status is "error" */
200
+ error?: string;
201
+ /** Whether a thumbnail has been generated */
202
+ hasThumbnail?: boolean;
203
+ /** Override file.size for external attachments where actual File is empty */
204
+ actualSize?: number;
196
205
  }
197
206
 
198
207
  interface ChatMessageProps {
@@ -370,7 +379,11 @@ interface ExecuteInput {
370
379
  context?: Record<string, unknown>;
371
380
  /** Attachment UUIDs to include with the message (for images, documents, etc.) */
372
381
  attachmentIds?: string[];
373
- /** Team UUID for team-based execution (routes to team's lead orchestrator) */
382
+ /**
383
+ * Team UUID for team-based execution (routes to team's lead orchestrator).
384
+ * @deprecated Pass the team UUID directly as the agent/entity ID instead.
385
+ * The platform now auto-detects whether a UUID is an agent, team, or tool.
386
+ */
374
387
  teamUuid?: string;
375
388
  /** Execution options */
376
389
  options?: ExecuteOptions;
@@ -1167,7 +1180,7 @@ interface AgentChatProps {
1167
1180
  className?: string;
1168
1181
  /** Theme mode */
1169
1182
  theme?: ThemeMode;
1170
- /** Enable file attachments (future feature) */
1183
+ /** Enable file attachments */
1171
1184
  enableAttachments?: boolean;
1172
1185
  /** Enable markdown rendering */
1173
1186
  enableMarkdown?: boolean;
@@ -1195,6 +1208,7 @@ interface AgentChatProps {
1195
1208
  * <ChatConfigProvider config={{ baseUrl: '...', apiKey: '...' }}>
1196
1209
  * <AgentChat
1197
1210
  * agentId="agent-uuid"
1211
+ * enableAttachments
1198
1212
  * onMessage={(msg) => console.log('New message:', msg)}
1199
1213
  * />
1200
1214
  * </ChatConfigProvider>
@@ -1524,6 +1538,34 @@ interface ToolConfigUpdateInput {
1524
1538
  /** Enable/disable tool */
1525
1539
  isEnabled?: boolean;
1526
1540
  }
1541
+ /**
1542
+ * Request to execute a tool directly, bypassing the agent runtime.
1543
+ * The tool execution is enqueued for async processing via BullMQ.
1544
+ */
1545
+ interface ExecuteToolDirectRequest {
1546
+ /** Tool UUID */
1547
+ toolUuid: string;
1548
+ /** Which endpoint on the tool to call (defaults to first) */
1549
+ endpointId?: string;
1550
+ /** Tool parameters (prompt, referenceImageArtifactUuid, aspectRatio, etc.) */
1551
+ parameters: Record<string, unknown>;
1552
+ /** Optional execution ID (auto-generated if not provided) */
1553
+ executionId?: string;
1554
+ /** Optional callback URL for completion notification */
1555
+ callbackUrl?: string;
1556
+ }
1557
+ /**
1558
+ * Response from a direct tool execution request.
1559
+ * The tool is enqueued for async processing - use SSE or polling to get results.
1560
+ */
1561
+ interface ExecuteToolDirectResponse {
1562
+ /** Execution ID for tracking */
1563
+ executionId: string;
1564
+ /** BullMQ job ID */
1565
+ jobId: string;
1566
+ /** Execution status (always 'queued' on success) */
1567
+ status: 'queued';
1568
+ }
1527
1569
 
1528
1570
  /**
1529
1571
  * Artifact types
@@ -2150,6 +2192,26 @@ declare class ToolsAPI extends BaseResourceAPI {
2150
2192
  * ```
2151
2193
  */
2152
2194
  execute(uuid: string, input: Record<string, unknown>): Promise<ToolExecution>;
2195
+ /**
2196
+ * Execute a tool directly, bypassing the agent runtime.
2197
+ *
2198
+ * Enqueues the tool for async processing via BullMQ (no LLM, no ReAct loop).
2199
+ * Use SSE or polling with the returned executionId to get the result.
2200
+ *
2201
+ * @param request - Direct execution request
2202
+ * @returns Queued execution response with executionId for tracking
2203
+ *
2204
+ * @example
2205
+ * ```typescript
2206
+ * const result = await client.tools.executeDirect({
2207
+ * toolUuid: 'tool-uuid',
2208
+ * parameters: { prompt: 'Generate an image of a sunset' },
2209
+ * });
2210
+ * console.log(result.executionId); // Use for polling/SSE
2211
+ * console.log(result.status); // 'queued'
2212
+ * ```
2213
+ */
2214
+ executeDirect(request: ExecuteToolDirectRequest): Promise<ExecuteToolDirectResponse>;
2153
2215
  /**
2154
2216
  * Validate input against tool schema
2155
2217
  *
@@ -2807,6 +2869,13 @@ interface UseAgentChatOptions {
2807
2869
  /** Callback fired when clarification is needed */
2808
2870
  onClarification?: (data: ClarificationData) => void;
2809
2871
  }
2872
+ /**
2873
+ * Options for sendMessage
2874
+ */
2875
+ interface SendMessageOptions {
2876
+ /** UUIDs of attached files to include with the message */
2877
+ attachmentUuids?: string[];
2878
+ }
2810
2879
  interface UseAgentChatResult {
2811
2880
  /** Current messages in the chat */
2812
2881
  messages: ChatMessage$1[];
@@ -2823,7 +2892,7 @@ interface UseAgentChatResult {
2823
2892
  /** Current clarification request if any */
2824
2893
  clarification: ClarificationData | null;
2825
2894
  /** Send a message to the agent */
2826
- sendMessage: (content: string) => Promise<void>;
2895
+ sendMessage: (content: string, options?: SendMessageOptions) => Promise<void>;
2827
2896
  /** Respond to a clarification request */
2828
2897
  respondToClarification: (response: string) => Promise<void>;
2829
2898
  /** Cancel the current execution */
@@ -2930,6 +2999,122 @@ interface UseExecutionStreamResult {
2930
2999
  */
2931
3000
  declare function useExecutionStream(options: UseExecutionStreamOptions): UseExecutionStreamResult;
2932
3001
 
3002
+ /**
3003
+ * FileDropZone - Reusable file upload component with drag-and-drop
3004
+ *
3005
+ * Supports drag-and-drop file upload with visual feedback, file validation,
3006
+ * image compression, upload progress tracking, and thumbnail previews.
3007
+ *
3008
+ * Two modes:
3009
+ * - Standalone: renders a drop zone UI (default)
3010
+ * - Wrapper: wraps children with a drag-drop overlay (when children provided)
3011
+ *
3012
+ * @packageDocumentation
3013
+ */
3014
+
3015
+ interface FileDropZoneProps {
3016
+ files: AttachmentFile[];
3017
+ onFilesChange: (files: AttachmentFile[]) => void;
3018
+ /** Upload a file. Return the UUID and presigned URL. If uploadUrl is empty, the S3 PUT step is skipped. */
3019
+ onUpload: (file: File, metadata: {
3020
+ filename: string;
3021
+ mimeType: string;
3022
+ size: number;
3023
+ }) => Promise<{
3024
+ uuid: string;
3025
+ uploadUrl: string;
3026
+ }>;
3027
+ /** Confirm the upload after S3 PUT succeeds */
3028
+ onConfirmUpload?: (uuid: string) => Promise<void>;
3029
+ /** Error callback instead of toast */
3030
+ onError?: (message: string) => void;
3031
+ maxFiles?: number;
3032
+ maxTotalSizeMB?: number;
3033
+ disabled?: boolean;
3034
+ className?: string;
3035
+ /** Restrict accepted file types, e.g. "image/*" */
3036
+ accept?: string;
3037
+ /** Compact mode for embedding in small panels */
3038
+ compact?: boolean;
3039
+ children?: React__default.ReactNode;
3040
+ }
3041
+ /** Ref interface for programmatic access to FileDropZone */
3042
+ interface FileDropZoneRef {
3043
+ /** Trigger the file selection dialog */
3044
+ openFileDialog: () => void;
3045
+ }
3046
+ declare const FileDropZone: React__default.ForwardRefExoticComponent<FileDropZoneProps & React__default.RefAttributes<FileDropZoneRef>>;
3047
+
3048
+ interface UseFileAttachmentsOptions {
3049
+ /**
3050
+ * Upload handler called immediately when files are dropped/selected.
3051
+ * Return the UUID and a presigned upload URL.
3052
+ * If uploadUrl is empty, the S3 PUT step in FileDropZone is skipped
3053
+ * (useful for direct-upload patterns where the upload happens here).
3054
+ */
3055
+ onUpload: (file: File, metadata: {
3056
+ filename: string;
3057
+ mimeType: string;
3058
+ size: number;
3059
+ }) => Promise<{
3060
+ uuid: string;
3061
+ uploadUrl: string;
3062
+ }>;
3063
+ /** Optional confirm callback after S3 PUT succeeds */
3064
+ onConfirmUpload?: (uuid: string) => Promise<void>;
3065
+ /**
3066
+ * Deferred upload handler called during prepareForSubmit().
3067
+ * Use this for two-phase upload patterns where files are uploaded to local
3068
+ * storage on drop, but a second upload to an AI service happens on submit.
3069
+ *
3070
+ * Receives the file and localUuid (from onUpload) and should return
3071
+ * the AI service's attachment UUID.
3072
+ *
3073
+ * If not provided, prepareForSubmit() returns the UUIDs from onUpload as-is.
3074
+ */
3075
+ onSubmitUpload?: (file: File, localUuid: string, metadata: {
3076
+ filename: string;
3077
+ mimeType: string;
3078
+ size: number;
3079
+ }) => Promise<string>;
3080
+ /** Error handler */
3081
+ onError?: (message: string) => void;
3082
+ /** Maximum number of files (default: 10) */
3083
+ maxFiles?: number;
3084
+ /** Maximum total upload size in MB (default: 100) */
3085
+ maxTotalSizeMB?: number;
3086
+ }
3087
+ interface UseFileAttachmentsResult {
3088
+ /** Current attachment files */
3089
+ files: AttachmentFile[];
3090
+ /**
3091
+ * Props to spread onto FileDropZone.
3092
+ * Includes: files, onFilesChange, onUpload, onConfirmUpload, onError, maxFiles, maxTotalSizeMB
3093
+ */
3094
+ dropZoneProps: Pick<FileDropZoneProps, "files" | "onFilesChange" | "onUpload" | "onConfirmUpload" | "onError" | "maxFiles" | "maxTotalSizeMB">;
3095
+ /** Remove a file by UUID */
3096
+ removeFile: (uuid: string) => void;
3097
+ /** Get UUIDs of ready (uploaded) attachments — for Cadra adapter pattern */
3098
+ getReadyUuids: () => string[];
3099
+ /** Get UUIDs of ready attachments as URLs — for direct-upload pattern where uuid IS the url */
3100
+ getReadyUrls: () => string[];
3101
+ /**
3102
+ * Two-phase submit: uploads ready files to the AI service via onSubmitUpload,
3103
+ * returns the AI service attachment UUIDs. Call this on Generate/Remix.
3104
+ * If onSubmitUpload is not configured, returns getReadyUuids().
3105
+ */
3106
+ prepareForSubmit: () => Promise<string[]>;
3107
+ /** Clear all attachments (revokes preview URLs) */
3108
+ clear: () => void;
3109
+ /** Whether any files are currently uploading */
3110
+ isUploading: boolean;
3111
+ /** Whether there are files ready to send */
3112
+ hasReadyFiles: boolean;
3113
+ /** Total number of files */
3114
+ fileCount: number;
3115
+ }
3116
+ declare function useFileAttachments(options: UseFileAttachmentsOptions): UseFileAttachmentsResult;
3117
+
2933
3118
  interface ChatContainerProps {
2934
3119
  /** Child components (MessageList, ChatInput, etc.) */
2935
3120
  children: React$1.ReactNode;
@@ -2966,6 +3151,14 @@ interface ChatInputProps {
2966
3151
  isLoading?: boolean;
2967
3152
  /** Whether to enable attachments */
2968
3153
  enableAttachments?: boolean;
3154
+ /** Current attachment files (when enableAttachments is true) */
3155
+ attachments?: AttachmentFile[];
3156
+ /** Callback to remove an attachment */
3157
+ onRemoveAttachment?: (uuid: string) => void;
3158
+ /** Ref to FileDropZone for triggering file dialog */
3159
+ dropZoneRef?: React$1.RefObject<FileDropZoneRef | null>;
3160
+ /** Whether attachments are currently uploading */
3161
+ isUploadingAttachments?: boolean;
2969
3162
  /** Additional CSS classes */
2970
3163
  className?: string;
2971
3164
  }
@@ -2983,7 +3176,7 @@ interface ChatInputProps {
2983
3176
  * />
2984
3177
  * ```
2985
3178
  */
2986
- declare function ChatInput({ onSend, onStop, placeholder, disabled, isLoading, enableAttachments, className, }: ChatInputProps): react_jsx_runtime.JSX.Element;
3179
+ declare function ChatInput({ onSend, onStop, placeholder, disabled, isLoading, enableAttachments, attachments, onRemoveAttachment, dropZoneRef, isUploadingAttachments, className, }: ChatInputProps): react_jsx_runtime.JSX.Element;
2987
3180
 
2988
3181
  interface ToolCallEntryProps {
2989
3182
  /** Tool call data */
@@ -3115,4 +3308,25 @@ declare function HelpCircleIcon({ className, ...props }: IconProps): react_jsx_r
3115
3308
  declare function DatabaseIcon({ className, ...props }: IconProps): react_jsx_runtime.JSX.Element;
3116
3309
  declare function ClockIcon({ className, ...props }: IconProps): react_jsx_runtime.JSX.Element;
3117
3310
 
3118
- export { AgentChat, type AgentChatProps, AlertCircleIcon, type Artifact$1 as Artifact, AskUserPrompt, type AskUserPromptProps, type AttachmentData, type AttachmentFile, BotIcon, type ChatAdapter, ChatConfigProvider, type ChatConfigProviderProps, ChatContainer, type ChatContainerProps, type ChatError, ChatInput, type ChatInputProps, ChatMessage, type ChatMessageProps, type ChatMessage$1 as ChatMessageType, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, CircleIcon, type ClarificationData, ClockIcon, CodeIcon, CopyIcon, DatabaseIcon, type DefaultAdapterConfig, DownloadIcon, type Execution, type ExecutionResult, type ExecutionStreamEvent, ExternalLinkIcon, FileIcon, FileTextIcon, HelpCircleIcon, type HistoryMessage, type IconProps, ImageIcon, ImagesIcon, type ListSessionsInput, ListTodoIcon, LoadingSpinner, MarkdownContent, type MarkdownContentProps, Maximize2Icon, MessageCircleIcon, MessageList, type MessageListProps, Minimize2Icon, PaperclipIcon, SendIcon, type SendMessageInput$1 as SendMessageInput, type SessionHistory$1 as SessionHistory, type SessionList, type SessionListItem, SparklesIcon, type StartExecutionInput, StopCircleIcon, type ThemeMode, type ThinkingBlock, type TodoItem, TodoList, type TodoListProps, type ToolCall, ToolCallEntry, type ToolCallEntryProps, type UploadUrlInput, type UploadUrlResult, type UseAgentChatOptions, type UseAgentChatResult, type UseExecutionStreamOptions, type UseExecutionStreamResult, UserIcon, XIcon, ZoomInIcon, ZoomOutIcon, createDefaultAdapter, useAgentChat, useChatConfig, useChatConfigOptional, useExecutionStream };
3311
+ /**
3312
+ * Client-side image compression using Canvas API.
3313
+ *
3314
+ * Resizes images to max 1920px on longest side and iteratively
3315
+ * reduces JPEG/WebP quality to hit a ~150KB target size.
3316
+ * Skips SVGs, non-image files, and files already under the target.
3317
+ */
3318
+ /**
3319
+ * Compress an image file to approximately targetSizeKB using Canvas API.
3320
+ *
3321
+ * - Returns the original file if it's already under targetSizeKB
3322
+ * - Skips SVGs and non-image files (returns as-is)
3323
+ * - Resizes to max 1920px on longest side
3324
+ * - Iteratively reduces quality to approach target size
3325
+ *
3326
+ * @param file - The File to compress
3327
+ * @param targetSizeKB - Target output size in KB (default: 150)
3328
+ * @returns Compressed File, or the original if no compression needed
3329
+ */
3330
+ declare function compressImage(file: File, targetSizeKB?: number): Promise<File>;
3331
+
3332
+ export { AgentChat, type AgentChatProps, AlertCircleIcon, type Artifact$1 as Artifact, AskUserPrompt, type AskUserPromptProps, type AttachmentData, type AttachmentFile, BotIcon, type ChatAdapter, ChatConfigProvider, type ChatConfigProviderProps, ChatContainer, type ChatContainerProps, type ChatError, ChatInput, type ChatInputProps, ChatMessage, type ChatMessageProps, type ChatMessage$1 as ChatMessageType, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, CircleIcon, type ClarificationData, ClockIcon, CodeIcon, CopyIcon, DatabaseIcon, type DefaultAdapterConfig, DownloadIcon, type Execution, type ExecutionResult, type ExecutionStreamEvent, ExternalLinkIcon, FileDropZone, type FileDropZoneProps, type FileDropZoneRef, FileIcon, FileTextIcon, HelpCircleIcon, type HistoryMessage, type IconProps, ImageIcon, ImagesIcon, type ListSessionsInput, ListTodoIcon, LoadingSpinner, MarkdownContent, type MarkdownContentProps, Maximize2Icon, MessageCircleIcon, MessageList, type MessageListProps, Minimize2Icon, PaperclipIcon, SendIcon, type SendMessageInput$1 as SendMessageInput, type SendMessageOptions, type SessionHistory$1 as SessionHistory, type SessionList, type SessionListItem, SparklesIcon, type StartExecutionInput, StopCircleIcon, type ThemeMode, type ThinkingBlock, type TodoItem, TodoList, type TodoListProps, type ToolCall, ToolCallEntry, type ToolCallEntryProps, type UploadUrlInput, type UploadUrlResult, type UseAgentChatOptions, type UseAgentChatResult, type UseExecutionStreamOptions, type UseExecutionStreamResult, type UseFileAttachmentsOptions, type UseFileAttachmentsResult, UserIcon, XIcon, ZoomInIcon, ZoomOutIcon, compressImage, createDefaultAdapter, useAgentChat, useChatConfig, useChatConfigOptional, useExecutionStream, useFileAttachments };
@@ -1,6 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { Components } from 'react-markdown';
3
3
  import * as React$1 from 'react';
4
+ import React__default from 'react';
4
5
 
5
6
  interface MarkdownContentProps {
6
7
  /** Markdown content to render */
@@ -188,11 +189,19 @@ interface AttachmentFile {
188
189
  /** Original file object */
189
190
  file: File;
190
191
  /** Upload status */
191
- status: "pending" | "uploading" | "ready" | "failed";
192
+ status: "pending" | "uploading" | "processing" | "ready" | "error" | "failed";
192
193
  /** Preview URL for local display */
193
194
  previewUrl?: string;
194
195
  /** Progress percentage (0-100) */
195
- progress?: number;
196
+ progress: number;
197
+ /** File category */
198
+ category: "document" | "image" | "audio";
199
+ /** Error message when status is "error" */
200
+ error?: string;
201
+ /** Whether a thumbnail has been generated */
202
+ hasThumbnail?: boolean;
203
+ /** Override file.size for external attachments where actual File is empty */
204
+ actualSize?: number;
196
205
  }
197
206
 
198
207
  interface ChatMessageProps {
@@ -370,7 +379,11 @@ interface ExecuteInput {
370
379
  context?: Record<string, unknown>;
371
380
  /** Attachment UUIDs to include with the message (for images, documents, etc.) */
372
381
  attachmentIds?: string[];
373
- /** Team UUID for team-based execution (routes to team's lead orchestrator) */
382
+ /**
383
+ * Team UUID for team-based execution (routes to team's lead orchestrator).
384
+ * @deprecated Pass the team UUID directly as the agent/entity ID instead.
385
+ * The platform now auto-detects whether a UUID is an agent, team, or tool.
386
+ */
374
387
  teamUuid?: string;
375
388
  /** Execution options */
376
389
  options?: ExecuteOptions;
@@ -1167,7 +1180,7 @@ interface AgentChatProps {
1167
1180
  className?: string;
1168
1181
  /** Theme mode */
1169
1182
  theme?: ThemeMode;
1170
- /** Enable file attachments (future feature) */
1183
+ /** Enable file attachments */
1171
1184
  enableAttachments?: boolean;
1172
1185
  /** Enable markdown rendering */
1173
1186
  enableMarkdown?: boolean;
@@ -1195,6 +1208,7 @@ interface AgentChatProps {
1195
1208
  * <ChatConfigProvider config={{ baseUrl: '...', apiKey: '...' }}>
1196
1209
  * <AgentChat
1197
1210
  * agentId="agent-uuid"
1211
+ * enableAttachments
1198
1212
  * onMessage={(msg) => console.log('New message:', msg)}
1199
1213
  * />
1200
1214
  * </ChatConfigProvider>
@@ -1524,6 +1538,34 @@ interface ToolConfigUpdateInput {
1524
1538
  /** Enable/disable tool */
1525
1539
  isEnabled?: boolean;
1526
1540
  }
1541
+ /**
1542
+ * Request to execute a tool directly, bypassing the agent runtime.
1543
+ * The tool execution is enqueued for async processing via BullMQ.
1544
+ */
1545
+ interface ExecuteToolDirectRequest {
1546
+ /** Tool UUID */
1547
+ toolUuid: string;
1548
+ /** Which endpoint on the tool to call (defaults to first) */
1549
+ endpointId?: string;
1550
+ /** Tool parameters (prompt, referenceImageArtifactUuid, aspectRatio, etc.) */
1551
+ parameters: Record<string, unknown>;
1552
+ /** Optional execution ID (auto-generated if not provided) */
1553
+ executionId?: string;
1554
+ /** Optional callback URL for completion notification */
1555
+ callbackUrl?: string;
1556
+ }
1557
+ /**
1558
+ * Response from a direct tool execution request.
1559
+ * The tool is enqueued for async processing - use SSE or polling to get results.
1560
+ */
1561
+ interface ExecuteToolDirectResponse {
1562
+ /** Execution ID for tracking */
1563
+ executionId: string;
1564
+ /** BullMQ job ID */
1565
+ jobId: string;
1566
+ /** Execution status (always 'queued' on success) */
1567
+ status: 'queued';
1568
+ }
1527
1569
 
1528
1570
  /**
1529
1571
  * Artifact types
@@ -2150,6 +2192,26 @@ declare class ToolsAPI extends BaseResourceAPI {
2150
2192
  * ```
2151
2193
  */
2152
2194
  execute(uuid: string, input: Record<string, unknown>): Promise<ToolExecution>;
2195
+ /**
2196
+ * Execute a tool directly, bypassing the agent runtime.
2197
+ *
2198
+ * Enqueues the tool for async processing via BullMQ (no LLM, no ReAct loop).
2199
+ * Use SSE or polling with the returned executionId to get the result.
2200
+ *
2201
+ * @param request - Direct execution request
2202
+ * @returns Queued execution response with executionId for tracking
2203
+ *
2204
+ * @example
2205
+ * ```typescript
2206
+ * const result = await client.tools.executeDirect({
2207
+ * toolUuid: 'tool-uuid',
2208
+ * parameters: { prompt: 'Generate an image of a sunset' },
2209
+ * });
2210
+ * console.log(result.executionId); // Use for polling/SSE
2211
+ * console.log(result.status); // 'queued'
2212
+ * ```
2213
+ */
2214
+ executeDirect(request: ExecuteToolDirectRequest): Promise<ExecuteToolDirectResponse>;
2153
2215
  /**
2154
2216
  * Validate input against tool schema
2155
2217
  *
@@ -2807,6 +2869,13 @@ interface UseAgentChatOptions {
2807
2869
  /** Callback fired when clarification is needed */
2808
2870
  onClarification?: (data: ClarificationData) => void;
2809
2871
  }
2872
+ /**
2873
+ * Options for sendMessage
2874
+ */
2875
+ interface SendMessageOptions {
2876
+ /** UUIDs of attached files to include with the message */
2877
+ attachmentUuids?: string[];
2878
+ }
2810
2879
  interface UseAgentChatResult {
2811
2880
  /** Current messages in the chat */
2812
2881
  messages: ChatMessage$1[];
@@ -2823,7 +2892,7 @@ interface UseAgentChatResult {
2823
2892
  /** Current clarification request if any */
2824
2893
  clarification: ClarificationData | null;
2825
2894
  /** Send a message to the agent */
2826
- sendMessage: (content: string) => Promise<void>;
2895
+ sendMessage: (content: string, options?: SendMessageOptions) => Promise<void>;
2827
2896
  /** Respond to a clarification request */
2828
2897
  respondToClarification: (response: string) => Promise<void>;
2829
2898
  /** Cancel the current execution */
@@ -2930,6 +2999,122 @@ interface UseExecutionStreamResult {
2930
2999
  */
2931
3000
  declare function useExecutionStream(options: UseExecutionStreamOptions): UseExecutionStreamResult;
2932
3001
 
3002
+ /**
3003
+ * FileDropZone - Reusable file upload component with drag-and-drop
3004
+ *
3005
+ * Supports drag-and-drop file upload with visual feedback, file validation,
3006
+ * image compression, upload progress tracking, and thumbnail previews.
3007
+ *
3008
+ * Two modes:
3009
+ * - Standalone: renders a drop zone UI (default)
3010
+ * - Wrapper: wraps children with a drag-drop overlay (when children provided)
3011
+ *
3012
+ * @packageDocumentation
3013
+ */
3014
+
3015
+ interface FileDropZoneProps {
3016
+ files: AttachmentFile[];
3017
+ onFilesChange: (files: AttachmentFile[]) => void;
3018
+ /** Upload a file. Return the UUID and presigned URL. If uploadUrl is empty, the S3 PUT step is skipped. */
3019
+ onUpload: (file: File, metadata: {
3020
+ filename: string;
3021
+ mimeType: string;
3022
+ size: number;
3023
+ }) => Promise<{
3024
+ uuid: string;
3025
+ uploadUrl: string;
3026
+ }>;
3027
+ /** Confirm the upload after S3 PUT succeeds */
3028
+ onConfirmUpload?: (uuid: string) => Promise<void>;
3029
+ /** Error callback instead of toast */
3030
+ onError?: (message: string) => void;
3031
+ maxFiles?: number;
3032
+ maxTotalSizeMB?: number;
3033
+ disabled?: boolean;
3034
+ className?: string;
3035
+ /** Restrict accepted file types, e.g. "image/*" */
3036
+ accept?: string;
3037
+ /** Compact mode for embedding in small panels */
3038
+ compact?: boolean;
3039
+ children?: React__default.ReactNode;
3040
+ }
3041
+ /** Ref interface for programmatic access to FileDropZone */
3042
+ interface FileDropZoneRef {
3043
+ /** Trigger the file selection dialog */
3044
+ openFileDialog: () => void;
3045
+ }
3046
+ declare const FileDropZone: React__default.ForwardRefExoticComponent<FileDropZoneProps & React__default.RefAttributes<FileDropZoneRef>>;
3047
+
3048
+ interface UseFileAttachmentsOptions {
3049
+ /**
3050
+ * Upload handler called immediately when files are dropped/selected.
3051
+ * Return the UUID and a presigned upload URL.
3052
+ * If uploadUrl is empty, the S3 PUT step in FileDropZone is skipped
3053
+ * (useful for direct-upload patterns where the upload happens here).
3054
+ */
3055
+ onUpload: (file: File, metadata: {
3056
+ filename: string;
3057
+ mimeType: string;
3058
+ size: number;
3059
+ }) => Promise<{
3060
+ uuid: string;
3061
+ uploadUrl: string;
3062
+ }>;
3063
+ /** Optional confirm callback after S3 PUT succeeds */
3064
+ onConfirmUpload?: (uuid: string) => Promise<void>;
3065
+ /**
3066
+ * Deferred upload handler called during prepareForSubmit().
3067
+ * Use this for two-phase upload patterns where files are uploaded to local
3068
+ * storage on drop, but a second upload to an AI service happens on submit.
3069
+ *
3070
+ * Receives the file and localUuid (from onUpload) and should return
3071
+ * the AI service's attachment UUID.
3072
+ *
3073
+ * If not provided, prepareForSubmit() returns the UUIDs from onUpload as-is.
3074
+ */
3075
+ onSubmitUpload?: (file: File, localUuid: string, metadata: {
3076
+ filename: string;
3077
+ mimeType: string;
3078
+ size: number;
3079
+ }) => Promise<string>;
3080
+ /** Error handler */
3081
+ onError?: (message: string) => void;
3082
+ /** Maximum number of files (default: 10) */
3083
+ maxFiles?: number;
3084
+ /** Maximum total upload size in MB (default: 100) */
3085
+ maxTotalSizeMB?: number;
3086
+ }
3087
+ interface UseFileAttachmentsResult {
3088
+ /** Current attachment files */
3089
+ files: AttachmentFile[];
3090
+ /**
3091
+ * Props to spread onto FileDropZone.
3092
+ * Includes: files, onFilesChange, onUpload, onConfirmUpload, onError, maxFiles, maxTotalSizeMB
3093
+ */
3094
+ dropZoneProps: Pick<FileDropZoneProps, "files" | "onFilesChange" | "onUpload" | "onConfirmUpload" | "onError" | "maxFiles" | "maxTotalSizeMB">;
3095
+ /** Remove a file by UUID */
3096
+ removeFile: (uuid: string) => void;
3097
+ /** Get UUIDs of ready (uploaded) attachments — for Cadra adapter pattern */
3098
+ getReadyUuids: () => string[];
3099
+ /** Get UUIDs of ready attachments as URLs — for direct-upload pattern where uuid IS the url */
3100
+ getReadyUrls: () => string[];
3101
+ /**
3102
+ * Two-phase submit: uploads ready files to the AI service via onSubmitUpload,
3103
+ * returns the AI service attachment UUIDs. Call this on Generate/Remix.
3104
+ * If onSubmitUpload is not configured, returns getReadyUuids().
3105
+ */
3106
+ prepareForSubmit: () => Promise<string[]>;
3107
+ /** Clear all attachments (revokes preview URLs) */
3108
+ clear: () => void;
3109
+ /** Whether any files are currently uploading */
3110
+ isUploading: boolean;
3111
+ /** Whether there are files ready to send */
3112
+ hasReadyFiles: boolean;
3113
+ /** Total number of files */
3114
+ fileCount: number;
3115
+ }
3116
+ declare function useFileAttachments(options: UseFileAttachmentsOptions): UseFileAttachmentsResult;
3117
+
2933
3118
  interface ChatContainerProps {
2934
3119
  /** Child components (MessageList, ChatInput, etc.) */
2935
3120
  children: React$1.ReactNode;
@@ -2966,6 +3151,14 @@ interface ChatInputProps {
2966
3151
  isLoading?: boolean;
2967
3152
  /** Whether to enable attachments */
2968
3153
  enableAttachments?: boolean;
3154
+ /** Current attachment files (when enableAttachments is true) */
3155
+ attachments?: AttachmentFile[];
3156
+ /** Callback to remove an attachment */
3157
+ onRemoveAttachment?: (uuid: string) => void;
3158
+ /** Ref to FileDropZone for triggering file dialog */
3159
+ dropZoneRef?: React$1.RefObject<FileDropZoneRef | null>;
3160
+ /** Whether attachments are currently uploading */
3161
+ isUploadingAttachments?: boolean;
2969
3162
  /** Additional CSS classes */
2970
3163
  className?: string;
2971
3164
  }
@@ -2983,7 +3176,7 @@ interface ChatInputProps {
2983
3176
  * />
2984
3177
  * ```
2985
3178
  */
2986
- declare function ChatInput({ onSend, onStop, placeholder, disabled, isLoading, enableAttachments, className, }: ChatInputProps): react_jsx_runtime.JSX.Element;
3179
+ declare function ChatInput({ onSend, onStop, placeholder, disabled, isLoading, enableAttachments, attachments, onRemoveAttachment, dropZoneRef, isUploadingAttachments, className, }: ChatInputProps): react_jsx_runtime.JSX.Element;
2987
3180
 
2988
3181
  interface ToolCallEntryProps {
2989
3182
  /** Tool call data */
@@ -3115,4 +3308,25 @@ declare function HelpCircleIcon({ className, ...props }: IconProps): react_jsx_r
3115
3308
  declare function DatabaseIcon({ className, ...props }: IconProps): react_jsx_runtime.JSX.Element;
3116
3309
  declare function ClockIcon({ className, ...props }: IconProps): react_jsx_runtime.JSX.Element;
3117
3310
 
3118
- export { AgentChat, type AgentChatProps, AlertCircleIcon, type Artifact$1 as Artifact, AskUserPrompt, type AskUserPromptProps, type AttachmentData, type AttachmentFile, BotIcon, type ChatAdapter, ChatConfigProvider, type ChatConfigProviderProps, ChatContainer, type ChatContainerProps, type ChatError, ChatInput, type ChatInputProps, ChatMessage, type ChatMessageProps, type ChatMessage$1 as ChatMessageType, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, CircleIcon, type ClarificationData, ClockIcon, CodeIcon, CopyIcon, DatabaseIcon, type DefaultAdapterConfig, DownloadIcon, type Execution, type ExecutionResult, type ExecutionStreamEvent, ExternalLinkIcon, FileIcon, FileTextIcon, HelpCircleIcon, type HistoryMessage, type IconProps, ImageIcon, ImagesIcon, type ListSessionsInput, ListTodoIcon, LoadingSpinner, MarkdownContent, type MarkdownContentProps, Maximize2Icon, MessageCircleIcon, MessageList, type MessageListProps, Minimize2Icon, PaperclipIcon, SendIcon, type SendMessageInput$1 as SendMessageInput, type SessionHistory$1 as SessionHistory, type SessionList, type SessionListItem, SparklesIcon, type StartExecutionInput, StopCircleIcon, type ThemeMode, type ThinkingBlock, type TodoItem, TodoList, type TodoListProps, type ToolCall, ToolCallEntry, type ToolCallEntryProps, type UploadUrlInput, type UploadUrlResult, type UseAgentChatOptions, type UseAgentChatResult, type UseExecutionStreamOptions, type UseExecutionStreamResult, UserIcon, XIcon, ZoomInIcon, ZoomOutIcon, createDefaultAdapter, useAgentChat, useChatConfig, useChatConfigOptional, useExecutionStream };
3311
+ /**
3312
+ * Client-side image compression using Canvas API.
3313
+ *
3314
+ * Resizes images to max 1920px on longest side and iteratively
3315
+ * reduces JPEG/WebP quality to hit a ~150KB target size.
3316
+ * Skips SVGs, non-image files, and files already under the target.
3317
+ */
3318
+ /**
3319
+ * Compress an image file to approximately targetSizeKB using Canvas API.
3320
+ *
3321
+ * - Returns the original file if it's already under targetSizeKB
3322
+ * - Skips SVGs and non-image files (returns as-is)
3323
+ * - Resizes to max 1920px on longest side
3324
+ * - Iteratively reduces quality to approach target size
3325
+ *
3326
+ * @param file - The File to compress
3327
+ * @param targetSizeKB - Target output size in KB (default: 150)
3328
+ * @returns Compressed File, or the original if no compression needed
3329
+ */
3330
+ declare function compressImage(file: File, targetSizeKB?: number): Promise<File>;
3331
+
3332
+ export { AgentChat, type AgentChatProps, AlertCircleIcon, type Artifact$1 as Artifact, AskUserPrompt, type AskUserPromptProps, type AttachmentData, type AttachmentFile, BotIcon, type ChatAdapter, ChatConfigProvider, type ChatConfigProviderProps, ChatContainer, type ChatContainerProps, type ChatError, ChatInput, type ChatInputProps, ChatMessage, type ChatMessageProps, type ChatMessage$1 as ChatMessageType, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, CircleIcon, type ClarificationData, ClockIcon, CodeIcon, CopyIcon, DatabaseIcon, type DefaultAdapterConfig, DownloadIcon, type Execution, type ExecutionResult, type ExecutionStreamEvent, ExternalLinkIcon, FileDropZone, type FileDropZoneProps, type FileDropZoneRef, FileIcon, FileTextIcon, HelpCircleIcon, type HistoryMessage, type IconProps, ImageIcon, ImagesIcon, type ListSessionsInput, ListTodoIcon, LoadingSpinner, MarkdownContent, type MarkdownContentProps, Maximize2Icon, MessageCircleIcon, MessageList, type MessageListProps, Minimize2Icon, PaperclipIcon, SendIcon, type SendMessageInput$1 as SendMessageInput, type SendMessageOptions, type SessionHistory$1 as SessionHistory, type SessionList, type SessionListItem, SparklesIcon, type StartExecutionInput, StopCircleIcon, type ThemeMode, type ThinkingBlock, type TodoItem, TodoList, type TodoListProps, type ToolCall, ToolCallEntry, type ToolCallEntryProps, type UploadUrlInput, type UploadUrlResult, type UseAgentChatOptions, type UseAgentChatResult, type UseExecutionStreamOptions, type UseExecutionStreamResult, type UseFileAttachmentsOptions, type UseFileAttachmentsResult, UserIcon, XIcon, ZoomInIcon, ZoomOutIcon, compressImage, createDefaultAdapter, useAgentChat, useChatConfig, useChatConfigOptional, useExecutionStream, useFileAttachments };