@yourgpt/copilot-sdk 0.1.1 → 1.0.1
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/LICENSE +21 -0
- package/dist/{thread-CLmfwine.d.ts → ThreadManager-BCVt-_k_.d.cts} +376 -223
- package/dist/{thread-CLmfwine.d.cts → ThreadManager-BjC15mh8.d.ts} +376 -223
- package/dist/{chunk-IH7WXWX4.cjs → chunk-42YQ4ATO.cjs} +889 -2
- package/dist/chunk-42YQ4ATO.cjs.map +1 -0
- package/dist/{chunk-R452HH3J.cjs → chunk-BN75ZW24.cjs} +455 -26
- package/dist/chunk-BN75ZW24.cjs.map +1 -0
- package/dist/{chunk-QWQELTEB.js → chunk-QSEGNATZ.js} +882 -3
- package/dist/chunk-QSEGNATZ.js.map +1 -0
- package/dist/{chunk-FO75W5UI.js → chunk-XAVZZVUL.js} +428 -4
- package/dist/chunk-XAVZZVUL.js.map +1 -0
- package/dist/core/index.cjs +99 -71
- package/dist/core/index.d.cts +4 -4
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +1 -1
- package/dist/react/index.cjs +66 -34
- package/dist/react/index.d.cts +371 -5
- package/dist/react/index.d.ts +371 -5
- package/dist/react/index.js +2 -2
- package/dist/{tools-eeJ5iEC4.d.ts → types-BtAaOV07.d.cts} +367 -1
- package/dist/{tools-eeJ5iEC4.d.cts → types-BtAaOV07.d.ts} +367 -1
- package/dist/ui/index.cjs +1703 -467
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.d.cts +333 -38
- package/dist/ui/index.d.ts +333 -38
- package/dist/ui/index.js +1699 -467
- package/dist/ui/index.js.map +1 -1
- package/package.json +9 -9
- package/dist/chunk-FO75W5UI.js.map +0 -1
- package/dist/chunk-IH7WXWX4.cjs.map +0 -1
- package/dist/chunk-QWQELTEB.js.map +0 -1
- package/dist/chunk-R452HH3J.cjs.map +0 -1
package/dist/ui/index.d.cts
CHANGED
|
@@ -5,7 +5,7 @@ import { Components } from 'react-markdown';
|
|
|
5
5
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
6
6
|
import { VariantProps } from 'class-variance-authority';
|
|
7
7
|
import * as use_stick_to_bottom from 'use-stick-to-bottom';
|
|
8
|
-
import { T as ToolDefinition } from '../
|
|
8
|
+
import { k as Thread, T as ToolDefinition, _ as ThreadStorageAdapter, X as AsyncThreadStorageAdapter } from '../types-BtAaOV07.cjs';
|
|
9
9
|
import { ClassValue } from 'clsx';
|
|
10
10
|
|
|
11
11
|
interface LoaderProps {
|
|
@@ -93,11 +93,14 @@ declare const Message: ({ children, className, ...props }: MessageProps) => reac
|
|
|
93
93
|
type MessageAvatarProps = {
|
|
94
94
|
src: string;
|
|
95
95
|
alt: string;
|
|
96
|
+
/** Text fallback (e.g. "AI") */
|
|
96
97
|
fallback?: string;
|
|
98
|
+
/** Icon/component fallback (takes precedence over text fallback when src is empty) */
|
|
99
|
+
fallbackIcon?: React.ReactNode;
|
|
97
100
|
delayMs?: number;
|
|
98
101
|
className?: string;
|
|
99
102
|
};
|
|
100
|
-
declare const MessageAvatar: ({ src, alt, fallback, delayMs, className, }: MessageAvatarProps) => react_jsx_runtime.JSX.Element;
|
|
103
|
+
declare const MessageAvatar: ({ src, alt, fallback, fallbackIcon, delayMs, className, }: MessageAvatarProps) => react_jsx_runtime.JSX.Element;
|
|
101
104
|
type MessageContentProps = {
|
|
102
105
|
children: React.ReactNode;
|
|
103
106
|
markdown?: boolean;
|
|
@@ -756,6 +759,113 @@ interface SimpleModelSelectorProps {
|
|
|
756
759
|
*/
|
|
757
760
|
declare function SimpleModelSelector({ value, onChange, models, disabled, className, }: SimpleModelSelectorProps): react_jsx_runtime.JSX.Element;
|
|
758
761
|
|
|
762
|
+
interface ThreadPickerProps {
|
|
763
|
+
/** Currently selected thread ID */
|
|
764
|
+
value?: string | null;
|
|
765
|
+
/** List of threads to display */
|
|
766
|
+
threads: Thread[];
|
|
767
|
+
/** Called when a thread is selected */
|
|
768
|
+
onSelect?: (threadId: string) => void;
|
|
769
|
+
/** Called when a thread is deleted */
|
|
770
|
+
onDeleteThread?: (threadId: string) => void;
|
|
771
|
+
/** Called when "New conversation" is clicked */
|
|
772
|
+
onNewThread?: () => void;
|
|
773
|
+
/** Placeholder text when no thread is selected */
|
|
774
|
+
placeholder?: string;
|
|
775
|
+
/** Text for new conversation button */
|
|
776
|
+
newThreadLabel?: string;
|
|
777
|
+
/** Disabled state */
|
|
778
|
+
disabled?: boolean;
|
|
779
|
+
/** Loading state */
|
|
780
|
+
loading?: boolean;
|
|
781
|
+
/** Size variant */
|
|
782
|
+
size?: "sm" | "md" | "lg";
|
|
783
|
+
/** Additional class name for root container */
|
|
784
|
+
className?: string;
|
|
785
|
+
/** Class name for the trigger button */
|
|
786
|
+
buttonClassName?: string;
|
|
787
|
+
/** Class name for the dropdown container */
|
|
788
|
+
dropdownClassName?: string;
|
|
789
|
+
/** Class name for thread items */
|
|
790
|
+
itemClassName?: string;
|
|
791
|
+
/** Class name for the new conversation button */
|
|
792
|
+
newButtonClassName?: string;
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* ThreadPicker - Dropdown for selecting conversations
|
|
796
|
+
*
|
|
797
|
+
* @example
|
|
798
|
+
* ```tsx
|
|
799
|
+
* const { threads, currentThread, switchThread, createThread } = useThreadManager();
|
|
800
|
+
*
|
|
801
|
+
* <ThreadPicker
|
|
802
|
+
* value={currentThread?.id}
|
|
803
|
+
* threads={threads}
|
|
804
|
+
* onSelect={switchThread}
|
|
805
|
+
* onNewThread={() => createThread()}
|
|
806
|
+
* />
|
|
807
|
+
* ```
|
|
808
|
+
*/
|
|
809
|
+
declare function ThreadPicker({ value, threads, onSelect, onDeleteThread, onNewThread, placeholder, newThreadLabel, disabled, loading, size, className, buttonClassName, dropdownClassName, itemClassName, newButtonClassName, }: ThreadPickerProps): react_jsx_runtime.JSX.Element;
|
|
810
|
+
|
|
811
|
+
interface ThreadListProps {
|
|
812
|
+
/** List of threads to display */
|
|
813
|
+
threads: Thread[];
|
|
814
|
+
/** Currently selected thread ID */
|
|
815
|
+
selectedId?: string | null;
|
|
816
|
+
/** Called when a thread is selected */
|
|
817
|
+
onSelect?: (threadId: string) => void;
|
|
818
|
+
/** Called when a thread's delete button is clicked */
|
|
819
|
+
onDelete?: (threadId: string) => void;
|
|
820
|
+
/** Called when "New conversation" is clicked */
|
|
821
|
+
onNewThread?: () => void;
|
|
822
|
+
/** Text for new conversation button */
|
|
823
|
+
newThreadLabel?: string;
|
|
824
|
+
/** Loading state */
|
|
825
|
+
loading?: boolean;
|
|
826
|
+
/** Empty state text */
|
|
827
|
+
emptyText?: string;
|
|
828
|
+
/** Show delete buttons */
|
|
829
|
+
showDelete?: boolean;
|
|
830
|
+
/** Additional class name */
|
|
831
|
+
className?: string;
|
|
832
|
+
}
|
|
833
|
+
interface ThreadCardProps {
|
|
834
|
+
/** Thread data */
|
|
835
|
+
thread: Thread;
|
|
836
|
+
/** Whether this thread is selected */
|
|
837
|
+
selected?: boolean;
|
|
838
|
+
/** Called when clicked */
|
|
839
|
+
onClick?: () => void;
|
|
840
|
+
/** Called when delete is clicked */
|
|
841
|
+
onDelete?: () => void;
|
|
842
|
+
/** Show delete button */
|
|
843
|
+
showDelete?: boolean;
|
|
844
|
+
/** Additional class name */
|
|
845
|
+
className?: string;
|
|
846
|
+
}
|
|
847
|
+
/**
|
|
848
|
+
* ThreadCard - Individual thread item in the list
|
|
849
|
+
*/
|
|
850
|
+
declare function ThreadCard({ thread, selected, onClick, onDelete, showDelete, className, }: ThreadCardProps): react_jsx_runtime.JSX.Element;
|
|
851
|
+
/**
|
|
852
|
+
* ThreadList - Card-based list of conversations
|
|
853
|
+
*
|
|
854
|
+
* @example
|
|
855
|
+
* ```tsx
|
|
856
|
+
* const { threads, currentThread, switchThread, deleteThread, createThread } = useThreadManager();
|
|
857
|
+
*
|
|
858
|
+
* <ThreadList
|
|
859
|
+
* threads={threads}
|
|
860
|
+
* selectedId={currentThread?.id}
|
|
861
|
+
* onSelect={switchThread}
|
|
862
|
+
* onDelete={deleteThread}
|
|
863
|
+
* onNewThread={() => createThread()}
|
|
864
|
+
* />
|
|
865
|
+
* ```
|
|
866
|
+
*/
|
|
867
|
+
declare function ThreadList({ threads, selectedId, onSelect, onDelete, onNewThread, newThreadLabel, loading, emptyText, showDelete, className, }: ThreadListProps): react_jsx_runtime.JSX.Element;
|
|
868
|
+
|
|
759
869
|
interface CopilotUIConfig {
|
|
760
870
|
/**
|
|
761
871
|
* Debug mode - shows JSON args/results in collapsible sections
|
|
@@ -949,6 +1059,39 @@ interface ToolRendererProps {
|
|
|
949
1059
|
* ```
|
|
950
1060
|
*/
|
|
951
1061
|
type ToolRenderers = Record<string, React__default.ComponentType<ToolRendererProps>>;
|
|
1062
|
+
/**
|
|
1063
|
+
* Header configuration for CopilotChat
|
|
1064
|
+
*/
|
|
1065
|
+
interface ChatHeaderConfig {
|
|
1066
|
+
/** Logo image URL (default: YourGPT logo) */
|
|
1067
|
+
logo?: string;
|
|
1068
|
+
/** Copilot name (default: "AI Copilot") */
|
|
1069
|
+
name?: string;
|
|
1070
|
+
/** Called when close button is clicked */
|
|
1071
|
+
onClose?: () => void;
|
|
1072
|
+
}
|
|
1073
|
+
/**
|
|
1074
|
+
* Welcome screen configuration for CopilotChat
|
|
1075
|
+
* Shown when there are no messages (new session)
|
|
1076
|
+
*/
|
|
1077
|
+
interface WelcomeConfig {
|
|
1078
|
+
/** Hero title (default: "How can I help you today?") */
|
|
1079
|
+
title?: string;
|
|
1080
|
+
/** Hero subtitle (default: "Ask anything and get it done.") */
|
|
1081
|
+
subtitle?: string;
|
|
1082
|
+
/** Hero logo URL (defaults to header logo or SDK logo) */
|
|
1083
|
+
logo?: string;
|
|
1084
|
+
/** Label for suggestions section (default: "Try AI Copilot") */
|
|
1085
|
+
suggestionsLabel?: string;
|
|
1086
|
+
/** Show recent chats section (requires persistence) (default: true) */
|
|
1087
|
+
showRecentChats?: boolean;
|
|
1088
|
+
/** Label for recent chats section (default: "Recent chats") */
|
|
1089
|
+
recentChatsLabel?: string;
|
|
1090
|
+
/** Max recent chats to show (default: 3) */
|
|
1091
|
+
maxRecentChats?: number;
|
|
1092
|
+
/** "View more" link text (default: "View more..") */
|
|
1093
|
+
viewMoreLabel?: string;
|
|
1094
|
+
}
|
|
952
1095
|
type ChatProps = {
|
|
953
1096
|
/** Messages to display */
|
|
954
1097
|
messages?: ChatMessage[];
|
|
@@ -962,12 +1105,33 @@ type ChatProps = {
|
|
|
962
1105
|
placeholder?: string;
|
|
963
1106
|
/** Custom welcome message when no messages */
|
|
964
1107
|
welcomeMessage?: React__default.ReactNode;
|
|
965
|
-
/**
|
|
1108
|
+
/** @deprecated Use `header.name` instead */
|
|
966
1109
|
title?: string;
|
|
967
|
-
/** Show header bar
|
|
1110
|
+
/** Show header bar */
|
|
968
1111
|
showHeader?: boolean;
|
|
969
|
-
/**
|
|
1112
|
+
/** Header configuration */
|
|
1113
|
+
header?: ChatHeaderConfig;
|
|
1114
|
+
/** Thread picker element (passed from connected-chat) */
|
|
1115
|
+
threadPicker?: React__default.ReactNode;
|
|
1116
|
+
/** @deprecated Use `header.logo` instead */
|
|
1117
|
+
logo?: string;
|
|
1118
|
+
/** @deprecated Use `header.name` instead */
|
|
1119
|
+
name?: string;
|
|
1120
|
+
/** @deprecated Use `header.onClose` instead */
|
|
970
1121
|
onClose?: () => void;
|
|
1122
|
+
/**
|
|
1123
|
+
* Welcome screen configuration. Shown when no messages.
|
|
1124
|
+
* Set to `false` to disable and show empty chat instead.
|
|
1125
|
+
*/
|
|
1126
|
+
welcome?: WelcomeConfig | false;
|
|
1127
|
+
/** Recent threads for welcome screen (from persistence) */
|
|
1128
|
+
recentThreads?: Thread[];
|
|
1129
|
+
/** Called when user selects a recent thread */
|
|
1130
|
+
onSelectThread?: (threadId: string) => void;
|
|
1131
|
+
/** Called when user deletes a thread from welcome screen */
|
|
1132
|
+
onDeleteThread?: (threadId: string) => void;
|
|
1133
|
+
/** Called when user clicks "View more" in recent threads */
|
|
1134
|
+
onViewMoreThreads?: () => void;
|
|
971
1135
|
/** Show powered by footer (free tier) */
|
|
972
1136
|
showPoweredBy?: boolean;
|
|
973
1137
|
/** Show user avatar (default: false) */
|
|
@@ -1075,7 +1239,49 @@ type ChatProps = {
|
|
|
1075
1239
|
};
|
|
1076
1240
|
};
|
|
1077
1241
|
|
|
1078
|
-
declare function Chat({ messages, onSendMessage, onStop, isLoading, placeholder, welcomeMessage, title, showHeader, onClose, showPoweredBy, showUserAvatar, userAvatar, assistantAvatar, loaderVariant, fontSize, maxFileSize, allowedFileTypes, attachmentsEnabled, attachmentsDisabledTooltip, processAttachment: processAttachmentProp, suggestions, onSuggestionClick, isProcessing, registeredTools, toolRenderers, onApproveToolExecution, onRejectToolExecution, showFollowUps, followUpClassName, followUpButtonClassName, renderMessage, renderInput, renderHeader, className, classNames, }: ChatProps): react_jsx_runtime.JSX.Element;
|
|
1242
|
+
declare function Chat({ messages, onSendMessage, onStop, isLoading, placeholder, welcomeMessage, title, showHeader, header, threadPicker, logo, name, onClose, showPoweredBy, showUserAvatar, userAvatar, assistantAvatar, loaderVariant, fontSize, maxFileSize, allowedFileTypes, attachmentsEnabled, attachmentsDisabledTooltip, processAttachment: processAttachmentProp, suggestions, onSuggestionClick, welcome, recentThreads, onSelectThread, onDeleteThread, onViewMoreThreads, isProcessing, registeredTools, toolRenderers, onApproveToolExecution, onRejectToolExecution, showFollowUps, followUpClassName, followUpButtonClassName, renderMessage, renderInput, renderHeader, className, classNames, }: ChatProps): react_jsx_runtime.JSX.Element;
|
|
1243
|
+
|
|
1244
|
+
interface ChatWelcomeProps {
|
|
1245
|
+
/** Welcome screen configuration */
|
|
1246
|
+
config?: WelcomeConfig;
|
|
1247
|
+
/** Suggestions to show */
|
|
1248
|
+
suggestions?: string[];
|
|
1249
|
+
/** Recent threads for the recent chats section */
|
|
1250
|
+
recentThreads?: Thread[];
|
|
1251
|
+
/** Called when user sends a message */
|
|
1252
|
+
onSendMessage: (message: string, attachments?: MessageAttachment[]) => void;
|
|
1253
|
+
/** Called when user selects a recent thread */
|
|
1254
|
+
onSelectThread?: (threadId: string) => void;
|
|
1255
|
+
/** Called when user deletes a recent thread */
|
|
1256
|
+
onDeleteThread?: (threadId: string) => void;
|
|
1257
|
+
/** Called when user clicks "View more" */
|
|
1258
|
+
onViewMoreThreads?: () => void;
|
|
1259
|
+
/** Whether AI is currently generating */
|
|
1260
|
+
isLoading?: boolean;
|
|
1261
|
+
/** Called when user stops generation */
|
|
1262
|
+
onStop?: () => void;
|
|
1263
|
+
/** Placeholder for input */
|
|
1264
|
+
placeholder?: string;
|
|
1265
|
+
/** Whether attachments are enabled */
|
|
1266
|
+
attachmentsEnabled?: boolean;
|
|
1267
|
+
/** Tooltip when attachments are disabled */
|
|
1268
|
+
attachmentsDisabledTooltip?: string;
|
|
1269
|
+
/** Maximum file size in bytes */
|
|
1270
|
+
maxFileSize?: number;
|
|
1271
|
+
/** Allowed file types */
|
|
1272
|
+
allowedFileTypes?: string[];
|
|
1273
|
+
/** Custom attachment processor */
|
|
1274
|
+
processAttachment?: (file: File) => Promise<MessageAttachment>;
|
|
1275
|
+
/** Custom class names */
|
|
1276
|
+
classNames?: {
|
|
1277
|
+
root?: string;
|
|
1278
|
+
hero?: string;
|
|
1279
|
+
input?: string;
|
|
1280
|
+
suggestions?: string;
|
|
1281
|
+
recentChats?: string;
|
|
1282
|
+
};
|
|
1283
|
+
}
|
|
1284
|
+
declare function ChatWelcome({ config, suggestions, recentThreads, onSendMessage, onSelectThread, onDeleteThread, onViewMoreThreads, isLoading, onStop, placeholder, attachmentsEnabled, attachmentsDisabledTooltip, maxFileSize, allowedFileTypes, processAttachment: processAttachmentProp, classNames, }: ChatWelcomeProps): react_jsx_runtime.JSX.Element;
|
|
1079
1285
|
|
|
1080
1286
|
interface ToolExecutionMessageProps {
|
|
1081
1287
|
executions: ToolExecutionData[];
|
|
@@ -1104,49 +1310,138 @@ interface ToolExecutionMessageProps {
|
|
|
1104
1310
|
declare function ToolExecutionMessage({ executions, assistantAvatar, onApprove, onReject, toolRenderers, className, }: ToolExecutionMessageProps): react_jsx_runtime.JSX.Element | null;
|
|
1105
1311
|
|
|
1106
1312
|
/**
|
|
1107
|
-
*
|
|
1108
|
-
* No need to pass messages, sendMessage, etc. - handled internally
|
|
1313
|
+
* localStorage persistence (zero config)
|
|
1109
1314
|
*/
|
|
1110
|
-
|
|
1315
|
+
interface LocalPersistenceConfig {
|
|
1316
|
+
type: "local";
|
|
1317
|
+
/** Debounce delay for auto-save (ms). Default: 1000 */
|
|
1318
|
+
saveDebounce?: number;
|
|
1319
|
+
/** Whether to auto-restore the last active thread. Default: true */
|
|
1320
|
+
autoRestoreLastThread?: boolean;
|
|
1321
|
+
}
|
|
1111
1322
|
/**
|
|
1112
|
-
*
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1323
|
+
* Server persistence (point to your own API routes)
|
|
1324
|
+
*/
|
|
1325
|
+
interface ServerPersistenceConfig {
|
|
1326
|
+
type: "server";
|
|
1327
|
+
/**
|
|
1328
|
+
* Endpoint URL for your thread CRUD API
|
|
1329
|
+
* @example "/api/threads"
|
|
1330
|
+
*/
|
|
1331
|
+
endpoint: string;
|
|
1332
|
+
/** Additional headers for requests (e.g., auth tokens) */
|
|
1333
|
+
headers?: Record<string, string>;
|
|
1334
|
+
/** Debounce delay for auto-save (ms). Default: 1000 */
|
|
1335
|
+
saveDebounce?: number;
|
|
1336
|
+
/** Whether to auto-restore the last active thread. Default: true */
|
|
1337
|
+
autoRestoreLastThread?: boolean;
|
|
1338
|
+
}
|
|
1339
|
+
/**
|
|
1340
|
+
* Cloud persistence (future - managed service)
|
|
1341
|
+
*/
|
|
1342
|
+
interface CloudPersistenceConfig {
|
|
1343
|
+
type: "cloud";
|
|
1344
|
+
/** Copilot Cloud API key */
|
|
1345
|
+
apiKey: string;
|
|
1346
|
+
/** Custom endpoint for enterprise (optional) */
|
|
1347
|
+
endpoint?: string;
|
|
1348
|
+
}
|
|
1349
|
+
/**
|
|
1350
|
+
* Legacy persistence config (backward compatibility)
|
|
1351
|
+
*/
|
|
1352
|
+
interface LegacyPersistenceConfig {
|
|
1353
|
+
/** Storage adapter (defaults to localStorage) */
|
|
1354
|
+
adapter?: ThreadStorageAdapter | AsyncThreadStorageAdapter;
|
|
1355
|
+
/** Debounce delay for auto-save (ms). Default: 1000 */
|
|
1356
|
+
saveDebounce?: number;
|
|
1357
|
+
/** Whether to auto-restore the last active thread on mount. Default: true */
|
|
1358
|
+
autoRestoreLastThread?: boolean;
|
|
1359
|
+
}
|
|
1360
|
+
/**
|
|
1361
|
+
* Persistence configuration for CopilotChat
|
|
1116
1362
|
*
|
|
1117
|
-
* @example
|
|
1363
|
+
* @example localStorage (zero config)
|
|
1118
1364
|
* ```tsx
|
|
1119
|
-
*
|
|
1120
|
-
*
|
|
1121
|
-
*
|
|
1122
|
-
* function App() {
|
|
1123
|
-
* return (
|
|
1124
|
-
* <CopilotProvider runtimeUrl="/api/chat">
|
|
1125
|
-
* <CopilotChat
|
|
1126
|
-
* title="AI Assistant"
|
|
1127
|
-
* placeholder="Ask anything..."
|
|
1128
|
-
* />
|
|
1129
|
-
* </CopilotProvider>
|
|
1130
|
-
* );
|
|
1131
|
-
* }
|
|
1365
|
+
* <CopilotChat persistence={true} />
|
|
1366
|
+
* // or explicitly:
|
|
1367
|
+
* <CopilotChat persistence={{ type: "local" }} />
|
|
1132
1368
|
* ```
|
|
1133
1369
|
*
|
|
1134
|
-
* @example
|
|
1370
|
+
* @example Server persistence
|
|
1135
1371
|
* ```tsx
|
|
1136
|
-
* import { CopilotChat, type ToolRendererProps } from '@yourgpt/copilot-sdk-ui';
|
|
1137
|
-
*
|
|
1138
|
-
* function WeatherCard({ execution }: ToolRendererProps) {
|
|
1139
|
-
* if (execution.status !== 'completed') return <div>Loading...</div>;
|
|
1140
|
-
* return <div>{execution.result.city}: {execution.result.temperature}°</div>;
|
|
1141
|
-
* }
|
|
1142
|
-
*
|
|
1143
1372
|
* <CopilotChat
|
|
1144
|
-
*
|
|
1145
|
-
*
|
|
1373
|
+
* persistence={{
|
|
1374
|
+
* type: "server",
|
|
1375
|
+
* threadsUrl: "/api/threads",
|
|
1376
|
+
* headers: { Authorization: `Bearer ${token}` },
|
|
1146
1377
|
* }}
|
|
1147
1378
|
* />
|
|
1148
1379
|
* ```
|
|
1149
1380
|
*/
|
|
1381
|
+
type CopilotChatPersistenceConfig = LocalPersistenceConfig | ServerPersistenceConfig | CloudPersistenceConfig | LegacyPersistenceConfig;
|
|
1382
|
+
/**
|
|
1383
|
+
* Extended classNames for CopilotChat including thread picker
|
|
1384
|
+
*/
|
|
1385
|
+
interface CopilotChatClassNames {
|
|
1386
|
+
root?: string;
|
|
1387
|
+
header?: string;
|
|
1388
|
+
container?: string;
|
|
1389
|
+
messageList?: string;
|
|
1390
|
+
userMessage?: string;
|
|
1391
|
+
assistantMessage?: string;
|
|
1392
|
+
input?: string;
|
|
1393
|
+
suggestions?: string;
|
|
1394
|
+
footer?: string;
|
|
1395
|
+
threadPicker?: string;
|
|
1396
|
+
threadPickerButton?: string;
|
|
1397
|
+
threadPickerDropdown?: string;
|
|
1398
|
+
threadPickerItem?: string;
|
|
1399
|
+
threadPickerNewButton?: string;
|
|
1400
|
+
}
|
|
1401
|
+
/**
|
|
1402
|
+
* Header configuration for CopilotChat
|
|
1403
|
+
*/
|
|
1404
|
+
interface CopilotChatHeaderConfig {
|
|
1405
|
+
/** Logo image URL (default: YourGPT logo) */
|
|
1406
|
+
logo?: string;
|
|
1407
|
+
/** Copilot name (default: "AI Copilot") */
|
|
1408
|
+
name?: string;
|
|
1409
|
+
/** Called when close button is clicked */
|
|
1410
|
+
onClose?: () => void;
|
|
1411
|
+
}
|
|
1412
|
+
/**
|
|
1413
|
+
* Props for CopilotChat - auto-connects to CopilotProvider context
|
|
1414
|
+
* No need to pass messages, sendMessage, etc. - handled internally
|
|
1415
|
+
*/
|
|
1416
|
+
type CopilotChatProps = Omit<ChatProps, "messages" | "onSendMessage" | "onStop" | "isLoading" | "isProcessing" | "onApproveToolExecution" | "onRejectToolExecution" | "processAttachment" | "classNames" | "header" | "threadPicker" | "recentThreads" | "onSelectThread" | "onViewMoreThreads"> & {
|
|
1417
|
+
/**
|
|
1418
|
+
* Header configuration.
|
|
1419
|
+
* Providing this prop will automatically show the header.
|
|
1420
|
+
*/
|
|
1421
|
+
header?: CopilotChatHeaderConfig;
|
|
1422
|
+
/**
|
|
1423
|
+
* Enable built-in persistence.
|
|
1424
|
+
* - `true`: Use localStorage with default settings
|
|
1425
|
+
* - `object`: Custom persistence config
|
|
1426
|
+
* - `undefined`: No persistence (default)
|
|
1427
|
+
*/
|
|
1428
|
+
persistence?: boolean | CopilotChatPersistenceConfig;
|
|
1429
|
+
/**
|
|
1430
|
+
* Show thread picker in the header for switching conversations.
|
|
1431
|
+
* Requires `persistence` to be enabled.
|
|
1432
|
+
* @default false
|
|
1433
|
+
*/
|
|
1434
|
+
showThreadPicker?: boolean;
|
|
1435
|
+
/**
|
|
1436
|
+
* Callback when the current thread changes.
|
|
1437
|
+
* Useful for syncing thread ID with URL or external state.
|
|
1438
|
+
*/
|
|
1439
|
+
onThreadChange?: (threadId: string | null) => void;
|
|
1440
|
+
/**
|
|
1441
|
+
* Granular class names for sub-components including thread picker
|
|
1442
|
+
*/
|
|
1443
|
+
classNames?: CopilotChatClassNames;
|
|
1444
|
+
};
|
|
1150
1445
|
declare function CopilotChat(props: CopilotChatProps): react_jsx_runtime.JSX.Element;
|
|
1151
1446
|
declare const ConnectedChat: typeof CopilotChat;
|
|
1152
1447
|
type ConnectedChatProps = CopilotChatProps;
|
|
@@ -1202,4 +1497,4 @@ declare function AlertTriangleIcon({ className }: {
|
|
|
1202
1497
|
|
|
1203
1498
|
declare function cn(...inputs: ClassValue[]): string;
|
|
1204
1499
|
|
|
1205
|
-
export { AlertTriangleIcon, BotIcon, Button, CapabilityBadge, type CapabilityBadgeProps, CapabilityList, type CapabilityListProps, type CapabilityType, Chat, ChatContainerContent, ChatContainerRoot, ChatContainerScrollAnchor, type ChatMessage, type ChatProps, CheckIcon, ChevronDownIcon, ChevronUpIcon, CloseIcon, 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 CopilotChatProps, type CopilotUIConfig, type CopilotUIContextValue, CopilotUIProvider, type CopilotUIProviderProps, CopyIcon, DEFAULT_PERMISSION_OPTIONS, DevLogger, type DevLoggerProps, type DevLoggerState, FeedbackBar, type FollowUpProps, FollowUpQuestions, InlineToolSteps, type InlineToolStepsProps, Loader, Markdown, MessageAvatar, MessageContent, Message as MessagePrimitive, 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, SendIcon, SimpleConfirmation, type SimpleConfirmationProps, SimpleModelSelector, type SimpleModelSelectorProps, SimpleReasoning, type SimpleReasoningProps, Source, SourceContent, SourceTrigger, StopIcon, 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, XIcon, cn, parseFollowUps, useChatContainer, useCopilotUI };
|
|
1500
|
+
export { AlertTriangleIcon, BotIcon, Button, CapabilityBadge, type CapabilityBadgeProps, CapabilityList, type CapabilityListProps, type CapabilityType, Chat, ChatContainerContent, ChatContainerRoot, ChatContainerScrollAnchor, type ChatMessage, type ChatProps, ChatWelcome, CheckIcon, ChevronDownIcon, ChevronUpIcon, 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, InlineToolSteps, type InlineToolStepsProps, Loader, type LocalPersistenceConfig, Markdown, MessageAvatar, MessageContent, Message as MessagePrimitive, 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, SendIcon, type ServerPersistenceConfig, SimpleConfirmation, type SimpleConfirmationProps, SimpleModelSelector, type SimpleModelSelectorProps, SimpleReasoning, type SimpleReasoningProps, Source, SourceContent, SourceTrigger, StopIcon, ThreadCard, type ThreadCardProps, ThreadList, type ThreadListProps, ThreadPicker, 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, cn, parseFollowUps, useChatContainer, useCopilotUI };
|