@copilotkitnext/react 1.51.2-next.1 → 1.51.3-next.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.
package/dist/index.d.mts CHANGED
@@ -1,13 +1,27 @@
1
1
  import { AbstractAgent } from '@ag-ui/client';
2
2
  export * from '@ag-ui/client';
3
- import * as react_jsx_runtime from 'react/jsx-runtime';
4
3
  import * as React$1 from 'react';
5
4
  import React__default, { ReactNode } from 'react';
5
+ import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import { AssistantMessage, Message, UserMessage, ToolCall, ToolMessage, ActivityMessage } from '@ag-ui/core';
7
7
  import { Streamdown } from 'streamdown';
8
8
  import { Suggestion, CopilotKitCore, ToolCallStatus, FrontendTool, DynamicSuggestionsConfig, StaticSuggestionsConfig, CopilotKitCoreConfig, CopilotKitCoreSubscriber, CopilotKitCoreSubscription } from '@copilotkitnext/core';
9
9
  import { z } from 'zod';
10
10
 
11
+ /** Finite-state machine for every recorder implementation */
12
+ type AudioRecorderState = "idle" | "recording" | "processing";
13
+ /** Error subclass so callers can `instanceof`-guard recorder failures */
14
+ declare class AudioRecorderError extends Error {
15
+ constructor(message: string);
16
+ }
17
+ interface AudioRecorderRef {
18
+ state: AudioRecorderState;
19
+ start: () => Promise<void>;
20
+ stop: () => Promise<Blob>;
21
+ dispose: () => void;
22
+ }
23
+ declare const CopilotChatAudioRecorder: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<AudioRecorderRef>>;
24
+
11
25
  declare const CopilotChatDefaultLabels: {
12
26
  chatInputPlaceholder: string;
13
27
  chatInputToolbarStartTranscribeButtonLabel: string;
@@ -28,6 +42,7 @@ declare const CopilotChatDefaultLabels: {
28
42
  chatToggleOpenLabel: string;
29
43
  chatToggleCloseLabel: string;
30
44
  modalHeaderTitle: string;
45
+ welcomeMessageText: string;
31
46
  };
32
47
  type CopilotChatLabels = typeof CopilotChatDefaultLabels;
33
48
  interface CopilotChatConfigurationValue {
@@ -48,14 +63,6 @@ interface CopilotChatConfigurationProviderProps {
48
63
  declare const CopilotChatConfigurationProvider: React__default.FC<CopilotChatConfigurationProviderProps>;
49
64
  declare const useCopilotChatConfiguration: () => CopilotChatConfigurationValue | null;
50
65
 
51
- /** Finite-state machine for every recorder implementation */
52
- type AudioRecorderState = "idle" | "recording" | "processing";
53
- /** Error subclass so callers can `instanceof`-guard recorder failures */
54
- declare class AudioRecorderError extends Error {
55
- constructor(message: string);
56
- }
57
- declare const CopilotChatAudioRecorder: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<any>>;
58
-
59
66
  /** Existing union (unchanged) */
60
67
  type SlotValue<C extends React__default.ComponentType<any>> = C | string | Partial<React__default.ComponentProps<C>>;
61
68
  /** Utility: concrete React elements for every slot */
@@ -97,6 +104,7 @@ type CopilotChatInputRestProps = {
97
104
  onStartTranscribe?: () => void;
98
105
  onCancelTranscribe?: () => void;
99
106
  onFinishTranscribe?: () => void;
107
+ onFinishTranscribeWithAudio?: (audioBlob: Blob) => Promise<void>;
100
108
  onAddFile?: () => void;
101
109
  value?: string;
102
110
  onChange?: (value: string) => void;
@@ -108,7 +116,7 @@ type CopilotChatInputChildrenArgs = CopilotChatInputBaseProps extends {
108
116
  type CopilotChatInputProps = Omit<CopilotChatInputBaseProps, "children"> & {
109
117
  children?: (props: CopilotChatInputChildrenArgs) => React__default.ReactNode;
110
118
  };
111
- declare function CopilotChatInput({ mode, onSubmitMessage, onStop, isRunning, onStartTranscribe, onCancelTranscribe, onFinishTranscribe, onAddFile, onChange, value, toolsMenu, autoFocus, textArea, sendButton, startTranscribeButton, cancelTranscribeButton, finishTranscribeButton, addMenuButton, audioRecorder, children, className, ...props }: CopilotChatInputProps): react_jsx_runtime.JSX.Element;
119
+ declare function CopilotChatInput({ mode, onSubmitMessage, onStop, isRunning, onStartTranscribe, onCancelTranscribe, onFinishTranscribe, onFinishTranscribeWithAudio, onAddFile, onChange, value, toolsMenu, autoFocus, textArea, sendButton, startTranscribeButton, cancelTranscribeButton, finishTranscribeButton, addMenuButton, audioRecorder, children, className, ...props }: CopilotChatInputProps): react_jsx_runtime.JSX.Element;
112
120
  declare namespace CopilotChatInput {
113
121
  const SendButton: React__default.FC<React__default.ButtonHTMLAttributes<HTMLButtonElement>>;
114
122
  const ToolbarButton: React__default.FC<React__default.ButtonHTMLAttributes<HTMLButtonElement> & {
@@ -125,7 +133,7 @@ declare namespace CopilotChatInput {
125
133
  }>;
126
134
  type TextAreaProps = React__default.TextareaHTMLAttributes<HTMLTextAreaElement>;
127
135
  const TextArea: React__default.ForwardRefExoticComponent<TextAreaProps & React__default.RefAttributes<HTMLTextAreaElement>>;
128
- const AudioRecorder: React__default.ForwardRefExoticComponent<React__default.HTMLAttributes<HTMLDivElement> & React__default.RefAttributes<any>>;
136
+ const AudioRecorder: React__default.ForwardRefExoticComponent<React__default.HTMLAttributes<HTMLDivElement> & React__default.RefAttributes<AudioRecorderRef>>;
129
137
  }
130
138
 
131
139
  type CopilotChatToolCallsViewProps = {
@@ -271,6 +279,12 @@ declare namespace CopilotChatMessageView {
271
279
  var Cursor: ({ className, ...props }: React__default.HTMLAttributes<HTMLDivElement>) => react_jsx_runtime.JSX.Element;
272
280
  }
273
281
 
282
+ type WelcomeScreenProps = WithSlots<{
283
+ welcomeMessage: React__default.FC<React__default.HTMLAttributes<HTMLDivElement>>;
284
+ }, {
285
+ input: React__default.ReactElement;
286
+ suggestionView: React__default.ReactElement;
287
+ } & React__default.HTMLAttributes<HTMLDivElement>>;
274
288
  type CopilotChatViewProps = WithSlots<{
275
289
  messageView: typeof CopilotChatMessageView;
276
290
  scrollView: React__default.FC<React__default.HTMLAttributes<HTMLDivElement>>;
@@ -290,8 +304,9 @@ type CopilotChatViewProps = WithSlots<{
290
304
  suggestions?: Suggestion[];
291
305
  suggestionLoadingIndexes?: ReadonlyArray<number>;
292
306
  onSelectSuggestion?: (suggestion: Suggestion, index: number) => void;
307
+ welcomeScreen?: SlotValue<React__default.FC<WelcomeScreenProps>> | boolean;
293
308
  } & React__default.HTMLAttributes<HTMLDivElement>>;
294
- declare function CopilotChatView({ messageView, input, scrollView, scrollToBottomButton, feather, inputContainer, disclaimer, suggestionView, messages, autoScroll, inputProps, isRunning, suggestions, suggestionLoadingIndexes, onSelectSuggestion, children, className, ...props }: CopilotChatViewProps): string | number | bigint | boolean | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
309
+ declare function CopilotChatView({ messageView, input, scrollView, scrollToBottomButton, feather, inputContainer, disclaimer, suggestionView, welcomeScreen, messages, autoScroll, inputProps, isRunning, suggestions, suggestionLoadingIndexes, onSelectSuggestion, children, className, ...props }: CopilotChatViewProps): string | number | bigint | boolean | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
295
310
  declare namespace CopilotChatView {
296
311
  const ScrollView: React__default.FC<React__default.HTMLAttributes<HTMLDivElement> & {
297
312
  autoScroll?: boolean;
@@ -306,6 +321,8 @@ declare namespace CopilotChatView {
306
321
  keyboardHeight?: number;
307
322
  } & React__default.RefAttributes<HTMLDivElement>>;
308
323
  const Disclaimer: React__default.FC<React__default.HTMLAttributes<HTMLDivElement>>;
324
+ const WelcomeMessage: React__default.FC<React__default.HTMLAttributes<HTMLDivElement>>;
325
+ const WelcomeScreen: React__default.FC<WelcomeScreenProps>;
309
326
  }
310
327
 
311
328
  type CopilotChatProps = Omit<CopilotChatViewProps, "messages" | "isRunning" | "suggestions" | "suggestionLoadingIndexes" | "onSelectSuggestion"> & {
@@ -355,6 +372,15 @@ declare function CopilotSidebarView({ header, width, ...props }: CopilotSidebarV
355
372
  declare namespace CopilotSidebarView {
356
373
  var displayName: string;
357
374
  }
375
+ declare namespace CopilotSidebarView {
376
+ /**
377
+ * Sidebar-specific welcome screen layout:
378
+ * - Suggestions at the top
379
+ * - Welcome message in the middle
380
+ * - Input fixed at the bottom (like normal chat)
381
+ */
382
+ const WelcomeScreen: React__default.FC<WelcomeScreenProps>;
383
+ }
358
384
 
359
385
  type CopilotPopupViewProps = CopilotChatViewProps & {
360
386
  header?: SlotValue<typeof CopilotModalHeader>;
@@ -366,6 +392,15 @@ declare function CopilotPopupView({ header, width, height, clickOutsideToClose,
366
392
  declare namespace CopilotPopupView {
367
393
  var displayName: string;
368
394
  }
395
+ declare namespace CopilotPopupView {
396
+ /**
397
+ * Popup-specific welcome screen layout:
398
+ * - Welcome message centered vertically
399
+ * - Suggestions just above input
400
+ * - Input fixed at the bottom
401
+ */
402
+ const WelcomeScreen: React__default.FC<WelcomeScreenProps>;
403
+ }
369
404
 
370
405
  type CopilotSidebarProps = Omit<CopilotChatProps, "chatView"> & {
371
406
  header?: CopilotSidebarViewProps["header"];
@@ -701,6 +736,10 @@ interface CopilotKitProviderProps {
701
736
  children: ReactNode;
702
737
  runtimeUrl?: string;
703
738
  headers?: Record<string, string>;
739
+ /**
740
+ * Credentials mode for fetch requests (e.g., "include" for HTTP-only cookies in cross-origin requests).
741
+ */
742
+ credentials?: RequestCredentials;
704
743
  /**
705
744
  * The Copilot Cloud public API key.
706
745
  */
package/dist/index.d.ts CHANGED
@@ -1,13 +1,27 @@
1
1
  import { AbstractAgent } from '@ag-ui/client';
2
2
  export * from '@ag-ui/client';
3
- import * as react_jsx_runtime from 'react/jsx-runtime';
4
3
  import * as React$1 from 'react';
5
4
  import React__default, { ReactNode } from 'react';
5
+ import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import { AssistantMessage, Message, UserMessage, ToolCall, ToolMessage, ActivityMessage } from '@ag-ui/core';
7
7
  import { Streamdown } from 'streamdown';
8
8
  import { Suggestion, CopilotKitCore, ToolCallStatus, FrontendTool, DynamicSuggestionsConfig, StaticSuggestionsConfig, CopilotKitCoreConfig, CopilotKitCoreSubscriber, CopilotKitCoreSubscription } from '@copilotkitnext/core';
9
9
  import { z } from 'zod';
10
10
 
11
+ /** Finite-state machine for every recorder implementation */
12
+ type AudioRecorderState = "idle" | "recording" | "processing";
13
+ /** Error subclass so callers can `instanceof`-guard recorder failures */
14
+ declare class AudioRecorderError extends Error {
15
+ constructor(message: string);
16
+ }
17
+ interface AudioRecorderRef {
18
+ state: AudioRecorderState;
19
+ start: () => Promise<void>;
20
+ stop: () => Promise<Blob>;
21
+ dispose: () => void;
22
+ }
23
+ declare const CopilotChatAudioRecorder: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<AudioRecorderRef>>;
24
+
11
25
  declare const CopilotChatDefaultLabels: {
12
26
  chatInputPlaceholder: string;
13
27
  chatInputToolbarStartTranscribeButtonLabel: string;
@@ -28,6 +42,7 @@ declare const CopilotChatDefaultLabels: {
28
42
  chatToggleOpenLabel: string;
29
43
  chatToggleCloseLabel: string;
30
44
  modalHeaderTitle: string;
45
+ welcomeMessageText: string;
31
46
  };
32
47
  type CopilotChatLabels = typeof CopilotChatDefaultLabels;
33
48
  interface CopilotChatConfigurationValue {
@@ -48,14 +63,6 @@ interface CopilotChatConfigurationProviderProps {
48
63
  declare const CopilotChatConfigurationProvider: React__default.FC<CopilotChatConfigurationProviderProps>;
49
64
  declare const useCopilotChatConfiguration: () => CopilotChatConfigurationValue | null;
50
65
 
51
- /** Finite-state machine for every recorder implementation */
52
- type AudioRecorderState = "idle" | "recording" | "processing";
53
- /** Error subclass so callers can `instanceof`-guard recorder failures */
54
- declare class AudioRecorderError extends Error {
55
- constructor(message: string);
56
- }
57
- declare const CopilotChatAudioRecorder: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<any>>;
58
-
59
66
  /** Existing union (unchanged) */
60
67
  type SlotValue<C extends React__default.ComponentType<any>> = C | string | Partial<React__default.ComponentProps<C>>;
61
68
  /** Utility: concrete React elements for every slot */
@@ -97,6 +104,7 @@ type CopilotChatInputRestProps = {
97
104
  onStartTranscribe?: () => void;
98
105
  onCancelTranscribe?: () => void;
99
106
  onFinishTranscribe?: () => void;
107
+ onFinishTranscribeWithAudio?: (audioBlob: Blob) => Promise<void>;
100
108
  onAddFile?: () => void;
101
109
  value?: string;
102
110
  onChange?: (value: string) => void;
@@ -108,7 +116,7 @@ type CopilotChatInputChildrenArgs = CopilotChatInputBaseProps extends {
108
116
  type CopilotChatInputProps = Omit<CopilotChatInputBaseProps, "children"> & {
109
117
  children?: (props: CopilotChatInputChildrenArgs) => React__default.ReactNode;
110
118
  };
111
- declare function CopilotChatInput({ mode, onSubmitMessage, onStop, isRunning, onStartTranscribe, onCancelTranscribe, onFinishTranscribe, onAddFile, onChange, value, toolsMenu, autoFocus, textArea, sendButton, startTranscribeButton, cancelTranscribeButton, finishTranscribeButton, addMenuButton, audioRecorder, children, className, ...props }: CopilotChatInputProps): react_jsx_runtime.JSX.Element;
119
+ declare function CopilotChatInput({ mode, onSubmitMessage, onStop, isRunning, onStartTranscribe, onCancelTranscribe, onFinishTranscribe, onFinishTranscribeWithAudio, onAddFile, onChange, value, toolsMenu, autoFocus, textArea, sendButton, startTranscribeButton, cancelTranscribeButton, finishTranscribeButton, addMenuButton, audioRecorder, children, className, ...props }: CopilotChatInputProps): react_jsx_runtime.JSX.Element;
112
120
  declare namespace CopilotChatInput {
113
121
  const SendButton: React__default.FC<React__default.ButtonHTMLAttributes<HTMLButtonElement>>;
114
122
  const ToolbarButton: React__default.FC<React__default.ButtonHTMLAttributes<HTMLButtonElement> & {
@@ -125,7 +133,7 @@ declare namespace CopilotChatInput {
125
133
  }>;
126
134
  type TextAreaProps = React__default.TextareaHTMLAttributes<HTMLTextAreaElement>;
127
135
  const TextArea: React__default.ForwardRefExoticComponent<TextAreaProps & React__default.RefAttributes<HTMLTextAreaElement>>;
128
- const AudioRecorder: React__default.ForwardRefExoticComponent<React__default.HTMLAttributes<HTMLDivElement> & React__default.RefAttributes<any>>;
136
+ const AudioRecorder: React__default.ForwardRefExoticComponent<React__default.HTMLAttributes<HTMLDivElement> & React__default.RefAttributes<AudioRecorderRef>>;
129
137
  }
130
138
 
131
139
  type CopilotChatToolCallsViewProps = {
@@ -271,6 +279,12 @@ declare namespace CopilotChatMessageView {
271
279
  var Cursor: ({ className, ...props }: React__default.HTMLAttributes<HTMLDivElement>) => react_jsx_runtime.JSX.Element;
272
280
  }
273
281
 
282
+ type WelcomeScreenProps = WithSlots<{
283
+ welcomeMessage: React__default.FC<React__default.HTMLAttributes<HTMLDivElement>>;
284
+ }, {
285
+ input: React__default.ReactElement;
286
+ suggestionView: React__default.ReactElement;
287
+ } & React__default.HTMLAttributes<HTMLDivElement>>;
274
288
  type CopilotChatViewProps = WithSlots<{
275
289
  messageView: typeof CopilotChatMessageView;
276
290
  scrollView: React__default.FC<React__default.HTMLAttributes<HTMLDivElement>>;
@@ -290,8 +304,9 @@ type CopilotChatViewProps = WithSlots<{
290
304
  suggestions?: Suggestion[];
291
305
  suggestionLoadingIndexes?: ReadonlyArray<number>;
292
306
  onSelectSuggestion?: (suggestion: Suggestion, index: number) => void;
307
+ welcomeScreen?: SlotValue<React__default.FC<WelcomeScreenProps>> | boolean;
293
308
  } & React__default.HTMLAttributes<HTMLDivElement>>;
294
- declare function CopilotChatView({ messageView, input, scrollView, scrollToBottomButton, feather, inputContainer, disclaimer, suggestionView, messages, autoScroll, inputProps, isRunning, suggestions, suggestionLoadingIndexes, onSelectSuggestion, children, className, ...props }: CopilotChatViewProps): string | number | bigint | boolean | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
309
+ declare function CopilotChatView({ messageView, input, scrollView, scrollToBottomButton, feather, inputContainer, disclaimer, suggestionView, welcomeScreen, messages, autoScroll, inputProps, isRunning, suggestions, suggestionLoadingIndexes, onSelectSuggestion, children, className, ...props }: CopilotChatViewProps): string | number | bigint | boolean | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
295
310
  declare namespace CopilotChatView {
296
311
  const ScrollView: React__default.FC<React__default.HTMLAttributes<HTMLDivElement> & {
297
312
  autoScroll?: boolean;
@@ -306,6 +321,8 @@ declare namespace CopilotChatView {
306
321
  keyboardHeight?: number;
307
322
  } & React__default.RefAttributes<HTMLDivElement>>;
308
323
  const Disclaimer: React__default.FC<React__default.HTMLAttributes<HTMLDivElement>>;
324
+ const WelcomeMessage: React__default.FC<React__default.HTMLAttributes<HTMLDivElement>>;
325
+ const WelcomeScreen: React__default.FC<WelcomeScreenProps>;
309
326
  }
310
327
 
311
328
  type CopilotChatProps = Omit<CopilotChatViewProps, "messages" | "isRunning" | "suggestions" | "suggestionLoadingIndexes" | "onSelectSuggestion"> & {
@@ -355,6 +372,15 @@ declare function CopilotSidebarView({ header, width, ...props }: CopilotSidebarV
355
372
  declare namespace CopilotSidebarView {
356
373
  var displayName: string;
357
374
  }
375
+ declare namespace CopilotSidebarView {
376
+ /**
377
+ * Sidebar-specific welcome screen layout:
378
+ * - Suggestions at the top
379
+ * - Welcome message in the middle
380
+ * - Input fixed at the bottom (like normal chat)
381
+ */
382
+ const WelcomeScreen: React__default.FC<WelcomeScreenProps>;
383
+ }
358
384
 
359
385
  type CopilotPopupViewProps = CopilotChatViewProps & {
360
386
  header?: SlotValue<typeof CopilotModalHeader>;
@@ -366,6 +392,15 @@ declare function CopilotPopupView({ header, width, height, clickOutsideToClose,
366
392
  declare namespace CopilotPopupView {
367
393
  var displayName: string;
368
394
  }
395
+ declare namespace CopilotPopupView {
396
+ /**
397
+ * Popup-specific welcome screen layout:
398
+ * - Welcome message centered vertically
399
+ * - Suggestions just above input
400
+ * - Input fixed at the bottom
401
+ */
402
+ const WelcomeScreen: React__default.FC<WelcomeScreenProps>;
403
+ }
369
404
 
370
405
  type CopilotSidebarProps = Omit<CopilotChatProps, "chatView"> & {
371
406
  header?: CopilotSidebarViewProps["header"];
@@ -701,6 +736,10 @@ interface CopilotKitProviderProps {
701
736
  children: ReactNode;
702
737
  runtimeUrl?: string;
703
738
  headers?: Record<string, string>;
739
+ /**
740
+ * Credentials mode for fetch requests (e.g., "include" for HTTP-only cookies in cross-origin requests).
741
+ */
742
+ credentials?: RequestCredentials;
704
743
  /**
705
744
  * The Copilot Cloud public API key.
706
745
  */