@yourgpt/copilot-sdk 2.1.5-alpha.5 → 2.1.5-alpha.6
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/{chunk-LHLVTGIP.cjs → chunk-2QLF7XM7.cjs} +297 -96
- package/dist/chunk-2QLF7XM7.cjs.map +1 -0
- package/dist/{chunk-DH6EO6NW.js → chunk-I2XOCFHG.js} +293 -92
- package/dist/chunk-I2XOCFHG.js.map +1 -0
- package/dist/{chunk-YLZCTR4O.js → chunk-PSNLKMZH.js} +12 -3
- package/dist/chunk-PSNLKMZH.js.map +1 -0
- package/dist/{chunk-ZAOTYA5L.js → chunk-PURFAD2P.js} +48 -11
- package/dist/chunk-PURFAD2P.js.map +1 -0
- package/dist/{chunk-5UGWLGFS.cjs → chunk-QTGEEBRW.cjs} +84 -46
- package/dist/chunk-QTGEEBRW.cjs.map +1 -0
- package/dist/{chunk-KGYDGK3U.cjs → chunk-VION33GW.cjs} +12 -3
- package/dist/chunk-VION33GW.cjs.map +1 -0
- package/dist/core/index.cjs +72 -72
- package/dist/core/index.js +1 -1
- package/dist/experimental/index.cjs +3 -3
- package/dist/experimental/index.js +2 -2
- package/dist/react/index.cjs +70 -66
- package/dist/react/index.d.cts +205 -3
- package/dist/react/index.d.ts +205 -3
- package/dist/react/index.js +3 -3
- package/dist/ui/index.cjs +954 -76
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.d.cts +116 -7
- package/dist/ui/index.d.ts +116 -7
- package/dist/ui/index.js +947 -73
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-5UGWLGFS.cjs.map +0 -1
- package/dist/chunk-DH6EO6NW.js.map +0 -1
- package/dist/chunk-KGYDGK3U.cjs.map +0 -1
- package/dist/chunk-LHLVTGIP.cjs.map +0 -1
- package/dist/chunk-YLZCTR4O.js.map +0 -1
- package/dist/chunk-ZAOTYA5L.js.map +0 -1
package/dist/ui/index.d.cts
CHANGED
|
@@ -7,7 +7,7 @@ import * as class_variance_authority_types from 'class-variance-authority/types'
|
|
|
7
7
|
import { VariantProps } from 'class-variance-authority';
|
|
8
8
|
import * as use_stick_to_bottom from 'use-stick-to-bottom';
|
|
9
9
|
import { d as WebSearchResult, f as WebSearchResponse } from '../types-ZguuKEs_.cjs';
|
|
10
|
-
import { a as Thread, c as ThreadStorageAdapter, A as AsyncThreadStorageAdapter } from '../types-waEqyE4K.cjs';
|
|
10
|
+
import { a as Thread, c as ThreadStorageAdapter, A as AsyncThreadStorageAdapter, M as MessageAttachment$1 } from '../types-waEqyE4K.cjs';
|
|
11
11
|
import { T as ToolDefinition } from '../tools-DcS6Aeao.cjs';
|
|
12
12
|
import { B as BranchInfo } from '../MessageTree-Dt9qfJ55.cjs';
|
|
13
13
|
import { d as MCPUIIntent, n as MCPUIFrameProps, M as MCPUIResource } from '../types-B20VCJXL.cjs';
|
|
@@ -1521,6 +1521,8 @@ type ChatProps = {
|
|
|
1521
1521
|
fallback?: string;
|
|
1522
1522
|
/** Custom avatar component - when provided, replaces the default avatar */
|
|
1523
1523
|
component?: React__default.ReactNode;
|
|
1524
|
+
/** Additional className applied to the avatar wrapper (e.g. "!bg-transparent") */
|
|
1525
|
+
className?: string;
|
|
1524
1526
|
};
|
|
1525
1527
|
/** Loader variant for typing indicator */
|
|
1526
1528
|
loaderVariant?: "dots" | "typing" | "wave" | "terminal" | "text-blink" | "text-shimmer" | "loading-dots";
|
|
@@ -1535,11 +1537,37 @@ type ChatProps = {
|
|
|
1535
1537
|
/** Tooltip text when attachments are disabled */
|
|
1536
1538
|
attachmentsDisabledTooltip?: string;
|
|
1537
1539
|
/**
|
|
1538
|
-
*
|
|
1539
|
-
*
|
|
1540
|
-
*
|
|
1541
|
-
*
|
|
1540
|
+
* File upload handler. Determines how attachments are uploaded.
|
|
1541
|
+
*
|
|
1542
|
+
* - `string` — Server upload URL. Files are POSTed as JSON `{ data, mimeType, filename }`.
|
|
1543
|
+
* - `object` — URL + headers/body options for the upload request.
|
|
1544
|
+
* - `function` — Full custom handler. Receives `File`, returns `MessageAttachment`.
|
|
1545
|
+
* - `undefined` — Falls back to base64 (embedded in message, no upload).
|
|
1546
|
+
*
|
|
1547
|
+
* @example
|
|
1548
|
+
* ```tsx
|
|
1549
|
+
* // Simple — just a URL:
|
|
1550
|
+
* <CopilotChat upload="/api/copilot/upload" />
|
|
1551
|
+
*
|
|
1552
|
+
* // With auth headers:
|
|
1553
|
+
* <CopilotChat upload={{
|
|
1554
|
+
* url: "/api/copilot/upload",
|
|
1555
|
+
* headers: () => ({ Authorization: `Bearer ${token}` }),
|
|
1556
|
+
* }} />
|
|
1557
|
+
*
|
|
1558
|
+
* // Full custom:
|
|
1559
|
+
* <CopilotChat upload={async (file) => {
|
|
1560
|
+
* const url = await myS3Upload(file);
|
|
1561
|
+
* return { type: 'image', url, mimeType: file.type, filename: file.name };
|
|
1562
|
+
* }} />
|
|
1563
|
+
* ```
|
|
1542
1564
|
*/
|
|
1565
|
+
upload?: string | {
|
|
1566
|
+
url: string;
|
|
1567
|
+
headers?: Record<string, string> | (() => Record<string, string>);
|
|
1568
|
+
body?: Record<string, unknown> | (() => Record<string, unknown>);
|
|
1569
|
+
} | ((file: File) => Promise<MessageAttachment>);
|
|
1570
|
+
/** @deprecated Use `upload` instead */
|
|
1543
1571
|
processAttachment?: (file: File) => Promise<MessageAttachment>;
|
|
1544
1572
|
/** Quick reply suggestions */
|
|
1545
1573
|
suggestions?: string[];
|
|
@@ -1894,7 +1922,7 @@ declare function BackButton({ className, children, disabled, "aria-label": ariaL
|
|
|
1894
1922
|
*/
|
|
1895
1923
|
type ThreadPickerCompoundProps = Omit<ThreadPickerProps, "value" | "threads" | "onSelect" | "onNewThread" | "onDeleteThread" | "disabled">;
|
|
1896
1924
|
declare function ThreadPickerCompound(props: ThreadPickerCompoundProps): react_jsx_runtime.JSX.Element | null;
|
|
1897
|
-
declare function ChatComponent({ messages, onSendMessage, onStop, isLoading, children, placeholder, welcomeMessage, title, showHeader, header, threadPicker, logo, name, onClose, showPoweredBy, showUserAvatar, userAvatar: userAvatarProp, assistantAvatar: assistantAvatarProp, loaderVariant, fontSize, maxFileSize, allowedFileTypes, attachmentsEnabled, attachmentsDisabledTooltip, processAttachment:
|
|
1925
|
+
declare function ChatComponent({ messages, onSendMessage, onStop, isLoading, children, placeholder, welcomeMessage, title, showHeader, header, threadPicker, logo, name, onClose, showPoweredBy, showUserAvatar, userAvatar: userAvatarProp, assistantAvatar: assistantAvatarProp, loaderVariant, fontSize, maxFileSize, allowedFileTypes, attachmentsEnabled, attachmentsDisabledTooltip, upload: uploadProp, processAttachment: deprecatedProcessAttachment, suggestions, onSuggestionClick, welcome, recentThreads, onSelectThread, onDeleteThread, onViewMoreThreads, isProcessing, registeredTools, toolRenderers, mcpToolRenderer, fallbackToolRenderer, onApproveToolExecution, onRejectToolExecution, showFollowUps, followUpClassName, followUpButtonClassName, citations, messageView, renderMessage, wrapMessage, renderInput, renderHeader, groupConsecutiveMessages, className, classNames, onNewChat, threads, currentThreadId, onSwitchThread, isThreadBusy, getBranchInfo, onSwitchBranch, onEditMessage, }: ChatProps): react_jsx_runtime.JSX.Element;
|
|
1898
1926
|
/**
|
|
1899
1927
|
* Chat component with compound component pattern.
|
|
1900
1928
|
*
|
|
@@ -2433,6 +2461,87 @@ declare function MCPUIFrameList({ resources, onIntent, onError, className, frame
|
|
|
2433
2461
|
|
|
2434
2462
|
declare function cn(...inputs: ClassValue[]): string;
|
|
2435
2463
|
|
|
2464
|
+
type AttachmentStatus = "uploading" | "ready" | "error";
|
|
2465
|
+
interface PendingAttachment {
|
|
2466
|
+
id: string;
|
|
2467
|
+
file: File;
|
|
2468
|
+
/** Object URL for image preview */
|
|
2469
|
+
preview?: string;
|
|
2470
|
+
status: AttachmentStatus;
|
|
2471
|
+
/** Upload progress 0-100 */
|
|
2472
|
+
progress: number;
|
|
2473
|
+
error?: string;
|
|
2474
|
+
/** Final attachment data when ready */
|
|
2475
|
+
attachment?: MessageAttachment$1;
|
|
2476
|
+
}
|
|
2477
|
+
type UploadConfig = string | {
|
|
2478
|
+
url: string;
|
|
2479
|
+
headers?: Record<string, string> | (() => Record<string, string>);
|
|
2480
|
+
body?: Record<string, unknown> | (() => Record<string, unknown>);
|
|
2481
|
+
} | ((file: File) => Promise<MessageAttachment$1>);
|
|
2482
|
+
interface UseAttachmentsConfig {
|
|
2483
|
+
/** Upload handler — string (URL), object (URL+options), or function (custom) */
|
|
2484
|
+
upload?: UploadConfig;
|
|
2485
|
+
/** Maximum number of files (default: 5) */
|
|
2486
|
+
maxFiles?: number;
|
|
2487
|
+
/** Maximum file size in bytes (default: 10MB) */
|
|
2488
|
+
maxFileSize?: number;
|
|
2489
|
+
/** Allowed MIME types (default: images + PDF) */
|
|
2490
|
+
allowedFileTypes?: string[];
|
|
2491
|
+
}
|
|
2492
|
+
interface UseAttachmentsReturn {
|
|
2493
|
+
/** Current pending attachments */
|
|
2494
|
+
attachments: PendingAttachment[];
|
|
2495
|
+
/** Whether files are being dragged over the drop zone */
|
|
2496
|
+
isDragging: boolean;
|
|
2497
|
+
/** Add files (from file picker or drop) */
|
|
2498
|
+
addFiles: (files: FileList | File[]) => void;
|
|
2499
|
+
/** Remove a pending attachment */
|
|
2500
|
+
removeAttachment: (id: string) => void;
|
|
2501
|
+
/** Cancel an in-progress upload */
|
|
2502
|
+
cancelUpload: (id: string) => void;
|
|
2503
|
+
/** Retry a failed upload */
|
|
2504
|
+
retryUpload: (id: string) => void;
|
|
2505
|
+
/** Clear all attachments */
|
|
2506
|
+
clearAll: () => void;
|
|
2507
|
+
/** Get ready attachments as MessageAttachment[] for sending */
|
|
2508
|
+
getReadyAttachments: () => MessageAttachment$1[];
|
|
2509
|
+
/** Whether any attachments exist */
|
|
2510
|
+
hasAttachments: boolean;
|
|
2511
|
+
/** Whether any upload is in progress */
|
|
2512
|
+
isUploading: boolean;
|
|
2513
|
+
/** Whether message can be sent (has ready attachments, none still uploading) */
|
|
2514
|
+
canSend: boolean;
|
|
2515
|
+
/** Drag-drop event handlers — spread on the container element */
|
|
2516
|
+
dragHandlers: {
|
|
2517
|
+
onDragEnter: (e: React.DragEvent) => void;
|
|
2518
|
+
onDragOver: (e: React.DragEvent) => void;
|
|
2519
|
+
onDragLeave: (e: React.DragEvent) => void;
|
|
2520
|
+
onDrop: (e: React.DragEvent) => void;
|
|
2521
|
+
};
|
|
2522
|
+
/** Open native file picker */
|
|
2523
|
+
openFilePicker: () => void;
|
|
2524
|
+
/** Ref for hidden file input */
|
|
2525
|
+
fileInputRef: React.RefObject<HTMLInputElement | null>;
|
|
2526
|
+
/** Handler for file input change */
|
|
2527
|
+
onFileInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
2528
|
+
}
|
|
2529
|
+
declare function useAttachments(config?: UseAttachmentsConfig): UseAttachmentsReturn;
|
|
2530
|
+
|
|
2531
|
+
interface AttachmentStripProps {
|
|
2532
|
+
attachments: PendingAttachment[];
|
|
2533
|
+
onRemove: (id: string) => void;
|
|
2534
|
+
onRetry: (id: string) => void;
|
|
2535
|
+
className?: string;
|
|
2536
|
+
}
|
|
2537
|
+
declare function AttachmentStrip({ attachments, onRemove, onRetry, className, }: AttachmentStripProps): react_jsx_runtime.JSX.Element | null;
|
|
2538
|
+
|
|
2539
|
+
interface DropZoneOverlayProps {
|
|
2540
|
+
isDragging: boolean;
|
|
2541
|
+
className?: string;
|
|
2542
|
+
}
|
|
2543
|
+
declare function DropZoneOverlay({ isDragging, className, }: DropZoneOverlayProps): react_jsx_runtime.JSX.Element | null;
|
|
2544
|
+
|
|
2436
2545
|
/**
|
|
2437
2546
|
* ChatPrimitives — composable primitives for building custom chat layouts.
|
|
2438
2547
|
* Must be used inside <CopilotChat>.
|
|
@@ -2481,4 +2590,4 @@ declare const ChatPrimitives: {
|
|
|
2481
2590
|
Loader: typeof Loader;
|
|
2482
2591
|
};
|
|
2483
2592
|
|
|
2484
|
-
export { AlertTriangleIcon, type BackButtonProps, BotIcon, BranchNavigator, type BranchNavigatorProps, Button, CapabilityBadge, type CapabilityBadgeProps, CapabilityList, type CapabilityListProps, type CapabilityType, Chat, ChatContainerContent, ChatContainerRoot, ChatContainerScrollAnchor, type ChatMessage, ChatPrimitives, type ChatProps, type ChatViewProps, ChatWelcome, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronUpIcon, type Citation, CitationBadge, type CitationBadgeProps, type CitationConfig, CitationSuperscript, type CitationSuperscriptProps, type CitationsConfig, CloseIcon, type CloudPersistenceConfig, CodeBlock, CompactPermissionConfirmation, type CompactPermissionConfirmationProps, Confirmation, ConfirmationActions, type ConfirmationActionsProps, ConfirmationApproved, type ConfirmationApprovedProps, ConfirmationMessage, type ConfirmationMessageProps, ConfirmationPending, type ConfirmationPendingProps, type ConfirmationProps, ConfirmationRejected, type ConfirmationRejectedProps, type ConfirmationState$1 as ConfirmationState, ConnectedChat, type ConnectedChatProps, CopilotChat, type CopilotChatClassNames, type CopilotChatPersistenceConfig, type CopilotChatProps, type CopilotUIConfig, type CopilotUIContextValue, CopilotUIProvider, type CopilotUIProviderProps, CopyIcon, DEFAULT_PERMISSION_OPTIONS, DevLogger, type DevLoggerProps, type DevLoggerState, FeedbackBar, type FollowUpProps, FollowUpQuestions, type FooterProps, type HeaderProps, type HomeViewProps as HomeProps, type HomeViewProps, InlineToolSteps, type InlineToolStepsProps, Loader, type LocalPersistenceConfig, MCPUIFrame, MCPUIFrameList, type MCPUIFrameListProps, MCPUIFrameProps, Markdown, MessageAvatar, MessageContent, type MessageListProps, Message as MessagePrimitive, MessageWithCitations, type MessageWithCitationsProps, type ModelOption, ModelSelector, type ModelSelectorProps, PermissionConfirmation, type PermissionConfirmationProps, type PermissionLevel, type PermissionOption, PoweredBy, type PoweredByProps, PromptInput, PromptInputAction, PromptInputActions, PromptInputTextarea, type ProviderGroup, Reasoning, ReasoningContent, type ReasoningContentProps, type ReasoningProps, ReasoningTrigger, type ReasoningTriggerProps, RefreshIcon, ScrollButton, SearchAnswer, type SearchAnswerProps, SearchResults, type SearchResultsProps, SearchResultsWithAnswer, type SearchResultsWithAnswerProps, SendIcon, type ServerPersistenceConfig, SimpleConfirmation, type SimpleConfirmationProps, SimpleModelSelector, type SimpleModelSelectorProps, SimpleReasoning, type SimpleReasoningProps, SimpleSource, type SimpleSourceProps, Source, SourceContent, type SourceContentProps, SourceGroup, type SourceGroupProps, type SourceItem, SourcePill, type SourcePillProps, type SourceProps, SourceTrigger, type SourceTriggerProps, SourcesBar, type SourcesBarProps, SourcesCollapsible, type SourcesCollapsibleProps, SourcesList, type SourcesListProps, StopIcon, ThreadCard, type ThreadCardProps, ThreadList, type ThreadListProps, ThreadPicker, type ThreadPickerCompoundProps, type ThreadPickerProps, ThumbsDownIcon, ThumbsUpIcon, ToolExecutionMessage, type ToolRendererProps, type ToolRenderers, ToolStep, type ToolStepData, type ToolStepProps, type ToolStepStatus, ToolSteps, type ToolStepsProps, Tooltip, TooltipContent, type TooltipContentProps, type TooltipProps, TooltipProvider, type TooltipProviderProps, TooltipTrigger, type TooltipTriggerProps, UserIcon, type WelcomeConfig, XIcon, annotationsToCitations, cn, parseFollowUps, resultsToCitations, useChatContainer, useCopilotChatContext, useCopilotUI };
|
|
2593
|
+
export { AlertTriangleIcon, AttachmentStrip, type AttachmentStripProps, type BackButtonProps, BotIcon, BranchNavigator, type BranchNavigatorProps, Button, CapabilityBadge, type CapabilityBadgeProps, CapabilityList, type CapabilityListProps, type CapabilityType, Chat, ChatContainerContent, ChatContainerRoot, ChatContainerScrollAnchor, type ChatMessage, ChatPrimitives, type ChatProps, type ChatViewProps, ChatWelcome, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronUpIcon, type Citation, CitationBadge, type CitationBadgeProps, type CitationConfig, CitationSuperscript, type CitationSuperscriptProps, type CitationsConfig, CloseIcon, type CloudPersistenceConfig, CodeBlock, CompactPermissionConfirmation, type CompactPermissionConfirmationProps, Confirmation, ConfirmationActions, type ConfirmationActionsProps, ConfirmationApproved, type ConfirmationApprovedProps, ConfirmationMessage, type ConfirmationMessageProps, ConfirmationPending, type ConfirmationPendingProps, type ConfirmationProps, ConfirmationRejected, type ConfirmationRejectedProps, type ConfirmationState$1 as ConfirmationState, ConnectedChat, type ConnectedChatProps, CopilotChat, type CopilotChatClassNames, type CopilotChatPersistenceConfig, type CopilotChatProps, type CopilotUIConfig, type CopilotUIContextValue, CopilotUIProvider, type CopilotUIProviderProps, CopyIcon, DEFAULT_PERMISSION_OPTIONS, DevLogger, type DevLoggerProps, type DevLoggerState, DropZoneOverlay, type DropZoneOverlayProps, FeedbackBar, type FollowUpProps, FollowUpQuestions, type FooterProps, type HeaderProps, type HomeViewProps as HomeProps, type HomeViewProps, InlineToolSteps, type InlineToolStepsProps, Loader, type LocalPersistenceConfig, MCPUIFrame, MCPUIFrameList, type MCPUIFrameListProps, MCPUIFrameProps, Markdown, MessageAvatar, MessageContent, type MessageListProps, Message as MessagePrimitive, MessageWithCitations, type MessageWithCitationsProps, type ModelOption, ModelSelector, type ModelSelectorProps, type PendingAttachment, PermissionConfirmation, type PermissionConfirmationProps, type PermissionLevel, type PermissionOption, PoweredBy, type PoweredByProps, PromptInput, PromptInputAction, PromptInputActions, PromptInputTextarea, type ProviderGroup, Reasoning, ReasoningContent, type ReasoningContentProps, type ReasoningProps, ReasoningTrigger, type ReasoningTriggerProps, RefreshIcon, ScrollButton, SearchAnswer, type SearchAnswerProps, SearchResults, type SearchResultsProps, SearchResultsWithAnswer, type SearchResultsWithAnswerProps, SendIcon, type ServerPersistenceConfig, SimpleConfirmation, type SimpleConfirmationProps, SimpleModelSelector, type SimpleModelSelectorProps, SimpleReasoning, type SimpleReasoningProps, SimpleSource, type SimpleSourceProps, Source, SourceContent, type SourceContentProps, SourceGroup, type SourceGroupProps, type SourceItem, SourcePill, type SourcePillProps, type SourceProps, SourceTrigger, type SourceTriggerProps, SourcesBar, type SourcesBarProps, SourcesCollapsible, type SourcesCollapsibleProps, SourcesList, type SourcesListProps, StopIcon, ThreadCard, type ThreadCardProps, ThreadList, type ThreadListProps, ThreadPicker, type ThreadPickerCompoundProps, type ThreadPickerProps, ThumbsDownIcon, ThumbsUpIcon, ToolExecutionMessage, type ToolRendererProps, type ToolRenderers, ToolStep, type ToolStepData, type ToolStepProps, type ToolStepStatus, ToolSteps, type ToolStepsProps, Tooltip, TooltipContent, type TooltipContentProps, type TooltipProps, TooltipProvider, type TooltipProviderProps, TooltipTrigger, type TooltipTriggerProps, type UploadConfig, type UseAttachmentsConfig, type UseAttachmentsReturn, UserIcon, type WelcomeConfig, XIcon, annotationsToCitations, cn, parseFollowUps, resultsToCitations, useAttachments, useChatContainer, useCopilotChatContext, useCopilotUI };
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import * as class_variance_authority_types from 'class-variance-authority/types'
|
|
|
7
7
|
import { VariantProps } from 'class-variance-authority';
|
|
8
8
|
import * as use_stick_to_bottom from 'use-stick-to-bottom';
|
|
9
9
|
import { d as WebSearchResult, f as WebSearchResponse } from '../types-ZguuKEs_.js';
|
|
10
|
-
import { a as Thread, c as ThreadStorageAdapter, A as AsyncThreadStorageAdapter } from '../types-waEqyE4K.js';
|
|
10
|
+
import { a as Thread, c as ThreadStorageAdapter, A as AsyncThreadStorageAdapter, M as MessageAttachment$1 } from '../types-waEqyE4K.js';
|
|
11
11
|
import { T as ToolDefinition } from '../tools-DcS6Aeao.js';
|
|
12
12
|
import { B as BranchInfo } from '../MessageTree-Clhiv_k2.js';
|
|
13
13
|
import { d as MCPUIIntent, n as MCPUIFrameProps, M as MCPUIResource } from '../types-B20VCJXL.js';
|
|
@@ -1521,6 +1521,8 @@ type ChatProps = {
|
|
|
1521
1521
|
fallback?: string;
|
|
1522
1522
|
/** Custom avatar component - when provided, replaces the default avatar */
|
|
1523
1523
|
component?: React__default.ReactNode;
|
|
1524
|
+
/** Additional className applied to the avatar wrapper (e.g. "!bg-transparent") */
|
|
1525
|
+
className?: string;
|
|
1524
1526
|
};
|
|
1525
1527
|
/** Loader variant for typing indicator */
|
|
1526
1528
|
loaderVariant?: "dots" | "typing" | "wave" | "terminal" | "text-blink" | "text-shimmer" | "loading-dots";
|
|
@@ -1535,11 +1537,37 @@ type ChatProps = {
|
|
|
1535
1537
|
/** Tooltip text when attachments are disabled */
|
|
1536
1538
|
attachmentsDisabledTooltip?: string;
|
|
1537
1539
|
/**
|
|
1538
|
-
*
|
|
1539
|
-
*
|
|
1540
|
-
*
|
|
1541
|
-
*
|
|
1540
|
+
* File upload handler. Determines how attachments are uploaded.
|
|
1541
|
+
*
|
|
1542
|
+
* - `string` — Server upload URL. Files are POSTed as JSON `{ data, mimeType, filename }`.
|
|
1543
|
+
* - `object` — URL + headers/body options for the upload request.
|
|
1544
|
+
* - `function` — Full custom handler. Receives `File`, returns `MessageAttachment`.
|
|
1545
|
+
* - `undefined` — Falls back to base64 (embedded in message, no upload).
|
|
1546
|
+
*
|
|
1547
|
+
* @example
|
|
1548
|
+
* ```tsx
|
|
1549
|
+
* // Simple — just a URL:
|
|
1550
|
+
* <CopilotChat upload="/api/copilot/upload" />
|
|
1551
|
+
*
|
|
1552
|
+
* // With auth headers:
|
|
1553
|
+
* <CopilotChat upload={{
|
|
1554
|
+
* url: "/api/copilot/upload",
|
|
1555
|
+
* headers: () => ({ Authorization: `Bearer ${token}` }),
|
|
1556
|
+
* }} />
|
|
1557
|
+
*
|
|
1558
|
+
* // Full custom:
|
|
1559
|
+
* <CopilotChat upload={async (file) => {
|
|
1560
|
+
* const url = await myS3Upload(file);
|
|
1561
|
+
* return { type: 'image', url, mimeType: file.type, filename: file.name };
|
|
1562
|
+
* }} />
|
|
1563
|
+
* ```
|
|
1542
1564
|
*/
|
|
1565
|
+
upload?: string | {
|
|
1566
|
+
url: string;
|
|
1567
|
+
headers?: Record<string, string> | (() => Record<string, string>);
|
|
1568
|
+
body?: Record<string, unknown> | (() => Record<string, unknown>);
|
|
1569
|
+
} | ((file: File) => Promise<MessageAttachment>);
|
|
1570
|
+
/** @deprecated Use `upload` instead */
|
|
1543
1571
|
processAttachment?: (file: File) => Promise<MessageAttachment>;
|
|
1544
1572
|
/** Quick reply suggestions */
|
|
1545
1573
|
suggestions?: string[];
|
|
@@ -1894,7 +1922,7 @@ declare function BackButton({ className, children, disabled, "aria-label": ariaL
|
|
|
1894
1922
|
*/
|
|
1895
1923
|
type ThreadPickerCompoundProps = Omit<ThreadPickerProps, "value" | "threads" | "onSelect" | "onNewThread" | "onDeleteThread" | "disabled">;
|
|
1896
1924
|
declare function ThreadPickerCompound(props: ThreadPickerCompoundProps): react_jsx_runtime.JSX.Element | null;
|
|
1897
|
-
declare function ChatComponent({ messages, onSendMessage, onStop, isLoading, children, placeholder, welcomeMessage, title, showHeader, header, threadPicker, logo, name, onClose, showPoweredBy, showUserAvatar, userAvatar: userAvatarProp, assistantAvatar: assistantAvatarProp, loaderVariant, fontSize, maxFileSize, allowedFileTypes, attachmentsEnabled, attachmentsDisabledTooltip, processAttachment:
|
|
1925
|
+
declare function ChatComponent({ messages, onSendMessage, onStop, isLoading, children, placeholder, welcomeMessage, title, showHeader, header, threadPicker, logo, name, onClose, showPoweredBy, showUserAvatar, userAvatar: userAvatarProp, assistantAvatar: assistantAvatarProp, loaderVariant, fontSize, maxFileSize, allowedFileTypes, attachmentsEnabled, attachmentsDisabledTooltip, upload: uploadProp, processAttachment: deprecatedProcessAttachment, suggestions, onSuggestionClick, welcome, recentThreads, onSelectThread, onDeleteThread, onViewMoreThreads, isProcessing, registeredTools, toolRenderers, mcpToolRenderer, fallbackToolRenderer, onApproveToolExecution, onRejectToolExecution, showFollowUps, followUpClassName, followUpButtonClassName, citations, messageView, renderMessage, wrapMessage, renderInput, renderHeader, groupConsecutiveMessages, className, classNames, onNewChat, threads, currentThreadId, onSwitchThread, isThreadBusy, getBranchInfo, onSwitchBranch, onEditMessage, }: ChatProps): react_jsx_runtime.JSX.Element;
|
|
1898
1926
|
/**
|
|
1899
1927
|
* Chat component with compound component pattern.
|
|
1900
1928
|
*
|
|
@@ -2433,6 +2461,87 @@ declare function MCPUIFrameList({ resources, onIntent, onError, className, frame
|
|
|
2433
2461
|
|
|
2434
2462
|
declare function cn(...inputs: ClassValue[]): string;
|
|
2435
2463
|
|
|
2464
|
+
type AttachmentStatus = "uploading" | "ready" | "error";
|
|
2465
|
+
interface PendingAttachment {
|
|
2466
|
+
id: string;
|
|
2467
|
+
file: File;
|
|
2468
|
+
/** Object URL for image preview */
|
|
2469
|
+
preview?: string;
|
|
2470
|
+
status: AttachmentStatus;
|
|
2471
|
+
/** Upload progress 0-100 */
|
|
2472
|
+
progress: number;
|
|
2473
|
+
error?: string;
|
|
2474
|
+
/** Final attachment data when ready */
|
|
2475
|
+
attachment?: MessageAttachment$1;
|
|
2476
|
+
}
|
|
2477
|
+
type UploadConfig = string | {
|
|
2478
|
+
url: string;
|
|
2479
|
+
headers?: Record<string, string> | (() => Record<string, string>);
|
|
2480
|
+
body?: Record<string, unknown> | (() => Record<string, unknown>);
|
|
2481
|
+
} | ((file: File) => Promise<MessageAttachment$1>);
|
|
2482
|
+
interface UseAttachmentsConfig {
|
|
2483
|
+
/** Upload handler — string (URL), object (URL+options), or function (custom) */
|
|
2484
|
+
upload?: UploadConfig;
|
|
2485
|
+
/** Maximum number of files (default: 5) */
|
|
2486
|
+
maxFiles?: number;
|
|
2487
|
+
/** Maximum file size in bytes (default: 10MB) */
|
|
2488
|
+
maxFileSize?: number;
|
|
2489
|
+
/** Allowed MIME types (default: images + PDF) */
|
|
2490
|
+
allowedFileTypes?: string[];
|
|
2491
|
+
}
|
|
2492
|
+
interface UseAttachmentsReturn {
|
|
2493
|
+
/** Current pending attachments */
|
|
2494
|
+
attachments: PendingAttachment[];
|
|
2495
|
+
/** Whether files are being dragged over the drop zone */
|
|
2496
|
+
isDragging: boolean;
|
|
2497
|
+
/** Add files (from file picker or drop) */
|
|
2498
|
+
addFiles: (files: FileList | File[]) => void;
|
|
2499
|
+
/** Remove a pending attachment */
|
|
2500
|
+
removeAttachment: (id: string) => void;
|
|
2501
|
+
/** Cancel an in-progress upload */
|
|
2502
|
+
cancelUpload: (id: string) => void;
|
|
2503
|
+
/** Retry a failed upload */
|
|
2504
|
+
retryUpload: (id: string) => void;
|
|
2505
|
+
/** Clear all attachments */
|
|
2506
|
+
clearAll: () => void;
|
|
2507
|
+
/** Get ready attachments as MessageAttachment[] for sending */
|
|
2508
|
+
getReadyAttachments: () => MessageAttachment$1[];
|
|
2509
|
+
/** Whether any attachments exist */
|
|
2510
|
+
hasAttachments: boolean;
|
|
2511
|
+
/** Whether any upload is in progress */
|
|
2512
|
+
isUploading: boolean;
|
|
2513
|
+
/** Whether message can be sent (has ready attachments, none still uploading) */
|
|
2514
|
+
canSend: boolean;
|
|
2515
|
+
/** Drag-drop event handlers — spread on the container element */
|
|
2516
|
+
dragHandlers: {
|
|
2517
|
+
onDragEnter: (e: React.DragEvent) => void;
|
|
2518
|
+
onDragOver: (e: React.DragEvent) => void;
|
|
2519
|
+
onDragLeave: (e: React.DragEvent) => void;
|
|
2520
|
+
onDrop: (e: React.DragEvent) => void;
|
|
2521
|
+
};
|
|
2522
|
+
/** Open native file picker */
|
|
2523
|
+
openFilePicker: () => void;
|
|
2524
|
+
/** Ref for hidden file input */
|
|
2525
|
+
fileInputRef: React.RefObject<HTMLInputElement | null>;
|
|
2526
|
+
/** Handler for file input change */
|
|
2527
|
+
onFileInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
2528
|
+
}
|
|
2529
|
+
declare function useAttachments(config?: UseAttachmentsConfig): UseAttachmentsReturn;
|
|
2530
|
+
|
|
2531
|
+
interface AttachmentStripProps {
|
|
2532
|
+
attachments: PendingAttachment[];
|
|
2533
|
+
onRemove: (id: string) => void;
|
|
2534
|
+
onRetry: (id: string) => void;
|
|
2535
|
+
className?: string;
|
|
2536
|
+
}
|
|
2537
|
+
declare function AttachmentStrip({ attachments, onRemove, onRetry, className, }: AttachmentStripProps): react_jsx_runtime.JSX.Element | null;
|
|
2538
|
+
|
|
2539
|
+
interface DropZoneOverlayProps {
|
|
2540
|
+
isDragging: boolean;
|
|
2541
|
+
className?: string;
|
|
2542
|
+
}
|
|
2543
|
+
declare function DropZoneOverlay({ isDragging, className, }: DropZoneOverlayProps): react_jsx_runtime.JSX.Element | null;
|
|
2544
|
+
|
|
2436
2545
|
/**
|
|
2437
2546
|
* ChatPrimitives — composable primitives for building custom chat layouts.
|
|
2438
2547
|
* Must be used inside <CopilotChat>.
|
|
@@ -2481,4 +2590,4 @@ declare const ChatPrimitives: {
|
|
|
2481
2590
|
Loader: typeof Loader;
|
|
2482
2591
|
};
|
|
2483
2592
|
|
|
2484
|
-
export { AlertTriangleIcon, type BackButtonProps, BotIcon, BranchNavigator, type BranchNavigatorProps, Button, CapabilityBadge, type CapabilityBadgeProps, CapabilityList, type CapabilityListProps, type CapabilityType, Chat, ChatContainerContent, ChatContainerRoot, ChatContainerScrollAnchor, type ChatMessage, ChatPrimitives, type ChatProps, type ChatViewProps, ChatWelcome, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronUpIcon, type Citation, CitationBadge, type CitationBadgeProps, type CitationConfig, CitationSuperscript, type CitationSuperscriptProps, type CitationsConfig, CloseIcon, type CloudPersistenceConfig, CodeBlock, CompactPermissionConfirmation, type CompactPermissionConfirmationProps, Confirmation, ConfirmationActions, type ConfirmationActionsProps, ConfirmationApproved, type ConfirmationApprovedProps, ConfirmationMessage, type ConfirmationMessageProps, ConfirmationPending, type ConfirmationPendingProps, type ConfirmationProps, ConfirmationRejected, type ConfirmationRejectedProps, type ConfirmationState$1 as ConfirmationState, ConnectedChat, type ConnectedChatProps, CopilotChat, type CopilotChatClassNames, type CopilotChatPersistenceConfig, type CopilotChatProps, type CopilotUIConfig, type CopilotUIContextValue, CopilotUIProvider, type CopilotUIProviderProps, CopyIcon, DEFAULT_PERMISSION_OPTIONS, DevLogger, type DevLoggerProps, type DevLoggerState, FeedbackBar, type FollowUpProps, FollowUpQuestions, type FooterProps, type HeaderProps, type HomeViewProps as HomeProps, type HomeViewProps, InlineToolSteps, type InlineToolStepsProps, Loader, type LocalPersistenceConfig, MCPUIFrame, MCPUIFrameList, type MCPUIFrameListProps, MCPUIFrameProps, Markdown, MessageAvatar, MessageContent, type MessageListProps, Message as MessagePrimitive, MessageWithCitations, type MessageWithCitationsProps, type ModelOption, ModelSelector, type ModelSelectorProps, PermissionConfirmation, type PermissionConfirmationProps, type PermissionLevel, type PermissionOption, PoweredBy, type PoweredByProps, PromptInput, PromptInputAction, PromptInputActions, PromptInputTextarea, type ProviderGroup, Reasoning, ReasoningContent, type ReasoningContentProps, type ReasoningProps, ReasoningTrigger, type ReasoningTriggerProps, RefreshIcon, ScrollButton, SearchAnswer, type SearchAnswerProps, SearchResults, type SearchResultsProps, SearchResultsWithAnswer, type SearchResultsWithAnswerProps, SendIcon, type ServerPersistenceConfig, SimpleConfirmation, type SimpleConfirmationProps, SimpleModelSelector, type SimpleModelSelectorProps, SimpleReasoning, type SimpleReasoningProps, SimpleSource, type SimpleSourceProps, Source, SourceContent, type SourceContentProps, SourceGroup, type SourceGroupProps, type SourceItem, SourcePill, type SourcePillProps, type SourceProps, SourceTrigger, type SourceTriggerProps, SourcesBar, type SourcesBarProps, SourcesCollapsible, type SourcesCollapsibleProps, SourcesList, type SourcesListProps, StopIcon, ThreadCard, type ThreadCardProps, ThreadList, type ThreadListProps, ThreadPicker, type ThreadPickerCompoundProps, type ThreadPickerProps, ThumbsDownIcon, ThumbsUpIcon, ToolExecutionMessage, type ToolRendererProps, type ToolRenderers, ToolStep, type ToolStepData, type ToolStepProps, type ToolStepStatus, ToolSteps, type ToolStepsProps, Tooltip, TooltipContent, type TooltipContentProps, type TooltipProps, TooltipProvider, type TooltipProviderProps, TooltipTrigger, type TooltipTriggerProps, UserIcon, type WelcomeConfig, XIcon, annotationsToCitations, cn, parseFollowUps, resultsToCitations, useChatContainer, useCopilotChatContext, useCopilotUI };
|
|
2593
|
+
export { AlertTriangleIcon, AttachmentStrip, type AttachmentStripProps, type BackButtonProps, BotIcon, BranchNavigator, type BranchNavigatorProps, Button, CapabilityBadge, type CapabilityBadgeProps, CapabilityList, type CapabilityListProps, type CapabilityType, Chat, ChatContainerContent, ChatContainerRoot, ChatContainerScrollAnchor, type ChatMessage, ChatPrimitives, type ChatProps, type ChatViewProps, ChatWelcome, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronUpIcon, type Citation, CitationBadge, type CitationBadgeProps, type CitationConfig, CitationSuperscript, type CitationSuperscriptProps, type CitationsConfig, CloseIcon, type CloudPersistenceConfig, CodeBlock, CompactPermissionConfirmation, type CompactPermissionConfirmationProps, Confirmation, ConfirmationActions, type ConfirmationActionsProps, ConfirmationApproved, type ConfirmationApprovedProps, ConfirmationMessage, type ConfirmationMessageProps, ConfirmationPending, type ConfirmationPendingProps, type ConfirmationProps, ConfirmationRejected, type ConfirmationRejectedProps, type ConfirmationState$1 as ConfirmationState, ConnectedChat, type ConnectedChatProps, CopilotChat, type CopilotChatClassNames, type CopilotChatPersistenceConfig, type CopilotChatProps, type CopilotUIConfig, type CopilotUIContextValue, CopilotUIProvider, type CopilotUIProviderProps, CopyIcon, DEFAULT_PERMISSION_OPTIONS, DevLogger, type DevLoggerProps, type DevLoggerState, DropZoneOverlay, type DropZoneOverlayProps, FeedbackBar, type FollowUpProps, FollowUpQuestions, type FooterProps, type HeaderProps, type HomeViewProps as HomeProps, type HomeViewProps, InlineToolSteps, type InlineToolStepsProps, Loader, type LocalPersistenceConfig, MCPUIFrame, MCPUIFrameList, type MCPUIFrameListProps, MCPUIFrameProps, Markdown, MessageAvatar, MessageContent, type MessageListProps, Message as MessagePrimitive, MessageWithCitations, type MessageWithCitationsProps, type ModelOption, ModelSelector, type ModelSelectorProps, type PendingAttachment, PermissionConfirmation, type PermissionConfirmationProps, type PermissionLevel, type PermissionOption, PoweredBy, type PoweredByProps, PromptInput, PromptInputAction, PromptInputActions, PromptInputTextarea, type ProviderGroup, Reasoning, ReasoningContent, type ReasoningContentProps, type ReasoningProps, ReasoningTrigger, type ReasoningTriggerProps, RefreshIcon, ScrollButton, SearchAnswer, type SearchAnswerProps, SearchResults, type SearchResultsProps, SearchResultsWithAnswer, type SearchResultsWithAnswerProps, SendIcon, type ServerPersistenceConfig, SimpleConfirmation, type SimpleConfirmationProps, SimpleModelSelector, type SimpleModelSelectorProps, SimpleReasoning, type SimpleReasoningProps, SimpleSource, type SimpleSourceProps, Source, SourceContent, type SourceContentProps, SourceGroup, type SourceGroupProps, type SourceItem, SourcePill, type SourcePillProps, type SourceProps, SourceTrigger, type SourceTriggerProps, SourcesBar, type SourcesBarProps, SourcesCollapsible, type SourcesCollapsibleProps, SourcesList, type SourcesListProps, StopIcon, ThreadCard, type ThreadCardProps, ThreadList, type ThreadListProps, ThreadPicker, type ThreadPickerCompoundProps, type ThreadPickerProps, ThumbsDownIcon, ThumbsUpIcon, ToolExecutionMessage, type ToolRendererProps, type ToolRenderers, ToolStep, type ToolStepData, type ToolStepProps, type ToolStepStatus, ToolSteps, type ToolStepsProps, Tooltip, TooltipContent, type TooltipContentProps, type TooltipProps, TooltipProvider, type TooltipProviderProps, TooltipTrigger, type TooltipTriggerProps, type UploadConfig, type UseAttachmentsConfig, type UseAttachmentsReturn, UserIcon, type WelcomeConfig, XIcon, annotationsToCitations, cn, parseFollowUps, resultsToCitations, useAttachments, useChatContainer, useCopilotChatContext, useCopilotUI };
|