@yourgpt/copilot-sdk 0.1.0 → 1.0.0

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.
@@ -5,6 +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 { k as Thread, T as ToolDefinition, _ as ThreadStorageAdapter, X as AsyncThreadStorageAdapter } from '../types-BtAaOV07.js';
8
9
  import { ClassValue } from 'clsx';
9
10
 
10
11
  interface LoaderProps {
@@ -92,11 +93,14 @@ declare const Message: ({ children, className, ...props }: MessageProps) => reac
92
93
  type MessageAvatarProps = {
93
94
  src: string;
94
95
  alt: string;
96
+ /** Text fallback (e.g. "AI") */
95
97
  fallback?: string;
98
+ /** Icon/component fallback (takes precedence over text fallback when src is empty) */
99
+ fallbackIcon?: React.ReactNode;
96
100
  delayMs?: number;
97
101
  className?: string;
98
102
  };
99
- 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;
100
104
  type MessageContentProps = {
101
105
  children: React.ReactNode;
102
106
  markdown?: boolean;
@@ -755,6 +759,113 @@ interface SimpleModelSelectorProps {
755
759
  */
756
760
  declare function SimpleModelSelector({ value, onChange, models, disabled, className, }: SimpleModelSelectorProps): react_jsx_runtime.JSX.Element;
757
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
+
758
869
  interface CopilotUIConfig {
759
870
  /**
760
871
  * Debug mode - shows JSON args/results in collapsible sections
@@ -821,6 +932,8 @@ interface ToolExecutionData {
821
932
  approvalStatus?: ToolApprovalStatus;
822
933
  /** Message shown in approval UI */
823
934
  approvalMessage?: string;
935
+ /** Data passed from user's approval action (e.g., selected item) */
936
+ approvalData?: Record<string, unknown>;
824
937
  }
825
938
 
826
939
  /**
@@ -865,6 +978,21 @@ type ChatMessage = {
865
978
  }>;
866
979
  };
867
980
 
981
+ /**
982
+ * Approval callbacks for custom tool renderers.
983
+ * Only provided when approvalStatus is 'required'.
984
+ */
985
+ interface ToolApprovalCallbacks {
986
+ /**
987
+ * Approve execution with optional extra data.
988
+ * The extraData is passed to the tool handler via context.approvalData.
989
+ */
990
+ onApprove: (extraData?: Record<string, unknown>) => void;
991
+ /** Reject the execution with optional reason */
992
+ onReject: (reason?: string) => void;
993
+ /** Custom message from tool config */
994
+ message?: string;
995
+ }
868
996
  /**
869
997
  * Props passed to custom tool renderer components
870
998
  *
@@ -879,6 +1007,19 @@ type ChatMessage = {
879
1007
  * const { city, temperature } = execution.result;
880
1008
  * return <div>{city}: {temperature}°</div>;
881
1009
  * }
1010
+ *
1011
+ * // With approval callbacks for interactive tools
1012
+ * function EscalationCard({ execution, approval }: ToolRendererProps) {
1013
+ * if (execution.approvalStatus === 'required' && approval) {
1014
+ * return (
1015
+ * <SelectionCard
1016
+ * onSelect={(item) => approval.onApprove({ selectedItem: item })}
1017
+ * onCancel={() => approval.onReject('Cancelled')}
1018
+ * />
1019
+ * );
1020
+ * }
1021
+ * // ... other states
1022
+ * }
882
1023
  * ```
883
1024
  */
884
1025
  interface ToolRendererProps {
@@ -897,7 +1038,14 @@ interface ToolRendererProps {
897
1038
  error?: string;
898
1039
  /** Approval status for tools requiring confirmation */
899
1040
  approvalStatus?: ToolApprovalStatus;
1041
+ /** Data passed from user's approval action */
1042
+ approvalData?: Record<string, unknown>;
900
1043
  };
1044
+ /**
1045
+ * Approval callbacks - only provided when approvalStatus is 'required'.
1046
+ * Use these to create custom approval UIs.
1047
+ */
1048
+ approval?: ToolApprovalCallbacks;
901
1049
  }
902
1050
  /**
903
1051
  * Map of tool names to their custom renderer components
@@ -911,6 +1059,39 @@ interface ToolRendererProps {
911
1059
  * ```
912
1060
  */
913
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
+ }
914
1095
  type ChatProps = {
915
1096
  /** Messages to display */
916
1097
  messages?: ChatMessage[];
@@ -924,12 +1105,33 @@ type ChatProps = {
924
1105
  placeholder?: string;
925
1106
  /** Custom welcome message when no messages */
926
1107
  welcomeMessage?: React__default.ReactNode;
927
- /** Title shown in header (if showHeader is true) */
1108
+ /** @deprecated Use `header.name` instead */
928
1109
  title?: string;
929
- /** Show header bar with title and close button */
1110
+ /** Show header bar */
930
1111
  showHeader?: boolean;
931
- /** Called when close button is clicked */
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 */
932
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;
933
1135
  /** Show powered by footer (free tier) */
934
1136
  showPoweredBy?: boolean;
935
1137
  /** Show user avatar (default: false) */
@@ -979,12 +1181,21 @@ type ChatProps = {
979
1181
  followUpButtonClassName?: string;
980
1182
  /** Whether waiting for server after tool completion (shows "Continuing..." loader) */
981
1183
  isProcessing?: boolean;
1184
+ /**
1185
+ * Registered tools for accessing tool's render function.
1186
+ * Passed automatically by CopilotChat from context.
1187
+ *
1188
+ * Priority: toolRenderers > tool.render > default ToolSteps
1189
+ */
1190
+ registeredTools?: ToolDefinition[];
982
1191
  /**
983
1192
  * Custom renderers for tool results (Generative UI)
984
1193
  *
985
1194
  * Map tool names to React components that render their results.
986
1195
  * When a tool execution matches a key, the custom component is rendered
987
- * instead of the default ToolSteps display.
1196
+ * instead of tool's render function or default ToolSteps display.
1197
+ *
1198
+ * Higher priority than tool's built-in render function.
988
1199
  *
989
1200
  * @example
990
1201
  * ```tsx
@@ -997,8 +1208,13 @@ type ChatProps = {
997
1208
  * ```
998
1209
  */
999
1210
  toolRenderers?: ToolRenderers;
1000
- /** Called when user approves a tool execution */
1001
- onApproveToolExecution?: (executionId: string, permissionLevel?: PermissionLevel) => void;
1211
+ /**
1212
+ * Called when user approves a tool execution.
1213
+ * @param executionId - The tool execution ID
1214
+ * @param extraData - Optional data from user's action (e.g., selected item)
1215
+ * @param permissionLevel - Optional permission level for persistence
1216
+ */
1217
+ onApproveToolExecution?: (executionId: string, extraData?: Record<string, unknown>, permissionLevel?: PermissionLevel) => void;
1002
1218
  /** Called when user rejects a tool execution */
1003
1219
  onRejectToolExecution?: (executionId: string, reason?: string, permissionLevel?: PermissionLevel) => void;
1004
1220
  /** Custom message renderer */
@@ -1023,7 +1239,49 @@ type ChatProps = {
1023
1239
  };
1024
1240
  };
1025
1241
 
1026
- 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, 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;
1027
1285
 
1028
1286
  interface ToolExecutionMessageProps {
1029
1287
  executions: ToolExecutionData[];
@@ -1031,60 +1289,159 @@ interface ToolExecutionMessageProps {
1031
1289
  src?: string;
1032
1290
  fallback?: string;
1033
1291
  };
1034
- onApprove?: (executionId: string, permissionLevel?: PermissionLevel) => void;
1292
+ /** Called when user approves with optional extraData from custom UI */
1293
+ onApprove?: (executionId: string, extraData?: Record<string, unknown>, permissionLevel?: PermissionLevel) => void;
1035
1294
  onReject?: (executionId: string, reason?: string, permissionLevel?: PermissionLevel) => void;
1295
+ /** Custom tool renderers that can handle approval UI */
1296
+ toolRenderers?: Record<string, React$1.ComponentType<{
1297
+ execution: ToolExecutionData;
1298
+ approval?: {
1299
+ onApprove: (extraData?: Record<string, unknown>) => void;
1300
+ onReject: (reason?: string) => void;
1301
+ message?: string;
1302
+ };
1303
+ }>>;
1036
1304
  className?: string;
1037
1305
  }
1038
1306
  /**
1039
1307
  * Standalone tool execution message shown during agentic loop
1040
1308
  * Displays tool calls with status, progress, and approval UI
1041
1309
  */
1042
- declare function ToolExecutionMessage({ executions, assistantAvatar, onApprove, onReject, className, }: ToolExecutionMessageProps): react_jsx_runtime.JSX.Element | null;
1310
+ declare function ToolExecutionMessage({ executions, assistantAvatar, onApprove, onReject, toolRenderers, className, }: ToolExecutionMessageProps): react_jsx_runtime.JSX.Element | null;
1043
1311
 
1044
1312
  /**
1045
- * Props for CopilotChat - auto-connects to CopilotProvider context
1046
- * No need to pass messages, sendMessage, etc. - handled internally
1313
+ * localStorage persistence (zero config)
1047
1314
  */
1048
- type CopilotChatProps = Omit<ChatProps, "messages" | "onSendMessage" | "onStop" | "isLoading" | "isProcessing" | "onApproveToolExecution" | "onRejectToolExecution" | "processAttachment">;
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
+ }
1049
1322
  /**
1050
- * CopilotChat - Auto-connected chat component
1051
- *
1052
- * Automatically connects to CopilotProvider context.
1053
- * No need to use hooks or pass messages - everything is handled internally.
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
1054
1362
  *
1055
- * @example
1363
+ * @example localStorage (zero config)
1056
1364
  * ```tsx
1057
- * import { CopilotProvider } from '../../react';
1058
- * import { CopilotChat } from '@yourgpt/copilot-sdk-ui';
1059
- *
1060
- * function App() {
1061
- * return (
1062
- * <CopilotProvider runtimeUrl="/api/chat">
1063
- * <CopilotChat
1064
- * title="AI Assistant"
1065
- * placeholder="Ask anything..."
1066
- * />
1067
- * </CopilotProvider>
1068
- * );
1069
- * }
1365
+ * <CopilotChat persistence={true} />
1366
+ * // or explicitly:
1367
+ * <CopilotChat persistence={{ type: "local" }} />
1070
1368
  * ```
1071
1369
  *
1072
- * @example Generative UI with custom tool renderers
1370
+ * @example Server persistence
1073
1371
  * ```tsx
1074
- * import { CopilotChat, type ToolRendererProps } from '@yourgpt/copilot-sdk-ui';
1075
- *
1076
- * function WeatherCard({ execution }: ToolRendererProps) {
1077
- * if (execution.status !== 'completed') return <div>Loading...</div>;
1078
- * return <div>{execution.result.city}: {execution.result.temperature}°</div>;
1079
- * }
1080
- *
1081
1372
  * <CopilotChat
1082
- * toolRenderers={{
1083
- * get_weather: WeatherCard,
1373
+ * persistence={{
1374
+ * type: "server",
1375
+ * threadsUrl: "/api/threads",
1376
+ * headers: { Authorization: `Bearer ${token}` },
1084
1377
  * }}
1085
1378
  * />
1086
1379
  * ```
1087
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
+ };
1088
1445
  declare function CopilotChat(props: CopilotChatProps): react_jsx_runtime.JSX.Element;
1089
1446
  declare const ConnectedChat: typeof CopilotChat;
1090
1447
  type ConnectedChatProps = CopilotChatProps;
@@ -1140,4 +1497,4 @@ declare function AlertTriangleIcon({ className }: {
1140
1497
 
1141
1498
  declare function cn(...inputs: ClassValue[]): string;
1142
1499
 
1143
- 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 };