@assistant-ui/react 0.5.45 → 0.5.46

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { ComponentType, PropsWithChildren, ComponentPropsWithoutRef, FC, ElementType, ReactNode } from 'react';
2
+ import { ComponentType, PropsWithChildren, FC, ComponentPropsWithoutRef, ElementType, ReactNode } from 'react';
3
3
  import { T as ThreadAssistantContentPart, M as MessageStatus, a as ThreadRoundtrip, b as ThreadMessage, c as ModelConfig, d as ModelConfigProvider, e as TextContentPart, C as ContentPartStatus, I as ImageContentPart, U as UIContentPart, f as ToolCallContentPart, g as ToolCallContentPartStatus, h as CoreMessage, A as AppendMessage, i as Tool, j as CoreToolCallContentPart, k as CreateEdgeRuntimeAPIOptions } from './edge-6dYzFCV5.mjs';
4
4
  export { q as CoreAssistantContentPart, t as CoreAssistantMessage, r as CoreSystemMessage, p as CoreUserContentPart, s as CoreUserMessage, E as EdgeRuntimeRequestOptions, n as ThreadAssistantMessage, m as ThreadSystemMessage, l as ThreadUserContentPart, o as ThreadUserMessage } from './edge-6dYzFCV5.mjs';
5
5
  import { UseBoundStore, StoreApi } from 'zustand';
@@ -618,7 +618,10 @@ type AssistantToolProps<TArgs extends Record<string, unknown>, TResult> = Tool<T
618
618
  };
619
619
  declare const useAssistantTool: <TArgs extends Record<string, unknown>, TResult>(tool: AssistantToolProps<TArgs, TResult>) => void;
620
620
 
621
- declare const makeAssistantTool: <TArgs extends Record<string, unknown>, TResult>(tool: AssistantToolProps<TArgs, TResult>) => () => null;
621
+ type AssistantTool = FC & {
622
+ unstable_tool: AssistantToolProps<any, any>;
623
+ };
624
+ declare const makeAssistantTool: <TArgs extends Record<string, unknown>, TResult>(tool: AssistantToolProps<TArgs, TResult>) => AssistantTool;
622
625
 
623
626
  type AssistantToolUIProps<TArgs extends Record<string, unknown>, TResult> = {
624
627
  toolName: string;
@@ -626,7 +629,10 @@ type AssistantToolUIProps<TArgs extends Record<string, unknown>, TResult> = {
626
629
  };
627
630
  declare const useAssistantToolUI: (tool: AssistantToolUIProps<any, any> | null) => void;
628
631
 
629
- declare const makeAssistantToolUI: <TArgs extends Record<string, unknown>, TResult>(tool: AssistantToolUIProps<TArgs, TResult>) => () => null;
632
+ type AssistantToolUI = FC & {
633
+ unstable_tool: AssistantToolUIProps<any, any>;
634
+ };
635
+ declare const makeAssistantToolUI: <TArgs extends Record<string, unknown>, TResult>(tool: AssistantToolUIProps<TArgs, TResult>) => AssistantToolUI;
630
636
 
631
637
  declare const useAssistantInstructions: (instruction: string) => void;
632
638
 
@@ -911,7 +917,7 @@ type MessagePrimitiveContentProps = {
911
917
  tools?: {
912
918
  by_name?: Record<string, ToolCallContentPartComponent | undefined> | undefined;
913
919
  Fallback?: ComponentType<ToolCallContentPartProps> | undefined;
914
- };
920
+ } | undefined;
915
921
  } | undefined;
916
922
  };
917
923
  declare const MessagePrimitiveContent: FC<MessagePrimitiveContentProps>;
@@ -1013,6 +1019,7 @@ type AssistantMessageConfig = {
1013
1019
  allowSpeak?: boolean | undefined;
1014
1020
  components?: {
1015
1021
  Text?: TextContentPartComponent | undefined;
1022
+ ToolFallback?: ComponentType<ToolCallContentPartProps> | undefined;
1016
1023
  } | undefined;
1017
1024
  };
1018
1025
  type BranchPickerConfig = {
@@ -1098,6 +1105,7 @@ type ThreadConfig = {
1098
1105
  userMessage?: UserMessageConfig;
1099
1106
  branchPicker?: BranchPickerConfig;
1100
1107
  strings?: StringsConfig;
1108
+ tools?: AssistantToolUI[];
1101
1109
  };
1102
1110
  declare const useThreadConfig: () => Omit<ThreadConfig, "runtime">;
1103
1111
  type ThreadConfigProviderProps = PropsWithChildren<{
@@ -1279,4 +1287,4 @@ declare const exports: {
1279
1287
  Text: FC;
1280
1288
  };
1281
1289
 
1282
- export { index$6 as ActionBarPrimitive, type ActionBarPrimitiveCopyProps, type ActionBarPrimitiveEditProps, type ActionBarPrimitiveReloadProps, type ActionBarPrimitiveRootProps, type ActionBarPrimitiveSpeakProps, type ActionBarPrimitiveStopSpeakingProps, type AddToolResultOptions, AppendMessage, _default$9 as AssistantActionBar, type AssistantActionsState, type AssistantContextValue, _default$8 as AssistantMessage, type AssistantMessageConfig, type AssistantMessageContentProps, _default$7 as AssistantModal, index$5 as AssistantModalPrimitive, type AssistantModalPrimitiveContentProps, type AssistantModalPrimitiveRootProps, type AssistantModalPrimitiveTriggerProps, type AssistantModelConfigState, type AssistantRuntime, AssistantRuntimeProvider, type AssistantToolProps, type AssistantToolUIProps, type AssistantToolUIsState, _default$6 as BranchPicker, index$4 as BranchPickerPrimitive, type BranchPickerPrimitiveCountProps, type BranchPickerPrimitiveNextProps, type BranchPickerPrimitiveNumberProps, type BranchPickerPrimitivePreviousProps, type BranchPickerPrimitiveRootProps, type ChatModelAdapter, type ChatModelRunOptions, type ChatModelRunResult, type ChatModelRunUpdate, _default$5 as Composer, type ComposerContextValue, type ComposerInputProps, index$3 as ComposerPrimitive, type ComposerPrimitiveCancelProps, type ComposerPrimitiveIfProps, type ComposerPrimitiveInputProps, type ComposerPrimitiveRootProps, type ComposerPrimitiveSendProps, type ComposerState, exports as ContentPart, type ContentPartContextValue, index$2 as ContentPartPrimitive, type ContentPartPrimitiveDisplayProps, type ContentPartPrimitiveImageProps, type ContentPartPrimitiveInProgressProps, type ContentPartPrimitiveTextProps, type ContentPartState, CoreMessage, type DangerousInBrowserRuntimeOptions, EdgeChatAdapter, type EdgeRuntimeOptions, _default$4 as EditComposer, type EditComposerState, type ExternalStoreAdapter, type ExternalStoreMessageConverter, ExternalStoreRuntime, internal as INTERNAL, ImageContentPart, type ImageContentPartComponent, type ImageContentPartProps, type LocalRuntimeOptions, type MessageContextValue, index$1 as MessagePrimitive, type MessagePrimitiveContentProps, type MessagePrimitiveIfProps, type MessagePrimitiveInProgressProps, type MessagePrimitiveRootProps, type MessageState, MessageStatus, type MessageUtilsState, ModelConfig, ModelConfigProvider, type ReactThreadRuntime, SpeechSynthesisAdapter, StreamUtils, type StringsConfig, type SuggestionConfig, TextContentPart, type TextContentPartComponent, type TextContentPartProps, _default$3 as Thread, type ThreadActionsState, ThreadAssistantContentPart, type ThreadConfig, ThreadConfigProvider, type ThreadConfigProviderProps, type ThreadContextValue, ThreadMessage, type ThreadMessageLike, type ThreadMessagesState, index as ThreadPrimitive, type ThreadPrimitiveEmptyProps, type ThreadPrimitiveIfProps, type ThreadPrimitiveMessagesProps, type ThreadPrimitiveRootProps, type ThreadPrimitiveScrollToBottomProps, type ThreadPrimitiveSuggestionProps, type ThreadPrimitiveViewportProps, type ThreadRootProps, ThreadRuntime, type ThreadState, type ThreadViewportState, _default as ThreadWelcome, type ThreadWelcomeConfig, type ThreadWelcomeMessageProps, type ThreadWelcomeSuggestionProps, Tool, ToolCallContentPart, type ToolCallContentPartComponent, type ToolCallContentPartProps, UIContentPart, type UIContentPartComponent, type UIContentPartProps, type Unsubscribe, type UseActionBarCopyProps, _default$1 as UserActionBar, _default$2 as UserMessage, type UserMessageConfig, type UserMessageContentProps, WebSpeechSynthesisAdapter, fromCoreMessage, fromCoreMessages, fromLanguageModelMessages, fromLanguageModelTools, getExternalStoreMessage, makeAssistantTool, makeAssistantToolUI, streamUtils, subscribeToMainThread, toCoreMessage, toCoreMessages, toLanguageModelMessages, toLanguageModelTools, useActionBarCopy, useActionBarEdit, useActionBarReload, useActionBarSpeak, useActionBarStopSpeaking, useAppendMessage, useAssistantContext, useAssistantInstructions, useAssistantTool, useAssistantToolUI, useBranchPickerCount, useBranchPickerNext, useBranchPickerNumber, useBranchPickerPrevious, useComposerCancel, useComposerContext, useComposerIf, useComposerSend, useContentPartContext, useContentPartDisplay, useContentPartImage, useContentPartText, useDangerousInBrowserRuntime, useEdgeRuntime, useExternalMessageConverter, useExternalStoreRuntime, useLocalRuntime, useMessageContext, useMessageIf, useSwitchToNewThread, useThreadConfig, useThreadContext, useThreadEmpty, useThreadIf, useThreadScrollToBottom, useThreadSuggestion };
1290
+ export { index$6 as ActionBarPrimitive, type ActionBarPrimitiveCopyProps, type ActionBarPrimitiveEditProps, type ActionBarPrimitiveReloadProps, type ActionBarPrimitiveRootProps, type ActionBarPrimitiveSpeakProps, type ActionBarPrimitiveStopSpeakingProps, type AddToolResultOptions, AppendMessage, _default$9 as AssistantActionBar, type AssistantActionsState, type AssistantContextValue, _default$8 as AssistantMessage, type AssistantMessageConfig, type AssistantMessageContentProps, _default$7 as AssistantModal, index$5 as AssistantModalPrimitive, type AssistantModalPrimitiveContentProps, type AssistantModalPrimitiveRootProps, type AssistantModalPrimitiveTriggerProps, type AssistantModelConfigState, type AssistantRuntime, AssistantRuntimeProvider, type AssistantTool, type AssistantToolProps, type AssistantToolUI, type AssistantToolUIProps, type AssistantToolUIsState, _default$6 as BranchPicker, index$4 as BranchPickerPrimitive, type BranchPickerPrimitiveCountProps, type BranchPickerPrimitiveNextProps, type BranchPickerPrimitiveNumberProps, type BranchPickerPrimitivePreviousProps, type BranchPickerPrimitiveRootProps, type ChatModelAdapter, type ChatModelRunOptions, type ChatModelRunResult, type ChatModelRunUpdate, _default$5 as Composer, type ComposerContextValue, type ComposerInputProps, index$3 as ComposerPrimitive, type ComposerPrimitiveCancelProps, type ComposerPrimitiveIfProps, type ComposerPrimitiveInputProps, type ComposerPrimitiveRootProps, type ComposerPrimitiveSendProps, type ComposerState, exports as ContentPart, type ContentPartContextValue, index$2 as ContentPartPrimitive, type ContentPartPrimitiveDisplayProps, type ContentPartPrimitiveImageProps, type ContentPartPrimitiveInProgressProps, type ContentPartPrimitiveTextProps, type ContentPartState, CoreMessage, type DangerousInBrowserRuntimeOptions, EdgeChatAdapter, type EdgeRuntimeOptions, _default$4 as EditComposer, type EditComposerState, type ExternalStoreAdapter, type ExternalStoreMessageConverter, ExternalStoreRuntime, internal as INTERNAL, ImageContentPart, type ImageContentPartComponent, type ImageContentPartProps, type LocalRuntimeOptions, type MessageContextValue, index$1 as MessagePrimitive, type MessagePrimitiveContentProps, type MessagePrimitiveIfProps, type MessagePrimitiveInProgressProps, type MessagePrimitiveRootProps, type MessageState, MessageStatus, type MessageUtilsState, ModelConfig, ModelConfigProvider, type ReactThreadRuntime, SpeechSynthesisAdapter, StreamUtils, type StringsConfig, type SuggestionConfig, TextContentPart, type TextContentPartComponent, type TextContentPartProps, _default$3 as Thread, type ThreadActionsState, ThreadAssistantContentPart, type ThreadConfig, ThreadConfigProvider, type ThreadConfigProviderProps, type ThreadContextValue, ThreadMessage, type ThreadMessageLike, type ThreadMessagesState, index as ThreadPrimitive, type ThreadPrimitiveEmptyProps, type ThreadPrimitiveIfProps, type ThreadPrimitiveMessagesProps, type ThreadPrimitiveRootProps, type ThreadPrimitiveScrollToBottomProps, type ThreadPrimitiveSuggestionProps, type ThreadPrimitiveViewportProps, type ThreadRootProps, ThreadRuntime, type ThreadState, type ThreadViewportState, _default as ThreadWelcome, type ThreadWelcomeConfig, type ThreadWelcomeMessageProps, type ThreadWelcomeSuggestionProps, Tool, ToolCallContentPart, type ToolCallContentPartComponent, type ToolCallContentPartProps, UIContentPart, type UIContentPartComponent, type UIContentPartProps, type Unsubscribe, type UseActionBarCopyProps, _default$1 as UserActionBar, _default$2 as UserMessage, type UserMessageConfig, type UserMessageContentProps, WebSpeechSynthesisAdapter, fromCoreMessage, fromCoreMessages, fromLanguageModelMessages, fromLanguageModelTools, getExternalStoreMessage, makeAssistantTool, makeAssistantToolUI, streamUtils, subscribeToMainThread, toCoreMessage, toCoreMessages, toLanguageModelMessages, toLanguageModelTools, useActionBarCopy, useActionBarEdit, useActionBarReload, useActionBarSpeak, useActionBarStopSpeaking, useAppendMessage, useAssistantContext, useAssistantInstructions, useAssistantTool, useAssistantToolUI, useBranchPickerCount, useBranchPickerNext, useBranchPickerNumber, useBranchPickerPrevious, useComposerCancel, useComposerContext, useComposerIf, useComposerSend, useContentPartContext, useContentPartDisplay, useContentPartImage, useContentPartText, useDangerousInBrowserRuntime, useEdgeRuntime, useExternalMessageConverter, useExternalStoreRuntime, useLocalRuntime, useMessageContext, useMessageIf, useSwitchToNewThread, useThreadConfig, useThreadContext, useThreadEmpty, useThreadIf, useThreadScrollToBottom, useThreadSuggestion };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { ComponentType, PropsWithChildren, ComponentPropsWithoutRef, FC, ElementType, ReactNode } from 'react';
2
+ import { ComponentType, PropsWithChildren, FC, ComponentPropsWithoutRef, ElementType, ReactNode } from 'react';
3
3
  import { T as ThreadAssistantContentPart, M as MessageStatus, a as ThreadRoundtrip, b as ThreadMessage, c as ModelConfig, d as ModelConfigProvider, e as TextContentPart, C as ContentPartStatus, I as ImageContentPart, U as UIContentPart, f as ToolCallContentPart, g as ToolCallContentPartStatus, h as CoreMessage, A as AppendMessage, i as Tool, j as CoreToolCallContentPart, k as CreateEdgeRuntimeAPIOptions } from './edge-6dYzFCV5.js';
4
4
  export { q as CoreAssistantContentPart, t as CoreAssistantMessage, r as CoreSystemMessage, p as CoreUserContentPart, s as CoreUserMessage, E as EdgeRuntimeRequestOptions, n as ThreadAssistantMessage, m as ThreadSystemMessage, l as ThreadUserContentPart, o as ThreadUserMessage } from './edge-6dYzFCV5.js';
5
5
  import { UseBoundStore, StoreApi } from 'zustand';
@@ -618,7 +618,10 @@ type AssistantToolProps<TArgs extends Record<string, unknown>, TResult> = Tool<T
618
618
  };
619
619
  declare const useAssistantTool: <TArgs extends Record<string, unknown>, TResult>(tool: AssistantToolProps<TArgs, TResult>) => void;
620
620
 
621
- declare const makeAssistantTool: <TArgs extends Record<string, unknown>, TResult>(tool: AssistantToolProps<TArgs, TResult>) => () => null;
621
+ type AssistantTool = FC & {
622
+ unstable_tool: AssistantToolProps<any, any>;
623
+ };
624
+ declare const makeAssistantTool: <TArgs extends Record<string, unknown>, TResult>(tool: AssistantToolProps<TArgs, TResult>) => AssistantTool;
622
625
 
623
626
  type AssistantToolUIProps<TArgs extends Record<string, unknown>, TResult> = {
624
627
  toolName: string;
@@ -626,7 +629,10 @@ type AssistantToolUIProps<TArgs extends Record<string, unknown>, TResult> = {
626
629
  };
627
630
  declare const useAssistantToolUI: (tool: AssistantToolUIProps<any, any> | null) => void;
628
631
 
629
- declare const makeAssistantToolUI: <TArgs extends Record<string, unknown>, TResult>(tool: AssistantToolUIProps<TArgs, TResult>) => () => null;
632
+ type AssistantToolUI = FC & {
633
+ unstable_tool: AssistantToolUIProps<any, any>;
634
+ };
635
+ declare const makeAssistantToolUI: <TArgs extends Record<string, unknown>, TResult>(tool: AssistantToolUIProps<TArgs, TResult>) => AssistantToolUI;
630
636
 
631
637
  declare const useAssistantInstructions: (instruction: string) => void;
632
638
 
@@ -911,7 +917,7 @@ type MessagePrimitiveContentProps = {
911
917
  tools?: {
912
918
  by_name?: Record<string, ToolCallContentPartComponent | undefined> | undefined;
913
919
  Fallback?: ComponentType<ToolCallContentPartProps> | undefined;
914
- };
920
+ } | undefined;
915
921
  } | undefined;
916
922
  };
917
923
  declare const MessagePrimitiveContent: FC<MessagePrimitiveContentProps>;
@@ -1013,6 +1019,7 @@ type AssistantMessageConfig = {
1013
1019
  allowSpeak?: boolean | undefined;
1014
1020
  components?: {
1015
1021
  Text?: TextContentPartComponent | undefined;
1022
+ ToolFallback?: ComponentType<ToolCallContentPartProps> | undefined;
1016
1023
  } | undefined;
1017
1024
  };
1018
1025
  type BranchPickerConfig = {
@@ -1098,6 +1105,7 @@ type ThreadConfig = {
1098
1105
  userMessage?: UserMessageConfig;
1099
1106
  branchPicker?: BranchPickerConfig;
1100
1107
  strings?: StringsConfig;
1108
+ tools?: AssistantToolUI[];
1101
1109
  };
1102
1110
  declare const useThreadConfig: () => Omit<ThreadConfig, "runtime">;
1103
1111
  type ThreadConfigProviderProps = PropsWithChildren<{
@@ -1279,4 +1287,4 @@ declare const exports: {
1279
1287
  Text: FC;
1280
1288
  };
1281
1289
 
1282
- export { index$6 as ActionBarPrimitive, type ActionBarPrimitiveCopyProps, type ActionBarPrimitiveEditProps, type ActionBarPrimitiveReloadProps, type ActionBarPrimitiveRootProps, type ActionBarPrimitiveSpeakProps, type ActionBarPrimitiveStopSpeakingProps, type AddToolResultOptions, AppendMessage, _default$9 as AssistantActionBar, type AssistantActionsState, type AssistantContextValue, _default$8 as AssistantMessage, type AssistantMessageConfig, type AssistantMessageContentProps, _default$7 as AssistantModal, index$5 as AssistantModalPrimitive, type AssistantModalPrimitiveContentProps, type AssistantModalPrimitiveRootProps, type AssistantModalPrimitiveTriggerProps, type AssistantModelConfigState, type AssistantRuntime, AssistantRuntimeProvider, type AssistantToolProps, type AssistantToolUIProps, type AssistantToolUIsState, _default$6 as BranchPicker, index$4 as BranchPickerPrimitive, type BranchPickerPrimitiveCountProps, type BranchPickerPrimitiveNextProps, type BranchPickerPrimitiveNumberProps, type BranchPickerPrimitivePreviousProps, type BranchPickerPrimitiveRootProps, type ChatModelAdapter, type ChatModelRunOptions, type ChatModelRunResult, type ChatModelRunUpdate, _default$5 as Composer, type ComposerContextValue, type ComposerInputProps, index$3 as ComposerPrimitive, type ComposerPrimitiveCancelProps, type ComposerPrimitiveIfProps, type ComposerPrimitiveInputProps, type ComposerPrimitiveRootProps, type ComposerPrimitiveSendProps, type ComposerState, exports as ContentPart, type ContentPartContextValue, index$2 as ContentPartPrimitive, type ContentPartPrimitiveDisplayProps, type ContentPartPrimitiveImageProps, type ContentPartPrimitiveInProgressProps, type ContentPartPrimitiveTextProps, type ContentPartState, CoreMessage, type DangerousInBrowserRuntimeOptions, EdgeChatAdapter, type EdgeRuntimeOptions, _default$4 as EditComposer, type EditComposerState, type ExternalStoreAdapter, type ExternalStoreMessageConverter, ExternalStoreRuntime, internal as INTERNAL, ImageContentPart, type ImageContentPartComponent, type ImageContentPartProps, type LocalRuntimeOptions, type MessageContextValue, index$1 as MessagePrimitive, type MessagePrimitiveContentProps, type MessagePrimitiveIfProps, type MessagePrimitiveInProgressProps, type MessagePrimitiveRootProps, type MessageState, MessageStatus, type MessageUtilsState, ModelConfig, ModelConfigProvider, type ReactThreadRuntime, SpeechSynthesisAdapter, StreamUtils, type StringsConfig, type SuggestionConfig, TextContentPart, type TextContentPartComponent, type TextContentPartProps, _default$3 as Thread, type ThreadActionsState, ThreadAssistantContentPart, type ThreadConfig, ThreadConfigProvider, type ThreadConfigProviderProps, type ThreadContextValue, ThreadMessage, type ThreadMessageLike, type ThreadMessagesState, index as ThreadPrimitive, type ThreadPrimitiveEmptyProps, type ThreadPrimitiveIfProps, type ThreadPrimitiveMessagesProps, type ThreadPrimitiveRootProps, type ThreadPrimitiveScrollToBottomProps, type ThreadPrimitiveSuggestionProps, type ThreadPrimitiveViewportProps, type ThreadRootProps, ThreadRuntime, type ThreadState, type ThreadViewportState, _default as ThreadWelcome, type ThreadWelcomeConfig, type ThreadWelcomeMessageProps, type ThreadWelcomeSuggestionProps, Tool, ToolCallContentPart, type ToolCallContentPartComponent, type ToolCallContentPartProps, UIContentPart, type UIContentPartComponent, type UIContentPartProps, type Unsubscribe, type UseActionBarCopyProps, _default$1 as UserActionBar, _default$2 as UserMessage, type UserMessageConfig, type UserMessageContentProps, WebSpeechSynthesisAdapter, fromCoreMessage, fromCoreMessages, fromLanguageModelMessages, fromLanguageModelTools, getExternalStoreMessage, makeAssistantTool, makeAssistantToolUI, streamUtils, subscribeToMainThread, toCoreMessage, toCoreMessages, toLanguageModelMessages, toLanguageModelTools, useActionBarCopy, useActionBarEdit, useActionBarReload, useActionBarSpeak, useActionBarStopSpeaking, useAppendMessage, useAssistantContext, useAssistantInstructions, useAssistantTool, useAssistantToolUI, useBranchPickerCount, useBranchPickerNext, useBranchPickerNumber, useBranchPickerPrevious, useComposerCancel, useComposerContext, useComposerIf, useComposerSend, useContentPartContext, useContentPartDisplay, useContentPartImage, useContentPartText, useDangerousInBrowserRuntime, useEdgeRuntime, useExternalMessageConverter, useExternalStoreRuntime, useLocalRuntime, useMessageContext, useMessageIf, useSwitchToNewThread, useThreadConfig, useThreadContext, useThreadEmpty, useThreadIf, useThreadScrollToBottom, useThreadSuggestion };
1290
+ export { index$6 as ActionBarPrimitive, type ActionBarPrimitiveCopyProps, type ActionBarPrimitiveEditProps, type ActionBarPrimitiveReloadProps, type ActionBarPrimitiveRootProps, type ActionBarPrimitiveSpeakProps, type ActionBarPrimitiveStopSpeakingProps, type AddToolResultOptions, AppendMessage, _default$9 as AssistantActionBar, type AssistantActionsState, type AssistantContextValue, _default$8 as AssistantMessage, type AssistantMessageConfig, type AssistantMessageContentProps, _default$7 as AssistantModal, index$5 as AssistantModalPrimitive, type AssistantModalPrimitiveContentProps, type AssistantModalPrimitiveRootProps, type AssistantModalPrimitiveTriggerProps, type AssistantModelConfigState, type AssistantRuntime, AssistantRuntimeProvider, type AssistantTool, type AssistantToolProps, type AssistantToolUI, type AssistantToolUIProps, type AssistantToolUIsState, _default$6 as BranchPicker, index$4 as BranchPickerPrimitive, type BranchPickerPrimitiveCountProps, type BranchPickerPrimitiveNextProps, type BranchPickerPrimitiveNumberProps, type BranchPickerPrimitivePreviousProps, type BranchPickerPrimitiveRootProps, type ChatModelAdapter, type ChatModelRunOptions, type ChatModelRunResult, type ChatModelRunUpdate, _default$5 as Composer, type ComposerContextValue, type ComposerInputProps, index$3 as ComposerPrimitive, type ComposerPrimitiveCancelProps, type ComposerPrimitiveIfProps, type ComposerPrimitiveInputProps, type ComposerPrimitiveRootProps, type ComposerPrimitiveSendProps, type ComposerState, exports as ContentPart, type ContentPartContextValue, index$2 as ContentPartPrimitive, type ContentPartPrimitiveDisplayProps, type ContentPartPrimitiveImageProps, type ContentPartPrimitiveInProgressProps, type ContentPartPrimitiveTextProps, type ContentPartState, CoreMessage, type DangerousInBrowserRuntimeOptions, EdgeChatAdapter, type EdgeRuntimeOptions, _default$4 as EditComposer, type EditComposerState, type ExternalStoreAdapter, type ExternalStoreMessageConverter, ExternalStoreRuntime, internal as INTERNAL, ImageContentPart, type ImageContentPartComponent, type ImageContentPartProps, type LocalRuntimeOptions, type MessageContextValue, index$1 as MessagePrimitive, type MessagePrimitiveContentProps, type MessagePrimitiveIfProps, type MessagePrimitiveInProgressProps, type MessagePrimitiveRootProps, type MessageState, MessageStatus, type MessageUtilsState, ModelConfig, ModelConfigProvider, type ReactThreadRuntime, SpeechSynthesisAdapter, StreamUtils, type StringsConfig, type SuggestionConfig, TextContentPart, type TextContentPartComponent, type TextContentPartProps, _default$3 as Thread, type ThreadActionsState, ThreadAssistantContentPart, type ThreadConfig, ThreadConfigProvider, type ThreadConfigProviderProps, type ThreadContextValue, ThreadMessage, type ThreadMessageLike, type ThreadMessagesState, index as ThreadPrimitive, type ThreadPrimitiveEmptyProps, type ThreadPrimitiveIfProps, type ThreadPrimitiveMessagesProps, type ThreadPrimitiveRootProps, type ThreadPrimitiveScrollToBottomProps, type ThreadPrimitiveSuggestionProps, type ThreadPrimitiveViewportProps, type ThreadRootProps, ThreadRuntime, type ThreadState, type ThreadViewportState, _default as ThreadWelcome, type ThreadWelcomeConfig, type ThreadWelcomeMessageProps, type ThreadWelcomeSuggestionProps, Tool, ToolCallContentPart, type ToolCallContentPartComponent, type ToolCallContentPartProps, UIContentPart, type UIContentPartComponent, type UIContentPartProps, type Unsubscribe, type UseActionBarCopyProps, _default$1 as UserActionBar, _default$2 as UserMessage, type UserMessageConfig, type UserMessageContentProps, WebSpeechSynthesisAdapter, fromCoreMessage, fromCoreMessages, fromLanguageModelMessages, fromLanguageModelTools, getExternalStoreMessage, makeAssistantTool, makeAssistantToolUI, streamUtils, subscribeToMainThread, toCoreMessage, toCoreMessages, toLanguageModelMessages, toLanguageModelTools, useActionBarCopy, useActionBarEdit, useActionBarReload, useActionBarSpeak, useActionBarStopSpeaking, useAppendMessage, useAssistantContext, useAssistantInstructions, useAssistantTool, useAssistantToolUI, useBranchPickerCount, useBranchPickerNext, useBranchPickerNumber, useBranchPickerPrevious, useComposerCancel, useComposerContext, useComposerIf, useComposerSend, useContentPartContext, useContentPartDisplay, useContentPartImage, useContentPartText, useDangerousInBrowserRuntime, useEdgeRuntime, useExternalMessageConverter, useExternalStoreRuntime, useLocalRuntime, useMessageContext, useMessageIf, useSwitchToNewThread, useThreadConfig, useThreadContext, useThreadEmpty, useThreadIf, useThreadScrollToBottom, useThreadSuggestion };
package/dist/index.js CHANGED
@@ -2156,6 +2156,7 @@ var makeAssistantTool = (tool) => {
2156
2156
  useAssistantTool(tool);
2157
2157
  return null;
2158
2158
  };
2159
+ Tool.unstable_tool = tool;
2159
2160
  return Tool;
2160
2161
  };
2161
2162
 
@@ -2177,6 +2178,7 @@ var makeAssistantToolUI = (tool) => {
2177
2178
  useAssistantToolUI(tool);
2178
2179
  return null;
2179
2180
  };
2181
+ ToolUI.unstable_tool = tool;
2180
2182
  return ToolUI;
2181
2183
  };
2182
2184
 
@@ -3033,21 +3035,22 @@ ContentPartPrimitiveInProgress.displayName = "ContentPartPrimitive.InProgress";
3033
3035
 
3034
3036
  // src/primitives/message/MessageContent.tsx
3035
3037
 
3038
+ var ToolUIDisplay = ({
3039
+ UI,
3040
+ ...props
3041
+ }) => {
3042
+ const { useToolUIs } = useAssistantContext();
3043
+ const Render = _nullishCoalesce(useToolUIs((s) => s.getToolUI(props.part.toolName)), () => ( UI));
3044
+ if (!Render) return null;
3045
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Render, { ...props });
3046
+ };
3036
3047
  var defaultComponents = {
3037
3048
  Text: () => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { style: { whiteSpace: "pre-line" }, children: [
3038
3049
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ContentPartPrimitiveText, {}),
3039
3050
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ContentPartPrimitiveInProgress, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { style: { fontFamily: "revert" }, children: " \u25CF" }) })
3040
3051
  ] }),
3041
3052
  Image: () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ContentPartPrimitiveImage, {}),
3042
- UI: () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ContentPartPrimitiveDisplay, {}),
3043
- tools: {
3044
- Fallback: (props) => {
3045
- const { useToolUIs } = useAssistantContext();
3046
- const Render = useToolUIs((s) => s.getToolUI(props.part.toolName));
3047
- if (!Render) return null;
3048
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Render, { ...props });
3049
- }
3050
- }
3053
+ UI: () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ContentPartPrimitiveDisplay, {})
3051
3054
  };
3052
3055
  var MessageContentPartComponent = ({
3053
3056
  components: {
@@ -3055,7 +3058,7 @@ var MessageContentPartComponent = ({
3055
3058
  Text: Text2 = defaultComponents.Text,
3056
3059
  Image: Image2 = defaultComponents.Image,
3057
3060
  UI = defaultComponents.UI,
3058
- tools: { by_name = {}, Fallback: Fallback2 = defaultComponents.tools.Fallback } = {}
3061
+ tools: { by_name = {}, Fallback: Fallback2 = void 0 } = {}
3059
3062
  } = {}
3060
3063
  }) => {
3061
3064
  const { useThreadActions } = useThreadContext();
@@ -3086,7 +3089,15 @@ var MessageContentPartComponent = ({
3086
3089
  toolCallId: part.toolCallId,
3087
3090
  result
3088
3091
  });
3089
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Tool, { part, status, addResult });
3092
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3093
+ ToolUIDisplay,
3094
+ {
3095
+ UI: Tool,
3096
+ part,
3097
+ status,
3098
+ addResult
3099
+ }
3100
+ );
3090
3101
  }
3091
3102
  default:
3092
3103
  const unhandledType = type;
@@ -3955,13 +3966,22 @@ var AssistantMessageContentWrapper = withDefaults("div", {
3955
3966
  className: "aui-assistant-message-content"
3956
3967
  });
3957
3968
  var AssistantMessageContent = _react.forwardRef.call(void 0, ({ components: componentsProp, ...rest }, ref) => {
3958
- const { assistantMessage: { components = {} } = {} } = useThreadConfig();
3969
+ const { tools, assistantMessage: { components = {} } = {} } = useThreadConfig();
3959
3970
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AssistantMessageContentWrapper, { ...rest, ref, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3960
3971
  message_exports.Content,
3961
3972
  {
3962
3973
  components: {
3963
3974
  ...componentsProp,
3964
- Text: _nullishCoalesce(_nullishCoalesce(_optionalChain([componentsProp, 'optionalAccess', _151 => _151.Text]), () => ( components.Text)), () => ( content_part_default.Text))
3975
+ Text: _nullishCoalesce(_nullishCoalesce(_optionalChain([componentsProp, 'optionalAccess', _151 => _151.Text]), () => ( components.Text)), () => ( content_part_default.Text)),
3976
+ tools: {
3977
+ by_name: !tools ? void 0 : Object.fromEntries(
3978
+ tools.map((t) => [
3979
+ t.unstable_tool.toolName,
3980
+ t.unstable_tool.render
3981
+ ])
3982
+ ),
3983
+ Fallback: components.ToolFallback
3984
+ }
3965
3985
  }
3966
3986
  }
3967
3987
  ) });