@assistant-ui/react 0.2.3 → 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,14 +422,16 @@ 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
+ declare const AssistantModalPrimitiveAnchor: react.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverAnchorProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
432
+
431
433
  declare namespace index$5 {
432
- export { AssistantModalPrimitiveContent as Content, AssistantModalPrimitiveRoot as Root, AssistantModalPrimitiveTrigger as Trigger };
434
+ export { AssistantModalPrimitiveAnchor as Anchor, AssistantModalPrimitiveContent as Content, AssistantModalPrimitiveRoot as Root, AssistantModalPrimitiveTrigger as Trigger };
433
435
  }
434
436
 
435
437
  type BranchPickerPrimitiveNextProps = ActionButtonProps<typeof useBranchPickerNext>;
@@ -454,14 +456,14 @@ declare const BranchPickerPrimitiveNumber: FC<BranchPickerPrimitiveNumberProps>;
454
456
 
455
457
  type PrimitiveDivProps$3 = ComponentPropsWithoutRef<typeof Primitive.div>;
456
458
  type BranchPickerPrimitiveRootProps = PrimitiveDivProps$3 & {
457
- hideWhenSingleBranch?: boolean;
459
+ hideWhenSingleBranch?: boolean | undefined;
458
460
  };
459
461
  declare const BranchPickerPrimitiveRoot: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
460
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;
461
463
  } & {
462
464
  asChild?: boolean;
463
465
  }, "ref"> & {
464
- hideWhenSingleBranch?: boolean;
466
+ hideWhenSingleBranch?: boolean | undefined;
465
467
  } & react.RefAttributes<HTMLDivElement>>;
466
468
 
467
469
  declare namespace index$4 {
@@ -477,10 +479,10 @@ declare const ComposerPrimitiveRoot: react.ForwardRefExoticComponent<Omit<Omit<r
477
479
  }, "ref"> & react.RefAttributes<HTMLFormElement>>;
478
480
 
479
481
  type ComposerPrimitiveInputProps = TextareaAutosizeProps & {
480
- asChild?: boolean;
482
+ asChild?: boolean | undefined;
481
483
  };
482
484
  declare const ComposerPrimitiveInput: react.ForwardRefExoticComponent<TextareaAutosizeProps & {
483
- asChild?: boolean;
485
+ asChild?: boolean | undefined;
484
486
  } & react.RefAttributes<HTMLTextAreaElement>>;
485
487
 
486
488
  type PrimitiveButtonProps = ComponentPropsWithoutRef<typeof Primitive.button>;
@@ -505,12 +507,9 @@ declare namespace index$3 {
505
507
  export { ComposerPrimitiveCancel as Cancel, ComposerPrimitiveIf as If, ComposerPrimitiveInput as Input, ComposerPrimitiveRoot as Root, ComposerPrimitiveSend as Send };
506
508
  }
507
509
 
508
- type ContentPartPrimitiveInProgressIndicatorProps = {};
509
- declare const ContentPartPrimitiveInProgressIndicator: FC<ContentPartPrimitiveInProgressIndicatorProps>;
510
-
511
- type PrimitiveSpanProps$1 = ComponentPropsWithoutRef<typeof Primitive.p>;
510
+ type PrimitiveSpanProps$1 = ComponentPropsWithoutRef<typeof Primitive.span>;
512
511
  type ContentPartPrimitiveTextProps = Omit<PrimitiveSpanProps$1, "children">;
513
- declare const ContentPartPrimitiveText: react.ForwardRefExoticComponent<ContentPartPrimitiveTextProps & react.RefAttributes<HTMLParagraphElement>>;
512
+ declare const ContentPartPrimitiveText: react.ForwardRefExoticComponent<ContentPartPrimitiveTextProps & react.RefAttributes<HTMLSpanElement>>;
514
513
 
515
514
  type PrimitiveImageProps = ComponentPropsWithoutRef<typeof Primitive.img>;
516
515
  type ContentPartPrimitiveImageProps = PrimitiveImageProps;
@@ -523,8 +522,11 @@ declare const ContentPartPrimitiveImage: react.ForwardRefExoticComponent<Omit<Om
523
522
  type ContentPartPrimitiveDisplayProps = {};
524
523
  declare const ContentPartPrimitiveDisplay: FC<ContentPartPrimitiveDisplayProps>;
525
524
 
525
+ type ContentPartPrimitiveInProgressProps = PropsWithChildren;
526
+ declare const ContentPartPrimitiveInProgress: FC<ContentPartPrimitiveInProgressProps>;
527
+
526
528
  declare namespace index$2 {
527
- 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 };
528
530
  }
529
531
 
530
532
  type PrimitiveDivProps$2 = ComponentPropsWithoutRef<typeof Primitive.div>;
@@ -540,24 +542,23 @@ declare const MessagePrimitiveIf: FC<MessagePrimitiveIfProps>;
540
542
 
541
543
  type MessagePrimitiveContentProps = {
542
544
  components?: {
543
- Text?: TextContentPartComponent;
544
- Image?: ImageContentPartComponent;
545
- UI?: UIContentPartComponent;
545
+ Text?: TextContentPartComponent | undefined;
546
+ Image?: ImageContentPartComponent | undefined;
547
+ UI?: UIContentPartComponent | undefined;
546
548
  tools?: {
547
- by_name?: Record<string, ToolCallContentPartComponent>;
548
- Fallback?: ComponentType<ToolCallContentPartProps>;
549
+ by_name?: Record<string, ToolCallContentPartComponent | undefined> | undefined;
550
+ Fallback?: ComponentType<ToolCallContentPartProps> | undefined;
549
551
  };
550
- };
552
+ } | undefined;
551
553
  };
552
554
  declare const MessagePrimitiveContent: FC<MessagePrimitiveContentProps>;
553
555
 
554
556
  type PrimitiveSpanProps = ComponentPropsWithoutRef<typeof Primitive.span>;
555
557
  type MessagePrimitiveInProgressProps = PrimitiveSpanProps;
556
- declare const MessagePrimitiveInProgress: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
557
- 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;
558
- } & {
559
- asChild?: boolean;
560
- }, "ref"> & react.RefAttributes<HTMLSpanElement>>;
558
+ /**
559
+ * @deprecated Define a custom Text renderer via ContentPartPrimitiveInProgress instead.
560
+ */
561
+ declare const MessagePrimitiveInProgress: FC<MessagePrimitiveInProgressProps>;
561
562
 
562
563
  declare namespace index$1 {
563
564
  export { MessagePrimitiveContent as Content, MessagePrimitiveIf as If, MessagePrimitiveInProgress as InProgress, MessagePrimitiveRoot as Root };
@@ -594,13 +595,13 @@ declare const ThreadPrimitiveViewport: react.ForwardRefExoticComponent<Omit<Omit
594
595
  type ThreadPrimitiveMessagesProps = {
595
596
  components: {
596
597
  Message: ComponentType;
597
- UserMessage?: ComponentType;
598
- EditComposer?: ComponentType;
599
- AssistantMessage?: ComponentType;
598
+ UserMessage?: ComponentType | undefined;
599
+ EditComposer?: ComponentType | undefined;
600
+ AssistantMessage?: ComponentType | undefined;
600
601
  } | {
601
- Message?: ComponentType;
602
+ Message?: ComponentType | undefined;
602
603
  UserMessage: ComponentType;
603
- EditComposer?: ComponentType;
604
+ EditComposer?: ComponentType | undefined;
604
605
  AssistantMessage: ComponentType;
605
606
  };
606
607
  };
@@ -618,11 +619,7 @@ declare const ThreadPrimitiveSuggestion: react.ForwardRefExoticComponent<Omit<Om
618
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;
619
620
  } & {
620
621
  asChild?: boolean;
621
- }, "ref"> & {
622
- prompt: string;
623
- method: "replace";
624
- autoSend?: boolean;
625
- } & react.RefAttributes<HTMLButtonElement>>;
622
+ }, "ref"> & UseApplyThreadSuggestionProps & react.RefAttributes<HTMLButtonElement>>;
626
623
 
627
624
  declare namespace index {
628
625
  export { ThreadPrimitiveEmpty as Empty, ThreadPrimitiveIf as If, ThreadPrimitiveMessages as Messages, ThreadPrimitiveRoot as Root, ThreadPrimitiveScrollToBottom as ScrollToBottom, ThreadPrimitiveSuggestion as Suggestion, ThreadPrimitiveViewport as Viewport };
@@ -658,4 +655,4 @@ declare namespace internal {
658
655
  export { internal_BaseAssistantRuntime as BaseAssistantRuntime, internal_MessageRepository as MessageRepository, internal_ProxyConfigProvider as ProxyConfigProvider };
659
656
  }
660
657
 
661
- 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,14 +422,16 @@ 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
+ declare const AssistantModalPrimitiveAnchor: react.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverAnchorProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
432
+
431
433
  declare namespace index$5 {
432
- export { AssistantModalPrimitiveContent as Content, AssistantModalPrimitiveRoot as Root, AssistantModalPrimitiveTrigger as Trigger };
434
+ export { AssistantModalPrimitiveAnchor as Anchor, AssistantModalPrimitiveContent as Content, AssistantModalPrimitiveRoot as Root, AssistantModalPrimitiveTrigger as Trigger };
433
435
  }
434
436
 
435
437
  type BranchPickerPrimitiveNextProps = ActionButtonProps<typeof useBranchPickerNext>;
@@ -454,14 +456,14 @@ declare const BranchPickerPrimitiveNumber: FC<BranchPickerPrimitiveNumberProps>;
454
456
 
455
457
  type PrimitiveDivProps$3 = ComponentPropsWithoutRef<typeof Primitive.div>;
456
458
  type BranchPickerPrimitiveRootProps = PrimitiveDivProps$3 & {
457
- hideWhenSingleBranch?: boolean;
459
+ hideWhenSingleBranch?: boolean | undefined;
458
460
  };
459
461
  declare const BranchPickerPrimitiveRoot: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
460
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;
461
463
  } & {
462
464
  asChild?: boolean;
463
465
  }, "ref"> & {
464
- hideWhenSingleBranch?: boolean;
466
+ hideWhenSingleBranch?: boolean | undefined;
465
467
  } & react.RefAttributes<HTMLDivElement>>;
466
468
 
467
469
  declare namespace index$4 {
@@ -477,10 +479,10 @@ declare const ComposerPrimitiveRoot: react.ForwardRefExoticComponent<Omit<Omit<r
477
479
  }, "ref"> & react.RefAttributes<HTMLFormElement>>;
478
480
 
479
481
  type ComposerPrimitiveInputProps = TextareaAutosizeProps & {
480
- asChild?: boolean;
482
+ asChild?: boolean | undefined;
481
483
  };
482
484
  declare const ComposerPrimitiveInput: react.ForwardRefExoticComponent<TextareaAutosizeProps & {
483
- asChild?: boolean;
485
+ asChild?: boolean | undefined;
484
486
  } & react.RefAttributes<HTMLTextAreaElement>>;
485
487
 
486
488
  type PrimitiveButtonProps = ComponentPropsWithoutRef<typeof Primitive.button>;
@@ -505,12 +507,9 @@ declare namespace index$3 {
505
507
  export { ComposerPrimitiveCancel as Cancel, ComposerPrimitiveIf as If, ComposerPrimitiveInput as Input, ComposerPrimitiveRoot as Root, ComposerPrimitiveSend as Send };
506
508
  }
507
509
 
508
- type ContentPartPrimitiveInProgressIndicatorProps = {};
509
- declare const ContentPartPrimitiveInProgressIndicator: FC<ContentPartPrimitiveInProgressIndicatorProps>;
510
-
511
- type PrimitiveSpanProps$1 = ComponentPropsWithoutRef<typeof Primitive.p>;
510
+ type PrimitiveSpanProps$1 = ComponentPropsWithoutRef<typeof Primitive.span>;
512
511
  type ContentPartPrimitiveTextProps = Omit<PrimitiveSpanProps$1, "children">;
513
- declare const ContentPartPrimitiveText: react.ForwardRefExoticComponent<ContentPartPrimitiveTextProps & react.RefAttributes<HTMLParagraphElement>>;
512
+ declare const ContentPartPrimitiveText: react.ForwardRefExoticComponent<ContentPartPrimitiveTextProps & react.RefAttributes<HTMLSpanElement>>;
514
513
 
515
514
  type PrimitiveImageProps = ComponentPropsWithoutRef<typeof Primitive.img>;
516
515
  type ContentPartPrimitiveImageProps = PrimitiveImageProps;
@@ -523,8 +522,11 @@ declare const ContentPartPrimitiveImage: react.ForwardRefExoticComponent<Omit<Om
523
522
  type ContentPartPrimitiveDisplayProps = {};
524
523
  declare const ContentPartPrimitiveDisplay: FC<ContentPartPrimitiveDisplayProps>;
525
524
 
525
+ type ContentPartPrimitiveInProgressProps = PropsWithChildren;
526
+ declare const ContentPartPrimitiveInProgress: FC<ContentPartPrimitiveInProgressProps>;
527
+
526
528
  declare namespace index$2 {
527
- 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 };
528
530
  }
529
531
 
530
532
  type PrimitiveDivProps$2 = ComponentPropsWithoutRef<typeof Primitive.div>;
@@ -540,24 +542,23 @@ declare const MessagePrimitiveIf: FC<MessagePrimitiveIfProps>;
540
542
 
541
543
  type MessagePrimitiveContentProps = {
542
544
  components?: {
543
- Text?: TextContentPartComponent;
544
- Image?: ImageContentPartComponent;
545
- UI?: UIContentPartComponent;
545
+ Text?: TextContentPartComponent | undefined;
546
+ Image?: ImageContentPartComponent | undefined;
547
+ UI?: UIContentPartComponent | undefined;
546
548
  tools?: {
547
- by_name?: Record<string, ToolCallContentPartComponent>;
548
- Fallback?: ComponentType<ToolCallContentPartProps>;
549
+ by_name?: Record<string, ToolCallContentPartComponent | undefined> | undefined;
550
+ Fallback?: ComponentType<ToolCallContentPartProps> | undefined;
549
551
  };
550
- };
552
+ } | undefined;
551
553
  };
552
554
  declare const MessagePrimitiveContent: FC<MessagePrimitiveContentProps>;
553
555
 
554
556
  type PrimitiveSpanProps = ComponentPropsWithoutRef<typeof Primitive.span>;
555
557
  type MessagePrimitiveInProgressProps = PrimitiveSpanProps;
556
- declare const MessagePrimitiveInProgress: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
557
- 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;
558
- } & {
559
- asChild?: boolean;
560
- }, "ref"> & react.RefAttributes<HTMLSpanElement>>;
558
+ /**
559
+ * @deprecated Define a custom Text renderer via ContentPartPrimitiveInProgress instead.
560
+ */
561
+ declare const MessagePrimitiveInProgress: FC<MessagePrimitiveInProgressProps>;
561
562
 
562
563
  declare namespace index$1 {
563
564
  export { MessagePrimitiveContent as Content, MessagePrimitiveIf as If, MessagePrimitiveInProgress as InProgress, MessagePrimitiveRoot as Root };
@@ -594,13 +595,13 @@ declare const ThreadPrimitiveViewport: react.ForwardRefExoticComponent<Omit<Omit
594
595
  type ThreadPrimitiveMessagesProps = {
595
596
  components: {
596
597
  Message: ComponentType;
597
- UserMessage?: ComponentType;
598
- EditComposer?: ComponentType;
599
- AssistantMessage?: ComponentType;
598
+ UserMessage?: ComponentType | undefined;
599
+ EditComposer?: ComponentType | undefined;
600
+ AssistantMessage?: ComponentType | undefined;
600
601
  } | {
601
- Message?: ComponentType;
602
+ Message?: ComponentType | undefined;
602
603
  UserMessage: ComponentType;
603
- EditComposer?: ComponentType;
604
+ EditComposer?: ComponentType | undefined;
604
605
  AssistantMessage: ComponentType;
605
606
  };
606
607
  };
@@ -618,11 +619,7 @@ declare const ThreadPrimitiveSuggestion: react.ForwardRefExoticComponent<Omit<Om
618
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;
619
620
  } & {
620
621
  asChild?: boolean;
621
- }, "ref"> & {
622
- prompt: string;
623
- method: "replace";
624
- autoSend?: boolean;
625
- } & react.RefAttributes<HTMLButtonElement>>;
622
+ }, "ref"> & UseApplyThreadSuggestionProps & react.RefAttributes<HTMLButtonElement>>;
626
623
 
627
624
  declare namespace index {
628
625
  export { ThreadPrimitiveEmpty as Empty, ThreadPrimitiveIf as If, ThreadPrimitiveMessages as Messages, ThreadPrimitiveRoot as Root, ThreadPrimitiveScrollToBottom as ScrollToBottom, ThreadPrimitiveSuggestion as Suggestion, ThreadPrimitiveViewport as Viewport };
@@ -658,4 +655,4 @@ declare namespace internal {
658
655
  export { internal_BaseAssistantRuntime as BaseAssistantRuntime, internal_MessageRepository as MessageRepository, internal_ProxyConfigProvider as ProxyConfigProvider };
659
656
  }
660
657
 
661
- 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 };