@copilotkitnext/react 0.0.18 → 0.0.19-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 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,29 @@ 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
+ }>;
553
+ }
554
+
530
555
  /**
531
556
  * Helper to define a type-safe tool call renderer entry.
532
557
  * - Accepts a single object whose keys match ReactToolCallRenderer's fields: { name, args, render, agentId? }.
@@ -564,6 +589,7 @@ declare function defineToolCallRenderer<S extends z.ZodTypeAny>(def: {
564
589
 
565
590
  interface CopilotKitCoreReactConfig extends CopilotKitCoreConfig {
566
591
  renderToolCalls?: ReactToolCallRenderer<any>[];
592
+ renderActivityMessages?: ReactActivityMessageRenderer<any>[];
567
593
  renderCustomMessages?: ReactCustomMessageRenderer[];
568
594
  }
569
595
  interface CopilotKitCoreReactSubscriber extends CopilotKitCoreSubscriber {
@@ -575,8 +601,10 @@ interface CopilotKitCoreReactSubscriber extends CopilotKitCoreSubscriber {
575
601
  declare class CopilotKitCoreReact extends CopilotKitCore {
576
602
  private _renderToolCalls;
577
603
  private _renderCustomMessages;
604
+ private _renderActivityMessages;
578
605
  constructor(config: CopilotKitCoreReactConfig);
579
606
  get renderCustomMessages(): Readonly<ReactCustomMessageRenderer[]>;
607
+ get renderActivityMessages(): Readonly<ReactActivityMessageRenderer<any>>[];
580
608
  get renderToolCalls(): Readonly<ReactToolCallRenderer<any>>[];
581
609
  setRenderToolCalls(renderToolCalls: ReactToolCallRenderer<any>[]): void;
582
610
  subscribe(subscriber: CopilotKitCoreReactSubscriber): () => void;
@@ -593,6 +621,7 @@ interface CopilotKitProviderProps {
593
621
  properties?: Record<string, unknown>;
594
622
  agents__unsafe_dev_only?: Record<string, AbstractAgent>;
595
623
  renderToolCalls?: ReactToolCallRenderer<any>[];
624
+ renderActivityMessages?: ReactActivityMessageRenderer<any>[];
596
625
  renderCustomMessages?: ReactCustomMessageRenderer[];
597
626
  frontendTools?: ReactFrontendTool[];
598
627
  humanInTheLoop?: ReactHumanInTheLoop[];
@@ -601,4 +630,4 @@ interface CopilotKitProviderProps {
601
630
  declare const CopilotKitProvider: React__default.FC<CopilotKitProviderProps>;
602
631
  declare const useCopilotKit: () => CopilotKitContextValue;
603
632
 
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 };
633
+ 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,29 @@ 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
+ }>;
553
+ }
554
+
530
555
  /**
531
556
  * Helper to define a type-safe tool call renderer entry.
532
557
  * - Accepts a single object whose keys match ReactToolCallRenderer's fields: { name, args, render, agentId? }.
@@ -564,6 +589,7 @@ declare function defineToolCallRenderer<S extends z.ZodTypeAny>(def: {
564
589
 
565
590
  interface CopilotKitCoreReactConfig extends CopilotKitCoreConfig {
566
591
  renderToolCalls?: ReactToolCallRenderer<any>[];
592
+ renderActivityMessages?: ReactActivityMessageRenderer<any>[];
567
593
  renderCustomMessages?: ReactCustomMessageRenderer[];
568
594
  }
569
595
  interface CopilotKitCoreReactSubscriber extends CopilotKitCoreSubscriber {
@@ -575,8 +601,10 @@ interface CopilotKitCoreReactSubscriber extends CopilotKitCoreSubscriber {
575
601
  declare class CopilotKitCoreReact extends CopilotKitCore {
576
602
  private _renderToolCalls;
577
603
  private _renderCustomMessages;
604
+ private _renderActivityMessages;
578
605
  constructor(config: CopilotKitCoreReactConfig);
579
606
  get renderCustomMessages(): Readonly<ReactCustomMessageRenderer[]>;
607
+ get renderActivityMessages(): Readonly<ReactActivityMessageRenderer<any>>[];
580
608
  get renderToolCalls(): Readonly<ReactToolCallRenderer<any>>[];
581
609
  setRenderToolCalls(renderToolCalls: ReactToolCallRenderer<any>[]): void;
582
610
  subscribe(subscriber: CopilotKitCoreReactSubscriber): () => void;
@@ -593,6 +621,7 @@ interface CopilotKitProviderProps {
593
621
  properties?: Record<string, unknown>;
594
622
  agents__unsafe_dev_only?: Record<string, AbstractAgent>;
595
623
  renderToolCalls?: ReactToolCallRenderer<any>[];
624
+ renderActivityMessages?: ReactActivityMessageRenderer<any>[];
596
625
  renderCustomMessages?: ReactCustomMessageRenderer[];
597
626
  frontendTools?: ReactFrontendTool[];
598
627
  humanInTheLoop?: ReactHumanInTheLoop[];
@@ -601,4 +630,4 @@ interface CopilotKitProviderProps {
601
630
  declare const CopilotKitProvider: React__default.FC<CopilotKitProviderProps>;
602
631
  declare const useCopilotKit: () => CopilotKitContextValue;
603
632
 
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 };
633
+ 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 };