@assistant-ui/react 0.5.42 → 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';
@@ -154,6 +154,7 @@ declare class LocalThreadRuntime implements ThreadRuntime {
154
154
  unstable_copy: boolean;
155
155
  speak: boolean;
156
156
  };
157
+ readonly threadId: string;
157
158
  readonly isDisabled = false;
158
159
  get messages(): ThreadMessage[];
159
160
  readonly composer: {
@@ -253,7 +254,7 @@ declare const useEdgeRuntime: ({ initialMessages, maxToolRoundtrips, adapters, .
253
254
 
254
255
  type ThreadMessageLike = {
255
256
  role: "assistant" | "user" | "system";
256
- content: (TextContentPart | ImageContentPart | ToolCallContentPart<any, any> | CoreToolCallContentPart<any, any> | UIContentPart)[];
257
+ content: string | (TextContentPart | ImageContentPart | ToolCallContentPart<any, any> | CoreToolCallContentPart<any, any> | UIContentPart)[];
257
258
  id?: string | undefined;
258
259
  createdAt?: Date | undefined;
259
260
  status?: MessageStatus | undefined;
@@ -366,6 +367,7 @@ declare class ExternalStoreThreadRuntime implements ReactThreadRuntime {
366
367
  private assistantOptimisticId;
367
368
  private _capabilities;
368
369
  get capabilities(): RuntimeCapabilities;
370
+ threadId: string;
369
371
  messages: ThreadMessage[];
370
372
  isDisabled: boolean;
371
373
  converter: ThreadMessageConverter;
@@ -375,6 +377,7 @@ declare class ExternalStoreThreadRuntime implements ReactThreadRuntime {
375
377
  setText: (value: string) => void;
376
378
  };
377
379
  constructor(store: ExternalStoreAdapter<any>);
380
+ get store(): ExternalStoreAdapter<any>;
378
381
  set store(store: ExternalStoreAdapter<any>);
379
382
  private notifySubscribers;
380
383
  getBranches(messageId: string): string[];
@@ -391,6 +394,7 @@ declare class ExternalStoreThreadRuntime implements ReactThreadRuntime {
391
394
  declare class ExternalStoreRuntime extends BaseAssistantRuntime<ExternalStoreThreadRuntime> {
392
395
  private readonly _proxyConfigProvider;
393
396
  constructor(store: ExternalStoreAdapter<any>);
397
+ get store(): ExternalStoreAdapter<any>;
394
398
  set store(store: ExternalStoreAdapter<any>);
395
399
  getModelConfig(): ModelConfig;
396
400
  registerModelConfigProvider(provider: ModelConfigProvider): () => void;
@@ -401,6 +405,21 @@ declare const useExternalStoreRuntime: <T>(store: ExternalStoreAdapter<T>) => Ex
401
405
 
402
406
  declare const getExternalStoreMessage: <T>(message: ThreadMessage) => T | undefined;
403
407
 
408
+ declare namespace useExternalMessageConverter {
409
+ type Message = ThreadMessageLike | {
410
+ role: "tool";
411
+ toolCallId: string;
412
+ toolName?: string | undefined;
413
+ result: any;
414
+ };
415
+ type Callback<T> = (message: T) => Message | Message[];
416
+ }
417
+ declare const useExternalMessageConverter: <T extends WeakKey>({ callback, messages, isRunning, }: {
418
+ callback: useExternalMessageConverter.Callback<T>;
419
+ messages: T[];
420
+ isRunning: boolean;
421
+ }) => ThreadMessage[];
422
+
404
423
  type DangerousInBrowserAdapterOptions = CreateEdgeRuntimeAPIOptions;
405
424
 
406
425
  type DangerousInBrowserRuntimeOptions = DangerousInBrowserAdapterOptions & LocalRuntimeOptions;
@@ -410,6 +429,7 @@ type ThreadRuntimeStore = ThreadRuntime;
410
429
 
411
430
  type ThreadState = Readonly<{
412
431
  capabilities: Readonly<RuntimeCapabilities>;
432
+ threadId: string;
413
433
  isRunning: boolean;
414
434
  isDisabled: boolean;
415
435
  }>;
@@ -424,6 +444,7 @@ type RuntimeCapabilities = {
424
444
 
425
445
  type AddToolResultOptions = {
426
446
  messageId: string;
447
+ toolName: string;
427
448
  toolCallId: string;
428
449
  result: any;
429
450
  };
@@ -440,6 +461,7 @@ type ThreadActionsState = Readonly<{
440
461
  type ThreadRuntime = ThreadActionsState & Readonly<{
441
462
  composer: ThreadRuntime.Composer;
442
463
  capabilities: Readonly<RuntimeCapabilities>;
464
+ threadId: string;
443
465
  isDisabled: boolean;
444
466
  messages: readonly ThreadMessage[];
445
467
  subscribe: (callback: () => void) => Unsubscribe;
@@ -596,7 +618,10 @@ type AssistantToolProps<TArgs extends Record<string, unknown>, TResult> = Tool<T
596
618
  };
597
619
  declare const useAssistantTool: <TArgs extends Record<string, unknown>, TResult>(tool: AssistantToolProps<TArgs, TResult>) => void;
598
620
 
599
- 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;
600
625
 
601
626
  type AssistantToolUIProps<TArgs extends Record<string, unknown>, TResult> = {
602
627
  toolName: string;
@@ -604,7 +629,10 @@ type AssistantToolUIProps<TArgs extends Record<string, unknown>, TResult> = {
604
629
  };
605
630
  declare const useAssistantToolUI: (tool: AssistantToolUIProps<any, any> | null) => void;
606
631
 
607
- 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;
608
636
 
609
637
  declare const useAssistantInstructions: (instruction: string) => void;
610
638
 
@@ -889,7 +917,7 @@ type MessagePrimitiveContentProps = {
889
917
  tools?: {
890
918
  by_name?: Record<string, ToolCallContentPartComponent | undefined> | undefined;
891
919
  Fallback?: ComponentType<ToolCallContentPartProps> | undefined;
892
- };
920
+ } | undefined;
893
921
  } | undefined;
894
922
  };
895
923
  declare const MessagePrimitiveContent: FC<MessagePrimitiveContentProps>;
@@ -991,6 +1019,7 @@ type AssistantMessageConfig = {
991
1019
  allowSpeak?: boolean | undefined;
992
1020
  components?: {
993
1021
  Text?: TextContentPartComponent | undefined;
1022
+ ToolFallback?: ComponentType<ToolCallContentPartProps> | undefined;
994
1023
  } | undefined;
995
1024
  };
996
1025
  type BranchPickerConfig = {
@@ -1076,6 +1105,7 @@ type ThreadConfig = {
1076
1105
  userMessage?: UserMessageConfig;
1077
1106
  branchPicker?: BranchPickerConfig;
1078
1107
  strings?: StringsConfig;
1108
+ tools?: AssistantToolUI[];
1079
1109
  };
1080
1110
  declare const useThreadConfig: () => Omit<ThreadConfig, "runtime">;
1081
1111
  type ThreadConfigProviderProps = PropsWithChildren<{
@@ -1257,4 +1287,4 @@ declare const exports: {
1257
1287
  Text: FC;
1258
1288
  };
1259
1289
 
1260
- 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, 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';
@@ -154,6 +154,7 @@ declare class LocalThreadRuntime implements ThreadRuntime {
154
154
  unstable_copy: boolean;
155
155
  speak: boolean;
156
156
  };
157
+ readonly threadId: string;
157
158
  readonly isDisabled = false;
158
159
  get messages(): ThreadMessage[];
159
160
  readonly composer: {
@@ -253,7 +254,7 @@ declare const useEdgeRuntime: ({ initialMessages, maxToolRoundtrips, adapters, .
253
254
 
254
255
  type ThreadMessageLike = {
255
256
  role: "assistant" | "user" | "system";
256
- content: (TextContentPart | ImageContentPart | ToolCallContentPart<any, any> | CoreToolCallContentPart<any, any> | UIContentPart)[];
257
+ content: string | (TextContentPart | ImageContentPart | ToolCallContentPart<any, any> | CoreToolCallContentPart<any, any> | UIContentPart)[];
257
258
  id?: string | undefined;
258
259
  createdAt?: Date | undefined;
259
260
  status?: MessageStatus | undefined;
@@ -366,6 +367,7 @@ declare class ExternalStoreThreadRuntime implements ReactThreadRuntime {
366
367
  private assistantOptimisticId;
367
368
  private _capabilities;
368
369
  get capabilities(): RuntimeCapabilities;
370
+ threadId: string;
369
371
  messages: ThreadMessage[];
370
372
  isDisabled: boolean;
371
373
  converter: ThreadMessageConverter;
@@ -375,6 +377,7 @@ declare class ExternalStoreThreadRuntime implements ReactThreadRuntime {
375
377
  setText: (value: string) => void;
376
378
  };
377
379
  constructor(store: ExternalStoreAdapter<any>);
380
+ get store(): ExternalStoreAdapter<any>;
378
381
  set store(store: ExternalStoreAdapter<any>);
379
382
  private notifySubscribers;
380
383
  getBranches(messageId: string): string[];
@@ -391,6 +394,7 @@ declare class ExternalStoreThreadRuntime implements ReactThreadRuntime {
391
394
  declare class ExternalStoreRuntime extends BaseAssistantRuntime<ExternalStoreThreadRuntime> {
392
395
  private readonly _proxyConfigProvider;
393
396
  constructor(store: ExternalStoreAdapter<any>);
397
+ get store(): ExternalStoreAdapter<any>;
394
398
  set store(store: ExternalStoreAdapter<any>);
395
399
  getModelConfig(): ModelConfig;
396
400
  registerModelConfigProvider(provider: ModelConfigProvider): () => void;
@@ -401,6 +405,21 @@ declare const useExternalStoreRuntime: <T>(store: ExternalStoreAdapter<T>) => Ex
401
405
 
402
406
  declare const getExternalStoreMessage: <T>(message: ThreadMessage) => T | undefined;
403
407
 
408
+ declare namespace useExternalMessageConverter {
409
+ type Message = ThreadMessageLike | {
410
+ role: "tool";
411
+ toolCallId: string;
412
+ toolName?: string | undefined;
413
+ result: any;
414
+ };
415
+ type Callback<T> = (message: T) => Message | Message[];
416
+ }
417
+ declare const useExternalMessageConverter: <T extends WeakKey>({ callback, messages, isRunning, }: {
418
+ callback: useExternalMessageConverter.Callback<T>;
419
+ messages: T[];
420
+ isRunning: boolean;
421
+ }) => ThreadMessage[];
422
+
404
423
  type DangerousInBrowserAdapterOptions = CreateEdgeRuntimeAPIOptions;
405
424
 
406
425
  type DangerousInBrowserRuntimeOptions = DangerousInBrowserAdapterOptions & LocalRuntimeOptions;
@@ -410,6 +429,7 @@ type ThreadRuntimeStore = ThreadRuntime;
410
429
 
411
430
  type ThreadState = Readonly<{
412
431
  capabilities: Readonly<RuntimeCapabilities>;
432
+ threadId: string;
413
433
  isRunning: boolean;
414
434
  isDisabled: boolean;
415
435
  }>;
@@ -424,6 +444,7 @@ type RuntimeCapabilities = {
424
444
 
425
445
  type AddToolResultOptions = {
426
446
  messageId: string;
447
+ toolName: string;
427
448
  toolCallId: string;
428
449
  result: any;
429
450
  };
@@ -440,6 +461,7 @@ type ThreadActionsState = Readonly<{
440
461
  type ThreadRuntime = ThreadActionsState & Readonly<{
441
462
  composer: ThreadRuntime.Composer;
442
463
  capabilities: Readonly<RuntimeCapabilities>;
464
+ threadId: string;
443
465
  isDisabled: boolean;
444
466
  messages: readonly ThreadMessage[];
445
467
  subscribe: (callback: () => void) => Unsubscribe;
@@ -596,7 +618,10 @@ type AssistantToolProps<TArgs extends Record<string, unknown>, TResult> = Tool<T
596
618
  };
597
619
  declare const useAssistantTool: <TArgs extends Record<string, unknown>, TResult>(tool: AssistantToolProps<TArgs, TResult>) => void;
598
620
 
599
- 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;
600
625
 
601
626
  type AssistantToolUIProps<TArgs extends Record<string, unknown>, TResult> = {
602
627
  toolName: string;
@@ -604,7 +629,10 @@ type AssistantToolUIProps<TArgs extends Record<string, unknown>, TResult> = {
604
629
  };
605
630
  declare const useAssistantToolUI: (tool: AssistantToolUIProps<any, any> | null) => void;
606
631
 
607
- 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;
608
636
 
609
637
  declare const useAssistantInstructions: (instruction: string) => void;
610
638
 
@@ -889,7 +917,7 @@ type MessagePrimitiveContentProps = {
889
917
  tools?: {
890
918
  by_name?: Record<string, ToolCallContentPartComponent | undefined> | undefined;
891
919
  Fallback?: ComponentType<ToolCallContentPartProps> | undefined;
892
- };
920
+ } | undefined;
893
921
  } | undefined;
894
922
  };
895
923
  declare const MessagePrimitiveContent: FC<MessagePrimitiveContentProps>;
@@ -991,6 +1019,7 @@ type AssistantMessageConfig = {
991
1019
  allowSpeak?: boolean | undefined;
992
1020
  components?: {
993
1021
  Text?: TextContentPartComponent | undefined;
1022
+ ToolFallback?: ComponentType<ToolCallContentPartProps> | undefined;
994
1023
  } | undefined;
995
1024
  };
996
1025
  type BranchPickerConfig = {
@@ -1076,6 +1105,7 @@ type ThreadConfig = {
1076
1105
  userMessage?: UserMessageConfig;
1077
1106
  branchPicker?: BranchPickerConfig;
1078
1107
  strings?: StringsConfig;
1108
+ tools?: AssistantToolUI[];
1079
1109
  };
1080
1110
  declare const useThreadConfig: () => Omit<ThreadConfig, "runtime">;
1081
1111
  type ThreadConfigProviderProps = PropsWithChildren<{
@@ -1257,4 +1287,4 @@ declare const exports: {
1257
1287
  Text: FC;
1258
1288
  };
1259
1289
 
1260
- 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, 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 };