@copilotkitnext/react 0.0.11 → 0.0.13-alpha.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 +126 -7
- package/dist/index.d.ts +126 -7
- package/dist/index.js +987 -337
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +992 -368
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -2,8 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import * as React$1 from 'react';
|
|
3
3
|
import React__default, { ReactNode } from 'react';
|
|
4
4
|
import { AssistantMessage, Message, UserMessage, ToolCall, ToolMessage } from '@ag-ui/core';
|
|
5
|
+
import { Suggestion, ToolCallStatus, FrontendTool, DynamicSuggestionsConfig, StaticSuggestionsConfig, CopilotKitCore } from '@copilotkitnext/core';
|
|
5
6
|
import { z } from 'zod';
|
|
6
|
-
import { ToolCallStatus, FrontendTool, CopilotKitCore } from '@copilotkitnext/core';
|
|
7
7
|
import { AbstractAgent, Context } from '@ag-ui/client';
|
|
8
8
|
|
|
9
9
|
declare const CopilotChatDefaultLabels: {
|
|
@@ -23,21 +23,28 @@ declare const CopilotChatDefaultLabels: {
|
|
|
23
23
|
userMessageToolbarCopyMessageLabel: string;
|
|
24
24
|
userMessageToolbarEditMessageLabel: string;
|
|
25
25
|
chatDisclaimerText: string;
|
|
26
|
+
chatToggleOpenLabel: string;
|
|
27
|
+
chatToggleCloseLabel: string;
|
|
28
|
+
modalHeaderTitle: string;
|
|
26
29
|
};
|
|
27
30
|
type CopilotChatLabels = typeof CopilotChatDefaultLabels;
|
|
28
31
|
interface CopilotChatConfigurationValue {
|
|
29
32
|
labels: CopilotChatLabels;
|
|
30
33
|
agentId: string;
|
|
31
34
|
threadId: string;
|
|
35
|
+
isModalOpen: boolean;
|
|
36
|
+
setModalOpen: (open: boolean) => void;
|
|
37
|
+
isModalDefaultOpen: boolean;
|
|
32
38
|
}
|
|
33
39
|
interface CopilotChatConfigurationProviderProps {
|
|
34
40
|
children: ReactNode;
|
|
35
41
|
labels?: Partial<CopilotChatLabels>;
|
|
36
42
|
agentId?: string;
|
|
37
|
-
threadId
|
|
43
|
+
threadId?: string;
|
|
44
|
+
isModalDefaultOpen?: boolean;
|
|
38
45
|
}
|
|
39
46
|
declare const CopilotChatConfigurationProvider: React__default.FC<CopilotChatConfigurationProviderProps>;
|
|
40
|
-
declare const useCopilotChatConfiguration: () => CopilotChatConfigurationValue;
|
|
47
|
+
declare const useCopilotChatConfiguration: () => CopilotChatConfigurationValue | null;
|
|
41
48
|
|
|
42
49
|
/** Finite-state machine for every recorder implementation */
|
|
43
50
|
type AudioRecorderState = "idle" | "recording" | "processing";
|
|
@@ -204,6 +211,41 @@ declare namespace CopilotChatUserMessage {
|
|
|
204
211
|
}>;
|
|
205
212
|
}
|
|
206
213
|
|
|
214
|
+
interface CopilotChatSuggestionPillProps extends React__default.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
215
|
+
/** Optional icon to render on the left side when not loading. */
|
|
216
|
+
icon?: React__default.ReactNode;
|
|
217
|
+
/** Whether the pill should display a loading spinner. */
|
|
218
|
+
isLoading?: boolean;
|
|
219
|
+
}
|
|
220
|
+
declare const CopilotChatSuggestionPill: React__default.ForwardRefExoticComponent<CopilotChatSuggestionPillProps & React__default.RefAttributes<HTMLButtonElement>>;
|
|
221
|
+
|
|
222
|
+
declare const DefaultContainer: React__default.ForwardRefExoticComponent<React__default.HTMLAttributes<HTMLDivElement> & React__default.RefAttributes<HTMLDivElement>>;
|
|
223
|
+
type CopilotChatSuggestionViewProps = WithSlots<{
|
|
224
|
+
container: typeof DefaultContainer;
|
|
225
|
+
suggestion: typeof CopilotChatSuggestionPill;
|
|
226
|
+
}, {
|
|
227
|
+
suggestions: Suggestion[];
|
|
228
|
+
onSelectSuggestion?: (suggestion: Suggestion, index: number) => void;
|
|
229
|
+
loadingIndexes?: ReadonlyArray<number>;
|
|
230
|
+
} & React__default.HTMLAttributes<HTMLDivElement>>;
|
|
231
|
+
declare const CopilotChatSuggestionView: React__default.ForwardRefExoticComponent<{
|
|
232
|
+
container?: SlotValue<React__default.ForwardRefExoticComponent<React__default.HTMLAttributes<HTMLDivElement> & React__default.RefAttributes<HTMLDivElement>>> | undefined;
|
|
233
|
+
suggestion?: SlotValue<React__default.ForwardRefExoticComponent<CopilotChatSuggestionPillProps & React__default.RefAttributes<HTMLButtonElement>>> | undefined;
|
|
234
|
+
} & {
|
|
235
|
+
children?: ((props: {
|
|
236
|
+
container: React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>>;
|
|
237
|
+
suggestion: React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>>;
|
|
238
|
+
} & {
|
|
239
|
+
suggestions: Suggestion[];
|
|
240
|
+
onSelectSuggestion?: (suggestion: Suggestion, index: number) => void;
|
|
241
|
+
loadingIndexes?: ReadonlyArray<number>;
|
|
242
|
+
} & React__default.HTMLAttributes<HTMLDivElement>) => React__default.ReactNode) | undefined;
|
|
243
|
+
} & Omit<{
|
|
244
|
+
suggestions: Suggestion[];
|
|
245
|
+
onSelectSuggestion?: (suggestion: Suggestion, index: number) => void;
|
|
246
|
+
loadingIndexes?: ReadonlyArray<number>;
|
|
247
|
+
} & React__default.HTMLAttributes<HTMLDivElement>, "children"> & React__default.RefAttributes<HTMLDivElement>>;
|
|
248
|
+
|
|
207
249
|
type CopilotChatMessageViewProps = Omit<WithSlots<{
|
|
208
250
|
assistantMessage: typeof CopilotChatAssistantMessage;
|
|
209
251
|
userMessage: typeof CopilotChatUserMessage;
|
|
@@ -233,13 +275,17 @@ type CopilotChatViewProps = WithSlots<{
|
|
|
233
275
|
}>;
|
|
234
276
|
feather: React__default.FC<React__default.HTMLAttributes<HTMLDivElement>>;
|
|
235
277
|
disclaimer: React__default.FC<React__default.HTMLAttributes<HTMLDivElement>>;
|
|
278
|
+
suggestionView: typeof CopilotChatSuggestionView;
|
|
236
279
|
}, {
|
|
237
280
|
messages?: Message[];
|
|
238
281
|
autoScroll?: boolean;
|
|
239
282
|
inputProps?: Partial<Omit<CopilotChatInputProps, "children">>;
|
|
240
283
|
isRunning?: boolean;
|
|
284
|
+
suggestions?: Suggestion[];
|
|
285
|
+
suggestionLoadingIndexes?: ReadonlyArray<number>;
|
|
286
|
+
onSelectSuggestion?: (suggestion: Suggestion, index: number) => void;
|
|
241
287
|
} & React__default.HTMLAttributes<HTMLDivElement>>;
|
|
242
|
-
declare function CopilotChatView({ messageView, input, scrollView, scrollToBottomButton, feather, inputContainer, disclaimer, messages, autoScroll, inputProps, isRunning, 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;
|
|
288
|
+
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;
|
|
243
289
|
declare namespace CopilotChatView {
|
|
244
290
|
const ScrollView: React__default.FC<React__default.HTMLAttributes<HTMLDivElement> & {
|
|
245
291
|
autoScroll?: boolean;
|
|
@@ -255,11 +301,63 @@ declare namespace CopilotChatView {
|
|
|
255
301
|
const Disclaimer: React__default.FC<React__default.HTMLAttributes<HTMLDivElement>>;
|
|
256
302
|
}
|
|
257
303
|
|
|
258
|
-
type CopilotChatProps = Omit<CopilotChatViewProps, "messages"> & {
|
|
304
|
+
type CopilotChatProps = Omit<CopilotChatViewProps, "messages" | "isRunning" | "suggestions" | "suggestionLoadingIndexes" | "onSelectSuggestion"> & {
|
|
259
305
|
agentId?: string;
|
|
260
306
|
threadId?: string;
|
|
307
|
+
labels?: Partial<CopilotChatLabels>;
|
|
308
|
+
chatView?: SlotValue<typeof CopilotChatView>;
|
|
309
|
+
isModalDefaultOpen?: boolean;
|
|
261
310
|
};
|
|
262
|
-
declare function CopilotChat({ agentId, threadId, ...props }: CopilotChatProps): react_jsx_runtime.JSX.Element;
|
|
311
|
+
declare function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen, ...props }: CopilotChatProps): react_jsx_runtime.JSX.Element;
|
|
312
|
+
declare namespace CopilotChat {
|
|
313
|
+
const View: typeof CopilotChatView;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
declare const DefaultOpenIcon: React__default.FC<React__default.SVGProps<SVGSVGElement>>;
|
|
317
|
+
declare const DefaultCloseIcon: React__default.FC<React__default.SVGProps<SVGSVGElement>>;
|
|
318
|
+
interface CopilotChatToggleButtonProps extends Omit<React__default.ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
|
|
319
|
+
/** Optional slot override for the chat (closed) icon. */
|
|
320
|
+
openIcon?: SlotValue<typeof DefaultOpenIcon>;
|
|
321
|
+
/** Optional slot override for the close icon. */
|
|
322
|
+
closeIcon?: SlotValue<typeof DefaultCloseIcon>;
|
|
323
|
+
}
|
|
324
|
+
declare const CopilotChatToggleButton: React__default.ForwardRefExoticComponent<CopilotChatToggleButtonProps & React__default.RefAttributes<HTMLButtonElement>>;
|
|
325
|
+
|
|
326
|
+
type HeaderSlots = {
|
|
327
|
+
titleContent: typeof CopilotModalHeader.Title;
|
|
328
|
+
closeButton: typeof CopilotModalHeader.CloseButton;
|
|
329
|
+
};
|
|
330
|
+
type HeaderRestProps = {
|
|
331
|
+
title?: string;
|
|
332
|
+
} & Omit<React__default.HTMLAttributes<HTMLDivElement>, "children">;
|
|
333
|
+
type CopilotModalHeaderProps = WithSlots<HeaderSlots, HeaderRestProps>;
|
|
334
|
+
declare function CopilotModalHeader({ title, titleContent, closeButton, children, className, ...rest }: CopilotModalHeaderProps): 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;
|
|
335
|
+
declare namespace CopilotModalHeader {
|
|
336
|
+
var displayName: string;
|
|
337
|
+
}
|
|
338
|
+
declare namespace CopilotModalHeader {
|
|
339
|
+
const Title: React__default.FC<React__default.HTMLAttributes<HTMLDivElement>>;
|
|
340
|
+
const CloseButton: React__default.FC<React__default.ButtonHTMLAttributes<HTMLButtonElement>>;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
type CopilotSidebarViewProps = CopilotChatViewProps & {
|
|
344
|
+
header?: SlotValue<typeof CopilotModalHeader>;
|
|
345
|
+
width?: number | string;
|
|
346
|
+
};
|
|
347
|
+
declare function CopilotSidebarView({ header, width, ...props }: CopilotSidebarViewProps): react_jsx_runtime.JSX.Element;
|
|
348
|
+
declare namespace CopilotSidebarView {
|
|
349
|
+
var displayName: string;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
type CopilotSidebarProps = Omit<CopilotChatProps, "chatView"> & {
|
|
353
|
+
header?: CopilotSidebarViewProps["header"];
|
|
354
|
+
defaultOpen?: boolean;
|
|
355
|
+
width?: number | string;
|
|
356
|
+
};
|
|
357
|
+
declare function CopilotSidebar({ header, defaultOpen, width, ...chatProps }: CopilotSidebarProps): react_jsx_runtime.JSX.Element;
|
|
358
|
+
declare namespace CopilotSidebar {
|
|
359
|
+
var displayName: string;
|
|
360
|
+
}
|
|
263
361
|
|
|
264
362
|
declare const WildcardToolCallRender: ReactToolCallRender<any>;
|
|
265
363
|
|
|
@@ -349,6 +447,27 @@ declare function useAgent({ agentId, updates }?: UseAgentProps): {
|
|
|
349
447
|
|
|
350
448
|
declare function useAgentContext(context: Context): void;
|
|
351
449
|
|
|
450
|
+
interface UseSuggestionsOptions {
|
|
451
|
+
agentId?: string;
|
|
452
|
+
}
|
|
453
|
+
interface UseSuggestionsResult {
|
|
454
|
+
suggestions: Suggestion[];
|
|
455
|
+
reloadSuggestions: () => void;
|
|
456
|
+
clearSuggestions: () => void;
|
|
457
|
+
isLoading: boolean;
|
|
458
|
+
}
|
|
459
|
+
declare function useSuggestions({ agentId }?: UseSuggestionsOptions): UseSuggestionsResult;
|
|
460
|
+
|
|
461
|
+
type StaticSuggestionInput = Omit<Suggestion, "isLoading"> & Partial<Pick<Suggestion, "isLoading">>;
|
|
462
|
+
type StaticSuggestionsConfigInput = Omit<StaticSuggestionsConfig, "suggestions"> & {
|
|
463
|
+
suggestions: StaticSuggestionInput[];
|
|
464
|
+
};
|
|
465
|
+
type SuggestionsConfigInput = DynamicSuggestionsConfig | StaticSuggestionsConfigInput;
|
|
466
|
+
interface UseConfigureSuggestionsOptions {
|
|
467
|
+
deps?: ReadonlyArray<unknown>;
|
|
468
|
+
}
|
|
469
|
+
declare function useConfigureSuggestions(config: SuggestionsConfigInput | null | undefined, options?: UseConfigureSuggestionsOptions): void;
|
|
470
|
+
|
|
352
471
|
interface CopilotKitContextValue {
|
|
353
472
|
copilotkit: CopilotKitCore;
|
|
354
473
|
renderToolCalls: ReactToolCallRender<any>[];
|
|
@@ -403,4 +522,4 @@ declare function defineToolCallRender<S extends z.ZodTypeAny>(def: {
|
|
|
403
522
|
agentId?: string;
|
|
404
523
|
}): ReactToolCallRender<z.infer<S>>;
|
|
405
524
|
|
|
406
|
-
export { AudioRecorderError, type AudioRecorderState, CopilotChat, CopilotChatAssistantMessage, type CopilotChatAssistantMessageProps, CopilotChatAudioRecorder, CopilotChatConfigurationProvider, type CopilotChatConfigurationProviderProps, type CopilotChatConfigurationValue, CopilotChatInput, type CopilotChatInputProps, type CopilotChatLabels, CopilotChatMessageView, type CopilotChatMessageViewProps, type CopilotChatProps, CopilotChatToolCallsView, type CopilotChatToolCallsViewProps, CopilotChatUserMessage, type CopilotChatUserMessageProps, CopilotChatView, type CopilotChatViewProps, type CopilotKitContextValue, CopilotKitProvider, type CopilotKitProviderProps, type ReactFrontendTool, type ReactHumanInTheLoop, type ReactToolCallRender, type ToolsMenuItem, WildcardToolCallRender, defineToolCallRender, useAgent, useAgentContext, useCopilotChatConfiguration, useCopilotKit, useFrontendTool, useHumanInTheLoop, useRenderToolCall };
|
|
525
|
+
export { AudioRecorderError, type AudioRecorderState, CopilotChat, CopilotChatAssistantMessage, type CopilotChatAssistantMessageProps, CopilotChatAudioRecorder, CopilotChatConfigurationProvider, type CopilotChatConfigurationProviderProps, type CopilotChatConfigurationValue, CopilotChatInput, type CopilotChatInputProps, type CopilotChatLabels, CopilotChatMessageView, type CopilotChatMessageViewProps, type CopilotChatProps, CopilotChatSuggestionPill, type CopilotChatSuggestionPillProps, CopilotChatSuggestionView, type CopilotChatSuggestionViewProps, CopilotChatToggleButton, DefaultCloseIcon as CopilotChatToggleButtonCloseIcon, DefaultOpenIcon as CopilotChatToggleButtonOpenIcon, type CopilotChatToggleButtonProps, CopilotChatToolCallsView, type CopilotChatToolCallsViewProps, CopilotChatUserMessage, type CopilotChatUserMessageProps, CopilotChatView, type CopilotChatViewProps, type CopilotKitContextValue, CopilotKitProvider, type CopilotKitProviderProps, CopilotModalHeader, type CopilotModalHeaderProps, CopilotSidebar, type CopilotSidebarProps, CopilotSidebarView, type CopilotSidebarViewProps, type ReactFrontendTool, type ReactHumanInTheLoop, type ReactToolCallRender, type ToolsMenuItem, WildcardToolCallRender, defineToolCallRender, useAgent, useAgentContext, useConfigureSuggestions, useCopilotChatConfiguration, useCopilotKit, useFrontendTool, useHumanInTheLoop, useRenderToolCall, useSuggestions };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import * as React$1 from 'react';
|
|
3
3
|
import React__default, { ReactNode } from 'react';
|
|
4
4
|
import { AssistantMessage, Message, UserMessage, ToolCall, ToolMessage } from '@ag-ui/core';
|
|
5
|
+
import { Suggestion, ToolCallStatus, FrontendTool, DynamicSuggestionsConfig, StaticSuggestionsConfig, CopilotKitCore } from '@copilotkitnext/core';
|
|
5
6
|
import { z } from 'zod';
|
|
6
|
-
import { ToolCallStatus, FrontendTool, CopilotKitCore } from '@copilotkitnext/core';
|
|
7
7
|
import { AbstractAgent, Context } from '@ag-ui/client';
|
|
8
8
|
|
|
9
9
|
declare const CopilotChatDefaultLabels: {
|
|
@@ -23,21 +23,28 @@ declare const CopilotChatDefaultLabels: {
|
|
|
23
23
|
userMessageToolbarCopyMessageLabel: string;
|
|
24
24
|
userMessageToolbarEditMessageLabel: string;
|
|
25
25
|
chatDisclaimerText: string;
|
|
26
|
+
chatToggleOpenLabel: string;
|
|
27
|
+
chatToggleCloseLabel: string;
|
|
28
|
+
modalHeaderTitle: string;
|
|
26
29
|
};
|
|
27
30
|
type CopilotChatLabels = typeof CopilotChatDefaultLabels;
|
|
28
31
|
interface CopilotChatConfigurationValue {
|
|
29
32
|
labels: CopilotChatLabels;
|
|
30
33
|
agentId: string;
|
|
31
34
|
threadId: string;
|
|
35
|
+
isModalOpen: boolean;
|
|
36
|
+
setModalOpen: (open: boolean) => void;
|
|
37
|
+
isModalDefaultOpen: boolean;
|
|
32
38
|
}
|
|
33
39
|
interface CopilotChatConfigurationProviderProps {
|
|
34
40
|
children: ReactNode;
|
|
35
41
|
labels?: Partial<CopilotChatLabels>;
|
|
36
42
|
agentId?: string;
|
|
37
|
-
threadId
|
|
43
|
+
threadId?: string;
|
|
44
|
+
isModalDefaultOpen?: boolean;
|
|
38
45
|
}
|
|
39
46
|
declare const CopilotChatConfigurationProvider: React__default.FC<CopilotChatConfigurationProviderProps>;
|
|
40
|
-
declare const useCopilotChatConfiguration: () => CopilotChatConfigurationValue;
|
|
47
|
+
declare const useCopilotChatConfiguration: () => CopilotChatConfigurationValue | null;
|
|
41
48
|
|
|
42
49
|
/** Finite-state machine for every recorder implementation */
|
|
43
50
|
type AudioRecorderState = "idle" | "recording" | "processing";
|
|
@@ -204,6 +211,41 @@ declare namespace CopilotChatUserMessage {
|
|
|
204
211
|
}>;
|
|
205
212
|
}
|
|
206
213
|
|
|
214
|
+
interface CopilotChatSuggestionPillProps extends React__default.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
215
|
+
/** Optional icon to render on the left side when not loading. */
|
|
216
|
+
icon?: React__default.ReactNode;
|
|
217
|
+
/** Whether the pill should display a loading spinner. */
|
|
218
|
+
isLoading?: boolean;
|
|
219
|
+
}
|
|
220
|
+
declare const CopilotChatSuggestionPill: React__default.ForwardRefExoticComponent<CopilotChatSuggestionPillProps & React__default.RefAttributes<HTMLButtonElement>>;
|
|
221
|
+
|
|
222
|
+
declare const DefaultContainer: React__default.ForwardRefExoticComponent<React__default.HTMLAttributes<HTMLDivElement> & React__default.RefAttributes<HTMLDivElement>>;
|
|
223
|
+
type CopilotChatSuggestionViewProps = WithSlots<{
|
|
224
|
+
container: typeof DefaultContainer;
|
|
225
|
+
suggestion: typeof CopilotChatSuggestionPill;
|
|
226
|
+
}, {
|
|
227
|
+
suggestions: Suggestion[];
|
|
228
|
+
onSelectSuggestion?: (suggestion: Suggestion, index: number) => void;
|
|
229
|
+
loadingIndexes?: ReadonlyArray<number>;
|
|
230
|
+
} & React__default.HTMLAttributes<HTMLDivElement>>;
|
|
231
|
+
declare const CopilotChatSuggestionView: React__default.ForwardRefExoticComponent<{
|
|
232
|
+
container?: SlotValue<React__default.ForwardRefExoticComponent<React__default.HTMLAttributes<HTMLDivElement> & React__default.RefAttributes<HTMLDivElement>>> | undefined;
|
|
233
|
+
suggestion?: SlotValue<React__default.ForwardRefExoticComponent<CopilotChatSuggestionPillProps & React__default.RefAttributes<HTMLButtonElement>>> | undefined;
|
|
234
|
+
} & {
|
|
235
|
+
children?: ((props: {
|
|
236
|
+
container: React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>>;
|
|
237
|
+
suggestion: React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>>;
|
|
238
|
+
} & {
|
|
239
|
+
suggestions: Suggestion[];
|
|
240
|
+
onSelectSuggestion?: (suggestion: Suggestion, index: number) => void;
|
|
241
|
+
loadingIndexes?: ReadonlyArray<number>;
|
|
242
|
+
} & React__default.HTMLAttributes<HTMLDivElement>) => React__default.ReactNode) | undefined;
|
|
243
|
+
} & Omit<{
|
|
244
|
+
suggestions: Suggestion[];
|
|
245
|
+
onSelectSuggestion?: (suggestion: Suggestion, index: number) => void;
|
|
246
|
+
loadingIndexes?: ReadonlyArray<number>;
|
|
247
|
+
} & React__default.HTMLAttributes<HTMLDivElement>, "children"> & React__default.RefAttributes<HTMLDivElement>>;
|
|
248
|
+
|
|
207
249
|
type CopilotChatMessageViewProps = Omit<WithSlots<{
|
|
208
250
|
assistantMessage: typeof CopilotChatAssistantMessage;
|
|
209
251
|
userMessage: typeof CopilotChatUserMessage;
|
|
@@ -233,13 +275,17 @@ type CopilotChatViewProps = WithSlots<{
|
|
|
233
275
|
}>;
|
|
234
276
|
feather: React__default.FC<React__default.HTMLAttributes<HTMLDivElement>>;
|
|
235
277
|
disclaimer: React__default.FC<React__default.HTMLAttributes<HTMLDivElement>>;
|
|
278
|
+
suggestionView: typeof CopilotChatSuggestionView;
|
|
236
279
|
}, {
|
|
237
280
|
messages?: Message[];
|
|
238
281
|
autoScroll?: boolean;
|
|
239
282
|
inputProps?: Partial<Omit<CopilotChatInputProps, "children">>;
|
|
240
283
|
isRunning?: boolean;
|
|
284
|
+
suggestions?: Suggestion[];
|
|
285
|
+
suggestionLoadingIndexes?: ReadonlyArray<number>;
|
|
286
|
+
onSelectSuggestion?: (suggestion: Suggestion, index: number) => void;
|
|
241
287
|
} & React__default.HTMLAttributes<HTMLDivElement>>;
|
|
242
|
-
declare function CopilotChatView({ messageView, input, scrollView, scrollToBottomButton, feather, inputContainer, disclaimer, messages, autoScroll, inputProps, isRunning, 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;
|
|
288
|
+
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;
|
|
243
289
|
declare namespace CopilotChatView {
|
|
244
290
|
const ScrollView: React__default.FC<React__default.HTMLAttributes<HTMLDivElement> & {
|
|
245
291
|
autoScroll?: boolean;
|
|
@@ -255,11 +301,63 @@ declare namespace CopilotChatView {
|
|
|
255
301
|
const Disclaimer: React__default.FC<React__default.HTMLAttributes<HTMLDivElement>>;
|
|
256
302
|
}
|
|
257
303
|
|
|
258
|
-
type CopilotChatProps = Omit<CopilotChatViewProps, "messages"> & {
|
|
304
|
+
type CopilotChatProps = Omit<CopilotChatViewProps, "messages" | "isRunning" | "suggestions" | "suggestionLoadingIndexes" | "onSelectSuggestion"> & {
|
|
259
305
|
agentId?: string;
|
|
260
306
|
threadId?: string;
|
|
307
|
+
labels?: Partial<CopilotChatLabels>;
|
|
308
|
+
chatView?: SlotValue<typeof CopilotChatView>;
|
|
309
|
+
isModalDefaultOpen?: boolean;
|
|
261
310
|
};
|
|
262
|
-
declare function CopilotChat({ agentId, threadId, ...props }: CopilotChatProps): react_jsx_runtime.JSX.Element;
|
|
311
|
+
declare function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen, ...props }: CopilotChatProps): react_jsx_runtime.JSX.Element;
|
|
312
|
+
declare namespace CopilotChat {
|
|
313
|
+
const View: typeof CopilotChatView;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
declare const DefaultOpenIcon: React__default.FC<React__default.SVGProps<SVGSVGElement>>;
|
|
317
|
+
declare const DefaultCloseIcon: React__default.FC<React__default.SVGProps<SVGSVGElement>>;
|
|
318
|
+
interface CopilotChatToggleButtonProps extends Omit<React__default.ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
|
|
319
|
+
/** Optional slot override for the chat (closed) icon. */
|
|
320
|
+
openIcon?: SlotValue<typeof DefaultOpenIcon>;
|
|
321
|
+
/** Optional slot override for the close icon. */
|
|
322
|
+
closeIcon?: SlotValue<typeof DefaultCloseIcon>;
|
|
323
|
+
}
|
|
324
|
+
declare const CopilotChatToggleButton: React__default.ForwardRefExoticComponent<CopilotChatToggleButtonProps & React__default.RefAttributes<HTMLButtonElement>>;
|
|
325
|
+
|
|
326
|
+
type HeaderSlots = {
|
|
327
|
+
titleContent: typeof CopilotModalHeader.Title;
|
|
328
|
+
closeButton: typeof CopilotModalHeader.CloseButton;
|
|
329
|
+
};
|
|
330
|
+
type HeaderRestProps = {
|
|
331
|
+
title?: string;
|
|
332
|
+
} & Omit<React__default.HTMLAttributes<HTMLDivElement>, "children">;
|
|
333
|
+
type CopilotModalHeaderProps = WithSlots<HeaderSlots, HeaderRestProps>;
|
|
334
|
+
declare function CopilotModalHeader({ title, titleContent, closeButton, children, className, ...rest }: CopilotModalHeaderProps): 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;
|
|
335
|
+
declare namespace CopilotModalHeader {
|
|
336
|
+
var displayName: string;
|
|
337
|
+
}
|
|
338
|
+
declare namespace CopilotModalHeader {
|
|
339
|
+
const Title: React__default.FC<React__default.HTMLAttributes<HTMLDivElement>>;
|
|
340
|
+
const CloseButton: React__default.FC<React__default.ButtonHTMLAttributes<HTMLButtonElement>>;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
type CopilotSidebarViewProps = CopilotChatViewProps & {
|
|
344
|
+
header?: SlotValue<typeof CopilotModalHeader>;
|
|
345
|
+
width?: number | string;
|
|
346
|
+
};
|
|
347
|
+
declare function CopilotSidebarView({ header, width, ...props }: CopilotSidebarViewProps): react_jsx_runtime.JSX.Element;
|
|
348
|
+
declare namespace CopilotSidebarView {
|
|
349
|
+
var displayName: string;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
type CopilotSidebarProps = Omit<CopilotChatProps, "chatView"> & {
|
|
353
|
+
header?: CopilotSidebarViewProps["header"];
|
|
354
|
+
defaultOpen?: boolean;
|
|
355
|
+
width?: number | string;
|
|
356
|
+
};
|
|
357
|
+
declare function CopilotSidebar({ header, defaultOpen, width, ...chatProps }: CopilotSidebarProps): react_jsx_runtime.JSX.Element;
|
|
358
|
+
declare namespace CopilotSidebar {
|
|
359
|
+
var displayName: string;
|
|
360
|
+
}
|
|
263
361
|
|
|
264
362
|
declare const WildcardToolCallRender: ReactToolCallRender<any>;
|
|
265
363
|
|
|
@@ -349,6 +447,27 @@ declare function useAgent({ agentId, updates }?: UseAgentProps): {
|
|
|
349
447
|
|
|
350
448
|
declare function useAgentContext(context: Context): void;
|
|
351
449
|
|
|
450
|
+
interface UseSuggestionsOptions {
|
|
451
|
+
agentId?: string;
|
|
452
|
+
}
|
|
453
|
+
interface UseSuggestionsResult {
|
|
454
|
+
suggestions: Suggestion[];
|
|
455
|
+
reloadSuggestions: () => void;
|
|
456
|
+
clearSuggestions: () => void;
|
|
457
|
+
isLoading: boolean;
|
|
458
|
+
}
|
|
459
|
+
declare function useSuggestions({ agentId }?: UseSuggestionsOptions): UseSuggestionsResult;
|
|
460
|
+
|
|
461
|
+
type StaticSuggestionInput = Omit<Suggestion, "isLoading"> & Partial<Pick<Suggestion, "isLoading">>;
|
|
462
|
+
type StaticSuggestionsConfigInput = Omit<StaticSuggestionsConfig, "suggestions"> & {
|
|
463
|
+
suggestions: StaticSuggestionInput[];
|
|
464
|
+
};
|
|
465
|
+
type SuggestionsConfigInput = DynamicSuggestionsConfig | StaticSuggestionsConfigInput;
|
|
466
|
+
interface UseConfigureSuggestionsOptions {
|
|
467
|
+
deps?: ReadonlyArray<unknown>;
|
|
468
|
+
}
|
|
469
|
+
declare function useConfigureSuggestions(config: SuggestionsConfigInput | null | undefined, options?: UseConfigureSuggestionsOptions): void;
|
|
470
|
+
|
|
352
471
|
interface CopilotKitContextValue {
|
|
353
472
|
copilotkit: CopilotKitCore;
|
|
354
473
|
renderToolCalls: ReactToolCallRender<any>[];
|
|
@@ -403,4 +522,4 @@ declare function defineToolCallRender<S extends z.ZodTypeAny>(def: {
|
|
|
403
522
|
agentId?: string;
|
|
404
523
|
}): ReactToolCallRender<z.infer<S>>;
|
|
405
524
|
|
|
406
|
-
export { AudioRecorderError, type AudioRecorderState, CopilotChat, CopilotChatAssistantMessage, type CopilotChatAssistantMessageProps, CopilotChatAudioRecorder, CopilotChatConfigurationProvider, type CopilotChatConfigurationProviderProps, type CopilotChatConfigurationValue, CopilotChatInput, type CopilotChatInputProps, type CopilotChatLabels, CopilotChatMessageView, type CopilotChatMessageViewProps, type CopilotChatProps, CopilotChatToolCallsView, type CopilotChatToolCallsViewProps, CopilotChatUserMessage, type CopilotChatUserMessageProps, CopilotChatView, type CopilotChatViewProps, type CopilotKitContextValue, CopilotKitProvider, type CopilotKitProviderProps, type ReactFrontendTool, type ReactHumanInTheLoop, type ReactToolCallRender, type ToolsMenuItem, WildcardToolCallRender, defineToolCallRender, useAgent, useAgentContext, useCopilotChatConfiguration, useCopilotKit, useFrontendTool, useHumanInTheLoop, useRenderToolCall };
|
|
525
|
+
export { AudioRecorderError, type AudioRecorderState, CopilotChat, CopilotChatAssistantMessage, type CopilotChatAssistantMessageProps, CopilotChatAudioRecorder, CopilotChatConfigurationProvider, type CopilotChatConfigurationProviderProps, type CopilotChatConfigurationValue, CopilotChatInput, type CopilotChatInputProps, type CopilotChatLabels, CopilotChatMessageView, type CopilotChatMessageViewProps, type CopilotChatProps, CopilotChatSuggestionPill, type CopilotChatSuggestionPillProps, CopilotChatSuggestionView, type CopilotChatSuggestionViewProps, CopilotChatToggleButton, DefaultCloseIcon as CopilotChatToggleButtonCloseIcon, DefaultOpenIcon as CopilotChatToggleButtonOpenIcon, type CopilotChatToggleButtonProps, CopilotChatToolCallsView, type CopilotChatToolCallsViewProps, CopilotChatUserMessage, type CopilotChatUserMessageProps, CopilotChatView, type CopilotChatViewProps, type CopilotKitContextValue, CopilotKitProvider, type CopilotKitProviderProps, CopilotModalHeader, type CopilotModalHeaderProps, CopilotSidebar, type CopilotSidebarProps, CopilotSidebarView, type CopilotSidebarViewProps, type ReactFrontendTool, type ReactHumanInTheLoop, type ReactToolCallRender, type ToolsMenuItem, WildcardToolCallRender, defineToolCallRender, useAgent, useAgentContext, useConfigureSuggestions, useCopilotChatConfiguration, useCopilotKit, useFrontendTool, useHumanInTheLoop, useRenderToolCall, useSuggestions };
|