@ash-cloud/ash-ui 0.0.1 → 0.0.3

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.
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { NormalizedToolCall, NormalizedEntry, ToolDisplayConfig, LogEntry, ToolDisplayMode, TodoItem, ToolStatus, ActionType } from './types.cjs';
3
3
  export { AssistantMessageEntry, CommandRunAction, CommandRunResult, DEFAULT_DISPLAY_CONFIG, ErrorEntry, FileAttachment, FileEditAction, FileReadAction, FileWriteAction, GenericToolAction, GlobAction, LogCategory, LogLevel, McpToolAction, NormalizedEntryType, SearchAction, ThinkingEntry, TodoStatus, TodoWriteAction, ToolCallEntry, ToolExecutionGroup as ToolExecutionGroupType, ToolResult, UserMessageEntry, WebFetchAction, WebSearchAction, isCommandRunAction, isErrorEntry, isFileEditAction, isFileReadAction, isFileWriteAction, isGenericToolAction, isGlobAction, isMcpToolAction, isSearchAction, isTodoWriteAction, isToolCallEntry, isWebFetchAction, isWebSearchAction } from './types.cjs';
4
- import { ReactNode } from 'react';
4
+ import { ReactNode, DragEvent, ChangeEvent } from 'react';
5
5
  import { ParsedOption } from './utils.cjs';
6
6
  export { GroupedEntry, ParsedOptionsResult, ToolUseInput, cn, createToolCall, extractTextContent, extractToolCallsFromGroup, formatFileSize, formatTimestamp, formatToolName, generateToolSummary, getActionIcon, getActionLabel, groupEntriesForCompactMode, mapToolToActionType, normalizeToolResult, parseCommandResult, parseMcpToolName, parseOptionsFromContent, truncate, updateToolCallWithResult } from './utils.cjs';
7
7
  export { AlertCircleIcon, AlertTriangleIcon, BotIcon, BrainIcon, BugIcon, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CircleIcon, ClipboardListIcon, CodeIcon, CopyIcon, EditIcon, FileIcon, FilePlusIcon, FolderSearchIcon, GlobeIcon, IconProps, InfoIcon, ListChecksIcon, LoaderIcon, MessageSquareIcon, MoonIcon, PaperclipIcon, PlugIcon, SearchIcon, SendIcon, SparklesIcon, StopCircleIcon, SunIcon, TerminalIcon, ToolIcon, UserIcon, XCircleIcon, XIcon } from './icons.cjs';
@@ -336,6 +336,83 @@ interface TodoPanelProps {
336
336
  */
337
337
  declare function TodoPanel({ todos, title, compact, showProgress, className, }: TodoPanelProps): react_jsx_runtime.JSX.Element | null;
338
338
 
339
+ interface EnvVarsPanelProps {
340
+ /** Current environment variables */
341
+ envVars: Record<string, string>;
342
+ /** Callback when environment variables change */
343
+ onChange: (envVars: Record<string, string>) => void;
344
+ /** Whether the panel is collapsed initially (default: true) */
345
+ defaultCollapsed?: boolean;
346
+ /** Additional class name */
347
+ className?: string;
348
+ /** Label for the panel header */
349
+ label?: string;
350
+ /** Helper text shown below the input */
351
+ helperText?: string;
352
+ }
353
+ /**
354
+ * EnvVarsPanel - Collapsible panel for managing environment variables
355
+ *
356
+ * Provides a UI for adding, viewing, and removing environment variables.
357
+ * Commonly used to set environment variables for sandbox/agent execution.
358
+ *
359
+ * @example
360
+ * ```tsx
361
+ * function ChatSettings() {
362
+ * const [envVars, setEnvVars] = useState<Record<string, string>>({});
363
+ *
364
+ * return (
365
+ * <EnvVarsPanel
366
+ * envVars={envVars}
367
+ * onChange={setEnvVars}
368
+ * helperText="These variables will be available in the sandbox."
369
+ * />
370
+ * );
371
+ * }
372
+ * ```
373
+ */
374
+ declare function EnvVarsPanel({ envVars, onChange, defaultCollapsed, className, label, helperText, }: EnvVarsPanelProps): react_jsx_runtime.JSX.Element;
375
+
376
+ interface DisplayModeToggleProps {
377
+ /** Additional class name */
378
+ className?: string;
379
+ /** Show label text (default: true) */
380
+ showLabel?: boolean;
381
+ /** Custom labels for modes */
382
+ labels?: {
383
+ inline?: string;
384
+ compact?: string;
385
+ };
386
+ }
387
+ /**
388
+ * DisplayModeToggle - Button to toggle between inline and compact display modes
389
+ *
390
+ * Uses the DisplayModeContext to toggle between 'inline' and 'compact' modes.
391
+ * Must be used within a DisplayModeProvider.
392
+ *
393
+ * @example
394
+ * ```tsx
395
+ * function ChatHeader() {
396
+ * return (
397
+ * <header>
398
+ * <h1>Chat</h1>
399
+ * <DisplayModeToggle />
400
+ * </header>
401
+ * );
402
+ * }
403
+ *
404
+ * function App() {
405
+ * return (
406
+ * <DisplayModeProvider>
407
+ * <ChatHeader />
408
+ * <MessageList entries={entries} />
409
+ * </DisplayModeProvider>
410
+ * );
411
+ * }
412
+ * ```
413
+ */
414
+ declare function DisplayModeToggle({ className, showLabel, labels, }: DisplayModeToggleProps): react_jsx_runtime.JSX.Element;
415
+
339
416
  interface StatusIndicatorProps {
340
417
  status: ToolStatus;
341
418
  size?: 'sm' | 'md' | 'lg';
@@ -532,4 +609,235 @@ interface ThemeProviderProps {
532
609
  declare function ThemeProvider({ children, defaultTheme, storageKey, listenToSystemChanges, }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
533
610
  declare function useTheme(): ThemeContextType;
534
611
 
535
- export { ActionIcon, type ActionIconProps, ActionType, AssistantMessage, type AssistantMessageProps, CodeBlock, type CodeBlockProps, CompactToolStatusLine, type CompactToolStatusLineProps, type DisplayModeContextType, DisplayModeProvider, type DisplayModeProviderProps, ErrorMessage, type ErrorMessageProps, JsonDisplay, type JsonDisplayProps, LoadingIndicator, type LoadingIndicatorProps, LogEntry, LogsPanel, type LogsPanelProps, MessageEntry, type MessageEntryProps, MessageList, type MessageListProps, NormalizedEntry, NormalizedToolCall, OptionCards, type OptionCardsProps, ParsedOption, StatusIndicator, type StatusIndicatorProps, StreamingText, type StreamingTextProps, type Theme, type ThemeContextType, ThemeProvider, type ThemeProviderProps, ThinkingMessage, type ThinkingMessageProps, TodoItem, TodoPanel, type TodoPanelProps, ToolCallCard, type ToolCallCardProps, ToolCallMessage, type ToolCallMessageProps, ToolDisplayConfig, ToolDisplayMode, ToolExecutionGroup, type ToolExecutionGroupProps, ToolStatus, TypewriterText, type TypewriterTextProps, UserMessage, type UserMessageProps, useDisplayConfig, useDisplayMode, useTheme };
612
+ /**
613
+ * A queued message waiting to be sent
614
+ */
615
+ interface QueuedMessage {
616
+ /** Unique ID for this queued message */
617
+ id: string;
618
+ /** The message text */
619
+ text: string;
620
+ /** Optional file attachments */
621
+ files?: FileAttachment$1[];
622
+ /** Timestamp when queued */
623
+ queuedAt: number;
624
+ }
625
+ /**
626
+ * File attachment for upload
627
+ */
628
+ interface FileAttachment$1 {
629
+ /** Original filename */
630
+ filename: string;
631
+ /** Base64-encoded file content */
632
+ content: string;
633
+ /** MIME type of the file */
634
+ mimeType: string;
635
+ /** File size in bytes */
636
+ size: number;
637
+ }
638
+ interface UseMessageQueueOptions {
639
+ /** Callback to process a message - should return when processing is complete */
640
+ onProcessMessage: (message: QueuedMessage) => Promise<void>;
641
+ /** Whether messages can currently be processed (e.g., agent selected) */
642
+ canProcess?: boolean;
643
+ }
644
+ interface UseMessageQueueReturn {
645
+ /** Current queue of pending messages */
646
+ queue: QueuedMessage[];
647
+ /** Whether a message is currently being processed */
648
+ isProcessing: boolean;
649
+ /** Add a message to the queue (or process immediately if idle) */
650
+ enqueue: (text: string, files?: FileAttachment$1[]) => void;
651
+ /** Cancel a queued message by ID */
652
+ cancel: (id: string) => void;
653
+ /** Clear all queued messages */
654
+ clearQueue: () => void;
655
+ /** Number of messages in queue */
656
+ queueLength: number;
657
+ }
658
+ /**
659
+ * Hook for managing a message queue with sequential processing.
660
+ *
661
+ * Messages are queued when the agent is busy and processed sequentially.
662
+ * Users can continue typing while the agent processes previous messages.
663
+ *
664
+ * @example
665
+ * ```tsx
666
+ * function ChatInput() {
667
+ * const { queue, isProcessing, enqueue, cancel } = useMessageQueue({
668
+ * onProcessMessage: async (msg) => {
669
+ * for await (const event of client.agents.run(agentId, msg.text)) {
670
+ * // handle events
671
+ * }
672
+ * }
673
+ * });
674
+ *
675
+ * return (
676
+ * <div>
677
+ * {queue.map(msg => (
678
+ * <div key={msg.id}>
679
+ * Queued: {msg.text}
680
+ * <button onClick={() => cancel(msg.id)}>Cancel</button>
681
+ * </div>
682
+ * ))}
683
+ * <input onSubmit={(text) => enqueue(text)} />
684
+ * <button>{isProcessing ? `Queue (${queue.length})` : 'Send'}</button>
685
+ * </div>
686
+ * );
687
+ * }
688
+ * ```
689
+ */
690
+ declare function useMessageQueue({ onProcessMessage, canProcess, }: UseMessageQueueOptions): UseMessageQueueReturn;
691
+
692
+ interface UseStopExecutionOptions {
693
+ /** Callback to stop server-side execution (e.g., client.sessions.stop) */
694
+ onServerStop?: (sessionId: string) => Promise<void>;
695
+ }
696
+ interface UseStopExecutionReturn {
697
+ /** Whether execution can currently be stopped */
698
+ canStop: boolean;
699
+ /** The AbortSignal to pass to fetch requests */
700
+ signal: AbortSignal | undefined;
701
+ /** Start tracking a new execution (call when starting a request) */
702
+ startExecution: () => void;
703
+ /** Mark execution as complete (call when request finishes) */
704
+ endExecution: () => void;
705
+ /** Stop the current execution (aborts client + optionally server) */
706
+ stop: (sessionId?: string) => Promise<void>;
707
+ /** Set the current session ID for server-side stop */
708
+ setSessionId: (sessionId: string | null) => void;
709
+ }
710
+ /**
711
+ * Hook for managing execution stopping with AbortController.
712
+ *
713
+ * Handles both client-side request abortion and optional server-side stop calls.
714
+ * Use this to implement stop/cancel buttons for long-running agent executions.
715
+ *
716
+ * @example
717
+ * ```tsx
718
+ * function Chat() {
719
+ * const { canStop, signal, startExecution, endExecution, stop, setSessionId } = useStopExecution({
720
+ * onServerStop: (sessionId) => client.sessions.stop(sessionId)
721
+ * });
722
+ *
723
+ * async function sendMessage(text: string) {
724
+ * startExecution();
725
+ * try {
726
+ * for await (const event of client.agents.run(agentId, text, { signal })) {
727
+ * if (event.type === 'session_start') {
728
+ * setSessionId(event.sessionId);
729
+ * }
730
+ * // handle events...
731
+ * }
732
+ * } catch (err) {
733
+ * if (err.name === 'AbortError') {
734
+ * console.log('Request aborted');
735
+ * }
736
+ * } finally {
737
+ * endExecution();
738
+ * }
739
+ * }
740
+ *
741
+ * return (
742
+ * <div>
743
+ * {canStop && <button onClick={() => stop()}>Stop</button>}
744
+ * </div>
745
+ * );
746
+ * }
747
+ * ```
748
+ */
749
+ declare function useStopExecution({ onServerStop, }?: UseStopExecutionOptions): UseStopExecutionReturn;
750
+
751
+ /**
752
+ * File attachment ready for upload
753
+ */
754
+ interface FileAttachment {
755
+ /** Original filename */
756
+ filename: string;
757
+ /** Base64-encoded file content (without data URL prefix) */
758
+ content: string;
759
+ /** MIME type of the file */
760
+ mimeType: string;
761
+ /** File size in bytes */
762
+ size: number;
763
+ }
764
+ interface UseFileUploadOptions {
765
+ /** Maximum file size in bytes (default: 100MB) */
766
+ maxFileSize?: number;
767
+ /** Maximum number of files (default: 10) */
768
+ maxFiles?: number;
769
+ /** Callback when file validation fails */
770
+ onValidationError?: (filename: string, error: string) => void;
771
+ }
772
+ interface UseFileUploadReturn {
773
+ /** Current list of attached files */
774
+ files: FileAttachment[];
775
+ /** Whether drag is currently over the drop zone */
776
+ isDragOver: boolean;
777
+ /** Add files from a FileList (e.g., from input or drop) */
778
+ addFiles: (fileList: FileList | null) => Promise<void>;
779
+ /** Remove a file by index */
780
+ removeFile: (index: number) => void;
781
+ /** Clear all files */
782
+ clearFiles: () => void;
783
+ /** Whether more files can be added */
784
+ canAddMore: boolean;
785
+ /** Props to spread on a drop zone element */
786
+ dropZoneProps: {
787
+ onDragOver: (e: DragEvent) => void;
788
+ onDragLeave: (e: DragEvent) => void;
789
+ onDrop: (e: DragEvent) => void;
790
+ };
791
+ /** Handler for file input onChange */
792
+ handleFileInputChange: (e: ChangeEvent<HTMLInputElement>) => void;
793
+ /** Ref for a hidden file input */
794
+ fileInputRef: React.RefObject<HTMLInputElement | null>;
795
+ /** Click handler to trigger file input */
796
+ openFilePicker: () => void;
797
+ }
798
+ /**
799
+ * Hook for managing file uploads with drag & drop support.
800
+ *
801
+ * Handles file selection, validation, base64 encoding, and drag/drop UI state.
802
+ *
803
+ * @example
804
+ * ```tsx
805
+ * function FileUploadArea() {
806
+ * const {
807
+ * files,
808
+ * isDragOver,
809
+ * addFiles,
810
+ * removeFile,
811
+ * dropZoneProps,
812
+ * fileInputRef,
813
+ * openFilePicker,
814
+ * canAddMore,
815
+ * } = useFileUpload({
816
+ * maxFileSize: 50 * 1024 * 1024, // 50MB
817
+ * maxFiles: 5,
818
+ * onValidationError: (filename, error) => {
819
+ * toast.error(`${filename}: ${error}`);
820
+ * }
821
+ * });
822
+ *
823
+ * return (
824
+ * <div {...dropZoneProps} className={isDragOver ? 'drag-over' : ''}>
825
+ * <input ref={fileInputRef} type="file" multiple hidden />
826
+ * <button onClick={openFilePicker} disabled={!canAddMore}>
827
+ * Add Files
828
+ * </button>
829
+ * {files.map((file, i) => (
830
+ * <div key={i}>
831
+ * {file.filename} ({formatFileSize(file.size)})
832
+ * <button onClick={() => removeFile(i)}>Remove</button>
833
+ * </div>
834
+ * ))}
835
+ * </div>
836
+ * );
837
+ * }
838
+ * ```
839
+ */
840
+ declare function useFileUpload({ maxFileSize, // 100MB
841
+ maxFiles, onValidationError, }?: UseFileUploadOptions): UseFileUploadReturn;
842
+
843
+ export { ActionIcon, type ActionIconProps, ActionType, AssistantMessage, type AssistantMessageProps, type FileAttachment as ChatFileAttachment, CodeBlock, type CodeBlockProps, CompactToolStatusLine, type CompactToolStatusLineProps, type DisplayModeContextType, DisplayModeProvider, type DisplayModeProviderProps, DisplayModeToggle, type DisplayModeToggleProps, EnvVarsPanel, type EnvVarsPanelProps, ErrorMessage, type ErrorMessageProps, JsonDisplay, type JsonDisplayProps, LoadingIndicator, type LoadingIndicatorProps, LogEntry, LogsPanel, type LogsPanelProps, MessageEntry, type MessageEntryProps, MessageList, type MessageListProps, NormalizedEntry, NormalizedToolCall, OptionCards, type OptionCardsProps, ParsedOption, type QueuedMessage, StatusIndicator, type StatusIndicatorProps, StreamingText, type StreamingTextProps, type Theme, type ThemeContextType, ThemeProvider, type ThemeProviderProps, ThinkingMessage, type ThinkingMessageProps, TodoItem, TodoPanel, type TodoPanelProps, ToolCallCard, type ToolCallCardProps, ToolCallMessage, type ToolCallMessageProps, ToolDisplayConfig, ToolDisplayMode, ToolExecutionGroup, type ToolExecutionGroupProps, ToolStatus, TypewriterText, type TypewriterTextProps, type UseFileUploadOptions, type UseFileUploadReturn, type UseMessageQueueOptions, type UseMessageQueueReturn, type UseStopExecutionOptions, type UseStopExecutionReturn, UserMessage, type UserMessageProps, useDisplayConfig, useDisplayMode, useFileUpload, useMessageQueue, useStopExecution, useTheme };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { NormalizedToolCall, NormalizedEntry, ToolDisplayConfig, LogEntry, ToolDisplayMode, TodoItem, ToolStatus, ActionType } from './types.js';
3
3
  export { AssistantMessageEntry, CommandRunAction, CommandRunResult, DEFAULT_DISPLAY_CONFIG, ErrorEntry, FileAttachment, FileEditAction, FileReadAction, FileWriteAction, GenericToolAction, GlobAction, LogCategory, LogLevel, McpToolAction, NormalizedEntryType, SearchAction, ThinkingEntry, TodoStatus, TodoWriteAction, ToolCallEntry, ToolExecutionGroup as ToolExecutionGroupType, ToolResult, UserMessageEntry, WebFetchAction, WebSearchAction, isCommandRunAction, isErrorEntry, isFileEditAction, isFileReadAction, isFileWriteAction, isGenericToolAction, isGlobAction, isMcpToolAction, isSearchAction, isTodoWriteAction, isToolCallEntry, isWebFetchAction, isWebSearchAction } from './types.js';
4
- import { ReactNode } from 'react';
4
+ import { ReactNode, DragEvent, ChangeEvent } from 'react';
5
5
  import { ParsedOption } from './utils.js';
6
6
  export { GroupedEntry, ParsedOptionsResult, ToolUseInput, cn, createToolCall, extractTextContent, extractToolCallsFromGroup, formatFileSize, formatTimestamp, formatToolName, generateToolSummary, getActionIcon, getActionLabel, groupEntriesForCompactMode, mapToolToActionType, normalizeToolResult, parseCommandResult, parseMcpToolName, parseOptionsFromContent, truncate, updateToolCallWithResult } from './utils.js';
7
7
  export { AlertCircleIcon, AlertTriangleIcon, BotIcon, BrainIcon, BugIcon, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CircleIcon, ClipboardListIcon, CodeIcon, CopyIcon, EditIcon, FileIcon, FilePlusIcon, FolderSearchIcon, GlobeIcon, IconProps, InfoIcon, ListChecksIcon, LoaderIcon, MessageSquareIcon, MoonIcon, PaperclipIcon, PlugIcon, SearchIcon, SendIcon, SparklesIcon, StopCircleIcon, SunIcon, TerminalIcon, ToolIcon, UserIcon, XCircleIcon, XIcon } from './icons.js';
@@ -336,6 +336,83 @@ interface TodoPanelProps {
336
336
  */
337
337
  declare function TodoPanel({ todos, title, compact, showProgress, className, }: TodoPanelProps): react_jsx_runtime.JSX.Element | null;
338
338
 
339
+ interface EnvVarsPanelProps {
340
+ /** Current environment variables */
341
+ envVars: Record<string, string>;
342
+ /** Callback when environment variables change */
343
+ onChange: (envVars: Record<string, string>) => void;
344
+ /** Whether the panel is collapsed initially (default: true) */
345
+ defaultCollapsed?: boolean;
346
+ /** Additional class name */
347
+ className?: string;
348
+ /** Label for the panel header */
349
+ label?: string;
350
+ /** Helper text shown below the input */
351
+ helperText?: string;
352
+ }
353
+ /**
354
+ * EnvVarsPanel - Collapsible panel for managing environment variables
355
+ *
356
+ * Provides a UI for adding, viewing, and removing environment variables.
357
+ * Commonly used to set environment variables for sandbox/agent execution.
358
+ *
359
+ * @example
360
+ * ```tsx
361
+ * function ChatSettings() {
362
+ * const [envVars, setEnvVars] = useState<Record<string, string>>({});
363
+ *
364
+ * return (
365
+ * <EnvVarsPanel
366
+ * envVars={envVars}
367
+ * onChange={setEnvVars}
368
+ * helperText="These variables will be available in the sandbox."
369
+ * />
370
+ * );
371
+ * }
372
+ * ```
373
+ */
374
+ declare function EnvVarsPanel({ envVars, onChange, defaultCollapsed, className, label, helperText, }: EnvVarsPanelProps): react_jsx_runtime.JSX.Element;
375
+
376
+ interface DisplayModeToggleProps {
377
+ /** Additional class name */
378
+ className?: string;
379
+ /** Show label text (default: true) */
380
+ showLabel?: boolean;
381
+ /** Custom labels for modes */
382
+ labels?: {
383
+ inline?: string;
384
+ compact?: string;
385
+ };
386
+ }
387
+ /**
388
+ * DisplayModeToggle - Button to toggle between inline and compact display modes
389
+ *
390
+ * Uses the DisplayModeContext to toggle between 'inline' and 'compact' modes.
391
+ * Must be used within a DisplayModeProvider.
392
+ *
393
+ * @example
394
+ * ```tsx
395
+ * function ChatHeader() {
396
+ * return (
397
+ * <header>
398
+ * <h1>Chat</h1>
399
+ * <DisplayModeToggle />
400
+ * </header>
401
+ * );
402
+ * }
403
+ *
404
+ * function App() {
405
+ * return (
406
+ * <DisplayModeProvider>
407
+ * <ChatHeader />
408
+ * <MessageList entries={entries} />
409
+ * </DisplayModeProvider>
410
+ * );
411
+ * }
412
+ * ```
413
+ */
414
+ declare function DisplayModeToggle({ className, showLabel, labels, }: DisplayModeToggleProps): react_jsx_runtime.JSX.Element;
415
+
339
416
  interface StatusIndicatorProps {
340
417
  status: ToolStatus;
341
418
  size?: 'sm' | 'md' | 'lg';
@@ -532,4 +609,235 @@ interface ThemeProviderProps {
532
609
  declare function ThemeProvider({ children, defaultTheme, storageKey, listenToSystemChanges, }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
533
610
  declare function useTheme(): ThemeContextType;
534
611
 
535
- export { ActionIcon, type ActionIconProps, ActionType, AssistantMessage, type AssistantMessageProps, CodeBlock, type CodeBlockProps, CompactToolStatusLine, type CompactToolStatusLineProps, type DisplayModeContextType, DisplayModeProvider, type DisplayModeProviderProps, ErrorMessage, type ErrorMessageProps, JsonDisplay, type JsonDisplayProps, LoadingIndicator, type LoadingIndicatorProps, LogEntry, LogsPanel, type LogsPanelProps, MessageEntry, type MessageEntryProps, MessageList, type MessageListProps, NormalizedEntry, NormalizedToolCall, OptionCards, type OptionCardsProps, ParsedOption, StatusIndicator, type StatusIndicatorProps, StreamingText, type StreamingTextProps, type Theme, type ThemeContextType, ThemeProvider, type ThemeProviderProps, ThinkingMessage, type ThinkingMessageProps, TodoItem, TodoPanel, type TodoPanelProps, ToolCallCard, type ToolCallCardProps, ToolCallMessage, type ToolCallMessageProps, ToolDisplayConfig, ToolDisplayMode, ToolExecutionGroup, type ToolExecutionGroupProps, ToolStatus, TypewriterText, type TypewriterTextProps, UserMessage, type UserMessageProps, useDisplayConfig, useDisplayMode, useTheme };
612
+ /**
613
+ * A queued message waiting to be sent
614
+ */
615
+ interface QueuedMessage {
616
+ /** Unique ID for this queued message */
617
+ id: string;
618
+ /** The message text */
619
+ text: string;
620
+ /** Optional file attachments */
621
+ files?: FileAttachment$1[];
622
+ /** Timestamp when queued */
623
+ queuedAt: number;
624
+ }
625
+ /**
626
+ * File attachment for upload
627
+ */
628
+ interface FileAttachment$1 {
629
+ /** Original filename */
630
+ filename: string;
631
+ /** Base64-encoded file content */
632
+ content: string;
633
+ /** MIME type of the file */
634
+ mimeType: string;
635
+ /** File size in bytes */
636
+ size: number;
637
+ }
638
+ interface UseMessageQueueOptions {
639
+ /** Callback to process a message - should return when processing is complete */
640
+ onProcessMessage: (message: QueuedMessage) => Promise<void>;
641
+ /** Whether messages can currently be processed (e.g., agent selected) */
642
+ canProcess?: boolean;
643
+ }
644
+ interface UseMessageQueueReturn {
645
+ /** Current queue of pending messages */
646
+ queue: QueuedMessage[];
647
+ /** Whether a message is currently being processed */
648
+ isProcessing: boolean;
649
+ /** Add a message to the queue (or process immediately if idle) */
650
+ enqueue: (text: string, files?: FileAttachment$1[]) => void;
651
+ /** Cancel a queued message by ID */
652
+ cancel: (id: string) => void;
653
+ /** Clear all queued messages */
654
+ clearQueue: () => void;
655
+ /** Number of messages in queue */
656
+ queueLength: number;
657
+ }
658
+ /**
659
+ * Hook for managing a message queue with sequential processing.
660
+ *
661
+ * Messages are queued when the agent is busy and processed sequentially.
662
+ * Users can continue typing while the agent processes previous messages.
663
+ *
664
+ * @example
665
+ * ```tsx
666
+ * function ChatInput() {
667
+ * const { queue, isProcessing, enqueue, cancel } = useMessageQueue({
668
+ * onProcessMessage: async (msg) => {
669
+ * for await (const event of client.agents.run(agentId, msg.text)) {
670
+ * // handle events
671
+ * }
672
+ * }
673
+ * });
674
+ *
675
+ * return (
676
+ * <div>
677
+ * {queue.map(msg => (
678
+ * <div key={msg.id}>
679
+ * Queued: {msg.text}
680
+ * <button onClick={() => cancel(msg.id)}>Cancel</button>
681
+ * </div>
682
+ * ))}
683
+ * <input onSubmit={(text) => enqueue(text)} />
684
+ * <button>{isProcessing ? `Queue (${queue.length})` : 'Send'}</button>
685
+ * </div>
686
+ * );
687
+ * }
688
+ * ```
689
+ */
690
+ declare function useMessageQueue({ onProcessMessage, canProcess, }: UseMessageQueueOptions): UseMessageQueueReturn;
691
+
692
+ interface UseStopExecutionOptions {
693
+ /** Callback to stop server-side execution (e.g., client.sessions.stop) */
694
+ onServerStop?: (sessionId: string) => Promise<void>;
695
+ }
696
+ interface UseStopExecutionReturn {
697
+ /** Whether execution can currently be stopped */
698
+ canStop: boolean;
699
+ /** The AbortSignal to pass to fetch requests */
700
+ signal: AbortSignal | undefined;
701
+ /** Start tracking a new execution (call when starting a request) */
702
+ startExecution: () => void;
703
+ /** Mark execution as complete (call when request finishes) */
704
+ endExecution: () => void;
705
+ /** Stop the current execution (aborts client + optionally server) */
706
+ stop: (sessionId?: string) => Promise<void>;
707
+ /** Set the current session ID for server-side stop */
708
+ setSessionId: (sessionId: string | null) => void;
709
+ }
710
+ /**
711
+ * Hook for managing execution stopping with AbortController.
712
+ *
713
+ * Handles both client-side request abortion and optional server-side stop calls.
714
+ * Use this to implement stop/cancel buttons for long-running agent executions.
715
+ *
716
+ * @example
717
+ * ```tsx
718
+ * function Chat() {
719
+ * const { canStop, signal, startExecution, endExecution, stop, setSessionId } = useStopExecution({
720
+ * onServerStop: (sessionId) => client.sessions.stop(sessionId)
721
+ * });
722
+ *
723
+ * async function sendMessage(text: string) {
724
+ * startExecution();
725
+ * try {
726
+ * for await (const event of client.agents.run(agentId, text, { signal })) {
727
+ * if (event.type === 'session_start') {
728
+ * setSessionId(event.sessionId);
729
+ * }
730
+ * // handle events...
731
+ * }
732
+ * } catch (err) {
733
+ * if (err.name === 'AbortError') {
734
+ * console.log('Request aborted');
735
+ * }
736
+ * } finally {
737
+ * endExecution();
738
+ * }
739
+ * }
740
+ *
741
+ * return (
742
+ * <div>
743
+ * {canStop && <button onClick={() => stop()}>Stop</button>}
744
+ * </div>
745
+ * );
746
+ * }
747
+ * ```
748
+ */
749
+ declare function useStopExecution({ onServerStop, }?: UseStopExecutionOptions): UseStopExecutionReturn;
750
+
751
+ /**
752
+ * File attachment ready for upload
753
+ */
754
+ interface FileAttachment {
755
+ /** Original filename */
756
+ filename: string;
757
+ /** Base64-encoded file content (without data URL prefix) */
758
+ content: string;
759
+ /** MIME type of the file */
760
+ mimeType: string;
761
+ /** File size in bytes */
762
+ size: number;
763
+ }
764
+ interface UseFileUploadOptions {
765
+ /** Maximum file size in bytes (default: 100MB) */
766
+ maxFileSize?: number;
767
+ /** Maximum number of files (default: 10) */
768
+ maxFiles?: number;
769
+ /** Callback when file validation fails */
770
+ onValidationError?: (filename: string, error: string) => void;
771
+ }
772
+ interface UseFileUploadReturn {
773
+ /** Current list of attached files */
774
+ files: FileAttachment[];
775
+ /** Whether drag is currently over the drop zone */
776
+ isDragOver: boolean;
777
+ /** Add files from a FileList (e.g., from input or drop) */
778
+ addFiles: (fileList: FileList | null) => Promise<void>;
779
+ /** Remove a file by index */
780
+ removeFile: (index: number) => void;
781
+ /** Clear all files */
782
+ clearFiles: () => void;
783
+ /** Whether more files can be added */
784
+ canAddMore: boolean;
785
+ /** Props to spread on a drop zone element */
786
+ dropZoneProps: {
787
+ onDragOver: (e: DragEvent) => void;
788
+ onDragLeave: (e: DragEvent) => void;
789
+ onDrop: (e: DragEvent) => void;
790
+ };
791
+ /** Handler for file input onChange */
792
+ handleFileInputChange: (e: ChangeEvent<HTMLInputElement>) => void;
793
+ /** Ref for a hidden file input */
794
+ fileInputRef: React.RefObject<HTMLInputElement | null>;
795
+ /** Click handler to trigger file input */
796
+ openFilePicker: () => void;
797
+ }
798
+ /**
799
+ * Hook for managing file uploads with drag & drop support.
800
+ *
801
+ * Handles file selection, validation, base64 encoding, and drag/drop UI state.
802
+ *
803
+ * @example
804
+ * ```tsx
805
+ * function FileUploadArea() {
806
+ * const {
807
+ * files,
808
+ * isDragOver,
809
+ * addFiles,
810
+ * removeFile,
811
+ * dropZoneProps,
812
+ * fileInputRef,
813
+ * openFilePicker,
814
+ * canAddMore,
815
+ * } = useFileUpload({
816
+ * maxFileSize: 50 * 1024 * 1024, // 50MB
817
+ * maxFiles: 5,
818
+ * onValidationError: (filename, error) => {
819
+ * toast.error(`${filename}: ${error}`);
820
+ * }
821
+ * });
822
+ *
823
+ * return (
824
+ * <div {...dropZoneProps} className={isDragOver ? 'drag-over' : ''}>
825
+ * <input ref={fileInputRef} type="file" multiple hidden />
826
+ * <button onClick={openFilePicker} disabled={!canAddMore}>
827
+ * Add Files
828
+ * </button>
829
+ * {files.map((file, i) => (
830
+ * <div key={i}>
831
+ * {file.filename} ({formatFileSize(file.size)})
832
+ * <button onClick={() => removeFile(i)}>Remove</button>
833
+ * </div>
834
+ * ))}
835
+ * </div>
836
+ * );
837
+ * }
838
+ * ```
839
+ */
840
+ declare function useFileUpload({ maxFileSize, // 100MB
841
+ maxFiles, onValidationError, }?: UseFileUploadOptions): UseFileUploadReturn;
842
+
843
+ export { ActionIcon, type ActionIconProps, ActionType, AssistantMessage, type AssistantMessageProps, type FileAttachment as ChatFileAttachment, CodeBlock, type CodeBlockProps, CompactToolStatusLine, type CompactToolStatusLineProps, type DisplayModeContextType, DisplayModeProvider, type DisplayModeProviderProps, DisplayModeToggle, type DisplayModeToggleProps, EnvVarsPanel, type EnvVarsPanelProps, ErrorMessage, type ErrorMessageProps, JsonDisplay, type JsonDisplayProps, LoadingIndicator, type LoadingIndicatorProps, LogEntry, LogsPanel, type LogsPanelProps, MessageEntry, type MessageEntryProps, MessageList, type MessageListProps, NormalizedEntry, NormalizedToolCall, OptionCards, type OptionCardsProps, ParsedOption, type QueuedMessage, StatusIndicator, type StatusIndicatorProps, StreamingText, type StreamingTextProps, type Theme, type ThemeContextType, ThemeProvider, type ThemeProviderProps, ThinkingMessage, type ThinkingMessageProps, TodoItem, TodoPanel, type TodoPanelProps, ToolCallCard, type ToolCallCardProps, ToolCallMessage, type ToolCallMessageProps, ToolDisplayConfig, ToolDisplayMode, ToolExecutionGroup, type ToolExecutionGroupProps, ToolStatus, TypewriterText, type TypewriterTextProps, type UseFileUploadOptions, type UseFileUploadReturn, type UseMessageQueueOptions, type UseMessageQueueReturn, type UseStopExecutionOptions, type UseStopExecutionReturn, UserMessage, type UserMessageProps, useDisplayConfig, useDisplayMode, useFileUpload, useMessageQueue, useStopExecution, useTheme };