@assistant-ui/react 0.5.19 → 0.5.20

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { ReactNode, ComponentType, PropsWithChildren, ComponentPropsWithoutRef, FC } from 'react';
2
+ import { ReactNode, ComponentType, PropsWithChildren, ComponentPropsWithoutRef, FC, ElementType } from 'react';
3
3
  import { z } from 'zod';
4
4
  import { JSONSchema7 } from 'json-schema';
5
5
  import { LanguageModelV1LogProbs, LanguageModelV1Message, LanguageModelV1FunctionTool } from '@ai-sdk/provider';
@@ -116,7 +116,7 @@ type ContentPartStatus = {
116
116
  reason: "cancelled" | "length" | "content-filter" | "other" | "error";
117
117
  error?: unknown;
118
118
  };
119
- type ToolContentPartStatus = {
119
+ type ToolCallContentPartStatus = {
120
120
  type: "requires-action";
121
121
  reason: "tool-calls";
122
122
  } | ContentPartStatus;
@@ -224,7 +224,7 @@ type UIContentPartProps = {
224
224
  type UIContentPartComponent = ComponentType<UIContentPartProps>;
225
225
  type ToolCallContentPartProps<TArgs extends Record<string, unknown> = any, TResult = unknown> = {
226
226
  part: ToolCallContentPart<TArgs, TResult>;
227
- status: ToolContentPartStatus;
227
+ status: ToolCallContentPartStatus;
228
228
  addResult: (result: any) => void;
229
229
  };
230
230
  type ToolCallContentPartComponent<TArgs extends Record<string, unknown> = any, TResult = any> = ComponentType<ToolCallContentPartProps<TArgs, TResult>>;
@@ -609,7 +609,30 @@ declare class MessageRepository {
609
609
  resetHead(messageId: string | null): void;
610
610
  }
611
611
 
612
- declare const useSmooth: (text: string, smooth?: boolean) => string;
612
+ type TextContentPartState = Readonly<{
613
+ status: ContentPartStatus;
614
+ part: TextContentPart;
615
+ }>;
616
+ type ContentPartState = Readonly<{
617
+ status: ContentPartStatus | ToolCallContentPartStatus;
618
+ part: TextContentPart | ImageContentPart | UIContentPart | ToolCallContentPart;
619
+ }>;
620
+
621
+ declare const useSmooth: (state: TextContentPartState, smooth?: boolean) => TextContentPartState;
622
+
623
+ declare const withSmoothContextProvider: <C extends React.ComponentType<any>>(Component: C) => C;
624
+ declare const useSmoothStatus: () => {
625
+ type: "running";
626
+ } | {
627
+ type: "complete";
628
+ } | {
629
+ type: "incomplete";
630
+ reason: "cancelled" | "length" | "content-filter" | "other" | "error";
631
+ error?: unknown;
632
+ } | {
633
+ type: "requires-action";
634
+ reason: "tool-calls";
635
+ };
613
636
 
614
637
  declare const buttonVariants: (props?: ({
615
638
  variant?: "default" | "outline" | "ghost" | null | undefined;
@@ -644,8 +667,10 @@ declare const internal_ProxyConfigProvider: typeof ProxyConfigProvider;
644
667
  declare const internal_TooltipIconButton: typeof TooltipIconButton;
645
668
  declare const internal_generateId: typeof generateId;
646
669
  declare const internal_useSmooth: typeof useSmooth;
670
+ declare const internal_useSmoothStatus: typeof useSmoothStatus;
671
+ declare const internal_withSmoothContextProvider: typeof withSmoothContextProvider;
647
672
  declare namespace internal {
648
- export { internal_BaseAssistantRuntime as BaseAssistantRuntime, internal_MessageRepository as MessageRepository, internal_ProxyConfigProvider as ProxyConfigProvider, internal_TooltipIconButton as TooltipIconButton, internal_generateId as generateId, internal_useSmooth as useSmooth };
673
+ export { internal_BaseAssistantRuntime as BaseAssistantRuntime, internal_MessageRepository as MessageRepository, internal_ProxyConfigProvider as ProxyConfigProvider, internal_TooltipIconButton as TooltipIconButton, internal_generateId as generateId, internal_useSmooth as useSmooth, internal_useSmoothStatus as useSmoothStatus, internal_withSmoothContextProvider as withSmoothContextProvider };
649
674
  }
650
675
 
651
676
  declare class ExternalStoreThreadRuntime implements ReactThreadRuntime {
@@ -828,11 +853,6 @@ declare function useMessageContext(options: {
828
853
  optional: true;
829
854
  }): MessageContextValue | null;
830
855
 
831
- type ContentPartState = Readonly<{
832
- status: ToolContentPartStatus;
833
- part: TextContentPart | ImageContentPart | UIContentPart | ToolCallContentPart;
834
- }>;
835
-
836
856
  type ContentPartContextValue = {
837
857
  useContentPart: ReadonlyStore<ContentPartState>;
838
858
  };
@@ -1088,15 +1108,17 @@ declare namespace index$3 {
1088
1108
  }
1089
1109
 
1090
1110
  type PrimitiveSpanProps$1 = ComponentPropsWithoutRef<typeof Primitive.span>;
1091
- type ContentPartPrimitiveTextProps = Omit<PrimitiveSpanProps$1, "children"> & {
1111
+ type ContentPartPrimitiveTextProps = Omit<PrimitiveSpanProps$1, "children" | "asChild"> & {
1092
1112
  smooth?: boolean;
1113
+ component?: ElementType;
1093
1114
  };
1094
1115
  declare const ContentPartPrimitiveText: react.ForwardRefExoticComponent<Omit<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
1095
1116
  ref?: ((instance: HTMLSpanElement | null) => void | react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | react.RefObject<HTMLSpanElement> | null | undefined;
1096
1117
  } & {
1097
1118
  asChild?: boolean;
1098
- }, "ref">, "children"> & {
1119
+ }, "ref">, "children" | "asChild"> & {
1099
1120
  smooth?: boolean;
1121
+ component?: ElementType;
1100
1122
  } & react.RefAttributes<HTMLSpanElement>>;
1101
1123
 
1102
1124
  type PrimitiveImageProps = ComponentPropsWithoutRef<typeof Primitive.img>;
@@ -1487,7 +1509,7 @@ declare const exports$1: {
1487
1509
  declare const _default: typeof ThreadWelcome & typeof exports$1;
1488
1510
 
1489
1511
  declare const exports: {
1490
- Text: FC<TextContentPartProps>;
1512
+ Text: FC;
1491
1513
  };
1492
1514
 
1493
1515
  export { index$6 as ActionBarPrimitive, type ActionBarPrimitiveCopyProps, type ActionBarPrimitiveEditProps, type ActionBarPrimitiveReloadProps, type ActionBarPrimitiveRootProps, type AddToolResultOptions, type 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, type CoreAssistantContentPart, type CoreAssistantMessage, type CoreMessage, type CoreSystemMessage, type CoreUserContentPart, type CoreUserMessage, EdgeChatAdapter, type EdgeRuntimeOptions, type EdgeRuntimeRequestOptions, _default$4 as EditComposer, type EditComposerState, type ExternalStoreAdapter, type ExternalStoreMessageConverter, ExternalStoreRuntime, internal as INTERNAL, type ImageContentPart, type ImageContentPartComponent, type ImageContentPartProps, type LocalRuntimeOptions, type MessageContextValue, index$1 as MessagePrimitive, type MessagePrimitiveContentProps, type MessagePrimitiveIfProps, type MessagePrimitiveInProgressProps, type MessagePrimitiveRootProps, type MessageState, type MessageStatus, type MessageUtilsState, type ModelConfig, type ModelConfigProvider, type ReactThreadRuntime, type StringsConfig, type SuggestionConfig, type TextContentPart, type TextContentPartComponent, type TextContentPartProps, _default$3 as Thread, type ThreadActionsState, type ThreadAssistantContentPart, type ThreadAssistantMessage, type ThreadConfig, ThreadConfigProvider, type ThreadConfigProviderProps, type ThreadContextValue, type ThreadMessage, type ThreadMessageLike, type ThreadMessagesState, index as ThreadPrimitive, type ThreadPrimitiveEmptyProps, type ThreadPrimitiveIfProps, type ThreadPrimitiveMessagesProps, type ThreadPrimitiveRootProps, type ThreadPrimitiveScrollToBottomProps, type ThreadPrimitiveSuggestionProps, type ThreadPrimitiveViewportProps, type ThreadRootProps, type ThreadRuntime, type ThreadState, type ThreadSystemMessage, type ThreadUserContentPart, type ThreadUserMessage, type ThreadViewportState, _default as ThreadWelcome, type ThreadWelcomeConfig, type ThreadWelcomeMessageProps, type ThreadWelcomeSuggestionProps, type Tool, type ToolCallContentPart, type ToolCallContentPartComponent, type ToolCallContentPartProps, type UIContentPart, type UIContentPartComponent, type UIContentPartProps, type Unsubscribe, type UseActionBarCopyProps, _default$1 as UserActionBar, _default$2 as UserMessage, type UserMessageConfig, type UserMessageContentProps, fromCoreMessage, fromCoreMessages, fromLanguageModelMessages, fromLanguageModelTools, getExternalStoreMessage, makeAssistantTool, makeAssistantToolUI, toCoreMessage, toCoreMessages, toLanguageModelMessages, toLanguageModelTools, useActionBarCopy, useActionBarEdit, useActionBarReload, useAppendMessage, useAssistantContext, useAssistantInstructions, useAssistantTool, useAssistantToolUI, useBranchPickerCount, useBranchPickerNext, useBranchPickerNumber, useBranchPickerPrevious, useComposerCancel, useComposerContext, useComposerIf, useComposerSend, useContentPartContext, useContentPartDisplay, useContentPartImage, useContentPartText, useEdgeRuntime, useExternalStoreRuntime, useLocalRuntime, useMessageContext, useMessageIf, useSwitchToNewThread, useThreadConfig, useThreadContext, useThreadEmpty, useThreadIf, useThreadScrollToBottom, useThreadSuggestion };