@assistant-ui/react 0.2.4 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.mts CHANGED
@@ -8,14 +8,14 @@ import { TextareaAutosizeProps } from 'react-textarea-autosize';
8
8
 
9
9
  type ToolExecuteFunction<TArgs, TResult> = (args: TArgs) => TResult | Promise<TResult>;
10
10
  type Tool<TArgs = unknown, TResult = unknown> = {
11
- description?: string;
11
+ description?: string | undefined;
12
12
  parameters: z.ZodSchema<TArgs>;
13
13
  execute: ToolExecuteFunction<TArgs, TResult>;
14
14
  };
15
15
  type ModelConfig = {
16
- priority?: number;
17
- system?: string;
18
- tools?: Record<string, Tool<any, any>>;
16
+ priority?: number | undefined;
17
+ system?: string | undefined;
18
+ tools?: Record<string, Tool<any, any>> | undefined;
19
19
  };
20
20
  type ModelConfigProvider = () => ModelConfig;
21
21
 
@@ -184,7 +184,7 @@ type AssistantModelConfigState = Readonly<{
184
184
 
185
185
  type ContentPartState = Readonly<{
186
186
  status: "in_progress" | "done" | "error";
187
- part: ThreadMessage["content"][number];
187
+ part: TextContentPart | ImageContentPart | UIContentPart | ToolCallContentPart;
188
188
  }>;
189
189
 
190
190
  type MessageState = Readonly<{
@@ -252,7 +252,6 @@ type ComposerContextValue = {
252
252
  declare const useComposerContext: () => ComposerContextValue;
253
253
 
254
254
  type MessageUtilsState = Readonly<{
255
- inProgressIndicator: HTMLSpanElement;
256
255
  isCopied: boolean;
257
256
  setIsCopied: (value: boolean) => void;
258
257
  isHovering: boolean;
@@ -281,7 +280,7 @@ type ComposerState = BaseComposerState & Readonly<{
281
280
 
282
281
  type CreateAppendMessage = string | {
283
282
  parentId?: string | null | undefined;
284
- role?: AppendMessage["role"];
283
+ role?: AppendMessage["role"] | undefined;
285
284
  content: AppendMessage["content"];
286
285
  };
287
286
  declare const useAppendMessage: () => (message: CreateAppendMessage) => void;
@@ -290,7 +289,7 @@ declare const useSwitchToNewThread: () => () => void;
290
289
 
291
290
  type AssistantToolProps<TArgs, TResult> = Tool<TArgs, TResult> & {
292
291
  toolName: string;
293
- render?: ToolCallContentPartComponent<TArgs, TResult>;
292
+ render?: ToolCallContentPartComponent<TArgs, TResult> | undefined;
294
293
  };
295
294
  declare const useAssistantTool: <TArgs, TResult>(tool: AssistantToolProps<TArgs, TResult>) => void;
296
295
 
@@ -307,7 +306,7 @@ declare const makeAssistantToolUI: <TArgs, TResult>(tool: AssistantToolUIProps<T
307
306
  declare const useAssistantInstructions: (instruction: string) => void;
308
307
 
309
308
  type UseActionBarCopyProps = {
310
- copiedDuration?: number;
309
+ copiedDuration?: number | undefined;
311
310
  };
312
311
  declare const useActionBarCopy: ({ copiedDuration, }?: UseActionBarCopyProps) => (() => void) | null;
313
312
 
@@ -341,7 +340,10 @@ declare const useContentPartDisplay: () => react.ReactNode;
341
340
 
342
341
  declare const useContentPartImage: () => string;
343
342
 
344
- declare const useContentPartText: () => string;
343
+ declare const useContentPartText: () => Readonly<{
344
+ status: "in_progress" | "done" | "error";
345
+ part: TextContentPart;
346
+ }>;
345
347
 
346
348
  type MessageIfFilters = {
347
349
  user: boolean | undefined;
@@ -367,7 +369,7 @@ declare const useThreadScrollToBottom: () => (() => void) | null;
367
369
  type UseApplyThreadSuggestionProps = {
368
370
  prompt: string;
369
371
  method: "replace";
370
- autoSend?: boolean;
372
+ autoSend?: boolean | undefined;
371
373
  };
372
374
  declare const useThreadSuggestion: ({ prompt, autoSend, }: UseApplyThreadSuggestionProps) => (() => void) | null;
373
375
 
@@ -393,9 +395,7 @@ declare const ActionBarPrimitiveCopy: react.ForwardRefExoticComponent<Omit<Omit<
393
395
  ref?: ((instance: HTMLButtonElement | 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<HTMLButtonElement> | null | undefined;
394
396
  } & {
395
397
  asChild?: boolean;
396
- }, "ref"> & {
397
- copiedDuration?: number;
398
- } & react.RefAttributes<HTMLButtonElement>>;
398
+ }, "ref"> & UseActionBarCopyProps & react.RefAttributes<HTMLButtonElement>>;
399
399
 
400
400
  type ActionBarPrimitiveReloadProps = ActionButtonProps<typeof useActionBarReload>;
401
401
  declare const ActionBarPrimitiveReload: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
@@ -422,10 +422,10 @@ type AssistantModalPrimitiveTriggerProps = ComponentPropsWithoutRef<typeof Popov
422
422
  declare const AssistantModalPrimitiveTrigger: react.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverTriggerProps & react.RefAttributes<HTMLButtonElement>, "ref"> & react.RefAttributes<HTMLButtonElement>>;
423
423
 
424
424
  type AssistantModalPrimitiveContentProps = ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> & {
425
- dissmissOnInteractOutside?: boolean;
425
+ dissmissOnInteractOutside?: boolean | undefined;
426
426
  };
427
427
  declare const AssistantModalPrimitiveContent: react.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & react.RefAttributes<HTMLDivElement>, "ref"> & {
428
- dissmissOnInteractOutside?: boolean;
428
+ dissmissOnInteractOutside?: boolean | undefined;
429
429
  } & react.RefAttributes<HTMLDivElement>>;
430
430
 
431
431
  declare const AssistantModalPrimitiveAnchor: react.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverAnchorProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
@@ -456,14 +456,14 @@ declare const BranchPickerPrimitiveNumber: FC<BranchPickerPrimitiveNumberProps>;
456
456
 
457
457
  type PrimitiveDivProps$3 = ComponentPropsWithoutRef<typeof Primitive.div>;
458
458
  type BranchPickerPrimitiveRootProps = PrimitiveDivProps$3 & {
459
- hideWhenSingleBranch?: boolean;
459
+ hideWhenSingleBranch?: boolean | undefined;
460
460
  };
461
461
  declare const BranchPickerPrimitiveRoot: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
462
462
  ref?: ((instance: HTMLDivElement | 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<HTMLDivElement> | null | undefined;
463
463
  } & {
464
464
  asChild?: boolean;
465
465
  }, "ref"> & {
466
- hideWhenSingleBranch?: boolean;
466
+ hideWhenSingleBranch?: boolean | undefined;
467
467
  } & react.RefAttributes<HTMLDivElement>>;
468
468
 
469
469
  declare namespace index$4 {
@@ -479,10 +479,10 @@ declare const ComposerPrimitiveRoot: react.ForwardRefExoticComponent<Omit<Omit<r
479
479
  }, "ref"> & react.RefAttributes<HTMLFormElement>>;
480
480
 
481
481
  type ComposerPrimitiveInputProps = TextareaAutosizeProps & {
482
- asChild?: boolean;
482
+ asChild?: boolean | undefined;
483
483
  };
484
484
  declare const ComposerPrimitiveInput: react.ForwardRefExoticComponent<TextareaAutosizeProps & {
485
- asChild?: boolean;
485
+ asChild?: boolean | undefined;
486
486
  } & react.RefAttributes<HTMLTextAreaElement>>;
487
487
 
488
488
  type PrimitiveButtonProps = ComponentPropsWithoutRef<typeof Primitive.button>;
@@ -507,12 +507,9 @@ declare namespace index$3 {
507
507
  export { ComposerPrimitiveCancel as Cancel, ComposerPrimitiveIf as If, ComposerPrimitiveInput as Input, ComposerPrimitiveRoot as Root, ComposerPrimitiveSend as Send };
508
508
  }
509
509
 
510
- type ContentPartPrimitiveInProgressIndicatorProps = {};
511
- declare const ContentPartPrimitiveInProgressIndicator: FC<ContentPartPrimitiveInProgressIndicatorProps>;
512
-
513
- type PrimitiveSpanProps$1 = ComponentPropsWithoutRef<typeof Primitive.p>;
510
+ type PrimitiveSpanProps$1 = ComponentPropsWithoutRef<typeof Primitive.span>;
514
511
  type ContentPartPrimitiveTextProps = Omit<PrimitiveSpanProps$1, "children">;
515
- declare const ContentPartPrimitiveText: react.ForwardRefExoticComponent<ContentPartPrimitiveTextProps & react.RefAttributes<HTMLParagraphElement>>;
512
+ declare const ContentPartPrimitiveText: react.ForwardRefExoticComponent<ContentPartPrimitiveTextProps & react.RefAttributes<HTMLSpanElement>>;
516
513
 
517
514
  type PrimitiveImageProps = ComponentPropsWithoutRef<typeof Primitive.img>;
518
515
  type ContentPartPrimitiveImageProps = PrimitiveImageProps;
@@ -525,8 +522,11 @@ declare const ContentPartPrimitiveImage: react.ForwardRefExoticComponent<Omit<Om
525
522
  type ContentPartPrimitiveDisplayProps = {};
526
523
  declare const ContentPartPrimitiveDisplay: FC<ContentPartPrimitiveDisplayProps>;
527
524
 
525
+ type ContentPartPrimitiveInProgressProps = PropsWithChildren;
526
+ declare const ContentPartPrimitiveInProgress: FC<ContentPartPrimitiveInProgressProps>;
527
+
528
528
  declare namespace index$2 {
529
- export { ContentPartPrimitiveDisplay as Display, ContentPartPrimitiveImage as Image, ContentPartPrimitiveInProgressIndicator as InProgressIndicator, ContentPartPrimitiveText as Text };
529
+ export { ContentPartPrimitiveDisplay as Display, ContentPartPrimitiveImage as Image, ContentPartPrimitiveInProgress as InProgress, ContentPartPrimitiveText as Text };
530
530
  }
531
531
 
532
532
  type PrimitiveDivProps$2 = ComponentPropsWithoutRef<typeof Primitive.div>;
@@ -542,24 +542,23 @@ declare const MessagePrimitiveIf: FC<MessagePrimitiveIfProps>;
542
542
 
543
543
  type MessagePrimitiveContentProps = {
544
544
  components?: {
545
- Text?: TextContentPartComponent;
546
- Image?: ImageContentPartComponent;
547
- UI?: UIContentPartComponent;
545
+ Text?: TextContentPartComponent | undefined;
546
+ Image?: ImageContentPartComponent | undefined;
547
+ UI?: UIContentPartComponent | undefined;
548
548
  tools?: {
549
- by_name?: Record<string, ToolCallContentPartComponent>;
550
- Fallback?: ComponentType<ToolCallContentPartProps>;
549
+ by_name?: Record<string, ToolCallContentPartComponent | undefined> | undefined;
550
+ Fallback?: ComponentType<ToolCallContentPartProps> | undefined;
551
551
  };
552
- };
552
+ } | undefined;
553
553
  };
554
554
  declare const MessagePrimitiveContent: FC<MessagePrimitiveContentProps>;
555
555
 
556
556
  type PrimitiveSpanProps = ComponentPropsWithoutRef<typeof Primitive.span>;
557
557
  type MessagePrimitiveInProgressProps = PrimitiveSpanProps;
558
- declare const MessagePrimitiveInProgress: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
559
- 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;
560
- } & {
561
- asChild?: boolean;
562
- }, "ref"> & react.RefAttributes<HTMLSpanElement>>;
558
+ /**
559
+ * @deprecated Define a custom Text renderer via ContentPartPrimitiveInProgress instead.
560
+ */
561
+ declare const MessagePrimitiveInProgress: FC<MessagePrimitiveInProgressProps>;
563
562
 
564
563
  declare namespace index$1 {
565
564
  export { MessagePrimitiveContent as Content, MessagePrimitiveIf as If, MessagePrimitiveInProgress as InProgress, MessagePrimitiveRoot as Root };
@@ -596,13 +595,13 @@ declare const ThreadPrimitiveViewport: react.ForwardRefExoticComponent<Omit<Omit
596
595
  type ThreadPrimitiveMessagesProps = {
597
596
  components: {
598
597
  Message: ComponentType;
599
- UserMessage?: ComponentType;
600
- EditComposer?: ComponentType;
601
- AssistantMessage?: ComponentType;
598
+ UserMessage?: ComponentType | undefined;
599
+ EditComposer?: ComponentType | undefined;
600
+ AssistantMessage?: ComponentType | undefined;
602
601
  } | {
603
- Message?: ComponentType;
602
+ Message?: ComponentType | undefined;
604
603
  UserMessage: ComponentType;
605
- EditComposer?: ComponentType;
604
+ EditComposer?: ComponentType | undefined;
606
605
  AssistantMessage: ComponentType;
607
606
  };
608
607
  };
@@ -620,11 +619,7 @@ declare const ThreadPrimitiveSuggestion: react.ForwardRefExoticComponent<Omit<Om
620
619
  ref?: ((instance: HTMLButtonElement | 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<HTMLButtonElement> | null | undefined;
621
620
  } & {
622
621
  asChild?: boolean;
623
- }, "ref"> & {
624
- prompt: string;
625
- method: "replace";
626
- autoSend?: boolean;
627
- } & react.RefAttributes<HTMLButtonElement>>;
622
+ }, "ref"> & UseApplyThreadSuggestionProps & react.RefAttributes<HTMLButtonElement>>;
628
623
 
629
624
  declare namespace index {
630
625
  export { ThreadPrimitiveEmpty as Empty, ThreadPrimitiveIf as If, ThreadPrimitiveMessages as Messages, ThreadPrimitiveRoot as Root, ThreadPrimitiveScrollToBottom as ScrollToBottom, ThreadPrimitiveSuggestion as Suggestion, ThreadPrimitiveViewport as Viewport };
@@ -660,4 +655,4 @@ declare namespace internal {
660
655
  export { internal_BaseAssistantRuntime as BaseAssistantRuntime, internal_MessageRepository as MessageRepository, internal_ProxyConfigProvider as ProxyConfigProvider };
661
656
  }
662
657
 
663
- export { index$6 as ActionBarPrimitive, type ActionBarPrimitiveCopyProps, type ActionBarPrimitiveEditProps, type ActionBarPrimitiveReloadProps, type ActionBarPrimitiveRootProps, type AppendContentPart, type AppendMessage, type AssistantContentPart, type AssistantContextValue, type AssistantMessage, index$5 as AssistantModalPrimitive, type AssistantModalPrimitiveContentProps, type AssistantModalPrimitiveRootProps, type AssistantModalPrimitiveTriggerProps, type AssistantModelConfigState, type AssistantRuntime, AssistantRuntimeProvider, type AssistantToolProps, type AssistantToolUIProps, index$4 as BranchPickerPrimitive, type BranchPickerPrimitiveCountProps, type BranchPickerPrimitiveNextProps, type BranchPickerPrimitiveNumberProps, type BranchPickerPrimitivePreviousProps, type BranchPickerPrimitiveRootProps, type ChatModelAdapter, type ChatModelRunOptions, type ComposerContextValue, index$3 as ComposerPrimitive, type ComposerPrimitiveCancelProps, type ComposerPrimitiveIfProps, type ComposerPrimitiveInputProps, type ComposerPrimitiveRootProps, type ComposerPrimitiveSendProps, type ComposerState, type ContentPartContextValue, index$2 as ContentPartPrimitive, type ContentPartPrimitiveDisplayProps, type ContentPartPrimitiveImageProps, type ContentPartPrimitiveInProgressIndicatorProps, type ContentPartPrimitiveTextProps, type ContentPartState, type EditComposerState, internal as INTERNAL, type ImageContentPart, type ImageContentPartComponent, type ImageContentPartProps, type MessageContextValue, index$1 as MessagePrimitive, type MessagePrimitiveContentProps, type MessagePrimitiveIfProps, type MessagePrimitiveInProgressProps, type MessagePrimitiveRootProps, type MessageState, type ModelConfig, type ModelConfigProvider, type ReactThreadRuntime, type TextContentPart, type TextContentPartComponent, type TextContentPartProps, type ThreadContextValue, type ThreadMessage, index as ThreadPrimitive, type ThreadPrimitiveEmptyProps, type ThreadPrimitiveIfProps, type ThreadPrimitiveMessagesProps, type ThreadPrimitiveRootProps, type ThreadPrimitiveScrollToBottomProps, type ThreadPrimitiveSuggestionProps, type ThreadPrimitiveViewportProps, type ThreadRuntime, type ThreadState, type ThreadViewportState, type ToolCallContentPart, type ToolCallContentPartComponent, type ToolCallContentPartProps, type UIContentPart, type UIContentPartComponent, type UIContentPartProps, type Unsubscribe, type UserContentPart, type UserMessage, makeAssistantTool, makeAssistantToolUI, useActionBarCopy, useActionBarEdit, useActionBarReload, useAppendMessage, useAssistantContext, useAssistantInstructions, useAssistantTool, useAssistantToolUI, useBranchPickerCount, useBranchPickerNext, useBranchPickerNumber, useBranchPickerPrevious, useComposerCancel, useComposerContext, useComposerIf, useComposerSend, useContentPartContext, useContentPartDisplay, useContentPartImage, useContentPartText, useLocalRuntime, useMessageContext, useMessageIf, useSwitchToNewThread, useThreadContext, useThreadEmpty, useThreadIf, useThreadScrollToBottom, useThreadSuggestion };
658
+ export { index$6 as ActionBarPrimitive, type ActionBarPrimitiveCopyProps, type ActionBarPrimitiveEditProps, type ActionBarPrimitiveReloadProps, type ActionBarPrimitiveRootProps, type AppendContentPart, type AppendMessage, type AssistantContentPart, type AssistantContextValue, type AssistantMessage, index$5 as AssistantModalPrimitive, type AssistantModalPrimitiveContentProps, type AssistantModalPrimitiveRootProps, type AssistantModalPrimitiveTriggerProps, type AssistantModelConfigState, type AssistantRuntime, AssistantRuntimeProvider, type AssistantToolProps, type AssistantToolUIProps, index$4 as BranchPickerPrimitive, type BranchPickerPrimitiveCountProps, type BranchPickerPrimitiveNextProps, type BranchPickerPrimitiveNumberProps, type BranchPickerPrimitivePreviousProps, type BranchPickerPrimitiveRootProps, type ChatModelAdapter, type ChatModelRunOptions, type ComposerContextValue, index$3 as ComposerPrimitive, type ComposerPrimitiveCancelProps, type ComposerPrimitiveIfProps, type ComposerPrimitiveInputProps, type ComposerPrimitiveRootProps, type ComposerPrimitiveSendProps, type ComposerState, type ContentPartContextValue, index$2 as ContentPartPrimitive, type ContentPartPrimitiveDisplayProps, type ContentPartPrimitiveImageProps, type ContentPartPrimitiveInProgressProps, type ContentPartPrimitiveTextProps, type ContentPartState, type EditComposerState, internal as INTERNAL, type ImageContentPart, type ImageContentPartComponent, type ImageContentPartProps, type MessageContextValue, index$1 as MessagePrimitive, type MessagePrimitiveContentProps, type MessagePrimitiveIfProps, type MessagePrimitiveInProgressProps, type MessagePrimitiveRootProps, type MessageState, type ModelConfig, type ModelConfigProvider, type ReactThreadRuntime, type TextContentPart, type TextContentPartComponent, type TextContentPartProps, type ThreadContextValue, type ThreadMessage, index as ThreadPrimitive, type ThreadPrimitiveEmptyProps, type ThreadPrimitiveIfProps, type ThreadPrimitiveMessagesProps, type ThreadPrimitiveRootProps, type ThreadPrimitiveScrollToBottomProps, type ThreadPrimitiveSuggestionProps, type ThreadPrimitiveViewportProps, type ThreadRuntime, type ThreadState, type ThreadViewportState, type ToolCallContentPart, type ToolCallContentPartComponent, type ToolCallContentPartProps, type UIContentPart, type UIContentPartComponent, type UIContentPartProps, type Unsubscribe, type UserContentPart, type UserMessage, makeAssistantTool, makeAssistantToolUI, useActionBarCopy, useActionBarEdit, useActionBarReload, useAppendMessage, useAssistantContext, useAssistantInstructions, useAssistantTool, useAssistantToolUI, useBranchPickerCount, useBranchPickerNext, useBranchPickerNumber, useBranchPickerPrevious, useComposerCancel, useComposerContext, useComposerIf, useComposerSend, useContentPartContext, useContentPartDisplay, useContentPartImage, useContentPartText, useLocalRuntime, useMessageContext, useMessageIf, useSwitchToNewThread, useThreadContext, useThreadEmpty, useThreadIf, useThreadScrollToBottom, useThreadSuggestion };
package/dist/index.d.ts CHANGED
@@ -8,14 +8,14 @@ import { TextareaAutosizeProps } from 'react-textarea-autosize';
8
8
 
9
9
  type ToolExecuteFunction<TArgs, TResult> = (args: TArgs) => TResult | Promise<TResult>;
10
10
  type Tool<TArgs = unknown, TResult = unknown> = {
11
- description?: string;
11
+ description?: string | undefined;
12
12
  parameters: z.ZodSchema<TArgs>;
13
13
  execute: ToolExecuteFunction<TArgs, TResult>;
14
14
  };
15
15
  type ModelConfig = {
16
- priority?: number;
17
- system?: string;
18
- tools?: Record<string, Tool<any, any>>;
16
+ priority?: number | undefined;
17
+ system?: string | undefined;
18
+ tools?: Record<string, Tool<any, any>> | undefined;
19
19
  };
20
20
  type ModelConfigProvider = () => ModelConfig;
21
21
 
@@ -184,7 +184,7 @@ type AssistantModelConfigState = Readonly<{
184
184
 
185
185
  type ContentPartState = Readonly<{
186
186
  status: "in_progress" | "done" | "error";
187
- part: ThreadMessage["content"][number];
187
+ part: TextContentPart | ImageContentPart | UIContentPart | ToolCallContentPart;
188
188
  }>;
189
189
 
190
190
  type MessageState = Readonly<{
@@ -252,7 +252,6 @@ type ComposerContextValue = {
252
252
  declare const useComposerContext: () => ComposerContextValue;
253
253
 
254
254
  type MessageUtilsState = Readonly<{
255
- inProgressIndicator: HTMLSpanElement;
256
255
  isCopied: boolean;
257
256
  setIsCopied: (value: boolean) => void;
258
257
  isHovering: boolean;
@@ -281,7 +280,7 @@ type ComposerState = BaseComposerState & Readonly<{
281
280
 
282
281
  type CreateAppendMessage = string | {
283
282
  parentId?: string | null | undefined;
284
- role?: AppendMessage["role"];
283
+ role?: AppendMessage["role"] | undefined;
285
284
  content: AppendMessage["content"];
286
285
  };
287
286
  declare const useAppendMessage: () => (message: CreateAppendMessage) => void;
@@ -290,7 +289,7 @@ declare const useSwitchToNewThread: () => () => void;
290
289
 
291
290
  type AssistantToolProps<TArgs, TResult> = Tool<TArgs, TResult> & {
292
291
  toolName: string;
293
- render?: ToolCallContentPartComponent<TArgs, TResult>;
292
+ render?: ToolCallContentPartComponent<TArgs, TResult> | undefined;
294
293
  };
295
294
  declare const useAssistantTool: <TArgs, TResult>(tool: AssistantToolProps<TArgs, TResult>) => void;
296
295
 
@@ -307,7 +306,7 @@ declare const makeAssistantToolUI: <TArgs, TResult>(tool: AssistantToolUIProps<T
307
306
  declare const useAssistantInstructions: (instruction: string) => void;
308
307
 
309
308
  type UseActionBarCopyProps = {
310
- copiedDuration?: number;
309
+ copiedDuration?: number | undefined;
311
310
  };
312
311
  declare const useActionBarCopy: ({ copiedDuration, }?: UseActionBarCopyProps) => (() => void) | null;
313
312
 
@@ -341,7 +340,10 @@ declare const useContentPartDisplay: () => react.ReactNode;
341
340
 
342
341
  declare const useContentPartImage: () => string;
343
342
 
344
- declare const useContentPartText: () => string;
343
+ declare const useContentPartText: () => Readonly<{
344
+ status: "in_progress" | "done" | "error";
345
+ part: TextContentPart;
346
+ }>;
345
347
 
346
348
  type MessageIfFilters = {
347
349
  user: boolean | undefined;
@@ -367,7 +369,7 @@ declare const useThreadScrollToBottom: () => (() => void) | null;
367
369
  type UseApplyThreadSuggestionProps = {
368
370
  prompt: string;
369
371
  method: "replace";
370
- autoSend?: boolean;
372
+ autoSend?: boolean | undefined;
371
373
  };
372
374
  declare const useThreadSuggestion: ({ prompt, autoSend, }: UseApplyThreadSuggestionProps) => (() => void) | null;
373
375
 
@@ -393,9 +395,7 @@ declare const ActionBarPrimitiveCopy: react.ForwardRefExoticComponent<Omit<Omit<
393
395
  ref?: ((instance: HTMLButtonElement | 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<HTMLButtonElement> | null | undefined;
394
396
  } & {
395
397
  asChild?: boolean;
396
- }, "ref"> & {
397
- copiedDuration?: number;
398
- } & react.RefAttributes<HTMLButtonElement>>;
398
+ }, "ref"> & UseActionBarCopyProps & react.RefAttributes<HTMLButtonElement>>;
399
399
 
400
400
  type ActionBarPrimitiveReloadProps = ActionButtonProps<typeof useActionBarReload>;
401
401
  declare const ActionBarPrimitiveReload: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
@@ -422,10 +422,10 @@ type AssistantModalPrimitiveTriggerProps = ComponentPropsWithoutRef<typeof Popov
422
422
  declare const AssistantModalPrimitiveTrigger: react.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverTriggerProps & react.RefAttributes<HTMLButtonElement>, "ref"> & react.RefAttributes<HTMLButtonElement>>;
423
423
 
424
424
  type AssistantModalPrimitiveContentProps = ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> & {
425
- dissmissOnInteractOutside?: boolean;
425
+ dissmissOnInteractOutside?: boolean | undefined;
426
426
  };
427
427
  declare const AssistantModalPrimitiveContent: react.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & react.RefAttributes<HTMLDivElement>, "ref"> & {
428
- dissmissOnInteractOutside?: boolean;
428
+ dissmissOnInteractOutside?: boolean | undefined;
429
429
  } & react.RefAttributes<HTMLDivElement>>;
430
430
 
431
431
  declare const AssistantModalPrimitiveAnchor: react.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverAnchorProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
@@ -456,14 +456,14 @@ declare const BranchPickerPrimitiveNumber: FC<BranchPickerPrimitiveNumberProps>;
456
456
 
457
457
  type PrimitiveDivProps$3 = ComponentPropsWithoutRef<typeof Primitive.div>;
458
458
  type BranchPickerPrimitiveRootProps = PrimitiveDivProps$3 & {
459
- hideWhenSingleBranch?: boolean;
459
+ hideWhenSingleBranch?: boolean | undefined;
460
460
  };
461
461
  declare const BranchPickerPrimitiveRoot: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
462
462
  ref?: ((instance: HTMLDivElement | 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<HTMLDivElement> | null | undefined;
463
463
  } & {
464
464
  asChild?: boolean;
465
465
  }, "ref"> & {
466
- hideWhenSingleBranch?: boolean;
466
+ hideWhenSingleBranch?: boolean | undefined;
467
467
  } & react.RefAttributes<HTMLDivElement>>;
468
468
 
469
469
  declare namespace index$4 {
@@ -479,10 +479,10 @@ declare const ComposerPrimitiveRoot: react.ForwardRefExoticComponent<Omit<Omit<r
479
479
  }, "ref"> & react.RefAttributes<HTMLFormElement>>;
480
480
 
481
481
  type ComposerPrimitiveInputProps = TextareaAutosizeProps & {
482
- asChild?: boolean;
482
+ asChild?: boolean | undefined;
483
483
  };
484
484
  declare const ComposerPrimitiveInput: react.ForwardRefExoticComponent<TextareaAutosizeProps & {
485
- asChild?: boolean;
485
+ asChild?: boolean | undefined;
486
486
  } & react.RefAttributes<HTMLTextAreaElement>>;
487
487
 
488
488
  type PrimitiveButtonProps = ComponentPropsWithoutRef<typeof Primitive.button>;
@@ -507,12 +507,9 @@ declare namespace index$3 {
507
507
  export { ComposerPrimitiveCancel as Cancel, ComposerPrimitiveIf as If, ComposerPrimitiveInput as Input, ComposerPrimitiveRoot as Root, ComposerPrimitiveSend as Send };
508
508
  }
509
509
 
510
- type ContentPartPrimitiveInProgressIndicatorProps = {};
511
- declare const ContentPartPrimitiveInProgressIndicator: FC<ContentPartPrimitiveInProgressIndicatorProps>;
512
-
513
- type PrimitiveSpanProps$1 = ComponentPropsWithoutRef<typeof Primitive.p>;
510
+ type PrimitiveSpanProps$1 = ComponentPropsWithoutRef<typeof Primitive.span>;
514
511
  type ContentPartPrimitiveTextProps = Omit<PrimitiveSpanProps$1, "children">;
515
- declare const ContentPartPrimitiveText: react.ForwardRefExoticComponent<ContentPartPrimitiveTextProps & react.RefAttributes<HTMLParagraphElement>>;
512
+ declare const ContentPartPrimitiveText: react.ForwardRefExoticComponent<ContentPartPrimitiveTextProps & react.RefAttributes<HTMLSpanElement>>;
516
513
 
517
514
  type PrimitiveImageProps = ComponentPropsWithoutRef<typeof Primitive.img>;
518
515
  type ContentPartPrimitiveImageProps = PrimitiveImageProps;
@@ -525,8 +522,11 @@ declare const ContentPartPrimitiveImage: react.ForwardRefExoticComponent<Omit<Om
525
522
  type ContentPartPrimitiveDisplayProps = {};
526
523
  declare const ContentPartPrimitiveDisplay: FC<ContentPartPrimitiveDisplayProps>;
527
524
 
525
+ type ContentPartPrimitiveInProgressProps = PropsWithChildren;
526
+ declare const ContentPartPrimitiveInProgress: FC<ContentPartPrimitiveInProgressProps>;
527
+
528
528
  declare namespace index$2 {
529
- export { ContentPartPrimitiveDisplay as Display, ContentPartPrimitiveImage as Image, ContentPartPrimitiveInProgressIndicator as InProgressIndicator, ContentPartPrimitiveText as Text };
529
+ export { ContentPartPrimitiveDisplay as Display, ContentPartPrimitiveImage as Image, ContentPartPrimitiveInProgress as InProgress, ContentPartPrimitiveText as Text };
530
530
  }
531
531
 
532
532
  type PrimitiveDivProps$2 = ComponentPropsWithoutRef<typeof Primitive.div>;
@@ -542,24 +542,23 @@ declare const MessagePrimitiveIf: FC<MessagePrimitiveIfProps>;
542
542
 
543
543
  type MessagePrimitiveContentProps = {
544
544
  components?: {
545
- Text?: TextContentPartComponent;
546
- Image?: ImageContentPartComponent;
547
- UI?: UIContentPartComponent;
545
+ Text?: TextContentPartComponent | undefined;
546
+ Image?: ImageContentPartComponent | undefined;
547
+ UI?: UIContentPartComponent | undefined;
548
548
  tools?: {
549
- by_name?: Record<string, ToolCallContentPartComponent>;
550
- Fallback?: ComponentType<ToolCallContentPartProps>;
549
+ by_name?: Record<string, ToolCallContentPartComponent | undefined> | undefined;
550
+ Fallback?: ComponentType<ToolCallContentPartProps> | undefined;
551
551
  };
552
- };
552
+ } | undefined;
553
553
  };
554
554
  declare const MessagePrimitiveContent: FC<MessagePrimitiveContentProps>;
555
555
 
556
556
  type PrimitiveSpanProps = ComponentPropsWithoutRef<typeof Primitive.span>;
557
557
  type MessagePrimitiveInProgressProps = PrimitiveSpanProps;
558
- declare const MessagePrimitiveInProgress: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
559
- 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;
560
- } & {
561
- asChild?: boolean;
562
- }, "ref"> & react.RefAttributes<HTMLSpanElement>>;
558
+ /**
559
+ * @deprecated Define a custom Text renderer via ContentPartPrimitiveInProgress instead.
560
+ */
561
+ declare const MessagePrimitiveInProgress: FC<MessagePrimitiveInProgressProps>;
563
562
 
564
563
  declare namespace index$1 {
565
564
  export { MessagePrimitiveContent as Content, MessagePrimitiveIf as If, MessagePrimitiveInProgress as InProgress, MessagePrimitiveRoot as Root };
@@ -596,13 +595,13 @@ declare const ThreadPrimitiveViewport: react.ForwardRefExoticComponent<Omit<Omit
596
595
  type ThreadPrimitiveMessagesProps = {
597
596
  components: {
598
597
  Message: ComponentType;
599
- UserMessage?: ComponentType;
600
- EditComposer?: ComponentType;
601
- AssistantMessage?: ComponentType;
598
+ UserMessage?: ComponentType | undefined;
599
+ EditComposer?: ComponentType | undefined;
600
+ AssistantMessage?: ComponentType | undefined;
602
601
  } | {
603
- Message?: ComponentType;
602
+ Message?: ComponentType | undefined;
604
603
  UserMessage: ComponentType;
605
- EditComposer?: ComponentType;
604
+ EditComposer?: ComponentType | undefined;
606
605
  AssistantMessage: ComponentType;
607
606
  };
608
607
  };
@@ -620,11 +619,7 @@ declare const ThreadPrimitiveSuggestion: react.ForwardRefExoticComponent<Omit<Om
620
619
  ref?: ((instance: HTMLButtonElement | 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<HTMLButtonElement> | null | undefined;
621
620
  } & {
622
621
  asChild?: boolean;
623
- }, "ref"> & {
624
- prompt: string;
625
- method: "replace";
626
- autoSend?: boolean;
627
- } & react.RefAttributes<HTMLButtonElement>>;
622
+ }, "ref"> & UseApplyThreadSuggestionProps & react.RefAttributes<HTMLButtonElement>>;
628
623
 
629
624
  declare namespace index {
630
625
  export { ThreadPrimitiveEmpty as Empty, ThreadPrimitiveIf as If, ThreadPrimitiveMessages as Messages, ThreadPrimitiveRoot as Root, ThreadPrimitiveScrollToBottom as ScrollToBottom, ThreadPrimitiveSuggestion as Suggestion, ThreadPrimitiveViewport as Viewport };
@@ -660,4 +655,4 @@ declare namespace internal {
660
655
  export { internal_BaseAssistantRuntime as BaseAssistantRuntime, internal_MessageRepository as MessageRepository, internal_ProxyConfigProvider as ProxyConfigProvider };
661
656
  }
662
657
 
663
- export { index$6 as ActionBarPrimitive, type ActionBarPrimitiveCopyProps, type ActionBarPrimitiveEditProps, type ActionBarPrimitiveReloadProps, type ActionBarPrimitiveRootProps, type AppendContentPart, type AppendMessage, type AssistantContentPart, type AssistantContextValue, type AssistantMessage, index$5 as AssistantModalPrimitive, type AssistantModalPrimitiveContentProps, type AssistantModalPrimitiveRootProps, type AssistantModalPrimitiveTriggerProps, type AssistantModelConfigState, type AssistantRuntime, AssistantRuntimeProvider, type AssistantToolProps, type AssistantToolUIProps, index$4 as BranchPickerPrimitive, type BranchPickerPrimitiveCountProps, type BranchPickerPrimitiveNextProps, type BranchPickerPrimitiveNumberProps, type BranchPickerPrimitivePreviousProps, type BranchPickerPrimitiveRootProps, type ChatModelAdapter, type ChatModelRunOptions, type ComposerContextValue, index$3 as ComposerPrimitive, type ComposerPrimitiveCancelProps, type ComposerPrimitiveIfProps, type ComposerPrimitiveInputProps, type ComposerPrimitiveRootProps, type ComposerPrimitiveSendProps, type ComposerState, type ContentPartContextValue, index$2 as ContentPartPrimitive, type ContentPartPrimitiveDisplayProps, type ContentPartPrimitiveImageProps, type ContentPartPrimitiveInProgressIndicatorProps, type ContentPartPrimitiveTextProps, type ContentPartState, type EditComposerState, internal as INTERNAL, type ImageContentPart, type ImageContentPartComponent, type ImageContentPartProps, type MessageContextValue, index$1 as MessagePrimitive, type MessagePrimitiveContentProps, type MessagePrimitiveIfProps, type MessagePrimitiveInProgressProps, type MessagePrimitiveRootProps, type MessageState, type ModelConfig, type ModelConfigProvider, type ReactThreadRuntime, type TextContentPart, type TextContentPartComponent, type TextContentPartProps, type ThreadContextValue, type ThreadMessage, index as ThreadPrimitive, type ThreadPrimitiveEmptyProps, type ThreadPrimitiveIfProps, type ThreadPrimitiveMessagesProps, type ThreadPrimitiveRootProps, type ThreadPrimitiveScrollToBottomProps, type ThreadPrimitiveSuggestionProps, type ThreadPrimitiveViewportProps, type ThreadRuntime, type ThreadState, type ThreadViewportState, type ToolCallContentPart, type ToolCallContentPartComponent, type ToolCallContentPartProps, type UIContentPart, type UIContentPartComponent, type UIContentPartProps, type Unsubscribe, type UserContentPart, type UserMessage, makeAssistantTool, makeAssistantToolUI, useActionBarCopy, useActionBarEdit, useActionBarReload, useAppendMessage, useAssistantContext, useAssistantInstructions, useAssistantTool, useAssistantToolUI, useBranchPickerCount, useBranchPickerNext, useBranchPickerNumber, useBranchPickerPrevious, useComposerCancel, useComposerContext, useComposerIf, useComposerSend, useContentPartContext, useContentPartDisplay, useContentPartImage, useContentPartText, useLocalRuntime, useMessageContext, useMessageIf, useSwitchToNewThread, useThreadContext, useThreadEmpty, useThreadIf, useThreadScrollToBottom, useThreadSuggestion };
658
+ export { index$6 as ActionBarPrimitive, type ActionBarPrimitiveCopyProps, type ActionBarPrimitiveEditProps, type ActionBarPrimitiveReloadProps, type ActionBarPrimitiveRootProps, type AppendContentPart, type AppendMessage, type AssistantContentPart, type AssistantContextValue, type AssistantMessage, index$5 as AssistantModalPrimitive, type AssistantModalPrimitiveContentProps, type AssistantModalPrimitiveRootProps, type AssistantModalPrimitiveTriggerProps, type AssistantModelConfigState, type AssistantRuntime, AssistantRuntimeProvider, type AssistantToolProps, type AssistantToolUIProps, index$4 as BranchPickerPrimitive, type BranchPickerPrimitiveCountProps, type BranchPickerPrimitiveNextProps, type BranchPickerPrimitiveNumberProps, type BranchPickerPrimitivePreviousProps, type BranchPickerPrimitiveRootProps, type ChatModelAdapter, type ChatModelRunOptions, type ComposerContextValue, index$3 as ComposerPrimitive, type ComposerPrimitiveCancelProps, type ComposerPrimitiveIfProps, type ComposerPrimitiveInputProps, type ComposerPrimitiveRootProps, type ComposerPrimitiveSendProps, type ComposerState, type ContentPartContextValue, index$2 as ContentPartPrimitive, type ContentPartPrimitiveDisplayProps, type ContentPartPrimitiveImageProps, type ContentPartPrimitiveInProgressProps, type ContentPartPrimitiveTextProps, type ContentPartState, type EditComposerState, internal as INTERNAL, type ImageContentPart, type ImageContentPartComponent, type ImageContentPartProps, type MessageContextValue, index$1 as MessagePrimitive, type MessagePrimitiveContentProps, type MessagePrimitiveIfProps, type MessagePrimitiveInProgressProps, type MessagePrimitiveRootProps, type MessageState, type ModelConfig, type ModelConfigProvider, type ReactThreadRuntime, type TextContentPart, type TextContentPartComponent, type TextContentPartProps, type ThreadContextValue, type ThreadMessage, index as ThreadPrimitive, type ThreadPrimitiveEmptyProps, type ThreadPrimitiveIfProps, type ThreadPrimitiveMessagesProps, type ThreadPrimitiveRootProps, type ThreadPrimitiveScrollToBottomProps, type ThreadPrimitiveSuggestionProps, type ThreadPrimitiveViewportProps, type ThreadRuntime, type ThreadState, type ThreadViewportState, type ToolCallContentPart, type ToolCallContentPartComponent, type ToolCallContentPartProps, type UIContentPart, type UIContentPartComponent, type UIContentPartProps, type Unsubscribe, type UserContentPart, type UserMessage, makeAssistantTool, makeAssistantToolUI, useActionBarCopy, useActionBarEdit, useActionBarReload, useAppendMessage, useAssistantContext, useAssistantInstructions, useAssistantTool, useAssistantToolUI, useBranchPickerCount, useBranchPickerNext, useBranchPickerNumber, useBranchPickerPrevious, useComposerCancel, useComposerContext, useComposerIf, useComposerSend, useContentPartContext, useContentPartDisplay, useContentPartImage, useContentPartText, useLocalRuntime, useMessageContext, useMessageIf, useSwitchToNewThread, useThreadContext, useThreadEmpty, useThreadIf, useThreadScrollToBottom, useThreadSuggestion };