@copilotkitnext/react 0.0.20 → 0.0.21-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 +33 -2
- package/dist/index.d.ts +33 -2
- package/dist/index.js +326 -240
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +223 -138
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
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
|
-
import { AssistantMessage, Message, UserMessage, ToolCall, ToolMessage } from '@ag-ui/core';
|
|
4
|
+
import { AssistantMessage, Message, UserMessage, ToolCall, ToolMessage, ActivityMessage } from '@ag-ui/core';
|
|
5
5
|
import { Streamdown } from 'streamdown';
|
|
6
6
|
import { Suggestion, CopilotKitCore, ToolCallStatus, FrontendTool, DynamicSuggestionsConfig, StaticSuggestionsConfig, CopilotKitCoreConfig, CopilotKitCoreSubscriber } from '@copilotkitnext/core';
|
|
7
7
|
import { z } from 'zod';
|
|
@@ -432,6 +432,8 @@ interface UseRenderCustomMessagesParams {
|
|
|
432
432
|
}
|
|
433
433
|
declare function useRenderCustomMessages(): ((params: UseRenderCustomMessagesParams) => react_jsx_runtime.JSX.Element | null) | null;
|
|
434
434
|
|
|
435
|
+
declare function useRenderActivityMessage(): (message: ActivityMessage) => React.ReactElement | null;
|
|
436
|
+
|
|
435
437
|
interface ReactToolCallRenderer<T> {
|
|
436
438
|
name: string;
|
|
437
439
|
args: z.ZodSchema<T>;
|
|
@@ -527,6 +529,30 @@ interface UseConfigureSuggestionsOptions {
|
|
|
527
529
|
}
|
|
528
530
|
declare function useConfigureSuggestions(config: SuggestionsConfigInput | null | undefined, options?: UseConfigureSuggestionsOptions): void;
|
|
529
531
|
|
|
532
|
+
interface ReactActivityMessageRenderer<TActivityContent> {
|
|
533
|
+
/**
|
|
534
|
+
* Activity type to match when rendering. Use "*" as a wildcard renderer.
|
|
535
|
+
*/
|
|
536
|
+
activityType: string;
|
|
537
|
+
/**
|
|
538
|
+
* Optional agent ID to scope the renderer to a particular agent.
|
|
539
|
+
*/
|
|
540
|
+
agentId?: string;
|
|
541
|
+
/**
|
|
542
|
+
* Schema describing the activity content payload.
|
|
543
|
+
*/
|
|
544
|
+
content: z.ZodSchema<TActivityContent>;
|
|
545
|
+
/**
|
|
546
|
+
* React component invoked to render the activity message.
|
|
547
|
+
*/
|
|
548
|
+
render: React.ComponentType<{
|
|
549
|
+
activityType: string;
|
|
550
|
+
content: TActivityContent;
|
|
551
|
+
message: ActivityMessage;
|
|
552
|
+
agent: AbstractAgent | undefined;
|
|
553
|
+
}>;
|
|
554
|
+
}
|
|
555
|
+
|
|
530
556
|
/**
|
|
531
557
|
* Helper to define a type-safe tool call renderer entry.
|
|
532
558
|
* - Accepts a single object whose keys match ReactToolCallRenderer's fields: { name, args, render, agentId? }.
|
|
@@ -564,6 +590,7 @@ declare function defineToolCallRenderer<S extends z.ZodTypeAny>(def: {
|
|
|
564
590
|
|
|
565
591
|
interface CopilotKitCoreReactConfig extends CopilotKitCoreConfig {
|
|
566
592
|
renderToolCalls?: ReactToolCallRenderer<any>[];
|
|
593
|
+
renderActivityMessages?: ReactActivityMessageRenderer<any>[];
|
|
567
594
|
renderCustomMessages?: ReactCustomMessageRenderer[];
|
|
568
595
|
}
|
|
569
596
|
interface CopilotKitCoreReactSubscriber extends CopilotKitCoreSubscriber {
|
|
@@ -575,8 +602,10 @@ interface CopilotKitCoreReactSubscriber extends CopilotKitCoreSubscriber {
|
|
|
575
602
|
declare class CopilotKitCoreReact extends CopilotKitCore {
|
|
576
603
|
private _renderToolCalls;
|
|
577
604
|
private _renderCustomMessages;
|
|
605
|
+
private _renderActivityMessages;
|
|
578
606
|
constructor(config: CopilotKitCoreReactConfig);
|
|
579
607
|
get renderCustomMessages(): Readonly<ReactCustomMessageRenderer[]>;
|
|
608
|
+
get renderActivityMessages(): Readonly<ReactActivityMessageRenderer<any>>[];
|
|
580
609
|
get renderToolCalls(): Readonly<ReactToolCallRenderer<any>>[];
|
|
581
610
|
setRenderToolCalls(renderToolCalls: ReactToolCallRenderer<any>[]): void;
|
|
582
611
|
subscribe(subscriber: CopilotKitCoreReactSubscriber): () => void;
|
|
@@ -591,8 +620,10 @@ interface CopilotKitProviderProps {
|
|
|
591
620
|
runtimeUrl?: string;
|
|
592
621
|
headers?: Record<string, string>;
|
|
593
622
|
properties?: Record<string, unknown>;
|
|
623
|
+
useSingleEndpoint?: boolean;
|
|
594
624
|
agents__unsafe_dev_only?: Record<string, AbstractAgent>;
|
|
595
625
|
renderToolCalls?: ReactToolCallRenderer<any>[];
|
|
626
|
+
renderActivityMessages?: ReactActivityMessageRenderer<any>[];
|
|
596
627
|
renderCustomMessages?: ReactCustomMessageRenderer[];
|
|
597
628
|
frontendTools?: ReactFrontendTool[];
|
|
598
629
|
humanInTheLoop?: ReactHumanInTheLoop[];
|
|
@@ -601,4 +632,4 @@ interface CopilotKitProviderProps {
|
|
|
601
632
|
declare const CopilotKitProvider: React__default.FC<CopilotKitProviderProps>;
|
|
602
633
|
declare const useCopilotKit: () => CopilotKitContextValue;
|
|
603
634
|
|
|
604
|
-
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, CopilotKitCoreReact, type CopilotKitCoreReactConfig, type CopilotKitCoreReactSubscriber, CopilotKitInspector, type CopilotKitInspectorBaseProps, type CopilotKitInspectorProps, CopilotKitProvider, type CopilotKitProviderProps, CopilotModalHeader, type CopilotModalHeaderProps, CopilotPopup, type CopilotPopupProps, CopilotPopupView, type CopilotPopupViewProps, CopilotSidebar, type CopilotSidebarProps, CopilotSidebarView, type CopilotSidebarViewProps, type ReactCustomMessageRenderer, type ReactCustomMessageRendererPosition, type ReactFrontendTool, type ReactHumanInTheLoop, type ReactToolCallRenderer, type ToolsMenuItem, WildcardToolCallRender, defineToolCallRenderer, useAgent, useAgentContext, useConfigureSuggestions, useCopilotChatConfiguration, useCopilotKit, useFrontendTool, useHumanInTheLoop, useRenderCustomMessages, useRenderToolCall, useSuggestions };
|
|
635
|
+
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, CopilotKitCoreReact, type CopilotKitCoreReactConfig, type CopilotKitCoreReactSubscriber, CopilotKitInspector, type CopilotKitInspectorBaseProps, type CopilotKitInspectorProps, CopilotKitProvider, type CopilotKitProviderProps, CopilotModalHeader, type CopilotModalHeaderProps, CopilotPopup, type CopilotPopupProps, CopilotPopupView, type CopilotPopupViewProps, CopilotSidebar, type CopilotSidebarProps, CopilotSidebarView, type CopilotSidebarViewProps, type ReactActivityMessageRenderer, type ReactCustomMessageRenderer, type ReactCustomMessageRendererPosition, type ReactFrontendTool, type ReactHumanInTheLoop, type ReactToolCallRenderer, type ToolsMenuItem, WildcardToolCallRender, defineToolCallRenderer, useAgent, useAgentContext, useConfigureSuggestions, useCopilotChatConfiguration, useCopilotKit, useFrontendTool, useHumanInTheLoop, useRenderActivityMessage, useRenderCustomMessages, useRenderToolCall, useSuggestions };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
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
|
-
import { AssistantMessage, Message, UserMessage, ToolCall, ToolMessage } from '@ag-ui/core';
|
|
4
|
+
import { AssistantMessage, Message, UserMessage, ToolCall, ToolMessage, ActivityMessage } from '@ag-ui/core';
|
|
5
5
|
import { Streamdown } from 'streamdown';
|
|
6
6
|
import { Suggestion, CopilotKitCore, ToolCallStatus, FrontendTool, DynamicSuggestionsConfig, StaticSuggestionsConfig, CopilotKitCoreConfig, CopilotKitCoreSubscriber } from '@copilotkitnext/core';
|
|
7
7
|
import { z } from 'zod';
|
|
@@ -432,6 +432,8 @@ interface UseRenderCustomMessagesParams {
|
|
|
432
432
|
}
|
|
433
433
|
declare function useRenderCustomMessages(): ((params: UseRenderCustomMessagesParams) => react_jsx_runtime.JSX.Element | null) | null;
|
|
434
434
|
|
|
435
|
+
declare function useRenderActivityMessage(): (message: ActivityMessage) => React.ReactElement | null;
|
|
436
|
+
|
|
435
437
|
interface ReactToolCallRenderer<T> {
|
|
436
438
|
name: string;
|
|
437
439
|
args: z.ZodSchema<T>;
|
|
@@ -527,6 +529,30 @@ interface UseConfigureSuggestionsOptions {
|
|
|
527
529
|
}
|
|
528
530
|
declare function useConfigureSuggestions(config: SuggestionsConfigInput | null | undefined, options?: UseConfigureSuggestionsOptions): void;
|
|
529
531
|
|
|
532
|
+
interface ReactActivityMessageRenderer<TActivityContent> {
|
|
533
|
+
/**
|
|
534
|
+
* Activity type to match when rendering. Use "*" as a wildcard renderer.
|
|
535
|
+
*/
|
|
536
|
+
activityType: string;
|
|
537
|
+
/**
|
|
538
|
+
* Optional agent ID to scope the renderer to a particular agent.
|
|
539
|
+
*/
|
|
540
|
+
agentId?: string;
|
|
541
|
+
/**
|
|
542
|
+
* Schema describing the activity content payload.
|
|
543
|
+
*/
|
|
544
|
+
content: z.ZodSchema<TActivityContent>;
|
|
545
|
+
/**
|
|
546
|
+
* React component invoked to render the activity message.
|
|
547
|
+
*/
|
|
548
|
+
render: React.ComponentType<{
|
|
549
|
+
activityType: string;
|
|
550
|
+
content: TActivityContent;
|
|
551
|
+
message: ActivityMessage;
|
|
552
|
+
agent: AbstractAgent | undefined;
|
|
553
|
+
}>;
|
|
554
|
+
}
|
|
555
|
+
|
|
530
556
|
/**
|
|
531
557
|
* Helper to define a type-safe tool call renderer entry.
|
|
532
558
|
* - Accepts a single object whose keys match ReactToolCallRenderer's fields: { name, args, render, agentId? }.
|
|
@@ -564,6 +590,7 @@ declare function defineToolCallRenderer<S extends z.ZodTypeAny>(def: {
|
|
|
564
590
|
|
|
565
591
|
interface CopilotKitCoreReactConfig extends CopilotKitCoreConfig {
|
|
566
592
|
renderToolCalls?: ReactToolCallRenderer<any>[];
|
|
593
|
+
renderActivityMessages?: ReactActivityMessageRenderer<any>[];
|
|
567
594
|
renderCustomMessages?: ReactCustomMessageRenderer[];
|
|
568
595
|
}
|
|
569
596
|
interface CopilotKitCoreReactSubscriber extends CopilotKitCoreSubscriber {
|
|
@@ -575,8 +602,10 @@ interface CopilotKitCoreReactSubscriber extends CopilotKitCoreSubscriber {
|
|
|
575
602
|
declare class CopilotKitCoreReact extends CopilotKitCore {
|
|
576
603
|
private _renderToolCalls;
|
|
577
604
|
private _renderCustomMessages;
|
|
605
|
+
private _renderActivityMessages;
|
|
578
606
|
constructor(config: CopilotKitCoreReactConfig);
|
|
579
607
|
get renderCustomMessages(): Readonly<ReactCustomMessageRenderer[]>;
|
|
608
|
+
get renderActivityMessages(): Readonly<ReactActivityMessageRenderer<any>>[];
|
|
580
609
|
get renderToolCalls(): Readonly<ReactToolCallRenderer<any>>[];
|
|
581
610
|
setRenderToolCalls(renderToolCalls: ReactToolCallRenderer<any>[]): void;
|
|
582
611
|
subscribe(subscriber: CopilotKitCoreReactSubscriber): () => void;
|
|
@@ -591,8 +620,10 @@ interface CopilotKitProviderProps {
|
|
|
591
620
|
runtimeUrl?: string;
|
|
592
621
|
headers?: Record<string, string>;
|
|
593
622
|
properties?: Record<string, unknown>;
|
|
623
|
+
useSingleEndpoint?: boolean;
|
|
594
624
|
agents__unsafe_dev_only?: Record<string, AbstractAgent>;
|
|
595
625
|
renderToolCalls?: ReactToolCallRenderer<any>[];
|
|
626
|
+
renderActivityMessages?: ReactActivityMessageRenderer<any>[];
|
|
596
627
|
renderCustomMessages?: ReactCustomMessageRenderer[];
|
|
597
628
|
frontendTools?: ReactFrontendTool[];
|
|
598
629
|
humanInTheLoop?: ReactHumanInTheLoop[];
|
|
@@ -601,4 +632,4 @@ interface CopilotKitProviderProps {
|
|
|
601
632
|
declare const CopilotKitProvider: React__default.FC<CopilotKitProviderProps>;
|
|
602
633
|
declare const useCopilotKit: () => CopilotKitContextValue;
|
|
603
634
|
|
|
604
|
-
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, CopilotKitCoreReact, type CopilotKitCoreReactConfig, type CopilotKitCoreReactSubscriber, CopilotKitInspector, type CopilotKitInspectorBaseProps, type CopilotKitInspectorProps, CopilotKitProvider, type CopilotKitProviderProps, CopilotModalHeader, type CopilotModalHeaderProps, CopilotPopup, type CopilotPopupProps, CopilotPopupView, type CopilotPopupViewProps, CopilotSidebar, type CopilotSidebarProps, CopilotSidebarView, type CopilotSidebarViewProps, type ReactCustomMessageRenderer, type ReactCustomMessageRendererPosition, type ReactFrontendTool, type ReactHumanInTheLoop, type ReactToolCallRenderer, type ToolsMenuItem, WildcardToolCallRender, defineToolCallRenderer, useAgent, useAgentContext, useConfigureSuggestions, useCopilotChatConfiguration, useCopilotKit, useFrontendTool, useHumanInTheLoop, useRenderCustomMessages, useRenderToolCall, useSuggestions };
|
|
635
|
+
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, CopilotKitCoreReact, type CopilotKitCoreReactConfig, type CopilotKitCoreReactSubscriber, CopilotKitInspector, type CopilotKitInspectorBaseProps, type CopilotKitInspectorProps, CopilotKitProvider, type CopilotKitProviderProps, CopilotModalHeader, type CopilotModalHeaderProps, CopilotPopup, type CopilotPopupProps, CopilotPopupView, type CopilotPopupViewProps, CopilotSidebar, type CopilotSidebarProps, CopilotSidebarView, type CopilotSidebarViewProps, type ReactActivityMessageRenderer, type ReactCustomMessageRenderer, type ReactCustomMessageRendererPosition, type ReactFrontendTool, type ReactHumanInTheLoop, type ReactToolCallRenderer, type ToolsMenuItem, WildcardToolCallRender, defineToolCallRenderer, useAgent, useAgentContext, useConfigureSuggestions, useCopilotChatConfiguration, useCopilotKit, useFrontendTool, useHumanInTheLoop, useRenderActivityMessage, useRenderCustomMessages, useRenderToolCall, useSuggestions };
|